[
  {
    "path": ".gitattributes",
    "content": "*.h linguist-language=Assembly\n*.hpp linguist-language=C++\n*.c linguist-language=C\n*.cpp linguist-language=C++\n"
  },
  {
    "path": ".gitignore",
    "content": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n##\n## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore\n\n# User-specific files\n*.rsuser\n*.suo\n*.user\n*.userosscache\n*.sln.docstates\n\n# User-specific files (MonoDevelop/Xamarin Studio)\n*.userprefs\n\n# Mono auto generated files\nmono_crash.*\n\n# Build results\n[Dd]ebug/\n[Dd]ebugPublic/\n[Rr]elease/\n[Rr]eleases/\nRiotGamesServers/\nChinaServer/\nx64/\nx86/\n[Aa][Rr][Mm]/\n[Aa][Rr][Mm]64/\nbld/\n[Bb]in/\n[Oo]bj/\n[Ll]og/\n[Ll]ogs/\n\n# Visual Studio 2015/2017 cache/options directory\n.vs/\n# Uncomment if you have tasks that create the project's static files in wwwroot\n#wwwroot/\n\n# Visual Studio 2017 auto generated files\nGenerated\\ Files/\n\n# MSTest test Results\n[Tt]est[Rr]esult*/\n[Bb]uild[Ll]og.*\n\n# NUnit\n*.VisualState.xml\nTestResult.xml\nnunit-*.xml\n\n# Build Results of an ATL Project\n[Dd]ebugPS/\n[Rr]eleasePS/\ndlldata.c\n\n# Benchmark Results\nBenchmarkDotNet.Artifacts/\n\n# .NET Core\nproject.lock.json\nproject.fragment.lock.json\nartifacts/\n\n# StyleCop\nStyleCopReport.xml\n\n# Files built by Visual Studio\n*_i.c\n*_p.c\n*_h.h\n*.ilk\n*.meta\n*.obj\n*.iobj\n*.pch\n*.pdb\n*.ipdb\n*.pgc\n*.pgd\n*.rsp\n*.sbr\n*.tlb\n*.tli\n*.tlh\n*.tmp\n*.tmp_proj\n*_wpftmp.csproj\n*.log\n*.vspscc\n*.vssscc\n.builds\n*.pidb\n*.svclog\n*.scc\n\n# Chutzpah Test files\n_Chutzpah*\n\n# Visual C++ cache files\nipch/\n*.aps\n*.ncb\n*.opendb\n*.opensdf\n*.sdf\n*.cachefile\n*.VC.db\n*.VC.VC.opendb\n\n# Visual Studio profiler\n*.psess\n*.vsp\n*.vspx\n*.sap\n\n# Visual Studio Trace Files\n*.e2e\n\n# TFS 2012 Local Workspace\n$tf/\n\n# Guidance Automation Toolkit\n*.gpState\n\n# ReSharper is a .NET coding add-in\n_ReSharper*/\n*.[Rr]e[Ss]harper\n*.DotSettings.user\n\n# TeamCity is a build add-in\n_TeamCity*\n\n# DotCover is a Code Coverage Tool\n*.dotCover\n\n# AxoCover is a Code Coverage Tool\n.axoCover/*\n!.axoCover/settings.json\n\n# Visual Studio code coverage results\n*.coverage\n*.coveragexml\n\n# NCrunch\n_NCrunch_*\n.*crunch*.local.xml\nnCrunchTemp_*\n\n# MightyMoose\n*.mm.*\nAutoTest.Net/\n\n# Web workbench (sass)\n.sass-cache/\n\n# Installshield output folder\n[Ee]xpress/\n\n# DocProject is a documentation generator add-in\nDocProject/buildhelp/\nDocProject/Help/*.HxT\nDocProject/Help/*.HxC\nDocProject/Help/*.hhc\nDocProject/Help/*.hhk\nDocProject/Help/*.hhp\nDocProject/Help/Html2\nDocProject/Help/html\n\n# Click-Once directory\npublish/\n\n# Publish Web Output\n*.[Pp]ublish.xml\n*.azurePubxml\n# Note: Comment the next line if you want to checkin your web deploy settings,\n# but database connection strings (with potential passwords) will be unencrypted\n*.pubxml\n*.publishproj\n\n# Microsoft Azure Web App publish settings. Comment the next line if you want to\n# checkin your Azure Web App publish settings, but sensitive information contained\n# in these scripts will be unencrypted\nPublishScripts/\n\n# NuGet Packages\n*.nupkg\n# NuGet Symbol Packages\n*.snupkg\n# The packages folder can be ignored because of Package Restore\n**/[Pp]ackages/*\n# except build/, which is used as an MSBuild target.\n!**/[Pp]ackages/build/\n# Uncomment if necessary however generally it will be regenerated when needed\n#!**/[Pp]ackages/repositories.config\n# NuGet v3's project.json files produces more ignorable files\n*.nuget.props\n*.nuget.targets\n\n# Microsoft Azure Build Output\ncsx/\n*.build.csdef\n\n# Microsoft Azure Emulator\necf/\nrcf/\n\n# Windows Store app package directories and files\nAppPackages/\nBundleArtifacts/\nPackage.StoreAssociation.xml\n_pkginfo.txt\n*.appx\n*.appxbundle\n*.appxupload\n\n# Visual Studio cache files\n# files ending in .cache can be ignored\n*.[Cc]ache\n# but keep track of directories ending in .cache\n!?*.[Cc]ache/\n\n# Others\nClientBin/\n~$*\n*~\n*.dbmdl\n*.dbproj.schemaview\n*.jfm\n*.pfx\n*.publishsettings\norleans.codegen.cs\n\n# Including strong name files can present a security risk\n# (https://github.com/github/gitignore/pull/2483#issue-259490424)\n#*.snk\n\n# Since there are multiple workflows, uncomment next line to ignore bower_components\n# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)\n#bower_components/\n\n# RIA/Silverlight projects\nGenerated_Code/\n\n# Backup & report files from converting an old project file\n# to a newer Visual Studio version. Backup files are not needed,\n# because we have git ;-)\n_UpgradeReport_Files/\nBackup*/\nUpgradeLog*.XML\nUpgradeLog*.htm\nServiceFabricBackup/\n*.rptproj.bak\n\n# SQL Server files\n*.mdf\n*.ldf\n*.ndf\n\n# Business Intelligence projects\n*.rdl.data\n*.bim.layout\n*.bim_*.settings\n*.rptproj.rsuser\n*- [Bb]ackup.rdl\n*- [Bb]ackup ([0-9]).rdl\n*- [Bb]ackup ([0-9][0-9]).rdl\n\n# Microsoft Fakes\nFakesAssemblies/\n\n# GhostDoc plugin setting file\n*.GhostDoc.xml\n\n# Node.js Tools for Visual Studio\n.ntvs_analysis.dat\nnode_modules/\n\n# Visual Studio 6 build log\n*.plg\n\n# Visual Studio 6 workspace options file\n*.opt\n\n# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)\n*.vbw\n\n# Visual Studio LightSwitch build output\n**/*.HTMLClient/GeneratedArtifacts\n**/*.DesktopClient/GeneratedArtifacts\n**/*.DesktopClient/ModelManifest.xml\n**/*.Server/GeneratedArtifacts\n**/*.Server/ModelManifest.xml\n_Pvt_Extensions\n\n# Paket dependency manager\n.paket/paket.exe\npaket-files/\n\n# FAKE - F# Make\n.fake/\n\n# CodeRush personal settings\n.cr/personal\n\n# Python Tools for Visual Studio (PTVS)\n__pycache__/\n*.pyc\n\n# Cake - Uncomment if you are using it\n# tools/**\n# !tools/packages.config\n\n# Tabs Studio\n*.tss\n\n# Telerik's JustMock configuration file\n*.jmconfig\n\n# BizTalk build output\n*.btp.cs\n*.btm.cs\n*.odx.cs\n*.xsd.cs\n\n# OpenCover UI analysis results\nOpenCover/\n\n# Azure Stream Analytics local run output\nASALocalRun/\n\n# MSBuild Binary and Structured Log\n*.binlog\n\n# NVidia Nsight GPU debugger configuration file\n*.nvuser\n\n# MFractors (Xamarin productivity tool) working folder\n.mfractor/\n\n# Local History for Visual Studio\n.localhistory/\n\n# BeatPulse healthcheck temp database\nhealthchecksdb\n\n# Backup folder for Package Reference Convert tool in Visual Studio 2017\nMigrationBackup/\n\n# Ionide (cross platform F# VS Code tools) working folder\n.ionide/\n"
  },
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2021-2023 R3nzTheCodeGOD and B3akers\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "PythonScripts/lolskin_to_skin.py",
    "content": "import configparser\nimport json\nimport os\n\n\ndef skin_to_dictionary(path):\n    config = configparser.ConfigParser()\n\n    config.read(path, encoding=\"utf-8\")\n    ini_dict = {}\n    for key, values in config.items():\n        ini_dict[key] = dict(config.items(key))\n        print(values)\n    lolskin_hero_skin = ini_dict[\"SKIN_CHAMPION_ACTIVED\"]\n    del lolskin_hero_skin['custom_file']\n\n    return lolskin_hero_skin\n\n\ndef forward_data(lolskin_hero_skin: dict):\n    # Convert lolskin's skin data to R3nzSkin\n    dict_from_list = {}\n\n    for key, value in lolskin_hero_skin.items():\n        key = key.capitalize()\n        key = key + \".current_combo_skin_index\"\n        value = int(value) + int(1)\n        dict_from_list[key] = value\n\n    return dict_from_list\n\n\n\nif __name__ == '__main__':\n    LOLSKIN_CONFIG_PATH = r\"C:\\Fraps\\data\\My\\Config.ini\"\n\n    if os.path.exists(LOLSKIN_CONFIG_PATH):\n        hero_skin = skin_to_dictionary(LOLSKIN_CONFIG_PATH)\n    else:\n        LOLSKIN_CONFIG_PATH = input(\n            \"lolskin Configuration file path Example:\\t\" + LOLSKIN_CONFIG_PATH + \"\\n\")\n    to_skin = forward_data(lolskin_hero_skin=hero_skin)\n\n    json_str = json.dumps(to_skin)\n    print(\"JSON 对象：\", json_str)\n    with open('data.json', 'w', encoding=\"utf-8\") as fp:\n        json.dump(to_skin, fp)"
  },
  {
    "path": "R3nzSkin/CheatManager.hpp",
    "content": "#pragma once\n\n#include <memory>\n\n#include \"Config.hpp\"\n#include \"GUI.hpp\"\n#include \"Hooks.hpp\"\n#include \"Logger.hpp\"\n#include \"Memory.hpp\"\n#include \"SkinDatabase.hpp\"\n\nclass CheatManager {\npublic:\n\tvoid start() noexcept\n\t{\n\t\tthis->hooks = std::make_unique<Hooks>();\n\t\tthis->config = std::make_unique<Config>();\n\t\tthis->gui = std::make_unique<GUI>();\n\t\tthis->memory = std::make_unique<Memory>();\n\t\tthis->database = std::make_unique<SkinDatabase>();\n\t\tthis->logger = std::make_unique<R3nzSkinLogger>();\n\t}\n\n\tbool cheatState{ true };\n\tstd::unique_ptr<Hooks> hooks;\n\tstd::unique_ptr<Config> config;\n\tstd::unique_ptr<GUI> gui;\n\tstd::unique_ptr<Memory> memory;\n\tstd::unique_ptr<SkinDatabase> database;\n\tstd::unique_ptr<R3nzSkinLogger> logger;\n};\n\ninline CheatManager cheatManager;\n"
  },
  {
    "path": "R3nzSkin/Config.cpp",
    "content": "#include <fstream>\n#include <string>\n#include <system_error>\n\n#include <Windows.h>\n#include <ShlObj.h>\n\n#include \"Json/json.hpp\"\n\n#include \"CheatManager.hpp\"\n#include \"Memory.hpp\"\n#include \"Utils.hpp\"\n\nvoid Config::init() noexcept\n{\n\tif (PWSTR pathToDocuments; SUCCEEDED(SHGetKnownFolderPath(FOLDERID_Documents, 0, nullptr, &pathToDocuments))) {\n\t\tthis->path = pathToDocuments;\n\t\tCoTaskMemFree(pathToDocuments);\n\t}\n\n\tthis->path /= \"R3nzSkin\";\n}\n\nvoid Config::save() noexcept\n{\n\tconst auto player{ cheatManager.memory->localPlayer };\n\tstd::error_code ec;\n\tstd::filesystem::create_directory(this->path, ec);\n\tauto out{ std::ofstream(this->path / u8\"R3nzSkin64\")};\n\n\tif (!out.good())\n\t\treturn;\n\n\tif (player)\n\t\tconfig_json[std::string(player->get_character_data_stack()->base_skin.model.str) + \".current_combo_skin_index\"] = this->current_combo_skin_index;\n\n\tconfig_json[\"menuKey\"] = this->menuKey.toString();\n\tconfig_json[\"nextSkinKey\"] = this->nextSkinKey.toString();\n\tconfig_json[\"previousSkinKey\"] = this->previousSkinKey.toString();\n\tconfig_json[\"heroName\"] = this->heroName;\n\tconfig_json[\"raibowText\"] = this->rainbowText;\n\tconfig_json[\"quickSkinChange\"] = this->quickSkinChange;\n\tconfig_json[\"fontScale\"] = this->fontScale;\n\tconfig_json[\"current_combo_ward_index\"] = this->current_combo_ward_index;\n\tconfig_json[\"current_ward_skin_index\"] = this->current_ward_skin_index;\n\tconfig_json[\"current_minion_skin_index\"] = this->current_minion_skin_index;\n\n\tfor (const auto& [fst, snd] : this->current_combo_ally_skin_index)\n\t\tconfig_json[\"current_combo_ally_skin_index\"][std::to_string(fst)] = snd;\n\n\tfor (const auto& [fst, snd] : this->current_combo_enemy_skin_index)\n\t\tconfig_json[\"current_combo_enemy_skin_index\"][std::to_string(fst)] = snd;\n\n\tfor (const auto& [fst, snd] : this->current_combo_jungle_mob_skin_index)\n\t\tconfig_json[\"current_combo_jungle_mob_skin_index\"][std::to_string(fst)] = snd;\n\n\tout << config_json.dump();\n\tout.close();\n}\n\nvoid Config::load() noexcept\n{\n\tconst auto player{ cheatManager.memory->localPlayer };\n\tauto in{ std::ifstream(this->path / u8\"R3nzSkin64\") };\n\n\tif (!in.good())\n\t\treturn;\n\n\tif (json j{ json::parse(in, nullptr, false, true) }; j.is_discarded())\n\t\treturn;\n\telse\n\t\tconfig_json = j;\n\n\tif (player)\n\t\tthis->current_combo_skin_index = config_json.value(std::string(player->get_character_data_stack()->base_skin.model.str) + \".current_combo_skin_index\", 0);\n\n\tthis->menuKey = KeyBind(config_json.value(\"menuKey\", \"INSERT\").c_str());\n\tthis->nextSkinKey = KeyBind(config_json.value(\"nextSkinKey\", \"PAGE_UP\").c_str());\n\tthis->previousSkinKey = KeyBind(config_json.value(\"previousSkinKey\", \"PAGE_DOWN\").c_str());\n\tthis->heroName = config_json.value(\"heroName\", true);\n\tthis->rainbowText = config_json.value(\"raibowText\", false);\n\tthis->quickSkinChange = config_json.value(\"quickSkinChange\", true);\n\tthis->fontScale = config_json.value(\"fontScale\", 1.0f);\n\tthis->current_combo_ward_index = config_json.value(\"current_combo_ward_index\", 0);\n\tthis->current_ward_skin_index = config_json.value(\"current_ward_skin_index\", -1);\n\tthis->current_minion_skin_index = config_json.value(\"current_minion_skin_index\", -1);\n\n\tconst auto ally_skins{ config_json.find(\"current_combo_ally_skin_index\") };\n\tif (ally_skins != config_json.end())\n\t\tfor (const auto& it : ally_skins.value().items())\n\t\t\tthis->current_combo_ally_skin_index[std::stoull(it.key())] = it.value().get<std::int32_t>();\n\n\tconst auto enemy_skins{ config_json.find(\"current_combo_enemy_skin_index\") };\n\tif (enemy_skins != config_json.end())\n\t\tfor (const auto& it : enemy_skins.value().items())\n\t\t\tthis->current_combo_enemy_skin_index[std::stoull(it.key())] = it.value().get<std::int32_t>();\n\n\tconst auto jungle_mobs_skins{ config_json.find(\"current_combo_jungle_mob_skin_index\") };\n\tif (jungle_mobs_skins != config_json.end())\n\t\tfor (const auto& it : jungle_mobs_skins.value().items())\n\t\t\tthis->current_combo_jungle_mob_skin_index[std::stoull(it.key())] = it.value().get<std::int32_t>();\n\n\tin.close();\n}\n\nvoid Config::reset() noexcept\n{\n\tthis->menuKey = KeyBind(KeyBind::INSERT);\n\tthis->nextSkinKey = KeyBind(KeyBind::PAGE_UP);\n\tthis->previousSkinKey = KeyBind(KeyBind::PAGE_DOWN);\n\tthis->heroName = true;\n\tthis->rainbowText = true;\n\tthis->quickSkinChange = false;\n\tthis->fontScale = 1.0f;\n\tthis->current_combo_skin_index = 0;\n\tthis->current_combo_ward_index = 0;\n\tthis->current_combo_minion_index = 0;\n\tthis->current_minion_skin_index = -1;\n\tthis->current_ward_skin_index = -1;\n\tthis->current_combo_order_turret_index = 0;\n\tthis->current_combo_chaos_turret_index = 0;\n\tthis->current_combo_ally_skin_index.clear();\n\tthis->current_combo_enemy_skin_index.clear();\n\tthis->current_combo_jungle_mob_skin_index.clear();\n}\n"
  },
  {
    "path": "R3nzSkin/Config.hpp",
    "content": "#pragma once\n\n#include <cstdint>\n#include <filesystem>\n#include <map>\n\n#include \"json/json.hpp\"\n\n#include \"Utils.hpp\"\n\nusing json = nlohmann::json;\n\nclass Config {\npublic:\n\tvoid init() noexcept;\n\tvoid save() noexcept;\n\tvoid load() noexcept;\n\tvoid reset() noexcept;\n\n\tKeyBind menuKey{ KeyBind(KeyBind::INSERT) };\n\tKeyBind nextSkinKey{ KeyBind(KeyBind::PAGE_UP) };\n\tKeyBind previousSkinKey{ KeyBind(KeyBind::PAGE_DOWN) };\n\tbool rainbowText{ false };\n\tfloat fontScale{ 1.0f };\n\tbool heroName{ true };\n\tbool quickSkinChange{ false };\n\t// player\n\tstd::int32_t current_combo_skin_index{ 0 };\n\n\t// minion\n\tstd::int32_t current_combo_minion_index{ 0 };\n\tstd::int32_t current_minion_skin_index{ -1 };\n\n\t// ward\n\tstd::int32_t current_combo_ward_index{ 0 };\n\tstd::int32_t current_ward_skin_index{ -1 };\n\n\t// turrets, don't save them in config\n\tstd::int32_t current_combo_order_turret_index{ 0 };\n\tstd::int32_t current_combo_chaos_turret_index{ 0 };\n\n\t// other champions\n\tstd::map<std::uint64_t, std::int32_t> current_combo_ally_skin_index;\n\tstd::map<std::uint64_t, std::int32_t> current_combo_enemy_skin_index;\n\n\t// jungle mobs\n\tstd::map<std::uint64_t, std::int32_t> current_combo_jungle_mob_skin_index;\nprivate:\n\tstd::filesystem::path path;\n\tjson config_json{ json() };\n};\n"
  },
  {
    "path": "R3nzSkin/GUI.cpp",
    "content": "#include <algorithm>\n#include <cstdio>\n#include <string>\n#include <vector>\n\n#include \"CheatManager.hpp\"\n#include \"GUI.hpp\"\n\n#include <ranges>\n\n#include \"Memory.hpp\"\n#include \"SkinDatabase.hpp\"\n#include \"Utils.hpp\"\n#include \"fnv_hash.hpp\"\n#include \"imgui/imgui.h\"\n\ninline static void footer() noexcept\n{\n\tusing namespace std::string_literals;\n\tstatic const auto buildText{ \"Last Build: \"s + __DATE__ + \" - \" + __TIME__ };\n\tImGui::Separator();\n\tImGui::textUnformattedCentered(buildText.c_str());\n\tImGui::textUnformattedCentered(\"Copyright (C) 2021-2024 R3nzTheCodeGOD\");\n}\n\nstatic void changeTurretSkin(const std::int32_t skinId, const std::int32_t team) noexcept\n{\n\tif (skinId == -1)\n\t\treturn;\n\n\tconst auto turrets{ cheatManager.memory->turretList };\n\tconst auto playerTeam{ cheatManager.memory->localPlayer->get_team() };\n\n\tfor (auto i{ 0u }; i < turrets->length; ++i) {\n\t\tif (const auto turret{ turrets->list[i] }; turret->get_team() == team) {\n\t\t\tif (playerTeam == team) {\n\t\t\t\tturret->get_character_data_stack()->base_skin.skin = skinId * 2;\n\t\t\t\tturret->get_character_data_stack()->update(true);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tturret->get_character_data_stack()->base_skin.skin = skinId * 2 + 1;\n\t\t\t\tturret->get_character_data_stack()->update(true);\n\t\t\t}\n\t\t}\n\t}\n}\n\nvoid GUI::render() noexcept\n{\n\tstd::call_once(set_font_scale, [&]\n\t\t{\n\t\t\tImGui::GetIO().FontGlobalScale = cheatManager.config->fontScale;\n\t\t});\n\n\tconst auto player{ cheatManager.memory->localPlayer };\n\tconst auto heroes{ cheatManager.memory->heroList };\n\tstatic const auto my_team{ player ? player->get_team() : 100 };\n\tstatic int gear{ player ? player->get_character_data_stack()->base_skin.gear : 0 };\n\n\tstatic const auto vector_getter_skin = [](void* vec, const std::int32_t idx, const char** out_text) noexcept {\n\t\tconst auto& vector{ *static_cast<std::vector<SkinDatabase::skin_info>*>(vec) };\n\t\tif (idx < 0 || idx > static_cast<std::int32_t>(vector.size())) return false;\n\t\t*out_text = idx == 0 ? \"Default\" : vector.at(idx - 1).skin_name.c_str();\n\t\treturn true;\n\t\t};\n\n\tstatic const auto vector_getter_ward_skin = [](void* vec, const std::int32_t idx, const char** out_text) noexcept {\n\t\tconst auto& vector{ *static_cast<std::vector<std::pair<std::int32_t, const char*>>*>(vec) };\n\t\tif (idx < 0 || idx > static_cast<std::int32_t>(vector.size())) return false;\n\t\t*out_text = idx == 0 ? \"Default\" : vector.at(idx - 1).second;\n\t\treturn true;\n\t\t};\n\n\tstatic auto vector_getter_gear = [](void* vec, const std::int32_t idx, const char** out_text) noexcept {\n\t\tconst auto& vector{ *static_cast<std::vector<const char*>*>(vec) };\n\t\tif (idx < 0 || idx > static_cast<std::int32_t>(vector.size())) return false;\n\t\t*out_text = vector[idx];\n\t\treturn true;\n\t\t};\n\n\tstatic auto vector_getter_default = [](void* vec, const std::int32_t idx, const char** out_text) noexcept {\n\t\tconst auto& vector{ *static_cast<std::vector<const char*>*>(vec) };\n\t\tif (idx < 0 || idx > static_cast<std::int32_t>(vector.size())) return false;\n\t\t*out_text = idx == 0 ? \"Default\" : vector.at(idx - 1);\n\t\treturn true;\n\t\t};\n\n\tImGui::Begin(\"R3nzSkin\", nullptr, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_AlwaysAutoResize);\n\t{\n\t\tImGui::rainbowText();\n\t\tif (ImGui::BeginTabBar(\"TabBar\", ImGuiTabBarFlags_Reorderable | ImGuiTabBarFlags_FittingPolicyScroll | ImGuiTabBarFlags_NoTooltip)) {\n\t\t\tif (player) {\n\t\t\t\tif (ImGui::BeginTabItem(\"Local Player\")) {\n\t\t\t\t\tauto& values{ cheatManager.database->champions_skins[fnv::hash_runtime(player->get_character_data_stack()->base_skin.model.str)] };\n\t\t\t\t\tImGui::Text(\"Player Skins Settings:\");\n\n\t\t\t\t\tif (ImGui::Combo(\"Current Skin\", &cheatManager.config->current_combo_skin_index, vector_getter_skin, static_cast<void*>(&values), values.size() + 1))\n\t\t\t\t\t\tif (cheatManager.config->current_combo_skin_index > 0)\n\t\t\t\t\t\t\tplayer->change_skin(values[cheatManager.config->current_combo_skin_index - 1].model_name, values[cheatManager.config->current_combo_skin_index - 1].skin_id);\n\n\t\t\t\t\tconst auto playerHash{ fnv::hash_runtime(player->get_character_data_stack()->base_skin.model.str) };\n\t\t\t\t\tif (const auto it{ std::ranges::find_if(cheatManager.database->specialSkins,\n\t\t\t\t\t[&skin = player->get_character_data_stack()->base_skin.skin, &ph = playerHash](const SkinDatabase::specialSkin& x) noexcept -> bool\n\t\t\t\t\t\t{\n\t\t\t\t\t\t   return x.champHash == ph && (x.skinIdStart <= skin && x.skinIdEnd >= skin);\n\t\t\t\t\t\t})\n\t\t\t\t\t\t}; it != cheatManager.database->specialSkins.end())\n\t\t\t\t\t{\n\t\t\t\t\t\tconst auto stack{ player->get_character_data_stack() };\n\t\t\t\t\t\tgear = stack->base_skin.gear;\n\n\t\t\t\t\t\tif (ImGui::Combo(\"Current Gear\", &gear, vector_getter_gear, static_cast<void*>(&it->gears), it->gears.size())) {\n\t\t\t\t\t\t\tplayer->get_character_data_stack()->base_skin.gear = static_cast<std::int8_t>(gear);\n\t\t\t\t\t\t\tplayer->get_character_data_stack()->update(true);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tImGui::Separator();\n\t\t\t\t\t}\n\n\t\t\t\t\tif (ImGui::Combo(\"Current Ward Skin\", &cheatManager.config->current_combo_ward_index, vector_getter_ward_skin, static_cast<void*>(&cheatManager.database->wards_skins), cheatManager.database->wards_skins.size() + 1))\n\t\t\t\t\t\tcheatManager.config->current_ward_skin_index = cheatManager.config->current_combo_ward_index == 0 ? -1 : cheatManager.database->wards_skins.at(cheatManager.config->current_combo_ward_index - 1).first;\n\t\t\t\t\tfooter();\n\t\t\t\t\tImGui::EndTabItem();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tstatic std::int32_t temp_heroes_length = heroes->length;\n\t\t\tif (temp_heroes_length > 1)\n\t\t\t{\n\t\t\t\tif (ImGui::BeginTabItem(\"Other Champs\")) {\n\t\t\t\t\tImGui::Text(\"Other Champs Skins Settings:\");\n\t\t\t\t\tstd::int32_t last_team{ 0 };\n\t\t\t\t\tfor (auto i{ 0u }; i < heroes->length; ++i) {\n\t\t\t\t\t\tconst auto hero{ heroes->list[i] };\n\n\t\t\t\t\t\tif (hero == player)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\n\t\t\t\t\t\tconst auto champion_name_hash{ fnv::hash_runtime(hero->get_character_data_stack()->base_skin.model.str) };\n\t\t\t\t\t\tif (champion_name_hash == FNV(\"PracticeTool_TargetDummy\"))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttemp_heroes_length = heroes->length - 1;\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst auto hero_team{ hero->get_team() };\n\t\t\t\t\t\tconst auto is_enemy{ hero_team != my_team };\n\n\t\t\t\t\t\tif (last_team == 0 || hero_team != last_team) {\n\t\t\t\t\t\t\tif (last_team != 0)\n\t\t\t\t\t\t\t\tImGui::Separator();\n\t\t\t\t\t\t\tif (is_enemy)\n\t\t\t\t\t\t\t\tImGui::Text(\" Enemy champions\");\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tImGui::Text(\" Ally champions\");\n\t\t\t\t\t\t\tlast_team = hero_team;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tauto& config_array{ is_enemy ? cheatManager.config->current_combo_enemy_skin_index : cheatManager.config->current_combo_ally_skin_index };\n\t\t\t\t\t\tconst auto [fst, snd] { config_array.insert({ champion_name_hash, 0 }) };\n\n\t\t\t\t\t\tstd::snprintf(this->str_buffer, sizeof(this->str_buffer), cheatManager.config->heroName ? \"HeroName: [ %s ]##%X\" : \"PlayerName: [ %s ]##%X\", cheatManager.config->heroName ? hero->get_character_data_stack()->base_skin.model.str : hero->get_name()->c_str(), reinterpret_cast<std::uintptr_t>(hero));\n\n\t\t\t\t\t\tauto& values{ cheatManager.database->champions_skins[champion_name_hash] };\n\t\t\t\t\t\tif (ImGui::Combo(str_buffer, &fst->second, vector_getter_skin, static_cast<void*>(&values), values.size() + 1))\n\t\t\t\t\t\t\tif (fst->second > 0)\n\t\t\t\t\t\t\t\thero->change_skin(values[fst->second - 1].model_name, values[fst->second - 1].skin_id);\n\t\t\t\t\t}\n\t\t\t\t\tfooter();\n\t\t\t\t\tImGui::EndTabItem();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (ImGui::BeginTabItem(\"Global Skins\")) {\n\t\t\t\tImGui::Text(\"Global Skins Settings:\");\n\t\t\t\tif (ImGui::Combo(\"Minion Skins:\", &cheatManager.config->current_combo_minion_index, vector_getter_default, static_cast<void*>(&cheatManager.database->minions_skins), cheatManager.database->minions_skins.size() + 1))\n\t\t\t\t\tcheatManager.config->current_minion_skin_index = cheatManager.config->current_combo_minion_index - 1;\n\t\t\t\tImGui::Separator();\n\t\t\t\tif (ImGui::Combo(\"Order Turret Skins:\", &cheatManager.config->current_combo_order_turret_index, vector_getter_default, static_cast<void*>(&cheatManager.database->turret_skins), cheatManager.database->turret_skins.size() + 1))\n\t\t\t\t\tchangeTurretSkin(cheatManager.config->current_combo_order_turret_index - 1, 100);\n\t\t\t\tif (ImGui::Combo(\"Chaos Turret Skins:\", &cheatManager.config->current_combo_chaos_turret_index, vector_getter_default, static_cast<void*>(&cheatManager.database->turret_skins), cheatManager.database->turret_skins.size() + 1))\n\t\t\t\t\tchangeTurretSkin(cheatManager.config->current_combo_chaos_turret_index - 1, 200);\n\t\t\t\tImGui::Separator();\n\t\t\t\tImGui::Text(\"Jungle Mobs Skins Settings:\");\n\t\t\t\tfor (auto& [name, name_hashes, skins] : cheatManager.database->jungle_mobs_skins) {\n\t\t\t\t\tstd::snprintf(str_buffer, 256, \"Current %s skin\", name);\n\t\t\t\t\tconst auto [fst, snd] { cheatManager.config->current_combo_jungle_mob_skin_index.insert({ name_hashes.front(), 0 }) };\n\t\t\t\t\tif (ImGui::Combo(str_buffer, &fst->second, vector_getter_default, &skins, skins.size() + 1))\n\t\t\t\t\t\tfor (const auto& hash : name_hashes)\n\t\t\t\t\t\t\tcheatManager.config->current_combo_jungle_mob_skin_index[hash] = fst->second;\n\t\t\t\t}\n\t\t\t\tfooter();\n\t\t\t\tImGui::EndTabItem();\n\t\t\t}\n\n\t\t\tif (ImGui::BeginTabItem(\"Logger\")) {\n\t\t\t\tcheatManager.logger->draw();\n\t\t\t\tImGui::EndTabItem();\n\t\t\t}\n\n\t\t\tif (ImGui::BeginTabItem(\"Extras\")) {\n\t\t\t\tImGui::hotkey(\"Menu Key\", cheatManager.config->menuKey);\n\t\t\t\tImGui::Checkbox(cheatManager.config->heroName ? \"HeroName based\" : \"PlayerName based\", &cheatManager.config->heroName);\n\t\t\t\tImGui::Checkbox(\"Rainbow Text\", &cheatManager.config->rainbowText);\n\t\t\t\tImGui::Checkbox(\"Quick Skin Change\", &cheatManager.config->quickSkinChange);\n\t\t\t\tImGui::hoverInfo(\"It allows you to change skin without opening the menu with the key you assign from the keyboard.\");\n\n\t\t\t\tif (cheatManager.config->quickSkinChange) {\n\t\t\t\t\tImGui::Separator();\n\t\t\t\t\tImGui::hotkey(\"Previous Skin Key\", cheatManager.config->previousSkinKey);\n\t\t\t\t\tImGui::hotkey(\"Next Skin Key\", cheatManager.config->nextSkinKey);\n\t\t\t\t\tImGui::Separator();\n\t\t\t\t}\n\n\t\t\t\tif (player)\n\t\t\t\t\tImGui::InputText(\"Change Nick\", player->get_name());\n\n\t\t\t\tif (ImGui::Button(\"No skins except local player\")) {\n\t\t\t\t\tfor (auto& val : cheatManager.config->current_combo_enemy_skin_index | std::views::values)\n\t\t\t\t\t\tval = 1;\n\n\t\t\t\t\tfor (auto& val : cheatManager.config->current_combo_ally_skin_index | std::views::values)\n\t\t\t\t\t\tval = 1;\n\n\t\t\t\t\tfor (auto i{ 0u }; i < heroes->length; ++i) {\n\t\t\t\t\t\tif (const auto hero{ heroes->list[i] }; hero != player)\n\t\t\t\t\t\t\thero->change_skin(hero->get_character_data_stack()->base_skin.model.str, 0);\n\t\t\t\t\t}\n\t\t\t\t} ImGui::hoverInfo(\"Sets the skins of all champions except the local player to the default skin.\");\n\n\t\t\t\tif (ImGui::Button(\"Random Skins\")) {\n\t\t\t\t\tfor (auto i{ 0u }; i < heroes->length; ++i) {\n\t\t\t\t\t\tconst auto hero{ heroes->list[i] };\n\t\t\t\t\t\tconst auto championHash{ fnv::hash_runtime(hero->get_character_data_stack()->base_skin.model.str) };\n\n\t\t\t\t\t\tif (championHash == FNV(\"PracticeTool_TargetDummy\"))\n\t\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\t\tconst auto skinCount{ cheatManager.database->champions_skins[championHash].size() };\n\t\t\t\t\t\tauto& skinDatabase{ cheatManager.database->champions_skins[championHash] };\n\t\t\t\t\t\tauto& config{ (hero->get_team() != my_team) ? cheatManager.config->current_combo_enemy_skin_index : cheatManager.config->current_combo_ally_skin_index };\n\n\t\t\t\t\t\tif (hero == player) {\n\t\t\t\t\t\t\tcheatManager.config->current_combo_skin_index = random(1ull, skinCount);\n\t\t\t\t\t\t\thero->change_skin(skinDatabase[cheatManager.config->current_combo_skin_index - 1].model_name, skinDatabase[cheatManager.config->current_combo_skin_index - 1].skin_id);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tauto& data{ config[championHash] };\n\t\t\t\t\t\t\tdata = random(1ull, skinCount);\n\t\t\t\t\t\t\thero->change_skin(skinDatabase[data - 1].model_name, skinDatabase[data - 1].skin_id);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} ImGui::hoverInfo(\"Randomly changes the skin of all champions.\");\n\n\t\t\t\tImGui::SliderFloat(\"Font Scale\", &cheatManager.config->fontScale, 1.0f, 2.0f, \"%.3f\");\n\t\t\t\tif (ImGui::GetIO().FontGlobalScale != cheatManager.config->fontScale) {\n\t\t\t\t\tImGui::GetIO().FontGlobalScale = cheatManager.config->fontScale;\n\t\t\t\t} ImGui::hoverInfo(\"Changes the menu font scale.\");\n\n\t\t\t\tif (ImGui::Button(\"Force Close\"))\n\t\t\t\t\tcheatManager.hooks->uninstall();\n\t\t\t\tImGui::hoverInfo(\"You will be returned to the reconnect screen.\");\n\t\t\t\tImGui::Text(\"FPS: %.0f FPS\", ImGui::GetIO().Framerate);\n\t\t\t\tfooter();\n\t\t\t\tImGui::EndTabItem();\n\t\t\t}\n\t\t}\n\t}\n\tImGui::End();\n}"
  },
  {
    "path": "R3nzSkin/GUI.hpp",
    "content": "#pragma once\n\nclass GUI {\npublic:\n\tvoid render() noexcept;\n\n\tbool is_open{ true };\n\tstd::once_flag set_font_scale;\nprivate:\n\tchar str_buffer[256];\n};\n"
  },
  {
    "path": "R3nzSkin/Hooks.cpp",
    "content": "#pragma warning(disable : 6011)\n\n#include <Windows.h>\n#include <ShlObj.h>\n#include <cinttypes>\n#include <filesystem>\n#include <string>\n\n#include \"fnv_hash.hpp\"\n#include \"imgui/imgui.h\"\n#include \"imgui/imgui_impl_dx11.h\"\n#include \"imgui/imgui_impl_win32.h\"\n#include \"vmt_smart_hook.hpp\"\n\n#include \"CheatManager.hpp\"\n#include \"Hooks.hpp\"\n#include \"Memory.hpp\"\n#include \"SDK/AIBaseCommon.hpp\"\n#include \"SDK/GameState.hpp\"\n\nLRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);\n\nstatic inline void testFunc() noexcept\n{\n\t// The codes you write here are executed when you press the F7 key in the game.\n\t\n\t// Example Func\n\tconst auto minions{ cheatManager.memory->minionList };\n\tfor (auto i{ 0u }; i < minions->length; ++i) {\n\t\tconst auto minion{ minions->list[i] };\n\t\tconst auto owner{ minion->getGoldRedirectTarget() };\n\t\tcheatManager.logger->addLog(\"Minion: %s\\n\\tModelName: %s\\n\\t\", minion->get_name()->c_str(), minion->get_character_data_stack()->base_skin.model.str);\n\t\tif (owner)\n\t\t\tcheatManager.logger->addLog(\"OwnerName: %s\\n\\t\\tModelName: %s\\n\\t\", owner->get_name()->c_str(), owner->get_character_data_stack()->base_skin.model.str);\n\t\tcheatManager.logger->addLog(\"IsLaneMinion: %d\\n\\t\", minion->isLaneMinion());\n\t\tcheatManager.logger->addLog(\"IsEliteMinion: %d\\n\\t\", minion->isEliteMinion());\n\t\tcheatManager.logger->addLog(\"IsEpicMinion: %d\\n\\t\", minion->isEpicMinion());\n\t\tcheatManager.logger->addLog(\"IsMinion: %d\\n\\t\", minion->isMinion());\n\t\tcheatManager.logger->addLog(\"IsJungle: %d\\n\\n\", minion->isJungle());\n\t}\n}\n\nstatic LRESULT WINAPI wndProc(const HWND window, const UINT msg, const WPARAM wParam, const LPARAM lParam) noexcept\n{\n\tif (ImGui_ImplWin32_WndProcHandler(window, msg, wParam, lParam))\n\t\treturn true;\n\n\tif (msg == WM_KEYDOWN) {\n\t\tif (wParam == cheatManager.config->menuKey.getKey()) {\n\t\t\tcheatManager.gui->is_open = !cheatManager.gui->is_open;\n\t\t\tif (!cheatManager.gui->is_open)\n\t\t\t\tcheatManager.config->save();\n\t\t} else if (wParam == 0x35) {\n\t\t\tconst auto player{ cheatManager.memory->localPlayer };\n\t\t\tif (const auto player{ cheatManager.memory->localPlayer }; (::GetAsyncKeyState(VK_LCONTROL) & 0x8000) && player) {\n\t\t\t\tconst auto playerHash{ fnv::hash_runtime(player->get_character_data_stack()->base_skin.model.str) };\n\t\t\t\tif (const auto it{ std::ranges::find_if(cheatManager.database->specialSkins,\n\t\t\t\t    [&skin = player->get_character_data_stack()->base_skin.skin, &ph = playerHash](const SkinDatabase::specialSkin& x) noexcept -> bool\n\t\t\t\t    {\n\t\t\t\t\t\treturn x.champHash == ph && (x.skinIdStart <= skin && x.skinIdEnd >= skin);\n\t\t\t\t    })}; it != cheatManager.database->specialSkins.end())\n\t\t\t\t{\n\t\t\t\t\tconst auto stack{ player->get_character_data_stack() };\n\t\t\t\t\tif (stack->base_skin.gear < static_cast<std::int8_t>(it->gears.size()) - 1)\n\t\t\t\t\t\t++stack->base_skin.gear;\n\t\t\t\t\telse\n\t\t\t\t\t\tstack->base_skin.gear = static_cast<std::int8_t>(0);\n\n\t\t\t\t\tstack->update(true);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (wParam == cheatManager.config->nextSkinKey.getKey() && cheatManager.config->quickSkinChange) {\n\t\t\tif (const auto player{ cheatManager.memory->localPlayer }; player) {\n\t\t\t\tconst auto& values{ cheatManager.database->champions_skins[fnv::hash_runtime(player->get_character_data_stack()->base_skin.model.str)] };\n\t\t\t\tif (++cheatManager.config->current_combo_skin_index > static_cast<std::int32_t>(values.size()))\n\t\t\t\t\tcheatManager.config->current_combo_skin_index = static_cast<std::int32_t>(values.size());\n\t\t\t\tif (cheatManager.config->current_combo_skin_index > 0)\n\t\t\t\t\tplayer->change_skin(values[cheatManager.config->current_combo_skin_index - 1].model_name, values[cheatManager.config->current_combo_skin_index - 1].skin_id);\n\t\t\t\tcheatManager.config->save();\n\t\t\t}\n\t\t} else if (wParam == cheatManager.config->previousSkinKey.getKey() && cheatManager.config->quickSkinChange) {\n\t\t\tif (const auto player{ cheatManager.memory->localPlayer }; player) {\n\t\t\t\tconst auto& values{ cheatManager.database->champions_skins[fnv::hash_runtime(player->get_character_data_stack()->base_skin.model.str)] };\n\t\t\t\tif (--cheatManager.config->current_combo_skin_index > 0)\n\t\t\t\t\tplayer->change_skin(values[cheatManager.config->current_combo_skin_index - 1].model_name, values[cheatManager.config->current_combo_skin_index - 1].skin_id);\n\t\t\t\telse\n\t\t\t\t\tcheatManager.config->current_combo_skin_index = 1;\n\t\t\t\tcheatManager.config->save();\n\t\t\t}\n\t\t} else if (wParam == VK_F7) {\n\t\t\ttestFunc();\n\t\t}\n\t}\n\n\treturn ::CallWindowProc(originalWndProc, window, msg, wParam, lParam);\n}\n\nstd::once_flag init_device;\nstd::unique_ptr<::vmt_smart_hook> swap_chain_vmt{ nullptr };\n\nstatic const ImWchar tahomaRanges[] = {\n\t0x0020, 0x00FF, // Basic Latin + Latin Supplement\n\t0x0100, 0x024F, // Latin Extended-A + Latin Extended-B\n\t0x0250, 0x02FF, // IPA Extensions + Spacing Modifier Letters\n\t0x0300, 0x03FF, // Combining Diacritical Marks + Greek/Coptic\n\t0x0400, 0x052F, // Cyrillic + Cyrillic Supplement\n\t0x0530, 0x06FF, // Armenian + Hebrew + Arabic\n\t0x0E00, 0x0E7F, // Thai\n\t0x1E00, 0x1FFF, // Latin Extended Additional + Greek Extended\n\t0x2000, 0x20CF, // General Punctuation + Superscripts and Subscripts + Currency Symbols\n\t0x2100, 0x218F, // Letterlike Symbols + Number Forms\n\t0,\n};\n\nnamespace d3d_vtable {\n\tID3D11Device* d3d11_device{ nullptr };\n\tID3D11DeviceContext* d3d11_device_context{ nullptr };\n\tID3D11RenderTargetView* main_render_target_view{ nullptr };\n\tIDXGISwapChain* p_swap_chain{ nullptr };\n\n\tstatic void WINAPI create_render_target() noexcept\n\t{\n\t\tID3D11Texture2D* back_buffer{ nullptr };\n\t\tp_swap_chain->GetBuffer(0u, IID_PPV_ARGS(&back_buffer));\n\n\t\tif (back_buffer) {\n\t\t\td3d11_device->CreateRenderTargetView(back_buffer, nullptr, &main_render_target_view);\n\t\t\tback_buffer->Release();\n\t\t}\n\t}\n\n\tstatic void init_imgui(IDXGISwapChain* device) noexcept\n\t{\n\t\tcheatManager.database->load();\n\t\tcheatManager.logger->addLog(\"All skins loaded from memory!\\n\");\n\t\tImGui::CreateContext();\n\t\tauto& style{ ImGui::GetStyle() };\n\n\t\tstyle.WindowPadding = ImVec2(6.0f, 6.0f);\n\t\tstyle.FramePadding = ImVec2(6.0f, 4.0f);\n\t\tstyle.ItemSpacing = ImVec2(6.0f, 4.0f);\n\t\tstyle.WindowTitleAlign = ImVec2(0.5f, 0.5f);\n\n\t\tstyle.ScrollbarSize = 12.0f;\n\n\t\tstyle.WindowBorderSize = 0.5f;\n\t\tstyle.ChildBorderSize = 0.5f;\n\t\tstyle.PopupBorderSize = 0.5f;\n\t\tstyle.FrameBorderSize = 0;\n\n\t\tstyle.WindowRounding = 0.0f;\n\t\tstyle.ChildRounding = 0.0f;\n\t\tstyle.FrameRounding = 0.0f;\n\t\tstyle.ScrollbarRounding = 0.0f;\n\t\tstyle.GrabRounding = 0.0f;\n\t\tstyle.TabRounding = 0.0f;\n\t\tstyle.PopupRounding = 0.0f;\n\n\t\tstyle.AntiAliasedFill = true;\n\t\tstyle.AntiAliasedLines = true;\n\n\t\tconst auto colors{ style.Colors };\n\n\t\tcolors[ImGuiCol_Text] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);\n\t\tcolors[ImGuiCol_TextDisabled] = ImVec4(0.44f, 0.44f, 0.44f, 1.00f);\n\t\tcolors[ImGuiCol_WindowBg] = ImVec4(0.06f, 0.06f, 0.06f, 1.00f);\n\t\tcolors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);\n\t\tcolors[ImGuiCol_PopupBg] = ImVec4(0.08f, 0.08f, 0.08f, 0.94f);\n\t\tcolors[ImGuiCol_Border] = ImVec4(0.51f, 0.36f, 0.15f, 1.00f);\n\t\tcolors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);\n\t\tcolors[ImGuiCol_FrameBg] = ImVec4(0.11f, 0.11f, 0.11f, 1.00f);\n\t\tcolors[ImGuiCol_FrameBgHovered] = ImVec4(0.51f, 0.36f, 0.15f, 1.00f);\n\t\tcolors[ImGuiCol_FrameBgActive] = ImVec4(0.78f, 0.55f, 0.21f, 1.00f);\n\t\tcolors[ImGuiCol_TitleBg] = ImVec4(0.51f, 0.36f, 0.15f, 1.00f);\n\t\tcolors[ImGuiCol_TitleBgActive] = ImVec4(0.91f, 0.64f, 0.13f, 1.00f);\n\t\tcolors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.00f, 0.00f, 0.00f, 0.51f);\n\t\tcolors[ImGuiCol_MenuBarBg] = ImVec4(0.11f, 0.11f, 0.11f, 1.00f);\n\t\tcolors[ImGuiCol_ScrollbarBg] = ImVec4(0.06f, 0.06f, 0.06f, 0.53f);\n\t\tcolors[ImGuiCol_ScrollbarGrab] = ImVec4(0.21f, 0.21f, 0.21f, 1.00f);\n\t\tcolors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.47f, 0.47f, 0.47f, 1.00f);\n\t\tcolors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.81f, 0.83f, 0.81f, 1.00f);\n\t\tcolors[ImGuiCol_CheckMark] = ImVec4(0.78f, 0.55f, 0.21f, 1.00f);\n\t\tcolors[ImGuiCol_SliderGrab] = ImVec4(0.91f, 0.64f, 0.13f, 1.00f);\n\t\tcolors[ImGuiCol_SliderGrabActive] = ImVec4(0.91f, 0.64f, 0.13f, 1.00f);\n\t\tcolors[ImGuiCol_Button] = ImVec4(0.51f, 0.36f, 0.15f, 1.00f);\n\t\tcolors[ImGuiCol_ButtonHovered] = ImVec4(0.91f, 0.64f, 0.13f, 1.00f);\n\t\tcolors[ImGuiCol_ButtonActive] = ImVec4(0.78f, 0.55f, 0.21f, 1.00f);\n\t\tcolors[ImGuiCol_Header] = ImVec4(0.51f, 0.36f, 0.15f, 1.00f);\n\t\tcolors[ImGuiCol_HeaderHovered] = ImVec4(0.91f, 0.64f, 0.13f, 1.00f);\n\t\tcolors[ImGuiCol_HeaderActive] = ImVec4(0.93f, 0.65f, 0.14f, 1.00f);\n\t\tcolors[ImGuiCol_Separator] = ImVec4(0.21f, 0.21f, 0.21f, 1.00f);\n\t\tcolors[ImGuiCol_SeparatorHovered] = ImVec4(0.91f, 0.64f, 0.13f, 1.00f);\n\t\tcolors[ImGuiCol_SeparatorActive] = ImVec4(0.78f, 0.55f, 0.21f, 1.00f);\n\t\tcolors[ImGuiCol_ResizeGrip] = ImVec4(0.21f, 0.21f, 0.21f, 1.00f);\n\t\tcolors[ImGuiCol_ResizeGripHovered] = ImVec4(0.91f, 0.64f, 0.13f, 1.00f);\n\t\tcolors[ImGuiCol_ResizeGripActive] = ImVec4(0.78f, 0.55f, 0.21f, 1.00f);\n\t\tcolors[ImGuiCol_Tab] = ImVec4(0.51f, 0.36f, 0.15f, 1.00f);\n\t\tcolors[ImGuiCol_TabHovered] = ImVec4(0.91f, 0.64f, 0.13f, 1.00f);\n\t\tcolors[ImGuiCol_TabActive] = ImVec4(0.78f, 0.55f, 0.21f, 1.00f);\n\t\tcolors[ImGuiCol_TabUnfocused] = ImVec4(0.07f, 0.10f, 0.15f, 0.97f);\n\t\tcolors[ImGuiCol_TabUnfocusedActive] = ImVec4(0.14f, 0.26f, 0.42f, 1.00f);\n\t\tcolors[ImGuiCol_PlotLines] = ImVec4(0.61f, 0.61f, 0.61f, 1.00f);\n\t\tcolors[ImGuiCol_PlotLinesHovered] = ImVec4(1.00f, 0.43f, 0.35f, 1.00f);\n\t\tcolors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);\n\t\tcolors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f);\n\t\tcolors[ImGuiCol_TextSelectedBg] = ImVec4(0.26f, 0.59f, 0.98f, 0.35f);\n\t\tcolors[ImGuiCol_DragDropTarget] = ImVec4(1.00f, 1.00f, 0.00f, 0.90f);\n\t\tcolors[ImGuiCol_NavHighlight] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);\n\t\tcolors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f);\n\t\tcolors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f);\n\t\tcolors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.35f);\n\n\t\tauto& io{ ImGui::GetIO() }; (void)io;\n\t\tio.IniFilename = nullptr;\n\t\tio.LogFilename = nullptr;\n\t\tio.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange;\n\n\t\tif (PWSTR pathToFonts; SUCCEEDED(::SHGetKnownFolderPath(FOLDERID_Fonts, 0, nullptr, &pathToFonts))) {\n\t\t\tconst std::filesystem::path path{ pathToFonts };\n\t\t\t::CoTaskMemFree(pathToFonts);\n\t\t\tImFontConfig cfg;\n\t\t\tcfg.SizePixels = 15.0f;\n\t\t\tio.Fonts->AddFontFromFileTTF((path / \"tahoma.ttf\").string().c_str(), cfg.SizePixels, &cfg, tahomaRanges);\n\t\t\tcfg.MergeMode = true;\n\t\t\tio.Fonts->AddFontFromFileTTF((path / \"malgun.ttf\").string().c_str(), cfg.SizePixels, &cfg, io.Fonts->GetGlyphRangesKorean());\n\t\t\tio.Fonts->AddFontFromFileTTF((path / \"msyh.ttc\").string().c_str(), cfg.SizePixels, &cfg, io.Fonts->GetGlyphRangesChineseFull());\n\t\t\tcfg.MergeMode = false;\n\t\t\tcheatManager.logger->addLog(\"Fonts loaded!\\n\");\n\t\t}\n\n\t\tImGui_ImplWin32_Init(cheatManager.memory->window);\n\n\t\tp_swap_chain = device;\n\t\tp_swap_chain->GetDevice(__uuidof(d3d11_device), reinterpret_cast<void**>(&(d3d11_device)));\n\t\td3d11_device->GetImmediateContext(&d3d11_device_context);\n\t\tcreate_render_target();\n\t\t::ImGui_ImplDX11_Init(d3d11_device, d3d11_device_context);\n\t\t::ImGui_ImplDX11_CreateDeviceObjects();\n\n\t\toriginalWndProc = WNDPROC(::SetWindowLongPtr(cheatManager.memory->window, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(&wndProc)));\n\t\tcheatManager.logger->addLog(\"WndProc hooked!\\n\\tOriginal: 0x%X\\n\\tNew: 0x%X\\n\", &originalWndProc, &wndProc);\n\t}\n\n\tstatic void render() noexcept\n\t{\n\t\tconst auto client{ cheatManager.memory->client };\n\t\tif (client && client->game_state == GGameState_s::Running) {\n\t\t\tcheatManager.hooks->init();\n\t\t\tif (cheatManager.gui->is_open) {\n\t\t\t\t::ImGui_ImplDX11_NewFrame();\n\t\t\t\t::ImGui_ImplWin32_NewFrame();\n\t\t\t\tImGui::NewFrame();\n\t\t\t\tcheatManager.gui->render();\n\t\t\t\tImGui::EndFrame();\n\t\t\t\tImGui::Render();\n\t\t\t\td3d11_device_context->OMSetRenderTargets(1, &main_render_target_view, nullptr);\n\t\t\t\t::ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());\n\t\t\t}\n\t\t}\n\t}\n\n\tstruct dxgi_present {\n\t\tstatic long WINAPI hooked(IDXGISwapChain* p_swap_chain, UINT sync_interval, UINT flags) noexcept\n\t\t{\n\t\t\tstd::call_once(init_device, [&]() { init_imgui(p_swap_chain); });\n\t\t\trender();\n\t\t\treturn m_original(p_swap_chain, sync_interval, flags);\n\t\t}\n\t\tstatic decltype(&hooked) m_original;\n\t};\n\tdecltype(dxgi_present::m_original) dxgi_present::m_original;\n\n\tstruct dxgi_resize_buffers {\n\t\tstatic long WINAPI hooked(IDXGISwapChain* p_swap_chain, UINT buffer_count, UINT width, UINT height, DXGI_FORMAT new_format, UINT swap_chain_flags) noexcept\n\t\t{\n\t\t\tif (main_render_target_view) { main_render_target_view->Release(); main_render_target_view = nullptr; }\n\t\t\tconst auto hr{ m_original(p_swap_chain, buffer_count, width, height, new_format, swap_chain_flags) };\n\t\t\tcreate_render_target();\n\t\t\treturn hr;\n\t\t}\n\t\tstatic decltype(&hooked) m_original;\n\t};\n\tdecltype(dxgi_resize_buffers::m_original) dxgi_resize_buffers::m_original;\n};\n\nstatic void changeModelForObject(const AIBaseCommon* obj, const char* model, const std::int32_t skin) noexcept\n{\n\tif (skin == -1)\n\t\treturn;\n\n\tif (const auto stack{ obj->get_character_data_stack() }; stack->base_skin.skin != skin) {\n\t\tstack->base_skin.skin = skin;\n\t\tstack->stack.clear();\n\t\tstack->push(model, skin);\n\t}\n}\n\nstatic void changeSkinForObject(const AIBaseCommon* obj, const std::int32_t skin) noexcept\n{\n\tif (skin == -1)\n\t\treturn;\n\n\tif (const auto stack{ obj->get_character_data_stack() }; stack->base_skin.skin != skin) {\n\t\tstack->base_skin.skin = skin;\n\t\tstack->update(true);\n\t}\n}\n\nvoid Hooks::init() noexcept\n{\n\tconst auto player{ cheatManager.memory->localPlayer };\n\tconst auto heroes{ cheatManager.memory->heroList };\n\tconst auto minions{ cheatManager.memory->minionList };\n\tstatic const auto playerHash{ player ? fnv::hash_runtime(player->get_character_data_stack()->base_skin.model.str) : 0u };\n\n\tstd::call_once(change_skins, [&]() noexcept -> void {\n\t\tif (player) {\n\t\t\tif (cheatManager.config->current_combo_skin_index > 0) {\n\t\t\t\tconst auto& values{ cheatManager.database->champions_skins[fnv::hash_runtime(player->get_character_data_stack()->base_skin.model.str)] };\n\t\t\t\tplayer->change_skin(values[cheatManager.config->current_combo_skin_index - 1].model_name, values[cheatManager.config->current_combo_skin_index - 1].skin_id);\n\t\t\t}\n\t\t}\n\n\t\tconst auto my_team{ player ? player->get_team() : 100 };\n\t\tfor (auto i{ 0u }; i < heroes->length; ++i) {\n\t\t\tconst auto hero{ heroes->list[i] };\n\t\t\tif (hero == player)\n\t\t\t\tcontinue;\n\n\t\t\tconst auto champion_name_hash{ fnv::hash_runtime(hero->get_character_data_stack()->base_skin.model.str) };\n\t\t\tif (champion_name_hash == FNV(\"PracticeTool_TargetDummy\"))\n\t\t\t\tcontinue;\n\n\t\t\tconst auto is_enemy{ my_team != hero->get_team() };\n\t\t\tconst auto& config_array{ is_enemy ? cheatManager.config->current_combo_enemy_skin_index : cheatManager.config->current_combo_ally_skin_index };\n\t\t\tconst auto config_entry{ config_array.find(champion_name_hash) };\n\t\t\tif (config_entry == config_array.end())\n\t\t\t\tcontinue;\n\n\t\t\tif (config_entry->second > 0) {\n\t\t\t\tconst auto& values = cheatManager.database->champions_skins[champion_name_hash];\n\t\t\t\thero->change_skin(values[config_entry->second - 1].model_name, values[config_entry->second - 1].skin_id);\n\t\t\t}\n\t\t}\n\t});\n\n\tfor (auto i{ 0u }; i < heroes->length; ++i) {\n\t\tif (const auto hero{ heroes->list[i] }; !hero->get_character_data_stack()->stack.empty()) {\n\t\t\t// Viego transforms into another champion as 2nd form, our own skin's id may not match for every champion. (same problem exists in sylas) \n\t\t\tif (const auto championName{ fnv::hash_runtime(hero->get_character_data_stack()->base_skin.model.str) }; championName == FNV(\"Viego\") || championName == FNV(\"Sylas\"))\n\t\t\t\tcontinue;\n\n\t\t\tif (auto& stack{ hero->get_character_data_stack()->stack.front() }; stack.skin != hero->get_character_data_stack()->base_skin.skin) {\n\t\t\t\tstack.skin = hero->get_character_data_stack()->base_skin.skin;\n\t\t\t\thero->get_character_data_stack()->update(true);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (auto i{ 0u }; i < minions->length; ++i) {\n\t\tconst auto minion{ minions->list[i] };\n\n\t\tif (minion->isLaneMinion()) {\n\t\t\tif (player && player->get_team() == 200)\n\t\t\t\tchangeSkinForObject(minion, cheatManager.config->current_minion_skin_index * 2 + 1);\n\t\t\telse\n\t\t\t\tchangeSkinForObject(minion, cheatManager.config->current_minion_skin_index * 2);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst auto hash{ fnv::hash_runtime(minion->get_character_data_stack()->base_skin.model.str) };\n\n\t\tif (const auto owner{ minion->getGoldRedirectTarget() }; owner) {\n\t\t\tif (hash == FNV(\"JammerDevice\") || hash == FNV(\"SightWard\") || hash == FNV(\"YellowTrinket\") || hash == FNV(\"VisionWard\") || hash == FNV(\"BlueTrinket\") || hash == FNV(\"TestCubeRender10Vision\")) {\n\t\t\t\tif (!player || owner == player) {\n\t\t\t\t\tif (hash == FNV(\"TestCubeRender10Vision\") && playerHash == FNV(\"Yone\"))\n\t\t\t\t\t\tchangeModelForObject(minion, \"Yone\", owner->get_character_data_stack()->base_skin.skin);\n\t\t\t\t\telse if (hash == FNV(\"TestCubeRender10Vision\"))\n\t\t\t\t\t\tchangeSkinForObject(minion, 0);\n\t\t\t\t\telse\n\t\t\t\t\t\tchangeSkinForObject(minion, cheatManager.config->current_ward_skin_index);\n\t\t\t\t}\n\t\t\t} else if (hash != FNV(\"SRU_Jungle_Companions\") && hash != FNV(\"DominationScout\"))\n\t\t\t\tchangeSkinForObject(minion, owner->get_character_data_stack()->base_skin.skin);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (const auto config_entry{ cheatManager.config->current_combo_jungle_mob_skin_index.find(hash) }; config_entry != cheatManager.config->current_combo_jungle_mob_skin_index.end() && config_entry->second != 0) {\n\t\t\tchangeSkinForObject(minion, config_entry->second - 1);\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Just LocalPlayer\n\t\tif ((hash == FNV(\"NunuSnowball\") && playerHash == FNV(\"Nunu\")) || (hash == FNV(\"KindredWolf\") && playerHash == FNV(\"Kindred\")) || (hash == FNV(\"QuinnValor\") && playerHash == FNV(\"Quinn\")))\n\t\t\tchangeSkinForObject(minion, player->get_character_data_stack()->base_skin.skin);\n\t}\n}\n\nvoid Hooks::install() noexcept\n{\n\tif (cheatManager.memory->swapChain) {\n\t\tswap_chain_vmt = std::make_unique<::vmt_smart_hook>(cheatManager.memory->swapChain);\n\t\tswap_chain_vmt->apply_hook<d3d_vtable::dxgi_present>(8);\n\t\tswap_chain_vmt->apply_hook<d3d_vtable::dxgi_resize_buffers>(13);\n\t\tcheatManager.logger->addLog(\"DX11 Hooked!\\n\");\n\t} else {\n\t\t::MessageBoxA(nullptr, \"Uncheck legacy dx9 in the client settings cuz it is no longer supported.\", \"R3nzSkin\", MB_OK | MB_ICONWARNING);\n\t\t::ExitProcess(EXIT_SUCCESS);\n\t}\n}\n\nvoid Hooks::uninstall() noexcept\n{\n\t::SetWindowLongW(cheatManager.memory->window, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(originalWndProc));\n\tswap_chain_vmt->unhook();\n\tcheatManager.cheatState = false;\n}\n"
  },
  {
    "path": "R3nzSkin/Hooks.hpp",
    "content": "#pragma once\n\n#include <Windows.h>\n#include <mutex>\n\ninline std::once_flag change_skins;\ninline WNDPROC originalWndProc;\n\nclass Hooks {\npublic:\n\tvoid init() noexcept;\n\tvoid install() noexcept;\n\tvoid uninstall() noexcept;\n};\n"
  },
  {
    "path": "R3nzSkin/Logger.hpp",
    "content": "#pragma once\n\n#include \"imgui/imgui.h\"\n\nclass R3nzSkinLogger {\npublic:\n    R3nzSkinLogger() { this->clear(); }\n\n    void clear() noexcept\n    {\n        this->buffer.clear();\n        this->lineOffsets.clear();\n        this->lineOffsets.push_back(0);\n    }\n\n    void addLog(const char* fmt, ...) noexcept\n    {\n        auto old_size{ this->buffer.size() };\n        va_list args;\n        va_start(args, fmt);\n        buffer.appendfv(fmt, args);\n        va_end(args);\n        for (const auto new_size{ this->buffer.size() }; old_size < new_size; ++old_size) {\n            if (this->buffer[old_size] == '\\n')\n                this->lineOffsets.push_back(old_size + 1);\n        }\n    }\n\n    void draw() noexcept\n    {\n        if (ImGui::BeginPopup(\"Options\")) {\n            ImGui::Checkbox(\"Auto-scroll\", &this->autoScroll);\n            ImGui::EndPopup();\n        }\n\n        if (ImGui::Button(\"Options\"))\n            ImGui::OpenPopup(\"Options\");\n\n        ImGui::SameLine();\n        if (ImGui::Button(\"Clear\"))\n            this->clear();\n\n        ImGui::SameLine();\n        if (ImGui::Button(\"Copy\"))\n            ImGui::LogToClipboard();\n\n        ImGui::SameLine();\n        filter.Draw(\"Filter\", -100.0f);\n\n        ImGui::Separator();\n        ImGui::BeginChild(\"scrolling\", ImVec2(0, 0), false, ImGuiWindowFlags_HorizontalScrollbar);\n\n        ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));\n        \n        const auto buf{ this->buffer.begin() };\n        const auto bufEnd{ this->buffer.end() };\n        \n        if (this->filter.IsActive()) {\n            for (auto line_no{ 0 }; line_no < this->lineOffsets.Size; ++line_no) {\n                const auto line_start{ buf + this->lineOffsets[line_no] };\n                const auto line_end{ (line_no + 1 < this->lineOffsets.Size) ? (buf + this->lineOffsets[line_no + 1] - 1) : bufEnd };\n                if (this->filter.PassFilter(line_start, line_end))\n                    ImGui::TextUnformatted(line_start, line_end);\n            }\n        } else {\n            ImGuiListClipper clipper;\n            clipper.Begin(this->lineOffsets.Size);\n            while (clipper.Step()) {\n                for (auto line_no{ clipper.DisplayStart }; line_no < clipper.DisplayEnd; ++line_no) {\n                    const auto line_start{ buf + this->lineOffsets[line_no] };\n                    const auto line_end{ (line_no + 1 < this->lineOffsets.Size) ? (buf + this->lineOffsets[line_no + 1] - 1) : bufEnd };\n                    ImGui::TextUnformatted(line_start, line_end);\n                }\n            }\n            clipper.End();\n        }\n        \n        ImGui::PopStyleVar();\n\n        if (this->autoScroll && ImGui::GetScrollY() >= ImGui::GetScrollMaxY())\n            ImGui::SetScrollHereY(1.0f);\n\n        ImGui::EndChild();\n    }\nprivate:\n    ImGuiTextBuffer buffer;\n    ImGuiTextFilter filter;\n    ImVector<int> lineOffsets;\n    bool autoScroll{ true };\n};\n"
  },
  {
    "path": "R3nzSkin/R3nzSkin.cpp",
    "content": "#pragma warning(disable : 6387 4715)\n\n#include <Windows.h>\n#include <clocale>\n#include <chrono>\n#include <thread>\n\n#include \"CheatManager.hpp\"\n\n#include \"Config.hpp\"\n#include \"Hooks.hpp\"\n#include \"Memory.hpp\"\n\n#include \"SDK/GameState.hpp\"\n\nbool WINAPI HideThread(const HANDLE hThread) noexcept\n{\n\t__try {\n\t\tusing FnSetInformationThread = NTSTATUS(NTAPI*)(HANDLE ThreadHandle, UINT ThreadInformationClass, PVOID ThreadInformation, ULONG ThreadInformationLength);\n\t\tconst auto NtSetInformationThread{ reinterpret_cast<FnSetInformationThread>(::GetProcAddress(::GetModuleHandleW(L\"ntdll.dll\"), \"NtSetInformationThread\")) };\n\n\t\tif (!NtSetInformationThread)\n\t\t\treturn false;\n\n\t\tif (const auto status{ NtSetInformationThread(hThread, 0x11u, nullptr, 0ul) }; status == 0x00000000)\n\t\t\treturn true;\n\t} __except (TRUE) {\n\t\treturn false;\n\t}\n\treturn false;\n}\n\n__declspec(safebuffers) static void WINAPI DllAttach([[maybe_unused]] LPVOID lp) noexcept\n{\n\tusing namespace std::chrono_literals;\n\n\tcheatManager.start();\n\tif (HideThread(::GetCurrentThread()))\n\t\tcheatManager.logger->addLog(\"Thread Hidden!\\n\");\n\n\tcheatManager.memory->Search(true);\n\twhile (true) {\n\t\tstd::this_thread::sleep_for(1s);\n\t\t\n\t\tif (!cheatManager.memory->client)\n\t\t\tcheatManager.memory->Search(true);\n\t\telse if (cheatManager.memory->client->game_state == GGameState_s::Running)\n\t\t\tbreak;\n\t}\n\tcheatManager.logger->addLog(\"GameClient found!\\n\");\n\t\n\tstd::this_thread::sleep_for(500ms);\n\tcheatManager.memory->Search(false);\n\tcheatManager.logger->addLog(\"All offsets found!\\n\");\n\tstd::this_thread::sleep_for(500ms);\n\n\tcheatManager.config->init();\n\tcheatManager.config->load();\n\tcheatManager.logger->addLog(\"CFG loaded!\\n\");\n\t\n\tcheatManager.hooks->install();\n\t\t\n\twhile (cheatManager.cheatState)\n\t\tstd::this_thread::sleep_for(250ms);\n\n\t::ExitProcess(0u);\n}\n\n__declspec(safebuffers) BOOL APIENTRY DllMain(const HMODULE hModule, const DWORD reason, [[maybe_unused]] LPVOID reserved)\n{\n\tDisableThreadLibraryCalls(hModule);\n\n\tif (reason != DLL_PROCESS_ATTACH)\n\t\treturn FALSE;\n\n\tHideThread(hModule);\n\tstd::setlocale(LC_ALL, \".utf8\");\n\n\t::_beginthreadex(nullptr, 0u, reinterpret_cast<_beginthreadex_proc_type>(DllAttach), nullptr, 0u, nullptr);\n\t::CloseHandle(hModule);\n\treturn TRUE;\n}\n"
  },
  {
    "path": "R3nzSkin/R3nzSkin.rc",
    "content": "// Microsoft Visual C++ generated resource script.\n//\n#include \"resource.h\"\n\n#define APSTUDIO_READONLY_SYMBOLS\n/////////////////////////////////////////////////////////////////////////////\n//\n// Generated from the TEXTINCLUDE 2 resource.\n//\n#include \"winres.h\"\n\n/////////////////////////////////////////////////////////////////////////////\n#undef APSTUDIO_READONLY_SYMBOLS\n\n/////////////////////////////////////////////////////////////////////////////\n// Turkish (Turkey) resources\n\n#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_TRK)\nLANGUAGE LANG_TURKISH, SUBLANG_DEFAULT\n#pragma code_page(1254)\n\n#ifdef APSTUDIO_INVOKED\n/////////////////////////////////////////////////////////////////////////////\n//\n// TEXTINCLUDE\n//\n\n1 TEXTINCLUDE \nBEGIN\n    \"resource.h\\0\"\nEND\n\n2 TEXTINCLUDE \nBEGIN\n    \"#include \"\"winres.h\"\"\\r\\n\"\n    \"\\0\"\nEND\n\n3 TEXTINCLUDE \nBEGIN\n    \"\\r\\n\"\n    \"\\0\"\nEND\n\n#endif    // APSTUDIO_INVOKED\n\n\n/////////////////////////////////////////////////////////////////////////////\n//\n// Version\n//\n\nVS_VERSION_INFO VERSIONINFO\n FILEVERSION 1,0,0,0\n PRODUCTVERSION 1,0,0,0\n FILEFLAGSMASK 0x3fL\n#ifdef _DEBUG\n FILEFLAGS 0x1L\n#else\n FILEFLAGS 0x0L\n#endif\n FILEOS 0x40004L\n FILETYPE 0x2L\n FILESUBTYPE 0x0L\nBEGIN\n    BLOCK \"StringFileInfo\"\n    BEGIN\n        BLOCK \"041f04b0\"\n        BEGIN\n            VALUE \"CompanyName\", \"R3nzSoftware Inc.\"\n            VALUE \"FileDescription\", \"R3nzSkin DLL\"\n            VALUE \"FileVersion\", \"1.0.0.0\"\n            VALUE \"InternalName\", \"R3nzSkin.dll\"\n            VALUE \"LegalCopyright\", \"Copyright (c) 2021-2023 Erdem Ylmaz\"\n            VALUE \"OriginalFilename\", \"R3nzSkin.dll\"\n            VALUE \"ProductName\", \"R3nzSkin DLL\"\n            VALUE \"ProductVersion\", \"1.0.0.0\"\n        END\n    END\n    BLOCK \"VarFileInfo\"\n    BEGIN\n        VALUE \"Translation\", 0x41f, 1200\n    END\nEND\n\n#endif    // Turkish (Turkey) resources\n/////////////////////////////////////////////////////////////////////////////\n\n\n\n#ifndef APSTUDIO_INVOKED\n/////////////////////////////////////////////////////////////////////////////\n//\n// Generated from the TEXTINCLUDE 3 resource.\n//\n\n\n/////////////////////////////////////////////////////////////////////////////\n#endif    // not APSTUDIO_INVOKED\n\n"
  },
  {
    "path": "R3nzSkin/R3nzSkin.vcxproj",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup Label=\"ProjectConfigurations\">\n    <ProjectConfiguration Include=\"ChinaServer|x64\">\n      <Configuration>ChinaServer</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"RiotGamesServers|Win32\">\n      <Configuration>RiotGamesServers</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"ChinaServer|Win32\">\n      <Configuration>ChinaServer</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"RiotGamesServers|x64\">\n      <Configuration>RiotGamesServers</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n  </ItemGroup>\n  <PropertyGroup Label=\"Globals\">\n    <VCProjectVersion>16.0</VCProjectVersion>\n    <Keyword>Win32Proj</Keyword>\n    <ProjectGuid>{17b6e7a6-aa76-4c09-b2aa-e2055ef748d2}</ProjectGuid>\n    <RootNamespace>R3nzSkin</RootNamespace>\n    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>\n    <ProjectName>R3nzSkin</ProjectName>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='ChinaServer|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v143</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='ChinaServer|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v143</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='RiotGamesServers|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v143</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n    <PreferredToolArchitecture>x86</PreferredToolArchitecture>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='RiotGamesServers|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v143</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n    <PreferredToolArchitecture>x64</PreferredToolArchitecture>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n  <ImportGroup Label=\"ExtensionSettings\">\n  </ImportGroup>\n  <ImportGroup Label=\"Shared\">\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='ChinaServer|Win32'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='ChinaServer|x64'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='RiotGamesServers|Win32'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='RiotGamesServers|x64'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <PropertyGroup Label=\"UserMacros\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='ChinaServer|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)Release\\$(Configuration)\\</OutDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='ChinaServer|x64'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)Release\\$(Configuration)\\</OutDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='RiotGamesServers|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)Release\\$(Configuration)\\</OutDir>\n    <GenerateManifest>false</GenerateManifest>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='RiotGamesServers|x64'\">\n    <GenerateManifest>false</GenerateManifest>\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)Release\\$(Configuration)\\</OutDir>\n  </PropertyGroup>\n  <PropertyGroup Label=\"Vcpkg\">\n    <VcpkgEnabled>false</VcpkgEnabled>\n  </PropertyGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='ChinaServer|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <SDLCheck>true</SDLCheck>\n      <PreprocessorDefinitions>__SSE__;__SSE2__;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;R3NZSKIN_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <ConformanceMode>true</ConformanceMode>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>\n      <LanguageStandard>stdcpplatest</LanguageStandard>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n      <LanguageStandard_C>Default</LanguageStandard_C>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableUAC>false</EnableUAC>\n      <UACExecutionLevel>RequireAdministrator</UACExecutionLevel>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='ChinaServer|x64'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <SDLCheck>true</SDLCheck>\n      <PreprocessorDefinitions>__SSE2__;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;R3NZSKIN_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <ConformanceMode>true</ConformanceMode>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>\n      <LanguageStandard>stdcpplatest</LanguageStandard>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n      <LanguageStandard_C>Default</LanguageStandard_C>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableUAC>false</EnableUAC>\n      <UACExecutionLevel>RequireAdministrator</UACExecutionLevel>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='RiotGamesServers|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <SDLCheck>false</SDLCheck>\n      <PreprocessorDefinitions>__SSE__;__SSE2__;_CRT_SECURE_NO_WARNINGS;_RIOT;WIN32;NDEBUG;R3NZSKIN_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <ConformanceMode>true</ConformanceMode>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>\n      <LanguageStandard>stdcpplatest</LanguageStandard>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n      <LanguageStandard_C>Default</LanguageStandard_C>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <StringPooling>true</StringPooling>\n      <ExceptionHandling>false</ExceptionHandling>\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <ControlFlowGuard>false</ControlFlowGuard>\n      <FloatingPointExceptions>false</FloatingPointExceptions>\n      <CreateHotpatchableImage>false</CreateHotpatchableImage>\n      <RuntimeTypeInfo>false</RuntimeTypeInfo>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableUAC>false</EnableUAC>\n      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='RiotGamesServers|x64'\">\n    <ClCompile>\n      <WarningLevel>TurnOffAllWarnings</WarningLevel>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <SDLCheck>false</SDLCheck>\n      <PreprocessorDefinitions>__SSE2__;_CRT_SECURE_NO_WARNINGS;_RIOT;WIN32;NDEBUG;R3NZSKIN_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <ConformanceMode>true</ConformanceMode>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>\n      <LanguageStandard>stdcpplatest</LanguageStandard>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n      <LanguageStandard_C>Default</LanguageStandard_C>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <StringPooling>true</StringPooling>\n      <ExceptionHandling>false</ExceptionHandling>\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <ControlFlowGuard>false</ControlFlowGuard>\n      <FloatingPointExceptions>false</FloatingPointExceptions>\n      <CreateHotpatchableImage>false</CreateHotpatchableImage>\n      <RuntimeTypeInfo>false</RuntimeTypeInfo>\n      <MultiProcessorCompilation>true</MultiProcessorCompilation>\n      <AdditionalOptions>/EHsc %(AdditionalOptions)</AdditionalOptions>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableUAC>false</EnableUAC>\n      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemGroup>\n    <ClCompile Include=\"Config.cpp\" />\n    <ClCompile Include=\"imgui\\imgui.cpp\" />\n    <ClCompile Include=\"imgui\\imgui_demo.cpp\" />\n    <ClCompile Include=\"imgui\\imgui_draw.cpp\" />\n    <ClCompile Include=\"imgui\\imgui_impl_dx11.cpp\" />\n    <ClCompile Include=\"imgui\\imgui_impl_win32.cpp\" />\n    <ClCompile Include=\"imgui\\imgui_tables.cpp\" />\n    <ClCompile Include=\"imgui\\imgui_widgets.cpp\" />\n    <ClCompile Include=\"Memory.cpp\" />\n    <ClCompile Include=\"Hooks.cpp\" />\n    <ClCompile Include=\"R3nzSkin.cpp\" />\n    <ClCompile Include=\"GUI.cpp\" />\n    <ClCompile Include=\"SDK\\AIBaseCommon.cpp\" />\n    <ClCompile Include=\"SDK\\AIMinionClient.cpp\" />\n    <ClCompile Include=\"SDK\\CharacterDataStack.cpp\" />\n    <ClCompile Include=\"SkinDatabase.cpp\" />\n    <ClCompile Include=\"Utils.cpp\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"CheatManager.hpp\" />\n    <ClInclude Include=\"Config.hpp\" />\n    <ClInclude Include=\"imgui\\imconfig.h\" />\n    <ClInclude Include=\"imgui\\imgui.h\" />\n    <ClInclude Include=\"imgui\\imgui_impl_dx11.h\" />\n    <ClInclude Include=\"imgui\\imgui_impl_win32.h\" />\n    <ClInclude Include=\"imgui\\imgui_internal.h\" />\n    <ClInclude Include=\"imgui\\imstb_rectpack.h\" />\n    <ClInclude Include=\"imgui\\imstb_textedit.h\" />\n    <ClInclude Include=\"imgui\\imstb_truetype.h\" />\n    <ClInclude Include=\"json\\json.hpp\" />\n    <ClInclude Include=\"Logger.hpp\" />\n    <ClInclude Include=\"Memory.hpp\" />\n    <ClInclude Include=\"Encryption.hpp\" />\n    <ClInclude Include=\"fnv_hash.hpp\" />\n    <ClInclude Include=\"Hooks.hpp\" />\n    <ClInclude Include=\"GUI.hpp\" />\n    <ClInclude Include=\"Offsets.hpp\" />\n    <ClInclude Include=\"resource.h\" />\n    <ClInclude Include=\"SDK\\AIBaseCommon.hpp\" />\n    <ClInclude Include=\"SDK\\AIHero.hpp\" />\n    <ClInclude Include=\"SDK\\AIMinionClient.hpp\" />\n    <ClInclude Include=\"SDK\\AITurret.hpp\" />\n    <ClInclude Include=\"SDK\\AString.hpp\" />\n    <ClInclude Include=\"SDK\\Champion.hpp\" />\n    <ClInclude Include=\"SDK\\ChampionManager.hpp\" />\n    <ClInclude Include=\"SDK\\CharacterDataStack.hpp\" />\n    <ClInclude Include=\"SDK\\CharacterStackData.hpp\" />\n    <ClInclude Include=\"SDK\\GameClient.hpp\" />\n    <ClInclude Include=\"SDK\\GameObject.hpp\" />\n    <ClInclude Include=\"SDK\\GameState.hpp\" />\n    <ClInclude Include=\"SDK\\ManagerTemplate.hpp\" />\n    <ClInclude Include=\"SDK\\Pad.hpp\" />\n    <ClInclude Include=\"SDK\\Skin.hpp\" />\n    <ClInclude Include=\"SDK\\RiotArray.hpp\" />\n    <ClInclude Include=\"SkinDatabase.hpp\" />\n    <ClInclude Include=\"Utils.hpp\" />\n    <ClInclude Include=\"vmt_smart_hook.hpp\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ResourceCompile Include=\"R3nzSkin.rc\" />\n  </ItemGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n  <ImportGroup Label=\"ExtensionTargets\">\n  </ImportGroup>\n</Project>"
  },
  {
    "path": "R3nzSkin/R3nzSkin.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup>\n    <Filter Include=\"Imgui\">\n      <UniqueIdentifier>{6e1c3fe0-7b4e-4ddc-b0af-ef2565509bab}</UniqueIdentifier>\n    </Filter>\n    <Filter Include=\"Json\">\n      <UniqueIdentifier>{24604dbf-d26d-4752-9537-7815e59a2e32}</UniqueIdentifier>\n    </Filter>\n    <Filter Include=\"Source Files\">\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\n      <Extensions>cpp;c;cc;cxx;c++;def;odl;idl;hpj;bat;asm;asmx</Extensions>\n    </Filter>\n    <Filter Include=\"Source Files\\SDK\">\n      <UniqueIdentifier>{e168d0f0-d453-47c1-867e-8e15f16f1918}</UniqueIdentifier>\n    </Filter>\n    <Filter Include=\"Source Files\\Skins\">\n      <UniqueIdentifier>{d978207e-684f-4e9b-a516-3a1bdf6da43a}</UniqueIdentifier>\n    </Filter>\n    <Filter Include=\"Source Files\\Utils\">\n      <UniqueIdentifier>{908bf81e-18df-417d-bcd9-8e3458213e73}</UniqueIdentifier>\n    </Filter>\n    <Filter Include=\"Source Files\\Offsets\">\n      <UniqueIdentifier>{6df88be6-4732-4c12-ab2a-b0e38f717525}</UniqueIdentifier>\n    </Filter>\n    <Filter Include=\"Source Files\\Memory\">\n      <UniqueIdentifier>{fb0c6058-a093-4f26-bc23-dd4f3d31e4c3}</UniqueIdentifier>\n    </Filter>\n    <Filter Include=\"Source Files\\Hooks\">\n      <UniqueIdentifier>{6b382e58-2f4f-42a8-8d19-ea492ca17eb7}</UniqueIdentifier>\n    </Filter>\n    <Filter Include=\"Source Files\\GUI\">\n      <UniqueIdentifier>{4c536b17-7ff4-4861-9586-0981e0bd981b}</UniqueIdentifier>\n    </Filter>\n    <Filter Include=\"Source Files\\Config\">\n      <UniqueIdentifier>{a2d7fdd0-5331-4fcc-95c6-864f9d9d19bf}</UniqueIdentifier>\n    </Filter>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"R3nzSkin.cpp\" />\n    <ClCompile Include=\"SkinDatabase.cpp\">\n      <Filter>Source Files\\Skins</Filter>\n    </ClCompile>\n    <ClCompile Include=\"GUI.cpp\">\n      <Filter>Source Files\\GUI</Filter>\n    </ClCompile>\n    <ClCompile Include=\"Memory.cpp\">\n      <Filter>Source Files\\Memory</Filter>\n    </ClCompile>\n    <ClCompile Include=\"Hooks.cpp\">\n      <Filter>Source Files\\Hooks</Filter>\n    </ClCompile>\n    <ClCompile Include=\"imgui\\imgui.cpp\">\n      <Filter>Imgui</Filter>\n    </ClCompile>\n    <ClCompile Include=\"imgui\\imgui_demo.cpp\">\n      <Filter>Imgui</Filter>\n    </ClCompile>\n    <ClCompile Include=\"imgui\\imgui_draw.cpp\">\n      <Filter>Imgui</Filter>\n    </ClCompile>\n    <ClCompile Include=\"imgui\\imgui_impl_dx11.cpp\">\n      <Filter>Imgui</Filter>\n    </ClCompile>\n    <ClCompile Include=\"imgui\\imgui_impl_win32.cpp\">\n      <Filter>Imgui</Filter>\n    </ClCompile>\n    <ClCompile Include=\"imgui\\imgui_tables.cpp\">\n      <Filter>Imgui</Filter>\n    </ClCompile>\n    <ClCompile Include=\"imgui\\imgui_widgets.cpp\">\n      <Filter>Imgui</Filter>\n    </ClCompile>\n    <ClCompile Include=\"Config.cpp\">\n      <Filter>Source Files\\Config</Filter>\n    </ClCompile>\n    <ClCompile Include=\"Utils.cpp\">\n      <Filter>Source Files\\Utils</Filter>\n    </ClCompile>\n    <ClCompile Include=\"SDK\\CharacterDataStack.cpp\">\n      <Filter>Source Files\\SDK</Filter>\n    </ClCompile>\n    <ClCompile Include=\"SDK\\AIBaseCommon.cpp\">\n      <Filter>Source Files\\SDK</Filter>\n    </ClCompile>\n    <ClCompile Include=\"SDK\\AIMinionClient.cpp\">\n      <Filter>Source Files\\SDK</Filter>\n    </ClCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"SkinDatabase.hpp\">\n      <Filter>Source Files\\Skins</Filter>\n    </ClInclude>\n    <ClInclude Include=\"fnv_hash.hpp\">\n      <Filter>Source Files\\Utils</Filter>\n    </ClInclude>\n    <ClInclude Include=\"vmt_smart_hook.hpp\">\n      <Filter>Source Files\\Utils</Filter>\n    </ClInclude>\n    <ClInclude Include=\"Offsets.hpp\">\n      <Filter>Source Files\\Offsets</Filter>\n    </ClInclude>\n    <ClInclude Include=\"GUI.hpp\">\n      <Filter>Source Files\\GUI</Filter>\n    </ClInclude>\n    <ClInclude Include=\"Memory.hpp\">\n      <Filter>Source Files\\Memory</Filter>\n    </ClInclude>\n    <ClInclude Include=\"Hooks.hpp\">\n      <Filter>Source Files\\Hooks</Filter>\n    </ClInclude>\n    <ClInclude Include=\"resource.h\" />\n    <ClInclude Include=\"imgui\\imconfig.h\">\n      <Filter>Imgui</Filter>\n    </ClInclude>\n    <ClInclude Include=\"imgui\\imgui.h\">\n      <Filter>Imgui</Filter>\n    </ClInclude>\n    <ClInclude Include=\"imgui\\imgui_impl_dx11.h\">\n      <Filter>Imgui</Filter>\n    </ClInclude>\n    <ClInclude Include=\"imgui\\imgui_impl_win32.h\">\n      <Filter>Imgui</Filter>\n    </ClInclude>\n    <ClInclude Include=\"imgui\\imgui_internal.h\">\n      <Filter>Imgui</Filter>\n    </ClInclude>\n    <ClInclude Include=\"imgui\\imstb_rectpack.h\">\n      <Filter>Imgui</Filter>\n    </ClInclude>\n    <ClInclude Include=\"imgui\\imstb_textedit.h\">\n      <Filter>Imgui</Filter>\n    </ClInclude>\n    <ClInclude Include=\"imgui\\imstb_truetype.h\">\n      <Filter>Imgui</Filter>\n    </ClInclude>\n    <ClInclude Include=\"json\\json.hpp\">\n      <Filter>Json</Filter>\n    </ClInclude>\n    <ClInclude Include=\"Config.hpp\">\n      <Filter>Source Files\\Config</Filter>\n    </ClInclude>\n    <ClInclude Include=\"Utils.hpp\">\n      <Filter>Source Files\\Utils</Filter>\n    </ClInclude>\n    <ClInclude Include=\"SDK\\GameState.hpp\">\n      <Filter>Source Files\\SDK</Filter>\n    </ClInclude>\n    <ClInclude Include=\"SDK\\GameClient.hpp\">\n      <Filter>Source Files\\SDK</Filter>\n    </ClInclude>\n    <ClInclude Include=\"SDK\\AString.hpp\">\n      <Filter>Source Files\\SDK</Filter>\n    </ClInclude>\n    <ClInclude Include=\"SDK\\Pad.hpp\">\n      <Filter>Source Files\\SDK</Filter>\n    </ClInclude>\n    <ClInclude Include=\"SDK\\Skin.hpp\">\n      <Filter>Source Files\\SDK</Filter>\n    </ClInclude>\n    <ClInclude Include=\"SDK\\Champion.hpp\">\n      <Filter>Source Files\\SDK</Filter>\n    </ClInclude>\n    <ClInclude Include=\"SDK\\ChampionManager.hpp\">\n      <Filter>Source Files\\SDK</Filter>\n    </ClInclude>\n    <ClInclude Include=\"SDK\\CharacterStackData.hpp\">\n      <Filter>Source Files\\SDK</Filter>\n    </ClInclude>\n    <ClInclude Include=\"SDK\\CharacterDataStack.hpp\">\n      <Filter>Source Files\\SDK</Filter>\n    </ClInclude>\n    <ClInclude Include=\"SDK\\GameObject.hpp\">\n      <Filter>Source Files\\SDK</Filter>\n    </ClInclude>\n    <ClInclude Include=\"SDK\\AIBaseCommon.hpp\">\n      <Filter>Source Files\\SDK</Filter>\n    </ClInclude>\n    <ClInclude Include=\"SDK\\AIHero.hpp\">\n      <Filter>Source Files\\SDK</Filter>\n    </ClInclude>\n    <ClInclude Include=\"SDK\\AIMinionClient.hpp\">\n      <Filter>Source Files\\SDK</Filter>\n    </ClInclude>\n    <ClInclude Include=\"SDK\\ManagerTemplate.hpp\">\n      <Filter>Source Files\\SDK</Filter>\n    </ClInclude>\n    <ClInclude Include=\"Encryption.hpp\">\n      <Filter>Source Files\\SDK</Filter>\n    </ClInclude>\n    <ClInclude Include=\"CheatManager.hpp\" />\n    <ClInclude Include=\"SDK\\RiotArray.hpp\">\n      <Filter>Source Files\\SDK</Filter>\n    </ClInclude>\n    <ClInclude Include=\"SDK\\AITurret.hpp\">\n      <Filter>Source Files\\SDK</Filter>\n    </ClInclude>\n    <ClInclude Include=\"Logger.hpp\">\n      <Filter>Source Files\\Utils</Filter>\n    </ClInclude>\n  </ItemGroup>\n  <ItemGroup>\n    <ResourceCompile Include=\"R3nzSkin.rc\" />\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "R3nzSkin/SDK/AIBaseCommon.cpp",
    "content": "#include <cstdint>\n#include <string>\n\n#include \"AIBaseCommon.hpp\"\n\n#include \"../encryption.hpp\"\n#include \"../fnv_hash.hpp\"\n#include \"../offsets.hpp\"\n\n#include \"../CheatManager.hpp\"\n\nbool AIBaseCommon::checkSpecialSkins(const char* model, const std::int32_t skin) noexcept\n{\n\tconst auto stack{ this->get_character_data_stack() };\n\tconst auto champ_name{ fnv::hash_runtime(stack->base_skin.model.str) };\n\n\tif (champ_name == FNV(\"Katarina\") && (skin >= 29 && skin <= 36)) {\n\t\tstack->base_skin.gear = static_cast<std::int8_t>(0);\n\t} else if (champ_name == FNV(\"Renekton\") && (skin >= 26 && skin <= 32)) {\n\t\tstack->base_skin.gear = static_cast<std::int8_t>(0);\n\t} else if (champ_name == FNV(\"MissFortune\") && skin == 16) {\n\t\tstack->base_skin.gear = static_cast<std::int8_t>(0);\n\t} else if (champ_name == FNV(\"Lux\") || champ_name == FNV(\"Sona\")) {\n\t\tif ((skin == 7 && champ_name == FNV(\"Lux\")) || (skin == 6 && champ_name == FNV(\"Sona\"))) {\n\t\t\tstack->stack.clear();\n\t\t\tstack->push(model, skin);\n\t\t\treturn true;\n\t\t} else stack->stack.clear();\n\t} else if (stack->base_skin.gear != static_cast<std::int8_t>(-1) && champ_name != FNV(\"Kayn\")) {\n\t\tstack->base_skin.gear = static_cast<std::int8_t>(-1);\n\t}\n\t\n\treturn false;\n}\n\nvoid AIBaseCommon::change_skin(const char* model, const std::int32_t skin) noexcept\n{\n\tconst auto stack{ this->get_character_data_stack() };\n\treinterpret_cast<xor_value<std::int32_t>*>(std::uintptr_t(this) + offsets::AIBaseCommon::SkinId)->encrypt(skin);\n\tstack->base_skin.skin = skin;\n\n\tif (!this->checkSpecialSkins(model, skin))\n\t\tstack->update(true);\n}\n"
  },
  {
    "path": "R3nzSkin/SDK/AIBaseCommon.hpp",
    "content": "#pragma once\n\n#include <cstdint>\n\n#include \"CharacterDataStack.hpp\"\n#include \"GameObject.hpp\"\n\nclass AIBaseCommon : public GameObject {\npublic:\n\t[[nodiscard]] CharacterDataStack* get_character_data_stack() const noexcept { return reinterpret_cast<CharacterDataStack*>(std::uintptr_t(this) + offsets::AIBaseCommon::CharacterDataStack); }\n\n\tvoid change_skin(const char* model, const std::int32_t skin) noexcept;\nprivate:\n\tbool checkSpecialSkins(const char* model, const std::int32_t skin) noexcept;\n};\n"
  },
  {
    "path": "R3nzSkin/SDK/AIHero.hpp",
    "content": "#pragma once\n\n#include \"AIBaseCommon.hpp\"\n\nclass AIHero : public AIBaseCommon {\npublic:\n};\n"
  },
  {
    "path": "R3nzSkin/SDK/AIMinionClient.cpp",
    "content": "#include \"AIMinionClient.hpp\"\n\n#include <cstdint>\n\n#include \"../CheatManager.hpp\"\n\nAIBaseCommon* AIMinionClient::getGoldRedirectTarget() const noexcept\n{\n\tstatic const auto getOwner{ reinterpret_cast<AIBaseCommon*(__fastcall*)(std::uintptr_t)>(cheatManager.memory->base + offsets::functions::GetGoldRedirectTarget) };\n\treturn getOwner(std::uintptr_t(this));\n}\n"
  },
  {
    "path": "R3nzSkin/SDK/AIMinionClient.hpp",
    "content": "#pragma once\n\n#include \"AIBaseCommon.hpp\"\n\nclass AIMinionClient : public AIBaseCommon {\npublic:\n\t[[nodiscard]] AIBaseCommon* getGoldRedirectTarget() const noexcept;\n};\n"
  },
  {
    "path": "R3nzSkin/SDK/AITurret.hpp",
    "content": "#pragma once\n\n#include \"AIBaseCommon.hpp\"\n\nclass AITurret : public AIBaseCommon {\npublic:\n};\n"
  },
  {
    "path": "R3nzSkin/SDK/AString.hpp",
    "content": "#pragma once\n\n#include <cstdint>\n\nclass AString {\npublic:\n\tconst char* str;\n\tstd::int32_t length;\n\tstd::int32_t capacity;\n};\n"
  },
  {
    "path": "R3nzSkin/SDK/Champion.hpp",
    "content": "#pragma once\n\n#include \"AString.hpp\"\n#include \"Pad.hpp\"\n#include \"Skin.hpp\"\n#include \"RiotArray.hpp\"\n\nclass Champion {\n\tPAD(0x8)\n\tAString champion_name;\n\tPAD(0xA0)\n\tRiotArray<Skin> skins;\n};\n"
  },
  {
    "path": "R3nzSkin/SDK/ChampionManager.hpp",
    "content": "#pragma once\n\n#include <vector>\n\n#include \"Champion.hpp\"\n#include \"Pad.hpp\"\n#include \"RiotArray.hpp\"\n\nclass ChampionManager {\n\tPAD(0x18)\n\tRiotArray<Champion*> champions;\n};\n"
  },
  {
    "path": "R3nzSkin/SDK/CharacterDataStack.cpp",
    "content": "#include <cstdint>\n\n#include \"../CheatManager.hpp\"\n#include \"../Offsets.hpp\"\n\n#include \"CharacterDataStack.hpp\"\n\nvoid CharacterDataStack::push(const char* model, const std::int32_t skin) const noexcept\n{\n\tusing push_t = __int64(__fastcall*)(std::uintptr_t, const char*, std::int32_t, std::int32_t, bool, bool, bool, bool, bool, bool, std::int8_t, const char*, std::int32_t, const char*, std::int32_t, bool, std::int32_t);\n\tstatic const auto _push{ reinterpret_cast<push_t>(cheatManager.memory->base + offsets::functions::CharacterDataStack__Push) };\n\t_push(std::uintptr_t(this), model, skin, 0, false, false, false, false, true, false, -1, \"\\x00\", 0, \"\\x00\", 0, false, 1);\n}\n\nvoid CharacterDataStack::update(const bool change) const noexcept\n{\n\tstatic const auto _update{ reinterpret_cast<__int64(__fastcall*)(std::uintptr_t, bool)>(cheatManager.memory->base + offsets::functions::CharacterDataStack__Update) };\n\t_update(std::uintptr_t(this), change);\n}\n"
  },
  {
    "path": "R3nzSkin/SDK/CharacterDataStack.hpp",
    "content": "#pragma once\n\n#include <cstdint>\n#include <vector>\n\n#include \"CharacterStackData.hpp\"\n\nclass CharacterDataStack {\npublic:\n\tstd::vector<CharacterStackData> stack;\n\tCharacterStackData base_skin;\n\n\tvoid update(const bool change) const noexcept;\n\tvoid push(const char* model, const std::int32_t skin) const noexcept;\n};\n"
  },
  {
    "path": "R3nzSkin/SDK/CharacterStackData.hpp",
    "content": "#pragma once\n\n#include <cstdint>\n\n#include \"AString.hpp\"\n#include \"Pad.hpp\"\n\nclass CharacterStackData {\npublic:\n    AString model;\n    PAD(0x10)\n    std::int32_t skin;\n    PAD(0x60)\n    std::int8_t gear;\n    PAD(0x7)\n};\n"
  },
  {
    "path": "R3nzSkin/SDK/GameClient.hpp",
    "content": "#pragma once\n\n#include \"GameState.hpp\"\n#include \"Pad.hpp\"\n\nclass GameClient {\n\tPAD(0xC)\n\tGGameState_s game_state;\n};\n"
  },
  {
    "path": "R3nzSkin/SDK/GameObject.hpp",
    "content": "#pragma once\n\n#include <cstdint>\n#include <string>\n\n#include \"../offsets.hpp\"\n#include \"Pad.hpp\"\n\nclass GameObject {\npublic:\n\tCLASS_GETTER_P(std::string, get_name, offsets::GameObject::Name)\n\tCLASS_GETTER(std::int32_t, get_team, offsets::GameObject::Team)\n\n\t// Returns true for lane minions.\n\t[[nodiscard]] bool isLaneMinion() const noexcept { return CallVirtual<offsets::GameObject::VTable::IsLaneMinion, bool>(std::uintptr_t(this)); }\n\n\t// Returns true for blue, red and crab.\n\t[[nodiscard]] bool isEliteMinion() const noexcept { return CallVirtual<offsets::GameObject::VTable::IsEliteMinion, bool>(std::uintptr_t(this)); }\n\n\t// Returns true for dragon, baron, and rift.\n\t[[nodiscard]] bool isEpicMinion() const noexcept { return CallVirtual<offsets::GameObject::VTable::IsEpicMinion, bool>(std::uintptr_t(this)); }\n\n\t// Returns true for minion.\n\t[[nodiscard]] bool isMinion() const noexcept { return CallVirtual<offsets::GameObject::VTable::IsMinion, bool>(std::uintptr_t(this)); }\n\n\t// Returns true for objects that both teams can damage, such as jungle objects, gangplain barrels, etc.\n\t[[nodiscard]] bool isJungle() const noexcept { return CallVirtual<offsets::GameObject::VTable::IsJungle, bool>(std::uintptr_t(this)); }\n};\n"
  },
  {
    "path": "R3nzSkin/SDK/GameState.hpp",
    "content": "#pragma once\n\n#include <cstdint>\n\nenum class GGameState_s : std::int32_t {\n\tLoadingScreen = 0,\n\tConnecting = 1,\n\tRunning = 2,\n\tPoaused = 3,\n\tFinished = 4,\n\tExiting = 5\n};\n"
  },
  {
    "path": "R3nzSkin/SDK/ManagerTemplate.hpp",
    "content": "#pragma once\n\n#include <cstdint>\n\n#include \"Pad.hpp\"\n\ntemplate <class T>\nclass ManagerTemplate {\n\tPAD(0x8)\n\tT** list;\n\tstd::int32_t length;\n\tstd::int32_t capacity;\n};\n"
  },
  {
    "path": "R3nzSkin/SDK/Pad.hpp",
    "content": "#pragma once\n\n#include <cstddef>\n\n#define CONCAT(a, b) a##b\n#define PAD_NAME(n) CONCAT(pad, n)\n#define PAD(size) \\\nprivate: \\\n    std::byte PAD_NAME(__LINE__)[size]; \\\npublic:\n\n#define CLASS_GETTER(returnType, name, offset) \\\n[[nodiscard]] inline returnType name() const noexcept \\\n{ \\\n\treturn *reinterpret_cast<returnType*>(std::uintptr_t(this) + offset); \\\n}\n\n#define CLASS_GETTER_P(returnType, name, offset) \\\n[[nodiscard]] inline returnType* name() const noexcept \\\n{ \\\n\treturn reinterpret_cast<returnType*>(std::uintptr_t(this) + offset); \\\n}\n\ntemplate <std::size_t Index, typename ReturnType, typename... Args>\nReturnType CallVirtual(std::uintptr_t instance, Args... args)\n{\n\tusing Fn = ReturnType(__fastcall*)(std::uintptr_t, Args...);\n\tconst auto function{ (*reinterpret_cast<Fn**>(instance))[Index] };\n\treturn function(instance, args...);\n}"
  },
  {
    "path": "R3nzSkin/SDK/RiotArray.hpp",
    "content": "#pragma once\n\n#include <cstdint>\n\ntemplate <class T>\nclass RiotArray {\npublic:\n\tT* list;\n\tstd::int32_t size;\n\tstd::int32_t cap;\n};\n"
  },
  {
    "path": "R3nzSkin/SDK/Skin.hpp",
    "content": "#pragma once\n\n#include <cstdint>\n\n#include \"AString.hpp\"\n#include \"Pad.hpp\"\n\nclass Skin {\npublic:\n\tstd::int32_t skin_id;\n\tPAD(0x4)\n\tAString skin_name;\n};\n"
  },
  {
    "path": "R3nzSkin/SkinDatabase.cpp",
    "content": "#include <algorithm>\n#include <cstdint>\n#include <map>\n#include <ranges>\n#include <string>\n#include <utility>\n\n#include \"CheatManager.hpp\"\n#include \"SkinDatabase.hpp\"\n#include \"fnv_hash.hpp\"\n\nvoid SkinDatabase::load() noexcept\n{\n\tfor (auto j{ 0 }; j < cheatManager.memory->championManager->champions.size; ++j) {\n\t\tconst auto& champion = cheatManager.memory->championManager->champions.list[j];\n\t\tstd::vector<std::int32_t> skins_ids;\n\t\t\n\t\tfor (auto i{ 0 }; i < champion->skins.size; ++i)\n\t\t\tskins_ids.push_back(champion->skins.list[i].skin_id);\n\t\t\n\t\tstd::ranges::sort(skins_ids);\n\n\t\tstd::map<std::string, std::int32_t> temp_skin_list;\n\t\tfor (const auto& i : skins_ids) {\n\t\t\tconst auto skin_display_name{ std::string(\"game_character_skin_displayname_\") + champion->champion_name.str + \"_\" + std::to_string(i) };\n\t\t\tauto skin_display_name_translated{ i > 0 ? std::string(cheatManager.memory->translateString(skin_display_name.c_str())) : std::string(champion->champion_name.str) };\n\n\t\t\tif (skin_display_name_translated == skin_display_name)\n\t\t\t\tcontinue;\n\n\t\t\tif (const auto it{ temp_skin_list.find(skin_display_name_translated) }; it == temp_skin_list.end()) {\n\t\t\t\ttemp_skin_list[skin_display_name_translated] = 1;\n\t\t\t} else {\n\t\t\t\tskin_display_name_translated.append(\" Chroma \" + std::to_string(it->second));\n\t\t\t\tit->second = it->second + 1;\n\t\t\t}\n\n\t\t\tconst auto champ_name{ fnv::hash_runtime(champion->champion_name.str) };\n\t\t\tthis->champions_skins[champ_name].push_back({ champion->champion_name.str, skin_display_name_translated, i });\n\n\t\t\tif (i == 7 && champ_name == FNV(\"Lux\")) {\n\t\t\t\tthis->champions_skins[champ_name].push_back({ \"LuxAir\", \"Elementalist Air Lux\", i });\n\t\t\t\tthis->champions_skins[champ_name].push_back({ \"LuxDark\", \"Elementalist Dark Lux\", i });\n\t\t\t\tthis->champions_skins[champ_name].push_back({ \"LuxFire\", \"Elementalist Fire Lux\", i });\n\t\t\t\tthis->champions_skins[champ_name].push_back({ \"LuxIce\", \"Elementalist Ice Lux\", i });\n\t\t\t\tthis->champions_skins[champ_name].push_back({ \"LuxMagma\", \"Elementalist Magma Lux\", i });\n\t\t\t\tthis->champions_skins[champ_name].push_back({ \"LuxMystic\", \"Elementalist Mystic Lux\", i });\n\t\t\t\tthis->champions_skins[champ_name].push_back({ \"LuxNature\", \"Elementalist Nature Lux\", i });\n\t\t\t\tthis->champions_skins[champ_name].push_back({ \"LuxStorm\", \"Elementalist Storm Lux\", i });\n\t\t\t\tthis->champions_skins[champ_name].push_back({ \"LuxWater\", \"Elementalist Water Lux\", i });\n\t\t\t} else if (i == 6 && champ_name == FNV(\"Sona\")) {\n\t\t\t\tthis->champions_skins[champ_name].push_back({ \"SonaDJGenre02\", \"DJ Sona 2\", i });\n\t\t\t\tthis->champions_skins[champ_name].push_back({ \"SonaDJGenre03\", \"DJ Sona 3\", i });\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (auto ward_skin_id{ 1u };; ++ward_skin_id) {\n\t\tconst auto ward_display_name{ \"game_character_skin_displayname_SightWard_\" + std::to_string(ward_skin_id) };\n\t\tconst auto ward_display_name_translated{ cheatManager.memory->translateString(ward_display_name.c_str()) };\n\t\t\n\t\tif (ward_display_name == ward_display_name_translated)\n\t\t\tbreak;\n\n\t\tthis->wards_skins.emplace_back(ward_skin_id, ward_display_name_translated);\n\t}\n}\n"
  },
  {
    "path": "R3nzSkin/SkinDatabase.hpp",
    "content": "#pragma once\n\n#include <cstdint>\n#include <map>\n#include <utility>\n#include <vector>\n\n#include \"fnv_hash.hpp\"\n \nclass SkinDatabase {\npublic:\n\tclass skin_info {\n\tpublic:\n\t\tconst char* model_name;\n\t\tstd::string skin_name;\n\t\tstd::int32_t skin_id;\n\t};\n\n\tclass jungle_mob_skin_info {\n\tpublic:\n\t\tconst char* name;\n\t\tstd::vector<std::uint64_t> name_hashes;\n\t\tstd::vector<const char*> skins;\n\t};\n\n\tclass specialSkin {\n\tpublic:\n\t\tstd::uint64_t champHash;\n\t\tstd::int32_t skinIdStart;\n\t\tstd::int32_t skinIdEnd;\n\t\tstd::vector<const char*> gears;\n\t};\n\n\tvoid load() noexcept;\n\n\tstd::map<std::uint64_t, std::vector<skin_info>> champions_skins;\n\tstd::vector<std::pair<std::uint32_t, const char*>> wards_skins;\n\t\n\tstd::vector<const char*> minions_skins{\n\t\t\"Minion\", \"Summer Minion\",\n\t\t\"Project Minion\", \"Snowdown Minion\",\n\t\t\"Draven Minion\", \"Star Guardian Minion\",\n\t\t\"Arcade Minion\", \"Snowdown 2 Minion\",\n\t\t\"Odyssey Minion\", \"Mouse Minion\", \"Arcane Minion\"\n\t};\n\n\tstd::vector<const char*> turret_skins{\n\t\t\"Default Order Turret\", \"Default Chaos Turret\",\n\t\t\"Snow Order Turret\", \"Snow Chaos Turret\",\n\t\t\"Twisted Treeline Order Turret\", \"Twisted Treeline Chaos Turret\",\n\t\t\"URF Order Turret\", \"URF Chaos Turret\",\n\t\t\"Arcade Turret\",\n\t\t\"Temple of Lily and Lotus Turret\",\n\t\t\"Arcane Order Turret\", \"Arcane Chaos Turret\",\n\t\t\"Butcher's Bridge Order Turret\", \"Butcher's Bridge Chaos Turret\",\n\t\t\"Howling Abyss Order Turret\", \"Howling Abyss Chaos Turret\"\n\t};\n\n\tstd::vector<jungle_mob_skin_info> jungle_mobs_skins{\n\t\t{\n\t\t\t\"Baron\",\n\t\t\t{ FNV(\"SRU_Baron\") },\n\t\t\t{ \"Baron\", \"Snowdown Baron\", \"Championship Baron\", \"Lunar Revel Baron\", \"MSI Baron\", \"Odyssey Baron\", \"Championship Birthday Baron\", \"Ruined King Baron\" }\n\t\t},\n\t\t{\n\t\t\t\"Blue\",\n\t\t\t{ FNV(\"SRU_Blue\") },\n\t\t\t{ \"Blue\", \"Dark Blue\", \"Pool Party Blue\", \"Ruined King Blue\" }\n\t\t},\n\t\t{\n\t\t\t\"Red\",\n\t\t\t{ FNV(\"SRU_Red\") },\n\t\t\t{ \"Red\", \"Pool Party Red\", \"Ruined King Red\" }\n\t\t},\n\t\t{\n\t\t\t\"Scuttle\",\n\t\t\t{ FNV(\"Sru_Crab\") },\n\t\t\t{ \"Scuttle\", \"Halloween Light Scuttle\", \"Halloween Dark Scuttle\", \"Ruined King Scuttle\" }\n\t\t},\n\t\t{\n\t\t\t\"Krug\",\n\t\t\t{ FNV(\"SRU_Krug\"), FNV(\"SRU_KrugMini\"), FNV(\"SRU_KrugMiniMini\") },\n\t\t\t{ \"Krug\", \"Dark Krug\" }\n\t\t},\n\t\t{\n\t\t\t\"Razorbeak\",\n\t\t\t{ FNV(\"SRU_Razorbeak\"), FNV(\"SRU_RazorbeakMini\") },\n\t\t\t{ \"Razorbeak\", \"Chicken Razorbeak\" }\n\t\t}\n\t};\n\t//左开右闭\n\tstd::vector<specialSkin> specialSkins{\n\t\t{ FNV(\"Katarina\"), 29, 36, { \"Dagger 1\", \"Dagger 2\", \"Dagger 3\", \"Dagger 4\", \"Dagger 5\", \"Dagger 6\" }},\n\t\t{ FNV(\"Renekton\"), 26, 32, { \"Head off\", \"Head on\", \"Fins\", \"Ultimate\" } },\n\t\t{ FNV(\"MissFortune\"), 16, 16, { \"Scarlet fair\", \"Zero hour\", \"Royal arms\", \"Starswarm\" } },\n\t\t{ FNV(\"Ezreal\"), 5, 5, { \"Level 1\", \"Level 2\", \"Level 3\" } },\n\t\t{ FNV(\"Ahri\"), 86, 87, { \"Level 1\", \"Level 2\", \"Level 3\" } }\n\t};\n};\n"
  },
  {
    "path": "R3nzSkin/Utils.cpp",
    "content": "#include <Windows.h>\n#include <algorithm>\n#include <array>\n#include <string_view>\n\n#include \"imgui/imgui.h\"\n#define IMGUI_DEFINE_MATH_OPERATORS\n#include \"imgui/imgui_internal.h\"\n\n#include \"CheatManager.hpp\"\n#include \"Utils.hpp\"\n\nstruct Key {\n    constexpr Key(std::string_view name, int code) : name{ name }, code{ code } {  }\n\n    std::string_view name;\n    int code;\n};\n\n// indices must match KeyBind::KeyCode enum\nstatic constexpr auto keyMap = std::to_array<Key>({\n    { \"'\", VK_OEM_7 },\n    { \",\", VK_OEM_COMMA },\n    { \"-\", VK_OEM_MINUS },\n    { \".\", VK_OEM_PERIOD },\n    { \"/\", VK_OEM_2 },\n    { \"0\", '0' },\n    { \"1\", '1' },\n    { \"2\", '2' },\n    { \"3\", '3' },\n    { \"4\", '4' },\n    { \"5\", '5' },\n    { \"6\", '6' },\n    { \"7\", '7' },\n    { \"8\", '8' },\n    { \"9\", '9' },\n    { \";\", VK_OEM_1 },\n    { \"=\", VK_OEM_PLUS },\n    { \"A\", 'A' },\n    { \"ADD\", VK_ADD },\n    { \"B\", 'B' },\n    { \"BACKSPACE\", VK_BACK },\n    { \"C\", 'C' },\n    { \"CAPSLOCK\", VK_CAPITAL },\n    { \"D\", 'D' },\n    { \"DECIMAL\", VK_DECIMAL },\n    { \"DELETE\", VK_DELETE },\n    { \"DIVIDE\", VK_DIVIDE },\n    { \"DOWN\", VK_DOWN },\n    { \"E\", 'E' },\n    { \"END\", VK_END },\n    { \"ENTER\", VK_RETURN },\n    { \"F\", 'F' },\n    { \"F1\", VK_F1 },\n    { \"F10\", VK_F10 },\n    { \"F11\", VK_F11 },\n    { \"F12\", VK_F12 },\n    { \"F2\", VK_F2 },\n    { \"F3\", VK_F3 },\n    { \"F4\", VK_F4 },\n    { \"F5\", VK_F5 },\n    { \"F6\", VK_F6 },\n    { \"F7\", VK_F7 },\n    { \"F8\", VK_F8 },\n    { \"F9\", VK_F9 },\n    { \"G\", 'G' },\n    { \"H\", 'H' },\n    { \"HOME\", VK_HOME },\n    { \"I\", 'I' },\n    { \"INSERT\", VK_INSERT },\n    { \"J\", 'J' },\n    { \"K\", 'K' },\n    { \"L\", 'L' },\n    { \"LALT\", VK_LMENU },\n    { \"LCTRL\", VK_LCONTROL },\n    { \"LEFT\", VK_LEFT },\n    { \"LSHIFT\", VK_LSHIFT },\n    { \"M\", 'M' },\n    { \"MOUSE1\", 0x0 },\n    { \"MOUSE2\", 0x1 },\n    { \"MOUSE3\", 0x2 },\n    { \"MOUSE4\", 0x3 },\n    { \"MOUSE5\", 0x4 },\n    { \"MULTIPLY\", VK_MULTIPLY },\n    { \"MWHEEL_DOWN\", 0x0 },\n    { \"MWHEEL_UP\", 0x0 },\n    { \"N\", 'N' },\n    { \"NONE\", 0x0 },\n    { \"NUMPAD_0\", VK_NUMPAD0 },\n    { \"NUMPAD_1\", VK_NUMPAD1 },\n    { \"NUMPAD_2\", VK_NUMPAD2 },\n    { \"NUMPAD_3\", VK_NUMPAD3 },\n    { \"NUMPAD_4\", VK_NUMPAD4 },\n    { \"NUMPAD_5\", VK_NUMPAD5 },\n    { \"NUMPAD_6\", VK_NUMPAD6 },\n    { \"NUMPAD_7\", VK_NUMPAD7 },\n    { \"NUMPAD_8\", VK_NUMPAD8 },\n    { \"NUMPAD_9\", VK_NUMPAD9 },\n    { \"O\", 'O' },\n    { \"P\", 'P' },\n    { \"PAGE_DOWN\", VK_NEXT },\n    { \"PAGE_UP\", VK_PRIOR },\n    { \"Q\", 'Q' },\n    { \"R\", 'R' },\n    { \"RALT\", VK_RMENU },\n    { \"RCTRL\", VK_RCONTROL },\n    { \"RIGHT\", VK_RIGHT },\n    { \"RSHIFT\", VK_RSHIFT },\n    { \"S\", 'S' },\n    { \"SPACE\", VK_SPACE },\n    { \"SUBTRACT\", VK_SUBTRACT },\n    { \"T\", 'T' },\n    { \"TAB\", VK_TAB },\n    { \"U\", 'U' },\n    { \"UP\", VK_UP },\n    { \"V\", 'V' },\n    { \"W\", 'W' },\n    { \"X\", 'X' },\n    { \"Y\", 'Y' },\n    { \"Z\", 'Z' },\n    { \"[\", VK_OEM_4 },\n    { \"\\\\\", VK_OEM_5 },\n    { \"]\", VK_OEM_6 },\n    { \"`\", VK_OEM_3 }\n});\n\nstatic_assert(keyMap.size() == KeyBind::MAX);\nstatic_assert(std::ranges::is_sorted(keyMap, {}, &Key::name));\n\nKeyBind::KeyBind(const KeyCode keyCode) noexcept : keyCode{ static_cast<std::size_t>(keyCode) < keyMap.size() ? keyCode : KeyCode::NONE } {  }\n\nKeyBind::KeyBind(const char* keyName) noexcept\n{\n    if (const auto it{ std::ranges::lower_bound(keyMap, keyName, {}, &Key::name) }; it != keyMap.end() && it->name == keyName)\n        keyCode = static_cast<KeyCode>(std::distance(keyMap.begin(), it));\n    else\n        keyCode = KeyCode::NONE;\n}\n\nconst char* KeyBind::toString() const noexcept\n{\n    return keyMap[static_cast<std::size_t>(keyCode) < keyMap.size() ? keyCode : KeyCode::NONE].name.data();\n}\n\nint KeyBind::getKey() const noexcept\n{\n    return keyMap[static_cast<std::size_t>(keyCode) < keyMap.size() ? keyCode : KeyCode::NONE].code;\n}\n\nbool KeyBind::isPressed() const noexcept\n{\n    if (keyCode == KeyCode::NONE)\n        return false;\n\n    if (keyCode == KeyCode::MOUSEWHEEL_DOWN)\n        return ImGui::GetIO().MouseWheel < 0.0f;\n\n    if (keyCode == KeyCode::MOUSEWHEEL_UP)\n        return ImGui::GetIO().MouseWheel > 0.0f;\n\n    if (keyCode >= KeyCode::MOUSE1 && keyCode <= KeyCode::MOUSE5)\n        return ImGui::IsMouseClicked(keyMap[keyCode].code);\n\n    return static_cast<std::size_t>(keyCode) < keyMap.size() && ImGui::IsKeyPressed(keyMap[keyCode].code, false);\n}\n\nbool KeyBind::isDown() const noexcept\n{\n    if (keyCode == KeyCode::NONE)\n        return false;\n\n    if (keyCode == KeyCode::MOUSEWHEEL_DOWN)\n        return ImGui::GetIO().MouseWheel < 0.0f;\n\n    if (keyCode == KeyCode::MOUSEWHEEL_UP)\n        return ImGui::GetIO().MouseWheel > 0.0f;\n\n    if (keyCode >= KeyCode::MOUSE1 && keyCode <= KeyCode::MOUSE5)\n        return ImGui::IsMouseDown(keyMap[keyCode].code);\n\n    return static_cast<std::size_t>(keyCode) < keyMap.size() && ImGui::IsKeyDown(keyMap[keyCode].code);\n}\n\nbool KeyBind::setToPressedKey() noexcept\n{\n    if (ImGui::IsKeyPressed(ImGui::GetIO().KeyMap[ImGuiKey_Escape])) {\n        keyCode = KeyCode::NONE;\n        return true;\n    } else if (ImGui::GetIO().MouseWheel < 0.0f) {\n        keyCode = KeyCode::MOUSEWHEEL_DOWN;\n        return true;\n    } else if (ImGui::GetIO().MouseWheel > 0.0f) {\n        keyCode = KeyCode::MOUSEWHEEL_UP;\n        return true;\n    }\n\n    for (auto i{ 0u }; i < IM_ARRAYSIZE(ImGui::GetIO().MouseDown); ++i) {\n        if (ImGui::IsMouseClicked(i)) {\n            keyCode = static_cast<KeyCode>(KeyCode::MOUSE1 + i);\n            return true;\n        }\n    }\n\n    for (auto i{ 0u }; i < IM_ARRAYSIZE(ImGui::GetIO().KeysDown); ++i) {\n        if (!ImGui::IsKeyPressed(i))\n            continue;\n\n        if (const auto it{ std::ranges::find(keyMap, i, &Key::code) }; it != keyMap.end()) {\n            keyCode = static_cast<KeyCode>(std::distance(keyMap.begin(), it));\n            if (keyCode == KeyCode::LCTRL && ImGui::IsKeyPressed(keyMap[KeyCode::RALT].code))\n                keyCode = KeyCode::RALT;\n            return true;\n        }\n    }\n    return false;\n}\n\nvoid KeyBindToggle::handleToggle() noexcept\n{\n    if (isPressed())\n        toggledOn = !toggledOn;\n}\n\nvoid ImGui::textUnformattedCentered(const char* text) noexcept\n{\n    ImGui::SetCursorPosX((ImGui::GetWindowSize().x - ImGui::CalcTextSize(text).x) / 2.0f);\n    ImGui::TextUnformatted(text);\n}\n\nvoid ImGui::hoverInfo(const char* desc) noexcept\n{\n    if (ImGui::IsItemHovered()) {\n        ImGui::BeginTooltip();\n        ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);\n        ImGui::TextUnformatted(desc);\n        ImGui::PopTextWrapPos();\n        ImGui::EndTooltip();\n    }\n}\n\nvoid ImGui::rainbowText() noexcept\n{\n\tstatic float r{ 1.0f };\n\tstatic float g{ 0.f };\n\tstatic float b{ 0.f };\n\n\tif (cheatManager.config->rainbowText) {\n\t\tif (r == 1.f && g >= 0.f && b <= 0.f) {\n\t\t\tg += 0.005f;\n\t\t\tb = 0.f;\n\t\t}\n\t\tif (r <= 1.f && g >= 1.f && b == 0.f) {\n\t\t\tg = 1.f;\n\t\t\tr -= 0.005f;\n\t\t}\n\t\tif (r <= 0.f && g == 1.f && b >= 0.f) {\n\t\t\tr = 0.f;\n\t\t\tb += 0.005f;\n\t\t}\n\t\tif (r == 0.f && g <= 1.f && b >= 1.f) {\n\t\t\tb = 1.f;\n\t\t\tg -= 0.005f;\n\t\t}\n\t\tif (r >= 0.f && g <= 0.f && b == 1.f) {\n\t\t\tg = 0.f;\n\t\t\tr += 0.005f;\n\t\t}\n\t\tif (r >= 1.f && g >= 0.f && b <= 1.f) {\n\t\t\tr = 1.f;\n\t\t\tb -= 0.005f;\n\t\t}\n\t\tImGui::GetStyle().Colors[ImGuiCol_Text] = ImVec4(r, g, b, 1.00f);\n\t} else {\n\t\tif (auto& clr{ ImGui::GetStyle().Colors[ImGuiCol_Text] }; clr.x != 0.92f && clr.y != 0.92f && clr.z != 0.92f)\n\t\t\tclr = ImVec4(0.92f, 0.92f, 0.92f, 0.92f);\n\t}\n}\n\nstruct InputTextCallback_UserData {\n    std::string* Str;\n    ImGuiInputTextCallback ChainCallback;\n    void* ChainCallbackUserData;\n};\n\nstatic int InputTextCallback(ImGuiInputTextCallbackData* data) noexcept\n{\n    const auto user_data{ static_cast<InputTextCallback_UserData*>(data->UserData) };\n    if (data->EventFlag == ImGuiInputTextFlags_CallbackResize) {\n        const auto str{ user_data->Str };\n        IM_ASSERT(data->Buf == str->c_str());\n        str->resize(data->BufTextLen);\n        data->Buf = const_cast<char*>(str->c_str());\n    } else if (user_data->ChainCallback) {\n        data->UserData = user_data->ChainCallbackUserData;\n        return user_data->ChainCallback(data);\n    }\n    return 0;\n}\n\nbool ImGui::InputText(const char* label, std::string* str, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* userData) noexcept\n{\n    IM_ASSERT((flags & ImGuiInputTextFlags_CallbackResize) == 0);\n    flags |= ImGuiInputTextFlags_CallbackResize;\n    auto cbUserData{ InputTextCallback_UserData(str, callback, userData) };\n    return InputText(label, const_cast<char*>(str->c_str()), str->capacity() + 1, flags, InputTextCallback, &cbUserData);\n}\n\nvoid ImGui::hotkey(const char* label, KeyBind& key, float samelineOffset, const ImVec2& size) noexcept\n{\n    const auto id{ GetID(label) };\n    PushID(label);\n\n    TextUnformatted(label);\n    SameLine(samelineOffset);\n\n    if (GetActiveID() == id) {\n        PushStyleColor(ImGuiCol_Button, GetColorU32(ImGuiCol_ButtonActive));\n        Button(\"...\", size);\n        PopStyleColor();\n\n        GetCurrentContext()->ActiveIdAllowOverlap = true;\n        if ((!IsItemHovered() && GetIO().MouseClicked[0]) || key.setToPressedKey())\n            ClearActiveID();\n    } else if (Button(key.toString(), size)) {\n        SetActiveID(id, GetCurrentWindow());\n    }\n\n    PopID();\n}\n"
  },
  {
    "path": "R3nzSkin/Utils.hpp",
    "content": "#pragma once\n\n#include <concepts>\n#include <mutex>\n#include <random>\n#include <string>\n\n#include \"imgui/imgui.h\"\n\nclass RandomGenerator {\npublic:\n    template <std::integral T>\n    [[nodiscard]] static T random(T min, T max) noexcept\n    {\n        std::scoped_lock lock{ mutex };\n        return std::uniform_int_distribution{ min, max }(gen);\n    }\n\n    template <std::floating_point T>\n    [[nodiscard]] static T random(T min, T max) noexcept\n    {\n        std::scoped_lock lock{ mutex };\n        return std::uniform_real_distribution{ min, max }(gen);\n    }\n\n    template <typename T>\n    [[nodiscard]] static std::enable_if_t<std::is_enum_v<T>, T> random(T min, T max) noexcept\n    {\n        return static_cast<T>(random(static_cast<std::underlying_type_t<T>>(min), static_cast<std::underlying_type_t<T>>(max)));\n    }\nprivate:\n    inline static std::mt19937 gen{ std::random_device{}() };\n    inline static std::mutex mutex;\n};\n\ntemplate <typename T>\n[[nodiscard]] T random(T min, T max) noexcept\n{\n    return RandomGenerator::random(min, max);\n}\n\nclass KeyBind {\npublic:\n    enum KeyCode : unsigned char {\n        APOSTROPHE = 0, COMMA, MINUS, PERIOD, SLASH, KEY_0, KEY_1, KEY_2,\n        KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9, SEMICOLON, EQUALS,\n        A, ADD, B, BACKSPACE, C, CAPSLOCK, D, DECIMAL, DEL, DIVIDE, DOWN, E,\n        END, ENTER, F, F1, F10, F11, F12, F2, F3, F4, F5, F6, F7, F8, F9, G,\n        H, HOME, I, INSERT, J, K, L, LALT, LCTRL, LEFT, LSHIFT, M, MOUSE1, MOUSE2,\n        MOUSE3, MOUSE4, MOUSE5, MULTIPLY, MOUSEWHEEL_DOWN, MOUSEWHEEL_UP, N, NONE,\n        NUMPAD_0, NUMPAD_1, NUMPAD_2, NUMPAD_3, NUMPAD_4, NUMPAD_5, NUMPAD_6, NUMPAD_7,\n        NUMPAD_8, NUMPAD_9, O, P, PAGE_DOWN, PAGE_UP, Q, R, RALT, RCTRL, RIGHT, RSHIFT,\n        S, SPACE, SUBTRACT, T, TAB, U, UP, V, W, X, Y, Z, LEFTBRACKET, BACKSLASH,\n        RIGHTBRACKET, BACKTICK, MAX\n    };\n\n    KeyBind() = default;\n    explicit KeyBind(KeyCode keyCode) noexcept;\n    explicit KeyBind(const char* keyName) noexcept;\n\n    bool operator==(KeyCode keyCode) const noexcept { return this->keyCode == keyCode; }\n    friend bool operator==(const KeyBind& a, const KeyBind& b) noexcept { return a.keyCode == b.keyCode; }\n\n    const char* toString() const noexcept;\n    int getKey() const noexcept;\n    bool isPressed() const noexcept;\n    bool isDown() const noexcept;\n    bool isSet() const noexcept { return keyCode != KeyCode::NONE; }\n\n    bool setToPressedKey() noexcept;\nprivate:\n    KeyCode keyCode{ KeyCode::NONE };\n};\n\nclass KeyBindToggle : public KeyBind {\npublic:\n    using KeyBind::KeyBind;\n\n    void handleToggle() noexcept;\n    bool isToggled() const noexcept { return toggledOn; }\nprivate:\n    bool toggledOn = true;\n};\n\nnamespace ImGui\n{\n    bool InputText(const char* label, std::string* str, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = nullptr, void* userData = nullptr) noexcept;\n\tvoid textUnformattedCentered(const char* text) noexcept;\n\tvoid rainbowText() noexcept;\n    void hotkey(const char* label, KeyBind& key, float samelineOffset = 0.0f, const ImVec2& size = { 100.0f, 0.0f }) noexcept;\n    void hoverInfo(const char* desc) noexcept;\n};\n"
  },
  {
    "path": "R3nzSkin/encryption.hpp",
    "content": "#pragma once\n\n#include <cstdint>\n#include <intrin.h>\n\n#pragma pack(push, 4)\ntemplate <typename T>\nclass xor_value {\n\tT xor_key;\n\tT values_table[4];\n\tbool xor_key_was_init{ 0 };\n\tstd::uint8_t bytes_xor_count;\n\tstd::uint8_t bytes_xor_count_8;\n\tstd::uint8_t value_index{ 0 };\npublic:\n\tT decrypt() noexcept\n\t{\n\t\tif (xor_key_was_init != 1)\n\t\t\treturn 0;\n\n\t\tauto xored_value{ values_table[value_index] };\n\t\tauto xor_key_value{ xor_key };\n\n\t\t{\n\t\t\tauto* xor_value_ptr{ reinterpret_cast<std::uint32_t*>(&xor_key_value) };\n\t\t\tfor (auto i{ 0u }; i < bytes_xor_count; i++)\n\t\t\t\t*(reinterpret_cast<std::uint32_t*>(&xored_value) + i) ^= ~xor_value_ptr[i];\n\t\t}\n\n\t\t{\n\t\t\tauto* xor_value_ptr{ reinterpret_cast<std::uint8_t*>(&xor_key_value) };\n\n\t\t\tfor (auto i{ sizeof(T) - bytes_xor_count_8 }; i < sizeof(T); ++i)\n\t\t\t\t*(reinterpret_cast<std::uint8_t*>(&xored_value) + i) ^= ~xor_value_ptr[i];\n\t\t}\n\n\t\treturn xored_value;\n\t}\n\n\tvoid encrypt(T value) noexcept\n\t{\n\t\tif (!xor_key_was_init) {\n\t\t\tif (sizeof(T) <= 2) {\n\t\t\t\tbytes_xor_count_8 = sizeof(T);\n\t\t\t\tbytes_xor_count = 0;\n\t\t\t} else {\n\t\t\t\tbytes_xor_count_8 = sizeof(T) % 4;\n\t\t\t\tbytes_xor_count = (sizeof(T) - bytes_xor_count_8) / 4;\n\t\t\t}\n\n\t\t\tauto key{ ::__rdtsc() };\n\t\t\tauto key_index{ 0 };\n\n\t\t\tfor (auto i{ 0u }; i < sizeof(T); i++) {\n\t\t\t\t*(reinterpret_cast<std::uint8_t*>(&xor_key) + i) = *(reinterpret_cast<std::uint8_t*>(&key) + key_index++);\n\n\t\t\t\tif (key_index == 8) {\n\t\t\t\t\tkey = ::__rdtsc();\n\t\t\t\t\tkey_index = 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvalue_index = 0;\n\t\t\txor_key_was_init = 1;\n\t\t}\n\n\t\tauto xored_value{ value };\n\t\tauto xor_key_value{ xor_key };\n\n\t\t{\n\t\t\tauto* xor_value_ptr{ reinterpret_cast<std::uint32_t*>(&xor_key_value) };\n\t\t\tfor (auto i{ 0u }; i < bytes_xor_count; i++)\n\t\t\t\t*(reinterpret_cast<std::uint32_t*>(&xored_value) + i) ^= ~xor_value_ptr[i];\n\t\t}\n\n\t\t{\n\t\t\tauto* xor_value_ptr{ reinterpret_cast<std::uint8_t*>(&xor_key_value) };\n\n\t\t\tfor (auto i{ sizeof(T) - bytes_xor_count_8 }; i < sizeof(T); ++i)\n\t\t\t\t*(reinterpret_cast<std::uint8_t*>(&xored_value) + i) ^= ~xor_value_ptr[i];\n\t\t}\n\n\t\tauto new_value_index{ std::uint8_t(value_index + 1) & 3 };\n\t\tvalues_table[new_value_index] = xored_value;\n\t\tvalue_index = new_value_index;\n\t}\n};\n#pragma pack(pop)\n"
  },
  {
    "path": "R3nzSkin/fnv_hash.hpp",
    "content": "#pragma once\n\n#include <cstdlib>\n#include <cstdint>\n\nnamespace detail {\n\ttemplate <typename Type, Type OffsetBasis, Type Prime>\n\tstruct size_dependant_data {\n\t\tusing type = Type;\n\t\tconstexpr static auto k_offset_basis{ OffsetBasis };\n\t\tconstexpr static auto k_prime{ Prime };\n\t};\n\n\ttemplate <std::size_t Bits>\n\tstruct size_selector;\n\n\ttemplate <>\n\tstruct size_selector<32> {\n\t\tusing type = size_dependant_data<std::uint32_t, 0x811c9dc5ul, 16777619ul>;\n\t};\n\n\ttemplate <>\n\tstruct size_selector<64> {\n\t\tusing type = size_dependant_data<std::uint64_t, 0xcbf29ce484222325ull, 1099511628211ull>;\n\t};\n\n\ttemplate <std::size_t Size>\n\tclass fnv_hash {\n\tprivate:\n\t\tusing data_t = typename size_selector<Size>::type;\n\n\tpublic:\n\t\tusing hash = typename data_t::type;\n\n\tprivate:\n\t\tconstexpr static auto k_offset_basis{ data_t::k_offset_basis };\n\t\tconstexpr static auto k_prime{ data_t::k_prime };\n\n\tpublic:\n\t\ttemplate <std::size_t N>\n\t\tstatic __forceinline constexpr auto hash_constexpr(const char(&str)[N], const std::size_t size = N) -> hash {\n\t\t\treturn static_cast<hash>(1ull * (size == 1 ? (k_offset_basis ^ str[0]) : (hash_constexpr(str, size - 1) ^ str[size - 1])) * k_prime);\n\t\t}\n\n\t\tstatic auto __forceinline hash_runtime(const char* str) -> hash {\n\t\t\tauto result{ k_offset_basis };\n\t\t\tdo {\n\t\t\t\tresult ^= *str++;\n\t\t\t\tresult *= k_prime;\n\t\t\t} while (*(str - 1) != '\\0');\n\n\t\t\treturn result;\n\t\t}\n\t};\n}\n\nusing fnv = ::detail::fnv_hash<sizeof(void*) * 8>;\n\n#define FNV(str) (std::integral_constant<fnv::hash, fnv::hash_constexpr(str)>::value)\n"
  },
  {
    "path": "R3nzSkin/imgui/imconfig.h",
    "content": "#pragma once\n\n#define IMGUI_DISABLE_DEMO_WINDOWS\n#define IMGUI_DISABLE_METRICS_WINDOW\n#define IMGUI_IMPL_WIN32_DISABLE_GAMEPAD\n#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS\n"
  },
  {
    "path": "R3nzSkin/imgui/imgui.cpp",
    "content": "// dear imgui, v1.84\n// (main code and documentation)\n\n// Help:\n// - Read FAQ at http://dearimgui.org/faq\n// - Newcomers, read 'Programmer guide' below for notes on how to setup Dear ImGui in your codebase.\n// - Call and read ImGui::ShowDemoWindow() in imgui_demo.cpp. All applications in examples/ are doing that.\n// Read imgui.cpp for details, links and comments.\n\n// Resources:\n// - FAQ                   http://dearimgui.org/faq\n// - Homepage & latest     https://github.com/ocornut/imgui\n// - Releases & changelog  https://github.com/ocornut/imgui/releases\n// - Gallery               https://github.com/ocornut/imgui/issues/4451 (please post your screenshots/video there!)\n// - Wiki                  https://github.com/ocornut/imgui/wiki (lots of good stuff there)\n// - Glossary              https://github.com/ocornut/imgui/wiki/Glossary\n// - Issues & support      https://github.com/ocornut/imgui/issues\n// - Discussions           https://github.com/ocornut/imgui/discussions\n\n// Developed by Omar Cornut and every direct or indirect contributors to the GitHub.\n// See LICENSE.txt for copyright and licensing details (standard MIT License).\n// This library is free but needs your support to sustain development and maintenance.\n// Businesses: you can support continued development via invoiced technical support, maintenance and sponsoring contracts. Please reach out to \"contact AT dearimgui.com\".\n// Individuals: you can support continued development via donations. See docs/README or web page.\n\n// It is recommended that you don't modify imgui.cpp! It will become difficult for you to update the library.\n// Note that 'ImGui::' being a namespace, you can add functions into the namespace from your own source files, without\n// modifying imgui.h or imgui.cpp. You may include imgui_internal.h to access internal data structures, but it doesn't\n// come with any guarantee of forward compatibility. Discussing your changes on the GitHub Issue Tracker may lead you\n// to a better solution or official support for them.\n\n/*\n\nIndex of this file:\n\nDOCUMENTATION\n\n- MISSION STATEMENT\n- END-USER GUIDE\n- PROGRAMMER GUIDE\n  - READ FIRST\n  - HOW TO UPDATE TO A NEWER VERSION OF DEAR IMGUI\n  - GETTING STARTED WITH INTEGRATING DEAR IMGUI IN YOUR CODE/ENGINE\n  - HOW A SIMPLE APPLICATION MAY LOOK LIKE\n  - HOW A SIMPLE RENDERING FUNCTION MAY LOOK LIKE\n  - USING GAMEPAD/KEYBOARD NAVIGATION CONTROLS\n- API BREAKING CHANGES (read me when you update!)\n- FREQUENTLY ASKED QUESTIONS (FAQ)\n  - Read all answers online: https://www.dearimgui.org/faq, or in docs/FAQ.md (with a Markdown viewer)\n\nCODE\n(search for \"[SECTION]\" in the code to find them)\n\n// [SECTION] INCLUDES\n// [SECTION] FORWARD DECLARATIONS\n// [SECTION] CONTEXT AND MEMORY ALLOCATORS\n// [SECTION] USER FACING STRUCTURES (ImGuiStyle, ImGuiIO)\n// [SECTION] MISC HELPERS/UTILITIES (Geometry functions)\n// [SECTION] MISC HELPERS/UTILITIES (String, Format, Hash functions)\n// [SECTION] MISC HELPERS/UTILITIES (File functions)\n// [SECTION] MISC HELPERS/UTILITIES (ImText* functions)\n// [SECTION] MISC HELPERS/UTILITIES (Color functions)\n// [SECTION] ImGuiStorage\n// [SECTION] ImGuiTextFilter\n// [SECTION] ImGuiTextBuffer\n// [SECTION] ImGuiListClipper\n// [SECTION] STYLING\n// [SECTION] RENDER HELPERS\n// [SECTION] MAIN CODE (most of the code! lots of stuff, needs tidying up!)\n// [SECTION] ERROR CHECKING\n// [SECTION] LAYOUT\n// [SECTION] SCROLLING\n// [SECTION] TOOLTIPS\n// [SECTION] POPUPS\n// [SECTION] KEYBOARD/GAMEPAD NAVIGATION\n// [SECTION] DRAG AND DROP\n// [SECTION] LOGGING/CAPTURING\n// [SECTION] SETTINGS\n// [SECTION] VIEWPORTS\n// [SECTION] PLATFORM DEPENDENT HELPERS\n// [SECTION] METRICS/DEBUGGER WINDOW\n\n*/\n\n//-----------------------------------------------------------------------------\n// DOCUMENTATION\n//-----------------------------------------------------------------------------\n\n/*\n\n MISSION STATEMENT\n =================\n\n - Easy to use to create code-driven and data-driven tools.\n - Easy to use to create ad hoc short-lived tools and long-lived, more elaborate tools.\n - Easy to hack and improve.\n - Minimize setup and maintenance.\n - Minimize state storage on user side.\n - Portable, minimize dependencies, run on target (consoles, phones, etc.).\n - Efficient runtime and memory consumption.\n\n Designed for developers and content-creators, not the typical end-user! Some of the current weaknesses includes:\n\n - Doesn't look fancy, doesn't animate.\n - Limited layout features, intricate layouts are typically crafted in code.\n\n\n END-USER GUIDE\n ==============\n\n - Double-click on title bar to collapse window.\n - Click upper right corner to close a window, available when 'bool* p_open' is passed to ImGui::Begin().\n - Click and drag on lower right corner to resize window (double-click to auto fit window to its contents).\n - Click and drag on any empty space to move window.\n - TAB/SHIFT+TAB to cycle through keyboard editable fields.\n - CTRL+Click on a slider or drag box to input value as text.\n - Use mouse wheel to scroll.\n - Text editor:\n   - Hold SHIFT or use mouse to select text.\n   - CTRL+Left/Right to word jump.\n   - CTRL+Shift+Left/Right to select words.\n   - CTRL+A our Double-Click to select all.\n   - CTRL+X,CTRL+C,CTRL+V to use OS clipboard/\n   - CTRL+Z,CTRL+Y to undo/redo.\n   - ESCAPE to revert text to its original value.\n   - You can apply arithmetic operators +,*,/ on numerical values. Use +- to subtract (because - would set a negative value!)\n   - Controls are automatically adjusted for OSX to match standard OSX text editing operations.\n - General Keyboard controls: enable with ImGuiConfigFlags_NavEnableKeyboard.\n - General Gamepad controls: enable with ImGuiConfigFlags_NavEnableGamepad. See suggested mappings in imgui.h ImGuiNavInput_ + download PNG/PSD at http://dearimgui.org/controls_sheets\n\n\n PROGRAMMER GUIDE\n ================\n\n READ FIRST\n ----------\n - Remember to check the wonderful Wiki (https://github.com/ocornut/imgui/wiki)\n - Your code creates the UI, if your code doesn't run the UI is gone! The UI can be highly dynamic, there are no construction or\n   destruction steps, less superfluous data retention on your side, less state duplication, less state synchronization, fewer bugs.\n - Call and read ImGui::ShowDemoWindow() for demo code demonstrating most features.\n - The library is designed to be built from sources. Avoid pre-compiled binaries and packaged versions. See imconfig.h to configure your build.\n - Dear ImGui is an implementation of the IMGUI paradigm (immediate-mode graphical user interface, a term coined by Casey Muratori).\n   You can learn about IMGUI principles at http://www.johno.se/book/imgui.html, http://mollyrocket.com/861 & more links in Wiki.\n - Dear ImGui is a \"single pass\" rasterizing implementation of the IMGUI paradigm, aimed at ease of use and high-performances.\n   For every application frame, your UI code will be called only once. This is in contrast to e.g. Unity's implementation of an IMGUI,\n   where the UI code is called multiple times (\"multiple passes\") from a single entry point. There are pros and cons to both approaches.\n - Our origin is on the top-left. In axis aligned bounding boxes, Min = top-left, Max = bottom-right.\n - This codebase is also optimized to yield decent performances with typical \"Debug\" builds settings.\n - Please make sure you have asserts enabled (IM_ASSERT redirects to assert() by default, but can be redirected).\n   If you get an assert, read the messages and comments around the assert.\n - C++: this is a very C-ish codebase: we don't rely on C++11, we don't include any C++ headers, and ImGui:: is a namespace.\n - C++: ImVec2/ImVec4 do not expose math operators by default, because it is expected that you use your own math types.\n   See FAQ \"How can I use my own math types instead of ImVec2/ImVec4?\" for details about setting up imconfig.h for that.\n   However, imgui_internal.h can optionally export math operators for ImVec2/ImVec4, which we use in this codebase.\n - C++: pay attention that ImVector<> manipulates plain-old-data and does not honor construction/destruction (avoid using it in your code!).\n\n\n HOW TO UPDATE TO A NEWER VERSION OF DEAR IMGUI\n ----------------------------------------------\n - Overwrite all the sources files except for imconfig.h (if you have modified your copy of imconfig.h)\n - Or maintain your own branch where you have imconfig.h modified as a top-most commit which you can regularly rebase over \"master\".\n - You can also use '#define IMGUI_USER_CONFIG \"my_config_file.h\" to redirect configuration to your own file.\n - Read the \"API BREAKING CHANGES\" section (below). This is where we list occasional API breaking changes.\n   If a function/type has been renamed / or marked obsolete, try to fix the name in your code before it is permanently removed\n   from the public API. If you have a problem with a missing function/symbols, search for its name in the code, there will\n   likely be a comment about it. Please report any issue to the GitHub page!\n - To find out usage of old API, you can add '#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS' in your configuration file.\n - Try to keep your copy of Dear ImGui reasonably up to date.\n\n\n GETTING STARTED WITH INTEGRATING DEAR IMGUI IN YOUR CODE/ENGINE\n ---------------------------------------------------------------\n - Run and study the examples and demo in imgui_demo.cpp to get acquainted with the library.\n - In the majority of cases you should be able to use unmodified backends files available in the backends/ folder.\n - Add the Dear ImGui source files + selected backend source files to your projects or using your preferred build system.\n   It is recommended you build and statically link the .cpp files as part of your project and NOT as a shared library (DLL).\n - You can later customize the imconfig.h file to tweak some compile-time behavior, such as integrating Dear ImGui types with your own maths types.\n - When using Dear ImGui, your programming IDE is your friend: follow the declaration of variables, functions and types to find comments about them.\n - Dear ImGui never touches or knows about your GPU state. The only function that knows about GPU is the draw function that you provide.\n   Effectively it means you can create widgets at any time in your code, regardless of considerations of being in \"update\" vs \"render\"\n   phases of your own application. All rendering information is stored into command-lists that you will retrieve after calling ImGui::Render().\n - Refer to the backends and demo applications in the examples/ folder for instruction on how to setup your code.\n - If you are running over a standard OS with a common graphics API, you should be able to use unmodified imgui_impl_*** files from the examples/ folder.\n\n\n HOW A SIMPLE APPLICATION MAY LOOK LIKE\n --------------------------------------\n EXHIBIT 1: USING THE EXAMPLE BACKENDS (= imgui_impl_XXX.cpp files from the backends/ folder).\n The sub-folders in examples/ contain examples applications following this structure.\n\n     // Application init: create a dear imgui context, setup some options, load fonts\n     ImGui::CreateContext();\n     ImGuiIO& io = ImGui::GetIO();\n     // TODO: Set optional io.ConfigFlags values, e.g. 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard' to enable keyboard controls.\n     // TODO: Fill optional fields of the io structure later.\n     // TODO: Load TTF/OTF fonts if you don't want to use the default font.\n\n     // Initialize helper Platform and Renderer backends (here we are using imgui_impl_win32.cpp and imgui_impl_dx11.cpp)\n     ImGui_ImplWin32_Init(hwnd);\n     ImGui_ImplDX11_Init(g_pd3dDevice, g_pd3dDeviceContext);\n\n     // Application main loop\n     while (true)\n     {\n         // Feed inputs to dear imgui, start new frame\n         ImGui_ImplDX11_NewFrame();\n         ImGui_ImplWin32_NewFrame();\n         ImGui::NewFrame();\n\n         // Any application code here\n         ImGui::Text(\"Hello, world!\");\n\n         // Render dear imgui into screen\n         ImGui::Render();\n         ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());\n         g_pSwapChain->Present(1, 0);\n     }\n\n     // Shutdown\n     ImGui_ImplDX11_Shutdown();\n     ImGui_ImplWin32_Shutdown();\n     ImGui::DestroyContext();\n\n EXHIBIT 2: IMPLEMENTING CUSTOM BACKEND / CUSTOM ENGINE\n\n     // Application init: create a dear imgui context, setup some options, load fonts\n     ImGui::CreateContext();\n     ImGuiIO& io = ImGui::GetIO();\n     // TODO: Set optional io.ConfigFlags values, e.g. 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard' to enable keyboard controls.\n     // TODO: Fill optional fields of the io structure later.\n     // TODO: Load TTF/OTF fonts if you don't want to use the default font.\n\n     // Build and load the texture atlas into a texture\n     // (In the examples/ app this is usually done within the ImGui_ImplXXX_Init() function from one of the demo Renderer)\n     int width, height;\n     unsigned char* pixels = NULL;\n     io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height);\n\n     // At this point you've got the texture data and you need to upload that to your graphic system:\n     // After we have created the texture, store its pointer/identifier (_in whichever format your engine uses_) in 'io.Fonts->TexID'.\n     // This will be passed back to your via the renderer. Basically ImTextureID == void*. Read FAQ for details about ImTextureID.\n     MyTexture* texture = MyEngine::CreateTextureFromMemoryPixels(pixels, width, height, TEXTURE_TYPE_RGBA32)\n     io.Fonts->SetTexID((void*)texture);\n\n     // Application main loop\n     while (true)\n     {\n        // Setup low-level inputs, e.g. on Win32: calling GetKeyboardState(), or write to those fields from your Windows message handlers, etc.\n        // (In the examples/ app this is usually done within the ImGui_ImplXXX_NewFrame() function from one of the demo Platform Backends)\n        io.DeltaTime = 1.0f/60.0f;              // set the time elapsed since the previous frame (in seconds)\n        io.DisplaySize.x = 1920.0f;             // set the current display width\n        io.DisplaySize.y = 1280.0f;             // set the current display height here\n        io.MousePos = my_mouse_pos;             // set the mouse position\n        io.MouseDown[0] = my_mouse_buttons[0];  // set the mouse button states\n        io.MouseDown[1] = my_mouse_buttons[1];\n\n        // Call NewFrame(), after this point you can use ImGui::* functions anytime\n        // (So you want to try calling NewFrame() as early as you can in your main loop to be able to use Dear ImGui everywhere)\n        ImGui::NewFrame();\n\n        // Most of your application code here\n        ImGui::Text(\"Hello, world!\");\n        MyGameUpdate(); // may use any Dear ImGui functions, e.g. ImGui::Begin(\"My window\"); ImGui::Text(\"Hello, world!\"); ImGui::End();\n        MyGameRender(); // may use any Dear ImGui functions as well!\n\n        // Render dear imgui, swap buffers\n        // (You want to try calling EndFrame/Render as late as you can, to be able to use Dear ImGui in your own game rendering code)\n        ImGui::EndFrame();\n        ImGui::Render();\n        ImDrawData* draw_data = ImGui::GetDrawData();\n        MyImGuiRenderFunction(draw_data);\n        SwapBuffers();\n     }\n\n     // Shutdown\n     ImGui::DestroyContext();\n\n To decide whether to dispatch mouse/keyboard inputs to Dear ImGui to the rest of your application,\n you should read the 'io.WantCaptureMouse', 'io.WantCaptureKeyboard' and 'io.WantTextInput' flags!\n Please read the FAQ and example applications for details about this!\n\n\n HOW A SIMPLE RENDERING FUNCTION MAY LOOK LIKE\n ---------------------------------------------\n The backends in impl_impl_XXX.cpp files contain many working implementations of a rendering function.\n\n    void void MyImGuiRenderFunction(ImDrawData* draw_data)\n    {\n       // TODO: Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled\n       // TODO: Setup viewport covering draw_data->DisplayPos to draw_data->DisplayPos + draw_data->DisplaySize\n       // TODO: Setup orthographic projection matrix cover draw_data->DisplayPos to draw_data->DisplayPos + draw_data->DisplaySize\n       // TODO: Setup shader: vertex { float2 pos, float2 uv, u32 color }, fragment shader sample color from 1 texture, multiply by vertex color.\n       for (int n = 0; n < draw_data->CmdListsCount; n++)\n       {\n          const ImDrawList* cmd_list = draw_data->CmdLists[n];\n          const ImDrawVert* vtx_buffer = cmd_list->VtxBuffer.Data;  // vertex buffer generated by Dear ImGui\n          const ImDrawIdx* idx_buffer = cmd_list->IdxBuffer.Data;   // index buffer generated by Dear ImGui\n          for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)\n          {\n             const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];\n             if (pcmd->UserCallback)\n             {\n                 pcmd->UserCallback(cmd_list, pcmd);\n             }\n             else\n             {\n                 // The texture for the draw call is specified by pcmd->GetTexID().\n                 // The vast majority of draw calls will use the Dear ImGui texture atlas, which value you have set yourself during initialization.\n                 MyEngineBindTexture((MyTexture*)pcmd->GetTexID());\n\n                 // We are using scissoring to clip some objects. All low-level graphics API should support it.\n                 // - If your engine doesn't support scissoring yet, you may ignore this at first. You will get some small glitches\n                 //   (some elements visible outside their bounds) but you can fix that once everything else works!\n                 // - Clipping coordinates are provided in imgui coordinates space:\n                 //   - For a given viewport, draw_data->DisplayPos == viewport->Pos and draw_data->DisplaySize == viewport->Size\n                 //   - In a single viewport application, draw_data->DisplayPos == (0,0) and draw_data->DisplaySize == io.DisplaySize, but always use GetMainViewport()->Pos/Size instead of hardcoding those values.\n                 //   - In the interest of supporting multi-viewport applications (see 'docking' branch on github),\n                 //     always subtract draw_data->DisplayPos from clipping bounds to convert them to your viewport space.\n                 // - Note that pcmd->ClipRect contains Min+Max bounds. Some graphics API may use Min+Max, other may use Min+Size (size being Max-Min)\n                 ImVec2 pos = draw_data->DisplayPos;\n                 MyEngineScissor((int)(pcmd->ClipRect.x - pos.x), (int)(pcmd->ClipRect.y - pos.y), (int)(pcmd->ClipRect.z - pos.x), (int)(pcmd->ClipRect.w - pos.y));\n\n                 // Render 'pcmd->ElemCount/3' indexed triangles.\n                 // By default the indices ImDrawIdx are 16-bit, you can change them to 32-bit in imconfig.h if your engine doesn't support 16-bit indices.\n                 MyEngineDrawIndexedTriangles(pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, idx_buffer, vtx_buffer);\n             }\n             idx_buffer += pcmd->ElemCount;\n          }\n       }\n    }\n\n\n USING GAMEPAD/KEYBOARD NAVIGATION CONTROLS\n ------------------------------------------\n - The gamepad/keyboard navigation is fairly functional and keeps being improved.\n - Gamepad support is particularly useful to use Dear ImGui on a console system (e.g. PS4, Switch, XB1) without a mouse!\n - You can ask questions and report issues at https://github.com/ocornut/imgui/issues/787\n - The initial focus was to support game controllers, but keyboard is becoming increasingly and decently usable.\n - Keyboard:\n    - Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard to enable.\n      NewFrame() will automatically fill io.NavInputs[] based on your io.KeysDown[] + io.KeyMap[] arrays.\n    - When keyboard navigation is active (io.NavActive + ImGuiConfigFlags_NavEnableKeyboard), the io.WantCaptureKeyboard flag\n      will be set. For more advanced uses, you may want to read from:\n       - io.NavActive: true when a window is focused and it doesn't have the ImGuiWindowFlags_NoNavInputs flag set.\n       - io.NavVisible: true when the navigation cursor is visible (and usually goes false when mouse is used).\n       - or query focus information with e.g. IsWindowFocused(ImGuiFocusedFlags_AnyWindow), IsItemFocused() etc. functions.\n      Please reach out if you think the game vs navigation input sharing could be improved.\n - Gamepad:\n    - Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad to enable.\n    - Backend: Set io.BackendFlags |= ImGuiBackendFlags_HasGamepad + fill the io.NavInputs[] fields before calling NewFrame().\n      Note that io.NavInputs[] is cleared by EndFrame().\n    - See 'enum ImGuiNavInput_' in imgui.h for a description of inputs. For each entry of io.NavInputs[], set the following values:\n         0.0f= not held. 1.0f= fully held. Pass intermediate 0.0f..1.0f values for analog triggers/sticks.\n    - We use a simple >0.0f test for activation testing, and won't attempt to test for a dead-zone.\n      Your code will probably need to transform your raw inputs (such as e.g. remapping your 0.2..0.9 raw input range to 0.0..1.0 imgui range, etc.).\n    - You can download PNG/PSD files depicting the gamepad controls for common controllers at: http://dearimgui.org/controls_sheets\n    - If you need to share inputs between your game and the imgui parts, the easiest approach is to go all-or-nothing, with a buttons combo\n      to toggle the target. Please reach out if you think the game vs navigation input sharing could be improved.\n - Mouse:\n    - PS4 users: Consider emulating a mouse cursor with DualShock4 touch pad or a spare analog stick as a mouse-emulation fallback.\n    - Consoles/Tablet/Phone users: Consider using a Synergy 1.x server (on your PC) + uSynergy.c (on your console/tablet/phone app) to share your PC mouse/keyboard.\n    - On a TV/console system where readability may be lower or mouse inputs may be awkward, you may want to set the ImGuiConfigFlags_NavEnableSetMousePos flag.\n      Enabling ImGuiConfigFlags_NavEnableSetMousePos + ImGuiBackendFlags_HasSetMousePos instructs dear imgui to move your mouse cursor along with navigation movements.\n      When enabled, the NewFrame() function may alter 'io.MousePos' and set 'io.WantSetMousePos' to notify you that it wants the mouse cursor to be moved.\n      When that happens your backend NEEDS to move the OS or underlying mouse cursor on the next frame. Some of the backends in examples/ do that.\n      (If you set the NavEnableSetMousePos flag but don't honor 'io.WantSetMousePos' properly, imgui will misbehave as it will see your mouse moving back and forth!)\n      (In a setup when you may not have easy control over the mouse cursor, e.g. uSynergy.c doesn't expose moving remote mouse cursor, you may want\n       to set a boolean to ignore your other external mouse positions until the external source is moved again.)\n\n\n API BREAKING CHANGES\n ====================\n\n Occasionally introducing changes that are breaking the API. We try to make the breakage minor and easy to fix.\n Below is a change-log of API breaking changes only. If you are using one of the functions listed, expect to have to fix some code.\n When you are not sure about an old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files.\n You can read releases logs https://github.com/ocornut/imgui/releases for more details.\n\n - 2021/07/26 (1.84) - commented out redirecting functions/enums names that were marked obsolete in 1.67 and 1.69 (March 2019):\n                        - ImGui::GetOverlayDrawList() -> use ImGui::GetForegroundDrawList()\n                        - ImFont::GlyphRangesBuilder  -> use ImFontGlyphRangesBuilder\n - 2021/05/19 (1.83) - backends: obsoleted direct access to ImDrawCmd::TextureId in favor of calling ImDrawCmd::GetTexID().\n                        - if you are using official backends from the source tree: you have nothing to do.\n                        - if you have copied old backend code or using your own: change access to draw_cmd->TextureId to draw_cmd->GetTexID().\n - 2021/03/12 (1.82) - upgraded ImDrawList::AddRect(), AddRectFilled(), PathRect() to use ImDrawFlags instead of ImDrawCornersFlags.\n                        - ImDrawCornerFlags_TopLeft  -> use ImDrawFlags_RoundCornersTopLeft\n                        - ImDrawCornerFlags_BotRight -> use ImDrawFlags_RoundCornersBottomRight\n                        - ImDrawCornerFlags_None     -> use ImDrawFlags_RoundCornersNone etc.\n                       flags now sanely defaults to 0 instead of 0x0F, consistent with all other flags in the API.\n                       breaking: the default with rounding > 0.0f is now \"round all corners\" vs old implicit \"round no corners\":\n                        - rounding == 0.0f + flags == 0 --> meant no rounding  --> unchanged (common use)\n                        - rounding  > 0.0f + flags != 0 --> meant rounding     --> unchanged (common use)\n                        - rounding == 0.0f + flags != 0 --> meant no rounding  --> unchanged (unlikely use)\n                        - rounding  > 0.0f + flags == 0 --> meant no rounding  --> BREAKING (unlikely use): will now round all corners --> use ImDrawFlags_RoundCornersNone or rounding == 0.0f.\n                       this ONLY matters for hard coded use of 0 + rounding > 0.0f. Use of named ImDrawFlags_RoundCornersNone (new) or ImDrawCornerFlags_None (old) are ok.\n                       the old ImDrawCornersFlags used awkward default values of ~0 or 0xF (4 lower bits set) to signify \"round all corners\" and we sometimes encouraged using them as shortcuts.\n                       legacy path still support use of hard coded ~0 or any value from 0x1 or 0xF. They will behave the same with legacy paths enabled (will assert otherwise).\n - 2021/03/11 (1.82) - removed redirecting functions/enums names that were marked obsolete in 1.66 (September 2018):\n                        - ImGui::SetScrollHere()              -> use ImGui::SetScrollHereY()\n - 2021/03/11 (1.82) - clarified that ImDrawList::PathArcTo(), ImDrawList::PathArcToFast() won't render with radius < 0.0f. Previously it sorts of accidentally worked but would generally lead to counter-clockwise paths and have an effect on anti-aliasing.\n - 2021/03/10 (1.82) - upgraded ImDrawList::AddPolyline() and PathStroke() \"bool closed\" parameter to \"ImDrawFlags flags\". The matching ImDrawFlags_Closed value is guaranteed to always stay == 1 in the future.\n - 2021/02/22 (1.82) - (*undone in 1.84*) win32+mingw: Re-enabled IME functions by default even under MinGW. In July 2016, issue #738 had me incorrectly disable those default functions for MinGW. MinGW users should: either link with -limm32, either set their imconfig file  with '#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS'.\n - 2021/02/17 (1.82) - renamed rarely used style.CircleSegmentMaxError (old default = 1.60f) to style.CircleTessellationMaxError (new default = 0.30f) as the meaning of the value changed.\n - 2021/02/03 (1.81) - renamed ListBoxHeader(const char* label, ImVec2 size) to BeginListBox(). Kept inline redirection function (will obsolete).\n                     - removed ListBoxHeader(const char* label, int items_count, int height_in_items = -1) in favor of specifying size. Kept inline redirection function (will obsolete).\n                     - renamed ListBoxFooter() to EndListBox(). Kept inline redirection function (will obsolete).\n - 2021/01/26 (1.81) - removed ImGuiFreeType::BuildFontAtlas(). Kept inline redirection function. Prefer using '#define IMGUI_ENABLE_FREETYPE', but there's a runtime selection path available too. The shared extra flags parameters (very rarely used) are now stored in ImFontAtlas::FontBuilderFlags.\n                     - renamed ImFontConfig::RasterizerFlags (used by FreeType) to ImFontConfig::FontBuilderFlags.\n                     - renamed ImGuiFreeType::XXX flags to ImGuiFreeTypeBuilderFlags_XXX for consistency with other API.\n - 2020/10/12 (1.80) - removed redirecting functions/enums that were marked obsolete in 1.63 (August 2018):\n                        - ImGui::IsItemDeactivatedAfterChange() -> use ImGui::IsItemDeactivatedAfterEdit().\n                        - ImGuiCol_ModalWindowDarkening       -> use ImGuiCol_ModalWindowDimBg\n                        - ImGuiInputTextCallback              -> use ImGuiTextEditCallback\n                        - ImGuiInputTextCallbackData          -> use ImGuiTextEditCallbackData\n - 2020/12/21 (1.80) - renamed ImDrawList::AddBezierCurve() to AddBezierCubic(), and PathBezierCurveTo() to PathBezierCubicCurveTo(). Kept inline redirection function (will obsolete).\n - 2020/12/04 (1.80) - added imgui_tables.cpp file! Manually constructed project files will need the new file added!\n - 2020/11/18 (1.80) - renamed undocumented/internals ImGuiColumnsFlags_* to ImGuiOldColumnFlags_* in prevision of incoming Tables API.\n - 2020/11/03 (1.80) - renamed io.ConfigWindowsMemoryCompactTimer to io.ConfigMemoryCompactTimer as the feature will apply to other data structures\n - 2020/10/14 (1.80) - backends: moved all backends files (imgui_impl_XXXX.cpp, imgui_impl_XXXX.h) from examples/ to backends/.\n - 2020/10/12 (1.80) - removed redirecting functions/enums that were marked obsolete in 1.60 (April 2018):\n                        - io.RenderDrawListsFn pointer        -> use ImGui::GetDrawData() value and call the render function of your backend\n                        - ImGui::IsAnyWindowFocused()         -> use ImGui::IsWindowFocused(ImGuiFocusedFlags_AnyWindow)\n                        - ImGui::IsAnyWindowHovered()         -> use ImGui::IsWindowHovered(ImGuiHoveredFlags_AnyWindow)\n                        - ImGuiStyleVar_Count_                -> use ImGuiStyleVar_COUNT\n                        - ImGuiMouseCursor_Count_             -> use ImGuiMouseCursor_COUNT\n                      - removed redirecting functions names that were marked obsolete in 1.61 (May 2018):\n                        - InputFloat (... int decimal_precision ...) -> use InputFloat (... const char* format ...) with format = \"%.Xf\" where X is your value for decimal_precision.\n                        - same for InputFloat2()/InputFloat3()/InputFloat4() variants taking a `int decimal_precision` parameter.\n - 2020/10/05 (1.79) - removed ImGuiListClipper: Renamed constructor parameters which created an ambiguous alternative to using the ImGuiListClipper::Begin() function, with misleading edge cases (note: imgui_memory_editor <0.40 from imgui_club/ used this old clipper API. Update your copy if needed).\n - 2020/09/25 (1.79) - renamed ImGuiSliderFlags_ClampOnInput to ImGuiSliderFlags_AlwaysClamp. Kept redirection enum (will obsolete sooner because previous name was added recently).\n - 2020/09/25 (1.79) - renamed style.TabMinWidthForUnselectedCloseButton to style.TabMinWidthForCloseButton.\n - 2020/09/21 (1.79) - renamed OpenPopupContextItem() back to OpenPopupOnItemClick(), reverting the change from 1.77. For varieties of reason this is more self-explanatory.\n - 2020/09/21 (1.79) - removed return value from OpenPopupOnItemClick() - returned true on mouse release on an item - because it is inconsistent with other popup APIs and makes others misleading. It's also and unnecessary: you can use IsWindowAppearing() after BeginPopup() for a similar result.\n - 2020/09/17 (1.79) - removed ImFont::DisplayOffset in favor of ImFontConfig::GlyphOffset. DisplayOffset was applied after scaling and not very meaningful/useful outside of being needed by the default ProggyClean font. If you scaled this value after calling AddFontDefault(), this is now done automatically. It was also getting in the way of better font scaling, so let's get rid of it now!\n - 2020/08/17 (1.78) - obsoleted use of the trailing 'float power=1.0f' parameter for DragFloat(), DragFloat2(), DragFloat3(), DragFloat4(), DragFloatRange2(), DragScalar(), DragScalarN(), SliderFloat(), SliderFloat2(), SliderFloat3(), SliderFloat4(), SliderScalar(), SliderScalarN(), VSliderFloat() and VSliderScalar().\n                       replaced the 'float power=1.0f' argument with integer-based flags defaulting to 0 (as with all our flags).\n                       worked out a backward-compatibility scheme so hopefully most C++ codebase should not be affected. in short, when calling those functions:\n                       - if you omitted the 'power' parameter (likely!), you are not affected.\n                       - if you set the 'power' parameter to 1.0f (same as previous default value): 1/ your compiler may warn on float>int conversion, 2/ everything else will work. 3/ you can replace the 1.0f value with 0 to fix the warning, and be technically correct.\n                       - if you set the 'power' parameter to >1.0f (to enable non-linear editing): 1/ your compiler may warn on float>int conversion, 2/ code will assert at runtime, 3/ in case asserts are disabled, the code will not crash and enable the _Logarithmic flag. 4/ you can replace the >1.0f value with ImGuiSliderFlags_Logarithmic to fix the warning/assert and get a _similar_ effect as previous uses of power >1.0f.\n                       see https://github.com/ocornut/imgui/issues/3361 for all details.\n                       kept inline redirection functions (will obsolete) apart for: DragFloatRange2(), VSliderFloat(), VSliderScalar(). For those three the 'float power=1.0f' version was removed directly as they were most unlikely ever used.\n                       for shared code, you can version check at compile-time with `#if IMGUI_VERSION_NUM >= 17704`.\n                     - obsoleted use of v_min > v_max in DragInt, DragFloat, DragScalar to lock edits (introduced in 1.73, was not demoed nor documented very), will be replaced by a more generic ReadOnly feature. You may use the ImGuiSliderFlags_ReadOnly internal flag in the meantime.\n - 2020/06/23 (1.77) - removed BeginPopupContextWindow(const char*, int mouse_button, bool also_over_items) in favor of BeginPopupContextWindow(const char*, ImGuiPopupFlags flags) with ImGuiPopupFlags_NoOverItems.\n - 2020/06/15 (1.77) - renamed OpenPopupOnItemClick() to OpenPopupContextItem(). Kept inline redirection function (will obsolete). [NOTE: THIS WAS REVERTED IN 1.79]\n - 2020/06/15 (1.77) - removed CalcItemRectClosestPoint() entry point which was made obsolete and asserting in December 2017.\n - 2020/04/23 (1.77) - removed unnecessary ID (first arg) of ImFontAtlas::AddCustomRectRegular().\n - 2020/01/22 (1.75) - ImDrawList::AddCircle()/AddCircleFilled() functions don't accept negative radius any more.\n - 2019/12/17 (1.75) - [undid this change in 1.76] made Columns() limited to 64 columns by asserting above that limit. While the current code technically supports it, future code may not so we're putting the restriction ahead.\n - 2019/12/13 (1.75) - [imgui_internal.h] changed ImRect() default constructor initializes all fields to 0.0f instead of (FLT_MAX,FLT_MAX,-FLT_MAX,-FLT_MAX). If you used ImRect::Add() to create bounding boxes by adding multiple points into it, you may need to fix your initial value.\n - 2019/12/08 (1.75) - removed redirecting functions/enums that were marked obsolete in 1.53 (December 2017):\n                       - ShowTestWindow()                    -> use ShowDemoWindow()\n                       - IsRootWindowFocused()               -> use IsWindowFocused(ImGuiFocusedFlags_RootWindow)\n                       - IsRootWindowOrAnyChildFocused()     -> use IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows)\n                       - SetNextWindowContentWidth(w)        -> use SetNextWindowContentSize(ImVec2(w, 0.0f)\n                       - GetItemsLineHeightWithSpacing()     -> use GetFrameHeightWithSpacing()\n                       - ImGuiCol_ChildWindowBg              -> use ImGuiCol_ChildBg\n                       - ImGuiStyleVar_ChildWindowRounding   -> use ImGuiStyleVar_ChildRounding\n                       - ImGuiTreeNodeFlags_AllowOverlapMode -> use ImGuiTreeNodeFlags_AllowItemOverlap\n                       - IMGUI_DISABLE_TEST_WINDOWS          -> use IMGUI_DISABLE_DEMO_WINDOWS\n - 2019/12/08 (1.75) - obsoleted calling ImDrawList::PrimReserve() with a negative count (which was vaguely documented and rarely if ever used). Instead, we added an explicit PrimUnreserve() API.\n - 2019/12/06 (1.75) - removed implicit default parameter to IsMouseDragging(int button = 0) to be consistent with other mouse functions (none of the other functions have it).\n - 2019/11/21 (1.74) - ImFontAtlas::AddCustomRectRegular() now requires an ID larger than 0x110000 (instead of 0x10000) to conform with supporting Unicode planes 1-16 in a future update. ID below 0x110000 will now assert.\n - 2019/11/19 (1.74) - renamed IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS to IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS for consistency.\n - 2019/11/19 (1.74) - renamed IMGUI_DISABLE_MATH_FUNCTIONS to IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS for consistency.\n - 2019/10/22 (1.74) - removed redirecting functions/enums that were marked obsolete in 1.52 (October 2017):\n                       - Begin() [old 5 args version]        -> use Begin() [3 args], use SetNextWindowSize() SetNextWindowBgAlpha() if needed\n                       - IsRootWindowOrAnyChildHovered()     -> use IsWindowHovered(ImGuiHoveredFlags_RootAndChildWindows)\n                       - AlignFirstTextHeightToWidgets()     -> use AlignTextToFramePadding()\n                       - SetNextWindowPosCenter()            -> use SetNextWindowPos() with a pivot of (0.5f, 0.5f)\n                       - ImFont::Glyph                       -> use ImFontGlyph\n - 2019/10/14 (1.74) - inputs: Fixed a miscalculation in the keyboard/mouse \"typematic\" repeat delay/rate calculation, used by keys and e.g. repeating mouse buttons as well as the GetKeyPressedAmount() function.\n                       if you were using a non-default value for io.KeyRepeatRate (previous default was 0.250), you can add +io.KeyRepeatDelay to it to compensate for the fix.\n                       The function was triggering on: 0.0 and (delay+rate*N) where (N>=1). Fixed formula responds to (N>=0). Effectively it made io.KeyRepeatRate behave like it was set to (io.KeyRepeatRate + io.KeyRepeatDelay).\n                       If you never altered io.KeyRepeatRate nor used GetKeyPressedAmount() this won't affect you.\n - 2019/07/15 (1.72) - removed TreeAdvanceToLabelPos() which is rarely used and only does SetCursorPosX(GetCursorPosX() + GetTreeNodeToLabelSpacing()). Kept redirection function (will obsolete).\n - 2019/07/12 (1.72) - renamed ImFontAtlas::CustomRect to ImFontAtlasCustomRect. Kept redirection typedef (will obsolete).\n - 2019/06/14 (1.72) - removed redirecting functions/enums names that were marked obsolete in 1.51 (June 2017): ImGuiCol_Column*, ImGuiSetCond_*, IsItemHoveredRect(), IsPosHoveringAnyWindow(), IsMouseHoveringAnyWindow(), IsMouseHoveringWindow(), IMGUI_ONCE_UPON_A_FRAME. Grep this log for details and new names, or see how they were implemented until 1.71.\n - 2019/06/07 (1.71) - rendering of child window outer decorations (bg color, border, scrollbars) is now performed as part of the parent window. If you have\n                       overlapping child windows in a same parent, and relied on their relative z-order to be mapped to their submission order, this will affect your rendering.\n                       This optimization is disabled if the parent window has no visual output, because it appears to be the most common situation leading to the creation of overlapping child windows.\n                       Please reach out if you are affected.\n - 2019/05/13 (1.71) - renamed SetNextTreeNodeOpen() to SetNextItemOpen(). Kept inline redirection function (will obsolete).\n - 2019/05/11 (1.71) - changed io.AddInputCharacter(unsigned short c) signature to io.AddInputCharacter(unsigned int c).\n - 2019/04/29 (1.70) - improved ImDrawList thick strokes (>1.0f) preserving correct thickness up to 90 degrees angles (e.g. rectangles). If you have custom rendering using thick lines, they will appear thicker now.\n - 2019/04/29 (1.70) - removed GetContentRegionAvailWidth(), use GetContentRegionAvail().x instead. Kept inline redirection function (will obsolete).\n - 2019/03/04 (1.69) - renamed GetOverlayDrawList() to GetForegroundDrawList(). Kept redirection function (will obsolete).\n - 2019/02/26 (1.69) - renamed ImGuiColorEditFlags_RGB/ImGuiColorEditFlags_HSV/ImGuiColorEditFlags_HEX to ImGuiColorEditFlags_DisplayRGB/ImGuiColorEditFlags_DisplayHSV/ImGuiColorEditFlags_DisplayHex. Kept redirection enums (will obsolete).\n - 2019/02/14 (1.68) - made it illegal/assert when io.DisplayTime == 0.0f (with an exception for the first frame). If for some reason your time step calculation gives you a zero value, replace it with an arbitrarily small value!\n - 2019/02/01 (1.68) - removed io.DisplayVisibleMin/DisplayVisibleMax (which were marked obsolete and removed from viewport/docking branch already).\n - 2019/01/06 (1.67) - renamed io.InputCharacters[], marked internal as was always intended. Please don't access directly, and use AddInputCharacter() instead!\n - 2019/01/06 (1.67) - renamed ImFontAtlas::GlyphRangesBuilder to ImFontGlyphRangesBuilder. Kept redirection typedef (will obsolete).\n - 2018/12/20 (1.67) - made it illegal to call Begin(\"\") with an empty string. This somehow half-worked before but had various undesirable side-effects.\n - 2018/12/10 (1.67) - renamed io.ConfigResizeWindowsFromEdges to io.ConfigWindowsResizeFromEdges as we are doing a large pass on configuration flags.\n - 2018/10/12 (1.66) - renamed misc/stl/imgui_stl.* to misc/cpp/imgui_stdlib.* in prevision for other C++ helper files.\n - 2018/09/28 (1.66) - renamed SetScrollHere() to SetScrollHereY(). Kept redirection function (will obsolete).\n - 2018/09/06 (1.65) - renamed stb_truetype.h to imstb_truetype.h, stb_textedit.h to imstb_textedit.h, and stb_rect_pack.h to imstb_rectpack.h.\n                       If you were conveniently using the imgui copy of those STB headers in your project you will have to update your include paths.\n - 2018/09/05 (1.65) - renamed io.OptCursorBlink/io.ConfigCursorBlink to io.ConfigInputTextCursorBlink. (#1427)\n - 2018/08/31 (1.64) - added imgui_widgets.cpp file, extracted and moved widgets code out of imgui.cpp into imgui_widgets.cpp. Re-ordered some of the code remaining in imgui.cpp.\n                       NONE OF THE FUNCTIONS HAVE CHANGED. THE CODE IS SEMANTICALLY 100% IDENTICAL, BUT _EVERY_ FUNCTION HAS BEEN MOVED.\n                       Because of this, any local modifications to imgui.cpp will likely conflict when you update. Read docs/CHANGELOG.txt for suggestions.\n - 2018/08/22 (1.63) - renamed IsItemDeactivatedAfterChange() to IsItemDeactivatedAfterEdit() for consistency with new IsItemEdited() API. Kept redirection function (will obsolete soonish as IsItemDeactivatedAfterChange() is very recent).\n - 2018/08/21 (1.63) - renamed ImGuiTextEditCallback to ImGuiInputTextCallback, ImGuiTextEditCallbackData to ImGuiInputTextCallbackData for consistency. Kept redirection types (will obsolete).\n - 2018/08/21 (1.63) - removed ImGuiInputTextCallbackData::ReadOnly since it is a duplication of (ImGuiInputTextCallbackData::Flags & ImGuiInputTextFlags_ReadOnly).\n - 2018/08/01 (1.63) - removed per-window ImGuiWindowFlags_ResizeFromAnySide beta flag in favor of a global io.ConfigResizeWindowsFromEdges [update 1.67 renamed to ConfigWindowsResizeFromEdges] to enable the feature.\n - 2018/08/01 (1.63) - renamed io.OptCursorBlink to io.ConfigCursorBlink [-> io.ConfigInputTextCursorBlink in 1.65], io.OptMacOSXBehaviors to ConfigMacOSXBehaviors for consistency.\n - 2018/07/22 (1.63) - changed ImGui::GetTime() return value from float to double to avoid accumulating floating point imprecisions over time.\n - 2018/07/08 (1.63) - style: renamed ImGuiCol_ModalWindowDarkening to ImGuiCol_ModalWindowDimBg for consistency with other features. Kept redirection enum (will obsolete).\n - 2018/06/08 (1.62) - examples: the imgui_impl_XXX files have been split to separate platform (Win32, GLFW, SDL2, etc.) from renderer (DX11, OpenGL, Vulkan,  etc.).\n                       old backends will still work as is, however prefer using the separated backends as they will be updated to support multi-viewports.\n                       when adopting new backends follow the main.cpp code of your preferred examples/ folder to know which functions to call.\n                       in particular, note that old backends called ImGui::NewFrame() at the end of their ImGui_ImplXXXX_NewFrame() function.\n - 2018/06/06 (1.62) - renamed GetGlyphRangesChinese() to GetGlyphRangesChineseFull() to distinguish other variants and discourage using the full set.\n - 2018/06/06 (1.62) - TreeNodeEx()/TreeNodeBehavior(): the ImGuiTreeNodeFlags_CollapsingHeader helper now include the ImGuiTreeNodeFlags_NoTreePushOnOpen flag. See Changelog for details.\n - 2018/05/03 (1.61) - DragInt(): the default compile-time format string has been changed from \"%.0f\" to \"%d\", as we are not using integers internally any more.\n                       If you used DragInt() with custom format strings, make sure you change them to use %d or an integer-compatible format.\n                       To honor backward-compatibility, the DragInt() code will currently parse and modify format strings to replace %*f with %d, giving time to users to upgrade their code.\n                       If you have IMGUI_DISABLE_OBSOLETE_FUNCTIONS enabled, the code will instead assert! You may run a reg-exp search on your codebase for e.g. \"DragInt.*%f\" to help you find them.\n - 2018/04/28 (1.61) - obsoleted InputFloat() functions taking an optional \"int decimal_precision\" in favor of an equivalent and more flexible \"const char* format\",\n                       consistent with other functions. Kept redirection functions (will obsolete).\n - 2018/04/09 (1.61) - IM_DELETE() helper function added in 1.60 doesn't clear the input _pointer_ reference, more consistent with expectation and allows passing r-value.\n - 2018/03/20 (1.60) - renamed io.WantMoveMouse to io.WantSetMousePos for consistency and ease of understanding (was added in 1.52, _not_ used by core and only honored by some backend ahead of merging the Nav branch).\n - 2018/03/12 (1.60) - removed ImGuiCol_CloseButton, ImGuiCol_CloseButtonActive, ImGuiCol_CloseButtonHovered as the closing cross uses regular button colors now.\n - 2018/03/08 (1.60) - changed ImFont::DisplayOffset.y to default to 0 instead of +1. Fixed rounding of Ascent/Descent to match TrueType renderer. If you were adding or subtracting to ImFont::DisplayOffset check if your fonts are correctly aligned vertically.\n - 2018/03/03 (1.60) - renamed ImGuiStyleVar_Count_ to ImGuiStyleVar_COUNT and ImGuiMouseCursor_Count_ to ImGuiMouseCursor_COUNT for consistency with other public enums.\n - 2018/02/18 (1.60) - BeginDragDropSource(): temporarily removed the optional mouse_button=0 parameter because it is not really usable in many situations at the moment.\n - 2018/02/16 (1.60) - obsoleted the io.RenderDrawListsFn callback, you can call your graphics engine render function after ImGui::Render(). Use ImGui::GetDrawData() to retrieve the ImDrawData* to display.\n - 2018/02/07 (1.60) - reorganized context handling to be more explicit,\n                       - YOU NOW NEED TO CALL ImGui::CreateContext() AT THE BEGINNING OF YOUR APP, AND CALL ImGui::DestroyContext() AT THE END.\n                       - removed Shutdown() function, as DestroyContext() serve this purpose.\n                       - you may pass a ImFontAtlas* pointer to CreateContext() to share a font atlas between contexts. Otherwise CreateContext() will create its own font atlas instance.\n                       - removed allocator parameters from CreateContext(), they are now setup with SetAllocatorFunctions(), and shared by all contexts.\n                       - removed the default global context and font atlas instance, which were confusing for users of DLL reloading and users of multiple contexts.\n - 2018/01/31 (1.60) - moved sample TTF files from extra_fonts/ to misc/fonts/. If you loaded files directly from the imgui repo you may need to update your paths.\n - 2018/01/11 (1.60) - obsoleted IsAnyWindowHovered() in favor of IsWindowHovered(ImGuiHoveredFlags_AnyWindow). Kept redirection function (will obsolete).\n - 2018/01/11 (1.60) - obsoleted IsAnyWindowFocused() in favor of IsWindowFocused(ImGuiFocusedFlags_AnyWindow). Kept redirection function (will obsolete).\n - 2018/01/03 (1.60) - renamed ImGuiSizeConstraintCallback to ImGuiSizeCallback, ImGuiSizeConstraintCallbackData to ImGuiSizeCallbackData.\n - 2017/12/29 (1.60) - removed CalcItemRectClosestPoint() which was weird and not really used by anyone except demo code. If you need it it's easy to replicate on your side.\n - 2017/12/24 (1.53) - renamed the emblematic ShowTestWindow() function to ShowDemoWindow(). Kept redirection function (will obsolete).\n - 2017/12/21 (1.53) - ImDrawList: renamed style.AntiAliasedShapes to style.AntiAliasedFill for consistency and as a way to explicitly break code that manipulate those flag at runtime. You can now manipulate ImDrawList::Flags\n - 2017/12/21 (1.53) - ImDrawList: removed 'bool anti_aliased = true' final parameter of ImDrawList::AddPolyline() and ImDrawList::AddConvexPolyFilled(). Prefer manipulating ImDrawList::Flags if you need to toggle them during the frame.\n - 2017/12/14 (1.53) - using the ImGuiWindowFlags_NoScrollWithMouse flag on a child window forwards the mouse wheel event to the parent window, unless either ImGuiWindowFlags_NoInputs or ImGuiWindowFlags_NoScrollbar are also set.\n - 2017/12/13 (1.53) - renamed GetItemsLineHeightWithSpacing() to GetFrameHeightWithSpacing(). Kept redirection function (will obsolete).\n - 2017/12/13 (1.53) - obsoleted IsRootWindowFocused() in favor of using IsWindowFocused(ImGuiFocusedFlags_RootWindow). Kept redirection function (will obsolete).\n                     - obsoleted IsRootWindowOrAnyChildFocused() in favor of using IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows). Kept redirection function (will obsolete).\n - 2017/12/12 (1.53) - renamed ImGuiTreeNodeFlags_AllowOverlapMode to ImGuiTreeNodeFlags_AllowItemOverlap. Kept redirection enum (will obsolete).\n - 2017/12/10 (1.53) - removed SetNextWindowContentWidth(), prefer using SetNextWindowContentSize(). Kept redirection function (will obsolete).\n - 2017/11/27 (1.53) - renamed ImGuiTextBuffer::append() helper to appendf(), appendv() to appendfv(). If you copied the 'Log' demo in your code, it uses appendv() so that needs to be renamed.\n - 2017/11/18 (1.53) - Style, Begin: removed ImGuiWindowFlags_ShowBorders window flag. Borders are now fully set up in the ImGuiStyle structure (see e.g. style.FrameBorderSize, style.WindowBorderSize). Use ImGui::ShowStyleEditor() to look them up.\n                       Please note that the style system will keep evolving (hopefully stabilizing in Q1 2018), and so custom styles will probably subtly break over time. It is recommended you use the StyleColorsClassic(), StyleColorsDark(), StyleColorsLight() functions.\n - 2017/11/18 (1.53) - Style: removed ImGuiCol_ComboBg in favor of combo boxes using ImGuiCol_PopupBg for consistency.\n - 2017/11/18 (1.53) - Style: renamed ImGuiCol_ChildWindowBg to ImGuiCol_ChildBg.\n - 2017/11/18 (1.53) - Style: renamed style.ChildWindowRounding to style.ChildRounding, ImGuiStyleVar_ChildWindowRounding to ImGuiStyleVar_ChildRounding.\n - 2017/11/02 (1.53) - obsoleted IsRootWindowOrAnyChildHovered() in favor of using IsWindowHovered(ImGuiHoveredFlags_RootAndChildWindows);\n - 2017/10/24 (1.52) - renamed IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS/IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS to IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS/IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS for consistency.\n - 2017/10/20 (1.52) - changed IsWindowHovered() default parameters behavior to return false if an item is active in another window (e.g. click-dragging item from another window to this window). You can use the newly introduced IsWindowHovered() flags to requests this specific behavior if you need it.\n - 2017/10/20 (1.52) - marked IsItemHoveredRect()/IsMouseHoveringWindow() as obsolete, in favor of using the newly introduced flags for IsItemHovered() and IsWindowHovered(). See https://github.com/ocornut/imgui/issues/1382 for details.\n                       removed the IsItemRectHovered()/IsWindowRectHovered() names introduced in 1.51 since they were merely more consistent names for the two functions we are now obsoleting.\n                         IsItemHoveredRect()        --> IsItemHovered(ImGuiHoveredFlags_RectOnly)\n                         IsMouseHoveringAnyWindow() --> IsWindowHovered(ImGuiHoveredFlags_AnyWindow)\n                         IsMouseHoveringWindow()    --> IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem) [weird, old behavior]\n - 2017/10/17 (1.52) - marked the old 5-parameters version of Begin() as obsolete (still available). Use SetNextWindowSize()+Begin() instead!\n - 2017/10/11 (1.52) - renamed AlignFirstTextHeightToWidgets() to AlignTextToFramePadding(). Kept inline redirection function (will obsolete).\n - 2017/09/26 (1.52) - renamed ImFont::Glyph to ImFontGlyph. Kept redirection typedef (will obsolete).\n - 2017/09/25 (1.52) - removed SetNextWindowPosCenter() because SetNextWindowPos() now has the optional pivot information to do the same and more. Kept redirection function (will obsolete).\n - 2017/08/25 (1.52) - io.MousePos needs to be set to ImVec2(-FLT_MAX,-FLT_MAX) when mouse is unavailable/missing. Previously ImVec2(-1,-1) was enough but we now accept negative mouse coordinates. In your backend if you need to support unavailable mouse, make sure to replace \"io.MousePos = ImVec2(-1,-1)\" with \"io.MousePos = ImVec2(-FLT_MAX,-FLT_MAX)\".\n - 2017/08/22 (1.51) - renamed IsItemHoveredRect() to IsItemRectHovered(). Kept inline redirection function (will obsolete). -> (1.52) use IsItemHovered(ImGuiHoveredFlags_RectOnly)!\n                     - renamed IsMouseHoveringAnyWindow() to IsAnyWindowHovered() for consistency. Kept inline redirection function (will obsolete).\n                     - renamed IsMouseHoveringWindow() to IsWindowRectHovered() for consistency. Kept inline redirection function (will obsolete).\n - 2017/08/20 (1.51) - renamed GetStyleColName() to GetStyleColorName() for consistency.\n - 2017/08/20 (1.51) - added PushStyleColor(ImGuiCol idx, ImU32 col) overload, which _might_ cause an \"ambiguous call\" compilation error if you are using ImColor() with implicit cast. Cast to ImU32 or ImVec4 explicily to fix.\n - 2017/08/15 (1.51) - marked the weird IMGUI_ONCE_UPON_A_FRAME helper macro as obsolete. prefer using the more explicit ImGuiOnceUponAFrame type.\n - 2017/08/15 (1.51) - changed parameter order for BeginPopupContextWindow() from (const char*,int buttons,bool also_over_items) to (const char*,int buttons,bool also_over_items). Note that most calls relied on default parameters completely.\n - 2017/08/13 (1.51) - renamed ImGuiCol_Column to ImGuiCol_Separator, ImGuiCol_ColumnHovered to ImGuiCol_SeparatorHovered, ImGuiCol_ColumnActive to ImGuiCol_SeparatorActive. Kept redirection enums (will obsolete).\n - 2017/08/11 (1.51) - renamed ImGuiSetCond_Always to ImGuiCond_Always, ImGuiSetCond_Once to ImGuiCond_Once, ImGuiSetCond_FirstUseEver to ImGuiCond_FirstUseEver, ImGuiSetCond_Appearing to ImGuiCond_Appearing. Kept redirection enums (will obsolete).\n - 2017/08/09 (1.51) - removed ValueColor() helpers, they are equivalent to calling Text(label) + SameLine() + ColorButton().\n - 2017/08/08 (1.51) - removed ColorEditMode() and ImGuiColorEditMode in favor of ImGuiColorEditFlags and parameters to the various Color*() functions. The SetColorEditOptions() allows to initialize default but the user can still change them with right-click context menu.\n                     - changed prototype of 'ColorEdit4(const char* label, float col[4], bool show_alpha = true)' to 'ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flags = 0)', where passing flags = 0x01 is a safe no-op (hello dodgy backward compatibility!). - check and run the demo window, under \"Color/Picker Widgets\", to understand the various new options.\n                     - changed prototype of rarely used 'ColorButton(ImVec4 col, bool small_height = false, bool outline_border = true)' to 'ColorButton(const char* desc_id, ImVec4 col, ImGuiColorEditFlags flags = 0, ImVec2 size = ImVec2(0, 0))'\n - 2017/07/20 (1.51) - removed IsPosHoveringAnyWindow(ImVec2), which was partly broken and misleading. ASSERT + redirect user to io.WantCaptureMouse\n - 2017/05/26 (1.50) - removed ImFontConfig::MergeGlyphCenterV in favor of a more multipurpose ImFontConfig::GlyphOffset.\n - 2017/05/01 (1.50) - renamed ImDrawList::PathFill() (rarely used directly) to ImDrawList::PathFillConvex() for clarity.\n - 2016/11/06 (1.50) - BeginChild(const char*) now applies the stack id to the provided label, consistently with other functions as it should always have been. It shouldn't affect you unless (extremely unlikely) you were appending multiple times to a same child from different locations of the stack id. If that's the case, generate an id with GetID() and use it instead of passing string to BeginChild().\n - 2016/10/15 (1.50) - avoid 'void* user_data' parameter to io.SetClipboardTextFn/io.GetClipboardTextFn pointers. We pass io.ClipboardUserData to it.\n - 2016/09/25 (1.50) - style.WindowTitleAlign is now a ImVec2 (ImGuiAlign enum was removed). set to (0.5f,0.5f) for horizontal+vertical centering, (0.0f,0.0f) for upper-left, etc.\n - 2016/07/30 (1.50) - SameLine(x) with x>0.0f is now relative to left of column/group if any, and not always to left of window. This was sort of always the intent and hopefully, breakage should be minimal.\n - 2016/05/12 (1.49) - title bar (using ImGuiCol_TitleBg/ImGuiCol_TitleBgActive colors) isn't rendered over a window background (ImGuiCol_WindowBg color) anymore.\n                       If your TitleBg/TitleBgActive alpha was 1.0f or you are using the default theme it will not affect you, otherwise if <1.0f you need to tweak your custom theme to readjust for the fact that we don't draw a WindowBg background behind the title bar.\n                       This helper function will convert an old TitleBg/TitleBgActive color into a new one with the same visual output, given the OLD color and the OLD WindowBg color:\n                       ImVec4 ConvertTitleBgCol(const ImVec4& win_bg_col, const ImVec4& title_bg_col) { float new_a = 1.0f - ((1.0f - win_bg_col.w) * (1.0f - title_bg_col.w)), k = title_bg_col.w / new_a; return ImVec4((win_bg_col.x * win_bg_col.w + title_bg_col.x) * k, (win_bg_col.y * win_bg_col.w + title_bg_col.y) * k, (win_bg_col.z * win_bg_col.w + title_bg_col.z) * k, new_a); }\n                       If this is confusing, pick the RGB value from title bar from an old screenshot and apply this as TitleBg/TitleBgActive. Or you may just create TitleBgActive from a tweaked TitleBg color.\n - 2016/05/07 (1.49) - removed confusing set of GetInternalState(), GetInternalStateSize(), SetInternalState() functions. Now using CreateContext(), DestroyContext(), GetCurrentContext(), SetCurrentContext().\n - 2016/05/02 (1.49) - renamed SetNextTreeNodeOpened() to SetNextTreeNodeOpen(), no redirection.\n - 2016/05/01 (1.49) - obsoleted old signature of CollapsingHeader(const char* label, const char* str_id = NULL, bool display_frame = true, bool default_open = false) as extra parameters were badly designed and rarely used. You can replace the \"default_open = true\" flag in new API with CollapsingHeader(label, ImGuiTreeNodeFlags_DefaultOpen).\n - 2016/04/26 (1.49) - changed ImDrawList::PushClipRect(ImVec4 rect) to ImDrawList::PushClipRect(Imvec2 min,ImVec2 max,bool intersect_with_current_clip_rect=false). Note that higher-level ImGui::PushClipRect() is preferable because it will clip at logic/widget level, whereas ImDrawList::PushClipRect() only affect your renderer.\n - 2016/04/03 (1.48) - removed style.WindowFillAlphaDefault setting which was redundant. Bake default BG alpha inside style.Colors[ImGuiCol_WindowBg] and all other Bg color values. (ref GitHub issue #337).\n - 2016/04/03 (1.48) - renamed ImGuiCol_TooltipBg to ImGuiCol_PopupBg, used by popups/menus and tooltips. popups/menus were previously using ImGuiCol_WindowBg. (ref github issue #337)\n - 2016/03/21 (1.48) - renamed GetWindowFont() to GetFont(), GetWindowFontSize() to GetFontSize(). Kept inline redirection function (will obsolete).\n - 2016/03/02 (1.48) - InputText() completion/history/always callbacks: if you modify the text buffer manually (without using DeleteChars()/InsertChars() helper) you need to maintain the BufTextLen field. added an assert.\n - 2016/01/23 (1.48) - fixed not honoring exact width passed to PushItemWidth(), previously it would add extra FramePadding.x*2 over that width. if you had manual pixel-perfect alignment in place it might affect you.\n - 2015/12/27 (1.48) - fixed ImDrawList::AddRect() which used to render a rectangle 1 px too large on each axis.\n - 2015/12/04 (1.47) - renamed Color() helpers to ValueColor() - dangerously named, rarely used and probably to be made obsolete.\n - 2015/08/29 (1.45) - with the addition of horizontal scrollbar we made various fixes to inconsistencies with dealing with cursor position.\n                       GetCursorPos()/SetCursorPos() functions now include the scrolled amount. It shouldn't affect the majority of users, but take note that SetCursorPosX(100.0f) puts you at +100 from the starting x position which may include scrolling, not at +100 from the window left side.\n                       GetContentRegionMax()/GetWindowContentRegionMin()/GetWindowContentRegionMax() functions allow include the scrolled amount. Typically those were used in cases where no scrolling would happen so it may not be a problem, but watch out!\n - 2015/08/29 (1.45) - renamed style.ScrollbarWidth to style.ScrollbarSize\n - 2015/08/05 (1.44) - split imgui.cpp into extra files: imgui_demo.cpp imgui_draw.cpp imgui_internal.h that you need to add to your project.\n - 2015/07/18 (1.44) - fixed angles in ImDrawList::PathArcTo(), PathArcToFast() (introduced in 1.43) being off by an extra PI for no justifiable reason\n - 2015/07/14 (1.43) - add new ImFontAtlas::AddFont() API. For the old AddFont***, moved the 'font_no' parameter of ImFontAtlas::AddFont** functions to the ImFontConfig structure.\n                       you need to render your textured triangles with bilinear filtering to benefit from sub-pixel positioning of text.\n - 2015/07/08 (1.43) - switched rendering data to use indexed rendering. this is saving a fair amount of CPU/GPU and enables us to get anti-aliasing for a marginal cost.\n                       this necessary change will break your rendering function! the fix should be very easy. sorry for that :(\n                     - if you are using a vanilla copy of one of the imgui_impl_XXX.cpp provided in the example, you just need to update your copy and you can ignore the rest.\n                     - the signature of the io.RenderDrawListsFn handler has changed!\n                       old: ImGui_XXXX_RenderDrawLists(ImDrawList** const cmd_lists, int cmd_lists_count)\n                       new: ImGui_XXXX_RenderDrawLists(ImDrawData* draw_data).\n                         parameters: 'cmd_lists' becomes 'draw_data->CmdLists', 'cmd_lists_count' becomes 'draw_data->CmdListsCount'\n                         ImDrawList: 'commands' becomes 'CmdBuffer', 'vtx_buffer' becomes 'VtxBuffer', 'IdxBuffer' is new.\n                         ImDrawCmd:  'vtx_count' becomes 'ElemCount', 'clip_rect' becomes 'ClipRect', 'user_callback' becomes 'UserCallback', 'texture_id' becomes 'TextureId'.\n                     - each ImDrawList now contains both a vertex buffer and an index buffer. For each command, render ElemCount/3 triangles using indices from the index buffer.\n                     - if you REALLY cannot render indexed primitives, you can call the draw_data->DeIndexAllBuffers() method to de-index the buffers. This is slow and a waste of CPU/GPU. Prefer using indexed rendering!\n                     - refer to code in the examples/ folder or ask on the GitHub if you are unsure of how to upgrade. please upgrade!\n - 2015/07/10 (1.43) - changed SameLine() parameters from int to float.\n - 2015/07/02 (1.42) - renamed SetScrollPosHere() to SetScrollFromCursorPos(). Kept inline redirection function (will obsolete).\n - 2015/07/02 (1.42) - renamed GetScrollPosY() to GetScrollY(). Necessary to reduce confusion along with other scrolling functions, because positions (e.g. cursor position) are not equivalent to scrolling amount.\n - 2015/06/14 (1.41) - changed ImageButton() default bg_col parameter from (0,0,0,1) (black) to (0,0,0,0) (transparent) - makes a difference when texture have transparence\n - 2015/06/14 (1.41) - changed Selectable() API from (label, selected, size) to (label, selected, flags, size). Size override should have been rarely used. Sorry!\n - 2015/05/31 (1.40) - renamed GetWindowCollapsed() to IsWindowCollapsed() for consistency. Kept inline redirection function (will obsolete).\n - 2015/05/31 (1.40) - renamed IsRectClipped() to IsRectVisible() for consistency. Note that return value is opposite! Kept inline redirection function (will obsolete).\n - 2015/05/27 (1.40) - removed the third 'repeat_if_held' parameter from Button() - sorry! it was rarely used and inconsistent. Use PushButtonRepeat(true) / PopButtonRepeat() to enable repeat on desired buttons.\n - 2015/05/11 (1.40) - changed BeginPopup() API, takes a string identifier instead of a bool. ImGui needs to manage the open/closed state of popups. Call OpenPopup() to actually set the \"open\" state of a popup. BeginPopup() returns true if the popup is opened.\n - 2015/05/03 (1.40) - removed style.AutoFitPadding, using style.WindowPadding makes more sense (the default values were already the same).\n - 2015/04/13 (1.38) - renamed IsClipped() to IsRectClipped(). Kept inline redirection function until 1.50.\n - 2015/04/09 (1.38) - renamed ImDrawList::AddArc() to ImDrawList::AddArcFast() for compatibility with future API\n - 2015/04/03 (1.38) - removed ImGuiCol_CheckHovered, ImGuiCol_CheckActive, replaced with the more general ImGuiCol_FrameBgHovered, ImGuiCol_FrameBgActive.\n - 2014/04/03 (1.38) - removed support for passing -FLT_MAX..+FLT_MAX as the range for a SliderFloat(). Use DragFloat() or Inputfloat() instead.\n - 2015/03/17 (1.36) - renamed GetItemBoxMin()/GetItemBoxMax()/IsMouseHoveringBox() to GetItemRectMin()/GetItemRectMax()/IsMouseHoveringRect(). Kept inline redirection function until 1.50.\n - 2015/03/15 (1.36) - renamed style.TreeNodeSpacing to style.IndentSpacing, ImGuiStyleVar_TreeNodeSpacing to ImGuiStyleVar_IndentSpacing\n - 2015/03/13 (1.36) - renamed GetWindowIsFocused() to IsWindowFocused(). Kept inline redirection function until 1.50.\n - 2015/03/08 (1.35) - renamed style.ScrollBarWidth to style.ScrollbarWidth (casing)\n - 2015/02/27 (1.34) - renamed OpenNextNode(bool) to SetNextTreeNodeOpened(bool, ImGuiSetCond). Kept inline redirection function until 1.50.\n - 2015/02/27 (1.34) - renamed ImGuiSetCondition_*** to ImGuiSetCond_***, and _FirstUseThisSession becomes _Once.\n - 2015/02/11 (1.32) - changed text input callback ImGuiTextEditCallback return type from void-->int. reserved for future use, return 0 for now.\n - 2015/02/10 (1.32) - renamed GetItemWidth() to CalcItemWidth() to clarify its evolving behavior\n - 2015/02/08 (1.31) - renamed GetTextLineSpacing() to GetTextLineHeightWithSpacing()\n - 2015/02/01 (1.31) - removed IO.MemReallocFn (unused)\n - 2015/01/19 (1.30) - renamed ImGuiStorage::GetIntPtr()/GetFloatPtr() to GetIntRef()/GetIntRef() because Ptr was conflicting with actual pointer storage functions.\n - 2015/01/11 (1.30) - big font/image API change! now loads TTF file. allow for multiple fonts. no need for a PNG loader.\n - 2015/01/11 (1.30) - removed GetDefaultFontData(). uses io.Fonts->GetTextureData*() API to retrieve uncompressed pixels.\n                       - old:  const void* png_data; unsigned int png_size; ImGui::GetDefaultFontData(NULL, NULL, &png_data, &png_size); [..Upload texture to GPU..];\n                       - new:  unsigned char* pixels; int width, height; io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); [..Upload texture to GPU..]; io.Fonts->SetTexID(YourTexIdentifier);\n                       you now have more flexibility to load multiple TTF fonts and manage the texture buffer for internal needs. It is now recommended that you sample the font texture with bilinear interpolation.\n - 2015/01/11 (1.30) - added texture identifier in ImDrawCmd passed to your render function (we can now render images). make sure to call io.Fonts->SetTexID()\n - 2015/01/11 (1.30) - removed IO.PixelCenterOffset (unnecessary, can be handled in user projection matrix)\n - 2015/01/11 (1.30) - removed ImGui::IsItemFocused() in favor of ImGui::IsItemActive() which handles all widgets\n - 2014/12/10 (1.18) - removed SetNewWindowDefaultPos() in favor of new generic API SetNextWindowPos(pos, ImGuiSetCondition_FirstUseEver)\n - 2014/11/28 (1.17) - moved IO.Font*** options to inside the IO.Font-> structure (FontYOffset, FontTexUvForWhite, FontBaseScale, FontFallbackGlyph)\n - 2014/11/26 (1.17) - reworked syntax of IMGUI_ONCE_UPON_A_FRAME helper macro to increase compiler compatibility\n - 2014/11/07 (1.15) - renamed IsHovered() to IsItemHovered()\n - 2014/10/02 (1.14) - renamed IMGUI_INCLUDE_IMGUI_USER_CPP to IMGUI_INCLUDE_IMGUI_USER_INL and imgui_user.cpp to imgui_user.inl (more IDE friendly)\n - 2014/09/25 (1.13) - removed 'text_end' parameter from IO.SetClipboardTextFn (the string is now always zero-terminated for simplicity)\n - 2014/09/24 (1.12) - renamed SetFontScale() to SetWindowFontScale()\n - 2014/09/24 (1.12) - moved IM_MALLOC/IM_REALLOC/IM_FREE preprocessor defines to IO.MemAllocFn/IO.MemReallocFn/IO.MemFreeFn\n - 2014/08/30 (1.09) - removed IO.FontHeight (now computed automatically)\n - 2014/08/30 (1.09) - moved IMGUI_FONT_TEX_UV_FOR_WHITE preprocessor define to IO.FontTexUvForWhite\n - 2014/08/28 (1.09) - changed the behavior of IO.PixelCenterOffset following various rendering fixes\n\n\n FREQUENTLY ASKED QUESTIONS (FAQ)\n ================================\n\n Read all answers online:\n   https://www.dearimgui.org/faq or https://github.com/ocornut/imgui/blob/master/docs/FAQ.md (same url)\n Read all answers locally (with a text editor or ideally a Markdown viewer):\n   docs/FAQ.md\n Some answers are copied down here to facilitate searching in code.\n\n Q&A: Basics\n ===========\n\n Q: Where is the documentation?\n A: This library is poorly documented at the moment and expects the user to be acquainted with C/C++.\n    - Run the examples/ and explore them.\n    - See demo code in imgui_demo.cpp and particularly the ImGui::ShowDemoWindow() function.\n    - The demo covers most features of Dear ImGui, so you can read the code and see its output.\n    - See documentation and comments at the top of imgui.cpp + effectively imgui.h.\n    - Dozens of standalone example applications using e.g. OpenGL/DirectX are provided in the\n      examples/ folder to explain how to integrate Dear ImGui with your own engine/application.\n    - The Wiki (https://github.com/ocornut/imgui/wiki) has many resources and links.\n    - The Glossary (https://github.com/ocornut/imgui/wiki/Glossary) page also may be useful.\n    - Your programming IDE is your friend, find the type or function declaration to find comments\n      associated with it.\n\n Q: What is this library called?\n Q: Which version should I get?\n >> This library is called \"Dear ImGui\", please don't call it \"ImGui\" :)\n >> See https://www.dearimgui.org/faq for details.\n\n Q&A: Integration\n ================\n\n Q: How to get started?\n A: Read 'PROGRAMMER GUIDE' above. Read examples/README.txt.\n\n Q: How can I tell whether to dispatch mouse/keyboard to Dear ImGui or my application?\n A: You should read the 'io.WantCaptureMouse', 'io.WantCaptureKeyboard' and 'io.WantTextInput' flags!\n >> See https://www.dearimgui.org/faq for a fully detailed answer. You really want to read this.\n\n Q. How can I enable keyboard controls?\n Q: How can I use this without a mouse, without a keyboard or without a screen? (gamepad, input share, remote display)\n Q: I integrated Dear ImGui in my engine and little squares are showing instead of text...\n Q: I integrated Dear ImGui in my engine and some elements are clipping or disappearing when I move windows around...\n Q: I integrated Dear ImGui in my engine and some elements are displaying outside their expected windows boundaries...\n >> See https://www.dearimgui.org/faq\n\n Q&A: Usage\n ----------\n\n Q: Why is my widget not reacting when I click on it?\n Q: How can I have widgets with an empty label?\n Q: How can I have multiple widgets with the same label?\n Q: How can I display an image? What is ImTextureID, how does it works?\n Q: How can I use my own math types instead of ImVec2/ImVec4?\n Q: How can I interact with standard C++ types (such as std::string and std::vector)?\n Q: How can I display custom shapes? (using low-level ImDrawList API)\n >> See https://www.dearimgui.org/faq\n\n Q&A: Fonts, Text\n ================\n\n Q: How should I handle DPI in my application?\n Q: How can I load a different font than the default?\n Q: How can I easily use icons in my application?\n Q: How can I load multiple fonts?\n Q: How can I display and input non-Latin characters such as Chinese, Japanese, Korean, Cyrillic?\n >> See https://www.dearimgui.org/faq and https://github.com/ocornut/imgui/edit/master/docs/FONTS.md\n\n Q&A: Concerns\n =============\n\n Q: Who uses Dear ImGui?\n Q: Can you create elaborate/serious tools with Dear ImGui?\n Q: Can you reskin the look of Dear ImGui?\n Q: Why using C++ (as opposed to C)?\n >> See https://www.dearimgui.org/faq\n\n Q&A: Community\n ==============\n\n Q: How can I help?\n A: - Businesses: please reach out to \"contact AT dearimgui.com\" if you work in a place using Dear ImGui!\n      We can discuss ways for your company to fund development via invoiced technical support, maintenance or sponsoring contacts.\n      This is among the most useful thing you can do for Dear ImGui. With increased funding, we can hire more people working on this project.\n    - Individuals: you can support continued development via PayPal donations. See README.\n    - If you are experienced with Dear ImGui and C++, look at the GitHub issues, look at the Wiki, read docs/TODO.txt\n      and see how you want to help and can help!\n    - Disclose your usage of Dear ImGui via a dev blog post, a tweet, a screenshot, a mention somewhere etc.\n      You may post screenshot or links in the gallery threads. Visuals are ideal as they inspire other programmers.\n      But even without visuals, disclosing your use of dear imgui helps the library grow credibility, and help other teams and programmers with taking decisions.\n    - If you have issues or if you need to hack into the library, even if you don't expect any support it is useful that you share your issues (on GitHub or privately).\n\n*/\n\n//-------------------------------------------------------------------------\n// [SECTION] INCLUDES\n//-------------------------------------------------------------------------\n\n#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)\n#define _CRT_SECURE_NO_WARNINGS\n#endif\n\n#include \"imgui.h\"\n#ifndef IMGUI_DISABLE\n\n#ifndef IMGUI_DEFINE_MATH_OPERATORS\n#define IMGUI_DEFINE_MATH_OPERATORS\n#endif\n#include \"imgui_internal.h\"\n\n// System includes\n#include <ctype.h>      // toupper\n#include <stdio.h>      // vsnprintf, sscanf, printf\n#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier\n#include <stddef.h>     // intptr_t\n#else\n#include <stdint.h>     // intptr_t\n#endif\n\n// [Windows] On non-Visual Studio compilers, we default to IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS unless explicitly enabled\n#if defined(_WIN32) && !defined(_MSC_VER) && !defined(IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS) && !defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS)\n#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS\n#endif\n\n// [Windows] OS specific includes (optional)\n#if defined(_WIN32) && defined(IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS) && defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS) && defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS) && !defined(IMGUI_DISABLE_WIN32_FUNCTIONS)\n#define IMGUI_DISABLE_WIN32_FUNCTIONS\n#endif\n#if defined(_WIN32) && !defined(IMGUI_DISABLE_WIN32_FUNCTIONS)\n#ifndef WIN32_LEAN_AND_MEAN\n#define WIN32_LEAN_AND_MEAN\n#endif\n#ifndef NOMINMAX\n#define NOMINMAX\n#endif\n#ifndef __MINGW32__\n#include <Windows.h>        // _wfopen, OpenClipboard\n#else\n#include <windows.h>\n#endif\n#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) // UWP doesn't have all Win32 functions\n#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS\n#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS\n#endif\n#endif\n\n// [Apple] OS specific includes\n#if defined(__APPLE__)\n#include <TargetConditionals.h>\n#endif\n\n// Visual Studio warnings\n#ifdef _MSC_VER\n#pragma warning (disable: 4127)             // condition expression is constant\n#pragma warning (disable: 4996)             // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen\n#if defined(_MSC_VER) && _MSC_VER >= 1922   // MSVC 2019 16.2 or later\n#pragma warning (disable: 5054)             // operator '|': deprecated between enumerations of different types\n#endif\n#pragma warning (disable: 26451)            // [Static Analyzer] Arithmetic overflow : Using operator 'xxx' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator 'xxx' to avoid overflow(io.2).\n#pragma warning (disable: 26495)            // [Static Analyzer] Variable 'XXX' is uninitialized. Always initialize a member variable (type.6).\n#pragma warning (disable: 26812)            // [Static Analyzer] The enum type 'xxx' is unscoped. Prefer 'enum class' over 'enum' (Enum.3).\n#endif\n\n// Clang/GCC warnings with -Weverything\n#if defined(__clang__)\n#if __has_warning(\"-Wunknown-warning-option\")\n#pragma clang diagnostic ignored \"-Wunknown-warning-option\"         // warning: unknown warning group 'xxx'                      // not all warnings are known by all Clang versions and they tend to be rename-happy.. so ignoring warnings triggers new warnings on some configuration. Great!\n#endif\n#pragma clang diagnostic ignored \"-Wunknown-pragmas\"                // warning: unknown warning group 'xxx'\n#pragma clang diagnostic ignored \"-Wold-style-cast\"                 // warning: use of old-style cast                            // yes, they are more terse.\n#pragma clang diagnostic ignored \"-Wfloat-equal\"                    // warning: comparing floating point with == or != is unsafe // storing and comparing against same constants (typically 0.0f) is ok.\n#pragma clang diagnostic ignored \"-Wformat-nonliteral\"              // warning: format string is not a string literal            // passing non-literal to vsnformat(). yes, user passing incorrect format strings can crash the code.\n#pragma clang diagnostic ignored \"-Wexit-time-destructors\"          // warning: declaration requires an exit-time destructor     // exit-time destruction order is undefined. if MemFree() leads to users code that has been disabled before exit it might cause problems. ImGui coding style welcomes static/globals.\n#pragma clang diagnostic ignored \"-Wglobal-constructors\"            // warning: declaration requires a global destructor         // similar to above, not sure what the exact difference is.\n#pragma clang diagnostic ignored \"-Wsign-conversion\"                // warning: implicit conversion changes signedness\n#pragma clang diagnostic ignored \"-Wformat-pedantic\"                // warning: format specifies type 'void *' but the argument has type 'xxxx *' // unreasonable, would lead to casting every %p arg to void*. probably enabled by -pedantic.\n#pragma clang diagnostic ignored \"-Wint-to-void-pointer-cast\"       // warning: cast to 'void *' from smaller integer type 'int'\n#pragma clang diagnostic ignored \"-Wzero-as-null-pointer-constant\"  // warning: zero as null pointer constant                    // some standard header variations use #define NULL 0\n#pragma clang diagnostic ignored \"-Wdouble-promotion\"               // warning: implicit conversion from 'float' to 'double' when passing argument to function  // using printf() is a misery with this as C++ va_arg ellipsis changes float to double.\n#pragma clang diagnostic ignored \"-Wimplicit-int-float-conversion\"  // warning: implicit conversion from 'xxx' to 'float' may lose precision\n#elif defined(__GNUC__)\n// We disable -Wpragmas because GCC doesn't provide an has_warning equivalent and some forks/patches may not following the warning/version association.\n#pragma GCC diagnostic ignored \"-Wpragmas\"                  // warning: unknown option after '#pragma GCC diagnostic' kind\n#pragma GCC diagnostic ignored \"-Wunused-function\"          // warning: 'xxxx' defined but not used\n#pragma GCC diagnostic ignored \"-Wint-to-pointer-cast\"      // warning: cast to pointer from integer of different size\n#pragma GCC diagnostic ignored \"-Wformat\"                   // warning: format '%p' expects argument of type 'void*', but argument 6 has type 'ImGuiWindow*'\n#pragma GCC diagnostic ignored \"-Wdouble-promotion\"         // warning: implicit conversion from 'float' to 'double' when passing argument to function\n#pragma GCC diagnostic ignored \"-Wconversion\"               // warning: conversion to 'xxxx' from 'xxxx' may alter its value\n#pragma GCC diagnostic ignored \"-Wformat-nonliteral\"        // warning: format not a string literal, format string not checked\n#pragma GCC diagnostic ignored \"-Wstrict-overflow\"          // warning: assuming signed overflow does not occur when assuming that (X - c) > X is always false\n#pragma GCC diagnostic ignored \"-Wclass-memaccess\"          // [__GNUC__ >= 8] warning: 'memset/memcpy' clearing/writing an object of type 'xxxx' with no trivial copy-assignment; use assignment or value-initialization instead\n#endif\n\n// Debug options\n#define IMGUI_DEBUG_NAV_SCORING     0   // Display navigation scoring preview when hovering items. Display last moving direction matches when holding CTRL\n#define IMGUI_DEBUG_NAV_RECTS       0   // Display the reference navigation rectangle for each window\n#define IMGUI_DEBUG_INI_SETTINGS    0   // Save additional comments in .ini file (particularly helps for Docking, but makes saving slower)\n\n// When using CTRL+TAB (or Gamepad Square+L/R) we delay the visual a little in order to reduce visual noise doing a fast switch.\nstatic const float NAV_WINDOWING_HIGHLIGHT_DELAY            = 0.20f;    // Time before the highlight and screen dimming starts fading in\nstatic const float NAV_WINDOWING_LIST_APPEAR_DELAY          = 0.15f;    // Time before the window list starts to appear\n\n// Window resizing from edges (when io.ConfigWindowsResizeFromEdges = true and ImGuiBackendFlags_HasMouseCursors is set in io.BackendFlags by backend)\nstatic const float WINDOWS_HOVER_PADDING                    = 4.0f;     // Extend outside window for hovering/resizing (maxxed with TouchPadding) and inside windows for borders. Affect FindHoveredWindow().\nstatic const float WINDOWS_RESIZE_FROM_EDGES_FEEDBACK_TIMER = 0.04f;    // Reduce visual noise by only highlighting the border after a certain time.\nstatic const float WINDOWS_MOUSE_WHEEL_SCROLL_LOCK_TIMER    = 2.00f;    // Lock scrolled window (so it doesn't pick child windows that are scrolling through) for a certain time, unless mouse moved.\n\n//-------------------------------------------------------------------------\n// [SECTION] FORWARD DECLARATIONS\n//-------------------------------------------------------------------------\n\nstatic void             SetCurrentWindow(ImGuiWindow* window);\nstatic void             FindHoveredWindow();\nstatic ImGuiWindow*     CreateNewWindow(const char* name, ImGuiWindowFlags flags);\nstatic ImVec2           CalcNextScrollFromScrollTargetAndClamp(ImGuiWindow* window);\n\nstatic void             AddDrawListToDrawData(ImVector<ImDrawList*>* out_list, ImDrawList* draw_list);\nstatic void             AddWindowToSortBuffer(ImVector<ImGuiWindow*>* out_sorted_windows, ImGuiWindow* window);\n\n// Settings\nstatic void             WindowSettingsHandler_ClearAll(ImGuiContext*, ImGuiSettingsHandler*);\nstatic void*            WindowSettingsHandler_ReadOpen(ImGuiContext*, ImGuiSettingsHandler*, const char* name);\nstatic void             WindowSettingsHandler_ReadLine(ImGuiContext*, ImGuiSettingsHandler*, void* entry, const char* line);\nstatic void             WindowSettingsHandler_ApplyAll(ImGuiContext*, ImGuiSettingsHandler*);\nstatic void             WindowSettingsHandler_WriteAll(ImGuiContext*, ImGuiSettingsHandler*, ImGuiTextBuffer* buf);\n\n// Platform Dependents default implementation for IO functions\nstatic const char*      GetClipboardTextFn_DefaultImpl(void* user_data);\nstatic void             SetClipboardTextFn_DefaultImpl(void* user_data, const char* text);\nstatic void             ImeSetInputScreenPosFn_DefaultImpl(int x, int y);\n\nnamespace ImGui\n{\n// Navigation\nstatic void             NavUpdate();\nstatic void             NavUpdateWindowing();\nstatic void             NavUpdateWindowingOverlay();\nstatic void             NavUpdateMoveResult();\nstatic void             NavUpdateInitResult();\nstatic float            NavUpdatePageUpPageDown();\nstatic inline void      NavUpdateAnyRequestFlag();\nstatic void             NavEndFrame();\nstatic bool             NavScoreItem(ImGuiNavItemData* result, ImRect cand);\nstatic void             NavApplyItemToResult(ImGuiNavItemData* result, ImGuiWindow* window, ImGuiID id, const ImRect& nav_bb_rel);\nstatic void             NavProcessItem(ImGuiWindow* window, const ImRect& nav_bb, ImGuiID id);\nstatic ImVec2           NavCalcPreferredRefPos();\nstatic void             NavSaveLastChildNavWindowIntoParent(ImGuiWindow* nav_window);\nstatic ImGuiWindow*     NavRestoreLastChildNavWindow(ImGuiWindow* window);\nstatic void             NavRestoreLayer(ImGuiNavLayer layer);\nstatic int              FindWindowFocusIndex(ImGuiWindow* window);\n\n// Error Checking\nstatic void             ErrorCheckNewFrameSanityChecks();\nstatic void             ErrorCheckEndFrameSanityChecks();\n\n// Misc\nstatic void             UpdateSettings();\nstatic void             UpdateMouseInputs();\nstatic void             UpdateMouseWheel();\nstatic void             UpdateTabFocus();\nstatic void             UpdateDebugToolItemPicker();\nstatic bool             UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& size_auto_fit, int* border_held, int resize_grip_count, ImU32 resize_grip_col[4], const ImRect& visibility_rect);\nstatic void             RenderWindowOuterBorders(ImGuiWindow* window);\nstatic void             RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar_rect, bool title_bar_is_highlight, int resize_grip_count, const ImU32 resize_grip_col[4], float resize_grip_draw_size);\nstatic void             RenderWindowTitleBarContents(ImGuiWindow* window, const ImRect& title_bar_rect, const char* name, bool* p_open);\n\n// Viewports\nstatic void             UpdateViewportsNewFrame();\n\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] CONTEXT AND MEMORY ALLOCATORS\n//-----------------------------------------------------------------------------\n\n// DLL users:\n// - Heaps and globals are not shared across DLL boundaries!\n// - You will need to call SetCurrentContext() + SetAllocatorFunctions() for each static/DLL boundary you are calling from.\n// - Same applies for hot-reloading mechanisms that are reliant on reloading DLL (note that many hot-reloading mechanisms work without DLL).\n// - Using Dear ImGui via a shared library is not recommended, because of function call overhead and because we don't guarantee backward nor forward ABI compatibility.\n// - Confused? In a debugger: add GImGui to your watch window and notice how its value changes depending on your current location (which DLL boundary you are in).\n\n// Current context pointer. Implicitly used by all Dear ImGui functions. Always assumed to be != NULL.\n// - ImGui::CreateContext() will automatically set this pointer if it is NULL.\n//   Change to a different context by calling ImGui::SetCurrentContext().\n// - Important: Dear ImGui functions are not thread-safe because of this pointer.\n//   If you want thread-safety to allow N threads to access N different contexts:\n//   - Change this variable to use thread local storage so each thread can refer to a different context, in your imconfig.h:\n//         struct ImGuiContext;\n//         extern thread_local ImGuiContext* MyImGuiTLS;\n//         #define GImGui MyImGuiTLS\n//     And then define MyImGuiTLS in one of your cpp files. Note that thread_local is a C++11 keyword, earlier C++ uses compiler-specific keyword.\n//   - Future development aims to make this context pointer explicit to all calls. Also read https://github.com/ocornut/imgui/issues/586\n//   - If you need a finite number of contexts, you may compile and use multiple instances of the ImGui code from a different namespace.\n// - DLL users: read comments above.\n#ifndef GImGui\nImGuiContext*   GImGui = NULL;\n#endif\n\n// Memory Allocator functions. Use SetAllocatorFunctions() to change them.\n// - You probably don't want to modify that mid-program, and if you use global/static e.g. ImVector<> instances you may need to keep them accessible during program destruction.\n// - DLL users: read comments above.\n#ifndef IMGUI_DISABLE_DEFAULT_ALLOCATORS\nstatic void*   MallocWrapper(size_t size, void* user_data)    { IM_UNUSED(user_data); return malloc(size); }\nstatic void    FreeWrapper(void* ptr, void* user_data)        { IM_UNUSED(user_data); free(ptr); }\n#else\nstatic void*   MallocWrapper(size_t size, void* user_data)    { IM_UNUSED(user_data); IM_UNUSED(size); IM_ASSERT(0); return NULL; }\nstatic void    FreeWrapper(void* ptr, void* user_data)        { IM_UNUSED(user_data); IM_UNUSED(ptr); IM_ASSERT(0); }\n#endif\nstatic ImGuiMemAllocFunc    GImAllocatorAllocFunc = MallocWrapper;\nstatic ImGuiMemFreeFunc     GImAllocatorFreeFunc = FreeWrapper;\nstatic void*                GImAllocatorUserData = NULL;\n\n//-----------------------------------------------------------------------------\n// [SECTION] USER FACING STRUCTURES (ImGuiStyle, ImGuiIO)\n//-----------------------------------------------------------------------------\n\nImGuiStyle::ImGuiStyle()\n{\n    Alpha                   = 1.0f;             // Global alpha applies to everything in Dear ImGui.\n    DisabledAlpha           = 0.60f;            // Additional alpha multiplier applied by BeginDisabled(). Multiply over current value of Alpha.\n    WindowPadding           = ImVec2(8,8);      // Padding within a window\n    WindowRounding          = 0.0f;             // Radius of window corners rounding. Set to 0.0f to have rectangular windows. Large values tend to lead to variety of artifacts and are not recommended.\n    WindowBorderSize        = 1.0f;             // Thickness of border around windows. Generally set to 0.0f or 1.0f. Other values not well tested.\n    WindowMinSize           = ImVec2(32,32);    // Minimum window size\n    WindowTitleAlign        = ImVec2(0.0f,0.5f);// Alignment for title bar text\n    WindowMenuButtonPosition= ImGuiDir_Left;    // Position of the collapsing/docking button in the title bar (left/right). Defaults to ImGuiDir_Left.\n    ChildRounding           = 0.0f;             // Radius of child window corners rounding. Set to 0.0f to have rectangular child windows\n    ChildBorderSize         = 1.0f;             // Thickness of border around child windows. Generally set to 0.0f or 1.0f. Other values not well tested.\n    PopupRounding           = 0.0f;             // Radius of popup window corners rounding. Set to 0.0f to have rectangular child windows\n    PopupBorderSize         = 1.0f;             // Thickness of border around popup or tooltip windows. Generally set to 0.0f or 1.0f. Other values not well tested.\n    FramePadding            = ImVec2(4,3);      // Padding within a framed rectangle (used by most widgets)\n    FrameRounding           = 0.0f;             // Radius of frame corners rounding. Set to 0.0f to have rectangular frames (used by most widgets).\n    FrameBorderSize         = 0.0f;             // Thickness of border around frames. Generally set to 0.0f or 1.0f. Other values not well tested.\n    ItemSpacing             = ImVec2(8,4);      // Horizontal and vertical spacing between widgets/lines\n    ItemInnerSpacing        = ImVec2(4,4);      // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label)\n    CellPadding             = ImVec2(4,2);      // Padding within a table cell\n    TouchExtraPadding       = ImVec2(0,0);      // Expand reactive bounding box for touch-based system where touch position is not accurate enough. Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much!\n    IndentSpacing           = 21.0f;            // Horizontal spacing when e.g. entering a tree node. Generally == (FontSize + FramePadding.x*2).\n    ColumnsMinSpacing       = 6.0f;             // Minimum horizontal spacing between two columns. Preferably > (FramePadding.x + 1).\n    ScrollbarSize           = 14.0f;            // Width of the vertical scrollbar, Height of the horizontal scrollbar\n    ScrollbarRounding       = 9.0f;             // Radius of grab corners rounding for scrollbar\n    GrabMinSize             = 10.0f;            // Minimum width/height of a grab box for slider/scrollbar\n    GrabRounding            = 0.0f;             // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs.\n    LogSliderDeadzone       = 4.0f;             // The size in pixels of the dead-zone around zero on logarithmic sliders that cross zero.\n    TabRounding             = 4.0f;             // Radius of upper corners of a tab. Set to 0.0f to have rectangular tabs.\n    TabBorderSize           = 0.0f;             // Thickness of border around tabs.\n    TabMinWidthForCloseButton = 0.0f;           // Minimum width for close button to appears on an unselected tab when hovered. Set to 0.0f to always show when hovering, set to FLT_MAX to never show close button unless selected.\n    ColorButtonPosition     = ImGuiDir_Right;   // Side of the color button in the ColorEdit4 widget (left/right). Defaults to ImGuiDir_Right.\n    ButtonTextAlign         = ImVec2(0.5f,0.5f);// Alignment of button text when button is larger than text.\n    SelectableTextAlign     = ImVec2(0.0f,0.0f);// Alignment of selectable text. Defaults to (0.0f, 0.0f) (top-left aligned). It's generally important to keep this left-aligned if you want to lay multiple items on a same line.\n    DisplayWindowPadding    = ImVec2(19,19);    // Window position are clamped to be visible within the display area or monitors by at least this amount. Only applies to regular windows.\n    DisplaySafeAreaPadding  = ImVec2(3,3);      // If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding. Covers popups/tooltips as well regular windows.\n    MouseCursorScale        = 1.0f;             // Scale software rendered mouse cursor (when io.MouseDrawCursor is enabled). May be removed later.\n    AntiAliasedLines        = true;             // Enable anti-aliased lines/borders. Disable if you are really tight on CPU/GPU.\n    AntiAliasedLinesUseTex  = true;             // Enable anti-aliased lines/borders using textures where possible. Require backend to render with bilinear filtering.\n    AntiAliasedFill         = true;             // Enable anti-aliased filled shapes (rounded rectangles, circles, etc.).\n    CurveTessellationTol    = 1.25f;            // Tessellation tolerance when using PathBezierCurveTo() without a specific number of segments. Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality.\n    CircleTessellationMaxError = 0.30f;         // Maximum error (in pixels) allowed when using AddCircle()/AddCircleFilled() or drawing rounded corner rectangles with no explicit segment count specified. Decrease for higher quality but more geometry.\n\n    // Default theme\n    ImGui::StyleColorsDark(this);\n}\n\n// To scale your entire UI (e.g. if you want your app to use High DPI or generally be DPI aware) you may use this helper function. Scaling the fonts is done separately and is up to you.\n// Important: This operation is lossy because we round all sizes to integer. If you need to change your scale multiples, call this over a freshly initialized ImGuiStyle structure rather than scaling multiple times.\nvoid ImGuiStyle::ScaleAllSizes(float scale_factor)\n{\n    WindowPadding = ImFloor(WindowPadding * scale_factor);\n    WindowRounding = ImFloor(WindowRounding * scale_factor);\n    WindowMinSize = ImFloor(WindowMinSize * scale_factor);\n    ChildRounding = ImFloor(ChildRounding * scale_factor);\n    PopupRounding = ImFloor(PopupRounding * scale_factor);\n    FramePadding = ImFloor(FramePadding * scale_factor);\n    FrameRounding = ImFloor(FrameRounding * scale_factor);\n    ItemSpacing = ImFloor(ItemSpacing * scale_factor);\n    ItemInnerSpacing = ImFloor(ItemInnerSpacing * scale_factor);\n    CellPadding = ImFloor(CellPadding * scale_factor);\n    TouchExtraPadding = ImFloor(TouchExtraPadding * scale_factor);\n    IndentSpacing = ImFloor(IndentSpacing * scale_factor);\n    ColumnsMinSpacing = ImFloor(ColumnsMinSpacing * scale_factor);\n    ScrollbarSize = ImFloor(ScrollbarSize * scale_factor);\n    ScrollbarRounding = ImFloor(ScrollbarRounding * scale_factor);\n    GrabMinSize = ImFloor(GrabMinSize * scale_factor);\n    GrabRounding = ImFloor(GrabRounding * scale_factor);\n    LogSliderDeadzone = ImFloor(LogSliderDeadzone * scale_factor);\n    TabRounding = ImFloor(TabRounding * scale_factor);\n    TabMinWidthForCloseButton = (TabMinWidthForCloseButton != FLT_MAX) ? ImFloor(TabMinWidthForCloseButton * scale_factor) : FLT_MAX;\n    DisplayWindowPadding = ImFloor(DisplayWindowPadding * scale_factor);\n    DisplaySafeAreaPadding = ImFloor(DisplaySafeAreaPadding * scale_factor);\n    MouseCursorScale = ImFloor(MouseCursorScale * scale_factor);\n}\n\nImGuiIO::ImGuiIO()\n{\n    // Most fields are initialized with zero\n    memset(this, 0, sizeof(*this));\n    IM_ASSERT(IM_ARRAYSIZE(ImGuiIO::MouseDown) == ImGuiMouseButton_COUNT && IM_ARRAYSIZE(ImGuiIO::MouseClicked) == ImGuiMouseButton_COUNT); // Our pre-C++11 IM_STATIC_ASSERT() macros triggers warning on modern compilers so we don't use it here.\n\n    // Settings\n    ConfigFlags = ImGuiConfigFlags_None;\n    BackendFlags = ImGuiBackendFlags_None;\n    DisplaySize = ImVec2(-1.0f, -1.0f);\n    DeltaTime = 1.0f / 60.0f;\n    IniSavingRate = 5.0f;\n    IniFilename = \"imgui.ini\"; // Important: \"imgui.ini\" is relative to current working dir, most apps will want to lock this to an absolute path (e.g. same path as executables).\n    LogFilename = \"imgui_log.txt\";\n    MouseDoubleClickTime = 0.30f;\n    MouseDoubleClickMaxDist = 6.0f;\n    for (int i = 0; i < ImGuiKey_COUNT; i++)\n        KeyMap[i] = -1;\n    KeyRepeatDelay = 0.275f;\n    KeyRepeatRate = 0.050f;\n    UserData = NULL;\n\n    Fonts = NULL;\n    FontGlobalScale = 1.0f;\n    FontDefault = NULL;\n    FontAllowUserScaling = false;\n    DisplayFramebufferScale = ImVec2(1.0f, 1.0f);\n\n    // Miscellaneous options\n    MouseDrawCursor = false;\n#ifdef __APPLE__\n    ConfigMacOSXBehaviors = true;  // Set Mac OS X style defaults based on __APPLE__ compile time flag\n#else\n    ConfigMacOSXBehaviors = false;\n#endif\n    ConfigInputTextCursorBlink = true;\n    ConfigWindowsResizeFromEdges = true;\n    ConfigWindowsMoveFromTitleBarOnly = false;\n    ConfigMemoryCompactTimer = 60.0f;\n\n    // Platform Functions\n    BackendPlatformName = BackendRendererName = NULL;\n    BackendPlatformUserData = BackendRendererUserData = BackendLanguageUserData = NULL;\n    GetClipboardTextFn = GetClipboardTextFn_DefaultImpl;   // Platform dependent default implementations\n    SetClipboardTextFn = SetClipboardTextFn_DefaultImpl;\n    ClipboardUserData = NULL;\n    ImeSetInputScreenPosFn = ImeSetInputScreenPosFn_DefaultImpl;\n    ImeWindowHandle = NULL;\n\n    // Input (NB: we already have memset zero the entire structure!)\n    MousePos = ImVec2(-FLT_MAX, -FLT_MAX);\n    MousePosPrev = ImVec2(-FLT_MAX, -FLT_MAX);\n    MouseDragThreshold = 6.0f;\n    for (int i = 0; i < IM_ARRAYSIZE(MouseDownDuration); i++) MouseDownDuration[i] = MouseDownDurationPrev[i] = -1.0f;\n    for (int i = 0; i < IM_ARRAYSIZE(KeysDownDuration); i++) KeysDownDuration[i]  = KeysDownDurationPrev[i] = -1.0f;\n    for (int i = 0; i < IM_ARRAYSIZE(NavInputsDownDuration); i++) NavInputsDownDuration[i] = -1.0f;\n}\n\n// Pass in translated ASCII characters for text input.\n// - with glfw you can get those from the callback set in glfwSetCharCallback()\n// - on Windows you can get those using ToAscii+keyboard state, or via the WM_CHAR message\nvoid ImGuiIO::AddInputCharacter(unsigned int c)\n{\n    if (c != 0)\n        InputQueueCharacters.push_back(c <= IM_UNICODE_CODEPOINT_MAX ? (ImWchar)c : IM_UNICODE_CODEPOINT_INVALID);\n}\n\n// UTF16 strings use surrogate pairs to encode codepoints >= 0x10000, so\n// we should save the high surrogate.\nvoid ImGuiIO::AddInputCharacterUTF16(ImWchar16 c)\n{\n    if (c == 0 && InputQueueSurrogate == 0)\n        return;\n\n    if ((c & 0xFC00) == 0xD800) // High surrogate, must save\n    {\n        if (InputQueueSurrogate != 0)\n            InputQueueCharacters.push_back(IM_UNICODE_CODEPOINT_INVALID);\n        InputQueueSurrogate = c;\n        return;\n    }\n\n    ImWchar cp = c;\n    if (InputQueueSurrogate != 0)\n    {\n        if ((c & 0xFC00) != 0xDC00) // Invalid low surrogate\n        {\n            InputQueueCharacters.push_back(IM_UNICODE_CODEPOINT_INVALID);\n        }\n        else\n        {\n#if IM_UNICODE_CODEPOINT_MAX == 0xFFFF\n            cp = IM_UNICODE_CODEPOINT_INVALID; // Codepoint will not fit in ImWchar\n#else\n            cp = (ImWchar)(((InputQueueSurrogate - 0xD800) << 10) + (c - 0xDC00) + 0x10000);\n#endif\n        }\n\n        InputQueueSurrogate = 0;\n    }\n    InputQueueCharacters.push_back(cp);\n}\n\nvoid ImGuiIO::AddInputCharactersUTF8(const char* utf8_chars)\n{\n    while (*utf8_chars != 0)\n    {\n        unsigned int c = 0;\n        utf8_chars += ImTextCharFromUtf8(&c, utf8_chars, NULL);\n        if (c != 0)\n            InputQueueCharacters.push_back((ImWchar)c);\n    }\n}\n\nvoid ImGuiIO::ClearInputCharacters()\n{\n    InputQueueCharacters.resize(0);\n}\n\nvoid ImGuiIO::AddFocusEvent(bool focused)\n{\n    if (focused)\n        return;\n\n    // Clear buttons state when focus is lost\n    // (this is useful so e.g. releasing Alt after focus loss on Alt-Tab doesn't trigger the Alt menu toggle)\n    memset(KeysDown, 0, sizeof(KeysDown));\n    for (int n = 0; n < IM_ARRAYSIZE(KeysDownDuration); n++)\n        KeysDownDuration[n] = KeysDownDurationPrev[n] = -1.0f;\n    KeyCtrl = KeyShift = KeyAlt = KeySuper = false;\n    KeyMods = KeyModsPrev = ImGuiKeyModFlags_None;\n    for (int n = 0; n < IM_ARRAYSIZE(NavInputsDownDuration); n++)\n        NavInputsDownDuration[n] = NavInputsDownDurationPrev[n] = -1.0f;\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] MISC HELPERS/UTILITIES (Geometry functions)\n//-----------------------------------------------------------------------------\n\nImVec2 ImBezierCubicClosestPoint(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, const ImVec2& p, int num_segments)\n{\n    IM_ASSERT(num_segments > 0); // Use ImBezierCubicClosestPointCasteljau()\n    ImVec2 p_last = p1;\n    ImVec2 p_closest;\n    float p_closest_dist2 = FLT_MAX;\n    float t_step = 1.0f / (float)num_segments;\n    for (int i_step = 1; i_step <= num_segments; i_step++)\n    {\n        ImVec2 p_current = ImBezierCubicCalc(p1, p2, p3, p4, t_step * i_step);\n        ImVec2 p_line = ImLineClosestPoint(p_last, p_current, p);\n        float dist2 = ImLengthSqr(p - p_line);\n        if (dist2 < p_closest_dist2)\n        {\n            p_closest = p_line;\n            p_closest_dist2 = dist2;\n        }\n        p_last = p_current;\n    }\n    return p_closest;\n}\n\n// Closely mimics PathBezierToCasteljau() in imgui_draw.cpp\nstatic void ImBezierCubicClosestPointCasteljauStep(const ImVec2& p, ImVec2& p_closest, ImVec2& p_last, float& p_closest_dist2, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, float tess_tol, int level)\n{\n    float dx = x4 - x1;\n    float dy = y4 - y1;\n    float d2 = ((x2 - x4) * dy - (y2 - y4) * dx);\n    float d3 = ((x3 - x4) * dy - (y3 - y4) * dx);\n    d2 = (d2 >= 0) ? d2 : -d2;\n    d3 = (d3 >= 0) ? d3 : -d3;\n    if ((d2 + d3) * (d2 + d3) < tess_tol * (dx * dx + dy * dy))\n    {\n        ImVec2 p_current(x4, y4);\n        ImVec2 p_line = ImLineClosestPoint(p_last, p_current, p);\n        float dist2 = ImLengthSqr(p - p_line);\n        if (dist2 < p_closest_dist2)\n        {\n            p_closest = p_line;\n            p_closest_dist2 = dist2;\n        }\n        p_last = p_current;\n    }\n    else if (level < 10)\n    {\n        float x12 = (x1 + x2)*0.5f,       y12 = (y1 + y2)*0.5f;\n        float x23 = (x2 + x3)*0.5f,       y23 = (y2 + y3)*0.5f;\n        float x34 = (x3 + x4)*0.5f,       y34 = (y3 + y4)*0.5f;\n        float x123 = (x12 + x23)*0.5f,    y123 = (y12 + y23)*0.5f;\n        float x234 = (x23 + x34)*0.5f,    y234 = (y23 + y34)*0.5f;\n        float x1234 = (x123 + x234)*0.5f, y1234 = (y123 + y234)*0.5f;\n        ImBezierCubicClosestPointCasteljauStep(p, p_closest, p_last, p_closest_dist2, x1, y1, x12, y12, x123, y123, x1234, y1234, tess_tol, level + 1);\n        ImBezierCubicClosestPointCasteljauStep(p, p_closest, p_last, p_closest_dist2, x1234, y1234, x234, y234, x34, y34, x4, y4, tess_tol, level + 1);\n    }\n}\n\n// tess_tol is generally the same value you would find in ImGui::GetStyle().CurveTessellationTol\n// Because those ImXXX functions are lower-level than ImGui:: we cannot access this value automatically.\nImVec2 ImBezierCubicClosestPointCasteljau(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, const ImVec2& p, float tess_tol)\n{\n    IM_ASSERT(tess_tol > 0.0f);\n    ImVec2 p_last = p1;\n    ImVec2 p_closest;\n    float p_closest_dist2 = FLT_MAX;\n    ImBezierCubicClosestPointCasteljauStep(p, p_closest, p_last, p_closest_dist2, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, p4.x, p4.y, tess_tol, 0);\n    return p_closest;\n}\n\nImVec2 ImLineClosestPoint(const ImVec2& a, const ImVec2& b, const ImVec2& p)\n{\n    ImVec2 ap = p - a;\n    ImVec2 ab_dir = b - a;\n    float dot = ap.x * ab_dir.x + ap.y * ab_dir.y;\n    if (dot < 0.0f)\n        return a;\n    float ab_len_sqr = ab_dir.x * ab_dir.x + ab_dir.y * ab_dir.y;\n    if (dot > ab_len_sqr)\n        return b;\n    return a + ab_dir * dot / ab_len_sqr;\n}\n\nbool ImTriangleContainsPoint(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p)\n{\n    bool b1 = ((p.x - b.x) * (a.y - b.y) - (p.y - b.y) * (a.x - b.x)) < 0.0f;\n    bool b2 = ((p.x - c.x) * (b.y - c.y) - (p.y - c.y) * (b.x - c.x)) < 0.0f;\n    bool b3 = ((p.x - a.x) * (c.y - a.y) - (p.y - a.y) * (c.x - a.x)) < 0.0f;\n    return ((b1 == b2) && (b2 == b3));\n}\n\nvoid ImTriangleBarycentricCoords(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p, float& out_u, float& out_v, float& out_w)\n{\n    ImVec2 v0 = b - a;\n    ImVec2 v1 = c - a;\n    ImVec2 v2 = p - a;\n    const float denom = v0.x * v1.y - v1.x * v0.y;\n    out_v = (v2.x * v1.y - v1.x * v2.y) / denom;\n    out_w = (v0.x * v2.y - v2.x * v0.y) / denom;\n    out_u = 1.0f - out_v - out_w;\n}\n\nImVec2 ImTriangleClosestPoint(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p)\n{\n    ImVec2 proj_ab = ImLineClosestPoint(a, b, p);\n    ImVec2 proj_bc = ImLineClosestPoint(b, c, p);\n    ImVec2 proj_ca = ImLineClosestPoint(c, a, p);\n    float dist2_ab = ImLengthSqr(p - proj_ab);\n    float dist2_bc = ImLengthSqr(p - proj_bc);\n    float dist2_ca = ImLengthSqr(p - proj_ca);\n    float m = ImMin(dist2_ab, ImMin(dist2_bc, dist2_ca));\n    if (m == dist2_ab)\n        return proj_ab;\n    if (m == dist2_bc)\n        return proj_bc;\n    return proj_ca;\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] MISC HELPERS/UTILITIES (String, Format, Hash functions)\n//-----------------------------------------------------------------------------\n\n// Consider using _stricmp/_strnicmp under Windows or strcasecmp/strncasecmp. We don't actually use either ImStricmp/ImStrnicmp in the codebase any more.\nint ImStricmp(const char* str1, const char* str2)\n{\n    int d;\n    while ((d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; }\n    return d;\n}\n\nint ImStrnicmp(const char* str1, const char* str2, size_t count)\n{\n    int d = 0;\n    while (count > 0 && (d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; count--; }\n    return d;\n}\n\nvoid ImStrncpy(char* dst, const char* src, size_t count)\n{\n    if (count < 1)\n        return;\n    if (count > 1)\n        strncpy(dst, src, count - 1);\n    dst[count - 1] = 0;\n}\n\nchar* ImStrdup(const char* str)\n{\n    size_t len = strlen(str);\n    void* buf = IM_ALLOC(len + 1);\n    return (char*)memcpy(buf, (const void*)str, len + 1);\n}\n\nchar* ImStrdupcpy(char* dst, size_t* p_dst_size, const char* src)\n{\n    size_t dst_buf_size = p_dst_size ? *p_dst_size : strlen(dst) + 1;\n    size_t src_size = strlen(src) + 1;\n    if (dst_buf_size < src_size)\n    {\n        IM_FREE(dst);\n        dst = (char*)IM_ALLOC(src_size);\n        if (p_dst_size)\n            *p_dst_size = src_size;\n    }\n    return (char*)memcpy(dst, (const void*)src, src_size);\n}\n\nconst char* ImStrchrRange(const char* str, const char* str_end, char c)\n{\n    const char* p = (const char*)memchr(str, (int)c, str_end - str);\n    return p;\n}\n\nint ImStrlenW(const ImWchar* str)\n{\n    //return (int)wcslen((const wchar_t*)str);  // FIXME-OPT: Could use this when wchar_t are 16-bit\n    int n = 0;\n    while (*str++) n++;\n    return n;\n}\n\n// Find end-of-line. Return pointer will point to either first \\n, either str_end.\nconst char* ImStreolRange(const char* str, const char* str_end)\n{\n    const char* p = (const char*)memchr(str, '\\n', str_end - str);\n    return p ? p : str_end;\n}\n\nconst ImWchar* ImStrbolW(const ImWchar* buf_mid_line, const ImWchar* buf_begin) // find beginning-of-line\n{\n    while (buf_mid_line > buf_begin && buf_mid_line[-1] != '\\n')\n        buf_mid_line--;\n    return buf_mid_line;\n}\n\nconst char* ImStristr(const char* haystack, const char* haystack_end, const char* needle, const char* needle_end)\n{\n    if (!needle_end)\n        needle_end = needle + strlen(needle);\n\n    const char un0 = (char)toupper(*needle);\n    while ((!haystack_end && *haystack) || (haystack_end && haystack < haystack_end))\n    {\n        if (toupper(*haystack) == un0)\n        {\n            const char* b = needle + 1;\n            for (const char* a = haystack + 1; b < needle_end; a++, b++)\n                if (toupper(*a) != toupper(*b))\n                    break;\n            if (b == needle_end)\n                return haystack;\n        }\n        haystack++;\n    }\n    return NULL;\n}\n\n// Trim str by offsetting contents when there's leading data + writing a \\0 at the trailing position. We use this in situation where the cost is negligible.\nvoid ImStrTrimBlanks(char* buf)\n{\n    char* p = buf;\n    while (p[0] == ' ' || p[0] == '\\t')     // Leading blanks\n        p++;\n    char* p_start = p;\n    while (*p != 0)                         // Find end of string\n        p++;\n    while (p > p_start && (p[-1] == ' ' || p[-1] == '\\t'))  // Trailing blanks\n        p--;\n    if (p_start != buf)                     // Copy memory if we had leading blanks\n        memmove(buf, p_start, p - p_start);\n    buf[p - p_start] = 0;                   // Zero terminate\n}\n\nconst char* ImStrSkipBlank(const char* str)\n{\n    while (str[0] == ' ' || str[0] == '\\t')\n        str++;\n    return str;\n}\n\n// A) MSVC version appears to return -1 on overflow, whereas glibc appears to return total count (which may be >= buf_size).\n// Ideally we would test for only one of those limits at runtime depending on the behavior the vsnprintf(), but trying to deduct it at compile time sounds like a pandora can of worm.\n// B) When buf==NULL vsnprintf() will return the output size.\n#ifndef IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS\n\n// We support stb_sprintf which is much faster (see: https://github.com/nothings/stb/blob/master/stb_sprintf.h)\n// You may set IMGUI_USE_STB_SPRINTF to use our default wrapper, or set IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS\n// and setup the wrapper yourself. (FIXME-OPT: Some of our high-level operations such as ImGuiTextBuffer::appendfv() are\n// designed using two-passes worst case, which probably could be improved using the stbsp_vsprintfcb() function.)\n#ifdef IMGUI_USE_STB_SPRINTF\n#define STB_SPRINTF_IMPLEMENTATION\n#include \"stb_sprintf.h\"\n#endif\n\n#if defined(_MSC_VER) && !defined(vsnprintf)\n#define vsnprintf _vsnprintf\n#endif\n\nint ImFormatString(char* buf, size_t buf_size, const char* fmt, ...)\n{\n    va_list args;\n    va_start(args, fmt);\n#ifdef IMGUI_USE_STB_SPRINTF\n    int w = stbsp_vsnprintf(buf, (int)buf_size, fmt, args);\n#else\n    int w = vsnprintf(buf, buf_size, fmt, args);\n#endif\n    va_end(args);\n    if (buf == NULL)\n        return w;\n    if (w == -1 || w >= (int)buf_size)\n        w = (int)buf_size - 1;\n    buf[w] = 0;\n    return w;\n}\n\nint ImFormatStringV(char* buf, size_t buf_size, const char* fmt, va_list args)\n{\n#ifdef IMGUI_USE_STB_SPRINTF\n    int w = stbsp_vsnprintf(buf, (int)buf_size, fmt, args);\n#else\n    int w = vsnprintf(buf, buf_size, fmt, args);\n#endif\n    if (buf == NULL)\n        return w;\n    if (w == -1 || w >= (int)buf_size)\n        w = (int)buf_size - 1;\n    buf[w] = 0;\n    return w;\n}\n#endif // #ifdef IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS\n\n// CRC32 needs a 1KB lookup table (not cache friendly)\n// Although the code to generate the table is simple and shorter than the table itself, using a const table allows us to easily:\n// - avoid an unnecessary branch/memory tap, - keep the ImHashXXX functions usable by static constructors, - make it thread-safe.\nstatic const ImU32 GCrc32LookupTable[256] =\n{\n    0x00000000,0x77073096,0xEE0E612C,0x990951BA,0x076DC419,0x706AF48F,0xE963A535,0x9E6495A3,0x0EDB8832,0x79DCB8A4,0xE0D5E91E,0x97D2D988,0x09B64C2B,0x7EB17CBD,0xE7B82D07,0x90BF1D91,\n    0x1DB71064,0x6AB020F2,0xF3B97148,0x84BE41DE,0x1ADAD47D,0x6DDDE4EB,0xF4D4B551,0x83D385C7,0x136C9856,0x646BA8C0,0xFD62F97A,0x8A65C9EC,0x14015C4F,0x63066CD9,0xFA0F3D63,0x8D080DF5,\n    0x3B6E20C8,0x4C69105E,0xD56041E4,0xA2677172,0x3C03E4D1,0x4B04D447,0xD20D85FD,0xA50AB56B,0x35B5A8FA,0x42B2986C,0xDBBBC9D6,0xACBCF940,0x32D86CE3,0x45DF5C75,0xDCD60DCF,0xABD13D59,\n    0x26D930AC,0x51DE003A,0xC8D75180,0xBFD06116,0x21B4F4B5,0x56B3C423,0xCFBA9599,0xB8BDA50F,0x2802B89E,0x5F058808,0xC60CD9B2,0xB10BE924,0x2F6F7C87,0x58684C11,0xC1611DAB,0xB6662D3D,\n    0x76DC4190,0x01DB7106,0x98D220BC,0xEFD5102A,0x71B18589,0x06B6B51F,0x9FBFE4A5,0xE8B8D433,0x7807C9A2,0x0F00F934,0x9609A88E,0xE10E9818,0x7F6A0DBB,0x086D3D2D,0x91646C97,0xE6635C01,\n    0x6B6B51F4,0x1C6C6162,0x856530D8,0xF262004E,0x6C0695ED,0x1B01A57B,0x8208F4C1,0xF50FC457,0x65B0D9C6,0x12B7E950,0x8BBEB8EA,0xFCB9887C,0x62DD1DDF,0x15DA2D49,0x8CD37CF3,0xFBD44C65,\n    0x4DB26158,0x3AB551CE,0xA3BC0074,0xD4BB30E2,0x4ADFA541,0x3DD895D7,0xA4D1C46D,0xD3D6F4FB,0x4369E96A,0x346ED9FC,0xAD678846,0xDA60B8D0,0x44042D73,0x33031DE5,0xAA0A4C5F,0xDD0D7CC9,\n    0x5005713C,0x270241AA,0xBE0B1010,0xC90C2086,0x5768B525,0x206F85B3,0xB966D409,0xCE61E49F,0x5EDEF90E,0x29D9C998,0xB0D09822,0xC7D7A8B4,0x59B33D17,0x2EB40D81,0xB7BD5C3B,0xC0BA6CAD,\n    0xEDB88320,0x9ABFB3B6,0x03B6E20C,0x74B1D29A,0xEAD54739,0x9DD277AF,0x04DB2615,0x73DC1683,0xE3630B12,0x94643B84,0x0D6D6A3E,0x7A6A5AA8,0xE40ECF0B,0x9309FF9D,0x0A00AE27,0x7D079EB1,\n    0xF00F9344,0x8708A3D2,0x1E01F268,0x6906C2FE,0xF762575D,0x806567CB,0x196C3671,0x6E6B06E7,0xFED41B76,0x89D32BE0,0x10DA7A5A,0x67DD4ACC,0xF9B9DF6F,0x8EBEEFF9,0x17B7BE43,0x60B08ED5,\n    0xD6D6A3E8,0xA1D1937E,0x38D8C2C4,0x4FDFF252,0xD1BB67F1,0xA6BC5767,0x3FB506DD,0x48B2364B,0xD80D2BDA,0xAF0A1B4C,0x36034AF6,0x41047A60,0xDF60EFC3,0xA867DF55,0x316E8EEF,0x4669BE79,\n    0xCB61B38C,0xBC66831A,0x256FD2A0,0x5268E236,0xCC0C7795,0xBB0B4703,0x220216B9,0x5505262F,0xC5BA3BBE,0xB2BD0B28,0x2BB45A92,0x5CB36A04,0xC2D7FFA7,0xB5D0CF31,0x2CD99E8B,0x5BDEAE1D,\n    0x9B64C2B0,0xEC63F226,0x756AA39C,0x026D930A,0x9C0906A9,0xEB0E363F,0x72076785,0x05005713,0x95BF4A82,0xE2B87A14,0x7BB12BAE,0x0CB61B38,0x92D28E9B,0xE5D5BE0D,0x7CDCEFB7,0x0BDBDF21,\n    0x86D3D2D4,0xF1D4E242,0x68DDB3F8,0x1FDA836E,0x81BE16CD,0xF6B9265B,0x6FB077E1,0x18B74777,0x88085AE6,0xFF0F6A70,0x66063BCA,0x11010B5C,0x8F659EFF,0xF862AE69,0x616BFFD3,0x166CCF45,\n    0xA00AE278,0xD70DD2EE,0x4E048354,0x3903B3C2,0xA7672661,0xD06016F7,0x4969474D,0x3E6E77DB,0xAED16A4A,0xD9D65ADC,0x40DF0B66,0x37D83BF0,0xA9BCAE53,0xDEBB9EC5,0x47B2CF7F,0x30B5FFE9,\n    0xBDBDF21C,0xCABAC28A,0x53B39330,0x24B4A3A6,0xBAD03605,0xCDD70693,0x54DE5729,0x23D967BF,0xB3667A2E,0xC4614AB8,0x5D681B02,0x2A6F2B94,0xB40BBE37,0xC30C8EA1,0x5A05DF1B,0x2D02EF8D,\n};\n\n// Known size hash\n// It is ok to call ImHashData on a string with known length but the ### operator won't be supported.\n// FIXME-OPT: Replace with e.g. FNV1a hash? CRC32 pretty much randomly access 1KB. Need to do proper measurements.\nImGuiID ImHashData(const void* data_p, size_t data_size, ImU32 seed)\n{\n    ImU32 crc = ~seed;\n    const unsigned char* data = (const unsigned char*)data_p;\n    const ImU32* crc32_lut = GCrc32LookupTable;\n    while (data_size-- != 0)\n        crc = (crc >> 8) ^ crc32_lut[(crc & 0xFF) ^ *data++];\n    return ~crc;\n}\n\n// Zero-terminated string hash, with support for ### to reset back to seed value\n// We support a syntax of \"label###id\" where only \"###id\" is included in the hash, and only \"label\" gets displayed.\n// Because this syntax is rarely used we are optimizing for the common case.\n// - If we reach ### in the string we discard the hash so far and reset to the seed.\n// - We don't do 'current += 2; continue;' after handling ### to keep the code smaller/faster (measured ~10% diff in Debug build)\n// FIXME-OPT: Replace with e.g. FNV1a hash? CRC32 pretty much randomly access 1KB. Need to do proper measurements.\nImGuiID ImHashStr(const char* data_p, size_t data_size, ImU32 seed)\n{\n    seed = ~seed;\n    ImU32 crc = seed;\n    const unsigned char* data = (const unsigned char*)data_p;\n    const ImU32* crc32_lut = GCrc32LookupTable;\n    if (data_size != 0)\n    {\n        while (data_size-- != 0)\n        {\n            unsigned char c = *data++;\n            if (c == '#' && data_size >= 2 && data[0] == '#' && data[1] == '#')\n                crc = seed;\n            crc = (crc >> 8) ^ crc32_lut[(crc & 0xFF) ^ c];\n        }\n    }\n    else\n    {\n        while (unsigned char c = *data++)\n        {\n            if (c == '#' && data[0] == '#' && data[1] == '#')\n                crc = seed;\n            crc = (crc >> 8) ^ crc32_lut[(crc & 0xFF) ^ c];\n        }\n    }\n    return ~crc;\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] MISC HELPERS/UTILITIES (File functions)\n//-----------------------------------------------------------------------------\n\n// Default file functions\n#ifndef IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS\n\nImFileHandle ImFileOpen(const char* filename, const char* mode)\n{\n#if defined(_WIN32) && !defined(IMGUI_DISABLE_WIN32_FUNCTIONS) && !defined(__CYGWIN__) && !defined(__GNUC__)\n    // We need a fopen() wrapper because MSVC/Windows fopen doesn't handle UTF-8 filenames.\n    // Previously we used ImTextCountCharsFromUtf8/ImTextStrFromUtf8 here but we now need to support ImWchar16 and ImWchar32!\n    const int filename_wsize = ::MultiByteToWideChar(CP_UTF8, 0, filename, -1, NULL, 0);\n    const int mode_wsize = ::MultiByteToWideChar(CP_UTF8, 0, mode, -1, NULL, 0);\n    ImVector<ImWchar> buf;\n    buf.resize(filename_wsize + mode_wsize);\n    ::MultiByteToWideChar(CP_UTF8, 0, filename, -1, (wchar_t*)&buf[0], filename_wsize);\n    ::MultiByteToWideChar(CP_UTF8, 0, mode, -1, (wchar_t*)&buf[filename_wsize], mode_wsize);\n    return ::_wfopen((const wchar_t*)&buf[0], (const wchar_t*)&buf[filename_wsize]);\n#else\n    return fopen(filename, mode);\n#endif\n}\n\n// We should in theory be using fseeko()/ftello() with off_t and _fseeki64()/_ftelli64() with __int64, waiting for the PR that does that in a very portable pre-C++11 zero-warnings way.\nbool    ImFileClose(ImFileHandle f)     { return fclose(f) == 0; }\nImU64   ImFileGetSize(ImFileHandle f)   { long off = 0, sz = 0; return ((off = ftell(f)) != -1 && !fseek(f, 0, SEEK_END) && (sz = ftell(f)) != -1 && !fseek(f, off, SEEK_SET)) ? (ImU64)sz : (ImU64)-1; }\nImU64   ImFileRead(void* data, ImU64 sz, ImU64 count, ImFileHandle f)           { return fread(data, (size_t)sz, (size_t)count, f); }\nImU64   ImFileWrite(const void* data, ImU64 sz, ImU64 count, ImFileHandle f)    { return fwrite(data, (size_t)sz, (size_t)count, f); }\n#endif // #ifndef IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS\n\n// Helper: Load file content into memory\n// Memory allocated with IM_ALLOC(), must be freed by user using IM_FREE() == ImGui::MemFree()\n// This can't really be used with \"rt\" because fseek size won't match read size.\nvoid*   ImFileLoadToMemory(const char* filename, const char* mode, size_t* out_file_size, int padding_bytes)\n{\n    IM_ASSERT(filename && mode);\n    if (out_file_size)\n        *out_file_size = 0;\n\n    ImFileHandle f;\n    if ((f = ImFileOpen(filename, mode)) == NULL)\n        return NULL;\n\n    size_t file_size = (size_t)ImFileGetSize(f);\n    if (file_size == (size_t)-1)\n    {\n        ImFileClose(f);\n        return NULL;\n    }\n\n    void* file_data = IM_ALLOC(file_size + padding_bytes);\n    if (file_data == NULL)\n    {\n        ImFileClose(f);\n        return NULL;\n    }\n    if (ImFileRead(file_data, 1, file_size, f) != file_size)\n    {\n        ImFileClose(f);\n        IM_FREE(file_data);\n        return NULL;\n    }\n    if (padding_bytes > 0)\n        memset((void*)(((char*)file_data) + file_size), 0, (size_t)padding_bytes);\n\n    ImFileClose(f);\n    if (out_file_size)\n        *out_file_size = file_size;\n\n    return file_data;\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] MISC HELPERS/UTILITIES (ImText* functions)\n//-----------------------------------------------------------------------------\n\n// Convert UTF-8 to 32-bit character, process single character input.\n// A nearly-branchless UTF-8 decoder, based on work of Christopher Wellons (https://github.com/skeeto/branchless-utf8).\n// We handle UTF-8 decoding error by skipping forward.\nint ImTextCharFromUtf8(unsigned int* out_char, const char* in_text, const char* in_text_end)\n{\n    static const char lengths[32] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 3, 3, 4, 0 };\n    static const int masks[]  = { 0x00, 0x7f, 0x1f, 0x0f, 0x07 };\n    static const uint32_t mins[] = { 0x400000, 0, 0x80, 0x800, 0x10000 };\n    static const int shiftc[] = { 0, 18, 12, 6, 0 };\n    static const int shifte[] = { 0, 6, 4, 2, 0 };\n    int len = lengths[*(const unsigned char*)in_text >> 3];\n    int wanted = len + !len;\n\n    if (in_text_end == NULL)\n        in_text_end = in_text + wanted; // Max length, nulls will be taken into account.\n\n    // Copy at most 'len' bytes, stop copying at 0 or past in_text_end. Branch predictor does a good job here,\n    // so it is fast even with excessive branching.\n    unsigned char s[4];\n    s[0] = in_text + 0 < in_text_end ? in_text[0] : 0;\n    s[1] = in_text + 1 < in_text_end ? in_text[1] : 0;\n    s[2] = in_text + 2 < in_text_end ? in_text[2] : 0;\n    s[3] = in_text + 3 < in_text_end ? in_text[3] : 0;\n\n    // Assume a four-byte character and load four bytes. Unused bits are shifted out.\n    *out_char  = (uint32_t)(s[0] & masks[len]) << 18;\n    *out_char |= (uint32_t)(s[1] & 0x3f) << 12;\n    *out_char |= (uint32_t)(s[2] & 0x3f) <<  6;\n    *out_char |= (uint32_t)(s[3] & 0x3f) <<  0;\n    *out_char >>= shiftc[len];\n\n    // Accumulate the various error conditions.\n    int e = 0;\n    e  = (*out_char < mins[len]) << 6; // non-canonical encoding\n    e |= ((*out_char >> 11) == 0x1b) << 7;  // surrogate half?\n    e |= (*out_char > IM_UNICODE_CODEPOINT_MAX) << 8;  // out of range?\n    e |= (s[1] & 0xc0) >> 2;\n    e |= (s[2] & 0xc0) >> 4;\n    e |= (s[3]       ) >> 6;\n    e ^= 0x2a; // top two bits of each tail byte correct?\n    e >>= shifte[len];\n\n    if (e)\n    {\n        // No bytes are consumed when *in_text == 0 || in_text == in_text_end.\n        // One byte is consumed in case of invalid first byte of in_text.\n        // All available bytes (at most `len` bytes) are consumed on incomplete/invalid second to last bytes.\n        // Invalid or incomplete input may consume less bytes than wanted, therefore every byte has to be inspected in s.\n        wanted = ImMin(wanted, !!s[0] + !!s[1] + !!s[2] + !!s[3]);\n        *out_char = IM_UNICODE_CODEPOINT_INVALID;\n    }\n\n    return wanted;\n}\n\nint ImTextStrFromUtf8(ImWchar* buf, int buf_size, const char* in_text, const char* in_text_end, const char** in_text_remaining)\n{\n    ImWchar* buf_out = buf;\n    ImWchar* buf_end = buf + buf_size;\n    while (buf_out < buf_end - 1 && (!in_text_end || in_text < in_text_end) && *in_text)\n    {\n        unsigned int c;\n        in_text += ImTextCharFromUtf8(&c, in_text, in_text_end);\n        if (c == 0)\n            break;\n        *buf_out++ = (ImWchar)c;\n    }\n    *buf_out = 0;\n    if (in_text_remaining)\n        *in_text_remaining = in_text;\n    return (int)(buf_out - buf);\n}\n\nint ImTextCountCharsFromUtf8(const char* in_text, const char* in_text_end)\n{\n    int char_count = 0;\n    while ((!in_text_end || in_text < in_text_end) && *in_text)\n    {\n        unsigned int c;\n        in_text += ImTextCharFromUtf8(&c, in_text, in_text_end);\n        if (c == 0)\n            break;\n        char_count++;\n    }\n    return char_count;\n}\n\n// Based on stb_to_utf8() from github.com/nothings/stb/\nstatic inline int ImTextCharToUtf8_inline(char* buf, int buf_size, unsigned int c)\n{\n    if (c < 0x80)\n    {\n        buf[0] = (char)c;\n        return 1;\n    }\n    if (c < 0x800)\n    {\n        if (buf_size < 2) return 0;\n        buf[0] = (char)(0xc0 + (c >> 6));\n        buf[1] = (char)(0x80 + (c & 0x3f));\n        return 2;\n    }\n    if (c < 0x10000)\n    {\n        if (buf_size < 3) return 0;\n        buf[0] = (char)(0xe0 + (c >> 12));\n        buf[1] = (char)(0x80 + ((c >> 6) & 0x3f));\n        buf[2] = (char)(0x80 + ((c ) & 0x3f));\n        return 3;\n    }\n    if (c <= 0x10FFFF)\n    {\n        if (buf_size < 4) return 0;\n        buf[0] = (char)(0xf0 + (c >> 18));\n        buf[1] = (char)(0x80 + ((c >> 12) & 0x3f));\n        buf[2] = (char)(0x80 + ((c >> 6) & 0x3f));\n        buf[3] = (char)(0x80 + ((c ) & 0x3f));\n        return 4;\n    }\n    // Invalid code point, the max unicode is 0x10FFFF\n    return 0;\n}\n\nconst char* ImTextCharToUtf8(char out_buf[5], unsigned int c)\n{\n    int count = ImTextCharToUtf8_inline(out_buf, 5, c);\n    out_buf[count] = 0;\n    return out_buf;\n}\n\n// Not optimal but we very rarely use this function.\nint ImTextCountUtf8BytesFromChar(const char* in_text, const char* in_text_end)\n{\n    unsigned int unused = 0;\n    return ImTextCharFromUtf8(&unused, in_text, in_text_end);\n}\n\nstatic inline int ImTextCountUtf8BytesFromChar(unsigned int c)\n{\n    if (c < 0x80) return 1;\n    if (c < 0x800) return 2;\n    if (c < 0x10000) return 3;\n    if (c <= 0x10FFFF) return 4;\n    return 3;\n}\n\nint ImTextStrToUtf8(char* out_buf, int out_buf_size, const ImWchar* in_text, const ImWchar* in_text_end)\n{\n    char* buf_p = out_buf;\n    const char* buf_end = out_buf + out_buf_size;\n    while (buf_p < buf_end - 1 && (!in_text_end || in_text < in_text_end) && *in_text)\n    {\n        unsigned int c = (unsigned int)(*in_text++);\n        if (c < 0x80)\n            *buf_p++ = (char)c;\n        else\n            buf_p += ImTextCharToUtf8_inline(buf_p, (int)(buf_end - buf_p - 1), c);\n    }\n    *buf_p = 0;\n    return (int)(buf_p - out_buf);\n}\n\nint ImTextCountUtf8BytesFromStr(const ImWchar* in_text, const ImWchar* in_text_end)\n{\n    int bytes_count = 0;\n    while ((!in_text_end || in_text < in_text_end) && *in_text)\n    {\n        unsigned int c = (unsigned int)(*in_text++);\n        if (c < 0x80)\n            bytes_count++;\n        else\n            bytes_count += ImTextCountUtf8BytesFromChar(c);\n    }\n    return bytes_count;\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] MISC HELPERS/UTILITIES (Color functions)\n// Note: The Convert functions are early design which are not consistent with other API.\n//-----------------------------------------------------------------------------\n\nIMGUI_API ImU32 ImAlphaBlendColors(ImU32 col_a, ImU32 col_b)\n{\n    float t = ((col_b >> IM_COL32_A_SHIFT) & 0xFF) / 255.f;\n    int r = ImLerp((int)(col_a >> IM_COL32_R_SHIFT) & 0xFF, (int)(col_b >> IM_COL32_R_SHIFT) & 0xFF, t);\n    int g = ImLerp((int)(col_a >> IM_COL32_G_SHIFT) & 0xFF, (int)(col_b >> IM_COL32_G_SHIFT) & 0xFF, t);\n    int b = ImLerp((int)(col_a >> IM_COL32_B_SHIFT) & 0xFF, (int)(col_b >> IM_COL32_B_SHIFT) & 0xFF, t);\n    return IM_COL32(r, g, b, 0xFF);\n}\n\nImVec4 ImGui::ColorConvertU32ToFloat4(ImU32 in)\n{\n    float s = 1.0f / 255.0f;\n    return ImVec4(\n        ((in >> IM_COL32_R_SHIFT) & 0xFF) * s,\n        ((in >> IM_COL32_G_SHIFT) & 0xFF) * s,\n        ((in >> IM_COL32_B_SHIFT) & 0xFF) * s,\n        ((in >> IM_COL32_A_SHIFT) & 0xFF) * s);\n}\n\nImU32 ImGui::ColorConvertFloat4ToU32(const ImVec4& in)\n{\n    ImU32 out;\n    out  = ((ImU32)IM_F32_TO_INT8_SAT(in.x)) << IM_COL32_R_SHIFT;\n    out |= ((ImU32)IM_F32_TO_INT8_SAT(in.y)) << IM_COL32_G_SHIFT;\n    out |= ((ImU32)IM_F32_TO_INT8_SAT(in.z)) << IM_COL32_B_SHIFT;\n    out |= ((ImU32)IM_F32_TO_INT8_SAT(in.w)) << IM_COL32_A_SHIFT;\n    return out;\n}\n\n// Convert rgb floats ([0-1],[0-1],[0-1]) to hsv floats ([0-1],[0-1],[0-1]), from Foley & van Dam p592\n// Optimized http://lolengine.net/blog/2013/01/13/fast-rgb-to-hsv\nvoid ImGui::ColorConvertRGBtoHSV(float r, float g, float b, float& out_h, float& out_s, float& out_v)\n{\n    float K = 0.f;\n    if (g < b)\n    {\n        ImSwap(g, b);\n        K = -1.f;\n    }\n    if (r < g)\n    {\n        ImSwap(r, g);\n        K = -2.f / 6.f - K;\n    }\n\n    const float chroma = r - (g < b ? g : b);\n    out_h = ImFabs(K + (g - b) / (6.f * chroma + 1e-20f));\n    out_s = chroma / (r + 1e-20f);\n    out_v = r;\n}\n\n// Convert hsv floats ([0-1],[0-1],[0-1]) to rgb floats ([0-1],[0-1],[0-1]), from Foley & van Dam p593\n// also http://en.wikipedia.org/wiki/HSL_and_HSV\nvoid ImGui::ColorConvertHSVtoRGB(float h, float s, float v, float& out_r, float& out_g, float& out_b)\n{\n    if (s == 0.0f)\n    {\n        // gray\n        out_r = out_g = out_b = v;\n        return;\n    }\n\n    h = ImFmod(h, 1.0f) / (60.0f / 360.0f);\n    int   i = (int)h;\n    float f = h - (float)i;\n    float p = v * (1.0f - s);\n    float q = v * (1.0f - s * f);\n    float t = v * (1.0f - s * (1.0f - f));\n\n    switch (i)\n    {\n    case 0: out_r = v; out_g = t; out_b = p; break;\n    case 1: out_r = q; out_g = v; out_b = p; break;\n    case 2: out_r = p; out_g = v; out_b = t; break;\n    case 3: out_r = p; out_g = q; out_b = v; break;\n    case 4: out_r = t; out_g = p; out_b = v; break;\n    case 5: default: out_r = v; out_g = p; out_b = q; break;\n    }\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] ImGuiStorage\n// Helper: Key->value storage\n//-----------------------------------------------------------------------------\n\n// std::lower_bound but without the bullshit\nstatic ImGuiStorage::ImGuiStoragePair* LowerBound(ImVector<ImGuiStorage::ImGuiStoragePair>& data, ImGuiID key)\n{\n    ImGuiStorage::ImGuiStoragePair* first = data.Data;\n    ImGuiStorage::ImGuiStoragePair* last = data.Data + data.Size;\n    size_t count = (size_t)(last - first);\n    while (count > 0)\n    {\n        size_t count2 = count >> 1;\n        ImGuiStorage::ImGuiStoragePair* mid = first + count2;\n        if (mid->key < key)\n        {\n            first = ++mid;\n            count -= count2 + 1;\n        }\n        else\n        {\n            count = count2;\n        }\n    }\n    return first;\n}\n\n// For quicker full rebuild of a storage (instead of an incremental one), you may add all your contents and then sort once.\nvoid ImGuiStorage::BuildSortByKey()\n{\n    struct StaticFunc\n    {\n        static int IMGUI_CDECL PairCompareByID(const void* lhs, const void* rhs)\n        {\n            // We can't just do a subtraction because qsort uses signed integers and subtracting our ID doesn't play well with that.\n            if (((const ImGuiStoragePair*)lhs)->key > ((const ImGuiStoragePair*)rhs)->key) return +1;\n            if (((const ImGuiStoragePair*)lhs)->key < ((const ImGuiStoragePair*)rhs)->key) return -1;\n            return 0;\n        }\n    };\n    if (Data.Size > 1)\n        ImQsort(Data.Data, (size_t)Data.Size, sizeof(ImGuiStoragePair), StaticFunc::PairCompareByID);\n}\n\nint ImGuiStorage::GetInt(ImGuiID key, int default_val) const\n{\n    ImGuiStoragePair* it = LowerBound(const_cast<ImVector<ImGuiStoragePair>&>(Data), key);\n    if (it == Data.end() || it->key != key)\n        return default_val;\n    return it->val_i;\n}\n\nbool ImGuiStorage::GetBool(ImGuiID key, bool default_val) const\n{\n    return GetInt(key, default_val ? 1 : 0) != 0;\n}\n\nfloat ImGuiStorage::GetFloat(ImGuiID key, float default_val) const\n{\n    ImGuiStoragePair* it = LowerBound(const_cast<ImVector<ImGuiStoragePair>&>(Data), key);\n    if (it == Data.end() || it->key != key)\n        return default_val;\n    return it->val_f;\n}\n\nvoid* ImGuiStorage::GetVoidPtr(ImGuiID key) const\n{\n    ImGuiStoragePair* it = LowerBound(const_cast<ImVector<ImGuiStoragePair>&>(Data), key);\n    if (it == Data.end() || it->key != key)\n        return NULL;\n    return it->val_p;\n}\n\n// References are only valid until a new value is added to the storage. Calling a Set***() function or a Get***Ref() function invalidates the pointer.\nint* ImGuiStorage::GetIntRef(ImGuiID key, int default_val)\n{\n    ImGuiStoragePair* it = LowerBound(Data, key);\n    if (it == Data.end() || it->key != key)\n        it = Data.insert(it, ImGuiStoragePair(key, default_val));\n    return &it->val_i;\n}\n\nbool* ImGuiStorage::GetBoolRef(ImGuiID key, bool default_val)\n{\n    return (bool*)GetIntRef(key, default_val ? 1 : 0);\n}\n\nfloat* ImGuiStorage::GetFloatRef(ImGuiID key, float default_val)\n{\n    ImGuiStoragePair* it = LowerBound(Data, key);\n    if (it == Data.end() || it->key != key)\n        it = Data.insert(it, ImGuiStoragePair(key, default_val));\n    return &it->val_f;\n}\n\nvoid** ImGuiStorage::GetVoidPtrRef(ImGuiID key, void* default_val)\n{\n    ImGuiStoragePair* it = LowerBound(Data, key);\n    if (it == Data.end() || it->key != key)\n        it = Data.insert(it, ImGuiStoragePair(key, default_val));\n    return &it->val_p;\n}\n\n// FIXME-OPT: Need a way to reuse the result of lower_bound when doing GetInt()/SetInt() - not too bad because it only happens on explicit interaction (maximum one a frame)\nvoid ImGuiStorage::SetInt(ImGuiID key, int val)\n{\n    ImGuiStoragePair* it = LowerBound(Data, key);\n    if (it == Data.end() || it->key != key)\n    {\n        Data.insert(it, ImGuiStoragePair(key, val));\n        return;\n    }\n    it->val_i = val;\n}\n\nvoid ImGuiStorage::SetBool(ImGuiID key, bool val)\n{\n    SetInt(key, val ? 1 : 0);\n}\n\nvoid ImGuiStorage::SetFloat(ImGuiID key, float val)\n{\n    ImGuiStoragePair* it = LowerBound(Data, key);\n    if (it == Data.end() || it->key != key)\n    {\n        Data.insert(it, ImGuiStoragePair(key, val));\n        return;\n    }\n    it->val_f = val;\n}\n\nvoid ImGuiStorage::SetVoidPtr(ImGuiID key, void* val)\n{\n    ImGuiStoragePair* it = LowerBound(Data, key);\n    if (it == Data.end() || it->key != key)\n    {\n        Data.insert(it, ImGuiStoragePair(key, val));\n        return;\n    }\n    it->val_p = val;\n}\n\nvoid ImGuiStorage::SetAllInt(int v)\n{\n    for (int i = 0; i < Data.Size; i++)\n        Data[i].val_i = v;\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] ImGuiTextFilter\n//-----------------------------------------------------------------------------\n\n// Helper: Parse and apply text filters. In format \"aaaaa[,bbbb][,ccccc]\"\nImGuiTextFilter::ImGuiTextFilter(const char* default_filter)\n{\n    if (default_filter)\n    {\n        ImStrncpy(InputBuf, default_filter, IM_ARRAYSIZE(InputBuf));\n        Build();\n    }\n    else\n    {\n        InputBuf[0] = 0;\n        CountGrep = 0;\n    }\n}\n\nbool ImGuiTextFilter::Draw(const char* label, float width)\n{\n    if (width != 0.0f)\n        ImGui::SetNextItemWidth(width);\n    bool value_changed = ImGui::InputText(label, InputBuf, IM_ARRAYSIZE(InputBuf));\n    if (value_changed)\n        Build();\n    return value_changed;\n}\n\nvoid ImGuiTextFilter::ImGuiTextRange::split(char separator, ImVector<ImGuiTextRange>* out) const\n{\n    out->resize(0);\n    const char* wb = b;\n    const char* we = wb;\n    while (we < e)\n    {\n        if (*we == separator)\n        {\n            out->push_back(ImGuiTextRange(wb, we));\n            wb = we + 1;\n        }\n        we++;\n    }\n    if (wb != we)\n        out->push_back(ImGuiTextRange(wb, we));\n}\n\nvoid ImGuiTextFilter::Build()\n{\n    Filters.resize(0);\n    ImGuiTextRange input_range(InputBuf, InputBuf + strlen(InputBuf));\n    input_range.split(',', &Filters);\n\n    CountGrep = 0;\n    for (int i = 0; i != Filters.Size; i++)\n    {\n        ImGuiTextRange& f = Filters[i];\n        while (f.b < f.e && ImCharIsBlankA(f.b[0]))\n            f.b++;\n        while (f.e > f.b && ImCharIsBlankA(f.e[-1]))\n            f.e--;\n        if (f.empty())\n            continue;\n        if (Filters[i].b[0] != '-')\n            CountGrep += 1;\n    }\n}\n\nbool ImGuiTextFilter::PassFilter(const char* text, const char* text_end) const\n{\n    if (Filters.empty())\n        return true;\n\n    if (text == NULL)\n        text = \"\";\n\n    for (int i = 0; i != Filters.Size; i++)\n    {\n        const ImGuiTextRange& f = Filters[i];\n        if (f.empty())\n            continue;\n        if (f.b[0] == '-')\n        {\n            // Subtract\n            if (ImStristr(text, text_end, f.b + 1, f.e) != NULL)\n                return false;\n        }\n        else\n        {\n            // Grep\n            if (ImStristr(text, text_end, f.b, f.e) != NULL)\n                return true;\n        }\n    }\n\n    // Implicit * grep\n    if (CountGrep == 0)\n        return true;\n\n    return false;\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] ImGuiTextBuffer\n//-----------------------------------------------------------------------------\n\n// On some platform vsnprintf() takes va_list by reference and modifies it.\n// va_copy is the 'correct' way to copy a va_list but Visual Studio prior to 2013 doesn't have it.\n#ifndef va_copy\n#if defined(__GNUC__) || defined(__clang__)\n#define va_copy(dest, src) __builtin_va_copy(dest, src)\n#else\n#define va_copy(dest, src) (dest = src)\n#endif\n#endif\n\nchar ImGuiTextBuffer::EmptyString[1] = { 0 };\n\nvoid ImGuiTextBuffer::append(const char* str, const char* str_end)\n{\n    int len = str_end ? (int)(str_end - str) : (int)strlen(str);\n\n    // Add zero-terminator the first time\n    const int write_off = (Buf.Size != 0) ? Buf.Size : 1;\n    const int needed_sz = write_off + len;\n    if (write_off + len >= Buf.Capacity)\n    {\n        int new_capacity = Buf.Capacity * 2;\n        Buf.reserve(needed_sz > new_capacity ? needed_sz : new_capacity);\n    }\n\n    Buf.resize(needed_sz);\n    memcpy(&Buf[write_off - 1], str, (size_t)len);\n    Buf[write_off - 1 + len] = 0;\n}\n\nvoid ImGuiTextBuffer::appendf(const char* fmt, ...)\n{\n    va_list args;\n    va_start(args, fmt);\n    appendfv(fmt, args);\n    va_end(args);\n}\n\n// Helper: Text buffer for logging/accumulating text\nvoid ImGuiTextBuffer::appendfv(const char* fmt, va_list args)\n{\n    va_list args_copy;\n    va_copy(args_copy, args);\n\n    int len = ImFormatStringV(NULL, 0, fmt, args);         // FIXME-OPT: could do a first pass write attempt, likely successful on first pass.\n    if (len <= 0)\n    {\n        va_end(args_copy);\n        return;\n    }\n\n    // Add zero-terminator the first time\n    const int write_off = (Buf.Size != 0) ? Buf.Size : 1;\n    const int needed_sz = write_off + len;\n    if (write_off + len >= Buf.Capacity)\n    {\n        int new_capacity = Buf.Capacity * 2;\n        Buf.reserve(needed_sz > new_capacity ? needed_sz : new_capacity);\n    }\n\n    Buf.resize(needed_sz);\n    ImFormatStringV(&Buf[write_off - 1], (size_t)len + 1, fmt, args_copy);\n    va_end(args_copy);\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] ImGuiListClipper\n// This is currently not as flexible/powerful as it should be and really confusing/spaghetti, mostly because we changed\n// the API mid-way through development and support two ways to using the clipper, needs some rework (see TODO)\n//-----------------------------------------------------------------------------\n\n// FIXME-TABLE: This prevents us from using ImGuiListClipper _inside_ a table cell.\n// The problem we have is that without a Begin/End scheme for rows using the clipper is ambiguous.\nstatic bool GetSkipItemForListClipping()\n{\n    ImGuiContext& g = *GImGui;\n    return (g.CurrentTable ? g.CurrentTable->HostSkipItems : g.CurrentWindow->SkipItems);\n}\n\n// Helper to calculate coarse clipping of large list of evenly sized items.\n// NB: Prefer using the ImGuiListClipper higher-level helper if you can! Read comments and instructions there on how those use this sort of pattern.\n// NB: 'items_count' is only used to clamp the result, if you don't know your count you can use INT_MAX\nvoid ImGui::CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    if (g.LogEnabled)\n    {\n        // If logging is active, do not perform any clipping\n        *out_items_display_start = 0;\n        *out_items_display_end = items_count;\n        return;\n    }\n    if (GetSkipItemForListClipping())\n    {\n        *out_items_display_start = *out_items_display_end = 0;\n        return;\n    }\n\n    // We create the union of the ClipRect and the NavScoringRect which at worst should be 1 page away from ClipRect\n    ImRect unclipped_rect = window->ClipRect;\n    if (g.NavMoveRequest)\n        unclipped_rect.Add(g.NavScoringRect);\n    if (g.NavJustMovedToId && window->NavLastIds[0] == g.NavJustMovedToId)\n        unclipped_rect.Add(ImRect(window->Pos + window->NavRectRel[0].Min, window->Pos + window->NavRectRel[0].Max));\n\n    const ImVec2 pos = window->DC.CursorPos;\n    int start = (int)((unclipped_rect.Min.y - pos.y) / items_height);\n    int end = (int)((unclipped_rect.Max.y - pos.y) / items_height);\n\n    // When performing a navigation request, ensure we have one item extra in the direction we are moving to\n    if (g.NavMoveRequest && g.NavMoveClipDir == ImGuiDir_Up)\n        start--;\n    if (g.NavMoveRequest && g.NavMoveClipDir == ImGuiDir_Down)\n        end++;\n\n    start = ImClamp(start, 0, items_count);\n    end = ImClamp(end + 1, start, items_count);\n    *out_items_display_start = start;\n    *out_items_display_end = end;\n}\n\nstatic void SetCursorPosYAndSetupForPrevLine(float pos_y, float line_height)\n{\n    // Set cursor position and a few other things so that SetScrollHereY() and Columns() can work when seeking cursor.\n    // FIXME: It is problematic that we have to do that here, because custom/equivalent end-user code would stumble on the same issue.\n    // The clipper should probably have a 4th step to display the last item in a regular manner.\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    float off_y = pos_y - window->DC.CursorPos.y;\n    window->DC.CursorPos.y = pos_y;\n    window->DC.CursorMaxPos.y = ImMax(window->DC.CursorMaxPos.y, pos_y);\n    window->DC.CursorPosPrevLine.y = window->DC.CursorPos.y - line_height;  // Setting those fields so that SetScrollHereY() can properly function after the end of our clipper usage.\n    window->DC.PrevLineSize.y = (line_height - g.Style.ItemSpacing.y);      // If we end up needing more accurate data (to e.g. use SameLine) we may as well make the clipper have a fourth step to let user process and display the last item in their list.\n    if (ImGuiOldColumns* columns = window->DC.CurrentColumns)\n        columns->LineMinY = window->DC.CursorPos.y;                         // Setting this so that cell Y position are set properly\n    if (ImGuiTable* table = g.CurrentTable)\n    {\n        if (table->IsInsideRow)\n            ImGui::TableEndRow(table);\n        table->RowPosY2 = window->DC.CursorPos.y;\n        const int row_increase = (int)((off_y / line_height) + 0.5f);\n        //table->CurrentRow += row_increase; // Can't do without fixing TableEndRow()\n        table->RowBgColorCounter += row_increase;\n    }\n}\n\nImGuiListClipper::ImGuiListClipper()\n{\n    memset(this, 0, sizeof(*this));\n    ItemsCount = -1;\n}\n\nImGuiListClipper::~ImGuiListClipper()\n{\n    IM_ASSERT(ItemsCount == -1 && \"Forgot to call End(), or to Step() until false?\");\n}\n\n// Use case A: Begin() called from constructor with items_height<0, then called again from Step() in StepNo 1\n// Use case B: Begin() called from constructor with items_height>0\n// FIXME-LEGACY: Ideally we should remove the Begin/End functions but they are part of the legacy API we still support. This is why some of the code in Step() calling Begin() and reassign some fields, spaghetti style.\nvoid ImGuiListClipper::Begin(int items_count, float items_height)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n\n    if (ImGuiTable* table = g.CurrentTable)\n        if (table->IsInsideRow)\n            ImGui::TableEndRow(table);\n\n    StartPosY = window->DC.CursorPos.y;\n    ItemsHeight = items_height;\n    ItemsCount = items_count;\n    ItemsFrozen = 0;\n    StepNo = 0;\n    DisplayStart = -1;\n    DisplayEnd = 0;\n}\n\nvoid ImGuiListClipper::End()\n{\n    if (ItemsCount < 0) // Already ended\n        return;\n\n    // In theory here we should assert that ImGui::GetCursorPosY() == StartPosY + DisplayEnd * ItemsHeight, but it feels saner to just seek at the end and not assert/crash the user.\n    if (ItemsCount < INT_MAX && DisplayStart >= 0)\n        SetCursorPosYAndSetupForPrevLine(StartPosY + (ItemsCount - ItemsFrozen) * ItemsHeight, ItemsHeight);\n    ItemsCount = -1;\n    StepNo = 3;\n}\n\nbool ImGuiListClipper::Step()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n\n    ImGuiTable* table = g.CurrentTable;\n    if (table && table->IsInsideRow)\n        ImGui::TableEndRow(table);\n\n    // No items\n    if (ItemsCount == 0 || GetSkipItemForListClipping())\n    {\n        End();\n        return false;\n    }\n\n    // Step 0: Let you process the first element (regardless of it being visible or not, so we can measure the element height)\n    if (StepNo == 0)\n    {\n        // While we are in frozen row state, keep displaying items one by one, unclipped\n        // FIXME: Could be stored as a table-agnostic state.\n        if (table != NULL && !table->IsUnfrozenRows)\n        {\n            DisplayStart = ItemsFrozen;\n            DisplayEnd = ItemsFrozen + 1;\n            ItemsFrozen++;\n            return true;\n        }\n\n        StartPosY = window->DC.CursorPos.y;\n        if (ItemsHeight <= 0.0f)\n        {\n            // Submit the first item so we can measure its height (generally it is 0..1)\n            DisplayStart = ItemsFrozen;\n            DisplayEnd = ItemsFrozen + 1;\n            StepNo = 1;\n            return true;\n        }\n\n        // Already has item height (given by user in Begin): skip to calculating step\n        DisplayStart = DisplayEnd;\n        StepNo = 2;\n    }\n\n    // Step 1: the clipper infer height from first element\n    if (StepNo == 1)\n    {\n        IM_ASSERT(ItemsHeight <= 0.0f);\n        if (table)\n        {\n            const float pos_y1 = table->RowPosY1;   // Using this instead of StartPosY to handle clipper straddling the frozen row\n            const float pos_y2 = table->RowPosY2;   // Using this instead of CursorPos.y to take account of tallest cell.\n            ItemsHeight = pos_y2 - pos_y1;\n            window->DC.CursorPos.y = pos_y2;\n        }\n        else\n        {\n            ItemsHeight = window->DC.CursorPos.y - StartPosY;\n        }\n        IM_ASSERT(ItemsHeight > 0.0f && \"Unable to calculate item height! First item hasn't moved the cursor vertically!\");\n        StepNo = 2;\n    }\n\n    // Reached end of list\n    if (DisplayEnd >= ItemsCount)\n    {\n        End();\n        return false;\n    }\n\n    // Step 2: calculate the actual range of elements to display, and position the cursor before the first element\n    if (StepNo == 2)\n    {\n        IM_ASSERT(ItemsHeight > 0.0f);\n\n        int already_submitted = DisplayEnd;\n        ImGui::CalcListClipping(ItemsCount - already_submitted, ItemsHeight, &DisplayStart, &DisplayEnd);\n        DisplayStart += already_submitted;\n        DisplayEnd += already_submitted;\n\n        // Seek cursor\n        if (DisplayStart > already_submitted)\n            SetCursorPosYAndSetupForPrevLine(StartPosY + (DisplayStart - ItemsFrozen) * ItemsHeight, ItemsHeight);\n\n        StepNo = 3;\n        return true;\n    }\n\n    // Step 3: the clipper validate that we have reached the expected Y position (corresponding to element DisplayEnd),\n    // Advance the cursor to the end of the list and then returns 'false' to end the loop.\n    if (StepNo == 3)\n    {\n        // Seek cursor\n        if (ItemsCount < INT_MAX)\n            SetCursorPosYAndSetupForPrevLine(StartPosY + (ItemsCount - ItemsFrozen) * ItemsHeight, ItemsHeight); // advance cursor\n        ItemsCount = -1;\n        return false;\n    }\n\n    IM_ASSERT(0);\n    return false;\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] STYLING\n//-----------------------------------------------------------------------------\n\nImGuiStyle& ImGui::GetStyle()\n{\n    IM_ASSERT(GImGui != NULL && \"No current context. Did you call ImGui::CreateContext() and ImGui::SetCurrentContext() ?\");\n    return GImGui->Style;\n}\n\nImU32 ImGui::GetColorU32(ImGuiCol idx, float alpha_mul)\n{\n    ImGuiStyle& style = GImGui->Style;\n    ImVec4 c = style.Colors[idx];\n    c.w *= style.Alpha * alpha_mul;\n    return ColorConvertFloat4ToU32(c);\n}\n\nImU32 ImGui::GetColorU32(const ImVec4& col)\n{\n    ImGuiStyle& style = GImGui->Style;\n    ImVec4 c = col;\n    c.w *= style.Alpha;\n    return ColorConvertFloat4ToU32(c);\n}\n\nconst ImVec4& ImGui::GetStyleColorVec4(ImGuiCol idx)\n{\n    ImGuiStyle& style = GImGui->Style;\n    return style.Colors[idx];\n}\n\nImU32 ImGui::GetColorU32(ImU32 col)\n{\n    ImGuiStyle& style = GImGui->Style;\n    if (style.Alpha >= 1.0f)\n        return col;\n    ImU32 a = (col & IM_COL32_A_MASK) >> IM_COL32_A_SHIFT;\n    a = (ImU32)(a * style.Alpha); // We don't need to clamp 0..255 because Style.Alpha is in 0..1 range.\n    return (col & ~IM_COL32_A_MASK) | (a << IM_COL32_A_SHIFT);\n}\n\n// FIXME: This may incur a round-trip (if the end user got their data from a float4) but eventually we aim to store the in-flight colors as ImU32\nvoid ImGui::PushStyleColor(ImGuiCol idx, ImU32 col)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiColorMod backup;\n    backup.Col = idx;\n    backup.BackupValue = g.Style.Colors[idx];\n    g.ColorStack.push_back(backup);\n    g.Style.Colors[idx] = ColorConvertU32ToFloat4(col);\n}\n\nvoid ImGui::PushStyleColor(ImGuiCol idx, const ImVec4& col)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiColorMod backup;\n    backup.Col = idx;\n    backup.BackupValue = g.Style.Colors[idx];\n    g.ColorStack.push_back(backup);\n    g.Style.Colors[idx] = col;\n}\n\nvoid ImGui::PopStyleColor(int count)\n{\n    ImGuiContext& g = *GImGui;\n    while (count > 0)\n    {\n        ImGuiColorMod& backup = g.ColorStack.back();\n        g.Style.Colors[backup.Col] = backup.BackupValue;\n        g.ColorStack.pop_back();\n        count--;\n    }\n}\n\nstruct ImGuiStyleVarInfo\n{\n    ImGuiDataType   Type;\n    ImU32           Count;\n    ImU32           Offset;\n    void*           GetVarPtr(ImGuiStyle* style) const { return (void*)((unsigned char*)style + Offset); }\n};\n\nstatic const ImGuiStyleVarInfo GStyleVarInfo[] =\n{\n    { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, Alpha) },               // ImGuiStyleVar_Alpha\n    { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, DisabledAlpha) },       // ImGuiStyleVar_DisabledAlpha\n    { ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImGuiStyle, WindowPadding) },       // ImGuiStyleVar_WindowPadding\n    { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, WindowRounding) },      // ImGuiStyleVar_WindowRounding\n    { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, WindowBorderSize) },    // ImGuiStyleVar_WindowBorderSize\n    { ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImGuiStyle, WindowMinSize) },       // ImGuiStyleVar_WindowMinSize\n    { ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImGuiStyle, WindowTitleAlign) },    // ImGuiStyleVar_WindowTitleAlign\n    { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, ChildRounding) },       // ImGuiStyleVar_ChildRounding\n    { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, ChildBorderSize) },     // ImGuiStyleVar_ChildBorderSize\n    { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, PopupRounding) },       // ImGuiStyleVar_PopupRounding\n    { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, PopupBorderSize) },     // ImGuiStyleVar_PopupBorderSize\n    { ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImGuiStyle, FramePadding) },        // ImGuiStyleVar_FramePadding\n    { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, FrameRounding) },       // ImGuiStyleVar_FrameRounding\n    { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, FrameBorderSize) },     // ImGuiStyleVar_FrameBorderSize\n    { ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImGuiStyle, ItemSpacing) },         // ImGuiStyleVar_ItemSpacing\n    { ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImGuiStyle, ItemInnerSpacing) },    // ImGuiStyleVar_ItemInnerSpacing\n    { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, IndentSpacing) },       // ImGuiStyleVar_IndentSpacing\n    { ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImGuiStyle, CellPadding) },         // ImGuiStyleVar_CellPadding\n    { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, ScrollbarSize) },       // ImGuiStyleVar_ScrollbarSize\n    { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, ScrollbarRounding) },   // ImGuiStyleVar_ScrollbarRounding\n    { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, GrabMinSize) },         // ImGuiStyleVar_GrabMinSize\n    { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, GrabRounding) },        // ImGuiStyleVar_GrabRounding\n    { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, TabRounding) },         // ImGuiStyleVar_TabRounding\n    { ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImGuiStyle, ButtonTextAlign) },     // ImGuiStyleVar_ButtonTextAlign\n    { ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImGuiStyle, SelectableTextAlign) }, // ImGuiStyleVar_SelectableTextAlign\n};\n\nstatic const ImGuiStyleVarInfo* GetStyleVarInfo(ImGuiStyleVar idx)\n{\n    IM_ASSERT(idx >= 0 && idx < ImGuiStyleVar_COUNT);\n    IM_ASSERT(IM_ARRAYSIZE(GStyleVarInfo) == ImGuiStyleVar_COUNT);\n    return &GStyleVarInfo[idx];\n}\n\nvoid ImGui::PushStyleVar(ImGuiStyleVar idx, float val)\n{\n    const ImGuiStyleVarInfo* var_info = GetStyleVarInfo(idx);\n    if (var_info->Type == ImGuiDataType_Float && var_info->Count == 1)\n    {\n        ImGuiContext& g = *GImGui;\n        float* pvar = (float*)var_info->GetVarPtr(&g.Style);\n        g.StyleVarStack.push_back(ImGuiStyleMod(idx, *pvar));\n        *pvar = val;\n        return;\n    }\n    IM_ASSERT(0 && \"Called PushStyleVar() float variant but variable is not a float!\");\n}\n\nvoid ImGui::PushStyleVar(ImGuiStyleVar idx, const ImVec2& val)\n{\n    const ImGuiStyleVarInfo* var_info = GetStyleVarInfo(idx);\n    if (var_info->Type == ImGuiDataType_Float && var_info->Count == 2)\n    {\n        ImGuiContext& g = *GImGui;\n        ImVec2* pvar = (ImVec2*)var_info->GetVarPtr(&g.Style);\n        g.StyleVarStack.push_back(ImGuiStyleMod(idx, *pvar));\n        *pvar = val;\n        return;\n    }\n    IM_ASSERT(0 && \"Called PushStyleVar() ImVec2 variant but variable is not a ImVec2!\");\n}\n\nvoid ImGui::PopStyleVar(int count)\n{\n    ImGuiContext& g = *GImGui;\n    while (count > 0)\n    {\n        // We avoid a generic memcpy(data, &backup.Backup.., GDataTypeSize[info->Type] * info->Count), the overhead in Debug is not worth it.\n        ImGuiStyleMod& backup = g.StyleVarStack.back();\n        const ImGuiStyleVarInfo* info = GetStyleVarInfo(backup.VarIdx);\n        void* data = info->GetVarPtr(&g.Style);\n        if (info->Type == ImGuiDataType_Float && info->Count == 1)      { ((float*)data)[0] = backup.BackupFloat[0]; }\n        else if (info->Type == ImGuiDataType_Float && info->Count == 2) { ((float*)data)[0] = backup.BackupFloat[0]; ((float*)data)[1] = backup.BackupFloat[1]; }\n        g.StyleVarStack.pop_back();\n        count--;\n    }\n}\n\nconst char* ImGui::GetStyleColorName(ImGuiCol idx)\n{\n    // Create switch-case from enum with regexp: ImGuiCol_{.*}, --> case ImGuiCol_\\1: return \"\\1\";\n    switch (idx)\n    {\n    case ImGuiCol_Text: return \"Text\";\n    case ImGuiCol_TextDisabled: return \"TextDisabled\";\n    case ImGuiCol_WindowBg: return \"WindowBg\";\n    case ImGuiCol_ChildBg: return \"ChildBg\";\n    case ImGuiCol_PopupBg: return \"PopupBg\";\n    case ImGuiCol_Border: return \"Border\";\n    case ImGuiCol_BorderShadow: return \"BorderShadow\";\n    case ImGuiCol_FrameBg: return \"FrameBg\";\n    case ImGuiCol_FrameBgHovered: return \"FrameBgHovered\";\n    case ImGuiCol_FrameBgActive: return \"FrameBgActive\";\n    case ImGuiCol_TitleBg: return \"TitleBg\";\n    case ImGuiCol_TitleBgActive: return \"TitleBgActive\";\n    case ImGuiCol_TitleBgCollapsed: return \"TitleBgCollapsed\";\n    case ImGuiCol_MenuBarBg: return \"MenuBarBg\";\n    case ImGuiCol_ScrollbarBg: return \"ScrollbarBg\";\n    case ImGuiCol_ScrollbarGrab: return \"ScrollbarGrab\";\n    case ImGuiCol_ScrollbarGrabHovered: return \"ScrollbarGrabHovered\";\n    case ImGuiCol_ScrollbarGrabActive: return \"ScrollbarGrabActive\";\n    case ImGuiCol_CheckMark: return \"CheckMark\";\n    case ImGuiCol_SliderGrab: return \"SliderGrab\";\n    case ImGuiCol_SliderGrabActive: return \"SliderGrabActive\";\n    case ImGuiCol_Button: return \"Button\";\n    case ImGuiCol_ButtonHovered: return \"ButtonHovered\";\n    case ImGuiCol_ButtonActive: return \"ButtonActive\";\n    case ImGuiCol_Header: return \"Header\";\n    case ImGuiCol_HeaderHovered: return \"HeaderHovered\";\n    case ImGuiCol_HeaderActive: return \"HeaderActive\";\n    case ImGuiCol_Separator: return \"Separator\";\n    case ImGuiCol_SeparatorHovered: return \"SeparatorHovered\";\n    case ImGuiCol_SeparatorActive: return \"SeparatorActive\";\n    case ImGuiCol_ResizeGrip: return \"ResizeGrip\";\n    case ImGuiCol_ResizeGripHovered: return \"ResizeGripHovered\";\n    case ImGuiCol_ResizeGripActive: return \"ResizeGripActive\";\n    case ImGuiCol_Tab: return \"Tab\";\n    case ImGuiCol_TabHovered: return \"TabHovered\";\n    case ImGuiCol_TabActive: return \"TabActive\";\n    case ImGuiCol_TabUnfocused: return \"TabUnfocused\";\n    case ImGuiCol_TabUnfocusedActive: return \"TabUnfocusedActive\";\n    case ImGuiCol_PlotLines: return \"PlotLines\";\n    case ImGuiCol_PlotLinesHovered: return \"PlotLinesHovered\";\n    case ImGuiCol_PlotHistogram: return \"PlotHistogram\";\n    case ImGuiCol_PlotHistogramHovered: return \"PlotHistogramHovered\";\n    case ImGuiCol_TableHeaderBg: return \"TableHeaderBg\";\n    case ImGuiCol_TableBorderStrong: return \"TableBorderStrong\";\n    case ImGuiCol_TableBorderLight: return \"TableBorderLight\";\n    case ImGuiCol_TableRowBg: return \"TableRowBg\";\n    case ImGuiCol_TableRowBgAlt: return \"TableRowBgAlt\";\n    case ImGuiCol_TextSelectedBg: return \"TextSelectedBg\";\n    case ImGuiCol_DragDropTarget: return \"DragDropTarget\";\n    case ImGuiCol_NavHighlight: return \"NavHighlight\";\n    case ImGuiCol_NavWindowingHighlight: return \"NavWindowingHighlight\";\n    case ImGuiCol_NavWindowingDimBg: return \"NavWindowingDimBg\";\n    case ImGuiCol_ModalWindowDimBg: return \"ModalWindowDimBg\";\n    }\n    IM_ASSERT(0);\n    return \"Unknown\";\n}\n\n\n//-----------------------------------------------------------------------------\n// [SECTION] RENDER HELPERS\n// Some of those (internal) functions are currently quite a legacy mess - their signature and behavior will change,\n// we need a nicer separation between low-level functions and high-level functions relying on the ImGui context.\n// Also see imgui_draw.cpp for some more which have been reworked to not rely on ImGui:: context.\n//-----------------------------------------------------------------------------\n\nconst char* ImGui::FindRenderedTextEnd(const char* text, const char* text_end)\n{\n    const char* text_display_end = text;\n    if (!text_end)\n        text_end = (const char*)-1;\n\n    while (text_display_end < text_end && *text_display_end != '\\0' && (text_display_end[0] != '#' || text_display_end[1] != '#'))\n        text_display_end++;\n    return text_display_end;\n}\n\n// Internal ImGui functions to render text\n// RenderText***() functions calls ImDrawList::AddText() calls ImBitmapFont::RenderText()\nvoid ImGui::RenderText(ImVec2 pos, const char* text, const char* text_end, bool hide_text_after_hash)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n\n    // Hide anything after a '##' string\n    const char* text_display_end;\n    if (hide_text_after_hash)\n    {\n        text_display_end = FindRenderedTextEnd(text, text_end);\n    }\n    else\n    {\n        if (!text_end)\n            text_end = text + strlen(text); // FIXME-OPT\n        text_display_end = text_end;\n    }\n\n    if (text != text_display_end)\n    {\n        window->DrawList->AddText(g.Font, g.FontSize, pos, GetColorU32(ImGuiCol_Text), text, text_display_end);\n        if (g.LogEnabled)\n            LogRenderedText(&pos, text, text_display_end);\n    }\n}\n\nvoid ImGui::RenderTextWrapped(ImVec2 pos, const char* text, const char* text_end, float wrap_width)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n\n    if (!text_end)\n        text_end = text + strlen(text); // FIXME-OPT\n\n    if (text != text_end)\n    {\n        window->DrawList->AddText(g.Font, g.FontSize, pos, GetColorU32(ImGuiCol_Text), text, text_end, wrap_width);\n        if (g.LogEnabled)\n            LogRenderedText(&pos, text, text_end);\n    }\n}\n\n// Default clip_rect uses (pos_min,pos_max)\n// Handle clipping on CPU immediately (vs typically let the GPU clip the triangles that are overlapping the clipping rectangle edges)\nvoid ImGui::RenderTextClippedEx(ImDrawList* draw_list, const ImVec2& pos_min, const ImVec2& pos_max, const char* text, const char* text_display_end, const ImVec2* text_size_if_known, const ImVec2& align, const ImRect* clip_rect)\n{\n    // Perform CPU side clipping for single clipped element to avoid using scissor state\n    ImVec2 pos = pos_min;\n    const ImVec2 text_size = text_size_if_known ? *text_size_if_known : CalcTextSize(text, text_display_end, false, 0.0f);\n\n    const ImVec2* clip_min = clip_rect ? &clip_rect->Min : &pos_min;\n    const ImVec2* clip_max = clip_rect ? &clip_rect->Max : &pos_max;\n    bool need_clipping = (pos.x + text_size.x >= clip_max->x) || (pos.y + text_size.y >= clip_max->y);\n    if (clip_rect) // If we had no explicit clipping rectangle then pos==clip_min\n        need_clipping |= (pos.x < clip_min->x) || (pos.y < clip_min->y);\n\n    // Align whole block. We should defer that to the better rendering function when we'll have support for individual line alignment.\n    if (align.x > 0.0f) pos.x = ImMax(pos.x, pos.x + (pos_max.x - pos.x - text_size.x) * align.x);\n    if (align.y > 0.0f) pos.y = ImMax(pos.y, pos.y + (pos_max.y - pos.y - text_size.y) * align.y);\n\n    // Render\n    if (need_clipping)\n    {\n        ImVec4 fine_clip_rect(clip_min->x, clip_min->y, clip_max->x, clip_max->y);\n        draw_list->AddText(NULL, 0.0f, pos, GetColorU32(ImGuiCol_Text), text, text_display_end, 0.0f, &fine_clip_rect);\n    }\n    else\n    {\n        draw_list->AddText(NULL, 0.0f, pos, GetColorU32(ImGuiCol_Text), text, text_display_end, 0.0f, NULL);\n    }\n}\n\nvoid ImGui::RenderTextClipped(const ImVec2& pos_min, const ImVec2& pos_max, const char* text, const char* text_end, const ImVec2* text_size_if_known, const ImVec2& align, const ImRect* clip_rect)\n{\n    // Hide anything after a '##' string\n    const char* text_display_end = FindRenderedTextEnd(text, text_end);\n    const int text_len = (int)(text_display_end - text);\n    if (text_len == 0)\n        return;\n\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    RenderTextClippedEx(window->DrawList, pos_min, pos_max, text, text_display_end, text_size_if_known, align, clip_rect);\n    if (g.LogEnabled)\n        LogRenderedText(&pos_min, text, text_display_end);\n}\n\n\n// Another overly complex function until we reorganize everything into a nice all-in-one helper.\n// This is made more complex because we have dissociated the layout rectangle (pos_min..pos_max) which define _where_ the ellipsis is, from actual clipping of text and limit of the ellipsis display.\n// This is because in the context of tabs we selectively hide part of the text when the Close Button appears, but we don't want the ellipsis to move.\nvoid ImGui::RenderTextEllipsis(ImDrawList* draw_list, const ImVec2& pos_min, const ImVec2& pos_max, float clip_max_x, float ellipsis_max_x, const char* text, const char* text_end_full, const ImVec2* text_size_if_known)\n{\n    ImGuiContext& g = *GImGui;\n    if (text_end_full == NULL)\n        text_end_full = FindRenderedTextEnd(text);\n    const ImVec2 text_size = text_size_if_known ? *text_size_if_known : CalcTextSize(text, text_end_full, false, 0.0f);\n\n    //draw_list->AddLine(ImVec2(pos_max.x, pos_min.y - 4), ImVec2(pos_max.x, pos_max.y + 4), IM_COL32(0, 0, 255, 255));\n    //draw_list->AddLine(ImVec2(ellipsis_max_x, pos_min.y-2), ImVec2(ellipsis_max_x, pos_max.y+2), IM_COL32(0, 255, 0, 255));\n    //draw_list->AddLine(ImVec2(clip_max_x, pos_min.y), ImVec2(clip_max_x, pos_max.y), IM_COL32(255, 0, 0, 255));\n    // FIXME: We could technically remove (last_glyph->AdvanceX - last_glyph->X1) from text_size.x here and save a few pixels.\n    if (text_size.x > pos_max.x - pos_min.x)\n    {\n        // Hello wo...\n        // |       |   |\n        // min   max   ellipsis_max\n        //          <-> this is generally some padding value\n\n        const ImFont* font = draw_list->_Data->Font;\n        const float font_size = draw_list->_Data->FontSize;\n        const char* text_end_ellipsis = NULL;\n\n        ImWchar ellipsis_char = font->EllipsisChar;\n        int ellipsis_char_count = 1;\n        if (ellipsis_char == (ImWchar)-1)\n        {\n            ellipsis_char = font->DotChar;\n            ellipsis_char_count = 3;\n        }\n        const ImFontGlyph* glyph = font->FindGlyph(ellipsis_char);\n\n        float ellipsis_glyph_width = glyph->X1;                 // Width of the glyph with no padding on either side\n        float ellipsis_total_width = ellipsis_glyph_width;      // Full width of entire ellipsis\n\n        if (ellipsis_char_count > 1)\n        {\n            // Full ellipsis size without free spacing after it.\n            const float spacing_between_dots = 1.0f * (draw_list->_Data->FontSize / font->FontSize);\n            ellipsis_glyph_width = glyph->X1 - glyph->X0 + spacing_between_dots;\n            ellipsis_total_width = ellipsis_glyph_width * (float)ellipsis_char_count - spacing_between_dots;\n        }\n\n        // We can now claim the space between pos_max.x and ellipsis_max.x\n        const float text_avail_width = ImMax((ImMax(pos_max.x, ellipsis_max_x) - ellipsis_total_width) - pos_min.x, 1.0f);\n        float text_size_clipped_x = font->CalcTextSizeA(font_size, text_avail_width, 0.0f, text, text_end_full, &text_end_ellipsis).x;\n        if (text == text_end_ellipsis && text_end_ellipsis < text_end_full)\n        {\n            // Always display at least 1 character if there's no room for character + ellipsis\n            text_end_ellipsis = text + ImTextCountUtf8BytesFromChar(text, text_end_full);\n            text_size_clipped_x = font->CalcTextSizeA(font_size, FLT_MAX, 0.0f, text, text_end_ellipsis).x;\n        }\n        while (text_end_ellipsis > text && ImCharIsBlankA(text_end_ellipsis[-1]))\n        {\n            // Trim trailing space before ellipsis (FIXME: Supporting non-ascii blanks would be nice, for this we need a function to backtrack in UTF-8 text)\n            text_end_ellipsis--;\n            text_size_clipped_x -= font->CalcTextSizeA(font_size, FLT_MAX, 0.0f, text_end_ellipsis, text_end_ellipsis + 1).x; // Ascii blanks are always 1 byte\n        }\n\n        // Render text, render ellipsis\n        RenderTextClippedEx(draw_list, pos_min, ImVec2(clip_max_x, pos_max.y), text, text_end_ellipsis, &text_size, ImVec2(0.0f, 0.0f));\n        float ellipsis_x = pos_min.x + text_size_clipped_x;\n        if (ellipsis_x + ellipsis_total_width <= ellipsis_max_x)\n            for (int i = 0; i < ellipsis_char_count; i++)\n            {\n                font->RenderChar(draw_list, font_size, ImVec2(ellipsis_x, pos_min.y), GetColorU32(ImGuiCol_Text), ellipsis_char);\n                ellipsis_x += ellipsis_glyph_width;\n            }\n    }\n    else\n    {\n        RenderTextClippedEx(draw_list, pos_min, ImVec2(clip_max_x, pos_max.y), text, text_end_full, &text_size, ImVec2(0.0f, 0.0f));\n    }\n\n    if (g.LogEnabled)\n        LogRenderedText(&pos_min, text, text_end_full);\n}\n\n// Render a rectangle shaped with optional rounding and borders\nvoid ImGui::RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border, float rounding)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    window->DrawList->AddRectFilled(p_min, p_max, fill_col, rounding);\n    const float border_size = g.Style.FrameBorderSize;\n    if (border && border_size > 0.0f)\n    {\n        window->DrawList->AddRect(p_min + ImVec2(1, 1), p_max + ImVec2(1, 1), GetColorU32(ImGuiCol_BorderShadow), rounding, 0, border_size);\n        window->DrawList->AddRect(p_min, p_max, GetColorU32(ImGuiCol_Border), rounding, 0, border_size);\n    }\n}\n\nvoid ImGui::RenderFrameBorder(ImVec2 p_min, ImVec2 p_max, float rounding)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    const float border_size = g.Style.FrameBorderSize;\n    if (border_size > 0.0f)\n    {\n        window->DrawList->AddRect(p_min + ImVec2(1, 1), p_max + ImVec2(1, 1), GetColorU32(ImGuiCol_BorderShadow), rounding, 0, border_size);\n        window->DrawList->AddRect(p_min, p_max, GetColorU32(ImGuiCol_Border), rounding, 0, border_size);\n    }\n}\n\nvoid ImGui::RenderNavHighlight(const ImRect& bb, ImGuiID id, ImGuiNavHighlightFlags flags)\n{\n    ImGuiContext& g = *GImGui;\n    if (id != g.NavId)\n        return;\n    if (g.NavDisableHighlight && !(flags & ImGuiNavHighlightFlags_AlwaysDraw))\n        return;\n    ImGuiWindow* window = g.CurrentWindow;\n    if (window->DC.NavHideHighlightOneFrame)\n        return;\n\n    float rounding = (flags & ImGuiNavHighlightFlags_NoRounding) ? 0.0f : g.Style.FrameRounding;\n    ImRect display_rect = bb;\n    display_rect.ClipWith(window->ClipRect);\n    if (flags & ImGuiNavHighlightFlags_TypeDefault)\n    {\n        const float THICKNESS = 2.0f;\n        const float DISTANCE = 3.0f + THICKNESS * 0.5f;\n        display_rect.Expand(ImVec2(DISTANCE, DISTANCE));\n        bool fully_visible = window->ClipRect.Contains(display_rect);\n        if (!fully_visible)\n            window->DrawList->PushClipRect(display_rect.Min, display_rect.Max);\n        window->DrawList->AddRect(display_rect.Min + ImVec2(THICKNESS * 0.5f, THICKNESS * 0.5f), display_rect.Max - ImVec2(THICKNESS * 0.5f, THICKNESS * 0.5f), GetColorU32(ImGuiCol_NavHighlight), rounding, 0, THICKNESS);\n        if (!fully_visible)\n            window->DrawList->PopClipRect();\n    }\n    if (flags & ImGuiNavHighlightFlags_TypeThin)\n    {\n        window->DrawList->AddRect(display_rect.Min, display_rect.Max, GetColorU32(ImGuiCol_NavHighlight), rounding, 0, 1.0f);\n    }\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] MAIN CODE (most of the code! lots of stuff, needs tidying up!)\n//-----------------------------------------------------------------------------\n\n// ImGuiWindow is mostly a dumb struct. It merely has a constructor and a few helper methods\nImGuiWindow::ImGuiWindow(ImGuiContext* context, const char* name) : DrawListInst(NULL)\n{\n    memset(this, 0, sizeof(*this));\n    Name = ImStrdup(name);\n    NameBufLen = (int)strlen(name) + 1;\n    ID = ImHashStr(name);\n    IDStack.push_back(ID);\n    MoveId = GetID(\"#MOVE\");\n    ScrollTarget = ImVec2(FLT_MAX, FLT_MAX);\n    ScrollTargetCenterRatio = ImVec2(0.5f, 0.5f);\n    AutoFitFramesX = AutoFitFramesY = -1;\n    AutoPosLastDirection = ImGuiDir_None;\n    SetWindowPosAllowFlags = SetWindowSizeAllowFlags = SetWindowCollapsedAllowFlags = ImGuiCond_Always | ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing;\n    SetWindowPosVal = SetWindowPosPivot = ImVec2(FLT_MAX, FLT_MAX);\n    LastFrameActive = -1;\n    LastTimeActive = -1.0f;\n    FontWindowScale = 1.0f;\n    SettingsOffset = -1;\n    DrawList = &DrawListInst;\n    DrawList->_Data = &context->DrawListSharedData;\n    DrawList->_OwnerName = Name;\n}\n\nImGuiWindow::~ImGuiWindow()\n{\n    IM_ASSERT(DrawList == &DrawListInst);\n    IM_DELETE(Name);\n    ColumnsStorage.clear_destruct();\n}\n\nImGuiID ImGuiWindow::GetID(const char* str, const char* str_end)\n{\n    ImGuiID seed = IDStack.back();\n    ImGuiID id = ImHashStr(str, str_end ? (str_end - str) : 0, seed);\n    ImGui::KeepAliveID(id);\n#ifdef IMGUI_ENABLE_TEST_ENGINE\n    ImGuiContext& g = *GImGui;\n    IMGUI_TEST_ENGINE_ID_INFO2(id, ImGuiDataType_String, str, str_end);\n#endif\n    return id;\n}\n\nImGuiID ImGuiWindow::GetID(const void* ptr)\n{\n    ImGuiID seed = IDStack.back();\n    ImGuiID id = ImHashData(&ptr, sizeof(void*), seed);\n    ImGui::KeepAliveID(id);\n#ifdef IMGUI_ENABLE_TEST_ENGINE\n    ImGuiContext& g = *GImGui;\n    IMGUI_TEST_ENGINE_ID_INFO(id, ImGuiDataType_Pointer, ptr);\n#endif\n    return id;\n}\n\nImGuiID ImGuiWindow::GetID(int n)\n{\n    ImGuiID seed = IDStack.back();\n    ImGuiID id = ImHashData(&n, sizeof(n), seed);\n    ImGui::KeepAliveID(id);\n#ifdef IMGUI_ENABLE_TEST_ENGINE\n    ImGuiContext& g = *GImGui;\n    IMGUI_TEST_ENGINE_ID_INFO(id, ImGuiDataType_S32, (intptr_t)n);\n#endif\n    return id;\n}\n\nImGuiID ImGuiWindow::GetIDNoKeepAlive(const char* str, const char* str_end)\n{\n    ImGuiID seed = IDStack.back();\n    ImGuiID id = ImHashStr(str, str_end ? (str_end - str) : 0, seed);\n#ifdef IMGUI_ENABLE_TEST_ENGINE\n    ImGuiContext& g = *GImGui;\n    IMGUI_TEST_ENGINE_ID_INFO2(id, ImGuiDataType_String, str, str_end);\n#endif\n    return id;\n}\n\nImGuiID ImGuiWindow::GetIDNoKeepAlive(const void* ptr)\n{\n    ImGuiID seed = IDStack.back();\n    ImGuiID id = ImHashData(&ptr, sizeof(void*), seed);\n#ifdef IMGUI_ENABLE_TEST_ENGINE\n    ImGuiContext& g = *GImGui;\n    IMGUI_TEST_ENGINE_ID_INFO(id, ImGuiDataType_Pointer, ptr);\n#endif\n    return id;\n}\n\nImGuiID ImGuiWindow::GetIDNoKeepAlive(int n)\n{\n    ImGuiID seed = IDStack.back();\n    ImGuiID id = ImHashData(&n, sizeof(n), seed);\n#ifdef IMGUI_ENABLE_TEST_ENGINE\n    ImGuiContext& g = *GImGui;\n    IMGUI_TEST_ENGINE_ID_INFO(id, ImGuiDataType_S32, (intptr_t)n);\n#endif\n    return id;\n}\n\n// This is only used in rare/specific situations to manufacture an ID out of nowhere.\nImGuiID ImGuiWindow::GetIDFromRectangle(const ImRect& r_abs)\n{\n    ImGuiID seed = IDStack.back();\n    const int r_rel[4] = { (int)(r_abs.Min.x - Pos.x), (int)(r_abs.Min.y - Pos.y), (int)(r_abs.Max.x - Pos.x), (int)(r_abs.Max.y - Pos.y) };\n    ImGuiID id = ImHashData(&r_rel, sizeof(r_rel), seed);\n    ImGui::KeepAliveID(id);\n    return id;\n}\n\nstatic void SetCurrentWindow(ImGuiWindow* window)\n{\n    ImGuiContext& g = *GImGui;\n    g.CurrentWindow = window;\n    g.CurrentTable = window && window->DC.CurrentTableIdx != -1 ? g.Tables.GetByIndex(window->DC.CurrentTableIdx) : NULL;\n    if (window)\n        g.FontSize = g.DrawListSharedData.FontSize = window->CalcFontSize();\n}\n\nvoid ImGui::GcCompactTransientMiscBuffers()\n{\n    ImGuiContext& g = *GImGui;\n    g.ItemFlagsStack.clear();\n    g.GroupStack.clear();\n    TableGcCompactSettings();\n}\n\n// Free up/compact internal window buffers, we can use this when a window becomes unused.\n// Not freed:\n// - ImGuiWindow, ImGuiWindowSettings, Name, StateStorage, ColumnsStorage (may hold useful data)\n// This should have no noticeable visual effect. When the window reappear however, expect new allocation/buffer growth/copy cost.\nvoid ImGui::GcCompactTransientWindowBuffers(ImGuiWindow* window)\n{\n    window->MemoryCompacted = true;\n    window->MemoryDrawListIdxCapacity = window->DrawList->IdxBuffer.Capacity;\n    window->MemoryDrawListVtxCapacity = window->DrawList->VtxBuffer.Capacity;\n    window->IDStack.clear();\n    window->DrawList->_ClearFreeMemory();\n    window->DC.ChildWindows.clear();\n    window->DC.ItemWidthStack.clear();\n    window->DC.TextWrapPosStack.clear();\n}\n\nvoid ImGui::GcAwakeTransientWindowBuffers(ImGuiWindow* window)\n{\n    // We stored capacity of the ImDrawList buffer to reduce growth-caused allocation/copy when awakening.\n    // The other buffers tends to amortize much faster.\n    window->MemoryCompacted = false;\n    window->DrawList->IdxBuffer.reserve(window->MemoryDrawListIdxCapacity);\n    window->DrawList->VtxBuffer.reserve(window->MemoryDrawListVtxCapacity);\n    window->MemoryDrawListIdxCapacity = window->MemoryDrawListVtxCapacity = 0;\n}\n\nvoid ImGui::SetActiveID(ImGuiID id, ImGuiWindow* window)\n{\n    ImGuiContext& g = *GImGui;\n    g.ActiveIdIsJustActivated = (g.ActiveId != id);\n    if (g.ActiveIdIsJustActivated)\n    {\n        g.ActiveIdTimer = 0.0f;\n        g.ActiveIdHasBeenPressedBefore = false;\n        g.ActiveIdHasBeenEditedBefore = false;\n        g.ActiveIdMouseButton = -1;\n        if (id != 0)\n        {\n            g.LastActiveId = id;\n            g.LastActiveIdTimer = 0.0f;\n        }\n    }\n    g.ActiveId = id;\n    g.ActiveIdAllowOverlap = false;\n    g.ActiveIdNoClearOnFocusLoss = false;\n    g.ActiveIdWindow = window;\n    g.ActiveIdHasBeenEditedThisFrame = false;\n    if (id)\n    {\n        g.ActiveIdIsAlive = id;\n        g.ActiveIdSource = (g.NavActivateId == id || g.NavInputId == id || g.NavJustTabbedId == id || g.NavJustMovedToId == id) ? ImGuiInputSource_Nav : ImGuiInputSource_Mouse;\n    }\n\n    // Clear declaration of inputs claimed by the widget\n    // (Please note that this is WIP and not all keys/inputs are thoroughly declared by all widgets yet)\n    g.ActiveIdUsingMouseWheel = false;\n    g.ActiveIdUsingNavDirMask = 0x00;\n    g.ActiveIdUsingNavInputMask = 0x00;\n    g.ActiveIdUsingKeyInputMask = 0x00;\n}\n\nvoid ImGui::ClearActiveID()\n{\n    SetActiveID(0, NULL); // g.ActiveId = 0;\n}\n\nvoid ImGui::SetHoveredID(ImGuiID id)\n{\n    ImGuiContext& g = *GImGui;\n    g.HoveredId = id;\n    g.HoveredIdAllowOverlap = false;\n    g.HoveredIdUsingMouseWheel = false;\n    if (id != 0 && g.HoveredIdPreviousFrame != id)\n        g.HoveredIdTimer = g.HoveredIdNotActiveTimer = 0.0f;\n}\n\nImGuiID ImGui::GetHoveredID()\n{\n    ImGuiContext& g = *GImGui;\n    return g.HoveredId ? g.HoveredId : g.HoveredIdPreviousFrame;\n}\n\nvoid ImGui::KeepAliveID(ImGuiID id)\n{\n    ImGuiContext& g = *GImGui;\n    if (g.ActiveId == id)\n        g.ActiveIdIsAlive = id;\n    if (g.ActiveIdPreviousFrame == id)\n        g.ActiveIdPreviousFrameIsAlive = true;\n}\n\nvoid ImGui::MarkItemEdited(ImGuiID id)\n{\n    // This marking is solely to be able to provide info for IsItemDeactivatedAfterEdit().\n    // ActiveId might have been released by the time we call this (as in the typical press/release button behavior) but still need need to fill the data.\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(g.ActiveId == id || g.ActiveId == 0 || g.DragDropActive);\n    IM_UNUSED(id); // Avoid unused variable warnings when asserts are compiled out.\n    //IM_ASSERT(g.CurrentWindow->DC.LastItemId == id);\n    g.ActiveIdHasBeenEditedThisFrame = true;\n    g.ActiveIdHasBeenEditedBefore = true;\n    g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_Edited;\n}\n\nstatic inline bool IsWindowContentHoverable(ImGuiWindow* window, ImGuiHoveredFlags flags)\n{\n    // An active popup disable hovering on other windows (apart from its own children)\n    // FIXME-OPT: This could be cached/stored within the window.\n    ImGuiContext& g = *GImGui;\n    if (g.NavWindow)\n        if (ImGuiWindow* focused_root_window = g.NavWindow->RootWindow)\n            if (focused_root_window->WasActive && focused_root_window != window->RootWindow)\n            {\n                // For the purpose of those flags we differentiate \"standard popup\" from \"modal popup\"\n                // NB: The order of those two tests is important because Modal windows are also Popups.\n                if (focused_root_window->Flags & ImGuiWindowFlags_Modal)\n                    return false;\n                if ((focused_root_window->Flags & ImGuiWindowFlags_Popup) && !(flags & ImGuiHoveredFlags_AllowWhenBlockedByPopup))\n                    return false;\n            }\n    return true;\n}\n\n// This is roughly matching the behavior of internal-facing ItemHoverable()\n// - we allow hovering to be true when ActiveId==window->MoveID, so that clicking on non-interactive items such as a Text() item still returns true with IsItemHovered()\n// - this should work even for non-interactive items that have no ID, so we cannot use LastItemId\nbool ImGui::IsItemHovered(ImGuiHoveredFlags flags)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    if (g.NavDisableMouseHover && !g.NavDisableHighlight)\n    {\n        if ((g.LastItemData.InFlags & ImGuiItemFlags_Disabled) && !(flags & ImGuiHoveredFlags_AllowWhenDisabled))\n            return false;\n        return IsItemFocused();\n    }\n\n    // Test for bounding box overlap, as updated as ItemAdd()\n    ImGuiItemStatusFlags status_flags = g.LastItemData.StatusFlags;\n    if (!(status_flags & ImGuiItemStatusFlags_HoveredRect))\n        return false;\n    IM_ASSERT((flags & (ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows)) == 0);   // Flags not supported by this function\n\n    // Test if we are hovering the right window (our window could be behind another window)\n    // [2021/03/02] Reworked / reverted the revert, finally. Note we want e.g. BeginGroup/ItemAdd/EndGroup to work as well. (#3851)\n    // [2017/10/16] Reverted commit 344d48be3 and testing RootWindow instead. I believe it is correct to NOT test for RootWindow but this leaves us unable\n    // to use IsItemHovered() after EndChild() itself. Until a solution is found I believe reverting to the test from 2017/09/27 is safe since this was\n    // the test that has been running for a long while.\n    if (g.HoveredWindow != window && (status_flags & ImGuiItemStatusFlags_HoveredWindow) == 0)\n        if ((flags & ImGuiHoveredFlags_AllowWhenOverlapped) == 0)\n            return false;\n\n    // Test if another item is active (e.g. being dragged)\n    if ((flags & ImGuiHoveredFlags_AllowWhenBlockedByActiveItem) == 0)\n        if (g.ActiveId != 0 && g.ActiveId != g.LastItemData.ID && !g.ActiveIdAllowOverlap && g.ActiveId != window->MoveId)\n            return false;\n\n    // Test if interactions on this window are blocked by an active popup or modal.\n    // The ImGuiHoveredFlags_AllowWhenBlockedByPopup flag will be tested here.\n    if (!IsWindowContentHoverable(window, flags))\n        return false;\n\n    // Test if the item is disabled\n    if ((g.LastItemData.InFlags & ImGuiItemFlags_Disabled) && !(flags & ImGuiHoveredFlags_AllowWhenDisabled))\n        return false;\n\n    // Special handling for calling after Begin() which represent the title bar or tab.\n    // When the window is collapsed (SkipItems==true) that last item will never be overwritten so we need to detect the case.\n    if (g.LastItemData.ID == window->MoveId && window->WriteAccessed)\n        return false;\n    return true;\n}\n\n// Internal facing ItemHoverable() used when submitting widgets. Differs slightly from IsItemHovered().\nbool ImGui::ItemHoverable(const ImRect& bb, ImGuiID id)\n{\n    ImGuiContext& g = *GImGui;\n    if (g.HoveredId != 0 && g.HoveredId != id && !g.HoveredIdAllowOverlap)\n        return false;\n\n    ImGuiWindow* window = g.CurrentWindow;\n    if (g.HoveredWindow != window)\n        return false;\n    if (g.ActiveId != 0 && g.ActiveId != id && !g.ActiveIdAllowOverlap)\n        return false;\n    if (!IsMouseHoveringRect(bb.Min, bb.Max))\n        return false;\n    if (g.NavDisableMouseHover)\n        return false;\n    if (!IsWindowContentHoverable(window, ImGuiHoveredFlags_None))\n    {\n        g.HoveredIdDisabled = true;\n        return false;\n    }\n\n    // We exceptionally allow this function to be called with id==0 to allow using it for easy high-level\n    // hover test in widgets code. We could also decide to split this function is two.\n    if (id != 0)\n        SetHoveredID(id);\n\n    // When disabled we'll return false but still set HoveredId\n    ImGuiItemFlags item_flags = (g.LastItemData.ID == id ? g.LastItemData.InFlags : g.CurrentItemFlags);\n    if (item_flags & ImGuiItemFlags_Disabled)\n    {\n        // Release active id if turning disabled\n        if (g.ActiveId == id)\n            ClearActiveID();\n        g.HoveredIdDisabled = true;\n        return false;\n    }\n\n    if (id != 0)\n    {\n        // [DEBUG] Item Picker tool!\n        // We perform the check here because SetHoveredID() is not frequently called (1~ time a frame), making\n        // the cost of this tool near-zero. We can get slightly better call-stack and support picking non-hovered\n        // items if we perform the test in ItemAdd(), but that would incur a small runtime cost.\n        // #define IMGUI_DEBUG_TOOL_ITEM_PICKER_EX in imconfig.h if you want this check to also be performed in ItemAdd().\n        if (g.DebugItemPickerActive && g.HoveredIdPreviousFrame == id)\n            GetForegroundDrawList()->AddRect(bb.Min, bb.Max, IM_COL32(255, 255, 0, 255));\n        if (g.DebugItemPickerBreakId == id)\n            IM_DEBUG_BREAK();\n    }\n\n    return true;\n}\n\nbool ImGui::IsClippedEx(const ImRect& bb, ImGuiID id, bool clip_even_when_logged)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    if (!bb.Overlaps(window->ClipRect))\n        if (id == 0 || (id != g.ActiveId && id != g.NavId))\n            if (clip_even_when_logged || !g.LogEnabled)\n                return true;\n    return false;\n}\n\n// Called by ItemAdd()\n// Process TAB/Shift+TAB. Be mindful that this function may _clear_ the ActiveID when tabbing out.\nvoid ImGui::ItemFocusable(ImGuiWindow* window, ImGuiID id)\n{\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(id != 0 && id == g.LastItemData.ID);\n\n    // Increment counters\n    // FIXME: ImGuiItemFlags_Disabled should disable more.\n    const bool is_tab_stop = (g.LastItemData.InFlags & (ImGuiItemFlags_NoTabStop | ImGuiItemFlags_Disabled)) == 0;\n    window->DC.FocusCounterRegular++;\n    if (is_tab_stop)\n    {\n        window->DC.FocusCounterTabStop++;\n        if (g.NavId == id)\n            g.NavIdTabCounter = window->DC.FocusCounterTabStop;\n    }\n\n    // Process TAB/Shift-TAB to tab *OUT* of the currently focused item.\n    // (Note that we can always TAB out of a widget that doesn't allow tabbing in)\n    if (g.ActiveId == id && g.TabFocusPressed && !IsActiveIdUsingKey(ImGuiKey_Tab) && g.TabFocusRequestNextWindow == NULL)\n    {\n        g.TabFocusRequestNextWindow = window;\n        g.TabFocusRequestNextCounterTabStop = window->DC.FocusCounterTabStop + (g.IO.KeyShift ? (is_tab_stop ? -1 : 0) : +1); // Modulo on index will be applied at the end of frame once we've got the total counter of items.\n    }\n\n    // Handle focus requests\n    if (g.TabFocusRequestCurrWindow == window)\n    {\n        if (window->DC.FocusCounterRegular == g.TabFocusRequestCurrCounterRegular)\n        {\n            g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_FocusedByCode;\n            return;\n        }\n        if (is_tab_stop && window->DC.FocusCounterTabStop == g.TabFocusRequestCurrCounterTabStop)\n        {\n            g.NavJustTabbedId = id;\n            g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_FocusedByTabbing;\n            return;\n        }\n\n        // If another item is about to be focused, we clear our own active id\n        if (g.ActiveId == id)\n            ClearActiveID();\n    }\n}\n\nfloat ImGui::CalcWrapWidthForPos(const ImVec2& pos, float wrap_pos_x)\n{\n    if (wrap_pos_x < 0.0f)\n        return 0.0f;\n\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    if (wrap_pos_x == 0.0f)\n    {\n        // We could decide to setup a default wrapping max point for auto-resizing windows,\n        // or have auto-wrap (with unspecified wrapping pos) behave as a ContentSize extending function?\n        //if (window->Hidden && (window->Flags & ImGuiWindowFlags_AlwaysAutoResize))\n        //    wrap_pos_x = ImMax(window->WorkRect.Min.x + g.FontSize * 10.0f, window->WorkRect.Max.x);\n        //else\n        wrap_pos_x = window->WorkRect.Max.x;\n    }\n    else if (wrap_pos_x > 0.0f)\n    {\n        wrap_pos_x += window->Pos.x - window->Scroll.x; // wrap_pos_x is provided is window local space\n    }\n\n    return ImMax(wrap_pos_x - pos.x, 1.0f);\n}\n\n// IM_ALLOC() == ImGui::MemAlloc()\nvoid* ImGui::MemAlloc(size_t size)\n{\n    if (ImGuiContext* ctx = GImGui)\n        ctx->IO.MetricsActiveAllocations++;\n    return (*GImAllocatorAllocFunc)(size, GImAllocatorUserData);\n}\n\n// IM_FREE() == ImGui::MemFree()\nvoid ImGui::MemFree(void* ptr)\n{\n    if (ptr)\n        if (ImGuiContext* ctx = GImGui)\n            ctx->IO.MetricsActiveAllocations--;\n    return (*GImAllocatorFreeFunc)(ptr, GImAllocatorUserData);\n}\n\nconst char* ImGui::GetClipboardText()\n{\n    ImGuiContext& g = *GImGui;\n    return g.IO.GetClipboardTextFn ? g.IO.GetClipboardTextFn(g.IO.ClipboardUserData) : \"\";\n}\n\nvoid ImGui::SetClipboardText(const char* text)\n{\n    ImGuiContext& g = *GImGui;\n    if (g.IO.SetClipboardTextFn)\n        g.IO.SetClipboardTextFn(g.IO.ClipboardUserData, text);\n}\n\nconst char* ImGui::GetVersion()\n{\n    return IMGUI_VERSION;\n}\n\n// Internal state access - if you want to share Dear ImGui state between modules (e.g. DLL) or allocate it yourself\n// Note that we still point to some static data and members (such as GFontAtlas), so the state instance you end up using will point to the static data within its module\nImGuiContext* ImGui::GetCurrentContext()\n{\n    return GImGui;\n}\n\nvoid ImGui::SetCurrentContext(ImGuiContext* ctx)\n{\n#ifdef IMGUI_SET_CURRENT_CONTEXT_FUNC\n    IMGUI_SET_CURRENT_CONTEXT_FUNC(ctx); // For custom thread-based hackery you may want to have control over this.\n#else\n    GImGui = ctx;\n#endif\n}\n\nvoid ImGui::SetAllocatorFunctions(ImGuiMemAllocFunc alloc_func, ImGuiMemFreeFunc free_func, void* user_data)\n{\n    GImAllocatorAllocFunc = alloc_func;\n    GImAllocatorFreeFunc = free_func;\n    GImAllocatorUserData = user_data;\n}\n\n// This is provided to facilitate copying allocators from one static/DLL boundary to another (e.g. retrieve default allocator of your executable address space)\nvoid ImGui::GetAllocatorFunctions(ImGuiMemAllocFunc* p_alloc_func, ImGuiMemFreeFunc* p_free_func, void** p_user_data)\n{\n    *p_alloc_func = GImAllocatorAllocFunc;\n    *p_free_func = GImAllocatorFreeFunc;\n    *p_user_data = GImAllocatorUserData;\n}\n\nImGuiContext* ImGui::CreateContext(ImFontAtlas* shared_font_atlas)\n{\n    ImGuiContext* ctx = IM_NEW(ImGuiContext)(shared_font_atlas);\n    if (GImGui == NULL)\n        SetCurrentContext(ctx);\n    Initialize(ctx);\n    return ctx;\n}\n\nvoid ImGui::DestroyContext(ImGuiContext* ctx)\n{\n    if (ctx == NULL)\n        ctx = GImGui;\n    Shutdown(ctx);\n    if (GImGui == ctx)\n        SetCurrentContext(NULL);\n    IM_DELETE(ctx);\n}\n\n// No specific ordering/dependency support, will see as needed\nImGuiID ImGui::AddContextHook(ImGuiContext* ctx, const ImGuiContextHook* hook)\n{\n    ImGuiContext& g = *ctx;\n    IM_ASSERT(hook->Callback != NULL && hook->HookId == 0 && hook->Type != ImGuiContextHookType_PendingRemoval_);\n    g.Hooks.push_back(*hook);\n    g.Hooks.back().HookId = ++g.HookIdNext;\n    return g.HookIdNext;\n}\n\n// Deferred removal, avoiding issue with changing vector while iterating it\nvoid ImGui::RemoveContextHook(ImGuiContext* ctx, ImGuiID hook_id)\n{\n    ImGuiContext& g = *ctx;\n    IM_ASSERT(hook_id != 0);\n    for (int n = 0; n < g.Hooks.Size; n++)\n        if (g.Hooks[n].HookId == hook_id)\n            g.Hooks[n].Type = ImGuiContextHookType_PendingRemoval_;\n}\n\n// Call context hooks (used by e.g. test engine)\n// We assume a small number of hooks so all stored in same array\nvoid ImGui::CallContextHooks(ImGuiContext* ctx, ImGuiContextHookType hook_type)\n{\n    ImGuiContext& g = *ctx;\n    for (int n = 0; n < g.Hooks.Size; n++)\n        if (g.Hooks[n].Type == hook_type)\n            g.Hooks[n].Callback(&g, &g.Hooks[n]);\n}\n\nImGuiIO& ImGui::GetIO()\n{\n    IM_ASSERT(GImGui != NULL && \"No current context. Did you call ImGui::CreateContext() and ImGui::SetCurrentContext() ?\");\n    return GImGui->IO;\n}\n\n// Pass this to your backend rendering function! Valid after Render() and until the next call to NewFrame()\nImDrawData* ImGui::GetDrawData()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiViewportP* viewport = g.Viewports[0];\n    return viewport->DrawDataP.Valid ? &viewport->DrawDataP : NULL;\n}\n\ndouble ImGui::GetTime()\n{\n    return GImGui->Time;\n}\n\nint ImGui::GetFrameCount()\n{\n    return GImGui->FrameCount;\n}\n\nstatic ImDrawList* GetViewportDrawList(ImGuiViewportP* viewport, size_t drawlist_no, const char* drawlist_name)\n{\n    // Create the draw list on demand, because they are not frequently used for all viewports\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(drawlist_no < IM_ARRAYSIZE(viewport->DrawLists));\n    ImDrawList* draw_list = viewport->DrawLists[drawlist_no];\n    if (draw_list == NULL)\n    {\n        draw_list = IM_NEW(ImDrawList)(&g.DrawListSharedData);\n        draw_list->_OwnerName = drawlist_name;\n        viewport->DrawLists[drawlist_no] = draw_list;\n    }\n\n    // Our ImDrawList system requires that there is always a command\n    if (viewport->DrawListsLastFrame[drawlist_no] != g.FrameCount)\n    {\n        draw_list->_ResetForNewFrame();\n        draw_list->PushTextureID(g.IO.Fonts->TexID);\n        draw_list->PushClipRect(viewport->Pos, viewport->Pos + viewport->Size, false);\n        viewport->DrawListsLastFrame[drawlist_no] = g.FrameCount;\n    }\n    return draw_list;\n}\n\nImDrawList* ImGui::GetBackgroundDrawList(ImGuiViewport* viewport)\n{\n    return GetViewportDrawList((ImGuiViewportP*)viewport, 0, \"##Background\");\n}\n\nImDrawList* ImGui::GetBackgroundDrawList()\n{\n    ImGuiContext& g = *GImGui;\n    return GetBackgroundDrawList(g.Viewports[0]);\n}\n\nImDrawList* ImGui::GetForegroundDrawList(ImGuiViewport* viewport)\n{\n    return GetViewportDrawList((ImGuiViewportP*)viewport, 1, \"##Foreground\");\n}\n\nImDrawList* ImGui::GetForegroundDrawList()\n{\n    ImGuiContext& g = *GImGui;\n    return GetForegroundDrawList(g.Viewports[0]);\n}\n\nImDrawListSharedData* ImGui::GetDrawListSharedData()\n{\n    return &GImGui->DrawListSharedData;\n}\n\nvoid ImGui::StartMouseMovingWindow(ImGuiWindow* window)\n{\n    // Set ActiveId even if the _NoMove flag is set. Without it, dragging away from a window with _NoMove would activate hover on other windows.\n    // We _also_ call this when clicking in a window empty space when io.ConfigWindowsMoveFromTitleBarOnly is set, but clear g.MovingWindow afterward.\n    // This is because we want ActiveId to be set even when the window is not permitted to move.\n    ImGuiContext& g = *GImGui;\n    FocusWindow(window);\n    SetActiveID(window->MoveId, window);\n    g.NavDisableHighlight = true;\n    g.ActiveIdClickOffset = g.IO.MouseClickedPos[0] - window->RootWindow->Pos;\n    g.ActiveIdNoClearOnFocusLoss = true;\n    SetActiveIdUsingNavAndKeys();\n\n    bool can_move_window = true;\n    if ((window->Flags & ImGuiWindowFlags_NoMove) || (window->RootWindow->Flags & ImGuiWindowFlags_NoMove))\n        can_move_window = false;\n    if (can_move_window)\n        g.MovingWindow = window;\n}\n\n// Handle mouse moving window\n// Note: moving window with the navigation keys (Square + d-pad / CTRL+TAB + Arrows) are processed in NavUpdateWindowing()\n// FIXME: We don't have strong guarantee that g.MovingWindow stay synched with g.ActiveId == g.MovingWindow->MoveId.\n// This is currently enforced by the fact that BeginDragDropSource() is setting all g.ActiveIdUsingXXXX flags to inhibit navigation inputs,\n// but if we should more thoroughly test cases where g.ActiveId or g.MovingWindow gets changed and not the other.\nvoid ImGui::UpdateMouseMovingWindowNewFrame()\n{\n    ImGuiContext& g = *GImGui;\n    if (g.MovingWindow != NULL)\n    {\n        // We actually want to move the root window. g.MovingWindow == window we clicked on (could be a child window).\n        // We track it to preserve Focus and so that generally ActiveIdWindow == MovingWindow and ActiveId == MovingWindow->MoveId for consistency.\n        KeepAliveID(g.ActiveId);\n        IM_ASSERT(g.MovingWindow && g.MovingWindow->RootWindow);\n        ImGuiWindow* moving_window = g.MovingWindow->RootWindow;\n        if (g.IO.MouseDown[0] && IsMousePosValid(&g.IO.MousePos))\n        {\n            ImVec2 pos = g.IO.MousePos - g.ActiveIdClickOffset;\n            if (moving_window->Pos.x != pos.x || moving_window->Pos.y != pos.y)\n            {\n                MarkIniSettingsDirty(moving_window);\n                SetWindowPos(moving_window, pos, ImGuiCond_Always);\n            }\n            FocusWindow(g.MovingWindow);\n        }\n        else\n        {\n            g.MovingWindow = NULL;\n            ClearActiveID();\n        }\n    }\n    else\n    {\n        // When clicking/dragging from a window that has the _NoMove flag, we still set the ActiveId in order to prevent hovering others.\n        if (g.ActiveIdWindow && g.ActiveIdWindow->MoveId == g.ActiveId)\n        {\n            KeepAliveID(g.ActiveId);\n            if (!g.IO.MouseDown[0])\n                ClearActiveID();\n        }\n    }\n}\n\n// Initiate moving window when clicking on empty space or title bar.\n// Handle left-click and right-click focus.\nvoid ImGui::UpdateMouseMovingWindowEndFrame()\n{\n    ImGuiContext& g = *GImGui;\n    if (g.ActiveId != 0 || g.HoveredId != 0)\n        return;\n\n    // Unless we just made a window/popup appear\n    if (g.NavWindow && g.NavWindow->Appearing)\n        return;\n\n    // Click on empty space to focus window and start moving\n    // (after we're done with all our widgets)\n    if (g.IO.MouseClicked[0])\n    {\n        // Handle the edge case of a popup being closed while clicking in its empty space.\n        // If we try to focus it, FocusWindow() > ClosePopupsOverWindow() will accidentally close any parent popups because they are not linked together any more.\n        ImGuiWindow* root_window = g.HoveredWindow ? g.HoveredWindow->RootWindow : NULL;\n        const bool is_closed_popup = root_window && (root_window->Flags & ImGuiWindowFlags_Popup) && !IsPopupOpen(root_window->PopupId, ImGuiPopupFlags_AnyPopupLevel);\n\n        if (root_window != NULL && !is_closed_popup)\n        {\n            StartMouseMovingWindow(g.HoveredWindow); //-V595\n\n            // Cancel moving if clicked outside of title bar\n            if (g.IO.ConfigWindowsMoveFromTitleBarOnly && !(root_window->Flags & ImGuiWindowFlags_NoTitleBar))\n                if (!root_window->TitleBarRect().Contains(g.IO.MouseClickedPos[0]))\n                    g.MovingWindow = NULL;\n\n            // Cancel moving if clicked over an item which was disabled or inhibited by popups (note that we know HoveredId == 0 already)\n            if (g.HoveredIdDisabled)\n                g.MovingWindow = NULL;\n        }\n        else if (root_window == NULL && g.NavWindow != NULL && GetTopMostPopupModal() == NULL)\n        {\n            // Clicking on void disable focus\n            FocusWindow(NULL);\n        }\n    }\n\n    // With right mouse button we close popups without changing focus based on where the mouse is aimed\n    // Instead, focus will be restored to the window under the bottom-most closed popup.\n    // (The left mouse button path calls FocusWindow on the hovered window, which will lead NewFrame->ClosePopupsOverWindow to trigger)\n    if (g.IO.MouseClicked[1])\n    {\n        // Find the top-most window between HoveredWindow and the top-most Modal Window.\n        // This is where we can trim the popup stack.\n        ImGuiWindow* modal = GetTopMostPopupModal();\n        bool hovered_window_above_modal = g.HoveredWindow && IsWindowAbove(g.HoveredWindow, modal);\n        ClosePopupsOverWindow(hovered_window_above_modal ? g.HoveredWindow : modal, true);\n    }\n}\n\nstatic bool IsWindowActiveAndVisible(ImGuiWindow* window)\n{\n    return (window->Active) && (!window->Hidden);\n}\n\nstatic void ImGui::UpdateMouseInputs()\n{\n    ImGuiContext& g = *GImGui;\n\n    // Round mouse position to avoid spreading non-rounded position (e.g. UpdateManualResize doesn't support them well)\n    if (IsMousePosValid(&g.IO.MousePos))\n        g.IO.MousePos = g.LastValidMousePos = ImFloor(g.IO.MousePos);\n\n    // If mouse just appeared or disappeared (usually denoted by -FLT_MAX components) we cancel out movement in MouseDelta\n    if (IsMousePosValid(&g.IO.MousePos) && IsMousePosValid(&g.IO.MousePosPrev))\n        g.IO.MouseDelta = g.IO.MousePos - g.IO.MousePosPrev;\n    else\n        g.IO.MouseDelta = ImVec2(0.0f, 0.0f);\n    if (g.IO.MouseDelta.x != 0.0f || g.IO.MouseDelta.y != 0.0f)\n        g.NavDisableMouseHover = false;\n\n    g.IO.MousePosPrev = g.IO.MousePos;\n    for (int i = 0; i < IM_ARRAYSIZE(g.IO.MouseDown); i++)\n    {\n        g.IO.MouseClicked[i] = g.IO.MouseDown[i] && g.IO.MouseDownDuration[i] < 0.0f;\n        g.IO.MouseReleased[i] = !g.IO.MouseDown[i] && g.IO.MouseDownDuration[i] >= 0.0f;\n        g.IO.MouseDownDurationPrev[i] = g.IO.MouseDownDuration[i];\n        g.IO.MouseDownDuration[i] = g.IO.MouseDown[i] ? (g.IO.MouseDownDuration[i] < 0.0f ? 0.0f : g.IO.MouseDownDuration[i] + g.IO.DeltaTime) : -1.0f;\n        g.IO.MouseDoubleClicked[i] = false;\n        if (g.IO.MouseClicked[i])\n        {\n            if ((float)(g.Time - g.IO.MouseClickedTime[i]) < g.IO.MouseDoubleClickTime)\n            {\n                ImVec2 delta_from_click_pos = IsMousePosValid(&g.IO.MousePos) ? (g.IO.MousePos - g.IO.MouseClickedPos[i]) : ImVec2(0.0f, 0.0f);\n                if (ImLengthSqr(delta_from_click_pos) < g.IO.MouseDoubleClickMaxDist * g.IO.MouseDoubleClickMaxDist)\n                    g.IO.MouseDoubleClicked[i] = true;\n                g.IO.MouseClickedTime[i] = -g.IO.MouseDoubleClickTime * 2.0f; // Mark as \"old enough\" so the third click isn't turned into a double-click\n            }\n            else\n            {\n                g.IO.MouseClickedTime[i] = g.Time;\n            }\n            g.IO.MouseClickedPos[i] = g.IO.MousePos;\n            g.IO.MouseDownWasDoubleClick[i] = g.IO.MouseDoubleClicked[i];\n            g.IO.MouseDragMaxDistanceAbs[i] = ImVec2(0.0f, 0.0f);\n            g.IO.MouseDragMaxDistanceSqr[i] = 0.0f;\n        }\n        else if (g.IO.MouseDown[i])\n        {\n            // Maintain the maximum distance we reaching from the initial click position, which is used with dragging threshold\n            ImVec2 delta_from_click_pos = IsMousePosValid(&g.IO.MousePos) ? (g.IO.MousePos - g.IO.MouseClickedPos[i]) : ImVec2(0.0f, 0.0f);\n            g.IO.MouseDragMaxDistanceSqr[i] = ImMax(g.IO.MouseDragMaxDistanceSqr[i], ImLengthSqr(delta_from_click_pos));\n            g.IO.MouseDragMaxDistanceAbs[i].x = ImMax(g.IO.MouseDragMaxDistanceAbs[i].x, delta_from_click_pos.x < 0.0f ? -delta_from_click_pos.x : delta_from_click_pos.x);\n            g.IO.MouseDragMaxDistanceAbs[i].y = ImMax(g.IO.MouseDragMaxDistanceAbs[i].y, delta_from_click_pos.y < 0.0f ? -delta_from_click_pos.y : delta_from_click_pos.y);\n        }\n        if (!g.IO.MouseDown[i] && !g.IO.MouseReleased[i])\n            g.IO.MouseDownWasDoubleClick[i] = false;\n        if (g.IO.MouseClicked[i]) // Clicking any mouse button reactivate mouse hovering which may have been deactivated by gamepad/keyboard navigation\n            g.NavDisableMouseHover = false;\n    }\n}\n\nstatic void StartLockWheelingWindow(ImGuiWindow* window)\n{\n    ImGuiContext& g = *GImGui;\n    if (g.WheelingWindow == window)\n        return;\n    g.WheelingWindow = window;\n    g.WheelingWindowRefMousePos = g.IO.MousePos;\n    g.WheelingWindowTimer = WINDOWS_MOUSE_WHEEL_SCROLL_LOCK_TIMER;\n}\n\nvoid ImGui::UpdateMouseWheel()\n{\n    ImGuiContext& g = *GImGui;\n\n    // Reset the locked window if we move the mouse or after the timer elapses\n    if (g.WheelingWindow != NULL)\n    {\n        g.WheelingWindowTimer -= g.IO.DeltaTime;\n        if (IsMousePosValid() && ImLengthSqr(g.IO.MousePos - g.WheelingWindowRefMousePos) > g.IO.MouseDragThreshold * g.IO.MouseDragThreshold)\n            g.WheelingWindowTimer = 0.0f;\n        if (g.WheelingWindowTimer <= 0.0f)\n        {\n            g.WheelingWindow = NULL;\n            g.WheelingWindowTimer = 0.0f;\n        }\n    }\n\n    if (g.IO.MouseWheel == 0.0f && g.IO.MouseWheelH == 0.0f)\n        return;\n\n    if ((g.ActiveId != 0 && g.ActiveIdUsingMouseWheel) || (g.HoveredIdPreviousFrame != 0 && g.HoveredIdPreviousFrameUsingMouseWheel))\n        return;\n\n    ImGuiWindow* window = g.WheelingWindow ? g.WheelingWindow : g.HoveredWindow;\n    if (!window || window->Collapsed)\n        return;\n\n    // Zoom / Scale window\n    // FIXME-OBSOLETE: This is an old feature, it still works but pretty much nobody is using it and may be best redesigned.\n    if (g.IO.MouseWheel != 0.0f && g.IO.KeyCtrl && g.IO.FontAllowUserScaling)\n    {\n        StartLockWheelingWindow(window);\n        const float new_font_scale = ImClamp(window->FontWindowScale + g.IO.MouseWheel * 0.10f, 0.50f, 2.50f);\n        const float scale = new_font_scale / window->FontWindowScale;\n        window->FontWindowScale = new_font_scale;\n        if (window == window->RootWindow)\n        {\n            const ImVec2 offset = window->Size * (1.0f - scale) * (g.IO.MousePos - window->Pos) / window->Size;\n            SetWindowPos(window, window->Pos + offset, 0);\n            window->Size = ImFloor(window->Size * scale);\n            window->SizeFull = ImFloor(window->SizeFull * scale);\n        }\n        return;\n    }\n\n    // Mouse wheel scrolling\n    // If a child window has the ImGuiWindowFlags_NoScrollWithMouse flag, we give a chance to scroll its parent\n    if (g.IO.KeyCtrl)\n        return;\n\n    // As a standard behavior holding SHIFT while using Vertical Mouse Wheel triggers Horizontal scroll instead\n    // (we avoid doing it on OSX as it the OS input layer handles this already)\n    const bool swap_axis = g.IO.KeyShift && !g.IO.ConfigMacOSXBehaviors;\n    const float wheel_y = swap_axis ? 0.0f : g.IO.MouseWheel;\n    const float wheel_x = swap_axis ? g.IO.MouseWheel : g.IO.MouseWheelH;\n\n    // Vertical Mouse Wheel scrolling\n    if (wheel_y != 0.0f)\n    {\n        StartLockWheelingWindow(window);\n        while ((window->Flags & ImGuiWindowFlags_ChildWindow) && ((window->ScrollMax.y == 0.0f) || ((window->Flags & ImGuiWindowFlags_NoScrollWithMouse) && !(window->Flags & ImGuiWindowFlags_NoMouseInputs))))\n            window = window->ParentWindow;\n        if (!(window->Flags & ImGuiWindowFlags_NoScrollWithMouse) && !(window->Flags & ImGuiWindowFlags_NoMouseInputs))\n        {\n            float max_step = window->InnerRect.GetHeight() * 0.67f;\n            float scroll_step = ImFloor(ImMin(5 * window->CalcFontSize(), max_step));\n            SetScrollY(window, window->Scroll.y - wheel_y * scroll_step);\n        }\n    }\n\n    // Horizontal Mouse Wheel scrolling, or Vertical Mouse Wheel w/ Shift held\n    if (wheel_x != 0.0f)\n    {\n        StartLockWheelingWindow(window);\n        while ((window->Flags & ImGuiWindowFlags_ChildWindow) && ((window->ScrollMax.x == 0.0f) || ((window->Flags & ImGuiWindowFlags_NoScrollWithMouse) && !(window->Flags & ImGuiWindowFlags_NoMouseInputs))))\n            window = window->ParentWindow;\n        if (!(window->Flags & ImGuiWindowFlags_NoScrollWithMouse) && !(window->Flags & ImGuiWindowFlags_NoMouseInputs))\n        {\n            float max_step = window->InnerRect.GetWidth() * 0.67f;\n            float scroll_step = ImFloor(ImMin(2 * window->CalcFontSize(), max_step));\n            SetScrollX(window, window->Scroll.x - wheel_x * scroll_step);\n        }\n    }\n}\n\nvoid ImGui::UpdateTabFocus()\n{\n    ImGuiContext& g = *GImGui;\n\n    // Pressing TAB activate widget focus\n    g.TabFocusPressed = (g.NavWindow && g.NavWindow->Active && !(g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs) && !g.IO.KeyCtrl && IsKeyPressedMap(ImGuiKey_Tab));\n    if (g.ActiveId == 0 && g.TabFocusPressed)\n    {\n        // - This path is only taken when no widget are active/tabbed-into yet.\n        //   Subsequent tabbing will be processed by FocusableItemRegister()\n        // - Note that SetKeyboardFocusHere() sets the Next fields mid-frame. To be consistent we also\n        //   manipulate the Next fields here even though they will be turned into Curr fields below.\n        g.TabFocusRequestNextWindow = g.NavWindow;\n        g.TabFocusRequestNextCounterRegular = INT_MAX;\n        if (g.NavId != 0 && g.NavIdTabCounter != INT_MAX)\n            g.TabFocusRequestNextCounterTabStop = g.NavIdTabCounter + (g.IO.KeyShift ? -1 : 0);\n        else\n            g.TabFocusRequestNextCounterTabStop = g.IO.KeyShift ? -1 : 0;\n    }\n\n    // Turn queued focus request into current one\n    g.TabFocusRequestCurrWindow = NULL;\n    g.TabFocusRequestCurrCounterRegular = g.TabFocusRequestCurrCounterTabStop = INT_MAX;\n    if (g.TabFocusRequestNextWindow != NULL)\n    {\n        ImGuiWindow* window = g.TabFocusRequestNextWindow;\n        g.TabFocusRequestCurrWindow = window;\n        if (g.TabFocusRequestNextCounterRegular != INT_MAX && window->DC.FocusCounterRegular != -1)\n            g.TabFocusRequestCurrCounterRegular = ImModPositive(g.TabFocusRequestNextCounterRegular, window->DC.FocusCounterRegular + 1);\n        if (g.TabFocusRequestNextCounterTabStop != INT_MAX && window->DC.FocusCounterTabStop != -1)\n            g.TabFocusRequestCurrCounterTabStop = ImModPositive(g.TabFocusRequestNextCounterTabStop, window->DC.FocusCounterTabStop + 1);\n        g.TabFocusRequestNextWindow = NULL;\n        g.TabFocusRequestNextCounterRegular = g.TabFocusRequestNextCounterTabStop = INT_MAX;\n    }\n\n    g.NavIdTabCounter = INT_MAX;\n}\n\n// The reason this is exposed in imgui_internal.h is: on touch-based system that don't have hovering, we want to dispatch inputs to the right target (imgui vs imgui+app)\nvoid ImGui::UpdateHoveredWindowAndCaptureFlags()\n{\n    ImGuiContext& g = *GImGui;\n    g.WindowsHoverPadding = ImMax(g.Style.TouchExtraPadding, ImVec2(WINDOWS_HOVER_PADDING, WINDOWS_HOVER_PADDING));\n\n    // Find the window hovered by mouse:\n    // - Child windows can extend beyond the limit of their parent so we need to derive HoveredRootWindow from HoveredWindow.\n    // - When moving a window we can skip the search, which also conveniently bypasses the fact that window->WindowRectClipped is lagging as this point of the frame.\n    // - We also support the moved window toggling the NoInputs flag after moving has started in order to be able to detect windows below it, which is useful for e.g. docking mechanisms.\n    bool clear_hovered_windows = false;\n    FindHoveredWindow();\n\n    // Modal windows prevents mouse from hovering behind them.\n    ImGuiWindow* modal_window = GetTopMostPopupModal();\n    if (modal_window && g.HoveredWindow && !IsWindowChildOf(g.HoveredWindow->RootWindow, modal_window))\n        clear_hovered_windows = true;\n\n    // Disabled mouse?\n    if (g.IO.ConfigFlags & ImGuiConfigFlags_NoMouse)\n        clear_hovered_windows = true;\n\n    // We track click ownership. When clicked outside of a window the click is owned by the application and won't report hovering nor request capture even while dragging over our windows afterward.\n    int mouse_earliest_button_down = -1;\n    bool mouse_any_down = false;\n    for (int i = 0; i < IM_ARRAYSIZE(g.IO.MouseDown); i++)\n    {\n        if (g.IO.MouseClicked[i])\n            g.IO.MouseDownOwned[i] = (g.HoveredWindow != NULL) || (g.OpenPopupStack.Size > 0);\n        mouse_any_down |= g.IO.MouseDown[i];\n        if (g.IO.MouseDown[i])\n            if (mouse_earliest_button_down == -1 || g.IO.MouseClickedTime[i] < g.IO.MouseClickedTime[mouse_earliest_button_down])\n                mouse_earliest_button_down = i;\n    }\n    const bool mouse_avail_to_imgui = (mouse_earliest_button_down == -1) || g.IO.MouseDownOwned[mouse_earliest_button_down];\n\n    // If mouse was first clicked outside of ImGui bounds we also cancel out hovering.\n    // FIXME: For patterns of drag and drop across OS windows, we may need to rework/remove this test (first committed 311c0ca9 on 2015/02)\n    const bool mouse_dragging_extern_payload = g.DragDropActive && (g.DragDropSourceFlags & ImGuiDragDropFlags_SourceExtern) != 0;\n    if (!mouse_avail_to_imgui && !mouse_dragging_extern_payload)\n        clear_hovered_windows = true;\n\n    if (clear_hovered_windows)\n        g.HoveredWindow = g.HoveredWindowUnderMovingWindow = NULL;\n\n    // Update io.WantCaptureMouse for the user application (true = dispatch mouse info to imgui, false = dispatch mouse info to Dear ImGui + app)\n    if (g.WantCaptureMouseNextFrame != -1)\n        g.IO.WantCaptureMouse = (g.WantCaptureMouseNextFrame != 0);\n    else\n        g.IO.WantCaptureMouse = (mouse_avail_to_imgui && (g.HoveredWindow != NULL || mouse_any_down)) || (g.OpenPopupStack.Size > 0);\n\n    // Update io.WantCaptureKeyboard for the user application (true = dispatch keyboard info to imgui, false = dispatch keyboard info to Dear ImGui + app)\n    if (g.WantCaptureKeyboardNextFrame != -1)\n        g.IO.WantCaptureKeyboard = (g.WantCaptureKeyboardNextFrame != 0);\n    else\n        g.IO.WantCaptureKeyboard = (g.ActiveId != 0) || (modal_window != NULL);\n    if (g.IO.NavActive && (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) && !(g.IO.ConfigFlags & ImGuiConfigFlags_NavNoCaptureKeyboard))\n        g.IO.WantCaptureKeyboard = true;\n\n    // Update io.WantTextInput flag, this is to allow systems without a keyboard (e.g. mobile, hand-held) to show a software keyboard if possible\n    g.IO.WantTextInput = (g.WantTextInputNextFrame != -1) ? (g.WantTextInputNextFrame != 0) : false;\n}\n\nImGuiKeyModFlags ImGui::GetMergedKeyModFlags()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiKeyModFlags key_mod_flags = ImGuiKeyModFlags_None;\n    if (g.IO.KeyCtrl)   { key_mod_flags |= ImGuiKeyModFlags_Ctrl; }\n    if (g.IO.KeyShift)  { key_mod_flags |= ImGuiKeyModFlags_Shift; }\n    if (g.IO.KeyAlt)    { key_mod_flags |= ImGuiKeyModFlags_Alt; }\n    if (g.IO.KeySuper)  { key_mod_flags |= ImGuiKeyModFlags_Super; }\n    return key_mod_flags;\n}\n\nvoid ImGui::NewFrame()\n{\n    IM_ASSERT(GImGui != NULL && \"No current context. Did you call ImGui::CreateContext() and ImGui::SetCurrentContext() ?\");\n    ImGuiContext& g = *GImGui;\n\n    // Remove pending delete hooks before frame start.\n    // This deferred removal avoid issues of removal while iterating the hook vector\n    for (int n = g.Hooks.Size - 1; n >= 0; n--)\n        if (g.Hooks[n].Type == ImGuiContextHookType_PendingRemoval_)\n            g.Hooks.erase(&g.Hooks[n]);\n\n    CallContextHooks(&g, ImGuiContextHookType_NewFramePre);\n\n    // Check and assert for various common IO and Configuration mistakes\n    ErrorCheckNewFrameSanityChecks();\n\n    // Load settings on first frame, save settings when modified (after a delay)\n    UpdateSettings();\n\n    g.Time += g.IO.DeltaTime;\n    g.WithinFrameScope = true;\n    g.FrameCount += 1;\n    g.TooltipOverrideCount = 0;\n    g.WindowsActiveCount = 0;\n    g.MenusIdSubmittedThisFrame.resize(0);\n\n    // Calculate frame-rate for the user, as a purely luxurious feature\n    g.FramerateSecPerFrameAccum += g.IO.DeltaTime - g.FramerateSecPerFrame[g.FramerateSecPerFrameIdx];\n    g.FramerateSecPerFrame[g.FramerateSecPerFrameIdx] = g.IO.DeltaTime;\n    g.FramerateSecPerFrameIdx = (g.FramerateSecPerFrameIdx + 1) % IM_ARRAYSIZE(g.FramerateSecPerFrame);\n    g.FramerateSecPerFrameCount = ImMin(g.FramerateSecPerFrameCount + 1, IM_ARRAYSIZE(g.FramerateSecPerFrame));\n    g.IO.Framerate = (g.FramerateSecPerFrameAccum > 0.0f) ? (1.0f / (g.FramerateSecPerFrameAccum / (float)g.FramerateSecPerFrameCount)) : FLT_MAX;\n\n    UpdateViewportsNewFrame();\n\n    // Setup current font and draw list shared data\n    g.IO.Fonts->Locked = true;\n    SetCurrentFont(GetDefaultFont());\n    IM_ASSERT(g.Font->IsLoaded());\n    ImRect virtual_space(FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX);\n    for (int n = 0; n < g.Viewports.Size; n++)\n        virtual_space.Add(g.Viewports[n]->GetMainRect());\n    g.DrawListSharedData.ClipRectFullscreen = virtual_space.ToVec4();\n    g.DrawListSharedData.CurveTessellationTol = g.Style.CurveTessellationTol;\n    g.DrawListSharedData.SetCircleTessellationMaxError(g.Style.CircleTessellationMaxError);\n    g.DrawListSharedData.InitialFlags = ImDrawListFlags_None;\n    if (g.Style.AntiAliasedLines)\n        g.DrawListSharedData.InitialFlags |= ImDrawListFlags_AntiAliasedLines;\n    if (g.Style.AntiAliasedLinesUseTex && !(g.Font->ContainerAtlas->Flags & ImFontAtlasFlags_NoBakedLines))\n        g.DrawListSharedData.InitialFlags |= ImDrawListFlags_AntiAliasedLinesUseTex;\n    if (g.Style.AntiAliasedFill)\n        g.DrawListSharedData.InitialFlags |= ImDrawListFlags_AntiAliasedFill;\n    if (g.IO.BackendFlags & ImGuiBackendFlags_RendererHasVtxOffset)\n        g.DrawListSharedData.InitialFlags |= ImDrawListFlags_AllowVtxOffset;\n\n    // Mark rendering data as invalid to prevent user who may have a handle on it to use it.\n    for (int n = 0; n < g.Viewports.Size; n++)\n    {\n        ImGuiViewportP* viewport = g.Viewports[n];\n        viewport->DrawDataP.Clear();\n    }\n\n    // Drag and drop keep the source ID alive so even if the source disappear our state is consistent\n    if (g.DragDropActive && g.DragDropPayload.SourceId == g.ActiveId)\n        KeepAliveID(g.DragDropPayload.SourceId);\n\n    // Update HoveredId data\n    if (!g.HoveredIdPreviousFrame)\n        g.HoveredIdTimer = 0.0f;\n    if (!g.HoveredIdPreviousFrame || (g.HoveredId && g.ActiveId == g.HoveredId))\n        g.HoveredIdNotActiveTimer = 0.0f;\n    if (g.HoveredId)\n        g.HoveredIdTimer += g.IO.DeltaTime;\n    if (g.HoveredId && g.ActiveId != g.HoveredId)\n        g.HoveredIdNotActiveTimer += g.IO.DeltaTime;\n    g.HoveredIdPreviousFrame = g.HoveredId;\n    g.HoveredIdPreviousFrameUsingMouseWheel = g.HoveredIdUsingMouseWheel;\n    g.HoveredId = 0;\n    g.HoveredIdAllowOverlap = false;\n    g.HoveredIdUsingMouseWheel = false;\n    g.HoveredIdDisabled = false;\n\n    // Update ActiveId data (clear reference to active widget if the widget isn't alive anymore)\n    if (g.ActiveIdIsAlive != g.ActiveId && g.ActiveIdPreviousFrame == g.ActiveId && g.ActiveId != 0)\n        ClearActiveID();\n    if (g.ActiveId)\n        g.ActiveIdTimer += g.IO.DeltaTime;\n    g.LastActiveIdTimer += g.IO.DeltaTime;\n    g.ActiveIdPreviousFrame = g.ActiveId;\n    g.ActiveIdPreviousFrameWindow = g.ActiveIdWindow;\n    g.ActiveIdPreviousFrameHasBeenEditedBefore = g.ActiveIdHasBeenEditedBefore;\n    g.ActiveIdIsAlive = 0;\n    g.ActiveIdHasBeenEditedThisFrame = false;\n    g.ActiveIdPreviousFrameIsAlive = false;\n    g.ActiveIdIsJustActivated = false;\n    if (g.TempInputId != 0 && g.ActiveId != g.TempInputId)\n        g.TempInputId = 0;\n    if (g.ActiveId == 0)\n    {\n        g.ActiveIdUsingNavDirMask = 0x00;\n        g.ActiveIdUsingNavInputMask = 0x00;\n        g.ActiveIdUsingKeyInputMask = 0x00;\n    }\n\n    // Drag and drop\n    g.DragDropAcceptIdPrev = g.DragDropAcceptIdCurr;\n    g.DragDropAcceptIdCurr = 0;\n    g.DragDropAcceptIdCurrRectSurface = FLT_MAX;\n    g.DragDropWithinSource = false;\n    g.DragDropWithinTarget = false;\n    g.DragDropHoldJustPressedId = 0;\n\n    // Update keyboard input state\n    // Synchronize io.KeyMods with individual modifiers io.KeyXXX bools\n    g.IO.KeyMods = GetMergedKeyModFlags();\n    memcpy(g.IO.KeysDownDurationPrev, g.IO.KeysDownDuration, sizeof(g.IO.KeysDownDuration));\n    for (int i = 0; i < IM_ARRAYSIZE(g.IO.KeysDown); i++)\n        g.IO.KeysDownDuration[i] = g.IO.KeysDown[i] ? (g.IO.KeysDownDuration[i] < 0.0f ? 0.0f : g.IO.KeysDownDuration[i] + g.IO.DeltaTime) : -1.0f;\n\n    // Update gamepad/keyboard navigation\n    NavUpdate();\n\n    // Update mouse input state\n    UpdateMouseInputs();\n\n    // Find hovered window\n    // (needs to be before UpdateMouseMovingWindowNewFrame so we fill g.HoveredWindowUnderMovingWindow on the mouse release frame)\n    UpdateHoveredWindowAndCaptureFlags();\n\n    // Handle user moving window with mouse (at the beginning of the frame to avoid input lag or sheering)\n    UpdateMouseMovingWindowNewFrame();\n\n    // Background darkening/whitening\n    if (GetTopMostPopupModal() != NULL || (g.NavWindowingTarget != NULL && g.NavWindowingHighlightAlpha > 0.0f))\n        g.DimBgRatio = ImMin(g.DimBgRatio + g.IO.DeltaTime * 6.0f, 1.0f);\n    else\n        g.DimBgRatio = ImMax(g.DimBgRatio - g.IO.DeltaTime * 10.0f, 0.0f);\n\n    g.MouseCursor = ImGuiMouseCursor_Arrow;\n    g.WantCaptureMouseNextFrame = g.WantCaptureKeyboardNextFrame = g.WantTextInputNextFrame = -1;\n    g.PlatformImePos = ImVec2(1.0f, 1.0f); // OS Input Method Editor showing on top-left of our window by default\n\n    // Mouse wheel scrolling, scale\n    UpdateMouseWheel();\n\n    // Update legacy TAB focus\n    UpdateTabFocus();\n\n    // Mark all windows as not visible and compact unused memory.\n    IM_ASSERT(g.WindowsFocusOrder.Size <= g.Windows.Size);\n    const float memory_compact_start_time = (g.GcCompactAll || g.IO.ConfigMemoryCompactTimer < 0.0f) ? FLT_MAX : (float)g.Time - g.IO.ConfigMemoryCompactTimer;\n    for (int i = 0; i != g.Windows.Size; i++)\n    {\n        ImGuiWindow* window = g.Windows[i];\n        window->WasActive = window->Active;\n        window->BeginCount = 0;\n        window->Active = false;\n        window->WriteAccessed = false;\n\n        // Garbage collect transient buffers of recently unused windows\n        if (!window->WasActive && !window->MemoryCompacted && window->LastTimeActive < memory_compact_start_time)\n            GcCompactTransientWindowBuffers(window);\n    }\n\n    // Garbage collect transient buffers of recently unused tables\n    for (int i = 0; i < g.TablesLastTimeActive.Size; i++)\n        if (g.TablesLastTimeActive[i] >= 0.0f && g.TablesLastTimeActive[i] < memory_compact_start_time)\n            TableGcCompactTransientBuffers(g.Tables.GetByIndex(i));\n    for (int i = 0; i < g.TablesTempDataStack.Size; i++)\n        if (g.TablesTempDataStack[i].LastTimeActive >= 0.0f && g.TablesTempDataStack[i].LastTimeActive < memory_compact_start_time)\n            TableGcCompactTransientBuffers(&g.TablesTempDataStack[i]);\n    if (g.GcCompactAll)\n        GcCompactTransientMiscBuffers();\n    g.GcCompactAll = false;\n\n    // Closing the focused window restore focus to the first active root window in descending z-order\n    if (g.NavWindow && !g.NavWindow->WasActive)\n        FocusTopMostWindowUnderOne(NULL, NULL);\n\n    // No window should be open at the beginning of the frame.\n    // But in order to allow the user to call NewFrame() multiple times without calling Render(), we are doing an explicit clear.\n    g.CurrentWindowStack.resize(0);\n    g.BeginPopupStack.resize(0);\n    g.ItemFlagsStack.resize(0);\n    g.ItemFlagsStack.push_back(ImGuiItemFlags_None);\n    g.GroupStack.resize(0);\n\n    // [DEBUG] Item picker tool - start with DebugStartItemPicker() - useful to visually select an item and break into its call-stack.\n    UpdateDebugToolItemPicker();\n\n    // Create implicit/fallback window - which we will only render it if the user has added something to it.\n    // We don't use \"Debug\" to avoid colliding with user trying to create a \"Debug\" window with custom flags.\n    // This fallback is particularly important as it avoid ImGui:: calls from crashing.\n    g.WithinFrameScopeWithImplicitWindow = true;\n    SetNextWindowSize(ImVec2(400, 400), ImGuiCond_FirstUseEver);\n    Begin(\"Debug##Default\");\n    IM_ASSERT(g.CurrentWindow->IsFallbackWindow == true);\n\n    CallContextHooks(&g, ImGuiContextHookType_NewFramePost);\n}\n\n// [DEBUG] Item picker tool - start with DebugStartItemPicker() - useful to visually select an item and break into its call-stack.\nvoid ImGui::UpdateDebugToolItemPicker()\n{\n    ImGuiContext& g = *GImGui;\n    g.DebugItemPickerBreakId = 0;\n    if (g.DebugItemPickerActive)\n    {\n        const ImGuiID hovered_id = g.HoveredIdPreviousFrame;\n        SetMouseCursor(ImGuiMouseCursor_Hand);\n        if (IsKeyPressedMap(ImGuiKey_Escape))\n            g.DebugItemPickerActive = false;\n        if (IsMouseClicked(0) && hovered_id)\n        {\n            g.DebugItemPickerBreakId = hovered_id;\n            g.DebugItemPickerActive = false;\n        }\n        SetNextWindowBgAlpha(0.60f);\n        BeginTooltip();\n        Text(\"HoveredId: 0x%08X\", hovered_id);\n        Text(\"Press ESC to abort picking.\");\n        TextColored(GetStyleColorVec4(hovered_id ? ImGuiCol_Text : ImGuiCol_TextDisabled), \"Click to break in debugger!\");\n        EndTooltip();\n    }\n}\n\nvoid ImGui::Initialize(ImGuiContext* context)\n{\n    ImGuiContext& g = *context;\n    IM_ASSERT(!g.Initialized && !g.SettingsLoaded);\n\n    // Add .ini handle for ImGuiWindow type\n    {\n        ImGuiSettingsHandler ini_handler;\n        ini_handler.TypeName = \"Window\";\n        ini_handler.TypeHash = ImHashStr(\"Window\");\n        ini_handler.ClearAllFn = WindowSettingsHandler_ClearAll;\n        ini_handler.ReadOpenFn = WindowSettingsHandler_ReadOpen;\n        ini_handler.ReadLineFn = WindowSettingsHandler_ReadLine;\n        ini_handler.ApplyAllFn = WindowSettingsHandler_ApplyAll;\n        ini_handler.WriteAllFn = WindowSettingsHandler_WriteAll;\n        g.SettingsHandlers.push_back(ini_handler);\n    }\n\n    // Add .ini handle for ImGuiTable type\n    TableSettingsInstallHandler(context);\n\n    // Create default viewport\n    ImGuiViewportP* viewport = IM_NEW(ImGuiViewportP)();\n    g.Viewports.push_back(viewport);\n\n#ifdef IMGUI_HAS_DOCK\n#endif\n\n    g.Initialized = true;\n}\n\n// This function is merely here to free heap allocations.\nvoid ImGui::Shutdown(ImGuiContext* context)\n{\n    // The fonts atlas can be used prior to calling NewFrame(), so we clear it even if g.Initialized is FALSE (which would happen if we never called NewFrame)\n    ImGuiContext& g = *context;\n    if (g.IO.Fonts && g.FontAtlasOwnedByContext)\n    {\n        g.IO.Fonts->Locked = false;\n        IM_DELETE(g.IO.Fonts);\n    }\n    g.IO.Fonts = NULL;\n\n    // Cleanup of other data are conditional on actually having initialized Dear ImGui.\n    if (!g.Initialized)\n        return;\n\n    // Save settings (unless we haven't attempted to load them: CreateContext/DestroyContext without a call to NewFrame shouldn't save an empty file)\n    if (g.SettingsLoaded && g.IO.IniFilename != NULL)\n    {\n        ImGuiContext* backup_context = GImGui;\n        SetCurrentContext(&g);\n        SaveIniSettingsToDisk(g.IO.IniFilename);\n        SetCurrentContext(backup_context);\n    }\n\n    CallContextHooks(&g, ImGuiContextHookType_Shutdown);\n\n    // Clear everything else\n    g.Windows.clear_delete();\n    g.WindowsFocusOrder.clear();\n    g.WindowsTempSortBuffer.clear();\n    g.CurrentWindow = NULL;\n    g.CurrentWindowStack.clear();\n    g.WindowsById.Clear();\n    g.NavWindow = NULL;\n    g.HoveredWindow = g.HoveredWindowUnderMovingWindow = NULL;\n    g.ActiveIdWindow = g.ActiveIdPreviousFrameWindow = NULL;\n    g.MovingWindow = NULL;\n    g.ColorStack.clear();\n    g.StyleVarStack.clear();\n    g.FontStack.clear();\n    g.OpenPopupStack.clear();\n    g.BeginPopupStack.clear();\n\n    g.Viewports.clear_delete();\n\n    g.TabBars.Clear();\n    g.CurrentTabBarStack.clear();\n    g.ShrinkWidthBuffer.clear();\n\n    g.Tables.Clear();\n    g.TablesTempDataStack.clear_destruct();\n    g.DrawChannelsTempMergeBuffer.clear();\n\n    g.ClipboardHandlerData.clear();\n    g.MenusIdSubmittedThisFrame.clear();\n    g.InputTextState.ClearFreeMemory();\n\n    g.SettingsWindows.clear();\n    g.SettingsHandlers.clear();\n\n    if (g.LogFile)\n    {\n#ifndef IMGUI_DISABLE_TTY_FUNCTIONS\n        if (g.LogFile != stdout)\n#endif\n            ImFileClose(g.LogFile);\n        g.LogFile = NULL;\n    }\n    g.LogBuffer.clear();\n\n    g.Initialized = false;\n}\n\n// FIXME: Add a more explicit sort order in the window structure.\nstatic int IMGUI_CDECL ChildWindowComparer(const void* lhs, const void* rhs)\n{\n    const ImGuiWindow* const a = *(const ImGuiWindow* const *)lhs;\n    const ImGuiWindow* const b = *(const ImGuiWindow* const *)rhs;\n    if (int d = (a->Flags & ImGuiWindowFlags_Popup) - (b->Flags & ImGuiWindowFlags_Popup))\n        return d;\n    if (int d = (a->Flags & ImGuiWindowFlags_Tooltip) - (b->Flags & ImGuiWindowFlags_Tooltip))\n        return d;\n    return (a->BeginOrderWithinParent - b->BeginOrderWithinParent);\n}\n\nstatic void AddWindowToSortBuffer(ImVector<ImGuiWindow*>* out_sorted_windows, ImGuiWindow* window)\n{\n    out_sorted_windows->push_back(window);\n    if (window->Active)\n    {\n        int count = window->DC.ChildWindows.Size;\n        if (count > 1)\n            ImQsort(window->DC.ChildWindows.Data, (size_t)count, sizeof(ImGuiWindow*), ChildWindowComparer);\n        for (int i = 0; i < count; i++)\n        {\n            ImGuiWindow* child = window->DC.ChildWindows[i];\n            if (child->Active)\n                AddWindowToSortBuffer(out_sorted_windows, child);\n        }\n    }\n}\n\nstatic void AddDrawListToDrawData(ImVector<ImDrawList*>* out_list, ImDrawList* draw_list)\n{\n    // Remove trailing command if unused.\n    // Technically we could return directly instead of popping, but this make things looks neat in Metrics/Debugger window as well.\n    draw_list->_PopUnusedDrawCmd();\n    if (draw_list->CmdBuffer.Size == 0)\n        return;\n\n    // Draw list sanity check. Detect mismatch between PrimReserve() calls and incrementing _VtxCurrentIdx, _VtxWritePtr etc.\n    // May trigger for you if you are using PrimXXX functions incorrectly.\n    IM_ASSERT(draw_list->VtxBuffer.Size == 0 || draw_list->_VtxWritePtr == draw_list->VtxBuffer.Data + draw_list->VtxBuffer.Size);\n    IM_ASSERT(draw_list->IdxBuffer.Size == 0 || draw_list->_IdxWritePtr == draw_list->IdxBuffer.Data + draw_list->IdxBuffer.Size);\n    if (!(draw_list->Flags & ImDrawListFlags_AllowVtxOffset))\n        IM_ASSERT((int)draw_list->_VtxCurrentIdx == draw_list->VtxBuffer.Size);\n\n    // Check that draw_list doesn't use more vertices than indexable (default ImDrawIdx = unsigned short = 2 bytes = 64K vertices per ImDrawList = per window)\n    // If this assert triggers because you are drawing lots of stuff manually:\n    // - First, make sure you are coarse clipping yourself and not trying to draw many things outside visible bounds.\n    //   Be mindful that the ImDrawList API doesn't filter vertices. Use the Metrics/Debugger window to inspect draw list contents.\n    // - If you want large meshes with more than 64K vertices, you can either:\n    //   (A) Handle the ImDrawCmd::VtxOffset value in your renderer backend, and set 'io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset'.\n    //       Most example backends already support this from 1.71. Pre-1.71 backends won't.\n    //       Some graphics API such as GL ES 1/2 don't have a way to offset the starting vertex so it is not supported for them.\n    //   (B) Or handle 32-bit indices in your renderer backend, and uncomment '#define ImDrawIdx unsigned int' line in imconfig.h.\n    //       Most example backends already support this. For example, the OpenGL example code detect index size at compile-time:\n    //         glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, idx_buffer_offset);\n    //       Your own engine or render API may use different parameters or function calls to specify index sizes.\n    //       2 and 4 bytes indices are generally supported by most graphics API.\n    // - If for some reason neither of those solutions works for you, a workaround is to call BeginChild()/EndChild() before reaching\n    //   the 64K limit to split your draw commands in multiple draw lists.\n    if (sizeof(ImDrawIdx) == 2)\n        IM_ASSERT(draw_list->_VtxCurrentIdx < (1 << 16) && \"Too many vertices in ImDrawList using 16-bit indices. Read comment above\");\n\n    out_list->push_back(draw_list);\n}\n\nstatic void AddWindowToDrawData(ImGuiWindow* window, int layer)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiViewportP* viewport = g.Viewports[0];\n    g.IO.MetricsRenderWindows++;\n    AddDrawListToDrawData(&viewport->DrawDataBuilder.Layers[layer], window->DrawList);\n    for (int i = 0; i < window->DC.ChildWindows.Size; i++)\n    {\n        ImGuiWindow* child = window->DC.ChildWindows[i];\n        if (IsWindowActiveAndVisible(child)) // Clipped children may have been marked not active\n            AddWindowToDrawData(child, layer);\n    }\n}\n\n// Layer is locked for the root window, however child windows may use a different viewport (e.g. extruding menu)\nstatic void AddRootWindowToDrawData(ImGuiWindow* window)\n{\n    int layer = (window->Flags & ImGuiWindowFlags_Tooltip) ? 1 : 0;\n    AddWindowToDrawData(window, layer);\n}\n\nvoid ImDrawDataBuilder::FlattenIntoSingleLayer()\n{\n    int n = Layers[0].Size;\n    int size = n;\n    for (int i = 1; i < IM_ARRAYSIZE(Layers); i++)\n        size += Layers[i].Size;\n    Layers[0].resize(size);\n    for (int layer_n = 1; layer_n < IM_ARRAYSIZE(Layers); layer_n++)\n    {\n        ImVector<ImDrawList*>& layer = Layers[layer_n];\n        if (layer.empty())\n            continue;\n        memcpy(&Layers[0][n], &layer[0], layer.Size * sizeof(ImDrawList*));\n        n += layer.Size;\n        layer.resize(0);\n    }\n}\n\nstatic void SetupViewportDrawData(ImGuiViewportP* viewport, ImVector<ImDrawList*>* draw_lists)\n{\n    ImGuiIO& io = ImGui::GetIO();\n    ImDrawData* draw_data = &viewport->DrawDataP;\n    draw_data->Valid = true;\n    draw_data->CmdLists = (draw_lists->Size > 0) ? draw_lists->Data : NULL;\n    draw_data->CmdListsCount = draw_lists->Size;\n    draw_data->TotalVtxCount = draw_data->TotalIdxCount = 0;\n    draw_data->DisplayPos = viewport->Pos;\n    draw_data->DisplaySize = viewport->Size;\n    draw_data->FramebufferScale = io.DisplayFramebufferScale;\n    for (int n = 0; n < draw_lists->Size; n++)\n    {\n        draw_data->TotalVtxCount += draw_lists->Data[n]->VtxBuffer.Size;\n        draw_data->TotalIdxCount += draw_lists->Data[n]->IdxBuffer.Size;\n    }\n}\n\n// Push a clipping rectangle for both ImGui logic (hit-testing etc.) and low-level ImDrawList rendering.\n// - When using this function it is sane to ensure that float are perfectly rounded to integer values,\n//   so that e.g. (int)(max.x-min.x) in user's render produce correct result.\n// - If the code here changes, may need to update code of functions like NextColumn() and PushColumnClipRect():\n//   some frequently called functions which to modify both channels and clipping simultaneously tend to use the\n//   more specialized SetWindowClipRectBeforeSetChannel() to avoid extraneous updates of underlying ImDrawCmds.\nvoid ImGui::PushClipRect(const ImVec2& clip_rect_min, const ImVec2& clip_rect_max, bool intersect_with_current_clip_rect)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    window->DrawList->PushClipRect(clip_rect_min, clip_rect_max, intersect_with_current_clip_rect);\n    window->ClipRect = window->DrawList->_ClipRectStack.back();\n}\n\nvoid ImGui::PopClipRect()\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    window->DrawList->PopClipRect();\n    window->ClipRect = window->DrawList->_ClipRectStack.back();\n}\n\n// This is normally called by Render(). You may want to call it directly if you want to avoid calling Render() but the gain will be very minimal.\nvoid ImGui::EndFrame()\n{\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(g.Initialized);\n\n    // Don't process EndFrame() multiple times.\n    if (g.FrameCountEnded == g.FrameCount)\n        return;\n    IM_ASSERT(g.WithinFrameScope && \"Forgot to call ImGui::NewFrame()?\");\n\n    CallContextHooks(&g, ImGuiContextHookType_EndFramePre);\n\n    ErrorCheckEndFrameSanityChecks();\n\n    // Notify OS when our Input Method Editor cursor has moved (e.g. CJK inputs using Microsoft IME)\n    if (g.IO.ImeSetInputScreenPosFn && (g.PlatformImeLastPos.x == FLT_MAX || ImLengthSqr(g.PlatformImeLastPos - g.PlatformImePos) > 0.0001f))\n    {\n        g.IO.ImeSetInputScreenPosFn((int)g.PlatformImePos.x, (int)g.PlatformImePos.y);\n        g.PlatformImeLastPos = g.PlatformImePos;\n    }\n\n    // Hide implicit/fallback \"Debug\" window if it hasn't been used\n    g.WithinFrameScopeWithImplicitWindow = false;\n    if (g.CurrentWindow && !g.CurrentWindow->WriteAccessed)\n        g.CurrentWindow->Active = false;\n    End();\n\n    // Update navigation: CTRL+Tab, wrap-around requests\n    NavEndFrame();\n\n    // Drag and Drop: Elapse payload (if delivered, or if source stops being submitted)\n    if (g.DragDropActive)\n    {\n        bool is_delivered = g.DragDropPayload.Delivery;\n        bool is_elapsed = (g.DragDropPayload.DataFrameCount + 1 < g.FrameCount) && ((g.DragDropSourceFlags & ImGuiDragDropFlags_SourceAutoExpirePayload) || !IsMouseDown(g.DragDropMouseButton));\n        if (is_delivered || is_elapsed)\n            ClearDragDrop();\n    }\n\n    // Drag and Drop: Fallback for source tooltip. This is not ideal but better than nothing.\n    if (g.DragDropActive && g.DragDropSourceFrameCount < g.FrameCount && !(g.DragDropSourceFlags & ImGuiDragDropFlags_SourceNoPreviewTooltip))\n    {\n        g.DragDropWithinSource = true;\n        SetTooltip(\"...\");\n        g.DragDropWithinSource = false;\n    }\n\n    // End frame\n    g.WithinFrameScope = false;\n    g.FrameCountEnded = g.FrameCount;\n\n    // Initiate moving window + handle left-click and right-click focus\n    UpdateMouseMovingWindowEndFrame();\n\n    // Sort the window list so that all child windows are after their parent\n    // We cannot do that on FocusWindow() because children may not exist yet\n    g.WindowsTempSortBuffer.resize(0);\n    g.WindowsTempSortBuffer.reserve(g.Windows.Size);\n    for (int i = 0; i != g.Windows.Size; i++)\n    {\n        ImGuiWindow* window = g.Windows[i];\n        if (window->Active && (window->Flags & ImGuiWindowFlags_ChildWindow))       // if a child is active its parent will add it\n            continue;\n        AddWindowToSortBuffer(&g.WindowsTempSortBuffer, window);\n    }\n\n    // This usually assert if there is a mismatch between the ImGuiWindowFlags_ChildWindow / ParentWindow values and DC.ChildWindows[] in parents, aka we've done something wrong.\n    IM_ASSERT(g.Windows.Size == g.WindowsTempSortBuffer.Size);\n    g.Windows.swap(g.WindowsTempSortBuffer);\n    g.IO.MetricsActiveWindows = g.WindowsActiveCount;\n\n    // Unlock font atlas\n    g.IO.Fonts->Locked = false;\n\n    // Clear Input data for next frame\n    g.IO.MouseWheel = g.IO.MouseWheelH = 0.0f;\n    g.IO.InputQueueCharacters.resize(0);\n    g.IO.KeyModsPrev = g.IO.KeyMods; // doing it here is better than in NewFrame() as we'll tolerate backend writing to KeyMods. If we want to firmly disallow it we should detect it.\n    memset(g.IO.NavInputs, 0, sizeof(g.IO.NavInputs));\n\n    CallContextHooks(&g, ImGuiContextHookType_EndFramePost);\n}\n\n// Prepare the data for rendering so you can call GetDrawData()\n// (As with anything within the ImGui:: namspace this doesn't touch your GPU or graphics API at all:\n// it is the role of the ImGui_ImplXXXX_RenderDrawData() function provided by the renderer backend)\nvoid ImGui::Render()\n{\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(g.Initialized);\n\n    if (g.FrameCountEnded != g.FrameCount)\n        EndFrame();\n    g.FrameCountRendered = g.FrameCount;\n    g.IO.MetricsRenderWindows = 0;\n\n    CallContextHooks(&g, ImGuiContextHookType_RenderPre);\n\n    // Add background ImDrawList (for each active viewport)\n    for (int n = 0; n != g.Viewports.Size; n++)\n    {\n        ImGuiViewportP* viewport = g.Viewports[n];\n        viewport->DrawDataBuilder.Clear();\n        if (viewport->DrawLists[0] != NULL)\n            AddDrawListToDrawData(&viewport->DrawDataBuilder.Layers[0], GetBackgroundDrawList(viewport));\n    }\n\n    // Add ImDrawList to render\n    ImGuiWindow* windows_to_render_top_most[2];\n    windows_to_render_top_most[0] = (g.NavWindowingTarget && !(g.NavWindowingTarget->Flags & ImGuiWindowFlags_NoBringToFrontOnFocus)) ? g.NavWindowingTarget->RootWindow : NULL;\n    windows_to_render_top_most[1] = (g.NavWindowingTarget ? g.NavWindowingListWindow : NULL);\n    for (int n = 0; n != g.Windows.Size; n++)\n    {\n        ImGuiWindow* window = g.Windows[n];\n        IM_MSVC_WARNING_SUPPRESS(6011); // Static Analysis false positive \"warning C6011: Dereferencing NULL pointer 'window'\"\n        if (IsWindowActiveAndVisible(window) && (window->Flags & ImGuiWindowFlags_ChildWindow) == 0 && window != windows_to_render_top_most[0] && window != windows_to_render_top_most[1])\n            AddRootWindowToDrawData(window);\n    }\n    for (int n = 0; n < IM_ARRAYSIZE(windows_to_render_top_most); n++)\n        if (windows_to_render_top_most[n] && IsWindowActiveAndVisible(windows_to_render_top_most[n])) // NavWindowingTarget is always temporarily displayed as the top-most window\n            AddRootWindowToDrawData(windows_to_render_top_most[n]);\n\n    // Setup ImDrawData structures for end-user\n    g.IO.MetricsRenderVertices = g.IO.MetricsRenderIndices = 0;\n    for (int n = 0; n < g.Viewports.Size; n++)\n    {\n        ImGuiViewportP* viewport = g.Viewports[n];\n        viewport->DrawDataBuilder.FlattenIntoSingleLayer();\n\n        // Draw software mouse cursor if requested by io.MouseDrawCursor flag\n        if (g.IO.MouseDrawCursor)\n            RenderMouseCursor(GetForegroundDrawList(viewport), g.IO.MousePos, g.Style.MouseCursorScale, g.MouseCursor, IM_COL32_WHITE, IM_COL32_BLACK, IM_COL32(0, 0, 0, 48));\n\n        // Add foreground ImDrawList (for each active viewport)\n        if (viewport->DrawLists[1] != NULL)\n            AddDrawListToDrawData(&viewport->DrawDataBuilder.Layers[0], GetForegroundDrawList(viewport));\n\n        SetupViewportDrawData(viewport, &viewport->DrawDataBuilder.Layers[0]);\n        ImDrawData* draw_data = &viewport->DrawDataP;\n        g.IO.MetricsRenderVertices += draw_data->TotalVtxCount;\n        g.IO.MetricsRenderIndices += draw_data->TotalIdxCount;\n    }\n\n    CallContextHooks(&g, ImGuiContextHookType_RenderPost);\n}\n\n// Calculate text size. Text can be multi-line. Optionally ignore text after a ## marker.\n// CalcTextSize(\"\") should return ImVec2(0.0f, g.FontSize)\nImVec2 ImGui::CalcTextSize(const char* text, const char* text_end, bool hide_text_after_double_hash, float wrap_width)\n{\n    ImGuiContext& g = *GImGui;\n\n    const char* text_display_end;\n    if (hide_text_after_double_hash)\n        text_display_end = FindRenderedTextEnd(text, text_end);      // Hide anything after a '##' string\n    else\n        text_display_end = text_end;\n\n    ImFont* font = g.Font;\n    const float font_size = g.FontSize;\n    if (text == text_display_end)\n        return ImVec2(0.0f, font_size);\n    ImVec2 text_size = font->CalcTextSizeA(font_size, FLT_MAX, wrap_width, text, text_display_end, NULL);\n\n    // Round\n    // FIXME: This has been here since Dec 2015 (7b0bf230) but down the line we want this out.\n    // FIXME: Investigate using ceilf or e.g.\n    // - https://git.musl-libc.org/cgit/musl/tree/src/math/ceilf.c\n    // - https://embarkstudios.github.io/rust-gpu/api/src/libm/math/ceilf.rs.html\n    text_size.x = IM_FLOOR(text_size.x + 0.99999f);\n\n    return text_size;\n}\n\n// Find window given position, search front-to-back\n// FIXME: Note that we have an inconsequential lag here: OuterRectClipped is updated in Begin(), so windows moved programmatically\n// with SetWindowPos() and not SetNextWindowPos() will have that rectangle lagging by a frame at the time FindHoveredWindow() is\n// called, aka before the next Begin(). Moving window isn't affected.\nstatic void FindHoveredWindow()\n{\n    ImGuiContext& g = *GImGui;\n\n    ImGuiWindow* hovered_window = NULL;\n    ImGuiWindow* hovered_window_ignoring_moving_window = NULL;\n    if (g.MovingWindow && !(g.MovingWindow->Flags & ImGuiWindowFlags_NoMouseInputs))\n        hovered_window = g.MovingWindow;\n\n    ImVec2 padding_regular = g.Style.TouchExtraPadding;\n    ImVec2 padding_for_resize = g.IO.ConfigWindowsResizeFromEdges ? g.WindowsHoverPadding : padding_regular;\n    for (int i = g.Windows.Size - 1; i >= 0; i--)\n    {\n        ImGuiWindow* window = g.Windows[i];\n        IM_MSVC_WARNING_SUPPRESS(28182); // [Static Analyzer] Dereferencing NULL pointer.\n        if (!window->Active || window->Hidden)\n            continue;\n        if (window->Flags & ImGuiWindowFlags_NoMouseInputs)\n            continue;\n\n        // Using the clipped AABB, a child window will typically be clipped by its parent (not always)\n        ImRect bb(window->OuterRectClipped);\n        if (window->Flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize))\n            bb.Expand(padding_regular);\n        else\n            bb.Expand(padding_for_resize);\n        if (!bb.Contains(g.IO.MousePos))\n            continue;\n\n        // Support for one rectangular hole in any given window\n        // FIXME: Consider generalizing hit-testing override (with more generic data, callback, etc.) (#1512)\n        if (window->HitTestHoleSize.x != 0)\n        {\n            ImVec2 hole_pos(window->Pos.x + (float)window->HitTestHoleOffset.x, window->Pos.y + (float)window->HitTestHoleOffset.y);\n            ImVec2 hole_size((float)window->HitTestHoleSize.x, (float)window->HitTestHoleSize.y);\n            if (ImRect(hole_pos, hole_pos + hole_size).Contains(g.IO.MousePos))\n                continue;\n        }\n\n        if (hovered_window == NULL)\n            hovered_window = window;\n        IM_MSVC_WARNING_SUPPRESS(28182); // [Static Analyzer] Dereferencing NULL pointer.\n        if (hovered_window_ignoring_moving_window == NULL && (!g.MovingWindow || window->RootWindow != g.MovingWindow->RootWindow))\n            hovered_window_ignoring_moving_window = window;\n        if (hovered_window && hovered_window_ignoring_moving_window)\n            break;\n    }\n\n    g.HoveredWindow = hovered_window;\n    g.HoveredWindowUnderMovingWindow = hovered_window_ignoring_moving_window;\n}\n\n// Test if mouse cursor is hovering given rectangle\n// NB- Rectangle is clipped by our current clip setting\n// NB- Expand the rectangle to be generous on imprecise inputs systems (g.Style.TouchExtraPadding)\nbool ImGui::IsMouseHoveringRect(const ImVec2& r_min, const ImVec2& r_max, bool clip)\n{\n    ImGuiContext& g = *GImGui;\n\n    // Clip\n    ImRect rect_clipped(r_min, r_max);\n    if (clip)\n        rect_clipped.ClipWith(g.CurrentWindow->ClipRect);\n\n    // Expand for touch input\n    const ImRect rect_for_touch(rect_clipped.Min - g.Style.TouchExtraPadding, rect_clipped.Max + g.Style.TouchExtraPadding);\n    if (!rect_for_touch.Contains(g.IO.MousePos))\n        return false;\n    return true;\n}\n\nint ImGui::GetKeyIndex(ImGuiKey imgui_key)\n{\n    IM_ASSERT(imgui_key >= 0 && imgui_key < ImGuiKey_COUNT);\n    ImGuiContext& g = *GImGui;\n    return g.IO.KeyMap[imgui_key];\n}\n\n// Note that dear imgui doesn't know the semantic of each entry of io.KeysDown[]!\n// Use your own indices/enums according to how your backend/engine stored them into io.KeysDown[]!\nbool ImGui::IsKeyDown(int user_key_index)\n{\n    if (user_key_index < 0)\n        return false;\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(user_key_index >= 0 && user_key_index < IM_ARRAYSIZE(g.IO.KeysDown));\n    return g.IO.KeysDown[user_key_index];\n}\n\n// t0 = previous time (e.g.: g.Time - g.IO.DeltaTime)\n// t1 = current time (e.g.: g.Time)\n// An event is triggered at:\n//  t = 0.0f     t = repeat_delay,    t = repeat_delay + repeat_rate*N\nint ImGui::CalcTypematicRepeatAmount(float t0, float t1, float repeat_delay, float repeat_rate)\n{\n    if (t1 == 0.0f)\n        return 1;\n    if (t0 >= t1)\n        return 0;\n    if (repeat_rate <= 0.0f)\n        return (t0 < repeat_delay) && (t1 >= repeat_delay);\n    const int count_t0 = (t0 < repeat_delay) ? -1 : (int)((t0 - repeat_delay) / repeat_rate);\n    const int count_t1 = (t1 < repeat_delay) ? -1 : (int)((t1 - repeat_delay) / repeat_rate);\n    const int count = count_t1 - count_t0;\n    return count;\n}\n\nint ImGui::GetKeyPressedAmount(int key_index, float repeat_delay, float repeat_rate)\n{\n    ImGuiContext& g = *GImGui;\n    if (key_index < 0)\n        return 0;\n    IM_ASSERT(key_index >= 0 && key_index < IM_ARRAYSIZE(g.IO.KeysDown));\n    const float t = g.IO.KeysDownDuration[key_index];\n    return CalcTypematicRepeatAmount(t - g.IO.DeltaTime, t, repeat_delay, repeat_rate);\n}\n\nbool ImGui::IsKeyPressed(int user_key_index, bool repeat)\n{\n    ImGuiContext& g = *GImGui;\n    if (user_key_index < 0)\n        return false;\n    IM_ASSERT(user_key_index >= 0 && user_key_index < IM_ARRAYSIZE(g.IO.KeysDown));\n    const float t = g.IO.KeysDownDuration[user_key_index];\n    if (t == 0.0f)\n        return true;\n    if (repeat && t > g.IO.KeyRepeatDelay)\n        return GetKeyPressedAmount(user_key_index, g.IO.KeyRepeatDelay, g.IO.KeyRepeatRate) > 0;\n    return false;\n}\n\nbool ImGui::IsKeyReleased(int user_key_index)\n{\n    ImGuiContext& g = *GImGui;\n    if (user_key_index < 0) return false;\n    IM_ASSERT(user_key_index >= 0 && user_key_index < IM_ARRAYSIZE(g.IO.KeysDown));\n    return g.IO.KeysDownDurationPrev[user_key_index] >= 0.0f && !g.IO.KeysDown[user_key_index];\n}\n\nbool ImGui::IsMouseDown(ImGuiMouseButton button)\n{\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));\n    return g.IO.MouseDown[button];\n}\n\nbool ImGui::IsMouseClicked(ImGuiMouseButton button, bool repeat)\n{\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));\n    const float t = g.IO.MouseDownDuration[button];\n    if (t == 0.0f)\n        return true;\n\n    if (repeat && t > g.IO.KeyRepeatDelay)\n    {\n        // FIXME: 2019/05/03: Our old repeat code was wrong here and led to doubling the repeat rate, which made it an ok rate for repeat on mouse hold.\n        int amount = CalcTypematicRepeatAmount(t - g.IO.DeltaTime, t, g.IO.KeyRepeatDelay, g.IO.KeyRepeatRate * 0.50f);\n        if (amount > 0)\n            return true;\n    }\n    return false;\n}\n\nbool ImGui::IsMouseReleased(ImGuiMouseButton button)\n{\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));\n    return g.IO.MouseReleased[button];\n}\n\nbool ImGui::IsMouseDoubleClicked(ImGuiMouseButton button)\n{\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));\n    return g.IO.MouseDoubleClicked[button];\n}\n\n// Return if a mouse click/drag went past the given threshold. Valid to call during the MouseReleased frame.\n// [Internal] This doesn't test if the button is pressed\nbool ImGui::IsMouseDragPastThreshold(ImGuiMouseButton button, float lock_threshold)\n{\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));\n    if (lock_threshold < 0.0f)\n        lock_threshold = g.IO.MouseDragThreshold;\n    return g.IO.MouseDragMaxDistanceSqr[button] >= lock_threshold * lock_threshold;\n}\n\nbool ImGui::IsMouseDragging(ImGuiMouseButton button, float lock_threshold)\n{\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));\n    if (!g.IO.MouseDown[button])\n        return false;\n    return IsMouseDragPastThreshold(button, lock_threshold);\n}\n\nImVec2 ImGui::GetMousePos()\n{\n    ImGuiContext& g = *GImGui;\n    return g.IO.MousePos;\n}\n\n// NB: prefer to call right after BeginPopup(). At the time Selectable/MenuItem is activated, the popup is already closed!\nImVec2 ImGui::GetMousePosOnOpeningCurrentPopup()\n{\n    ImGuiContext& g = *GImGui;\n    if (g.BeginPopupStack.Size > 0)\n        return g.OpenPopupStack[g.BeginPopupStack.Size - 1].OpenMousePos;\n    return g.IO.MousePos;\n}\n\n// We typically use ImVec2(-FLT_MAX,-FLT_MAX) to denote an invalid mouse position.\nbool ImGui::IsMousePosValid(const ImVec2* mouse_pos)\n{\n    // The assert is only to silence a false-positive in XCode Static Analysis.\n    // Because GImGui is not dereferenced in every code path, the static analyzer assume that it may be NULL (which it doesn't for other functions).\n    IM_ASSERT(GImGui != NULL);\n    const float MOUSE_INVALID = -256000.0f;\n    ImVec2 p = mouse_pos ? *mouse_pos : GImGui->IO.MousePos;\n    return p.x >= MOUSE_INVALID && p.y >= MOUSE_INVALID;\n}\n\nbool ImGui::IsAnyMouseDown()\n{\n    ImGuiContext& g = *GImGui;\n    for (int n = 0; n < IM_ARRAYSIZE(g.IO.MouseDown); n++)\n        if (g.IO.MouseDown[n])\n            return true;\n    return false;\n}\n\n// Return the delta from the initial clicking position while the mouse button is clicked or was just released.\n// This is locked and return 0.0f until the mouse moves past a distance threshold at least once.\n// NB: This is only valid if IsMousePosValid(). backends in theory should always keep mouse position valid when dragging even outside the client window.\nImVec2 ImGui::GetMouseDragDelta(ImGuiMouseButton button, float lock_threshold)\n{\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));\n    if (lock_threshold < 0.0f)\n        lock_threshold = g.IO.MouseDragThreshold;\n    if (g.IO.MouseDown[button] || g.IO.MouseReleased[button])\n        if (g.IO.MouseDragMaxDistanceSqr[button] >= lock_threshold * lock_threshold)\n            if (IsMousePosValid(&g.IO.MousePos) && IsMousePosValid(&g.IO.MouseClickedPos[button]))\n                return g.IO.MousePos - g.IO.MouseClickedPos[button];\n    return ImVec2(0.0f, 0.0f);\n}\n\nvoid ImGui::ResetMouseDragDelta(ImGuiMouseButton button)\n{\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));\n    // NB: We don't need to reset g.IO.MouseDragMaxDistanceSqr\n    g.IO.MouseClickedPos[button] = g.IO.MousePos;\n}\n\nImGuiMouseCursor ImGui::GetMouseCursor()\n{\n    return GImGui->MouseCursor;\n}\n\nvoid ImGui::SetMouseCursor(ImGuiMouseCursor cursor_type)\n{\n    GImGui->MouseCursor = cursor_type;\n}\n\nvoid ImGui::CaptureKeyboardFromApp(bool capture)\n{\n    GImGui->WantCaptureKeyboardNextFrame = capture ? 1 : 0;\n}\n\nvoid ImGui::CaptureMouseFromApp(bool capture)\n{\n    GImGui->WantCaptureMouseNextFrame = capture ? 1 : 0;\n}\n\nbool ImGui::IsItemActive()\n{\n    ImGuiContext& g = *GImGui;\n    if (g.ActiveId)\n        return g.ActiveId == g.LastItemData.ID;\n    return false;\n}\n\nbool ImGui::IsItemActivated()\n{\n    ImGuiContext& g = *GImGui;\n    if (g.ActiveId)\n        if (g.ActiveId == g.LastItemData.ID && g.ActiveIdPreviousFrame != g.LastItemData.ID)\n            return true;\n    return false;\n}\n\nbool ImGui::IsItemDeactivated()\n{\n    ImGuiContext& g = *GImGui;\n    if (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_HasDeactivated)\n        return (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_Deactivated) != 0;\n    return (g.ActiveIdPreviousFrame == g.LastItemData.ID && g.ActiveIdPreviousFrame != 0 && g.ActiveId != g.LastItemData.ID);\n}\n\nbool ImGui::IsItemDeactivatedAfterEdit()\n{\n    ImGuiContext& g = *GImGui;\n    return IsItemDeactivated() && (g.ActiveIdPreviousFrameHasBeenEditedBefore || (g.ActiveId == 0 && g.ActiveIdHasBeenEditedBefore));\n}\n\n// == GetItemID() == GetFocusID()\nbool ImGui::IsItemFocused()\n{\n    ImGuiContext& g = *GImGui;\n    if (g.NavId != g.LastItemData.ID || g.NavId == 0)\n        return false;\n    return true;\n}\n\n// Important: this can be useful but it is NOT equivalent to the behavior of e.g.Button()!\n// Most widgets have specific reactions based on mouse-up/down state, mouse position etc.\nbool ImGui::IsItemClicked(ImGuiMouseButton mouse_button)\n{\n    return IsMouseClicked(mouse_button) && IsItemHovered(ImGuiHoveredFlags_None);\n}\n\nbool ImGui::IsItemToggledOpen()\n{\n    ImGuiContext& g = *GImGui;\n    return (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_ToggledOpen) ? true : false;\n}\n\nbool ImGui::IsItemToggledSelection()\n{\n    ImGuiContext& g = *GImGui;\n    return (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_ToggledSelection) ? true : false;\n}\n\nbool ImGui::IsAnyItemHovered()\n{\n    ImGuiContext& g = *GImGui;\n    return g.HoveredId != 0 || g.HoveredIdPreviousFrame != 0;\n}\n\nbool ImGui::IsAnyItemActive()\n{\n    ImGuiContext& g = *GImGui;\n    return g.ActiveId != 0;\n}\n\nbool ImGui::IsAnyItemFocused()\n{\n    ImGuiContext& g = *GImGui;\n    return g.NavId != 0 && !g.NavDisableHighlight;\n}\n\nbool ImGui::IsItemVisible()\n{\n    ImGuiContext& g = *GImGui;\n    return g.CurrentWindow->ClipRect.Overlaps(g.LastItemData.Rect);\n}\n\nbool ImGui::IsItemEdited()\n{\n    ImGuiContext& g = *GImGui;\n    return (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_Edited) != 0;\n}\n\n// Allow last item to be overlapped by a subsequent item. Both may be activated during the same frame before the later one takes priority.\n// FIXME: Although this is exposed, its interaction and ideal idiom with using ImGuiButtonFlags_AllowItemOverlap flag are extremely confusing, need rework.\nvoid ImGui::SetItemAllowOverlap()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiID id = g.LastItemData.ID;\n    if (g.HoveredId == id)\n        g.HoveredIdAllowOverlap = true;\n    if (g.ActiveId == id)\n        g.ActiveIdAllowOverlap = true;\n}\n\nvoid ImGui::SetItemUsingMouseWheel()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiID id = g.LastItemData.ID;\n    if (g.HoveredId == id)\n        g.HoveredIdUsingMouseWheel = true;\n    if (g.ActiveId == id)\n        g.ActiveIdUsingMouseWheel = true;\n}\n\nvoid ImGui::SetActiveIdUsingNavAndKeys()\n{\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(g.ActiveId != 0);\n    g.ActiveIdUsingNavDirMask = ~(ImU32)0;\n    g.ActiveIdUsingNavInputMask = ~(ImU32)0;\n    g.ActiveIdUsingKeyInputMask = ~(ImU64)0;\n    NavMoveRequestCancel();\n}\n\nImVec2 ImGui::GetItemRectMin()\n{\n    ImGuiContext& g = *GImGui;\n    return g.LastItemData.Rect.Min;\n}\n\nImVec2 ImGui::GetItemRectMax()\n{\n    ImGuiContext& g = *GImGui;\n    return g.LastItemData.Rect.Max;\n}\n\nImVec2 ImGui::GetItemRectSize()\n{\n    ImGuiContext& g = *GImGui;\n    return g.LastItemData.Rect.GetSize();\n}\n\nbool ImGui::BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, bool border, ImGuiWindowFlags flags)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* parent_window = g.CurrentWindow;\n\n    flags |= ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_ChildWindow;\n    flags |= (parent_window->Flags & ImGuiWindowFlags_NoMove);  // Inherit the NoMove flag\n\n    // Size\n    const ImVec2 content_avail = GetContentRegionAvail();\n    ImVec2 size = ImFloor(size_arg);\n    const int auto_fit_axises = ((size.x == 0.0f) ? (1 << ImGuiAxis_X) : 0x00) | ((size.y == 0.0f) ? (1 << ImGuiAxis_Y) : 0x00);\n    if (size.x <= 0.0f)\n        size.x = ImMax(content_avail.x + size.x, 4.0f); // Arbitrary minimum child size (0.0f causing too much issues)\n    if (size.y <= 0.0f)\n        size.y = ImMax(content_avail.y + size.y, 4.0f);\n    SetNextWindowSize(size);\n\n    // Build up name. If you need to append to a same child from multiple location in the ID stack, use BeginChild(ImGuiID id) with a stable value.\n    if (name)\n        ImFormatString(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), \"%s/%s_%08X\", parent_window->Name, name, id);\n    else\n        ImFormatString(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), \"%s/%08X\", parent_window->Name, id);\n\n    const float backup_border_size = g.Style.ChildBorderSize;\n    if (!border)\n        g.Style.ChildBorderSize = 0.0f;\n    bool ret = Begin(g.TempBuffer, NULL, flags);\n    g.Style.ChildBorderSize = backup_border_size;\n\n    ImGuiWindow* child_window = g.CurrentWindow;\n    child_window->ChildId = id;\n    child_window->AutoFitChildAxises = (ImS8)auto_fit_axises;\n\n    // Set the cursor to handle case where the user called SetNextWindowPos()+BeginChild() manually.\n    // While this is not really documented/defined, it seems that the expected thing to do.\n    if (child_window->BeginCount == 1)\n        parent_window->DC.CursorPos = child_window->Pos;\n\n    // Process navigation-in immediately so NavInit can run on first frame\n    if (g.NavActivateId == id && !(flags & ImGuiWindowFlags_NavFlattened) && (child_window->DC.NavLayersActiveMask != 0 || child_window->DC.NavHasScroll))\n    {\n        FocusWindow(child_window);\n        NavInitWindow(child_window, false);\n        SetActiveID(id + 1, child_window); // Steal ActiveId with another arbitrary id so that key-press won't activate child item\n        g.ActiveIdSource = ImGuiInputSource_Nav;\n    }\n    return ret;\n}\n\nbool ImGui::BeginChild(const char* str_id, const ImVec2& size_arg, bool border, ImGuiWindowFlags extra_flags)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    return BeginChildEx(str_id, window->GetID(str_id), size_arg, border, extra_flags);\n}\n\nbool ImGui::BeginChild(ImGuiID id, const ImVec2& size_arg, bool border, ImGuiWindowFlags extra_flags)\n{\n    IM_ASSERT(id != 0);\n    return BeginChildEx(NULL, id, size_arg, border, extra_flags);\n}\n\nvoid ImGui::EndChild()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n\n    IM_ASSERT(g.WithinEndChild == false);\n    IM_ASSERT(window->Flags & ImGuiWindowFlags_ChildWindow);   // Mismatched BeginChild()/EndChild() calls\n\n    g.WithinEndChild = true;\n    if (window->BeginCount > 1)\n    {\n        End();\n    }\n    else\n    {\n        ImVec2 sz = window->Size;\n        if (window->AutoFitChildAxises & (1 << ImGuiAxis_X)) // Arbitrary minimum zero-ish child size of 4.0f causes less trouble than a 0.0f\n            sz.x = ImMax(4.0f, sz.x);\n        if (window->AutoFitChildAxises & (1 << ImGuiAxis_Y))\n            sz.y = ImMax(4.0f, sz.y);\n        End();\n\n        ImGuiWindow* parent_window = g.CurrentWindow;\n        ImRect bb(parent_window->DC.CursorPos, parent_window->DC.CursorPos + sz);\n        ItemSize(sz);\n        if ((window->DC.NavLayersActiveMask != 0 || window->DC.NavHasScroll) && !(window->Flags & ImGuiWindowFlags_NavFlattened))\n        {\n            ItemAdd(bb, window->ChildId);\n            RenderNavHighlight(bb, window->ChildId);\n\n            // When browsing a window that has no activable items (scroll only) we keep a highlight on the child\n            if (window->DC.NavLayersActiveMask == 0 && window == g.NavWindow)\n                RenderNavHighlight(ImRect(bb.Min - ImVec2(2, 2), bb.Max + ImVec2(2, 2)), g.NavId, ImGuiNavHighlightFlags_TypeThin);\n        }\n        else\n        {\n            // Not navigable into\n            ItemAdd(bb, 0);\n        }\n        if (g.HoveredWindow == window)\n            g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_HoveredWindow;\n    }\n    g.WithinEndChild = false;\n    g.LogLinePosY = -FLT_MAX; // To enforce a carriage return\n}\n\n// Helper to create a child window / scrolling region that looks like a normal widget frame.\nbool ImGui::BeginChildFrame(ImGuiID id, const ImVec2& size, ImGuiWindowFlags extra_flags)\n{\n    ImGuiContext& g = *GImGui;\n    const ImGuiStyle& style = g.Style;\n    PushStyleColor(ImGuiCol_ChildBg, style.Colors[ImGuiCol_FrameBg]);\n    PushStyleVar(ImGuiStyleVar_ChildRounding, style.FrameRounding);\n    PushStyleVar(ImGuiStyleVar_ChildBorderSize, style.FrameBorderSize);\n    PushStyleVar(ImGuiStyleVar_WindowPadding, style.FramePadding);\n    bool ret = BeginChild(id, size, true, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysUseWindowPadding | extra_flags);\n    PopStyleVar(3);\n    PopStyleColor();\n    return ret;\n}\n\nvoid ImGui::EndChildFrame()\n{\n    EndChild();\n}\n\nstatic void SetWindowConditionAllowFlags(ImGuiWindow* window, ImGuiCond flags, bool enabled)\n{\n    window->SetWindowPosAllowFlags       = enabled ? (window->SetWindowPosAllowFlags       | flags) : (window->SetWindowPosAllowFlags       & ~flags);\n    window->SetWindowSizeAllowFlags      = enabled ? (window->SetWindowSizeAllowFlags      | flags) : (window->SetWindowSizeAllowFlags      & ~flags);\n    window->SetWindowCollapsedAllowFlags = enabled ? (window->SetWindowCollapsedAllowFlags | flags) : (window->SetWindowCollapsedAllowFlags & ~flags);\n}\n\nImGuiWindow* ImGui::FindWindowByID(ImGuiID id)\n{\n    ImGuiContext& g = *GImGui;\n    return (ImGuiWindow*)g.WindowsById.GetVoidPtr(id);\n}\n\nImGuiWindow* ImGui::FindWindowByName(const char* name)\n{\n    ImGuiID id = ImHashStr(name);\n    return FindWindowByID(id);\n}\n\nstatic void ApplyWindowSettings(ImGuiWindow* window, ImGuiWindowSettings* settings)\n{\n    window->Pos = ImFloor(ImVec2(settings->Pos.x, settings->Pos.y));\n    if (settings->Size.x > 0 && settings->Size.y > 0)\n        window->Size = window->SizeFull = ImFloor(ImVec2(settings->Size.x, settings->Size.y));\n    window->Collapsed = settings->Collapsed;\n}\n\nstatic ImGuiWindow* CreateNewWindow(const char* name, ImGuiWindowFlags flags)\n{\n    ImGuiContext& g = *GImGui;\n    //IMGUI_DEBUG_LOG(\"CreateNewWindow '%s', flags = 0x%08X\\n\", name, flags);\n\n    // Create window the first time\n    ImGuiWindow* window = IM_NEW(ImGuiWindow)(&g, name);\n    window->Flags = flags;\n    g.WindowsById.SetVoidPtr(window->ID, window);\n\n    // Default/arbitrary window position. Use SetNextWindowPos() with the appropriate condition flag to change the initial position of a window.\n    const ImGuiViewport* main_viewport = ImGui::GetMainViewport();\n    window->Pos = main_viewport->Pos + ImVec2(60, 60);\n\n    // User can disable loading and saving of settings. Tooltip and child windows also don't store settings.\n    if (!(flags & ImGuiWindowFlags_NoSavedSettings))\n        if (ImGuiWindowSettings* settings = ImGui::FindWindowSettings(window->ID))\n        {\n            // Retrieve settings from .ini file\n            window->SettingsOffset = g.SettingsWindows.offset_from_ptr(settings);\n            SetWindowConditionAllowFlags(window, ImGuiCond_FirstUseEver, false);\n            ApplyWindowSettings(window, settings);\n        }\n    window->DC.CursorStartPos = window->DC.CursorMaxPos = window->Pos; // So first call to CalcContentSize() doesn't return crazy values\n\n    if ((flags & ImGuiWindowFlags_AlwaysAutoResize) != 0)\n    {\n        window->AutoFitFramesX = window->AutoFitFramesY = 2;\n        window->AutoFitOnlyGrows = false;\n    }\n    else\n    {\n        if (window->Size.x <= 0.0f)\n            window->AutoFitFramesX = 2;\n        if (window->Size.y <= 0.0f)\n            window->AutoFitFramesY = 2;\n        window->AutoFitOnlyGrows = (window->AutoFitFramesX > 0) || (window->AutoFitFramesY > 0);\n    }\n\n    if (!(flags & ImGuiWindowFlags_ChildWindow))\n    {\n        g.WindowsFocusOrder.push_back(window);\n        window->FocusOrder = (short)(g.WindowsFocusOrder.Size - 1);\n    }\n\n    if (flags & ImGuiWindowFlags_NoBringToFrontOnFocus)\n        g.Windows.push_front(window); // Quite slow but rare and only once\n    else\n        g.Windows.push_back(window);\n    return window;\n}\n\nstatic ImVec2 CalcWindowSizeAfterConstraint(ImGuiWindow* window, const ImVec2& size_desired)\n{\n    ImGuiContext& g = *GImGui;\n    ImVec2 new_size = size_desired;\n    if (g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSizeConstraint)\n    {\n        // Using -1,-1 on either X/Y axis to preserve the current size.\n        ImRect cr = g.NextWindowData.SizeConstraintRect;\n        new_size.x = (cr.Min.x >= 0 && cr.Max.x >= 0) ? ImClamp(new_size.x, cr.Min.x, cr.Max.x) : window->SizeFull.x;\n        new_size.y = (cr.Min.y >= 0 && cr.Max.y >= 0) ? ImClamp(new_size.y, cr.Min.y, cr.Max.y) : window->SizeFull.y;\n        if (g.NextWindowData.SizeCallback)\n        {\n            ImGuiSizeCallbackData data;\n            data.UserData = g.NextWindowData.SizeCallbackUserData;\n            data.Pos = window->Pos;\n            data.CurrentSize = window->SizeFull;\n            data.DesiredSize = new_size;\n            g.NextWindowData.SizeCallback(&data);\n            new_size = data.DesiredSize;\n        }\n        new_size.x = IM_FLOOR(new_size.x);\n        new_size.y = IM_FLOOR(new_size.y);\n    }\n\n    // Minimum size\n    if (!(window->Flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_AlwaysAutoResize)))\n    {\n        ImGuiWindow* window_for_height = window;\n        const float decoration_up_height = window_for_height->TitleBarHeight() + window_for_height->MenuBarHeight();\n        new_size = ImMax(new_size, g.Style.WindowMinSize);\n        new_size.y = ImMax(new_size.y, decoration_up_height + ImMax(0.0f, g.Style.WindowRounding - 1.0f)); // Reduce artifacts with very small windows\n    }\n    return new_size;\n}\n\nstatic void CalcWindowContentSizes(ImGuiWindow* window, ImVec2* content_size_current, ImVec2* content_size_ideal)\n{\n    bool preserve_old_content_sizes = false;\n    if (window->Collapsed && window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0)\n        preserve_old_content_sizes = true;\n    else if (window->Hidden && window->HiddenFramesCannotSkipItems == 0 && window->HiddenFramesCanSkipItems > 0)\n        preserve_old_content_sizes = true;\n    if (preserve_old_content_sizes)\n    {\n        *content_size_current = window->ContentSize;\n        *content_size_ideal = window->ContentSizeIdeal;\n        return;\n    }\n\n    content_size_current->x = (window->ContentSizeExplicit.x != 0.0f) ? window->ContentSizeExplicit.x : IM_FLOOR(window->DC.CursorMaxPos.x - window->DC.CursorStartPos.x);\n    content_size_current->y = (window->ContentSizeExplicit.y != 0.0f) ? window->ContentSizeExplicit.y : IM_FLOOR(window->DC.CursorMaxPos.y - window->DC.CursorStartPos.y);\n    content_size_ideal->x = (window->ContentSizeExplicit.x != 0.0f) ? window->ContentSizeExplicit.x : IM_FLOOR(ImMax(window->DC.CursorMaxPos.x, window->DC.IdealMaxPos.x) - window->DC.CursorStartPos.x);\n    content_size_ideal->y = (window->ContentSizeExplicit.y != 0.0f) ? window->ContentSizeExplicit.y : IM_FLOOR(ImMax(window->DC.CursorMaxPos.y, window->DC.IdealMaxPos.y) - window->DC.CursorStartPos.y);\n}\n\nstatic ImVec2 CalcWindowAutoFitSize(ImGuiWindow* window, const ImVec2& size_contents)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiStyle& style = g.Style;\n    const float decoration_up_height = window->TitleBarHeight() + window->MenuBarHeight();\n    ImVec2 size_pad = window->WindowPadding * 2.0f;\n    ImVec2 size_desired = size_contents + size_pad + ImVec2(0.0f, decoration_up_height);\n    if (window->Flags & ImGuiWindowFlags_Tooltip)\n    {\n        // Tooltip always resize\n        return size_desired;\n    }\n    else\n    {\n        // Maximum window size is determined by the viewport size or monitor size\n        const bool is_popup = (window->Flags & ImGuiWindowFlags_Popup) != 0;\n        const bool is_menu = (window->Flags & ImGuiWindowFlags_ChildMenu) != 0;\n        ImVec2 size_min = style.WindowMinSize;\n        if (is_popup || is_menu) // Popups and menus bypass style.WindowMinSize by default, but we give then a non-zero minimum size to facilitate understanding problematic cases (e.g. empty popups)\n            size_min = ImMin(size_min, ImVec2(4.0f, 4.0f));\n\n        // FIXME-VIEWPORT-WORKAREA: May want to use GetWorkSize() instead of Size depending on the type of windows?\n        ImVec2 avail_size = ImGui::GetMainViewport()->Size;\n        ImVec2 size_auto_fit = ImClamp(size_desired, size_min, ImMax(size_min, avail_size - style.DisplaySafeAreaPadding * 2.0f));\n\n        // When the window cannot fit all contents (either because of constraints, either because screen is too small),\n        // we are growing the size on the other axis to compensate for expected scrollbar. FIXME: Might turn bigger than ViewportSize-WindowPadding.\n        ImVec2 size_auto_fit_after_constraint = CalcWindowSizeAfterConstraint(window, size_auto_fit);\n        bool will_have_scrollbar_x = (size_auto_fit_after_constraint.x - size_pad.x - 0.0f                 < size_contents.x && !(window->Flags & ImGuiWindowFlags_NoScrollbar) && (window->Flags & ImGuiWindowFlags_HorizontalScrollbar)) || (window->Flags & ImGuiWindowFlags_AlwaysHorizontalScrollbar);\n        bool will_have_scrollbar_y = (size_auto_fit_after_constraint.y - size_pad.y - decoration_up_height < size_contents.y && !(window->Flags & ImGuiWindowFlags_NoScrollbar)) || (window->Flags & ImGuiWindowFlags_AlwaysVerticalScrollbar);\n        if (will_have_scrollbar_x)\n            size_auto_fit.y += style.ScrollbarSize;\n        if (will_have_scrollbar_y)\n            size_auto_fit.x += style.ScrollbarSize;\n        return size_auto_fit;\n    }\n}\n\nImVec2 ImGui::CalcWindowNextAutoFitSize(ImGuiWindow* window)\n{\n    ImVec2 size_contents_current;\n    ImVec2 size_contents_ideal;\n    CalcWindowContentSizes(window, &size_contents_current, &size_contents_ideal);\n    ImVec2 size_auto_fit = CalcWindowAutoFitSize(window, size_contents_ideal);\n    ImVec2 size_final = CalcWindowSizeAfterConstraint(window, size_auto_fit);\n    return size_final;\n}\n\nstatic ImGuiCol GetWindowBgColorIdxFromFlags(ImGuiWindowFlags flags)\n{\n    if (flags & (ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_Popup))\n        return ImGuiCol_PopupBg;\n    if (flags & ImGuiWindowFlags_ChildWindow)\n        return ImGuiCol_ChildBg;\n    return ImGuiCol_WindowBg;\n}\n\nstatic void CalcResizePosSizeFromAnyCorner(ImGuiWindow* window, const ImVec2& corner_target, const ImVec2& corner_norm, ImVec2* out_pos, ImVec2* out_size)\n{\n    ImVec2 pos_min = ImLerp(corner_target, window->Pos, corner_norm);                // Expected window upper-left\n    ImVec2 pos_max = ImLerp(window->Pos + window->Size, corner_target, corner_norm); // Expected window lower-right\n    ImVec2 size_expected = pos_max - pos_min;\n    ImVec2 size_constrained = CalcWindowSizeAfterConstraint(window, size_expected);\n    *out_pos = pos_min;\n    if (corner_norm.x == 0.0f)\n        out_pos->x -= (size_constrained.x - size_expected.x);\n    if (corner_norm.y == 0.0f)\n        out_pos->y -= (size_constrained.y - size_expected.y);\n    *out_size = size_constrained;\n}\n\n// Data for resizing from corner\nstruct ImGuiResizeGripDef\n{\n    ImVec2  CornerPosN;\n    ImVec2  InnerDir;\n    int     AngleMin12, AngleMax12;\n};\nstatic const ImGuiResizeGripDef resize_grip_def[4] =\n{\n    { ImVec2(1, 1), ImVec2(-1, -1), 0, 3 },  // Lower-right\n    { ImVec2(0, 1), ImVec2(+1, -1), 3, 6 },  // Lower-left\n    { ImVec2(0, 0), ImVec2(+1, +1), 6, 9 },  // Upper-left (Unused)\n    { ImVec2(1, 0), ImVec2(-1, +1), 9, 12 }  // Upper-right (Unused)\n};\n\n// Data for resizing from borders\nstruct ImGuiResizeBorderDef\n{\n    ImVec2 InnerDir;\n    ImVec2 SegmentN1, SegmentN2;\n    float  OuterAngle;\n};\nstatic const ImGuiResizeBorderDef resize_border_def[4] =\n{\n    { ImVec2(+1, 0), ImVec2(0, 1), ImVec2(0, 0), IM_PI * 1.00f }, // Left\n    { ImVec2(-1, 0), ImVec2(1, 0), ImVec2(1, 1), IM_PI * 0.00f }, // Right\n    { ImVec2(0, +1), ImVec2(0, 0), ImVec2(1, 0), IM_PI * 1.50f }, // Up\n    { ImVec2(0, -1), ImVec2(1, 1), ImVec2(0, 1), IM_PI * 0.50f }  // Down\n};\n\nstatic ImRect GetResizeBorderRect(ImGuiWindow* window, int border_n, float perp_padding, float thickness)\n{\n    ImRect rect = window->Rect();\n    if (thickness == 0.0f)\n        rect.Max -= ImVec2(1, 1);\n    if (border_n == ImGuiDir_Left)  { return ImRect(rect.Min.x - thickness,    rect.Min.y + perp_padding, rect.Min.x + thickness,    rect.Max.y - perp_padding); }\n    if (border_n == ImGuiDir_Right) { return ImRect(rect.Max.x - thickness,    rect.Min.y + perp_padding, rect.Max.x + thickness,    rect.Max.y - perp_padding); }\n    if (border_n == ImGuiDir_Up)    { return ImRect(rect.Min.x + perp_padding, rect.Min.y - thickness,    rect.Max.x - perp_padding, rect.Min.y + thickness);    }\n    if (border_n == ImGuiDir_Down)  { return ImRect(rect.Min.x + perp_padding, rect.Max.y - thickness,    rect.Max.x - perp_padding, rect.Max.y + thickness);    }\n    IM_ASSERT(0);\n    return ImRect();\n}\n\n// 0..3: corners (Lower-right, Lower-left, Unused, Unused)\nImGuiID ImGui::GetWindowResizeCornerID(ImGuiWindow* window, int n)\n{\n    IM_ASSERT(n >= 0 && n < 4);\n    ImGuiID id = window->ID;\n    id = ImHashStr(\"#RESIZE\", 0, id);\n    id = ImHashData(&n, sizeof(int), id);\n    return id;\n}\n\n// Borders (Left, Right, Up, Down)\nImGuiID ImGui::GetWindowResizeBorderID(ImGuiWindow* window, ImGuiDir dir)\n{\n    IM_ASSERT(dir >= 0 && dir < 4);\n    int n = (int)dir + 4;\n    ImGuiID id = window->ID;\n    id = ImHashStr(\"#RESIZE\", 0, id);\n    id = ImHashData(&n, sizeof(int), id);\n    return id;\n}\n\n// Handle resize for: Resize Grips, Borders, Gamepad\n// Return true when using auto-fit (double click on resize grip)\nstatic bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& size_auto_fit, int* border_held, int resize_grip_count, ImU32 resize_grip_col[4], const ImRect& visibility_rect)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindowFlags flags = window->Flags;\n\n    if ((flags & ImGuiWindowFlags_NoResize) || (flags & ImGuiWindowFlags_AlwaysAutoResize) || window->AutoFitFramesX > 0 || window->AutoFitFramesY > 0)\n        return false;\n    if (window->WasActive == false) // Early out to avoid running this code for e.g. an hidden implicit/fallback Debug window.\n        return false;\n\n    bool ret_auto_fit = false;\n    const int resize_border_count = g.IO.ConfigWindowsResizeFromEdges ? 4 : 0;\n    const float grip_draw_size = IM_FLOOR(ImMax(g.FontSize * 1.35f, window->WindowRounding + 1.0f + g.FontSize * 0.2f));\n    const float grip_hover_inner_size = IM_FLOOR(grip_draw_size * 0.75f);\n    const float grip_hover_outer_size = g.IO.ConfigWindowsResizeFromEdges ? WINDOWS_HOVER_PADDING : 0.0f;\n\n    ImVec2 pos_target(FLT_MAX, FLT_MAX);\n    ImVec2 size_target(FLT_MAX, FLT_MAX);\n\n    // Resize grips and borders are on layer 1\n    window->DC.NavLayerCurrent = ImGuiNavLayer_Menu;\n\n    // Manual resize grips\n    PushID(\"#RESIZE\");\n    for (int resize_grip_n = 0; resize_grip_n < resize_grip_count; resize_grip_n++)\n    {\n        const ImGuiResizeGripDef& def = resize_grip_def[resize_grip_n];\n        const ImVec2 corner = ImLerp(window->Pos, window->Pos + window->Size, def.CornerPosN);\n\n        // Using the FlattenChilds button flag we make the resize button accessible even if we are hovering over a child window\n        bool hovered, held;\n        ImRect resize_rect(corner - def.InnerDir * grip_hover_outer_size, corner + def.InnerDir * grip_hover_inner_size);\n        if (resize_rect.Min.x > resize_rect.Max.x) ImSwap(resize_rect.Min.x, resize_rect.Max.x);\n        if (resize_rect.Min.y > resize_rect.Max.y) ImSwap(resize_rect.Min.y, resize_rect.Max.y);\n        ImGuiID resize_grip_id = window->GetID(resize_grip_n); // == GetWindowResizeCornerID()\n        ButtonBehavior(resize_rect, resize_grip_id, &hovered, &held, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_NoNavFocus);\n        //GetForegroundDrawList(window)->AddRect(resize_rect.Min, resize_rect.Max, IM_COL32(255, 255, 0, 255));\n        if (hovered || held)\n            g.MouseCursor = (resize_grip_n & 1) ? ImGuiMouseCursor_ResizeNESW : ImGuiMouseCursor_ResizeNWSE;\n\n        if (held && g.IO.MouseDoubleClicked[0] && resize_grip_n == 0)\n        {\n            // Manual auto-fit when double-clicking\n            size_target = CalcWindowSizeAfterConstraint(window, size_auto_fit);\n            ret_auto_fit = true;\n            ClearActiveID();\n        }\n        else if (held)\n        {\n            // Resize from any of the four corners\n            // We don't use an incremental MouseDelta but rather compute an absolute target size based on mouse position\n            ImVec2 clamp_min = ImVec2(def.CornerPosN.x == 1.0f ? visibility_rect.Min.x : -FLT_MAX, def.CornerPosN.y == 1.0f ? visibility_rect.Min.y : -FLT_MAX);\n            ImVec2 clamp_max = ImVec2(def.CornerPosN.x == 0.0f ? visibility_rect.Max.x : +FLT_MAX, def.CornerPosN.y == 0.0f ? visibility_rect.Max.y : +FLT_MAX);\n            ImVec2 corner_target = g.IO.MousePos - g.ActiveIdClickOffset + ImLerp(def.InnerDir * grip_hover_outer_size, def.InnerDir * -grip_hover_inner_size, def.CornerPosN); // Corner of the window corresponding to our corner grip\n            corner_target = ImClamp(corner_target, clamp_min, clamp_max);\n            CalcResizePosSizeFromAnyCorner(window, corner_target, def.CornerPosN, &pos_target, &size_target);\n        }\n\n        // Only lower-left grip is visible before hovering/activating\n        if (resize_grip_n == 0 || held || hovered)\n            resize_grip_col[resize_grip_n] = GetColorU32(held ? ImGuiCol_ResizeGripActive : hovered ? ImGuiCol_ResizeGripHovered : ImGuiCol_ResizeGrip);\n    }\n    for (int border_n = 0; border_n < resize_border_count; border_n++)\n    {\n        const ImGuiResizeBorderDef& def = resize_border_def[border_n];\n        const ImGuiAxis axis = (border_n == ImGuiDir_Left || border_n == ImGuiDir_Right) ? ImGuiAxis_X : ImGuiAxis_Y;\n\n        bool hovered, held;\n        ImRect border_rect = GetResizeBorderRect(window, border_n, grip_hover_inner_size, WINDOWS_HOVER_PADDING);\n        ImGuiID border_id = window->GetID(border_n + 4); // == GetWindowResizeBorderID()\n        ButtonBehavior(border_rect, border_id, &hovered, &held, ImGuiButtonFlags_FlattenChildren);\n        //GetForegroundDrawLists(window)->AddRect(border_rect.Min, border_rect.Max, IM_COL32(255, 255, 0, 255));\n        if ((hovered && g.HoveredIdTimer > WINDOWS_RESIZE_FROM_EDGES_FEEDBACK_TIMER) || held)\n        {\n            g.MouseCursor = (axis == ImGuiAxis_X) ? ImGuiMouseCursor_ResizeEW : ImGuiMouseCursor_ResizeNS;\n            if (held)\n                *border_held = border_n;\n        }\n        if (held)\n        {\n            ImVec2 clamp_min(border_n == ImGuiDir_Right ? visibility_rect.Min.x : -FLT_MAX, border_n == ImGuiDir_Down ? visibility_rect.Min.y : -FLT_MAX);\n            ImVec2 clamp_max(border_n == ImGuiDir_Left  ? visibility_rect.Max.x : +FLT_MAX, border_n == ImGuiDir_Up   ? visibility_rect.Max.y : +FLT_MAX);\n            ImVec2 border_target = window->Pos;\n            border_target[axis] = g.IO.MousePos[axis] - g.ActiveIdClickOffset[axis] + WINDOWS_HOVER_PADDING;\n            border_target = ImClamp(border_target, clamp_min, clamp_max);\n            CalcResizePosSizeFromAnyCorner(window, border_target, ImMin(def.SegmentN1, def.SegmentN2), &pos_target, &size_target);\n        }\n    }\n    PopID();\n\n    // Restore nav layer\n    window->DC.NavLayerCurrent = ImGuiNavLayer_Main;\n\n    // Navigation resize (keyboard/gamepad)\n    if (g.NavWindowingTarget && g.NavWindowingTarget->RootWindow == window)\n    {\n        ImVec2 nav_resize_delta;\n        if (g.NavInputSource == ImGuiInputSource_Keyboard && g.IO.KeyShift)\n            nav_resize_delta = GetNavInputAmount2d(ImGuiNavDirSourceFlags_Keyboard, ImGuiInputReadMode_Down);\n        if (g.NavInputSource == ImGuiInputSource_Gamepad)\n            nav_resize_delta = GetNavInputAmount2d(ImGuiNavDirSourceFlags_PadDPad, ImGuiInputReadMode_Down);\n        if (nav_resize_delta.x != 0.0f || nav_resize_delta.y != 0.0f)\n        {\n            const float NAV_RESIZE_SPEED = 600.0f;\n            nav_resize_delta *= ImFloor(NAV_RESIZE_SPEED * g.IO.DeltaTime * ImMin(g.IO.DisplayFramebufferScale.x, g.IO.DisplayFramebufferScale.y));\n            nav_resize_delta = ImMax(nav_resize_delta, visibility_rect.Min - window->Pos - window->Size);\n            g.NavWindowingToggleLayer = false;\n            g.NavDisableMouseHover = true;\n            resize_grip_col[0] = GetColorU32(ImGuiCol_ResizeGripActive);\n            // FIXME-NAV: Should store and accumulate into a separate size buffer to handle sizing constraints properly, right now a constraint will make us stuck.\n            size_target = CalcWindowSizeAfterConstraint(window, window->SizeFull + nav_resize_delta);\n        }\n    }\n\n    // Apply back modified position/size to window\n    if (size_target.x != FLT_MAX)\n    {\n        window->SizeFull = size_target;\n        MarkIniSettingsDirty(window);\n    }\n    if (pos_target.x != FLT_MAX)\n    {\n        window->Pos = ImFloor(pos_target);\n        MarkIniSettingsDirty(window);\n    }\n\n    window->Size = window->SizeFull;\n    return ret_auto_fit;\n}\n\nstatic inline void ClampWindowRect(ImGuiWindow* window, const ImRect& visibility_rect)\n{\n    ImGuiContext& g = *GImGui;\n    ImVec2 size_for_clamping = window->Size;\n    if (g.IO.ConfigWindowsMoveFromTitleBarOnly && !(window->Flags & ImGuiWindowFlags_NoTitleBar))\n        size_for_clamping.y = window->TitleBarHeight();\n    window->Pos = ImClamp(window->Pos, visibility_rect.Min - size_for_clamping, visibility_rect.Max);\n}\n\nstatic void ImGui::RenderWindowOuterBorders(ImGuiWindow* window)\n{\n    ImGuiContext& g = *GImGui;\n    float rounding = window->WindowRounding;\n    float border_size = window->WindowBorderSize;\n    if (border_size > 0.0f && !(window->Flags & ImGuiWindowFlags_NoBackground))\n        window->DrawList->AddRect(window->Pos, window->Pos + window->Size, GetColorU32(ImGuiCol_Border), rounding, 0, border_size);\n\n    int border_held = window->ResizeBorderHeld;\n    if (border_held != -1)\n    {\n        const ImGuiResizeBorderDef& def = resize_border_def[border_held];\n        ImRect border_r = GetResizeBorderRect(window, border_held, rounding, 0.0f);\n        window->DrawList->PathArcTo(ImLerp(border_r.Min, border_r.Max, def.SegmentN1) + ImVec2(0.5f, 0.5f) + def.InnerDir * rounding, rounding, def.OuterAngle - IM_PI * 0.25f, def.OuterAngle);\n        window->DrawList->PathArcTo(ImLerp(border_r.Min, border_r.Max, def.SegmentN2) + ImVec2(0.5f, 0.5f) + def.InnerDir * rounding, rounding, def.OuterAngle, def.OuterAngle + IM_PI * 0.25f);\n        window->DrawList->PathStroke(GetColorU32(ImGuiCol_SeparatorActive), 0, ImMax(2.0f, border_size)); // Thicker than usual\n    }\n    if (g.Style.FrameBorderSize > 0 && !(window->Flags & ImGuiWindowFlags_NoTitleBar))\n    {\n        float y = window->Pos.y + window->TitleBarHeight() - 1;\n        window->DrawList->AddLine(ImVec2(window->Pos.x + border_size, y), ImVec2(window->Pos.x + window->Size.x - border_size, y), GetColorU32(ImGuiCol_Border), g.Style.FrameBorderSize);\n    }\n}\n\n// Draw background and borders\n// Draw and handle scrollbars\nvoid ImGui::RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar_rect, bool title_bar_is_highlight, int resize_grip_count, const ImU32 resize_grip_col[4], float resize_grip_draw_size)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiStyle& style = g.Style;\n    ImGuiWindowFlags flags = window->Flags;\n\n    // Ensure that ScrollBar doesn't read last frame's SkipItems\n    IM_ASSERT(window->BeginCount == 0);\n    window->SkipItems = false;\n\n    // Draw window + handle manual resize\n    // As we highlight the title bar when want_focus is set, multiple reappearing windows will have have their title bar highlighted on their reappearing frame.\n    const float window_rounding = window->WindowRounding;\n    const float window_border_size = window->WindowBorderSize;\n    if (window->Collapsed)\n    {\n        // Title bar only\n        float backup_border_size = style.FrameBorderSize;\n        g.Style.FrameBorderSize = window->WindowBorderSize;\n        ImU32 title_bar_col = GetColorU32((title_bar_is_highlight && !g.NavDisableHighlight) ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBgCollapsed);\n        RenderFrame(title_bar_rect.Min, title_bar_rect.Max, title_bar_col, true, window_rounding);\n        g.Style.FrameBorderSize = backup_border_size;\n    }\n    else\n    {\n        // Window background\n        if (!(flags & ImGuiWindowFlags_NoBackground))\n        {\n            ImU32 bg_col = GetColorU32(GetWindowBgColorIdxFromFlags(flags));\n            bool override_alpha = false;\n            float alpha = 1.0f;\n            if (g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasBgAlpha)\n            {\n                alpha = g.NextWindowData.BgAlphaVal;\n                override_alpha = true;\n            }\n            if (override_alpha)\n                bg_col = (bg_col & ~IM_COL32_A_MASK) | (IM_F32_TO_INT8_SAT(alpha) << IM_COL32_A_SHIFT);\n            window->DrawList->AddRectFilled(window->Pos + ImVec2(0, window->TitleBarHeight()), window->Pos + window->Size, bg_col, window_rounding, (flags & ImGuiWindowFlags_NoTitleBar) ? 0 : ImDrawFlags_RoundCornersBottom);\n        }\n\n        // Title bar\n        if (!(flags & ImGuiWindowFlags_NoTitleBar))\n        {\n            ImU32 title_bar_col = GetColorU32(title_bar_is_highlight ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBg);\n            window->DrawList->AddRectFilled(title_bar_rect.Min, title_bar_rect.Max, title_bar_col, window_rounding, ImDrawFlags_RoundCornersTop);\n        }\n\n        // Menu bar\n        if (flags & ImGuiWindowFlags_MenuBar)\n        {\n            ImRect menu_bar_rect = window->MenuBarRect();\n            menu_bar_rect.ClipWith(window->Rect());  // Soft clipping, in particular child window don't have minimum size covering the menu bar so this is useful for them.\n            window->DrawList->AddRectFilled(menu_bar_rect.Min + ImVec2(window_border_size, 0), menu_bar_rect.Max - ImVec2(window_border_size, 0), GetColorU32(ImGuiCol_MenuBarBg), (flags & ImGuiWindowFlags_NoTitleBar) ? window_rounding : 0.0f, ImDrawFlags_RoundCornersTop);\n            if (style.FrameBorderSize > 0.0f && menu_bar_rect.Max.y < window->Pos.y + window->Size.y)\n                window->DrawList->AddLine(menu_bar_rect.GetBL(), menu_bar_rect.GetBR(), GetColorU32(ImGuiCol_Border), style.FrameBorderSize);\n        }\n\n        // Scrollbars\n        if (window->ScrollbarX)\n            Scrollbar(ImGuiAxis_X);\n        if (window->ScrollbarY)\n            Scrollbar(ImGuiAxis_Y);\n\n        // Render resize grips (after their input handling so we don't have a frame of latency)\n        if (!(flags & ImGuiWindowFlags_NoResize))\n        {\n            for (int resize_grip_n = 0; resize_grip_n < resize_grip_count; resize_grip_n++)\n            {\n                const ImGuiResizeGripDef& grip = resize_grip_def[resize_grip_n];\n                const ImVec2 corner = ImLerp(window->Pos, window->Pos + window->Size, grip.CornerPosN);\n                window->DrawList->PathLineTo(corner + grip.InnerDir * ((resize_grip_n & 1) ? ImVec2(window_border_size, resize_grip_draw_size) : ImVec2(resize_grip_draw_size, window_border_size)));\n                window->DrawList->PathLineTo(corner + grip.InnerDir * ((resize_grip_n & 1) ? ImVec2(resize_grip_draw_size, window_border_size) : ImVec2(window_border_size, resize_grip_draw_size)));\n                window->DrawList->PathArcToFast(ImVec2(corner.x + grip.InnerDir.x * (window_rounding + window_border_size), corner.y + grip.InnerDir.y * (window_rounding + window_border_size)), window_rounding, grip.AngleMin12, grip.AngleMax12);\n                window->DrawList->PathFillConvex(resize_grip_col[resize_grip_n]);\n            }\n        }\n\n        // Borders\n        RenderWindowOuterBorders(window);\n    }\n}\n\n// Render title text, collapse button, close button\nvoid ImGui::RenderWindowTitleBarContents(ImGuiWindow* window, const ImRect& title_bar_rect, const char* name, bool* p_open)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiStyle& style = g.Style;\n    ImGuiWindowFlags flags = window->Flags;\n\n    const bool has_close_button = (p_open != NULL);\n    const bool has_collapse_button = !(flags & ImGuiWindowFlags_NoCollapse) && (style.WindowMenuButtonPosition != ImGuiDir_None);\n\n    // Close & Collapse button are on the Menu NavLayer and don't default focus (unless there's nothing else on that layer)\n    const ImGuiItemFlags item_flags_backup = g.CurrentItemFlags;\n    g.CurrentItemFlags |= ImGuiItemFlags_NoNavDefaultFocus;\n    window->DC.NavLayerCurrent = ImGuiNavLayer_Menu;\n\n    // Layout buttons\n    // FIXME: Would be nice to generalize the subtleties expressed here into reusable code.\n    float pad_l = style.FramePadding.x;\n    float pad_r = style.FramePadding.x;\n    float button_sz = g.FontSize;\n    ImVec2 close_button_pos;\n    ImVec2 collapse_button_pos;\n    if (has_close_button)\n    {\n        pad_r += button_sz;\n        close_button_pos = ImVec2(title_bar_rect.Max.x - pad_r - style.FramePadding.x, title_bar_rect.Min.y);\n    }\n    if (has_collapse_button && style.WindowMenuButtonPosition == ImGuiDir_Right)\n    {\n        pad_r += button_sz;\n        collapse_button_pos = ImVec2(title_bar_rect.Max.x - pad_r - style.FramePadding.x, title_bar_rect.Min.y);\n    }\n    if (has_collapse_button && style.WindowMenuButtonPosition == ImGuiDir_Left)\n    {\n        collapse_button_pos = ImVec2(title_bar_rect.Min.x + pad_l - style.FramePadding.x, title_bar_rect.Min.y);\n        pad_l += button_sz;\n    }\n\n    // Collapse button (submitting first so it gets priority when choosing a navigation init fallback)\n    if (has_collapse_button)\n        if (CollapseButton(window->GetID(\"#COLLAPSE\"), collapse_button_pos))\n            window->WantCollapseToggle = true; // Defer actual collapsing to next frame as we are too far in the Begin() function\n\n    // Close button\n    if (has_close_button)\n        if (CloseButton(window->GetID(\"#CLOSE\"), close_button_pos))\n            *p_open = false;\n\n    window->DC.NavLayerCurrent = ImGuiNavLayer_Main;\n    g.CurrentItemFlags = item_flags_backup;\n\n    // Title bar text (with: horizontal alignment, avoiding collapse/close button, optional \"unsaved document\" marker)\n    // FIXME: Refactor text alignment facilities along with RenderText helpers, this is WAY too much messy code..\n    const float marker_size_x = (flags & ImGuiWindowFlags_UnsavedDocument) ? button_sz * 0.80f : 0.0f;\n    const ImVec2 text_size = CalcTextSize(name, NULL, true) + ImVec2(marker_size_x, 0.0f);\n\n    // As a nice touch we try to ensure that centered title text doesn't get affected by visibility of Close/Collapse button,\n    // while uncentered title text will still reach edges correctly.\n    if (pad_l > style.FramePadding.x)\n        pad_l += g.Style.ItemInnerSpacing.x;\n    if (pad_r > style.FramePadding.x)\n        pad_r += g.Style.ItemInnerSpacing.x;\n    if (style.WindowTitleAlign.x > 0.0f && style.WindowTitleAlign.x < 1.0f)\n    {\n        float centerness = ImSaturate(1.0f - ImFabs(style.WindowTitleAlign.x - 0.5f) * 2.0f); // 0.0f on either edges, 1.0f on center\n        float pad_extend = ImMin(ImMax(pad_l, pad_r), title_bar_rect.GetWidth() - pad_l - pad_r - text_size.x);\n        pad_l = ImMax(pad_l, pad_extend * centerness);\n        pad_r = ImMax(pad_r, pad_extend * centerness);\n    }\n\n    ImRect layout_r(title_bar_rect.Min.x + pad_l, title_bar_rect.Min.y, title_bar_rect.Max.x - pad_r, title_bar_rect.Max.y);\n    ImRect clip_r(layout_r.Min.x, layout_r.Min.y, ImMin(layout_r.Max.x + g.Style.ItemInnerSpacing.x, title_bar_rect.Max.x), layout_r.Max.y);\n    if (flags & ImGuiWindowFlags_UnsavedDocument)\n    {\n        ImVec2 marker_pos;\n        marker_pos.x = ImClamp(layout_r.Min.x + (layout_r.GetWidth() - text_size.x) * style.WindowTitleAlign.x + text_size.x, layout_r.Min.x, layout_r.Max.x);\n        marker_pos.y = (layout_r.Min.y + layout_r.Max.y) * 0.5f;\n        if (marker_pos.x > layout_r.Min.x)\n        {\n            RenderBullet(window->DrawList, marker_pos, GetColorU32(ImGuiCol_Text));\n            clip_r.Max.x = ImMin(clip_r.Max.x, marker_pos.x - (int)(marker_size_x * 0.5f));\n        }\n    }\n    //if (g.IO.KeyShift) window->DrawList->AddRect(layout_r.Min, layout_r.Max, IM_COL32(255, 128, 0, 255)); // [DEBUG]\n    //if (g.IO.KeyCtrl) window->DrawList->AddRect(clip_r.Min, clip_r.Max, IM_COL32(255, 128, 0, 255)); // [DEBUG]\n    RenderTextClipped(layout_r.Min, layout_r.Max, name, NULL, &text_size, style.WindowTitleAlign, &clip_r);\n}\n\nvoid ImGui::UpdateWindowParentAndRootLinks(ImGuiWindow* window, ImGuiWindowFlags flags, ImGuiWindow* parent_window)\n{\n    window->ParentWindow = parent_window;\n    window->RootWindow = window->RootWindowForTitleBarHighlight = window->RootWindowForNav = window;\n    if (parent_window && (flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Tooltip))\n        window->RootWindow = parent_window->RootWindow;\n    if (parent_window && !(flags & ImGuiWindowFlags_Modal) && (flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Popup)))\n        window->RootWindowForTitleBarHighlight = parent_window->RootWindowForTitleBarHighlight;\n    while (window->RootWindowForNav->Flags & ImGuiWindowFlags_NavFlattened)\n    {\n        IM_ASSERT(window->RootWindowForNav->ParentWindow != NULL);\n        window->RootWindowForNav = window->RootWindowForNav->ParentWindow;\n    }\n}\n\n// Push a new Dear ImGui window to add widgets to.\n// - A default window called \"Debug\" is automatically stacked at the beginning of every frame so you can use widgets without explicitly calling a Begin/End pair.\n// - Begin/End can be called multiple times during the frame with the same window name to append content.\n// - The window name is used as a unique identifier to preserve window information across frames (and save rudimentary information to the .ini file).\n//   You can use the \"##\" or \"###\" markers to use the same label with different id, or same id with different label. See documentation at the top of this file.\n// - Return false when window is collapsed, so you can early out in your code. You always need to call ImGui::End() even if false is returned.\n// - Passing 'bool* p_open' displays a Close button on the upper-right corner of the window, the pointed value will be set to false when the button is pressed.\nbool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)\n{\n    ImGuiContext& g = *GImGui;\n    const ImGuiStyle& style = g.Style;\n    IM_ASSERT(name != NULL && name[0] != '\\0');     // Window name required\n    IM_ASSERT(g.WithinFrameScope);                  // Forgot to call ImGui::NewFrame()\n    IM_ASSERT(g.FrameCountEnded != g.FrameCount);   // Called ImGui::Render() or ImGui::EndFrame() and haven't called ImGui::NewFrame() again yet\n\n    // Find or create\n    ImGuiWindow* window = FindWindowByName(name);\n    const bool window_just_created = (window == NULL);\n    if (window_just_created)\n        window = CreateNewWindow(name, flags);\n\n    // Automatically disable manual moving/resizing when NoInputs is set\n    if ((flags & ImGuiWindowFlags_NoInputs) == ImGuiWindowFlags_NoInputs)\n        flags |= ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize;\n\n    if (flags & ImGuiWindowFlags_NavFlattened)\n        IM_ASSERT(flags & ImGuiWindowFlags_ChildWindow);\n\n    const int current_frame = g.FrameCount;\n    const bool first_begin_of_the_frame = (window->LastFrameActive != current_frame);\n    window->IsFallbackWindow = (g.CurrentWindowStack.Size == 0 && g.WithinFrameScopeWithImplicitWindow);\n\n    // Update the Appearing flag\n    bool window_just_activated_by_user = (window->LastFrameActive < current_frame - 1);   // Not using !WasActive because the implicit \"Debug\" window would always toggle off->on\n    if (flags & ImGuiWindowFlags_Popup)\n    {\n        ImGuiPopupData& popup_ref = g.OpenPopupStack[g.BeginPopupStack.Size];\n        window_just_activated_by_user |= (window->PopupId != popup_ref.PopupId); // We recycle popups so treat window as activated if popup id changed\n        window_just_activated_by_user |= (window != popup_ref.Window);\n    }\n    window->Appearing = window_just_activated_by_user;\n    if (window->Appearing)\n        SetWindowConditionAllowFlags(window, ImGuiCond_Appearing, true);\n\n    // Update Flags, LastFrameActive, BeginOrderXXX fields\n    if (first_begin_of_the_frame)\n    {\n        window->Flags = (ImGuiWindowFlags)flags;\n        window->LastFrameActive = current_frame;\n        window->LastTimeActive = (float)g.Time;\n        window->BeginOrderWithinParent = 0;\n        window->BeginOrderWithinContext = (short)(g.WindowsActiveCount++);\n    }\n    else\n    {\n        flags = window->Flags;\n    }\n\n    // Parent window is latched only on the first call to Begin() of the frame, so further append-calls can be done from a different window stack\n    ImGuiWindow* parent_window_in_stack = g.CurrentWindowStack.empty() ? NULL : g.CurrentWindowStack.back().Window;\n    ImGuiWindow* parent_window = first_begin_of_the_frame ? ((flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Popup)) ? parent_window_in_stack : NULL) : window->ParentWindow;\n    IM_ASSERT(parent_window != NULL || !(flags & ImGuiWindowFlags_ChildWindow));\n\n    // We allow window memory to be compacted so recreate the base stack when needed.\n    if (window->IDStack.Size == 0)\n        window->IDStack.push_back(window->ID);\n\n    // Add to stack\n    // We intentionally set g.CurrentWindow to NULL to prevent usage until when the viewport is set, then will call SetCurrentWindow()\n    ImGuiWindowStackData window_stack_data;\n    window_stack_data.Window = window;\n    window_stack_data.ParentLastItemDataBackup = g.LastItemData;\n    g.CurrentWindowStack.push_back(window_stack_data);\n    g.CurrentWindow = window;\n    window->DC.StackSizesOnBegin.SetToCurrentState();\n    g.CurrentWindow = NULL;\n\n    if (flags & ImGuiWindowFlags_Popup)\n    {\n        ImGuiPopupData& popup_ref = g.OpenPopupStack[g.BeginPopupStack.Size];\n        popup_ref.Window = window;\n        g.BeginPopupStack.push_back(popup_ref);\n        window->PopupId = popup_ref.PopupId;\n    }\n\n    // Update ->RootWindow and others pointers (before any possible call to FocusWindow)\n    if (first_begin_of_the_frame)\n        UpdateWindowParentAndRootLinks(window, flags, parent_window);\n\n    // Process SetNextWindow***() calls\n    // (FIXME: Consider splitting the HasXXX flags into X/Y components\n    bool window_pos_set_by_api = false;\n    bool window_size_x_set_by_api = false, window_size_y_set_by_api = false;\n    if (g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasPos)\n    {\n        window_pos_set_by_api = (window->SetWindowPosAllowFlags & g.NextWindowData.PosCond) != 0;\n        if (window_pos_set_by_api && ImLengthSqr(g.NextWindowData.PosPivotVal) > 0.00001f)\n        {\n            // May be processed on the next frame if this is our first frame and we are measuring size\n            // FIXME: Look into removing the branch so everything can go through this same code path for consistency.\n            window->SetWindowPosVal = g.NextWindowData.PosVal;\n            window->SetWindowPosPivot = g.NextWindowData.PosPivotVal;\n            window->SetWindowPosAllowFlags &= ~(ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing);\n        }\n        else\n        {\n            SetWindowPos(window, g.NextWindowData.PosVal, g.NextWindowData.PosCond);\n        }\n    }\n    if (g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSize)\n    {\n        window_size_x_set_by_api = (window->SetWindowSizeAllowFlags & g.NextWindowData.SizeCond) != 0 && (g.NextWindowData.SizeVal.x > 0.0f);\n        window_size_y_set_by_api = (window->SetWindowSizeAllowFlags & g.NextWindowData.SizeCond) != 0 && (g.NextWindowData.SizeVal.y > 0.0f);\n        SetWindowSize(window, g.NextWindowData.SizeVal, g.NextWindowData.SizeCond);\n    }\n    if (g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasScroll)\n    {\n        if (g.NextWindowData.ScrollVal.x >= 0.0f)\n        {\n            window->ScrollTarget.x = g.NextWindowData.ScrollVal.x;\n            window->ScrollTargetCenterRatio.x = 0.0f;\n        }\n        if (g.NextWindowData.ScrollVal.y >= 0.0f)\n        {\n            window->ScrollTarget.y = g.NextWindowData.ScrollVal.y;\n            window->ScrollTargetCenterRatio.y = 0.0f;\n        }\n    }\n    if (g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasContentSize)\n        window->ContentSizeExplicit = g.NextWindowData.ContentSizeVal;\n    else if (first_begin_of_the_frame)\n        window->ContentSizeExplicit = ImVec2(0.0f, 0.0f);\n    if (g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasCollapsed)\n        SetWindowCollapsed(window, g.NextWindowData.CollapsedVal, g.NextWindowData.CollapsedCond);\n    if (g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasFocus)\n        FocusWindow(window);\n    if (window->Appearing)\n        SetWindowConditionAllowFlags(window, ImGuiCond_Appearing, false);\n\n    // When reusing window again multiple times a frame, just append content (don't need to setup again)\n    if (first_begin_of_the_frame)\n    {\n        // Initialize\n        const bool window_is_child_tooltip = (flags & ImGuiWindowFlags_ChildWindow) && (flags & ImGuiWindowFlags_Tooltip); // FIXME-WIP: Undocumented behavior of Child+Tooltip for pinned tooltip (#1345)\n        window->Active = true;\n        window->HasCloseButton = (p_open != NULL);\n        window->ClipRect = ImVec4(-FLT_MAX, -FLT_MAX, +FLT_MAX, +FLT_MAX);\n        window->IDStack.resize(1);\n        window->DrawList->_ResetForNewFrame();\n        window->DC.CurrentTableIdx = -1;\n\n        // Restore buffer capacity when woken from a compacted state, to avoid\n        if (window->MemoryCompacted)\n            GcAwakeTransientWindowBuffers(window);\n\n        // Update stored window name when it changes (which can _only_ happen with the \"###\" operator, so the ID would stay unchanged).\n        // The title bar always display the 'name' parameter, so we only update the string storage if it needs to be visible to the end-user elsewhere.\n        bool window_title_visible_elsewhere = false;\n        if (g.NavWindowingListWindow != NULL && (window->Flags & ImGuiWindowFlags_NoNavFocus) == 0)   // Window titles visible when using CTRL+TAB\n            window_title_visible_elsewhere = true;\n        if (window_title_visible_elsewhere && !window_just_created && strcmp(name, window->Name) != 0)\n        {\n            size_t buf_len = (size_t)window->NameBufLen;\n            window->Name = ImStrdupcpy(window->Name, &buf_len, name);\n            window->NameBufLen = (int)buf_len;\n        }\n\n        // UPDATE CONTENTS SIZE, UPDATE HIDDEN STATUS\n\n        // Update contents size from last frame for auto-fitting (or use explicit size)\n        const bool window_just_appearing_after_hidden_for_resize = (window->HiddenFramesCannotSkipItems > 0);\n        CalcWindowContentSizes(window, &window->ContentSize, &window->ContentSizeIdeal);\n        if (window->HiddenFramesCanSkipItems > 0)\n            window->HiddenFramesCanSkipItems--;\n        if (window->HiddenFramesCannotSkipItems > 0)\n            window->HiddenFramesCannotSkipItems--;\n        if (window->HiddenFramesForRenderOnly > 0)\n            window->HiddenFramesForRenderOnly--;\n\n        // Hide new windows for one frame until they calculate their size\n        if (window_just_created && (!window_size_x_set_by_api || !window_size_y_set_by_api))\n            window->HiddenFramesCannotSkipItems = 1;\n\n        // Hide popup/tooltip window when re-opening while we measure size (because we recycle the windows)\n        // We reset Size/ContentSize for reappearing popups/tooltips early in this function, so further code won't be tempted to use the old size.\n        if (window_just_activated_by_user && (flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_Tooltip)) != 0)\n        {\n            window->HiddenFramesCannotSkipItems = 1;\n            if (flags & ImGuiWindowFlags_AlwaysAutoResize)\n            {\n                if (!window_size_x_set_by_api)\n                    window->Size.x = window->SizeFull.x = 0.f;\n                if (!window_size_y_set_by_api)\n                    window->Size.y = window->SizeFull.y = 0.f;\n                window->ContentSize = window->ContentSizeIdeal = ImVec2(0.f, 0.f);\n            }\n        }\n\n        // SELECT VIEWPORT\n        // FIXME-VIEWPORT: In the docking/viewport branch, this is the point where we select the current viewport (which may affect the style)\n        SetCurrentWindow(window);\n\n        // LOCK BORDER SIZE AND PADDING FOR THE FRAME (so that altering them doesn't cause inconsistencies)\n\n        if (flags & ImGuiWindowFlags_ChildWindow)\n            window->WindowBorderSize = style.ChildBorderSize;\n        else\n            window->WindowBorderSize = ((flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_Tooltip)) && !(flags & ImGuiWindowFlags_Modal)) ? style.PopupBorderSize : style.WindowBorderSize;\n        window->WindowPadding = style.WindowPadding;\n        if ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & (ImGuiWindowFlags_AlwaysUseWindowPadding | ImGuiWindowFlags_Popup)) && window->WindowBorderSize == 0.0f)\n            window->WindowPadding = ImVec2(0.0f, (flags & ImGuiWindowFlags_MenuBar) ? style.WindowPadding.y : 0.0f);\n\n        // Lock menu offset so size calculation can use it as menu-bar windows need a minimum size.\n        window->DC.MenuBarOffset.x = ImMax(ImMax(window->WindowPadding.x, style.ItemSpacing.x), g.NextWindowData.MenuBarOffsetMinVal.x);\n        window->DC.MenuBarOffset.y = g.NextWindowData.MenuBarOffsetMinVal.y;\n\n        // Collapse window by double-clicking on title bar\n        // At this point we don't have a clipping rectangle setup yet, so we can use the title bar area for hit detection and drawing\n        if (!(flags & ImGuiWindowFlags_NoTitleBar) && !(flags & ImGuiWindowFlags_NoCollapse))\n        {\n            // We don't use a regular button+id to test for double-click on title bar (mostly due to legacy reason, could be fixed), so verify that we don't have items over the title bar.\n            ImRect title_bar_rect = window->TitleBarRect();\n            if (g.HoveredWindow == window && g.HoveredId == 0 && g.HoveredIdPreviousFrame == 0 && IsMouseHoveringRect(title_bar_rect.Min, title_bar_rect.Max) && g.IO.MouseDoubleClicked[0])\n                window->WantCollapseToggle = true;\n            if (window->WantCollapseToggle)\n            {\n                window->Collapsed = !window->Collapsed;\n                MarkIniSettingsDirty(window);\n            }\n        }\n        else\n        {\n            window->Collapsed = false;\n        }\n        window->WantCollapseToggle = false;\n\n        // SIZE\n\n        // Calculate auto-fit size, handle automatic resize\n        const ImVec2 size_auto_fit = CalcWindowAutoFitSize(window, window->ContentSizeIdeal);\n        bool use_current_size_for_scrollbar_x = window_just_created;\n        bool use_current_size_for_scrollbar_y = window_just_created;\n        if ((flags & ImGuiWindowFlags_AlwaysAutoResize) && !window->Collapsed)\n        {\n            // Using SetNextWindowSize() overrides ImGuiWindowFlags_AlwaysAutoResize, so it can be used on tooltips/popups, etc.\n            if (!window_size_x_set_by_api)\n            {\n                window->SizeFull.x = size_auto_fit.x;\n                use_current_size_for_scrollbar_x = true;\n            }\n            if (!window_size_y_set_by_api)\n            {\n                window->SizeFull.y = size_auto_fit.y;\n                use_current_size_for_scrollbar_y = true;\n            }\n        }\n        else if (window->AutoFitFramesX > 0 || window->AutoFitFramesY > 0)\n        {\n            // Auto-fit may only grow window during the first few frames\n            // We still process initial auto-fit on collapsed windows to get a window width, but otherwise don't honor ImGuiWindowFlags_AlwaysAutoResize when collapsed.\n            if (!window_size_x_set_by_api && window->AutoFitFramesX > 0)\n            {\n                window->SizeFull.x = window->AutoFitOnlyGrows ? ImMax(window->SizeFull.x, size_auto_fit.x) : size_auto_fit.x;\n                use_current_size_for_scrollbar_x = true;\n            }\n            if (!window_size_y_set_by_api && window->AutoFitFramesY > 0)\n            {\n                window->SizeFull.y = window->AutoFitOnlyGrows ? ImMax(window->SizeFull.y, size_auto_fit.y) : size_auto_fit.y;\n                use_current_size_for_scrollbar_y = true;\n            }\n            if (!window->Collapsed)\n                MarkIniSettingsDirty(window);\n        }\n\n        // Apply minimum/maximum window size constraints and final size\n        window->SizeFull = CalcWindowSizeAfterConstraint(window, window->SizeFull);\n        window->Size = window->Collapsed && !(flags & ImGuiWindowFlags_ChildWindow) ? window->TitleBarRect().GetSize() : window->SizeFull;\n\n        // Decoration size\n        const float decoration_up_height = window->TitleBarHeight() + window->MenuBarHeight();\n\n        // POSITION\n\n        // Popup latch its initial position, will position itself when it appears next frame\n        if (window_just_activated_by_user)\n        {\n            window->AutoPosLastDirection = ImGuiDir_None;\n            if ((flags & ImGuiWindowFlags_Popup) != 0 && !(flags & ImGuiWindowFlags_Modal) && !window_pos_set_by_api) // FIXME: BeginPopup() could use SetNextWindowPos()\n                window->Pos = g.BeginPopupStack.back().OpenPopupPos;\n        }\n\n        // Position child window\n        if (flags & ImGuiWindowFlags_ChildWindow)\n        {\n            IM_ASSERT(parent_window && parent_window->Active);\n            window->BeginOrderWithinParent = (short)parent_window->DC.ChildWindows.Size;\n            parent_window->DC.ChildWindows.push_back(window);\n            if (!(flags & ImGuiWindowFlags_Popup) && !window_pos_set_by_api && !window_is_child_tooltip)\n                window->Pos = parent_window->DC.CursorPos;\n        }\n\n        const bool window_pos_with_pivot = (window->SetWindowPosVal.x != FLT_MAX && window->HiddenFramesCannotSkipItems == 0);\n        if (window_pos_with_pivot)\n            SetWindowPos(window, window->SetWindowPosVal - window->Size * window->SetWindowPosPivot, 0); // Position given a pivot (e.g. for centering)\n        else if ((flags & ImGuiWindowFlags_ChildMenu) != 0)\n            window->Pos = FindBestWindowPosForPopup(window);\n        else if ((flags & ImGuiWindowFlags_Popup) != 0 && !window_pos_set_by_api && window_just_appearing_after_hidden_for_resize)\n            window->Pos = FindBestWindowPosForPopup(window);\n        else if ((flags & ImGuiWindowFlags_Tooltip) != 0 && !window_pos_set_by_api && !window_is_child_tooltip)\n            window->Pos = FindBestWindowPosForPopup(window);\n\n        // Calculate the range of allowed position for that window (to be movable and visible past safe area padding)\n        // When clamping to stay visible, we will enforce that window->Pos stays inside of visibility_rect.\n        ImGuiViewportP* viewport = (ImGuiViewportP*)(void*)GetMainViewport();\n        ImRect viewport_rect(viewport->GetMainRect());\n        ImRect viewport_work_rect(viewport->GetWorkRect());\n        ImVec2 visibility_padding = ImMax(style.DisplayWindowPadding, style.DisplaySafeAreaPadding);\n        ImRect visibility_rect(viewport_work_rect.Min + visibility_padding, viewport_work_rect.Max - visibility_padding);\n\n        // Clamp position/size so window stays visible within its viewport or monitor\n        // Ignore zero-sized display explicitly to avoid losing positions if a window manager reports zero-sized window when initializing or minimizing.\n        if (!window_pos_set_by_api && !(flags & ImGuiWindowFlags_ChildWindow) && window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0)\n            if (viewport_rect.GetWidth() > 0.0f && viewport_rect.GetHeight() > 0.0f)\n                ClampWindowRect(window, visibility_rect);\n        window->Pos = ImFloor(window->Pos);\n\n        // Lock window rounding for the frame (so that altering them doesn't cause inconsistencies)\n        // Large values tend to lead to variety of artifacts and are not recommended.\n        window->WindowRounding = (flags & ImGuiWindowFlags_ChildWindow) ? style.ChildRounding : ((flags & ImGuiWindowFlags_Popup) && !(flags & ImGuiWindowFlags_Modal)) ? style.PopupRounding : style.WindowRounding;\n\n        // For windows with title bar or menu bar, we clamp to FrameHeight(FontSize + FramePadding.y * 2.0f) to completely hide artifacts.\n        //if ((window->Flags & ImGuiWindowFlags_MenuBar) || !(window->Flags & ImGuiWindowFlags_NoTitleBar))\n        //    window->WindowRounding = ImMin(window->WindowRounding, g.FontSize + style.FramePadding.y * 2.0f);\n\n        // Apply window focus (new and reactivated windows are moved to front)\n        bool want_focus = false;\n        if (window_just_activated_by_user && !(flags & ImGuiWindowFlags_NoFocusOnAppearing))\n        {\n            if (flags & ImGuiWindowFlags_Popup)\n                want_focus = true;\n            else if ((flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Tooltip)) == 0)\n                want_focus = true;\n        }\n\n        // Handle manual resize: Resize Grips, Borders, Gamepad\n        int border_held = -1;\n        ImU32 resize_grip_col[4] = {};\n        const int resize_grip_count = g.IO.ConfigWindowsResizeFromEdges ? 2 : 1; // Allow resize from lower-left if we have the mouse cursor feedback for it.\n        const float resize_grip_draw_size = IM_FLOOR(ImMax(g.FontSize * 1.10f, window->WindowRounding + 1.0f + g.FontSize * 0.2f));\n        if (!window->Collapsed)\n            if (UpdateWindowManualResize(window, size_auto_fit, &border_held, resize_grip_count, &resize_grip_col[0], visibility_rect))\n                use_current_size_for_scrollbar_x = use_current_size_for_scrollbar_y = true;\n        window->ResizeBorderHeld = (signed char)border_held;\n\n        // SCROLLBAR VISIBILITY\n\n        // Update scrollbar visibility (based on the Size that was effective during last frame or the auto-resized Size).\n        if (!window->Collapsed)\n        {\n            // When reading the current size we need to read it after size constraints have been applied.\n            // When we use InnerRect here we are intentionally reading last frame size, same for ScrollbarSizes values before we set them again.\n            ImVec2 avail_size_from_current_frame = ImVec2(window->SizeFull.x, window->SizeFull.y - decoration_up_height);\n            ImVec2 avail_size_from_last_frame = window->InnerRect.GetSize() + window->ScrollbarSizes;\n            ImVec2 needed_size_from_last_frame = window_just_created ? ImVec2(0, 0) : window->ContentSize + window->WindowPadding * 2.0f;\n            float size_x_for_scrollbars = use_current_size_for_scrollbar_x ? avail_size_from_current_frame.x : avail_size_from_last_frame.x;\n            float size_y_for_scrollbars = use_current_size_for_scrollbar_y ? avail_size_from_current_frame.y : avail_size_from_last_frame.y;\n            //bool scrollbar_y_from_last_frame = window->ScrollbarY; // FIXME: May want to use that in the ScrollbarX expression? How many pros vs cons?\n            window->ScrollbarY = (flags & ImGuiWindowFlags_AlwaysVerticalScrollbar) || ((needed_size_from_last_frame.y > size_y_for_scrollbars) && !(flags & ImGuiWindowFlags_NoScrollbar));\n            window->ScrollbarX = (flags & ImGuiWindowFlags_AlwaysHorizontalScrollbar) || ((needed_size_from_last_frame.x > size_x_for_scrollbars - (window->ScrollbarY ? style.ScrollbarSize : 0.0f)) && !(flags & ImGuiWindowFlags_NoScrollbar) && (flags & ImGuiWindowFlags_HorizontalScrollbar));\n            if (window->ScrollbarX && !window->ScrollbarY)\n                window->ScrollbarY = (needed_size_from_last_frame.y > size_y_for_scrollbars) && !(flags & ImGuiWindowFlags_NoScrollbar);\n            window->ScrollbarSizes = ImVec2(window->ScrollbarY ? style.ScrollbarSize : 0.0f, window->ScrollbarX ? style.ScrollbarSize : 0.0f);\n        }\n\n        // UPDATE RECTANGLES (1- THOSE NOT AFFECTED BY SCROLLING)\n        // Update various regions. Variables they depends on should be set above in this function.\n        // We set this up after processing the resize grip so that our rectangles doesn't lag by a frame.\n\n        // Outer rectangle\n        // Not affected by window border size. Used by:\n        // - FindHoveredWindow() (w/ extra padding when border resize is enabled)\n        // - Begin() initial clipping rect for drawing window background and borders.\n        // - Begin() clipping whole child\n        const ImRect host_rect = ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Popup) && !window_is_child_tooltip) ? parent_window->ClipRect : viewport_rect;\n        const ImRect outer_rect = window->Rect();\n        const ImRect title_bar_rect = window->TitleBarRect();\n        window->OuterRectClipped = outer_rect;\n        window->OuterRectClipped.ClipWith(host_rect);\n\n        // Inner rectangle\n        // Not affected by window border size. Used by:\n        // - InnerClipRect\n        // - ScrollToBringRectIntoView()\n        // - NavUpdatePageUpPageDown()\n        // - Scrollbar()\n        window->InnerRect.Min.x = window->Pos.x;\n        window->InnerRect.Min.y = window->Pos.y + decoration_up_height;\n        window->InnerRect.Max.x = window->Pos.x + window->Size.x - window->ScrollbarSizes.x;\n        window->InnerRect.Max.y = window->Pos.y + window->Size.y - window->ScrollbarSizes.y;\n\n        // Inner clipping rectangle.\n        // Will extend a little bit outside the normal work region.\n        // This is to allow e.g. Selectable or CollapsingHeader or some separators to cover that space.\n        // Force round operator last to ensure that e.g. (int)(max.x-min.x) in user's render code produce correct result.\n        // Note that if our window is collapsed we will end up with an inverted (~null) clipping rectangle which is the correct behavior.\n        // Affected by window/frame border size. Used by:\n        // - Begin() initial clip rect\n        float top_border_size = (((flags & ImGuiWindowFlags_MenuBar) || !(flags & ImGuiWindowFlags_NoTitleBar)) ? style.FrameBorderSize : window->WindowBorderSize);\n        window->InnerClipRect.Min.x = ImFloor(0.5f + window->InnerRect.Min.x + ImMax(ImFloor(window->WindowPadding.x * 0.5f), window->WindowBorderSize));\n        window->InnerClipRect.Min.y = ImFloor(0.5f + window->InnerRect.Min.y + top_border_size);\n        window->InnerClipRect.Max.x = ImFloor(0.5f + window->InnerRect.Max.x - ImMax(ImFloor(window->WindowPadding.x * 0.5f), window->WindowBorderSize));\n        window->InnerClipRect.Max.y = ImFloor(0.5f + window->InnerRect.Max.y - window->WindowBorderSize);\n        window->InnerClipRect.ClipWithFull(host_rect);\n\n        // Default item width. Make it proportional to window size if window manually resizes\n        if (window->Size.x > 0.0f && !(flags & ImGuiWindowFlags_Tooltip) && !(flags & ImGuiWindowFlags_AlwaysAutoResize))\n            window->ItemWidthDefault = ImFloor(window->Size.x * 0.65f);\n        else\n            window->ItemWidthDefault = ImFloor(g.FontSize * 16.0f);\n\n        // SCROLLING\n\n        // Lock down maximum scrolling\n        // The value of ScrollMax are ahead from ScrollbarX/ScrollbarY which is intentionally using InnerRect from previous rect in order to accommodate\n        // for right/bottom aligned items without creating a scrollbar.\n        window->ScrollMax.x = ImMax(0.0f, window->ContentSize.x + window->WindowPadding.x * 2.0f - window->InnerRect.GetWidth());\n        window->ScrollMax.y = ImMax(0.0f, window->ContentSize.y + window->WindowPadding.y * 2.0f - window->InnerRect.GetHeight());\n\n        // Apply scrolling\n        window->Scroll = CalcNextScrollFromScrollTargetAndClamp(window);\n        window->ScrollTarget = ImVec2(FLT_MAX, FLT_MAX);\n\n        // DRAWING\n\n        // Setup draw list and outer clipping rectangle\n        IM_ASSERT(window->DrawList->CmdBuffer.Size == 1 && window->DrawList->CmdBuffer[0].ElemCount == 0);\n        window->DrawList->PushTextureID(g.Font->ContainerAtlas->TexID);\n        PushClipRect(host_rect.Min, host_rect.Max, false);\n\n        // Draw modal window background (darkens what is behind them, all viewports)\n        const bool dim_bg_for_modal = (flags & ImGuiWindowFlags_Modal) && window == GetTopMostPopupModal() && window->HiddenFramesCannotSkipItems <= 0;\n        const bool dim_bg_for_window_list = g.NavWindowingTargetAnim && (window == g.NavWindowingTargetAnim->RootWindow);\n        if (dim_bg_for_modal || dim_bg_for_window_list)\n        {\n            const ImU32 dim_bg_col = GetColorU32(dim_bg_for_modal ? ImGuiCol_ModalWindowDimBg : ImGuiCol_NavWindowingDimBg, g.DimBgRatio);\n            window->DrawList->AddRectFilled(viewport_rect.Min, viewport_rect.Max, dim_bg_col);\n        }\n\n        // Draw navigation selection/windowing rectangle background\n        if (dim_bg_for_window_list && window == g.NavWindowingTargetAnim)\n        {\n            ImRect bb = window->Rect();\n            bb.Expand(g.FontSize);\n            if (!bb.Contains(viewport_rect)) // Avoid drawing if the window covers all the viewport anyway\n                window->DrawList->AddRectFilled(bb.Min, bb.Max, GetColorU32(ImGuiCol_NavWindowingHighlight, g.NavWindowingHighlightAlpha * 0.25f), g.Style.WindowRounding);\n        }\n\n        // Since 1.71, child window can render their decoration (bg color, border, scrollbars, etc.) within their parent to save a draw call.\n        // When using overlapping child windows, this will break the assumption that child z-order is mapped to submission order.\n        // We disable this when the parent window has zero vertices, which is a common pattern leading to laying out multiple overlapping child.\n        // We also disabled this when we have dimming overlay behind this specific one child.\n        // FIXME: More code may rely on explicit sorting of overlapping child window and would need to disable this somehow. Please get in contact if you are affected.\n        {\n            bool render_decorations_in_parent = false;\n            if ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Popup) && !window_is_child_tooltip)\n                if (window->DrawList->CmdBuffer.back().ElemCount == 0 && parent_window->DrawList->VtxBuffer.Size > 0)\n                    render_decorations_in_parent = true;\n            if (render_decorations_in_parent)\n                window->DrawList = parent_window->DrawList;\n\n            // Handle title bar, scrollbar, resize grips and resize borders\n            const ImGuiWindow* window_to_highlight = g.NavWindowingTarget ? g.NavWindowingTarget : g.NavWindow;\n            const bool title_bar_is_highlight = want_focus || (window_to_highlight && window->RootWindowForTitleBarHighlight == window_to_highlight->RootWindowForTitleBarHighlight);\n            RenderWindowDecorations(window, title_bar_rect, title_bar_is_highlight, resize_grip_count, resize_grip_col, resize_grip_draw_size);\n\n            if (render_decorations_in_parent)\n                window->DrawList = &window->DrawListInst;\n        }\n\n        // Draw navigation selection/windowing rectangle border\n        if (g.NavWindowingTargetAnim == window)\n        {\n            float rounding = ImMax(window->WindowRounding, g.Style.WindowRounding);\n            ImRect bb = window->Rect();\n            bb.Expand(g.FontSize);\n            if (bb.Contains(viewport_rect)) // If a window fits the entire viewport, adjust its highlight inward\n            {\n                bb.Expand(-g.FontSize - 1.0f);\n                rounding = window->WindowRounding;\n            }\n            window->DrawList->AddRect(bb.Min, bb.Max, GetColorU32(ImGuiCol_NavWindowingHighlight, g.NavWindowingHighlightAlpha), rounding, 0, 3.0f);\n        }\n\n        // UPDATE RECTANGLES (2- THOSE AFFECTED BY SCROLLING)\n\n        // Work rectangle.\n        // Affected by window padding and border size. Used by:\n        // - Columns() for right-most edge\n        // - TreeNode(), CollapsingHeader() for right-most edge\n        // - BeginTabBar() for right-most edge\n        const bool allow_scrollbar_x = !(flags & ImGuiWindowFlags_NoScrollbar) && (flags & ImGuiWindowFlags_HorizontalScrollbar);\n        const bool allow_scrollbar_y = !(flags & ImGuiWindowFlags_NoScrollbar);\n        const float work_rect_size_x = (window->ContentSizeExplicit.x != 0.0f ? window->ContentSizeExplicit.x : ImMax(allow_scrollbar_x ? window->ContentSize.x : 0.0f, window->Size.x - window->WindowPadding.x * 2.0f - window->ScrollbarSizes.x));\n        const float work_rect_size_y = (window->ContentSizeExplicit.y != 0.0f ? window->ContentSizeExplicit.y : ImMax(allow_scrollbar_y ? window->ContentSize.y : 0.0f, window->Size.y - window->WindowPadding.y * 2.0f - decoration_up_height - window->ScrollbarSizes.y));\n        window->WorkRect.Min.x = ImFloor(window->InnerRect.Min.x - window->Scroll.x + ImMax(window->WindowPadding.x, window->WindowBorderSize));\n        window->WorkRect.Min.y = ImFloor(window->InnerRect.Min.y - window->Scroll.y + ImMax(window->WindowPadding.y, window->WindowBorderSize));\n        window->WorkRect.Max.x = window->WorkRect.Min.x + work_rect_size_x;\n        window->WorkRect.Max.y = window->WorkRect.Min.y + work_rect_size_y;\n        window->ParentWorkRect = window->WorkRect;\n\n        // [LEGACY] Content Region\n        // FIXME-OBSOLETE: window->ContentRegionRect.Max is currently very misleading / partly faulty, but some BeginChild() patterns relies on it.\n        // Used by:\n        // - Mouse wheel scrolling + many other things\n        window->ContentRegionRect.Min.x = window->Pos.x - window->Scroll.x + window->WindowPadding.x;\n        window->ContentRegionRect.Min.y = window->Pos.y - window->Scroll.y + window->WindowPadding.y + decoration_up_height;\n        window->ContentRegionRect.Max.x = window->ContentRegionRect.Min.x + (window->ContentSizeExplicit.x != 0.0f ? window->ContentSizeExplicit.x : (window->Size.x - window->WindowPadding.x * 2.0f - window->ScrollbarSizes.x));\n        window->ContentRegionRect.Max.y = window->ContentRegionRect.Min.y + (window->ContentSizeExplicit.y != 0.0f ? window->ContentSizeExplicit.y : (window->Size.y - window->WindowPadding.y * 2.0f - decoration_up_height - window->ScrollbarSizes.y));\n\n        // Setup drawing context\n        // (NB: That term \"drawing context / DC\" lost its meaning a long time ago. Initially was meant to hold transient data only. Nowadays difference between window-> and window->DC-> is dubious.)\n        window->DC.Indent.x = 0.0f + window->WindowPadding.x - window->Scroll.x;\n        window->DC.GroupOffset.x = 0.0f;\n        window->DC.ColumnsOffset.x = 0.0f;\n        window->DC.CursorStartPos = window->Pos + ImVec2(window->DC.Indent.x + window->DC.ColumnsOffset.x, decoration_up_height + window->WindowPadding.y - window->Scroll.y);\n        window->DC.CursorPos = window->DC.CursorStartPos;\n        window->DC.CursorPosPrevLine = window->DC.CursorPos;\n        window->DC.CursorMaxPos = window->DC.CursorStartPos;\n        window->DC.IdealMaxPos = window->DC.CursorStartPos;\n        window->DC.CurrLineSize = window->DC.PrevLineSize = ImVec2(0.0f, 0.0f);\n        window->DC.CurrLineTextBaseOffset = window->DC.PrevLineTextBaseOffset = 0.0f;\n\n        window->DC.NavLayerCurrent = ImGuiNavLayer_Main;\n        window->DC.NavLayersActiveMask = window->DC.NavLayersActiveMaskNext;\n        window->DC.NavLayersActiveMaskNext = 0x00;\n        window->DC.NavHideHighlightOneFrame = false;\n        window->DC.NavHasScroll = (window->ScrollMax.y > 0.0f);\n\n        window->DC.MenuBarAppending = false;\n        window->DC.MenuColumns.Update(style.ItemSpacing.x, window_just_activated_by_user);\n        window->DC.TreeDepth = 0;\n        window->DC.TreeJumpToParentOnPopMask = 0x00;\n        window->DC.ChildWindows.resize(0);\n        window->DC.StateStorage = &window->StateStorage;\n        window->DC.CurrentColumns = NULL;\n        window->DC.LayoutType = ImGuiLayoutType_Vertical;\n        window->DC.ParentLayoutType = parent_window ? parent_window->DC.LayoutType : ImGuiLayoutType_Vertical;\n        window->DC.FocusCounterRegular = window->DC.FocusCounterTabStop = -1;\n\n        window->DC.ItemWidth = window->ItemWidthDefault;\n        window->DC.TextWrapPos = -1.0f; // disabled\n        window->DC.ItemWidthStack.resize(0);\n        window->DC.TextWrapPosStack.resize(0);\n\n        if (window->AutoFitFramesX > 0)\n            window->AutoFitFramesX--;\n        if (window->AutoFitFramesY > 0)\n            window->AutoFitFramesY--;\n\n        // Apply focus (we need to call FocusWindow() AFTER setting DC.CursorStartPos so our initial navigation reference rectangle can start around there)\n        if (want_focus)\n        {\n            FocusWindow(window);\n            NavInitWindow(window, false); // <-- this is in the way for us to be able to defer and sort reappearing FocusWindow() calls\n        }\n\n        // Title bar\n        if (!(flags & ImGuiWindowFlags_NoTitleBar))\n            RenderWindowTitleBarContents(window, ImRect(title_bar_rect.Min.x + window->WindowBorderSize, title_bar_rect.Min.y, title_bar_rect.Max.x - window->WindowBorderSize, title_bar_rect.Max.y), name, p_open);\n\n        // Clear hit test shape every frame\n        window->HitTestHoleSize.x = window->HitTestHoleSize.y = 0;\n\n        // Pressing CTRL+C while holding on a window copy its content to the clipboard\n        // This works but 1. doesn't handle multiple Begin/End pairs, 2. recursing into another Begin/End pair - so we need to work that out and add better logging scope.\n        // Maybe we can support CTRL+C on every element?\n        /*\n        //if (g.NavWindow == window && g.ActiveId == 0)\n        if (g.ActiveId == window->MoveId)\n            if (g.IO.KeyCtrl && IsKeyPressedMap(ImGuiKey_C))\n                LogToClipboard();\n        */\n\n        // We fill last item data based on Title Bar/Tab, in order for IsItemHovered() and IsItemActive() to be usable after Begin().\n        // This is useful to allow creating context menus on title bar only, etc.\n        g.LastItemData.ID = window->MoveId;\n        g.LastItemData.InFlags = g.CurrentItemFlags;\n        g.LastItemData.StatusFlags = IsMouseHoveringRect(title_bar_rect.Min, title_bar_rect.Max, false) ? ImGuiItemStatusFlags_HoveredRect : 0;\n        g.LastItemData.Rect = title_bar_rect;\n\n#ifdef IMGUI_ENABLE_TEST_ENGINE\n        if (!(window->Flags & ImGuiWindowFlags_NoTitleBar))\n            IMGUI_TEST_ENGINE_ITEM_ADD(g.LastItemData.Rect, g.LastItemData.ID);\n#endif\n    }\n    else\n    {\n        // Append\n        SetCurrentWindow(window);\n    }\n\n    // Pull/inherit current state\n    window->DC.NavFocusScopeIdCurrent = (flags & ImGuiWindowFlags_ChildWindow) ? parent_window->DC.NavFocusScopeIdCurrent : window->GetID(\"#FOCUSSCOPE\"); // Inherit from parent only // -V595\n\n    PushClipRect(window->InnerClipRect.Min, window->InnerClipRect.Max, true);\n\n    // Clear 'accessed' flag last thing (After PushClipRect which will set the flag. We want the flag to stay false when the default \"Debug\" window is unused)\n    window->WriteAccessed = false;\n    window->BeginCount++;\n    g.NextWindowData.ClearFlags();\n\n    // Update visibility\n    if (first_begin_of_the_frame)\n    {\n        if (flags & ImGuiWindowFlags_ChildWindow)\n        {\n            // Child window can be out of sight and have \"negative\" clip windows.\n            // Mark them as collapsed so commands are skipped earlier (we can't manually collapse them because they have no title bar).\n            IM_ASSERT((flags & ImGuiWindowFlags_NoTitleBar) != 0);\n            if (!(flags & ImGuiWindowFlags_AlwaysAutoResize) && window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0) // FIXME: Doesn't make sense for ChildWindow??\n                if (!g.LogEnabled)\n                    if (window->OuterRectClipped.Min.x >= window->OuterRectClipped.Max.x || window->OuterRectClipped.Min.y >= window->OuterRectClipped.Max.y)\n                        window->HiddenFramesCanSkipItems = 1;\n\n            // Hide along with parent or if parent is collapsed\n            if (parent_window && (parent_window->Collapsed || parent_window->HiddenFramesCanSkipItems > 0))\n                window->HiddenFramesCanSkipItems = 1;\n            if (parent_window && (parent_window->Collapsed || parent_window->HiddenFramesCannotSkipItems > 0))\n                window->HiddenFramesCannotSkipItems = 1;\n        }\n\n        // Don't render if style alpha is 0.0 at the time of Begin(). This is arbitrary and inconsistent but has been there for a long while (may remove at some point)\n        if (style.Alpha <= 0.0f)\n            window->HiddenFramesCanSkipItems = 1;\n\n        // Update the Hidden flag\n        window->Hidden = (window->HiddenFramesCanSkipItems > 0) || (window->HiddenFramesCannotSkipItems > 0) || (window->HiddenFramesForRenderOnly > 0);\n\n        // Disable inputs for requested number of frames\n        if (window->DisableInputsFrames > 0)\n        {\n            window->DisableInputsFrames--;\n            window->Flags |= ImGuiWindowFlags_NoInputs;\n        }\n\n        // Update the SkipItems flag, used to early out of all items functions (no layout required)\n        bool skip_items = false;\n        if (window->Collapsed || !window->Active || window->Hidden)\n            if (window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0 && window->HiddenFramesCannotSkipItems <= 0)\n                skip_items = true;\n        window->SkipItems = skip_items;\n    }\n\n    return !window->SkipItems;\n}\n\nvoid ImGui::End()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n\n    // Error checking: verify that user hasn't called End() too many times!\n    if (g.CurrentWindowStack.Size <= 1 && g.WithinFrameScopeWithImplicitWindow)\n    {\n        IM_ASSERT_USER_ERROR(g.CurrentWindowStack.Size > 1, \"Calling End() too many times!\");\n        return;\n    }\n    IM_ASSERT(g.CurrentWindowStack.Size > 0);\n\n    // Error checking: verify that user doesn't directly call End() on a child window.\n    if (window->Flags & ImGuiWindowFlags_ChildWindow)\n        IM_ASSERT_USER_ERROR(g.WithinEndChild, \"Must call EndChild() and not End()!\");\n\n    // Close anything that is open\n    if (window->DC.CurrentColumns)\n        EndColumns();\n    PopClipRect();   // Inner window clip rectangle\n\n    // Stop logging\n    if (!(window->Flags & ImGuiWindowFlags_ChildWindow))    // FIXME: add more options for scope of logging\n        LogFinish();\n\n    // Pop from window stack\n    g.LastItemData = g.CurrentWindowStack.back().ParentLastItemDataBackup;\n    g.CurrentWindowStack.pop_back();\n    if (window->Flags & ImGuiWindowFlags_Popup)\n        g.BeginPopupStack.pop_back();\n    window->DC.StackSizesOnBegin.CompareWithCurrentState();\n    SetCurrentWindow(g.CurrentWindowStack.Size == 0 ? NULL : g.CurrentWindowStack.back().Window);\n}\n\nvoid ImGui::BringWindowToFocusFront(ImGuiWindow* window)\n{\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(window == window->RootWindow);\n\n    const int cur_order = window->FocusOrder;\n    IM_ASSERT(g.WindowsFocusOrder[cur_order] == window);\n    if (g.WindowsFocusOrder.back() == window)\n        return;\n\n    const int new_order = g.WindowsFocusOrder.Size - 1;\n    for (int n = cur_order; n < new_order; n++)\n    {\n        g.WindowsFocusOrder[n] = g.WindowsFocusOrder[n + 1];\n        g.WindowsFocusOrder[n]->FocusOrder--;\n        IM_ASSERT(g.WindowsFocusOrder[n]->FocusOrder == n);\n    }\n    g.WindowsFocusOrder[new_order] = window;\n    window->FocusOrder = (short)new_order;\n}\n\nvoid ImGui::BringWindowToDisplayFront(ImGuiWindow* window)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* current_front_window = g.Windows.back();\n    if (current_front_window == window || current_front_window->RootWindow == window) // Cheap early out (could be better)\n        return;\n    for (int i = g.Windows.Size - 2; i >= 0; i--) // We can ignore the top-most window\n        if (g.Windows[i] == window)\n        {\n            memmove(&g.Windows[i], &g.Windows[i + 1], (size_t)(g.Windows.Size - i - 1) * sizeof(ImGuiWindow*));\n            g.Windows[g.Windows.Size - 1] = window;\n            break;\n        }\n}\n\nvoid ImGui::BringWindowToDisplayBack(ImGuiWindow* window)\n{\n    ImGuiContext& g = *GImGui;\n    if (g.Windows[0] == window)\n        return;\n    for (int i = 0; i < g.Windows.Size; i++)\n        if (g.Windows[i] == window)\n        {\n            memmove(&g.Windows[1], &g.Windows[0], (size_t)i * sizeof(ImGuiWindow*));\n            g.Windows[0] = window;\n            break;\n        }\n}\n\n// Moving window to front of display and set focus (which happens to be back of our sorted list)\nvoid ImGui::FocusWindow(ImGuiWindow* window)\n{\n    ImGuiContext& g = *GImGui;\n\n    if (g.NavWindow != window)\n    {\n        g.NavWindow = window;\n        if (window && g.NavDisableMouseHover)\n            g.NavMousePosDirty = true;\n        g.NavId = window ? window->NavLastIds[0] : 0; // Restore NavId\n        g.NavFocusScopeId = 0;\n        g.NavIdIsAlive = false;\n        g.NavLayer = ImGuiNavLayer_Main;\n        g.NavInitRequest = g.NavMoveRequest = false;\n        NavUpdateAnyRequestFlag();\n        //IMGUI_DEBUG_LOG(\"FocusWindow(\\\"%s\\\")\\n\", window ? window->Name : NULL);\n    }\n\n    // Close popups if any\n    ClosePopupsOverWindow(window, false);\n\n    // Move the root window to the top of the pile\n    IM_ASSERT(window == NULL || window->RootWindow != NULL);\n    ImGuiWindow* focus_front_window = window ? window->RootWindow : NULL; // NB: In docking branch this is window->RootWindowDockStop\n    ImGuiWindow* display_front_window = window ? window->RootWindow : NULL;\n\n    // Steal active widgets. Some of the cases it triggers includes:\n    // - Focus a window while an InputText in another window is active, if focus happens before the old InputText can run.\n    // - When using Nav to activate menu items (due to timing of activating on press->new window appears->losing ActiveId)\n    if (g.ActiveId != 0 && g.ActiveIdWindow && g.ActiveIdWindow->RootWindow != focus_front_window)\n        if (!g.ActiveIdNoClearOnFocusLoss)\n            ClearActiveID();\n\n    // Passing NULL allow to disable keyboard focus\n    if (!window)\n        return;\n\n    // Bring to front\n    BringWindowToFocusFront(focus_front_window);\n    if (((window->Flags | display_front_window->Flags) & ImGuiWindowFlags_NoBringToFrontOnFocus) == 0)\n        BringWindowToDisplayFront(display_front_window);\n}\n\nvoid ImGui::FocusTopMostWindowUnderOne(ImGuiWindow* under_this_window, ImGuiWindow* ignore_window)\n{\n    ImGuiContext& g = *GImGui;\n\n    const int start_idx = ((under_this_window != NULL) ? FindWindowFocusIndex(under_this_window) : g.WindowsFocusOrder.Size) - 1;\n    for (int i = start_idx; i >= 0; i--)\n    {\n        // We may later decide to test for different NoXXXInputs based on the active navigation input (mouse vs nav) but that may feel more confusing to the user.\n        ImGuiWindow* window = g.WindowsFocusOrder[i];\n        IM_ASSERT(window == window->RootWindow);\n        if (window != ignore_window && window->WasActive)\n            if ((window->Flags & (ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoNavInputs)) != (ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoNavInputs))\n            {\n                ImGuiWindow* focus_window = NavRestoreLastChildNavWindow(window);\n                FocusWindow(focus_window);\n                return;\n            }\n    }\n    FocusWindow(NULL);\n}\n\n// Important: this alone doesn't alter current ImDrawList state. This is called by PushFont/PopFont only.\nvoid ImGui::SetCurrentFont(ImFont* font)\n{\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(font && font->IsLoaded());    // Font Atlas not created. Did you call io.Fonts->GetTexDataAsRGBA32 / GetTexDataAsAlpha8 ?\n    IM_ASSERT(font->Scale > 0.0f);\n    g.Font = font;\n    g.FontBaseSize = ImMax(1.0f, g.IO.FontGlobalScale * g.Font->FontSize * g.Font->Scale);\n    g.FontSize = g.CurrentWindow ? g.CurrentWindow->CalcFontSize() : 0.0f;\n\n    ImFontAtlas* atlas = g.Font->ContainerAtlas;\n    g.DrawListSharedData.TexUvWhitePixel = atlas->TexUvWhitePixel;\n    g.DrawListSharedData.TexUvLines = atlas->TexUvLines;\n    g.DrawListSharedData.Font = g.Font;\n    g.DrawListSharedData.FontSize = g.FontSize;\n}\n\nvoid ImGui::PushFont(ImFont* font)\n{\n    ImGuiContext& g = *GImGui;\n    if (!font)\n        font = GetDefaultFont();\n    SetCurrentFont(font);\n    g.FontStack.push_back(font);\n    g.CurrentWindow->DrawList->PushTextureID(font->ContainerAtlas->TexID);\n}\n\nvoid  ImGui::PopFont()\n{\n    ImGuiContext& g = *GImGui;\n    g.CurrentWindow->DrawList->PopTextureID();\n    g.FontStack.pop_back();\n    SetCurrentFont(g.FontStack.empty() ? GetDefaultFont() : g.FontStack.back());\n}\n\nvoid ImGui::PushItemFlag(ImGuiItemFlags option, bool enabled)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiItemFlags item_flags = g.CurrentItemFlags;\n    IM_ASSERT(item_flags == g.ItemFlagsStack.back());\n    if (enabled)\n        item_flags |= option;\n    else\n        item_flags &= ~option;\n    g.CurrentItemFlags = item_flags;\n    g.ItemFlagsStack.push_back(item_flags);\n}\n\nvoid ImGui::PopItemFlag()\n{\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(g.ItemFlagsStack.Size > 1); // Too many calls to PopItemFlag() - we always leave a 0 at the bottom of the stack.\n    g.ItemFlagsStack.pop_back();\n    g.CurrentItemFlags = g.ItemFlagsStack.back();\n}\n\n// BeginDisabled()/EndDisabled()\n// - Those can be nested but this cannot be used to enable an already disabled section (a single BeginDisabled(true) in the stack is enough to keep things disabled)\n// - Visually this is currently altering alpha, but it is expected that in a future styling system this would work differently.\n// - Feedback welcome at https://github.com/ocornut/imgui/issues/211\n// - BeginDisabled(false) essentially does nothing useful but is provided to facilitate use of boolean expressions. If you can avoid calling BeginDisabled(False)/EndDisabled() best to avoid it.\n// - Optimized shortcuts instead of PushStyleVar() + PushItemFlag()\nvoid ImGui::BeginDisabled(bool disabled)\n{\n    ImGuiContext& g = *GImGui;\n    bool was_disabled = (g.CurrentItemFlags & ImGuiItemFlags_Disabled) != 0;\n    if (!was_disabled && disabled)\n    {\n        g.DisabledAlphaBackup = g.Style.Alpha;\n        g.Style.Alpha *= g.Style.DisabledAlpha; // PushStyleVar(ImGuiStyleVar_Alpha, g.Style.Alpha * g.Style.DisabledAlpha);\n    }\n    if (was_disabled || disabled)\n        g.CurrentItemFlags |= ImGuiItemFlags_Disabled;\n    g.ItemFlagsStack.push_back(g.CurrentItemFlags);\n}\n\nvoid ImGui::EndDisabled()\n{\n    ImGuiContext& g = *GImGui;\n    bool was_disabled = (g.CurrentItemFlags & ImGuiItemFlags_Disabled) != 0;\n    //PopItemFlag();\n    g.ItemFlagsStack.pop_back();\n    g.CurrentItemFlags = g.ItemFlagsStack.back();\n    if (was_disabled && (g.CurrentItemFlags & ImGuiItemFlags_Disabled) == 0)\n        g.Style.Alpha = g.DisabledAlphaBackup; //PopStyleVar();\n}\n\n// FIXME: Look into renaming this once we have settled the new Focus/Activation/TabStop system.\nvoid ImGui::PushAllowKeyboardFocus(bool allow_keyboard_focus)\n{\n    PushItemFlag(ImGuiItemFlags_NoTabStop, !allow_keyboard_focus);\n}\n\nvoid ImGui::PopAllowKeyboardFocus()\n{\n    PopItemFlag();\n}\n\nvoid ImGui::PushButtonRepeat(bool repeat)\n{\n    PushItemFlag(ImGuiItemFlags_ButtonRepeat, repeat);\n}\n\nvoid ImGui::PopButtonRepeat()\n{\n    PopItemFlag();\n}\n\nvoid ImGui::PushTextWrapPos(float wrap_pos_x)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    window->DC.TextWrapPosStack.push_back(window->DC.TextWrapPos);\n    window->DC.TextWrapPos = wrap_pos_x;\n}\n\nvoid ImGui::PopTextWrapPos()\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    window->DC.TextWrapPos = window->DC.TextWrapPosStack.back();\n    window->DC.TextWrapPosStack.pop_back();\n}\n\nbool ImGui::IsWindowChildOf(ImGuiWindow* window, ImGuiWindow* potential_parent)\n{\n    if (window->RootWindow == potential_parent)\n        return true;\n    while (window != NULL)\n    {\n        if (window == potential_parent)\n            return true;\n        window = window->ParentWindow;\n    }\n    return false;\n}\n\nbool ImGui::IsWindowAbove(ImGuiWindow* potential_above, ImGuiWindow* potential_below)\n{\n    ImGuiContext& g = *GImGui;\n    for (int i = g.Windows.Size - 1; i >= 0; i--)\n    {\n        ImGuiWindow* candidate_window = g.Windows[i];\n        if (candidate_window == potential_above)\n            return true;\n        if (candidate_window == potential_below)\n            return false;\n    }\n    return false;\n}\n\nbool ImGui::IsWindowHovered(ImGuiHoveredFlags flags)\n{\n    IM_ASSERT((flags & ImGuiHoveredFlags_AllowWhenOverlapped) == 0);   // Flags not supported by this function\n    ImGuiContext& g = *GImGui;\n    if (g.HoveredWindow == NULL)\n        return false;\n\n    if ((flags & ImGuiHoveredFlags_AnyWindow) == 0)\n    {\n        ImGuiWindow* window = g.CurrentWindow;\n        switch (flags & (ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows))\n        {\n        case ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows:\n            if (g.HoveredWindow->RootWindow != window->RootWindow)\n                return false;\n            break;\n        case ImGuiHoveredFlags_RootWindow:\n            if (g.HoveredWindow != window->RootWindow)\n                return false;\n            break;\n        case ImGuiHoveredFlags_ChildWindows:\n            if (!IsWindowChildOf(g.HoveredWindow, window))\n                return false;\n            break;\n        default:\n            if (g.HoveredWindow != window)\n                return false;\n            break;\n        }\n    }\n\n    if (!IsWindowContentHoverable(g.HoveredWindow, flags))\n        return false;\n    if (!(flags & ImGuiHoveredFlags_AllowWhenBlockedByActiveItem))\n        if (g.ActiveId != 0 && !g.ActiveIdAllowOverlap && g.ActiveId != g.HoveredWindow->MoveId)\n            return false;\n    return true;\n}\n\nbool ImGui::IsWindowFocused(ImGuiFocusedFlags flags)\n{\n    ImGuiContext& g = *GImGui;\n\n    if (flags & ImGuiFocusedFlags_AnyWindow)\n        return g.NavWindow != NULL;\n\n    IM_ASSERT(g.CurrentWindow);     // Not inside a Begin()/End()\n    switch (flags & (ImGuiFocusedFlags_RootWindow | ImGuiFocusedFlags_ChildWindows))\n    {\n    case ImGuiFocusedFlags_RootWindow | ImGuiFocusedFlags_ChildWindows:\n        return g.NavWindow && g.NavWindow->RootWindow == g.CurrentWindow->RootWindow;\n    case ImGuiFocusedFlags_RootWindow:\n        return g.NavWindow == g.CurrentWindow->RootWindow;\n    case ImGuiFocusedFlags_ChildWindows:\n        return g.NavWindow && IsWindowChildOf(g.NavWindow, g.CurrentWindow);\n    default:\n        return g.NavWindow == g.CurrentWindow;\n    }\n}\n\n// Can we focus this window with CTRL+TAB (or PadMenu + PadFocusPrev/PadFocusNext)\n// Note that NoNavFocus makes the window not reachable with CTRL+TAB but it can still be focused with mouse or programmatically.\n// If you want a window to never be focused, you may use the e.g. NoInputs flag.\nbool ImGui::IsWindowNavFocusable(ImGuiWindow* window)\n{\n    return window->WasActive && window == window->RootWindow && !(window->Flags & ImGuiWindowFlags_NoNavFocus);\n}\n\nfloat ImGui::GetWindowWidth()\n{\n    ImGuiWindow* window = GImGui->CurrentWindow;\n    return window->Size.x;\n}\n\nfloat ImGui::GetWindowHeight()\n{\n    ImGuiWindow* window = GImGui->CurrentWindow;\n    return window->Size.y;\n}\n\nImVec2 ImGui::GetWindowPos()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    return window->Pos;\n}\n\nvoid ImGui::SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiCond cond)\n{\n    // Test condition (NB: bit 0 is always true) and clear flags for next time\n    if (cond && (window->SetWindowPosAllowFlags & cond) == 0)\n        return;\n\n    IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond)); // Make sure the user doesn't attempt to combine multiple condition flags.\n    window->SetWindowPosAllowFlags &= ~(ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing);\n    window->SetWindowPosVal = ImVec2(FLT_MAX, FLT_MAX);\n\n    // Set\n    const ImVec2 old_pos = window->Pos;\n    window->Pos = ImFloor(pos);\n    ImVec2 offset = window->Pos - old_pos;\n    window->DC.CursorPos += offset;         // As we happen to move the window while it is being appended to (which is a bad idea - will smear) let's at least offset the cursor\n    window->DC.CursorMaxPos += offset;      // And more importantly we need to offset CursorMaxPos/CursorStartPos this so ContentSize calculation doesn't get affected.\n    window->DC.IdealMaxPos += offset;\n    window->DC.CursorStartPos += offset;\n}\n\nvoid ImGui::SetWindowPos(const ImVec2& pos, ImGuiCond cond)\n{\n    ImGuiWindow* window = GetCurrentWindowRead();\n    SetWindowPos(window, pos, cond);\n}\n\nvoid ImGui::SetWindowPos(const char* name, const ImVec2& pos, ImGuiCond cond)\n{\n    if (ImGuiWindow* window = FindWindowByName(name))\n        SetWindowPos(window, pos, cond);\n}\n\nImVec2 ImGui::GetWindowSize()\n{\n    ImGuiWindow* window = GetCurrentWindowRead();\n    return window->Size;\n}\n\nvoid ImGui::SetWindowSize(ImGuiWindow* window, const ImVec2& size, ImGuiCond cond)\n{\n    // Test condition (NB: bit 0 is always true) and clear flags for next time\n    if (cond && (window->SetWindowSizeAllowFlags & cond) == 0)\n        return;\n\n    IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond)); // Make sure the user doesn't attempt to combine multiple condition flags.\n    window->SetWindowSizeAllowFlags &= ~(ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing);\n\n    // Set\n    if (size.x > 0.0f)\n    {\n        window->AutoFitFramesX = 0;\n        window->SizeFull.x = IM_FLOOR(size.x);\n    }\n    else\n    {\n        window->AutoFitFramesX = 2;\n        window->AutoFitOnlyGrows = false;\n    }\n    if (size.y > 0.0f)\n    {\n        window->AutoFitFramesY = 0;\n        window->SizeFull.y = IM_FLOOR(size.y);\n    }\n    else\n    {\n        window->AutoFitFramesY = 2;\n        window->AutoFitOnlyGrows = false;\n    }\n}\n\nvoid ImGui::SetWindowSize(const ImVec2& size, ImGuiCond cond)\n{\n    SetWindowSize(GImGui->CurrentWindow, size, cond);\n}\n\nvoid ImGui::SetWindowSize(const char* name, const ImVec2& size, ImGuiCond cond)\n{\n    if (ImGuiWindow* window = FindWindowByName(name))\n        SetWindowSize(window, size, cond);\n}\n\nvoid ImGui::SetWindowCollapsed(ImGuiWindow* window, bool collapsed, ImGuiCond cond)\n{\n    // Test condition (NB: bit 0 is always true) and clear flags for next time\n    if (cond && (window->SetWindowCollapsedAllowFlags & cond) == 0)\n        return;\n    window->SetWindowCollapsedAllowFlags &= ~(ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing);\n\n    // Set\n    window->Collapsed = collapsed;\n}\n\nvoid ImGui::SetWindowHitTestHole(ImGuiWindow* window, const ImVec2& pos, const ImVec2& size)\n{\n    IM_ASSERT(window->HitTestHoleSize.x == 0);     // We don't support multiple holes/hit test filters\n    window->HitTestHoleSize = ImVec2ih(size);\n    window->HitTestHoleOffset = ImVec2ih(pos - window->Pos);\n}\n\nvoid ImGui::SetWindowCollapsed(bool collapsed, ImGuiCond cond)\n{\n    SetWindowCollapsed(GImGui->CurrentWindow, collapsed, cond);\n}\n\nbool ImGui::IsWindowCollapsed()\n{\n    ImGuiWindow* window = GetCurrentWindowRead();\n    return window->Collapsed;\n}\n\nbool ImGui::IsWindowAppearing()\n{\n    ImGuiWindow* window = GetCurrentWindowRead();\n    return window->Appearing;\n}\n\nvoid ImGui::SetWindowCollapsed(const char* name, bool collapsed, ImGuiCond cond)\n{\n    if (ImGuiWindow* window = FindWindowByName(name))\n        SetWindowCollapsed(window, collapsed, cond);\n}\n\nvoid ImGui::SetWindowFocus()\n{\n    FocusWindow(GImGui->CurrentWindow);\n}\n\nvoid ImGui::SetWindowFocus(const char* name)\n{\n    if (name)\n    {\n        if (ImGuiWindow* window = FindWindowByName(name))\n            FocusWindow(window);\n    }\n    else\n    {\n        FocusWindow(NULL);\n    }\n}\n\nvoid ImGui::SetNextWindowPos(const ImVec2& pos, ImGuiCond cond, const ImVec2& pivot)\n{\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond)); // Make sure the user doesn't attempt to combine multiple condition flags.\n    g.NextWindowData.Flags |= ImGuiNextWindowDataFlags_HasPos;\n    g.NextWindowData.PosVal = pos;\n    g.NextWindowData.PosPivotVal = pivot;\n    g.NextWindowData.PosCond = cond ? cond : ImGuiCond_Always;\n}\n\nvoid ImGui::SetNextWindowSize(const ImVec2& size, ImGuiCond cond)\n{\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond)); // Make sure the user doesn't attempt to combine multiple condition flags.\n    g.NextWindowData.Flags |= ImGuiNextWindowDataFlags_HasSize;\n    g.NextWindowData.SizeVal = size;\n    g.NextWindowData.SizeCond = cond ? cond : ImGuiCond_Always;\n}\n\nvoid ImGui::SetNextWindowSizeConstraints(const ImVec2& size_min, const ImVec2& size_max, ImGuiSizeCallback custom_callback, void* custom_callback_user_data)\n{\n    ImGuiContext& g = *GImGui;\n    g.NextWindowData.Flags |= ImGuiNextWindowDataFlags_HasSizeConstraint;\n    g.NextWindowData.SizeConstraintRect = ImRect(size_min, size_max);\n    g.NextWindowData.SizeCallback = custom_callback;\n    g.NextWindowData.SizeCallbackUserData = custom_callback_user_data;\n}\n\n// Content size = inner scrollable rectangle, padded with WindowPadding.\n// SetNextWindowContentSize(ImVec2(100,100) + ImGuiWindowFlags_AlwaysAutoResize will always allow submitting a 100x100 item.\nvoid ImGui::SetNextWindowContentSize(const ImVec2& size)\n{\n    ImGuiContext& g = *GImGui;\n    g.NextWindowData.Flags |= ImGuiNextWindowDataFlags_HasContentSize;\n    g.NextWindowData.ContentSizeVal = ImFloor(size);\n}\n\nvoid ImGui::SetNextWindowScroll(const ImVec2& scroll)\n{\n    ImGuiContext& g = *GImGui;\n    g.NextWindowData.Flags |= ImGuiNextWindowDataFlags_HasScroll;\n    g.NextWindowData.ScrollVal = scroll;\n}\n\nvoid ImGui::SetNextWindowCollapsed(bool collapsed, ImGuiCond cond)\n{\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond)); // Make sure the user doesn't attempt to combine multiple condition flags.\n    g.NextWindowData.Flags |= ImGuiNextWindowDataFlags_HasCollapsed;\n    g.NextWindowData.CollapsedVal = collapsed;\n    g.NextWindowData.CollapsedCond = cond ? cond : ImGuiCond_Always;\n}\n\nvoid ImGui::SetNextWindowFocus()\n{\n    ImGuiContext& g = *GImGui;\n    g.NextWindowData.Flags |= ImGuiNextWindowDataFlags_HasFocus;\n}\n\nvoid ImGui::SetNextWindowBgAlpha(float alpha)\n{\n    ImGuiContext& g = *GImGui;\n    g.NextWindowData.Flags |= ImGuiNextWindowDataFlags_HasBgAlpha;\n    g.NextWindowData.BgAlphaVal = alpha;\n}\n\nImDrawList* ImGui::GetWindowDrawList()\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    return window->DrawList;\n}\n\nImFont* ImGui::GetFont()\n{\n    return GImGui->Font;\n}\n\nfloat ImGui::GetFontSize()\n{\n    return GImGui->FontSize;\n}\n\nImVec2 ImGui::GetFontTexUvWhitePixel()\n{\n    return GImGui->DrawListSharedData.TexUvWhitePixel;\n}\n\nvoid ImGui::SetWindowFontScale(float scale)\n{\n    IM_ASSERT(scale > 0.0f);\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = GetCurrentWindow();\n    window->FontWindowScale = scale;\n    g.FontSize = g.DrawListSharedData.FontSize = window->CalcFontSize();\n}\n\nvoid ImGui::ActivateItem(ImGuiID id)\n{\n    ImGuiContext& g = *GImGui;\n    g.NavNextActivateId = id;\n}\n\nvoid ImGui::PushFocusScope(ImGuiID id)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    g.FocusScopeStack.push_back(window->DC.NavFocusScopeIdCurrent);\n    window->DC.NavFocusScopeIdCurrent = id;\n}\n\nvoid ImGui::PopFocusScope()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    IM_ASSERT(g.FocusScopeStack.Size > 0); // Too many PopFocusScope() ?\n    window->DC.NavFocusScopeIdCurrent = g.FocusScopeStack.back();\n    g.FocusScopeStack.pop_back();\n}\n\nvoid ImGui::SetKeyboardFocusHere(int offset)\n{\n    IM_ASSERT(offset >= -1);    // -1 is allowed but not below\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    g.TabFocusRequestNextWindow = window;\n    g.TabFocusRequestNextCounterRegular = window->DC.FocusCounterRegular + 1 + offset;\n    g.TabFocusRequestNextCounterTabStop = INT_MAX;\n}\n\nvoid ImGui::SetItemDefaultFocus()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    if (!window->Appearing)\n        return;\n    if (g.NavWindow == window->RootWindowForNav && (g.NavInitRequest || g.NavInitResultId != 0) && g.NavLayer == window->DC.NavLayerCurrent)\n    {\n        g.NavInitRequest = false;\n        g.NavInitResultId = g.LastItemData.ID;\n        g.NavInitResultRectRel = ImRect(g.LastItemData.Rect.Min - window->Pos, g.LastItemData.Rect.Max - window->Pos);\n        NavUpdateAnyRequestFlag();\n        if (!IsItemVisible())\n            SetScrollHereY();\n    }\n}\n\nvoid ImGui::SetStateStorage(ImGuiStorage* tree)\n{\n    ImGuiWindow* window = GImGui->CurrentWindow;\n    window->DC.StateStorage = tree ? tree : &window->StateStorage;\n}\n\nImGuiStorage* ImGui::GetStateStorage()\n{\n    ImGuiWindow* window = GImGui->CurrentWindow;\n    return window->DC.StateStorage;\n}\n\nvoid ImGui::PushID(const char* str_id)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    ImGuiID id = window->GetIDNoKeepAlive(str_id);\n    window->IDStack.push_back(id);\n}\n\nvoid ImGui::PushID(const char* str_id_begin, const char* str_id_end)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    ImGuiID id = window->GetIDNoKeepAlive(str_id_begin, str_id_end);\n    window->IDStack.push_back(id);\n}\n\nvoid ImGui::PushID(const void* ptr_id)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    ImGuiID id = window->GetIDNoKeepAlive(ptr_id);\n    window->IDStack.push_back(id);\n}\n\nvoid ImGui::PushID(int int_id)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    ImGuiID id = window->GetIDNoKeepAlive(int_id);\n    window->IDStack.push_back(id);\n}\n\n// Push a given id value ignoring the ID stack as a seed.\nvoid ImGui::PushOverrideID(ImGuiID id)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    window->IDStack.push_back(id);\n}\n\n// Helper to avoid a common series of PushOverrideID -> GetID() -> PopID() call\n// (note that when using this pattern, TestEngine's \"Stack Tool\" will tend to not display the intermediate stack level.\n//  for that to work we would need to do PushOverrideID() -> ItemAdd() -> PopID() which would alter widget code a little more)\nImGuiID ImGui::GetIDWithSeed(const char* str, const char* str_end, ImGuiID seed)\n{\n    ImGuiID id = ImHashStr(str, str_end ? (str_end - str) : 0, seed);\n    ImGui::KeepAliveID(id);\n#ifdef IMGUI_ENABLE_TEST_ENGINE\n    ImGuiContext& g = *GImGui;\n    IMGUI_TEST_ENGINE_ID_INFO2(id, ImGuiDataType_String, str, str_end);\n#endif\n    return id;\n}\n\nvoid ImGui::PopID()\n{\n    ImGuiWindow* window = GImGui->CurrentWindow;\n    IM_ASSERT(window->IDStack.Size > 1); // Too many PopID(), or could be popping in a wrong/different window?\n    window->IDStack.pop_back();\n}\n\nImGuiID ImGui::GetID(const char* str_id)\n{\n    ImGuiWindow* window = GImGui->CurrentWindow;\n    return window->GetID(str_id);\n}\n\nImGuiID ImGui::GetID(const char* str_id_begin, const char* str_id_end)\n{\n    ImGuiWindow* window = GImGui->CurrentWindow;\n    return window->GetID(str_id_begin, str_id_end);\n}\n\nImGuiID ImGui::GetID(const void* ptr_id)\n{\n    ImGuiWindow* window = GImGui->CurrentWindow;\n    return window->GetID(ptr_id);\n}\n\nbool ImGui::IsRectVisible(const ImVec2& size)\n{\n    ImGuiWindow* window = GImGui->CurrentWindow;\n    return window->ClipRect.Overlaps(ImRect(window->DC.CursorPos, window->DC.CursorPos + size));\n}\n\nbool ImGui::IsRectVisible(const ImVec2& rect_min, const ImVec2& rect_max)\n{\n    ImGuiWindow* window = GImGui->CurrentWindow;\n    return window->ClipRect.Overlaps(ImRect(rect_min, rect_max));\n}\n\n\n//-----------------------------------------------------------------------------\n// [SECTION] ERROR CHECKING\n//-----------------------------------------------------------------------------\n\n// Helper function to verify ABI compatibility between caller code and compiled version of Dear ImGui.\n// Verify that the type sizes are matching between the calling file's compilation unit and imgui.cpp's compilation unit\n// If the user has inconsistent compilation settings, imgui configuration #define, packing pragma, etc. your user code\n// may see different structures than what imgui.cpp sees, which is problematic.\n// We usually require settings to be in imconfig.h to make sure that they are accessible to all compilation units involved with Dear ImGui.\nbool ImGui::DebugCheckVersionAndDataLayout(const char* version, size_t sz_io, size_t sz_style, size_t sz_vec2, size_t sz_vec4, size_t sz_vert, size_t sz_idx)\n{\n    bool error = false;\n    if (strcmp(version, IMGUI_VERSION) != 0) { error = true; IM_ASSERT(strcmp(version, IMGUI_VERSION) == 0 && \"Mismatched version string!\"); }\n    if (sz_io != sizeof(ImGuiIO)) { error = true; IM_ASSERT(sz_io == sizeof(ImGuiIO) && \"Mismatched struct layout!\"); }\n    if (sz_style != sizeof(ImGuiStyle)) { error = true; IM_ASSERT(sz_style == sizeof(ImGuiStyle) && \"Mismatched struct layout!\"); }\n    if (sz_vec2 != sizeof(ImVec2)) { error = true; IM_ASSERT(sz_vec2 == sizeof(ImVec2) && \"Mismatched struct layout!\"); }\n    if (sz_vec4 != sizeof(ImVec4)) { error = true; IM_ASSERT(sz_vec4 == sizeof(ImVec4) && \"Mismatched struct layout!\"); }\n    if (sz_vert != sizeof(ImDrawVert)) { error = true; IM_ASSERT(sz_vert == sizeof(ImDrawVert) && \"Mismatched struct layout!\"); }\n    if (sz_idx != sizeof(ImDrawIdx)) { error = true; IM_ASSERT(sz_idx == sizeof(ImDrawIdx) && \"Mismatched struct layout!\"); }\n    return !error;\n}\n\nstatic void ImGui::ErrorCheckNewFrameSanityChecks()\n{\n    ImGuiContext& g = *GImGui;\n\n    // Check user IM_ASSERT macro\n    // (IF YOU GET A WARNING OR COMPILE ERROR HERE: it means your assert macro is incorrectly defined!\n    //  If your macro uses multiple statements, it NEEDS to be surrounded by a 'do { ... } while (0)' block.\n    //  This is a common C/C++ idiom to allow multiple statements macros to be used in control flow blocks.)\n    // #define IM_ASSERT(EXPR)   if (SomeCode(EXPR)) SomeMoreCode();                    // Wrong!\n    // #define IM_ASSERT(EXPR)   do { if (SomeCode(EXPR)) SomeMoreCode(); } while (0)   // Correct!\n    if (true) IM_ASSERT(1); else IM_ASSERT(0);\n\n    // Check user data\n    // (We pass an error message in the assert expression to make it visible to programmers who are not using a debugger, as most assert handlers display their argument)\n    IM_ASSERT(g.Initialized);\n    IM_ASSERT((g.IO.DeltaTime > 0.0f || g.FrameCount == 0)              && \"Need a positive DeltaTime!\");\n    IM_ASSERT((g.FrameCount == 0 || g.FrameCountEnded == g.FrameCount)  && \"Forgot to call Render() or EndFrame() at the end of the previous frame?\");\n    IM_ASSERT(g.IO.DisplaySize.x >= 0.0f && g.IO.DisplaySize.y >= 0.0f  && \"Invalid DisplaySize value!\");\n    IM_ASSERT(g.IO.Fonts->IsBuilt()                                     && \"Font Atlas not built! Make sure you called ImGui_ImplXXXX_NewFrame() function for renderer backend, which should call io.Fonts->GetTexDataAsRGBA32() / GetTexDataAsAlpha8()\");\n    IM_ASSERT(g.Style.CurveTessellationTol > 0.0f                       && \"Invalid style setting!\");\n    IM_ASSERT(g.Style.CircleTessellationMaxError  > 0.0f                && \"Invalid style setting!\");\n    IM_ASSERT(g.Style.Alpha >= 0.0f && g.Style.Alpha <= 1.0f            && \"Invalid style setting!\"); // Allows us to avoid a few clamps in color computations\n    IM_ASSERT(g.Style.WindowMinSize.x >= 1.0f && g.Style.WindowMinSize.y >= 1.0f && \"Invalid style setting.\");\n    IM_ASSERT(g.Style.WindowMenuButtonPosition == ImGuiDir_None || g.Style.WindowMenuButtonPosition == ImGuiDir_Left || g.Style.WindowMenuButtonPosition == ImGuiDir_Right);\n    for (int n = 0; n < ImGuiKey_COUNT; n++)\n        IM_ASSERT(g.IO.KeyMap[n] >= -1 && g.IO.KeyMap[n] < IM_ARRAYSIZE(g.IO.KeysDown) && \"io.KeyMap[] contains an out of bound value (need to be 0..512, or -1 for unmapped key)\");\n\n    // Check: required key mapping (we intentionally do NOT check all keys to not pressure user into setting up everything, but Space is required and was only added in 1.60 WIP)\n    if (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard)\n        IM_ASSERT(g.IO.KeyMap[ImGuiKey_Space] != -1 && \"ImGuiKey_Space is not mapped, required for keyboard navigation.\");\n\n    // Check: the io.ConfigWindowsResizeFromEdges option requires backend to honor mouse cursor changes and set the ImGuiBackendFlags_HasMouseCursors flag accordingly.\n    if (g.IO.ConfigWindowsResizeFromEdges && !(g.IO.BackendFlags & ImGuiBackendFlags_HasMouseCursors))\n        g.IO.ConfigWindowsResizeFromEdges = false;\n}\n\nstatic void ImGui::ErrorCheckEndFrameSanityChecks()\n{\n    ImGuiContext& g = *GImGui;\n\n    // Verify that io.KeyXXX fields haven't been tampered with. Key mods should not be modified between NewFrame() and EndFrame()\n    // One possible reason leading to this assert is that your backends update inputs _AFTER_ NewFrame().\n    // It is known that when some modal native windows called mid-frame takes focus away, some backends such as GLFW will\n    // send key release events mid-frame. This would normally trigger this assertion and lead to sheared inputs.\n    // We silently accommodate for this case by ignoring/ the case where all io.KeyXXX modifiers were released (aka key_mod_flags == 0),\n    // while still correctly asserting on mid-frame key press events.\n    const ImGuiKeyModFlags key_mod_flags = GetMergedKeyModFlags();\n    IM_ASSERT((key_mod_flags == 0 || g.IO.KeyMods == key_mod_flags) && \"Mismatching io.KeyCtrl/io.KeyShift/io.KeyAlt/io.KeySuper vs io.KeyMods\");\n    IM_UNUSED(key_mod_flags);\n\n    // Recover from errors\n    //ErrorCheckEndFrameRecover();\n\n    // Report when there is a mismatch of Begin/BeginChild vs End/EndChild calls. Important: Remember that the Begin/BeginChild API requires you\n    // to always call End/EndChild even if Begin/BeginChild returns false! (this is unfortunately inconsistent with most other Begin* API).\n    if (g.CurrentWindowStack.Size != 1)\n    {\n        if (g.CurrentWindowStack.Size > 1)\n        {\n            IM_ASSERT_USER_ERROR(g.CurrentWindowStack.Size == 1, \"Mismatched Begin/BeginChild vs End/EndChild calls: did you forget to call End/EndChild?\");\n            while (g.CurrentWindowStack.Size > 1)\n                End();\n        }\n        else\n        {\n            IM_ASSERT_USER_ERROR(g.CurrentWindowStack.Size == 1, \"Mismatched Begin/BeginChild vs End/EndChild calls: did you call End/EndChild too much?\");\n        }\n    }\n\n    IM_ASSERT_USER_ERROR(g.GroupStack.Size == 0, \"Missing EndGroup call!\");\n}\n\n// Experimental recovery from incorrect usage of BeginXXX/EndXXX/PushXXX/PopXXX calls.\n// Must be called during or before EndFrame().\n// This is generally flawed as we are not necessarily End/Popping things in the right order.\n// FIXME: Can't recover from inside BeginTabItem/EndTabItem yet.\n// FIXME: Can't recover from interleaved BeginTabBar/Begin\nvoid    ImGui::ErrorCheckEndFrameRecover(ImGuiErrorLogCallback log_callback, void* user_data)\n{\n    // PVS-Studio V1044 is \"Loop break conditions do not depend on the number of iterations\"\n    ImGuiContext& g = *GImGui;\n    while (g.CurrentWindowStack.Size > 0)\n    {\n        while (g.CurrentTable && (g.CurrentTable->OuterWindow == g.CurrentWindow || g.CurrentTable->InnerWindow == g.CurrentWindow))\n        {\n            if (log_callback) log_callback(user_data, \"Recovered from missing EndTable() in '%s'\", g.CurrentTable->OuterWindow->Name);\n            EndTable();\n        }\n        ImGuiWindow* window = g.CurrentWindow;\n        IM_ASSERT(window != NULL);\n        while (g.CurrentTabBar != NULL) //-V1044\n        {\n            if (log_callback) log_callback(user_data, \"Recovered from missing EndTabBar() in '%s'\", window->Name);\n            EndTabBar();\n        }\n        while (window->DC.TreeDepth > 0)\n        {\n            if (log_callback) log_callback(user_data, \"Recovered from missing TreePop() in '%s'\", window->Name);\n            TreePop();\n        }\n        while (g.GroupStack.Size > window->DC.StackSizesOnBegin.SizeOfGroupStack)\n        {\n            if (log_callback) log_callback(user_data, \"Recovered from missing EndGroup() in '%s'\", window->Name);\n            EndGroup();\n        }\n        while (window->IDStack.Size > 1)\n        {\n            if (log_callback) log_callback(user_data, \"Recovered from missing PopID() in '%s'\", window->Name);\n            PopID();\n        }\n        while (g.ColorStack.Size > window->DC.StackSizesOnBegin.SizeOfColorStack)\n        {\n            if (log_callback) log_callback(user_data, \"Recovered from missing PopStyleColor() in '%s' for ImGuiCol_%s\", window->Name, GetStyleColorName(g.ColorStack.back().Col));\n            PopStyleColor();\n        }\n        while (g.StyleVarStack.Size > window->DC.StackSizesOnBegin.SizeOfStyleVarStack)\n        {\n            if (log_callback) log_callback(user_data, \"Recovered from missing PopStyleVar() in '%s'\", window->Name);\n            PopStyleVar();\n        }\n        while (g.FocusScopeStack.Size > window->DC.StackSizesOnBegin.SizeOfFocusScopeStack)\n        {\n            if (log_callback) log_callback(user_data, \"Recovered from missing PopFocusScope() in '%s'\", window->Name);\n            PopFocusScope();\n        }\n        if (g.CurrentWindowStack.Size == 1)\n        {\n            IM_ASSERT(g.CurrentWindow->IsFallbackWindow);\n            break;\n        }\n        IM_ASSERT(window == g.CurrentWindow);\n        if (window->Flags & ImGuiWindowFlags_ChildWindow)\n        {\n            if (log_callback) log_callback(user_data, \"Recovered from missing EndChild() for '%s'\", window->Name);\n            EndChild();\n        }\n        else\n        {\n            if (log_callback) log_callback(user_data, \"Recovered from missing End() for '%s'\", window->Name);\n            End();\n        }\n    }\n}\n\n// Save current stack sizes for later compare\nvoid ImGuiStackSizes::SetToCurrentState()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    SizeOfIDStack = (short)window->IDStack.Size;\n    SizeOfColorStack = (short)g.ColorStack.Size;\n    SizeOfStyleVarStack = (short)g.StyleVarStack.Size;\n    SizeOfFontStack = (short)g.FontStack.Size;\n    SizeOfFocusScopeStack = (short)g.FocusScopeStack.Size;\n    SizeOfGroupStack = (short)g.GroupStack.Size;\n    SizeOfBeginPopupStack = (short)g.BeginPopupStack.Size;\n}\n\n// Compare to detect usage errors\nvoid ImGuiStackSizes::CompareWithCurrentState()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    IM_UNUSED(window);\n\n    // Window stacks\n    // NOT checking: DC.ItemWidth, DC.TextWrapPos (per window) to allow user to conveniently push once and not pop (they are cleared on Begin)\n    IM_ASSERT(SizeOfIDStack         == window->IDStack.Size     && \"PushID/PopID or TreeNode/TreePop Mismatch!\");\n\n    // Global stacks\n    // For color, style and font stacks there is an incentive to use Push/Begin/Pop/.../End patterns, so we relax our checks a little to allow them.\n    IM_ASSERT(SizeOfGroupStack      == g.GroupStack.Size        && \"BeginGroup/EndGroup Mismatch!\");\n    IM_ASSERT(SizeOfBeginPopupStack == g.BeginPopupStack.Size   && \"BeginPopup/EndPopup or BeginMenu/EndMenu Mismatch!\");\n    IM_ASSERT(SizeOfColorStack      >= g.ColorStack.Size        && \"PushStyleColor/PopStyleColor Mismatch!\");\n    IM_ASSERT(SizeOfStyleVarStack   >= g.StyleVarStack.Size     && \"PushStyleVar/PopStyleVar Mismatch!\");\n    IM_ASSERT(SizeOfFontStack       >= g.FontStack.Size         && \"PushFont/PopFont Mismatch!\");\n    IM_ASSERT(SizeOfFocusScopeStack == g.FocusScopeStack.Size   && \"PushFocusScope/PopFocusScope Mismatch!\");\n}\n\n\n//-----------------------------------------------------------------------------\n// [SECTION] LAYOUT\n//-----------------------------------------------------------------------------\n// - ItemSize()\n// - ItemAdd()\n// - SameLine()\n// - GetCursorScreenPos()\n// - SetCursorScreenPos()\n// - GetCursorPos(), GetCursorPosX(), GetCursorPosY()\n// - SetCursorPos(), SetCursorPosX(), SetCursorPosY()\n// - GetCursorStartPos()\n// - Indent()\n// - Unindent()\n// - SetNextItemWidth()\n// - PushItemWidth()\n// - PushMultiItemsWidths()\n// - PopItemWidth()\n// - CalcItemWidth()\n// - CalcItemSize()\n// - GetTextLineHeight()\n// - GetTextLineHeightWithSpacing()\n// - GetFrameHeight()\n// - GetFrameHeightWithSpacing()\n// - GetContentRegionMax()\n// - GetContentRegionMaxAbs() [Internal]\n// - GetContentRegionAvail(),\n// - GetWindowContentRegionMin(), GetWindowContentRegionMax()\n// - GetWindowContentRegionWidth()\n// - BeginGroup()\n// - EndGroup()\n// Also see in imgui_widgets: tab bars, columns.\n//-----------------------------------------------------------------------------\n\n// Advance cursor given item size for layout.\n// Register minimum needed size so it can extend the bounding box used for auto-fit calculation.\n// See comments in ItemAdd() about how/why the size provided to ItemSize() vs ItemAdd() may often different.\nvoid ImGui::ItemSize(const ImVec2& size, float text_baseline_y)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    if (window->SkipItems)\n        return;\n\n    // We increase the height in this function to accommodate for baseline offset.\n    // In theory we should be offsetting the starting position (window->DC.CursorPos), that will be the topic of a larger refactor,\n    // but since ItemSize() is not yet an API that moves the cursor (to handle e.g. wrapping) enlarging the height has the same effect.\n    const float offset_to_match_baseline_y = (text_baseline_y >= 0) ? ImMax(0.0f, window->DC.CurrLineTextBaseOffset - text_baseline_y) : 0.0f;\n    const float line_height = ImMax(window->DC.CurrLineSize.y, size.y + offset_to_match_baseline_y);\n\n    // Always align ourselves on pixel boundaries\n    //if (g.IO.KeyAlt) window->DrawList->AddRect(window->DC.CursorPos, window->DC.CursorPos + ImVec2(size.x, line_height), IM_COL32(255,0,0,200)); // [DEBUG]\n    window->DC.CursorPosPrevLine.x = window->DC.CursorPos.x + size.x;\n    window->DC.CursorPosPrevLine.y = window->DC.CursorPos.y;\n    window->DC.CursorPos.x = IM_FLOOR(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x);    // Next line\n    window->DC.CursorPos.y = IM_FLOOR(window->DC.CursorPos.y + line_height + g.Style.ItemSpacing.y);        // Next line\n    window->DC.CursorMaxPos.x = ImMax(window->DC.CursorMaxPos.x, window->DC.CursorPosPrevLine.x);\n    window->DC.CursorMaxPos.y = ImMax(window->DC.CursorMaxPos.y, window->DC.CursorPos.y - g.Style.ItemSpacing.y);\n    //if (g.IO.KeyAlt) window->DrawList->AddCircle(window->DC.CursorMaxPos, 3.0f, IM_COL32(255,0,0,255), 4); // [DEBUG]\n\n    window->DC.PrevLineSize.y = line_height;\n    window->DC.CurrLineSize.y = 0.0f;\n    window->DC.PrevLineTextBaseOffset = ImMax(window->DC.CurrLineTextBaseOffset, text_baseline_y);\n    window->DC.CurrLineTextBaseOffset = 0.0f;\n\n    // Horizontal layout mode\n    if (window->DC.LayoutType == ImGuiLayoutType_Horizontal)\n        SameLine();\n}\n\nvoid ImGui::ItemSize(const ImRect& bb, float text_baseline_y)\n{\n    ItemSize(bb.GetSize(), text_baseline_y);\n}\n\n// Declare item bounding box for clipping and interaction.\n// Note that the size can be different than the one provided to ItemSize(). Typically, widgets that spread over available surface\n// declare their minimum size requirement to ItemSize() and provide a larger region to ItemAdd() which is used drawing/interaction.\nbool ImGui::ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb_arg, ImGuiItemAddFlags flags)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n\n    // Set item data\n    g.LastItemData.ID = id;\n    g.LastItemData.Rect = bb;\n    g.LastItemData.InFlags = g.CurrentItemFlags;\n    g.LastItemData.StatusFlags = ImGuiItemStatusFlags_None;\n\n    // Directional navigation processing\n    if (id != 0)\n    {\n        // Runs prior to clipping early-out\n        //  (a) So that NavInitRequest can be honored, for newly opened windows to select a default widget\n        //  (b) So that we can scroll up/down past clipped items. This adds a small O(N) cost to regular navigation requests\n        //      unfortunately, but it is still limited to one window. It may not scale very well for windows with ten of\n        //      thousands of item, but at least NavMoveRequest is only set on user interaction, aka maximum once a frame.\n        //      We could early out with \"if (is_clipped && !g.NavInitRequest) return false;\" but when we wouldn't be able\n        //      to reach unclipped widgets. This would work if user had explicit scrolling control (e.g. mapped on a stick).\n        // We intentionally don't check if g.NavWindow != NULL because g.NavAnyRequest should only be set when it is non null.\n        // If we crash on a NULL g.NavWindow we need to fix the bug elsewhere.\n        window->DC.NavLayersActiveMaskNext |= (1 << window->DC.NavLayerCurrent);\n        if (g.NavId == id || g.NavAnyRequest)\n            if (g.NavWindow->RootWindowForNav == window->RootWindowForNav)\n                if (window == g.NavWindow || ((window->Flags | g.NavWindow->Flags) & ImGuiWindowFlags_NavFlattened))\n                    NavProcessItem(window, nav_bb_arg ? *nav_bb_arg : bb, id);\n\n        // [DEBUG] Item Picker tool, when enabling the \"extended\" version we perform the check in ItemAdd()\n#ifdef IMGUI_DEBUG_TOOL_ITEM_PICKER_EX\n        if (id == g.DebugItemPickerBreakId)\n        {\n            IM_DEBUG_BREAK();\n            g.DebugItemPickerBreakId = 0;\n        }\n#endif\n    }\n    g.NextItemData.Flags = ImGuiNextItemDataFlags_None;\n\n#ifdef IMGUI_ENABLE_TEST_ENGINE\n    if (id != 0)\n        IMGUI_TEST_ENGINE_ITEM_ADD(nav_bb_arg ? *nav_bb_arg : bb, id);\n#endif\n\n    // Clipping test\n    const bool is_clipped = IsClippedEx(bb, id, false);\n    if (is_clipped)\n        return false;\n    //if (g.IO.KeyAlt) window->DrawList->AddRect(bb.Min, bb.Max, IM_COL32(255,255,0,120)); // [DEBUG]\n\n    // Tab stop handling (previously was using internal ItemFocusable() api)\n    // FIXME-NAV: We would now want to move this above the clipping test, but this would require being able to scroll and currently this would mean an extra frame. (#4079, #343)\n    if (flags & ImGuiItemAddFlags_Focusable)\n        ItemFocusable(window, id);\n\n    // We need to calculate this now to take account of the current clipping rectangle (as items like Selectable may change them)\n    if (IsMouseHoveringRect(bb.Min, bb.Max))\n        g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_HoveredRect;\n    return true;\n}\n\n// Gets back to previous line and continue with horizontal layout\n//      offset_from_start_x == 0 : follow right after previous item\n//      offset_from_start_x != 0 : align to specified x position (relative to window/group left)\n//      spacing_w < 0            : use default spacing if pos_x == 0, no spacing if pos_x != 0\n//      spacing_w >= 0           : enforce spacing amount\nvoid ImGui::SameLine(float offset_from_start_x, float spacing_w)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return;\n\n    ImGuiContext& g = *GImGui;\n    if (offset_from_start_x != 0.0f)\n    {\n        if (spacing_w < 0.0f) spacing_w = 0.0f;\n        window->DC.CursorPos.x = window->Pos.x - window->Scroll.x + offset_from_start_x + spacing_w + window->DC.GroupOffset.x + window->DC.ColumnsOffset.x;\n        window->DC.CursorPos.y = window->DC.CursorPosPrevLine.y;\n    }\n    else\n    {\n        if (spacing_w < 0.0f) spacing_w = g.Style.ItemSpacing.x;\n        window->DC.CursorPos.x = window->DC.CursorPosPrevLine.x + spacing_w;\n        window->DC.CursorPos.y = window->DC.CursorPosPrevLine.y;\n    }\n    window->DC.CurrLineSize = window->DC.PrevLineSize;\n    window->DC.CurrLineTextBaseOffset = window->DC.PrevLineTextBaseOffset;\n}\n\nImVec2 ImGui::GetCursorScreenPos()\n{\n    ImGuiWindow* window = GetCurrentWindowRead();\n    return window->DC.CursorPos;\n}\n\nvoid ImGui::SetCursorScreenPos(const ImVec2& pos)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    window->DC.CursorPos = pos;\n    window->DC.CursorMaxPos = ImMax(window->DC.CursorMaxPos, window->DC.CursorPos);\n}\n\n// User generally sees positions in window coordinates. Internally we store CursorPos in absolute screen coordinates because it is more convenient.\n// Conversion happens as we pass the value to user, but it makes our naming convention confusing because GetCursorPos() == (DC.CursorPos - window.Pos). May want to rename 'DC.CursorPos'.\nImVec2 ImGui::GetCursorPos()\n{\n    ImGuiWindow* window = GetCurrentWindowRead();\n    return window->DC.CursorPos - window->Pos + window->Scroll;\n}\n\nfloat ImGui::GetCursorPosX()\n{\n    ImGuiWindow* window = GetCurrentWindowRead();\n    return window->DC.CursorPos.x - window->Pos.x + window->Scroll.x;\n}\n\nfloat ImGui::GetCursorPosY()\n{\n    ImGuiWindow* window = GetCurrentWindowRead();\n    return window->DC.CursorPos.y - window->Pos.y + window->Scroll.y;\n}\n\nvoid ImGui::SetCursorPos(const ImVec2& local_pos)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    window->DC.CursorPos = window->Pos - window->Scroll + local_pos;\n    window->DC.CursorMaxPos = ImMax(window->DC.CursorMaxPos, window->DC.CursorPos);\n}\n\nvoid ImGui::SetCursorPosX(float x)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    window->DC.CursorPos.x = window->Pos.x - window->Scroll.x + x;\n    window->DC.CursorMaxPos.x = ImMax(window->DC.CursorMaxPos.x, window->DC.CursorPos.x);\n}\n\nvoid ImGui::SetCursorPosY(float y)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    window->DC.CursorPos.y = window->Pos.y - window->Scroll.y + y;\n    window->DC.CursorMaxPos.y = ImMax(window->DC.CursorMaxPos.y, window->DC.CursorPos.y);\n}\n\nImVec2 ImGui::GetCursorStartPos()\n{\n    ImGuiWindow* window = GetCurrentWindowRead();\n    return window->DC.CursorStartPos - window->Pos;\n}\n\nvoid ImGui::Indent(float indent_w)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = GetCurrentWindow();\n    window->DC.Indent.x += (indent_w != 0.0f) ? indent_w : g.Style.IndentSpacing;\n    window->DC.CursorPos.x = window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x;\n}\n\nvoid ImGui::Unindent(float indent_w)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = GetCurrentWindow();\n    window->DC.Indent.x -= (indent_w != 0.0f) ? indent_w : g.Style.IndentSpacing;\n    window->DC.CursorPos.x = window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x;\n}\n\n// Affect large frame+labels widgets only.\nvoid ImGui::SetNextItemWidth(float item_width)\n{\n    ImGuiContext& g = *GImGui;\n    g.NextItemData.Flags |= ImGuiNextItemDataFlags_HasWidth;\n    g.NextItemData.Width = item_width;\n}\n\n// FIXME: Remove the == 0.0f behavior?\nvoid ImGui::PushItemWidth(float item_width)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    window->DC.ItemWidthStack.push_back(window->DC.ItemWidth); // Backup current width\n    window->DC.ItemWidth = (item_width == 0.0f ? window->ItemWidthDefault : item_width);\n    g.NextItemData.Flags &= ~ImGuiNextItemDataFlags_HasWidth;\n}\n\nvoid ImGui::PushMultiItemsWidths(int components, float w_full)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    const ImGuiStyle& style = g.Style;\n    const float w_item_one  = ImMax(1.0f, IM_FLOOR((w_full - (style.ItemInnerSpacing.x) * (components - 1)) / (float)components));\n    const float w_item_last = ImMax(1.0f, IM_FLOOR(w_full - (w_item_one + style.ItemInnerSpacing.x) * (components - 1)));\n    window->DC.ItemWidthStack.push_back(window->DC.ItemWidth); // Backup current width\n    window->DC.ItemWidthStack.push_back(w_item_last);\n    for (int i = 0; i < components - 2; i++)\n        window->DC.ItemWidthStack.push_back(w_item_one);\n    window->DC.ItemWidth = (components == 1) ? w_item_last : w_item_one;\n    g.NextItemData.Flags &= ~ImGuiNextItemDataFlags_HasWidth;\n}\n\nvoid ImGui::PopItemWidth()\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    window->DC.ItemWidth = window->DC.ItemWidthStack.back();\n    window->DC.ItemWidthStack.pop_back();\n}\n\n// Calculate default item width given value passed to PushItemWidth() or SetNextItemWidth().\n// The SetNextItemWidth() data is generally cleared/consumed by ItemAdd() or NextItemData.ClearFlags()\nfloat ImGui::CalcItemWidth()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    float w;\n    if (g.NextItemData.Flags & ImGuiNextItemDataFlags_HasWidth)\n        w = g.NextItemData.Width;\n    else\n        w = window->DC.ItemWidth;\n    if (w < 0.0f)\n    {\n        float region_max_x = GetContentRegionMaxAbs().x;\n        w = ImMax(1.0f, region_max_x - window->DC.CursorPos.x + w);\n    }\n    w = IM_FLOOR(w);\n    return w;\n}\n\n// [Internal] Calculate full item size given user provided 'size' parameter and default width/height. Default width is often == CalcItemWidth().\n// Those two functions CalcItemWidth vs CalcItemSize are awkwardly named because they are not fully symmetrical.\n// Note that only CalcItemWidth() is publicly exposed.\n// The 4.0f here may be changed to match CalcItemWidth() and/or BeginChild() (right now we have a mismatch which is harmless but undesirable)\nImVec2 ImGui::CalcItemSize(ImVec2 size, float default_w, float default_h)\n{\n    ImGuiWindow* window = GImGui->CurrentWindow;\n\n    ImVec2 region_max;\n    if (size.x < 0.0f || size.y < 0.0f)\n        region_max = GetContentRegionMaxAbs();\n\n    if (size.x == 0.0f)\n        size.x = default_w;\n    else if (size.x < 0.0f)\n        size.x = ImMax(4.0f, region_max.x - window->DC.CursorPos.x + size.x);\n\n    if (size.y == 0.0f)\n        size.y = default_h;\n    else if (size.y < 0.0f)\n        size.y = ImMax(4.0f, region_max.y - window->DC.CursorPos.y + size.y);\n\n    return size;\n}\n\nfloat ImGui::GetTextLineHeight()\n{\n    ImGuiContext& g = *GImGui;\n    return g.FontSize;\n}\n\nfloat ImGui::GetTextLineHeightWithSpacing()\n{\n    ImGuiContext& g = *GImGui;\n    return g.FontSize + g.Style.ItemSpacing.y;\n}\n\nfloat ImGui::GetFrameHeight()\n{\n    ImGuiContext& g = *GImGui;\n    return g.FontSize + g.Style.FramePadding.y * 2.0f;\n}\n\nfloat ImGui::GetFrameHeightWithSpacing()\n{\n    ImGuiContext& g = *GImGui;\n    return g.FontSize + g.Style.FramePadding.y * 2.0f + g.Style.ItemSpacing.y;\n}\n\n// FIXME: All the Contents Region function are messy or misleading. WE WILL AIM TO OBSOLETE ALL OF THEM WITH A NEW \"WORK RECT\" API. Thanks for your patience!\n\n// FIXME: This is in window space (not screen space!).\nImVec2 ImGui::GetContentRegionMax()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    ImVec2 mx = window->ContentRegionRect.Max - window->Pos;\n    if (window->DC.CurrentColumns || g.CurrentTable)\n        mx.x = window->WorkRect.Max.x - window->Pos.x;\n    return mx;\n}\n\n// [Internal] Absolute coordinate. Saner. This is not exposed until we finishing refactoring work rect features.\nImVec2 ImGui::GetContentRegionMaxAbs()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    ImVec2 mx = window->ContentRegionRect.Max;\n    if (window->DC.CurrentColumns || g.CurrentTable)\n        mx.x = window->WorkRect.Max.x;\n    return mx;\n}\n\nImVec2 ImGui::GetContentRegionAvail()\n{\n    ImGuiWindow* window = GImGui->CurrentWindow;\n    return GetContentRegionMaxAbs() - window->DC.CursorPos;\n}\n\n// In window space (not screen space!)\nImVec2 ImGui::GetWindowContentRegionMin()\n{\n    ImGuiWindow* window = GImGui->CurrentWindow;\n    return window->ContentRegionRect.Min - window->Pos;\n}\n\nImVec2 ImGui::GetWindowContentRegionMax()\n{\n    ImGuiWindow* window = GImGui->CurrentWindow;\n    return window->ContentRegionRect.Max - window->Pos;\n}\n\nfloat ImGui::GetWindowContentRegionWidth()\n{\n    ImGuiWindow* window = GImGui->CurrentWindow;\n    return window->ContentRegionRect.GetWidth();\n}\n\n// Lock horizontal starting position + capture group bounding box into one \"item\" (so you can use IsItemHovered() or layout primitives such as SameLine() on whole group, etc.)\n// Groups are currently a mishmash of functionalities which should perhaps be clarified and separated.\nvoid ImGui::BeginGroup()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n\n    g.GroupStack.resize(g.GroupStack.Size + 1);\n    ImGuiGroupData& group_data = g.GroupStack.back();\n    group_data.WindowID = window->ID;\n    group_data.BackupCursorPos = window->DC.CursorPos;\n    group_data.BackupCursorMaxPos = window->DC.CursorMaxPos;\n    group_data.BackupIndent = window->DC.Indent;\n    group_data.BackupGroupOffset = window->DC.GroupOffset;\n    group_data.BackupCurrLineSize = window->DC.CurrLineSize;\n    group_data.BackupCurrLineTextBaseOffset = window->DC.CurrLineTextBaseOffset;\n    group_data.BackupActiveIdIsAlive = g.ActiveIdIsAlive;\n    group_data.BackupHoveredIdIsAlive = g.HoveredId != 0;\n    group_data.BackupActiveIdPreviousFrameIsAlive = g.ActiveIdPreviousFrameIsAlive;\n    group_data.EmitItem = true;\n\n    window->DC.GroupOffset.x = window->DC.CursorPos.x - window->Pos.x - window->DC.ColumnsOffset.x;\n    window->DC.Indent = window->DC.GroupOffset;\n    window->DC.CursorMaxPos = window->DC.CursorPos;\n    window->DC.CurrLineSize = ImVec2(0.0f, 0.0f);\n    if (g.LogEnabled)\n        g.LogLinePosY = -FLT_MAX; // To enforce a carriage return\n}\n\nvoid ImGui::EndGroup()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    IM_ASSERT(g.GroupStack.Size > 0); // Mismatched BeginGroup()/EndGroup() calls\n\n    ImGuiGroupData& group_data = g.GroupStack.back();\n    IM_ASSERT(group_data.WindowID == window->ID); // EndGroup() in wrong window?\n\n    ImRect group_bb(group_data.BackupCursorPos, ImMax(window->DC.CursorMaxPos, group_data.BackupCursorPos));\n\n    window->DC.CursorPos = group_data.BackupCursorPos;\n    window->DC.CursorMaxPos = ImMax(group_data.BackupCursorMaxPos, window->DC.CursorMaxPos);\n    window->DC.Indent = group_data.BackupIndent;\n    window->DC.GroupOffset = group_data.BackupGroupOffset;\n    window->DC.CurrLineSize = group_data.BackupCurrLineSize;\n    window->DC.CurrLineTextBaseOffset = group_data.BackupCurrLineTextBaseOffset;\n    if (g.LogEnabled)\n        g.LogLinePosY = -FLT_MAX; // To enforce a carriage return\n\n    if (!group_data.EmitItem)\n    {\n        g.GroupStack.pop_back();\n        return;\n    }\n\n    window->DC.CurrLineTextBaseOffset = ImMax(window->DC.PrevLineTextBaseOffset, group_data.BackupCurrLineTextBaseOffset);      // FIXME: Incorrect, we should grab the base offset from the *first line* of the group but it is hard to obtain now.\n    ItemSize(group_bb.GetSize());\n    ItemAdd(group_bb, 0);\n\n    // If the current ActiveId was declared within the boundary of our group, we copy it to LastItemId so IsItemActive(), IsItemDeactivated() etc. will be functional on the entire group.\n    // It would be be neater if we replaced window.DC.LastItemId by e.g. 'bool LastItemIsActive', but would put a little more burden on individual widgets.\n    // Also if you grep for LastItemId you'll notice it is only used in that context.\n    // (The two tests not the same because ActiveIdIsAlive is an ID itself, in order to be able to handle ActiveId being overwritten during the frame.)\n    const bool group_contains_curr_active_id = (group_data.BackupActiveIdIsAlive != g.ActiveId) && (g.ActiveIdIsAlive == g.ActiveId) && g.ActiveId;\n    const bool group_contains_prev_active_id = (group_data.BackupActiveIdPreviousFrameIsAlive == false) && (g.ActiveIdPreviousFrameIsAlive == true);\n    if (group_contains_curr_active_id)\n        g.LastItemData.ID = g.ActiveId;\n    else if (group_contains_prev_active_id)\n        g.LastItemData.ID = g.ActiveIdPreviousFrame;\n    g.LastItemData.Rect = group_bb;\n\n    // Forward Hovered flag\n    const bool group_contains_curr_hovered_id = (group_data.BackupHoveredIdIsAlive == false) && g.HoveredId != 0;\n    if (group_contains_curr_hovered_id)\n        g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_HoveredWindow;\n\n    // Forward Edited flag\n    if (group_contains_curr_active_id && g.ActiveIdHasBeenEditedThisFrame)\n        g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_Edited;\n\n    // Forward Deactivated flag\n    g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_HasDeactivated;\n    if (group_contains_prev_active_id && g.ActiveId != g.ActiveIdPreviousFrame)\n        g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_Deactivated;\n\n    g.GroupStack.pop_back();\n    //window->DrawList->AddRect(group_bb.Min, group_bb.Max, IM_COL32(255,0,255,255));   // [Debug]\n}\n\n\n//-----------------------------------------------------------------------------\n// [SECTION] SCROLLING\n//-----------------------------------------------------------------------------\n\n// Helper to snap on edges when aiming at an item very close to the edge,\n// So the difference between WindowPadding and ItemSpacing will be in the visible area after scrolling.\n// When we refactor the scrolling API this may be configurable with a flag?\n// Note that the effect for this won't be visible on X axis with default Style settings as WindowPadding.x == ItemSpacing.x by default.\nstatic float CalcScrollEdgeSnap(float target, float snap_min, float snap_max, float snap_threshold, float center_ratio)\n{\n    if (target <= snap_min + snap_threshold)\n        return ImLerp(snap_min, target, center_ratio);\n    if (target >= snap_max - snap_threshold)\n        return ImLerp(target, snap_max, center_ratio);\n    return target;\n}\n\nstatic ImVec2 CalcNextScrollFromScrollTargetAndClamp(ImGuiWindow* window)\n{\n    ImVec2 scroll = window->Scroll;\n    if (window->ScrollTarget.x < FLT_MAX)\n    {\n        float decoration_total_width = window->ScrollbarSizes.x;\n        float center_x_ratio = window->ScrollTargetCenterRatio.x;\n        float scroll_target_x = window->ScrollTarget.x;\n        if (window->ScrollTargetEdgeSnapDist.x > 0.0f)\n        {\n            float snap_x_min = 0.0f;\n            float snap_x_max = window->ScrollMax.x + window->SizeFull.x - decoration_total_width;\n            scroll_target_x = CalcScrollEdgeSnap(scroll_target_x, snap_x_min, snap_x_max, window->ScrollTargetEdgeSnapDist.x, center_x_ratio);\n        }\n        scroll.x = scroll_target_x - center_x_ratio * (window->SizeFull.x - decoration_total_width);\n    }\n    if (window->ScrollTarget.y < FLT_MAX)\n    {\n        float decoration_total_height = window->TitleBarHeight() + window->MenuBarHeight() + window->ScrollbarSizes.y;\n        float center_y_ratio = window->ScrollTargetCenterRatio.y;\n        float scroll_target_y = window->ScrollTarget.y;\n        if (window->ScrollTargetEdgeSnapDist.y > 0.0f)\n        {\n            float snap_y_min = 0.0f;\n            float snap_y_max = window->ScrollMax.y + window->SizeFull.y - decoration_total_height;\n            scroll_target_y = CalcScrollEdgeSnap(scroll_target_y, snap_y_min, snap_y_max, window->ScrollTargetEdgeSnapDist.y, center_y_ratio);\n        }\n        scroll.y = scroll_target_y - center_y_ratio * (window->SizeFull.y - decoration_total_height);\n    }\n    scroll.x = IM_FLOOR(ImMax(scroll.x, 0.0f));\n    scroll.y = IM_FLOOR(ImMax(scroll.y, 0.0f));\n    if (!window->Collapsed && !window->SkipItems)\n    {\n        scroll.x = ImMin(scroll.x, window->ScrollMax.x);\n        scroll.y = ImMin(scroll.y, window->ScrollMax.y);\n    }\n    return scroll;\n}\n\n// Scroll to keep newly navigated item fully into view\nImVec2 ImGui::ScrollToBringRectIntoView(ImGuiWindow* window, const ImRect& item_rect)\n{\n    ImGuiContext& g = *GImGui;\n    ImRect window_rect(window->InnerRect.Min - ImVec2(1, 1), window->InnerRect.Max + ImVec2(1, 1));\n    //GetForegroundDrawList(window)->AddRect(window_rect.Min, window_rect.Max, IM_COL32_WHITE); // [DEBUG]\n\n    ImVec2 delta_scroll;\n    if (!window_rect.Contains(item_rect))\n    {\n        if (window->ScrollbarX && item_rect.Min.x < window_rect.Min.x)\n            SetScrollFromPosX(window, item_rect.Min.x - window->Pos.x - g.Style.ItemSpacing.x, 0.0f);\n        else if (window->ScrollbarX && item_rect.Max.x >= window_rect.Max.x)\n            SetScrollFromPosX(window, item_rect.Max.x - window->Pos.x + g.Style.ItemSpacing.x, 1.0f);\n        if (item_rect.Min.y < window_rect.Min.y)\n            SetScrollFromPosY(window, item_rect.Min.y - window->Pos.y - g.Style.ItemSpacing.y, 0.0f);\n        else if (item_rect.Max.y >= window_rect.Max.y)\n            SetScrollFromPosY(window, item_rect.Max.y - window->Pos.y + g.Style.ItemSpacing.y, 1.0f);\n\n        ImVec2 next_scroll = CalcNextScrollFromScrollTargetAndClamp(window);\n        delta_scroll = next_scroll - window->Scroll;\n    }\n\n    // Also scroll parent window to keep us into view if necessary\n    if (window->Flags & ImGuiWindowFlags_ChildWindow)\n        delta_scroll += ScrollToBringRectIntoView(window->ParentWindow, ImRect(item_rect.Min - delta_scroll, item_rect.Max - delta_scroll));\n\n    return delta_scroll;\n}\n\nfloat ImGui::GetScrollX()\n{\n    ImGuiWindow* window = GImGui->CurrentWindow;\n    return window->Scroll.x;\n}\n\nfloat ImGui::GetScrollY()\n{\n    ImGuiWindow* window = GImGui->CurrentWindow;\n    return window->Scroll.y;\n}\n\nfloat ImGui::GetScrollMaxX()\n{\n    ImGuiWindow* window = GImGui->CurrentWindow;\n    return window->ScrollMax.x;\n}\n\nfloat ImGui::GetScrollMaxY()\n{\n    ImGuiWindow* window = GImGui->CurrentWindow;\n    return window->ScrollMax.y;\n}\n\nvoid ImGui::SetScrollX(ImGuiWindow* window, float scroll_x)\n{\n    window->ScrollTarget.x = scroll_x;\n    window->ScrollTargetCenterRatio.x = 0.0f;\n    window->ScrollTargetEdgeSnapDist.x = 0.0f;\n}\n\nvoid ImGui::SetScrollY(ImGuiWindow* window, float scroll_y)\n{\n    window->ScrollTarget.y = scroll_y;\n    window->ScrollTargetCenterRatio.y = 0.0f;\n    window->ScrollTargetEdgeSnapDist.y = 0.0f;\n}\n\nvoid ImGui::SetScrollX(float scroll_x)\n{\n    ImGuiContext& g = *GImGui;\n    SetScrollX(g.CurrentWindow, scroll_x);\n}\n\nvoid ImGui::SetScrollY(float scroll_y)\n{\n    ImGuiContext& g = *GImGui;\n    SetScrollY(g.CurrentWindow, scroll_y);\n}\n\n// Note that a local position will vary depending on initial scroll value,\n// This is a little bit confusing so bear with us:\n//  - local_pos = (absolution_pos - window->Pos)\n//  - So local_x/local_y are 0.0f for a position at the upper-left corner of a window,\n//    and generally local_x/local_y are >(padding+decoration) && <(size-padding-decoration) when in the visible area.\n//  - They mostly exists because of legacy API.\n// Following the rules above, when trying to work with scrolling code, consider that:\n//  - SetScrollFromPosY(0.0f) == SetScrollY(0.0f + scroll.y) == has no effect!\n//  - SetScrollFromPosY(-scroll.y) == SetScrollY(-scroll.y + scroll.y) == SetScrollY(0.0f) == reset scroll. Of course writing SetScrollY(0.0f) directly then makes more sense\n// We store a target position so centering and clamping can occur on the next frame when we are guaranteed to have a known window size\nvoid ImGui::SetScrollFromPosX(ImGuiWindow* window, float local_x, float center_x_ratio)\n{\n    IM_ASSERT(center_x_ratio >= 0.0f && center_x_ratio <= 1.0f);\n    window->ScrollTarget.x = IM_FLOOR(local_x + window->Scroll.x); // Convert local position to scroll offset\n    window->ScrollTargetCenterRatio.x = center_x_ratio;\n    window->ScrollTargetEdgeSnapDist.x = 0.0f;\n}\n\nvoid ImGui::SetScrollFromPosY(ImGuiWindow* window, float local_y, float center_y_ratio)\n{\n    IM_ASSERT(center_y_ratio >= 0.0f && center_y_ratio <= 1.0f);\n    const float decoration_up_height = window->TitleBarHeight() + window->MenuBarHeight(); // FIXME: Would be nice to have a more standardized access to our scrollable/client rect;\n    local_y -= decoration_up_height;\n    window->ScrollTarget.y = IM_FLOOR(local_y + window->Scroll.y); // Convert local position to scroll offset\n    window->ScrollTargetCenterRatio.y = center_y_ratio;\n    window->ScrollTargetEdgeSnapDist.y = 0.0f;\n}\n\nvoid ImGui::SetScrollFromPosX(float local_x, float center_x_ratio)\n{\n    ImGuiContext& g = *GImGui;\n    SetScrollFromPosX(g.CurrentWindow, local_x, center_x_ratio);\n}\n\nvoid ImGui::SetScrollFromPosY(float local_y, float center_y_ratio)\n{\n    ImGuiContext& g = *GImGui;\n    SetScrollFromPosY(g.CurrentWindow, local_y, center_y_ratio);\n}\n\n// center_x_ratio: 0.0f left of last item, 0.5f horizontal center of last item, 1.0f right of last item.\nvoid ImGui::SetScrollHereX(float center_x_ratio)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    float spacing_x = ImMax(window->WindowPadding.x, g.Style.ItemSpacing.x);\n    float target_pos_x = ImLerp(g.LastItemData.Rect.Min.x - spacing_x, g.LastItemData.Rect.Max.x + spacing_x, center_x_ratio);\n    SetScrollFromPosX(window, target_pos_x - window->Pos.x, center_x_ratio); // Convert from absolute to local pos\n\n    // Tweak: snap on edges when aiming at an item very close to the edge\n    window->ScrollTargetEdgeSnapDist.x = ImMax(0.0f, window->WindowPadding.x - spacing_x);\n}\n\n// center_y_ratio: 0.0f top of last item, 0.5f vertical center of last item, 1.0f bottom of last item.\nvoid ImGui::SetScrollHereY(float center_y_ratio)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    float spacing_y = ImMax(window->WindowPadding.y, g.Style.ItemSpacing.y);\n    float target_pos_y = ImLerp(window->DC.CursorPosPrevLine.y - spacing_y, window->DC.CursorPosPrevLine.y + window->DC.PrevLineSize.y + spacing_y, center_y_ratio);\n    SetScrollFromPosY(window, target_pos_y - window->Pos.y, center_y_ratio); // Convert from absolute to local pos\n\n    // Tweak: snap on edges when aiming at an item very close to the edge\n    window->ScrollTargetEdgeSnapDist.y = ImMax(0.0f, window->WindowPadding.y - spacing_y);\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] TOOLTIPS\n//-----------------------------------------------------------------------------\n\nvoid ImGui::BeginTooltip()\n{\n    BeginTooltipEx(ImGuiWindowFlags_None, ImGuiTooltipFlags_None);\n}\n\nvoid ImGui::BeginTooltipEx(ImGuiWindowFlags extra_flags, ImGuiTooltipFlags tooltip_flags)\n{\n    ImGuiContext& g = *GImGui;\n\n    if (g.DragDropWithinSource || g.DragDropWithinTarget)\n    {\n        // The default tooltip position is a little offset to give space to see the context menu (it's also clamped within the current viewport/monitor)\n        // In the context of a dragging tooltip we try to reduce that offset and we enforce following the cursor.\n        // Whatever we do we want to call SetNextWindowPos() to enforce a tooltip position and disable clipping the tooltip without our display area, like regular tooltip do.\n        //ImVec2 tooltip_pos = g.IO.MousePos - g.ActiveIdClickOffset - g.Style.WindowPadding;\n        ImVec2 tooltip_pos = g.IO.MousePos + ImVec2(16 * g.Style.MouseCursorScale, 8 * g.Style.MouseCursorScale);\n        SetNextWindowPos(tooltip_pos);\n        SetNextWindowBgAlpha(g.Style.Colors[ImGuiCol_PopupBg].w * 0.60f);\n        //PushStyleVar(ImGuiStyleVar_Alpha, g.Style.Alpha * 0.60f); // This would be nice but e.g ColorButton with checkboard has issue with transparent colors :(\n        tooltip_flags |= ImGuiTooltipFlags_OverridePreviousTooltip;\n    }\n\n    char window_name[16];\n    ImFormatString(window_name, IM_ARRAYSIZE(window_name), \"##Tooltip_%02d\", g.TooltipOverrideCount);\n    if (tooltip_flags & ImGuiTooltipFlags_OverridePreviousTooltip)\n        if (ImGuiWindow* window = FindWindowByName(window_name))\n            if (window->Active)\n            {\n                // Hide previous tooltip from being displayed. We can't easily \"reset\" the content of a window so we create a new one.\n                window->Hidden = true;\n                window->HiddenFramesCanSkipItems = 1; // FIXME: This may not be necessary?\n                ImFormatString(window_name, IM_ARRAYSIZE(window_name), \"##Tooltip_%02d\", ++g.TooltipOverrideCount);\n            }\n    ImGuiWindowFlags flags = ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_AlwaysAutoResize;\n    Begin(window_name, NULL, flags | extra_flags);\n}\n\nvoid ImGui::EndTooltip()\n{\n    IM_ASSERT(GetCurrentWindowRead()->Flags & ImGuiWindowFlags_Tooltip);   // Mismatched BeginTooltip()/EndTooltip() calls\n    End();\n}\n\nvoid ImGui::SetTooltipV(const char* fmt, va_list args)\n{\n    BeginTooltipEx(0, ImGuiTooltipFlags_OverridePreviousTooltip);\n    TextV(fmt, args);\n    EndTooltip();\n}\n\nvoid ImGui::SetTooltip(const char* fmt, ...)\n{\n    va_list args;\n    va_start(args, fmt);\n    SetTooltipV(fmt, args);\n    va_end(args);\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] POPUPS\n//-----------------------------------------------------------------------------\n\n// Supported flags: ImGuiPopupFlags_AnyPopupId, ImGuiPopupFlags_AnyPopupLevel\nbool ImGui::IsPopupOpen(ImGuiID id, ImGuiPopupFlags popup_flags)\n{\n    ImGuiContext& g = *GImGui;\n    if (popup_flags & ImGuiPopupFlags_AnyPopupId)\n    {\n        // Return true if any popup is open at the current BeginPopup() level of the popup stack\n        // This may be used to e.g. test for another popups already opened to handle popups priorities at the same level.\n        IM_ASSERT(id == 0);\n        if (popup_flags & ImGuiPopupFlags_AnyPopupLevel)\n            return g.OpenPopupStack.Size > 0;\n        else\n            return g.OpenPopupStack.Size > g.BeginPopupStack.Size;\n    }\n    else\n    {\n        if (popup_flags & ImGuiPopupFlags_AnyPopupLevel)\n        {\n            // Return true if the popup is open anywhere in the popup stack\n            for (int n = 0; n < g.OpenPopupStack.Size; n++)\n                if (g.OpenPopupStack[n].PopupId == id)\n                    return true;\n            return false;\n        }\n        else\n        {\n            // Return true if the popup is open at the current BeginPopup() level of the popup stack (this is the most-common query)\n            return g.OpenPopupStack.Size > g.BeginPopupStack.Size && g.OpenPopupStack[g.BeginPopupStack.Size].PopupId == id;\n        }\n    }\n}\n\nbool ImGui::IsPopupOpen(const char* str_id, ImGuiPopupFlags popup_flags)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiID id = (popup_flags & ImGuiPopupFlags_AnyPopupId) ? 0 : g.CurrentWindow->GetID(str_id);\n    if ((popup_flags & ImGuiPopupFlags_AnyPopupLevel) && id != 0)\n        IM_ASSERT(0 && \"Cannot use IsPopupOpen() with a string id and ImGuiPopupFlags_AnyPopupLevel.\"); // But non-string version is legal and used internally\n    return IsPopupOpen(id, popup_flags);\n}\n\nImGuiWindow* ImGui::GetTopMostPopupModal()\n{\n    ImGuiContext& g = *GImGui;\n    for (int n = g.OpenPopupStack.Size - 1; n >= 0; n--)\n        if (ImGuiWindow* popup = g.OpenPopupStack.Data[n].Window)\n            if (popup->Flags & ImGuiWindowFlags_Modal)\n                return popup;\n    return NULL;\n}\n\nvoid ImGui::OpenPopup(const char* str_id, ImGuiPopupFlags popup_flags)\n{\n    ImGuiContext& g = *GImGui;\n    OpenPopupEx(g.CurrentWindow->GetID(str_id), popup_flags);\n}\n\nvoid ImGui::OpenPopup(ImGuiID id, ImGuiPopupFlags popup_flags)\n{\n    OpenPopupEx(id, popup_flags);\n}\n\n// Mark popup as open (toggle toward open state).\n// Popups are closed when user click outside, or activate a pressable item, or CloseCurrentPopup() is called within a BeginPopup()/EndPopup() block.\n// Popup identifiers are relative to the current ID-stack (so OpenPopup and BeginPopup needs to be at the same level).\n// One open popup per level of the popup hierarchy (NB: when assigning we reset the Window member of ImGuiPopupRef to NULL)\nvoid ImGui::OpenPopupEx(ImGuiID id, ImGuiPopupFlags popup_flags)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* parent_window = g.CurrentWindow;\n    const int current_stack_size = g.BeginPopupStack.Size;\n\n    if (popup_flags & ImGuiPopupFlags_NoOpenOverExistingPopup)\n        if (IsPopupOpen(0u, ImGuiPopupFlags_AnyPopupId))\n            return;\n\n    ImGuiPopupData popup_ref; // Tagged as new ref as Window will be set back to NULL if we write this into OpenPopupStack.\n    popup_ref.PopupId = id;\n    popup_ref.Window = NULL;\n    popup_ref.SourceWindow = g.NavWindow;\n    popup_ref.OpenFrameCount = g.FrameCount;\n    popup_ref.OpenParentId = parent_window->IDStack.back();\n    popup_ref.OpenPopupPos = NavCalcPreferredRefPos();\n    popup_ref.OpenMousePos = IsMousePosValid(&g.IO.MousePos) ? g.IO.MousePos : popup_ref.OpenPopupPos;\n\n    IMGUI_DEBUG_LOG_POPUP(\"OpenPopupEx(0x%08X)\\n\", id);\n    if (g.OpenPopupStack.Size < current_stack_size + 1)\n    {\n        g.OpenPopupStack.push_back(popup_ref);\n    }\n    else\n    {\n        // Gently handle the user mistakenly calling OpenPopup() every frame. It is a programming mistake! However, if we were to run the regular code path, the ui\n        // would become completely unusable because the popup will always be in hidden-while-calculating-size state _while_ claiming focus. Which would be a very confusing\n        // situation for the programmer. Instead, we silently allow the popup to proceed, it will keep reappearing and the programming error will be more obvious to understand.\n        if (g.OpenPopupStack[current_stack_size].PopupId == id && g.OpenPopupStack[current_stack_size].OpenFrameCount == g.FrameCount - 1)\n        {\n            g.OpenPopupStack[current_stack_size].OpenFrameCount = popup_ref.OpenFrameCount;\n        }\n        else\n        {\n            // Close child popups if any, then flag popup for open/reopen\n            ClosePopupToLevel(current_stack_size, false);\n            g.OpenPopupStack.push_back(popup_ref);\n        }\n\n        // When reopening a popup we first refocus its parent, otherwise if its parent is itself a popup it would get closed by ClosePopupsOverWindow().\n        // This is equivalent to what ClosePopupToLevel() does.\n        //if (g.OpenPopupStack[current_stack_size].PopupId == id)\n        //    FocusWindow(parent_window);\n    }\n}\n\n// When popups are stacked, clicking on a lower level popups puts focus back to it and close popups above it.\n// This function closes any popups that are over 'ref_window'.\nvoid ImGui::ClosePopupsOverWindow(ImGuiWindow* ref_window, bool restore_focus_to_window_under_popup)\n{\n    ImGuiContext& g = *GImGui;\n    if (g.OpenPopupStack.Size == 0)\n        return;\n\n    // Don't close our own child popup windows.\n    int popup_count_to_keep = 0;\n    if (ref_window)\n    {\n        // Find the highest popup which is a descendant of the reference window (generally reference window = NavWindow)\n        for (; popup_count_to_keep < g.OpenPopupStack.Size; popup_count_to_keep++)\n        {\n            ImGuiPopupData& popup = g.OpenPopupStack[popup_count_to_keep];\n            if (!popup.Window)\n                continue;\n            IM_ASSERT((popup.Window->Flags & ImGuiWindowFlags_Popup) != 0);\n            if (popup.Window->Flags & ImGuiWindowFlags_ChildWindow)\n                continue;\n\n            // Trim the stack unless the popup is a direct parent of the reference window (the reference window is often the NavWindow)\n            // - With this stack of window, clicking/focusing Popup1 will close Popup2 and Popup3:\n            //     Window -> Popup1 -> Popup2 -> Popup3\n            // - Each popups may contain child windows, which is why we compare ->RootWindow!\n            //     Window -> Popup1 -> Popup1_Child -> Popup2 -> Popup2_Child\n            bool ref_window_is_descendent_of_popup = false;\n            for (int n = popup_count_to_keep; n < g.OpenPopupStack.Size; n++)\n                if (ImGuiWindow* popup_window = g.OpenPopupStack[n].Window)\n                    if (popup_window->RootWindow == ref_window->RootWindow)\n                    {\n                        ref_window_is_descendent_of_popup = true;\n                        break;\n                    }\n            if (!ref_window_is_descendent_of_popup)\n                break;\n        }\n    }\n    if (popup_count_to_keep < g.OpenPopupStack.Size) // This test is not required but it allows to set a convenient breakpoint on the statement below\n    {\n        IMGUI_DEBUG_LOG_POPUP(\"ClosePopupsOverWindow(\\\"%s\\\") -> ClosePopupToLevel(%d)\\n\", ref_window->Name, popup_count_to_keep);\n        ClosePopupToLevel(popup_count_to_keep, restore_focus_to_window_under_popup);\n    }\n}\n\nvoid ImGui::ClosePopupToLevel(int remaining, bool restore_focus_to_window_under_popup)\n{\n    ImGuiContext& g = *GImGui;\n    IMGUI_DEBUG_LOG_POPUP(\"ClosePopupToLevel(%d), restore_focus_to_window_under_popup=%d\\n\", remaining, restore_focus_to_window_under_popup);\n    IM_ASSERT(remaining >= 0 && remaining < g.OpenPopupStack.Size);\n\n    // Trim open popup stack\n    ImGuiWindow* focus_window = g.OpenPopupStack[remaining].SourceWindow;\n    ImGuiWindow* popup_window = g.OpenPopupStack[remaining].Window;\n    g.OpenPopupStack.resize(remaining);\n\n    if (restore_focus_to_window_under_popup)\n    {\n        if (focus_window && !focus_window->WasActive && popup_window)\n        {\n            // Fallback\n            FocusTopMostWindowUnderOne(popup_window, NULL);\n        }\n        else\n        {\n            if (g.NavLayer == ImGuiNavLayer_Main && focus_window)\n                focus_window = NavRestoreLastChildNavWindow(focus_window);\n            FocusWindow(focus_window);\n        }\n    }\n}\n\n// Close the popup we have begin-ed into.\nvoid ImGui::CloseCurrentPopup()\n{\n    ImGuiContext& g = *GImGui;\n    int popup_idx = g.BeginPopupStack.Size - 1;\n    if (popup_idx < 0 || popup_idx >= g.OpenPopupStack.Size || g.BeginPopupStack[popup_idx].PopupId != g.OpenPopupStack[popup_idx].PopupId)\n        return;\n\n    // Closing a menu closes its top-most parent popup (unless a modal)\n    while (popup_idx > 0)\n    {\n        ImGuiWindow* popup_window = g.OpenPopupStack[popup_idx].Window;\n        ImGuiWindow* parent_popup_window = g.OpenPopupStack[popup_idx - 1].Window;\n        bool close_parent = false;\n        if (popup_window && (popup_window->Flags & ImGuiWindowFlags_ChildMenu))\n            if (parent_popup_window == NULL || !(parent_popup_window->Flags & ImGuiWindowFlags_Modal))\n                close_parent = true;\n        if (!close_parent)\n            break;\n        popup_idx--;\n    }\n    IMGUI_DEBUG_LOG_POPUP(\"CloseCurrentPopup %d -> %d\\n\", g.BeginPopupStack.Size - 1, popup_idx);\n    ClosePopupToLevel(popup_idx, true);\n\n    // A common pattern is to close a popup when selecting a menu item/selectable that will open another window.\n    // To improve this usage pattern, we avoid nav highlight for a single frame in the parent window.\n    // Similarly, we could avoid mouse hover highlight in this window but it is less visually problematic.\n    if (ImGuiWindow* window = g.NavWindow)\n        window->DC.NavHideHighlightOneFrame = true;\n}\n\n// Attention! BeginPopup() adds default flags which BeginPopupEx()!\nbool ImGui::BeginPopupEx(ImGuiID id, ImGuiWindowFlags flags)\n{\n    ImGuiContext& g = *GImGui;\n    if (!IsPopupOpen(id, ImGuiPopupFlags_None))\n    {\n        g.NextWindowData.ClearFlags(); // We behave like Begin() and need to consume those values\n        return false;\n    }\n\n    char name[20];\n    if (flags & ImGuiWindowFlags_ChildMenu)\n        ImFormatString(name, IM_ARRAYSIZE(name), \"##Menu_%02d\", g.BeginPopupStack.Size); // Recycle windows based on depth\n    else\n        ImFormatString(name, IM_ARRAYSIZE(name), \"##Popup_%08x\", id); // Not recycling, so we can close/open during the same frame\n\n    flags |= ImGuiWindowFlags_Popup;\n    bool is_open = Begin(name, NULL, flags);\n    if (!is_open) // NB: Begin can return false when the popup is completely clipped (e.g. zero size display)\n        EndPopup();\n\n    return is_open;\n}\n\nbool ImGui::BeginPopup(const char* str_id, ImGuiWindowFlags flags)\n{\n    ImGuiContext& g = *GImGui;\n    if (g.OpenPopupStack.Size <= g.BeginPopupStack.Size) // Early out for performance\n    {\n        g.NextWindowData.ClearFlags(); // We behave like Begin() and need to consume those values\n        return false;\n    }\n    flags |= ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoSavedSettings;\n    return BeginPopupEx(g.CurrentWindow->GetID(str_id), flags);\n}\n\n// If 'p_open' is specified for a modal popup window, the popup will have a regular close button which will close the popup.\n// Note that popup visibility status is owned by Dear ImGui (and manipulated with e.g. OpenPopup) so the actual value of *p_open is meaningless here.\nbool ImGui::BeginPopupModal(const char* name, bool* p_open, ImGuiWindowFlags flags)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    const ImGuiID id = window->GetID(name);\n    if (!IsPopupOpen(id, ImGuiPopupFlags_None))\n    {\n        g.NextWindowData.ClearFlags(); // We behave like Begin() and need to consume those values\n        return false;\n    }\n\n    // Center modal windows by default for increased visibility\n    // (this won't really last as settings will kick in, and is mostly for backward compatibility. user may do the same themselves)\n    // FIXME: Should test for (PosCond & window->SetWindowPosAllowFlags) with the upcoming window.\n    if ((g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasPos) == 0)\n    {\n        const ImGuiViewport* viewport = GetMainViewport();\n        SetNextWindowPos(viewport->GetCenter(), ImGuiCond_FirstUseEver, ImVec2(0.5f, 0.5f));\n    }\n\n    flags |= ImGuiWindowFlags_Popup | ImGuiWindowFlags_Modal | ImGuiWindowFlags_NoCollapse;\n    const bool is_open = Begin(name, p_open, flags);\n    if (!is_open || (p_open && !*p_open)) // NB: is_open can be 'false' when the popup is completely clipped (e.g. zero size display)\n    {\n        EndPopup();\n        if (is_open)\n            ClosePopupToLevel(g.BeginPopupStack.Size, true);\n        return false;\n    }\n    return is_open;\n}\n\nvoid ImGui::EndPopup()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    IM_ASSERT(window->Flags & ImGuiWindowFlags_Popup);  // Mismatched BeginPopup()/EndPopup() calls\n    IM_ASSERT(g.BeginPopupStack.Size > 0);\n\n    // Make all menus and popups wrap around for now, may need to expose that policy.\n    if (g.NavWindow == window)\n        NavMoveRequestTryWrapping(window, ImGuiNavMoveFlags_LoopY);\n\n    // Child-popups don't need to be laid out\n    IM_ASSERT(g.WithinEndChild == false);\n    if (window->Flags & ImGuiWindowFlags_ChildWindow)\n        g.WithinEndChild = true;\n    End();\n    g.WithinEndChild = false;\n}\n\n// Helper to open a popup if mouse button is released over the item\n// - This is essentially the same as BeginPopupContextItem() but without the trailing BeginPopup()\nvoid ImGui::OpenPopupOnItemClick(const char* str_id, ImGuiPopupFlags popup_flags)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    int mouse_button = (popup_flags & ImGuiPopupFlags_MouseButtonMask_);\n    if (IsMouseReleased(mouse_button) && IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup))\n    {\n        ImGuiID id = str_id ? window->GetID(str_id) : g.LastItemData.ID;    // If user hasn't passed an ID, we can use the LastItemID. Using LastItemID as a Popup ID won't conflict!\n        IM_ASSERT(id != 0);                                             // You cannot pass a NULL str_id if the last item has no identifier (e.g. a Text() item)\n        OpenPopupEx(id, popup_flags);\n    }\n}\n\n// This is a helper to handle the simplest case of associating one named popup to one given widget.\n// - To create a popup associated to the last item, you generally want to pass a NULL value to str_id.\n// - To create a popup with a specific identifier, pass it in str_id.\n//    - This is useful when using using BeginPopupContextItem() on an item which doesn't have an identifier, e.g. a Text() call.\n//    - This is useful when multiple code locations may want to manipulate/open the same popup, given an explicit id.\n// - You may want to handle the whole on user side if you have specific needs (e.g. tweaking IsItemHovered() parameters).\n//   This is essentially the same as:\n//       id = str_id ? GetID(str_id) : GetItemID();\n//       OpenPopupOnItemClick(str_id);\n//       return BeginPopup(id);\n//   Which is essentially the same as:\n//       id = str_id ? GetID(str_id) : GetItemID();\n//       if (IsItemHovered() && IsMouseReleased(ImGuiMouseButton_Right))\n//           OpenPopup(id);\n//       return BeginPopup(id);\n//   The main difference being that this is tweaked to avoid computing the ID twice.\nbool ImGui::BeginPopupContextItem(const char* str_id, ImGuiPopupFlags popup_flags)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    if (window->SkipItems)\n        return false;\n    ImGuiID id = str_id ? window->GetID(str_id) : g.LastItemData.ID;    // If user hasn't passed an ID, we can use the LastItemID. Using LastItemID as a Popup ID won't conflict!\n    IM_ASSERT(id != 0);                                             // You cannot pass a NULL str_id if the last item has no identifier (e.g. a Text() item)\n    int mouse_button = (popup_flags & ImGuiPopupFlags_MouseButtonMask_);\n    if (IsMouseReleased(mouse_button) && IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup))\n        OpenPopupEx(id, popup_flags);\n    return BeginPopupEx(id, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoSavedSettings);\n}\n\nbool ImGui::BeginPopupContextWindow(const char* str_id, ImGuiPopupFlags popup_flags)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    if (!str_id)\n        str_id = \"window_context\";\n    ImGuiID id = window->GetID(str_id);\n    int mouse_button = (popup_flags & ImGuiPopupFlags_MouseButtonMask_);\n    if (IsMouseReleased(mouse_button) && IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup))\n        if (!(popup_flags & ImGuiPopupFlags_NoOpenOverItems) || !IsAnyItemHovered())\n            OpenPopupEx(id, popup_flags);\n    return BeginPopupEx(id, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoSavedSettings);\n}\n\nbool ImGui::BeginPopupContextVoid(const char* str_id, ImGuiPopupFlags popup_flags)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    if (!str_id)\n        str_id = \"void_context\";\n    ImGuiID id = window->GetID(str_id);\n    int mouse_button = (popup_flags & ImGuiPopupFlags_MouseButtonMask_);\n    if (IsMouseReleased(mouse_button) && !IsWindowHovered(ImGuiHoveredFlags_AnyWindow))\n        if (GetTopMostPopupModal() == NULL)\n            OpenPopupEx(id, popup_flags);\n    return BeginPopupEx(id, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoSavedSettings);\n}\n\n// r_avoid = the rectangle to avoid (e.g. for tooltip it is a rectangle around the mouse cursor which we want to avoid. for popups it's a small point around the cursor.)\n// r_outer = the visible area rectangle, minus safe area padding. If our popup size won't fit because of safe area padding we ignore it.\n// (r_outer is usually equivalent to the viewport rectangle minus padding, but when multi-viewports are enabled and monitor\n//  information are available, it may represent the entire platform monitor from the frame of reference of the current viewport.\n//  this allows us to have tooltips/popups displayed out of the parent viewport.)\nImVec2 ImGui::FindBestWindowPosForPopupEx(const ImVec2& ref_pos, const ImVec2& size, ImGuiDir* last_dir, const ImRect& r_outer, const ImRect& r_avoid, ImGuiPopupPositionPolicy policy)\n{\n    ImVec2 base_pos_clamped = ImClamp(ref_pos, r_outer.Min, r_outer.Max - size);\n    //GetForegroundDrawList()->AddRect(r_avoid.Min, r_avoid.Max, IM_COL32(255,0,0,255));\n    //GetForegroundDrawList()->AddRect(r_outer.Min, r_outer.Max, IM_COL32(0,255,0,255));\n\n    // Combo Box policy (we want a connecting edge)\n    if (policy == ImGuiPopupPositionPolicy_ComboBox)\n    {\n        const ImGuiDir dir_prefered_order[ImGuiDir_COUNT] = { ImGuiDir_Down, ImGuiDir_Right, ImGuiDir_Left, ImGuiDir_Up };\n        for (int n = (*last_dir != ImGuiDir_None) ? -1 : 0; n < ImGuiDir_COUNT; n++)\n        {\n            const ImGuiDir dir = (n == -1) ? *last_dir : dir_prefered_order[n];\n            if (n != -1 && dir == *last_dir) // Already tried this direction?\n                continue;\n            ImVec2 pos;\n            if (dir == ImGuiDir_Down)  pos = ImVec2(r_avoid.Min.x, r_avoid.Max.y);          // Below, Toward Right (default)\n            if (dir == ImGuiDir_Right) pos = ImVec2(r_avoid.Min.x, r_avoid.Min.y - size.y); // Above, Toward Right\n            if (dir == ImGuiDir_Left)  pos = ImVec2(r_avoid.Max.x - size.x, r_avoid.Max.y); // Below, Toward Left\n            if (dir == ImGuiDir_Up)    pos = ImVec2(r_avoid.Max.x - size.x, r_avoid.Min.y - size.y); // Above, Toward Left\n            if (!r_outer.Contains(ImRect(pos, pos + size)))\n                continue;\n            *last_dir = dir;\n            return pos;\n        }\n    }\n\n    // Tooltip and Default popup policy\n    // (Always first try the direction we used on the last frame, if any)\n    if (policy == ImGuiPopupPositionPolicy_Tooltip || policy == ImGuiPopupPositionPolicy_Default)\n    {\n        const ImGuiDir dir_prefered_order[ImGuiDir_COUNT] = { ImGuiDir_Right, ImGuiDir_Down, ImGuiDir_Up, ImGuiDir_Left };\n        for (int n = (*last_dir != ImGuiDir_None) ? -1 : 0; n < ImGuiDir_COUNT; n++)\n        {\n            const ImGuiDir dir = (n == -1) ? *last_dir : dir_prefered_order[n];\n            if (n != -1 && dir == *last_dir) // Already tried this direction?\n                continue;\n\n            const float avail_w = (dir == ImGuiDir_Left ? r_avoid.Min.x : r_outer.Max.x) - (dir == ImGuiDir_Right ? r_avoid.Max.x : r_outer.Min.x);\n            const float avail_h = (dir == ImGuiDir_Up ? r_avoid.Min.y : r_outer.Max.y) - (dir == ImGuiDir_Down ? r_avoid.Max.y : r_outer.Min.y);\n\n            // If there not enough room on one axis, there's no point in positioning on a side on this axis (e.g. when not enough width, use a top/bottom position to maximize available width)\n            if (avail_w < size.x && (dir == ImGuiDir_Left || dir == ImGuiDir_Right))\n                continue;\n            if (avail_h < size.y && (dir == ImGuiDir_Up || dir == ImGuiDir_Down))\n                continue;\n\n            ImVec2 pos;\n            pos.x = (dir == ImGuiDir_Left) ? r_avoid.Min.x - size.x : (dir == ImGuiDir_Right) ? r_avoid.Max.x : base_pos_clamped.x;\n            pos.y = (dir == ImGuiDir_Up) ? r_avoid.Min.y - size.y : (dir == ImGuiDir_Down) ? r_avoid.Max.y : base_pos_clamped.y;\n\n            // Clamp top-left corner of popup\n            pos.x = ImMax(pos.x, r_outer.Min.x);\n            pos.y = ImMax(pos.y, r_outer.Min.y);\n\n            *last_dir = dir;\n            return pos;\n        }\n    }\n\n    // Fallback when not enough room:\n    *last_dir = ImGuiDir_None;\n\n    // For tooltip we prefer avoiding the cursor at all cost even if it means that part of the tooltip won't be visible.\n    if (policy == ImGuiPopupPositionPolicy_Tooltip)\n        return ref_pos + ImVec2(2, 2);\n\n    // Otherwise try to keep within display\n    ImVec2 pos = ref_pos;\n    pos.x = ImMax(ImMin(pos.x + size.x, r_outer.Max.x) - size.x, r_outer.Min.x);\n    pos.y = ImMax(ImMin(pos.y + size.y, r_outer.Max.y) - size.y, r_outer.Min.y);\n    return pos;\n}\n\n// Note that this is used for popups, which can overlap the non work-area of individual viewports.\nImRect ImGui::GetPopupAllowedExtentRect(ImGuiWindow* window)\n{\n    ImGuiContext& g = *GImGui;\n    IM_UNUSED(window);\n    ImRect r_screen = ((ImGuiViewportP*)(void*)GetMainViewport())->GetMainRect();\n    ImVec2 padding = g.Style.DisplaySafeAreaPadding;\n    r_screen.Expand(ImVec2((r_screen.GetWidth() > padding.x * 2) ? -padding.x : 0.0f, (r_screen.GetHeight() > padding.y * 2) ? -padding.y : 0.0f));\n    return r_screen;\n}\n\nImVec2 ImGui::FindBestWindowPosForPopup(ImGuiWindow* window)\n{\n    ImGuiContext& g = *GImGui;\n\n    ImRect r_outer = GetPopupAllowedExtentRect(window);\n    if (window->Flags & ImGuiWindowFlags_ChildMenu)\n    {\n        // Child menus typically request _any_ position within the parent menu item, and then we move the new menu outside the parent bounds.\n        // This is how we end up with child menus appearing (most-commonly) on the right of the parent menu.\n        IM_ASSERT(g.CurrentWindow == window);\n        ImGuiWindow* parent_window = g.CurrentWindowStack[g.CurrentWindowStack.Size - 2].Window;\n        float horizontal_overlap = g.Style.ItemInnerSpacing.x; // We want some overlap to convey the relative depth of each menu (currently the amount of overlap is hard-coded to style.ItemSpacing.x).\n        ImRect r_avoid;\n        if (parent_window->DC.MenuBarAppending)\n            r_avoid = ImRect(-FLT_MAX, parent_window->ClipRect.Min.y, FLT_MAX, parent_window->ClipRect.Max.y); // Avoid parent menu-bar. If we wanted multi-line menu-bar, we may instead want to have the calling window setup e.g. a NextWindowData.PosConstraintAvoidRect field\n        else\n            r_avoid = ImRect(parent_window->Pos.x + horizontal_overlap, -FLT_MAX, parent_window->Pos.x + parent_window->Size.x - horizontal_overlap - parent_window->ScrollbarSizes.x, FLT_MAX);\n        return FindBestWindowPosForPopupEx(window->Pos, window->Size, &window->AutoPosLastDirection, r_outer, r_avoid, ImGuiPopupPositionPolicy_Default);\n    }\n    if (window->Flags & ImGuiWindowFlags_Popup)\n    {\n        ImRect r_avoid = ImRect(window->Pos.x - 1, window->Pos.y - 1, window->Pos.x + 1, window->Pos.y + 1);\n        return FindBestWindowPosForPopupEx(window->Pos, window->Size, &window->AutoPosLastDirection, r_outer, r_avoid, ImGuiPopupPositionPolicy_Default);\n    }\n    if (window->Flags & ImGuiWindowFlags_Tooltip)\n    {\n        // Position tooltip (always follows mouse)\n        float sc = g.Style.MouseCursorScale;\n        ImVec2 ref_pos = NavCalcPreferredRefPos();\n        ImRect r_avoid;\n        if (!g.NavDisableHighlight && g.NavDisableMouseHover && !(g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableSetMousePos))\n            r_avoid = ImRect(ref_pos.x - 16, ref_pos.y - 8, ref_pos.x + 16, ref_pos.y + 8);\n        else\n            r_avoid = ImRect(ref_pos.x - 16, ref_pos.y - 8, ref_pos.x + 24 * sc, ref_pos.y + 24 * sc); // FIXME: Hard-coded based on mouse cursor shape expectation. Exact dimension not very important.\n        return FindBestWindowPosForPopupEx(ref_pos, window->Size, &window->AutoPosLastDirection, r_outer, r_avoid, ImGuiPopupPositionPolicy_Tooltip);\n    }\n    IM_ASSERT(0);\n    return window->Pos;\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] KEYBOARD/GAMEPAD NAVIGATION\n//-----------------------------------------------------------------------------\n\n// FIXME-NAV: The existence of SetNavID vs SetFocusID properly needs to be clarified/reworked.\nvoid ImGui::SetNavID(ImGuiID id, ImGuiNavLayer nav_layer, ImGuiID focus_scope_id, const ImRect& rect_rel)\n{\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(g.NavWindow != NULL);\n    IM_ASSERT(nav_layer == ImGuiNavLayer_Main || nav_layer == ImGuiNavLayer_Menu);\n    g.NavId = id;\n    g.NavLayer = nav_layer;\n    g.NavFocusScopeId = focus_scope_id;\n    g.NavWindow->NavLastIds[nav_layer] = id;\n    g.NavWindow->NavRectRel[nav_layer] = rect_rel;\n    //g.NavDisableHighlight = false;\n    //g.NavDisableMouseHover = g.NavMousePosDirty = true;\n}\n\nvoid ImGui::SetFocusID(ImGuiID id, ImGuiWindow* window)\n{\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(id != 0);\n\n    // Assume that SetFocusID() is called in the context where its window->DC.NavLayerCurrent and window->DC.NavFocusScopeIdCurrent are valid.\n    // Note that window may be != g.CurrentWindow (e.g. SetFocusID call in InputTextEx for multi-line text)\n    const ImGuiNavLayer nav_layer = window->DC.NavLayerCurrent;\n    if (g.NavWindow != window)\n        g.NavInitRequest = false;\n    g.NavWindow = window;\n    g.NavId = id;\n    g.NavLayer = nav_layer;\n    g.NavFocusScopeId = window->DC.NavFocusScopeIdCurrent;\n    window->NavLastIds[nav_layer] = id;\n    if (g.LastItemData.ID == id)\n        window->NavRectRel[nav_layer] = ImRect(g.LastItemData.Rect.Min - window->Pos, g.LastItemData.Rect.Max - window->Pos);\n\n    if (g.ActiveIdSource == ImGuiInputSource_Nav)\n        g.NavDisableMouseHover = true;\n    else\n        g.NavDisableHighlight = true;\n}\n\nImGuiDir ImGetDirQuadrantFromDelta(float dx, float dy)\n{\n    if (ImFabs(dx) > ImFabs(dy))\n        return (dx > 0.0f) ? ImGuiDir_Right : ImGuiDir_Left;\n    return (dy > 0.0f) ? ImGuiDir_Down : ImGuiDir_Up;\n}\n\nstatic float inline NavScoreItemDistInterval(float a0, float a1, float b0, float b1)\n{\n    if (a1 < b0)\n        return a1 - b0;\n    if (b1 < a0)\n        return a0 - b1;\n    return 0.0f;\n}\n\nstatic void inline NavClampRectToVisibleAreaForMoveDir(ImGuiDir move_dir, ImRect& r, const ImRect& clip_rect)\n{\n    if (move_dir == ImGuiDir_Left || move_dir == ImGuiDir_Right)\n    {\n        r.Min.y = ImClamp(r.Min.y, clip_rect.Min.y, clip_rect.Max.y);\n        r.Max.y = ImClamp(r.Max.y, clip_rect.Min.y, clip_rect.Max.y);\n    }\n    else\n    {\n        r.Min.x = ImClamp(r.Min.x, clip_rect.Min.x, clip_rect.Max.x);\n        r.Max.x = ImClamp(r.Max.x, clip_rect.Min.x, clip_rect.Max.x);\n    }\n}\n\n// Scoring function for gamepad/keyboard directional navigation. Based on https://gist.github.com/rygorous/6981057\nstatic bool ImGui::NavScoreItem(ImGuiNavItemData* result, ImRect cand)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    if (g.NavLayer != window->DC.NavLayerCurrent)\n        return false;\n\n    const ImRect& curr = g.NavScoringRect; // Current modified source rect (NB: we've applied Max.x = Min.x in NavUpdate() to inhibit the effect of having varied item width)\n    g.NavScoringCount++;\n\n    // When entering through a NavFlattened border, we consider child window items as fully clipped for scoring\n    if (window->ParentWindow == g.NavWindow)\n    {\n        IM_ASSERT((window->Flags | g.NavWindow->Flags) & ImGuiWindowFlags_NavFlattened);\n        if (!window->ClipRect.Overlaps(cand))\n            return false;\n        cand.ClipWithFull(window->ClipRect); // This allows the scored item to not overlap other candidates in the parent window\n    }\n\n    // We perform scoring on items bounding box clipped by the current clipping rectangle on the other axis (clipping on our movement axis would give us equal scores for all clipped items)\n    // For example, this ensure that items in one column are not reached when moving vertically from items in another column.\n    NavClampRectToVisibleAreaForMoveDir(g.NavMoveClipDir, cand, window->ClipRect);\n\n    // Compute distance between boxes\n    // FIXME-NAV: Introducing biases for vertical navigation, needs to be removed.\n    float dbx = NavScoreItemDistInterval(cand.Min.x, cand.Max.x, curr.Min.x, curr.Max.x);\n    float dby = NavScoreItemDistInterval(ImLerp(cand.Min.y, cand.Max.y, 0.2f), ImLerp(cand.Min.y, cand.Max.y, 0.8f), ImLerp(curr.Min.y, curr.Max.y, 0.2f), ImLerp(curr.Min.y, curr.Max.y, 0.8f)); // Scale down on Y to keep using box-distance for vertically touching items\n    if (dby != 0.0f && dbx != 0.0f)\n        dbx = (dbx / 1000.0f) + ((dbx > 0.0f) ? +1.0f : -1.0f);\n    float dist_box = ImFabs(dbx) + ImFabs(dby);\n\n    // Compute distance between centers (this is off by a factor of 2, but we only compare center distances with each other so it doesn't matter)\n    float dcx = (cand.Min.x + cand.Max.x) - (curr.Min.x + curr.Max.x);\n    float dcy = (cand.Min.y + cand.Max.y) - (curr.Min.y + curr.Max.y);\n    float dist_center = ImFabs(dcx) + ImFabs(dcy); // L1 metric (need this for our connectedness guarantee)\n\n    // Determine which quadrant of 'curr' our candidate item 'cand' lies in based on distance\n    ImGuiDir quadrant;\n    float dax = 0.0f, day = 0.0f, dist_axial = 0.0f;\n    if (dbx != 0.0f || dby != 0.0f)\n    {\n        // For non-overlapping boxes, use distance between boxes\n        dax = dbx;\n        day = dby;\n        dist_axial = dist_box;\n        quadrant = ImGetDirQuadrantFromDelta(dbx, dby);\n    }\n    else if (dcx != 0.0f || dcy != 0.0f)\n    {\n        // For overlapping boxes with different centers, use distance between centers\n        dax = dcx;\n        day = dcy;\n        dist_axial = dist_center;\n        quadrant = ImGetDirQuadrantFromDelta(dcx, dcy);\n    }\n    else\n    {\n        // Degenerate case: two overlapping buttons with same center, break ties arbitrarily (note that LastItemId here is really the _previous_ item order, but it doesn't matter)\n        quadrant = (g.LastItemData.ID < g.NavId) ? ImGuiDir_Left : ImGuiDir_Right;\n    }\n\n#if IMGUI_DEBUG_NAV_SCORING\n    char buf[128];\n    if (IsMouseHoveringRect(cand.Min, cand.Max))\n    {\n        ImFormatString(buf, IM_ARRAYSIZE(buf), \"dbox (%.2f,%.2f->%.4f)\\ndcen (%.2f,%.2f->%.4f)\\nd (%.2f,%.2f->%.4f)\\nnav %c, quadrant %c\", dbx, dby, dist_box, dcx, dcy, dist_center, dax, day, dist_axial, \"WENS\"[g.NavMoveDir], \"WENS\"[quadrant]);\n        ImDrawList* draw_list = GetForegroundDrawList(window);\n        draw_list->AddRect(curr.Min, curr.Max, IM_COL32(255,200,0,100));\n        draw_list->AddRect(cand.Min, cand.Max, IM_COL32(255,255,0,200));\n        draw_list->AddRectFilled(cand.Max - ImVec2(4, 4), cand.Max + CalcTextSize(buf) + ImVec2(4, 4), IM_COL32(40,0,0,150));\n        draw_list->AddText(g.IO.FontDefault, 13.0f, cand.Max, ~0U, buf);\n    }\n    else if (g.IO.KeyCtrl) // Hold to preview score in matching quadrant. Press C to rotate.\n    {\n        if (IsKeyPressedMap(ImGuiKey_C)) { g.NavMoveDirLast = (ImGuiDir)((g.NavMoveDirLast + 1) & 3); g.IO.KeysDownDuration[g.IO.KeyMap[ImGuiKey_C]] = 0.01f; }\n        if (quadrant == g.NavMoveDir)\n        {\n            ImFormatString(buf, IM_ARRAYSIZE(buf), \"%.0f/%.0f\", dist_box, dist_center);\n            ImDrawList* draw_list = GetForegroundDrawList(window);\n            draw_list->AddRectFilled(cand.Min, cand.Max, IM_COL32(255, 0, 0, 200));\n            draw_list->AddText(g.IO.FontDefault, 13.0f, cand.Min, IM_COL32(255, 255, 255, 255), buf);\n        }\n    }\n#endif\n\n    // Is it in the quadrant we're interesting in moving to?\n    bool new_best = false;\n    if (quadrant == g.NavMoveDir)\n    {\n        // Does it beat the current best candidate?\n        if (dist_box < result->DistBox)\n        {\n            result->DistBox = dist_box;\n            result->DistCenter = dist_center;\n            return true;\n        }\n        if (dist_box == result->DistBox)\n        {\n            // Try using distance between center points to break ties\n            if (dist_center < result->DistCenter)\n            {\n                result->DistCenter = dist_center;\n                new_best = true;\n            }\n            else if (dist_center == result->DistCenter)\n            {\n                // Still tied! we need to be extra-careful to make sure everything gets linked properly. We consistently break ties by symbolically moving \"later\" items\n                // (with higher index) to the right/downwards by an infinitesimal amount since we the current \"best\" button already (so it must have a lower index),\n                // this is fairly easy. This rule ensures that all buttons with dx==dy==0 will end up being linked in order of appearance along the x axis.\n                if (((g.NavMoveDir == ImGuiDir_Up || g.NavMoveDir == ImGuiDir_Down) ? dby : dbx) < 0.0f) // moving bj to the right/down decreases distance\n                    new_best = true;\n            }\n        }\n    }\n\n    // Axial check: if 'curr' has no link at all in some direction and 'cand' lies roughly in that direction, add a tentative link. This will only be kept if no \"real\" matches\n    // are found, so it only augments the graph produced by the above method using extra links. (important, since it doesn't guarantee strong connectedness)\n    // This is just to avoid buttons having no links in a particular direction when there's a suitable neighbor. you get good graphs without this too.\n    // 2017/09/29: FIXME: This now currently only enabled inside menu bars, ideally we'd disable it everywhere. Menus in particular need to catch failure. For general navigation it feels awkward.\n    // Disabling it may lead to disconnected graphs when nodes are very spaced out on different axis. Perhaps consider offering this as an option?\n    if (result->DistBox == FLT_MAX && dist_axial < result->DistAxial)  // Check axial match\n        if (g.NavLayer == ImGuiNavLayer_Menu && !(g.NavWindow->Flags & ImGuiWindowFlags_ChildMenu))\n            if ((g.NavMoveDir == ImGuiDir_Left && dax < 0.0f) || (g.NavMoveDir == ImGuiDir_Right && dax > 0.0f) || (g.NavMoveDir == ImGuiDir_Up && day < 0.0f) || (g.NavMoveDir == ImGuiDir_Down && day > 0.0f))\n            {\n                result->DistAxial = dist_axial;\n                new_best = true;\n            }\n\n    return new_best;\n}\n\nstatic void ImGui::NavApplyItemToResult(ImGuiNavItemData* result, ImGuiWindow* window, ImGuiID id, const ImRect& nav_bb_rel)\n{\n    result->Window = window;\n    result->ID = id;\n    result->FocusScopeId = window->DC.NavFocusScopeIdCurrent;\n    result->RectRel = nav_bb_rel;\n}\n\n// We get there when either NavId == id, or when g.NavAnyRequest is set (which is updated by NavUpdateAnyRequestFlag above)\nstatic void ImGui::NavProcessItem(ImGuiWindow* window, const ImRect& nav_bb, const ImGuiID id)\n{\n    ImGuiContext& g = *GImGui;\n    //if (!g.IO.NavActive)  // [2017/10/06] Removed this possibly redundant test but I am not sure of all the side-effects yet. Some of the feature here will need to work regardless of using a _NoNavInputs flag.\n    //    return;\n\n    const ImGuiItemFlags item_flags = g.LastItemData.InFlags;\n    const ImRect nav_bb_rel(nav_bb.Min - window->Pos, nav_bb.Max - window->Pos);\n\n    // Process Init Request\n    if (g.NavInitRequest && g.NavLayer == window->DC.NavLayerCurrent)\n    {\n        // Even if 'ImGuiItemFlags_NoNavDefaultFocus' is on (typically collapse/close button) we record the first ResultId so they can be used as a fallback\n        const bool candidate_for_nav_default_focus = (item_flags & (ImGuiItemFlags_NoNavDefaultFocus | ImGuiItemFlags_Disabled)) == 0;\n        if (candidate_for_nav_default_focus || g.NavInitResultId == 0)\n        {\n            g.NavInitResultId = id;\n            g.NavInitResultRectRel = nav_bb_rel;\n        }\n        if (candidate_for_nav_default_focus)\n        {\n            g.NavInitRequest = false; // Found a match, clear request\n            NavUpdateAnyRequestFlag();\n        }\n    }\n\n    // Process Move Request (scoring for navigation)\n    // FIXME-NAV: Consider policy for double scoring (scoring from NavScoringRectScreen + scoring from a rect wrapped according to current wrapping policy)\n    if ((g.NavId != id || (g.NavMoveRequestFlags & ImGuiNavMoveFlags_AllowCurrentNavId)) && !(item_flags & (ImGuiItemFlags_Disabled | ImGuiItemFlags_NoNav)))\n    {\n        ImGuiNavItemData* result = (window == g.NavWindow) ? &g.NavMoveResultLocal : &g.NavMoveResultOther;\n#if IMGUI_DEBUG_NAV_SCORING\n        // [DEBUG] Score all items in NavWindow at all times\n        if (!g.NavMoveRequest)\n            g.NavMoveDir = g.NavMoveDirLast;\n        bool new_best = NavScoreItem(result, nav_bb) && g.NavMoveRequest;\n#else\n        bool new_best = g.NavMoveRequest && NavScoreItem(result, nav_bb);\n#endif\n        if (new_best)\n            NavApplyItemToResult(result, window, id, nav_bb_rel);\n\n        // Features like PageUp/PageDown need to maintain a separate score for the visible set of items.\n        const float VISIBLE_RATIO = 0.70f;\n        if ((g.NavMoveRequestFlags & ImGuiNavMoveFlags_AlsoScoreVisibleSet) && window->ClipRect.Overlaps(nav_bb))\n            if (ImClamp(nav_bb.Max.y, window->ClipRect.Min.y, window->ClipRect.Max.y) - ImClamp(nav_bb.Min.y, window->ClipRect.Min.y, window->ClipRect.Max.y) >= (nav_bb.Max.y - nav_bb.Min.y) * VISIBLE_RATIO)\n                if (NavScoreItem(&g.NavMoveResultLocalVisibleSet, nav_bb))\n                    NavApplyItemToResult(&g.NavMoveResultLocalVisibleSet, window, id, nav_bb_rel);\n    }\n\n    // Update window-relative bounding box of navigated item\n    if (g.NavId == id)\n    {\n        g.NavWindow = window;                                           // Always refresh g.NavWindow, because some operations such as FocusItem() don't have a window.\n        g.NavLayer = window->DC.NavLayerCurrent;\n        g.NavFocusScopeId = window->DC.NavFocusScopeIdCurrent;\n        g.NavIdIsAlive = true;\n        window->NavRectRel[window->DC.NavLayerCurrent] = nav_bb_rel;    // Store item bounding box (relative to window position)\n    }\n}\n\nbool ImGui::NavMoveRequestButNoResultYet()\n{\n    ImGuiContext& g = *GImGui;\n    return g.NavMoveRequest && g.NavMoveResultLocal.ID == 0 && g.NavMoveResultOther.ID == 0;\n}\n\nvoid ImGui::NavMoveRequestCancel()\n{\n    ImGuiContext& g = *GImGui;\n    g.NavMoveRequest = false;\n    NavUpdateAnyRequestFlag();\n}\n\nvoid ImGui::NavMoveRequestForward(ImGuiDir move_dir, ImGuiDir clip_dir, const ImRect& bb_rel, ImGuiNavMoveFlags move_flags)\n{\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(g.NavMoveRequestForward == ImGuiNavForward_None);\n    NavMoveRequestCancel();\n    g.NavMoveDir = move_dir;\n    g.NavMoveClipDir = clip_dir;\n    g.NavMoveRequestForward = ImGuiNavForward_ForwardQueued;\n    g.NavMoveRequestFlags = move_flags;\n    g.NavWindow->NavRectRel[g.NavLayer] = bb_rel;\n}\n\nvoid ImGui::NavMoveRequestTryWrapping(ImGuiWindow* window, ImGuiNavMoveFlags move_flags)\n{\n    ImGuiContext& g = *GImGui;\n\n    // Navigation wrap-around logic is delayed to the end of the frame because this operation is only valid after entire\n    // popup is assembled and in case of appended popups it is not clear which EndPopup() call is final.\n    g.NavWrapRequestWindow = window;\n    g.NavWrapRequestFlags = move_flags;\n}\n\n// FIXME: This could be replaced by updating a frame number in each window when (window == NavWindow) and (NavLayer == 0).\n// This way we could find the last focused window among our children. It would be much less confusing this way?\nstatic void ImGui::NavSaveLastChildNavWindowIntoParent(ImGuiWindow* nav_window)\n{\n    ImGuiWindow* parent = nav_window;\n    while (parent && parent->RootWindow != parent && (parent->Flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_ChildMenu)) == 0)\n        parent = parent->ParentWindow;\n    if (parent && parent != nav_window)\n        parent->NavLastChildNavWindow = nav_window;\n}\n\n// Restore the last focused child.\n// Call when we are expected to land on the Main Layer (0) after FocusWindow()\nstatic ImGuiWindow* ImGui::NavRestoreLastChildNavWindow(ImGuiWindow* window)\n{\n    if (window->NavLastChildNavWindow && window->NavLastChildNavWindow->WasActive)\n        return window->NavLastChildNavWindow;\n    return window;\n}\n\nvoid ImGui::NavRestoreLayer(ImGuiNavLayer layer)\n{\n    ImGuiContext& g = *GImGui;\n    if (layer == ImGuiNavLayer_Main)\n        g.NavWindow = NavRestoreLastChildNavWindow(g.NavWindow);\n    ImGuiWindow* window = g.NavWindow;\n    if (window->NavLastIds[layer] != 0)\n    {\n        SetNavID(window->NavLastIds[layer], layer, 0, window->NavRectRel[layer]);\n        g.NavDisableHighlight = false;\n        g.NavDisableMouseHover = g.NavMousePosDirty = true;\n    }\n    else\n    {\n        g.NavLayer = layer;\n        NavInitWindow(window, true);\n    }\n}\n\nstatic inline void ImGui::NavUpdateAnyRequestFlag()\n{\n    ImGuiContext& g = *GImGui;\n    g.NavAnyRequest = g.NavMoveRequest || g.NavInitRequest || (IMGUI_DEBUG_NAV_SCORING && g.NavWindow != NULL);\n    if (g.NavAnyRequest)\n        IM_ASSERT(g.NavWindow != NULL);\n}\n\n// This needs to be called before we submit any widget (aka in or before Begin)\nvoid ImGui::NavInitWindow(ImGuiWindow* window, bool force_reinit)\n{\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(window == g.NavWindow);\n\n    if (window->Flags & ImGuiWindowFlags_NoNavInputs)\n    {\n        g.NavId = g.NavFocusScopeId = 0;\n        return;\n    }\n\n    bool init_for_nav = false;\n    if (window == window->RootWindow || (window->Flags & ImGuiWindowFlags_Popup) || (window->NavLastIds[0] == 0) || force_reinit)\n        init_for_nav = true;\n    IMGUI_DEBUG_LOG_NAV(\"[nav] NavInitRequest: from NavInitWindow(), init_for_nav=%d, window=\\\"%s\\\", layer=%d\\n\", init_for_nav, window->Name, g.NavLayer);\n    if (init_for_nav)\n    {\n        SetNavID(0, g.NavLayer, 0, ImRect());\n        g.NavInitRequest = true;\n        g.NavInitRequestFromMove = false;\n        g.NavInitResultId = 0;\n        g.NavInitResultRectRel = ImRect();\n        NavUpdateAnyRequestFlag();\n    }\n    else\n    {\n        g.NavId = window->NavLastIds[0];\n        g.NavFocusScopeId = 0;\n    }\n}\n\nstatic ImVec2 ImGui::NavCalcPreferredRefPos()\n{\n    ImGuiContext& g = *GImGui;\n    if (g.NavDisableHighlight || !g.NavDisableMouseHover || !g.NavWindow)\n    {\n        // Mouse (we need a fallback in case the mouse becomes invalid after being used)\n        if (IsMousePosValid(&g.IO.MousePos))\n            return g.IO.MousePos;\n        return g.LastValidMousePos;\n    }\n    else\n    {\n        // When navigation is active and mouse is disabled, decide on an arbitrary position around the bottom left of the currently navigated item.\n        const ImRect& rect_rel = g.NavWindow->NavRectRel[g.NavLayer];\n        ImVec2 pos = g.NavWindow->Pos + ImVec2(rect_rel.Min.x + ImMin(g.Style.FramePadding.x * 4, rect_rel.GetWidth()), rect_rel.Max.y - ImMin(g.Style.FramePadding.y, rect_rel.GetHeight()));\n        ImGuiViewport* viewport = GetMainViewport();\n        return ImFloor(ImClamp(pos, viewport->Pos, viewport->Pos + viewport->Size)); // ImFloor() is important because non-integer mouse position application in backend might be lossy and result in undesirable non-zero delta.\n    }\n}\n\nfloat ImGui::GetNavInputAmount(ImGuiNavInput n, ImGuiInputReadMode mode)\n{\n    ImGuiContext& g = *GImGui;\n    if (mode == ImGuiInputReadMode_Down)\n        return g.IO.NavInputs[n];                         // Instant, read analog input (0.0f..1.0f, as provided by user)\n\n    const float t = g.IO.NavInputsDownDuration[n];\n    if (t < 0.0f && mode == ImGuiInputReadMode_Released)  // Return 1.0f when just released, no repeat, ignore analog input.\n        return (g.IO.NavInputsDownDurationPrev[n] >= 0.0f ? 1.0f : 0.0f);\n    if (t < 0.0f)\n        return 0.0f;\n    if (mode == ImGuiInputReadMode_Pressed)               // Return 1.0f when just pressed, no repeat, ignore analog input.\n        return (t == 0.0f) ? 1.0f : 0.0f;\n    if (mode == ImGuiInputReadMode_Repeat)\n        return (float)CalcTypematicRepeatAmount(t - g.IO.DeltaTime, t, g.IO.KeyRepeatDelay * 0.72f, g.IO.KeyRepeatRate * 0.80f);\n    if (mode == ImGuiInputReadMode_RepeatSlow)\n        return (float)CalcTypematicRepeatAmount(t - g.IO.DeltaTime, t, g.IO.KeyRepeatDelay * 1.25f, g.IO.KeyRepeatRate * 2.00f);\n    if (mode == ImGuiInputReadMode_RepeatFast)\n        return (float)CalcTypematicRepeatAmount(t - g.IO.DeltaTime, t, g.IO.KeyRepeatDelay * 0.72f, g.IO.KeyRepeatRate * 0.30f);\n    return 0.0f;\n}\n\nImVec2 ImGui::GetNavInputAmount2d(ImGuiNavDirSourceFlags dir_sources, ImGuiInputReadMode mode, float slow_factor, float fast_factor)\n{\n    ImVec2 delta(0.0f, 0.0f);\n    if (dir_sources & ImGuiNavDirSourceFlags_Keyboard)\n        delta += ImVec2(GetNavInputAmount(ImGuiNavInput_KeyRight_, mode)   - GetNavInputAmount(ImGuiNavInput_KeyLeft_,   mode), GetNavInputAmount(ImGuiNavInput_KeyDown_,   mode) - GetNavInputAmount(ImGuiNavInput_KeyUp_,   mode));\n    if (dir_sources & ImGuiNavDirSourceFlags_PadDPad)\n        delta += ImVec2(GetNavInputAmount(ImGuiNavInput_DpadRight, mode)   - GetNavInputAmount(ImGuiNavInput_DpadLeft,   mode), GetNavInputAmount(ImGuiNavInput_DpadDown,   mode) - GetNavInputAmount(ImGuiNavInput_DpadUp,   mode));\n    if (dir_sources & ImGuiNavDirSourceFlags_PadLStick)\n        delta += ImVec2(GetNavInputAmount(ImGuiNavInput_LStickRight, mode) - GetNavInputAmount(ImGuiNavInput_LStickLeft, mode), GetNavInputAmount(ImGuiNavInput_LStickDown, mode) - GetNavInputAmount(ImGuiNavInput_LStickUp, mode));\n    if (slow_factor != 0.0f && IsNavInputDown(ImGuiNavInput_TweakSlow))\n        delta *= slow_factor;\n    if (fast_factor != 0.0f && IsNavInputDown(ImGuiNavInput_TweakFast))\n        delta *= fast_factor;\n    return delta;\n}\n\nstatic void ImGui::NavUpdate()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiIO& io = g.IO;\n\n    io.WantSetMousePos = false;\n    g.NavWrapRequestWindow = NULL;\n    g.NavWrapRequestFlags = ImGuiNavMoveFlags_None;\n#if 0\n    if (g.NavScoringCount > 0) IMGUI_DEBUG_LOG(\"NavScoringCount %d for '%s' layer %d (Init:%d, Move:%d)\\n\", g.FrameCount, g.NavScoringCount, g.NavWindow ? g.NavWindow->Name : \"NULL\", g.NavLayer, g.NavInitRequest || g.NavInitResultId != 0, g.NavMoveRequest);\n#endif\n\n    // Set input source as Gamepad when buttons are pressed (as some features differs when used with Gamepad vs Keyboard)\n    // (do it before we map Keyboard input!)\n    bool nav_keyboard_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0;\n    bool nav_gamepad_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) != 0 && (io.BackendFlags & ImGuiBackendFlags_HasGamepad) != 0;\n    if (nav_gamepad_active && g.NavInputSource != ImGuiInputSource_Gamepad)\n    {\n        if (io.NavInputs[ImGuiNavInput_Activate] > 0.0f || io.NavInputs[ImGuiNavInput_Input] > 0.0f || io.NavInputs[ImGuiNavInput_Cancel] > 0.0f || io.NavInputs[ImGuiNavInput_Menu] > 0.0f\n            || io.NavInputs[ImGuiNavInput_DpadLeft] > 0.0f || io.NavInputs[ImGuiNavInput_DpadRight] > 0.0f || io.NavInputs[ImGuiNavInput_DpadUp] > 0.0f || io.NavInputs[ImGuiNavInput_DpadDown] > 0.0f)\n            g.NavInputSource = ImGuiInputSource_Gamepad;\n    }\n\n    // Update Keyboard->Nav inputs mapping\n    if (nav_keyboard_active)\n    {\n        #define NAV_MAP_KEY(_KEY, _NAV_INPUT)  do { if (IsKeyDown(io.KeyMap[_KEY])) { io.NavInputs[_NAV_INPUT] = 1.0f; g.NavInputSource = ImGuiInputSource_Keyboard; } } while (0)\n        NAV_MAP_KEY(ImGuiKey_Space,     ImGuiNavInput_Activate );\n        NAV_MAP_KEY(ImGuiKey_Enter,     ImGuiNavInput_Input    );\n        NAV_MAP_KEY(ImGuiKey_Escape,    ImGuiNavInput_Cancel   );\n        NAV_MAP_KEY(ImGuiKey_LeftArrow, ImGuiNavInput_KeyLeft_ );\n        NAV_MAP_KEY(ImGuiKey_RightArrow,ImGuiNavInput_KeyRight_);\n        NAV_MAP_KEY(ImGuiKey_UpArrow,   ImGuiNavInput_KeyUp_   );\n        NAV_MAP_KEY(ImGuiKey_DownArrow, ImGuiNavInput_KeyDown_ );\n        if (io.KeyCtrl)\n            io.NavInputs[ImGuiNavInput_TweakSlow] = 1.0f;\n        if (io.KeyShift)\n            io.NavInputs[ImGuiNavInput_TweakFast] = 1.0f;\n        #undef NAV_MAP_KEY\n    }\n    memcpy(io.NavInputsDownDurationPrev, io.NavInputsDownDuration, sizeof(io.NavInputsDownDuration));\n    for (int i = 0; i < IM_ARRAYSIZE(io.NavInputs); i++)\n        io.NavInputsDownDuration[i] = (io.NavInputs[i] > 0.0f) ? (io.NavInputsDownDuration[i] < 0.0f ? 0.0f : io.NavInputsDownDuration[i] + io.DeltaTime) : -1.0f;\n\n    // Process navigation init request (select first/default focus)\n    if (g.NavInitResultId != 0)\n        NavUpdateInitResult();\n    g.NavInitRequest = false;\n    g.NavInitRequestFromMove = false;\n    g.NavInitResultId = 0;\n    g.NavJustMovedToId = 0;\n\n    // Process navigation move request\n    if (g.NavMoveRequest)\n        NavUpdateMoveResult();\n\n    // When a forwarded move request failed, we restore the highlight that we disabled during the forward frame\n    if (g.NavMoveRequestForward == ImGuiNavForward_ForwardActive)\n    {\n        IM_ASSERT(g.NavMoveRequest);\n        if (g.NavMoveResultLocal.ID == 0 && g.NavMoveResultOther.ID == 0)\n            g.NavDisableHighlight = false;\n        g.NavMoveRequestForward = ImGuiNavForward_None;\n    }\n\n    // Apply application mouse position movement, after we had a chance to process move request result.\n    if (g.NavMousePosDirty && g.NavIdIsAlive)\n    {\n        // Set mouse position given our knowledge of the navigated item position from last frame\n        if ((io.ConfigFlags & ImGuiConfigFlags_NavEnableSetMousePos) && (io.BackendFlags & ImGuiBackendFlags_HasSetMousePos))\n            if (!g.NavDisableHighlight && g.NavDisableMouseHover && g.NavWindow)\n            {\n                io.MousePos = io.MousePosPrev = NavCalcPreferredRefPos();\n                io.WantSetMousePos = true;\n            }\n        g.NavMousePosDirty = false;\n    }\n    g.NavIdIsAlive = false;\n    g.NavJustTabbedId = 0;\n    IM_ASSERT(g.NavLayer == 0 || g.NavLayer == 1);\n\n    // Store our return window (for returning from Layer 1 to Layer 0) and clear it as soon as we step back in our own Layer 0\n    if (g.NavWindow)\n        NavSaveLastChildNavWindowIntoParent(g.NavWindow);\n    if (g.NavWindow && g.NavWindow->NavLastChildNavWindow != NULL && g.NavLayer == ImGuiNavLayer_Main)\n        g.NavWindow->NavLastChildNavWindow = NULL;\n\n    // Update CTRL+TAB and Windowing features (hold Square to move/resize/etc.)\n    NavUpdateWindowing();\n\n    // Set output flags for user application\n    io.NavActive = (nav_keyboard_active || nav_gamepad_active) && g.NavWindow && !(g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs);\n    io.NavVisible = (io.NavActive && g.NavId != 0 && !g.NavDisableHighlight) || (g.NavWindowingTarget != NULL);\n\n    // Process NavCancel input (to close a popup, get back to parent, clear focus)\n    if (IsNavInputTest(ImGuiNavInput_Cancel, ImGuiInputReadMode_Pressed))\n    {\n        IMGUI_DEBUG_LOG_NAV(\"[nav] ImGuiNavInput_Cancel\\n\");\n        if (g.ActiveId != 0)\n        {\n            if (!IsActiveIdUsingNavInput(ImGuiNavInput_Cancel))\n                ClearActiveID();\n        }\n        else if (g.NavLayer != ImGuiNavLayer_Main)\n        {\n            // Leave the \"menu\" layer\n            NavRestoreLayer(ImGuiNavLayer_Main);\n        }\n        else if (g.NavWindow && g.NavWindow != g.NavWindow->RootWindow && !(g.NavWindow->Flags & ImGuiWindowFlags_Popup) && g.NavWindow->ParentWindow)\n        {\n            // Exit child window\n            ImGuiWindow* child_window = g.NavWindow;\n            ImGuiWindow* parent_window = g.NavWindow->ParentWindow;\n            IM_ASSERT(child_window->ChildId != 0);\n            ImRect child_rect = child_window->Rect();\n            FocusWindow(parent_window);\n            SetNavID(child_window->ChildId, ImGuiNavLayer_Main, 0, ImRect(child_rect.Min - parent_window->Pos, child_rect.Max - parent_window->Pos));\n        }\n        else if (g.OpenPopupStack.Size > 0)\n        {\n            // Close open popup/menu\n            if (!(g.OpenPopupStack.back().Window->Flags & ImGuiWindowFlags_Modal))\n                ClosePopupToLevel(g.OpenPopupStack.Size - 1, true);\n        }\n        else\n        {\n            // Clear NavLastId for popups but keep it for regular child window so we can leave one and come back where we were\n            if (g.NavWindow && ((g.NavWindow->Flags & ImGuiWindowFlags_Popup) || !(g.NavWindow->Flags & ImGuiWindowFlags_ChildWindow)))\n                g.NavWindow->NavLastIds[0] = 0;\n            g.NavId = g.NavFocusScopeId = 0;\n        }\n    }\n\n    // Process manual activation request\n    g.NavActivateId = g.NavActivateDownId = g.NavActivatePressedId = g.NavInputId = 0;\n    if (g.NavId != 0 && !g.NavDisableHighlight && !g.NavWindowingTarget && g.NavWindow && !(g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs))\n    {\n        bool activate_down = IsNavInputDown(ImGuiNavInput_Activate);\n        bool activate_pressed = activate_down && IsNavInputTest(ImGuiNavInput_Activate, ImGuiInputReadMode_Pressed);\n        if (g.ActiveId == 0 && activate_pressed)\n            g.NavActivateId = g.NavId;\n        if ((g.ActiveId == 0 || g.ActiveId == g.NavId) && activate_down)\n            g.NavActivateDownId = g.NavId;\n        if ((g.ActiveId == 0 || g.ActiveId == g.NavId) && activate_pressed)\n            g.NavActivatePressedId = g.NavId;\n        if ((g.ActiveId == 0 || g.ActiveId == g.NavId) && IsNavInputTest(ImGuiNavInput_Input, ImGuiInputReadMode_Pressed))\n            g.NavInputId = g.NavId;\n    }\n    if (g.NavWindow && (g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs))\n        g.NavDisableHighlight = true;\n    if (g.NavActivateId != 0)\n        IM_ASSERT(g.NavActivateDownId == g.NavActivateId);\n    g.NavMoveRequest = false;\n\n    // Process programmatic activation request\n    if (g.NavNextActivateId != 0)\n        g.NavActivateId = g.NavActivateDownId = g.NavActivatePressedId = g.NavInputId = g.NavNextActivateId;\n    g.NavNextActivateId = 0;\n\n    // Initiate directional inputs request\n    if (g.NavMoveRequestForward == ImGuiNavForward_None)\n    {\n        g.NavMoveDir = ImGuiDir_None;\n        g.NavMoveRequestFlags = ImGuiNavMoveFlags_None;\n        if (g.NavWindow && !g.NavWindowingTarget && !(g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs))\n        {\n            const ImGuiInputReadMode read_mode = ImGuiInputReadMode_Repeat;\n            if (!IsActiveIdUsingNavDir(ImGuiDir_Left)  && (IsNavInputTest(ImGuiNavInput_DpadLeft,  read_mode) || IsNavInputTest(ImGuiNavInput_KeyLeft_,  read_mode))) { g.NavMoveDir = ImGuiDir_Left; }\n            if (!IsActiveIdUsingNavDir(ImGuiDir_Right) && (IsNavInputTest(ImGuiNavInput_DpadRight, read_mode) || IsNavInputTest(ImGuiNavInput_KeyRight_, read_mode))) { g.NavMoveDir = ImGuiDir_Right; }\n            if (!IsActiveIdUsingNavDir(ImGuiDir_Up)    && (IsNavInputTest(ImGuiNavInput_DpadUp,    read_mode) || IsNavInputTest(ImGuiNavInput_KeyUp_,    read_mode))) { g.NavMoveDir = ImGuiDir_Up; }\n            if (!IsActiveIdUsingNavDir(ImGuiDir_Down)  && (IsNavInputTest(ImGuiNavInput_DpadDown,  read_mode) || IsNavInputTest(ImGuiNavInput_KeyDown_,  read_mode))) { g.NavMoveDir = ImGuiDir_Down; }\n        }\n        g.NavMoveClipDir = g.NavMoveDir;\n    }\n    else\n    {\n        // Forwarding previous request (which has been modified, e.g. wrap around menus rewrite the requests with a starting rectangle at the other side of the window)\n        // (Preserve g.NavMoveRequestFlags, g.NavMoveClipDir which were set by the NavMoveRequestForward() function)\n        IM_ASSERT(g.NavMoveDir != ImGuiDir_None && g.NavMoveClipDir != ImGuiDir_None);\n        IM_ASSERT(g.NavMoveRequestForward == ImGuiNavForward_ForwardQueued);\n        IMGUI_DEBUG_LOG_NAV(\"[nav] NavMoveRequestForward %d\\n\", g.NavMoveDir);\n        g.NavMoveRequestForward = ImGuiNavForward_ForwardActive;\n    }\n\n    // Update PageUp/PageDown/Home/End scroll\n    // FIXME-NAV: Consider enabling those keys even without the master ImGuiConfigFlags_NavEnableKeyboard flag?\n    float nav_scoring_rect_offset_y = 0.0f;\n    if (nav_keyboard_active)\n        nav_scoring_rect_offset_y = NavUpdatePageUpPageDown();\n\n    // If we initiate a movement request and have no current NavId, we initiate a InitDefautRequest that will be used as a fallback if the direction fails to find a match\n    if (g.NavMoveDir != ImGuiDir_None)\n    {\n        g.NavMoveRequest = true;\n        g.NavMoveRequestKeyMods = io.KeyMods;\n        g.NavMoveDirLast = g.NavMoveDir;\n    }\n    if (g.NavMoveRequest && g.NavId == 0)\n    {\n        IMGUI_DEBUG_LOG_NAV(\"[nav] NavInitRequest: from move, window \\\"%s\\\", layer=%d\\n\", g.NavWindow->Name, g.NavLayer);\n        g.NavInitRequest = g.NavInitRequestFromMove = true;\n        // Reassigning with same value, we're being explicit here.\n        g.NavInitResultId = 0;     // -V1048\n        g.NavDisableHighlight = false;\n    }\n    NavUpdateAnyRequestFlag();\n\n    // Scrolling\n    if (g.NavWindow && !(g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs) && !g.NavWindowingTarget)\n    {\n        // *Fallback* manual-scroll with Nav directional keys when window has no navigable item\n        ImGuiWindow* window = g.NavWindow;\n        const float scroll_speed = IM_ROUND(window->CalcFontSize() * 100 * io.DeltaTime); // We need round the scrolling speed because sub-pixel scroll isn't reliably supported.\n        if (window->DC.NavLayersActiveMask == 0x00 && window->DC.NavHasScroll && g.NavMoveRequest)\n        {\n            if (g.NavMoveDir == ImGuiDir_Left || g.NavMoveDir == ImGuiDir_Right)\n                SetScrollX(window, ImFloor(window->Scroll.x + ((g.NavMoveDir == ImGuiDir_Left) ? -1.0f : +1.0f) * scroll_speed));\n            if (g.NavMoveDir == ImGuiDir_Up || g.NavMoveDir == ImGuiDir_Down)\n                SetScrollY(window, ImFloor(window->Scroll.y + ((g.NavMoveDir == ImGuiDir_Up) ? -1.0f : +1.0f) * scroll_speed));\n        }\n\n        // *Normal* Manual scroll with NavScrollXXX keys\n        // Next movement request will clamp the NavId reference rectangle to the visible area, so navigation will resume within those bounds.\n        ImVec2 scroll_dir = GetNavInputAmount2d(ImGuiNavDirSourceFlags_PadLStick, ImGuiInputReadMode_Down, 1.0f / 10.0f, 10.0f);\n        if (scroll_dir.x != 0.0f && window->ScrollbarX)\n            SetScrollX(window, ImFloor(window->Scroll.x + scroll_dir.x * scroll_speed));\n        if (scroll_dir.y != 0.0f)\n            SetScrollY(window, ImFloor(window->Scroll.y + scroll_dir.y * scroll_speed));\n    }\n\n    // Reset search results\n    g.NavMoveResultLocal.Clear();\n    g.NavMoveResultLocalVisibleSet.Clear();\n    g.NavMoveResultOther.Clear();\n\n    // When using gamepad, we project the reference nav bounding box into window visible area.\n    // This is to allow resuming navigation inside the visible area after doing a large amount of scrolling, since with gamepad every movements are relative\n    // (can't focus a visible object like we can with the mouse).\n    if (g.NavMoveRequest && g.NavInputSource == ImGuiInputSource_Gamepad && g.NavLayer == ImGuiNavLayer_Main)\n    {\n        ImGuiWindow* window = g.NavWindow;\n        ImRect window_rect_rel(window->InnerRect.Min - window->Pos - ImVec2(1, 1), window->InnerRect.Max - window->Pos + ImVec2(1, 1));\n        if (!window_rect_rel.Contains(window->NavRectRel[g.NavLayer]))\n        {\n            IMGUI_DEBUG_LOG_NAV(\"[nav] NavMoveRequest: clamp NavRectRel\\n\");\n            float pad = window->CalcFontSize() * 0.5f;\n            window_rect_rel.Expand(ImVec2(-ImMin(window_rect_rel.GetWidth(), pad), -ImMin(window_rect_rel.GetHeight(), pad))); // Terrible approximation for the intent of starting navigation from first fully visible item\n            window->NavRectRel[g.NavLayer].ClipWithFull(window_rect_rel);\n            g.NavId = g.NavFocusScopeId = 0;\n        }\n    }\n\n    // For scoring we use a single segment on the left side our current item bounding box (not touching the edge to avoid box overlap with zero-spaced items)\n    ImRect nav_rect_rel = g.NavWindow && !g.NavWindow->NavRectRel[g.NavLayer].IsInverted() ? g.NavWindow->NavRectRel[g.NavLayer] : ImRect(0, 0, 0, 0);\n    g.NavScoringRect = g.NavWindow ? ImRect(g.NavWindow->Pos + nav_rect_rel.Min, g.NavWindow->Pos + nav_rect_rel.Max) : ImRect(0, 0, 0, 0);\n    g.NavScoringRect.TranslateY(nav_scoring_rect_offset_y);\n    g.NavScoringRect.Min.x = ImMin(g.NavScoringRect.Min.x + 1.0f, g.NavScoringRect.Max.x);\n    g.NavScoringRect.Max.x = g.NavScoringRect.Min.x;\n    IM_ASSERT(!g.NavScoringRect.IsInverted()); // Ensure if we have a finite, non-inverted bounding box here will allows us to remove extraneous ImFabs() calls in NavScoreItem().\n    //GetForegroundDrawList()->AddRect(g.NavScoringRectScreen.Min, g.NavScoringRectScreen.Max, IM_COL32(255,200,0,255)); // [DEBUG]\n    g.NavScoringCount = 0;\n#if IMGUI_DEBUG_NAV_RECTS\n    if (g.NavWindow)\n    {\n        ImDrawList* draw_list = GetForegroundDrawList(g.NavWindow);\n        if (1) { for (int layer = 0; layer < 2; layer++) draw_list->AddRect(g.NavWindow->Pos + g.NavWindow->NavRectRel[layer].Min, g.NavWindow->Pos + g.NavWindow->NavRectRel[layer].Max, IM_COL32(255,200,0,255)); } // [DEBUG]\n        if (1) { ImU32 col = (!g.NavWindow->Hidden) ? IM_COL32(255,0,255,255) : IM_COL32(255,0,0,255); ImVec2 p = NavCalcPreferredRefPos(); char buf[32]; ImFormatString(buf, 32, \"%d\", g.NavLayer); draw_list->AddCircleFilled(p, 3.0f, col); draw_list->AddText(NULL, 13.0f, p + ImVec2(8,-4), col, buf); }\n    }\n#endif\n}\n\nstatic void ImGui::NavUpdateInitResult()\n{\n    // In very rare cases g.NavWindow may be null (e.g. clearing focus after requesting an init request, which does happen when releasing Alt while clicking on void)\n    ImGuiContext& g = *GImGui;\n    if (!g.NavWindow)\n        return;\n\n    // Apply result from previous navigation init request (will typically select the first item, unless SetItemDefaultFocus() has been called)\n    // FIXME-NAV: On _NavFlattened windows, g.NavWindow will only be updated during subsequent frame. Not a problem currently.\n    IMGUI_DEBUG_LOG_NAV(\"[nav] NavInitRequest: result NavID 0x%08X in Layer %d Window \\\"%s\\\"\\n\", g.NavInitResultId, g.NavLayer, g.NavWindow->Name);\n    SetNavID(g.NavInitResultId, g.NavLayer, 0, g.NavInitResultRectRel);\n    if (g.NavInitRequestFromMove)\n    {\n        g.NavDisableHighlight = false;\n        g.NavDisableMouseHover = g.NavMousePosDirty = true;\n    }\n}\n\n// Apply result from previous frame navigation directional move request\nstatic void ImGui::NavUpdateMoveResult()\n{\n    ImGuiContext& g = *GImGui;\n    if (g.NavMoveResultLocal.ID == 0 && g.NavMoveResultOther.ID == 0)\n    {\n        // In a situation when there is no results but NavId != 0, re-enable the Navigation highlight (because g.NavId is not considered as a possible result)\n        if (g.NavId != 0)\n        {\n            g.NavDisableHighlight = false;\n            g.NavDisableMouseHover = true;\n        }\n        return;\n    }\n\n    // Select which result to use\n    ImGuiNavItemData* result = (g.NavMoveResultLocal.ID != 0) ? &g.NavMoveResultLocal : &g.NavMoveResultOther;\n\n    // PageUp/PageDown behavior first jumps to the bottom/top mostly visible item, _otherwise_ use the result from the previous/next page.\n    if (g.NavMoveRequestFlags & ImGuiNavMoveFlags_AlsoScoreVisibleSet)\n        if (g.NavMoveResultLocalVisibleSet.ID != 0 && g.NavMoveResultLocalVisibleSet.ID != g.NavId)\n            result = &g.NavMoveResultLocalVisibleSet;\n\n    // Maybe entering a flattened child from the outside? In this case solve the tie using the regular scoring rules.\n    if (result != &g.NavMoveResultOther && g.NavMoveResultOther.ID != 0 && g.NavMoveResultOther.Window->ParentWindow == g.NavWindow)\n        if ((g.NavMoveResultOther.DistBox < result->DistBox) || (g.NavMoveResultOther.DistBox == result->DistBox && g.NavMoveResultOther.DistCenter < result->DistCenter))\n            result = &g.NavMoveResultOther;\n    IM_ASSERT(g.NavWindow && result->Window);\n\n    // Scroll to keep newly navigated item fully into view.\n    if (g.NavLayer == ImGuiNavLayer_Main)\n    {\n        ImVec2 delta_scroll;\n        if (g.NavMoveRequestFlags & ImGuiNavMoveFlags_ScrollToEdge)\n        {\n            float scroll_target = (g.NavMoveDir == ImGuiDir_Up) ? result->Window->ScrollMax.y : 0.0f;\n            delta_scroll.y = result->Window->Scroll.y - scroll_target;\n            SetScrollY(result->Window, scroll_target);\n        }\n        else\n        {\n            ImRect rect_abs = ImRect(result->RectRel.Min + result->Window->Pos, result->RectRel.Max + result->Window->Pos);\n            delta_scroll = ScrollToBringRectIntoView(result->Window, rect_abs);\n        }\n\n        // Offset our result position so mouse position can be applied immediately after in NavUpdate()\n        result->RectRel.TranslateX(-delta_scroll.x);\n        result->RectRel.TranslateY(-delta_scroll.y);\n    }\n\n    ClearActiveID();\n    g.NavWindow = result->Window;\n    if (g.NavId != result->ID)\n    {\n        // Don't set NavJustMovedToId if just landed on the same spot (which may happen with ImGuiNavMoveFlags_AllowCurrentNavId)\n        g.NavJustMovedToId = result->ID;\n        g.NavJustMovedToFocusScopeId = result->FocusScopeId;\n        g.NavJustMovedToKeyMods = g.NavMoveRequestKeyMods;\n    }\n    IMGUI_DEBUG_LOG_NAV(\"[nav] NavMoveRequest: result NavID 0x%08X in Layer %d Window \\\"%s\\\"\\n\", result->ID, g.NavLayer, g.NavWindow->Name);\n    SetNavID(result->ID, g.NavLayer, result->FocusScopeId, result->RectRel);\n    g.NavDisableHighlight = false;\n    g.NavDisableMouseHover = g.NavMousePosDirty = true;\n}\n\n// Handle PageUp/PageDown/Home/End keys\nstatic float ImGui::NavUpdatePageUpPageDown()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiIO& io = g.IO;\n\n    if (g.NavMoveDir != ImGuiDir_None || g.NavWindow == NULL)\n        return 0.0f;\n    if ((g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs) || g.NavWindowingTarget != NULL || g.NavLayer != ImGuiNavLayer_Main)\n        return 0.0f;\n\n    ImGuiWindow* window = g.NavWindow;\n    const bool page_up_held = IsKeyDown(io.KeyMap[ImGuiKey_PageUp]) && !IsActiveIdUsingKey(ImGuiKey_PageUp);\n    const bool page_down_held = IsKeyDown(io.KeyMap[ImGuiKey_PageDown]) && !IsActiveIdUsingKey(ImGuiKey_PageDown);\n    const bool home_pressed = IsKeyPressed(io.KeyMap[ImGuiKey_Home]) && !IsActiveIdUsingKey(ImGuiKey_Home);\n    const bool end_pressed = IsKeyPressed(io.KeyMap[ImGuiKey_End]) && !IsActiveIdUsingKey(ImGuiKey_End);\n    if (page_up_held != page_down_held || home_pressed != end_pressed) // If either (not both) are pressed\n    {\n        if (window->DC.NavLayersActiveMask == 0x00 && window->DC.NavHasScroll)\n        {\n            // Fallback manual-scroll when window has no navigable item\n            if (IsKeyPressed(io.KeyMap[ImGuiKey_PageUp], true))\n                SetScrollY(window, window->Scroll.y - window->InnerRect.GetHeight());\n            else if (IsKeyPressed(io.KeyMap[ImGuiKey_PageDown], true))\n                SetScrollY(window, window->Scroll.y + window->InnerRect.GetHeight());\n            else if (home_pressed)\n                SetScrollY(window, 0.0f);\n            else if (end_pressed)\n                SetScrollY(window, window->ScrollMax.y);\n        }\n        else\n        {\n            ImRect& nav_rect_rel = window->NavRectRel[g.NavLayer];\n            const float page_offset_y = ImMax(0.0f, window->InnerRect.GetHeight() - window->CalcFontSize() * 1.0f + nav_rect_rel.GetHeight());\n            float nav_scoring_rect_offset_y = 0.0f;\n            if (IsKeyPressed(io.KeyMap[ImGuiKey_PageUp], true))\n            {\n                nav_scoring_rect_offset_y = -page_offset_y;\n                g.NavMoveDir = ImGuiDir_Down; // Because our scoring rect is offset up, we request the down direction (so we can always land on the last item)\n                g.NavMoveClipDir = ImGuiDir_Up;\n                g.NavMoveRequestFlags = ImGuiNavMoveFlags_AllowCurrentNavId | ImGuiNavMoveFlags_AlsoScoreVisibleSet;\n            }\n            else if (IsKeyPressed(io.KeyMap[ImGuiKey_PageDown], true))\n            {\n                nav_scoring_rect_offset_y = +page_offset_y;\n                g.NavMoveDir = ImGuiDir_Up; // Because our scoring rect is offset down, we request the up direction (so we can always land on the last item)\n                g.NavMoveClipDir = ImGuiDir_Down;\n                g.NavMoveRequestFlags = ImGuiNavMoveFlags_AllowCurrentNavId | ImGuiNavMoveFlags_AlsoScoreVisibleSet;\n            }\n            else if (home_pressed)\n            {\n                // FIXME-NAV: handling of Home/End is assuming that the top/bottom most item will be visible with Scroll.y == 0/ScrollMax.y\n                // Scrolling will be handled via the ImGuiNavMoveFlags_ScrollToEdge flag, we don't scroll immediately to avoid scrolling happening before nav result.\n                // Preserve current horizontal position if we have any.\n                nav_rect_rel.Min.y = nav_rect_rel.Max.y = -window->Scroll.y;\n                if (nav_rect_rel.IsInverted())\n                    nav_rect_rel.Min.x = nav_rect_rel.Max.x = 0.0f;\n                g.NavMoveDir = ImGuiDir_Down;\n                g.NavMoveRequestFlags = ImGuiNavMoveFlags_AllowCurrentNavId | ImGuiNavMoveFlags_ScrollToEdge;\n            }\n            else if (end_pressed)\n            {\n                nav_rect_rel.Min.y = nav_rect_rel.Max.y = window->ScrollMax.y + window->SizeFull.y - window->Scroll.y;\n                if (nav_rect_rel.IsInverted())\n                    nav_rect_rel.Min.x = nav_rect_rel.Max.x = 0.0f;\n                g.NavMoveDir = ImGuiDir_Up;\n                g.NavMoveRequestFlags = ImGuiNavMoveFlags_AllowCurrentNavId | ImGuiNavMoveFlags_ScrollToEdge;\n            }\n            return nav_scoring_rect_offset_y;\n        }\n    }\n    return 0.0f;\n}\n\nstatic void ImGui::NavEndFrame()\n{\n    ImGuiContext& g = *GImGui;\n\n    // Show CTRL+TAB list window\n    if (g.NavWindowingTarget != NULL)\n        NavUpdateWindowingOverlay();\n\n    // Perform wrap-around in menus\n    ImGuiWindow* window = g.NavWrapRequestWindow;\n    ImGuiNavMoveFlags move_flags = g.NavWrapRequestFlags;\n    if (window != NULL && g.NavWindow == window && NavMoveRequestButNoResultYet() && g.NavMoveRequestForward == ImGuiNavForward_None && g.NavLayer == ImGuiNavLayer_Main)\n    {\n        IM_ASSERT(move_flags != 0); // No points calling this with no wrapping\n        ImRect bb_rel = window->NavRectRel[0];\n\n        ImGuiDir clip_dir = g.NavMoveDir;\n        if (g.NavMoveDir == ImGuiDir_Left && (move_flags & (ImGuiNavMoveFlags_WrapX | ImGuiNavMoveFlags_LoopX)))\n        {\n            bb_rel.Min.x = bb_rel.Max.x =\n                ImMax(window->SizeFull.x, window->ContentSize.x + window->WindowPadding.x * 2.0f) - window->Scroll.x;\n            if (move_flags & ImGuiNavMoveFlags_WrapX)\n            {\n                bb_rel.TranslateY(-bb_rel.GetHeight());\n                clip_dir = ImGuiDir_Up;\n            }\n            NavMoveRequestForward(g.NavMoveDir, clip_dir, bb_rel, move_flags);\n        }\n        if (g.NavMoveDir == ImGuiDir_Right && (move_flags & (ImGuiNavMoveFlags_WrapX | ImGuiNavMoveFlags_LoopX)))\n        {\n            bb_rel.Min.x = bb_rel.Max.x = -window->Scroll.x;\n            if (move_flags & ImGuiNavMoveFlags_WrapX)\n            {\n                bb_rel.TranslateY(+bb_rel.GetHeight());\n                clip_dir = ImGuiDir_Down;\n            }\n            NavMoveRequestForward(g.NavMoveDir, clip_dir, bb_rel, move_flags);\n        }\n        if (g.NavMoveDir == ImGuiDir_Up && (move_flags & (ImGuiNavMoveFlags_WrapY | ImGuiNavMoveFlags_LoopY)))\n        {\n            bb_rel.Min.y = bb_rel.Max.y =\n                ImMax(window->SizeFull.y, window->ContentSize.y + window->WindowPadding.y * 2.0f) - window->Scroll.y;\n            if (move_flags & ImGuiNavMoveFlags_WrapY)\n            {\n                bb_rel.TranslateX(-bb_rel.GetWidth());\n                clip_dir = ImGuiDir_Left;\n            }\n            NavMoveRequestForward(g.NavMoveDir, clip_dir, bb_rel, move_flags);\n        }\n        if (g.NavMoveDir == ImGuiDir_Down && (move_flags & (ImGuiNavMoveFlags_WrapY | ImGuiNavMoveFlags_LoopY)))\n        {\n            bb_rel.Min.y = bb_rel.Max.y = -window->Scroll.y;\n            if (move_flags & ImGuiNavMoveFlags_WrapY)\n            {\n                bb_rel.TranslateX(+bb_rel.GetWidth());\n                clip_dir = ImGuiDir_Right;\n            }\n            NavMoveRequestForward(g.NavMoveDir, clip_dir, bb_rel, move_flags);\n        }\n    }\n}\n\nstatic int ImGui::FindWindowFocusIndex(ImGuiWindow* window)\n{\n    ImGuiContext& g = *GImGui;\n    IM_UNUSED(g);\n    int order = window->FocusOrder;\n    IM_ASSERT(g.WindowsFocusOrder[order] == window);\n    return order;\n}\n\nstatic ImGuiWindow* FindWindowNavFocusable(int i_start, int i_stop, int dir) // FIXME-OPT O(N)\n{\n    ImGuiContext& g = *GImGui;\n    for (int i = i_start; i >= 0 && i < g.WindowsFocusOrder.Size && i != i_stop; i += dir)\n        if (ImGui::IsWindowNavFocusable(g.WindowsFocusOrder[i]))\n            return g.WindowsFocusOrder[i];\n    return NULL;\n}\n\nstatic void NavUpdateWindowingHighlightWindow(int focus_change_dir)\n{\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(g.NavWindowingTarget);\n    if (g.NavWindowingTarget->Flags & ImGuiWindowFlags_Modal)\n        return;\n\n    const int i_current = ImGui::FindWindowFocusIndex(g.NavWindowingTarget);\n    ImGuiWindow* window_target = FindWindowNavFocusable(i_current + focus_change_dir, -INT_MAX, focus_change_dir);\n    if (!window_target)\n        window_target = FindWindowNavFocusable((focus_change_dir < 0) ? (g.WindowsFocusOrder.Size - 1) : 0, i_current, focus_change_dir);\n    if (window_target) // Don't reset windowing target if there's a single window in the list\n        g.NavWindowingTarget = g.NavWindowingTargetAnim = window_target;\n    g.NavWindowingToggleLayer = false;\n}\n\n// Windowing management mode\n// Keyboard: CTRL+Tab (change focus/move/resize), Alt (toggle menu layer)\n// Gamepad:  Hold Menu/Square (change focus/move/resize), Tap Menu/Square (toggle menu layer)\nstatic void ImGui::NavUpdateWindowing()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiIO& io = g.IO;\n\n    ImGuiWindow* apply_focus_window = NULL;\n    bool apply_toggle_layer = false;\n\n    ImGuiWindow* modal_window = GetTopMostPopupModal();\n    bool allow_windowing = (modal_window == NULL);\n    if (!allow_windowing)\n        g.NavWindowingTarget = NULL;\n\n    // Fade out\n    if (g.NavWindowingTargetAnim && g.NavWindowingTarget == NULL)\n    {\n        g.NavWindowingHighlightAlpha = ImMax(g.NavWindowingHighlightAlpha - io.DeltaTime * 10.0f, 0.0f);\n        if (g.DimBgRatio <= 0.0f && g.NavWindowingHighlightAlpha <= 0.0f)\n            g.NavWindowingTargetAnim = NULL;\n    }\n\n    // Start CTRL-TAB or Square+L/R window selection\n    bool start_windowing_with_gamepad = allow_windowing && !g.NavWindowingTarget && IsNavInputTest(ImGuiNavInput_Menu, ImGuiInputReadMode_Pressed);\n    bool start_windowing_with_keyboard = allow_windowing && !g.NavWindowingTarget && io.KeyCtrl && IsKeyPressedMap(ImGuiKey_Tab) && (io.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard);\n    if (start_windowing_with_gamepad || start_windowing_with_keyboard)\n        if (ImGuiWindow* window = g.NavWindow ? g.NavWindow : FindWindowNavFocusable(g.WindowsFocusOrder.Size - 1, -INT_MAX, -1))\n        {\n            g.NavWindowingTarget = g.NavWindowingTargetAnim = window->RootWindow;\n            g.NavWindowingTimer = g.NavWindowingHighlightAlpha = 0.0f;\n            g.NavWindowingToggleLayer = start_windowing_with_gamepad ? true : false; // Gamepad starts toggling layer\n            g.NavInputSource = start_windowing_with_keyboard ? ImGuiInputSource_Keyboard : ImGuiInputSource_Gamepad;\n        }\n\n    // Gamepad update\n    g.NavWindowingTimer += io.DeltaTime;\n    if (g.NavWindowingTarget && g.NavInputSource == ImGuiInputSource_Gamepad)\n    {\n        // Highlight only appears after a brief time holding the button, so that a fast tap on PadMenu (to toggle NavLayer) doesn't add visual noise\n        g.NavWindowingHighlightAlpha = ImMax(g.NavWindowingHighlightAlpha, ImSaturate((g.NavWindowingTimer - NAV_WINDOWING_HIGHLIGHT_DELAY) / 0.05f));\n\n        // Select window to focus\n        const int focus_change_dir = (int)IsNavInputTest(ImGuiNavInput_FocusPrev, ImGuiInputReadMode_RepeatSlow) - (int)IsNavInputTest(ImGuiNavInput_FocusNext, ImGuiInputReadMode_RepeatSlow);\n        if (focus_change_dir != 0)\n        {\n            NavUpdateWindowingHighlightWindow(focus_change_dir);\n            g.NavWindowingHighlightAlpha = 1.0f;\n        }\n\n        // Single press toggles NavLayer, long press with L/R apply actual focus on release (until then the window was merely rendered top-most)\n        if (!IsNavInputDown(ImGuiNavInput_Menu))\n        {\n            g.NavWindowingToggleLayer &= (g.NavWindowingHighlightAlpha < 1.0f); // Once button was held long enough we don't consider it a tap-to-toggle-layer press anymore.\n            if (g.NavWindowingToggleLayer && g.NavWindow)\n                apply_toggle_layer = true;\n            else if (!g.NavWindowingToggleLayer)\n                apply_focus_window = g.NavWindowingTarget;\n            g.NavWindowingTarget = NULL;\n        }\n    }\n\n    // Keyboard: Focus\n    if (g.NavWindowingTarget && g.NavInputSource == ImGuiInputSource_Keyboard)\n    {\n        // Visuals only appears after a brief time after pressing TAB the first time, so that a fast CTRL+TAB doesn't add visual noise\n        g.NavWindowingHighlightAlpha = ImMax(g.NavWindowingHighlightAlpha, ImSaturate((g.NavWindowingTimer - NAV_WINDOWING_HIGHLIGHT_DELAY) / 0.05f)); // 1.0f\n        if (IsKeyPressedMap(ImGuiKey_Tab, true))\n            NavUpdateWindowingHighlightWindow(io.KeyShift ? +1 : -1);\n        if (!io.KeyCtrl)\n            apply_focus_window = g.NavWindowingTarget;\n    }\n\n    // Keyboard: Press and Release ALT to toggle menu layer\n    // - Testing that only Alt is tested prevents Alt+Shift or AltGR from toggling menu layer.\n    // - AltGR is normally Alt+Ctrl but we can't reliably detect it (not all backends/systems/layout emit it as Alt+Ctrl). But even on keyboards without AltGR we don't want Alt+Ctrl to open menu anyway.\n    if (io.KeyMods == ImGuiKeyModFlags_Alt && (io.KeyModsPrev & ImGuiKeyModFlags_Alt) == 0)\n    {\n        g.NavWindowingToggleLayer = true;\n        g.NavInputSource = ImGuiInputSource_Keyboard;\n    }\n    if (g.NavWindowingToggleLayer && g.NavInputSource == ImGuiInputSource_Keyboard)\n    {\n        // We cancel toggling nav layer when any text has been typed (generally while holding Alt). (See #370)\n        // We cancel toggling nav layer when other modifiers are pressed. (See #4439)\n        if (io.InputQueueCharacters.Size > 0 || io.KeyCtrl || io.KeyShift || io.KeySuper)\n            g.NavWindowingToggleLayer = false;\n\n        // Apply layer toggle on release\n        // Important: we don't assume that Alt was previously held in order to handle loss of focus when backend calls io.AddFocusEvent(false)\n        // Important: as before version <18314 we lacked an explicit IO event for focus gain/loss, we also compare mouse validity to detect old backends clearing mouse pos on focus loss.\n        if (!(io.KeyMods & ImGuiKeyModFlags_Alt) && (io.KeyModsPrev & ImGuiKeyModFlags_Alt) && g.NavWindowingToggleLayer)\n            if (g.ActiveId == 0 || g.ActiveIdAllowOverlap)\n                if (IsMousePosValid(&io.MousePos) == IsMousePosValid(&io.MousePosPrev))\n                    apply_toggle_layer = true;\n        if (!io.KeyAlt)\n            g.NavWindowingToggleLayer = false;\n    }\n\n    // Move window\n    if (g.NavWindowingTarget && !(g.NavWindowingTarget->Flags & ImGuiWindowFlags_NoMove))\n    {\n        ImVec2 move_delta;\n        if (g.NavInputSource == ImGuiInputSource_Keyboard && !io.KeyShift)\n            move_delta = GetNavInputAmount2d(ImGuiNavDirSourceFlags_Keyboard, ImGuiInputReadMode_Down);\n        if (g.NavInputSource == ImGuiInputSource_Gamepad)\n            move_delta = GetNavInputAmount2d(ImGuiNavDirSourceFlags_PadLStick, ImGuiInputReadMode_Down);\n        if (move_delta.x != 0.0f || move_delta.y != 0.0f)\n        {\n            const float NAV_MOVE_SPEED = 800.0f;\n            const float move_speed = ImFloor(NAV_MOVE_SPEED * io.DeltaTime * ImMin(io.DisplayFramebufferScale.x, io.DisplayFramebufferScale.y)); // FIXME: Doesn't handle variable framerate very well\n            ImGuiWindow* moving_window = g.NavWindowingTarget->RootWindow;\n            SetWindowPos(moving_window, moving_window->Pos + move_delta * move_speed, ImGuiCond_Always);\n            MarkIniSettingsDirty(moving_window);\n            g.NavDisableMouseHover = true;\n        }\n    }\n\n    // Apply final focus\n    if (apply_focus_window && (g.NavWindow == NULL || apply_focus_window != g.NavWindow->RootWindow))\n    {\n        ClearActiveID();\n        g.NavDisableHighlight = false;\n        g.NavDisableMouseHover = true;\n        apply_focus_window = NavRestoreLastChildNavWindow(apply_focus_window);\n        ClosePopupsOverWindow(apply_focus_window, false);\n        FocusWindow(apply_focus_window);\n        if (apply_focus_window->NavLastIds[0] == 0)\n            NavInitWindow(apply_focus_window, false);\n\n        // If the window has ONLY a menu layer (no main layer), select it directly\n        // Use NavLayersActiveMaskNext since windows didn't have a chance to be Begin()-ed on this frame,\n        // so CTRL+Tab where the keys are only held for 1 frame will be able to use correct layers mask since\n        // the target window as already been previewed once.\n        // FIXME-NAV: This should be done in NavInit.. or in FocusWindow... However in both of those cases,\n        // we won't have a guarantee that windows has been visible before and therefore NavLayersActiveMask*\n        // won't be valid.\n        if (apply_focus_window->DC.NavLayersActiveMaskNext == (1 << ImGuiNavLayer_Menu))\n            g.NavLayer = ImGuiNavLayer_Menu;\n    }\n    if (apply_focus_window)\n        g.NavWindowingTarget = NULL;\n\n    // Apply menu/layer toggle\n    if (apply_toggle_layer && g.NavWindow)\n    {\n        ClearActiveID();\n\n        // Move to parent menu if necessary\n        ImGuiWindow* new_nav_window = g.NavWindow;\n        while (new_nav_window->ParentWindow\n            && (new_nav_window->DC.NavLayersActiveMask & (1 << ImGuiNavLayer_Menu)) == 0\n            && (new_nav_window->Flags & ImGuiWindowFlags_ChildWindow) != 0\n            && (new_nav_window->Flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_ChildMenu)) == 0)\n            new_nav_window = new_nav_window->ParentWindow;\n        if (new_nav_window != g.NavWindow)\n        {\n            ImGuiWindow* old_nav_window = g.NavWindow;\n            FocusWindow(new_nav_window);\n            new_nav_window->NavLastChildNavWindow = old_nav_window;\n        }\n        g.NavDisableHighlight = false;\n        g.NavDisableMouseHover = true;\n\n        // Reinitialize navigation when entering menu bar with the Alt key.\n        const ImGuiNavLayer new_nav_layer = (g.NavWindow->DC.NavLayersActiveMask & (1 << ImGuiNavLayer_Menu)) ? (ImGuiNavLayer)((int)g.NavLayer ^ 1) : ImGuiNavLayer_Main;\n        if (new_nav_layer == ImGuiNavLayer_Menu)\n            g.NavWindow->NavLastIds[new_nav_layer] = 0;\n        NavRestoreLayer(new_nav_layer);\n    }\n}\n\n// Window has already passed the IsWindowNavFocusable()\nstatic const char* GetFallbackWindowNameForWindowingList(ImGuiWindow* window)\n{\n    if (window->Flags & ImGuiWindowFlags_Popup)\n        return \"(Popup)\";\n    if ((window->Flags & ImGuiWindowFlags_MenuBar) && strcmp(window->Name, \"##MainMenuBar\") == 0)\n        return \"(Main menu bar)\";\n    return \"(Untitled)\";\n}\n\n// Overlay displayed when using CTRL+TAB. Called by EndFrame().\nvoid ImGui::NavUpdateWindowingOverlay()\n{\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(g.NavWindowingTarget != NULL);\n\n    if (g.NavWindowingTimer < NAV_WINDOWING_LIST_APPEAR_DELAY)\n        return;\n\n    if (g.NavWindowingListWindow == NULL)\n        g.NavWindowingListWindow = FindWindowByName(\"###NavWindowingList\");\n    const ImGuiViewport* viewport = GetMainViewport();\n    SetNextWindowSizeConstraints(ImVec2(viewport->Size.x * 0.20f, viewport->Size.y * 0.20f), ImVec2(FLT_MAX, FLT_MAX));\n    SetNextWindowPos(viewport->GetCenter(), ImGuiCond_Always, ImVec2(0.5f, 0.5f));\n    PushStyleVar(ImGuiStyleVar_WindowPadding, g.Style.WindowPadding * 2.0f);\n    Begin(\"###NavWindowingList\", NULL, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings);\n    for (int n = g.WindowsFocusOrder.Size - 1; n >= 0; n--)\n    {\n        ImGuiWindow* window = g.WindowsFocusOrder[n];\n        IM_ASSERT(window != NULL); // Fix static analyzers\n        if (!IsWindowNavFocusable(window))\n            continue;\n        const char* label = window->Name;\n        if (label == FindRenderedTextEnd(label))\n            label = GetFallbackWindowNameForWindowingList(window);\n        Selectable(label, g.NavWindowingTarget == window);\n    }\n    End();\n    PopStyleVar();\n}\n\n\n//-----------------------------------------------------------------------------\n// [SECTION] DRAG AND DROP\n//-----------------------------------------------------------------------------\n\nvoid ImGui::ClearDragDrop()\n{\n    ImGuiContext& g = *GImGui;\n    g.DragDropActive = false;\n    g.DragDropPayload.Clear();\n    g.DragDropAcceptFlags = ImGuiDragDropFlags_None;\n    g.DragDropAcceptIdCurr = g.DragDropAcceptIdPrev = 0;\n    g.DragDropAcceptIdCurrRectSurface = FLT_MAX;\n    g.DragDropAcceptFrameCount = -1;\n\n    g.DragDropPayloadBufHeap.clear();\n    memset(&g.DragDropPayloadBufLocal, 0, sizeof(g.DragDropPayloadBufLocal));\n}\n\n// When this returns true you need to: a) call SetDragDropPayload() exactly once, b) you may render the payload visual/description, c) call EndDragDropSource()\n// If the item has an identifier:\n// - This assume/require the item to be activated (typically via ButtonBehavior).\n// - Therefore if you want to use this with a mouse button other than left mouse button, it is up to the item itself to activate with another button.\n// - We then pull and use the mouse button that was used to activate the item and use it to carry on the drag.\n// If the item has no identifier:\n// - Currently always assume left mouse button.\nbool ImGui::BeginDragDropSource(ImGuiDragDropFlags flags)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n\n    // FIXME-DRAGDROP: While in the common-most \"drag from non-zero active id\" case we can tell the mouse button,\n    // in both SourceExtern and id==0 cases we may requires something else (explicit flags or some heuristic).\n    ImGuiMouseButton mouse_button = ImGuiMouseButton_Left;\n\n    bool source_drag_active = false;\n    ImGuiID source_id = 0;\n    ImGuiID source_parent_id = 0;\n    if (!(flags & ImGuiDragDropFlags_SourceExtern))\n    {\n        source_id = g.LastItemData.ID;\n        if (source_id != 0)\n        {\n            // Common path: items with ID\n            if (g.ActiveId != source_id)\n                return false;\n            if (g.ActiveIdMouseButton != -1)\n                mouse_button = g.ActiveIdMouseButton;\n            if (g.IO.MouseDown[mouse_button] == false)\n                return false;\n            g.ActiveIdAllowOverlap = false;\n        }\n        else\n        {\n            // Uncommon path: items without ID\n            if (g.IO.MouseDown[mouse_button] == false)\n                return false;\n\n            // If you want to use BeginDragDropSource() on an item with no unique identifier for interaction, such as Text() or Image(), you need to:\n            // A) Read the explanation below, B) Use the ImGuiDragDropFlags_SourceAllowNullID flag, C) Swallow your programmer pride.\n            if (!(flags & ImGuiDragDropFlags_SourceAllowNullID))\n            {\n                IM_ASSERT(0);\n                return false;\n            }\n\n            // Early out\n            if ((g.LastItemData.StatusFlags & ImGuiItemStatusFlags_HoveredRect) == 0 && (g.ActiveId == 0 || g.ActiveIdWindow != window))\n                return false;\n\n            // Magic fallback (=somehow reprehensible) to handle items with no assigned ID, e.g. Text(), Image()\n            // We build a throwaway ID based on current ID stack + relative AABB of items in window.\n            // THE IDENTIFIER WON'T SURVIVE ANY REPOSITIONING OF THE WIDGET, so if your widget moves your dragging operation will be canceled.\n            // We don't need to maintain/call ClearActiveID() as releasing the button will early out this function and trigger !ActiveIdIsAlive.\n            // Rely on keeping other window->LastItemXXX fields intact.\n            source_id = g.LastItemData.ID = window->GetIDFromRectangle(g.LastItemData.Rect);\n            bool is_hovered = ItemHoverable(g.LastItemData.Rect, source_id);\n            if (is_hovered && g.IO.MouseClicked[mouse_button])\n            {\n                SetActiveID(source_id, window);\n                FocusWindow(window);\n            }\n            if (g.ActiveId == source_id) // Allow the underlying widget to display/return hovered during the mouse release frame, else we would get a flicker.\n                g.ActiveIdAllowOverlap = is_hovered;\n        }\n        if (g.ActiveId != source_id)\n            return false;\n        source_parent_id = window->IDStack.back();\n        source_drag_active = IsMouseDragging(mouse_button);\n\n        // Disable navigation and key inputs while dragging + cancel existing request if any\n        SetActiveIdUsingNavAndKeys();\n    }\n    else\n    {\n        window = NULL;\n        source_id = ImHashStr(\"#SourceExtern\");\n        source_drag_active = true;\n    }\n\n    if (source_drag_active)\n    {\n        if (!g.DragDropActive)\n        {\n            IM_ASSERT(source_id != 0);\n            ClearDragDrop();\n            ImGuiPayload& payload = g.DragDropPayload;\n            payload.SourceId = source_id;\n            payload.SourceParentId = source_parent_id;\n            g.DragDropActive = true;\n            g.DragDropSourceFlags = flags;\n            g.DragDropMouseButton = mouse_button;\n            if (payload.SourceId == g.ActiveId)\n                g.ActiveIdNoClearOnFocusLoss = true;\n        }\n        g.DragDropSourceFrameCount = g.FrameCount;\n        g.DragDropWithinSource = true;\n\n        if (!(flags & ImGuiDragDropFlags_SourceNoPreviewTooltip))\n        {\n            // Target can request the Source to not display its tooltip (we use a dedicated flag to make this request explicit)\n            // We unfortunately can't just modify the source flags and skip the call to BeginTooltip, as caller may be emitting contents.\n            BeginTooltip();\n            if (g.DragDropAcceptIdPrev && (g.DragDropAcceptFlags & ImGuiDragDropFlags_AcceptNoPreviewTooltip))\n            {\n                ImGuiWindow* tooltip_window = g.CurrentWindow;\n                tooltip_window->Hidden = tooltip_window->SkipItems = true;\n                tooltip_window->HiddenFramesCanSkipItems = 1;\n            }\n        }\n\n        if (!(flags & ImGuiDragDropFlags_SourceNoDisableHover) && !(flags & ImGuiDragDropFlags_SourceExtern))\n            g.LastItemData.StatusFlags &= ~ImGuiItemStatusFlags_HoveredRect;\n\n        return true;\n    }\n    return false;\n}\n\nvoid ImGui::EndDragDropSource()\n{\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(g.DragDropActive);\n    IM_ASSERT(g.DragDropWithinSource && \"Not after a BeginDragDropSource()?\");\n\n    if (!(g.DragDropSourceFlags & ImGuiDragDropFlags_SourceNoPreviewTooltip))\n        EndTooltip();\n\n    // Discard the drag if have not called SetDragDropPayload()\n    if (g.DragDropPayload.DataFrameCount == -1)\n        ClearDragDrop();\n    g.DragDropWithinSource = false;\n}\n\n// Use 'cond' to choose to submit payload on drag start or every frame\nbool ImGui::SetDragDropPayload(const char* type, const void* data, size_t data_size, ImGuiCond cond)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiPayload& payload = g.DragDropPayload;\n    if (cond == 0)\n        cond = ImGuiCond_Always;\n\n    IM_ASSERT(type != NULL);\n    IM_ASSERT(strlen(type) < IM_ARRAYSIZE(payload.DataType) && \"Payload type can be at most 32 characters long\");\n    IM_ASSERT((data != NULL && data_size > 0) || (data == NULL && data_size == 0));\n    IM_ASSERT(cond == ImGuiCond_Always || cond == ImGuiCond_Once);\n    IM_ASSERT(payload.SourceId != 0);                               // Not called between BeginDragDropSource() and EndDragDropSource()\n\n    if (cond == ImGuiCond_Always || payload.DataFrameCount == -1)\n    {\n        // Copy payload\n        ImStrncpy(payload.DataType, type, IM_ARRAYSIZE(payload.DataType));\n        g.DragDropPayloadBufHeap.resize(0);\n        if (data_size > sizeof(g.DragDropPayloadBufLocal))\n        {\n            // Store in heap\n            g.DragDropPayloadBufHeap.resize((int)data_size);\n            payload.Data = g.DragDropPayloadBufHeap.Data;\n            memcpy(payload.Data, data, data_size);\n        }\n        else if (data_size > 0)\n        {\n            // Store locally\n            memset(&g.DragDropPayloadBufLocal, 0, sizeof(g.DragDropPayloadBufLocal));\n            payload.Data = g.DragDropPayloadBufLocal;\n            memcpy(payload.Data, data, data_size);\n        }\n        else\n        {\n            payload.Data = NULL;\n        }\n        payload.DataSize = (int)data_size;\n    }\n    payload.DataFrameCount = g.FrameCount;\n\n    return (g.DragDropAcceptFrameCount == g.FrameCount) || (g.DragDropAcceptFrameCount == g.FrameCount - 1);\n}\n\nbool ImGui::BeginDragDropTargetCustom(const ImRect& bb, ImGuiID id)\n{\n    ImGuiContext& g = *GImGui;\n    if (!g.DragDropActive)\n        return false;\n\n    ImGuiWindow* window = g.CurrentWindow;\n    ImGuiWindow* hovered_window = g.HoveredWindowUnderMovingWindow;\n    if (hovered_window == NULL || window->RootWindow != hovered_window->RootWindow)\n        return false;\n    IM_ASSERT(id != 0);\n    if (!IsMouseHoveringRect(bb.Min, bb.Max) || (id == g.DragDropPayload.SourceId))\n        return false;\n    if (window->SkipItems)\n        return false;\n\n    IM_ASSERT(g.DragDropWithinTarget == false);\n    g.DragDropTargetRect = bb;\n    g.DragDropTargetId = id;\n    g.DragDropWithinTarget = true;\n    return true;\n}\n\n// We don't use BeginDragDropTargetCustom() and duplicate its code because:\n// 1) we use LastItemRectHoveredRect which handles items that pushes a temporarily clip rectangle in their code. Calling BeginDragDropTargetCustom(LastItemRect) would not handle them.\n// 2) and it's faster. as this code may be very frequently called, we want to early out as fast as we can.\n// Also note how the HoveredWindow test is positioned differently in both functions (in both functions we optimize for the cheapest early out case)\nbool ImGui::BeginDragDropTarget()\n{\n    ImGuiContext& g = *GImGui;\n    if (!g.DragDropActive)\n        return false;\n\n    ImGuiWindow* window = g.CurrentWindow;\n    if (!(g.LastItemData.StatusFlags & ImGuiItemStatusFlags_HoveredRect))\n        return false;\n    ImGuiWindow* hovered_window = g.HoveredWindowUnderMovingWindow;\n    if (hovered_window == NULL || window->RootWindow != hovered_window->RootWindow)\n        return false;\n\n    const ImRect& display_rect = (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_HasDisplayRect) ? g.LastItemData.DisplayRect : g.LastItemData.Rect;\n    ImGuiID id = g.LastItemData.ID;\n    if (id == 0)\n        id = window->GetIDFromRectangle(display_rect);\n    if (g.DragDropPayload.SourceId == id)\n        return false;\n\n    IM_ASSERT(g.DragDropWithinTarget == false);\n    g.DragDropTargetRect = display_rect;\n    g.DragDropTargetId = id;\n    g.DragDropWithinTarget = true;\n    return true;\n}\n\nbool ImGui::IsDragDropPayloadBeingAccepted()\n{\n    ImGuiContext& g = *GImGui;\n    return g.DragDropActive && g.DragDropAcceptIdPrev != 0;\n}\n\nconst ImGuiPayload* ImGui::AcceptDragDropPayload(const char* type, ImGuiDragDropFlags flags)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    ImGuiPayload& payload = g.DragDropPayload;\n    IM_ASSERT(g.DragDropActive);                        // Not called between BeginDragDropTarget() and EndDragDropTarget() ?\n    IM_ASSERT(payload.DataFrameCount != -1);            // Forgot to call EndDragDropTarget() ?\n    if (type != NULL && !payload.IsDataType(type))\n        return NULL;\n\n    // Accept smallest drag target bounding box, this allows us to nest drag targets conveniently without ordering constraints.\n    // NB: We currently accept NULL id as target. However, overlapping targets requires a unique ID to function!\n    const bool was_accepted_previously = (g.DragDropAcceptIdPrev == g.DragDropTargetId);\n    ImRect r = g.DragDropTargetRect;\n    float r_surface = r.GetWidth() * r.GetHeight();\n    if (r_surface <= g.DragDropAcceptIdCurrRectSurface)\n    {\n        g.DragDropAcceptFlags = flags;\n        g.DragDropAcceptIdCurr = g.DragDropTargetId;\n        g.DragDropAcceptIdCurrRectSurface = r_surface;\n    }\n\n    // Render default drop visuals\n    // FIXME-DRAGDROP: Settle on a proper default visuals for drop target.\n    payload.Preview = was_accepted_previously;\n    flags |= (g.DragDropSourceFlags & ImGuiDragDropFlags_AcceptNoDrawDefaultRect); // Source can also inhibit the preview (useful for external sources that lives for 1 frame)\n    if (!(flags & ImGuiDragDropFlags_AcceptNoDrawDefaultRect) && payload.Preview)\n        window->DrawList->AddRect(r.Min - ImVec2(3.5f,3.5f), r.Max + ImVec2(3.5f, 3.5f), GetColorU32(ImGuiCol_DragDropTarget), 0.0f, 0, 2.0f);\n\n    g.DragDropAcceptFrameCount = g.FrameCount;\n    payload.Delivery = was_accepted_previously && !IsMouseDown(g.DragDropMouseButton); // For extern drag sources affecting os window focus, it's easier to just test !IsMouseDown() instead of IsMouseReleased()\n    if (!payload.Delivery && !(flags & ImGuiDragDropFlags_AcceptBeforeDelivery))\n        return NULL;\n\n    return &payload;\n}\n\nconst ImGuiPayload* ImGui::GetDragDropPayload()\n{\n    ImGuiContext& g = *GImGui;\n    return g.DragDropActive ? &g.DragDropPayload : NULL;\n}\n\n// We don't really use/need this now, but added it for the sake of consistency and because we might need it later.\nvoid ImGui::EndDragDropTarget()\n{\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(g.DragDropActive);\n    IM_ASSERT(g.DragDropWithinTarget);\n    g.DragDropWithinTarget = false;\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] LOGGING/CAPTURING\n//-----------------------------------------------------------------------------\n// All text output from the interface can be captured into tty/file/clipboard.\n// By default, tree nodes are automatically opened during logging.\n//-----------------------------------------------------------------------------\n\n// Pass text data straight to log (without being displayed)\nstatic inline void LogTextV(ImGuiContext& g, const char* fmt, va_list args)\n{\n    if (g.LogFile)\n    {\n        g.LogBuffer.Buf.resize(0);\n        g.LogBuffer.appendfv(fmt, args);\n        ImFileWrite(g.LogBuffer.c_str(), sizeof(char), (ImU64)g.LogBuffer.size(), g.LogFile);\n    }\n    else\n    {\n        g.LogBuffer.appendfv(fmt, args);\n    }\n}\n\nvoid ImGui::LogText(const char* fmt, ...)\n{\n    ImGuiContext& g = *GImGui;\n    if (!g.LogEnabled)\n        return;\n\n    va_list args;\n    va_start(args, fmt);\n    LogTextV(g, fmt, args);\n    va_end(args);\n}\n\nvoid ImGui::LogTextV(const char* fmt, va_list args)\n{\n    ImGuiContext& g = *GImGui;\n    if (!g.LogEnabled)\n        return;\n\n    LogTextV(g, fmt, args);\n}\n\n// Internal version that takes a position to decide on newline placement and pad items according to their depth.\n// We split text into individual lines to add current tree level padding\n// FIXME: This code is a little complicated perhaps, considering simplifying the whole system.\nvoid ImGui::LogRenderedText(const ImVec2* ref_pos, const char* text, const char* text_end)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n\n    const char* prefix = g.LogNextPrefix;\n    const char* suffix = g.LogNextSuffix;\n    g.LogNextPrefix = g.LogNextSuffix = NULL;\n\n    if (!text_end)\n        text_end = FindRenderedTextEnd(text, text_end);\n\n    const bool log_new_line = ref_pos && (ref_pos->y > g.LogLinePosY + g.Style.FramePadding.y + 1);\n    if (ref_pos)\n        g.LogLinePosY = ref_pos->y;\n    if (log_new_line)\n    {\n        LogText(IM_NEWLINE);\n        g.LogLineFirstItem = true;\n    }\n\n    if (prefix)\n        LogRenderedText(ref_pos, prefix, prefix + strlen(prefix)); // Calculate end ourself to ensure \"##\" are included here.\n\n    // Re-adjust padding if we have popped out of our starting depth\n    if (g.LogDepthRef > window->DC.TreeDepth)\n        g.LogDepthRef = window->DC.TreeDepth;\n    const int tree_depth = (window->DC.TreeDepth - g.LogDepthRef);\n\n    const char* text_remaining = text;\n    for (;;)\n    {\n        // Split the string. Each new line (after a '\\n') is followed by indentation corresponding to the current depth of our log entry.\n        // We don't add a trailing \\n yet to allow a subsequent item on the same line to be captured.\n        const char* line_start = text_remaining;\n        const char* line_end = ImStreolRange(line_start, text_end);\n        const bool is_last_line = (line_end == text_end);\n        if (line_start != line_end || !is_last_line)\n        {\n            const int line_length = (int)(line_end - line_start);\n            const int indentation = g.LogLineFirstItem ? tree_depth * 4 : 1;\n            LogText(\"%*s%.*s\", indentation, \"\", line_length, line_start);\n            g.LogLineFirstItem = false;\n            if (*line_end == '\\n')\n            {\n                LogText(IM_NEWLINE);\n                g.LogLineFirstItem = true;\n            }\n        }\n        if (is_last_line)\n            break;\n        text_remaining = line_end + 1;\n    }\n\n    if (suffix)\n        LogRenderedText(ref_pos, suffix, suffix + strlen(suffix));\n}\n\n// Start logging/capturing text output\nvoid ImGui::LogBegin(ImGuiLogType type, int auto_open_depth)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    IM_ASSERT(g.LogEnabled == false);\n    IM_ASSERT(g.LogFile == NULL);\n    IM_ASSERT(g.LogBuffer.empty());\n    g.LogEnabled = true;\n    g.LogType = type;\n    g.LogNextPrefix = g.LogNextSuffix = NULL;\n    g.LogDepthRef = window->DC.TreeDepth;\n    g.LogDepthToExpand = ((auto_open_depth >= 0) ? auto_open_depth : g.LogDepthToExpandDefault);\n    g.LogLinePosY = FLT_MAX;\n    g.LogLineFirstItem = true;\n}\n\n// Important: doesn't copy underlying data, use carefully (prefix/suffix must be in scope at the time of the next LogRenderedText)\nvoid ImGui::LogSetNextTextDecoration(const char* prefix, const char* suffix)\n{\n    ImGuiContext& g = *GImGui;\n    g.LogNextPrefix = prefix;\n    g.LogNextSuffix = suffix;\n}\n\nvoid ImGui::LogToTTY(int auto_open_depth)\n{\n    ImGuiContext& g = *GImGui;\n    if (g.LogEnabled)\n        return;\n    IM_UNUSED(auto_open_depth);\n#ifndef IMGUI_DISABLE_TTY_FUNCTIONS\n    LogBegin(ImGuiLogType_TTY, auto_open_depth);\n    g.LogFile = stdout;\n#endif\n}\n\n// Start logging/capturing text output to given file\nvoid ImGui::LogToFile(int auto_open_depth, const char* filename)\n{\n    ImGuiContext& g = *GImGui;\n    if (g.LogEnabled)\n        return;\n\n    // FIXME: We could probably open the file in text mode \"at\", however note that clipboard/buffer logging will still\n    // be subject to outputting OS-incompatible carriage return if within strings the user doesn't use IM_NEWLINE.\n    // By opening the file in binary mode \"ab\" we have consistent output everywhere.\n    if (!filename)\n        filename = g.IO.LogFilename;\n    if (!filename || !filename[0])\n        return;\n    ImFileHandle f = ImFileOpen(filename, \"ab\");\n    if (!f)\n    {\n        IM_ASSERT(0);\n        return;\n    }\n\n    LogBegin(ImGuiLogType_File, auto_open_depth);\n    g.LogFile = f;\n}\n\n// Start logging/capturing text output to clipboard\nvoid ImGui::LogToClipboard(int auto_open_depth)\n{\n    ImGuiContext& g = *GImGui;\n    if (g.LogEnabled)\n        return;\n    LogBegin(ImGuiLogType_Clipboard, auto_open_depth);\n}\n\nvoid ImGui::LogToBuffer(int auto_open_depth)\n{\n    ImGuiContext& g = *GImGui;\n    if (g.LogEnabled)\n        return;\n    LogBegin(ImGuiLogType_Buffer, auto_open_depth);\n}\n\nvoid ImGui::LogFinish()\n{\n    ImGuiContext& g = *GImGui;\n    if (!g.LogEnabled)\n        return;\n\n    LogText(IM_NEWLINE);\n    switch (g.LogType)\n    {\n    case ImGuiLogType_TTY:\n#ifndef IMGUI_DISABLE_TTY_FUNCTIONS\n        fflush(g.LogFile);\n#endif\n        break;\n    case ImGuiLogType_File:\n        ImFileClose(g.LogFile);\n        break;\n    case ImGuiLogType_Buffer:\n        break;\n    case ImGuiLogType_Clipboard:\n        if (!g.LogBuffer.empty())\n            SetClipboardText(g.LogBuffer.begin());\n        break;\n    case ImGuiLogType_None:\n        IM_ASSERT(0);\n        break;\n    }\n\n    g.LogEnabled = false;\n    g.LogType = ImGuiLogType_None;\n    g.LogFile = NULL;\n    g.LogBuffer.clear();\n}\n\n// Helper to display logging buttons\n// FIXME-OBSOLETE: We should probably obsolete this and let the user have their own helper (this is one of the oldest function alive!)\nvoid ImGui::LogButtons()\n{\n    ImGuiContext& g = *GImGui;\n\n    PushID(\"LogButtons\");\n#ifndef IMGUI_DISABLE_TTY_FUNCTIONS\n    const bool log_to_tty = Button(\"Log To TTY\"); SameLine();\n#else\n    const bool log_to_tty = false;\n#endif\n    const bool log_to_file = Button(\"Log To File\"); SameLine();\n    const bool log_to_clipboard = Button(\"Log To Clipboard\"); SameLine();\n    PushAllowKeyboardFocus(false);\n    SetNextItemWidth(80.0f);\n    SliderInt(\"Default Depth\", &g.LogDepthToExpandDefault, 0, 9, NULL);\n    PopAllowKeyboardFocus();\n    PopID();\n\n    // Start logging at the end of the function so that the buttons don't appear in the log\n    if (log_to_tty)\n        LogToTTY();\n    if (log_to_file)\n        LogToFile();\n    if (log_to_clipboard)\n        LogToClipboard();\n}\n\n\n//-----------------------------------------------------------------------------\n// [SECTION] SETTINGS\n//-----------------------------------------------------------------------------\n// - UpdateSettings() [Internal]\n// - MarkIniSettingsDirty() [Internal]\n// - CreateNewWindowSettings() [Internal]\n// - FindWindowSettings() [Internal]\n// - FindOrCreateWindowSettings() [Internal]\n// - FindSettingsHandler() [Internal]\n// - ClearIniSettings() [Internal]\n// - LoadIniSettingsFromDisk()\n// - LoadIniSettingsFromMemory()\n// - SaveIniSettingsToDisk()\n// - SaveIniSettingsToMemory()\n// - WindowSettingsHandler_***() [Internal]\n//-----------------------------------------------------------------------------\n\n// Called by NewFrame()\nvoid ImGui::UpdateSettings()\n{\n    // Load settings on first frame (if not explicitly loaded manually before)\n    ImGuiContext& g = *GImGui;\n    if (!g.SettingsLoaded)\n    {\n        IM_ASSERT(g.SettingsWindows.empty());\n        if (g.IO.IniFilename)\n            LoadIniSettingsFromDisk(g.IO.IniFilename);\n        g.SettingsLoaded = true;\n    }\n\n    // Save settings (with a delay after the last modification, so we don't spam disk too much)\n    if (g.SettingsDirtyTimer > 0.0f)\n    {\n        g.SettingsDirtyTimer -= g.IO.DeltaTime;\n        if (g.SettingsDirtyTimer <= 0.0f)\n        {\n            if (g.IO.IniFilename != NULL)\n                SaveIniSettingsToDisk(g.IO.IniFilename);\n            else\n                g.IO.WantSaveIniSettings = true;  // Let user know they can call SaveIniSettingsToMemory(). user will need to clear io.WantSaveIniSettings themselves.\n            g.SettingsDirtyTimer = 0.0f;\n        }\n    }\n}\n\nvoid ImGui::MarkIniSettingsDirty()\n{\n    ImGuiContext& g = *GImGui;\n    if (g.SettingsDirtyTimer <= 0.0f)\n        g.SettingsDirtyTimer = g.IO.IniSavingRate;\n}\n\nvoid ImGui::MarkIniSettingsDirty(ImGuiWindow* window)\n{\n    ImGuiContext& g = *GImGui;\n    if (!(window->Flags & ImGuiWindowFlags_NoSavedSettings))\n        if (g.SettingsDirtyTimer <= 0.0f)\n            g.SettingsDirtyTimer = g.IO.IniSavingRate;\n}\n\nImGuiWindowSettings* ImGui::CreateNewWindowSettings(const char* name)\n{\n    ImGuiContext& g = *GImGui;\n\n#if !IMGUI_DEBUG_INI_SETTINGS\n    // Skip to the \"###\" marker if any. We don't skip past to match the behavior of GetID()\n    // Preserve the full string when IMGUI_DEBUG_INI_SETTINGS is set to make .ini inspection easier.\n    if (const char* p = strstr(name, \"###\"))\n        name = p;\n#endif\n    const size_t name_len = strlen(name);\n\n    // Allocate chunk\n    const size_t chunk_size = sizeof(ImGuiWindowSettings) + name_len + 1;\n    ImGuiWindowSettings* settings = g.SettingsWindows.alloc_chunk(chunk_size);\n    IM_PLACEMENT_NEW(settings) ImGuiWindowSettings();\n    settings->ID = ImHashStr(name, name_len);\n    memcpy(settings->GetName(), name, name_len + 1);   // Store with zero terminator\n\n    return settings;\n}\n\nImGuiWindowSettings* ImGui::FindWindowSettings(ImGuiID id)\n{\n    ImGuiContext& g = *GImGui;\n    for (ImGuiWindowSettings* settings = g.SettingsWindows.begin(); settings != NULL; settings = g.SettingsWindows.next_chunk(settings))\n        if (settings->ID == id)\n            return settings;\n    return NULL;\n}\n\nImGuiWindowSettings* ImGui::FindOrCreateWindowSettings(const char* name)\n{\n    if (ImGuiWindowSettings* settings = FindWindowSettings(ImHashStr(name)))\n        return settings;\n    return CreateNewWindowSettings(name);\n}\n\nImGuiSettingsHandler* ImGui::FindSettingsHandler(const char* type_name)\n{\n    ImGuiContext& g = *GImGui;\n    const ImGuiID type_hash = ImHashStr(type_name);\n    for (int handler_n = 0; handler_n < g.SettingsHandlers.Size; handler_n++)\n        if (g.SettingsHandlers[handler_n].TypeHash == type_hash)\n            return &g.SettingsHandlers[handler_n];\n    return NULL;\n}\n\nvoid ImGui::ClearIniSettings()\n{\n    ImGuiContext& g = *GImGui;\n    g.SettingsIniData.clear();\n    for (int handler_n = 0; handler_n < g.SettingsHandlers.Size; handler_n++)\n        if (g.SettingsHandlers[handler_n].ClearAllFn)\n            g.SettingsHandlers[handler_n].ClearAllFn(&g, &g.SettingsHandlers[handler_n]);\n}\n\nvoid ImGui::LoadIniSettingsFromDisk(const char* ini_filename)\n{\n    size_t file_data_size = 0;\n    char* file_data = (char*)ImFileLoadToMemory(ini_filename, \"rb\", &file_data_size);\n    if (!file_data)\n        return;\n    LoadIniSettingsFromMemory(file_data, (size_t)file_data_size);\n    IM_FREE(file_data);\n}\n\n// Zero-tolerance, no error reporting, cheap .ini parsing\nvoid ImGui::LoadIniSettingsFromMemory(const char* ini_data, size_t ini_size)\n{\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(g.Initialized);\n    //IM_ASSERT(!g.WithinFrameScope && \"Cannot be called between NewFrame() and EndFrame()\");\n    //IM_ASSERT(g.SettingsLoaded == false && g.FrameCount == 0);\n\n    // For user convenience, we allow passing a non zero-terminated string (hence the ini_size parameter).\n    // For our convenience and to make the code simpler, we'll also write zero-terminators within the buffer. So let's create a writable copy..\n    if (ini_size == 0)\n        ini_size = strlen(ini_data);\n    g.SettingsIniData.Buf.resize((int)ini_size + 1);\n    char* const buf = g.SettingsIniData.Buf.Data;\n    char* const buf_end = buf + ini_size;\n    memcpy(buf, ini_data, ini_size);\n    buf_end[0] = 0;\n\n    // Call pre-read handlers\n    // Some types will clear their data (e.g. dock information) some types will allow merge/override (window)\n    for (int handler_n = 0; handler_n < g.SettingsHandlers.Size; handler_n++)\n        if (g.SettingsHandlers[handler_n].ReadInitFn)\n            g.SettingsHandlers[handler_n].ReadInitFn(&g, &g.SettingsHandlers[handler_n]);\n\n    void* entry_data = NULL;\n    ImGuiSettingsHandler* entry_handler = NULL;\n\n    char* line_end = NULL;\n    for (char* line = buf; line < buf_end; line = line_end + 1)\n    {\n        // Skip new lines markers, then find end of the line\n        while (*line == '\\n' || *line == '\\r')\n            line++;\n        line_end = line;\n        while (line_end < buf_end && *line_end != '\\n' && *line_end != '\\r')\n            line_end++;\n        line_end[0] = 0;\n        if (line[0] == ';')\n            continue;\n        if (line[0] == '[' && line_end > line && line_end[-1] == ']')\n        {\n            // Parse \"[Type][Name]\". Note that 'Name' can itself contains [] characters, which is acceptable with the current format and parsing code.\n            line_end[-1] = 0;\n            const char* name_end = line_end - 1;\n            const char* type_start = line + 1;\n            char* type_end = (char*)(void*)ImStrchrRange(type_start, name_end, ']');\n            const char* name_start = type_end ? ImStrchrRange(type_end + 1, name_end, '[') : NULL;\n            if (!type_end || !name_start)\n                continue;\n            *type_end = 0; // Overwrite first ']'\n            name_start++;  // Skip second '['\n            entry_handler = FindSettingsHandler(type_start);\n            entry_data = entry_handler ? entry_handler->ReadOpenFn(&g, entry_handler, name_start) : NULL;\n        }\n        else if (entry_handler != NULL && entry_data != NULL)\n        {\n            // Let type handler parse the line\n            entry_handler->ReadLineFn(&g, entry_handler, entry_data, line);\n        }\n    }\n    g.SettingsLoaded = true;\n\n    // [DEBUG] Restore untouched copy so it can be browsed in Metrics (not strictly necessary)\n    memcpy(buf, ini_data, ini_size);\n\n    // Call post-read handlers\n    for (int handler_n = 0; handler_n < g.SettingsHandlers.Size; handler_n++)\n        if (g.SettingsHandlers[handler_n].ApplyAllFn)\n            g.SettingsHandlers[handler_n].ApplyAllFn(&g, &g.SettingsHandlers[handler_n]);\n}\n\nvoid ImGui::SaveIniSettingsToDisk(const char* ini_filename)\n{\n    ImGuiContext& g = *GImGui;\n    g.SettingsDirtyTimer = 0.0f;\n    if (!ini_filename)\n        return;\n\n    size_t ini_data_size = 0;\n    const char* ini_data = SaveIniSettingsToMemory(&ini_data_size);\n    ImFileHandle f = ImFileOpen(ini_filename, \"wt\");\n    if (!f)\n        return;\n    ImFileWrite(ini_data, sizeof(char), ini_data_size, f);\n    ImFileClose(f);\n}\n\n// Call registered handlers (e.g. SettingsHandlerWindow_WriteAll() + custom handlers) to write their stuff into a text buffer\nconst char* ImGui::SaveIniSettingsToMemory(size_t* out_size)\n{\n    ImGuiContext& g = *GImGui;\n    g.SettingsDirtyTimer = 0.0f;\n    g.SettingsIniData.Buf.resize(0);\n    g.SettingsIniData.Buf.push_back(0);\n    for (int handler_n = 0; handler_n < g.SettingsHandlers.Size; handler_n++)\n    {\n        ImGuiSettingsHandler* handler = &g.SettingsHandlers[handler_n];\n        handler->WriteAllFn(&g, handler, &g.SettingsIniData);\n    }\n    if (out_size)\n        *out_size = (size_t)g.SettingsIniData.size();\n    return g.SettingsIniData.c_str();\n}\n\nstatic void WindowSettingsHandler_ClearAll(ImGuiContext* ctx, ImGuiSettingsHandler*)\n{\n    ImGuiContext& g = *ctx;\n    for (int i = 0; i != g.Windows.Size; i++)\n        g.Windows[i]->SettingsOffset = -1;\n    g.SettingsWindows.clear();\n}\n\nstatic void* WindowSettingsHandler_ReadOpen(ImGuiContext*, ImGuiSettingsHandler*, const char* name)\n{\n    ImGuiWindowSettings* settings = ImGui::FindOrCreateWindowSettings(name);\n    ImGuiID id = settings->ID;\n    *settings = ImGuiWindowSettings(); // Clear existing if recycling previous entry\n    settings->ID = id;\n    settings->WantApply = true;\n    return (void*)settings;\n}\n\nstatic void WindowSettingsHandler_ReadLine(ImGuiContext*, ImGuiSettingsHandler*, void* entry, const char* line)\n{\n    ImGuiWindowSettings* settings = (ImGuiWindowSettings*)entry;\n    int x, y;\n    int i;\n    if (sscanf(line, \"Pos=%i,%i\", &x, &y) == 2)         { settings->Pos = ImVec2ih((short)x, (short)y); }\n    else if (sscanf(line, \"Size=%i,%i\", &x, &y) == 2)   { settings->Size = ImVec2ih((short)x, (short)y); }\n    else if (sscanf(line, \"Collapsed=%d\", &i) == 1)     { settings->Collapsed = (i != 0); }\n}\n\n// Apply to existing windows (if any)\nstatic void WindowSettingsHandler_ApplyAll(ImGuiContext* ctx, ImGuiSettingsHandler*)\n{\n    ImGuiContext& g = *ctx;\n    for (ImGuiWindowSettings* settings = g.SettingsWindows.begin(); settings != NULL; settings = g.SettingsWindows.next_chunk(settings))\n        if (settings->WantApply)\n        {\n            if (ImGuiWindow* window = ImGui::FindWindowByID(settings->ID))\n                ApplyWindowSettings(window, settings);\n            settings->WantApply = false;\n        }\n}\n\nstatic void WindowSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* buf)\n{\n    // Gather data from windows that were active during this session\n    // (if a window wasn't opened in this session we preserve its settings)\n    ImGuiContext& g = *ctx;\n    for (int i = 0; i != g.Windows.Size; i++)\n    {\n        ImGuiWindow* window = g.Windows[i];\n        if (window->Flags & ImGuiWindowFlags_NoSavedSettings)\n            continue;\n\n        ImGuiWindowSettings* settings = (window->SettingsOffset != -1) ? g.SettingsWindows.ptr_from_offset(window->SettingsOffset) : ImGui::FindWindowSettings(window->ID);\n        if (!settings)\n        {\n            settings = ImGui::CreateNewWindowSettings(window->Name);\n            window->SettingsOffset = g.SettingsWindows.offset_from_ptr(settings);\n        }\n        IM_ASSERT(settings->ID == window->ID);\n        settings->Pos = ImVec2ih(window->Pos);\n        settings->Size = ImVec2ih(window->SizeFull);\n\n        settings->Collapsed = window->Collapsed;\n    }\n\n    // Write to text buffer\n    buf->reserve(buf->size() + g.SettingsWindows.size() * 6); // ballpark reserve\n    for (ImGuiWindowSettings* settings = g.SettingsWindows.begin(); settings != NULL; settings = g.SettingsWindows.next_chunk(settings))\n    {\n        const char* settings_name = settings->GetName();\n        buf->appendf(\"[%s][%s]\\n\", handler->TypeName, settings_name);\n        buf->appendf(\"Pos=%d,%d\\n\", settings->Pos.x, settings->Pos.y);\n        buf->appendf(\"Size=%d,%d\\n\", settings->Size.x, settings->Size.y);\n        buf->appendf(\"Collapsed=%d\\n\", settings->Collapsed);\n        buf->append(\"\\n\");\n    }\n}\n\n\n//-----------------------------------------------------------------------------\n// [SECTION] VIEWPORTS, PLATFORM WINDOWS\n//-----------------------------------------------------------------------------\n// - GetMainViewport()\n// - UpdateViewportsNewFrame() [Internal]\n// (this section is more complete in the 'docking' branch)\n//-----------------------------------------------------------------------------\n\nImGuiViewport* ImGui::GetMainViewport()\n{\n    ImGuiContext& g = *GImGui;\n    return g.Viewports[0];\n}\n\n// Update viewports and monitor infos\nstatic void ImGui::UpdateViewportsNewFrame()\n{\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(g.Viewports.Size == 1);\n\n    // Update main viewport with current platform position.\n    // FIXME-VIEWPORT: Size is driven by backend/user code for backward-compatibility but we should aim to make this more consistent.\n    ImGuiViewportP* main_viewport = g.Viewports[0];\n    main_viewport->Flags = ImGuiViewportFlags_IsPlatformWindow | ImGuiViewportFlags_OwnedByApp;\n    main_viewport->Pos = ImVec2(0.0f, 0.0f);\n    main_viewport->Size = g.IO.DisplaySize;\n\n    for (int n = 0; n < g.Viewports.Size; n++)\n    {\n        ImGuiViewportP* viewport = g.Viewports[n];\n\n        // Lock down space taken by menu bars and status bars, reset the offset for fucntions like BeginMainMenuBar() to alter them again.\n        viewport->WorkOffsetMin = viewport->BuildWorkOffsetMin;\n        viewport->WorkOffsetMax = viewport->BuildWorkOffsetMax;\n        viewport->BuildWorkOffsetMin = viewport->BuildWorkOffsetMax = ImVec2(0.0f, 0.0f);\n        viewport->UpdateWorkRect();\n    }\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] DOCKING\n//-----------------------------------------------------------------------------\n\n// (this section is filled in the 'docking' branch)\n\n\n//-----------------------------------------------------------------------------\n// [SECTION] PLATFORM DEPENDENT HELPERS\n//-----------------------------------------------------------------------------\n\n#if defined(_WIN32) && !defined(IMGUI_DISABLE_WIN32_FUNCTIONS) && !defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS)\n\n#ifdef _MSC_VER\n#pragma comment(lib, \"user32\")\n#pragma comment(lib, \"kernel32\")\n#endif\n\n// Win32 clipboard implementation\n// We use g.ClipboardHandlerData for temporary storage to ensure it is freed on Shutdown()\nstatic const char* GetClipboardTextFn_DefaultImpl(void*)\n{\n    ImGuiContext& g = *GImGui;\n    g.ClipboardHandlerData.clear();\n    if (!::OpenClipboard(NULL))\n        return NULL;\n    HANDLE wbuf_handle = ::GetClipboardData(CF_UNICODETEXT);\n    if (wbuf_handle == NULL)\n    {\n        ::CloseClipboard();\n        return NULL;\n    }\n    if (const WCHAR* wbuf_global = (const WCHAR*)::GlobalLock(wbuf_handle))\n    {\n        int buf_len = ::WideCharToMultiByte(CP_UTF8, 0, wbuf_global, -1, NULL, 0, NULL, NULL);\n        g.ClipboardHandlerData.resize(buf_len);\n        ::WideCharToMultiByte(CP_UTF8, 0, wbuf_global, -1, g.ClipboardHandlerData.Data, buf_len, NULL, NULL);\n    }\n    ::GlobalUnlock(wbuf_handle);\n    ::CloseClipboard();\n    return g.ClipboardHandlerData.Data;\n}\n\nstatic void SetClipboardTextFn_DefaultImpl(void*, const char* text)\n{\n    if (!::OpenClipboard(NULL))\n        return;\n    const int wbuf_length = ::MultiByteToWideChar(CP_UTF8, 0, text, -1, NULL, 0);\n    HGLOBAL wbuf_handle = ::GlobalAlloc(GMEM_MOVEABLE, (SIZE_T)wbuf_length * sizeof(WCHAR));\n    if (wbuf_handle == NULL)\n    {\n        ::CloseClipboard();\n        return;\n    }\n    WCHAR* wbuf_global = (WCHAR*)::GlobalLock(wbuf_handle);\n    ::MultiByteToWideChar(CP_UTF8, 0, text, -1, wbuf_global, wbuf_length);\n    ::GlobalUnlock(wbuf_handle);\n    ::EmptyClipboard();\n    if (::SetClipboardData(CF_UNICODETEXT, wbuf_handle) == NULL)\n        ::GlobalFree(wbuf_handle);\n    ::CloseClipboard();\n}\n\n#elif defined(__APPLE__) && TARGET_OS_OSX && defined(IMGUI_ENABLE_OSX_DEFAULT_CLIPBOARD_FUNCTIONS)\n\n#include <Carbon/Carbon.h>  // Use old API to avoid need for separate .mm file\nstatic PasteboardRef main_clipboard = 0;\n\n// OSX clipboard implementation\n// If you enable this you will need to add '-framework ApplicationServices' to your linker command-line!\nstatic void SetClipboardTextFn_DefaultImpl(void*, const char* text)\n{\n    if (!main_clipboard)\n        PasteboardCreate(kPasteboardClipboard, &main_clipboard);\n    PasteboardClear(main_clipboard);\n    CFDataRef cf_data = CFDataCreate(kCFAllocatorDefault, (const UInt8*)text, strlen(text));\n    if (cf_data)\n    {\n        PasteboardPutItemFlavor(main_clipboard, (PasteboardItemID)1, CFSTR(\"public.utf8-plain-text\"), cf_data, 0);\n        CFRelease(cf_data);\n    }\n}\n\nstatic const char* GetClipboardTextFn_DefaultImpl(void*)\n{\n    if (!main_clipboard)\n        PasteboardCreate(kPasteboardClipboard, &main_clipboard);\n    PasteboardSynchronize(main_clipboard);\n\n    ItemCount item_count = 0;\n    PasteboardGetItemCount(main_clipboard, &item_count);\n    for (ItemCount i = 0; i < item_count; i++)\n    {\n        PasteboardItemID item_id = 0;\n        PasteboardGetItemIdentifier(main_clipboard, i + 1, &item_id);\n        CFArrayRef flavor_type_array = 0;\n        PasteboardCopyItemFlavors(main_clipboard, item_id, &flavor_type_array);\n        for (CFIndex j = 0, nj = CFArrayGetCount(flavor_type_array); j < nj; j++)\n        {\n            CFDataRef cf_data;\n            if (PasteboardCopyItemFlavorData(main_clipboard, item_id, CFSTR(\"public.utf8-plain-text\"), &cf_data) == noErr)\n            {\n                ImGuiContext& g = *GImGui;\n                g.ClipboardHandlerData.clear();\n                int length = (int)CFDataGetLength(cf_data);\n                g.ClipboardHandlerData.resize(length + 1);\n                CFDataGetBytes(cf_data, CFRangeMake(0, length), (UInt8*)g.ClipboardHandlerData.Data);\n                g.ClipboardHandlerData[length] = 0;\n                CFRelease(cf_data);\n                return g.ClipboardHandlerData.Data;\n            }\n        }\n    }\n    return NULL;\n}\n\n#else\n\n// Local Dear ImGui-only clipboard implementation, if user hasn't defined better clipboard handlers.\nstatic const char* GetClipboardTextFn_DefaultImpl(void*)\n{\n    ImGuiContext& g = *GImGui;\n    return g.ClipboardHandlerData.empty() ? NULL : g.ClipboardHandlerData.begin();\n}\n\nstatic void SetClipboardTextFn_DefaultImpl(void*, const char* text)\n{\n    ImGuiContext& g = *GImGui;\n    g.ClipboardHandlerData.clear();\n    const char* text_end = text + strlen(text);\n    g.ClipboardHandlerData.resize((int)(text_end - text) + 1);\n    memcpy(&g.ClipboardHandlerData[0], text, (size_t)(text_end - text));\n    g.ClipboardHandlerData[(int)(text_end - text)] = 0;\n}\n\n#endif\n\n// Win32 API IME support (for Asian languages, etc.)\n#if defined(_WIN32) && !defined(IMGUI_DISABLE_WIN32_FUNCTIONS) && !defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS)\n\n#include <imm.h>\n#ifdef _MSC_VER\n#pragma comment(lib, \"imm32\")\n#endif\n\nstatic void ImeSetInputScreenPosFn_DefaultImpl(int x, int y)\n{\n    // Notify OS Input Method Editor of text input position\n    ImGuiIO& io = ImGui::GetIO();\n    if (HWND hwnd = (HWND)io.ImeWindowHandle)\n        if (HIMC himc = ::ImmGetContext(hwnd))\n        {\n            COMPOSITIONFORM cf;\n            cf.ptCurrentPos.x = x;\n            cf.ptCurrentPos.y = y;\n            cf.dwStyle = CFS_FORCE_POSITION;\n            ::ImmSetCompositionWindow(himc, &cf);\n            ::ImmReleaseContext(hwnd, himc);\n        }\n}\n\n#else\n\nstatic void ImeSetInputScreenPosFn_DefaultImpl(int, int) {}\n\n#endif\n\n//-----------------------------------------------------------------------------\n// [SECTION] METRICS/DEBUGGER WINDOW\n//-----------------------------------------------------------------------------\n// - RenderViewportThumbnail() [Internal]\n// - RenderViewportsThumbnails() [Internal]\n// - MetricsHelpMarker() [Internal]\n// - ShowMetricsWindow()\n// - DebugNodeColumns() [Internal]\n// - DebugNodeDrawList() [Internal]\n// - DebugNodeDrawCmdShowMeshAndBoundingBox() [Internal]\n// - DebugNodeStorage() [Internal]\n// - DebugNodeTabBar() [Internal]\n// - DebugNodeViewport() [Internal]\n// - DebugNodeWindow() [Internal]\n// - DebugNodeWindowSettings() [Internal]\n// - DebugNodeWindowsList() [Internal]\n//-----------------------------------------------------------------------------\n\n#ifndef IMGUI_DISABLE_METRICS_WINDOW\n\nvoid ImGui::DebugRenderViewportThumbnail(ImDrawList* draw_list, ImGuiViewportP* viewport, const ImRect& bb)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n\n    ImVec2 scale = bb.GetSize() / viewport->Size;\n    ImVec2 off = bb.Min - viewport->Pos * scale;\n    float alpha_mul = 1.0f;\n    window->DrawList->AddRectFilled(bb.Min, bb.Max, GetColorU32(ImGuiCol_Border, alpha_mul * 0.40f));\n    for (int i = 0; i != g.Windows.Size; i++)\n    {\n        ImGuiWindow* thumb_window = g.Windows[i];\n        if (!thumb_window->WasActive || (thumb_window->Flags & ImGuiWindowFlags_ChildWindow))\n            continue;\n\n        ImRect thumb_r = thumb_window->Rect();\n        ImRect title_r = thumb_window->TitleBarRect();\n        thumb_r = ImRect(ImFloor(off + thumb_r.Min * scale), ImFloor(off +  thumb_r.Max * scale));\n        title_r = ImRect(ImFloor(off + title_r.Min * scale), ImFloor(off +  ImVec2(title_r.Max.x, title_r.Min.y) * scale) + ImVec2(0,5)); // Exaggerate title bar height\n        thumb_r.ClipWithFull(bb);\n        title_r.ClipWithFull(bb);\n        const bool window_is_focused = (g.NavWindow && thumb_window->RootWindowForTitleBarHighlight == g.NavWindow->RootWindowForTitleBarHighlight);\n        window->DrawList->AddRectFilled(thumb_r.Min, thumb_r.Max, GetColorU32(ImGuiCol_WindowBg, alpha_mul));\n        window->DrawList->AddRectFilled(title_r.Min, title_r.Max, GetColorU32(window_is_focused ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBg, alpha_mul));\n        window->DrawList->AddRect(thumb_r.Min, thumb_r.Max, GetColorU32(ImGuiCol_Border, alpha_mul));\n        window->DrawList->AddText(g.Font, g.FontSize * 1.0f, title_r.Min, GetColorU32(ImGuiCol_Text, alpha_mul), thumb_window->Name, FindRenderedTextEnd(thumb_window->Name));\n    }\n    draw_list->AddRect(bb.Min, bb.Max, GetColorU32(ImGuiCol_Border, alpha_mul));\n}\n\nstatic void RenderViewportsThumbnails()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n\n    // We don't display full monitor bounds (we could, but it often looks awkward), instead we display just enough to cover all of our viewports.\n    float SCALE = 1.0f / 8.0f;\n    ImRect bb_full(FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX);\n    for (int n = 0; n < g.Viewports.Size; n++)\n        bb_full.Add(g.Viewports[n]->GetMainRect());\n    ImVec2 p = window->DC.CursorPos;\n    ImVec2 off = p - bb_full.Min * SCALE;\n    for (int n = 0; n < g.Viewports.Size; n++)\n    {\n        ImGuiViewportP* viewport = g.Viewports[n];\n        ImRect viewport_draw_bb(off + (viewport->Pos) * SCALE, off + (viewport->Pos + viewport->Size) * SCALE);\n        ImGui::DebugRenderViewportThumbnail(window->DrawList, viewport, viewport_draw_bb);\n    }\n    ImGui::Dummy(bb_full.GetSize() * SCALE);\n}\n\n// Avoid naming collision with imgui_demo.cpp's HelpMarker() for unity builds.\nstatic void MetricsHelpMarker(const char* desc)\n{\n    ImGui::TextDisabled(\"(?)\");\n    if (ImGui::IsItemHovered())\n    {\n        ImGui::BeginTooltip();\n        ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);\n        ImGui::TextUnformatted(desc);\n        ImGui::PopTextWrapPos();\n        ImGui::EndTooltip();\n    }\n}\n\n#ifndef IMGUI_DISABLE_DEMO_WINDOWS\nnamespace ImGui { void ShowFontAtlas(ImFontAtlas* atlas); }\n#endif\n\nvoid ImGui::ShowMetricsWindow(bool* p_open)\n{\n    if (!Begin(\"Dear ImGui Metrics/Debugger\", p_open))\n    {\n        End();\n        return;\n    }\n\n    ImGuiContext& g = *GImGui;\n    ImGuiIO& io = g.IO;\n    ImGuiMetricsConfig* cfg = &g.DebugMetricsConfig;\n\n    // Basic info\n    Text(\"Dear ImGui %s\", GetVersion());\n    Text(\"Application average %.3f ms/frame (%.1f FPS)\", 1000.0f / io.Framerate, io.Framerate);\n    Text(\"%d vertices, %d indices (%d triangles)\", io.MetricsRenderVertices, io.MetricsRenderIndices, io.MetricsRenderIndices / 3);\n    Text(\"%d active windows (%d visible)\", io.MetricsActiveWindows, io.MetricsRenderWindows);\n    Text(\"%d active allocations\", io.MetricsActiveAllocations);\n    //SameLine(); if (SmallButton(\"GC\")) { g.GcCompactAll = true; }\n\n    Separator();\n\n    // Debugging enums\n    enum { WRT_OuterRect, WRT_OuterRectClipped, WRT_InnerRect, WRT_InnerClipRect, WRT_WorkRect, WRT_Content, WRT_ContentIdeal, WRT_ContentRegionRect, WRT_Count }; // Windows Rect Type\n    const char* wrt_rects_names[WRT_Count] = { \"OuterRect\", \"OuterRectClipped\", \"InnerRect\", \"InnerClipRect\", \"WorkRect\", \"Content\", \"ContentIdeal\", \"ContentRegionRect\" };\n    enum { TRT_OuterRect, TRT_InnerRect, TRT_WorkRect, TRT_HostClipRect, TRT_InnerClipRect, TRT_BackgroundClipRect, TRT_ColumnsRect, TRT_ColumnsWorkRect, TRT_ColumnsClipRect, TRT_ColumnsContentHeadersUsed, TRT_ColumnsContentHeadersIdeal, TRT_ColumnsContentFrozen, TRT_ColumnsContentUnfrozen, TRT_Count }; // Tables Rect Type\n    const char* trt_rects_names[TRT_Count] = { \"OuterRect\", \"InnerRect\", \"WorkRect\", \"HostClipRect\", \"InnerClipRect\", \"BackgroundClipRect\", \"ColumnsRect\", \"ColumnsWorkRect\", \"ColumnsClipRect\", \"ColumnsContentHeadersUsed\", \"ColumnsContentHeadersIdeal\", \"ColumnsContentFrozen\", \"ColumnsContentUnfrozen\" };\n    if (cfg->ShowWindowsRectsType < 0)\n        cfg->ShowWindowsRectsType = WRT_WorkRect;\n    if (cfg->ShowTablesRectsType < 0)\n        cfg->ShowTablesRectsType = TRT_WorkRect;\n\n    struct Funcs\n    {\n        static ImRect GetTableRect(ImGuiTable* table, int rect_type, int n)\n        {\n            if (rect_type == TRT_OuterRect)                     { return table->OuterRect; }\n            else if (rect_type == TRT_InnerRect)                { return table->InnerRect; }\n            else if (rect_type == TRT_WorkRect)                 { return table->WorkRect; }\n            else if (rect_type == TRT_HostClipRect)             { return table->HostClipRect; }\n            else if (rect_type == TRT_InnerClipRect)            { return table->InnerClipRect; }\n            else if (rect_type == TRT_BackgroundClipRect)       { return table->BgClipRect; }\n            else if (rect_type == TRT_ColumnsRect)              { ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->MinX, table->InnerClipRect.Min.y, c->MaxX, table->InnerClipRect.Min.y + table->LastOuterHeight); }\n            else if (rect_type == TRT_ColumnsWorkRect)          { ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->WorkRect.Min.y, c->WorkMaxX, table->WorkRect.Max.y); }\n            else if (rect_type == TRT_ColumnsClipRect)          { ImGuiTableColumn* c = &table->Columns[n]; return c->ClipRect; }\n            else if (rect_type == TRT_ColumnsContentHeadersUsed){ ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->InnerClipRect.Min.y, c->ContentMaxXHeadersUsed, table->InnerClipRect.Min.y + table->LastFirstRowHeight); } // Note: y1/y2 not always accurate\n            else if (rect_type == TRT_ColumnsContentHeadersIdeal){ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->InnerClipRect.Min.y, c->ContentMaxXHeadersIdeal, table->InnerClipRect.Min.y + table->LastFirstRowHeight); }\n            else if (rect_type == TRT_ColumnsContentFrozen)     { ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->InnerClipRect.Min.y, c->ContentMaxXFrozen, table->InnerClipRect.Min.y + table->LastFirstRowHeight); }\n            else if (rect_type == TRT_ColumnsContentUnfrozen)   { ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->InnerClipRect.Min.y + table->LastFirstRowHeight, c->ContentMaxXUnfrozen, table->InnerClipRect.Max.y); }\n            IM_ASSERT(0);\n            return ImRect();\n        }\n\n        static ImRect GetWindowRect(ImGuiWindow* window, int rect_type)\n        {\n            if (rect_type == WRT_OuterRect)                 { return window->Rect(); }\n            else if (rect_type == WRT_OuterRectClipped)     { return window->OuterRectClipped; }\n            else if (rect_type == WRT_InnerRect)            { return window->InnerRect; }\n            else if (rect_type == WRT_InnerClipRect)        { return window->InnerClipRect; }\n            else if (rect_type == WRT_WorkRect)             { return window->WorkRect; }\n            else if (rect_type == WRT_Content)       { ImVec2 min = window->InnerRect.Min - window->Scroll + window->WindowPadding; return ImRect(min, min + window->ContentSize); }\n            else if (rect_type == WRT_ContentIdeal)         { ImVec2 min = window->InnerRect.Min - window->Scroll + window->WindowPadding; return ImRect(min, min + window->ContentSizeIdeal); }\n            else if (rect_type == WRT_ContentRegionRect)    { return window->ContentRegionRect; }\n            IM_ASSERT(0);\n            return ImRect();\n        }\n    };\n\n    // Tools\n    if (TreeNode(\"Tools\"))\n    {\n        // The Item Picker tool is super useful to visually select an item and break into the call-stack of where it was submitted.\n        if (Button(\"Item Picker..\"))\n            DebugStartItemPicker();\n        SameLine();\n        MetricsHelpMarker(\"Will call the IM_DEBUG_BREAK() macro to break in debugger.\\nWarning: If you don't have a debugger attached, this will probably crash.\");\n\n        Checkbox(\"Show windows begin order\", &cfg->ShowWindowsBeginOrder);\n        Checkbox(\"Show windows rectangles\", &cfg->ShowWindowsRects);\n        SameLine();\n        SetNextItemWidth(GetFontSize() * 12);\n        cfg->ShowWindowsRects |= Combo(\"##show_windows_rect_type\", &cfg->ShowWindowsRectsType, wrt_rects_names, WRT_Count, WRT_Count);\n        if (cfg->ShowWindowsRects && g.NavWindow != NULL)\n        {\n            BulletText(\"'%s':\", g.NavWindow->Name);\n            Indent();\n            for (int rect_n = 0; rect_n < WRT_Count; rect_n++)\n            {\n                ImRect r = Funcs::GetWindowRect(g.NavWindow, rect_n);\n                Text(\"(%6.1f,%6.1f) (%6.1f,%6.1f) Size (%6.1f,%6.1f) %s\", r.Min.x, r.Min.y, r.Max.x, r.Max.y, r.GetWidth(), r.GetHeight(), wrt_rects_names[rect_n]);\n            }\n            Unindent();\n        }\n        Checkbox(\"Show ImDrawCmd mesh when hovering\", &cfg->ShowDrawCmdMesh);\n        Checkbox(\"Show ImDrawCmd bounding boxes when hovering\", &cfg->ShowDrawCmdBoundingBoxes);\n\n        Checkbox(\"Show tables rectangles\", &cfg->ShowTablesRects);\n        SameLine();\n        SetNextItemWidth(GetFontSize() * 12);\n        cfg->ShowTablesRects |= Combo(\"##show_table_rects_type\", &cfg->ShowTablesRectsType, trt_rects_names, TRT_Count, TRT_Count);\n        if (cfg->ShowTablesRects && g.NavWindow != NULL)\n        {\n            for (int table_n = 0; table_n < g.Tables.GetMapSize(); table_n++)\n            {\n                ImGuiTable* table = g.Tables.TryGetMapData(table_n);\n                if (table == NULL || table->LastFrameActive < g.FrameCount - 1 || (table->OuterWindow != g.NavWindow && table->InnerWindow != g.NavWindow))\n                    continue;\n\n                BulletText(\"Table 0x%08X (%d columns, in '%s')\", table->ID, table->ColumnsCount, table->OuterWindow->Name);\n                if (IsItemHovered())\n                    GetForegroundDrawList()->AddRect(table->OuterRect.Min - ImVec2(1, 1), table->OuterRect.Max + ImVec2(1, 1), IM_COL32(255, 255, 0, 255), 0.0f, 0, 2.0f);\n                Indent();\n                char buf[128];\n                for (int rect_n = 0; rect_n < TRT_Count; rect_n++)\n                {\n                    if (rect_n >= TRT_ColumnsRect)\n                    {\n                        if (rect_n != TRT_ColumnsRect && rect_n != TRT_ColumnsClipRect)\n                            continue;\n                        for (int column_n = 0; column_n < table->ColumnsCount; column_n++)\n                        {\n                            ImRect r = Funcs::GetTableRect(table, rect_n, column_n);\n                            ImFormatString(buf, IM_ARRAYSIZE(buf), \"(%6.1f,%6.1f) (%6.1f,%6.1f) Size (%6.1f,%6.1f) Col %d %s\", r.Min.x, r.Min.y, r.Max.x, r.Max.y, r.GetWidth(), r.GetHeight(), column_n, trt_rects_names[rect_n]);\n                            Selectable(buf);\n                            if (IsItemHovered())\n                                GetForegroundDrawList()->AddRect(r.Min - ImVec2(1, 1), r.Max + ImVec2(1, 1), IM_COL32(255, 255, 0, 255), 0.0f, 0, 2.0f);\n                        }\n                    }\n                    else\n                    {\n                        ImRect r = Funcs::GetTableRect(table, rect_n, -1);\n                        ImFormatString(buf, IM_ARRAYSIZE(buf), \"(%6.1f,%6.1f) (%6.1f,%6.1f) Size (%6.1f,%6.1f) %s\", r.Min.x, r.Min.y, r.Max.x, r.Max.y, r.GetWidth(), r.GetHeight(), trt_rects_names[rect_n]);\n                        Selectable(buf);\n                        if (IsItemHovered())\n                            GetForegroundDrawList()->AddRect(r.Min - ImVec2(1, 1), r.Max + ImVec2(1, 1), IM_COL32(255, 255, 0, 255), 0.0f, 0, 2.0f);\n                    }\n                }\n                Unindent();\n            }\n        }\n\n        TreePop();\n    }\n\n    // Windows\n    DebugNodeWindowsList(&g.Windows, \"Windows\");\n    //DebugNodeWindowsList(&g.WindowsFocusOrder, \"WindowsFocusOrder\");\n\n    // DrawLists\n    int drawlist_count = 0;\n    for (int viewport_i = 0; viewport_i < g.Viewports.Size; viewport_i++)\n        drawlist_count += g.Viewports[viewport_i]->DrawDataBuilder.GetDrawListCount();\n    if (TreeNode(\"DrawLists\", \"DrawLists (%d)\", drawlist_count))\n    {\n        for (int viewport_i = 0; viewport_i < g.Viewports.Size; viewport_i++)\n        {\n            ImGuiViewportP* viewport = g.Viewports[viewport_i];\n            for (int layer_i = 0; layer_i < IM_ARRAYSIZE(viewport->DrawDataBuilder.Layers); layer_i++)\n                for (int draw_list_i = 0; draw_list_i < viewport->DrawDataBuilder.Layers[layer_i].Size; draw_list_i++)\n                    DebugNodeDrawList(NULL, viewport->DrawDataBuilder.Layers[layer_i][draw_list_i], \"DrawList\");\n        }\n        TreePop();\n    }\n\n    // Viewports\n    if (TreeNode(\"Viewports\", \"Viewports (%d)\", g.Viewports.Size))\n    {\n        Indent(GetTreeNodeToLabelSpacing());\n        RenderViewportsThumbnails();\n        Unindent(GetTreeNodeToLabelSpacing());\n        for (int i = 0; i < g.Viewports.Size; i++)\n            DebugNodeViewport(g.Viewports[i]);\n        TreePop();\n    }\n\n    // Details for Popups\n    if (TreeNode(\"Popups\", \"Popups (%d)\", g.OpenPopupStack.Size))\n    {\n        for (int i = 0; i < g.OpenPopupStack.Size; i++)\n        {\n            ImGuiWindow* window = g.OpenPopupStack[i].Window;\n            BulletText(\"PopupID: %08x, Window: '%s'%s%s\", g.OpenPopupStack[i].PopupId, window ? window->Name : \"NULL\", window && (window->Flags & ImGuiWindowFlags_ChildWindow) ? \" ChildWindow\" : \"\", window && (window->Flags & ImGuiWindowFlags_ChildMenu) ? \" ChildMenu\" : \"\");\n        }\n        TreePop();\n    }\n\n    // Details for TabBars\n    if (TreeNode(\"TabBars\", \"Tab Bars (%d)\", g.TabBars.GetAliveCount()))\n    {\n        for (int n = 0; n < g.TabBars.GetMapSize(); n++)\n            if (ImGuiTabBar* tab_bar = g.TabBars.TryGetMapData(n))\n            {\n                PushID(tab_bar);\n                DebugNodeTabBar(tab_bar, \"TabBar\");\n                PopID();\n            }\n        TreePop();\n    }\n\n    // Details for Tables\n    if (TreeNode(\"Tables\", \"Tables (%d)\", g.Tables.GetAliveCount()))\n    {\n        for (int n = 0; n < g.Tables.GetMapSize(); n++)\n            if (ImGuiTable* table = g.Tables.TryGetMapData(n))\n                DebugNodeTable(table);\n        TreePop();\n    }\n\n    // Details for Fonts\n#ifndef IMGUI_DISABLE_DEMO_WINDOWS\n    ImFontAtlas* atlas = g.IO.Fonts;\n    if (TreeNode(\"Fonts\", \"Fonts (%d)\", atlas->Fonts.Size))\n    {\n        ShowFontAtlas(atlas);\n        TreePop();\n    }\n#endif\n\n    // Details for Docking\n#ifdef IMGUI_HAS_DOCK\n    if (TreeNode(\"Docking\"))\n    {\n        TreePop();\n    }\n#endif // #ifdef IMGUI_HAS_DOCK\n\n    // Settings\n    if (TreeNode(\"Settings\"))\n    {\n        if (SmallButton(\"Clear\"))\n            ClearIniSettings();\n        SameLine();\n        if (SmallButton(\"Save to memory\"))\n            SaveIniSettingsToMemory();\n        SameLine();\n        if (SmallButton(\"Save to disk\"))\n            SaveIniSettingsToDisk(g.IO.IniFilename);\n        SameLine();\n        if (g.IO.IniFilename)\n            Text(\"\\\"%s\\\"\", g.IO.IniFilename);\n        else\n            TextUnformatted(\"<NULL>\");\n        Text(\"SettingsDirtyTimer %.2f\", g.SettingsDirtyTimer);\n        if (TreeNode(\"SettingsHandlers\", \"Settings handlers: (%d)\", g.SettingsHandlers.Size))\n        {\n            for (int n = 0; n < g.SettingsHandlers.Size; n++)\n                BulletText(\"%s\", g.SettingsHandlers[n].TypeName);\n            TreePop();\n        }\n        if (TreeNode(\"SettingsWindows\", \"Settings packed data: Windows: %d bytes\", g.SettingsWindows.size()))\n        {\n            for (ImGuiWindowSettings* settings = g.SettingsWindows.begin(); settings != NULL; settings = g.SettingsWindows.next_chunk(settings))\n                DebugNodeWindowSettings(settings);\n            TreePop();\n        }\n\n        if (TreeNode(\"SettingsTables\", \"Settings packed data: Tables: %d bytes\", g.SettingsTables.size()))\n        {\n            for (ImGuiTableSettings* settings = g.SettingsTables.begin(); settings != NULL; settings = g.SettingsTables.next_chunk(settings))\n                DebugNodeTableSettings(settings);\n            TreePop();\n        }\n\n#ifdef IMGUI_HAS_DOCK\n#endif // #ifdef IMGUI_HAS_DOCK\n\n        if (TreeNode(\"SettingsIniData\", \"Settings unpacked data (.ini): %d bytes\", g.SettingsIniData.size()))\n        {\n            InputTextMultiline(\"##Ini\", (char*)(void*)g.SettingsIniData.c_str(), g.SettingsIniData.Buf.Size, ImVec2(-FLT_MIN, GetTextLineHeight() * 20), ImGuiInputTextFlags_ReadOnly);\n            TreePop();\n        }\n        TreePop();\n    }\n\n    // Misc Details\n    if (TreeNode(\"Internal state\"))\n    {\n        const char* input_source_names[] = { \"None\", \"Mouse\", \"Keyboard\", \"Gamepad\", \"Nav\", \"Clipboard\" }; IM_ASSERT(IM_ARRAYSIZE(input_source_names) == ImGuiInputSource_COUNT);\n\n        Text(\"WINDOWING\");\n        Indent();\n        Text(\"HoveredWindow: '%s'\", g.HoveredWindow ? g.HoveredWindow->Name : \"NULL\");\n        Text(\"HoveredWindow->Root: '%s'\", g.HoveredWindow ? g.HoveredWindow->RootWindow->Name : \"NULL\");\n        Text(\"HoveredWindowUnderMovingWindow: '%s'\", g.HoveredWindowUnderMovingWindow ? g.HoveredWindowUnderMovingWindow->Name : \"NULL\");\n        Text(\"MovingWindow: '%s'\", g.MovingWindow ? g.MovingWindow->Name : \"NULL\");\n        Unindent();\n\n        Text(\"ITEMS\");\n        Indent();\n        Text(\"ActiveId: 0x%08X/0x%08X (%.2f sec), AllowOverlap: %d, Source: %s\", g.ActiveId, g.ActiveIdPreviousFrame, g.ActiveIdTimer, g.ActiveIdAllowOverlap, input_source_names[g.ActiveIdSource]);\n        Text(\"ActiveIdWindow: '%s'\", g.ActiveIdWindow ? g.ActiveIdWindow->Name : \"NULL\");\n        Text(\"ActiveIdUsing: Wheel: %d, NavDirMask: %X, NavInputMask: %X, KeyInputMask: %llX\", g.ActiveIdUsingMouseWheel, g.ActiveIdUsingNavDirMask, g.ActiveIdUsingNavInputMask, g.ActiveIdUsingKeyInputMask);\n        Text(\"HoveredId: 0x%08X (%.2f sec), AllowOverlap: %d\", g.HoveredIdPreviousFrame, g.HoveredIdTimer, g.HoveredIdAllowOverlap); // Not displaying g.HoveredId as it is update mid-frame\n        Text(\"DragDrop: %d, SourceId = 0x%08X, Payload \\\"%s\\\" (%d bytes)\", g.DragDropActive, g.DragDropPayload.SourceId, g.DragDropPayload.DataType, g.DragDropPayload.DataSize);\n        Unindent();\n\n        Text(\"NAV,FOCUS\");\n        Indent();\n        Text(\"NavWindow: '%s'\", g.NavWindow ? g.NavWindow->Name : \"NULL\");\n        Text(\"NavId: 0x%08X, NavLayer: %d\", g.NavId, g.NavLayer);\n        Text(\"NavInputSource: %s\", input_source_names[g.NavInputSource]);\n        Text(\"NavActive: %d, NavVisible: %d\", g.IO.NavActive, g.IO.NavVisible);\n        Text(\"NavActivateId: 0x%08X, NavInputId: 0x%08X\", g.NavActivateId, g.NavInputId);\n        Text(\"NavDisableHighlight: %d, NavDisableMouseHover: %d\", g.NavDisableHighlight, g.NavDisableMouseHover);\n        Text(\"NavFocusScopeId = 0x%08X\", g.NavFocusScopeId);\n        Text(\"NavWindowingTarget: '%s'\", g.NavWindowingTarget ? g.NavWindowingTarget->Name : \"NULL\");\n        Unindent();\n\n        TreePop();\n    }\n\n    // Overlay: Display windows Rectangles and Begin Order\n    if (cfg->ShowWindowsRects || cfg->ShowWindowsBeginOrder)\n    {\n        for (int n = 0; n < g.Windows.Size; n++)\n        {\n            ImGuiWindow* window = g.Windows[n];\n            if (!window->WasActive)\n                continue;\n            ImDrawList* draw_list = GetForegroundDrawList(window);\n            if (cfg->ShowWindowsRects)\n            {\n                ImRect r = Funcs::GetWindowRect(window, cfg->ShowWindowsRectsType);\n                draw_list->AddRect(r.Min, r.Max, IM_COL32(255, 0, 128, 255));\n            }\n            if (cfg->ShowWindowsBeginOrder && !(window->Flags & ImGuiWindowFlags_ChildWindow))\n            {\n                char buf[32];\n                ImFormatString(buf, IM_ARRAYSIZE(buf), \"%d\", window->BeginOrderWithinContext);\n                float font_size = GetFontSize();\n                draw_list->AddRectFilled(window->Pos, window->Pos + ImVec2(font_size, font_size), IM_COL32(200, 100, 100, 255));\n                draw_list->AddText(window->Pos, IM_COL32(255, 255, 255, 255), buf);\n            }\n        }\n    }\n\n    // Overlay: Display Tables Rectangles\n    if (cfg->ShowTablesRects)\n    {\n        for (int table_n = 0; table_n < g.Tables.GetMapSize(); table_n++)\n        {\n            ImGuiTable* table = g.Tables.TryGetMapData(table_n);\n            if (table == NULL || table->LastFrameActive < g.FrameCount - 1)\n                continue;\n            ImDrawList* draw_list = GetForegroundDrawList(table->OuterWindow);\n            if (cfg->ShowTablesRectsType >= TRT_ColumnsRect)\n            {\n                for (int column_n = 0; column_n < table->ColumnsCount; column_n++)\n                {\n                    ImRect r = Funcs::GetTableRect(table, cfg->ShowTablesRectsType, column_n);\n                    ImU32 col = (table->HoveredColumnBody == column_n) ? IM_COL32(255, 255, 128, 255) : IM_COL32(255, 0, 128, 255);\n                    float thickness = (table->HoveredColumnBody == column_n) ? 3.0f : 1.0f;\n                    draw_list->AddRect(r.Min, r.Max, col, 0.0f, 0, thickness);\n                }\n            }\n            else\n            {\n                ImRect r = Funcs::GetTableRect(table, cfg->ShowTablesRectsType, -1);\n                draw_list->AddRect(r.Min, r.Max, IM_COL32(255, 0, 128, 255));\n            }\n        }\n    }\n\n#ifdef IMGUI_HAS_DOCK\n    // Overlay: Display Docking info\n    if (show_docking_nodes && g.IO.KeyCtrl)\n    {\n    }\n#endif // #ifdef IMGUI_HAS_DOCK\n\n    End();\n}\n\n// [DEBUG] List fonts in a font atlas and display its texture\nvoid ImGui::ShowFontAtlas(ImFontAtlas* atlas)\n{\n    for (int i = 0; i < atlas->Fonts.Size; i++)\n    {\n        ImFont* font = atlas->Fonts[i];\n        PushID(font);\n        DebugNodeFont(font);\n        PopID();\n    }\n    if (TreeNode(\"Atlas texture\", \"Atlas texture (%dx%d pixels)\", atlas->TexWidth, atlas->TexHeight))\n    {\n        ImVec4 tint_col = ImVec4(1.0f, 1.0f, 1.0f, 1.0f);\n        ImVec4 border_col = ImVec4(1.0f, 1.0f, 1.0f, 0.5f);\n        Image(atlas->TexID, ImVec2((float)atlas->TexWidth, (float)atlas->TexHeight), ImVec2(0.0f, 0.0f), ImVec2(1.0f, 1.0f), tint_col, border_col);\n        TreePop();\n    }\n}\n\n// [DEBUG] Display contents of Columns\nvoid ImGui::DebugNodeColumns(ImGuiOldColumns* columns)\n{\n    if (!TreeNode((void*)(uintptr_t)columns->ID, \"Columns Id: 0x%08X, Count: %d, Flags: 0x%04X\", columns->ID, columns->Count, columns->Flags))\n        return;\n    BulletText(\"Width: %.1f (MinX: %.1f, MaxX: %.1f)\", columns->OffMaxX - columns->OffMinX, columns->OffMinX, columns->OffMaxX);\n    for (int column_n = 0; column_n < columns->Columns.Size; column_n++)\n        BulletText(\"Column %02d: OffsetNorm %.3f (= %.1f px)\", column_n, columns->Columns[column_n].OffsetNorm, GetColumnOffsetFromNorm(columns, columns->Columns[column_n].OffsetNorm));\n    TreePop();\n}\n\n// [DEBUG] Display contents of ImDrawList\nvoid ImGui::DebugNodeDrawList(ImGuiWindow* window, const ImDrawList* draw_list, const char* label)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiMetricsConfig* cfg = &g.DebugMetricsConfig;\n    int cmd_count = draw_list->CmdBuffer.Size;\n    if (cmd_count > 0 && draw_list->CmdBuffer.back().ElemCount == 0 && draw_list->CmdBuffer.back().UserCallback == NULL)\n        cmd_count--;\n    bool node_open = TreeNode(draw_list, \"%s: '%s' %d vtx, %d indices, %d cmds\", label, draw_list->_OwnerName ? draw_list->_OwnerName : \"\", draw_list->VtxBuffer.Size, draw_list->IdxBuffer.Size, cmd_count);\n    if (draw_list == GetWindowDrawList())\n    {\n        SameLine();\n        TextColored(ImVec4(1.0f, 0.4f, 0.4f, 1.0f), \"CURRENTLY APPENDING\"); // Can't display stats for active draw list! (we don't have the data double-buffered)\n        if (node_open)\n            TreePop();\n        return;\n    }\n\n    ImDrawList* fg_draw_list = GetForegroundDrawList(window); // Render additional visuals into the top-most draw list\n    if (window && IsItemHovered())\n        fg_draw_list->AddRect(window->Pos, window->Pos + window->Size, IM_COL32(255, 255, 0, 255));\n    if (!node_open)\n        return;\n\n    if (window && !window->WasActive)\n        TextDisabled(\"Warning: owning Window is inactive. This DrawList is not being rendered!\");\n\n    for (const ImDrawCmd* pcmd = draw_list->CmdBuffer.Data; pcmd < draw_list->CmdBuffer.Data + cmd_count; pcmd++)\n    {\n        if (pcmd->UserCallback)\n        {\n            BulletText(\"Callback %p, user_data %p\", pcmd->UserCallback, pcmd->UserCallbackData);\n            continue;\n        }\n\n        char buf[300];\n        ImFormatString(buf, IM_ARRAYSIZE(buf), \"DrawCmd:%5d tris, Tex 0x%p, ClipRect (%4.0f,%4.0f)-(%4.0f,%4.0f)\",\n            pcmd->ElemCount / 3, (void*)(intptr_t)pcmd->TextureId,\n            pcmd->ClipRect.x, pcmd->ClipRect.y, pcmd->ClipRect.z, pcmd->ClipRect.w);\n        bool pcmd_node_open = TreeNode((void*)(pcmd - draw_list->CmdBuffer.begin()), \"%s\", buf);\n        if (IsItemHovered() && (cfg->ShowDrawCmdMesh || cfg->ShowDrawCmdBoundingBoxes) && fg_draw_list)\n            DebugNodeDrawCmdShowMeshAndBoundingBox(fg_draw_list, draw_list, pcmd, cfg->ShowDrawCmdMesh, cfg->ShowDrawCmdBoundingBoxes);\n        if (!pcmd_node_open)\n            continue;\n\n        // Calculate approximate coverage area (touched pixel count)\n        // This will be in pixels squared as long there's no post-scaling happening to the renderer output.\n        const ImDrawIdx* idx_buffer = (draw_list->IdxBuffer.Size > 0) ? draw_list->IdxBuffer.Data : NULL;\n        const ImDrawVert* vtx_buffer = draw_list->VtxBuffer.Data + pcmd->VtxOffset;\n        float total_area = 0.0f;\n        for (unsigned int idx_n = pcmd->IdxOffset; idx_n < pcmd->IdxOffset + pcmd->ElemCount; )\n        {\n            ImVec2 triangle[3];\n            for (int n = 0; n < 3; n++, idx_n++)\n                triangle[n] = vtx_buffer[idx_buffer ? idx_buffer[idx_n] : idx_n].pos;\n            total_area += ImTriangleArea(triangle[0], triangle[1], triangle[2]);\n        }\n\n        // Display vertex information summary. Hover to get all triangles drawn in wire-frame\n        ImFormatString(buf, IM_ARRAYSIZE(buf), \"Mesh: ElemCount: %d, VtxOffset: +%d, IdxOffset: +%d, Area: ~%0.f px\", pcmd->ElemCount, pcmd->VtxOffset, pcmd->IdxOffset, total_area);\n        Selectable(buf);\n        if (IsItemHovered() && fg_draw_list)\n            DebugNodeDrawCmdShowMeshAndBoundingBox(fg_draw_list, draw_list, pcmd, true, false);\n\n        // Display individual triangles/vertices. Hover on to get the corresponding triangle highlighted.\n        ImGuiListClipper clipper;\n        clipper.Begin(pcmd->ElemCount / 3); // Manually coarse clip our print out of individual vertices to save CPU, only items that may be visible.\n        while (clipper.Step())\n            for (int prim = clipper.DisplayStart, idx_i = pcmd->IdxOffset + clipper.DisplayStart * 3; prim < clipper.DisplayEnd; prim++)\n            {\n                char* buf_p = buf, * buf_end = buf + IM_ARRAYSIZE(buf);\n                ImVec2 triangle[3];\n                for (int n = 0; n < 3; n++, idx_i++)\n                {\n                    const ImDrawVert& v = vtx_buffer[idx_buffer ? idx_buffer[idx_i] : idx_i];\n                    triangle[n] = v.pos;\n                    buf_p += ImFormatString(buf_p, buf_end - buf_p, \"%s %04d: pos (%8.2f,%8.2f), uv (%.6f,%.6f), col %08X\\n\",\n                        (n == 0) ? \"Vert:\" : \"     \", idx_i, v.pos.x, v.pos.y, v.uv.x, v.uv.y, v.col);\n                }\n\n                Selectable(buf, false);\n                if (fg_draw_list && IsItemHovered())\n                {\n                    ImDrawListFlags backup_flags = fg_draw_list->Flags;\n                    fg_draw_list->Flags &= ~ImDrawListFlags_AntiAliasedLines; // Disable AA on triangle outlines is more readable for very large and thin triangles.\n                    fg_draw_list->AddPolyline(triangle, 3, IM_COL32(255, 255, 0, 255), ImDrawFlags_Closed, 1.0f);\n                    fg_draw_list->Flags = backup_flags;\n                }\n            }\n        TreePop();\n    }\n    TreePop();\n}\n\n// [DEBUG] Display mesh/aabb of a ImDrawCmd\nvoid ImGui::DebugNodeDrawCmdShowMeshAndBoundingBox(ImDrawList* out_draw_list, const ImDrawList* draw_list, const ImDrawCmd* draw_cmd, bool show_mesh, bool show_aabb)\n{\n    IM_ASSERT(show_mesh || show_aabb);\n\n    // Draw wire-frame version of all triangles\n    ImRect clip_rect = draw_cmd->ClipRect;\n    ImRect vtxs_rect(FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX);\n    ImDrawListFlags backup_flags = out_draw_list->Flags;\n    out_draw_list->Flags &= ~ImDrawListFlags_AntiAliasedLines; // Disable AA on triangle outlines is more readable for very large and thin triangles.\n    for (unsigned int idx_n = draw_cmd->IdxOffset, idx_end = draw_cmd->IdxOffset + draw_cmd->ElemCount; idx_n < idx_end; )\n    {\n        ImDrawIdx* idx_buffer = (draw_list->IdxBuffer.Size > 0) ? draw_list->IdxBuffer.Data : NULL; // We don't hold on those pointers past iterations as ->AddPolyline() may invalidate them if out_draw_list==draw_list\n        ImDrawVert* vtx_buffer = draw_list->VtxBuffer.Data + draw_cmd->VtxOffset;\n\n        ImVec2 triangle[3];\n        for (int n = 0; n < 3; n++, idx_n++)\n            vtxs_rect.Add((triangle[n] = vtx_buffer[idx_buffer ? idx_buffer[idx_n] : idx_n].pos));\n        if (show_mesh)\n            out_draw_list->AddPolyline(triangle, 3, IM_COL32(255, 255, 0, 255), ImDrawFlags_Closed, 1.0f); // In yellow: mesh triangles\n    }\n    // Draw bounding boxes\n    if (show_aabb)\n    {\n        out_draw_list->AddRect(ImFloor(clip_rect.Min), ImFloor(clip_rect.Max), IM_COL32(255, 0, 255, 255)); // In pink: clipping rectangle submitted to GPU\n        out_draw_list->AddRect(ImFloor(vtxs_rect.Min), ImFloor(vtxs_rect.Max), IM_COL32(0, 255, 255, 255)); // In cyan: bounding box of triangles\n    }\n    out_draw_list->Flags = backup_flags;\n}\n\n// [DEBUG] Display details for a single font, called by ShowStyleEditor().\nvoid ImGui::DebugNodeFont(ImFont* font)\n{\n    bool opened = TreeNode(font, \"Font: \\\"%s\\\"\\n%.2f px, %d glyphs, %d file(s)\",\n        font->ConfigData ? font->ConfigData[0].Name : \"\", font->FontSize, font->Glyphs.Size, font->ConfigDataCount);\n    SameLine();\n    if (SmallButton(\"Set as default\"))\n        GetIO().FontDefault = font;\n    if (!opened)\n        return;\n\n    // Display preview text\n    PushFont(font);\n    Text(\"The quick brown fox jumps over the lazy dog\");\n    PopFont();\n\n    // Display details\n    SetNextItemWidth(GetFontSize() * 8);\n    DragFloat(\"Font scale\", &font->Scale, 0.005f, 0.3f, 2.0f, \"%.1f\");\n    SameLine(); MetricsHelpMarker(\n        \"Note than the default embedded font is NOT meant to be scaled.\\n\\n\"\n        \"Font are currently rendered into bitmaps at a given size at the time of building the atlas. \"\n        \"You may oversample them to get some flexibility with scaling. \"\n        \"You can also render at multiple sizes and select which one to use at runtime.\\n\\n\"\n        \"(Glimmer of hope: the atlas system will be rewritten in the future to make scaling more flexible.)\");\n    Text(\"Ascent: %f, Descent: %f, Height: %f\", font->Ascent, font->Descent, font->Ascent - font->Descent);\n    char c_str[5];\n    Text(\"Fallback character: '%s' (U+%04X)\", ImTextCharToUtf8(c_str, font->FallbackChar), font->FallbackChar);\n    Text(\"Ellipsis character: '%s' (U+%04X)\", ImTextCharToUtf8(c_str, font->EllipsisChar), font->EllipsisChar);\n    const int surface_sqrt = (int)ImSqrt((float)font->MetricsTotalSurface);\n    Text(\"Texture Area: about %d px ~%dx%d px\", font->MetricsTotalSurface, surface_sqrt, surface_sqrt);\n    for (int config_i = 0; config_i < font->ConfigDataCount; config_i++)\n        if (font->ConfigData)\n            if (const ImFontConfig* cfg = &font->ConfigData[config_i])\n                BulletText(\"Input %d: \\'%s\\', Oversample: (%d,%d), PixelSnapH: %d, Offset: (%.1f,%.1f)\",\n                    config_i, cfg->Name, cfg->OversampleH, cfg->OversampleV, cfg->PixelSnapH, cfg->GlyphOffset.x, cfg->GlyphOffset.y);\n\n    // Display all glyphs of the fonts in separate pages of 256 characters\n    if (TreeNode(\"Glyphs\", \"Glyphs (%d)\", font->Glyphs.Size))\n    {\n        ImDrawList* draw_list = GetWindowDrawList();\n        const ImU32 glyph_col = GetColorU32(ImGuiCol_Text);\n        const float cell_size = font->FontSize * 1;\n        const float cell_spacing = GetStyle().ItemSpacing.y;\n        for (unsigned int base = 0; base <= IM_UNICODE_CODEPOINT_MAX; base += 256)\n        {\n            // Skip ahead if a large bunch of glyphs are not present in the font (test in chunks of 4k)\n            // This is only a small optimization to reduce the number of iterations when IM_UNICODE_MAX_CODEPOINT\n            // is large // (if ImWchar==ImWchar32 we will do at least about 272 queries here)\n            if (!(base & 4095) && font->IsGlyphRangeUnused(base, base + 4095))\n            {\n                base += 4096 - 256;\n                continue;\n            }\n\n            int count = 0;\n            for (unsigned int n = 0; n < 256; n++)\n                if (font->FindGlyphNoFallback((ImWchar)(base + n)))\n                    count++;\n            if (count <= 0)\n                continue;\n            if (!TreeNode((void*)(intptr_t)base, \"U+%04X..U+%04X (%d %s)\", base, base + 255, count, count > 1 ? \"glyphs\" : \"glyph\"))\n                continue;\n\n            // Draw a 16x16 grid of glyphs\n            ImVec2 base_pos = GetCursorScreenPos();\n            for (unsigned int n = 0; n < 256; n++)\n            {\n                // We use ImFont::RenderChar as a shortcut because we don't have UTF-8 conversion functions\n                // available here and thus cannot easily generate a zero-terminated UTF-8 encoded string.\n                ImVec2 cell_p1(base_pos.x + (n % 16) * (cell_size + cell_spacing), base_pos.y + (n / 16) * (cell_size + cell_spacing));\n                ImVec2 cell_p2(cell_p1.x + cell_size, cell_p1.y + cell_size);\n                const ImFontGlyph* glyph = font->FindGlyphNoFallback((ImWchar)(base + n));\n                draw_list->AddRect(cell_p1, cell_p2, glyph ? IM_COL32(255, 255, 255, 100) : IM_COL32(255, 255, 255, 50));\n                if (glyph)\n                    font->RenderChar(draw_list, cell_size, cell_p1, glyph_col, (ImWchar)(base + n));\n                if (glyph && IsMouseHoveringRect(cell_p1, cell_p2))\n                {\n                    BeginTooltip();\n                    Text(\"Codepoint: U+%04X\", base + n);\n                    Separator();\n                    Text(\"Visible: %d\", glyph->Visible);\n                    Text(\"AdvanceX: %.1f\", glyph->AdvanceX);\n                    Text(\"Pos: (%.2f,%.2f)->(%.2f,%.2f)\", glyph->X0, glyph->Y0, glyph->X1, glyph->Y1);\n                    Text(\"UV: (%.3f,%.3f)->(%.3f,%.3f)\", glyph->U0, glyph->V0, glyph->U1, glyph->V1);\n                    EndTooltip();\n                }\n            }\n            Dummy(ImVec2((cell_size + cell_spacing) * 16, (cell_size + cell_spacing) * 16));\n            TreePop();\n        }\n        TreePop();\n    }\n    TreePop();\n}\n\n// [DEBUG] Display contents of ImGuiStorage\nvoid ImGui::DebugNodeStorage(ImGuiStorage* storage, const char* label)\n{\n    if (!TreeNode(label, \"%s: %d entries, %d bytes\", label, storage->Data.Size, storage->Data.size_in_bytes()))\n        return;\n    for (int n = 0; n < storage->Data.Size; n++)\n    {\n        const ImGuiStorage::ImGuiStoragePair& p = storage->Data[n];\n        BulletText(\"Key 0x%08X Value { i: %d }\", p.key, p.val_i); // Important: we currently don't store a type, real value may not be integer.\n    }\n    TreePop();\n}\n\n// [DEBUG] Display contents of ImGuiTabBar\nvoid ImGui::DebugNodeTabBar(ImGuiTabBar* tab_bar, const char* label)\n{\n    // Standalone tab bars (not associated to docking/windows functionality) currently hold no discernible strings.\n    char buf[256];\n    char* p = buf;\n    const char* buf_end = buf + IM_ARRAYSIZE(buf);\n    const bool is_active = (tab_bar->PrevFrameVisible >= GetFrameCount() - 2);\n    p += ImFormatString(p, buf_end - p, \"%s 0x%08X (%d tabs)%s\", label, tab_bar->ID, tab_bar->Tabs.Size, is_active ? \"\" : \" *Inactive*\");\n    p += ImFormatString(p, buf_end - p, \"  { \");\n    for (int tab_n = 0; tab_n < ImMin(tab_bar->Tabs.Size, 3); tab_n++)\n    {\n        ImGuiTabItem* tab = &tab_bar->Tabs[tab_n];\n        p += ImFormatString(p, buf_end - p, \"%s'%s'\",\n            tab_n > 0 ? \", \" : \"\", (tab->NameOffset != -1) ? tab_bar->GetTabName(tab) : \"???\");\n    }\n    p += ImFormatString(p, buf_end - p, (tab_bar->Tabs.Size > 3) ? \" ... }\" : \" } \");\n    if (!is_active) { PushStyleColor(ImGuiCol_Text, GetStyleColorVec4(ImGuiCol_TextDisabled)); }\n    bool open = TreeNode(label, \"%s\", buf);\n    if (!is_active) { PopStyleColor(); }\n    if (is_active && IsItemHovered())\n    {\n        ImDrawList* draw_list = GetForegroundDrawList();\n        draw_list->AddRect(tab_bar->BarRect.Min, tab_bar->BarRect.Max, IM_COL32(255, 255, 0, 255));\n        draw_list->AddLine(ImVec2(tab_bar->ScrollingRectMinX, tab_bar->BarRect.Min.y), ImVec2(tab_bar->ScrollingRectMinX, tab_bar->BarRect.Max.y), IM_COL32(0, 255, 0, 255));\n        draw_list->AddLine(ImVec2(tab_bar->ScrollingRectMaxX, tab_bar->BarRect.Min.y), ImVec2(tab_bar->ScrollingRectMaxX, tab_bar->BarRect.Max.y), IM_COL32(0, 255, 0, 255));\n    }\n    if (open)\n    {\n        for (int tab_n = 0; tab_n < tab_bar->Tabs.Size; tab_n++)\n        {\n            const ImGuiTabItem* tab = &tab_bar->Tabs[tab_n];\n            PushID(tab);\n            if (SmallButton(\"<\")) { TabBarQueueReorder(tab_bar, tab, -1); } SameLine(0, 2);\n            if (SmallButton(\">\")) { TabBarQueueReorder(tab_bar, tab, +1); } SameLine();\n            Text(\"%02d%c Tab 0x%08X '%s' Offset: %.1f, Width: %.1f/%.1f\",\n                tab_n, (tab->ID == tab_bar->SelectedTabId) ? '*' : ' ', tab->ID, (tab->NameOffset != -1) ? tab_bar->GetTabName(tab) : \"???\", tab->Offset, tab->Width, tab->ContentWidth);\n            PopID();\n        }\n        TreePop();\n    }\n}\n\nvoid ImGui::DebugNodeViewport(ImGuiViewportP* viewport)\n{\n    SetNextItemOpen(true, ImGuiCond_Once);\n    if (TreeNode(\"viewport0\", \"Viewport #%d\", 0))\n    {\n        ImGuiWindowFlags flags = viewport->Flags;\n        BulletText(\"Main Pos: (%.0f,%.0f), Size: (%.0f,%.0f)\\nWorkArea Offset Left: %.0f Top: %.0f, Right: %.0f, Bottom: %.0f\",\n            viewport->Pos.x, viewport->Pos.y, viewport->Size.x, viewport->Size.y,\n            viewport->WorkOffsetMin.x, viewport->WorkOffsetMin.y, viewport->WorkOffsetMax.x, viewport->WorkOffsetMax.y);\n        BulletText(\"Flags: 0x%04X =%s%s%s\", viewport->Flags,\n            (flags & ImGuiViewportFlags_IsPlatformWindow)  ? \" IsPlatformWindow\"  : \"\",\n            (flags & ImGuiViewportFlags_IsPlatformMonitor) ? \" IsPlatformMonitor\" : \"\",\n            (flags & ImGuiViewportFlags_OwnedByApp)        ? \" OwnedByApp\"        : \"\");\n        for (int layer_i = 0; layer_i < IM_ARRAYSIZE(viewport->DrawDataBuilder.Layers); layer_i++)\n            for (int draw_list_i = 0; draw_list_i < viewport->DrawDataBuilder.Layers[layer_i].Size; draw_list_i++)\n                DebugNodeDrawList(NULL, viewport->DrawDataBuilder.Layers[layer_i][draw_list_i], \"DrawList\");\n        TreePop();\n    }\n}\n\nvoid ImGui::DebugNodeWindow(ImGuiWindow* window, const char* label)\n{\n    if (window == NULL)\n    {\n        BulletText(\"%s: NULL\", label);\n        return;\n    }\n\n    ImGuiContext& g = *GImGui;\n    const bool is_active = window->WasActive;\n    ImGuiTreeNodeFlags tree_node_flags = (window == g.NavWindow) ? ImGuiTreeNodeFlags_Selected : ImGuiTreeNodeFlags_None;\n    if (!is_active) { PushStyleColor(ImGuiCol_Text, GetStyleColorVec4(ImGuiCol_TextDisabled)); }\n    const bool open = TreeNodeEx(label, tree_node_flags, \"%s '%s'%s\", label, window->Name, is_active ? \"\" : \" *Inactive*\");\n    if (!is_active) { PopStyleColor(); }\n    if (IsItemHovered() && is_active)\n        GetForegroundDrawList(window)->AddRect(window->Pos, window->Pos + window->Size, IM_COL32(255, 255, 0, 255));\n    if (!open)\n        return;\n\n    if (window->MemoryCompacted)\n        TextDisabled(\"Note: some memory buffers have been compacted/freed.\");\n\n    ImGuiWindowFlags flags = window->Flags;\n    DebugNodeDrawList(window, window->DrawList, \"DrawList\");\n    BulletText(\"Pos: (%.1f,%.1f), Size: (%.1f,%.1f), ContentSize (%.1f,%.1f) Ideal (%.1f,%.1f)\", window->Pos.x, window->Pos.y, window->Size.x, window->Size.y, window->ContentSize.x, window->ContentSize.y, window->ContentSizeIdeal.x, window->ContentSizeIdeal.y);\n    BulletText(\"Flags: 0x%08X (%s%s%s%s%s%s%s%s%s..)\", flags,\n        (flags & ImGuiWindowFlags_ChildWindow)  ? \"Child \" : \"\",      (flags & ImGuiWindowFlags_Tooltip)     ? \"Tooltip \"   : \"\",  (flags & ImGuiWindowFlags_Popup) ? \"Popup \" : \"\",\n        (flags & ImGuiWindowFlags_Modal)        ? \"Modal \" : \"\",      (flags & ImGuiWindowFlags_ChildMenu)   ? \"ChildMenu \" : \"\",  (flags & ImGuiWindowFlags_NoSavedSettings) ? \"NoSavedSettings \" : \"\",\n        (flags & ImGuiWindowFlags_NoMouseInputs)? \"NoMouseInputs\":\"\", (flags & ImGuiWindowFlags_NoNavInputs) ? \"NoNavInputs\" : \"\", (flags & ImGuiWindowFlags_AlwaysAutoResize) ? \"AlwaysAutoResize\" : \"\");\n    BulletText(\"Scroll: (%.2f/%.2f,%.2f/%.2f) Scrollbar:%s%s\", window->Scroll.x, window->ScrollMax.x, window->Scroll.y, window->ScrollMax.y, window->ScrollbarX ? \"X\" : \"\", window->ScrollbarY ? \"Y\" : \"\");\n    BulletText(\"Active: %d/%d, WriteAccessed: %d, BeginOrderWithinContext: %d\", window->Active, window->WasActive, window->WriteAccessed, (window->Active || window->WasActive) ? window->BeginOrderWithinContext : -1);\n    BulletText(\"Appearing: %d, Hidden: %d (CanSkip %d Cannot %d), SkipItems: %d\", window->Appearing, window->Hidden, window->HiddenFramesCanSkipItems, window->HiddenFramesCannotSkipItems, window->SkipItems);\n    for (int layer = 0; layer < ImGuiNavLayer_COUNT; layer++)\n    {\n        ImRect r = window->NavRectRel[layer];\n        if (r.Min.x >= r.Max.y && r.Min.y >= r.Max.y)\n        {\n            BulletText(\"NavLastIds[%d]: 0x%08X\", layer, window->NavLastIds[layer]);\n            continue;\n        }\n        BulletText(\"NavLastIds[%d]: 0x%08X at +(%.1f,%.1f)(%.1f,%.1f)\", layer, window->NavLastIds[layer], r.Min.x, r.Min.y, r.Max.x, r.Max.y);\n        if (IsItemHovered())\n            GetForegroundDrawList(window)->AddRect(r.Min + window->Pos, r.Max + window->Pos, IM_COL32(255, 255, 0, 255));\n    }\n    BulletText(\"NavLayersActiveMask: %X, NavLastChildNavWindow: %s\", window->DC.NavLayersActiveMask, window->NavLastChildNavWindow ? window->NavLastChildNavWindow->Name : \"NULL\");\n    if (window->RootWindow != window)       { DebugNodeWindow(window->RootWindow, \"RootWindow\"); }\n    if (window->ParentWindow != NULL)       { DebugNodeWindow(window->ParentWindow, \"ParentWindow\"); }\n    if (window->DC.ChildWindows.Size > 0)   { DebugNodeWindowsList(&window->DC.ChildWindows, \"ChildWindows\"); }\n    if (window->ColumnsStorage.Size > 0 && TreeNode(\"Columns\", \"Columns sets (%d)\", window->ColumnsStorage.Size))\n    {\n        for (int n = 0; n < window->ColumnsStorage.Size; n++)\n            DebugNodeColumns(&window->ColumnsStorage[n]);\n        TreePop();\n    }\n    DebugNodeStorage(&window->StateStorage, \"Storage\");\n    TreePop();\n}\n\nvoid ImGui::DebugNodeWindowSettings(ImGuiWindowSettings* settings)\n{\n    Text(\"0x%08X \\\"%s\\\" Pos (%d,%d) Size (%d,%d) Collapsed=%d\",\n        settings->ID, settings->GetName(), settings->Pos.x, settings->Pos.y, settings->Size.x, settings->Size.y, settings->Collapsed);\n}\n\nvoid ImGui::DebugNodeWindowsList(ImVector<ImGuiWindow*>* windows, const char* label)\n{\n    if (!TreeNode(label, \"%s (%d)\", label, windows->Size))\n        return;\n    Text(\"(In front-to-back order:)\");\n    for (int i = windows->Size - 1; i >= 0; i--) // Iterate front to back\n    {\n        PushID((*windows)[i]);\n        DebugNodeWindow((*windows)[i], \"Window\");\n        PopID();\n    }\n    TreePop();\n}\n\n#else\n\nvoid ImGui::ShowMetricsWindow(bool*) {}\nvoid ImGui::ShowFontAtlas(ImFontAtlas*) {}\nvoid ImGui::DebugNodeColumns(ImGuiOldColumns*) {}\nvoid ImGui::DebugNodeDrawList(ImGuiWindow*, const ImDrawList*, const char*) {}\nvoid ImGui::DebugNodeDrawCmdShowMeshAndBoundingBox(ImDrawList*, const ImDrawList*, const ImDrawCmd*, bool, bool) {}\nvoid ImGui::DebugNodeFont(ImFont*) {}\nvoid ImGui::DebugNodeStorage(ImGuiStorage*, const char*) {}\nvoid ImGui::DebugNodeTabBar(ImGuiTabBar*, const char*) {}\nvoid ImGui::DebugNodeWindow(ImGuiWindow*, const char*) {}\nvoid ImGui::DebugNodeWindowSettings(ImGuiWindowSettings*) {}\nvoid ImGui::DebugNodeWindowsList(ImVector<ImGuiWindow*>*, const char*) {}\nvoid ImGui::DebugNodeViewport(ImGuiViewportP*) {}\n\n#endif\n\n//-----------------------------------------------------------------------------\n\n// Include imgui_user.inl at the end of imgui.cpp to access private data/functions that aren't exposed.\n// Prefer just including imgui_internal.h from your code rather than using this define. If a declaration is missing from imgui_internal.h add it or request it on the github.\n#ifdef IMGUI_INCLUDE_IMGUI_USER_INL\n#include \"imgui_user.inl\"\n#endif\n\n//-----------------------------------------------------------------------------\n\n#endif // #ifndef IMGUI_DISABLE\n"
  },
  {
    "path": "R3nzSkin/imgui/imgui.h",
    "content": "// dear imgui, v1.84\n// (headers)\n\n// Help:\n// - Read FAQ at http://dearimgui.org/faq\n// - Newcomers, read 'Programmer guide' in imgui.cpp for notes on how to setup Dear ImGui in your codebase.\n// - Call and read ImGui::ShowDemoWindow() in imgui_demo.cpp. All applications in examples/ are doing that.\n// Read imgui.cpp for details, links and comments.\n\n// Resources:\n// - FAQ                   http://dearimgui.org/faq\n// - Homepage & latest     https://github.com/ocornut/imgui\n// - Releases & changelog  https://github.com/ocornut/imgui/releases\n// - Gallery               https://github.com/ocornut/imgui/issues/4451 (please post your screenshots/video there!)\n// - Wiki                  https://github.com/ocornut/imgui/wiki (lots of good stuff there)\n// - Glossary              https://github.com/ocornut/imgui/wiki/Glossary\n// - Issues & support      https://github.com/ocornut/imgui/issues\n// - Discussions           https://github.com/ocornut/imgui/discussions\n\n/*\n\nIndex of this file:\n// [SECTION] Header mess\n// [SECTION] Forward declarations and basic types\n// [SECTION] Dear ImGui end-user API functions\n// [SECTION] Flags & Enumerations\n// [SECTION] Helpers: Memory allocations macros, ImVector<>\n// [SECTION] ImGuiStyle\n// [SECTION] ImGuiIO\n// [SECTION] Misc data structures (ImGuiInputTextCallbackData, ImGuiSizeCallbackData, ImGuiPayload, ImGuiTableSortSpecs, ImGuiTableColumnSortSpecs)\n// [SECTION] Helpers (ImGuiOnceUponAFrame, ImGuiTextFilter, ImGuiTextBuffer, ImGuiStorage, ImGuiListClipper, ImColor)\n// [SECTION] Drawing API (ImDrawCallback, ImDrawCmd, ImDrawIdx, ImDrawVert, ImDrawChannel, ImDrawListSplitter, ImDrawFlags, ImDrawListFlags, ImDrawList, ImDrawData)\n// [SECTION] Font API (ImFontConfig, ImFontGlyph, ImFontGlyphRangesBuilder, ImFontAtlasFlags, ImFontAtlas, ImFont)\n// [SECTION] Viewports (ImGuiViewportFlags, ImGuiViewport)\n// [SECTION] Obsolete functions and types\n\n*/\n\n#pragma once\n\n// Configuration file with compile-time options (edit imconfig.h or '#define IMGUI_USER_CONFIG \"myfilename.h\" from your build system')\n#ifdef IMGUI_USER_CONFIG\n#include IMGUI_USER_CONFIG\n#endif\n#if !defined(IMGUI_DISABLE_INCLUDE_IMCONFIG_H) || defined(IMGUI_INCLUDE_IMCONFIG_H)\n#include \"imconfig.h\"\n#endif\n\n#ifndef IMGUI_DISABLE\n\n//-----------------------------------------------------------------------------\n// [SECTION] Header mess\n//-----------------------------------------------------------------------------\n\n// Includes\n#include <float.h>                  // FLT_MIN, FLT_MAX\n#include <stdarg.h>                 // va_list, va_start, va_end\n#include <stddef.h>                 // ptrdiff_t, NULL\n#include <string.h>                 // memset, memmove, memcpy, strlen, strchr, strcpy, strcmp\n\n// Version\n// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)\n#define IMGUI_VERSION               \"1.84.2\"\n#define IMGUI_VERSION_NUM           18405\n#define IMGUI_CHECKVERSION()        ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))\n#define IMGUI_HAS_TABLE\n\n// Define attributes of all API symbols declarations (e.g. for DLL under Windows)\n// IMGUI_API is used for core imgui functions, IMGUI_IMPL_API is used for the default backends files (imgui_impl_xxx.h)\n// Using dear imgui via a shared library is not recommended, because we don't guarantee backward nor forward ABI compatibility (also function call overhead, as dear imgui is a call-heavy API)\n#ifndef IMGUI_API\n#define IMGUI_API\n#endif\n#ifndef IMGUI_IMPL_API\n#define IMGUI_IMPL_API              IMGUI_API\n#endif\n\n// Helper Macros\n#ifndef IM_ASSERT\n#include <assert.h>\n#define IM_ASSERT(_EXPR)            assert(_EXPR)                               // You can override the default assert handler by editing imconfig.h\n#endif\n#define IM_ARRAYSIZE(_ARR)          ((int)(sizeof(_ARR) / sizeof(*(_ARR))))     // Size of a static C-style array. Don't use on pointers!\n#define IM_UNUSED(_VAR)             ((void)(_VAR))                              // Used to silence \"unused variable warnings\". Often useful as asserts may be stripped out from final builds.\n#if (__cplusplus >= 201100) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201100)\n#define IM_OFFSETOF(_TYPE,_MEMBER)  offsetof(_TYPE, _MEMBER)                    // Offset of _MEMBER within _TYPE. Standardized as offsetof() in C++11\n#else\n#define IM_OFFSETOF(_TYPE,_MEMBER)  ((size_t)&(((_TYPE*)0)->_MEMBER))           // Offset of _MEMBER within _TYPE. Old style macro.\n#endif\n\n// Helper Macros - IM_FMTARGS, IM_FMTLIST: Apply printf-style warnings to our formatting functions.\n#if !defined(IMGUI_USE_STB_SPRINTF) && defined(__MINGW32__)\n#define IM_FMTARGS(FMT)             __attribute__((format(gnu_printf, FMT, FMT+1)))\n#define IM_FMTLIST(FMT)             __attribute__((format(gnu_printf, FMT, 0)))\n#elif !defined(IMGUI_USE_STB_SPRINTF) && (defined(__clang__) || defined(__GNUC__))\n#define IM_FMTARGS(FMT)             __attribute__((format(printf, FMT, FMT+1)))\n#define IM_FMTLIST(FMT)             __attribute__((format(printf, FMT, 0)))\n#else\n#define IM_FMTARGS(FMT)\n#define IM_FMTLIST(FMT)\n#endif\n\n// Disable some of MSVC most aggressive Debug runtime checks in function header/footer (used in some simple/low-level functions)\n#if defined(_MSC_VER) && !defined(__clang__) && !defined(IMGUI_DEBUG_PARANOID)\n#define IM_MSVC_RUNTIME_CHECKS_OFF      __pragma(runtime_checks(\"\",off))     __pragma(check_stack(off)) __pragma(strict_gs_check(push,off))\n#define IM_MSVC_RUNTIME_CHECKS_RESTORE  __pragma(runtime_checks(\"\",restore)) __pragma(check_stack())    __pragma(strict_gs_check(pop))\n#else\n#define IM_MSVC_RUNTIME_CHECKS_OFF\n#define IM_MSVC_RUNTIME_CHECKS_RESTORE\n#endif\n\n// Warnings\n#ifdef _MSC_VER\n#pragma warning (push)\n#pragma warning (disable: 26495)    // [Static Analyzer] Variable 'XXX' is uninitialized. Always initialize a member variable (type.6).\n#endif\n#if defined(__clang__)\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wold-style-cast\"\n#if __has_warning(\"-Wzero-as-null-pointer-constant\")\n#pragma clang diagnostic ignored \"-Wzero-as-null-pointer-constant\"\n#endif\n#elif defined(__GNUC__)\n#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored \"-Wpragmas\"          // warning: unknown option after '#pragma GCC diagnostic' kind\n#pragma GCC diagnostic ignored \"-Wclass-memaccess\"  // [__GNUC__ >= 8] warning: 'memset/memcpy' clearing/writing an object of type 'xxxx' with no trivial copy-assignment; use assignment or value-initialization instead\n#endif\n\n//-----------------------------------------------------------------------------\n// [SECTION] Forward declarations and basic types\n//-----------------------------------------------------------------------------\n\n// Forward declarations\nstruct ImDrawChannel;               // Temporary storage to output draw commands out of order, used by ImDrawListSplitter and ImDrawList::ChannelsSplit()\nstruct ImDrawCmd;                   // A single draw command within a parent ImDrawList (generally maps to 1 GPU draw call, unless it is a callback)\nstruct ImDrawData;                  // All draw command lists required to render the frame + pos/size coordinates to use for the projection matrix.\nstruct ImDrawList;                  // A single draw command list (generally one per window, conceptually you may see this as a dynamic \"mesh\" builder)\nstruct ImDrawListSharedData;        // Data shared among multiple draw lists (typically owned by parent ImGui context, but you may create one yourself)\nstruct ImDrawListSplitter;          // Helper to split a draw list into different layers which can be drawn into out of order, then flattened back.\nstruct ImDrawVert;                  // A single vertex (pos + uv + col = 20 bytes by default. Override layout with IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT)\nstruct ImFont;                      // Runtime data for a single font within a parent ImFontAtlas\nstruct ImFontAtlas;                 // Runtime data for multiple fonts, bake multiple fonts into a single texture, TTF/OTF font loader\nstruct ImFontBuilderIO;             // Opaque interface to a font builder (stb_truetype or FreeType).\nstruct ImFontConfig;                // Configuration data when adding a font or merging fonts\nstruct ImFontGlyph;                 // A single font glyph (code point + coordinates within in ImFontAtlas + offset)\nstruct ImFontGlyphRangesBuilder;    // Helper to build glyph ranges from text/string data\nstruct ImColor;                     // Helper functions to create a color that can be converted to either u32 or float4 (*OBSOLETE* please avoid using)\nstruct ImGuiContext;                // Dear ImGui context (opaque structure, unless including imgui_internal.h)\nstruct ImGuiIO;                     // Main configuration and I/O between your application and ImGui\nstruct ImGuiInputTextCallbackData;  // Shared state of InputText() when using custom ImGuiInputTextCallback (rare/advanced use)\nstruct ImGuiListClipper;            // Helper to manually clip large list of items\nstruct ImGuiOnceUponAFrame;         // Helper for running a block of code not more than once a frame, used by IMGUI_ONCE_UPON_A_FRAME macro\nstruct ImGuiPayload;                // User data payload for drag and drop operations\nstruct ImGuiSizeCallbackData;       // Callback data when using SetNextWindowSizeConstraints() (rare/advanced use)\nstruct ImGuiStorage;                // Helper for key->value storage\nstruct ImGuiStyle;                  // Runtime data for styling/colors\nstruct ImGuiTableSortSpecs;         // Sorting specifications for a table (often handling sort specs for a single column, occasionally more)\nstruct ImGuiTableColumnSortSpecs;   // Sorting specification for one column of a table\nstruct ImGuiTextBuffer;             // Helper to hold and append into a text buffer (~string builder)\nstruct ImGuiTextFilter;             // Helper to parse and apply text filters (e.g. \"aaaaa[,bbbbb][,ccccc]\")\nstruct ImGuiViewport;               // A Platform Window (always only one in 'master' branch), in the future may represent Platform Monitor\n\n// Enums/Flags (declared as int for compatibility with old C++, to allow using as flags without overhead, and to not pollute the top of this file)\n// - Tip: Use your programming IDE navigation facilities on the names in the _central column_ below to find the actual flags/enum lists!\n//   In Visual Studio IDE: CTRL+comma (\"Edit.NavigateTo\") can follow symbols in comments, whereas CTRL+F12 (\"Edit.GoToImplementation\") cannot.\n//   With Visual Assist installed: ALT+G (\"VAssistX.GoToImplementation\") can also follow symbols in comments.\ntypedef int ImGuiCol;               // -> enum ImGuiCol_             // Enum: A color identifier for styling\ntypedef int ImGuiCond;              // -> enum ImGuiCond_            // Enum: A condition for many Set*() functions\ntypedef int ImGuiDataType;          // -> enum ImGuiDataType_        // Enum: A primary data type\ntypedef int ImGuiDir;               // -> enum ImGuiDir_             // Enum: A cardinal direction\ntypedef int ImGuiKey;               // -> enum ImGuiKey_             // Enum: A key identifier (ImGui-side enum)\ntypedef int ImGuiNavInput;          // -> enum ImGuiNavInput_        // Enum: An input identifier for navigation\ntypedef int ImGuiMouseButton;       // -> enum ImGuiMouseButton_     // Enum: A mouse button identifier (0=left, 1=right, 2=middle)\ntypedef int ImGuiMouseCursor;       // -> enum ImGuiMouseCursor_     // Enum: A mouse cursor identifier\ntypedef int ImGuiSortDirection;     // -> enum ImGuiSortDirection_   // Enum: A sorting direction (ascending or descending)\ntypedef int ImGuiStyleVar;          // -> enum ImGuiStyleVar_        // Enum: A variable identifier for styling\ntypedef int ImGuiTableBgTarget;     // -> enum ImGuiTableBgTarget_   // Enum: A color target for TableSetBgColor()\ntypedef int ImDrawFlags;            // -> enum ImDrawFlags_          // Flags: for ImDrawList functions\ntypedef int ImDrawListFlags;        // -> enum ImDrawListFlags_      // Flags: for ImDrawList instance\ntypedef int ImFontAtlasFlags;       // -> enum ImFontAtlasFlags_     // Flags: for ImFontAtlas build\ntypedef int ImGuiBackendFlags;      // -> enum ImGuiBackendFlags_    // Flags: for io.BackendFlags\ntypedef int ImGuiButtonFlags;       // -> enum ImGuiButtonFlags_     // Flags: for InvisibleButton()\ntypedef int ImGuiColorEditFlags;    // -> enum ImGuiColorEditFlags_  // Flags: for ColorEdit4(), ColorPicker4() etc.\ntypedef int ImGuiConfigFlags;       // -> enum ImGuiConfigFlags_     // Flags: for io.ConfigFlags\ntypedef int ImGuiComboFlags;        // -> enum ImGuiComboFlags_      // Flags: for BeginCombo()\ntypedef int ImGuiDragDropFlags;     // -> enum ImGuiDragDropFlags_   // Flags: for BeginDragDropSource(), AcceptDragDropPayload()\ntypedef int ImGuiFocusedFlags;      // -> enum ImGuiFocusedFlags_    // Flags: for IsWindowFocused()\ntypedef int ImGuiHoveredFlags;      // -> enum ImGuiHoveredFlags_    // Flags: for IsItemHovered(), IsWindowHovered() etc.\ntypedef int ImGuiInputTextFlags;    // -> enum ImGuiInputTextFlags_  // Flags: for InputText(), InputTextMultiline()\ntypedef int ImGuiKeyModFlags;       // -> enum ImGuiKeyModFlags_     // Flags: for io.KeyMods (Ctrl/Shift/Alt/Super)\ntypedef int ImGuiPopupFlags;        // -> enum ImGuiPopupFlags_      // Flags: for OpenPopup*(), BeginPopupContext*(), IsPopupOpen()\ntypedef int ImGuiSelectableFlags;   // -> enum ImGuiSelectableFlags_ // Flags: for Selectable()\ntypedef int ImGuiSliderFlags;       // -> enum ImGuiSliderFlags_     // Flags: for DragFloat(), DragInt(), SliderFloat(), SliderInt() etc.\ntypedef int ImGuiTabBarFlags;       // -> enum ImGuiTabBarFlags_     // Flags: for BeginTabBar()\ntypedef int ImGuiTabItemFlags;      // -> enum ImGuiTabItemFlags_    // Flags: for BeginTabItem()\ntypedef int ImGuiTableFlags;        // -> enum ImGuiTableFlags_      // Flags: For BeginTable()\ntypedef int ImGuiTableColumnFlags;  // -> enum ImGuiTableColumnFlags_// Flags: For TableSetupColumn()\ntypedef int ImGuiTableRowFlags;     // -> enum ImGuiTableRowFlags_   // Flags: For TableNextRow()\ntypedef int ImGuiTreeNodeFlags;     // -> enum ImGuiTreeNodeFlags_   // Flags: for TreeNode(), TreeNodeEx(), CollapsingHeader()\ntypedef int ImGuiViewportFlags;     // -> enum ImGuiViewportFlags_   // Flags: for ImGuiViewport\ntypedef int ImGuiWindowFlags;       // -> enum ImGuiWindowFlags_     // Flags: for Begin(), BeginChild()\n\n// ImTexture: user data for renderer backend to identify a texture [Compile-time configurable type]\n// - To use something else than an opaque void* pointer: override with e.g. '#define ImTextureID MyTextureType*' in your imconfig.h file.\n// - This can be whatever to you want it to be! read the FAQ about ImTextureID for details.\n#ifndef ImTextureID\ntypedef void* ImTextureID;          // Default: store a pointer or an integer fitting in a pointer (most renderer backends are ok with that)\n#endif\n\n// ImDrawIdx: vertex index. [Compile-time configurable type]\n// - To use 16-bit indices + allow large meshes: backend need to set 'io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset' and handle ImDrawCmd::VtxOffset (recommended).\n// - To use 32-bit indices: override with '#define ImDrawIdx unsigned int' in your imconfig.h file.\n#ifndef ImDrawIdx\ntypedef unsigned short ImDrawIdx;   // Default: 16-bit (for maximum compatibility with renderer backends)\n#endif\n\n// Scalar data types\ntypedef unsigned int        ImGuiID;// A unique ID used by widgets (typically the result of hashing a stack of string)\ntypedef signed char         ImS8;   // 8-bit signed integer\ntypedef unsigned char       ImU8;   // 8-bit unsigned integer\ntypedef signed short        ImS16;  // 16-bit signed integer\ntypedef unsigned short      ImU16;  // 16-bit unsigned integer\ntypedef signed int          ImS32;  // 32-bit signed integer == int\ntypedef unsigned int        ImU32;  // 32-bit unsigned integer (often used to store packed colors)\n#if defined(_MSC_VER) && !defined(__clang__)\ntypedef signed   __int64    ImS64;  // 64-bit signed integer (pre and post C++11 with Visual Studio)\ntypedef unsigned __int64    ImU64;  // 64-bit unsigned integer (pre and post C++11 with Visual Studio)\n#elif (defined(__clang__) || defined(__GNUC__)) && (__cplusplus < 201100)\n#include <stdint.h>\ntypedef int64_t             ImS64;  // 64-bit signed integer (pre C++11)\ntypedef uint64_t            ImU64;  // 64-bit unsigned integer (pre C++11)\n#else\ntypedef signed   long long  ImS64;  // 64-bit signed integer (post C++11)\ntypedef unsigned long long  ImU64;  // 64-bit unsigned integer (post C++11)\n#endif\n\n// Character types\n// (we generally use UTF-8 encoded string in the API. This is storage specifically for a decoded character used for keyboard input and display)\ntypedef unsigned short ImWchar16;   // A single decoded U16 character/code point. We encode them as multi bytes UTF-8 when used in strings.\ntypedef unsigned int ImWchar32;     // A single decoded U32 character/code point. We encode them as multi bytes UTF-8 when used in strings.\n#ifdef IMGUI_USE_WCHAR32            // ImWchar [configurable type: override in imconfig.h with '#define IMGUI_USE_WCHAR32' to support Unicode planes 1-16]\ntypedef ImWchar32 ImWchar;\n#else\ntypedef ImWchar16 ImWchar;\n#endif\n\n// Callback and functions types\ntypedef int     (*ImGuiInputTextCallback)(ImGuiInputTextCallbackData* data);    // Callback function for ImGui::InputText()\ntypedef void    (*ImGuiSizeCallback)(ImGuiSizeCallbackData* data);              // Callback function for ImGui::SetNextWindowSizeConstraints()\ntypedef void*   (*ImGuiMemAllocFunc)(size_t sz, void* user_data);               // Function signature for ImGui::SetAllocatorFunctions()\ntypedef void    (*ImGuiMemFreeFunc)(void* ptr, void* user_data);                // Function signature for ImGui::SetAllocatorFunctions()\n\n// ImVec2: 2D vector used to store positions, sizes etc. [Compile-time configurable type]\n// This is a frequently used type in the API. Consider using IM_VEC2_CLASS_EXTRA to create implicit cast from/to our preferred type.\nIM_MSVC_RUNTIME_CHECKS_OFF\nstruct ImVec2\n{\n    float                                   x, y;\n    ImVec2()                                { x = y = 0.0f; }\n    ImVec2(float _x, float _y)              { x = _x; y = _y; }\n    float  operator[] (size_t idx) const    { IM_ASSERT(idx <= 1); return (&x)[idx]; }    // We very rarely use this [] operator, the assert overhead is fine.\n    float& operator[] (size_t idx)          { IM_ASSERT(idx <= 1); return (&x)[idx]; }    // We very rarely use this [] operator, the assert overhead is fine.\n#ifdef IM_VEC2_CLASS_EXTRA\n    IM_VEC2_CLASS_EXTRA     // Define additional constructors and implicit cast operators in imconfig.h to convert back and forth between your math types and ImVec2.\n#endif\n};\n\n// ImVec4: 4D vector used to store clipping rectangles, colors etc. [Compile-time configurable type]\nstruct ImVec4\n{\n    float                                           x, y, z, w;\n    ImVec4()                                        { x = y = z = w = 0.0f; }\n    ImVec4(float _x, float _y, float _z, float _w)  { x = _x; y = _y; z = _z; w = _w; }\n#ifdef IM_VEC4_CLASS_EXTRA\n    IM_VEC4_CLASS_EXTRA     // Define additional constructors and implicit cast operators in imconfig.h to convert back and forth between your math types and ImVec4.\n#endif\n};\nIM_MSVC_RUNTIME_CHECKS_RESTORE\n\n//-----------------------------------------------------------------------------\n// [SECTION] Dear ImGui end-user API functions\n// (Note that ImGui:: being a namespace, you can add extra ImGui:: functions in your own separate file. Please don't modify imgui source files!)\n//-----------------------------------------------------------------------------\n\nnamespace ImGui\n{\n    // Context creation and access\n    // - Each context create its own ImFontAtlas by default. You may instance one yourself and pass it to CreateContext() to share a font atlas between contexts.\n    // - DLL users: heaps and globals are not shared across DLL boundaries! You will need to call SetCurrentContext() + SetAllocatorFunctions()\n    //   for each static/DLL boundary you are calling from. Read \"Context and Memory Allocators\" section of imgui.cpp for details.\n    IMGUI_API ImGuiContext* CreateContext(ImFontAtlas* shared_font_atlas = NULL);\n    IMGUI_API void          DestroyContext(ImGuiContext* ctx = NULL);   // NULL = destroy current context\n    IMGUI_API ImGuiContext* GetCurrentContext();\n    IMGUI_API void          SetCurrentContext(ImGuiContext* ctx);\n\n    // Main\n    IMGUI_API ImGuiIO&      GetIO();                                    // access the IO structure (mouse/keyboard/gamepad inputs, time, various configuration options/flags)\n    IMGUI_API ImGuiStyle&   GetStyle();                                 // access the Style structure (colors, sizes). Always use PushStyleCol(), PushStyleVar() to modify style mid-frame!\n    IMGUI_API void          NewFrame();                                 // start a new Dear ImGui frame, you can submit any command from this point until Render()/EndFrame().\n    IMGUI_API void          EndFrame();                                 // ends the Dear ImGui frame. automatically called by Render(). If you don't need to render data (skipping rendering) you may call EndFrame() without Render()... but you'll have wasted CPU already! If you don't need to render, better to not create any windows and not call NewFrame() at all!\n    IMGUI_API void          Render();                                   // ends the Dear ImGui frame, finalize the draw data. You can then get call GetDrawData().\n    IMGUI_API ImDrawData*   GetDrawData();                              // valid after Render() and until the next call to NewFrame(). this is what you have to render.\n\n    // Demo, Debug, Information\n    IMGUI_API void          ShowDemoWindow(bool* p_open = NULL);        // create Demo window. demonstrate most ImGui features. call this to learn about the library! try to make it always available in your application!\n    IMGUI_API void          ShowMetricsWindow(bool* p_open = NULL);     // create Metrics/Debugger window. display Dear ImGui internals: windows, draw commands, various internal state, etc.\n    IMGUI_API void          ShowAboutWindow(bool* p_open = NULL);       // create About window. display Dear ImGui version, credits and build/system information.\n    IMGUI_API void          ShowStyleEditor(ImGuiStyle* ref = NULL);    // add style editor block (not a window). you can pass in a reference ImGuiStyle structure to compare to, revert to and save to (else it uses the default style)\n    IMGUI_API bool          ShowStyleSelector(const char* label);       // add style selector block (not a window), essentially a combo listing the default styles.\n    IMGUI_API void          ShowFontSelector(const char* label);        // add font selector block (not a window), essentially a combo listing the loaded fonts.\n    IMGUI_API void          ShowUserGuide();                            // add basic help/info block (not a window): how to manipulate ImGui as a end-user (mouse/keyboard controls).\n    IMGUI_API const char*   GetVersion();                               // get the compiled version string e.g. \"1.80 WIP\" (essentially the value for IMGUI_VERSION from the compiled version of imgui.cpp)\n\n    // Styles\n    IMGUI_API void          StyleColorsDark(ImGuiStyle* dst = NULL);    // new, recommended style (default)\n    IMGUI_API void          StyleColorsLight(ImGuiStyle* dst = NULL);   // best used with borders and a custom, thicker font\n    IMGUI_API void          StyleColorsClassic(ImGuiStyle* dst = NULL); // classic imgui style\n\n    // Windows\n    // - Begin() = push window to the stack and start appending to it. End() = pop window from the stack.\n    // - Passing 'bool* p_open != NULL' shows a window-closing widget in the upper-right corner of the window,\n    //   which clicking will set the boolean to false when clicked.\n    // - You may append multiple times to the same window during the same frame by calling Begin()/End() pairs multiple times.\n    //   Some information such as 'flags' or 'p_open' will only be considered by the first call to Begin().\n    // - Begin() return false to indicate the window is collapsed or fully clipped, so you may early out and omit submitting\n    //   anything to the window. Always call a matching End() for each Begin() call, regardless of its return value!\n    //   [Important: due to legacy reason, this is inconsistent with most other functions such as BeginMenu/EndMenu,\n    //    BeginPopup/EndPopup, etc. where the EndXXX call should only be called if the corresponding BeginXXX function\n    //    returned true. Begin and BeginChild are the only odd ones out. Will be fixed in a future update.]\n    // - Note that the bottom of window stack always contains a window called \"Debug\".\n    IMGUI_API bool          Begin(const char* name, bool* p_open = NULL, ImGuiWindowFlags flags = 0);\n    IMGUI_API void          End();\n\n    // Child Windows\n    // - Use child windows to begin into a self-contained independent scrolling/clipping regions within a host window. Child windows can embed their own child.\n    // - For each independent axis of 'size': ==0.0f: use remaining host window size / >0.0f: fixed size / <0.0f: use remaining window size minus abs(size) / Each axis can use a different mode, e.g. ImVec2(0,400).\n    // - BeginChild() returns false to indicate the window is collapsed or fully clipped, so you may early out and omit submitting anything to the window.\n    //   Always call a matching EndChild() for each BeginChild() call, regardless of its return value.\n    //   [Important: due to legacy reason, this is inconsistent with most other functions such as BeginMenu/EndMenu,\n    //    BeginPopup/EndPopup, etc. where the EndXXX call should only be called if the corresponding BeginXXX function\n    //    returned true. Begin and BeginChild are the only odd ones out. Will be fixed in a future update.]\n    IMGUI_API bool          BeginChild(const char* str_id, const ImVec2& size = ImVec2(0, 0), bool border = false, ImGuiWindowFlags flags = 0);\n    IMGUI_API bool          BeginChild(ImGuiID id, const ImVec2& size = ImVec2(0, 0), bool border = false, ImGuiWindowFlags flags = 0);\n    IMGUI_API void          EndChild();\n\n    // Windows Utilities\n    // - 'current window' = the window we are appending into while inside a Begin()/End() block. 'next window' = next window we will Begin() into.\n    IMGUI_API bool          IsWindowAppearing();\n    IMGUI_API bool          IsWindowCollapsed();\n    IMGUI_API bool          IsWindowFocused(ImGuiFocusedFlags flags=0); // is current window focused? or its root/child, depending on flags. see flags for options.\n    IMGUI_API bool          IsWindowHovered(ImGuiHoveredFlags flags=0); // is current window hovered (and typically: not blocked by a popup/modal)? see flags for options. NB: If you are trying to check whether your mouse should be dispatched to imgui or to your app, you should use the 'io.WantCaptureMouse' boolean for that! Please read the FAQ!\n    IMGUI_API ImDrawList*   GetWindowDrawList();                        // get draw list associated to the current window, to append your own drawing primitives\n    IMGUI_API ImVec2        GetWindowPos();                             // get current window position in screen space (useful if you want to do your own drawing via the DrawList API)\n    IMGUI_API ImVec2        GetWindowSize();                            // get current window size\n    IMGUI_API float         GetWindowWidth();                           // get current window width (shortcut for GetWindowSize().x)\n    IMGUI_API float         GetWindowHeight();                          // get current window height (shortcut for GetWindowSize().y)\n\n    // Window manipulation\n    // - Prefer using SetNextXXX functions (before Begin) rather that SetXXX functions (after Begin).\n    IMGUI_API void          SetNextWindowPos(const ImVec2& pos, ImGuiCond cond = 0, const ImVec2& pivot = ImVec2(0, 0)); // set next window position. call before Begin(). use pivot=(0.5f,0.5f) to center on given point, etc.\n    IMGUI_API void          SetNextWindowSize(const ImVec2& size, ImGuiCond cond = 0);                  // set next window size. set axis to 0.0f to force an auto-fit on this axis. call before Begin()\n    IMGUI_API void          SetNextWindowSizeConstraints(const ImVec2& size_min, const ImVec2& size_max, ImGuiSizeCallback custom_callback = NULL, void* custom_callback_data = NULL); // set next window size limits. use -1,-1 on either X/Y axis to preserve the current size. Sizes will be rounded down. Use callback to apply non-trivial programmatic constraints.\n    IMGUI_API void          SetNextWindowContentSize(const ImVec2& size);                               // set next window content size (~ scrollable client area, which enforce the range of scrollbars). Not including window decorations (title bar, menu bar, etc.) nor WindowPadding. set an axis to 0.0f to leave it automatic. call before Begin()\n    IMGUI_API void          SetNextWindowCollapsed(bool collapsed, ImGuiCond cond = 0);                 // set next window collapsed state. call before Begin()\n    IMGUI_API void          SetNextWindowFocus();                                                       // set next window to be focused / top-most. call before Begin()\n    IMGUI_API void          SetNextWindowBgAlpha(float alpha);                                          // set next window background color alpha. helper to easily override the Alpha component of ImGuiCol_WindowBg/ChildBg/PopupBg. you may also use ImGuiWindowFlags_NoBackground.\n    IMGUI_API void          SetWindowPos(const ImVec2& pos, ImGuiCond cond = 0);                        // (not recommended) set current window position - call within Begin()/End(). prefer using SetNextWindowPos(), as this may incur tearing and side-effects.\n    IMGUI_API void          SetWindowSize(const ImVec2& size, ImGuiCond cond = 0);                      // (not recommended) set current window size - call within Begin()/End(). set to ImVec2(0, 0) to force an auto-fit. prefer using SetNextWindowSize(), as this may incur tearing and minor side-effects.\n    IMGUI_API void          SetWindowCollapsed(bool collapsed, ImGuiCond cond = 0);                     // (not recommended) set current window collapsed state. prefer using SetNextWindowCollapsed().\n    IMGUI_API void          SetWindowFocus();                                                           // (not recommended) set current window to be focused / top-most. prefer using SetNextWindowFocus().\n    IMGUI_API void          SetWindowFontScale(float scale);                                            // [OBSOLETE] set font scale. Adjust IO.FontGlobalScale if you want to scale all windows. This is an old API! For correct scaling, prefer to reload font + rebuild ImFontAtlas + call style.ScaleAllSizes().\n    IMGUI_API void          SetWindowPos(const char* name, const ImVec2& pos, ImGuiCond cond = 0);      // set named window position.\n    IMGUI_API void          SetWindowSize(const char* name, const ImVec2& size, ImGuiCond cond = 0);    // set named window size. set axis to 0.0f to force an auto-fit on this axis.\n    IMGUI_API void          SetWindowCollapsed(const char* name, bool collapsed, ImGuiCond cond = 0);   // set named window collapsed state\n    IMGUI_API void          SetWindowFocus(const char* name);                                           // set named window to be focused / top-most. use NULL to remove focus.\n\n    // Content region\n    // - Retrieve available space from a given point. GetContentRegionAvail() is frequently useful.\n    // - Those functions are bound to be redesigned (they are confusing, incomplete and the Min/Max return values are in local window coordinates which increases confusion)\n    IMGUI_API ImVec2        GetContentRegionAvail();                                        // == GetContentRegionMax() - GetCursorPos()\n    IMGUI_API ImVec2        GetContentRegionMax();                                          // current content boundaries (typically window boundaries including scrolling, or current column boundaries), in windows coordinates\n    IMGUI_API ImVec2        GetWindowContentRegionMin();                                    // content boundaries min (roughly (0,0)-Scroll), in window coordinates\n    IMGUI_API ImVec2        GetWindowContentRegionMax();                                    // content boundaries max (roughly (0,0)+Size-Scroll) where Size can be override with SetNextWindowContentSize(), in window coordinates\n    IMGUI_API float         GetWindowContentRegionWidth();                                  //\n\n    // Windows Scrolling\n    IMGUI_API float         GetScrollX();                                                   // get scrolling amount [0 .. GetScrollMaxX()]\n    IMGUI_API float         GetScrollY();                                                   // get scrolling amount [0 .. GetScrollMaxY()]\n    IMGUI_API void          SetScrollX(float scroll_x);                                     // set scrolling amount [0 .. GetScrollMaxX()]\n    IMGUI_API void          SetScrollY(float scroll_y);                                     // set scrolling amount [0 .. GetScrollMaxY()]\n    IMGUI_API float         GetScrollMaxX();                                                // get maximum scrolling amount ~~ ContentSize.x - WindowSize.x - DecorationsSize.x\n    IMGUI_API float         GetScrollMaxY();                                                // get maximum scrolling amount ~~ ContentSize.y - WindowSize.y - DecorationsSize.y\n    IMGUI_API void          SetScrollHereX(float center_x_ratio = 0.5f);                    // adjust scrolling amount to make current cursor position visible. center_x_ratio=0.0: left, 0.5: center, 1.0: right. When using to make a \"default/current item\" visible, consider using SetItemDefaultFocus() instead.\n    IMGUI_API void          SetScrollHereY(float center_y_ratio = 0.5f);                    // adjust scrolling amount to make current cursor position visible. center_y_ratio=0.0: top, 0.5: center, 1.0: bottom. When using to make a \"default/current item\" visible, consider using SetItemDefaultFocus() instead.\n    IMGUI_API void          SetScrollFromPosX(float local_x, float center_x_ratio = 0.5f);  // adjust scrolling amount to make given position visible. Generally GetCursorStartPos() + offset to compute a valid position.\n    IMGUI_API void          SetScrollFromPosY(float local_y, float center_y_ratio = 0.5f);  // adjust scrolling amount to make given position visible. Generally GetCursorStartPos() + offset to compute a valid position.\n\n    // Parameters stacks (shared)\n    IMGUI_API void          PushFont(ImFont* font);                                         // use NULL as a shortcut to push default font\n    IMGUI_API void          PopFont();\n    IMGUI_API void          PushStyleColor(ImGuiCol idx, ImU32 col);                        // modify a style color. always use this if you modify the style after NewFrame().\n    IMGUI_API void          PushStyleColor(ImGuiCol idx, const ImVec4& col);\n    IMGUI_API void          PopStyleColor(int count = 1);\n    IMGUI_API void          PushStyleVar(ImGuiStyleVar idx, float val);                     // modify a style float variable. always use this if you modify the style after NewFrame().\n    IMGUI_API void          PushStyleVar(ImGuiStyleVar idx, const ImVec2& val);             // modify a style ImVec2 variable. always use this if you modify the style after NewFrame().\n    IMGUI_API void          PopStyleVar(int count = 1);\n    IMGUI_API void          PushAllowKeyboardFocus(bool allow_keyboard_focus);              // == tab stop enable. Allow focusing using TAB/Shift-TAB, enabled by default but you can disable it for certain widgets\n    IMGUI_API void          PopAllowKeyboardFocus();\n    IMGUI_API void          PushButtonRepeat(bool repeat);                                  // in 'repeat' mode, Button*() functions return repeated true in a typematic manner (using io.KeyRepeatDelay/io.KeyRepeatRate setting). Note that you can call IsItemActive() after any Button() to tell if the button is held in the current frame.\n    IMGUI_API void          PopButtonRepeat();\n\n    // Parameters stacks (current window)\n    IMGUI_API void          PushItemWidth(float item_width);                                // push width of items for common large \"item+label\" widgets. >0.0f: width in pixels, <0.0f align xx pixels to the right of window (so -FLT_MIN always align width to the right side).\n    IMGUI_API void          PopItemWidth();\n    IMGUI_API void          SetNextItemWidth(float item_width);                             // set width of the _next_ common large \"item+label\" widget. >0.0f: width in pixels, <0.0f align xx pixels to the right of window (so -FLT_MIN always align width to the right side)\n    IMGUI_API float         CalcItemWidth();                                                // width of item given pushed settings and current cursor position. NOT necessarily the width of last item unlike most 'Item' functions.\n    IMGUI_API void          PushTextWrapPos(float wrap_local_pos_x = 0.0f);                 // push word-wrapping position for Text*() commands. < 0.0f: no wrapping; 0.0f: wrap to end of window (or column); > 0.0f: wrap at 'wrap_pos_x' position in window local space\n    IMGUI_API void          PopTextWrapPos();\n\n    // Style read access\n    // - Use the style editor (ShowStyleEditor() function) to interactively see what the colors are)\n    IMGUI_API ImFont*       GetFont();                                                      // get current font\n    IMGUI_API float         GetFontSize();                                                  // get current font size (= height in pixels) of current font with current scale applied\n    IMGUI_API ImVec2        GetFontTexUvWhitePixel();                                       // get UV coordinate for a while pixel, useful to draw custom shapes via the ImDrawList API\n    IMGUI_API ImU32         GetColorU32(ImGuiCol idx, float alpha_mul = 1.0f);              // retrieve given style color with style alpha applied and optional extra alpha multiplier, packed as a 32-bit value suitable for ImDrawList\n    IMGUI_API ImU32         GetColorU32(const ImVec4& col);                                 // retrieve given color with style alpha applied, packed as a 32-bit value suitable for ImDrawList\n    IMGUI_API ImU32         GetColorU32(ImU32 col);                                         // retrieve given color with style alpha applied, packed as a 32-bit value suitable for ImDrawList\n    IMGUI_API const ImVec4& GetStyleColorVec4(ImGuiCol idx);                                // retrieve style color as stored in ImGuiStyle structure. use to feed back into PushStyleColor(), otherwise use GetColorU32() to get style color with style alpha baked in.\n\n    // Cursor / Layout\n    // - By \"cursor\" we mean the current output position.\n    // - The typical widget behavior is to output themselves at the current cursor position, then move the cursor one line down.\n    // - You can call SameLine() between widgets to undo the last carriage return and output at the right of the preceding widget.\n    // - Attention! We currently have inconsistencies between window-local and absolute positions we will aim to fix with future API:\n    //    Window-local coordinates:   SameLine(), GetCursorPos(), SetCursorPos(), GetCursorStartPos(), GetContentRegionMax(), GetWindowContentRegion*(), PushTextWrapPos()\n    //    Absolute coordinate:        GetCursorScreenPos(), SetCursorScreenPos(), all ImDrawList:: functions.\n    IMGUI_API void          Separator();                                                    // separator, generally horizontal. inside a menu bar or in horizontal layout mode, this becomes a vertical separator.\n    IMGUI_API void          SameLine(float offset_from_start_x=0.0f, float spacing=-1.0f);  // call between widgets or groups to layout them horizontally. X position given in window coordinates.\n    IMGUI_API void          NewLine();                                                      // undo a SameLine() or force a new line when in an horizontal-layout context.\n    IMGUI_API void          Spacing();                                                      // add vertical spacing.\n    IMGUI_API void          Dummy(const ImVec2& size);                                      // add a dummy item of given size. unlike InvisibleButton(), Dummy() won't take the mouse click or be navigable into.\n    IMGUI_API void          Indent(float indent_w = 0.0f);                                  // move content position toward the right, by indent_w, or style.IndentSpacing if indent_w <= 0\n    IMGUI_API void          Unindent(float indent_w = 0.0f);                                // move content position back to the left, by indent_w, or style.IndentSpacing if indent_w <= 0\n    IMGUI_API void          BeginGroup();                                                   // lock horizontal starting position\n    IMGUI_API void          EndGroup();                                                     // unlock horizontal starting position + capture the whole group bounding box into one \"item\" (so you can use IsItemHovered() or layout primitives such as SameLine() on whole group, etc.)\n    IMGUI_API ImVec2        GetCursorPos();                                                 // cursor position in window coordinates (relative to window position)\n    IMGUI_API float         GetCursorPosX();                                                //   (some functions are using window-relative coordinates, such as: GetCursorPos, GetCursorStartPos, GetContentRegionMax, GetWindowContentRegion* etc.\n    IMGUI_API float         GetCursorPosY();                                                //    other functions such as GetCursorScreenPos or everything in ImDrawList::\n    IMGUI_API void          SetCursorPos(const ImVec2& local_pos);                          //    are using the main, absolute coordinate system.\n    IMGUI_API void          SetCursorPosX(float local_x);                                   //    GetWindowPos() + GetCursorPos() == GetCursorScreenPos() etc.)\n    IMGUI_API void          SetCursorPosY(float local_y);                                   //\n    IMGUI_API ImVec2        GetCursorStartPos();                                            // initial cursor position in window coordinates\n    IMGUI_API ImVec2        GetCursorScreenPos();                                           // cursor position in absolute coordinates (useful to work with ImDrawList API). generally top-left == GetMainViewport()->Pos == (0,0) in single viewport mode, and bottom-right == GetMainViewport()->Pos+Size == io.DisplaySize in single-viewport mode.\n    IMGUI_API void          SetCursorScreenPos(const ImVec2& pos);                          // cursor position in absolute coordinates\n    IMGUI_API void          AlignTextToFramePadding();                                      // vertically align upcoming text baseline to FramePadding.y so that it will align properly to regularly framed items (call if you have text on a line before a framed item)\n    IMGUI_API float         GetTextLineHeight();                                            // ~ FontSize\n    IMGUI_API float         GetTextLineHeightWithSpacing();                                 // ~ FontSize + style.ItemSpacing.y (distance in pixels between 2 consecutive lines of text)\n    IMGUI_API float         GetFrameHeight();                                               // ~ FontSize + style.FramePadding.y * 2\n    IMGUI_API float         GetFrameHeightWithSpacing();                                    // ~ FontSize + style.FramePadding.y * 2 + style.ItemSpacing.y (distance in pixels between 2 consecutive lines of framed widgets)\n\n    // ID stack/scopes\n    // Read the FAQ (docs/FAQ.md or http://dearimgui.org/faq) for more details about how ID are handled in dear imgui.\n    // - Those questions are answered and impacted by understanding of the ID stack system:\n    //   - \"Q: Why is my widget not reacting when I click on it?\"\n    //   - \"Q: How can I have widgets with an empty label?\"\n    //   - \"Q: How can I have multiple widgets with the same label?\"\n    // - Short version: ID are hashes of the entire ID stack. If you are creating widgets in a loop you most likely\n    //   want to push a unique identifier (e.g. object pointer, loop index) to uniquely differentiate them.\n    // - You can also use the \"Label##foobar\" syntax within widget label to distinguish them from each others.\n    // - In this header file we use the \"label\"/\"name\" terminology to denote a string that will be displayed + used as an ID,\n    //   whereas \"str_id\" denote a string that is only used as an ID and not normally displayed.\n    IMGUI_API void          PushID(const char* str_id);                                     // push string into the ID stack (will hash string).\n    IMGUI_API void          PushID(const char* str_id_begin, const char* str_id_end);       // push string into the ID stack (will hash string).\n    IMGUI_API void          PushID(const void* ptr_id);                                     // push pointer into the ID stack (will hash pointer).\n    IMGUI_API void          PushID(int int_id);                                             // push integer into the ID stack (will hash integer).\n    IMGUI_API void          PopID();                                                        // pop from the ID stack.\n    IMGUI_API ImGuiID       GetID(const char* str_id);                                      // calculate unique ID (hash of whole ID stack + given parameter). e.g. if you want to query into ImGuiStorage yourself\n    IMGUI_API ImGuiID       GetID(const char* str_id_begin, const char* str_id_end);\n    IMGUI_API ImGuiID       GetID(const void* ptr_id);\n\n    // Widgets: Text\n    IMGUI_API void          TextUnformatted(const char* text, const char* text_end = NULL); // raw text without formatting. Roughly equivalent to Text(\"%s\", text) but: A) doesn't require null terminated string if 'text_end' is specified, B) it's faster, no memory copy is done, no buffer size limits, recommended for long chunks of text.\n    IMGUI_API void          Text(const char* fmt, ...)                                      IM_FMTARGS(1); // formatted text\n    IMGUI_API void          TextV(const char* fmt, va_list args)                            IM_FMTLIST(1);\n    IMGUI_API void          TextColored(const ImVec4& col, const char* fmt, ...)            IM_FMTARGS(2); // shortcut for PushStyleColor(ImGuiCol_Text, col); Text(fmt, ...); PopStyleColor();\n    IMGUI_API void          TextColoredV(const ImVec4& col, const char* fmt, va_list args)  IM_FMTLIST(2);\n    IMGUI_API void          TextDisabled(const char* fmt, ...)                              IM_FMTARGS(1); // shortcut for PushStyleColor(ImGuiCol_Text, style.Colors[ImGuiCol_TextDisabled]); Text(fmt, ...); PopStyleColor();\n    IMGUI_API void          TextDisabledV(const char* fmt, va_list args)                    IM_FMTLIST(1);\n    IMGUI_API void          TextWrapped(const char* fmt, ...)                               IM_FMTARGS(1); // shortcut for PushTextWrapPos(0.0f); Text(fmt, ...); PopTextWrapPos();. Note that this won't work on an auto-resizing window if there's no other widgets to extend the window width, yoy may need to set a size using SetNextWindowSize().\n    IMGUI_API void          TextWrappedV(const char* fmt, va_list args)                     IM_FMTLIST(1);\n    IMGUI_API void          LabelText(const char* label, const char* fmt, ...)              IM_FMTARGS(2); // display text+label aligned the same way as value+label widgets\n    IMGUI_API void          LabelTextV(const char* label, const char* fmt, va_list args)    IM_FMTLIST(2);\n    IMGUI_API void          BulletText(const char* fmt, ...)                                IM_FMTARGS(1); // shortcut for Bullet()+Text()\n    IMGUI_API void          BulletTextV(const char* fmt, va_list args)                      IM_FMTLIST(1);\n\n    // Widgets: Main\n    // - Most widgets return true when the value has been changed or when pressed/selected\n    // - You may also use one of the many IsItemXXX functions (e.g. IsItemActive, IsItemHovered, etc.) to query widget state.\n    IMGUI_API bool          Button(const char* label, const ImVec2& size = ImVec2(0, 0));   // button\n    IMGUI_API bool          SmallButton(const char* label);                                 // button with FramePadding=(0,0) to easily embed within text\n    IMGUI_API bool          InvisibleButton(const char* str_id, const ImVec2& size, ImGuiButtonFlags flags = 0); // flexible button behavior without the visuals, frequently useful to build custom behaviors using the public api (along with IsItemActive, IsItemHovered, etc.)\n    IMGUI_API bool          ArrowButton(const char* str_id, ImGuiDir dir);                  // square button with an arrow shape\n    IMGUI_API void          Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1,1), const ImVec4& tint_col = ImVec4(1,1,1,1), const ImVec4& border_col = ImVec4(0,0,0,0));\n    IMGUI_API bool          ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0),  const ImVec2& uv1 = ImVec2(1,1), int frame_padding = -1, const ImVec4& bg_col = ImVec4(0,0,0,0), const ImVec4& tint_col = ImVec4(1,1,1,1));    // <0 frame_padding uses default frame padding settings. 0 for no padding\n    IMGUI_API bool          Checkbox(const char* label, bool* v);\n    IMGUI_API bool          CheckboxFlags(const char* label, int* flags, int flags_value);\n    IMGUI_API bool          CheckboxFlags(const char* label, unsigned int* flags, unsigned int flags_value);\n    IMGUI_API bool          RadioButton(const char* label, bool active);                    // use with e.g. if (RadioButton(\"one\", my_value==1)) { my_value = 1; }\n    IMGUI_API bool          RadioButton(const char* label, int* v, int v_button);           // shortcut to handle the above pattern when value is an integer\n    IMGUI_API void          ProgressBar(float fraction, const ImVec2& size_arg = ImVec2(-FLT_MIN, 0), const char* overlay = NULL);\n    IMGUI_API void          Bullet();                                                       // draw a small circle + keep the cursor on the same line. advance cursor x position by GetTreeNodeToLabelSpacing(), same distance that TreeNode() uses\n\n    // Widgets: Combo Box\n    // - The BeginCombo()/EndCombo() api allows you to manage your contents and selection state however you want it, by creating e.g. Selectable() items.\n    // - The old Combo() api are helpers over BeginCombo()/EndCombo() which are kept available for convenience purpose. This is analogous to how ListBox are created.\n    IMGUI_API bool          BeginCombo(const char* label, const char* preview_value, ImGuiComboFlags flags = 0);\n    IMGUI_API void          EndCombo(); // only call EndCombo() if BeginCombo() returns true!\n    IMGUI_API bool          Combo(const char* label, int* current_item, const char* const items[], int items_count, int popup_max_height_in_items = -1);\n    IMGUI_API bool          Combo(const char* label, int* current_item, const char* items_separated_by_zeros, int popup_max_height_in_items = -1);      // Separate items with \\0 within a string, end item-list with \\0\\0. e.g. \"One\\0Two\\0Three\\0\"\n    IMGUI_API bool          Combo(const char* label, int* current_item, bool(*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int popup_max_height_in_items = -1);\n\n    // Widgets: Drag Sliders\n    // - CTRL+Click on any drag box to turn them into an input box. Manually input values aren't clamped and can go off-bounds.\n    // - For all the Float2/Float3/Float4/Int2/Int3/Int4 versions of every functions, note that a 'float v[X]' function argument is the same as 'float* v', the array syntax is just a way to document the number of elements that are expected to be accessible. You can pass address of your first element out of a contiguous set, e.g. &myvector.x\n    // - Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. \"%.3f\" -> 1.234; \"%5.2f secs\" -> 01.23 secs; \"Biscuit: %.0f\" -> Biscuit: 1; etc.\n    // - Format string may also be set to NULL or use the default format (\"%f\" or \"%d\").\n    // - Speed are per-pixel of mouse movement (v_speed=0.2f: mouse needs to move by 5 pixels to increase value by 1). For gamepad/keyboard navigation, minimum speed is Max(v_speed, minimum_step_at_given_precision).\n    // - Use v_min < v_max to clamp edits to given limits. Note that CTRL+Click manual input can override those limits.\n    // - Use v_max = FLT_MAX / INT_MAX etc to avoid clamping to a maximum, same with v_min = -FLT_MAX / INT_MIN to avoid clamping to a minimum.\n    // - We use the same sets of flags for DragXXX() and SliderXXX() functions as the features are the same and it makes it easier to swap them.\n    // - Legacy: Pre-1.78 there are DragXXX() function signatures that takes a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument.\n    //   If you get a warning converting a float to ImGuiSliderFlags, read https://github.com/ocornut/imgui/issues/3361\n    IMGUI_API bool          DragFloat(const char* label, float* v, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = \"%.3f\", ImGuiSliderFlags flags = 0);     // If v_min >= v_max we have no bound\n    IMGUI_API bool          DragFloat2(const char* label, float v[2], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = \"%.3f\", ImGuiSliderFlags flags = 0);\n    IMGUI_API bool          DragFloat3(const char* label, float v[3], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = \"%.3f\", ImGuiSliderFlags flags = 0);\n    IMGUI_API bool          DragFloat4(const char* label, float v[4], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = \"%.3f\", ImGuiSliderFlags flags = 0);\n    IMGUI_API bool          DragFloatRange2(const char* label, float* v_current_min, float* v_current_max, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = \"%.3f\", const char* format_max = NULL, ImGuiSliderFlags flags = 0);\n    IMGUI_API bool          DragInt(const char* label, int* v, float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = \"%d\", ImGuiSliderFlags flags = 0);  // If v_min >= v_max we have no bound\n    IMGUI_API bool          DragInt2(const char* label, int v[2], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = \"%d\", ImGuiSliderFlags flags = 0);\n    IMGUI_API bool          DragInt3(const char* label, int v[3], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = \"%d\", ImGuiSliderFlags flags = 0);\n    IMGUI_API bool          DragInt4(const char* label, int v[4], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = \"%d\", ImGuiSliderFlags flags = 0);\n    IMGUI_API bool          DragIntRange2(const char* label, int* v_current_min, int* v_current_max, float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = \"%d\", const char* format_max = NULL, ImGuiSliderFlags flags = 0);\n    IMGUI_API bool          DragScalar(const char* label, ImGuiDataType data_type, void* p_data, float v_speed = 1.0f, const void* p_min = NULL, const void* p_max = NULL, const char* format = NULL, ImGuiSliderFlags flags = 0);\n    IMGUI_API bool          DragScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, float v_speed = 1.0f, const void* p_min = NULL, const void* p_max = NULL, const char* format = NULL, ImGuiSliderFlags flags = 0);\n\n    // Widgets: Regular Sliders\n    // - CTRL+Click on any slider to turn them into an input box. Manually input values aren't clamped and can go off-bounds.\n    // - Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. \"%.3f\" -> 1.234; \"%5.2f secs\" -> 01.23 secs; \"Biscuit: %.0f\" -> Biscuit: 1; etc.\n    // - Format string may also be set to NULL or use the default format (\"%f\" or \"%d\").\n    // - Legacy: Pre-1.78 there are SliderXXX() function signatures that takes a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument.\n    //   If you get a warning converting a float to ImGuiSliderFlags, read https://github.com/ocornut/imgui/issues/3361\n    IMGUI_API bool          SliderFloat(const char* label, float* v, float v_min, float v_max, const char* format = \"%.3f\", ImGuiSliderFlags flags = 0);     // adjust format to decorate the value with a prefix or a suffix for in-slider labels or unit display.\n    IMGUI_API bool          SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* format = \"%.3f\", ImGuiSliderFlags flags = 0);\n    IMGUI_API bool          SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* format = \"%.3f\", ImGuiSliderFlags flags = 0);\n    IMGUI_API bool          SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* format = \"%.3f\", ImGuiSliderFlags flags = 0);\n    IMGUI_API bool          SliderAngle(const char* label, float* v_rad, float v_degrees_min = -360.0f, float v_degrees_max = +360.0f, const char* format = \"%.0f deg\", ImGuiSliderFlags flags = 0);\n    IMGUI_API bool          SliderInt(const char* label, int* v, int v_min, int v_max, const char* format = \"%d\", ImGuiSliderFlags flags = 0);\n    IMGUI_API bool          SliderInt2(const char* label, int v[2], int v_min, int v_max, const char* format = \"%d\", ImGuiSliderFlags flags = 0);\n    IMGUI_API bool          SliderInt3(const char* label, int v[3], int v_min, int v_max, const char* format = \"%d\", ImGuiSliderFlags flags = 0);\n    IMGUI_API bool          SliderInt4(const char* label, int v[4], int v_min, int v_max, const char* format = \"%d\", ImGuiSliderFlags flags = 0);\n    IMGUI_API bool          SliderScalar(const char* label, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, const char* format = NULL, ImGuiSliderFlags flags = 0);\n    IMGUI_API bool          SliderScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, const void* p_min, const void* p_max, const char* format = NULL, ImGuiSliderFlags flags = 0);\n    IMGUI_API bool          VSliderFloat(const char* label, const ImVec2& size, float* v, float v_min, float v_max, const char* format = \"%.3f\", ImGuiSliderFlags flags = 0);\n    IMGUI_API bool          VSliderInt(const char* label, const ImVec2& size, int* v, int v_min, int v_max, const char* format = \"%d\", ImGuiSliderFlags flags = 0);\n    IMGUI_API bool          VSliderScalar(const char* label, const ImVec2& size, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, const char* format = NULL, ImGuiSliderFlags flags = 0);\n\n    // Widgets: Input with Keyboard\n    // - If you want to use InputText() with std::string or any custom dynamic string type, see misc/cpp/imgui_stdlib.h and comments in imgui_demo.cpp.\n    // - Most of the ImGuiInputTextFlags flags are only useful for InputText() and not for InputFloatX, InputIntX, InputDouble etc.\n    IMGUI_API bool          InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL);\n    IMGUI_API bool          InputTextMultiline(const char* label, char* buf, size_t buf_size, const ImVec2& size = ImVec2(0, 0), ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL);\n    IMGUI_API bool          InputTextWithHint(const char* label, const char* hint, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL);\n    IMGUI_API bool          InputFloat(const char* label, float* v, float step = 0.0f, float step_fast = 0.0f, const char* format = \"%.3f\", ImGuiInputTextFlags flags = 0);\n    IMGUI_API bool          InputFloat2(const char* label, float v[2], const char* format = \"%.3f\", ImGuiInputTextFlags flags = 0);\n    IMGUI_API bool          InputFloat3(const char* label, float v[3], const char* format = \"%.3f\", ImGuiInputTextFlags flags = 0);\n    IMGUI_API bool          InputFloat4(const char* label, float v[4], const char* format = \"%.3f\", ImGuiInputTextFlags flags = 0);\n    IMGUI_API bool          InputInt(const char* label, int* v, int step = 1, int step_fast = 100, ImGuiInputTextFlags flags = 0);\n    IMGUI_API bool          InputInt2(const char* label, int v[2], ImGuiInputTextFlags flags = 0);\n    IMGUI_API bool          InputInt3(const char* label, int v[3], ImGuiInputTextFlags flags = 0);\n    IMGUI_API bool          InputInt4(const char* label, int v[4], ImGuiInputTextFlags flags = 0);\n    IMGUI_API bool          InputDouble(const char* label, double* v, double step = 0.0, double step_fast = 0.0, const char* format = \"%.6f\", ImGuiInputTextFlags flags = 0);\n    IMGUI_API bool          InputScalar(const char* label, ImGuiDataType data_type, void* p_data, const void* p_step = NULL, const void* p_step_fast = NULL, const char* format = NULL, ImGuiInputTextFlags flags = 0);\n    IMGUI_API bool          InputScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, const void* p_step = NULL, const void* p_step_fast = NULL, const char* format = NULL, ImGuiInputTextFlags flags = 0);\n\n    // Widgets: Color Editor/Picker (tip: the ColorEdit* functions have a little color square that can be left-clicked to open a picker, and right-clicked to open an option menu.)\n    // - Note that in C++ a 'float v[X]' function argument is the _same_ as 'float* v', the array syntax is just a way to document the number of elements that are expected to be accessible.\n    // - You can pass the address of a first float element out of a contiguous structure, e.g. &myvector.x\n    IMGUI_API bool          ColorEdit3(const char* label, float col[3], ImGuiColorEditFlags flags = 0);\n    IMGUI_API bool          ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flags = 0);\n    IMGUI_API bool          ColorPicker3(const char* label, float col[3], ImGuiColorEditFlags flags = 0);\n    IMGUI_API bool          ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags flags = 0, const float* ref_col = NULL);\n    IMGUI_API bool          ColorButton(const char* desc_id, const ImVec4& col, ImGuiColorEditFlags flags = 0, ImVec2 size = ImVec2(0, 0)); // display a color square/button, hover for details, return true when pressed.\n    IMGUI_API void          SetColorEditOptions(ImGuiColorEditFlags flags);                     // initialize current options (generally on application startup) if you want to select a default format, picker type, etc. User will be able to change many settings, unless you pass the _NoOptions flag to your calls.\n\n    // Widgets: Trees\n    // - TreeNode functions return true when the node is open, in which case you need to also call TreePop() when you are finished displaying the tree node contents.\n    IMGUI_API bool          TreeNode(const char* label);\n    IMGUI_API bool          TreeNode(const char* str_id, const char* fmt, ...) IM_FMTARGS(2);   // helper variation to easily decorelate the id from the displayed string. Read the FAQ about why and how to use ID. to align arbitrary text at the same level as a TreeNode() you can use Bullet().\n    IMGUI_API bool          TreeNode(const void* ptr_id, const char* fmt, ...) IM_FMTARGS(2);   // \"\n    IMGUI_API bool          TreeNodeV(const char* str_id, const char* fmt, va_list args) IM_FMTLIST(2);\n    IMGUI_API bool          TreeNodeV(const void* ptr_id, const char* fmt, va_list args) IM_FMTLIST(2);\n    IMGUI_API bool          TreeNodeEx(const char* label, ImGuiTreeNodeFlags flags = 0);\n    IMGUI_API bool          TreeNodeEx(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, ...) IM_FMTARGS(3);\n    IMGUI_API bool          TreeNodeEx(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, ...) IM_FMTARGS(3);\n    IMGUI_API bool          TreeNodeExV(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args) IM_FMTLIST(3);\n    IMGUI_API bool          TreeNodeExV(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args) IM_FMTLIST(3);\n    IMGUI_API void          TreePush(const char* str_id);                                       // ~ Indent()+PushId(). Already called by TreeNode() when returning true, but you can call TreePush/TreePop yourself if desired.\n    IMGUI_API void          TreePush(const void* ptr_id = NULL);                                // \"\n    IMGUI_API void          TreePop();                                                          // ~ Unindent()+PopId()\n    IMGUI_API float         GetTreeNodeToLabelSpacing();                                        // horizontal distance preceding label when using TreeNode*() or Bullet() == (g.FontSize + style.FramePadding.x*2) for a regular unframed TreeNode\n    IMGUI_API bool          CollapsingHeader(const char* label, ImGuiTreeNodeFlags flags = 0);  // if returning 'true' the header is open. doesn't indent nor push on ID stack. user doesn't have to call TreePop().\n    IMGUI_API bool          CollapsingHeader(const char* label, bool* p_visible, ImGuiTreeNodeFlags flags = 0); // when 'p_visible != NULL': if '*p_visible==true' display an additional small close button on upper right of the header which will set the bool to false when clicked, if '*p_visible==false' don't display the header.\n    IMGUI_API void          SetNextItemOpen(bool is_open, ImGuiCond cond = 0);                  // set next TreeNode/CollapsingHeader open state.\n\n    // Widgets: Selectables\n    // - A selectable highlights when hovered, and can display another color when selected.\n    // - Neighbors selectable extend their highlight bounds in order to leave no gap between them. This is so a series of selected Selectable appear contiguous.\n    IMGUI_API bool          Selectable(const char* label, bool selected = false, ImGuiSelectableFlags flags = 0, const ImVec2& size = ImVec2(0, 0)); // \"bool selected\" carry the selection state (read-only). Selectable() is clicked is returns true so you can modify your selection state. size.x==0.0: use remaining width, size.x>0.0: specify width. size.y==0.0: use label height, size.y>0.0: specify height\n    IMGUI_API bool          Selectable(const char* label, bool* p_selected, ImGuiSelectableFlags flags = 0, const ImVec2& size = ImVec2(0, 0));      // \"bool* p_selected\" point to the selection state (read-write), as a convenient helper.\n\n    // Widgets: List Boxes\n    // - This is essentially a thin wrapper to using BeginChild/EndChild with some stylistic changes.\n    // - The BeginListBox()/EndListBox() api allows you to manage your contents and selection state however you want it, by creating e.g. Selectable() or any items.\n    // - The simplified/old ListBox() api are helpers over BeginListBox()/EndListBox() which are kept available for convenience purpose. This is analoguous to how Combos are created.\n    // - Choose frame width:   size.x > 0.0f: custom  /  size.x < 0.0f or -FLT_MIN: right-align   /  size.x = 0.0f (default): use current ItemWidth\n    // - Choose frame height:  size.y > 0.0f: custom  /  size.y < 0.0f or -FLT_MIN: bottom-align  /  size.y = 0.0f (default): arbitrary default height which can fit ~7 items\n    IMGUI_API bool          BeginListBox(const char* label, const ImVec2& size = ImVec2(0, 0)); // open a framed scrolling region\n    IMGUI_API void          EndListBox();                                                       // only call EndListBox() if BeginListBox() returned true!\n    IMGUI_API bool          ListBox(const char* label, int* current_item, const char* const items[], int items_count, int height_in_items = -1);\n    IMGUI_API bool          ListBox(const char* label, int* current_item, bool (*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int height_in_items = -1);\n\n    // Widgets: Data Plotting\n    // - Consider using ImPlot (https://github.com/epezent/implot) which is much better!\n    IMGUI_API void          PlotLines(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0), int stride = sizeof(float));\n    IMGUI_API void          PlotLines(const char* label, float(*values_getter)(void* data, int idx), void* data, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0));\n    IMGUI_API void          PlotHistogram(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0), int stride = sizeof(float));\n    IMGUI_API void          PlotHistogram(const char* label, float(*values_getter)(void* data, int idx), void* data, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0));\n\n    // Widgets: Value() Helpers.\n    // - Those are merely shortcut to calling Text() with a format string. Output single value in \"name: value\" format (tip: freely declare more in your code to handle your types. you can add functions to the ImGui namespace)\n    IMGUI_API void          Value(const char* prefix, bool b);\n    IMGUI_API void          Value(const char* prefix, int v);\n    IMGUI_API void          Value(const char* prefix, unsigned int v);\n    IMGUI_API void          Value(const char* prefix, float v, const char* float_format = NULL);\n\n    // Widgets: Menus\n    // - Use BeginMenuBar() on a window ImGuiWindowFlags_MenuBar to append to its menu bar.\n    // - Use BeginMainMenuBar() to create a menu bar at the top of the screen and append to it.\n    // - Use BeginMenu() to create a menu. You can call BeginMenu() multiple time with the same identifier to append more items to it.\n    // - Not that MenuItem() keyboardshortcuts are displayed as a convenience but _not processed_ by Dear ImGui at the moment.\n    IMGUI_API bool          BeginMenuBar();                                                     // append to menu-bar of current window (requires ImGuiWindowFlags_MenuBar flag set on parent window).\n    IMGUI_API void          EndMenuBar();                                                       // only call EndMenuBar() if BeginMenuBar() returns true!\n    IMGUI_API bool          BeginMainMenuBar();                                                 // create and append to a full screen menu-bar.\n    IMGUI_API void          EndMainMenuBar();                                                   // only call EndMainMenuBar() if BeginMainMenuBar() returns true!\n    IMGUI_API bool          BeginMenu(const char* label, bool enabled = true);                  // create a sub-menu entry. only call EndMenu() if this returns true!\n    IMGUI_API void          EndMenu();                                                          // only call EndMenu() if BeginMenu() returns true!\n    IMGUI_API bool          MenuItem(const char* label, const char* shortcut = NULL, bool selected = false, bool enabled = true);  // return true when activated.\n    IMGUI_API bool          MenuItem(const char* label, const char* shortcut, bool* p_selected, bool enabled = true);              // return true when activated + toggle (*p_selected) if p_selected != NULL\n\n    // Tooltips\n    // - Tooltip are windows following the mouse. They do not take focus away.\n    IMGUI_API void          BeginTooltip();                                                     // begin/append a tooltip window. to create full-featured tooltip (with any kind of items).\n    IMGUI_API void          EndTooltip();\n    IMGUI_API void          SetTooltip(const char* fmt, ...) IM_FMTARGS(1);                     // set a text-only tooltip, typically use with ImGui::IsItemHovered(). override any previous call to SetTooltip().\n    IMGUI_API void          SetTooltipV(const char* fmt, va_list args) IM_FMTLIST(1);\n\n    // Popups, Modals\n    //  - They block normal mouse hovering detection (and therefore most mouse interactions) behind them.\n    //  - If not modal: they can be closed by clicking anywhere outside them, or by pressing ESCAPE.\n    //  - Their visibility state (~bool) is held internally instead of being held by the programmer as we are used to with regular Begin*() calls.\n    //  - The 3 properties above are related: we need to retain popup visibility state in the library because popups may be closed as any time.\n    //  - You can bypass the hovering restriction by using ImGuiHoveredFlags_AllowWhenBlockedByPopup when calling IsItemHovered() or IsWindowHovered().\n    //  - IMPORTANT: Popup identifiers are relative to the current ID stack, so OpenPopup and BeginPopup generally needs to be at the same level of the stack.\n    //    This is sometimes leading to confusing mistakes. May rework this in the future.\n\n    // Popups: begin/end functions\n    //  - BeginPopup(): query popup state, if open start appending into the window. Call EndPopup() afterwards. ImGuiWindowFlags are forwarded to the window.\n    //  - BeginPopupModal(): block every interactions behind the window, cannot be closed by user, add a dimming background, has a title bar.\n    IMGUI_API bool          BeginPopup(const char* str_id, ImGuiWindowFlags flags = 0);                         // return true if the popup is open, and you can start outputting to it.\n    IMGUI_API bool          BeginPopupModal(const char* name, bool* p_open = NULL, ImGuiWindowFlags flags = 0); // return true if the modal is open, and you can start outputting to it.\n    IMGUI_API void          EndPopup();                                                                         // only call EndPopup() if BeginPopupXXX() returns true!\n\n    // Popups: open/close functions\n    //  - OpenPopup(): set popup state to open. ImGuiPopupFlags are available for opening options.\n    //  - If not modal: they can be closed by clicking anywhere outside them, or by pressing ESCAPE.\n    //  - CloseCurrentPopup(): use inside the BeginPopup()/EndPopup() scope to close manually.\n    //  - CloseCurrentPopup() is called by default by Selectable()/MenuItem() when activated (FIXME: need some options).\n    //  - Use ImGuiPopupFlags_NoOpenOverExistingPopup to avoid opening a popup if there's already one at the same level. This is equivalent to e.g. testing for !IsAnyPopupOpen() prior to OpenPopup().\n    //  - Use IsWindowAppearing() after BeginPopup() to tell if a window just opened.\n    IMGUI_API void          OpenPopup(const char* str_id, ImGuiPopupFlags popup_flags = 0);                     // call to mark popup as open (don't call every frame!).\n    IMGUI_API void          OpenPopup(ImGuiID id, ImGuiPopupFlags popup_flags = 0);                             // id overload to facilitate calling from nested stacks\n    IMGUI_API void          OpenPopupOnItemClick(const char* str_id = NULL, ImGuiPopupFlags popup_flags = 1);   // helper to open popup when clicked on last item. Default to ImGuiPopupFlags_MouseButtonRight == 1. (note: actually triggers on the mouse _released_ event to be consistent with popup behaviors)\n    IMGUI_API void          CloseCurrentPopup();                                                                // manually close the popup we have begin-ed into.\n\n    // Popups: open+begin combined functions helpers\n    //  - Helpers to do OpenPopup+BeginPopup where the Open action is triggered by e.g. hovering an item and right-clicking.\n    //  - They are convenient to easily create context menus, hence the name.\n    //  - IMPORTANT: Notice that BeginPopupContextXXX takes ImGuiPopupFlags just like OpenPopup() and unlike BeginPopup(). For full consistency, we may add ImGuiWindowFlags to the BeginPopupContextXXX functions in the future.\n    //  - IMPORTANT: we exceptionally default their flags to 1 (== ImGuiPopupFlags_MouseButtonRight) for backward compatibility with older API taking 'int mouse_button = 1' parameter, so if you add other flags remember to re-add the ImGuiPopupFlags_MouseButtonRight.\n    IMGUI_API bool          BeginPopupContextItem(const char* str_id = NULL, ImGuiPopupFlags popup_flags = 1);  // open+begin popup when clicked on last item. Use str_id==NULL to associate the popup to previous item. If you want to use that on a non-interactive item such as Text() you need to pass in an explicit ID here. read comments in .cpp!\n    IMGUI_API bool          BeginPopupContextWindow(const char* str_id = NULL, ImGuiPopupFlags popup_flags = 1);// open+begin popup when clicked on current window.\n    IMGUI_API bool          BeginPopupContextVoid(const char* str_id = NULL, ImGuiPopupFlags popup_flags = 1);  // open+begin popup when clicked in void (where there are no windows).\n\n    // Popups: query functions\n    //  - IsPopupOpen(): return true if the popup is open at the current BeginPopup() level of the popup stack.\n    //  - IsPopupOpen() with ImGuiPopupFlags_AnyPopupId: return true if any popup is open at the current BeginPopup() level of the popup stack.\n    //  - IsPopupOpen() with ImGuiPopupFlags_AnyPopupId + ImGuiPopupFlags_AnyPopupLevel: return true if any popup is open.\n    IMGUI_API bool          IsPopupOpen(const char* str_id, ImGuiPopupFlags flags = 0);                         // return true if the popup is open.\n\n    // Tables\n    // [BETA API] API may evolve slightly! If you use this, please update to the next version when it comes out!\n    // - Full-featured replacement for old Columns API.\n    // - See Demo->Tables for demo code.\n    // - See top of imgui_tables.cpp for general commentary.\n    // - See ImGuiTableFlags_ and ImGuiTableColumnFlags_ enums for a description of available flags.\n    // The typical call flow is:\n    // - 1. Call BeginTable().\n    // - 2. Optionally call TableSetupColumn() to submit column name/flags/defaults.\n    // - 3. Optionally call TableSetupScrollFreeze() to request scroll freezing of columns/rows.\n    // - 4. Optionally call TableHeadersRow() to submit a header row. Names are pulled from TableSetupColumn() data.\n    // - 5. Populate contents:\n    //    - In most situations you can use TableNextRow() + TableSetColumnIndex(N) to start appending into a column.\n    //    - If you are using tables as a sort of grid, where every columns is holding the same type of contents,\n    //      you may prefer using TableNextColumn() instead of TableNextRow() + TableSetColumnIndex().\n    //      TableNextColumn() will automatically wrap-around into the next row if needed.\n    //    - IMPORTANT: Comparatively to the old Columns() API, we need to call TableNextColumn() for the first column!\n    //    - Summary of possible call flow:\n    //        --------------------------------------------------------------------------------------------------------\n    //        TableNextRow() -> TableSetColumnIndex(0) -> Text(\"Hello 0\") -> TableSetColumnIndex(1) -> Text(\"Hello 1\")  // OK\n    //        TableNextRow() -> TableNextColumn()      -> Text(\"Hello 0\") -> TableNextColumn()      -> Text(\"Hello 1\")  // OK\n    //                          TableNextColumn()      -> Text(\"Hello 0\") -> TableNextColumn()      -> Text(\"Hello 1\")  // OK: TableNextColumn() automatically gets to next row!\n    //        TableNextRow()                           -> Text(\"Hello 0\")                                               // Not OK! Missing TableSetColumnIndex() or TableNextColumn()! Text will not appear!\n    //        --------------------------------------------------------------------------------------------------------\n    // - 5. Call EndTable()\n    IMGUI_API bool          BeginTable(const char* str_id, int column, ImGuiTableFlags flags = 0, const ImVec2& outer_size = ImVec2(0.0f, 0.0f), float inner_width = 0.0f);\n    IMGUI_API void          EndTable();                                 // only call EndTable() if BeginTable() returns true!\n    IMGUI_API void          TableNextRow(ImGuiTableRowFlags row_flags = 0, float min_row_height = 0.0f); // append into the first cell of a new row.\n    IMGUI_API bool          TableNextColumn();                          // append into the next column (or first column of next row if currently in last column). Return true when column is visible.\n    IMGUI_API bool          TableSetColumnIndex(int column_n);          // append into the specified column. Return true when column is visible.\n\n    // Tables: Headers & Columns declaration\n    // - Use TableSetupColumn() to specify label, resizing policy, default width/weight, id, various other flags etc.\n    // - Use TableHeadersRow() to create a header row and automatically submit a TableHeader() for each column.\n    //   Headers are required to perform: reordering, sorting, and opening the context menu.\n    //   The context menu can also be made available in columns body using ImGuiTableFlags_ContextMenuInBody.\n    // - You may manually submit headers using TableNextRow() + TableHeader() calls, but this is only useful in\n    //   some advanced use cases (e.g. adding custom widgets in header row).\n    // - Use TableSetupScrollFreeze() to lock columns/rows so they stay visible when scrolled.\n    IMGUI_API void          TableSetupColumn(const char* label, ImGuiTableColumnFlags flags = 0, float init_width_or_weight = 0.0f, ImGuiID user_id = 0);\n    IMGUI_API void          TableSetupScrollFreeze(int cols, int rows); // lock columns/rows so they stay visible when scrolled.\n    IMGUI_API void          TableHeadersRow();                          // submit all headers cells based on data provided to TableSetupColumn() + submit context menu\n    IMGUI_API void          TableHeader(const char* label);             // submit one header cell manually (rarely used)\n\n    // Tables: Sorting\n    // - Call TableGetSortSpecs() to retrieve latest sort specs for the table. NULL when not sorting.\n    // - When 'SpecsDirty == true' you should sort your data. It will be true when sorting specs have changed\n    //   since last call, or the first time. Make sure to set 'SpecsDirty = false' after sorting, else you may\n    //   wastefully sort your data every frame!\n    // - Lifetime: don't hold on this pointer over multiple frames or past any subsequent call to BeginTable().\n    IMGUI_API ImGuiTableSortSpecs*  TableGetSortSpecs();                        // get latest sort specs for the table (NULL if not sorting).\n\n    // Tables: Miscellaneous functions\n    // - Functions args 'int column_n' treat the default value of -1 as the same as passing the current column index.\n    IMGUI_API int                   TableGetColumnCount();                      // return number of columns (value passed to BeginTable)\n    IMGUI_API int                   TableGetColumnIndex();                      // return current column index.\n    IMGUI_API int                   TableGetRowIndex();                         // return current row index.\n    IMGUI_API const char*           TableGetColumnName(int column_n = -1);      // return \"\" if column didn't have a name declared by TableSetupColumn(). Pass -1 to use current column.\n    IMGUI_API ImGuiTableColumnFlags TableGetColumnFlags(int column_n = -1);     // return column flags so you can query their Enabled/Visible/Sorted/Hovered status flags. Pass -1 to use current column.\n    IMGUI_API void                  TableSetColumnEnabled(int column_n, bool v);// change user accessible enabled/disabled state of a column. Set to false to hide the column. User can use the context menu to change this themselves (right-click in headers, or right-click in columns body with ImGuiTableFlags_ContextMenuInBody)\n    IMGUI_API void                  TableSetBgColor(ImGuiTableBgTarget target, ImU32 color, int column_n = -1);  // change the color of a cell, row, or column. See ImGuiTableBgTarget_ flags for details.\n\n    // Legacy Columns API (prefer using Tables!)\n    // - You can also use SameLine(pos_x) to mimic simplified columns.\n    IMGUI_API void          Columns(int count = 1, const char* id = NULL, bool border = true);\n    IMGUI_API void          NextColumn();                                                       // next column, defaults to current row or next row if the current row is finished\n    IMGUI_API int           GetColumnIndex();                                                   // get current column index\n    IMGUI_API float         GetColumnWidth(int column_index = -1);                              // get column width (in pixels). pass -1 to use current column\n    IMGUI_API void          SetColumnWidth(int column_index, float width);                      // set column width (in pixels). pass -1 to use current column\n    IMGUI_API float         GetColumnOffset(int column_index = -1);                             // get position of column line (in pixels, from the left side of the contents region). pass -1 to use current column, otherwise 0..GetColumnsCount() inclusive. column 0 is typically 0.0f\n    IMGUI_API void          SetColumnOffset(int column_index, float offset_x);                  // set position of column line (in pixels, from the left side of the contents region). pass -1 to use current column\n    IMGUI_API int           GetColumnsCount();\n\n    // Tab Bars, Tabs\n    IMGUI_API bool          BeginTabBar(const char* str_id, ImGuiTabBarFlags flags = 0);        // create and append into a TabBar\n    IMGUI_API void          EndTabBar();                                                        // only call EndTabBar() if BeginTabBar() returns true!\n    IMGUI_API bool          BeginTabItem(const char* label, bool* p_open = NULL, ImGuiTabItemFlags flags = 0); // create a Tab. Returns true if the Tab is selected.\n    IMGUI_API void          EndTabItem();                                                       // only call EndTabItem() if BeginTabItem() returns true!\n    IMGUI_API bool          TabItemButton(const char* label, ImGuiTabItemFlags flags = 0);      // create a Tab behaving like a button. return true when clicked. cannot be selected in the tab bar.\n    IMGUI_API void          SetTabItemClosed(const char* tab_or_docked_window_label);           // notify TabBar or Docking system of a closed tab/window ahead (useful to reduce visual flicker on reorderable tab bars). For tab-bar: call after BeginTabBar() and before Tab submissions. Otherwise call with a window name.\n\n    // Logging/Capture\n    // - All text output from the interface can be captured into tty/file/clipboard. By default, tree nodes are automatically opened during logging.\n    IMGUI_API void          LogToTTY(int auto_open_depth = -1);                                 // start logging to tty (stdout)\n    IMGUI_API void          LogToFile(int auto_open_depth = -1, const char* filename = NULL);   // start logging to file\n    IMGUI_API void          LogToClipboard(int auto_open_depth = -1);                           // start logging to OS clipboard\n    IMGUI_API void          LogFinish();                                                        // stop logging (close file, etc.)\n    IMGUI_API void          LogButtons();                                                       // helper to display buttons for logging to tty/file/clipboard\n    IMGUI_API void          LogText(const char* fmt, ...) IM_FMTARGS(1);                        // pass text data straight to log (without being displayed)\n    IMGUI_API void          LogTextV(const char* fmt, va_list args) IM_FMTLIST(1);\n\n    // Drag and Drop\n    // - On source items, call BeginDragDropSource(), if it returns true also call SetDragDropPayload() + EndDragDropSource().\n    // - On target candidates, call BeginDragDropTarget(), if it returns true also call AcceptDragDropPayload() + EndDragDropTarget().\n    // - If you stop calling BeginDragDropSource() the payload is preserved however it won't have a preview tooltip (we currently display a fallback \"...\" tooltip, see #1725)\n    // - An item can be both drag source and drop target.\n    IMGUI_API bool          BeginDragDropSource(ImGuiDragDropFlags flags = 0);                                      // call after submitting an item which may be dragged. when this return true, you can call SetDragDropPayload() + EndDragDropSource()\n    IMGUI_API bool          SetDragDropPayload(const char* type, const void* data, size_t sz, ImGuiCond cond = 0);  // type is a user defined string of maximum 32 characters. Strings starting with '_' are reserved for dear imgui internal types. Data is copied and held by imgui.\n    IMGUI_API void          EndDragDropSource();                                                                    // only call EndDragDropSource() if BeginDragDropSource() returns true!\n    IMGUI_API bool                  BeginDragDropTarget();                                                          // call after submitting an item that may receive a payload. If this returns true, you can call AcceptDragDropPayload() + EndDragDropTarget()\n    IMGUI_API const ImGuiPayload*   AcceptDragDropPayload(const char* type, ImGuiDragDropFlags flags = 0);          // accept contents of a given type. If ImGuiDragDropFlags_AcceptBeforeDelivery is set you can peek into the payload before the mouse button is released.\n    IMGUI_API void                  EndDragDropTarget();                                                            // only call EndDragDropTarget() if BeginDragDropTarget() returns true!\n    IMGUI_API const ImGuiPayload*   GetDragDropPayload();                                                           // peek directly into the current payload from anywhere. may return NULL. use ImGuiPayload::IsDataType() to test for the payload type.\n\n    // Disabling [BETA API]\n    // - Disable all user interactions and dim items visuals (applying style.DisabledAlpha over current colors)\n    // - BeginDisabled(false) essentially does nothing useful but is provided to facilitate use of boolean expressions. If you can avoid calling BeginDisabled(False)/EndDisabled() best to avoid it.\n    IMGUI_API void          BeginDisabled(bool disabled = true);\n    IMGUI_API void          EndDisabled();\n\n    // Clipping\n    // - Mouse hovering is affected by ImGui::PushClipRect() calls, unlike direct calls to ImDrawList::PushClipRect() which are render only.\n    IMGUI_API void          PushClipRect(const ImVec2& clip_rect_min, const ImVec2& clip_rect_max, bool intersect_with_current_clip_rect);\n    IMGUI_API void          PopClipRect();\n\n    // Focus, Activation\n    // - Prefer using \"SetItemDefaultFocus()\" over \"if (IsWindowAppearing()) SetScrollHereY()\" when applicable to signify \"this is the default item\"\n    IMGUI_API void          SetItemDefaultFocus();                                              // make last item the default focused item of a window.\n    IMGUI_API void          SetKeyboardFocusHere(int offset = 0);                               // focus keyboard on the next widget. Use positive 'offset' to access sub components of a multiple component widget. Use -1 to access previous widget.\n\n    // Item/Widgets Utilities and Query Functions\n    // - Most of the functions are referring to the previous Item that has been submitted.\n    // - See Demo Window under \"Widgets->Querying Status\" for an interactive visualization of most of those functions.\n    IMGUI_API bool          IsItemHovered(ImGuiHoveredFlags flags = 0);                         // is the last item hovered? (and usable, aka not blocked by a popup, etc.). See ImGuiHoveredFlags for more options.\n    IMGUI_API bool          IsItemActive();                                                     // is the last item active? (e.g. button being held, text field being edited. This will continuously return true while holding mouse button on an item. Items that don't interact will always return false)\n    IMGUI_API bool          IsItemFocused();                                                    // is the last item focused for keyboard/gamepad navigation?\n    IMGUI_API bool          IsItemClicked(ImGuiMouseButton mouse_button = 0);                   // is the last item hovered and mouse clicked on? (**)  == IsMouseClicked(mouse_button) && IsItemHovered()Important. (**) this it NOT equivalent to the behavior of e.g. Button(). Read comments in function definition.\n    IMGUI_API bool          IsItemVisible();                                                    // is the last item visible? (items may be out of sight because of clipping/scrolling)\n    IMGUI_API bool          IsItemEdited();                                                     // did the last item modify its underlying value this frame? or was pressed? This is generally the same as the \"bool\" return value of many widgets.\n    IMGUI_API bool          IsItemActivated();                                                  // was the last item just made active (item was previously inactive).\n    IMGUI_API bool          IsItemDeactivated();                                                // was the last item just made inactive (item was previously active). Useful for Undo/Redo patterns with widgets that requires continuous editing.\n    IMGUI_API bool          IsItemDeactivatedAfterEdit();                                       // was the last item just made inactive and made a value change when it was active? (e.g. Slider/Drag moved). Useful for Undo/Redo patterns with widgets that requires continuous editing. Note that you may get false positives (some widgets such as Combo()/ListBox()/Selectable() will return true even when clicking an already selected item).\n    IMGUI_API bool          IsItemToggledOpen();                                                // was the last item open state toggled? set by TreeNode().\n    IMGUI_API bool          IsAnyItemHovered();                                                 // is any item hovered?\n    IMGUI_API bool          IsAnyItemActive();                                                  // is any item active?\n    IMGUI_API bool          IsAnyItemFocused();                                                 // is any item focused?\n    IMGUI_API ImVec2        GetItemRectMin();                                                   // get upper-left bounding rectangle of the last item (screen space)\n    IMGUI_API ImVec2        GetItemRectMax();                                                   // get lower-right bounding rectangle of the last item (screen space)\n    IMGUI_API ImVec2        GetItemRectSize();                                                  // get size of last item\n    IMGUI_API void          SetItemAllowOverlap();                                              // allow last item to be overlapped by a subsequent item. sometimes useful with invisible buttons, selectables, etc. to catch unused area.\n\n    // Viewports\n    // - Currently represents the Platform Window created by the application which is hosting our Dear ImGui windows.\n    // - In 'docking' branch with multi-viewport enabled, we extend this concept to have multiple active viewports.\n    // - In the future we will extend this concept further to also represent Platform Monitor and support a \"no main platform window\" operation mode.\n    IMGUI_API ImGuiViewport* GetMainViewport();                                                 // return primary/default viewport. This can never be NULL.\n\n    // Miscellaneous Utilities\n    IMGUI_API bool          IsRectVisible(const ImVec2& size);                                  // test if rectangle (of given size, starting from cursor position) is visible / not clipped.\n    IMGUI_API bool          IsRectVisible(const ImVec2& rect_min, const ImVec2& rect_max);      // test if rectangle (in screen space) is visible / not clipped. to perform coarse clipping on user's side.\n    IMGUI_API double        GetTime();                                                          // get global imgui time. incremented by io.DeltaTime every frame.\n    IMGUI_API int           GetFrameCount();                                                    // get global imgui frame count. incremented by 1 every frame.\n    IMGUI_API ImDrawList*   GetBackgroundDrawList();                                            // this draw list will be the first rendering one. Useful to quickly draw shapes/text behind dear imgui contents.\n    IMGUI_API ImDrawList*   GetForegroundDrawList();                                            // this draw list will be the last rendered one. Useful to quickly draw shapes/text over dear imgui contents.\n    IMGUI_API ImDrawListSharedData* GetDrawListSharedData();                                    // you may use this when creating your own ImDrawList instances.\n    IMGUI_API const char*   GetStyleColorName(ImGuiCol idx);                                    // get a string corresponding to the enum value (for display, saving, etc.).\n    IMGUI_API void          SetStateStorage(ImGuiStorage* storage);                             // replace current window storage with our own (if you want to manipulate it yourself, typically clear subsection of it)\n    IMGUI_API ImGuiStorage* GetStateStorage();\n    IMGUI_API void          CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end);    // calculate coarse clipping for large list of evenly sized items. Prefer using the ImGuiListClipper higher-level helper if you can.\n    IMGUI_API bool          BeginChildFrame(ImGuiID id, const ImVec2& size, ImGuiWindowFlags flags = 0); // helper to create a child window / scrolling region that looks like a normal widget frame\n    IMGUI_API void          EndChildFrame();                                                    // always call EndChildFrame() regardless of BeginChildFrame() return values (which indicates a collapsed/clipped window)\n\n    // Text Utilities\n    IMGUI_API ImVec2        CalcTextSize(const char* text, const char* text_end = NULL, bool hide_text_after_double_hash = false, float wrap_width = -1.0f);\n\n    // Color Utilities\n    IMGUI_API ImVec4        ColorConvertU32ToFloat4(ImU32 in);\n    IMGUI_API ImU32         ColorConvertFloat4ToU32(const ImVec4& in);\n    IMGUI_API void          ColorConvertRGBtoHSV(float r, float g, float b, float& out_h, float& out_s, float& out_v);\n    IMGUI_API void          ColorConvertHSVtoRGB(float h, float s, float v, float& out_r, float& out_g, float& out_b);\n\n    // Inputs Utilities: Keyboard\n    // - For 'int user_key_index' you can use your own indices/enums according to how your backend/engine stored them in io.KeysDown[].\n    // - We don't know the meaning of those value. You can use GetKeyIndex() to map a ImGuiKey_ value into the user index.\n    IMGUI_API int           GetKeyIndex(ImGuiKey imgui_key);                                    // map ImGuiKey_* values into user's key index. == io.KeyMap[key]\n    IMGUI_API bool          IsKeyDown(int user_key_index);                                      // is key being held. == io.KeysDown[user_key_index].\n    IMGUI_API bool          IsKeyPressed(int user_key_index, bool repeat = true);               // was key pressed (went from !Down to Down)? if repeat=true, uses io.KeyRepeatDelay / KeyRepeatRate\n    IMGUI_API bool          IsKeyReleased(int user_key_index);                                  // was key released (went from Down to !Down)?\n    IMGUI_API int           GetKeyPressedAmount(int key_index, float repeat_delay, float rate); // uses provided repeat rate/delay. return a count, most often 0 or 1 but might be >1 if RepeatRate is small enough that DeltaTime > RepeatRate\n    IMGUI_API void          CaptureKeyboardFromApp(bool want_capture_keyboard_value = true);    // attention: misleading name! manually override io.WantCaptureKeyboard flag next frame (said flag is entirely left for your application to handle). e.g. force capture keyboard when your widget is being hovered. This is equivalent to setting \"io.WantCaptureKeyboard = want_capture_keyboard_value\"; after the next NewFrame() call.\n\n    // Inputs Utilities: Mouse\n    // - To refer to a mouse button, you may use named enums in your code e.g. ImGuiMouseButton_Left, ImGuiMouseButton_Right.\n    // - You can also use regular integer: it is forever guaranteed that 0=Left, 1=Right, 2=Middle.\n    // - Dragging operations are only reported after mouse has moved a certain distance away from the initial clicking position (see 'lock_threshold' and 'io.MouseDraggingThreshold')\n    IMGUI_API bool          IsMouseDown(ImGuiMouseButton button);                               // is mouse button held?\n    IMGUI_API bool          IsMouseClicked(ImGuiMouseButton button, bool repeat = false);       // did mouse button clicked? (went from !Down to Down)\n    IMGUI_API bool          IsMouseReleased(ImGuiMouseButton button);                           // did mouse button released? (went from Down to !Down)\n    IMGUI_API bool          IsMouseDoubleClicked(ImGuiMouseButton button);                      // did mouse button double-clicked? (note that a double-click will also report IsMouseClicked() == true)\n    IMGUI_API bool          IsMouseHoveringRect(const ImVec2& r_min, const ImVec2& r_max, bool clip = true);// is mouse hovering given bounding rect (in screen space). clipped by current clipping settings, but disregarding of other consideration of focus/window ordering/popup-block.\n    IMGUI_API bool          IsMousePosValid(const ImVec2* mouse_pos = NULL);                    // by convention we use (-FLT_MAX,-FLT_MAX) to denote that there is no mouse available\n    IMGUI_API bool          IsAnyMouseDown();                                                   // is any mouse button held?\n    IMGUI_API ImVec2        GetMousePos();                                                      // shortcut to ImGui::GetIO().MousePos provided by user, to be consistent with other calls\n    IMGUI_API ImVec2        GetMousePosOnOpeningCurrentPopup();                                 // retrieve mouse position at the time of opening popup we have BeginPopup() into (helper to avoid user backing that value themselves)\n    IMGUI_API bool          IsMouseDragging(ImGuiMouseButton button, float lock_threshold = -1.0f);         // is mouse dragging? (if lock_threshold < -1.0f, uses io.MouseDraggingThreshold)\n    IMGUI_API ImVec2        GetMouseDragDelta(ImGuiMouseButton button = 0, float lock_threshold = -1.0f);   // return the delta from the initial clicking position while the mouse button is pressed or was just released. This is locked and return 0.0f until the mouse moves past a distance threshold at least once (if lock_threshold < -1.0f, uses io.MouseDraggingThreshold)\n    IMGUI_API void          ResetMouseDragDelta(ImGuiMouseButton button = 0);                   //\n    IMGUI_API ImGuiMouseCursor GetMouseCursor();                                                // get desired cursor type, reset in ImGui::NewFrame(), this is updated during the frame. valid before Render(). If you use software rendering by setting io.MouseDrawCursor ImGui will render those for you\n    IMGUI_API void          SetMouseCursor(ImGuiMouseCursor cursor_type);                       // set desired cursor type\n    IMGUI_API void          CaptureMouseFromApp(bool want_capture_mouse_value = true);          // attention: misleading name! manually override io.WantCaptureMouse flag next frame (said flag is entirely left for your application to handle). This is equivalent to setting \"io.WantCaptureMouse = want_capture_mouse_value;\" after the next NewFrame() call.\n\n    // Clipboard Utilities\n    // - Also see the LogToClipboard() function to capture GUI into clipboard, or easily output text data to the clipboard.\n    IMGUI_API const char*   GetClipboardText();\n    IMGUI_API void          SetClipboardText(const char* text);\n\n    // Settings/.Ini Utilities\n    // - The disk functions are automatically called if io.IniFilename != NULL (default is \"imgui.ini\").\n    // - Set io.IniFilename to NULL to load/save manually. Read io.WantSaveIniSettings description about handling .ini saving manually.\n    // - Important: default value \"imgui.ini\" is relative to current working dir! Most apps will want to lock this to an absolute path (e.g. same path as executables).\n    IMGUI_API void          LoadIniSettingsFromDisk(const char* ini_filename);                  // call after CreateContext() and before the first call to NewFrame(). NewFrame() automatically calls LoadIniSettingsFromDisk(io.IniFilename).\n    IMGUI_API void          LoadIniSettingsFromMemory(const char* ini_data, size_t ini_size=0); // call after CreateContext() and before the first call to NewFrame() to provide .ini data from your own data source.\n    IMGUI_API void          SaveIniSettingsToDisk(const char* ini_filename);                    // this is automatically called (if io.IniFilename is not empty) a few seconds after any modification that should be reflected in the .ini file (and also by DestroyContext).\n    IMGUI_API const char*   SaveIniSettingsToMemory(size_t* out_ini_size = NULL);               // return a zero-terminated string with the .ini data which you can save by your own mean. call when io.WantSaveIniSettings is set, then save data by your own mean and clear io.WantSaveIniSettings.\n\n    // Debug Utilities\n    // - This is used by the IMGUI_CHECKVERSION() macro.\n    IMGUI_API bool          DebugCheckVersionAndDataLayout(const char* version_str, size_t sz_io, size_t sz_style, size_t sz_vec2, size_t sz_vec4, size_t sz_drawvert, size_t sz_drawidx); // This is called by IMGUI_CHECKVERSION() macro.\n\n    // Memory Allocators\n    // - Those functions are not reliant on the current context.\n    // - DLL users: heaps and globals are not shared across DLL boundaries! You will need to call SetCurrentContext() + SetAllocatorFunctions()\n    //   for each static/DLL boundary you are calling from. Read \"Context and Memory Allocators\" section of imgui.cpp for more details.\n    IMGUI_API void          SetAllocatorFunctions(ImGuiMemAllocFunc alloc_func, ImGuiMemFreeFunc free_func, void* user_data = NULL);\n    IMGUI_API void          GetAllocatorFunctions(ImGuiMemAllocFunc* p_alloc_func, ImGuiMemFreeFunc* p_free_func, void** p_user_data);\n    IMGUI_API void*         MemAlloc(size_t size);\n    IMGUI_API void          MemFree(void* ptr);\n\n} // namespace ImGui\n\n//-----------------------------------------------------------------------------\n// [SECTION] Flags & Enumerations\n//-----------------------------------------------------------------------------\n\n// Flags for ImGui::Begin()\nenum ImGuiWindowFlags_\n{\n    ImGuiWindowFlags_None                   = 0,\n    ImGuiWindowFlags_NoTitleBar             = 1 << 0,   // Disable title-bar\n    ImGuiWindowFlags_NoResize               = 1 << 1,   // Disable user resizing with the lower-right grip\n    ImGuiWindowFlags_NoMove                 = 1 << 2,   // Disable user moving the window\n    ImGuiWindowFlags_NoScrollbar            = 1 << 3,   // Disable scrollbars (window can still scroll with mouse or programmatically)\n    ImGuiWindowFlags_NoScrollWithMouse      = 1 << 4,   // Disable user vertically scrolling with mouse wheel. On child window, mouse wheel will be forwarded to the parent unless NoScrollbar is also set.\n    ImGuiWindowFlags_NoCollapse             = 1 << 5,   // Disable user collapsing window by double-clicking on it\n    ImGuiWindowFlags_AlwaysAutoResize       = 1 << 6,   // Resize every window to its content every frame\n    ImGuiWindowFlags_NoBackground           = 1 << 7,   // Disable drawing background color (WindowBg, etc.) and outside border. Similar as using SetNextWindowBgAlpha(0.0f).\n    ImGuiWindowFlags_NoSavedSettings        = 1 << 8,   // Never load/save settings in .ini file\n    ImGuiWindowFlags_NoMouseInputs          = 1 << 9,   // Disable catching mouse, hovering test with pass through.\n    ImGuiWindowFlags_MenuBar                = 1 << 10,  // Has a menu-bar\n    ImGuiWindowFlags_HorizontalScrollbar    = 1 << 11,  // Allow horizontal scrollbar to appear (off by default). You may use SetNextWindowContentSize(ImVec2(width,0.0f)); prior to calling Begin() to specify width. Read code in imgui_demo in the \"Horizontal Scrolling\" section.\n    ImGuiWindowFlags_NoFocusOnAppearing     = 1 << 12,  // Disable taking focus when transitioning from hidden to visible state\n    ImGuiWindowFlags_NoBringToFrontOnFocus  = 1 << 13,  // Disable bringing window to front when taking focus (e.g. clicking on it or programmatically giving it focus)\n    ImGuiWindowFlags_AlwaysVerticalScrollbar= 1 << 14,  // Always show vertical scrollbar (even if ContentSize.y < Size.y)\n    ImGuiWindowFlags_AlwaysHorizontalScrollbar=1<< 15,  // Always show horizontal scrollbar (even if ContentSize.x < Size.x)\n    ImGuiWindowFlags_AlwaysUseWindowPadding = 1 << 16,  // Ensure child windows without border uses style.WindowPadding (ignored by default for non-bordered child windows, because more convenient)\n    ImGuiWindowFlags_NoNavInputs            = 1 << 18,  // No gamepad/keyboard navigation within the window\n    ImGuiWindowFlags_NoNavFocus             = 1 << 19,  // No focusing toward this window with gamepad/keyboard navigation (e.g. skipped by CTRL+TAB)\n    ImGuiWindowFlags_UnsavedDocument        = 1 << 20,  // Display a dot next to the title. When used in a tab/docking context, tab is selected when clicking the X + closure is not assumed (will wait for user to stop submitting the tab). Otherwise closure is assumed when pressing the X, so if you keep submitting the tab may reappear at end of tab bar.\n    ImGuiWindowFlags_NoNav                  = ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus,\n    ImGuiWindowFlags_NoDecoration           = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoCollapse,\n    ImGuiWindowFlags_NoInputs               = ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus,\n\n    // [Internal]\n    ImGuiWindowFlags_NavFlattened           = 1 << 23,  // [BETA] Allow gamepad/keyboard navigation to cross over parent border to this child (only use on child that have no scrolling!)\n    ImGuiWindowFlags_ChildWindow            = 1 << 24,  // Don't use! For internal use by BeginChild()\n    ImGuiWindowFlags_Tooltip                = 1 << 25,  // Don't use! For internal use by BeginTooltip()\n    ImGuiWindowFlags_Popup                  = 1 << 26,  // Don't use! For internal use by BeginPopup()\n    ImGuiWindowFlags_Modal                  = 1 << 27,  // Don't use! For internal use by BeginPopupModal()\n    ImGuiWindowFlags_ChildMenu              = 1 << 28   // Don't use! For internal use by BeginMenu()\n\n    // [Obsolete]\n    //ImGuiWindowFlags_ResizeFromAnySide    = 1 << 17,  // --> Set io.ConfigWindowsResizeFromEdges=true and make sure mouse cursors are supported by backend (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors)\n};\n\n// Flags for ImGui::InputText()\nenum ImGuiInputTextFlags_\n{\n    ImGuiInputTextFlags_None                = 0,\n    ImGuiInputTextFlags_CharsDecimal        = 1 << 0,   // Allow 0123456789.+-*/\n    ImGuiInputTextFlags_CharsHexadecimal    = 1 << 1,   // Allow 0123456789ABCDEFabcdef\n    ImGuiInputTextFlags_CharsUppercase      = 1 << 2,   // Turn a..z into A..Z\n    ImGuiInputTextFlags_CharsNoBlank        = 1 << 3,   // Filter out spaces, tabs\n    ImGuiInputTextFlags_AutoSelectAll       = 1 << 4,   // Select entire text when first taking mouse focus\n    ImGuiInputTextFlags_EnterReturnsTrue    = 1 << 5,   // Return 'true' when Enter is pressed (as opposed to every time the value was modified). Consider looking at the IsItemDeactivatedAfterEdit() function.\n    ImGuiInputTextFlags_CallbackCompletion  = 1 << 6,   // Callback on pressing TAB (for completion handling)\n    ImGuiInputTextFlags_CallbackHistory     = 1 << 7,   // Callback on pressing Up/Down arrows (for history handling)\n    ImGuiInputTextFlags_CallbackAlways      = 1 << 8,   // Callback on each iteration. User code may query cursor position, modify text buffer.\n    ImGuiInputTextFlags_CallbackCharFilter  = 1 << 9,   // Callback on character inputs to replace or discard them. Modify 'EventChar' to replace or discard, or return 1 in callback to discard.\n    ImGuiInputTextFlags_AllowTabInput       = 1 << 10,  // Pressing TAB input a '\\t' character into the text field\n    ImGuiInputTextFlags_CtrlEnterForNewLine = 1 << 11,  // In multi-line mode, unfocus with Enter, add new line with Ctrl+Enter (default is opposite: unfocus with Ctrl+Enter, add line with Enter).\n    ImGuiInputTextFlags_NoHorizontalScroll  = 1 << 12,  // Disable following the cursor horizontally\n    ImGuiInputTextFlags_AlwaysOverwrite     = 1 << 13,  // Overwrite mode\n    ImGuiInputTextFlags_ReadOnly            = 1 << 14,  // Read-only mode\n    ImGuiInputTextFlags_Password            = 1 << 15,  // Password mode, display all characters as '*'\n    ImGuiInputTextFlags_NoUndoRedo          = 1 << 16,  // Disable undo/redo. Note that input text owns the text data while active, if you want to provide your own undo/redo stack you need e.g. to call ClearActiveID().\n    ImGuiInputTextFlags_CharsScientific     = 1 << 17,  // Allow 0123456789.+-*/eE (Scientific notation input)\n    ImGuiInputTextFlags_CallbackResize      = 1 << 18,  // Callback on buffer capacity changes request (beyond 'buf_size' parameter value), allowing the string to grow. Notify when the string wants to be resized (for string types which hold a cache of their Size). You will be provided a new BufSize in the callback and NEED to honor it. (see misc/cpp/imgui_stdlib.h for an example of using this)\n    ImGuiInputTextFlags_CallbackEdit        = 1 << 19   // Callback on any edit (note that InputText() already returns true on edit, the callback is useful mainly to manipulate the underlying buffer while focus is active)\n\n    // Obsolete names (will be removed soon)\n#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS\n    , ImGuiInputTextFlags_AlwaysInsertMode    = ImGuiInputTextFlags_AlwaysOverwrite   // [renamed in 1.82] name was not matching behavior\n#endif\n};\n\n// Flags for ImGui::TreeNodeEx(), ImGui::CollapsingHeader*()\nenum ImGuiTreeNodeFlags_\n{\n    ImGuiTreeNodeFlags_None                 = 0,\n    ImGuiTreeNodeFlags_Selected             = 1 << 0,   // Draw as selected\n    ImGuiTreeNodeFlags_Framed               = 1 << 1,   // Draw frame with background (e.g. for CollapsingHeader)\n    ImGuiTreeNodeFlags_AllowItemOverlap     = 1 << 2,   // Hit testing to allow subsequent widgets to overlap this one\n    ImGuiTreeNodeFlags_NoTreePushOnOpen     = 1 << 3,   // Don't do a TreePush() when open (e.g. for CollapsingHeader) = no extra indent nor pushing on ID stack\n    ImGuiTreeNodeFlags_NoAutoOpenOnLog      = 1 << 4,   // Don't automatically and temporarily open node when Logging is active (by default logging will automatically open tree nodes)\n    ImGuiTreeNodeFlags_DefaultOpen          = 1 << 5,   // Default node to be open\n    ImGuiTreeNodeFlags_OpenOnDoubleClick    = 1 << 6,   // Need double-click to open node\n    ImGuiTreeNodeFlags_OpenOnArrow          = 1 << 7,   // Only open when clicking on the arrow part. If ImGuiTreeNodeFlags_OpenOnDoubleClick is also set, single-click arrow or double-click all box to open.\n    ImGuiTreeNodeFlags_Leaf                 = 1 << 8,   // No collapsing, no arrow (use as a convenience for leaf nodes).\n    ImGuiTreeNodeFlags_Bullet               = 1 << 9,   // Display a bullet instead of arrow\n    ImGuiTreeNodeFlags_FramePadding         = 1 << 10,  // Use FramePadding (even for an unframed text node) to vertically align text baseline to regular widget height. Equivalent to calling AlignTextToFramePadding().\n    ImGuiTreeNodeFlags_SpanAvailWidth       = 1 << 11,  // Extend hit box to the right-most edge, even if not framed. This is not the default in order to allow adding other items on the same line. In the future we may refactor the hit system to be front-to-back, allowing natural overlaps and then this can become the default.\n    ImGuiTreeNodeFlags_SpanFullWidth        = 1 << 12,  // Extend hit box to the left-most and right-most edges (bypass the indented area).\n    ImGuiTreeNodeFlags_NavLeftJumpsBackHere = 1 << 13,  // (WIP) Nav: left direction may move to this TreeNode() from any of its child (items submitted between TreeNode and TreePop)\n    //ImGuiTreeNodeFlags_NoScrollOnOpen     = 1 << 14,  // FIXME: TODO: Disable automatic scroll on TreePop() if node got just open and contents is not visible\n    ImGuiTreeNodeFlags_CollapsingHeader     = ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_NoTreePushOnOpen | ImGuiTreeNodeFlags_NoAutoOpenOnLog\n};\n\n// Flags for OpenPopup*(), BeginPopupContext*(), IsPopupOpen() functions.\n// - To be backward compatible with older API which took an 'int mouse_button = 1' argument, we need to treat\n//   small flags values as a mouse button index, so we encode the mouse button in the first few bits of the flags.\n//   It is therefore guaranteed to be legal to pass a mouse button index in ImGuiPopupFlags.\n// - For the same reason, we exceptionally default the ImGuiPopupFlags argument of BeginPopupContextXXX functions to 1 instead of 0.\n//   IMPORTANT: because the default parameter is 1 (==ImGuiPopupFlags_MouseButtonRight), if you rely on the default parameter\n//   and want to another another flag, you need to pass in the ImGuiPopupFlags_MouseButtonRight flag.\n// - Multiple buttons currently cannot be combined/or-ed in those functions (we could allow it later).\nenum ImGuiPopupFlags_\n{\n    ImGuiPopupFlags_None                    = 0,\n    ImGuiPopupFlags_MouseButtonLeft         = 0,        // For BeginPopupContext*(): open on Left Mouse release. Guaranteed to always be == 0 (same as ImGuiMouseButton_Left)\n    ImGuiPopupFlags_MouseButtonRight        = 1,        // For BeginPopupContext*(): open on Right Mouse release. Guaranteed to always be == 1 (same as ImGuiMouseButton_Right)\n    ImGuiPopupFlags_MouseButtonMiddle       = 2,        // For BeginPopupContext*(): open on Middle Mouse release. Guaranteed to always be == 2 (same as ImGuiMouseButton_Middle)\n    ImGuiPopupFlags_MouseButtonMask_        = 0x1F,\n    ImGuiPopupFlags_MouseButtonDefault_     = 1,\n    ImGuiPopupFlags_NoOpenOverExistingPopup = 1 << 5,   // For OpenPopup*(), BeginPopupContext*(): don't open if there's already a popup at the same level of the popup stack\n    ImGuiPopupFlags_NoOpenOverItems         = 1 << 6,   // For BeginPopupContextWindow(): don't return true when hovering items, only when hovering empty space\n    ImGuiPopupFlags_AnyPopupId              = 1 << 7,   // For IsPopupOpen(): ignore the ImGuiID parameter and test for any popup.\n    ImGuiPopupFlags_AnyPopupLevel           = 1 << 8,   // For IsPopupOpen(): search/test at any level of the popup stack (default test in the current level)\n    ImGuiPopupFlags_AnyPopup                = ImGuiPopupFlags_AnyPopupId | ImGuiPopupFlags_AnyPopupLevel\n};\n\n// Flags for ImGui::Selectable()\nenum ImGuiSelectableFlags_\n{\n    ImGuiSelectableFlags_None               = 0,\n    ImGuiSelectableFlags_DontClosePopups    = 1 << 0,   // Clicking this don't close parent popup window\n    ImGuiSelectableFlags_SpanAllColumns     = 1 << 1,   // Selectable frame can span all columns (text will still fit in current column)\n    ImGuiSelectableFlags_AllowDoubleClick   = 1 << 2,   // Generate press events on double clicks too\n    ImGuiSelectableFlags_Disabled           = 1 << 3,   // Cannot be selected, display grayed out text\n    ImGuiSelectableFlags_AllowItemOverlap   = 1 << 4    // (WIP) Hit testing to allow subsequent widgets to overlap this one\n};\n\n// Flags for ImGui::BeginCombo()\nenum ImGuiComboFlags_\n{\n    ImGuiComboFlags_None                    = 0,\n    ImGuiComboFlags_PopupAlignLeft          = 1 << 0,   // Align the popup toward the left by default\n    ImGuiComboFlags_HeightSmall             = 1 << 1,   // Max ~4 items visible. Tip: If you want your combo popup to be a specific size you can use SetNextWindowSizeConstraints() prior to calling BeginCombo()\n    ImGuiComboFlags_HeightRegular           = 1 << 2,   // Max ~8 items visible (default)\n    ImGuiComboFlags_HeightLarge             = 1 << 3,   // Max ~20 items visible\n    ImGuiComboFlags_HeightLargest           = 1 << 4,   // As many fitting items as possible\n    ImGuiComboFlags_NoArrowButton           = 1 << 5,   // Display on the preview box without the square arrow button\n    ImGuiComboFlags_NoPreview               = 1 << 6,   // Display only a square arrow button\n    ImGuiComboFlags_HeightMask_             = ImGuiComboFlags_HeightSmall | ImGuiComboFlags_HeightRegular | ImGuiComboFlags_HeightLarge | ImGuiComboFlags_HeightLargest\n};\n\n// Flags for ImGui::BeginTabBar()\nenum ImGuiTabBarFlags_\n{\n    ImGuiTabBarFlags_None                           = 0,\n    ImGuiTabBarFlags_Reorderable                    = 1 << 0,   // Allow manually dragging tabs to re-order them + New tabs are appended at the end of list\n    ImGuiTabBarFlags_AutoSelectNewTabs              = 1 << 1,   // Automatically select new tabs when they appear\n    ImGuiTabBarFlags_TabListPopupButton             = 1 << 2,   // Disable buttons to open the tab list popup\n    ImGuiTabBarFlags_NoCloseWithMiddleMouseButton   = 1 << 3,   // Disable behavior of closing tabs (that are submitted with p_open != NULL) with middle mouse button. You can still repro this behavior on user's side with if (IsItemHovered() && IsMouseClicked(2)) *p_open = false.\n    ImGuiTabBarFlags_NoTabListScrollingButtons      = 1 << 4,   // Disable scrolling buttons (apply when fitting policy is ImGuiTabBarFlags_FittingPolicyScroll)\n    ImGuiTabBarFlags_NoTooltip                      = 1 << 5,   // Disable tooltips when hovering a tab\n    ImGuiTabBarFlags_FittingPolicyResizeDown        = 1 << 6,   // Resize tabs when they don't fit\n    ImGuiTabBarFlags_FittingPolicyScroll            = 1 << 7,   // Add scroll buttons when tabs don't fit\n    ImGuiTabBarFlags_FittingPolicyMask_             = ImGuiTabBarFlags_FittingPolicyResizeDown | ImGuiTabBarFlags_FittingPolicyScroll,\n    ImGuiTabBarFlags_FittingPolicyDefault_          = ImGuiTabBarFlags_FittingPolicyResizeDown\n};\n\n// Flags for ImGui::BeginTabItem()\nenum ImGuiTabItemFlags_\n{\n    ImGuiTabItemFlags_None                          = 0,\n    ImGuiTabItemFlags_UnsavedDocument               = 1 << 0,   // Display a dot next to the title + tab is selected when clicking the X + closure is not assumed (will wait for user to stop submitting the tab). Otherwise closure is assumed when pressing the X, so if you keep submitting the tab may reappear at end of tab bar.\n    ImGuiTabItemFlags_SetSelected                   = 1 << 1,   // Trigger flag to programmatically make the tab selected when calling BeginTabItem()\n    ImGuiTabItemFlags_NoCloseWithMiddleMouseButton  = 1 << 2,   // Disable behavior of closing tabs (that are submitted with p_open != NULL) with middle mouse button. You can still repro this behavior on user's side with if (IsItemHovered() && IsMouseClicked(2)) *p_open = false.\n    ImGuiTabItemFlags_NoPushId                      = 1 << 3,   // Don't call PushID(tab->ID)/PopID() on BeginTabItem()/EndTabItem()\n    ImGuiTabItemFlags_NoTooltip                     = 1 << 4,   // Disable tooltip for the given tab\n    ImGuiTabItemFlags_NoReorder                     = 1 << 5,   // Disable reordering this tab or having another tab cross over this tab\n    ImGuiTabItemFlags_Leading                       = 1 << 6,   // Enforce the tab position to the left of the tab bar (after the tab list popup button)\n    ImGuiTabItemFlags_Trailing                      = 1 << 7    // Enforce the tab position to the right of the tab bar (before the scrolling buttons)\n};\n\n// Flags for ImGui::BeginTable()\n// [BETA API] API may evolve slightly! If you use this, please update to the next version when it comes out!\n// - Important! Sizing policies have complex and subtle side effects, more so than you would expect.\n//   Read comments/demos carefully + experiment with live demos to get acquainted with them.\n// - The DEFAULT sizing policies are:\n//    - Default to ImGuiTableFlags_SizingFixedFit    if ScrollX is on, or if host window has ImGuiWindowFlags_AlwaysAutoResize.\n//    - Default to ImGuiTableFlags_SizingStretchSame if ScrollX is off.\n// - When ScrollX is off:\n//    - Table defaults to ImGuiTableFlags_SizingStretchSame -> all Columns defaults to ImGuiTableColumnFlags_WidthStretch with same weight.\n//    - Columns sizing policy allowed: Stretch (default), Fixed/Auto.\n//    - Fixed Columns will generally obtain their requested width (unless the table cannot fit them all).\n//    - Stretch Columns will share the remaining width.\n//    - Mixed Fixed/Stretch columns is possible but has various side-effects on resizing behaviors.\n//      The typical use of mixing sizing policies is: any number of LEADING Fixed columns, followed by one or two TRAILING Stretch columns.\n//      (this is because the visible order of columns have subtle but necessary effects on how they react to manual resizing).\n// - When ScrollX is on:\n//    - Table defaults to ImGuiTableFlags_SizingFixedFit -> all Columns defaults to ImGuiTableColumnFlags_WidthFixed\n//    - Columns sizing policy allowed: Fixed/Auto mostly.\n//    - Fixed Columns can be enlarged as needed. Table will show an horizontal scrollbar if needed.\n//    - When using auto-resizing (non-resizable) fixed columns, querying the content width to use item right-alignment e.g. SetNextItemWidth(-FLT_MIN) doesn't make sense, would create a feedback loop.\n//    - Using Stretch columns OFTEN DOES NOT MAKE SENSE if ScrollX is on, UNLESS you have specified a value for 'inner_width' in BeginTable().\n//      If you specify a value for 'inner_width' then effectively the scrolling space is known and Stretch or mixed Fixed/Stretch columns become meaningful again.\n// - Read on documentation at the top of imgui_tables.cpp for details.\nenum ImGuiTableFlags_\n{\n    // Features\n    ImGuiTableFlags_None                       = 0,\n    ImGuiTableFlags_Resizable                  = 1 << 0,   // Enable resizing columns.\n    ImGuiTableFlags_Reorderable                = 1 << 1,   // Enable reordering columns in header row (need calling TableSetupColumn() + TableHeadersRow() to display headers)\n    ImGuiTableFlags_Hideable                   = 1 << 2,   // Enable hiding/disabling columns in context menu.\n    ImGuiTableFlags_Sortable                   = 1 << 3,   // Enable sorting. Call TableGetSortSpecs() to obtain sort specs. Also see ImGuiTableFlags_SortMulti and ImGuiTableFlags_SortTristate.\n    ImGuiTableFlags_NoSavedSettings            = 1 << 4,   // Disable persisting columns order, width and sort settings in the .ini file.\n    ImGuiTableFlags_ContextMenuInBody          = 1 << 5,   // Right-click on columns body/contents will display table context menu. By default it is available in TableHeadersRow().\n    // Decorations\n    ImGuiTableFlags_RowBg                      = 1 << 6,   // Set each RowBg color with ImGuiCol_TableRowBg or ImGuiCol_TableRowBgAlt (equivalent of calling TableSetBgColor with ImGuiTableBgFlags_RowBg0 on each row manually)\n    ImGuiTableFlags_BordersInnerH              = 1 << 7,   // Draw horizontal borders between rows.\n    ImGuiTableFlags_BordersOuterH              = 1 << 8,   // Draw horizontal borders at the top and bottom.\n    ImGuiTableFlags_BordersInnerV              = 1 << 9,   // Draw vertical borders between columns.\n    ImGuiTableFlags_BordersOuterV              = 1 << 10,  // Draw vertical borders on the left and right sides.\n    ImGuiTableFlags_BordersH                   = ImGuiTableFlags_BordersInnerH | ImGuiTableFlags_BordersOuterH, // Draw horizontal borders.\n    ImGuiTableFlags_BordersV                   = ImGuiTableFlags_BordersInnerV | ImGuiTableFlags_BordersOuterV, // Draw vertical borders.\n    ImGuiTableFlags_BordersInner               = ImGuiTableFlags_BordersInnerV | ImGuiTableFlags_BordersInnerH, // Draw inner borders.\n    ImGuiTableFlags_BordersOuter               = ImGuiTableFlags_BordersOuterV | ImGuiTableFlags_BordersOuterH, // Draw outer borders.\n    ImGuiTableFlags_Borders                    = ImGuiTableFlags_BordersInner | ImGuiTableFlags_BordersOuter,   // Draw all borders.\n    ImGuiTableFlags_NoBordersInBody            = 1 << 11,  // [ALPHA] Disable vertical borders in columns Body (borders will always appears in Headers). -> May move to style\n    ImGuiTableFlags_NoBordersInBodyUntilResize = 1 << 12,  // [ALPHA] Disable vertical borders in columns Body until hovered for resize (borders will always appears in Headers). -> May move to style\n    // Sizing Policy (read above for defaults)\n    ImGuiTableFlags_SizingFixedFit             = 1 << 13,  // Columns default to _WidthFixed or _WidthAuto (if resizable or not resizable), matching contents width.\n    ImGuiTableFlags_SizingFixedSame            = 2 << 13,  // Columns default to _WidthFixed or _WidthAuto (if resizable or not resizable), matching the maximum contents width of all columns. Implicitly enable ImGuiTableFlags_NoKeepColumnsVisible.\n    ImGuiTableFlags_SizingStretchProp          = 3 << 13,  // Columns default to _WidthStretch with default weights proportional to each columns contents widths.\n    ImGuiTableFlags_SizingStretchSame          = 4 << 13,  // Columns default to _WidthStretch with default weights all equal, unless overridden by TableSetupColumn().\n    // Sizing Extra Options\n    ImGuiTableFlags_NoHostExtendX              = 1 << 16,  // Make outer width auto-fit to columns, overriding outer_size.x value. Only available when ScrollX/ScrollY are disabled and Stretch columns are not used.\n    ImGuiTableFlags_NoHostExtendY              = 1 << 17,  // Make outer height stop exactly at outer_size.y (prevent auto-extending table past the limit). Only available when ScrollX/ScrollY are disabled. Data below the limit will be clipped and not visible.\n    ImGuiTableFlags_NoKeepColumnsVisible       = 1 << 18,  // Disable keeping column always minimally visible when ScrollX is off and table gets too small. Not recommended if columns are resizable.\n    ImGuiTableFlags_PreciseWidths              = 1 << 19,  // Disable distributing remainder width to stretched columns (width allocation on a 100-wide table with 3 columns: Without this flag: 33,33,34. With this flag: 33,33,33). With larger number of columns, resizing will appear to be less smooth.\n    // Clipping\n    ImGuiTableFlags_NoClip                     = 1 << 20,  // Disable clipping rectangle for every individual columns (reduce draw command count, items will be able to overflow into other columns). Generally incompatible with TableSetupScrollFreeze().\n    // Padding\n    ImGuiTableFlags_PadOuterX                  = 1 << 21,  // Default if BordersOuterV is on. Enable outer-most padding. Generally desirable if you have headers.\n    ImGuiTableFlags_NoPadOuterX                = 1 << 22,  // Default if BordersOuterV is off. Disable outer-most padding.\n    ImGuiTableFlags_NoPadInnerX                = 1 << 23,  // Disable inner padding between columns (double inner padding if BordersOuterV is on, single inner padding if BordersOuterV is off).\n    // Scrolling\n    ImGuiTableFlags_ScrollX                    = 1 << 24,  // Enable horizontal scrolling. Require 'outer_size' parameter of BeginTable() to specify the container size. Changes default sizing policy. Because this create a child window, ScrollY is currently generally recommended when using ScrollX.\n    ImGuiTableFlags_ScrollY                    = 1 << 25,  // Enable vertical scrolling. Require 'outer_size' parameter of BeginTable() to specify the container size.\n    // Sorting\n    ImGuiTableFlags_SortMulti                  = 1 << 26,  // Hold shift when clicking headers to sort on multiple column. TableGetSortSpecs() may return specs where (SpecsCount > 1).\n    ImGuiTableFlags_SortTristate               = 1 << 27,  // Allow no sorting, disable default sorting. TableGetSortSpecs() may return specs where (SpecsCount == 0).\n\n    // [Internal] Combinations and masks\n    ImGuiTableFlags_SizingMask_                = ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_SizingFixedSame | ImGuiTableFlags_SizingStretchProp | ImGuiTableFlags_SizingStretchSame\n\n    // Obsolete names (will be removed soon)\n#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS\n    //, ImGuiTableFlags_ColumnsWidthFixed = ImGuiTableFlags_SizingFixedFit, ImGuiTableFlags_ColumnsWidthStretch = ImGuiTableFlags_SizingStretchSame   // WIP Tables 2020/12\n    //, ImGuiTableFlags_SizingPolicyFixed = ImGuiTableFlags_SizingFixedFit, ImGuiTableFlags_SizingPolicyStretch = ImGuiTableFlags_SizingStretchSame   // WIP Tables 2021/01\n#endif\n};\n\n// Flags for ImGui::TableSetupColumn()\nenum ImGuiTableColumnFlags_\n{\n    // Input configuration flags\n    ImGuiTableColumnFlags_None                  = 0,\n    ImGuiTableColumnFlags_Disabled              = 1 << 0,   // Overriding/master disable flag: hide column, won't show in context menu (unlike calling TableSetColumnEnabled() which manipulates the user accessible state)\n    ImGuiTableColumnFlags_DefaultHide           = 1 << 1,   // Default as a hidden/disabled column.\n    ImGuiTableColumnFlags_DefaultSort           = 1 << 2,   // Default as a sorting column.\n    ImGuiTableColumnFlags_WidthStretch          = 1 << 3,   // Column will stretch. Preferable with horizontal scrolling disabled (default if table sizing policy is _SizingStretchSame or _SizingStretchProp).\n    ImGuiTableColumnFlags_WidthFixed            = 1 << 4,   // Column will not stretch. Preferable with horizontal scrolling enabled (default if table sizing policy is _SizingFixedFit and table is resizable).\n    ImGuiTableColumnFlags_NoResize              = 1 << 5,   // Disable manual resizing.\n    ImGuiTableColumnFlags_NoReorder             = 1 << 6,   // Disable manual reordering this column, this will also prevent other columns from crossing over this column.\n    ImGuiTableColumnFlags_NoHide                = 1 << 7,   // Disable ability to hide/disable this column.\n    ImGuiTableColumnFlags_NoClip                = 1 << 8,   // Disable clipping for this column (all NoClip columns will render in a same draw command).\n    ImGuiTableColumnFlags_NoSort                = 1 << 9,   // Disable ability to sort on this field (even if ImGuiTableFlags_Sortable is set on the table).\n    ImGuiTableColumnFlags_NoSortAscending       = 1 << 10,  // Disable ability to sort in the ascending direction.\n    ImGuiTableColumnFlags_NoSortDescending      = 1 << 11,  // Disable ability to sort in the descending direction.\n    ImGuiTableColumnFlags_NoHeaderLabel         = 1 << 12,  // TableHeadersRow() will not submit label for this column. Convenient for some small columns. Name will still appear in context menu.\n    ImGuiTableColumnFlags_NoHeaderWidth         = 1 << 13,  // Disable header text width contribution to automatic column width.\n    ImGuiTableColumnFlags_PreferSortAscending   = 1 << 14,  // Make the initial sort direction Ascending when first sorting on this column (default).\n    ImGuiTableColumnFlags_PreferSortDescending  = 1 << 15,  // Make the initial sort direction Descending when first sorting on this column.\n    ImGuiTableColumnFlags_IndentEnable          = 1 << 16,  // Use current Indent value when entering cell (default for column 0).\n    ImGuiTableColumnFlags_IndentDisable         = 1 << 17,  // Ignore current Indent value when entering cell (default for columns > 0). Indentation changes _within_ the cell will still be honored.\n\n    // Output status flags, read-only via TableGetColumnFlags()\n    ImGuiTableColumnFlags_IsEnabled             = 1 << 24,  // Status: is enabled == not hidden by user/api (referred to as \"Hide\" in _DefaultHide and _NoHide) flags.\n    ImGuiTableColumnFlags_IsVisible             = 1 << 25,  // Status: is visible == is enabled AND not clipped by scrolling.\n    ImGuiTableColumnFlags_IsSorted              = 1 << 26,  // Status: is currently part of the sort specs\n    ImGuiTableColumnFlags_IsHovered             = 1 << 27,  // Status: is hovered by mouse\n\n    // [Internal] Combinations and masks\n    ImGuiTableColumnFlags_WidthMask_            = ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_WidthFixed,\n    ImGuiTableColumnFlags_IndentMask_           = ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_IndentDisable,\n    ImGuiTableColumnFlags_StatusMask_           = ImGuiTableColumnFlags_IsEnabled | ImGuiTableColumnFlags_IsVisible | ImGuiTableColumnFlags_IsSorted | ImGuiTableColumnFlags_IsHovered,\n    ImGuiTableColumnFlags_NoDirectResize_       = 1 << 30   // [Internal] Disable user resizing this column directly (it may however we resized indirectly from its left edge)\n\n    // Obsolete names (will be removed soon)\n#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS\n    //ImGuiTableColumnFlags_WidthAuto           = ImGuiTableColumnFlags_WidthFixed | ImGuiTableColumnFlags_NoResize, // Column will not stretch and keep resizing based on submitted contents.\n#endif\n};\n\n// Flags for ImGui::TableNextRow()\nenum ImGuiTableRowFlags_\n{\n    ImGuiTableRowFlags_None                         = 0,\n    ImGuiTableRowFlags_Headers                      = 1 << 0    // Identify header row (set default background color + width of its contents accounted different for auto column width)\n};\n\n// Enum for ImGui::TableSetBgColor()\n// Background colors are rendering in 3 layers:\n//  - Layer 0: draw with RowBg0 color if set, otherwise draw with ColumnBg0 if set.\n//  - Layer 1: draw with RowBg1 color if set, otherwise draw with ColumnBg1 if set.\n//  - Layer 2: draw with CellBg color if set.\n// The purpose of the two row/columns layers is to let you decide if a background color changes should override or blend with the existing color.\n// When using ImGuiTableFlags_RowBg on the table, each row has the RowBg0 color automatically set for odd/even rows.\n// If you set the color of RowBg0 target, your color will override the existing RowBg0 color.\n// If you set the color of RowBg1 or ColumnBg1 target, your color will blend over the RowBg0 color.\nenum ImGuiTableBgTarget_\n{\n    ImGuiTableBgTarget_None                         = 0,\n    ImGuiTableBgTarget_RowBg0                       = 1,        // Set row background color 0 (generally used for background, automatically set when ImGuiTableFlags_RowBg is used)\n    ImGuiTableBgTarget_RowBg1                       = 2,        // Set row background color 1 (generally used for selection marking)\n    ImGuiTableBgTarget_CellBg                       = 3         // Set cell background color (top-most color)\n};\n\n// Flags for ImGui::IsWindowFocused()\nenum ImGuiFocusedFlags_\n{\n    ImGuiFocusedFlags_None                          = 0,\n    ImGuiFocusedFlags_ChildWindows                  = 1 << 0,   // IsWindowFocused(): Return true if any children of the window is focused\n    ImGuiFocusedFlags_RootWindow                    = 1 << 1,   // IsWindowFocused(): Test from root window (top most parent of the current hierarchy)\n    ImGuiFocusedFlags_AnyWindow                     = 1 << 2,   // IsWindowFocused(): Return true if any window is focused. Important: If you are trying to tell how to dispatch your low-level inputs, do NOT use this. Use 'io.WantCaptureMouse' instead! Please read the FAQ!\n    ImGuiFocusedFlags_RootAndChildWindows           = ImGuiFocusedFlags_RootWindow | ImGuiFocusedFlags_ChildWindows\n};\n\n// Flags for ImGui::IsItemHovered(), ImGui::IsWindowHovered()\n// Note: if you are trying to check whether your mouse should be dispatched to Dear ImGui or to your app, you should use 'io.WantCaptureMouse' instead! Please read the FAQ!\n// Note: windows with the ImGuiWindowFlags_NoInputs flag are ignored by IsWindowHovered() calls.\nenum ImGuiHoveredFlags_\n{\n    ImGuiHoveredFlags_None                          = 0,        // Return true if directly over the item/window, not obstructed by another window, not obstructed by an active popup or modal blocking inputs under them.\n    ImGuiHoveredFlags_ChildWindows                  = 1 << 0,   // IsWindowHovered() only: Return true if any children of the window is hovered\n    ImGuiHoveredFlags_RootWindow                    = 1 << 1,   // IsWindowHovered() only: Test from root window (top most parent of the current hierarchy)\n    ImGuiHoveredFlags_AnyWindow                     = 1 << 2,   // IsWindowHovered() only: Return true if any window is hovered\n    ImGuiHoveredFlags_AllowWhenBlockedByPopup       = 1 << 3,   // Return true even if a popup window is normally blocking access to this item/window\n    //ImGuiHoveredFlags_AllowWhenBlockedByModal     = 1 << 4,   // Return true even if a modal popup window is normally blocking access to this item/window. FIXME-TODO: Unavailable yet.\n    ImGuiHoveredFlags_AllowWhenBlockedByActiveItem  = 1 << 5,   // Return true even if an active item is blocking access to this item/window. Useful for Drag and Drop patterns.\n    ImGuiHoveredFlags_AllowWhenOverlapped           = 1 << 6,   // Return true even if the position is obstructed or overlapped by another window\n    ImGuiHoveredFlags_AllowWhenDisabled             = 1 << 7,   // Return true even if the item is disabled\n    ImGuiHoveredFlags_RectOnly                      = ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem | ImGuiHoveredFlags_AllowWhenOverlapped,\n    ImGuiHoveredFlags_RootAndChildWindows           = ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows\n};\n\n// Flags for ImGui::BeginDragDropSource(), ImGui::AcceptDragDropPayload()\nenum ImGuiDragDropFlags_\n{\n    ImGuiDragDropFlags_None                         = 0,\n    // BeginDragDropSource() flags\n    ImGuiDragDropFlags_SourceNoPreviewTooltip       = 1 << 0,   // By default, a successful call to BeginDragDropSource opens a tooltip so you can display a preview or description of the source contents. This flag disable this behavior.\n    ImGuiDragDropFlags_SourceNoDisableHover         = 1 << 1,   // By default, when dragging we clear data so that IsItemHovered() will return false, to avoid subsequent user code submitting tooltips. This flag disable this behavior so you can still call IsItemHovered() on the source item.\n    ImGuiDragDropFlags_SourceNoHoldToOpenOthers     = 1 << 2,   // Disable the behavior that allows to open tree nodes and collapsing header by holding over them while dragging a source item.\n    ImGuiDragDropFlags_SourceAllowNullID            = 1 << 3,   // Allow items such as Text(), Image() that have no unique identifier to be used as drag source, by manufacturing a temporary identifier based on their window-relative position. This is extremely unusual within the dear imgui ecosystem and so we made it explicit.\n    ImGuiDragDropFlags_SourceExtern                 = 1 << 4,   // External source (from outside of dear imgui), won't attempt to read current item/window info. Will always return true. Only one Extern source can be active simultaneously.\n    ImGuiDragDropFlags_SourceAutoExpirePayload      = 1 << 5,   // Automatically expire the payload if the source cease to be submitted (otherwise payloads are persisting while being dragged)\n    // AcceptDragDropPayload() flags\n    ImGuiDragDropFlags_AcceptBeforeDelivery         = 1 << 10,  // AcceptDragDropPayload() will returns true even before the mouse button is released. You can then call IsDelivery() to test if the payload needs to be delivered.\n    ImGuiDragDropFlags_AcceptNoDrawDefaultRect      = 1 << 11,  // Do not draw the default highlight rectangle when hovering over target.\n    ImGuiDragDropFlags_AcceptNoPreviewTooltip       = 1 << 12,  // Request hiding the BeginDragDropSource tooltip from the BeginDragDropTarget site.\n    ImGuiDragDropFlags_AcceptPeekOnly               = ImGuiDragDropFlags_AcceptBeforeDelivery | ImGuiDragDropFlags_AcceptNoDrawDefaultRect  // For peeking ahead and inspecting the payload before delivery.\n};\n\n// Standard Drag and Drop payload types. You can define you own payload types using short strings. Types starting with '_' are defined by Dear ImGui.\n#define IMGUI_PAYLOAD_TYPE_COLOR_3F     \"_COL3F\"    // float[3]: Standard type for colors, without alpha. User code may use this type.\n#define IMGUI_PAYLOAD_TYPE_COLOR_4F     \"_COL4F\"    // float[4]: Standard type for colors. User code may use this type.\n\n// A primary data type\nenum ImGuiDataType_\n{\n    ImGuiDataType_S8,       // signed char / char (with sensible compilers)\n    ImGuiDataType_U8,       // unsigned char\n    ImGuiDataType_S16,      // short\n    ImGuiDataType_U16,      // unsigned short\n    ImGuiDataType_S32,      // int\n    ImGuiDataType_U32,      // unsigned int\n    ImGuiDataType_S64,      // long long / __int64\n    ImGuiDataType_U64,      // unsigned long long / unsigned __int64\n    ImGuiDataType_Float,    // float\n    ImGuiDataType_Double,   // double\n    ImGuiDataType_COUNT\n};\n\n// A cardinal direction\nenum ImGuiDir_\n{\n    ImGuiDir_None    = -1,\n    ImGuiDir_Left    = 0,\n    ImGuiDir_Right   = 1,\n    ImGuiDir_Up      = 2,\n    ImGuiDir_Down    = 3,\n    ImGuiDir_COUNT\n};\n\n// A sorting direction\nenum ImGuiSortDirection_\n{\n    ImGuiSortDirection_None         = 0,\n    ImGuiSortDirection_Ascending    = 1,    // Ascending = 0->9, A->Z etc.\n    ImGuiSortDirection_Descending   = 2     // Descending = 9->0, Z->A etc.\n};\n\n// User fill ImGuiIO.KeyMap[] array with indices into the ImGuiIO.KeysDown[512] array\nenum ImGuiKey_\n{\n    ImGuiKey_Tab,\n    ImGuiKey_LeftArrow,\n    ImGuiKey_RightArrow,\n    ImGuiKey_UpArrow,\n    ImGuiKey_DownArrow,\n    ImGuiKey_PageUp,\n    ImGuiKey_PageDown,\n    ImGuiKey_Home,\n    ImGuiKey_End,\n    ImGuiKey_Insert,\n    ImGuiKey_Delete,\n    ImGuiKey_Backspace,\n    ImGuiKey_Space,\n    ImGuiKey_Enter,\n    ImGuiKey_Escape,\n    ImGuiKey_KeyPadEnter,\n    ImGuiKey_A,                 // for text edit CTRL+A: select all\n    ImGuiKey_C,                 // for text edit CTRL+C: copy\n    ImGuiKey_V,                 // for text edit CTRL+V: paste\n    ImGuiKey_X,                 // for text edit CTRL+X: cut\n    ImGuiKey_Y,                 // for text edit CTRL+Y: redo\n    ImGuiKey_Z,                 // for text edit CTRL+Z: undo\n    ImGuiKey_COUNT\n};\n\n// To test io.KeyMods (which is a combination of individual fields io.KeyCtrl, io.KeyShift, io.KeyAlt set by user/backend)\nenum ImGuiKeyModFlags_\n{\n    ImGuiKeyModFlags_None       = 0,\n    ImGuiKeyModFlags_Ctrl       = 1 << 0,\n    ImGuiKeyModFlags_Shift      = 1 << 1,\n    ImGuiKeyModFlags_Alt        = 1 << 2,\n    ImGuiKeyModFlags_Super      = 1 << 3\n};\n\n// Gamepad/Keyboard navigation\n// Keyboard: Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard to enable. NewFrame() will automatically fill io.NavInputs[] based on your io.KeysDown[] + io.KeyMap[] arrays.\n// Gamepad:  Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad to enable. Backend: set ImGuiBackendFlags_HasGamepad and fill the io.NavInputs[] fields before calling NewFrame(). Note that io.NavInputs[] is cleared by EndFrame().\n// Read instructions in imgui.cpp for more details. Download PNG/PSD at http://dearimgui.org/controls_sheets.\nenum ImGuiNavInput_\n{\n    // Gamepad Mapping\n    ImGuiNavInput_Activate,      // activate / open / toggle / tweak value       // e.g. Cross  (PS4), A (Xbox), A (Switch), Space (Keyboard)\n    ImGuiNavInput_Cancel,        // cancel / close / exit                        // e.g. Circle (PS4), B (Xbox), B (Switch), Escape (Keyboard)\n    ImGuiNavInput_Input,         // text input / on-screen keyboard              // e.g. Triang.(PS4), Y (Xbox), X (Switch), Return (Keyboard)\n    ImGuiNavInput_Menu,          // tap: toggle menu / hold: focus, move, resize // e.g. Square (PS4), X (Xbox), Y (Switch), Alt (Keyboard)\n    ImGuiNavInput_DpadLeft,      // move / tweak / resize window (w/ PadMenu)    // e.g. D-pad Left/Right/Up/Down (Gamepads), Arrow keys (Keyboard)\n    ImGuiNavInput_DpadRight,     //\n    ImGuiNavInput_DpadUp,        //\n    ImGuiNavInput_DpadDown,      //\n    ImGuiNavInput_LStickLeft,    // scroll / move window (w/ PadMenu)            // e.g. Left Analog Stick Left/Right/Up/Down\n    ImGuiNavInput_LStickRight,   //\n    ImGuiNavInput_LStickUp,      //\n    ImGuiNavInput_LStickDown,    //\n    ImGuiNavInput_FocusPrev,     // next window (w/ PadMenu)                     // e.g. L1 or L2 (PS4), LB or LT (Xbox), L or ZL (Switch)\n    ImGuiNavInput_FocusNext,     // prev window (w/ PadMenu)                     // e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch)\n    ImGuiNavInput_TweakSlow,     // slower tweaks                                // e.g. L1 or L2 (PS4), LB or LT (Xbox), L or ZL (Switch)\n    ImGuiNavInput_TweakFast,     // faster tweaks                                // e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch)\n\n    // [Internal] Don't use directly! This is used internally to differentiate keyboard from gamepad inputs for behaviors that require to differentiate them.\n    // Keyboard behavior that have no corresponding gamepad mapping (e.g. CTRL+TAB) will be directly reading from io.KeysDown[] instead of io.NavInputs[].\n    ImGuiNavInput_KeyLeft_,      // move left                                    // = Arrow keys\n    ImGuiNavInput_KeyRight_,     // move right\n    ImGuiNavInput_KeyUp_,        // move up\n    ImGuiNavInput_KeyDown_,      // move down\n    ImGuiNavInput_COUNT,\n    ImGuiNavInput_InternalStart_ = ImGuiNavInput_KeyLeft_\n};\n\n// Configuration flags stored in io.ConfigFlags. Set by user/application.\nenum ImGuiConfigFlags_\n{\n    ImGuiConfigFlags_None                   = 0,\n    ImGuiConfigFlags_NavEnableKeyboard      = 1 << 0,   // Master keyboard navigation enable flag. NewFrame() will automatically fill io.NavInputs[] based on io.KeysDown[].\n    ImGuiConfigFlags_NavEnableGamepad       = 1 << 1,   // Master gamepad navigation enable flag. This is mostly to instruct your imgui backend to fill io.NavInputs[]. Backend also needs to set ImGuiBackendFlags_HasGamepad.\n    ImGuiConfigFlags_NavEnableSetMousePos   = 1 << 2,   // Instruct navigation to move the mouse cursor. May be useful on TV/console systems where moving a virtual mouse is awkward. Will update io.MousePos and set io.WantSetMousePos=true. If enabled you MUST honor io.WantSetMousePos requests in your backend, otherwise ImGui will react as if the mouse is jumping around back and forth.\n    ImGuiConfigFlags_NavNoCaptureKeyboard   = 1 << 3,   // Instruct navigation to not set the io.WantCaptureKeyboard flag when io.NavActive is set.\n    ImGuiConfigFlags_NoMouse                = 1 << 4,   // Instruct imgui to clear mouse position/buttons in NewFrame(). This allows ignoring the mouse information set by the backend.\n    ImGuiConfigFlags_NoMouseCursorChange    = 1 << 5,   // Instruct backend to not alter mouse cursor shape and visibility. Use if the backend cursor changes are interfering with yours and you don't want to use SetMouseCursor() to change mouse cursor. You may want to honor requests from imgui by reading GetMouseCursor() yourself instead.\n\n    // User storage (to allow your backend/engine to communicate to code that may be shared between multiple projects. Those flags are not used by core Dear ImGui)\n    ImGuiConfigFlags_IsSRGB                 = 1 << 20,  // Application is SRGB-aware.\n    ImGuiConfigFlags_IsTouchScreen          = 1 << 21   // Application is using a touch screen instead of a mouse.\n};\n\n// Backend capabilities flags stored in io.BackendFlags. Set by imgui_impl_xxx or custom backend.\nenum ImGuiBackendFlags_\n{\n    ImGuiBackendFlags_None                  = 0,\n    ImGuiBackendFlags_HasGamepad            = 1 << 0,   // Backend Platform supports gamepad and currently has one connected.\n    ImGuiBackendFlags_HasMouseCursors       = 1 << 1,   // Backend Platform supports honoring GetMouseCursor() value to change the OS cursor shape.\n    ImGuiBackendFlags_HasSetMousePos        = 1 << 2,   // Backend Platform supports io.WantSetMousePos requests to reposition the OS mouse position (only used if ImGuiConfigFlags_NavEnableSetMousePos is set).\n    ImGuiBackendFlags_RendererHasVtxOffset  = 1 << 3    // Backend Renderer supports ImDrawCmd::VtxOffset. This enables output of large meshes (64K+ vertices) while still using 16-bit indices.\n};\n\n// Enumeration for PushStyleColor() / PopStyleColor()\nenum ImGuiCol_\n{\n    ImGuiCol_Text,\n    ImGuiCol_TextDisabled,\n    ImGuiCol_WindowBg,              // Background of normal windows\n    ImGuiCol_ChildBg,               // Background of child windows\n    ImGuiCol_PopupBg,               // Background of popups, menus, tooltips windows\n    ImGuiCol_Border,\n    ImGuiCol_BorderShadow,\n    ImGuiCol_FrameBg,               // Background of checkbox, radio button, plot, slider, text input\n    ImGuiCol_FrameBgHovered,\n    ImGuiCol_FrameBgActive,\n    ImGuiCol_TitleBg,\n    ImGuiCol_TitleBgActive,\n    ImGuiCol_TitleBgCollapsed,\n    ImGuiCol_MenuBarBg,\n    ImGuiCol_ScrollbarBg,\n    ImGuiCol_ScrollbarGrab,\n    ImGuiCol_ScrollbarGrabHovered,\n    ImGuiCol_ScrollbarGrabActive,\n    ImGuiCol_CheckMark,\n    ImGuiCol_SliderGrab,\n    ImGuiCol_SliderGrabActive,\n    ImGuiCol_Button,\n    ImGuiCol_ButtonHovered,\n    ImGuiCol_ButtonActive,\n    ImGuiCol_Header,                // Header* colors are used for CollapsingHeader, TreeNode, Selectable, MenuItem\n    ImGuiCol_HeaderHovered,\n    ImGuiCol_HeaderActive,\n    ImGuiCol_Separator,\n    ImGuiCol_SeparatorHovered,\n    ImGuiCol_SeparatorActive,\n    ImGuiCol_ResizeGrip,\n    ImGuiCol_ResizeGripHovered,\n    ImGuiCol_ResizeGripActive,\n    ImGuiCol_Tab,\n    ImGuiCol_TabHovered,\n    ImGuiCol_TabActive,\n    ImGuiCol_TabUnfocused,\n    ImGuiCol_TabUnfocusedActive,\n    ImGuiCol_PlotLines,\n    ImGuiCol_PlotLinesHovered,\n    ImGuiCol_PlotHistogram,\n    ImGuiCol_PlotHistogramHovered,\n    ImGuiCol_TableHeaderBg,         // Table header background\n    ImGuiCol_TableBorderStrong,     // Table outer and header borders (prefer using Alpha=1.0 here)\n    ImGuiCol_TableBorderLight,      // Table inner borders (prefer using Alpha=1.0 here)\n    ImGuiCol_TableRowBg,            // Table row background (even rows)\n    ImGuiCol_TableRowBgAlt,         // Table row background (odd rows)\n    ImGuiCol_TextSelectedBg,\n    ImGuiCol_DragDropTarget,\n    ImGuiCol_NavHighlight,          // Gamepad/keyboard: current highlighted item\n    ImGuiCol_NavWindowingHighlight, // Highlight window when using CTRL+TAB\n    ImGuiCol_NavWindowingDimBg,     // Darken/colorize entire screen behind the CTRL+TAB window list, when active\n    ImGuiCol_ModalWindowDimBg,      // Darken/colorize entire screen behind a modal window, when one is active\n    ImGuiCol_COUNT\n};\n\n// Enumeration for PushStyleVar() / PopStyleVar() to temporarily modify the ImGuiStyle structure.\n// - The enum only refers to fields of ImGuiStyle which makes sense to be pushed/popped inside UI code.\n//   During initialization or between frames, feel free to just poke into ImGuiStyle directly.\n// - Tip: Use your programming IDE navigation facilities on the names in the _second column_ below to find the actual members and their description.\n//   In Visual Studio IDE: CTRL+comma (\"Edit.NavigateTo\") can follow symbols in comments, whereas CTRL+F12 (\"Edit.GoToImplementation\") cannot.\n//   With Visual Assist installed: ALT+G (\"VAssistX.GoToImplementation\") can also follow symbols in comments.\n// - When changing this enum, you need to update the associated internal table GStyleVarInfo[] accordingly. This is where we link enum values to members offset/type.\nenum ImGuiStyleVar_\n{\n    // Enum name --------------------- // Member in ImGuiStyle structure (see ImGuiStyle for descriptions)\n    ImGuiStyleVar_Alpha,               // float     Alpha\n    ImGuiStyleVar_DisabledAlpha,       // float     DisabledAlpha\n    ImGuiStyleVar_WindowPadding,       // ImVec2    WindowPadding\n    ImGuiStyleVar_WindowRounding,      // float     WindowRounding\n    ImGuiStyleVar_WindowBorderSize,    // float     WindowBorderSize\n    ImGuiStyleVar_WindowMinSize,       // ImVec2    WindowMinSize\n    ImGuiStyleVar_WindowTitleAlign,    // ImVec2    WindowTitleAlign\n    ImGuiStyleVar_ChildRounding,       // float     ChildRounding\n    ImGuiStyleVar_ChildBorderSize,     // float     ChildBorderSize\n    ImGuiStyleVar_PopupRounding,       // float     PopupRounding\n    ImGuiStyleVar_PopupBorderSize,     // float     PopupBorderSize\n    ImGuiStyleVar_FramePadding,        // ImVec2    FramePadding\n    ImGuiStyleVar_FrameRounding,       // float     FrameRounding\n    ImGuiStyleVar_FrameBorderSize,     // float     FrameBorderSize\n    ImGuiStyleVar_ItemSpacing,         // ImVec2    ItemSpacing\n    ImGuiStyleVar_ItemInnerSpacing,    // ImVec2    ItemInnerSpacing\n    ImGuiStyleVar_IndentSpacing,       // float     IndentSpacing\n    ImGuiStyleVar_CellPadding,         // ImVec2    CellPadding\n    ImGuiStyleVar_ScrollbarSize,       // float     ScrollbarSize\n    ImGuiStyleVar_ScrollbarRounding,   // float     ScrollbarRounding\n    ImGuiStyleVar_GrabMinSize,         // float     GrabMinSize\n    ImGuiStyleVar_GrabRounding,        // float     GrabRounding\n    ImGuiStyleVar_TabRounding,         // float     TabRounding\n    ImGuiStyleVar_ButtonTextAlign,     // ImVec2    ButtonTextAlign\n    ImGuiStyleVar_SelectableTextAlign, // ImVec2    SelectableTextAlign\n    ImGuiStyleVar_COUNT\n};\n\n// Flags for InvisibleButton() [extended in imgui_internal.h]\nenum ImGuiButtonFlags_\n{\n    ImGuiButtonFlags_None                   = 0,\n    ImGuiButtonFlags_MouseButtonLeft        = 1 << 0,   // React on left mouse button (default)\n    ImGuiButtonFlags_MouseButtonRight       = 1 << 1,   // React on right mouse button\n    ImGuiButtonFlags_MouseButtonMiddle      = 1 << 2,   // React on center mouse button\n\n    // [Internal]\n    ImGuiButtonFlags_MouseButtonMask_       = ImGuiButtonFlags_MouseButtonLeft | ImGuiButtonFlags_MouseButtonRight | ImGuiButtonFlags_MouseButtonMiddle,\n    ImGuiButtonFlags_MouseButtonDefault_    = ImGuiButtonFlags_MouseButtonLeft\n};\n\n// Flags for ColorEdit3() / ColorEdit4() / ColorPicker3() / ColorPicker4() / ColorButton()\nenum ImGuiColorEditFlags_\n{\n    ImGuiColorEditFlags_None            = 0,\n    ImGuiColorEditFlags_NoAlpha         = 1 << 1,   //              // ColorEdit, ColorPicker, ColorButton: ignore Alpha component (will only read 3 components from the input pointer).\n    ImGuiColorEditFlags_NoPicker        = 1 << 2,   //              // ColorEdit: disable picker when clicking on color square.\n    ImGuiColorEditFlags_NoOptions       = 1 << 3,   //              // ColorEdit: disable toggling options menu when right-clicking on inputs/small preview.\n    ImGuiColorEditFlags_NoSmallPreview  = 1 << 4,   //              // ColorEdit, ColorPicker: disable color square preview next to the inputs. (e.g. to show only the inputs)\n    ImGuiColorEditFlags_NoInputs        = 1 << 5,   //              // ColorEdit, ColorPicker: disable inputs sliders/text widgets (e.g. to show only the small preview color square).\n    ImGuiColorEditFlags_NoTooltip       = 1 << 6,   //              // ColorEdit, ColorPicker, ColorButton: disable tooltip when hovering the preview.\n    ImGuiColorEditFlags_NoLabel         = 1 << 7,   //              // ColorEdit, ColorPicker: disable display of inline text label (the label is still forwarded to the tooltip and picker).\n    ImGuiColorEditFlags_NoSidePreview   = 1 << 8,   //              // ColorPicker: disable bigger color preview on right side of the picker, use small color square preview instead.\n    ImGuiColorEditFlags_NoDragDrop      = 1 << 9,   //              // ColorEdit: disable drag and drop target. ColorButton: disable drag and drop source.\n    ImGuiColorEditFlags_NoBorder        = 1 << 10,  //              // ColorButton: disable border (which is enforced by default)\n\n    // User Options (right-click on widget to change some of them).\n    ImGuiColorEditFlags_AlphaBar        = 1 << 16,  //              // ColorEdit, ColorPicker: show vertical alpha bar/gradient in picker.\n    ImGuiColorEditFlags_AlphaPreview    = 1 << 17,  //              // ColorEdit, ColorPicker, ColorButton: display preview as a transparent color over a checkerboard, instead of opaque.\n    ImGuiColorEditFlags_AlphaPreviewHalf= 1 << 18,  //              // ColorEdit, ColorPicker, ColorButton: display half opaque / half checkerboard, instead of opaque.\n    ImGuiColorEditFlags_HDR             = 1 << 19,  //              // (WIP) ColorEdit: Currently only disable 0.0f..1.0f limits in RGBA edition (note: you probably want to use ImGuiColorEditFlags_Float flag as well).\n    ImGuiColorEditFlags_DisplayRGB      = 1 << 20,  // [Display]    // ColorEdit: override _display_ type among RGB/HSV/Hex. ColorPicker: select any combination using one or more of RGB/HSV/Hex.\n    ImGuiColorEditFlags_DisplayHSV      = 1 << 21,  // [Display]    // \"\n    ImGuiColorEditFlags_DisplayHex      = 1 << 22,  // [Display]    // \"\n    ImGuiColorEditFlags_Uint8           = 1 << 23,  // [DataType]   // ColorEdit, ColorPicker, ColorButton: _display_ values formatted as 0..255.\n    ImGuiColorEditFlags_Float           = 1 << 24,  // [DataType]   // ColorEdit, ColorPicker, ColorButton: _display_ values formatted as 0.0f..1.0f floats instead of 0..255 integers. No round-trip of value via integers.\n    ImGuiColorEditFlags_PickerHueBar    = 1 << 25,  // [Picker]     // ColorPicker: bar for Hue, rectangle for Sat/Value.\n    ImGuiColorEditFlags_PickerHueWheel  = 1 << 26,  // [Picker]     // ColorPicker: wheel for Hue, triangle for Sat/Value.\n    ImGuiColorEditFlags_InputRGB        = 1 << 27,  // [Input]      // ColorEdit, ColorPicker: input and output data in RGB format.\n    ImGuiColorEditFlags_InputHSV        = 1 << 28,  // [Input]      // ColorEdit, ColorPicker: input and output data in HSV format.\n\n    // Defaults Options. You can set application defaults using SetColorEditOptions(). The intent is that you probably don't want to\n    // override them in most of your calls. Let the user choose via the option menu and/or call SetColorEditOptions() once during startup.\n    ImGuiColorEditFlags_DefaultOptions_ = ImGuiColorEditFlags_Uint8 | ImGuiColorEditFlags_DisplayRGB | ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_PickerHueBar,\n\n    // [Internal] Masks\n    ImGuiColorEditFlags_DisplayMask_    = ImGuiColorEditFlags_DisplayRGB | ImGuiColorEditFlags_DisplayHSV | ImGuiColorEditFlags_DisplayHex,\n    ImGuiColorEditFlags_DataTypeMask_   = ImGuiColorEditFlags_Uint8 | ImGuiColorEditFlags_Float,\n    ImGuiColorEditFlags_PickerMask_     = ImGuiColorEditFlags_PickerHueWheel | ImGuiColorEditFlags_PickerHueBar,\n    ImGuiColorEditFlags_InputMask_      = ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_InputHSV\n\n    // Obsolete names (will be removed)\n#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS\n    , ImGuiColorEditFlags_RGB = ImGuiColorEditFlags_DisplayRGB, ImGuiColorEditFlags_HSV = ImGuiColorEditFlags_DisplayHSV, ImGuiColorEditFlags_HEX = ImGuiColorEditFlags_DisplayHex  // [renamed in 1.69]\n#endif\n};\n\n// Flags for DragFloat(), DragInt(), SliderFloat(), SliderInt() etc.\n// We use the same sets of flags for DragXXX() and SliderXXX() functions as the features are the same and it makes it easier to swap them.\nenum ImGuiSliderFlags_\n{\n    ImGuiSliderFlags_None                   = 0,\n    ImGuiSliderFlags_AlwaysClamp            = 1 << 4,       // Clamp value to min/max bounds when input manually with CTRL+Click. By default CTRL+Click allows going out of bounds.\n    ImGuiSliderFlags_Logarithmic            = 1 << 5,       // Make the widget logarithmic (linear otherwise). Consider using ImGuiSliderFlags_NoRoundToFormat with this if using a format-string with small amount of digits.\n    ImGuiSliderFlags_NoRoundToFormat        = 1 << 6,       // Disable rounding underlying value to match precision of the display format string (e.g. %.3f values are rounded to those 3 digits)\n    ImGuiSliderFlags_NoInput                = 1 << 7,       // Disable CTRL+Click or Enter key allowing to input text directly into the widget\n    ImGuiSliderFlags_InvalidMask_           = 0x7000000F    // [Internal] We treat using those bits as being potentially a 'float power' argument from the previous API that has got miscast to this enum, and will trigger an assert if needed.\n\n    // Obsolete names (will be removed)\n#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS\n    , ImGuiSliderFlags_ClampOnInput = ImGuiSliderFlags_AlwaysClamp // [renamed in 1.79]\n#endif\n};\n\n// Identify a mouse button.\n// Those values are guaranteed to be stable and we frequently use 0/1 directly. Named enums provided for convenience.\nenum ImGuiMouseButton_\n{\n    ImGuiMouseButton_Left = 0,\n    ImGuiMouseButton_Right = 1,\n    ImGuiMouseButton_Middle = 2,\n    ImGuiMouseButton_COUNT = 5\n};\n\n// Enumeration for GetMouseCursor()\n// User code may request backend to display given cursor by calling SetMouseCursor(), which is why we have some cursors that are marked unused here\nenum ImGuiMouseCursor_\n{\n    ImGuiMouseCursor_None = -1,\n    ImGuiMouseCursor_Arrow = 0,\n    ImGuiMouseCursor_TextInput,         // When hovering over InputText, etc.\n    ImGuiMouseCursor_ResizeAll,         // (Unused by Dear ImGui functions)\n    ImGuiMouseCursor_ResizeNS,          // When hovering over an horizontal border\n    ImGuiMouseCursor_ResizeEW,          // When hovering over a vertical border or a column\n    ImGuiMouseCursor_ResizeNESW,        // When hovering over the bottom-left corner of a window\n    ImGuiMouseCursor_ResizeNWSE,        // When hovering over the bottom-right corner of a window\n    ImGuiMouseCursor_Hand,              // (Unused by Dear ImGui functions. Use for e.g. hyperlinks)\n    ImGuiMouseCursor_NotAllowed,        // When hovering something with disallowed interaction. Usually a crossed circle.\n    ImGuiMouseCursor_COUNT\n};\n\n// Enumeration for ImGui::SetWindow***(), SetNextWindow***(), SetNextItem***() functions\n// Represent a condition.\n// Important: Treat as a regular enum! Do NOT combine multiple values using binary operators! All the functions above treat 0 as a shortcut to ImGuiCond_Always.\nenum ImGuiCond_\n{\n    ImGuiCond_None          = 0,        // No condition (always set the variable), same as _Always\n    ImGuiCond_Always        = 1 << 0,   // No condition (always set the variable)\n    ImGuiCond_Once          = 1 << 1,   // Set the variable once per runtime session (only the first call will succeed)\n    ImGuiCond_FirstUseEver  = 1 << 2,   // Set the variable if the object/window has no persistently saved data (no entry in .ini file)\n    ImGuiCond_Appearing     = 1 << 3    // Set the variable if the object/window is appearing after being hidden/inactive (or the first time)\n};\n\n//-----------------------------------------------------------------------------\n// [SECTION] Helpers: Memory allocations macros, ImVector<>\n//-----------------------------------------------------------------------------\n\n//-----------------------------------------------------------------------------\n// IM_MALLOC(), IM_FREE(), IM_NEW(), IM_PLACEMENT_NEW(), IM_DELETE()\n// We call C++ constructor on own allocated memory via the placement \"new(ptr) Type()\" syntax.\n// Defining a custom placement new() with a custom parameter allows us to bypass including <new> which on some platforms complains when user has disabled exceptions.\n//-----------------------------------------------------------------------------\n\nstruct ImNewWrapper {};\ninline void* operator new(size_t, ImNewWrapper, void* ptr) { return ptr; }\ninline void  operator delete(void*, ImNewWrapper, void*)   {} // This is only required so we can use the symmetrical new()\n#define IM_ALLOC(_SIZE)                     ImGui::MemAlloc(_SIZE)\n#define IM_FREE(_PTR)                       ImGui::MemFree(_PTR)\n#define IM_PLACEMENT_NEW(_PTR)              new(ImNewWrapper(), _PTR)\n#define IM_NEW(_TYPE)                       new(ImNewWrapper(), ImGui::MemAlloc(sizeof(_TYPE))) _TYPE\ntemplate<typename T> void IM_DELETE(T* p)   { if (p) { p->~T(); ImGui::MemFree(p); } }\n\n//-----------------------------------------------------------------------------\n// ImVector<>\n// Lightweight std::vector<>-like class to avoid dragging dependencies (also, some implementations of STL with debug enabled are absurdly slow, we bypass it so our code runs fast in debug).\n//-----------------------------------------------------------------------------\n// - You generally do NOT need to care or use this ever. But we need to make it available in imgui.h because some of our public structures are relying on it.\n// - We use std-like naming convention here, which is a little unusual for this codebase.\n// - Important: clear() frees memory, resize(0) keep the allocated buffer. We use resize(0) a lot to intentionally recycle allocated buffers across frames and amortize our costs.\n// - Important: our implementation does NOT call C++ constructors/destructors, we treat everything as raw data! This is intentional but be extra mindful of that,\n//   Do NOT use this class as a std::vector replacement in your own code! Many of the structures used by dear imgui can be safely initialized by a zero-memset.\n//-----------------------------------------------------------------------------\n\nIM_MSVC_RUNTIME_CHECKS_OFF\ntemplate<typename T>\nstruct ImVector\n{\n    int                 Size;\n    int                 Capacity;\n    T*                  Data;\n\n    // Provide standard typedefs but we don't use them ourselves.\n    typedef T                   value_type;\n    typedef value_type*         iterator;\n    typedef const value_type*   const_iterator;\n\n    // Constructors, destructor\n    inline ImVector()                                       { Size = Capacity = 0; Data = NULL; }\n    inline ImVector(const ImVector<T>& src)                 { Size = Capacity = 0; Data = NULL; operator=(src); }\n    inline ImVector<T>& operator=(const ImVector<T>& src)   { clear(); resize(src.Size); memcpy(Data, src.Data, (size_t)Size * sizeof(T)); return *this; }\n    inline ~ImVector()                                      { if (Data) IM_FREE(Data); } // Important: does not destruct anything\n\n    inline void         clear()                             { if (Data) { Size = Capacity = 0; IM_FREE(Data); Data = NULL; } }  // Important: does not destruct anything\n    inline void         clear_delete()                      { for (int n = 0; n < Size; n++) IM_DELETE(Data[n]); clear(); }     // Important: never called automatically! always explicit.\n    inline void         clear_destruct()                    { for (int n = 0; n < Size; n++) Data[n].~T(); clear(); }           // Important: never called automatically! always explicit.\n\n    inline bool         empty() const                       { return Size == 0; }\n    inline int          size() const                        { return Size; }\n    inline int          size_in_bytes() const               { return Size * (int)sizeof(T); }\n    inline int          max_size() const                    { return 0x7FFFFFFF / (int)sizeof(T); }\n    inline int          capacity() const                    { return Capacity; }\n    inline T&           operator[](int i)                   { IM_ASSERT(i >= 0 && i < Size); return Data[i]; }\n    inline const T&     operator[](int i) const             { IM_ASSERT(i >= 0 && i < Size); return Data[i]; }\n\n    inline T*           begin()                             { return Data; }\n    inline const T*     begin() const                       { return Data; }\n    inline T*           end()                               { return Data + Size; }\n    inline const T*     end() const                         { return Data + Size; }\n    inline T&           front()                             { IM_ASSERT(Size > 0); return Data[0]; }\n    inline const T&     front() const                       { IM_ASSERT(Size > 0); return Data[0]; }\n    inline T&           back()                              { IM_ASSERT(Size > 0); return Data[Size - 1]; }\n    inline const T&     back() const                        { IM_ASSERT(Size > 0); return Data[Size - 1]; }\n    inline void         swap(ImVector<T>& rhs)              { int rhs_size = rhs.Size; rhs.Size = Size; Size = rhs_size; int rhs_cap = rhs.Capacity; rhs.Capacity = Capacity; Capacity = rhs_cap; T* rhs_data = rhs.Data; rhs.Data = Data; Data = rhs_data; }\n\n    inline int          _grow_capacity(int sz) const        { int new_capacity = Capacity ? (Capacity + Capacity / 2) : 8; return new_capacity > sz ? new_capacity : sz; }\n    inline void         resize(int new_size)                { if (new_size > Capacity) reserve(_grow_capacity(new_size)); Size = new_size; }\n    inline void         resize(int new_size, const T& v)    { if (new_size > Capacity) reserve(_grow_capacity(new_size)); if (new_size > Size) for (int n = Size; n < new_size; n++) memcpy(&Data[n], &v, sizeof(v)); Size = new_size; }\n    inline void         shrink(int new_size)                { IM_ASSERT(new_size <= Size); Size = new_size; } // Resize a vector to a smaller size, guaranteed not to cause a reallocation\n    inline void         reserve(int new_capacity)           { if (new_capacity <= Capacity) return; T* new_data = (T*)IM_ALLOC((size_t)new_capacity * sizeof(T)); if (Data) { memcpy(new_data, Data, (size_t)Size * sizeof(T)); IM_FREE(Data); } Data = new_data; Capacity = new_capacity; }\n\n    // NB: It is illegal to call push_back/push_front/insert with a reference pointing inside the ImVector data itself! e.g. v.push_back(v[10]) is forbidden.\n    inline void         push_back(const T& v)               { if (Size == Capacity) reserve(_grow_capacity(Size + 1)); memcpy(&Data[Size], &v, sizeof(v)); Size++; }\n    inline void         pop_back()                          { IM_ASSERT(Size > 0); Size--; }\n    inline void         push_front(const T& v)              { if (Size == 0) push_back(v); else insert(Data, v); }\n    inline T*           erase(const T* it)                  { IM_ASSERT(it >= Data && it < Data + Size); const ptrdiff_t off = it - Data; memmove(Data + off, Data + off + 1, ((size_t)Size - (size_t)off - 1) * sizeof(T)); Size--; return Data + off; }\n    inline T*           erase(const T* it, const T* it_last){ IM_ASSERT(it >= Data && it < Data + Size && it_last > it && it_last <= Data + Size); const ptrdiff_t count = it_last - it; const ptrdiff_t off = it - Data; memmove(Data + off, Data + off + count, ((size_t)Size - (size_t)off - count) * sizeof(T)); Size -= (int)count; return Data + off; }\n    inline T*           erase_unsorted(const T* it)         { IM_ASSERT(it >= Data && it < Data + Size);  const ptrdiff_t off = it - Data; if (it < Data + Size - 1) memcpy(Data + off, Data + Size - 1, sizeof(T)); Size--; return Data + off; }\n    inline T*           insert(const T* it, const T& v)     { IM_ASSERT(it >= Data && it <= Data + Size); const ptrdiff_t off = it - Data; if (Size == Capacity) reserve(_grow_capacity(Size + 1)); if (off < (int)Size) memmove(Data + off + 1, Data + off, ((size_t)Size - (size_t)off) * sizeof(T)); memcpy(&Data[off], &v, sizeof(v)); Size++; return Data + off; }\n    inline bool         contains(const T& v) const          { const T* data = Data;  const T* data_end = Data + Size; while (data < data_end) if (*data++ == v) return true; return false; }\n    inline T*           find(const T& v)                    { T* data = Data;  const T* data_end = Data + Size; while (data < data_end) if (*data == v) break; else ++data; return data; }\n    inline const T*     find(const T& v) const              { const T* data = Data;  const T* data_end = Data + Size; while (data < data_end) if (*data == v) break; else ++data; return data; }\n    inline bool         find_erase(const T& v)              { const T* it = find(v); if (it < Data + Size) { erase(it); return true; } return false; }\n    inline bool         find_erase_unsorted(const T& v)     { const T* it = find(v); if (it < Data + Size) { erase_unsorted(it); return true; } return false; }\n    inline int          index_from_ptr(const T* it) const   { IM_ASSERT(it >= Data && it < Data + Size); const ptrdiff_t off = it - Data; return (int)off; }\n};\nIM_MSVC_RUNTIME_CHECKS_RESTORE\n\n//-----------------------------------------------------------------------------\n// [SECTION] ImGuiStyle\n//-----------------------------------------------------------------------------\n// You may modify the ImGui::GetStyle() main instance during initialization and before NewFrame().\n// During the frame, use ImGui::PushStyleVar(ImGuiStyleVar_XXXX)/PopStyleVar() to alter the main style values,\n// and ImGui::PushStyleColor(ImGuiCol_XXX)/PopStyleColor() for colors.\n//-----------------------------------------------------------------------------\n\nstruct ImGuiStyle\n{\n    float       Alpha;                      // Global alpha applies to everything in Dear ImGui.\n    float       DisabledAlpha;              // Additional alpha multiplier applied by BeginDisabled(). Multiply over current value of Alpha.\n    ImVec2      WindowPadding;              // Padding within a window.\n    float       WindowRounding;             // Radius of window corners rounding. Set to 0.0f to have rectangular windows. Large values tend to lead to variety of artifacts and are not recommended.\n    float       WindowBorderSize;           // Thickness of border around windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly).\n    ImVec2      WindowMinSize;              // Minimum window size. This is a global setting. If you want to constraint individual windows, use SetNextWindowSizeConstraints().\n    ImVec2      WindowTitleAlign;           // Alignment for title bar text. Defaults to (0.0f,0.5f) for left-aligned,vertically centered.\n    ImGuiDir    WindowMenuButtonPosition;   // Side of the collapsing/docking button in the title bar (None/Left/Right). Defaults to ImGuiDir_Left.\n    float       ChildRounding;              // Radius of child window corners rounding. Set to 0.0f to have rectangular windows.\n    float       ChildBorderSize;            // Thickness of border around child windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly).\n    float       PopupRounding;              // Radius of popup window corners rounding. (Note that tooltip windows use WindowRounding)\n    float       PopupBorderSize;            // Thickness of border around popup/tooltip windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly).\n    ImVec2      FramePadding;               // Padding within a framed rectangle (used by most widgets).\n    float       FrameRounding;              // Radius of frame corners rounding. Set to 0.0f to have rectangular frame (used by most widgets).\n    float       FrameBorderSize;            // Thickness of border around frames. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly).\n    ImVec2      ItemSpacing;                // Horizontal and vertical spacing between widgets/lines.\n    ImVec2      ItemInnerSpacing;           // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label).\n    ImVec2      CellPadding;                // Padding within a table cell\n    ImVec2      TouchExtraPadding;          // Expand reactive bounding box for touch-based system where touch position is not accurate enough. Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much!\n    float       IndentSpacing;              // Horizontal indentation when e.g. entering a tree node. Generally == (FontSize + FramePadding.x*2).\n    float       ColumnsMinSpacing;          // Minimum horizontal spacing between two columns. Preferably > (FramePadding.x + 1).\n    float       ScrollbarSize;              // Width of the vertical scrollbar, Height of the horizontal scrollbar.\n    float       ScrollbarRounding;          // Radius of grab corners for scrollbar.\n    float       GrabMinSize;                // Minimum width/height of a grab box for slider/scrollbar.\n    float       GrabRounding;               // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs.\n    float       LogSliderDeadzone;          // The size in pixels of the dead-zone around zero on logarithmic sliders that cross zero.\n    float       TabRounding;                // Radius of upper corners of a tab. Set to 0.0f to have rectangular tabs.\n    float       TabBorderSize;              // Thickness of border around tabs.\n    float       TabMinWidthForCloseButton;  // Minimum width for close button to appears on an unselected tab when hovered. Set to 0.0f to always show when hovering, set to FLT_MAX to never show close button unless selected.\n    ImGuiDir    ColorButtonPosition;        // Side of the color button in the ColorEdit4 widget (left/right). Defaults to ImGuiDir_Right.\n    ImVec2      ButtonTextAlign;            // Alignment of button text when button is larger than text. Defaults to (0.5f, 0.5f) (centered).\n    ImVec2      SelectableTextAlign;        // Alignment of selectable text. Defaults to (0.0f, 0.0f) (top-left aligned). It's generally important to keep this left-aligned if you want to lay multiple items on a same line.\n    ImVec2      DisplayWindowPadding;       // Window position are clamped to be visible within the display area or monitors by at least this amount. Only applies to regular windows.\n    ImVec2      DisplaySafeAreaPadding;     // If you cannot see the edges of your screen (e.g. on a TV) increase the safe area padding. Apply to popups/tooltips as well regular windows. NB: Prefer configuring your TV sets correctly!\n    float       MouseCursorScale;           // Scale software rendered mouse cursor (when io.MouseDrawCursor is enabled). May be removed later.\n    bool        AntiAliasedLines;           // Enable anti-aliased lines/borders. Disable if you are really tight on CPU/GPU. Latched at the beginning of the frame (copied to ImDrawList).\n    bool        AntiAliasedLinesUseTex;     // Enable anti-aliased lines/borders using textures where possible. Require backend to render with bilinear filtering. Latched at the beginning of the frame (copied to ImDrawList).\n    bool        AntiAliasedFill;            // Enable anti-aliased edges around filled shapes (rounded rectangles, circles, etc.). Disable if you are really tight on CPU/GPU. Latched at the beginning of the frame (copied to ImDrawList).\n    float       CurveTessellationTol;       // Tessellation tolerance when using PathBezierCurveTo() without a specific number of segments. Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality.\n    float       CircleTessellationMaxError; // Maximum error (in pixels) allowed when using AddCircle()/AddCircleFilled() or drawing rounded corner rectangles with no explicit segment count specified. Decrease for higher quality but more geometry.\n    ImVec4      Colors[ImGuiCol_COUNT];\n\n    IMGUI_API ImGuiStyle();\n    IMGUI_API void ScaleAllSizes(float scale_factor);\n};\n\n//-----------------------------------------------------------------------------\n// [SECTION] ImGuiIO\n//-----------------------------------------------------------------------------\n// Communicate most settings and inputs/outputs to Dear ImGui using this structure.\n// Access via ImGui::GetIO(). Read 'Programmer guide' section in .cpp file for general usage.\n//-----------------------------------------------------------------------------\n\nstruct ImGuiIO\n{\n    //------------------------------------------------------------------\n    // Configuration (fill once)                // Default value\n    //------------------------------------------------------------------\n\n    ImGuiConfigFlags   ConfigFlags;             // = 0              // See ImGuiConfigFlags_ enum. Set by user/application. Gamepad/keyboard navigation options, etc.\n    ImGuiBackendFlags  BackendFlags;            // = 0              // See ImGuiBackendFlags_ enum. Set by backend (imgui_impl_xxx files or custom backend) to communicate features supported by the backend.\n    ImVec2      DisplaySize;                    // <unset>          // Main display size, in pixels (generally == GetMainViewport()->Size)\n    float       DeltaTime;                      // = 1.0f/60.0f     // Time elapsed since last frame, in seconds.\n    float       IniSavingRate;                  // = 5.0f           // Minimum time between saving positions/sizes to .ini file, in seconds.\n    const char* IniFilename;                    // = \"imgui.ini\"    // Path to .ini file (important: default \"imgui.ini\" is relative to current working dir!). Set NULL to disable automatic .ini loading/saving or if you want to manually call LoadIniSettingsXXX() / SaveIniSettingsXXX() functions.\n    const char* LogFilename;                    // = \"imgui_log.txt\"// Path to .log file (default parameter to ImGui::LogToFile when no file is specified).\n    float       MouseDoubleClickTime;           // = 0.30f          // Time for a double-click, in seconds.\n    float       MouseDoubleClickMaxDist;        // = 6.0f           // Distance threshold to stay in to validate a double-click, in pixels.\n    float       MouseDragThreshold;             // = 6.0f           // Distance threshold before considering we are dragging.\n    int         KeyMap[ImGuiKey_COUNT];         // <unset>          // Map of indices into the KeysDown[512] entries array which represent your \"native\" keyboard state.\n    float       KeyRepeatDelay;                 // = 0.250f         // When holding a key/button, time before it starts repeating, in seconds (for buttons in Repeat mode, etc.).\n    float       KeyRepeatRate;                  // = 0.050f         // When holding a key/button, rate at which it repeats, in seconds.\n    void*       UserData;                       // = NULL           // Store your own data for retrieval by callbacks.\n\n    ImFontAtlas*Fonts;                          // <auto>           // Font atlas: load, rasterize and pack one or more fonts into a single texture.\n    float       FontGlobalScale;                // = 1.0f           // Global scale all fonts\n    bool        FontAllowUserScaling;           // = false          // Allow user scaling text of individual window with CTRL+Wheel.\n    ImFont*     FontDefault;                    // = NULL           // Font to use on NewFrame(). Use NULL to uses Fonts->Fonts[0].\n    ImVec2      DisplayFramebufferScale;        // = (1, 1)         // For retina display or other situations where window coordinates are different from framebuffer coordinates. This generally ends up in ImDrawData::FramebufferScale.\n\n    // Miscellaneous options\n    bool        MouseDrawCursor;                // = false          // Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor). Cannot be easily renamed to 'io.ConfigXXX' because this is frequently used by backend implementations.\n    bool        ConfigMacOSXBehaviors;          // = defined(__APPLE__) // OS X style: Text editing cursor movement using Alt instead of Ctrl, Shortcuts using Cmd/Super instead of Ctrl, Line/Text Start and End using Cmd+Arrows instead of Home/End, Double click selects by word instead of selecting whole text, Multi-selection in lists uses Cmd/Super instead of Ctrl.\n    bool        ConfigInputTextCursorBlink;     // = true           // Enable blinking cursor (optional as some users consider it to be distracting).\n    bool        ConfigDragClickToInputText;     // = false          // [BETA] Enable turning DragXXX widgets into text input with a simple mouse click-release (without moving). Not desirable on devices without a keyboard.\n    bool        ConfigWindowsResizeFromEdges;   // = true           // Enable resizing of windows from their edges and from the lower-left corner. This requires (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) because it needs mouse cursor feedback. (This used to be a per-window ImGuiWindowFlags_ResizeFromAnySide flag)\n    bool        ConfigWindowsMoveFromTitleBarOnly; // = false       // Enable allowing to move windows only when clicking on their title bar. Does not apply to windows without a title bar.\n    float       ConfigMemoryCompactTimer;       // = 60.0f          // Timer (in seconds) to free transient windows/tables memory buffers when unused. Set to -1.0f to disable.\n\n    //------------------------------------------------------------------\n    // Platform Functions\n    // (the imgui_impl_xxxx backend files are setting those up for you)\n    //------------------------------------------------------------------\n\n    // Optional: Platform/Renderer backend name (informational only! will be displayed in About Window) + User data for backend/wrappers to store their own stuff.\n    const char* BackendPlatformName;            // = NULL\n    const char* BackendRendererName;            // = NULL\n    void*       BackendPlatformUserData;        // = NULL           // User data for platform backend\n    void*       BackendRendererUserData;        // = NULL           // User data for renderer backend\n    void*       BackendLanguageUserData;        // = NULL           // User data for non C++ programming language backend\n\n    // Optional: Access OS clipboard\n    // (default to use native Win32 clipboard on Windows, otherwise uses a private clipboard. Override to access OS clipboard on other architectures)\n    const char* (*GetClipboardTextFn)(void* user_data);\n    void        (*SetClipboardTextFn)(void* user_data, const char* text);\n    void*       ClipboardUserData;\n\n    // Optional: Notify OS Input Method Editor of the screen position of your cursor for text input position (e.g. when using Japanese/Chinese IME on Windows)\n    // (default to use native imm32 api on Windows)\n    void        (*ImeSetInputScreenPosFn)(int x, int y);\n    void*       ImeWindowHandle;                // = NULL           // (Windows) Set this to your HWND to get automatic IME cursor positioning.\n\n    //------------------------------------------------------------------\n    // Input - Fill before calling NewFrame()\n    //------------------------------------------------------------------\n\n    ImVec2      MousePos;                       // Mouse position, in pixels. Set to ImVec2(-FLT_MAX, -FLT_MAX) if mouse is unavailable (on another screen, etc.)\n    bool        MouseDown[5];                   // Mouse buttons: 0=left, 1=right, 2=middle + extras (ImGuiMouseButton_COUNT == 5). Dear ImGui mostly uses left and right buttons. Others buttons allows us to track if the mouse is being used by your application + available to user as a convenience via IsMouse** API.\n    float       MouseWheel;                     // Mouse wheel Vertical: 1 unit scrolls about 5 lines text.\n    float       MouseWheelH;                    // Mouse wheel Horizontal. Most users don't have a mouse with an horizontal wheel, may not be filled by all backends.\n    bool        KeyCtrl;                        // Keyboard modifier pressed: Control\n    bool        KeyShift;                       // Keyboard modifier pressed: Shift\n    bool        KeyAlt;                         // Keyboard modifier pressed: Alt\n    bool        KeySuper;                       // Keyboard modifier pressed: Cmd/Super/Windows\n    bool        KeysDown[512];                  // Keyboard keys that are pressed (ideally left in the \"native\" order your engine has access to keyboard keys, so you can use your own defines/enums for keys).\n    float       NavInputs[ImGuiNavInput_COUNT]; // Gamepad inputs. Cleared back to zero by EndFrame(). Keyboard keys will be auto-mapped and be written here by NewFrame().\n\n    // Functions\n    IMGUI_API void  AddInputCharacter(unsigned int c);          // Queue new character input\n    IMGUI_API void  AddInputCharacterUTF16(ImWchar16 c);        // Queue new character input from an UTF-16 character, it can be a surrogate\n    IMGUI_API void  AddInputCharactersUTF8(const char* str);    // Queue new characters input from an UTF-8 string\n    IMGUI_API void  ClearInputCharacters();                     // Clear the text input buffer manually\n    IMGUI_API void  AddFocusEvent(bool focused);                // Notifies Dear ImGui when hosting platform windows lose or gain input focus\n\n    //------------------------------------------------------------------\n    // Output - Updated by NewFrame() or EndFrame()/Render()\n    // (when reading from the io.WantCaptureMouse, io.WantCaptureKeyboard flags to dispatch your inputs, it is\n    //  generally easier and more correct to use their state BEFORE calling NewFrame(). See FAQ for details!)\n    //------------------------------------------------------------------\n\n    bool        WantCaptureMouse;               // Set when Dear ImGui will use mouse inputs, in this case do not dispatch them to your main game/application (either way, always pass on mouse inputs to imgui). (e.g. unclicked mouse is hovering over an imgui window, widget is active, mouse was clicked over an imgui window, etc.).\n    bool        WantCaptureKeyboard;            // Set when Dear ImGui will use keyboard inputs, in this case do not dispatch them to your main game/application (either way, always pass keyboard inputs to imgui). (e.g. InputText active, or an imgui window is focused and navigation is enabled, etc.).\n    bool        WantTextInput;                  // Mobile/console: when set, you may display an on-screen keyboard. This is set by Dear ImGui when it wants textual keyboard input to happen (e.g. when a InputText widget is active).\n    bool        WantSetMousePos;                // MousePos has been altered, backend should reposition mouse on next frame. Rarely used! Set only when ImGuiConfigFlags_NavEnableSetMousePos flag is enabled.\n    bool        WantSaveIniSettings;            // When manual .ini load/save is active (io.IniFilename == NULL), this will be set to notify your application that you can call SaveIniSettingsToMemory() and save yourself. Important: clear io.WantSaveIniSettings yourself after saving!\n    bool        NavActive;                      // Keyboard/Gamepad navigation is currently allowed (will handle ImGuiKey_NavXXX events) = a window is focused and it doesn't use the ImGuiWindowFlags_NoNavInputs flag.\n    bool        NavVisible;                     // Keyboard/Gamepad navigation is visible and allowed (will handle ImGuiKey_NavXXX events).\n    float       Framerate;                      // Rough estimate of application framerate, in frame per second. Solely for convenience. Rolling average estimation based on io.DeltaTime over 120 frames.\n    int         MetricsRenderVertices;          // Vertices output during last call to Render()\n    int         MetricsRenderIndices;           // Indices output during last call to Render() = number of triangles * 3\n    int         MetricsRenderWindows;           // Number of visible windows\n    int         MetricsActiveWindows;           // Number of active windows\n    int         MetricsActiveAllocations;       // Number of active allocations, updated by MemAlloc/MemFree based on current context. May be off if you have multiple imgui contexts.\n    ImVec2      MouseDelta;                     // Mouse delta. Note that this is zero if either current or previous position are invalid (-FLT_MAX,-FLT_MAX), so a disappearing/reappearing mouse won't have a huge delta.\n\n    //------------------------------------------------------------------\n    // [Internal] Dear ImGui will maintain those fields. Forward compatibility not guaranteed!\n    //------------------------------------------------------------------\n\n    ImGuiKeyModFlags KeyMods;                   // Key mods flags (same as io.KeyCtrl/KeyShift/KeyAlt/KeySuper but merged into flags), updated by NewFrame()\n    ImGuiKeyModFlags KeyModsPrev;               // Previous key mods\n    ImVec2      MousePosPrev;                   // Previous mouse position (note that MouseDelta is not necessary == MousePos-MousePosPrev, in case either position is invalid)\n    ImVec2      MouseClickedPos[5];             // Position at time of clicking\n    double      MouseClickedTime[5];            // Time of last click (used to figure out double-click)\n    bool        MouseClicked[5];                // Mouse button went from !Down to Down\n    bool        MouseDoubleClicked[5];          // Has mouse button been double-clicked?\n    bool        MouseReleased[5];               // Mouse button went from Down to !Down\n    bool        MouseDownOwned[5];              // Track if button was clicked inside a dear imgui window. We don't request mouse capture from the application if click started outside ImGui bounds.\n    bool        MouseDownWasDoubleClick[5];     // Track if button down was a double-click\n    float       MouseDownDuration[5];           // Duration the mouse button has been down (0.0f == just clicked)\n    float       MouseDownDurationPrev[5];       // Previous time the mouse button has been down\n    ImVec2      MouseDragMaxDistanceAbs[5];     // Maximum distance, absolute, on each axis, of how much mouse has traveled from the clicking point\n    float       MouseDragMaxDistanceSqr[5];     // Squared maximum distance of how much mouse has traveled from the clicking point\n    float       KeysDownDuration[512];          // Duration the keyboard key has been down (0.0f == just pressed)\n    float       KeysDownDurationPrev[512];      // Previous duration the key has been down\n    float       NavInputsDownDuration[ImGuiNavInput_COUNT];\n    float       NavInputsDownDurationPrev[ImGuiNavInput_COUNT];\n    float       PenPressure;                    // Touch/Pen pressure (0.0f to 1.0f, should be >0.0f only when MouseDown[0] == true). Helper storage currently unused by Dear ImGui.\n    ImWchar16   InputQueueSurrogate;            // For AddInputCharacterUTF16\n    ImVector<ImWchar> InputQueueCharacters;     // Queue of _characters_ input (obtained by platform backend). Fill using AddInputCharacter() helper.\n\n    IMGUI_API   ImGuiIO();\n};\n\n//-----------------------------------------------------------------------------\n// [SECTION] Misc data structures\n//-----------------------------------------------------------------------------\n\n// Shared state of InputText(), passed as an argument to your callback when a ImGuiInputTextFlags_Callback* flag is used.\n// The callback function should return 0 by default.\n// Callbacks (follow a flag name and see comments in ImGuiInputTextFlags_ declarations for more details)\n// - ImGuiInputTextFlags_CallbackEdit:        Callback on buffer edit (note that InputText() already returns true on edit, the callback is useful mainly to manipulate the underlying buffer while focus is active)\n// - ImGuiInputTextFlags_CallbackAlways:      Callback on each iteration\n// - ImGuiInputTextFlags_CallbackCompletion:  Callback on pressing TAB\n// - ImGuiInputTextFlags_CallbackHistory:     Callback on pressing Up/Down arrows\n// - ImGuiInputTextFlags_CallbackCharFilter:  Callback on character inputs to replace or discard them. Modify 'EventChar' to replace or discard, or return 1 in callback to discard.\n// - ImGuiInputTextFlags_CallbackResize:      Callback on buffer capacity changes request (beyond 'buf_size' parameter value), allowing the string to grow.\nstruct ImGuiInputTextCallbackData\n{\n    ImGuiInputTextFlags EventFlag;      // One ImGuiInputTextFlags_Callback*    // Read-only\n    ImGuiInputTextFlags Flags;          // What user passed to InputText()      // Read-only\n    void*               UserData;       // What user passed to InputText()      // Read-only\n\n    // Arguments for the different callback events\n    // - To modify the text buffer in a callback, prefer using the InsertChars() / DeleteChars() function. InsertChars() will take care of calling the resize callback if necessary.\n    // - If you know your edits are not going to resize the underlying buffer allocation, you may modify the contents of 'Buf[]' directly. You need to update 'BufTextLen' accordingly (0 <= BufTextLen < BufSize) and set 'BufDirty'' to true so InputText can update its internal state.\n    ImWchar             EventChar;      // Character input                      // Read-write   // [CharFilter] Replace character with another one, or set to zero to drop. return 1 is equivalent to setting EventChar=0;\n    ImGuiKey            EventKey;       // Key pressed (Up/Down/TAB)            // Read-only    // [Completion,History]\n    char*               Buf;            // Text buffer                          // Read-write   // [Resize] Can replace pointer / [Completion,History,Always] Only write to pointed data, don't replace the actual pointer!\n    int                 BufTextLen;     // Text length (in bytes)               // Read-write   // [Resize,Completion,History,Always] Exclude zero-terminator storage. In C land: == strlen(some_text), in C++ land: string.length()\n    int                 BufSize;        // Buffer size (in bytes) = capacity+1  // Read-only    // [Resize,Completion,History,Always] Include zero-terminator storage. In C land == ARRAYSIZE(my_char_array), in C++ land: string.capacity()+1\n    bool                BufDirty;       // Set if you modify Buf/BufTextLen!    // Write        // [Completion,History,Always]\n    int                 CursorPos;      //                                      // Read-write   // [Completion,History,Always]\n    int                 SelectionStart; //                                      // Read-write   // [Completion,History,Always] == to SelectionEnd when no selection)\n    int                 SelectionEnd;   //                                      // Read-write   // [Completion,History,Always]\n\n    // Helper functions for text manipulation.\n    // Use those function to benefit from the CallbackResize behaviors. Calling those function reset the selection.\n    IMGUI_API ImGuiInputTextCallbackData();\n    IMGUI_API void      DeleteChars(int pos, int bytes_count);\n    IMGUI_API void      InsertChars(int pos, const char* text, const char* text_end = NULL);\n    void                SelectAll()             { SelectionStart = 0; SelectionEnd = BufTextLen; }\n    void                ClearSelection()        { SelectionStart = SelectionEnd = BufTextLen; }\n    bool                HasSelection() const    { return SelectionStart != SelectionEnd; }\n};\n\n// Resizing callback data to apply custom constraint. As enabled by SetNextWindowSizeConstraints(). Callback is called during the next Begin().\n// NB: For basic min/max size constraint on each axis you don't need to use the callback! The SetNextWindowSizeConstraints() parameters are enough.\nstruct ImGuiSizeCallbackData\n{\n    void*   UserData;       // Read-only.   What user passed to SetNextWindowSizeConstraints()\n    ImVec2  Pos;            // Read-only.   Window position, for reference.\n    ImVec2  CurrentSize;    // Read-only.   Current window size.\n    ImVec2  DesiredSize;    // Read-write.  Desired size, based on user's mouse position. Write to this field to restrain resizing.\n};\n\n// Data payload for Drag and Drop operations: AcceptDragDropPayload(), GetDragDropPayload()\nstruct ImGuiPayload\n{\n    // Members\n    void*           Data;               // Data (copied and owned by dear imgui)\n    int             DataSize;           // Data size\n\n    // [Internal]\n    ImGuiID         SourceId;           // Source item id\n    ImGuiID         SourceParentId;     // Source parent id (if available)\n    int             DataFrameCount;     // Data timestamp\n    char            DataType[32 + 1];   // Data type tag (short user-supplied string, 32 characters max)\n    bool            Preview;            // Set when AcceptDragDropPayload() was called and mouse has been hovering the target item (nb: handle overlapping drag targets)\n    bool            Delivery;           // Set when AcceptDragDropPayload() was called and mouse button is released over the target item.\n\n    ImGuiPayload()  { Clear(); }\n    void Clear()    { SourceId = SourceParentId = 0; Data = NULL; DataSize = 0; memset(DataType, 0, sizeof(DataType)); DataFrameCount = -1; Preview = Delivery = false; }\n    bool IsDataType(const char* type) const { return DataFrameCount != -1 && strcmp(type, DataType) == 0; }\n    bool IsPreview() const                  { return Preview; }\n    bool IsDelivery() const                 { return Delivery; }\n};\n\n// Sorting specification for one column of a table (sizeof == 12 bytes)\nstruct ImGuiTableColumnSortSpecs\n{\n    ImGuiID                     ColumnUserID;       // User id of the column (if specified by a TableSetupColumn() call)\n    ImS16                       ColumnIndex;        // Index of the column\n    ImS16                       SortOrder;          // Index within parent ImGuiTableSortSpecs (always stored in order starting from 0, tables sorted on a single criteria will always have a 0 here)\n    ImGuiSortDirection          SortDirection : 8;  // ImGuiSortDirection_Ascending or ImGuiSortDirection_Descending (you can use this or SortSign, whichever is more convenient for your sort function)\n\n    ImGuiTableColumnSortSpecs() { memset(this, 0, sizeof(*this)); }\n};\n\n// Sorting specifications for a table (often handling sort specs for a single column, occasionally more)\n// Obtained by calling TableGetSortSpecs().\n// When 'SpecsDirty == true' you can sort your data. It will be true with sorting specs have changed since last call, or the first time.\n// Make sure to set 'SpecsDirty = false' after sorting, else you may wastefully sort your data every frame!\nstruct ImGuiTableSortSpecs\n{\n    const ImGuiTableColumnSortSpecs* Specs;     // Pointer to sort spec array.\n    int                         SpecsCount;     // Sort spec count. Most often 1. May be > 1 when ImGuiTableFlags_SortMulti is enabled. May be == 0 when ImGuiTableFlags_SortTristate is enabled.\n    bool                        SpecsDirty;     // Set to true when specs have changed since last time! Use this to sort again, then clear the flag.\n\n    ImGuiTableSortSpecs()       { memset(this, 0, sizeof(*this)); }\n};\n\n//-----------------------------------------------------------------------------\n// [SECTION] Helpers (ImGuiOnceUponAFrame, ImGuiTextFilter, ImGuiTextBuffer, ImGuiStorage, ImGuiListClipper, ImColor)\n//-----------------------------------------------------------------------------\n\n// Helper: Unicode defines\n#define IM_UNICODE_CODEPOINT_INVALID 0xFFFD     // Invalid Unicode code point (standard value).\n#ifdef IMGUI_USE_WCHAR32\n#define IM_UNICODE_CODEPOINT_MAX     0x10FFFF   // Maximum Unicode code point supported by this build.\n#else\n#define IM_UNICODE_CODEPOINT_MAX     0xFFFF     // Maximum Unicode code point supported by this build.\n#endif\n\n// Helper: Execute a block of code at maximum once a frame. Convenient if you want to quickly create an UI within deep-nested code that runs multiple times every frame.\n// Usage: static ImGuiOnceUponAFrame oaf; if (oaf) ImGui::Text(\"This will be called only once per frame\");\nstruct ImGuiOnceUponAFrame\n{\n    ImGuiOnceUponAFrame() { RefFrame = -1; }\n    mutable int RefFrame;\n    operator bool() const { int current_frame = ImGui::GetFrameCount(); if (RefFrame == current_frame) return false; RefFrame = current_frame; return true; }\n};\n\n// Helper: Parse and apply text filters. In format \"aaaaa[,bbbb][,ccccc]\"\nstruct ImGuiTextFilter\n{\n    IMGUI_API           ImGuiTextFilter(const char* default_filter = \"\");\n    IMGUI_API bool      Draw(const char* label = \"Filter (inc,-exc)\", float width = 0.0f);  // Helper calling InputText+Build\n    IMGUI_API bool      PassFilter(const char* text, const char* text_end = NULL) const;\n    IMGUI_API void      Build();\n    void                Clear()          { InputBuf[0] = 0; Build(); }\n    bool                IsActive() const { return !Filters.empty(); }\n\n    // [Internal]\n    struct ImGuiTextRange\n    {\n        const char*     b;\n        const char*     e;\n\n        ImGuiTextRange()                                { b = e = NULL; }\n        ImGuiTextRange(const char* _b, const char* _e)  { b = _b; e = _e; }\n        bool            empty() const                   { return b == e; }\n        IMGUI_API void  split(char separator, ImVector<ImGuiTextRange>* out) const;\n    };\n    char                    InputBuf[256];\n    ImVector<ImGuiTextRange>Filters;\n    int                     CountGrep;\n};\n\n// Helper: Growable text buffer for logging/accumulating text\n// (this could be called 'ImGuiTextBuilder' / 'ImGuiStringBuilder')\nstruct ImGuiTextBuffer\n{\n    ImVector<char>      Buf;\n    IMGUI_API static char EmptyString[1];\n\n    ImGuiTextBuffer()   { }\n    inline char         operator[](int i) const { IM_ASSERT(Buf.Data != NULL); return Buf.Data[i]; }\n    const char*         begin() const           { return Buf.Data ? &Buf.front() : EmptyString; }\n    const char*         end() const             { return Buf.Data ? &Buf.back() : EmptyString; }   // Buf is zero-terminated, so end() will point on the zero-terminator\n    int                 size() const            { return Buf.Size ? Buf.Size - 1 : 0; }\n    bool                empty() const           { return Buf.Size <= 1; }\n    void                clear()                 { Buf.clear(); }\n    void                reserve(int capacity)   { Buf.reserve(capacity); }\n    const char*         c_str() const           { return Buf.Data ? Buf.Data : EmptyString; }\n    IMGUI_API void      append(const char* str, const char* str_end = NULL);\n    IMGUI_API void      appendf(const char* fmt, ...) IM_FMTARGS(2);\n    IMGUI_API void      appendfv(const char* fmt, va_list args) IM_FMTLIST(2);\n};\n\n// Helper: Key->Value storage\n// Typically you don't have to worry about this since a storage is held within each Window.\n// We use it to e.g. store collapse state for a tree (Int 0/1)\n// This is optimized for efficient lookup (dichotomy into a contiguous buffer) and rare insertion (typically tied to user interactions aka max once a frame)\n// You can use it as custom user storage for temporary values. Declare your own storage if, for example:\n// - You want to manipulate the open/close state of a particular sub-tree in your interface (tree node uses Int 0/1 to store their state).\n// - You want to store custom debug data easily without adding or editing structures in your code (probably not efficient, but convenient)\n// Types are NOT stored, so it is up to you to make sure your Key don't collide with different types.\nstruct ImGuiStorage\n{\n    // [Internal]\n    struct ImGuiStoragePair\n    {\n        ImGuiID key;\n        union { int val_i; float val_f; void* val_p; };\n        ImGuiStoragePair(ImGuiID _key, int _val_i)      { key = _key; val_i = _val_i; }\n        ImGuiStoragePair(ImGuiID _key, float _val_f)    { key = _key; val_f = _val_f; }\n        ImGuiStoragePair(ImGuiID _key, void* _val_p)    { key = _key; val_p = _val_p; }\n    };\n\n    ImVector<ImGuiStoragePair>      Data;\n\n    // - Get***() functions find pair, never add/allocate. Pairs are sorted so a query is O(log N)\n    // - Set***() functions find pair, insertion on demand if missing.\n    // - Sorted insertion is costly, paid once. A typical frame shouldn't need to insert any new pair.\n    void                Clear() { Data.clear(); }\n    IMGUI_API int       GetInt(ImGuiID key, int default_val = 0) const;\n    IMGUI_API void      SetInt(ImGuiID key, int val);\n    IMGUI_API bool      GetBool(ImGuiID key, bool default_val = false) const;\n    IMGUI_API void      SetBool(ImGuiID key, bool val);\n    IMGUI_API float     GetFloat(ImGuiID key, float default_val = 0.0f) const;\n    IMGUI_API void      SetFloat(ImGuiID key, float val);\n    IMGUI_API void*     GetVoidPtr(ImGuiID key) const; // default_val is NULL\n    IMGUI_API void      SetVoidPtr(ImGuiID key, void* val);\n\n    // - Get***Ref() functions finds pair, insert on demand if missing, return pointer. Useful if you intend to do Get+Set.\n    // - References are only valid until a new value is added to the storage. Calling a Set***() function or a Get***Ref() function invalidates the pointer.\n    // - A typical use case where this is convenient for quick hacking (e.g. add storage during a live Edit&Continue session if you can't modify existing struct)\n    //      float* pvar = ImGui::GetFloatRef(key); ImGui::SliderFloat(\"var\", pvar, 0, 100.0f); some_var += *pvar;\n    IMGUI_API int*      GetIntRef(ImGuiID key, int default_val = 0);\n    IMGUI_API bool*     GetBoolRef(ImGuiID key, bool default_val = false);\n    IMGUI_API float*    GetFloatRef(ImGuiID key, float default_val = 0.0f);\n    IMGUI_API void**    GetVoidPtrRef(ImGuiID key, void* default_val = NULL);\n\n    // Use on your own storage if you know only integer are being stored (open/close all tree nodes)\n    IMGUI_API void      SetAllInt(int val);\n\n    // For quicker full rebuild of a storage (instead of an incremental one), you may add all your contents and then sort once.\n    IMGUI_API void      BuildSortByKey();\n};\n\n// Helper: Manually clip large list of items.\n// If you are submitting lots of evenly spaced items and you have a random access to the list, you can perform coarse\n// clipping based on visibility to save yourself from processing those items at all.\n// The clipper calculates the range of visible items and advance the cursor to compensate for the non-visible items we have skipped.\n// (Dear ImGui already clip items based on their bounds but it needs to measure text size to do so, whereas manual coarse clipping before submission makes this cost and your own data fetching/submission cost almost null)\n// Usage:\n//   ImGuiListClipper clipper;\n//   clipper.Begin(1000);         // We have 1000 elements, evenly spaced.\n//   while (clipper.Step())\n//       for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++)\n//           ImGui::Text(\"line number %d\", i);\n// Generally what happens is:\n// - Clipper lets you process the first element (DisplayStart = 0, DisplayEnd = 1) regardless of it being visible or not.\n// - User code submit one element.\n// - Clipper can measure the height of the first element\n// - Clipper calculate the actual range of elements to display based on the current clipping rectangle, position the cursor before the first visible element.\n// - User code submit visible elements.\nstruct ImGuiListClipper\n{\n    int     DisplayStart;\n    int     DisplayEnd;\n\n    // [Internal]\n    int     ItemsCount;\n    int     StepNo;\n    int     ItemsFrozen;\n    float   ItemsHeight;\n    float   StartPosY;\n\n    IMGUI_API ImGuiListClipper();\n    IMGUI_API ~ImGuiListClipper();\n\n    // items_count: Use INT_MAX if you don't know how many items you have (in which case the cursor won't be advanced in the final step)\n    // items_height: Use -1.0f to be calculated automatically on first step. Otherwise pass in the distance between your items, typically GetTextLineHeightWithSpacing() or GetFrameHeightWithSpacing().\n    IMGUI_API void Begin(int items_count, float items_height = -1.0f);  // Automatically called by constructor if you passed 'items_count' or by Step() in Step 1.\n    IMGUI_API void End();                                               // Automatically called on the last call of Step() that returns false.\n    IMGUI_API bool Step();                                              // Call until it returns false. The DisplayStart/DisplayEnd fields will be set and you can process/draw those items.\n\n#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS\n    inline ImGuiListClipper(int items_count, float items_height = -1.0f) { memset(this, 0, sizeof(*this)); ItemsCount = -1; Begin(items_count, items_height); } // [removed in 1.79]\n#endif\n};\n\n// Helpers macros to generate 32-bit encoded colors\n#ifdef IMGUI_USE_BGRA_PACKED_COLOR\n#define IM_COL32_R_SHIFT    16\n#define IM_COL32_G_SHIFT    8\n#define IM_COL32_B_SHIFT    0\n#define IM_COL32_A_SHIFT    24\n#define IM_COL32_A_MASK     0xFF000000\n#else\n#define IM_COL32_R_SHIFT    0\n#define IM_COL32_G_SHIFT    8\n#define IM_COL32_B_SHIFT    16\n#define IM_COL32_A_SHIFT    24\n#define IM_COL32_A_MASK     0xFF000000\n#endif\n#define IM_COL32(R,G,B,A)    (((ImU32)(A)<<IM_COL32_A_SHIFT) | ((ImU32)(B)<<IM_COL32_B_SHIFT) | ((ImU32)(G)<<IM_COL32_G_SHIFT) | ((ImU32)(R)<<IM_COL32_R_SHIFT))\n#define IM_COL32_WHITE       IM_COL32(255,255,255,255)  // Opaque white = 0xFFFFFFFF\n#define IM_COL32_BLACK       IM_COL32(0,0,0,255)        // Opaque black\n#define IM_COL32_BLACK_TRANS IM_COL32(0,0,0,0)          // Transparent black = 0x00000000\n\n// Helper: ImColor() implicitly converts colors to either ImU32 (packed 4x1 byte) or ImVec4 (4x1 float)\n// Prefer using IM_COL32() macros if you want a guaranteed compile-time ImU32 for usage with ImDrawList API.\n// **Avoid storing ImColor! Store either u32 of ImVec4. This is not a full-featured color class. MAY OBSOLETE.\n// **None of the ImGui API are using ImColor directly but you can use it as a convenience to pass colors in either ImU32 or ImVec4 formats. Explicitly cast to ImU32 or ImVec4 if needed.\nstruct ImColor\n{\n    ImVec4              Value;\n\n    ImColor()                                                       { Value.x = Value.y = Value.z = Value.w = 0.0f; }\n    ImColor(int r, int g, int b, int a = 255)                       { float sc = 1.0f / 255.0f; Value.x = (float)r * sc; Value.y = (float)g * sc; Value.z = (float)b * sc; Value.w = (float)a * sc; }\n    ImColor(ImU32 rgba)                                             { float sc = 1.0f / 255.0f; Value.x = (float)((rgba >> IM_COL32_R_SHIFT) & 0xFF) * sc; Value.y = (float)((rgba >> IM_COL32_G_SHIFT) & 0xFF) * sc; Value.z = (float)((rgba >> IM_COL32_B_SHIFT) & 0xFF) * sc; Value.w = (float)((rgba >> IM_COL32_A_SHIFT) & 0xFF) * sc; }\n    ImColor(float r, float g, float b, float a = 1.0f)              { Value.x = r; Value.y = g; Value.z = b; Value.w = a; }\n    ImColor(const ImVec4& col)                                      { Value = col; }\n    inline operator ImU32() const                                   { return ImGui::ColorConvertFloat4ToU32(Value); }\n    inline operator ImVec4() const                                  { return Value; }\n\n    // FIXME-OBSOLETE: May need to obsolete/cleanup those helpers.\n    inline void    SetHSV(float h, float s, float v, float a = 1.0f){ ImGui::ColorConvertHSVtoRGB(h, s, v, Value.x, Value.y, Value.z); Value.w = a; }\n    static ImColor HSV(float h, float s, float v, float a = 1.0f)   { float r, g, b; ImGui::ColorConvertHSVtoRGB(h, s, v, r, g, b); return ImColor(r, g, b, a); }\n};\n\n//-----------------------------------------------------------------------------\n// [SECTION] Drawing API (ImDrawCmd, ImDrawIdx, ImDrawVert, ImDrawChannel, ImDrawListSplitter, ImDrawListFlags, ImDrawList, ImDrawData)\n// Hold a series of drawing commands. The user provides a renderer for ImDrawData which essentially contains an array of ImDrawList.\n//-----------------------------------------------------------------------------\n\n// The maximum line width to bake anti-aliased textures for. Build atlas with ImFontAtlasFlags_NoBakedLines to disable baking.\n#ifndef IM_DRAWLIST_TEX_LINES_WIDTH_MAX\n#define IM_DRAWLIST_TEX_LINES_WIDTH_MAX     (63)\n#endif\n\n// ImDrawCallback: Draw callbacks for advanced uses [configurable type: override in imconfig.h]\n// NB: You most likely do NOT need to use draw callbacks just to create your own widget or customized UI rendering,\n// you can poke into the draw list for that! Draw callback may be useful for example to:\n//  A) Change your GPU render state,\n//  B) render a complex 3D scene inside a UI element without an intermediate texture/render target, etc.\n// The expected behavior from your rendering function is 'if (cmd.UserCallback != NULL) { cmd.UserCallback(parent_list, cmd); } else { RenderTriangles() }'\n// If you want to override the signature of ImDrawCallback, you can simply use e.g. '#define ImDrawCallback MyDrawCallback' (in imconfig.h) + update rendering backend accordingly.\n#ifndef ImDrawCallback\ntypedef void (*ImDrawCallback)(const ImDrawList* parent_list, const ImDrawCmd* cmd);\n#endif\n\n// Special Draw callback value to request renderer backend to reset the graphics/render state.\n// The renderer backend needs to handle this special value, otherwise it will crash trying to call a function at this address.\n// This is useful for example if you submitted callbacks which you know have altered the render state and you want it to be restored.\n// It is not done by default because they are many perfectly useful way of altering render state for imgui contents (e.g. changing shader/blending settings before an Image call).\n#define ImDrawCallback_ResetRenderState     (ImDrawCallback)(-1)\n\n// Typically, 1 command = 1 GPU draw call (unless command is a callback)\n// - VtxOffset/IdxOffset: When 'io.BackendFlags & ImGuiBackendFlags_RendererHasVtxOffset' is enabled,\n//   those fields allow us to render meshes larger than 64K vertices while keeping 16-bit indices.\n//   Pre-1.71 backends will typically ignore the VtxOffset/IdxOffset fields.\n// - The ClipRect/TextureId/VtxOffset fields must be contiguous as we memcmp() them together (this is asserted for).\nstruct ImDrawCmd\n{\n    ImVec4          ClipRect;           // 4*4  // Clipping rectangle (x1, y1, x2, y2). Subtract ImDrawData->DisplayPos to get clipping rectangle in \"viewport\" coordinates\n    ImTextureID     TextureId;          // 4-8  // User-provided texture ID. Set by user in ImfontAtlas::SetTexID() for fonts or passed to Image*() functions. Ignore if never using images or multiple fonts atlas.\n    unsigned int    VtxOffset;          // 4    // Start offset in vertex buffer. ImGuiBackendFlags_RendererHasVtxOffset: always 0, otherwise may be >0 to support meshes larger than 64K vertices with 16-bit indices.\n    unsigned int    IdxOffset;          // 4    // Start offset in index buffer. Always equal to sum of ElemCount drawn so far.\n    unsigned int    ElemCount;          // 4    // Number of indices (multiple of 3) to be rendered as triangles. Vertices are stored in the callee ImDrawList's vtx_buffer[] array, indices in idx_buffer[].\n    ImDrawCallback  UserCallback;       // 4-8  // If != NULL, call the function instead of rendering the vertices. clip_rect and texture_id will be set normally.\n    void*           UserCallbackData;   // 4-8  // The draw callback code can access this.\n\n    ImDrawCmd() { memset(this, 0, sizeof(*this)); } // Also ensure our padding fields are zeroed\n\n    // Since 1.83: returns ImTextureID associated with this draw call. Warning: DO NOT assume this is always same as 'TextureId' (we will change this function for an upcoming feature)\n    inline ImTextureID GetTexID() const { return TextureId; }\n};\n\n// Vertex layout\n#ifndef IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT\nstruct ImDrawVert\n{\n    ImVec2  pos;\n    ImVec2  uv;\n    ImU32   col;\n};\n#else\n// You can override the vertex format layout by defining IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT in imconfig.h\n// The code expect ImVec2 pos (8 bytes), ImVec2 uv (8 bytes), ImU32 col (4 bytes), but you can re-order them or add other fields as needed to simplify integration in your engine.\n// The type has to be described within the macro (you can either declare the struct or use a typedef). This is because ImVec2/ImU32 are likely not declared a the time you'd want to set your type up.\n// NOTE: IMGUI DOESN'T CLEAR THE STRUCTURE AND DOESN'T CALL A CONSTRUCTOR SO ANY CUSTOM FIELD WILL BE UNINITIALIZED. IF YOU ADD EXTRA FIELDS (SUCH AS A 'Z' COORDINATES) YOU WILL NEED TO CLEAR THEM DURING RENDER OR TO IGNORE THEM.\nIMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT;\n#endif\n\n// [Internal] For use by ImDrawList\nstruct ImDrawCmdHeader\n{\n    ImVec4          ClipRect;\n    ImTextureID     TextureId;\n    unsigned int    VtxOffset;\n};\n\n// [Internal] For use by ImDrawListSplitter\nstruct ImDrawChannel\n{\n    ImVector<ImDrawCmd>         _CmdBuffer;\n    ImVector<ImDrawIdx>         _IdxBuffer;\n};\n\n\n// Split/Merge functions are used to split the draw list into different layers which can be drawn into out of order.\n// This is used by the Columns/Tables API, so items of each column can be batched together in a same draw call.\nstruct ImDrawListSplitter\n{\n    int                         _Current;    // Current channel number (0)\n    int                         _Count;      // Number of active channels (1+)\n    ImVector<ImDrawChannel>     _Channels;   // Draw channels (not resized down so _Count might be < Channels.Size)\n\n    inline ImDrawListSplitter()  { memset(this, 0, sizeof(*this)); }\n    inline ~ImDrawListSplitter() { ClearFreeMemory(); }\n    inline void                 Clear() { _Current = 0; _Count = 1; } // Do not clear Channels[] so our allocations are reused next frame\n    IMGUI_API void              ClearFreeMemory();\n    IMGUI_API void              Split(ImDrawList* draw_list, int count);\n    IMGUI_API void              Merge(ImDrawList* draw_list);\n    IMGUI_API void              SetCurrentChannel(ImDrawList* draw_list, int channel_idx);\n};\n\n// Flags for ImDrawList functions\n// (Legacy: bit 0 must always correspond to ImDrawFlags_Closed to be backward compatible with old API using a bool. Bits 1..3 must be unused)\nenum ImDrawFlags_\n{\n    ImDrawFlags_None                        = 0,\n    ImDrawFlags_Closed                      = 1 << 0, // PathStroke(), AddPolyline(): specify that shape should be closed (Important: this is always == 1 for legacy reason)\n    ImDrawFlags_RoundCornersTopLeft         = 1 << 4, // AddRect(), AddRectFilled(), PathRect(): enable rounding top-left corner only (when rounding > 0.0f, we default to all corners). Was 0x01.\n    ImDrawFlags_RoundCornersTopRight        = 1 << 5, // AddRect(), AddRectFilled(), PathRect(): enable rounding top-right corner only (when rounding > 0.0f, we default to all corners). Was 0x02.\n    ImDrawFlags_RoundCornersBottomLeft      = 1 << 6, // AddRect(), AddRectFilled(), PathRect(): enable rounding bottom-left corner only (when rounding > 0.0f, we default to all corners). Was 0x04.\n    ImDrawFlags_RoundCornersBottomRight     = 1 << 7, // AddRect(), AddRectFilled(), PathRect(): enable rounding bottom-right corner only (when rounding > 0.0f, we default to all corners). Wax 0x08.\n    ImDrawFlags_RoundCornersNone            = 1 << 8, // AddRect(), AddRectFilled(), PathRect(): disable rounding on all corners (when rounding > 0.0f). This is NOT zero, NOT an implicit flag!\n    ImDrawFlags_RoundCornersTop             = ImDrawFlags_RoundCornersTopLeft | ImDrawFlags_RoundCornersTopRight,\n    ImDrawFlags_RoundCornersBottom          = ImDrawFlags_RoundCornersBottomLeft | ImDrawFlags_RoundCornersBottomRight,\n    ImDrawFlags_RoundCornersLeft            = ImDrawFlags_RoundCornersBottomLeft | ImDrawFlags_RoundCornersTopLeft,\n    ImDrawFlags_RoundCornersRight           = ImDrawFlags_RoundCornersBottomRight | ImDrawFlags_RoundCornersTopRight,\n    ImDrawFlags_RoundCornersAll             = ImDrawFlags_RoundCornersTopLeft | ImDrawFlags_RoundCornersTopRight | ImDrawFlags_RoundCornersBottomLeft | ImDrawFlags_RoundCornersBottomRight,\n    ImDrawFlags_RoundCornersDefault_        = ImDrawFlags_RoundCornersAll, // Default to ALL corners if none of the _RoundCornersXX flags are specified.\n    ImDrawFlags_RoundCornersMask_           = ImDrawFlags_RoundCornersAll | ImDrawFlags_RoundCornersNone\n};\n\n// Flags for ImDrawList instance. Those are set automatically by ImGui:: functions from ImGuiIO settings, and generally not manipulated directly.\n// It is however possible to temporarily alter flags between calls to ImDrawList:: functions.\nenum ImDrawListFlags_\n{\n    ImDrawListFlags_None                    = 0,\n    ImDrawListFlags_AntiAliasedLines        = 1 << 0,  // Enable anti-aliased lines/borders (*2 the number of triangles for 1.0f wide line or lines thin enough to be drawn using textures, otherwise *3 the number of triangles)\n    ImDrawListFlags_AntiAliasedLinesUseTex  = 1 << 1,  // Enable anti-aliased lines/borders using textures when possible. Require backend to render with bilinear filtering.\n    ImDrawListFlags_AntiAliasedFill         = 1 << 2,  // Enable anti-aliased edge around filled shapes (rounded rectangles, circles).\n    ImDrawListFlags_AllowVtxOffset          = 1 << 3   // Can emit 'VtxOffset > 0' to allow large meshes. Set when 'ImGuiBackendFlags_RendererHasVtxOffset' is enabled.\n};\n\n// Draw command list\n// This is the low-level list of polygons that ImGui:: functions are filling. At the end of the frame,\n// all command lists are passed to your ImGuiIO::RenderDrawListFn function for rendering.\n// Each dear imgui window contains its own ImDrawList. You can use ImGui::GetWindowDrawList() to\n// access the current window draw list and draw custom primitives.\n// You can interleave normal ImGui:: calls and adding primitives to the current draw list.\n// In single viewport mode, top-left is == GetMainViewport()->Pos (generally 0,0), bottom-right is == GetMainViewport()->Pos+Size (generally io.DisplaySize).\n// You are totally free to apply whatever transformation matrix to want to the data (depending on the use of the transformation you may want to apply it to ClipRect as well!)\n// Important: Primitives are always added to the list and not culled (culling is done at higher-level by ImGui:: functions), if you use this API a lot consider coarse culling your drawn objects.\nstruct ImDrawList\n{\n    // This is what you have to render\n    ImVector<ImDrawCmd>     CmdBuffer;          // Draw commands. Typically 1 command = 1 GPU draw call, unless the command is a callback.\n    ImVector<ImDrawIdx>     IdxBuffer;          // Index buffer. Each command consume ImDrawCmd::ElemCount of those\n    ImVector<ImDrawVert>    VtxBuffer;          // Vertex buffer.\n    ImDrawListFlags         Flags;              // Flags, you may poke into these to adjust anti-aliasing settings per-primitive.\n\n    // [Internal, used while building lists]\n    unsigned int            _VtxCurrentIdx;     // [Internal] generally == VtxBuffer.Size unless we are past 64K vertices, in which case this gets reset to 0.\n    const ImDrawListSharedData* _Data;          // Pointer to shared draw data (you can use ImGui::GetDrawListSharedData() to get the one from current ImGui context)\n    const char*             _OwnerName;         // Pointer to owner window's name for debugging\n    ImDrawVert*             _VtxWritePtr;       // [Internal] point within VtxBuffer.Data after each add command (to avoid using the ImVector<> operators too much)\n    ImDrawIdx*              _IdxWritePtr;       // [Internal] point within IdxBuffer.Data after each add command (to avoid using the ImVector<> operators too much)\n    ImVector<ImVec4>        _ClipRectStack;     // [Internal]\n    ImVector<ImTextureID>   _TextureIdStack;    // [Internal]\n    ImVector<ImVec2>        _Path;              // [Internal] current path building\n    ImDrawCmdHeader         _CmdHeader;         // [Internal] template of active commands. Fields should match those of CmdBuffer.back().\n    ImDrawListSplitter      _Splitter;          // [Internal] for channels api (note: prefer using your own persistent instance of ImDrawListSplitter!)\n    float                   _FringeScale;       // [Internal] anti-alias fringe is scaled by this value, this helps to keep things sharp while zooming at vertex buffer content\n\n    // If you want to create ImDrawList instances, pass them ImGui::GetDrawListSharedData() or create and use your own ImDrawListSharedData (so you can use ImDrawList without ImGui)\n    ImDrawList(const ImDrawListSharedData* shared_data) { memset(this, 0, sizeof(*this)); _Data = shared_data; }\n\n    ~ImDrawList() { _ClearFreeMemory(); }\n    IMGUI_API void  PushClipRect(ImVec2 clip_rect_min, ImVec2 clip_rect_max, bool intersect_with_current_clip_rect = false);  // Render-level scissoring. This is passed down to your render function but not used for CPU-side coarse clipping. Prefer using higher-level ImGui::PushClipRect() to affect logic (hit-testing and widget culling)\n    IMGUI_API void  PushClipRectFullScreen();\n    IMGUI_API void  PopClipRect();\n    IMGUI_API void  PushTextureID(ImTextureID texture_id);\n    IMGUI_API void  PopTextureID();\n    inline ImVec2   GetClipRectMin() const { const ImVec4& cr = _ClipRectStack.back(); return ImVec2(cr.x, cr.y); }\n    inline ImVec2   GetClipRectMax() const { const ImVec4& cr = _ClipRectStack.back(); return ImVec2(cr.z, cr.w); }\n\n    // Primitives\n    // - For rectangular primitives, \"p_min\" and \"p_max\" represent the upper-left and lower-right corners.\n    // - For circle primitives, use \"num_segments == 0\" to automatically calculate tessellation (preferred).\n    //   In older versions (until Dear ImGui 1.77) the AddCircle functions defaulted to num_segments == 12.\n    //   In future versions we will use textures to provide cheaper and higher-quality circles.\n    //   Use AddNgon() and AddNgonFilled() functions if you need to guaranteed a specific number of sides.\n    IMGUI_API void  AddLine(const ImVec2& p1, const ImVec2& p2, ImU32 col, float thickness = 1.0f);\n    IMGUI_API void  AddRect(const ImVec2& p_min, const ImVec2& p_max, ImU32 col, float rounding = 0.0f, ImDrawFlags flags = 0, float thickness = 1.0f);   // a: upper-left, b: lower-right (== upper-left + size)\n    IMGUI_API void  AddRectFilled(const ImVec2& p_min, const ImVec2& p_max, ImU32 col, float rounding = 0.0f, ImDrawFlags flags = 0);                     // a: upper-left, b: lower-right (== upper-left + size)\n    IMGUI_API void  AddRectFilledMultiColor(const ImVec2& p_min, const ImVec2& p_max, ImU32 col_upr_left, ImU32 col_upr_right, ImU32 col_bot_right, ImU32 col_bot_left);\n    IMGUI_API void  AddQuad(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, ImU32 col, float thickness = 1.0f);\n    IMGUI_API void  AddQuadFilled(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, ImU32 col);\n    IMGUI_API void  AddTriangle(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, ImU32 col, float thickness = 1.0f);\n    IMGUI_API void  AddTriangleFilled(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, ImU32 col);\n    IMGUI_API void  AddCircle(const ImVec2& center, float radius, ImU32 col, int num_segments = 0, float thickness = 1.0f);\n    IMGUI_API void  AddCircleFilled(const ImVec2& center, float radius, ImU32 col, int num_segments = 0);\n    IMGUI_API void  AddNgon(const ImVec2& center, float radius, ImU32 col, int num_segments, float thickness = 1.0f);\n    IMGUI_API void  AddNgonFilled(const ImVec2& center, float radius, ImU32 col, int num_segments);\n    IMGUI_API void  AddText(const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end = NULL);\n    IMGUI_API void  AddText(const ImFont* font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end = NULL, float wrap_width = 0.0f, const ImVec4* cpu_fine_clip_rect = NULL);\n    IMGUI_API void  AddPolyline(const ImVec2* points, int num_points, ImU32 col, ImDrawFlags flags, float thickness);\n    IMGUI_API void  AddConvexPolyFilled(const ImVec2* points, int num_points, ImU32 col); // Note: Anti-aliased filling requires points to be in clockwise order.\n    IMGUI_API void  AddBezierCubic(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, ImU32 col, float thickness, int num_segments = 0); // Cubic Bezier (4 control points)\n    IMGUI_API void  AddBezierQuadratic(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, ImU32 col, float thickness, int num_segments = 0);               // Quadratic Bezier (3 control points)\n\n    // Image primitives\n    // - Read FAQ to understand what ImTextureID is.\n    // - \"p_min\" and \"p_max\" represent the upper-left and lower-right corners of the rectangle.\n    // - \"uv_min\" and \"uv_max\" represent the normalized texture coordinates to use for those corners. Using (0,0)->(1,1) texture coordinates will generally display the entire texture.\n    IMGUI_API void  AddImage(ImTextureID user_texture_id, const ImVec2& p_min, const ImVec2& p_max, const ImVec2& uv_min = ImVec2(0, 0), const ImVec2& uv_max = ImVec2(1, 1), ImU32 col = IM_COL32_WHITE);\n    IMGUI_API void  AddImageQuad(ImTextureID user_texture_id, const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, const ImVec2& uv1 = ImVec2(0, 0), const ImVec2& uv2 = ImVec2(1, 0), const ImVec2& uv3 = ImVec2(1, 1), const ImVec2& uv4 = ImVec2(0, 1), ImU32 col = IM_COL32_WHITE);\n    IMGUI_API void  AddImageRounded(ImTextureID user_texture_id, const ImVec2& p_min, const ImVec2& p_max, const ImVec2& uv_min, const ImVec2& uv_max, ImU32 col, float rounding, ImDrawFlags flags = 0);\n\n    // Stateful path API, add points then finish with PathFillConvex() or PathStroke()\n    inline    void  PathClear()                                                 { _Path.Size = 0; }\n    inline    void  PathLineTo(const ImVec2& pos)                               { _Path.push_back(pos); }\n    inline    void  PathLineToMergeDuplicate(const ImVec2& pos)                 { if (_Path.Size == 0 || memcmp(&_Path.Data[_Path.Size - 1], &pos, 8) != 0) _Path.push_back(pos); }\n    inline    void  PathFillConvex(ImU32 col)                                   { AddConvexPolyFilled(_Path.Data, _Path.Size, col); _Path.Size = 0; }  // Note: Anti-aliased filling requires points to be in clockwise order.\n    inline    void  PathStroke(ImU32 col, ImDrawFlags flags = 0, float thickness = 1.0f) { AddPolyline(_Path.Data, _Path.Size, col, flags, thickness); _Path.Size = 0; }\n    IMGUI_API void  PathArcTo(const ImVec2& center, float radius, float a_min, float a_max, int num_segments = 0);\n    IMGUI_API void  PathArcToFast(const ImVec2& center, float radius, int a_min_of_12, int a_max_of_12);                // Use precomputed angles for a 12 steps circle\n    IMGUI_API void  PathBezierCubicCurveTo(const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, int num_segments = 0); // Cubic Bezier (4 control points)\n    IMGUI_API void  PathBezierQuadraticCurveTo(const ImVec2& p2, const ImVec2& p3, int num_segments = 0);               // Quadratic Bezier (3 control points)\n    IMGUI_API void  PathRect(const ImVec2& rect_min, const ImVec2& rect_max, float rounding = 0.0f, ImDrawFlags flags = 0);\n\n    // Advanced\n    IMGUI_API void  AddCallback(ImDrawCallback callback, void* callback_data);  // Your rendering function must check for 'UserCallback' in ImDrawCmd and call the function instead of rendering triangles.\n    IMGUI_API void  AddDrawCmd();                                               // This is useful if you need to forcefully create a new draw call (to allow for dependent rendering / blending). Otherwise primitives are merged into the same draw-call as much as possible\n    IMGUI_API ImDrawList* CloneOutput() const;                                  // Create a clone of the CmdBuffer/IdxBuffer/VtxBuffer.\n\n    // Advanced: Channels\n    // - Use to split render into layers. By switching channels to can render out-of-order (e.g. submit FG primitives before BG primitives)\n    // - Use to minimize draw calls (e.g. if going back-and-forth between multiple clipping rectangles, prefer to append into separate channels then merge at the end)\n    // - FIXME-OBSOLETE: This API shouldn't have been in ImDrawList in the first place!\n    //   Prefer using your own persistent instance of ImDrawListSplitter as you can stack them.\n    //   Using the ImDrawList::ChannelsXXXX you cannot stack a split over another.\n    inline void     ChannelsSplit(int count)    { _Splitter.Split(this, count); }\n    inline void     ChannelsMerge()             { _Splitter.Merge(this); }\n    inline void     ChannelsSetCurrent(int n)   { _Splitter.SetCurrentChannel(this, n); }\n\n    // Advanced: Primitives allocations\n    // - We render triangles (three vertices)\n    // - All primitives needs to be reserved via PrimReserve() beforehand.\n    IMGUI_API void  PrimReserve(int idx_count, int vtx_count);\n    IMGUI_API void  PrimUnreserve(int idx_count, int vtx_count);\n    IMGUI_API void  PrimRect(const ImVec2& a, const ImVec2& b, ImU32 col);      // Axis aligned rectangle (composed of two triangles)\n    IMGUI_API void  PrimRectUV(const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, ImU32 col);\n    IMGUI_API void  PrimQuadUV(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, const ImVec2& uv_a, const ImVec2& uv_b, const ImVec2& uv_c, const ImVec2& uv_d, ImU32 col);\n    inline    void  PrimWriteVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col)    { _VtxWritePtr->pos = pos; _VtxWritePtr->uv = uv; _VtxWritePtr->col = col; _VtxWritePtr++; _VtxCurrentIdx++; }\n    inline    void  PrimWriteIdx(ImDrawIdx idx)                                     { *_IdxWritePtr = idx; _IdxWritePtr++; }\n    inline    void  PrimVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col)         { PrimWriteIdx((ImDrawIdx)_VtxCurrentIdx); PrimWriteVtx(pos, uv, col); } // Write vertex with unique index\n\n#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS\n    inline    void  AddBezierCurve(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, ImU32 col, float thickness, int num_segments = 0) { AddBezierCubic(p1, p2, p3, p4, col, thickness, num_segments); }\n    inline    void  PathBezierCurveTo(const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, int num_segments = 0) { PathBezierCubicCurveTo(p2, p3, p4, num_segments); }\n#endif\n\n    // [Internal helpers]\n    IMGUI_API void  _ResetForNewFrame();\n    IMGUI_API void  _ClearFreeMemory();\n    IMGUI_API void  _PopUnusedDrawCmd();\n    IMGUI_API void  _TryMergeDrawCmds();\n    IMGUI_API void  _OnChangedClipRect();\n    IMGUI_API void  _OnChangedTextureID();\n    IMGUI_API void  _OnChangedVtxOffset();\n    IMGUI_API int   _CalcCircleAutoSegmentCount(float radius) const;\n    IMGUI_API void  _PathArcToFastEx(const ImVec2& center, float radius, int a_min_sample, int a_max_sample, int a_step);\n    IMGUI_API void  _PathArcToN(const ImVec2& center, float radius, float a_min, float a_max, int num_segments);\n};\n\n// All draw data to render a Dear ImGui frame\n// (NB: the style and the naming convention here is a little inconsistent, we currently preserve them for backward compatibility purpose,\n// as this is one of the oldest structure exposed by the library! Basically, ImDrawList == CmdList)\nstruct ImDrawData\n{\n    bool            Valid;                  // Only valid after Render() is called and before the next NewFrame() is called.\n    int             CmdListsCount;          // Number of ImDrawList* to render\n    int             TotalIdxCount;          // For convenience, sum of all ImDrawList's IdxBuffer.Size\n    int             TotalVtxCount;          // For convenience, sum of all ImDrawList's VtxBuffer.Size\n    ImDrawList**    CmdLists;               // Array of ImDrawList* to render. The ImDrawList are owned by ImGuiContext and only pointed to from here.\n    ImVec2          DisplayPos;             // Top-left position of the viewport to render (== top-left of the orthogonal projection matrix to use) (== GetMainViewport()->Pos for the main viewport, == (0.0) in most single-viewport applications)\n    ImVec2          DisplaySize;            // Size of the viewport to render (== GetMainViewport()->Size for the main viewport, == io.DisplaySize in most single-viewport applications)\n    ImVec2          FramebufferScale;       // Amount of pixels for each unit of DisplaySize. Based on io.DisplayFramebufferScale. Generally (1,1) on normal display, (2,2) on OSX with Retina display.\n\n    // Functions\n    ImDrawData()    { Clear(); }\n    void Clear()    { memset(this, 0, sizeof(*this)); }     // The ImDrawList are owned by ImGuiContext!\n    IMGUI_API void  DeIndexAllBuffers();                    // Helper to convert all buffers from indexed to non-indexed, in case you cannot render indexed. Note: this is slow and most likely a waste of resources. Always prefer indexed rendering!\n    IMGUI_API void  ScaleClipRects(const ImVec2& fb_scale); // Helper to scale the ClipRect field of each ImDrawCmd. Use if your final output buffer is at a different scale than Dear ImGui expects, or if there is a difference between your window resolution and framebuffer resolution.\n};\n\n//-----------------------------------------------------------------------------\n// [SECTION] Font API (ImFontConfig, ImFontGlyph, ImFontAtlasFlags, ImFontAtlas, ImFontGlyphRangesBuilder, ImFont)\n//-----------------------------------------------------------------------------\n\nstruct ImFontConfig\n{\n    void*           FontData;               //          // TTF/OTF data\n    int             FontDataSize;           //          // TTF/OTF data size\n    bool            FontDataOwnedByAtlas;   // true     // TTF/OTF data ownership taken by the container ImFontAtlas (will delete memory itself).\n    int             FontNo;                 // 0        // Index of font within TTF/OTF file\n    float           SizePixels;             //          // Size in pixels for rasterizer (more or less maps to the resulting font height).\n    int             OversampleH;            // 3        // Rasterize at higher quality for sub-pixel positioning. Note the difference between 2 and 3 is minimal so you can reduce this to 2 to save memory. Read https://github.com/nothings/stb/blob/master/tests/oversample/README.md for details.\n    int             OversampleV;            // 1        // Rasterize at higher quality for sub-pixel positioning. This is not really useful as we don't use sub-pixel positions on the Y axis.\n    bool            PixelSnapH;             // false    // Align every glyph to pixel boundary. Useful e.g. if you are merging a non-pixel aligned font with the default font. If enabled, you can set OversampleH/V to 1.\n    ImVec2          GlyphExtraSpacing;      // 0, 0     // Extra spacing (in pixels) between glyphs. Only X axis is supported for now.\n    ImVec2          GlyphOffset;            // 0, 0     // Offset all glyphs from this font input.\n    const ImWchar*  GlyphRanges;            // NULL     // Pointer to a user-provided list of Unicode range (2 value per range, values are inclusive, zero-terminated list). THE ARRAY DATA NEEDS TO PERSIST AS LONG AS THE FONT IS ALIVE.\n    float           GlyphMinAdvanceX;       // 0        // Minimum AdvanceX for glyphs, set Min to align font icons, set both Min/Max to enforce mono-space font\n    float           GlyphMaxAdvanceX;       // FLT_MAX  // Maximum AdvanceX for glyphs\n    bool            MergeMode;              // false    // Merge into previous ImFont, so you can combine multiple inputs font into one ImFont (e.g. ASCII font + icons + Japanese glyphs). You may want to use GlyphOffset.y when merge font of different heights.\n    unsigned int    FontBuilderFlags;       // 0        // Settings for custom font builder. THIS IS BUILDER IMPLEMENTATION DEPENDENT. Leave as zero if unsure.\n    float           RasterizerMultiply;     // 1.0f     // Brighten (>1.0f) or darken (<1.0f) font output. Brightening small fonts may be a good workaround to make them more readable.\n    ImWchar         EllipsisChar;           // -1       // Explicitly specify unicode codepoint of ellipsis character. When fonts are being merged first specified ellipsis will be used.\n\n    // [Internal]\n    char            Name[40];               // Name (strictly to ease debugging)\n    ImFont*         DstFont;\n\n    IMGUI_API ImFontConfig();\n};\n\n// Hold rendering data for one glyph.\n// (Note: some language parsers may fail to convert the 31+1 bitfield members, in this case maybe drop store a single u32 or we can rework this)\nstruct ImFontGlyph\n{\n    unsigned int    Colored : 1;        // Flag to indicate glyph is colored and should generally ignore tinting (make it usable with no shift on little-endian as this is used in loops)\n    unsigned int    Visible : 1;        // Flag to indicate glyph has no visible pixels (e.g. space). Allow early out when rendering.\n    unsigned int    Codepoint : 30;     // 0x0000..0x10FFFF\n    float           AdvanceX;           // Distance to next character (= data from font + ImFontConfig::GlyphExtraSpacing.x baked in)\n    float           X0, Y0, X1, Y1;     // Glyph corners\n    float           U0, V0, U1, V1;     // Texture coordinates\n};\n\n// Helper to build glyph ranges from text/string data. Feed your application strings/characters to it then call BuildRanges().\n// This is essentially a tightly packed of vector of 64k booleans = 8KB storage.\nstruct ImFontGlyphRangesBuilder\n{\n    ImVector<ImU32> UsedChars;            // Store 1-bit per Unicode code point (0=unused, 1=used)\n\n    ImFontGlyphRangesBuilder()              { Clear(); }\n    inline void     Clear()                 { int size_in_bytes = (IM_UNICODE_CODEPOINT_MAX + 1) / 8; UsedChars.resize(size_in_bytes / (int)sizeof(ImU32)); memset(UsedChars.Data, 0, (size_t)size_in_bytes); }\n    inline bool     GetBit(size_t n) const  { int off = (int)(n >> 5); ImU32 mask = 1u << (n & 31); return (UsedChars[off] & mask) != 0; }  // Get bit n in the array\n    inline void     SetBit(size_t n)        { int off = (int)(n >> 5); ImU32 mask = 1u << (n & 31); UsedChars[off] |= mask; }               // Set bit n in the array\n    inline void     AddChar(ImWchar c)      { SetBit(c); }                      // Add character\n    IMGUI_API void  AddText(const char* text, const char* text_end = NULL);     // Add string (each character of the UTF-8 string are added)\n    IMGUI_API void  AddRanges(const ImWchar* ranges);                           // Add ranges, e.g. builder.AddRanges(ImFontAtlas::GetGlyphRangesDefault()) to force add all of ASCII/Latin+Ext\n    IMGUI_API void  BuildRanges(ImVector<ImWchar>* out_ranges);                 // Output new ranges\n};\n\n// See ImFontAtlas::AddCustomRectXXX functions.\nstruct ImFontAtlasCustomRect\n{\n    unsigned short  Width, Height;  // Input    // Desired rectangle dimension\n    unsigned short  X, Y;           // Output   // Packed position in Atlas\n    unsigned int    GlyphID;        // Input    // For custom font glyphs only (ID < 0x110000)\n    float           GlyphAdvanceX;  // Input    // For custom font glyphs only: glyph xadvance\n    ImVec2          GlyphOffset;    // Input    // For custom font glyphs only: glyph display offset\n    ImFont*         Font;           // Input    // For custom font glyphs only: target font\n    ImFontAtlasCustomRect()         { Width = Height = 0; X = Y = 0xFFFF; GlyphID = 0; GlyphAdvanceX = 0.0f; GlyphOffset = ImVec2(0, 0); Font = NULL; }\n    bool IsPacked() const           { return X != 0xFFFF; }\n};\n\n// Flags for ImFontAtlas build\nenum ImFontAtlasFlags_\n{\n    ImFontAtlasFlags_None               = 0,\n    ImFontAtlasFlags_NoPowerOfTwoHeight = 1 << 0,   // Don't round the height to next power of two\n    ImFontAtlasFlags_NoMouseCursors     = 1 << 1,   // Don't build software mouse cursors into the atlas (save a little texture memory)\n    ImFontAtlasFlags_NoBakedLines       = 1 << 2    // Don't build thick line textures into the atlas (save a little texture memory). The AntiAliasedLinesUseTex features uses them, otherwise they will be rendered using polygons (more expensive for CPU/GPU).\n};\n\n// Load and rasterize multiple TTF/OTF fonts into a same texture. The font atlas will build a single texture holding:\n//  - One or more fonts.\n//  - Custom graphics data needed to render the shapes needed by Dear ImGui.\n//  - Mouse cursor shapes for software cursor rendering (unless setting 'Flags |= ImFontAtlasFlags_NoMouseCursors' in the font atlas).\n// It is the user-code responsibility to setup/build the atlas, then upload the pixel data into a texture accessible by your graphics api.\n//  - Optionally, call any of the AddFont*** functions. If you don't call any, the default font embedded in the code will be loaded for you.\n//  - Call GetTexDataAsAlpha8() or GetTexDataAsRGBA32() to build and retrieve pixels data.\n//  - Upload the pixels data into a texture within your graphics system (see imgui_impl_xxxx.cpp examples)\n//  - Call SetTexID(my_tex_id); and pass the pointer/identifier to your texture in a format natural to your graphics API.\n//    This value will be passed back to you during rendering to identify the texture. Read FAQ entry about ImTextureID for more details.\n// Common pitfalls:\n// - If you pass a 'glyph_ranges' array to AddFont*** functions, you need to make sure that your array persist up until the\n//   atlas is build (when calling GetTexData*** or Build()). We only copy the pointer, not the data.\n// - Important: By default, AddFontFromMemoryTTF() takes ownership of the data. Even though we are not writing to it, we will free the pointer on destruction.\n//   You can set font_cfg->FontDataOwnedByAtlas=false to keep ownership of your data and it won't be freed,\n// - Even though many functions are suffixed with \"TTF\", OTF data is supported just as well.\n// - This is an old API and it is currently awkward for those and and various other reasons! We will address them in the future!\nstruct ImFontAtlas\n{\n    IMGUI_API ImFontAtlas();\n    IMGUI_API ~ImFontAtlas();\n    IMGUI_API ImFont*           AddFont(const ImFontConfig* font_cfg);\n    IMGUI_API ImFont*           AddFontDefault(const ImFontConfig* font_cfg = NULL);\n    IMGUI_API ImFont*           AddFontFromFileTTF(const char* filename, float size_pixels, const ImFontConfig* font_cfg = NULL, const ImWchar* glyph_ranges = NULL);\n    IMGUI_API ImFont*           AddFontFromMemoryTTF(void* font_data, int font_size, float size_pixels, const ImFontConfig* font_cfg = NULL, const ImWchar* glyph_ranges = NULL); // Note: Transfer ownership of 'ttf_data' to ImFontAtlas! Will be deleted after destruction of the atlas. Set font_cfg->FontDataOwnedByAtlas=false to keep ownership of your data and it won't be freed.\n    IMGUI_API ImFont*           AddFontFromMemoryCompressedTTF(const void* compressed_font_data, int compressed_font_size, float size_pixels, const ImFontConfig* font_cfg = NULL, const ImWchar* glyph_ranges = NULL); // 'compressed_font_data' still owned by caller. Compress with binary_to_compressed_c.cpp.\n    IMGUI_API ImFont*           AddFontFromMemoryCompressedBase85TTF(const char* compressed_font_data_base85, float size_pixels, const ImFontConfig* font_cfg = NULL, const ImWchar* glyph_ranges = NULL);              // 'compressed_font_data_base85' still owned by caller. Compress with binary_to_compressed_c.cpp with -base85 parameter.\n    IMGUI_API void              ClearInputData();           // Clear input data (all ImFontConfig structures including sizes, TTF data, glyph ranges, etc.) = all the data used to build the texture and fonts.\n    IMGUI_API void              ClearTexData();             // Clear output texture data (CPU side). Saves RAM once the texture has been copied to graphics memory.\n    IMGUI_API void              ClearFonts();               // Clear output font data (glyphs storage, UV coordinates).\n    IMGUI_API void              Clear();                    // Clear all input and output.\n\n    // Build atlas, retrieve pixel data.\n    // User is in charge of copying the pixels into graphics memory (e.g. create a texture with your engine). Then store your texture handle with SetTexID().\n    // The pitch is always = Width * BytesPerPixels (1 or 4)\n    // Building in RGBA32 format is provided for convenience and compatibility, but note that unless you manually manipulate or copy color data into\n    // the texture (e.g. when using the AddCustomRect*** api), then the RGB pixels emitted will always be white (~75% of memory/bandwidth waste.\n    IMGUI_API bool              Build();                    // Build pixels data. This is called automatically for you by the GetTexData*** functions.\n    IMGUI_API void              GetTexDataAsAlpha8(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel = NULL);  // 1 byte per-pixel\n    IMGUI_API void              GetTexDataAsRGBA32(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel = NULL);  // 4 bytes-per-pixel\n    bool                        IsBuilt() const             { return Fonts.Size > 0 && TexReady; } // Bit ambiguous: used to detect when user didn't built texture but effectively we should check TexID != 0 except that would be backend dependent...\n    void                        SetTexID(ImTextureID id)    { TexID = id; }\n\n    //-------------------------------------------\n    // Glyph Ranges\n    //-------------------------------------------\n\n    // Helpers to retrieve list of common Unicode ranges (2 value per range, values are inclusive, zero-terminated list)\n    // NB: Make sure that your string are UTF-8 and NOT in your local code page. In C++11, you can create UTF-8 string literal using the u8\"Hello world\" syntax. See FAQ for details.\n    // NB: Consider using ImFontGlyphRangesBuilder to build glyph ranges from textual data.\n    IMGUI_API const ImWchar*    GetGlyphRangesDefault();                // Basic Latin, Extended Latin\n    IMGUI_API const ImWchar*    GetGlyphRangesKorean();                 // Default + Korean characters\n    IMGUI_API const ImWchar*    GetGlyphRangesJapanese();               // Default + Hiragana, Katakana, Half-Width, Selection of 2999 Ideographs\n    IMGUI_API const ImWchar*    GetGlyphRangesChineseFull();            // Default + Half-Width + Japanese Hiragana/Katakana + full set of about 21000 CJK Unified Ideographs\n    IMGUI_API const ImWchar*    GetGlyphRangesChineseSimplifiedCommon();// Default + Half-Width + Japanese Hiragana/Katakana + set of 2500 CJK Unified Ideographs for common simplified Chinese\n    IMGUI_API const ImWchar*    GetGlyphRangesCyrillic();               // Default + about 400 Cyrillic characters\n    IMGUI_API const ImWchar*    GetGlyphRangesThai();                   // Default + Thai characters\n    IMGUI_API const ImWchar*    GetGlyphRangesVietnamese();             // Default + Vietnamese characters\n\n    //-------------------------------------------\n    // [BETA] Custom Rectangles/Glyphs API\n    //-------------------------------------------\n\n    // You can request arbitrary rectangles to be packed into the atlas, for your own purposes.\n    // - After calling Build(), you can query the rectangle position and render your pixels.\n    // - If you render colored output, set 'atlas->TexPixelsUseColors = true' as this may help some backends decide of prefered texture format.\n    // - You can also request your rectangles to be mapped as font glyph (given a font + Unicode point),\n    //   so you can render e.g. custom colorful icons and use them as regular glyphs.\n    // - Read docs/FONTS.md for more details about using colorful icons.\n    // - Note: this API may be redesigned later in order to support multi-monitor varying DPI settings.\n    IMGUI_API int               AddCustomRectRegular(int width, int height);\n    IMGUI_API int               AddCustomRectFontGlyph(ImFont* font, ImWchar id, int width, int height, float advance_x, const ImVec2& offset = ImVec2(0, 0));\n    ImFontAtlasCustomRect*      GetCustomRectByIndex(int index) { IM_ASSERT(index >= 0); return &CustomRects[index]; }\n\n    // [Internal]\n    IMGUI_API void              CalcCustomRectUV(const ImFontAtlasCustomRect* rect, ImVec2* out_uv_min, ImVec2* out_uv_max) const;\n    IMGUI_API bool              GetMouseCursorTexData(ImGuiMouseCursor cursor, ImVec2* out_offset, ImVec2* out_size, ImVec2 out_uv_border[2], ImVec2 out_uv_fill[2]);\n\n    //-------------------------------------------\n    // Members\n    //-------------------------------------------\n\n    ImFontAtlasFlags            Flags;              // Build flags (see ImFontAtlasFlags_)\n    ImTextureID                 TexID;              // User data to refer to the texture once it has been uploaded to user's graphic systems. It is passed back to you during rendering via the ImDrawCmd structure.\n    int                         TexDesiredWidth;    // Texture width desired by user before Build(). Must be a power-of-two. If have many glyphs your graphics API have texture size restrictions you may want to increase texture width to decrease height.\n    int                         TexGlyphPadding;    // Padding between glyphs within texture in pixels. Defaults to 1. If your rendering method doesn't rely on bilinear filtering you may set this to 0.\n    bool                        Locked;             // Marked as Locked by ImGui::NewFrame() so attempt to modify the atlas will assert.\n\n    // [Internal]\n    // NB: Access texture data via GetTexData*() calls! Which will setup a default font for you.\n    bool                        TexReady;           // Set when texture was built matching current font input\n    bool                        TexPixelsUseColors; // Tell whether our texture data is known to use colors (rather than just alpha channel), in order to help backend select a format.\n    unsigned char*              TexPixelsAlpha8;    // 1 component per pixel, each component is unsigned 8-bit. Total size = TexWidth * TexHeight\n    unsigned int*               TexPixelsRGBA32;    // 4 component per pixel, each component is unsigned 8-bit. Total size = TexWidth * TexHeight * 4\n    int                         TexWidth;           // Texture width calculated during Build().\n    int                         TexHeight;          // Texture height calculated during Build().\n    ImVec2                      TexUvScale;         // = (1.0f/TexWidth, 1.0f/TexHeight)\n    ImVec2                      TexUvWhitePixel;    // Texture coordinates to a white pixel\n    ImVector<ImFont*>           Fonts;              // Hold all the fonts returned by AddFont*. Fonts[0] is the default font upon calling ImGui::NewFrame(), use ImGui::PushFont()/PopFont() to change the current font.\n    ImVector<ImFontAtlasCustomRect> CustomRects;    // Rectangles for packing custom texture data into the atlas.\n    ImVector<ImFontConfig>      ConfigData;         // Configuration data\n    ImVec4                      TexUvLines[IM_DRAWLIST_TEX_LINES_WIDTH_MAX + 1];  // UVs for baked anti-aliased lines\n\n    // [Internal] Font builder\n    const ImFontBuilderIO*      FontBuilderIO;      // Opaque interface to a font builder (default to stb_truetype, can be changed to use FreeType by defining IMGUI_ENABLE_FREETYPE).\n    unsigned int                FontBuilderFlags;   // Shared flags (for all fonts) for custom font builder. THIS IS BUILD IMPLEMENTATION DEPENDENT. Per-font override is also available in ImFontConfig.\n\n    // [Internal] Packing data\n    int                         PackIdMouseCursors; // Custom texture rectangle ID for white pixel and mouse cursors\n    int                         PackIdLines;        // Custom texture rectangle ID for baked anti-aliased lines\n\n#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS\n    typedef ImFontAtlasCustomRect    CustomRect;         // OBSOLETED in 1.72+\n    //typedef ImFontGlyphRangesBuilder GlyphRangesBuilder; // OBSOLETED in 1.67+\n#endif\n};\n\n// Font runtime data and rendering\n// ImFontAtlas automatically loads a default embedded font for you when you call GetTexDataAsAlpha8() or GetTexDataAsRGBA32().\nstruct ImFont\n{\n    // Members: Hot ~20/24 bytes (for CalcTextSize)\n    ImVector<float>             IndexAdvanceX;      // 12-16 // out //            // Sparse. Glyphs->AdvanceX in a directly indexable way (cache-friendly for CalcTextSize functions which only this this info, and are often bottleneck in large UI).\n    float                       FallbackAdvanceX;   // 4     // out // = FallbackGlyph->AdvanceX\n    float                       FontSize;           // 4     // in  //            // Height of characters/line, set during loading (don't change after loading)\n\n    // Members: Hot ~28/40 bytes (for CalcTextSize + render loop)\n    ImVector<ImWchar>           IndexLookup;        // 12-16 // out //            // Sparse. Index glyphs by Unicode code-point.\n    ImVector<ImFontGlyph>       Glyphs;             // 12-16 // out //            // All glyphs.\n    const ImFontGlyph*          FallbackGlyph;      // 4-8   // out // = FindGlyph(FontFallbackChar)\n\n    // Members: Cold ~32/40 bytes\n    ImFontAtlas*                ContainerAtlas;     // 4-8   // out //            // What we has been loaded into\n    const ImFontConfig*         ConfigData;         // 4-8   // in  //            // Pointer within ContainerAtlas->ConfigData\n    short                       ConfigDataCount;    // 2     // in  // ~ 1        // Number of ImFontConfig involved in creating this font. Bigger than 1 when merging multiple font sources into one ImFont.\n    ImWchar                     FallbackChar;       // 2     // out // = FFFD/'?' // Character used if a glyph isn't found.\n    ImWchar                     EllipsisChar;       // 2     // out // = '...'    // Character used for ellipsis rendering.\n    ImWchar                     DotChar;            // 2     // out // = '.'      // Character used for ellipsis rendering (if a single '...' character isn't found)\n    bool                        DirtyLookupTables;  // 1     // out //\n    float                       Scale;              // 4     // in  // = 1.f      // Base font scale, multiplied by the per-window font scale which you can adjust with SetWindowFontScale()\n    float                       Ascent, Descent;    // 4+4   // out //            // Ascent: distance from top to bottom of e.g. 'A' [0..FontSize]\n    int                         MetricsTotalSurface;// 4     // out //            // Total surface in pixels to get an idea of the font rasterization/texture cost (not exact, we approximate the cost of padding between glyphs)\n    ImU8                        Used4kPagesMap[(IM_UNICODE_CODEPOINT_MAX+1)/4096/8]; // 2 bytes if ImWchar=ImWchar16, 34 bytes if ImWchar==ImWchar32. Store 1-bit for each block of 4K codepoints that has one active glyph. This is mainly used to facilitate iterations across all used codepoints.\n\n    // Methods\n    IMGUI_API ImFont();\n    IMGUI_API ~ImFont();\n    IMGUI_API const ImFontGlyph*FindGlyph(ImWchar c) const;\n    IMGUI_API const ImFontGlyph*FindGlyphNoFallback(ImWchar c) const;\n    float                       GetCharAdvance(ImWchar c) const     { return ((int)c < IndexAdvanceX.Size) ? IndexAdvanceX[(int)c] : FallbackAdvanceX; }\n    bool                        IsLoaded() const                    { return ContainerAtlas != NULL; }\n    const char*                 GetDebugName() const                { return ConfigData ? ConfigData->Name : \"<unknown>\"; }\n\n    // 'max_width' stops rendering after a certain width (could be turned into a 2d size). FLT_MAX to disable.\n    // 'wrap_width' enable automatic word-wrapping across multiple lines to fit into given width. 0.0f to disable.\n    IMGUI_API ImVec2            CalcTextSizeA(float size, float max_width, float wrap_width, const char* text_begin, const char* text_end = NULL, const char** remaining = NULL) const; // utf8\n    IMGUI_API const char*       CalcWordWrapPositionA(float scale, const char* text, const char* text_end, float wrap_width) const;\n    IMGUI_API void              RenderChar(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, ImWchar c) const;\n    IMGUI_API void              RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, const ImVec4& clip_rect, const char* text_begin, const char* text_end, float wrap_width = 0.0f, bool cpu_fine_clip = false) const;\n\n    // [Internal] Don't use!\n    IMGUI_API void              BuildLookupTable();\n    IMGUI_API void              ClearOutputData();\n    IMGUI_API void              GrowIndex(int new_size);\n    IMGUI_API void              AddGlyph(const ImFontConfig* src_cfg, ImWchar c, float x0, float y0, float x1, float y1, float u0, float v0, float u1, float v1, float advance_x);\n    IMGUI_API void              AddRemapChar(ImWchar dst, ImWchar src, bool overwrite_dst = true); // Makes 'dst' character/glyph points to 'src' character/glyph. Currently needs to be called AFTER fonts have been built.\n    IMGUI_API void              SetGlyphVisible(ImWchar c, bool visible);\n    IMGUI_API bool              IsGlyphRangeUnused(unsigned int c_begin, unsigned int c_last);\n};\n\n//-----------------------------------------------------------------------------\n// [SECTION] Viewports\n//-----------------------------------------------------------------------------\n\n// Flags stored in ImGuiViewport::Flags, giving indications to the platform backends.\nenum ImGuiViewportFlags_\n{\n    ImGuiViewportFlags_None                     = 0,\n    ImGuiViewportFlags_IsPlatformWindow         = 1 << 0,   // Represent a Platform Window\n    ImGuiViewportFlags_IsPlatformMonitor        = 1 << 1,   // Represent a Platform Monitor (unused yet)\n    ImGuiViewportFlags_OwnedByApp               = 1 << 2    // Platform Window: is created/managed by the application (rather than a dear imgui backend)\n};\n\n// - Currently represents the Platform Window created by the application which is hosting our Dear ImGui windows.\n// - In 'docking' branch with multi-viewport enabled, we extend this concept to have multiple active viewports.\n// - In the future we will extend this concept further to also represent Platform Monitor and support a \"no main platform window\" operation mode.\n// - About Main Area vs Work Area:\n//   - Main Area = entire viewport.\n//   - Work Area = entire viewport minus sections used by main menu bars (for platform windows), or by task bar (for platform monitor).\n//   - Windows are generally trying to stay within the Work Area of their host viewport.\nstruct ImGuiViewport\n{\n    ImGuiViewportFlags  Flags;                  // See ImGuiViewportFlags_\n    ImVec2              Pos;                    // Main Area: Position of the viewport (Dear ImGui coordinates are the same as OS desktop/native coordinates)\n    ImVec2              Size;                   // Main Area: Size of the viewport.\n    ImVec2              WorkPos;                // Work Area: Position of the viewport minus task bars, menus bars, status bars (>= Pos)\n    ImVec2              WorkSize;               // Work Area: Size of the viewport minus task bars, menu bars, status bars (<= Size)\n\n    ImGuiViewport()     { memset(this, 0, sizeof(*this)); }\n\n    // Helpers\n    ImVec2              GetCenter() const       { return ImVec2(Pos.x + Size.x * 0.5f, Pos.y + Size.y * 0.5f); }\n    ImVec2              GetWorkCenter() const   { return ImVec2(WorkPos.x + WorkSize.x * 0.5f, WorkPos.y + WorkSize.y * 0.5f); }\n};\n\n//-----------------------------------------------------------------------------\n// [SECTION] Obsolete functions and types\n// (Will be removed! Read 'API BREAKING CHANGES' section in imgui.cpp for details)\n// Please keep your copy of dear imgui up to date! Occasionally set '#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS' in imconfig.h to stay ahead.\n//-----------------------------------------------------------------------------\n\n#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS\nnamespace ImGui\n{\n    // OBSOLETED in 1.81 (from February 2021)\n    IMGUI_API bool      ListBoxHeader(const char* label, int items_count, int height_in_items = -1); // Helper to calculate size from items_count and height_in_items\n    static inline bool  ListBoxHeader(const char* label, const ImVec2& size = ImVec2(0, 0)) { return BeginListBox(label, size); }\n    static inline void  ListBoxFooter() { EndListBox(); }\n    // OBSOLETED in 1.79 (from August 2020)\n    static inline void  OpenPopupContextItem(const char* str_id = NULL, ImGuiMouseButton mb = 1) { OpenPopupOnItemClick(str_id, mb); } // Bool return value removed. Use IsWindowAppearing() in BeginPopup() instead. Renamed in 1.77, renamed back in 1.79. Sorry!\n    // OBSOLETED in 1.78 (from June 2020)\n    // Old drag/sliders functions that took a 'float power = 1.0' argument instead of flags.\n    // For shared code, you can version check at compile-time with `#if IMGUI_VERSION_NUM >= 17704`.\n    IMGUI_API bool      DragScalar(const char* label, ImGuiDataType data_type, void* p_data, float v_speed, const void* p_min, const void* p_max, const char* format, float power);\n    IMGUI_API bool      DragScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, float v_speed, const void* p_min, const void* p_max, const char* format, float power);\n    static inline bool  DragFloat(const char* label, float* v, float v_speed, float v_min, float v_max, const char* format, float power)    { return DragScalar(label, ImGuiDataType_Float, v, v_speed, &v_min, &v_max, format, power); }\n    static inline bool  DragFloat2(const char* label, float v[2], float v_speed, float v_min, float v_max, const char* format, float power) { return DragScalarN(label, ImGuiDataType_Float, v, 2, v_speed, &v_min, &v_max, format, power); }\n    static inline bool  DragFloat3(const char* label, float v[3], float v_speed, float v_min, float v_max, const char* format, float power) { return DragScalarN(label, ImGuiDataType_Float, v, 3, v_speed, &v_min, &v_max, format, power); }\n    static inline bool  DragFloat4(const char* label, float v[4], float v_speed, float v_min, float v_max, const char* format, float power) { return DragScalarN(label, ImGuiDataType_Float, v, 4, v_speed, &v_min, &v_max, format, power); }\n    IMGUI_API bool      SliderScalar(const char* label, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, const char* format, float power);\n    IMGUI_API bool      SliderScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, const void* p_min, const void* p_max, const char* format, float power);\n    static inline bool  SliderFloat(const char* label, float* v, float v_min, float v_max, const char* format, float power)                 { return SliderScalar(label, ImGuiDataType_Float, v, &v_min, &v_max, format, power); }\n    static inline bool  SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* format, float power)              { return SliderScalarN(label, ImGuiDataType_Float, v, 2, &v_min, &v_max, format, power); }\n    static inline bool  SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* format, float power)              { return SliderScalarN(label, ImGuiDataType_Float, v, 3, &v_min, &v_max, format, power); }\n    static inline bool  SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* format, float power)              { return SliderScalarN(label, ImGuiDataType_Float, v, 4, &v_min, &v_max, format, power); }\n    // OBSOLETED in 1.77 (from June 2020)\n    static inline bool  BeginPopupContextWindow(const char* str_id, ImGuiMouseButton mb, bool over_items) { return BeginPopupContextWindow(str_id, mb | (over_items ? 0 : ImGuiPopupFlags_NoOpenOverItems)); }\n    // OBSOLETED in 1.72 (from April 2019)\n    static inline void  TreeAdvanceToLabelPos()             { SetCursorPosX(GetCursorPosX() + GetTreeNodeToLabelSpacing()); }\n    // OBSOLETED in 1.71 (from June 2019)\n    static inline void  SetNextTreeNodeOpen(bool open, ImGuiCond cond = 0) { SetNextItemOpen(open, cond); }\n    // OBSOLETED in 1.70 (from May 2019)\n    static inline float GetContentRegionAvailWidth()        { return GetContentRegionAvail().x; }\n\n    // Some of the older obsolete names along with their replacement (commented out so they are not reported in IDE)\n    //static inline ImDrawList* GetOverlayDrawList()            { return GetForegroundDrawList(); }                         // OBSOLETED in 1.69 (from Mar 2019)\n    //static inline void  SetScrollHere(float ratio = 0.5f)     { SetScrollHereY(ratio); }                                  // OBSOLETED in 1.66 (from Nov 2018)\n    //static inline bool  IsItemDeactivatedAfterChange()        { return IsItemDeactivatedAfterEdit(); }                    // OBSOLETED in 1.63 (from Aug 2018)\n    //static inline bool  IsAnyWindowFocused()                  { return IsWindowFocused(ImGuiFocusedFlags_AnyWindow); }    // OBSOLETED in 1.60 (from Apr 2018)\n    //static inline bool  IsAnyWindowHovered()                  { return IsWindowHovered(ImGuiHoveredFlags_AnyWindow); }    // OBSOLETED in 1.60 (between Dec 2017 and Apr 2018)\n    //static inline void  ShowTestWindow()                      { return ShowDemoWindow(); }                                // OBSOLETED in 1.53 (between Oct 2017 and Dec 2017)\n    //static inline bool  IsRootWindowFocused()                 { return IsWindowFocused(ImGuiFocusedFlags_RootWindow); }   // OBSOLETED in 1.53 (between Oct 2017 and Dec 2017)\n    //static inline bool  IsRootWindowOrAnyChildFocused()       { return IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows); } // OBSOLETED in 1.53 (between Oct 2017 and Dec 2017)\n    //static inline void  SetNextWindowContentWidth(float w)    { SetNextWindowContentSize(ImVec2(w, 0.0f)); }              // OBSOLETED in 1.53 (between Oct 2017 and Dec 2017)\n    //static inline float GetItemsLineHeightWithSpacing()       { return GetFrameHeightWithSpacing(); }                     // OBSOLETED in 1.53 (between Oct 2017 and Dec 2017)\n}\n\n// OBSOLETED in 1.82 (from Mars 2021): flags for AddRect(), AddRectFilled(), AddImageRounded(), PathRect()\ntypedef ImDrawFlags ImDrawCornerFlags;\nenum ImDrawCornerFlags_\n{\n    ImDrawCornerFlags_None      = ImDrawFlags_RoundCornersNone,         // Was == 0 prior to 1.82, this is now == ImDrawFlags_RoundCornersNone which is != 0 and not implicit\n    ImDrawCornerFlags_TopLeft   = ImDrawFlags_RoundCornersTopLeft,      // Was == 0x01 (1 << 0) prior to 1.82. Order matches ImDrawFlags_NoRoundCorner* flag (we exploit this internally).\n    ImDrawCornerFlags_TopRight  = ImDrawFlags_RoundCornersTopRight,     // Was == 0x02 (1 << 1) prior to 1.82.\n    ImDrawCornerFlags_BotLeft   = ImDrawFlags_RoundCornersBottomLeft,   // Was == 0x04 (1 << 2) prior to 1.82.\n    ImDrawCornerFlags_BotRight  = ImDrawFlags_RoundCornersBottomRight,  // Was == 0x08 (1 << 3) prior to 1.82.\n    ImDrawCornerFlags_All       = ImDrawFlags_RoundCornersAll,          // Was == 0x0F prior to 1.82\n    ImDrawCornerFlags_Top       = ImDrawCornerFlags_TopLeft | ImDrawCornerFlags_TopRight,\n    ImDrawCornerFlags_Bot       = ImDrawCornerFlags_BotLeft | ImDrawCornerFlags_BotRight,\n    ImDrawCornerFlags_Left      = ImDrawCornerFlags_TopLeft | ImDrawCornerFlags_BotLeft,\n    ImDrawCornerFlags_Right     = ImDrawCornerFlags_TopRight | ImDrawCornerFlags_BotRight\n};\n\n#endif // #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS\n\n//-----------------------------------------------------------------------------\n\n#if defined(__clang__)\n#pragma clang diagnostic pop\n#elif defined(__GNUC__)\n#pragma GCC diagnostic pop\n#endif\n\n#ifdef _MSC_VER\n#pragma warning (pop)\n#endif\n\n// Include imgui_user.h at the end of imgui.h (convenient for user to only explicitly include vanilla imgui.h)\n#ifdef IMGUI_INCLUDE_IMGUI_USER_H\n#include \"imgui_user.h\"\n#endif\n\n#endif // #ifndef IMGUI_DISABLE\n"
  },
  {
    "path": "R3nzSkin/imgui/imgui_demo.cpp",
    "content": "// dear imgui, v1.84\n// (demo code)\n\n// Help:\n// - Read FAQ at http://dearimgui.org/faq\n// - Newcomers, read 'Programmer guide' in imgui.cpp for notes on how to setup Dear ImGui in your codebase.\n// - Call and read ImGui::ShowDemoWindow() in imgui_demo.cpp. All applications in examples/ are doing that.\n// Read imgui.cpp for more details, documentation and comments.\n// Get the latest version at https://github.com/ocornut/imgui\n\n// Message to the person tempted to delete this file when integrating Dear ImGui into their codebase:\n// Do NOT remove this file from your project! Think again! It is the most useful reference code that you and other\n// coders will want to refer to and call. Have the ImGui::ShowDemoWindow() function wired in an always-available\n// debug menu of your game/app! Removing this file from your project is hindering access to documentation for everyone\n// in your team, likely leading you to poorer usage of the library.\n// Everything in this file will be stripped out by the linker if you don't call ImGui::ShowDemoWindow().\n// If you want to link core Dear ImGui in your shipped builds but want a thorough guarantee that the demo will not be\n// linked, you can setup your imconfig.h with #define IMGUI_DISABLE_DEMO_WINDOWS and those functions will be empty.\n// In another situation, whenever you have Dear ImGui available you probably want this to be available for reference.\n// Thank you,\n// -Your beloved friend, imgui_demo.cpp (which you won't delete)\n\n// Message to beginner C/C++ programmers about the meaning of the 'static' keyword:\n// In this demo code, we frequently use 'static' variables inside functions. A static variable persists across calls,\n// so it is essentially like a global variable but declared inside the scope of the function. We do this as a way to\n// gather code and data in the same place, to make the demo source code faster to read, faster to write, and smaller\n// in size. It also happens to be a convenient way of storing simple UI related information as long as your function\n// doesn't need to be reentrant or used in multiple threads. This might be a pattern you will want to use in your code,\n// but most of the real data you would be editing is likely going to be stored outside your functions.\n\n// The Demo code in this file is designed to be easy to copy-and-paste into your application!\n// Because of this:\n// - We never omit the ImGui:: prefix when calling functions, even though most code here is in the same namespace.\n// - We try to declare static variables in the local scope, as close as possible to the code using them.\n// - We never use any of the helpers/facilities used internally by Dear ImGui, unless available in the public API.\n// - We never use maths operators on ImVec2/ImVec4. For our other sources files we use them, and they are provided\n//   by imgui_internal.h using the IMGUI_DEFINE_MATH_OPERATORS define. For your own sources file they are optional\n//   and require you either enable those, either provide your own via IM_VEC2_CLASS_EXTRA in imconfig.h.\n//   Because we can't assume anything about your support of maths operators, we cannot use them in imgui_demo.cpp.\n\n// Navigating this file:\n// - In Visual Studio IDE: CTRL+comma (\"Edit.NavigateTo\") can follow symbols in comments, whereas CTRL+F12 (\"Edit.GoToImplementation\") cannot.\n// - With Visual Assist installed: ALT+G (\"VAssistX.GoToImplementation\") can also follow symbols in comments.\n\n/*\n\nIndex of this file:\n\n// [SECTION] Forward Declarations, Helpers\n// [SECTION] Demo Window / ShowDemoWindow()\n// - sub section: ShowDemoWindowWidgets()\n// - sub section: ShowDemoWindowLayout()\n// - sub section: ShowDemoWindowPopups()\n// - sub section: ShowDemoWindowTables()\n// - sub section: ShowDemoWindowMisc()\n// [SECTION] About Window / ShowAboutWindow()\n// [SECTION] Style Editor / ShowStyleEditor()\n// [SECTION] Example App: Main Menu Bar / ShowExampleAppMainMenuBar()\n// [SECTION] Example App: Debug Console / ShowExampleAppConsole()\n// [SECTION] Example App: Debug Log / ShowExampleAppLog()\n// [SECTION] Example App: Simple Layout / ShowExampleAppLayout()\n// [SECTION] Example App: Property Editor / ShowExampleAppPropertyEditor()\n// [SECTION] Example App: Long Text / ShowExampleAppLongText()\n// [SECTION] Example App: Auto Resize / ShowExampleAppAutoResize()\n// [SECTION] Example App: Constrained Resize / ShowExampleAppConstrainedResize()\n// [SECTION] Example App: Simple overlay / ShowExampleAppSimpleOverlay()\n// [SECTION] Example App: Fullscreen window / ShowExampleAppFullscreen()\n// [SECTION] Example App: Manipulating window titles / ShowExampleAppWindowTitles()\n// [SECTION] Example App: Custom Rendering using ImDrawList API / ShowExampleAppCustomRendering()\n// [SECTION] Example App: Documents Handling / ShowExampleAppDocuments()\n\n*/\n\n#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)\n#define _CRT_SECURE_NO_WARNINGS\n#endif\n\n#include \"imgui.h\"\n#ifndef IMGUI_DISABLE\n\n// System includes\n#include <ctype.h>          // toupper\n#include <limits.h>         // INT_MIN, INT_MAX\n#include <math.h>           // sqrtf, powf, cosf, sinf, floorf, ceilf\n#include <stdio.h>          // vsnprintf, sscanf, printf\n#include <stdlib.h>         // NULL, malloc, free, atoi\n#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier\n#include <stddef.h>         // intptr_t\n#else\n#include <stdint.h>         // intptr_t\n#endif\n\n// Visual Studio warnings\n#ifdef _MSC_VER\n#pragma warning (disable: 4996)     // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen\n#pragma warning (disable: 26451)    // [Static Analyzer] Arithmetic overflow : Using operator 'xxx' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator 'xxx' to avoid overflow(io.2).\n#endif\n\n// Clang/GCC warnings with -Weverything\n#if defined(__clang__)\n#if __has_warning(\"-Wunknown-warning-option\")\n#pragma clang diagnostic ignored \"-Wunknown-warning-option\"         // warning: unknown warning group 'xxx'                     // not all warnings are known by all Clang versions and they tend to be rename-happy.. so ignoring warnings triggers new warnings on some configuration. Great!\n#endif\n#pragma clang diagnostic ignored \"-Wunknown-pragmas\"                // warning: unknown warning group 'xxx'\n#pragma clang diagnostic ignored \"-Wold-style-cast\"                 // warning: use of old-style cast                           // yes, they are more terse.\n#pragma clang diagnostic ignored \"-Wdeprecated-declarations\"        // warning: 'xx' is deprecated: The POSIX name for this..   // for strdup used in demo code (so user can copy & paste the code)\n#pragma clang diagnostic ignored \"-Wint-to-void-pointer-cast\"       // warning: cast to 'void *' from smaller integer type\n#pragma clang diagnostic ignored \"-Wformat-security\"                // warning: format string is not a string literal\n#pragma clang diagnostic ignored \"-Wexit-time-destructors\"          // warning: declaration requires an exit-time destructor    // exit-time destruction order is undefined. if MemFree() leads to users code that has been disabled before exit it might cause problems. ImGui coding style welcomes static/globals.\n#pragma clang diagnostic ignored \"-Wunused-macros\"                  // warning: macro is not used                               // we define snprintf/vsnprintf on Windows so they are available, but not always used.\n#pragma clang diagnostic ignored \"-Wzero-as-null-pointer-constant\"  // warning: zero as null pointer constant                   // some standard header variations use #define NULL 0\n#pragma clang diagnostic ignored \"-Wdouble-promotion\"               // warning: implicit conversion from 'float' to 'double' when passing argument to function  // using printf() is a misery with this as C++ va_arg ellipsis changes float to double.\n#pragma clang diagnostic ignored \"-Wreserved-id-macro\"              // warning: macro name is a reserved identifier\n#pragma clang diagnostic ignored \"-Wimplicit-int-float-conversion\"  // warning: implicit conversion from 'xxx' to 'float' may lose precision\n#elif defined(__GNUC__)\n#pragma GCC diagnostic ignored \"-Wpragmas\"                  // warning: unknown option after '#pragma GCC diagnostic' kind\n#pragma GCC diagnostic ignored \"-Wint-to-pointer-cast\"      // warning: cast to pointer from integer of different size\n#pragma GCC diagnostic ignored \"-Wformat-security\"          // warning: format string is not a string literal (potentially insecure)\n#pragma GCC diagnostic ignored \"-Wdouble-promotion\"         // warning: implicit conversion from 'float' to 'double' when passing argument to function\n#pragma GCC diagnostic ignored \"-Wconversion\"               // warning: conversion to 'xxxx' from 'xxxx' may alter its value\n#pragma GCC diagnostic ignored \"-Wmisleading-indentation\"   // [__GNUC__ >= 6] warning: this 'if' clause does not guard this statement      // GCC 6.0+ only. See #883 on GitHub.\n#endif\n\n// Play it nice with Windows users (Update: May 2018, Notepad now supports Unix-style carriage returns!)\n#ifdef _WIN32\n#define IM_NEWLINE  \"\\r\\n\"\n#else\n#define IM_NEWLINE  \"\\n\"\n#endif\n\n// Helpers\n#if defined(_MSC_VER) && !defined(snprintf)\n#define snprintf    _snprintf\n#endif\n#if defined(_MSC_VER) && !defined(vsnprintf)\n#define vsnprintf   _vsnprintf\n#endif\n\n// Format specifiers, printing 64-bit hasn't been decently standardized...\n// In a real application you should be using PRId64 and PRIu64 from <inttypes.h> (non-windows) and on Windows define them yourself.\n#ifdef _MSC_VER\n#define IM_PRId64   \"I64d\"\n#define IM_PRIu64   \"I64u\"\n#else\n#define IM_PRId64   \"lld\"\n#define IM_PRIu64   \"llu\"\n#endif\n\n// Helpers macros\n// We normally try to not use many helpers in imgui_demo.cpp in order to make code easier to copy and paste,\n// but making an exception here as those are largely simplifying code...\n// In other imgui sources we can use nicer internal functions from imgui_internal.h (ImMin/ImMax) but not in the demo.\n#define IM_MIN(A, B)            (((A) < (B)) ? (A) : (B))\n#define IM_MAX(A, B)            (((A) >= (B)) ? (A) : (B))\n#define IM_CLAMP(V, MN, MX)     ((V) < (MN) ? (MN) : (V) > (MX) ? (MX) : (V))\n\n// Enforce cdecl calling convention for functions called by the standard library, in case compilation settings changed the default to e.g. __vectorcall\n#ifndef IMGUI_CDECL\n#ifdef _MSC_VER\n#define IMGUI_CDECL __cdecl\n#else\n#define IMGUI_CDECL\n#endif\n#endif\n\n//-----------------------------------------------------------------------------\n// [SECTION] Forward Declarations, Helpers\n//-----------------------------------------------------------------------------\n\n#if !defined(IMGUI_DISABLE_DEMO_WINDOWS)\n\n// Forward Declarations\nstatic void ShowExampleAppDocuments(bool* p_open);\nstatic void ShowExampleAppMainMenuBar();\nstatic void ShowExampleAppConsole(bool* p_open);\nstatic void ShowExampleAppLog(bool* p_open);\nstatic void ShowExampleAppLayout(bool* p_open);\nstatic void ShowExampleAppPropertyEditor(bool* p_open);\nstatic void ShowExampleAppLongText(bool* p_open);\nstatic void ShowExampleAppAutoResize(bool* p_open);\nstatic void ShowExampleAppConstrainedResize(bool* p_open);\nstatic void ShowExampleAppSimpleOverlay(bool* p_open);\nstatic void ShowExampleAppFullscreen(bool* p_open);\nstatic void ShowExampleAppWindowTitles(bool* p_open);\nstatic void ShowExampleAppCustomRendering(bool* p_open);\nstatic void ShowExampleMenuFile();\n\n// Helper to display a little (?) mark which shows a tooltip when hovered.\n// In your own code you may want to display an actual icon if you are using a merged icon fonts (see docs/FONTS.md)\nstatic void HelpMarker(const char* desc)\n{\n    ImGui::TextDisabled(\"(?)\");\n    if (ImGui::IsItemHovered())\n    {\n        ImGui::BeginTooltip();\n        ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);\n        ImGui::TextUnformatted(desc);\n        ImGui::PopTextWrapPos();\n        ImGui::EndTooltip();\n    }\n}\n\n// Helper to display basic user controls.\nvoid ImGui::ShowUserGuide()\n{\n    ImGuiIO& io = ImGui::GetIO();\n    ImGui::BulletText(\"Double-click on title bar to collapse window.\");\n    ImGui::BulletText(\n        \"Click and drag on lower corner to resize window\\n\"\n        \"(double-click to auto fit window to its contents).\");\n    ImGui::BulletText(\"CTRL+Click on a slider or drag box to input value as text.\");\n    ImGui::BulletText(\"TAB/SHIFT+TAB to cycle through keyboard editable fields.\");\n    if (io.FontAllowUserScaling)\n        ImGui::BulletText(\"CTRL+Mouse Wheel to zoom window contents.\");\n    ImGui::BulletText(\"While inputing text:\\n\");\n    ImGui::Indent();\n    ImGui::BulletText(\"CTRL+Left/Right to word jump.\");\n    ImGui::BulletText(\"CTRL+A or double-click to select all.\");\n    ImGui::BulletText(\"CTRL+X/C/V to use clipboard cut/copy/paste.\");\n    ImGui::BulletText(\"CTRL+Z,CTRL+Y to undo/redo.\");\n    ImGui::BulletText(\"ESCAPE to revert.\");\n    ImGui::BulletText(\"You can apply arithmetic operators +,*,/ on numerical values.\\nUse +- to subtract.\");\n    ImGui::Unindent();\n    ImGui::BulletText(\"With keyboard navigation enabled:\");\n    ImGui::Indent();\n    ImGui::BulletText(\"Arrow keys to navigate.\");\n    ImGui::BulletText(\"Space to activate a widget.\");\n    ImGui::BulletText(\"Return to input text into a widget.\");\n    ImGui::BulletText(\"Escape to deactivate a widget, close popup, exit child window.\");\n    ImGui::BulletText(\"Alt to jump to the menu layer of a window.\");\n    ImGui::BulletText(\"CTRL+Tab to select a window.\");\n    ImGui::Unindent();\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] Demo Window / ShowDemoWindow()\n//-----------------------------------------------------------------------------\n// - ShowDemoWindowWidgets()\n// - ShowDemoWindowLayout()\n// - ShowDemoWindowPopups()\n// - ShowDemoWindowTables()\n// - ShowDemoWindowColumns()\n// - ShowDemoWindowMisc()\n//-----------------------------------------------------------------------------\n\n// We split the contents of the big ShowDemoWindow() function into smaller functions\n// (because the link time of very large functions grow non-linearly)\nstatic void ShowDemoWindowWidgets();\nstatic void ShowDemoWindowLayout();\nstatic void ShowDemoWindowPopups();\nstatic void ShowDemoWindowTables();\nstatic void ShowDemoWindowColumns();\nstatic void ShowDemoWindowMisc();\n\n// Demonstrate most Dear ImGui features (this is big function!)\n// You may execute this function to experiment with the UI and understand what it does.\n// You may then search for keywords in the code when you are interested by a specific feature.\nvoid ImGui::ShowDemoWindow(bool* p_open)\n{\n    // Exceptionally add an extra assert here for people confused about initial Dear ImGui setup\n    // Most ImGui functions would normally just crash if the context is missing.\n    IM_ASSERT(ImGui::GetCurrentContext() != NULL && \"Missing dear imgui context. Refer to examples app!\");\n\n    // Examples Apps (accessible from the \"Examples\" menu)\n    static bool show_app_main_menu_bar = false;\n    static bool show_app_documents = false;\n\n    static bool show_app_console = false;\n    static bool show_app_log = false;\n    static bool show_app_layout = false;\n    static bool show_app_property_editor = false;\n    static bool show_app_long_text = false;\n    static bool show_app_auto_resize = false;\n    static bool show_app_constrained_resize = false;\n    static bool show_app_simple_overlay = false;\n    static bool show_app_fullscreen = false;\n    static bool show_app_window_titles = false;\n    static bool show_app_custom_rendering = false;\n\n    if (show_app_main_menu_bar)       ShowExampleAppMainMenuBar();\n    if (show_app_documents)           ShowExampleAppDocuments(&show_app_documents);\n\n    if (show_app_console)             ShowExampleAppConsole(&show_app_console);\n    if (show_app_log)                 ShowExampleAppLog(&show_app_log);\n    if (show_app_layout)              ShowExampleAppLayout(&show_app_layout);\n    if (show_app_property_editor)     ShowExampleAppPropertyEditor(&show_app_property_editor);\n    if (show_app_long_text)           ShowExampleAppLongText(&show_app_long_text);\n    if (show_app_auto_resize)         ShowExampleAppAutoResize(&show_app_auto_resize);\n    if (show_app_constrained_resize)  ShowExampleAppConstrainedResize(&show_app_constrained_resize);\n    if (show_app_simple_overlay)      ShowExampleAppSimpleOverlay(&show_app_simple_overlay);\n    if (show_app_fullscreen)          ShowExampleAppFullscreen(&show_app_fullscreen);\n    if (show_app_window_titles)       ShowExampleAppWindowTitles(&show_app_window_titles);\n    if (show_app_custom_rendering)    ShowExampleAppCustomRendering(&show_app_custom_rendering);\n\n    // Dear ImGui Apps (accessible from the \"Tools\" menu)\n    static bool show_app_metrics = false;\n    static bool show_app_style_editor = false;\n    static bool show_app_about = false;\n\n    if (show_app_metrics)       { ImGui::ShowMetricsWindow(&show_app_metrics); }\n    if (show_app_about)         { ImGui::ShowAboutWindow(&show_app_about); }\n    if (show_app_style_editor)\n    {\n        ImGui::Begin(\"Dear ImGui Style Editor\", &show_app_style_editor);\n        ImGui::ShowStyleEditor();\n        ImGui::End();\n    }\n\n    // Demonstrate the various window flags. Typically you would just use the default!\n    static bool no_titlebar = false;\n    static bool no_scrollbar = false;\n    static bool no_menu = false;\n    static bool no_move = false;\n    static bool no_resize = false;\n    static bool no_collapse = false;\n    static bool no_close = false;\n    static bool no_nav = false;\n    static bool no_background = false;\n    static bool no_bring_to_front = false;\n    static bool unsaved_document = false;\n\n    ImGuiWindowFlags window_flags = 0;\n    if (no_titlebar)        window_flags |= ImGuiWindowFlags_NoTitleBar;\n    if (no_scrollbar)       window_flags |= ImGuiWindowFlags_NoScrollbar;\n    if (!no_menu)           window_flags |= ImGuiWindowFlags_MenuBar;\n    if (no_move)            window_flags |= ImGuiWindowFlags_NoMove;\n    if (no_resize)          window_flags |= ImGuiWindowFlags_NoResize;\n    if (no_collapse)        window_flags |= ImGuiWindowFlags_NoCollapse;\n    if (no_nav)             window_flags |= ImGuiWindowFlags_NoNav;\n    if (no_background)      window_flags |= ImGuiWindowFlags_NoBackground;\n    if (no_bring_to_front)  window_flags |= ImGuiWindowFlags_NoBringToFrontOnFocus;\n    if (unsaved_document)   window_flags |= ImGuiWindowFlags_UnsavedDocument;\n    if (no_close)           p_open = NULL; // Don't pass our bool* to Begin\n\n    // We specify a default position/size in case there's no data in the .ini file.\n    // We only do it to make the demo applications a little more welcoming, but typically this isn't required.\n    const ImGuiViewport* main_viewport = ImGui::GetMainViewport();\n    ImGui::SetNextWindowPos(ImVec2(main_viewport->WorkPos.x + 650, main_viewport->WorkPos.y + 20), ImGuiCond_FirstUseEver);\n    ImGui::SetNextWindowSize(ImVec2(550, 680), ImGuiCond_FirstUseEver);\n\n    // Main body of the Demo window starts here.\n    if (!ImGui::Begin(\"Dear ImGui Demo\", p_open, window_flags))\n    {\n        // Early out if the window is collapsed, as an optimization.\n        ImGui::End();\n        return;\n    }\n\n    // Most \"big\" widgets share a common width settings by default. See 'Demo->Layout->Widgets Width' for details.\n\n    // e.g. Use 2/3 of the space for widgets and 1/3 for labels (right align)\n    //ImGui::PushItemWidth(-ImGui::GetWindowWidth() * 0.35f);\n\n    // e.g. Leave a fixed amount of width for labels (by passing a negative value), the rest goes to widgets.\n    ImGui::PushItemWidth(ImGui::GetFontSize() * -12);\n\n    // Menu Bar\n    if (ImGui::BeginMenuBar())\n    {\n        if (ImGui::BeginMenu(\"Menu\"))\n        {\n            ShowExampleMenuFile();\n            ImGui::EndMenu();\n        }\n        if (ImGui::BeginMenu(\"Examples\"))\n        {\n            ImGui::MenuItem(\"Main menu bar\", NULL, &show_app_main_menu_bar);\n            ImGui::MenuItem(\"Console\", NULL, &show_app_console);\n            ImGui::MenuItem(\"Log\", NULL, &show_app_log);\n            ImGui::MenuItem(\"Simple layout\", NULL, &show_app_layout);\n            ImGui::MenuItem(\"Property editor\", NULL, &show_app_property_editor);\n            ImGui::MenuItem(\"Long text display\", NULL, &show_app_long_text);\n            ImGui::MenuItem(\"Auto-resizing window\", NULL, &show_app_auto_resize);\n            ImGui::MenuItem(\"Constrained-resizing window\", NULL, &show_app_constrained_resize);\n            ImGui::MenuItem(\"Simple overlay\", NULL, &show_app_simple_overlay);\n            ImGui::MenuItem(\"Fullscreen window\", NULL, &show_app_fullscreen);\n            ImGui::MenuItem(\"Manipulating window titles\", NULL, &show_app_window_titles);\n            ImGui::MenuItem(\"Custom rendering\", NULL, &show_app_custom_rendering);\n            ImGui::MenuItem(\"Documents\", NULL, &show_app_documents);\n            ImGui::EndMenu();\n        }\n        if (ImGui::BeginMenu(\"Tools\"))\n        {\n            ImGui::MenuItem(\"Metrics/Debugger\", NULL, &show_app_metrics);\n            ImGui::MenuItem(\"Style Editor\", NULL, &show_app_style_editor);\n            ImGui::MenuItem(\"About Dear ImGui\", NULL, &show_app_about);\n            ImGui::EndMenu();\n        }\n        ImGui::EndMenuBar();\n    }\n\n    ImGui::Text(\"dear imgui says hello. (%s)\", IMGUI_VERSION);\n    ImGui::Spacing();\n\n    if (ImGui::CollapsingHeader(\"Help\"))\n    {\n        ImGui::Text(\"ABOUT THIS DEMO:\");\n        ImGui::BulletText(\"Sections below are demonstrating many aspects of the library.\");\n        ImGui::BulletText(\"The \\\"Examples\\\" menu above leads to more demo contents.\");\n        ImGui::BulletText(\"The \\\"Tools\\\" menu above gives access to: About Box, Style Editor,\\n\"\n                          \"and Metrics/Debugger (general purpose Dear ImGui debugging tool).\");\n        ImGui::Separator();\n\n        ImGui::Text(\"PROGRAMMER GUIDE:\");\n        ImGui::BulletText(\"See the ShowDemoWindow() code in imgui_demo.cpp. <- you are here!\");\n        ImGui::BulletText(\"See comments in imgui.cpp.\");\n        ImGui::BulletText(\"See example applications in the examples/ folder.\");\n        ImGui::BulletText(\"Read the FAQ at http://www.dearimgui.org/faq/\");\n        ImGui::BulletText(\"Set 'io.ConfigFlags |= NavEnableKeyboard' for keyboard controls.\");\n        ImGui::BulletText(\"Set 'io.ConfigFlags |= NavEnableGamepad' for gamepad controls.\");\n        ImGui::Separator();\n\n        ImGui::Text(\"USER GUIDE:\");\n        ImGui::ShowUserGuide();\n    }\n\n    if (ImGui::CollapsingHeader(\"Configuration\"))\n    {\n        ImGuiIO& io = ImGui::GetIO();\n\n        if (ImGui::TreeNode(\"Configuration##2\"))\n        {\n            ImGui::CheckboxFlags(\"io.ConfigFlags: NavEnableKeyboard\",    &io.ConfigFlags, ImGuiConfigFlags_NavEnableKeyboard);\n            ImGui::SameLine(); HelpMarker(\"Enable keyboard controls.\");\n            ImGui::CheckboxFlags(\"io.ConfigFlags: NavEnableGamepad\",     &io.ConfigFlags, ImGuiConfigFlags_NavEnableGamepad);\n            ImGui::SameLine(); HelpMarker(\"Enable gamepad controls. Require backend to set io.BackendFlags |= ImGuiBackendFlags_HasGamepad.\\n\\nRead instructions in imgui.cpp for details.\");\n            ImGui::CheckboxFlags(\"io.ConfigFlags: NavEnableSetMousePos\", &io.ConfigFlags, ImGuiConfigFlags_NavEnableSetMousePos);\n            ImGui::SameLine(); HelpMarker(\"Instruct navigation to move the mouse cursor. See comment for ImGuiConfigFlags_NavEnableSetMousePos.\");\n            ImGui::CheckboxFlags(\"io.ConfigFlags: NoMouse\",              &io.ConfigFlags, ImGuiConfigFlags_NoMouse);\n            if (io.ConfigFlags & ImGuiConfigFlags_NoMouse)\n            {\n                // The \"NoMouse\" option can get us stuck with a disabled mouse! Let's provide an alternative way to fix it:\n                if (fmodf((float)ImGui::GetTime(), 0.40f) < 0.20f)\n                {\n                    ImGui::SameLine();\n                    ImGui::Text(\"<<PRESS SPACE TO DISABLE>>\");\n                }\n                if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Space)))\n                    io.ConfigFlags &= ~ImGuiConfigFlags_NoMouse;\n            }\n            ImGui::CheckboxFlags(\"io.ConfigFlags: NoMouseCursorChange\", &io.ConfigFlags, ImGuiConfigFlags_NoMouseCursorChange);\n            ImGui::SameLine(); HelpMarker(\"Instruct backend to not alter mouse cursor shape and visibility.\");\n            ImGui::Checkbox(\"io.ConfigInputTextCursorBlink\", &io.ConfigInputTextCursorBlink);\n            ImGui::SameLine(); HelpMarker(\"Enable blinking cursor (optional as some users consider it to be distracting)\");\n            ImGui::Checkbox(\"io.ConfigDragClickToInputText\", &io.ConfigDragClickToInputText);\n            ImGui::SameLine(); HelpMarker(\"Enable turning DragXXX widgets into text input with a simple mouse click-release (without moving).\");\n            ImGui::Checkbox(\"io.ConfigWindowsResizeFromEdges\", &io.ConfigWindowsResizeFromEdges);\n            ImGui::SameLine(); HelpMarker(\"Enable resizing of windows from their edges and from the lower-left corner.\\nThis requires (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) because it needs mouse cursor feedback.\");\n            ImGui::Checkbox(\"io.ConfigWindowsMoveFromTitleBarOnly\", &io.ConfigWindowsMoveFromTitleBarOnly);\n            ImGui::Checkbox(\"io.MouseDrawCursor\", &io.MouseDrawCursor);\n            ImGui::SameLine(); HelpMarker(\"Instruct Dear ImGui to render a mouse cursor itself. Note that a mouse cursor rendered via your application GPU rendering path will feel more laggy than hardware cursor, but will be more in sync with your other visuals.\\n\\nSome desktop applications may use both kinds of cursors (e.g. enable software cursor only when resizing/dragging something).\");\n            ImGui::Text(\"Also see Style->Rendering for rendering options.\");\n            ImGui::TreePop();\n            ImGui::Separator();\n        }\n\n        if (ImGui::TreeNode(\"Backend Flags\"))\n        {\n            HelpMarker(\n                \"Those flags are set by the backends (imgui_impl_xxx files) to specify their capabilities.\\n\"\n                \"Here we expose them as read-only fields to avoid breaking interactions with your backend.\");\n\n            // Make a local copy to avoid modifying actual backend flags.\n            ImGuiBackendFlags backend_flags = io.BackendFlags;\n            ImGui::CheckboxFlags(\"io.BackendFlags: HasGamepad\",           &backend_flags, ImGuiBackendFlags_HasGamepad);\n            ImGui::CheckboxFlags(\"io.BackendFlags: HasMouseCursors\",      &backend_flags, ImGuiBackendFlags_HasMouseCursors);\n            ImGui::CheckboxFlags(\"io.BackendFlags: HasSetMousePos\",       &backend_flags, ImGuiBackendFlags_HasSetMousePos);\n            ImGui::CheckboxFlags(\"io.BackendFlags: RendererHasVtxOffset\", &backend_flags, ImGuiBackendFlags_RendererHasVtxOffset);\n            ImGui::TreePop();\n            ImGui::Separator();\n        }\n\n        if (ImGui::TreeNode(\"Style\"))\n        {\n            HelpMarker(\"The same contents can be accessed in 'Tools->Style Editor' or by calling the ShowStyleEditor() function.\");\n            ImGui::ShowStyleEditor();\n            ImGui::TreePop();\n            ImGui::Separator();\n        }\n\n        if (ImGui::TreeNode(\"Capture/Logging\"))\n        {\n            HelpMarker(\n                \"The logging API redirects all text output so you can easily capture the content of \"\n                \"a window or a block. Tree nodes can be automatically expanded.\\n\"\n                \"Try opening any of the contents below in this window and then click one of the \\\"Log To\\\" button.\");\n            ImGui::LogButtons();\n\n            HelpMarker(\"You can also call ImGui::LogText() to output directly to the log without a visual output.\");\n            if (ImGui::Button(\"Copy \\\"Hello, world!\\\" to clipboard\"))\n            {\n                ImGui::LogToClipboard();\n                ImGui::LogText(\"Hello, world!\");\n                ImGui::LogFinish();\n            }\n            ImGui::TreePop();\n        }\n    }\n\n    if (ImGui::CollapsingHeader(\"Window options\"))\n    {\n        if (ImGui::BeginTable(\"split\", 3))\n        {\n            ImGui::TableNextColumn(); ImGui::Checkbox(\"No titlebar\", &no_titlebar);\n            ImGui::TableNextColumn(); ImGui::Checkbox(\"No scrollbar\", &no_scrollbar);\n            ImGui::TableNextColumn(); ImGui::Checkbox(\"No menu\", &no_menu);\n            ImGui::TableNextColumn(); ImGui::Checkbox(\"No move\", &no_move);\n            ImGui::TableNextColumn(); ImGui::Checkbox(\"No resize\", &no_resize);\n            ImGui::TableNextColumn(); ImGui::Checkbox(\"No collapse\", &no_collapse);\n            ImGui::TableNextColumn(); ImGui::Checkbox(\"No close\", &no_close);\n            ImGui::TableNextColumn(); ImGui::Checkbox(\"No nav\", &no_nav);\n            ImGui::TableNextColumn(); ImGui::Checkbox(\"No background\", &no_background);\n            ImGui::TableNextColumn(); ImGui::Checkbox(\"No bring to front\", &no_bring_to_front);\n            ImGui::TableNextColumn(); ImGui::Checkbox(\"Unsaved document\", &unsaved_document);\n            ImGui::EndTable();\n        }\n    }\n\n    // All demo contents\n    ShowDemoWindowWidgets();\n    ShowDemoWindowLayout();\n    ShowDemoWindowPopups();\n    ShowDemoWindowTables();\n    ShowDemoWindowMisc();\n\n    // End of ShowDemoWindow()\n    ImGui::PopItemWidth();\n    ImGui::End();\n}\n\nstatic void ShowDemoWindowWidgets()\n{\n    if (!ImGui::CollapsingHeader(\"Widgets\"))\n        return;\n\n    static bool disable_all = false; // The Checkbox for that is inside the \"Disabled\" section at the bottom\n    if (disable_all)\n        ImGui::BeginDisabled();\n\n    if (ImGui::TreeNode(\"Basic\"))\n    {\n        static int clicked = 0;\n        if (ImGui::Button(\"Button\"))\n            clicked++;\n        if (clicked & 1)\n        {\n            ImGui::SameLine();\n            ImGui::Text(\"Thanks for clicking me!\");\n        }\n\n        static bool check = true;\n        ImGui::Checkbox(\"checkbox\", &check);\n\n        static int e = 0;\n        ImGui::RadioButton(\"radio a\", &e, 0); ImGui::SameLine();\n        ImGui::RadioButton(\"radio b\", &e, 1); ImGui::SameLine();\n        ImGui::RadioButton(\"radio c\", &e, 2);\n\n        // Color buttons, demonstrate using PushID() to add unique identifier in the ID stack, and changing style.\n        for (int i = 0; i < 7; i++)\n        {\n            if (i > 0)\n                ImGui::SameLine();\n            ImGui::PushID(i);\n            ImGui::PushStyleColor(ImGuiCol_Button, (ImVec4)ImColor::HSV(i / 7.0f, 0.6f, 0.6f));\n            ImGui::PushStyleColor(ImGuiCol_ButtonHovered, (ImVec4)ImColor::HSV(i / 7.0f, 0.7f, 0.7f));\n            ImGui::PushStyleColor(ImGuiCol_ButtonActive, (ImVec4)ImColor::HSV(i / 7.0f, 0.8f, 0.8f));\n            ImGui::Button(\"Click\");\n            ImGui::PopStyleColor(3);\n            ImGui::PopID();\n        }\n\n        // Use AlignTextToFramePadding() to align text baseline to the baseline of framed widgets elements\n        // (otherwise a Text+SameLine+Button sequence will have the text a little too high by default!)\n        // See 'Demo->Layout->Text Baseline Alignment' for details.\n        ImGui::AlignTextToFramePadding();\n        ImGui::Text(\"Hold to repeat:\");\n        ImGui::SameLine();\n\n        // Arrow buttons with Repeater\n        static int counter = 0;\n        float spacing = ImGui::GetStyle().ItemInnerSpacing.x;\n        ImGui::PushButtonRepeat(true);\n        if (ImGui::ArrowButton(\"##left\", ImGuiDir_Left)) { counter--; }\n        ImGui::SameLine(0.0f, spacing);\n        if (ImGui::ArrowButton(\"##right\", ImGuiDir_Right)) { counter++; }\n        ImGui::PopButtonRepeat();\n        ImGui::SameLine();\n        ImGui::Text(\"%d\", counter);\n\n        ImGui::Text(\"Hover over me\");\n        if (ImGui::IsItemHovered())\n            ImGui::SetTooltip(\"I am a tooltip\");\n\n        ImGui::SameLine();\n        ImGui::Text(\"- or me\");\n        if (ImGui::IsItemHovered())\n        {\n            ImGui::BeginTooltip();\n            ImGui::Text(\"I am a fancy tooltip\");\n            static float arr[] = { 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f };\n            ImGui::PlotLines(\"Curve\", arr, IM_ARRAYSIZE(arr));\n            ImGui::EndTooltip();\n        }\n\n        ImGui::Separator();\n\n        ImGui::LabelText(\"label\", \"Value\");\n\n        {\n            // Using the _simplified_ one-liner Combo() api here\n            // See \"Combo\" section for examples of how to use the more flexible BeginCombo()/EndCombo() api.\n            const char* items[] = { \"AAAA\", \"BBBB\", \"CCCC\", \"DDDD\", \"EEEE\", \"FFFF\", \"GGGG\", \"HHHH\", \"IIIIIII\", \"JJJJ\", \"KKKKKKK\" };\n            static int item_current = 0;\n            ImGui::Combo(\"combo\", &item_current, items, IM_ARRAYSIZE(items));\n            ImGui::SameLine(); HelpMarker(\n                \"Using the simplified one-liner Combo API here.\\nRefer to the \\\"Combo\\\" section below for an explanation of how to use the more flexible and general BeginCombo/EndCombo API.\");\n        }\n\n        {\n            // To wire InputText() with std::string or any other custom string type,\n            // see the \"Text Input > Resize Callback\" section of this demo, and the misc/cpp/imgui_stdlib.h file.\n            static char str0[128] = \"Hello, world!\";\n            ImGui::InputText(\"input text\", str0, IM_ARRAYSIZE(str0));\n            ImGui::SameLine(); HelpMarker(\n                \"USER:\\n\"\n                \"Hold SHIFT or use mouse to select text.\\n\"\n                \"CTRL+Left/Right to word jump.\\n\"\n                \"CTRL+A or double-click to select all.\\n\"\n                \"CTRL+X,CTRL+C,CTRL+V clipboard.\\n\"\n                \"CTRL+Z,CTRL+Y undo/redo.\\n\"\n                \"ESCAPE to revert.\\n\\n\"\n                \"PROGRAMMER:\\n\"\n                \"You can use the ImGuiInputTextFlags_CallbackResize facility if you need to wire InputText() \"\n                \"to a dynamic string type. See misc/cpp/imgui_stdlib.h for an example (this is not demonstrated \"\n                \"in imgui_demo.cpp).\");\n\n            static char str1[128] = \"\";\n            ImGui::InputTextWithHint(\"input text (w/ hint)\", \"enter text here\", str1, IM_ARRAYSIZE(str1));\n\n            static int i0 = 123;\n            ImGui::InputInt(\"input int\", &i0);\n            ImGui::SameLine(); HelpMarker(\n                \"You can apply arithmetic operators +,*,/ on numerical values.\\n\"\n                \"  e.g. [ 100 ], input \\'*2\\', result becomes [ 200 ]\\n\"\n                \"Use +- to subtract.\");\n\n            static float f0 = 0.001f;\n            ImGui::InputFloat(\"input float\", &f0, 0.01f, 1.0f, \"%.3f\");\n\n            static double d0 = 999999.00000001;\n            ImGui::InputDouble(\"input double\", &d0, 0.01f, 1.0f, \"%.8f\");\n\n            static float f1 = 1.e10f;\n            ImGui::InputFloat(\"input scientific\", &f1, 0.0f, 0.0f, \"%e\");\n            ImGui::SameLine(); HelpMarker(\n                \"You can input value using the scientific notation,\\n\"\n                \"  e.g. \\\"1e+8\\\" becomes \\\"100000000\\\".\");\n\n            static float vec4a[4] = { 0.10f, 0.20f, 0.30f, 0.44f };\n            ImGui::InputFloat3(\"input float3\", vec4a);\n        }\n\n        {\n            static int i1 = 50, i2 = 42;\n            ImGui::DragInt(\"drag int\", &i1, 1);\n            ImGui::SameLine(); HelpMarker(\n                \"Click and drag to edit value.\\n\"\n                \"Hold SHIFT/ALT for faster/slower edit.\\n\"\n                \"Double-click or CTRL+click to input value.\");\n\n            ImGui::DragInt(\"drag int 0..100\", &i2, 1, 0, 100, \"%d%%\", ImGuiSliderFlags_AlwaysClamp);\n\n            static float f1 = 1.00f, f2 = 0.0067f;\n            ImGui::DragFloat(\"drag float\", &f1, 0.005f);\n            ImGui::DragFloat(\"drag small float\", &f2, 0.0001f, 0.0f, 0.0f, \"%.06f ns\");\n        }\n\n        {\n            static int i1 = 0;\n            ImGui::SliderInt(\"slider int\", &i1, -1, 3);\n            ImGui::SameLine(); HelpMarker(\"CTRL+click to input value.\");\n\n            static float f1 = 0.123f, f2 = 0.0f;\n            ImGui::SliderFloat(\"slider float\", &f1, 0.0f, 1.0f, \"ratio = %.3f\");\n            ImGui::SliderFloat(\"slider float (log)\", &f2, -10.0f, 10.0f, \"%.4f\", ImGuiSliderFlags_Logarithmic);\n\n            static float angle = 0.0f;\n            ImGui::SliderAngle(\"slider angle\", &angle);\n\n            // Using the format string to display a name instead of an integer.\n            // Here we completely omit '%d' from the format string, so it'll only display a name.\n            // This technique can also be used with DragInt().\n            enum Element { Element_Fire, Element_Earth, Element_Air, Element_Water, Element_COUNT };\n            static int elem = Element_Fire;\n            const char* elems_names[Element_COUNT] = { \"Fire\", \"Earth\", \"Air\", \"Water\" };\n            const char* elem_name = (elem >= 0 && elem < Element_COUNT) ? elems_names[elem] : \"Unknown\";\n            ImGui::SliderInt(\"slider enum\", &elem, 0, Element_COUNT - 1, elem_name);\n            ImGui::SameLine(); HelpMarker(\"Using the format string parameter to display a name instead of the underlying integer.\");\n        }\n\n        {\n            static float col1[3] = { 1.0f, 0.0f, 0.2f };\n            static float col2[4] = { 0.4f, 0.7f, 0.0f, 0.5f };\n            ImGui::ColorEdit3(\"color 1\", col1);\n            ImGui::SameLine(); HelpMarker(\n                \"Click on the color square to open a color picker.\\n\"\n                \"Click and hold to use drag and drop.\\n\"\n                \"Right-click on the color square to show options.\\n\"\n                \"CTRL+click on individual component to input value.\\n\");\n\n            ImGui::ColorEdit4(\"color 2\", col2);\n        }\n\n        {\n            // Using the _simplified_ one-liner ListBox() api here\n            // See \"List boxes\" section for examples of how to use the more flexible BeginListBox()/EndListBox() api.\n            const char* items[] = { \"Apple\", \"Banana\", \"Cherry\", \"Kiwi\", \"Mango\", \"Orange\", \"Pineapple\", \"Strawberry\", \"Watermelon\" };\n            static int item_current = 1;\n            ImGui::ListBox(\"listbox\", &item_current, items, IM_ARRAYSIZE(items), 4);\n            ImGui::SameLine(); HelpMarker(\n                \"Using the simplified one-liner ListBox API here.\\nRefer to the \\\"List boxes\\\" section below for an explanation of how to use the more flexible and general BeginListBox/EndListBox API.\");\n        }\n\n        ImGui::TreePop();\n    }\n\n    // Testing ImGuiOnceUponAFrame helper.\n    //static ImGuiOnceUponAFrame once;\n    //for (int i = 0; i < 5; i++)\n    //    if (once)\n    //        ImGui::Text(\"This will be displayed only once.\");\n\n    if (ImGui::TreeNode(\"Trees\"))\n    {\n        if (ImGui::TreeNode(\"Basic trees\"))\n        {\n            for (int i = 0; i < 5; i++)\n            {\n                // Use SetNextItemOpen() so set the default state of a node to be open. We could\n                // also use TreeNodeEx() with the ImGuiTreeNodeFlags_DefaultOpen flag to achieve the same thing!\n                if (i == 0)\n                    ImGui::SetNextItemOpen(true, ImGuiCond_Once);\n\n                if (ImGui::TreeNode((void*)(intptr_t)i, \"Child %d\", i))\n                {\n                    ImGui::Text(\"blah blah\");\n                    ImGui::SameLine();\n                    if (ImGui::SmallButton(\"button\")) {}\n                    ImGui::TreePop();\n                }\n            }\n            ImGui::TreePop();\n        }\n\n        if (ImGui::TreeNode(\"Advanced, with Selectable nodes\"))\n        {\n            HelpMarker(\n                \"This is a more typical looking tree with selectable nodes.\\n\"\n                \"Click to select, CTRL+Click to toggle, click on arrows or double-click to open.\");\n            static ImGuiTreeNodeFlags base_flags = ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_OpenOnDoubleClick | ImGuiTreeNodeFlags_SpanAvailWidth;\n            static bool align_label_with_current_x_position = false;\n            static bool test_drag_and_drop = false;\n            ImGui::CheckboxFlags(\"ImGuiTreeNodeFlags_OpenOnArrow\",       &base_flags, ImGuiTreeNodeFlags_OpenOnArrow);\n            ImGui::CheckboxFlags(\"ImGuiTreeNodeFlags_OpenOnDoubleClick\", &base_flags, ImGuiTreeNodeFlags_OpenOnDoubleClick);\n            ImGui::CheckboxFlags(\"ImGuiTreeNodeFlags_SpanAvailWidth\",    &base_flags, ImGuiTreeNodeFlags_SpanAvailWidth); ImGui::SameLine(); HelpMarker(\"Extend hit area to all available width instead of allowing more items to be laid out after the node.\");\n            ImGui::CheckboxFlags(\"ImGuiTreeNodeFlags_SpanFullWidth\",     &base_flags, ImGuiTreeNodeFlags_SpanFullWidth);\n            ImGui::Checkbox(\"Align label with current X position\", &align_label_with_current_x_position);\n            ImGui::Checkbox(\"Test tree node as drag source\", &test_drag_and_drop);\n            ImGui::Text(\"Hello!\");\n            if (align_label_with_current_x_position)\n                ImGui::Unindent(ImGui::GetTreeNodeToLabelSpacing());\n\n            // 'selection_mask' is dumb representation of what may be user-side selection state.\n            //  You may retain selection state inside or outside your objects in whatever format you see fit.\n            // 'node_clicked' is temporary storage of what node we have clicked to process selection at the end\n            /// of the loop. May be a pointer to your own node type, etc.\n            static int selection_mask = (1 << 2);\n            int node_clicked = -1;\n            for (int i = 0; i < 6; i++)\n            {\n                // Disable the default \"open on single-click behavior\" + set Selected flag according to our selection.\n                ImGuiTreeNodeFlags node_flags = base_flags;\n                const bool is_selected = (selection_mask & (1 << i)) != 0;\n                if (is_selected)\n                    node_flags |= ImGuiTreeNodeFlags_Selected;\n                if (i < 3)\n                {\n                    // Items 0..2 are Tree Node\n                    bool node_open = ImGui::TreeNodeEx((void*)(intptr_t)i, node_flags, \"Selectable Node %d\", i);\n                    if (ImGui::IsItemClicked())\n                        node_clicked = i;\n                    if (test_drag_and_drop && ImGui::BeginDragDropSource())\n                    {\n                        ImGui::SetDragDropPayload(\"_TREENODE\", NULL, 0);\n                        ImGui::Text(\"This is a drag and drop source\");\n                        ImGui::EndDragDropSource();\n                    }\n                    if (node_open)\n                    {\n                        ImGui::BulletText(\"Blah blah\\nBlah Blah\");\n                        ImGui::TreePop();\n                    }\n                }\n                else\n                {\n                    // Items 3..5 are Tree Leaves\n                    // The only reason we use TreeNode at all is to allow selection of the leaf. Otherwise we can\n                    // use BulletText() or advance the cursor by GetTreeNodeToLabelSpacing() and call Text().\n                    node_flags |= ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_NoTreePushOnOpen; // ImGuiTreeNodeFlags_Bullet\n                    ImGui::TreeNodeEx((void*)(intptr_t)i, node_flags, \"Selectable Leaf %d\", i);\n                    if (ImGui::IsItemClicked())\n                        node_clicked = i;\n                    if (test_drag_and_drop && ImGui::BeginDragDropSource())\n                    {\n                        ImGui::SetDragDropPayload(\"_TREENODE\", NULL, 0);\n                        ImGui::Text(\"This is a drag and drop source\");\n                        ImGui::EndDragDropSource();\n                    }\n                }\n            }\n            if (node_clicked != -1)\n            {\n                // Update selection state\n                // (process outside of tree loop to avoid visual inconsistencies during the clicking frame)\n                if (ImGui::GetIO().KeyCtrl)\n                    selection_mask ^= (1 << node_clicked);          // CTRL+click to toggle\n                else //if (!(selection_mask & (1 << node_clicked))) // Depending on selection behavior you want, may want to preserve selection when clicking on item that is part of the selection\n                    selection_mask = (1 << node_clicked);           // Click to single-select\n            }\n            if (align_label_with_current_x_position)\n                ImGui::Indent(ImGui::GetTreeNodeToLabelSpacing());\n            ImGui::TreePop();\n        }\n        ImGui::TreePop();\n    }\n\n    if (ImGui::TreeNode(\"Collapsing Headers\"))\n    {\n        static bool closable_group = true;\n        ImGui::Checkbox(\"Show 2nd header\", &closable_group);\n        if (ImGui::CollapsingHeader(\"Header\", ImGuiTreeNodeFlags_None))\n        {\n            ImGui::Text(\"IsItemHovered: %d\", ImGui::IsItemHovered());\n            for (int i = 0; i < 5; i++)\n                ImGui::Text(\"Some content %d\", i);\n        }\n        if (ImGui::CollapsingHeader(\"Header with a close button\", &closable_group))\n        {\n            ImGui::Text(\"IsItemHovered: %d\", ImGui::IsItemHovered());\n            for (int i = 0; i < 5; i++)\n                ImGui::Text(\"More content %d\", i);\n        }\n        /*\n        if (ImGui::CollapsingHeader(\"Header with a bullet\", ImGuiTreeNodeFlags_Bullet))\n            ImGui::Text(\"IsItemHovered: %d\", ImGui::IsItemHovered());\n        */\n        ImGui::TreePop();\n    }\n\n    if (ImGui::TreeNode(\"Bullets\"))\n    {\n        ImGui::BulletText(\"Bullet point 1\");\n        ImGui::BulletText(\"Bullet point 2\\nOn multiple lines\");\n        if (ImGui::TreeNode(\"Tree node\"))\n        {\n            ImGui::BulletText(\"Another bullet point\");\n            ImGui::TreePop();\n        }\n        ImGui::Bullet(); ImGui::Text(\"Bullet point 3 (two calls)\");\n        ImGui::Bullet(); ImGui::SmallButton(\"Button\");\n        ImGui::TreePop();\n    }\n\n    if (ImGui::TreeNode(\"Text\"))\n    {\n        if (ImGui::TreeNode(\"Colorful Text\"))\n        {\n            // Using shortcut. You can use PushStyleColor()/PopStyleColor() for more flexibility.\n            ImGui::TextColored(ImVec4(1.0f, 0.0f, 1.0f, 1.0f), \"Pink\");\n            ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f), \"Yellow\");\n            ImGui::TextDisabled(\"Disabled\");\n            ImGui::SameLine(); HelpMarker(\"The TextDisabled color is stored in ImGuiStyle.\");\n            ImGui::TreePop();\n        }\n\n        if (ImGui::TreeNode(\"Word Wrapping\"))\n        {\n            // Using shortcut. You can use PushTextWrapPos()/PopTextWrapPos() for more flexibility.\n            ImGui::TextWrapped(\n                \"This text should automatically wrap on the edge of the window. The current implementation \"\n                \"for text wrapping follows simple rules suitable for English and possibly other languages.\");\n            ImGui::Spacing();\n\n            static float wrap_width = 200.0f;\n            ImGui::SliderFloat(\"Wrap width\", &wrap_width, -20, 600, \"%.0f\");\n\n            ImDrawList* draw_list = ImGui::GetWindowDrawList();\n            for (int n = 0; n < 2; n++)\n            {\n                ImGui::Text(\"Test paragraph %d:\", n);\n                ImVec2 pos = ImGui::GetCursorScreenPos();\n                ImVec2 marker_min = ImVec2(pos.x + wrap_width, pos.y);\n                ImVec2 marker_max = ImVec2(pos.x + wrap_width + 10, pos.y + ImGui::GetTextLineHeight());\n                ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + wrap_width);\n                if (n == 0)\n                    ImGui::Text(\"The lazy dog is a good dog. This paragraph should fit within %.0f pixels. Testing a 1 character word. The quick brown fox jumps over the lazy dog.\", wrap_width);\n                else\n                    ImGui::Text(\"aaaaaaaa bbbbbbbb, c cccccccc,dddddddd. d eeeeeeee   ffffffff. gggggggg!hhhhhhhh\");\n\n                // Draw actual text bounding box, following by marker of our expected limit (should not overlap!)\n                draw_list->AddRect(ImGui::GetItemRectMin(), ImGui::GetItemRectMax(), IM_COL32(255, 255, 0, 255));\n                draw_list->AddRectFilled(marker_min, marker_max, IM_COL32(255, 0, 255, 255));\n                ImGui::PopTextWrapPos();\n            }\n\n            ImGui::TreePop();\n        }\n\n        if (ImGui::TreeNode(\"UTF-8 Text\"))\n        {\n            // UTF-8 test with Japanese characters\n            // (Needs a suitable font? Try \"Google Noto\" or \"Arial Unicode\". See docs/FONTS.md for details.)\n            // - From C++11 you can use the u8\"my text\" syntax to encode literal strings as UTF-8\n            // - For earlier compiler, you may be able to encode your sources as UTF-8 (e.g. in Visual Studio, you\n            //   can save your source files as 'UTF-8 without signature').\n            // - FOR THIS DEMO FILE ONLY, BECAUSE WE WANT TO SUPPORT OLD COMPILERS, WE ARE *NOT* INCLUDING RAW UTF-8\n            //   CHARACTERS IN THIS SOURCE FILE. Instead we are encoding a few strings with hexadecimal constants.\n            //   Don't do this in your application! Please use u8\"text in any language\" in your application!\n            // Note that characters values are preserved even by InputText() if the font cannot be displayed,\n            // so you can safely copy & paste garbled characters into another application.\n            ImGui::TextWrapped(\n                \"CJK text will only appears if the font was loaded with the appropriate CJK character ranges. \"\n                \"Call io.Fonts->AddFontFromFileTTF() manually to load extra character ranges. \"\n                \"Read docs/FONTS.md for details.\");\n            ImGui::Text(\"Hiragana: \\xe3\\x81\\x8b\\xe3\\x81\\x8d\\xe3\\x81\\x8f\\xe3\\x81\\x91\\xe3\\x81\\x93 (kakikukeko)\"); // Normally we would use u8\"blah blah\" with the proper characters directly in the string.\n            ImGui::Text(\"Kanjis: \\xe6\\x97\\xa5\\xe6\\x9c\\xac\\xe8\\xaa\\x9e (nihongo)\");\n            static char buf[32] = \"\\xe6\\x97\\xa5\\xe6\\x9c\\xac\\xe8\\xaa\\x9e\";\n            //static char buf[32] = u8\"NIHONGO\"; // <- this is how you would write it with C++11, using real kanjis\n            ImGui::InputText(\"UTF-8 input\", buf, IM_ARRAYSIZE(buf));\n            ImGui::TreePop();\n        }\n        ImGui::TreePop();\n    }\n\n    if (ImGui::TreeNode(\"Images\"))\n    {\n        ImGuiIO& io = ImGui::GetIO();\n        ImGui::TextWrapped(\n            \"Below we are displaying the font texture (which is the only texture we have access to in this demo). \"\n            \"Use the 'ImTextureID' type as storage to pass pointers or identifier to your own texture data. \"\n            \"Hover the texture for a zoomed view!\");\n\n        // Below we are displaying the font texture because it is the only texture we have access to inside the demo!\n        // Remember that ImTextureID is just storage for whatever you want it to be. It is essentially a value that\n        // will be passed to the rendering backend via the ImDrawCmd structure.\n        // If you use one of the default imgui_impl_XXXX.cpp rendering backend, they all have comments at the top\n        // of their respective source file to specify what they expect to be stored in ImTextureID, for example:\n        // - The imgui_impl_dx11.cpp renderer expect a 'ID3D11ShaderResourceView*' pointer\n        // - The imgui_impl_opengl3.cpp renderer expect a GLuint OpenGL texture identifier, etc.\n        // More:\n        // - If you decided that ImTextureID = MyEngineTexture*, then you can pass your MyEngineTexture* pointers\n        //   to ImGui::Image(), and gather width/height through your own functions, etc.\n        // - You can use ShowMetricsWindow() to inspect the draw data that are being passed to your renderer,\n        //   it will help you debug issues if you are confused about it.\n        // - Consider using the lower-level ImDrawList::AddImage() API, via ImGui::GetWindowDrawList()->AddImage().\n        // - Read https://github.com/ocornut/imgui/blob/master/docs/FAQ.md\n        // - Read https://github.com/ocornut/imgui/wiki/Image-Loading-and-Displaying-Examples\n        ImTextureID my_tex_id = io.Fonts->TexID;\n        float my_tex_w = (float)io.Fonts->TexWidth;\n        float my_tex_h = (float)io.Fonts->TexHeight;\n        {\n            ImGui::Text(\"%.0fx%.0f\", my_tex_w, my_tex_h);\n            ImVec2 pos = ImGui::GetCursorScreenPos();\n            ImVec2 uv_min = ImVec2(0.0f, 0.0f);                 // Top-left\n            ImVec2 uv_max = ImVec2(1.0f, 1.0f);                 // Lower-right\n            ImVec4 tint_col = ImVec4(1.0f, 1.0f, 1.0f, 1.0f);   // No tint\n            ImVec4 border_col = ImVec4(1.0f, 1.0f, 1.0f, 0.5f); // 50% opaque white\n            ImGui::Image(my_tex_id, ImVec2(my_tex_w, my_tex_h), uv_min, uv_max, tint_col, border_col);\n            if (ImGui::IsItemHovered())\n            {\n                ImGui::BeginTooltip();\n                float region_sz = 32.0f;\n                float region_x = io.MousePos.x - pos.x - region_sz * 0.5f;\n                float region_y = io.MousePos.y - pos.y - region_sz * 0.5f;\n                float zoom = 4.0f;\n                if (region_x < 0.0f) { region_x = 0.0f; }\n                else if (region_x > my_tex_w - region_sz) { region_x = my_tex_w - region_sz; }\n                if (region_y < 0.0f) { region_y = 0.0f; }\n                else if (region_y > my_tex_h - region_sz) { region_y = my_tex_h - region_sz; }\n                ImGui::Text(\"Min: (%.2f, %.2f)\", region_x, region_y);\n                ImGui::Text(\"Max: (%.2f, %.2f)\", region_x + region_sz, region_y + region_sz);\n                ImVec2 uv0 = ImVec2((region_x) / my_tex_w, (region_y) / my_tex_h);\n                ImVec2 uv1 = ImVec2((region_x + region_sz) / my_tex_w, (region_y + region_sz) / my_tex_h);\n                ImGui::Image(my_tex_id, ImVec2(region_sz * zoom, region_sz * zoom), uv0, uv1, tint_col, border_col);\n                ImGui::EndTooltip();\n            }\n        }\n        ImGui::TextWrapped(\"And now some textured buttons..\");\n        static int pressed_count = 0;\n        for (int i = 0; i < 8; i++)\n        {\n            ImGui::PushID(i);\n            int frame_padding = -1 + i;                             // -1 == uses default padding (style.FramePadding)\n            ImVec2 size = ImVec2(32.0f, 32.0f);                     // Size of the image we want to make visible\n            ImVec2 uv0 = ImVec2(0.0f, 0.0f);                        // UV coordinates for lower-left\n            ImVec2 uv1 = ImVec2(32.0f / my_tex_w, 32.0f / my_tex_h);// UV coordinates for (32,32) in our texture\n            ImVec4 bg_col = ImVec4(0.0f, 0.0f, 0.0f, 1.0f);         // Black background\n            ImVec4 tint_col = ImVec4(1.0f, 1.0f, 1.0f, 1.0f);       // No tint\n            if (ImGui::ImageButton(my_tex_id, size, uv0, uv1, frame_padding, bg_col, tint_col))\n                pressed_count += 1;\n            ImGui::PopID();\n            ImGui::SameLine();\n        }\n        ImGui::NewLine();\n        ImGui::Text(\"Pressed %d times.\", pressed_count);\n        ImGui::TreePop();\n    }\n\n    if (ImGui::TreeNode(\"Combo\"))\n    {\n        // Expose flags as checkbox for the demo\n        static ImGuiComboFlags flags = 0;\n        ImGui::CheckboxFlags(\"ImGuiComboFlags_PopupAlignLeft\", &flags, ImGuiComboFlags_PopupAlignLeft);\n        ImGui::SameLine(); HelpMarker(\"Only makes a difference if the popup is larger than the combo\");\n        if (ImGui::CheckboxFlags(\"ImGuiComboFlags_NoArrowButton\", &flags, ImGuiComboFlags_NoArrowButton))\n            flags &= ~ImGuiComboFlags_NoPreview;     // Clear the other flag, as we cannot combine both\n        if (ImGui::CheckboxFlags(\"ImGuiComboFlags_NoPreview\", &flags, ImGuiComboFlags_NoPreview))\n            flags &= ~ImGuiComboFlags_NoArrowButton; // Clear the other flag, as we cannot combine both\n\n        // Using the generic BeginCombo() API, you have full control over how to display the combo contents.\n        // (your selection data could be an index, a pointer to the object, an id for the object, a flag intrusively\n        // stored in the object itself, etc.)\n        const char* items[] = { \"AAAA\", \"BBBB\", \"CCCC\", \"DDDD\", \"EEEE\", \"FFFF\", \"GGGG\", \"HHHH\", \"IIII\", \"JJJJ\", \"KKKK\", \"LLLLLLL\", \"MMMM\", \"OOOOOOO\" };\n        static int item_current_idx = 0; // Here we store our selection data as an index.\n        const char* combo_preview_value = items[item_current_idx];  // Pass in the preview value visible before opening the combo (it could be anything)\n        if (ImGui::BeginCombo(\"combo 1\", combo_preview_value, flags))\n        {\n            for (int n = 0; n < IM_ARRAYSIZE(items); n++)\n            {\n                const bool is_selected = (item_current_idx == n);\n                if (ImGui::Selectable(items[n], is_selected))\n                    item_current_idx = n;\n\n                // Set the initial focus when opening the combo (scrolling + keyboard navigation focus)\n                if (is_selected)\n                    ImGui::SetItemDefaultFocus();\n            }\n            ImGui::EndCombo();\n        }\n\n        // Simplified one-liner Combo() API, using values packed in a single constant string\n        // This is a convenience for when the selection set is small and known at compile-time.\n        static int item_current_2 = 0;\n        ImGui::Combo(\"combo 2 (one-liner)\", &item_current_2, \"aaaa\\0bbbb\\0cccc\\0dddd\\0eeee\\0\\0\");\n\n        // Simplified one-liner Combo() using an array of const char*\n        // This is not very useful (may obsolete): prefer using BeginCombo()/EndCombo() for full control.\n        static int item_current_3 = -1; // If the selection isn't within 0..count, Combo won't display a preview\n        ImGui::Combo(\"combo 3 (array)\", &item_current_3, items, IM_ARRAYSIZE(items));\n\n        // Simplified one-liner Combo() using an accessor function\n        struct Funcs { static bool ItemGetter(void* data, int n, const char** out_str) { *out_str = ((const char**)data)[n]; return true; } };\n        static int item_current_4 = 0;\n        ImGui::Combo(\"combo 4 (function)\", &item_current_4, &Funcs::ItemGetter, items, IM_ARRAYSIZE(items));\n\n        ImGui::TreePop();\n    }\n\n    if (ImGui::TreeNode(\"List boxes\"))\n    {\n        // Using the generic BeginListBox() API, you have full control over how to display the combo contents.\n        // (your selection data could be an index, a pointer to the object, an id for the object, a flag intrusively\n        // stored in the object itself, etc.)\n        const char* items[] = { \"AAAA\", \"BBBB\", \"CCCC\", \"DDDD\", \"EEEE\", \"FFFF\", \"GGGG\", \"HHHH\", \"IIII\", \"JJJJ\", \"KKKK\", \"LLLLLLL\", \"MMMM\", \"OOOOOOO\" };\n        static int item_current_idx = 0; // Here we store our selection data as an index.\n        if (ImGui::BeginListBox(\"listbox 1\"))\n        {\n            for (int n = 0; n < IM_ARRAYSIZE(items); n++)\n            {\n                const bool is_selected = (item_current_idx == n);\n                if (ImGui::Selectable(items[n], is_selected))\n                    item_current_idx = n;\n\n                // Set the initial focus when opening the combo (scrolling + keyboard navigation focus)\n                if (is_selected)\n                    ImGui::SetItemDefaultFocus();\n            }\n            ImGui::EndListBox();\n        }\n\n        // Custom size: use all width, 5 items tall\n        ImGui::Text(\"Full-width:\");\n        if (ImGui::BeginListBox(\"##listbox 2\", ImVec2(-FLT_MIN, 5 * ImGui::GetTextLineHeightWithSpacing())))\n        {\n            for (int n = 0; n < IM_ARRAYSIZE(items); n++)\n            {\n                const bool is_selected = (item_current_idx == n);\n                if (ImGui::Selectable(items[n], is_selected))\n                    item_current_idx = n;\n\n                // Set the initial focus when opening the combo (scrolling + keyboard navigation focus)\n                if (is_selected)\n                    ImGui::SetItemDefaultFocus();\n            }\n            ImGui::EndListBox();\n        }\n\n        ImGui::TreePop();\n    }\n\n    if (ImGui::TreeNode(\"Selectables\"))\n    {\n        // Selectable() has 2 overloads:\n        // - The one taking \"bool selected\" as a read-only selection information.\n        //   When Selectable() has been clicked it returns true and you can alter selection state accordingly.\n        // - The one taking \"bool* p_selected\" as a read-write selection information (convenient in some cases)\n        // The earlier is more flexible, as in real application your selection may be stored in many different ways\n        // and not necessarily inside a bool value (e.g. in flags within objects, as an external list, etc).\n        if (ImGui::TreeNode(\"Basic\"))\n        {\n            static bool selection[5] = { false, true, false, false, false };\n            ImGui::Selectable(\"1. I am selectable\", &selection[0]);\n            ImGui::Selectable(\"2. I am selectable\", &selection[1]);\n            ImGui::Text(\"(I am not selectable)\");\n            ImGui::Selectable(\"4. I am selectable\", &selection[3]);\n            if (ImGui::Selectable(\"5. I am double clickable\", selection[4], ImGuiSelectableFlags_AllowDoubleClick))\n                if (ImGui::IsMouseDoubleClicked(0))\n                    selection[4] = !selection[4];\n            ImGui::TreePop();\n        }\n        if (ImGui::TreeNode(\"Selection State: Single Selection\"))\n        {\n            static int selected = -1;\n            for (int n = 0; n < 5; n++)\n            {\n                char buf[32];\n                sprintf(buf, \"Object %d\", n);\n                if (ImGui::Selectable(buf, selected == n))\n                    selected = n;\n            }\n            ImGui::TreePop();\n        }\n        if (ImGui::TreeNode(\"Selection State: Multiple Selection\"))\n        {\n            HelpMarker(\"Hold CTRL and click to select multiple items.\");\n            static bool selection[5] = { false, false, false, false, false };\n            for (int n = 0; n < 5; n++)\n            {\n                char buf[32];\n                sprintf(buf, \"Object %d\", n);\n                if (ImGui::Selectable(buf, selection[n]))\n                {\n                    if (!ImGui::GetIO().KeyCtrl)    // Clear selection when CTRL is not held\n                        memset(selection, 0, sizeof(selection));\n                    selection[n] ^= 1;\n                }\n            }\n            ImGui::TreePop();\n        }\n        if (ImGui::TreeNode(\"Rendering more text into the same line\"))\n        {\n            // Using the Selectable() override that takes \"bool* p_selected\" parameter,\n            // this function toggle your bool value automatically.\n            static bool selected[3] = { false, false, false };\n            ImGui::Selectable(\"main.c\",    &selected[0]); ImGui::SameLine(300); ImGui::Text(\" 2,345 bytes\");\n            ImGui::Selectable(\"Hello.cpp\", &selected[1]); ImGui::SameLine(300); ImGui::Text(\"12,345 bytes\");\n            ImGui::Selectable(\"Hello.h\",   &selected[2]); ImGui::SameLine(300); ImGui::Text(\" 2,345 bytes\");\n            ImGui::TreePop();\n        }\n        if (ImGui::TreeNode(\"In columns\"))\n        {\n            static bool selected[10] = {};\n\n            if (ImGui::BeginTable(\"split1\", 3, ImGuiTableFlags_Resizable | ImGuiTableFlags_NoSavedSettings | ImGuiTableFlags_Borders))\n            {\n                for (int i = 0; i < 10; i++)\n                {\n                    char label[32];\n                    sprintf(label, \"Item %d\", i);\n                    ImGui::TableNextColumn();\n                    ImGui::Selectable(label, &selected[i]); // FIXME-TABLE: Selection overlap\n                }\n                ImGui::EndTable();\n            }\n            ImGui::Spacing();\n            if (ImGui::BeginTable(\"split2\", 3, ImGuiTableFlags_Resizable | ImGuiTableFlags_NoSavedSettings | ImGuiTableFlags_Borders))\n            {\n                for (int i = 0; i < 10; i++)\n                {\n                    char label[32];\n                    sprintf(label, \"Item %d\", i);\n                    ImGui::TableNextRow();\n                    ImGui::TableNextColumn();\n                    ImGui::Selectable(label, &selected[i], ImGuiSelectableFlags_SpanAllColumns);\n                    ImGui::TableNextColumn();\n                    ImGui::Text(\"Some other contents\");\n                    ImGui::TableNextColumn();\n                    ImGui::Text(\"123456\");\n                }\n                ImGui::EndTable();\n            }\n            ImGui::TreePop();\n        }\n        if (ImGui::TreeNode(\"Grid\"))\n        {\n            static char selected[4][4] = { { 1, 0, 0, 0 }, { 0, 1, 0, 0 }, { 0, 0, 1, 0 }, { 0, 0, 0, 1 } };\n\n            // Add in a bit of silly fun...\n            const float time = (float)ImGui::GetTime();\n            const bool winning_state = memchr(selected, 0, sizeof(selected)) == NULL; // If all cells are selected...\n            if (winning_state)\n                ImGui::PushStyleVar(ImGuiStyleVar_SelectableTextAlign, ImVec2(0.5f + 0.5f * cosf(time * 2.0f), 0.5f + 0.5f * sinf(time * 3.0f)));\n\n            for (int y = 0; y < 4; y++)\n                for (int x = 0; x < 4; x++)\n                {\n                    if (x > 0)\n                        ImGui::SameLine();\n                    ImGui::PushID(y * 4 + x);\n                    if (ImGui::Selectable(\"Sailor\", selected[y][x] != 0, 0, ImVec2(50, 50)))\n                    {\n                        // Toggle clicked cell + toggle neighbors\n                        selected[y][x] ^= 1;\n                        if (x > 0) { selected[y][x - 1] ^= 1; }\n                        if (x < 3) { selected[y][x + 1] ^= 1; }\n                        if (y > 0) { selected[y - 1][x] ^= 1; }\n                        if (y < 3) { selected[y + 1][x] ^= 1; }\n                    }\n                    ImGui::PopID();\n                }\n\n            if (winning_state)\n                ImGui::PopStyleVar();\n            ImGui::TreePop();\n        }\n        if (ImGui::TreeNode(\"Alignment\"))\n        {\n            HelpMarker(\n                \"By default, Selectables uses style.SelectableTextAlign but it can be overridden on a per-item \"\n                \"basis using PushStyleVar(). You'll probably want to always keep your default situation to \"\n                \"left-align otherwise it becomes difficult to layout multiple items on a same line\");\n            static bool selected[3 * 3] = { true, false, true, false, true, false, true, false, true };\n            for (int y = 0; y < 3; y++)\n            {\n                for (int x = 0; x < 3; x++)\n                {\n                    ImVec2 alignment = ImVec2((float)x / 2.0f, (float)y / 2.0f);\n                    char name[32];\n                    sprintf(name, \"(%.1f,%.1f)\", alignment.x, alignment.y);\n                    if (x > 0) ImGui::SameLine();\n                    ImGui::PushStyleVar(ImGuiStyleVar_SelectableTextAlign, alignment);\n                    ImGui::Selectable(name, &selected[3 * y + x], ImGuiSelectableFlags_None, ImVec2(80, 80));\n                    ImGui::PopStyleVar();\n                }\n            }\n            ImGui::TreePop();\n        }\n        ImGui::TreePop();\n    }\n\n    // To wire InputText() with std::string or any other custom string type,\n    // see the \"Text Input > Resize Callback\" section of this demo, and the misc/cpp/imgui_stdlib.h file.\n    if (ImGui::TreeNode(\"Text Input\"))\n    {\n        if (ImGui::TreeNode(\"Multi-line Text Input\"))\n        {\n            // Note: we are using a fixed-sized buffer for simplicity here. See ImGuiInputTextFlags_CallbackResize\n            // and the code in misc/cpp/imgui_stdlib.h for how to setup InputText() for dynamically resizing strings.\n            static char text[1024 * 16] =\n                \"/*\\n\"\n                \" The Pentium F00F bug, shorthand for F0 0F C7 C8,\\n\"\n                \" the hexadecimal encoding of one offending instruction,\\n\"\n                \" more formally, the invalid operand with locked CMPXCHG8B\\n\"\n                \" instruction bug, is a design flaw in the majority of\\n\"\n                \" Intel Pentium, Pentium MMX, and Pentium OverDrive\\n\"\n                \" processors (all in the P5 microarchitecture).\\n\"\n                \"*/\\n\\n\"\n                \"label:\\n\"\n                \"\\tlock cmpxchg8b eax\\n\";\n\n            static ImGuiInputTextFlags flags = ImGuiInputTextFlags_AllowTabInput;\n            HelpMarker(\"You can use the ImGuiInputTextFlags_CallbackResize facility if you need to wire InputTextMultiline() to a dynamic string type. See misc/cpp/imgui_stdlib.h for an example. (This is not demonstrated in imgui_demo.cpp because we don't want to include <string> in here)\");\n            ImGui::CheckboxFlags(\"ImGuiInputTextFlags_ReadOnly\", &flags, ImGuiInputTextFlags_ReadOnly);\n            ImGui::CheckboxFlags(\"ImGuiInputTextFlags_AllowTabInput\", &flags, ImGuiInputTextFlags_AllowTabInput);\n            ImGui::CheckboxFlags(\"ImGuiInputTextFlags_CtrlEnterForNewLine\", &flags, ImGuiInputTextFlags_CtrlEnterForNewLine);\n            ImGui::InputTextMultiline(\"##source\", text, IM_ARRAYSIZE(text), ImVec2(-FLT_MIN, ImGui::GetTextLineHeight() * 16), flags);\n            ImGui::TreePop();\n        }\n\n        if (ImGui::TreeNode(\"Filtered Text Input\"))\n        {\n            struct TextFilters\n            {\n                // Return 0 (pass) if the character is 'i' or 'm' or 'g' or 'u' or 'i'\n                static int FilterImGuiLetters(ImGuiInputTextCallbackData* data)\n                {\n                    if (data->EventChar < 256 && strchr(\"imgui\", (char)data->EventChar))\n                        return 0;\n                    return 1;\n                }\n            };\n\n            static char buf1[64] = \"\"; ImGui::InputText(\"default\",     buf1, 64);\n            static char buf2[64] = \"\"; ImGui::InputText(\"decimal\",     buf2, 64, ImGuiInputTextFlags_CharsDecimal);\n            static char buf3[64] = \"\"; ImGui::InputText(\"hexadecimal\", buf3, 64, ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsUppercase);\n            static char buf4[64] = \"\"; ImGui::InputText(\"uppercase\",   buf4, 64, ImGuiInputTextFlags_CharsUppercase);\n            static char buf5[64] = \"\"; ImGui::InputText(\"no blank\",    buf5, 64, ImGuiInputTextFlags_CharsNoBlank);\n            static char buf6[64] = \"\"; ImGui::InputText(\"\\\"imgui\\\" letters\", buf6, 64, ImGuiInputTextFlags_CallbackCharFilter, TextFilters::FilterImGuiLetters);\n            ImGui::TreePop();\n        }\n\n        if (ImGui::TreeNode(\"Password Input\"))\n        {\n            static char password[64] = \"password123\";\n            ImGui::InputText(\"password\", password, IM_ARRAYSIZE(password), ImGuiInputTextFlags_Password);\n            ImGui::SameLine(); HelpMarker(\"Display all characters as '*'.\\nDisable clipboard cut and copy.\\nDisable logging.\\n\");\n            ImGui::InputTextWithHint(\"password (w/ hint)\", \"<password>\", password, IM_ARRAYSIZE(password), ImGuiInputTextFlags_Password);\n            ImGui::InputText(\"password (clear)\", password, IM_ARRAYSIZE(password));\n            ImGui::TreePop();\n        }\n\n        if (ImGui::TreeNode(\"Completion, History, Edit Callbacks\"))\n        {\n            struct Funcs\n            {\n                static int MyCallback(ImGuiInputTextCallbackData* data)\n                {\n                    if (data->EventFlag == ImGuiInputTextFlags_CallbackCompletion)\n                    {\n                        data->InsertChars(data->CursorPos, \"..\");\n                    }\n                    else if (data->EventFlag == ImGuiInputTextFlags_CallbackHistory)\n                    {\n                        if (data->EventKey == ImGuiKey_UpArrow)\n                        {\n                            data->DeleteChars(0, data->BufTextLen);\n                            data->InsertChars(0, \"Pressed Up!\");\n                            data->SelectAll();\n                        }\n                        else if (data->EventKey == ImGuiKey_DownArrow)\n                        {\n                            data->DeleteChars(0, data->BufTextLen);\n                            data->InsertChars(0, \"Pressed Down!\");\n                            data->SelectAll();\n                        }\n                    }\n                    else if (data->EventFlag == ImGuiInputTextFlags_CallbackEdit)\n                    {\n                        // Toggle casing of first character\n                        char c = data->Buf[0];\n                        if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) data->Buf[0] ^= 32;\n                        data->BufDirty = true;\n\n                        // Increment a counter\n                        int* p_int = (int*)data->UserData;\n                        *p_int = *p_int + 1;\n                    }\n                    return 0;\n                }\n            };\n            static char buf1[64];\n            ImGui::InputText(\"Completion\", buf1, 64, ImGuiInputTextFlags_CallbackCompletion, Funcs::MyCallback);\n            ImGui::SameLine(); HelpMarker(\"Here we append \\\"..\\\" each time Tab is pressed. See 'Examples>Console' for a more meaningful demonstration of using this callback.\");\n\n            static char buf2[64];\n            ImGui::InputText(\"History\", buf2, 64, ImGuiInputTextFlags_CallbackHistory, Funcs::MyCallback);\n            ImGui::SameLine(); HelpMarker(\"Here we replace and select text each time Up/Down are pressed. See 'Examples>Console' for a more meaningful demonstration of using this callback.\");\n\n            static char buf3[64];\n            static int edit_count = 0;\n            ImGui::InputText(\"Edit\", buf3, 64, ImGuiInputTextFlags_CallbackEdit, Funcs::MyCallback, (void*)&edit_count);\n            ImGui::SameLine(); HelpMarker(\"Here we toggle the casing of the first character on every edits + count edits.\");\n            ImGui::SameLine(); ImGui::Text(\"(%d)\", edit_count);\n\n            ImGui::TreePop();\n        }\n\n        if (ImGui::TreeNode(\"Resize Callback\"))\n        {\n            // To wire InputText() with std::string or any other custom string type,\n            // you can use the ImGuiInputTextFlags_CallbackResize flag + create a custom ImGui::InputText() wrapper\n            // using your preferred type. See misc/cpp/imgui_stdlib.h for an implementation of this using std::string.\n            HelpMarker(\n                \"Using ImGuiInputTextFlags_CallbackResize to wire your custom string type to InputText().\\n\\n\"\n                \"See misc/cpp/imgui_stdlib.h for an implementation of this for std::string.\");\n            struct Funcs\n            {\n                static int MyResizeCallback(ImGuiInputTextCallbackData* data)\n                {\n                    if (data->EventFlag == ImGuiInputTextFlags_CallbackResize)\n                    {\n                        ImVector<char>* my_str = (ImVector<char>*)data->UserData;\n                        IM_ASSERT(my_str->begin() == data->Buf);\n                        my_str->resize(data->BufSize); // NB: On resizing calls, generally data->BufSize == data->BufTextLen + 1\n                        data->Buf = my_str->begin();\n                    }\n                    return 0;\n                }\n\n                // Note: Because ImGui:: is a namespace you would typically add your own function into the namespace.\n                // For example, you code may declare a function 'ImGui::InputText(const char* label, MyString* my_str)'\n                static bool MyInputTextMultiline(const char* label, ImVector<char>* my_str, const ImVec2& size = ImVec2(0, 0), ImGuiInputTextFlags flags = 0)\n                {\n                    IM_ASSERT((flags & ImGuiInputTextFlags_CallbackResize) == 0);\n                    return ImGui::InputTextMultiline(label, my_str->begin(), (size_t)my_str->size(), size, flags | ImGuiInputTextFlags_CallbackResize, Funcs::MyResizeCallback, (void*)my_str);\n                }\n            };\n\n            // For this demo we are using ImVector as a string container.\n            // Note that because we need to store a terminating zero character, our size/capacity are 1 more\n            // than usually reported by a typical string class.\n            static ImVector<char> my_str;\n            if (my_str.empty())\n                my_str.push_back(0);\n            Funcs::MyInputTextMultiline(\"##MyStr\", &my_str, ImVec2(-FLT_MIN, ImGui::GetTextLineHeight() * 16));\n            ImGui::Text(\"Data: %p\\nSize: %d\\nCapacity: %d\", (void*)my_str.begin(), my_str.size(), my_str.capacity());\n            ImGui::TreePop();\n        }\n\n        ImGui::TreePop();\n    }\n\n    // Tabs\n    if (ImGui::TreeNode(\"Tabs\"))\n    {\n        if (ImGui::TreeNode(\"Basic\"))\n        {\n            ImGuiTabBarFlags tab_bar_flags = ImGuiTabBarFlags_None;\n            if (ImGui::BeginTabBar(\"MyTabBar\", tab_bar_flags))\n            {\n                if (ImGui::BeginTabItem(\"Avocado\"))\n                {\n                    ImGui::Text(\"This is the Avocado tab!\\nblah blah blah blah blah\");\n                    ImGui::EndTabItem();\n                }\n                if (ImGui::BeginTabItem(\"Broccoli\"))\n                {\n                    ImGui::Text(\"This is the Broccoli tab!\\nblah blah blah blah blah\");\n                    ImGui::EndTabItem();\n                }\n                if (ImGui::BeginTabItem(\"Cucumber\"))\n                {\n                    ImGui::Text(\"This is the Cucumber tab!\\nblah blah blah blah blah\");\n                    ImGui::EndTabItem();\n                }\n                ImGui::EndTabBar();\n            }\n            ImGui::Separator();\n            ImGui::TreePop();\n        }\n\n        if (ImGui::TreeNode(\"Advanced & Close Button\"))\n        {\n            // Expose a couple of the available flags. In most cases you may just call BeginTabBar() with no flags (0).\n            static ImGuiTabBarFlags tab_bar_flags = ImGuiTabBarFlags_Reorderable;\n            ImGui::CheckboxFlags(\"ImGuiTabBarFlags_Reorderable\", &tab_bar_flags, ImGuiTabBarFlags_Reorderable);\n            ImGui::CheckboxFlags(\"ImGuiTabBarFlags_AutoSelectNewTabs\", &tab_bar_flags, ImGuiTabBarFlags_AutoSelectNewTabs);\n            ImGui::CheckboxFlags(\"ImGuiTabBarFlags_TabListPopupButton\", &tab_bar_flags, ImGuiTabBarFlags_TabListPopupButton);\n            ImGui::CheckboxFlags(\"ImGuiTabBarFlags_NoCloseWithMiddleMouseButton\", &tab_bar_flags, ImGuiTabBarFlags_NoCloseWithMiddleMouseButton);\n            if ((tab_bar_flags & ImGuiTabBarFlags_FittingPolicyMask_) == 0)\n                tab_bar_flags |= ImGuiTabBarFlags_FittingPolicyDefault_;\n            if (ImGui::CheckboxFlags(\"ImGuiTabBarFlags_FittingPolicyResizeDown\", &tab_bar_flags, ImGuiTabBarFlags_FittingPolicyResizeDown))\n                tab_bar_flags &= ~(ImGuiTabBarFlags_FittingPolicyMask_ ^ ImGuiTabBarFlags_FittingPolicyResizeDown);\n            if (ImGui::CheckboxFlags(\"ImGuiTabBarFlags_FittingPolicyScroll\", &tab_bar_flags, ImGuiTabBarFlags_FittingPolicyScroll))\n                tab_bar_flags &= ~(ImGuiTabBarFlags_FittingPolicyMask_ ^ ImGuiTabBarFlags_FittingPolicyScroll);\n\n            // Tab Bar\n            const char* names[4] = { \"Artichoke\", \"Beetroot\", \"Celery\", \"Daikon\" };\n            static bool opened[4] = { true, true, true, true }; // Persistent user state\n            for (int n = 0; n < IM_ARRAYSIZE(opened); n++)\n            {\n                if (n > 0) { ImGui::SameLine(); }\n                ImGui::Checkbox(names[n], &opened[n]);\n            }\n\n            // Passing a bool* to BeginTabItem() is similar to passing one to Begin():\n            // the underlying bool will be set to false when the tab is closed.\n            if (ImGui::BeginTabBar(\"MyTabBar\", tab_bar_flags))\n            {\n                for (int n = 0; n < IM_ARRAYSIZE(opened); n++)\n                    if (opened[n] && ImGui::BeginTabItem(names[n], &opened[n], ImGuiTabItemFlags_None))\n                    {\n                        ImGui::Text(\"This is the %s tab!\", names[n]);\n                        if (n & 1)\n                            ImGui::Text(\"I am an odd tab.\");\n                        ImGui::EndTabItem();\n                    }\n                ImGui::EndTabBar();\n            }\n            ImGui::Separator();\n            ImGui::TreePop();\n        }\n\n        if (ImGui::TreeNode(\"TabItemButton & Leading/Trailing flags\"))\n        {\n            static ImVector<int> active_tabs;\n            static int next_tab_id = 0;\n            if (next_tab_id == 0) // Initialize with some default tabs\n                for (int i = 0; i < 3; i++)\n                    active_tabs.push_back(next_tab_id++);\n\n            // TabItemButton() and Leading/Trailing flags are distinct features which we will demo together.\n            // (It is possible to submit regular tabs with Leading/Trailing flags, or TabItemButton tabs without Leading/Trailing flags...\n            // but they tend to make more sense together)\n            static bool show_leading_button = true;\n            static bool show_trailing_button = true;\n            ImGui::Checkbox(\"Show Leading TabItemButton()\", &show_leading_button);\n            ImGui::Checkbox(\"Show Trailing TabItemButton()\", &show_trailing_button);\n\n            // Expose some other flags which are useful to showcase how they interact with Leading/Trailing tabs\n            static ImGuiTabBarFlags tab_bar_flags = ImGuiTabBarFlags_AutoSelectNewTabs | ImGuiTabBarFlags_Reorderable | ImGuiTabBarFlags_FittingPolicyResizeDown;\n            ImGui::CheckboxFlags(\"ImGuiTabBarFlags_TabListPopupButton\", &tab_bar_flags, ImGuiTabBarFlags_TabListPopupButton);\n            if (ImGui::CheckboxFlags(\"ImGuiTabBarFlags_FittingPolicyResizeDown\", &tab_bar_flags, ImGuiTabBarFlags_FittingPolicyResizeDown))\n                tab_bar_flags &= ~(ImGuiTabBarFlags_FittingPolicyMask_ ^ ImGuiTabBarFlags_FittingPolicyResizeDown);\n            if (ImGui::CheckboxFlags(\"ImGuiTabBarFlags_FittingPolicyScroll\", &tab_bar_flags, ImGuiTabBarFlags_FittingPolicyScroll))\n                tab_bar_flags &= ~(ImGuiTabBarFlags_FittingPolicyMask_ ^ ImGuiTabBarFlags_FittingPolicyScroll);\n\n            if (ImGui::BeginTabBar(\"MyTabBar\", tab_bar_flags))\n            {\n                // Demo a Leading TabItemButton(): click the \"?\" button to open a menu\n                if (show_leading_button)\n                    if (ImGui::TabItemButton(\"?\", ImGuiTabItemFlags_Leading | ImGuiTabItemFlags_NoTooltip))\n                        ImGui::OpenPopup(\"MyHelpMenu\");\n                if (ImGui::BeginPopup(\"MyHelpMenu\"))\n                {\n                    ImGui::Selectable(\"Hello!\");\n                    ImGui::EndPopup();\n                }\n\n                // Demo Trailing Tabs: click the \"+\" button to add a new tab (in your app you may want to use a font icon instead of the \"+\")\n                // Note that we submit it before the regular tabs, but because of the ImGuiTabItemFlags_Trailing flag it will always appear at the end.\n                if (show_trailing_button)\n                    if (ImGui::TabItemButton(\"+\", ImGuiTabItemFlags_Trailing | ImGuiTabItemFlags_NoTooltip))\n                        active_tabs.push_back(next_tab_id++); // Add new tab\n\n                // Submit our regular tabs\n                for (int n = 0; n < active_tabs.Size; )\n                {\n                    bool open = true;\n                    char name[16];\n                    snprintf(name, IM_ARRAYSIZE(name), \"%04d\", active_tabs[n]);\n                    if (ImGui::BeginTabItem(name, &open, ImGuiTabItemFlags_None))\n                    {\n                        ImGui::Text(\"This is the %s tab!\", name);\n                        ImGui::EndTabItem();\n                    }\n\n                    if (!open)\n                        active_tabs.erase(active_tabs.Data + n);\n                    else\n                        n++;\n                }\n\n                ImGui::EndTabBar();\n            }\n            ImGui::Separator();\n            ImGui::TreePop();\n        }\n        ImGui::TreePop();\n    }\n\n    // Plot/Graph widgets are not very good.\n    // Consider writing your own, or using a third-party one, see:\n    // - ImPlot https://github.com/epezent/implot\n    // - others https://github.com/ocornut/imgui/wiki/Useful-Extensions\n    if (ImGui::TreeNode(\"Plots Widgets\"))\n    {\n        static bool animate = true;\n        ImGui::Checkbox(\"Animate\", &animate);\n\n        static float arr[] = { 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f };\n        ImGui::PlotLines(\"Frame Times\", arr, IM_ARRAYSIZE(arr));\n\n        // Fill an array of contiguous float values to plot\n        // Tip: If your float aren't contiguous but part of a structure, you can pass a pointer to your first float\n        // and the sizeof() of your structure in the \"stride\" parameter.\n        static float values[90] = {};\n        static int values_offset = 0;\n        static double refresh_time = 0.0;\n        if (!animate || refresh_time == 0.0)\n            refresh_time = ImGui::GetTime();\n        while (refresh_time < ImGui::GetTime()) // Create data at fixed 60 Hz rate for the demo\n        {\n            static float phase = 0.0f;\n            values[values_offset] = cosf(phase);\n            values_offset = (values_offset + 1) % IM_ARRAYSIZE(values);\n            phase += 0.10f * values_offset;\n            refresh_time += 1.0f / 60.0f;\n        }\n\n        // Plots can display overlay texts\n        // (in this example, we will display an average value)\n        {\n            float average = 0.0f;\n            for (int n = 0; n < IM_ARRAYSIZE(values); n++)\n                average += values[n];\n            average /= (float)IM_ARRAYSIZE(values);\n            char overlay[32];\n            sprintf(overlay, \"avg %f\", average);\n            ImGui::PlotLines(\"Lines\", values, IM_ARRAYSIZE(values), values_offset, overlay, -1.0f, 1.0f, ImVec2(0, 80.0f));\n        }\n        ImGui::PlotHistogram(\"Histogram\", arr, IM_ARRAYSIZE(arr), 0, NULL, 0.0f, 1.0f, ImVec2(0, 80.0f));\n\n        // Use functions to generate output\n        // FIXME: This is rather awkward because current plot API only pass in indices.\n        // We probably want an API passing floats and user provide sample rate/count.\n        struct Funcs\n        {\n            static float Sin(void*, int i) { return sinf(i * 0.1f); }\n            static float Saw(void*, int i) { return (i & 1) ? 1.0f : -1.0f; }\n        };\n        static int func_type = 0, display_count = 70;\n        ImGui::Separator();\n        ImGui::SetNextItemWidth(ImGui::GetFontSize() * 8);\n        ImGui::Combo(\"func\", &func_type, \"Sin\\0Saw\\0\");\n        ImGui::SameLine();\n        ImGui::SliderInt(\"Sample count\", &display_count, 1, 400);\n        float (*func)(void*, int) = (func_type == 0) ? Funcs::Sin : Funcs::Saw;\n        ImGui::PlotLines(\"Lines\", func, NULL, display_count, 0, NULL, -1.0f, 1.0f, ImVec2(0, 80));\n        ImGui::PlotHistogram(\"Histogram\", func, NULL, display_count, 0, NULL, -1.0f, 1.0f, ImVec2(0, 80));\n        ImGui::Separator();\n\n        // Animate a simple progress bar\n        static float progress = 0.0f, progress_dir = 1.0f;\n        if (animate)\n        {\n            progress += progress_dir * 0.4f * ImGui::GetIO().DeltaTime;\n            if (progress >= +1.1f) { progress = +1.1f; progress_dir *= -1.0f; }\n            if (progress <= -0.1f) { progress = -0.1f; progress_dir *= -1.0f; }\n        }\n\n        // Typically we would use ImVec2(-1.0f,0.0f) or ImVec2(-FLT_MIN,0.0f) to use all available width,\n        // or ImVec2(width,0.0f) for a specified width. ImVec2(0.0f,0.0f) uses ItemWidth.\n        ImGui::ProgressBar(progress, ImVec2(0.0f, 0.0f));\n        ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);\n        ImGui::Text(\"Progress Bar\");\n\n        float progress_saturated = IM_CLAMP(progress, 0.0f, 1.0f);\n        char buf[32];\n        sprintf(buf, \"%d/%d\", (int)(progress_saturated * 1753), 1753);\n        ImGui::ProgressBar(progress, ImVec2(0.f, 0.f), buf);\n        ImGui::TreePop();\n    }\n\n    if (ImGui::TreeNode(\"Color/Picker Widgets\"))\n    {\n        static ImVec4 color = ImVec4(114.0f / 255.0f, 144.0f / 255.0f, 154.0f / 255.0f, 200.0f / 255.0f);\n\n        static bool alpha_preview = true;\n        static bool alpha_half_preview = false;\n        static bool drag_and_drop = true;\n        static bool options_menu = true;\n        static bool hdr = false;\n        ImGui::Checkbox(\"With Alpha Preview\", &alpha_preview);\n        ImGui::Checkbox(\"With Half Alpha Preview\", &alpha_half_preview);\n        ImGui::Checkbox(\"With Drag and Drop\", &drag_and_drop);\n        ImGui::Checkbox(\"With Options Menu\", &options_menu); ImGui::SameLine(); HelpMarker(\"Right-click on the individual color widget to show options.\");\n        ImGui::Checkbox(\"With HDR\", &hdr); ImGui::SameLine(); HelpMarker(\"Currently all this does is to lift the 0..1 limits on dragging widgets.\");\n        ImGuiColorEditFlags misc_flags = (hdr ? ImGuiColorEditFlags_HDR : 0) | (drag_and_drop ? 0 : ImGuiColorEditFlags_NoDragDrop) | (alpha_half_preview ? ImGuiColorEditFlags_AlphaPreviewHalf : (alpha_preview ? ImGuiColorEditFlags_AlphaPreview : 0)) | (options_menu ? 0 : ImGuiColorEditFlags_NoOptions);\n\n        ImGui::Text(\"Color widget:\");\n        ImGui::SameLine(); HelpMarker(\n            \"Click on the color square to open a color picker.\\n\"\n            \"CTRL+click on individual component to input value.\\n\");\n        ImGui::ColorEdit3(\"MyColor##1\", (float*)&color, misc_flags);\n\n        ImGui::Text(\"Color widget HSV with Alpha:\");\n        ImGui::ColorEdit4(\"MyColor##2\", (float*)&color, ImGuiColorEditFlags_DisplayHSV | misc_flags);\n\n        ImGui::Text(\"Color widget with Float Display:\");\n        ImGui::ColorEdit4(\"MyColor##2f\", (float*)&color, ImGuiColorEditFlags_Float | misc_flags);\n\n        ImGui::Text(\"Color button with Picker:\");\n        ImGui::SameLine(); HelpMarker(\n            \"With the ImGuiColorEditFlags_NoInputs flag you can hide all the slider/text inputs.\\n\"\n            \"With the ImGuiColorEditFlags_NoLabel flag you can pass a non-empty label which will only \"\n            \"be used for the tooltip and picker popup.\");\n        ImGui::ColorEdit4(\"MyColor##3\", (float*)&color, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel | misc_flags);\n\n        ImGui::Text(\"Color button with Custom Picker Popup:\");\n\n        // Generate a default palette. The palette will persist and can be edited.\n        static bool saved_palette_init = true;\n        static ImVec4 saved_palette[32] = {};\n        if (saved_palette_init)\n        {\n            for (int n = 0; n < IM_ARRAYSIZE(saved_palette); n++)\n            {\n                ImGui::ColorConvertHSVtoRGB(n / 31.0f, 0.8f, 0.8f,\n                    saved_palette[n].x, saved_palette[n].y, saved_palette[n].z);\n                saved_palette[n].w = 1.0f; // Alpha\n            }\n            saved_palette_init = false;\n        }\n\n        static ImVec4 backup_color;\n        bool open_popup = ImGui::ColorButton(\"MyColor##3b\", color, misc_flags);\n        ImGui::SameLine(0, ImGui::GetStyle().ItemInnerSpacing.x);\n        open_popup |= ImGui::Button(\"Palette\");\n        if (open_popup)\n        {\n            ImGui::OpenPopup(\"mypicker\");\n            backup_color = color;\n        }\n        if (ImGui::BeginPopup(\"mypicker\"))\n        {\n            ImGui::Text(\"MY CUSTOM COLOR PICKER WITH AN AMAZING PALETTE!\");\n            ImGui::Separator();\n            ImGui::ColorPicker4(\"##picker\", (float*)&color, misc_flags | ImGuiColorEditFlags_NoSidePreview | ImGuiColorEditFlags_NoSmallPreview);\n            ImGui::SameLine();\n\n            ImGui::BeginGroup(); // Lock X position\n            ImGui::Text(\"Current\");\n            ImGui::ColorButton(\"##current\", color, ImGuiColorEditFlags_NoPicker | ImGuiColorEditFlags_AlphaPreviewHalf, ImVec2(60, 40));\n            ImGui::Text(\"Previous\");\n            if (ImGui::ColorButton(\"##previous\", backup_color, ImGuiColorEditFlags_NoPicker | ImGuiColorEditFlags_AlphaPreviewHalf, ImVec2(60, 40)))\n                color = backup_color;\n            ImGui::Separator();\n            ImGui::Text(\"Palette\");\n            for (int n = 0; n < IM_ARRAYSIZE(saved_palette); n++)\n            {\n                ImGui::PushID(n);\n                if ((n % 8) != 0)\n                    ImGui::SameLine(0.0f, ImGui::GetStyle().ItemSpacing.y);\n\n                ImGuiColorEditFlags palette_button_flags = ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_NoPicker | ImGuiColorEditFlags_NoTooltip;\n                if (ImGui::ColorButton(\"##palette\", saved_palette[n], palette_button_flags, ImVec2(20, 20)))\n                    color = ImVec4(saved_palette[n].x, saved_palette[n].y, saved_palette[n].z, color.w); // Preserve alpha!\n\n                // Allow user to drop colors into each palette entry. Note that ColorButton() is already a\n                // drag source by default, unless specifying the ImGuiColorEditFlags_NoDragDrop flag.\n                if (ImGui::BeginDragDropTarget())\n                {\n                    if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_3F))\n                        memcpy((float*)&saved_palette[n], payload->Data, sizeof(float) * 3);\n                    if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_4F))\n                        memcpy((float*)&saved_palette[n], payload->Data, sizeof(float) * 4);\n                    ImGui::EndDragDropTarget();\n                }\n\n                ImGui::PopID();\n            }\n            ImGui::EndGroup();\n            ImGui::EndPopup();\n        }\n\n        ImGui::Text(\"Color button only:\");\n        static bool no_border = false;\n        ImGui::Checkbox(\"ImGuiColorEditFlags_NoBorder\", &no_border);\n        ImGui::ColorButton(\"MyColor##3c\", *(ImVec4*)&color, misc_flags | (no_border ? ImGuiColorEditFlags_NoBorder : 0), ImVec2(80, 80));\n\n        ImGui::Text(\"Color picker:\");\n        static bool alpha = true;\n        static bool alpha_bar = true;\n        static bool side_preview = true;\n        static bool ref_color = false;\n        static ImVec4 ref_color_v(1.0f, 0.0f, 1.0f, 0.5f);\n        static int display_mode = 0;\n        static int picker_mode = 0;\n        ImGui::Checkbox(\"With Alpha\", &alpha);\n        ImGui::Checkbox(\"With Alpha Bar\", &alpha_bar);\n        ImGui::Checkbox(\"With Side Preview\", &side_preview);\n        if (side_preview)\n        {\n            ImGui::SameLine();\n            ImGui::Checkbox(\"With Ref Color\", &ref_color);\n            if (ref_color)\n            {\n                ImGui::SameLine();\n                ImGui::ColorEdit4(\"##RefColor\", &ref_color_v.x, ImGuiColorEditFlags_NoInputs | misc_flags);\n            }\n        }\n        ImGui::Combo(\"Display Mode\", &display_mode, \"Auto/Current\\0None\\0RGB Only\\0HSV Only\\0Hex Only\\0\");\n        ImGui::SameLine(); HelpMarker(\n            \"ColorEdit defaults to displaying RGB inputs if you don't specify a display mode, \"\n            \"but the user can change it with a right-click.\\n\\nColorPicker defaults to displaying RGB+HSV+Hex \"\n            \"if you don't specify a display mode.\\n\\nYou can change the defaults using SetColorEditOptions().\");\n        ImGui::Combo(\"Picker Mode\", &picker_mode, \"Auto/Current\\0Hue bar + SV rect\\0Hue wheel + SV triangle\\0\");\n        ImGui::SameLine(); HelpMarker(\"User can right-click the picker to change mode.\");\n        ImGuiColorEditFlags flags = misc_flags;\n        if (!alpha)            flags |= ImGuiColorEditFlags_NoAlpha;        // This is by default if you call ColorPicker3() instead of ColorPicker4()\n        if (alpha_bar)         flags |= ImGuiColorEditFlags_AlphaBar;\n        if (!side_preview)     flags |= ImGuiColorEditFlags_NoSidePreview;\n        if (picker_mode == 1)  flags |= ImGuiColorEditFlags_PickerHueBar;\n        if (picker_mode == 2)  flags |= ImGuiColorEditFlags_PickerHueWheel;\n        if (display_mode == 1) flags |= ImGuiColorEditFlags_NoInputs;       // Disable all RGB/HSV/Hex displays\n        if (display_mode == 2) flags |= ImGuiColorEditFlags_DisplayRGB;     // Override display mode\n        if (display_mode == 3) flags |= ImGuiColorEditFlags_DisplayHSV;\n        if (display_mode == 4) flags |= ImGuiColorEditFlags_DisplayHex;\n        ImGui::ColorPicker4(\"MyColor##4\", (float*)&color, flags, ref_color ? &ref_color_v.x : NULL);\n\n        ImGui::Text(\"Set defaults in code:\");\n        ImGui::SameLine(); HelpMarker(\n            \"SetColorEditOptions() is designed to allow you to set boot-time default.\\n\"\n            \"We don't have Push/Pop functions because you can force options on a per-widget basis if needed,\"\n            \"and the user can change non-forced ones with the options menu.\\nWe don't have a getter to avoid\"\n            \"encouraging you to persistently save values that aren't forward-compatible.\");\n        if (ImGui::Button(\"Default: Uint8 + HSV + Hue Bar\"))\n            ImGui::SetColorEditOptions(ImGuiColorEditFlags_Uint8 | ImGuiColorEditFlags_DisplayHSV | ImGuiColorEditFlags_PickerHueBar);\n        if (ImGui::Button(\"Default: Float + HDR + Hue Wheel\"))\n            ImGui::SetColorEditOptions(ImGuiColorEditFlags_Float | ImGuiColorEditFlags_HDR | ImGuiColorEditFlags_PickerHueWheel);\n\n        // HSV encoded support (to avoid RGB<>HSV round trips and singularities when S==0 or V==0)\n        static ImVec4 color_hsv(0.23f, 1.0f, 1.0f, 1.0f); // Stored as HSV!\n        ImGui::Spacing();\n        ImGui::Text(\"HSV encoded colors\");\n        ImGui::SameLine(); HelpMarker(\n            \"By default, colors are given to ColorEdit and ColorPicker in RGB, but ImGuiColorEditFlags_InputHSV\"\n            \"allows you to store colors as HSV and pass them to ColorEdit and ColorPicker as HSV. This comes with the\"\n            \"added benefit that you can manipulate hue values with the picker even when saturation or value are zero.\");\n        ImGui::Text(\"Color widget with InputHSV:\");\n        ImGui::ColorEdit4(\"HSV shown as RGB##1\", (float*)&color_hsv, ImGuiColorEditFlags_DisplayRGB | ImGuiColorEditFlags_InputHSV | ImGuiColorEditFlags_Float);\n        ImGui::ColorEdit4(\"HSV shown as HSV##1\", (float*)&color_hsv, ImGuiColorEditFlags_DisplayHSV | ImGuiColorEditFlags_InputHSV | ImGuiColorEditFlags_Float);\n        ImGui::DragFloat4(\"Raw HSV values\", (float*)&color_hsv, 0.01f, 0.0f, 1.0f);\n\n        ImGui::TreePop();\n    }\n\n    if (ImGui::TreeNode(\"Drag/Slider Flags\"))\n    {\n        // Demonstrate using advanced flags for DragXXX and SliderXXX functions. Note that the flags are the same!\n        static ImGuiSliderFlags flags = ImGuiSliderFlags_None;\n        ImGui::CheckboxFlags(\"ImGuiSliderFlags_AlwaysClamp\", &flags, ImGuiSliderFlags_AlwaysClamp);\n        ImGui::SameLine(); HelpMarker(\"Always clamp value to min/max bounds (if any) when input manually with CTRL+Click.\");\n        ImGui::CheckboxFlags(\"ImGuiSliderFlags_Logarithmic\", &flags, ImGuiSliderFlags_Logarithmic);\n        ImGui::SameLine(); HelpMarker(\"Enable logarithmic editing (more precision for small values).\");\n        ImGui::CheckboxFlags(\"ImGuiSliderFlags_NoRoundToFormat\", &flags, ImGuiSliderFlags_NoRoundToFormat);\n        ImGui::SameLine(); HelpMarker(\"Disable rounding underlying value to match precision of the format string (e.g. %.3f values are rounded to those 3 digits).\");\n        ImGui::CheckboxFlags(\"ImGuiSliderFlags_NoInput\", &flags, ImGuiSliderFlags_NoInput);\n        ImGui::SameLine(); HelpMarker(\"Disable CTRL+Click or Enter key allowing to input text directly into the widget.\");\n\n        // Drags\n        static float drag_f = 0.5f;\n        static int drag_i = 50;\n        ImGui::Text(\"Underlying float value: %f\", drag_f);\n        ImGui::DragFloat(\"DragFloat (0 -> 1)\", &drag_f, 0.005f, 0.0f, 1.0f, \"%.3f\", flags);\n        ImGui::DragFloat(\"DragFloat (0 -> +inf)\", &drag_f, 0.005f, 0.0f, FLT_MAX, \"%.3f\", flags);\n        ImGui::DragFloat(\"DragFloat (-inf -> 1)\", &drag_f, 0.005f, -FLT_MAX, 1.0f, \"%.3f\", flags);\n        ImGui::DragFloat(\"DragFloat (-inf -> +inf)\", &drag_f, 0.005f, -FLT_MAX, +FLT_MAX, \"%.3f\", flags);\n        ImGui::DragInt(\"DragInt (0 -> 100)\", &drag_i, 0.5f, 0, 100, \"%d\", flags);\n\n        // Sliders\n        static float slider_f = 0.5f;\n        static int slider_i = 50;\n        ImGui::Text(\"Underlying float value: %f\", slider_f);\n        ImGui::SliderFloat(\"SliderFloat (0 -> 1)\", &slider_f, 0.0f, 1.0f, \"%.3f\", flags);\n        ImGui::SliderInt(\"SliderInt (0 -> 100)\", &slider_i, 0, 100, \"%d\", flags);\n\n        ImGui::TreePop();\n    }\n\n    if (ImGui::TreeNode(\"Range Widgets\"))\n    {\n        static float begin = 10, end = 90;\n        static int begin_i = 100, end_i = 1000;\n        ImGui::DragFloatRange2(\"range float\", &begin, &end, 0.25f, 0.0f, 100.0f, \"Min: %.1f %%\", \"Max: %.1f %%\", ImGuiSliderFlags_AlwaysClamp);\n        ImGui::DragIntRange2(\"range int\", &begin_i, &end_i, 5, 0, 1000, \"Min: %d units\", \"Max: %d units\");\n        ImGui::DragIntRange2(\"range int (no bounds)\", &begin_i, &end_i, 5, 0, 0, \"Min: %d units\", \"Max: %d units\");\n        ImGui::TreePop();\n    }\n\n    if (ImGui::TreeNode(\"Data Types\"))\n    {\n        // DragScalar/InputScalar/SliderScalar functions allow various data types\n        // - signed/unsigned\n        // - 8/16/32/64-bits\n        // - integer/float/double\n        // To avoid polluting the public API with all possible combinations, we use the ImGuiDataType enum\n        // to pass the type, and passing all arguments by pointer.\n        // This is the reason the test code below creates local variables to hold \"zero\" \"one\" etc. for each types.\n        // In practice, if you frequently use a given type that is not covered by the normal API entry points,\n        // you can wrap it yourself inside a 1 line function which can take typed argument as value instead of void*,\n        // and then pass their address to the generic function. For example:\n        //   bool MySliderU64(const char *label, u64* value, u64 min = 0, u64 max = 0, const char* format = \"%lld\")\n        //   {\n        //      return SliderScalar(label, ImGuiDataType_U64, value, &min, &max, format);\n        //   }\n\n        // Setup limits (as helper variables so we can take their address, as explained above)\n        // Note: SliderScalar() functions have a maximum usable range of half the natural type maximum, hence the /2.\n        #ifndef LLONG_MIN\n        ImS64 LLONG_MIN = -9223372036854775807LL - 1;\n        ImS64 LLONG_MAX = 9223372036854775807LL;\n        ImU64 ULLONG_MAX = (2ULL * 9223372036854775807LL + 1);\n        #endif\n        const char    s8_zero  = 0,   s8_one  = 1,   s8_fifty  = 50, s8_min  = -128,        s8_max = 127;\n        const ImU8    u8_zero  = 0,   u8_one  = 1,   u8_fifty  = 50, u8_min  = 0,           u8_max = 255;\n        const short   s16_zero = 0,   s16_one = 1,   s16_fifty = 50, s16_min = -32768,      s16_max = 32767;\n        const ImU16   u16_zero = 0,   u16_one = 1,   u16_fifty = 50, u16_min = 0,           u16_max = 65535;\n        const ImS32   s32_zero = 0,   s32_one = 1,   s32_fifty = 50, s32_min = INT_MIN/2,   s32_max = INT_MAX/2,    s32_hi_a = INT_MAX/2 - 100,    s32_hi_b = INT_MAX/2;\n        const ImU32   u32_zero = 0,   u32_one = 1,   u32_fifty = 50, u32_min = 0,           u32_max = UINT_MAX/2,   u32_hi_a = UINT_MAX/2 - 100,   u32_hi_b = UINT_MAX/2;\n        const ImS64   s64_zero = 0,   s64_one = 1,   s64_fifty = 50, s64_min = LLONG_MIN/2, s64_max = LLONG_MAX/2,  s64_hi_a = LLONG_MAX/2 - 100,  s64_hi_b = LLONG_MAX/2;\n        const ImU64   u64_zero = 0,   u64_one = 1,   u64_fifty = 50, u64_min = 0,           u64_max = ULLONG_MAX/2, u64_hi_a = ULLONG_MAX/2 - 100, u64_hi_b = ULLONG_MAX/2;\n        const float   f32_zero = 0.f, f32_one = 1.f, f32_lo_a = -10000000000.0f, f32_hi_a = +10000000000.0f;\n        const double  f64_zero = 0.,  f64_one = 1.,  f64_lo_a = -1000000000000000.0, f64_hi_a = +1000000000000000.0;\n\n        // State\n        static char   s8_v  = 127;\n        static ImU8   u8_v  = 255;\n        static short  s16_v = 32767;\n        static ImU16  u16_v = 65535;\n        static ImS32  s32_v = -1;\n        static ImU32  u32_v = (ImU32)-1;\n        static ImS64  s64_v = -1;\n        static ImU64  u64_v = (ImU64)-1;\n        static float  f32_v = 0.123f;\n        static double f64_v = 90000.01234567890123456789;\n\n        const float drag_speed = 0.2f;\n        static bool drag_clamp = false;\n        ImGui::Text(\"Drags:\");\n        ImGui::Checkbox(\"Clamp integers to 0..50\", &drag_clamp);\n        ImGui::SameLine(); HelpMarker(\n            \"As with every widgets in dear imgui, we never modify values unless there is a user interaction.\\n\"\n            \"You can override the clamping limits by using CTRL+Click to input a value.\");\n        ImGui::DragScalar(\"drag s8\",        ImGuiDataType_S8,     &s8_v,  drag_speed, drag_clamp ? &s8_zero  : NULL, drag_clamp ? &s8_fifty  : NULL);\n        ImGui::DragScalar(\"drag u8\",        ImGuiDataType_U8,     &u8_v,  drag_speed, drag_clamp ? &u8_zero  : NULL, drag_clamp ? &u8_fifty  : NULL, \"%u ms\");\n        ImGui::DragScalar(\"drag s16\",       ImGuiDataType_S16,    &s16_v, drag_speed, drag_clamp ? &s16_zero : NULL, drag_clamp ? &s16_fifty : NULL);\n        ImGui::DragScalar(\"drag u16\",       ImGuiDataType_U16,    &u16_v, drag_speed, drag_clamp ? &u16_zero : NULL, drag_clamp ? &u16_fifty : NULL, \"%u ms\");\n        ImGui::DragScalar(\"drag s32\",       ImGuiDataType_S32,    &s32_v, drag_speed, drag_clamp ? &s32_zero : NULL, drag_clamp ? &s32_fifty : NULL);\n        ImGui::DragScalar(\"drag u32\",       ImGuiDataType_U32,    &u32_v, drag_speed, drag_clamp ? &u32_zero : NULL, drag_clamp ? &u32_fifty : NULL, \"%u ms\");\n        ImGui::DragScalar(\"drag s64\",       ImGuiDataType_S64,    &s64_v, drag_speed, drag_clamp ? &s64_zero : NULL, drag_clamp ? &s64_fifty : NULL);\n        ImGui::DragScalar(\"drag u64\",       ImGuiDataType_U64,    &u64_v, drag_speed, drag_clamp ? &u64_zero : NULL, drag_clamp ? &u64_fifty : NULL);\n        ImGui::DragScalar(\"drag float\",     ImGuiDataType_Float,  &f32_v, 0.005f,  &f32_zero, &f32_one, \"%f\");\n        ImGui::DragScalar(\"drag float log\", ImGuiDataType_Float,  &f32_v, 0.005f,  &f32_zero, &f32_one, \"%f\", ImGuiSliderFlags_Logarithmic);\n        ImGui::DragScalar(\"drag double\",    ImGuiDataType_Double, &f64_v, 0.0005f, &f64_zero, NULL,     \"%.10f grams\");\n        ImGui::DragScalar(\"drag double log\",ImGuiDataType_Double, &f64_v, 0.0005f, &f64_zero, &f64_one, \"0 < %.10f < 1\", ImGuiSliderFlags_Logarithmic);\n\n        ImGui::Text(\"Sliders\");\n        ImGui::SliderScalar(\"slider s8 full\",       ImGuiDataType_S8,     &s8_v,  &s8_min,   &s8_max,   \"%d\");\n        ImGui::SliderScalar(\"slider u8 full\",       ImGuiDataType_U8,     &u8_v,  &u8_min,   &u8_max,   \"%u\");\n        ImGui::SliderScalar(\"slider s16 full\",      ImGuiDataType_S16,    &s16_v, &s16_min,  &s16_max,  \"%d\");\n        ImGui::SliderScalar(\"slider u16 full\",      ImGuiDataType_U16,    &u16_v, &u16_min,  &u16_max,  \"%u\");\n        ImGui::SliderScalar(\"slider s32 low\",       ImGuiDataType_S32,    &s32_v, &s32_zero, &s32_fifty,\"%d\");\n        ImGui::SliderScalar(\"slider s32 high\",      ImGuiDataType_S32,    &s32_v, &s32_hi_a, &s32_hi_b, \"%d\");\n        ImGui::SliderScalar(\"slider s32 full\",      ImGuiDataType_S32,    &s32_v, &s32_min,  &s32_max,  \"%d\");\n        ImGui::SliderScalar(\"slider u32 low\",       ImGuiDataType_U32,    &u32_v, &u32_zero, &u32_fifty,\"%u\");\n        ImGui::SliderScalar(\"slider u32 high\",      ImGuiDataType_U32,    &u32_v, &u32_hi_a, &u32_hi_b, \"%u\");\n        ImGui::SliderScalar(\"slider u32 full\",      ImGuiDataType_U32,    &u32_v, &u32_min,  &u32_max,  \"%u\");\n        ImGui::SliderScalar(\"slider s64 low\",       ImGuiDataType_S64,    &s64_v, &s64_zero, &s64_fifty,\"%\" IM_PRId64);\n        ImGui::SliderScalar(\"slider s64 high\",      ImGuiDataType_S64,    &s64_v, &s64_hi_a, &s64_hi_b, \"%\" IM_PRId64);\n        ImGui::SliderScalar(\"slider s64 full\",      ImGuiDataType_S64,    &s64_v, &s64_min,  &s64_max,  \"%\" IM_PRId64);\n        ImGui::SliderScalar(\"slider u64 low\",       ImGuiDataType_U64,    &u64_v, &u64_zero, &u64_fifty,\"%\" IM_PRIu64 \" ms\");\n        ImGui::SliderScalar(\"slider u64 high\",      ImGuiDataType_U64,    &u64_v, &u64_hi_a, &u64_hi_b, \"%\" IM_PRIu64 \" ms\");\n        ImGui::SliderScalar(\"slider u64 full\",      ImGuiDataType_U64,    &u64_v, &u64_min,  &u64_max,  \"%\" IM_PRIu64 \" ms\");\n        ImGui::SliderScalar(\"slider float low\",     ImGuiDataType_Float,  &f32_v, &f32_zero, &f32_one);\n        ImGui::SliderScalar(\"slider float low log\", ImGuiDataType_Float,  &f32_v, &f32_zero, &f32_one,  \"%.10f\", ImGuiSliderFlags_Logarithmic);\n        ImGui::SliderScalar(\"slider float high\",    ImGuiDataType_Float,  &f32_v, &f32_lo_a, &f32_hi_a, \"%e\");\n        ImGui::SliderScalar(\"slider double low\",    ImGuiDataType_Double, &f64_v, &f64_zero, &f64_one,  \"%.10f grams\");\n        ImGui::SliderScalar(\"slider double low log\",ImGuiDataType_Double, &f64_v, &f64_zero, &f64_one,  \"%.10f\", ImGuiSliderFlags_Logarithmic);\n        ImGui::SliderScalar(\"slider double high\",   ImGuiDataType_Double, &f64_v, &f64_lo_a, &f64_hi_a, \"%e grams\");\n\n        ImGui::Text(\"Sliders (reverse)\");\n        ImGui::SliderScalar(\"slider s8 reverse\",    ImGuiDataType_S8,   &s8_v,  &s8_max,    &s8_min,   \"%d\");\n        ImGui::SliderScalar(\"slider u8 reverse\",    ImGuiDataType_U8,   &u8_v,  &u8_max,    &u8_min,   \"%u\");\n        ImGui::SliderScalar(\"slider s32 reverse\",   ImGuiDataType_S32,  &s32_v, &s32_fifty, &s32_zero, \"%d\");\n        ImGui::SliderScalar(\"slider u32 reverse\",   ImGuiDataType_U32,  &u32_v, &u32_fifty, &u32_zero, \"%u\");\n        ImGui::SliderScalar(\"slider s64 reverse\",   ImGuiDataType_S64,  &s64_v, &s64_fifty, &s64_zero, \"%\" IM_PRId64);\n        ImGui::SliderScalar(\"slider u64 reverse\",   ImGuiDataType_U64,  &u64_v, &u64_fifty, &u64_zero, \"%\" IM_PRIu64 \" ms\");\n\n        static bool inputs_step = true;\n        ImGui::Text(\"Inputs\");\n        ImGui::Checkbox(\"Show step buttons\", &inputs_step);\n        ImGui::InputScalar(\"input s8\",      ImGuiDataType_S8,     &s8_v,  inputs_step ? &s8_one  : NULL, NULL, \"%d\");\n        ImGui::InputScalar(\"input u8\",      ImGuiDataType_U8,     &u8_v,  inputs_step ? &u8_one  : NULL, NULL, \"%u\");\n        ImGui::InputScalar(\"input s16\",     ImGuiDataType_S16,    &s16_v, inputs_step ? &s16_one : NULL, NULL, \"%d\");\n        ImGui::InputScalar(\"input u16\",     ImGuiDataType_U16,    &u16_v, inputs_step ? &u16_one : NULL, NULL, \"%u\");\n        ImGui::InputScalar(\"input s32\",     ImGuiDataType_S32,    &s32_v, inputs_step ? &s32_one : NULL, NULL, \"%d\");\n        ImGui::InputScalar(\"input s32 hex\", ImGuiDataType_S32,    &s32_v, inputs_step ? &s32_one : NULL, NULL, \"%08X\", ImGuiInputTextFlags_CharsHexadecimal);\n        ImGui::InputScalar(\"input u32\",     ImGuiDataType_U32,    &u32_v, inputs_step ? &u32_one : NULL, NULL, \"%u\");\n        ImGui::InputScalar(\"input u32 hex\", ImGuiDataType_U32,    &u32_v, inputs_step ? &u32_one : NULL, NULL, \"%08X\", ImGuiInputTextFlags_CharsHexadecimal);\n        ImGui::InputScalar(\"input s64\",     ImGuiDataType_S64,    &s64_v, inputs_step ? &s64_one : NULL);\n        ImGui::InputScalar(\"input u64\",     ImGuiDataType_U64,    &u64_v, inputs_step ? &u64_one : NULL);\n        ImGui::InputScalar(\"input float\",   ImGuiDataType_Float,  &f32_v, inputs_step ? &f32_one : NULL);\n        ImGui::InputScalar(\"input double\",  ImGuiDataType_Double, &f64_v, inputs_step ? &f64_one : NULL);\n\n        ImGui::TreePop();\n    }\n\n    if (ImGui::TreeNode(\"Multi-component Widgets\"))\n    {\n        static float vec4f[4] = { 0.10f, 0.20f, 0.30f, 0.44f };\n        static int vec4i[4] = { 1, 5, 100, 255 };\n\n        ImGui::InputFloat2(\"input float2\", vec4f);\n        ImGui::DragFloat2(\"drag float2\", vec4f, 0.01f, 0.0f, 1.0f);\n        ImGui::SliderFloat2(\"slider float2\", vec4f, 0.0f, 1.0f);\n        ImGui::InputInt2(\"input int2\", vec4i);\n        ImGui::DragInt2(\"drag int2\", vec4i, 1, 0, 255);\n        ImGui::SliderInt2(\"slider int2\", vec4i, 0, 255);\n        ImGui::Spacing();\n\n        ImGui::InputFloat3(\"input float3\", vec4f);\n        ImGui::DragFloat3(\"drag float3\", vec4f, 0.01f, 0.0f, 1.0f);\n        ImGui::SliderFloat3(\"slider float3\", vec4f, 0.0f, 1.0f);\n        ImGui::InputInt3(\"input int3\", vec4i);\n        ImGui::DragInt3(\"drag int3\", vec4i, 1, 0, 255);\n        ImGui::SliderInt3(\"slider int3\", vec4i, 0, 255);\n        ImGui::Spacing();\n\n        ImGui::InputFloat4(\"input float4\", vec4f);\n        ImGui::DragFloat4(\"drag float4\", vec4f, 0.01f, 0.0f, 1.0f);\n        ImGui::SliderFloat4(\"slider float4\", vec4f, 0.0f, 1.0f);\n        ImGui::InputInt4(\"input int4\", vec4i);\n        ImGui::DragInt4(\"drag int4\", vec4i, 1, 0, 255);\n        ImGui::SliderInt4(\"slider int4\", vec4i, 0, 255);\n\n        ImGui::TreePop();\n    }\n\n    if (ImGui::TreeNode(\"Vertical Sliders\"))\n    {\n        const float spacing = 4;\n        ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(spacing, spacing));\n\n        static int int_value = 0;\n        ImGui::VSliderInt(\"##int\", ImVec2(18, 160), &int_value, 0, 5);\n        ImGui::SameLine();\n\n        static float values[7] = { 0.0f, 0.60f, 0.35f, 0.9f, 0.70f, 0.20f, 0.0f };\n        ImGui::PushID(\"set1\");\n        for (int i = 0; i < 7; i++)\n        {\n            if (i > 0) ImGui::SameLine();\n            ImGui::PushID(i);\n            ImGui::PushStyleColor(ImGuiCol_FrameBg, (ImVec4)ImColor::HSV(i / 7.0f, 0.5f, 0.5f));\n            ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, (ImVec4)ImColor::HSV(i / 7.0f, 0.6f, 0.5f));\n            ImGui::PushStyleColor(ImGuiCol_FrameBgActive, (ImVec4)ImColor::HSV(i / 7.0f, 0.7f, 0.5f));\n            ImGui::PushStyleColor(ImGuiCol_SliderGrab, (ImVec4)ImColor::HSV(i / 7.0f, 0.9f, 0.9f));\n            ImGui::VSliderFloat(\"##v\", ImVec2(18, 160), &values[i], 0.0f, 1.0f, \"\");\n            if (ImGui::IsItemActive() || ImGui::IsItemHovered())\n                ImGui::SetTooltip(\"%.3f\", values[i]);\n            ImGui::PopStyleColor(4);\n            ImGui::PopID();\n        }\n        ImGui::PopID();\n\n        ImGui::SameLine();\n        ImGui::PushID(\"set2\");\n        static float values2[4] = { 0.20f, 0.80f, 0.40f, 0.25f };\n        const int rows = 3;\n        const ImVec2 small_slider_size(18, (float)(int)((160.0f - (rows - 1) * spacing) / rows));\n        for (int nx = 0; nx < 4; nx++)\n        {\n            if (nx > 0) ImGui::SameLine();\n            ImGui::BeginGroup();\n            for (int ny = 0; ny < rows; ny++)\n            {\n                ImGui::PushID(nx * rows + ny);\n                ImGui::VSliderFloat(\"##v\", small_slider_size, &values2[nx], 0.0f, 1.0f, \"\");\n                if (ImGui::IsItemActive() || ImGui::IsItemHovered())\n                    ImGui::SetTooltip(\"%.3f\", values2[nx]);\n                ImGui::PopID();\n            }\n            ImGui::EndGroup();\n        }\n        ImGui::PopID();\n\n        ImGui::SameLine();\n        ImGui::PushID(\"set3\");\n        for (int i = 0; i < 4; i++)\n        {\n            if (i > 0) ImGui::SameLine();\n            ImGui::PushID(i);\n            ImGui::PushStyleVar(ImGuiStyleVar_GrabMinSize, 40);\n            ImGui::VSliderFloat(\"##v\", ImVec2(40, 160), &values[i], 0.0f, 1.0f, \"%.2f\\nsec\");\n            ImGui::PopStyleVar();\n            ImGui::PopID();\n        }\n        ImGui::PopID();\n        ImGui::PopStyleVar();\n        ImGui::TreePop();\n    }\n\n    if (ImGui::TreeNode(\"Drag and Drop\"))\n    {\n        if (ImGui::TreeNode(\"Drag and drop in standard widgets\"))\n        {\n            // ColorEdit widgets automatically act as drag source and drag target.\n            // They are using standardized payload strings IMGUI_PAYLOAD_TYPE_COLOR_3F and IMGUI_PAYLOAD_TYPE_COLOR_4F\n            // to allow your own widgets to use colors in their drag and drop interaction.\n            // Also see 'Demo->Widgets->Color/Picker Widgets->Palette' demo.\n            HelpMarker(\"You can drag from the color squares.\");\n            static float col1[3] = { 1.0f, 0.0f, 0.2f };\n            static float col2[4] = { 0.4f, 0.7f, 0.0f, 0.5f };\n            ImGui::ColorEdit3(\"color 1\", col1);\n            ImGui::ColorEdit4(\"color 2\", col2);\n            ImGui::TreePop();\n        }\n\n        if (ImGui::TreeNode(\"Drag and drop to copy/swap items\"))\n        {\n            enum Mode\n            {\n                Mode_Copy,\n                Mode_Move,\n                Mode_Swap\n            };\n            static int mode = 0;\n            if (ImGui::RadioButton(\"Copy\", mode == Mode_Copy)) { mode = Mode_Copy; } ImGui::SameLine();\n            if (ImGui::RadioButton(\"Move\", mode == Mode_Move)) { mode = Mode_Move; } ImGui::SameLine();\n            if (ImGui::RadioButton(\"Swap\", mode == Mode_Swap)) { mode = Mode_Swap; }\n            static const char* names[9] =\n            {\n                \"Bobby\", \"Beatrice\", \"Betty\",\n                \"Brianna\", \"Barry\", \"Bernard\",\n                \"Bibi\", \"Blaine\", \"Bryn\"\n            };\n            for (int n = 0; n < IM_ARRAYSIZE(names); n++)\n            {\n                ImGui::PushID(n);\n                if ((n % 3) != 0)\n                    ImGui::SameLine();\n                ImGui::Button(names[n], ImVec2(60, 60));\n\n                // Our buttons are both drag sources and drag targets here!\n                if (ImGui::BeginDragDropSource(ImGuiDragDropFlags_None))\n                {\n                    // Set payload to carry the index of our item (could be anything)\n                    ImGui::SetDragDropPayload(\"DND_DEMO_CELL\", &n, sizeof(int));\n\n                    // Display preview (could be anything, e.g. when dragging an image we could decide to display\n                    // the filename and a small preview of the image, etc.)\n                    if (mode == Mode_Copy) { ImGui::Text(\"Copy %s\", names[n]); }\n                    if (mode == Mode_Move) { ImGui::Text(\"Move %s\", names[n]); }\n                    if (mode == Mode_Swap) { ImGui::Text(\"Swap %s\", names[n]); }\n                    ImGui::EndDragDropSource();\n                }\n                if (ImGui::BeginDragDropTarget())\n                {\n                    if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload(\"DND_DEMO_CELL\"))\n                    {\n                        IM_ASSERT(payload->DataSize == sizeof(int));\n                        int payload_n = *(const int*)payload->Data;\n                        if (mode == Mode_Copy)\n                        {\n                            names[n] = names[payload_n];\n                        }\n                        if (mode == Mode_Move)\n                        {\n                            names[n] = names[payload_n];\n                            names[payload_n] = \"\";\n                        }\n                        if (mode == Mode_Swap)\n                        {\n                            const char* tmp = names[n];\n                            names[n] = names[payload_n];\n                            names[payload_n] = tmp;\n                        }\n                    }\n                    ImGui::EndDragDropTarget();\n                }\n                ImGui::PopID();\n            }\n            ImGui::TreePop();\n        }\n\n        if (ImGui::TreeNode(\"Drag to reorder items (simple)\"))\n        {\n            // Simple reordering\n            HelpMarker(\n                \"We don't use the drag and drop api at all here! \"\n                \"Instead we query when the item is held but not hovered, and order items accordingly.\");\n            static const char* item_names[] = { \"Item One\", \"Item Two\", \"Item Three\", \"Item Four\", \"Item Five\" };\n            for (int n = 0; n < IM_ARRAYSIZE(item_names); n++)\n            {\n                const char* item = item_names[n];\n                ImGui::Selectable(item);\n\n                if (ImGui::IsItemActive() && !ImGui::IsItemHovered())\n                {\n                    int n_next = n + (ImGui::GetMouseDragDelta(0).y < 0.f ? -1 : 1);\n                    if (n_next >= 0 && n_next < IM_ARRAYSIZE(item_names))\n                    {\n                        item_names[n] = item_names[n_next];\n                        item_names[n_next] = item;\n                        ImGui::ResetMouseDragDelta();\n                    }\n                }\n            }\n            ImGui::TreePop();\n        }\n\n        ImGui::TreePop();\n    }\n\n    if (ImGui::TreeNode(\"Querying Status (Edited/Active/Hovered etc.)\"))\n    {\n        // Select an item type\n        const char* item_names[] =\n        {\n            \"Text\", \"Button\", \"Button (w/ repeat)\", \"Checkbox\", \"SliderFloat\", \"InputText\", \"InputFloat\",\n            \"InputFloat3\", \"ColorEdit4\", \"Selectable\", \"MenuItem\", \"TreeNode\", \"TreeNode (w/ double-click)\", \"Combo\", \"ListBox\"\n        };\n        static int item_type = 4;\n        static bool item_disabled = false;\n        ImGui::Combo(\"Item Type\", &item_type, item_names, IM_ARRAYSIZE(item_names), IM_ARRAYSIZE(item_names));\n        ImGui::SameLine();\n        HelpMarker(\"Testing how various types of items are interacting with the IsItemXXX functions. Note that the bool return value of most ImGui function is generally equivalent to calling ImGui::IsItemHovered().\");\n        ImGui::Checkbox(\"Item Disabled\",  &item_disabled);\n\n        // Submit selected item item so we can query their status in the code following it.\n        bool ret = false;\n        static bool b = false;\n        static float col4f[4] = { 1.0f, 0.5, 0.0f, 1.0f };\n        static char str[16] = {};\n        if (item_disabled)\n            ImGui::BeginDisabled(true);\n        if (item_type == 0) { ImGui::Text(\"ITEM: Text\"); }                                              // Testing text items with no identifier/interaction\n        if (item_type == 1) { ret = ImGui::Button(\"ITEM: Button\"); }                                    // Testing button\n        if (item_type == 2) { ImGui::PushButtonRepeat(true); ret = ImGui::Button(\"ITEM: Button\"); ImGui::PopButtonRepeat(); } // Testing button (with repeater)\n        if (item_type == 3) { ret = ImGui::Checkbox(\"ITEM: Checkbox\", &b); }                            // Testing checkbox\n        if (item_type == 4) { ret = ImGui::SliderFloat(\"ITEM: SliderFloat\", &col4f[0], 0.0f, 1.0f); }   // Testing basic item\n        if (item_type == 5) { ret = ImGui::InputText(\"ITEM: InputText\", &str[0], IM_ARRAYSIZE(str)); }  // Testing input text (which handles tabbing)\n        if (item_type == 6) { ret = ImGui::InputFloat(\"ITEM: InputFloat\", col4f, 1.0f); }               // Testing +/- buttons on scalar input\n        if (item_type == 7) { ret = ImGui::InputFloat3(\"ITEM: InputFloat3\", col4f); }                   // Testing multi-component items (IsItemXXX flags are reported merged)\n        if (item_type == 8) { ret = ImGui::ColorEdit4(\"ITEM: ColorEdit4\", col4f); }                     // Testing multi-component items (IsItemXXX flags are reported merged)\n        if (item_type == 9) { ret = ImGui::Selectable(\"ITEM: Selectable\"); }                            // Testing selectable item\n        if (item_type == 10){ ret = ImGui::MenuItem(\"ITEM: MenuItem\"); }                                // Testing menu item (they use ImGuiButtonFlags_PressedOnRelease button policy)\n        if (item_type == 11){ ret = ImGui::TreeNode(\"ITEM: TreeNode\"); if (ret) ImGui::TreePop(); }     // Testing tree node\n        if (item_type == 12){ ret = ImGui::TreeNodeEx(\"ITEM: TreeNode w/ ImGuiTreeNodeFlags_OpenOnDoubleClick\", ImGuiTreeNodeFlags_OpenOnDoubleClick | ImGuiTreeNodeFlags_NoTreePushOnOpen); } // Testing tree node with ImGuiButtonFlags_PressedOnDoubleClick button policy.\n        if (item_type == 13){ const char* items[] = { \"Apple\", \"Banana\", \"Cherry\", \"Kiwi\" }; static int current = 1; ret = ImGui::Combo(\"ITEM: Combo\", &current, items, IM_ARRAYSIZE(items)); }\n        if (item_type == 14){ const char* items[] = { \"Apple\", \"Banana\", \"Cherry\", \"Kiwi\" }; static int current = 1; ret = ImGui::ListBox(\"ITEM: ListBox\", &current, items, IM_ARRAYSIZE(items), IM_ARRAYSIZE(items)); }\n\n        // Display the values of IsItemHovered() and other common item state functions.\n        // Note that the ImGuiHoveredFlags_XXX flags can be combined.\n        // Because BulletText is an item itself and that would affect the output of IsItemXXX functions,\n        // we query every state in a single call to avoid storing them and to simplify the code.\n        ImGui::BulletText(\n            \"Return value = %d\\n\"\n            \"IsItemFocused() = %d\\n\"\n            \"IsItemHovered() = %d\\n\"\n            \"IsItemHovered(_AllowWhenBlockedByPopup) = %d\\n\"\n            \"IsItemHovered(_AllowWhenBlockedByActiveItem) = %d\\n\"\n            \"IsItemHovered(_AllowWhenOverlapped) = %d\\n\"\n            \"IsItemHovered(_AllowWhenDisabled) = %d\\n\"\n            \"IsItemHovered(_RectOnly) = %d\\n\"\n            \"IsItemActive() = %d\\n\"\n            \"IsItemEdited() = %d\\n\"\n            \"IsItemActivated() = %d\\n\"\n            \"IsItemDeactivated() = %d\\n\"\n            \"IsItemDeactivatedAfterEdit() = %d\\n\"\n            \"IsItemVisible() = %d\\n\"\n            \"IsItemClicked() = %d\\n\"\n            \"IsItemToggledOpen() = %d\\n\"\n            \"GetItemRectMin() = (%.1f, %.1f)\\n\"\n            \"GetItemRectMax() = (%.1f, %.1f)\\n\"\n            \"GetItemRectSize() = (%.1f, %.1f)\",\n            ret,\n            ImGui::IsItemFocused(),\n            ImGui::IsItemHovered(),\n            ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup),\n            ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem),\n            ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenOverlapped),\n            ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled),\n            ImGui::IsItemHovered(ImGuiHoveredFlags_RectOnly),\n            ImGui::IsItemActive(),\n            ImGui::IsItemEdited(),\n            ImGui::IsItemActivated(),\n            ImGui::IsItemDeactivated(),\n            ImGui::IsItemDeactivatedAfterEdit(),\n            ImGui::IsItemVisible(),\n            ImGui::IsItemClicked(),\n            ImGui::IsItemToggledOpen(),\n            ImGui::GetItemRectMin().x, ImGui::GetItemRectMin().y,\n            ImGui::GetItemRectMax().x, ImGui::GetItemRectMax().y,\n            ImGui::GetItemRectSize().x, ImGui::GetItemRectSize().y\n        );\n\n        if (item_disabled)\n            ImGui::EndDisabled();\n\n        static bool embed_all_inside_a_child_window = false;\n        ImGui::Checkbox(\"Embed everything inside a child window (for additional testing)\", &embed_all_inside_a_child_window);\n        if (embed_all_inside_a_child_window)\n            ImGui::BeginChild(\"outer_child\", ImVec2(0, ImGui::GetFontSize() * 20.0f), true);\n\n        // Testing IsWindowFocused() function with its various flags.\n        // Note that the ImGuiFocusedFlags_XXX flags can be combined.\n        ImGui::BulletText(\n            \"IsWindowFocused() = %d\\n\"\n            \"IsWindowFocused(_ChildWindows) = %d\\n\"\n            \"IsWindowFocused(_ChildWindows|_RootWindow) = %d\\n\"\n            \"IsWindowFocused(_RootWindow) = %d\\n\"\n            \"IsWindowFocused(_AnyWindow) = %d\\n\",\n            ImGui::IsWindowFocused(),\n            ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows),\n            ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows | ImGuiFocusedFlags_RootWindow),\n            ImGui::IsWindowFocused(ImGuiFocusedFlags_RootWindow),\n            ImGui::IsWindowFocused(ImGuiFocusedFlags_AnyWindow));\n\n        // Testing IsWindowHovered() function with its various flags.\n        // Note that the ImGuiHoveredFlags_XXX flags can be combined.\n        ImGui::BulletText(\n            \"IsWindowHovered() = %d\\n\"\n            \"IsWindowHovered(_AllowWhenBlockedByPopup) = %d\\n\"\n            \"IsWindowHovered(_AllowWhenBlockedByActiveItem) = %d\\n\"\n            \"IsWindowHovered(_ChildWindows) = %d\\n\"\n            \"IsWindowHovered(_ChildWindows|_RootWindow) = %d\\n\"\n            \"IsWindowHovered(_ChildWindows|_AllowWhenBlockedByPopup) = %d\\n\"\n            \"IsWindowHovered(_RootWindow) = %d\\n\"\n            \"IsWindowHovered(_AnyWindow) = %d\\n\",\n            ImGui::IsWindowHovered(),\n            ImGui::IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup),\n            ImGui::IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem),\n            ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows),\n            ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows | ImGuiHoveredFlags_RootWindow),\n            ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows | ImGuiHoveredFlags_AllowWhenBlockedByPopup),\n            ImGui::IsWindowHovered(ImGuiHoveredFlags_RootWindow),\n            ImGui::IsWindowHovered(ImGuiHoveredFlags_AnyWindow));\n\n        ImGui::BeginChild(\"child\", ImVec2(0, 50), true);\n        ImGui::Text(\"This is another child window for testing the _ChildWindows flag.\");\n        ImGui::EndChild();\n        if (embed_all_inside_a_child_window)\n            ImGui::EndChild();\n\n        static char unused_str[] = \"This widget is only here to be able to tab-out of the widgets above.\";\n        ImGui::InputText(\"unused\", unused_str, IM_ARRAYSIZE(unused_str), ImGuiInputTextFlags_ReadOnly);\n\n        // Calling IsItemHovered() after begin returns the hovered status of the title bar.\n        // This is useful in particular if you want to create a context menu associated to the title bar of a window.\n        static bool test_window = false;\n        ImGui::Checkbox(\"Hovered/Active tests after Begin() for title bar testing\", &test_window);\n        if (test_window)\n        {\n            ImGui::Begin(\"Title bar Hovered/Active tests\", &test_window);\n            if (ImGui::BeginPopupContextItem()) // <-- This is using IsItemHovered()\n            {\n                if (ImGui::MenuItem(\"Close\")) { test_window = false; }\n                ImGui::EndPopup();\n            }\n            ImGui::Text(\n                \"IsItemHovered() after begin = %d (== is title bar hovered)\\n\"\n                \"IsItemActive() after begin = %d (== is window being clicked/moved)\\n\",\n                ImGui::IsItemHovered(), ImGui::IsItemActive());\n            ImGui::End();\n        }\n\n        ImGui::TreePop();\n    }\n\n    // Demonstrate BeginDisabled/EndDisabled using a checkbox located at the bottom of the section (which is a bit odd:\n    // logically we'd have this checkbox at the top of the section, but we don't want this feature to steal that space)\n    if (disable_all)\n        ImGui::EndDisabled();\n\n    if (ImGui::TreeNode(\"Disable block\"))\n    {\n        ImGui::Checkbox(\"Disable entire section above\", &disable_all);\n        ImGui::SameLine(); HelpMarker(\"Demonstrate using BeginDisabled()/EndDisabled() across this section.\");\n        ImGui::TreePop();\n    }\n}\n\nstatic void ShowDemoWindowLayout()\n{\n    if (!ImGui::CollapsingHeader(\"Layout & Scrolling\"))\n        return;\n\n    if (ImGui::TreeNode(\"Child windows\"))\n    {\n        HelpMarker(\"Use child windows to begin into a self-contained independent scrolling/clipping regions within a host window.\");\n        static bool disable_mouse_wheel = false;\n        static bool disable_menu = false;\n        ImGui::Checkbox(\"Disable Mouse Wheel\", &disable_mouse_wheel);\n        ImGui::Checkbox(\"Disable Menu\", &disable_menu);\n\n        // Child 1: no border, enable horizontal scrollbar\n        {\n            ImGuiWindowFlags window_flags = ImGuiWindowFlags_HorizontalScrollbar;\n            if (disable_mouse_wheel)\n                window_flags |= ImGuiWindowFlags_NoScrollWithMouse;\n            ImGui::BeginChild(\"ChildL\", ImVec2(ImGui::GetWindowContentRegionWidth() * 0.5f, 260), false, window_flags);\n            for (int i = 0; i < 100; i++)\n                ImGui::Text(\"%04d: scrollable region\", i);\n            ImGui::EndChild();\n        }\n\n        ImGui::SameLine();\n\n        // Child 2: rounded border\n        {\n            ImGuiWindowFlags window_flags = ImGuiWindowFlags_None;\n            if (disable_mouse_wheel)\n                window_flags |= ImGuiWindowFlags_NoScrollWithMouse;\n            if (!disable_menu)\n                window_flags |= ImGuiWindowFlags_MenuBar;\n            ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 5.0f);\n            ImGui::BeginChild(\"ChildR\", ImVec2(0, 260), true, window_flags);\n            if (!disable_menu && ImGui::BeginMenuBar())\n            {\n                if (ImGui::BeginMenu(\"Menu\"))\n                {\n                    ShowExampleMenuFile();\n                    ImGui::EndMenu();\n                }\n                ImGui::EndMenuBar();\n            }\n            if (ImGui::BeginTable(\"split\", 2, ImGuiTableFlags_Resizable | ImGuiTableFlags_NoSavedSettings))\n            {\n                for (int i = 0; i < 100; i++)\n                {\n                    char buf[32];\n                    sprintf(buf, \"%03d\", i);\n                    ImGui::TableNextColumn();\n                    ImGui::Button(buf, ImVec2(-FLT_MIN, 0.0f));\n                }\n                ImGui::EndTable();\n            }\n            ImGui::EndChild();\n            ImGui::PopStyleVar();\n        }\n\n        ImGui::Separator();\n\n        // Demonstrate a few extra things\n        // - Changing ImGuiCol_ChildBg (which is transparent black in default styles)\n        // - Using SetCursorPos() to position child window (the child window is an item from the POV of parent window)\n        //   You can also call SetNextWindowPos() to position the child window. The parent window will effectively\n        //   layout from this position.\n        // - Using ImGui::GetItemRectMin/Max() to query the \"item\" state (because the child window is an item from\n        //   the POV of the parent window). See 'Demo->Querying Status (Edited/Active/Hovered etc.)' for details.\n        {\n            static int offset_x = 0;\n            ImGui::SetNextItemWidth(ImGui::GetFontSize() * 8);\n            ImGui::DragInt(\"Offset X\", &offset_x, 1.0f, -1000, 1000);\n\n            ImGui::SetCursorPosX(ImGui::GetCursorPosX() + (float)offset_x);\n            ImGui::PushStyleColor(ImGuiCol_ChildBg, IM_COL32(255, 0, 0, 100));\n            ImGui::BeginChild(\"Red\", ImVec2(200, 100), true, ImGuiWindowFlags_None);\n            for (int n = 0; n < 50; n++)\n                ImGui::Text(\"Some test %d\", n);\n            ImGui::EndChild();\n            bool child_is_hovered = ImGui::IsItemHovered();\n            ImVec2 child_rect_min = ImGui::GetItemRectMin();\n            ImVec2 child_rect_max = ImGui::GetItemRectMax();\n            ImGui::PopStyleColor();\n            ImGui::Text(\"Hovered: %d\", child_is_hovered);\n            ImGui::Text(\"Rect of child window is: (%.0f,%.0f) (%.0f,%.0f)\", child_rect_min.x, child_rect_min.y, child_rect_max.x, child_rect_max.y);\n        }\n\n        ImGui::TreePop();\n    }\n\n    if (ImGui::TreeNode(\"Widgets Width\"))\n    {\n        static float f = 0.0f;\n        static bool show_indented_items = true;\n        ImGui::Checkbox(\"Show indented items\", &show_indented_items);\n\n        // Use SetNextItemWidth() to set the width of a single upcoming item.\n        // Use PushItemWidth()/PopItemWidth() to set the width of a group of items.\n        // In real code use you'll probably want to choose width values that are proportional to your font size\n        // e.g. Using '20.0f * GetFontSize()' as width instead of '200.0f', etc.\n\n        ImGui::Text(\"SetNextItemWidth/PushItemWidth(100)\");\n        ImGui::SameLine(); HelpMarker(\"Fixed width.\");\n        ImGui::PushItemWidth(100);\n        ImGui::DragFloat(\"float##1b\", &f);\n        if (show_indented_items)\n        {\n            ImGui::Indent();\n            ImGui::DragFloat(\"float (indented)##1b\", &f);\n            ImGui::Unindent();\n        }\n        ImGui::PopItemWidth();\n\n        ImGui::Text(\"SetNextItemWidth/PushItemWidth(-100)\");\n        ImGui::SameLine(); HelpMarker(\"Align to right edge minus 100\");\n        ImGui::PushItemWidth(-100);\n        ImGui::DragFloat(\"float##2a\", &f);\n        if (show_indented_items)\n        {\n            ImGui::Indent();\n            ImGui::DragFloat(\"float (indented)##2b\", &f);\n            ImGui::Unindent();\n        }\n        ImGui::PopItemWidth();\n\n        ImGui::Text(\"SetNextItemWidth/PushItemWidth(GetContentRegionAvail().x * 0.5f)\");\n        ImGui::SameLine(); HelpMarker(\"Half of available width.\\n(~ right-cursor_pos)\\n(works within a column set)\");\n        ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x * 0.5f);\n        ImGui::DragFloat(\"float##3a\", &f);\n        if (show_indented_items)\n        {\n            ImGui::Indent();\n            ImGui::DragFloat(\"float (indented)##3b\", &f);\n            ImGui::Unindent();\n        }\n        ImGui::PopItemWidth();\n\n        ImGui::Text(\"SetNextItemWidth/PushItemWidth(-GetContentRegionAvail().x * 0.5f)\");\n        ImGui::SameLine(); HelpMarker(\"Align to right edge minus half\");\n        ImGui::PushItemWidth(-ImGui::GetContentRegionAvail().x * 0.5f);\n        ImGui::DragFloat(\"float##4a\", &f);\n        if (show_indented_items)\n        {\n            ImGui::Indent();\n            ImGui::DragFloat(\"float (indented)##4b\", &f);\n            ImGui::Unindent();\n        }\n        ImGui::PopItemWidth();\n\n        // Demonstrate using PushItemWidth to surround three items.\n        // Calling SetNextItemWidth() before each of them would have the same effect.\n        ImGui::Text(\"SetNextItemWidth/PushItemWidth(-FLT_MIN)\");\n        ImGui::SameLine(); HelpMarker(\"Align to right edge\");\n        ImGui::PushItemWidth(-FLT_MIN);\n        ImGui::DragFloat(\"##float5a\", &f);\n        if (show_indented_items)\n        {\n            ImGui::Indent();\n            ImGui::DragFloat(\"float (indented)##5b\", &f);\n            ImGui::Unindent();\n        }\n        ImGui::PopItemWidth();\n\n        ImGui::TreePop();\n    }\n\n    if (ImGui::TreeNode(\"Basic Horizontal Layout\"))\n    {\n        ImGui::TextWrapped(\"(Use ImGui::SameLine() to keep adding items to the right of the preceding item)\");\n\n        // Text\n        ImGui::Text(\"Two items: Hello\"); ImGui::SameLine();\n        ImGui::TextColored(ImVec4(1,1,0,1), \"Sailor\");\n\n        // Adjust spacing\n        ImGui::Text(\"More spacing: Hello\"); ImGui::SameLine(0, 20);\n        ImGui::TextColored(ImVec4(1,1,0,1), \"Sailor\");\n\n        // Button\n        ImGui::AlignTextToFramePadding();\n        ImGui::Text(\"Normal buttons\"); ImGui::SameLine();\n        ImGui::Button(\"Banana\"); ImGui::SameLine();\n        ImGui::Button(\"Apple\"); ImGui::SameLine();\n        ImGui::Button(\"Corniflower\");\n\n        // Button\n        ImGui::Text(\"Small buttons\"); ImGui::SameLine();\n        ImGui::SmallButton(\"Like this one\"); ImGui::SameLine();\n        ImGui::Text(\"can fit within a text block.\");\n\n        // Aligned to arbitrary position. Easy/cheap column.\n        ImGui::Text(\"Aligned\");\n        ImGui::SameLine(150); ImGui::Text(\"x=150\");\n        ImGui::SameLine(300); ImGui::Text(\"x=300\");\n        ImGui::Text(\"Aligned\");\n        ImGui::SameLine(150); ImGui::SmallButton(\"x=150\");\n        ImGui::SameLine(300); ImGui::SmallButton(\"x=300\");\n\n        // Checkbox\n        static bool c1 = false, c2 = false, c3 = false, c4 = false;\n        ImGui::Checkbox(\"My\", &c1); ImGui::SameLine();\n        ImGui::Checkbox(\"Tailor\", &c2); ImGui::SameLine();\n        ImGui::Checkbox(\"Is\", &c3); ImGui::SameLine();\n        ImGui::Checkbox(\"Rich\", &c4);\n\n        // Various\n        static float f0 = 1.0f, f1 = 2.0f, f2 = 3.0f;\n        ImGui::PushItemWidth(80);\n        const char* items[] = { \"AAAA\", \"BBBB\", \"CCCC\", \"DDDD\" };\n        static int item = -1;\n        ImGui::Combo(\"Combo\", &item, items, IM_ARRAYSIZE(items)); ImGui::SameLine();\n        ImGui::SliderFloat(\"X\", &f0, 0.0f, 5.0f); ImGui::SameLine();\n        ImGui::SliderFloat(\"Y\", &f1, 0.0f, 5.0f); ImGui::SameLine();\n        ImGui::SliderFloat(\"Z\", &f2, 0.0f, 5.0f);\n        ImGui::PopItemWidth();\n\n        ImGui::PushItemWidth(80);\n        ImGui::Text(\"Lists:\");\n        static int selection[4] = { 0, 1, 2, 3 };\n        for (int i = 0; i < 4; i++)\n        {\n            if (i > 0) ImGui::SameLine();\n            ImGui::PushID(i);\n            ImGui::ListBox(\"\", &selection[i], items, IM_ARRAYSIZE(items));\n            ImGui::PopID();\n            //if (ImGui::IsItemHovered()) ImGui::SetTooltip(\"ListBox %d hovered\", i);\n        }\n        ImGui::PopItemWidth();\n\n        // Dummy\n        ImVec2 button_sz(40, 40);\n        ImGui::Button(\"A\", button_sz); ImGui::SameLine();\n        ImGui::Dummy(button_sz); ImGui::SameLine();\n        ImGui::Button(\"B\", button_sz);\n\n        // Manually wrapping\n        // (we should eventually provide this as an automatic layout feature, but for now you can do it manually)\n        ImGui::Text(\"Manually wrapping:\");\n        ImGuiStyle& style = ImGui::GetStyle();\n        int buttons_count = 20;\n        float window_visible_x2 = ImGui::GetWindowPos().x + ImGui::GetWindowContentRegionMax().x;\n        for (int n = 0; n < buttons_count; n++)\n        {\n            ImGui::PushID(n);\n            ImGui::Button(\"Box\", button_sz);\n            float last_button_x2 = ImGui::GetItemRectMax().x;\n            float next_button_x2 = last_button_x2 + style.ItemSpacing.x + button_sz.x; // Expected position if next button was on same line\n            if (n + 1 < buttons_count && next_button_x2 < window_visible_x2)\n                ImGui::SameLine();\n            ImGui::PopID();\n        }\n\n        ImGui::TreePop();\n    }\n\n    if (ImGui::TreeNode(\"Groups\"))\n    {\n        HelpMarker(\n            \"BeginGroup() basically locks the horizontal position for new line. \"\n            \"EndGroup() bundles the whole group so that you can use \\\"item\\\" functions such as \"\n            \"IsItemHovered()/IsItemActive() or SameLine() etc. on the whole group.\");\n        ImGui::BeginGroup();\n        {\n            ImGui::BeginGroup();\n            ImGui::Button(\"AAA\");\n            ImGui::SameLine();\n            ImGui::Button(\"BBB\");\n            ImGui::SameLine();\n            ImGui::BeginGroup();\n            ImGui::Button(\"CCC\");\n            ImGui::Button(\"DDD\");\n            ImGui::EndGroup();\n            ImGui::SameLine();\n            ImGui::Button(\"EEE\");\n            ImGui::EndGroup();\n            if (ImGui::IsItemHovered())\n                ImGui::SetTooltip(\"First group hovered\");\n        }\n        // Capture the group size and create widgets using the same size\n        ImVec2 size = ImGui::GetItemRectSize();\n        const float values[5] = { 0.5f, 0.20f, 0.80f, 0.60f, 0.25f };\n        ImGui::PlotHistogram(\"##values\", values, IM_ARRAYSIZE(values), 0, NULL, 0.0f, 1.0f, size);\n\n        ImGui::Button(\"ACTION\", ImVec2((size.x - ImGui::GetStyle().ItemSpacing.x) * 0.5f, size.y));\n        ImGui::SameLine();\n        ImGui::Button(\"REACTION\", ImVec2((size.x - ImGui::GetStyle().ItemSpacing.x) * 0.5f, size.y));\n        ImGui::EndGroup();\n        ImGui::SameLine();\n\n        ImGui::Button(\"LEVERAGE\\nBUZZWORD\", size);\n        ImGui::SameLine();\n\n        if (ImGui::BeginListBox(\"List\", size))\n        {\n            ImGui::Selectable(\"Selected\", true);\n            ImGui::Selectable(\"Not Selected\", false);\n            ImGui::EndListBox();\n        }\n\n        ImGui::TreePop();\n    }\n\n    if (ImGui::TreeNode(\"Text Baseline Alignment\"))\n    {\n        {\n            ImGui::BulletText(\"Text baseline:\");\n            ImGui::SameLine(); HelpMarker(\n                \"This is testing the vertical alignment that gets applied on text to keep it aligned with widgets. \"\n                \"Lines only composed of text or \\\"small\\\" widgets use less vertical space than lines with framed widgets.\");\n            ImGui::Indent();\n\n            ImGui::Text(\"KO Blahblah\"); ImGui::SameLine();\n            ImGui::Button(\"Some framed item\"); ImGui::SameLine();\n            HelpMarker(\"Baseline of button will look misaligned with text..\");\n\n            // If your line starts with text, call AlignTextToFramePadding() to align text to upcoming widgets.\n            // (because we don't know what's coming after the Text() statement, we need to move the text baseline\n            // down by FramePadding.y ahead of time)\n            ImGui::AlignTextToFramePadding();\n            ImGui::Text(\"OK Blahblah\"); ImGui::SameLine();\n            ImGui::Button(\"Some framed item\"); ImGui::SameLine();\n            HelpMarker(\"We call AlignTextToFramePadding() to vertically align the text baseline by +FramePadding.y\");\n\n            // SmallButton() uses the same vertical padding as Text\n            ImGui::Button(\"TEST##1\"); ImGui::SameLine();\n            ImGui::Text(\"TEST\"); ImGui::SameLine();\n            ImGui::SmallButton(\"TEST##2\");\n\n            // If your line starts with text, call AlignTextToFramePadding() to align text to upcoming widgets.\n            ImGui::AlignTextToFramePadding();\n            ImGui::Text(\"Text aligned to framed item\"); ImGui::SameLine();\n            ImGui::Button(\"Item##1\"); ImGui::SameLine();\n            ImGui::Text(\"Item\"); ImGui::SameLine();\n            ImGui::SmallButton(\"Item##2\"); ImGui::SameLine();\n            ImGui::Button(\"Item##3\");\n\n            ImGui::Unindent();\n        }\n\n        ImGui::Spacing();\n\n        {\n            ImGui::BulletText(\"Multi-line text:\");\n            ImGui::Indent();\n            ImGui::Text(\"One\\nTwo\\nThree\"); ImGui::SameLine();\n            ImGui::Text(\"Hello\\nWorld\"); ImGui::SameLine();\n            ImGui::Text(\"Banana\");\n\n            ImGui::Text(\"Banana\"); ImGui::SameLine();\n            ImGui::Text(\"Hello\\nWorld\"); ImGui::SameLine();\n            ImGui::Text(\"One\\nTwo\\nThree\");\n\n            ImGui::Button(\"HOP##1\"); ImGui::SameLine();\n            ImGui::Text(\"Banana\"); ImGui::SameLine();\n            ImGui::Text(\"Hello\\nWorld\"); ImGui::SameLine();\n            ImGui::Text(\"Banana\");\n\n            ImGui::Button(\"HOP##2\"); ImGui::SameLine();\n            ImGui::Text(\"Hello\\nWorld\"); ImGui::SameLine();\n            ImGui::Text(\"Banana\");\n            ImGui::Unindent();\n        }\n\n        ImGui::Spacing();\n\n        {\n            ImGui::BulletText(\"Misc items:\");\n            ImGui::Indent();\n\n            // SmallButton() sets FramePadding to zero. Text baseline is aligned to match baseline of previous Button.\n            ImGui::Button(\"80x80\", ImVec2(80, 80));\n            ImGui::SameLine();\n            ImGui::Button(\"50x50\", ImVec2(50, 50));\n            ImGui::SameLine();\n            ImGui::Button(\"Button()\");\n            ImGui::SameLine();\n            ImGui::SmallButton(\"SmallButton()\");\n\n            // Tree\n            const float spacing = ImGui::GetStyle().ItemInnerSpacing.x;\n            ImGui::Button(\"Button##1\");\n            ImGui::SameLine(0.0f, spacing);\n            if (ImGui::TreeNode(\"Node##1\"))\n            {\n                // Placeholder tree data\n                for (int i = 0; i < 6; i++)\n                    ImGui::BulletText(\"Item %d..\", i);\n                ImGui::TreePop();\n            }\n\n            // Vertically align text node a bit lower so it'll be vertically centered with upcoming widget.\n            // Otherwise you can use SmallButton() (smaller fit).\n            ImGui::AlignTextToFramePadding();\n\n            // Common mistake to avoid: if we want to SameLine after TreeNode we need to do it before we add\n            // other contents below the node.\n            bool node_open = ImGui::TreeNode(\"Node##2\");\n            ImGui::SameLine(0.0f, spacing); ImGui::Button(\"Button##2\");\n            if (node_open)\n            {\n                // Placeholder tree data\n                for (int i = 0; i < 6; i++)\n                    ImGui::BulletText(\"Item %d..\", i);\n                ImGui::TreePop();\n            }\n\n            // Bullet\n            ImGui::Button(\"Button##3\");\n            ImGui::SameLine(0.0f, spacing);\n            ImGui::BulletText(\"Bullet text\");\n\n            ImGui::AlignTextToFramePadding();\n            ImGui::BulletText(\"Node\");\n            ImGui::SameLine(0.0f, spacing); ImGui::Button(\"Button##4\");\n            ImGui::Unindent();\n        }\n\n        ImGui::TreePop();\n    }\n\n    if (ImGui::TreeNode(\"Scrolling\"))\n    {\n        // Vertical scroll functions\n        HelpMarker(\"Use SetScrollHereY() or SetScrollFromPosY() to scroll to a given vertical position.\");\n\n        static int track_item = 50;\n        static bool enable_track = true;\n        static bool enable_extra_decorations = false;\n        static float scroll_to_off_px = 0.0f;\n        static float scroll_to_pos_px = 200.0f;\n\n        ImGui::Checkbox(\"Decoration\", &enable_extra_decorations);\n\n        ImGui::Checkbox(\"Track\", &enable_track);\n        ImGui::PushItemWidth(100);\n        ImGui::SameLine(140); enable_track |= ImGui::DragInt(\"##item\", &track_item, 0.25f, 0, 99, \"Item = %d\");\n\n        bool scroll_to_off = ImGui::Button(\"Scroll Offset\");\n        ImGui::SameLine(140); scroll_to_off |= ImGui::DragFloat(\"##off\", &scroll_to_off_px, 1.00f, 0, FLT_MAX, \"+%.0f px\");\n\n        bool scroll_to_pos = ImGui::Button(\"Scroll To Pos\");\n        ImGui::SameLine(140); scroll_to_pos |= ImGui::DragFloat(\"##pos\", &scroll_to_pos_px, 1.00f, -10, FLT_MAX, \"X/Y = %.0f px\");\n        ImGui::PopItemWidth();\n\n        if (scroll_to_off || scroll_to_pos)\n            enable_track = false;\n\n        ImGuiStyle& style = ImGui::GetStyle();\n        float child_w = (ImGui::GetContentRegionAvail().x - 4 * style.ItemSpacing.x) / 5;\n        if (child_w < 1.0f)\n            child_w = 1.0f;\n        ImGui::PushID(\"##VerticalScrolling\");\n        for (int i = 0; i < 5; i++)\n        {\n            if (i > 0) ImGui::SameLine();\n            ImGui::BeginGroup();\n            const char* names[] = { \"Top\", \"25%\", \"Center\", \"75%\", \"Bottom\" };\n            ImGui::TextUnformatted(names[i]);\n\n            const ImGuiWindowFlags child_flags = enable_extra_decorations ? ImGuiWindowFlags_MenuBar : 0;\n            const ImGuiID child_id = ImGui::GetID((void*)(intptr_t)i);\n            const bool child_is_visible = ImGui::BeginChild(child_id, ImVec2(child_w, 200.0f), true, child_flags);\n            if (ImGui::BeginMenuBar())\n            {\n                ImGui::TextUnformatted(\"abc\");\n                ImGui::EndMenuBar();\n            }\n            if (scroll_to_off)\n                ImGui::SetScrollY(scroll_to_off_px);\n            if (scroll_to_pos)\n                ImGui::SetScrollFromPosY(ImGui::GetCursorStartPos().y + scroll_to_pos_px, i * 0.25f);\n            if (child_is_visible) // Avoid calling SetScrollHereY when running with culled items\n            {\n                for (int item = 0; item < 100; item++)\n                {\n                    if (enable_track && item == track_item)\n                    {\n                        ImGui::TextColored(ImVec4(1, 1, 0, 1), \"Item %d\", item);\n                        ImGui::SetScrollHereY(i * 0.25f); // 0.0f:top, 0.5f:center, 1.0f:bottom\n                    }\n                    else\n                    {\n                        ImGui::Text(\"Item %d\", item);\n                    }\n                }\n            }\n            float scroll_y = ImGui::GetScrollY();\n            float scroll_max_y = ImGui::GetScrollMaxY();\n            ImGui::EndChild();\n            ImGui::Text(\"%.0f/%.0f\", scroll_y, scroll_max_y);\n            ImGui::EndGroup();\n        }\n        ImGui::PopID();\n\n        // Horizontal scroll functions\n        ImGui::Spacing();\n        HelpMarker(\n            \"Use SetScrollHereX() or SetScrollFromPosX() to scroll to a given horizontal position.\\n\\n\"\n            \"Because the clipping rectangle of most window hides half worth of WindowPadding on the \"\n            \"left/right, using SetScrollFromPosX(+1) will usually result in clipped text whereas the \"\n            \"equivalent SetScrollFromPosY(+1) wouldn't.\");\n        ImGui::PushID(\"##HorizontalScrolling\");\n        for (int i = 0; i < 5; i++)\n        {\n            float child_height = ImGui::GetTextLineHeight() + style.ScrollbarSize + style.WindowPadding.y * 2.0f;\n            ImGuiWindowFlags child_flags = ImGuiWindowFlags_HorizontalScrollbar | (enable_extra_decorations ? ImGuiWindowFlags_AlwaysVerticalScrollbar : 0);\n            ImGuiID child_id = ImGui::GetID((void*)(intptr_t)i);\n            bool child_is_visible = ImGui::BeginChild(child_id, ImVec2(-100, child_height), true, child_flags);\n            if (scroll_to_off)\n                ImGui::SetScrollX(scroll_to_off_px);\n            if (scroll_to_pos)\n                ImGui::SetScrollFromPosX(ImGui::GetCursorStartPos().x + scroll_to_pos_px, i * 0.25f);\n            if (child_is_visible) // Avoid calling SetScrollHereY when running with culled items\n            {\n                for (int item = 0; item < 100; item++)\n                {\n                    if (item > 0)\n                        ImGui::SameLine();\n                    if (enable_track && item == track_item)\n                    {\n                        ImGui::TextColored(ImVec4(1, 1, 0, 1), \"Item %d\", item);\n                        ImGui::SetScrollHereX(i * 0.25f); // 0.0f:left, 0.5f:center, 1.0f:right\n                    }\n                    else\n                    {\n                        ImGui::Text(\"Item %d\", item);\n                    }\n                }\n            }\n            float scroll_x = ImGui::GetScrollX();\n            float scroll_max_x = ImGui::GetScrollMaxX();\n            ImGui::EndChild();\n            ImGui::SameLine();\n            const char* names[] = { \"Left\", \"25%\", \"Center\", \"75%\", \"Right\" };\n            ImGui::Text(\"%s\\n%.0f/%.0f\", names[i], scroll_x, scroll_max_x);\n            ImGui::Spacing();\n        }\n        ImGui::PopID();\n\n        // Miscellaneous Horizontal Scrolling Demo\n        HelpMarker(\n            \"Horizontal scrolling for a window is enabled via the ImGuiWindowFlags_HorizontalScrollbar flag.\\n\\n\"\n            \"You may want to also explicitly specify content width by using SetNextWindowContentWidth() before Begin().\");\n        static int lines = 7;\n        ImGui::SliderInt(\"Lines\", &lines, 1, 15);\n        ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f);\n        ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(2.0f, 1.0f));\n        ImVec2 scrolling_child_size = ImVec2(0, ImGui::GetFrameHeightWithSpacing() * 7 + 30);\n        ImGui::BeginChild(\"scrolling\", scrolling_child_size, true, ImGuiWindowFlags_HorizontalScrollbar);\n        for (int line = 0; line < lines; line++)\n        {\n            // Display random stuff. For the sake of this trivial demo we are using basic Button() + SameLine()\n            // If you want to create your own time line for a real application you may be better off manipulating\n            // the cursor position yourself, aka using SetCursorPos/SetCursorScreenPos to position the widgets\n            // yourself. You may also want to use the lower-level ImDrawList API.\n            int num_buttons = 10 + ((line & 1) ? line * 9 : line * 3);\n            for (int n = 0; n < num_buttons; n++)\n            {\n                if (n > 0) ImGui::SameLine();\n                ImGui::PushID(n + line * 1000);\n                char num_buf[16];\n                sprintf(num_buf, \"%d\", n);\n                const char* label = (!(n % 15)) ? \"FizzBuzz\" : (!(n % 3)) ? \"Fizz\" : (!(n % 5)) ? \"Buzz\" : num_buf;\n                float hue = n * 0.05f;\n                ImGui::PushStyleColor(ImGuiCol_Button, (ImVec4)ImColor::HSV(hue, 0.6f, 0.6f));\n                ImGui::PushStyleColor(ImGuiCol_ButtonHovered, (ImVec4)ImColor::HSV(hue, 0.7f, 0.7f));\n                ImGui::PushStyleColor(ImGuiCol_ButtonActive, (ImVec4)ImColor::HSV(hue, 0.8f, 0.8f));\n                ImGui::Button(label, ImVec2(40.0f + sinf((float)(line + n)) * 20.0f, 0.0f));\n                ImGui::PopStyleColor(3);\n                ImGui::PopID();\n            }\n        }\n        float scroll_x = ImGui::GetScrollX();\n        float scroll_max_x = ImGui::GetScrollMaxX();\n        ImGui::EndChild();\n        ImGui::PopStyleVar(2);\n        float scroll_x_delta = 0.0f;\n        ImGui::SmallButton(\"<<\");\n        if (ImGui::IsItemActive())\n            scroll_x_delta = -ImGui::GetIO().DeltaTime * 1000.0f;\n        ImGui::SameLine();\n        ImGui::Text(\"Scroll from code\"); ImGui::SameLine();\n        ImGui::SmallButton(\">>\");\n        if (ImGui::IsItemActive())\n            scroll_x_delta = +ImGui::GetIO().DeltaTime * 1000.0f;\n        ImGui::SameLine();\n        ImGui::Text(\"%.0f/%.0f\", scroll_x, scroll_max_x);\n        if (scroll_x_delta != 0.0f)\n        {\n            // Demonstrate a trick: you can use Begin to set yourself in the context of another window\n            // (here we are already out of your child window)\n            ImGui::BeginChild(\"scrolling\");\n            ImGui::SetScrollX(ImGui::GetScrollX() + scroll_x_delta);\n            ImGui::EndChild();\n        }\n        ImGui::Spacing();\n\n        static bool show_horizontal_contents_size_demo_window = false;\n        ImGui::Checkbox(\"Show Horizontal contents size demo window\", &show_horizontal_contents_size_demo_window);\n\n        if (show_horizontal_contents_size_demo_window)\n        {\n            static bool show_h_scrollbar = true;\n            static bool show_button = true;\n            static bool show_tree_nodes = true;\n            static bool show_text_wrapped = false;\n            static bool show_columns = true;\n            static bool show_tab_bar = true;\n            static bool show_child = false;\n            static bool explicit_content_size = false;\n            static float contents_size_x = 300.0f;\n            if (explicit_content_size)\n                ImGui::SetNextWindowContentSize(ImVec2(contents_size_x, 0.0f));\n            ImGui::Begin(\"Horizontal contents size demo window\", &show_horizontal_contents_size_demo_window, show_h_scrollbar ? ImGuiWindowFlags_HorizontalScrollbar : 0);\n            ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(2, 0));\n            ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(2, 0));\n            HelpMarker(\"Test of different widgets react and impact the work rectangle growing when horizontal scrolling is enabled.\\n\\nUse 'Metrics->Tools->Show windows rectangles' to visualize rectangles.\");\n            ImGui::Checkbox(\"H-scrollbar\", &show_h_scrollbar);\n            ImGui::Checkbox(\"Button\", &show_button);            // Will grow contents size (unless explicitly overwritten)\n            ImGui::Checkbox(\"Tree nodes\", &show_tree_nodes);    // Will grow contents size and display highlight over full width\n            ImGui::Checkbox(\"Text wrapped\", &show_text_wrapped);// Will grow and use contents size\n            ImGui::Checkbox(\"Columns\", &show_columns);          // Will use contents size\n            ImGui::Checkbox(\"Tab bar\", &show_tab_bar);          // Will use contents size\n            ImGui::Checkbox(\"Child\", &show_child);              // Will grow and use contents size\n            ImGui::Checkbox(\"Explicit content size\", &explicit_content_size);\n            ImGui::Text(\"Scroll %.1f/%.1f %.1f/%.1f\", ImGui::GetScrollX(), ImGui::GetScrollMaxX(), ImGui::GetScrollY(), ImGui::GetScrollMaxY());\n            if (explicit_content_size)\n            {\n                ImGui::SameLine();\n                ImGui::SetNextItemWidth(100);\n                ImGui::DragFloat(\"##csx\", &contents_size_x);\n                ImVec2 p = ImGui::GetCursorScreenPos();\n                ImGui::GetWindowDrawList()->AddRectFilled(p, ImVec2(p.x + 10, p.y + 10), IM_COL32_WHITE);\n                ImGui::GetWindowDrawList()->AddRectFilled(ImVec2(p.x + contents_size_x - 10, p.y), ImVec2(p.x + contents_size_x, p.y + 10), IM_COL32_WHITE);\n                ImGui::Dummy(ImVec2(0, 10));\n            }\n            ImGui::PopStyleVar(2);\n            ImGui::Separator();\n            if (show_button)\n            {\n                ImGui::Button(\"this is a 300-wide button\", ImVec2(300, 0));\n            }\n            if (show_tree_nodes)\n            {\n                bool open = true;\n                if (ImGui::TreeNode(\"this is a tree node\"))\n                {\n                    if (ImGui::TreeNode(\"another one of those tree node...\"))\n                    {\n                        ImGui::Text(\"Some tree contents\");\n                        ImGui::TreePop();\n                    }\n                    ImGui::TreePop();\n                }\n                ImGui::CollapsingHeader(\"CollapsingHeader\", &open);\n            }\n            if (show_text_wrapped)\n            {\n                ImGui::TextWrapped(\"This text should automatically wrap on the edge of the work rectangle.\");\n            }\n            if (show_columns)\n            {\n                ImGui::Text(\"Tables:\");\n                if (ImGui::BeginTable(\"table\", 4, ImGuiTableFlags_Borders))\n                {\n                    for (int n = 0; n < 4; n++)\n                    {\n                        ImGui::TableNextColumn();\n                        ImGui::Text(\"Width %.2f\", ImGui::GetContentRegionAvail().x);\n                    }\n                    ImGui::EndTable();\n                }\n                ImGui::Text(\"Columns:\");\n                ImGui::Columns(4);\n                for (int n = 0; n < 4; n++)\n                {\n                    ImGui::Text(\"Width %.2f\", ImGui::GetColumnWidth());\n                    ImGui::NextColumn();\n                }\n                ImGui::Columns(1);\n            }\n            if (show_tab_bar && ImGui::BeginTabBar(\"Hello\"))\n            {\n                if (ImGui::BeginTabItem(\"OneOneOne\")) { ImGui::EndTabItem(); }\n                if (ImGui::BeginTabItem(\"TwoTwoTwo\")) { ImGui::EndTabItem(); }\n                if (ImGui::BeginTabItem(\"ThreeThreeThree\")) { ImGui::EndTabItem(); }\n                if (ImGui::BeginTabItem(\"FourFourFour\")) { ImGui::EndTabItem(); }\n                ImGui::EndTabBar();\n            }\n            if (show_child)\n            {\n                ImGui::BeginChild(\"child\", ImVec2(0, 0), true);\n                ImGui::EndChild();\n            }\n            ImGui::End();\n        }\n\n        ImGui::TreePop();\n    }\n\n    if (ImGui::TreeNode(\"Clipping\"))\n    {\n        static ImVec2 size(100.0f, 100.0f);\n        static ImVec2 offset(30.0f, 30.0f);\n        ImGui::DragFloat2(\"size\", (float*)&size, 0.5f, 1.0f, 200.0f, \"%.0f\");\n        ImGui::TextWrapped(\"(Click and drag to scroll)\");\n\n        for (int n = 0; n < 3; n++)\n        {\n            if (n > 0)\n                ImGui::SameLine();\n            ImGui::PushID(n);\n            ImGui::BeginGroup(); // Lock X position\n\n            ImGui::InvisibleButton(\"##empty\", size);\n            if (ImGui::IsItemActive() && ImGui::IsMouseDragging(ImGuiMouseButton_Left))\n            {\n                offset.x += ImGui::GetIO().MouseDelta.x;\n                offset.y += ImGui::GetIO().MouseDelta.y;\n            }\n            const ImVec2 p0 = ImGui::GetItemRectMin();\n            const ImVec2 p1 = ImGui::GetItemRectMax();\n            const char* text_str = \"Line 1 hello\\nLine 2 clip me!\";\n            const ImVec2 text_pos = ImVec2(p0.x + offset.x, p0.y + offset.y);\n            ImDrawList* draw_list = ImGui::GetWindowDrawList();\n\n            switch (n)\n            {\n            case 0:\n                HelpMarker(\n                    \"Using ImGui::PushClipRect():\\n\"\n                    \"Will alter ImGui hit-testing logic + ImDrawList rendering.\\n\"\n                    \"(use this if you want your clipping rectangle to affect interactions)\");\n                ImGui::PushClipRect(p0, p1, true);\n                draw_list->AddRectFilled(p0, p1, IM_COL32(90, 90, 120, 255));\n                draw_list->AddText(text_pos, IM_COL32_WHITE, text_str);\n                ImGui::PopClipRect();\n                break;\n            case 1:\n                HelpMarker(\n                    \"Using ImDrawList::PushClipRect():\\n\"\n                    \"Will alter ImDrawList rendering only.\\n\"\n                    \"(use this as a shortcut if you are only using ImDrawList calls)\");\n                draw_list->PushClipRect(p0, p1, true);\n                draw_list->AddRectFilled(p0, p1, IM_COL32(90, 90, 120, 255));\n                draw_list->AddText(text_pos, IM_COL32_WHITE, text_str);\n                draw_list->PopClipRect();\n                break;\n            case 2:\n                HelpMarker(\n                    \"Using ImDrawList::AddText() with a fine ClipRect:\\n\"\n                    \"Will alter only this specific ImDrawList::AddText() rendering.\\n\"\n                    \"(this is often used internally to avoid altering the clipping rectangle and minimize draw calls)\");\n                ImVec4 clip_rect(p0.x, p0.y, p1.x, p1.y); // AddText() takes a ImVec4* here so let's convert.\n                draw_list->AddRectFilled(p0, p1, IM_COL32(90, 90, 120, 255));\n                draw_list->AddText(ImGui::GetFont(), ImGui::GetFontSize(), text_pos, IM_COL32_WHITE, text_str, NULL, 0.0f, &clip_rect);\n                break;\n            }\n            ImGui::EndGroup();\n            ImGui::PopID();\n        }\n\n        ImGui::TreePop();\n    }\n}\n\nstatic void ShowDemoWindowPopups()\n{\n    if (!ImGui::CollapsingHeader(\"Popups & Modal windows\"))\n        return;\n\n    // The properties of popups windows are:\n    // - They block normal mouse hovering detection outside them. (*)\n    // - Unless modal, they can be closed by clicking anywhere outside them, or by pressing ESCAPE.\n    // - Their visibility state (~bool) is held internally by Dear ImGui instead of being held by the programmer as\n    //   we are used to with regular Begin() calls. User can manipulate the visibility state by calling OpenPopup().\n    // (*) One can use IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup) to bypass it and detect hovering even\n    //     when normally blocked by a popup.\n    // Those three properties are connected. The library needs to hold their visibility state BECAUSE it can close\n    // popups at any time.\n\n    // Typical use for regular windows:\n    //   bool my_tool_is_active = false; if (ImGui::Button(\"Open\")) my_tool_is_active = true; [...] if (my_tool_is_active) Begin(\"My Tool\", &my_tool_is_active) { [...] } End();\n    // Typical use for popups:\n    //   if (ImGui::Button(\"Open\")) ImGui::OpenPopup(\"MyPopup\"); if (ImGui::BeginPopup(\"MyPopup\") { [...] EndPopup(); }\n\n    // With popups we have to go through a library call (here OpenPopup) to manipulate the visibility state.\n    // This may be a bit confusing at first but it should quickly make sense. Follow on the examples below.\n\n    if (ImGui::TreeNode(\"Popups\"))\n    {\n        ImGui::TextWrapped(\n            \"When a popup is active, it inhibits interacting with windows that are behind the popup. \"\n            \"Clicking outside the popup closes it.\");\n\n        static int selected_fish = -1;\n        const char* names[] = { \"Bream\", \"Haddock\", \"Mackerel\", \"Pollock\", \"Tilefish\" };\n        static bool toggles[] = { true, false, false, false, false };\n\n        // Simple selection popup (if you want to show the current selection inside the Button itself,\n        // you may want to build a string using the \"###\" operator to preserve a constant ID with a variable label)\n        if (ImGui::Button(\"Select..\"))\n            ImGui::OpenPopup(\"my_select_popup\");\n        ImGui::SameLine();\n        ImGui::TextUnformatted(selected_fish == -1 ? \"<None>\" : names[selected_fish]);\n        if (ImGui::BeginPopup(\"my_select_popup\"))\n        {\n            ImGui::Text(\"Aquarium\");\n            ImGui::Separator();\n            for (int i = 0; i < IM_ARRAYSIZE(names); i++)\n                if (ImGui::Selectable(names[i]))\n                    selected_fish = i;\n            ImGui::EndPopup();\n        }\n\n        // Showing a menu with toggles\n        if (ImGui::Button(\"Toggle..\"))\n            ImGui::OpenPopup(\"my_toggle_popup\");\n        if (ImGui::BeginPopup(\"my_toggle_popup\"))\n        {\n            for (int i = 0; i < IM_ARRAYSIZE(names); i++)\n                ImGui::MenuItem(names[i], \"\", &toggles[i]);\n            if (ImGui::BeginMenu(\"Sub-menu\"))\n            {\n                ImGui::MenuItem(\"Click me\");\n                ImGui::EndMenu();\n            }\n\n            ImGui::Separator();\n            ImGui::Text(\"Tooltip here\");\n            if (ImGui::IsItemHovered())\n                ImGui::SetTooltip(\"I am a tooltip over a popup\");\n\n            if (ImGui::Button(\"Stacked Popup\"))\n                ImGui::OpenPopup(\"another popup\");\n            if (ImGui::BeginPopup(\"another popup\"))\n            {\n                for (int i = 0; i < IM_ARRAYSIZE(names); i++)\n                    ImGui::MenuItem(names[i], \"\", &toggles[i]);\n                if (ImGui::BeginMenu(\"Sub-menu\"))\n                {\n                    ImGui::MenuItem(\"Click me\");\n                    if (ImGui::Button(\"Stacked Popup\"))\n                        ImGui::OpenPopup(\"another popup\");\n                    if (ImGui::BeginPopup(\"another popup\"))\n                    {\n                        ImGui::Text(\"I am the last one here.\");\n                        ImGui::EndPopup();\n                    }\n                    ImGui::EndMenu();\n                }\n                ImGui::EndPopup();\n            }\n            ImGui::EndPopup();\n        }\n\n        // Call the more complete ShowExampleMenuFile which we use in various places of this demo\n        if (ImGui::Button(\"File Menu..\"))\n            ImGui::OpenPopup(\"my_file_popup\");\n        if (ImGui::BeginPopup(\"my_file_popup\"))\n        {\n            ShowExampleMenuFile();\n            ImGui::EndPopup();\n        }\n\n        ImGui::TreePop();\n    }\n\n    if (ImGui::TreeNode(\"Context menus\"))\n    {\n        HelpMarker(\"\\\"Context\\\" functions are simple helpers to associate a Popup to a given Item or Window identifier.\");\n\n        // BeginPopupContextItem() is a helper to provide common/simple popup behavior of essentially doing:\n        //     if (id == 0)\n        //         id = GetItemID(); // Use last item id\n        //     if (IsItemHovered() && IsMouseReleased(ImGuiMouseButton_Right))\n        //         OpenPopup(id);\n        //     return BeginPopup(id);\n        // For advanced advanced uses you may want to replicate and customize this code.\n        // See more details in BeginPopupContextItem().\n\n        // Example 1\n        // When used after an item that has an ID (e.g. Button), we can skip providing an ID to BeginPopupContextItem(),\n        // and BeginPopupContextItem() will use the last item ID as the popup ID.\n        {\n            const char* names[5] = { \"Label1\", \"Label2\", \"Label3\", \"Label4\", \"Label5\" };\n            for (int n = 0; n < 5; n++)\n            {\n                ImGui::Selectable(names[n]);\n                if (ImGui::BeginPopupContextItem()) // <-- use last item id as popup id\n                {\n                    ImGui::Text(\"This a popup for \\\"%s\\\"!\", names[n]);\n                    if (ImGui::Button(\"Close\"))\n                        ImGui::CloseCurrentPopup();\n                    ImGui::EndPopup();\n                }\n                if (ImGui::IsItemHovered())\n                    ImGui::SetTooltip(\"Right-click to open popup\");\n            }\n        }\n\n        // Example 2\n        // Popup on a Text() element which doesn't have an identifier: we need to provide an identifier to BeginPopupContextItem().\n        // Using an explicit identifier is also convenient if you want to activate the popups from different locations.\n        {\n            HelpMarker(\"Text() elements don't have stable identifiers so we need to provide one.\");\n            static float value = 0.5f;\n            ImGui::Text(\"Value = %.3f <-- (1) right-click this value\", value);\n            if (ImGui::BeginPopupContextItem(\"my popup\"))\n            {\n                if (ImGui::Selectable(\"Set to zero\")) value = 0.0f;\n                if (ImGui::Selectable(\"Set to PI\")) value = 3.1415f;\n                ImGui::SetNextItemWidth(-FLT_MIN);\n                ImGui::DragFloat(\"##Value\", &value, 0.1f, 0.0f, 0.0f);\n                ImGui::EndPopup();\n            }\n\n            // We can also use OpenPopupOnItemClick() to toggle the visibility of a given popup.\n            // Here we make it that right-clicking this other text element opens the same popup as above.\n            // The popup itself will be submitted by the code above.\n            ImGui::Text(\"(2) Or right-click this text\");\n            ImGui::OpenPopupOnItemClick(\"my popup\", ImGuiPopupFlags_MouseButtonRight);\n\n            // Back to square one: manually open the same popup.\n            if (ImGui::Button(\"(3) Or click this button\"))\n                ImGui::OpenPopup(\"my popup\");\n        }\n\n        // Example 3\n        // When using BeginPopupContextItem() with an implicit identifier (NULL == use last item ID),\n        // we need to make sure your item identifier is stable.\n        // In this example we showcase altering the item label while preserving its identifier, using the ### operator (see FAQ).\n        {\n            HelpMarker(\"Showcase using a popup ID linked to item ID, with the item having a changing label + stable ID using the ### operator.\");\n            static char name[32] = \"Label1\";\n            char buf[64];\n            sprintf(buf, \"Button: %s###Button\", name); // ### operator override ID ignoring the preceding label\n            ImGui::Button(buf);\n            if (ImGui::BeginPopupContextItem())\n            {\n                ImGui::Text(\"Edit name:\");\n                ImGui::InputText(\"##edit\", name, IM_ARRAYSIZE(name));\n                if (ImGui::Button(\"Close\"))\n                    ImGui::CloseCurrentPopup();\n                ImGui::EndPopup();\n            }\n            ImGui::SameLine(); ImGui::Text(\"(<-- right-click here)\");\n        }\n\n        ImGui::TreePop();\n    }\n\n    if (ImGui::TreeNode(\"Modals\"))\n    {\n        ImGui::TextWrapped(\"Modal windows are like popups but the user cannot close them by clicking outside.\");\n\n        if (ImGui::Button(\"Delete..\"))\n            ImGui::OpenPopup(\"Delete?\");\n\n        // Always center this window when appearing\n        ImVec2 center = ImGui::GetMainViewport()->GetCenter();\n        ImGui::SetNextWindowPos(center, ImGuiCond_Appearing, ImVec2(0.5f, 0.5f));\n\n        if (ImGui::BeginPopupModal(\"Delete?\", NULL, ImGuiWindowFlags_AlwaysAutoResize))\n        {\n            ImGui::Text(\"All those beautiful files will be deleted.\\nThis operation cannot be undone!\\n\\n\");\n            ImGui::Separator();\n\n            //static int unused_i = 0;\n            //ImGui::Combo(\"Combo\", &unused_i, \"Delete\\0Delete harder\\0\");\n\n            static bool dont_ask_me_next_time = false;\n            ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));\n            ImGui::Checkbox(\"Don't ask me next time\", &dont_ask_me_next_time);\n            ImGui::PopStyleVar();\n\n            if (ImGui::Button(\"OK\", ImVec2(120, 0))) { ImGui::CloseCurrentPopup(); }\n            ImGui::SetItemDefaultFocus();\n            ImGui::SameLine();\n            if (ImGui::Button(\"Cancel\", ImVec2(120, 0))) { ImGui::CloseCurrentPopup(); }\n            ImGui::EndPopup();\n        }\n\n        if (ImGui::Button(\"Stacked modals..\"))\n            ImGui::OpenPopup(\"Stacked 1\");\n        if (ImGui::BeginPopupModal(\"Stacked 1\", NULL, ImGuiWindowFlags_MenuBar))\n        {\n            if (ImGui::BeginMenuBar())\n            {\n                if (ImGui::BeginMenu(\"File\"))\n                {\n                    if (ImGui::MenuItem(\"Some menu item\")) {}\n                    ImGui::EndMenu();\n                }\n                ImGui::EndMenuBar();\n            }\n            ImGui::Text(\"Hello from Stacked The First\\nUsing style.Colors[ImGuiCol_ModalWindowDimBg] behind it.\");\n\n            // Testing behavior of widgets stacking their own regular popups over the modal.\n            static int item = 1;\n            static float color[4] = { 0.4f, 0.7f, 0.0f, 0.5f };\n            ImGui::Combo(\"Combo\", &item, \"aaaa\\0bbbb\\0cccc\\0dddd\\0eeee\\0\\0\");\n            ImGui::ColorEdit4(\"color\", color);\n\n            if (ImGui::Button(\"Add another modal..\"))\n                ImGui::OpenPopup(\"Stacked 2\");\n\n            // Also demonstrate passing a bool* to BeginPopupModal(), this will create a regular close button which\n            // will close the popup. Note that the visibility state of popups is owned by imgui, so the input value\n            // of the bool actually doesn't matter here.\n            bool unused_open = true;\n            if (ImGui::BeginPopupModal(\"Stacked 2\", &unused_open))\n            {\n                ImGui::Text(\"Hello from Stacked The Second!\");\n                if (ImGui::Button(\"Close\"))\n                    ImGui::CloseCurrentPopup();\n                ImGui::EndPopup();\n            }\n\n            if (ImGui::Button(\"Close\"))\n                ImGui::CloseCurrentPopup();\n            ImGui::EndPopup();\n        }\n\n        ImGui::TreePop();\n    }\n\n    if (ImGui::TreeNode(\"Menus inside a regular window\"))\n    {\n        ImGui::TextWrapped(\"Below we are testing adding menu items to a regular window. It's rather unusual but should work!\");\n        ImGui::Separator();\n\n        // Note: As a quirk in this very specific example, we want to differentiate the parent of this menu from the\n        // parent of the various popup menus above. To do so we are encloding the items in a PushID()/PopID() block\n        // to make them two different menusets. If we don't, opening any popup above and hovering our menu here would\n        // open it. This is because once a menu is active, we allow to switch to a sibling menu by just hovering on it,\n        // which is the desired behavior for regular menus.\n        ImGui::PushID(\"foo\");\n        ImGui::MenuItem(\"Menu item\", \"CTRL+M\");\n        if (ImGui::BeginMenu(\"Menu inside a regular window\"))\n        {\n            ShowExampleMenuFile();\n            ImGui::EndMenu();\n        }\n        ImGui::PopID();\n        ImGui::Separator();\n        ImGui::TreePop();\n    }\n}\n\n// Dummy data structure that we use for the Table demo.\n// (pre-C++11 doesn't allow us to instantiate ImVector<MyItem> template if this structure if defined inside the demo function)\nnamespace\n{\n// We are passing our own identifier to TableSetupColumn() to facilitate identifying columns in the sorting code.\n// This identifier will be passed down into ImGuiTableSortSpec::ColumnUserID.\n// But it is possible to omit the user id parameter of TableSetupColumn() and just use the column index instead! (ImGuiTableSortSpec::ColumnIndex)\n// If you don't use sorting, you will generally never care about giving column an ID!\nenum MyItemColumnID\n{\n    MyItemColumnID_ID,\n    MyItemColumnID_Name,\n    MyItemColumnID_Action,\n    MyItemColumnID_Quantity,\n    MyItemColumnID_Description\n};\n\nstruct MyItem\n{\n    int         ID;\n    const char* Name;\n    int         Quantity;\n\n    // We have a problem which is affecting _only this demo_ and should not affect your code:\n    // As we don't rely on std:: or other third-party library to compile dear imgui, we only have reliable access to qsort(),\n    // however qsort doesn't allow passing user data to comparing function.\n    // As a workaround, we are storing the sort specs in a static/global for the comparing function to access.\n    // In your own use case you would probably pass the sort specs to your sorting/comparing functions directly and not use a global.\n    // We could technically call ImGui::TableGetSortSpecs() in CompareWithSortSpecs(), but considering that this function is called\n    // very often by the sorting algorithm it would be a little wasteful.\n    static const ImGuiTableSortSpecs* s_current_sort_specs;\n\n    // Compare function to be used by qsort()\n    static int IMGUI_CDECL CompareWithSortSpecs(const void* lhs, const void* rhs)\n    {\n        const MyItem* a = (const MyItem*)lhs;\n        const MyItem* b = (const MyItem*)rhs;\n        for (int n = 0; n < s_current_sort_specs->SpecsCount; n++)\n        {\n            // Here we identify columns using the ColumnUserID value that we ourselves passed to TableSetupColumn()\n            // We could also choose to identify columns based on their index (sort_spec->ColumnIndex), which is simpler!\n            const ImGuiTableColumnSortSpecs* sort_spec = &s_current_sort_specs->Specs[n];\n            int delta = 0;\n            switch (sort_spec->ColumnUserID)\n            {\n            case MyItemColumnID_ID:             delta = (a->ID - b->ID);                break;\n            case MyItemColumnID_Name:           delta = (strcmp(a->Name, b->Name));     break;\n            case MyItemColumnID_Quantity:       delta = (a->Quantity - b->Quantity);    break;\n            case MyItemColumnID_Description:    delta = (strcmp(a->Name, b->Name));     break;\n            default: IM_ASSERT(0); break;\n            }\n            if (delta > 0)\n                return (sort_spec->SortDirection == ImGuiSortDirection_Ascending) ? +1 : -1;\n            if (delta < 0)\n                return (sort_spec->SortDirection == ImGuiSortDirection_Ascending) ? -1 : +1;\n        }\n\n        // qsort() is instable so always return a way to differenciate items.\n        // Your own compare function may want to avoid fallback on implicit sort specs e.g. a Name compare if it wasn't already part of the sort specs.\n        return (a->ID - b->ID);\n    }\n};\nconst ImGuiTableSortSpecs* MyItem::s_current_sort_specs = NULL;\n}\n\n// Make the UI compact because there are so many fields\nstatic void PushStyleCompact()\n{\n    ImGuiStyle& style = ImGui::GetStyle();\n    ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(style.FramePadding.x, (float)(int)(style.FramePadding.y * 0.60f)));\n    ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(style.ItemSpacing.x, (float)(int)(style.ItemSpacing.y * 0.60f)));\n}\n\nstatic void PopStyleCompact()\n{\n    ImGui::PopStyleVar(2);\n}\n\n// Show a combo box with a choice of sizing policies\nstatic void EditTableSizingFlags(ImGuiTableFlags* p_flags)\n{\n    struct EnumDesc { ImGuiTableFlags Value; const char* Name; const char* Tooltip; };\n    static const EnumDesc policies[] =\n    {\n        { ImGuiTableFlags_None,               \"Default\",                            \"Use default sizing policy:\\n- ImGuiTableFlags_SizingFixedFit if ScrollX is on or if host window has ImGuiWindowFlags_AlwaysAutoResize.\\n- ImGuiTableFlags_SizingStretchSame otherwise.\" },\n        { ImGuiTableFlags_SizingFixedFit,     \"ImGuiTableFlags_SizingFixedFit\",     \"Columns default to _WidthFixed (if resizable) or _WidthAuto (if not resizable), matching contents width.\" },\n        { ImGuiTableFlags_SizingFixedSame,    \"ImGuiTableFlags_SizingFixedSame\",    \"Columns are all the same width, matching the maximum contents width.\\nImplicitly disable ImGuiTableFlags_Resizable and enable ImGuiTableFlags_NoKeepColumnsVisible.\" },\n        { ImGuiTableFlags_SizingStretchProp,  \"ImGuiTableFlags_SizingStretchProp\",  \"Columns default to _WidthStretch with weights proportional to their widths.\" },\n        { ImGuiTableFlags_SizingStretchSame,  \"ImGuiTableFlags_SizingStretchSame\",  \"Columns default to _WidthStretch with same weights.\" }\n    };\n    int idx;\n    for (idx = 0; idx < IM_ARRAYSIZE(policies); idx++)\n        if (policies[idx].Value == (*p_flags & ImGuiTableFlags_SizingMask_))\n            break;\n    const char* preview_text = (idx < IM_ARRAYSIZE(policies)) ? policies[idx].Name + (idx > 0 ? strlen(\"ImGuiTableFlags\") : 0) : \"\";\n    if (ImGui::BeginCombo(\"Sizing Policy\", preview_text))\n    {\n        for (int n = 0; n < IM_ARRAYSIZE(policies); n++)\n            if (ImGui::Selectable(policies[n].Name, idx == n))\n                *p_flags = (*p_flags & ~ImGuiTableFlags_SizingMask_) | policies[n].Value;\n        ImGui::EndCombo();\n    }\n    ImGui::SameLine();\n    ImGui::TextDisabled(\"(?)\");\n    if (ImGui::IsItemHovered())\n    {\n        ImGui::BeginTooltip();\n        ImGui::PushTextWrapPos(ImGui::GetFontSize() * 50.0f);\n        for (int m = 0; m < IM_ARRAYSIZE(policies); m++)\n        {\n            ImGui::Separator();\n            ImGui::Text(\"%s:\", policies[m].Name);\n            ImGui::Separator();\n            ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetStyle().IndentSpacing * 0.5f);\n            ImGui::TextUnformatted(policies[m].Tooltip);\n        }\n        ImGui::PopTextWrapPos();\n        ImGui::EndTooltip();\n    }\n}\n\nstatic void EditTableColumnsFlags(ImGuiTableColumnFlags* p_flags)\n{\n    ImGui::CheckboxFlags(\"_Disabled\", p_flags, ImGuiTableColumnFlags_Disabled); ImGui::SameLine(); HelpMarker(\"Master disable flag (also hide from context menu)\");\n    ImGui::CheckboxFlags(\"_DefaultHide\", p_flags, ImGuiTableColumnFlags_DefaultHide);\n    ImGui::CheckboxFlags(\"_DefaultSort\", p_flags, ImGuiTableColumnFlags_DefaultSort);\n    if (ImGui::CheckboxFlags(\"_WidthStretch\", p_flags, ImGuiTableColumnFlags_WidthStretch))\n        *p_flags &= ~(ImGuiTableColumnFlags_WidthMask_ ^ ImGuiTableColumnFlags_WidthStretch);\n    if (ImGui::CheckboxFlags(\"_WidthFixed\", p_flags, ImGuiTableColumnFlags_WidthFixed))\n        *p_flags &= ~(ImGuiTableColumnFlags_WidthMask_ ^ ImGuiTableColumnFlags_WidthFixed);\n    ImGui::CheckboxFlags(\"_NoResize\", p_flags, ImGuiTableColumnFlags_NoResize);\n    ImGui::CheckboxFlags(\"_NoReorder\", p_flags, ImGuiTableColumnFlags_NoReorder);\n    ImGui::CheckboxFlags(\"_NoHide\", p_flags, ImGuiTableColumnFlags_NoHide);\n    ImGui::CheckboxFlags(\"_NoClip\", p_flags, ImGuiTableColumnFlags_NoClip);\n    ImGui::CheckboxFlags(\"_NoSort\", p_flags, ImGuiTableColumnFlags_NoSort);\n    ImGui::CheckboxFlags(\"_NoSortAscending\", p_flags, ImGuiTableColumnFlags_NoSortAscending);\n    ImGui::CheckboxFlags(\"_NoSortDescending\", p_flags, ImGuiTableColumnFlags_NoSortDescending);\n    ImGui::CheckboxFlags(\"_NoHeaderLabel\", p_flags, ImGuiTableColumnFlags_NoHeaderLabel);\n    ImGui::CheckboxFlags(\"_NoHeaderWidth\", p_flags, ImGuiTableColumnFlags_NoHeaderWidth);\n    ImGui::CheckboxFlags(\"_PreferSortAscending\", p_flags, ImGuiTableColumnFlags_PreferSortAscending);\n    ImGui::CheckboxFlags(\"_PreferSortDescending\", p_flags, ImGuiTableColumnFlags_PreferSortDescending);\n    ImGui::CheckboxFlags(\"_IndentEnable\", p_flags, ImGuiTableColumnFlags_IndentEnable); ImGui::SameLine(); HelpMarker(\"Default for column 0\");\n    ImGui::CheckboxFlags(\"_IndentDisable\", p_flags, ImGuiTableColumnFlags_IndentDisable); ImGui::SameLine(); HelpMarker(\"Default for column >0\");\n}\n\nstatic void ShowTableColumnsStatusFlags(ImGuiTableColumnFlags flags)\n{\n    ImGui::CheckboxFlags(\"_IsEnabled\", &flags, ImGuiTableColumnFlags_IsEnabled);\n    ImGui::CheckboxFlags(\"_IsVisible\", &flags, ImGuiTableColumnFlags_IsVisible);\n    ImGui::CheckboxFlags(\"_IsSorted\", &flags, ImGuiTableColumnFlags_IsSorted);\n    ImGui::CheckboxFlags(\"_IsHovered\", &flags, ImGuiTableColumnFlags_IsHovered);\n}\n\nstatic void ShowDemoWindowTables()\n{\n    //ImGui::SetNextItemOpen(true, ImGuiCond_Once);\n    if (!ImGui::CollapsingHeader(\"Tables & Columns\"))\n        return;\n\n    // Using those as a base value to create width/height that are factor of the size of our font\n    const float TEXT_BASE_WIDTH = ImGui::CalcTextSize(\"A\").x;\n    const float TEXT_BASE_HEIGHT = ImGui::GetTextLineHeightWithSpacing();\n\n    ImGui::PushID(\"Tables\");\n\n    int open_action = -1;\n    if (ImGui::Button(\"Open all\"))\n        open_action = 1;\n    ImGui::SameLine();\n    if (ImGui::Button(\"Close all\"))\n        open_action = 0;\n    ImGui::SameLine();\n\n    // Options\n    static bool disable_indent = false;\n    ImGui::Checkbox(\"Disable tree indentation\", &disable_indent);\n    ImGui::SameLine();\n    HelpMarker(\"Disable the indenting of tree nodes so demo tables can use the full window width.\");\n    ImGui::Separator();\n    if (disable_indent)\n        ImGui::PushStyleVar(ImGuiStyleVar_IndentSpacing, 0.0f);\n\n    // About Styling of tables\n    // Most settings are configured on a per-table basis via the flags passed to BeginTable() and TableSetupColumns APIs.\n    // There are however a few settings that a shared and part of the ImGuiStyle structure:\n    //   style.CellPadding                          // Padding within each cell\n    //   style.Colors[ImGuiCol_TableHeaderBg]       // Table header background\n    //   style.Colors[ImGuiCol_TableBorderStrong]   // Table outer and header borders\n    //   style.Colors[ImGuiCol_TableBorderLight]    // Table inner borders\n    //   style.Colors[ImGuiCol_TableRowBg]          // Table row background when ImGuiTableFlags_RowBg is enabled (even rows)\n    //   style.Colors[ImGuiCol_TableRowBgAlt]       // Table row background when ImGuiTableFlags_RowBg is enabled (odds rows)\n\n    // Demos\n    if (open_action != -1)\n        ImGui::SetNextItemOpen(open_action != 0);\n    if (ImGui::TreeNode(\"Basic\"))\n    {\n        // Here we will showcase three different ways to output a table.\n        // They are very simple variations of a same thing!\n\n        // [Method 1] Using TableNextRow() to create a new row, and TableSetColumnIndex() to select the column.\n        // In many situations, this is the most flexible and easy to use pattern.\n        HelpMarker(\"Using TableNextRow() + calling TableSetColumnIndex() _before_ each cell, in a loop.\");\n        if (ImGui::BeginTable(\"table1\", 3))\n        {\n            for (int row = 0; row < 4; row++)\n            {\n                ImGui::TableNextRow();\n                for (int column = 0; column < 3; column++)\n                {\n                    ImGui::TableSetColumnIndex(column);\n                    ImGui::Text(\"Row %d Column %d\", row, column);\n                }\n            }\n            ImGui::EndTable();\n        }\n\n        // [Method 2] Using TableNextColumn() called multiple times, instead of using a for loop + TableSetColumnIndex().\n        // This is generally more convenient when you have code manually submitting the contents of each columns.\n        HelpMarker(\"Using TableNextRow() + calling TableNextColumn() _before_ each cell, manually.\");\n        if (ImGui::BeginTable(\"table2\", 3))\n        {\n            for (int row = 0; row < 4; row++)\n            {\n                ImGui::TableNextRow();\n                ImGui::TableNextColumn();\n                ImGui::Text(\"Row %d\", row);\n                ImGui::TableNextColumn();\n                ImGui::Text(\"Some contents\");\n                ImGui::TableNextColumn();\n                ImGui::Text(\"123.456\");\n            }\n            ImGui::EndTable();\n        }\n\n        // [Method 3] We call TableNextColumn() _before_ each cell. We never call TableNextRow(),\n        // as TableNextColumn() will automatically wrap around and create new roes as needed.\n        // This is generally more convenient when your cells all contains the same type of data.\n        HelpMarker(\n            \"Only using TableNextColumn(), which tends to be convenient for tables where every cells contains the same type of contents.\\n\"\n            \"This is also more similar to the old NextColumn() function of the Columns API, and provided to facilitate the Columns->Tables API transition.\");\n        if (ImGui::BeginTable(\"table3\", 3))\n        {\n            for (int item = 0; item < 14; item++)\n            {\n                ImGui::TableNextColumn();\n                ImGui::Text(\"Item %d\", item);\n            }\n            ImGui::EndTable();\n        }\n\n        ImGui::TreePop();\n    }\n\n    if (open_action != -1)\n        ImGui::SetNextItemOpen(open_action != 0);\n    if (ImGui::TreeNode(\"Borders, background\"))\n    {\n        // Expose a few Borders related flags interactively\n        enum ContentsType { CT_Text, CT_FillButton };\n        static ImGuiTableFlags flags = ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg;\n        static bool display_headers = false;\n        static int contents_type = CT_Text;\n\n        PushStyleCompact();\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_RowBg\", &flags, ImGuiTableFlags_RowBg);\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_Borders\", &flags, ImGuiTableFlags_Borders);\n        ImGui::SameLine(); HelpMarker(\"ImGuiTableFlags_Borders\\n = ImGuiTableFlags_BordersInnerV\\n | ImGuiTableFlags_BordersOuterV\\n | ImGuiTableFlags_BordersInnerV\\n | ImGuiTableFlags_BordersOuterH\");\n        ImGui::Indent();\n\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_BordersH\", &flags, ImGuiTableFlags_BordersH);\n        ImGui::Indent();\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_BordersOuterH\", &flags, ImGuiTableFlags_BordersOuterH);\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_BordersInnerH\", &flags, ImGuiTableFlags_BordersInnerH);\n        ImGui::Unindent();\n\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_BordersV\", &flags, ImGuiTableFlags_BordersV);\n        ImGui::Indent();\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_BordersOuterV\", &flags, ImGuiTableFlags_BordersOuterV);\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_BordersInnerV\", &flags, ImGuiTableFlags_BordersInnerV);\n        ImGui::Unindent();\n\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_BordersOuter\", &flags, ImGuiTableFlags_BordersOuter);\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_BordersInner\", &flags, ImGuiTableFlags_BordersInner);\n        ImGui::Unindent();\n\n        ImGui::AlignTextToFramePadding(); ImGui::Text(\"Cell contents:\");\n        ImGui::SameLine(); ImGui::RadioButton(\"Text\", &contents_type, CT_Text);\n        ImGui::SameLine(); ImGui::RadioButton(\"FillButton\", &contents_type, CT_FillButton);\n        ImGui::Checkbox(\"Display headers\", &display_headers);\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_NoBordersInBody\", &flags, ImGuiTableFlags_NoBordersInBody); ImGui::SameLine(); HelpMarker(\"Disable vertical borders in columns Body (borders will always appears in Headers\");\n        PopStyleCompact();\n\n        if (ImGui::BeginTable(\"table1\", 3, flags))\n        {\n            // Display headers so we can inspect their interaction with borders.\n            // (Headers are not the main purpose of this section of the demo, so we are not elaborating on them too much. See other sections for details)\n            if (display_headers)\n            {\n                ImGui::TableSetupColumn(\"One\");\n                ImGui::TableSetupColumn(\"Two\");\n                ImGui::TableSetupColumn(\"Three\");\n                ImGui::TableHeadersRow();\n            }\n\n            for (int row = 0; row < 5; row++)\n            {\n                ImGui::TableNextRow();\n                for (int column = 0; column < 3; column++)\n                {\n                    ImGui::TableSetColumnIndex(column);\n                    char buf[32];\n                    sprintf(buf, \"Hello %d,%d\", column, row);\n                    if (contents_type == CT_Text)\n                        ImGui::TextUnformatted(buf);\n                    else if (contents_type)\n                        ImGui::Button(buf, ImVec2(-FLT_MIN, 0.0f));\n                }\n            }\n            ImGui::EndTable();\n        }\n        ImGui::TreePop();\n    }\n\n    if (open_action != -1)\n        ImGui::SetNextItemOpen(open_action != 0);\n    if (ImGui::TreeNode(\"Resizable, stretch\"))\n    {\n        // By default, if we don't enable ScrollX the sizing policy for each columns is \"Stretch\"\n        // Each columns maintain a sizing weight, and they will occupy all available width.\n        static ImGuiTableFlags flags = ImGuiTableFlags_SizingStretchSame | ImGuiTableFlags_Resizable | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersV | ImGuiTableFlags_ContextMenuInBody;\n        PushStyleCompact();\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_Resizable\", &flags, ImGuiTableFlags_Resizable);\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_BordersV\", &flags, ImGuiTableFlags_BordersV);\n        ImGui::SameLine(); HelpMarker(\"Using the _Resizable flag automatically enables the _BordersInnerV flag as well, this is why the resize borders are still showing when unchecking this.\");\n        PopStyleCompact();\n\n        if (ImGui::BeginTable(\"table1\", 3, flags))\n        {\n            for (int row = 0; row < 5; row++)\n            {\n                ImGui::TableNextRow();\n                for (int column = 0; column < 3; column++)\n                {\n                    ImGui::TableSetColumnIndex(column);\n                    ImGui::Text(\"Hello %d,%d\", column, row);\n                }\n            }\n            ImGui::EndTable();\n        }\n        ImGui::TreePop();\n    }\n\n    if (open_action != -1)\n        ImGui::SetNextItemOpen(open_action != 0);\n    if (ImGui::TreeNode(\"Resizable, fixed\"))\n    {\n        // Here we use ImGuiTableFlags_SizingFixedFit (even though _ScrollX is not set)\n        // So columns will adopt the \"Fixed\" policy and will maintain a fixed width regardless of the whole available width (unless table is small)\n        // If there is not enough available width to fit all columns, they will however be resized down.\n        // FIXME-TABLE: Providing a stretch-on-init would make sense especially for tables which don't have saved settings\n        HelpMarker(\n            \"Using _Resizable + _SizingFixedFit flags.\\n\"\n            \"Fixed-width columns generally makes more sense if you want to use horizontal scrolling.\\n\\n\"\n            \"Double-click a column border to auto-fit the column to its contents.\");\n        PushStyleCompact();\n        static ImGuiTableFlags flags = ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_Resizable | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersV | ImGuiTableFlags_ContextMenuInBody;\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_NoHostExtendX\", &flags, ImGuiTableFlags_NoHostExtendX);\n        PopStyleCompact();\n\n        if (ImGui::BeginTable(\"table1\", 3, flags))\n        {\n            for (int row = 0; row < 5; row++)\n            {\n                ImGui::TableNextRow();\n                for (int column = 0; column < 3; column++)\n                {\n                    ImGui::TableSetColumnIndex(column);\n                    ImGui::Text(\"Hello %d,%d\", column, row);\n                }\n            }\n            ImGui::EndTable();\n        }\n        ImGui::TreePop();\n    }\n\n    if (open_action != -1)\n        ImGui::SetNextItemOpen(open_action != 0);\n    if (ImGui::TreeNode(\"Resizable, mixed\"))\n    {\n        HelpMarker(\n            \"Using TableSetupColumn() to alter resizing policy on a per-column basis.\\n\\n\"\n            \"When combining Fixed and Stretch columns, generally you only want one, maybe two trailing columns to use _WidthStretch.\");\n        static ImGuiTableFlags flags = ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable;\n\n        if (ImGui::BeginTable(\"table1\", 3, flags))\n        {\n            ImGui::TableSetupColumn(\"AAA\", ImGuiTableColumnFlags_WidthFixed);\n            ImGui::TableSetupColumn(\"BBB\", ImGuiTableColumnFlags_WidthFixed);\n            ImGui::TableSetupColumn(\"CCC\", ImGuiTableColumnFlags_WidthStretch);\n            ImGui::TableHeadersRow();\n            for (int row = 0; row < 5; row++)\n            {\n                ImGui::TableNextRow();\n                for (int column = 0; column < 3; column++)\n                {\n                    ImGui::TableSetColumnIndex(column);\n                    ImGui::Text(\"%s %d,%d\", (column == 2) ? \"Stretch\" : \"Fixed\", column, row);\n                }\n            }\n            ImGui::EndTable();\n        }\n        if (ImGui::BeginTable(\"table2\", 6, flags))\n        {\n            ImGui::TableSetupColumn(\"AAA\", ImGuiTableColumnFlags_WidthFixed);\n            ImGui::TableSetupColumn(\"BBB\", ImGuiTableColumnFlags_WidthFixed);\n            ImGui::TableSetupColumn(\"CCC\", ImGuiTableColumnFlags_WidthFixed | ImGuiTableColumnFlags_DefaultHide);\n            ImGui::TableSetupColumn(\"DDD\", ImGuiTableColumnFlags_WidthStretch);\n            ImGui::TableSetupColumn(\"EEE\", ImGuiTableColumnFlags_WidthStretch);\n            ImGui::TableSetupColumn(\"FFF\", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_DefaultHide);\n            ImGui::TableHeadersRow();\n            for (int row = 0; row < 5; row++)\n            {\n                ImGui::TableNextRow();\n                for (int column = 0; column < 6; column++)\n                {\n                    ImGui::TableSetColumnIndex(column);\n                    ImGui::Text(\"%s %d,%d\", (column >= 3) ? \"Stretch\" : \"Fixed\", column, row);\n                }\n            }\n            ImGui::EndTable();\n        }\n        ImGui::TreePop();\n    }\n\n    if (open_action != -1)\n        ImGui::SetNextItemOpen(open_action != 0);\n    if (ImGui::TreeNode(\"Reorderable, hideable, with headers\"))\n    {\n        HelpMarker(\n            \"Click and drag column headers to reorder columns.\\n\\n\"\n            \"Right-click on a header to open a context menu.\");\n        static ImGuiTableFlags flags = ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersV;\n        PushStyleCompact();\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_Resizable\", &flags, ImGuiTableFlags_Resizable);\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_Reorderable\", &flags, ImGuiTableFlags_Reorderable);\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_Hideable\", &flags, ImGuiTableFlags_Hideable);\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_NoBordersInBody\", &flags, ImGuiTableFlags_NoBordersInBody);\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_NoBordersInBodyUntilResize\", &flags, ImGuiTableFlags_NoBordersInBodyUntilResize); ImGui::SameLine(); HelpMarker(\"Disable vertical borders in columns Body until hovered for resize (borders will always appears in Headers)\");\n        PopStyleCompact();\n\n        if (ImGui::BeginTable(\"table1\", 3, flags))\n        {\n            // Submit columns name with TableSetupColumn() and call TableHeadersRow() to create a row with a header in each column.\n            // (Later we will show how TableSetupColumn() has other uses, optional flags, sizing weight etc.)\n            ImGui::TableSetupColumn(\"One\");\n            ImGui::TableSetupColumn(\"Two\");\n            ImGui::TableSetupColumn(\"Three\");\n            ImGui::TableHeadersRow();\n            for (int row = 0; row < 6; row++)\n            {\n                ImGui::TableNextRow();\n                for (int column = 0; column < 3; column++)\n                {\n                    ImGui::TableSetColumnIndex(column);\n                    ImGui::Text(\"Hello %d,%d\", column, row);\n                }\n            }\n            ImGui::EndTable();\n        }\n\n        // Use outer_size.x == 0.0f instead of default to make the table as tight as possible (only valid when no scrolling and no stretch column)\n        if (ImGui::BeginTable(\"table2\", 3, flags | ImGuiTableFlags_SizingFixedFit, ImVec2(0.0f, 0.0f)))\n        {\n            ImGui::TableSetupColumn(\"One\");\n            ImGui::TableSetupColumn(\"Two\");\n            ImGui::TableSetupColumn(\"Three\");\n            ImGui::TableHeadersRow();\n            for (int row = 0; row < 6; row++)\n            {\n                ImGui::TableNextRow();\n                for (int column = 0; column < 3; column++)\n                {\n                    ImGui::TableSetColumnIndex(column);\n                    ImGui::Text(\"Fixed %d,%d\", column, row);\n                }\n            }\n            ImGui::EndTable();\n        }\n        ImGui::TreePop();\n    }\n\n    if (open_action != -1)\n        ImGui::SetNextItemOpen(open_action != 0);\n    if (ImGui::TreeNode(\"Padding\"))\n    {\n        // First example: showcase use of padding flags and effect of BorderOuterV/BorderInnerV on X padding.\n        // We don't expose BorderOuterH/BorderInnerH here because they have no effect on X padding.\n        HelpMarker(\n            \"We often want outer padding activated when any using features which makes the edges of a column visible:\\n\"\n            \"e.g.:\\n\"\n            \"- BorderOuterV\\n\"\n            \"- any form of row selection\\n\"\n            \"Because of this, activating BorderOuterV sets the default to PadOuterX. Using PadOuterX or NoPadOuterX you can override the default.\\n\\n\"\n            \"Actual padding values are using style.CellPadding.\\n\\n\"\n            \"In this demo we don't show horizontal borders to emphasis how they don't affect default horizontal padding.\");\n\n        static ImGuiTableFlags flags1 = ImGuiTableFlags_BordersV;\n        PushStyleCompact();\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_PadOuterX\", &flags1, ImGuiTableFlags_PadOuterX);\n        ImGui::SameLine(); HelpMarker(\"Enable outer-most padding (default if ImGuiTableFlags_BordersOuterV is set)\");\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_NoPadOuterX\", &flags1, ImGuiTableFlags_NoPadOuterX);\n        ImGui::SameLine(); HelpMarker(\"Disable outer-most padding (default if ImGuiTableFlags_BordersOuterV is not set)\");\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_NoPadInnerX\", &flags1, ImGuiTableFlags_NoPadInnerX);\n        ImGui::SameLine(); HelpMarker(\"Disable inner padding between columns (double inner padding if BordersOuterV is on, single inner padding if BordersOuterV is off)\");\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_BordersOuterV\", &flags1, ImGuiTableFlags_BordersOuterV);\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_BordersInnerV\", &flags1, ImGuiTableFlags_BordersInnerV);\n        static bool show_headers = false;\n        ImGui::Checkbox(\"show_headers\", &show_headers);\n        PopStyleCompact();\n\n        if (ImGui::BeginTable(\"table_padding\", 3, flags1))\n        {\n            if (show_headers)\n            {\n                ImGui::TableSetupColumn(\"One\");\n                ImGui::TableSetupColumn(\"Two\");\n                ImGui::TableSetupColumn(\"Three\");\n                ImGui::TableHeadersRow();\n            }\n\n            for (int row = 0; row < 5; row++)\n            {\n                ImGui::TableNextRow();\n                for (int column = 0; column < 3; column++)\n                {\n                    ImGui::TableSetColumnIndex(column);\n                    if (row == 0)\n                    {\n                        ImGui::Text(\"Avail %.2f\", ImGui::GetContentRegionAvail().x);\n                    }\n                    else\n                    {\n                        char buf[32];\n                        sprintf(buf, \"Hello %d,%d\", column, row);\n                        ImGui::Button(buf, ImVec2(-FLT_MIN, 0.0f));\n                    }\n                    //if (ImGui::TableGetColumnFlags() & ImGuiTableColumnFlags_IsHovered)\n                    //    ImGui::TableSetBgColor(ImGuiTableBgTarget_CellBg, IM_COL32(0, 100, 0, 255));\n                }\n            }\n            ImGui::EndTable();\n        }\n\n        // Second example: set style.CellPadding to (0.0) or a custom value.\n        // FIXME-TABLE: Vertical border effectively not displayed the same way as horizontal one...\n        HelpMarker(\"Setting style.CellPadding to (0,0) or a custom value.\");\n        static ImGuiTableFlags flags2 = ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg;\n        static ImVec2 cell_padding(0.0f, 0.0f);\n        static bool show_widget_frame_bg = true;\n\n        PushStyleCompact();\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_Borders\", &flags2, ImGuiTableFlags_Borders);\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_BordersH\", &flags2, ImGuiTableFlags_BordersH);\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_BordersV\", &flags2, ImGuiTableFlags_BordersV);\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_BordersInner\", &flags2, ImGuiTableFlags_BordersInner);\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_BordersOuter\", &flags2, ImGuiTableFlags_BordersOuter);\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_RowBg\", &flags2, ImGuiTableFlags_RowBg);\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_Resizable\", &flags2, ImGuiTableFlags_Resizable);\n        ImGui::Checkbox(\"show_widget_frame_bg\", &show_widget_frame_bg);\n        ImGui::SliderFloat2(\"CellPadding\", &cell_padding.x, 0.0f, 10.0f, \"%.0f\");\n        PopStyleCompact();\n\n        ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, cell_padding);\n        if (ImGui::BeginTable(\"table_padding_2\", 3, flags2))\n        {\n            static char text_bufs[3 * 5][16]; // Mini text storage for 3x5 cells\n            static bool init = true;\n            if (!show_widget_frame_bg)\n                ImGui::PushStyleColor(ImGuiCol_FrameBg, 0);\n            for (int cell = 0; cell < 3 * 5; cell++)\n            {\n                ImGui::TableNextColumn();\n                if (init)\n                    strcpy(text_bufs[cell], \"edit me\");\n                ImGui::SetNextItemWidth(-FLT_MIN);\n                ImGui::PushID(cell);\n                ImGui::InputText(\"##cell\", text_bufs[cell], IM_ARRAYSIZE(text_bufs[cell]));\n                ImGui::PopID();\n            }\n            if (!show_widget_frame_bg)\n                ImGui::PopStyleColor();\n            init = false;\n            ImGui::EndTable();\n        }\n        ImGui::PopStyleVar();\n\n        ImGui::TreePop();\n    }\n\n    if (open_action != -1)\n        ImGui::SetNextItemOpen(open_action != 0);\n    if (ImGui::TreeNode(\"Sizing policies\"))\n    {\n        static ImGuiTableFlags flags1 = ImGuiTableFlags_BordersV | ImGuiTableFlags_BordersOuterH | ImGuiTableFlags_RowBg | ImGuiTableFlags_ContextMenuInBody;\n        PushStyleCompact();\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_Resizable\", &flags1, ImGuiTableFlags_Resizable);\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_NoHostExtendX\", &flags1, ImGuiTableFlags_NoHostExtendX);\n        PopStyleCompact();\n\n        static ImGuiTableFlags sizing_policy_flags[4] = { ImGuiTableFlags_SizingFixedFit, ImGuiTableFlags_SizingFixedSame, ImGuiTableFlags_SizingStretchProp, ImGuiTableFlags_SizingStretchSame };\n        for (int table_n = 0; table_n < 4; table_n++)\n        {\n            ImGui::PushID(table_n);\n            ImGui::SetNextItemWidth(TEXT_BASE_WIDTH * 30);\n            EditTableSizingFlags(&sizing_policy_flags[table_n]);\n\n            // To make it easier to understand the different sizing policy,\n            // For each policy: we display one table where the columns have equal contents width, and one where the columns have different contents width.\n            if (ImGui::BeginTable(\"table1\", 3, sizing_policy_flags[table_n] | flags1))\n            {\n                for (int row = 0; row < 3; row++)\n                {\n                    ImGui::TableNextRow();\n                    ImGui::TableNextColumn(); ImGui::Text(\"Oh dear\");\n                    ImGui::TableNextColumn(); ImGui::Text(\"Oh dear\");\n                    ImGui::TableNextColumn(); ImGui::Text(\"Oh dear\");\n                }\n                ImGui::EndTable();\n            }\n            if (ImGui::BeginTable(\"table2\", 3, sizing_policy_flags[table_n] | flags1))\n            {\n                for (int row = 0; row < 3; row++)\n                {\n                    ImGui::TableNextRow();\n                    ImGui::TableNextColumn(); ImGui::Text(\"AAAA\");\n                    ImGui::TableNextColumn(); ImGui::Text(\"BBBBBBBB\");\n                    ImGui::TableNextColumn(); ImGui::Text(\"CCCCCCCCCCCC\");\n                }\n                ImGui::EndTable();\n            }\n            ImGui::PopID();\n        }\n\n        ImGui::Spacing();\n        ImGui::TextUnformatted(\"Advanced\");\n        ImGui::SameLine();\n        HelpMarker(\"This section allows you to interact and see the effect of various sizing policies depending on whether Scroll is enabled and the contents of your columns.\");\n\n        enum ContentsType { CT_ShowWidth, CT_ShortText, CT_LongText, CT_Button, CT_FillButton, CT_InputText };\n        static ImGuiTableFlags flags = ImGuiTableFlags_ScrollY | ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg | ImGuiTableFlags_Resizable;\n        static int contents_type = CT_ShowWidth;\n        static int column_count = 3;\n\n        PushStyleCompact();\n        ImGui::PushID(\"Advanced\");\n        ImGui::PushItemWidth(TEXT_BASE_WIDTH * 30);\n        EditTableSizingFlags(&flags);\n        ImGui::Combo(\"Contents\", &contents_type, \"Show width\\0Short Text\\0Long Text\\0Button\\0Fill Button\\0InputText\\0\");\n        if (contents_type == CT_FillButton)\n        {\n            ImGui::SameLine();\n            HelpMarker(\"Be mindful that using right-alignment (e.g. size.x = -FLT_MIN) creates a feedback loop where contents width can feed into auto-column width can feed into contents width.\");\n        }\n        ImGui::DragInt(\"Columns\", &column_count, 0.1f, 1, 64, \"%d\", ImGuiSliderFlags_AlwaysClamp);\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_Resizable\", &flags, ImGuiTableFlags_Resizable);\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_PreciseWidths\", &flags, ImGuiTableFlags_PreciseWidths);\n        ImGui::SameLine(); HelpMarker(\"Disable distributing remainder width to stretched columns (width allocation on a 100-wide table with 3 columns: Without this flag: 33,33,34. With this flag: 33,33,33). With larger number of columns, resizing will appear to be less smooth.\");\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_ScrollX\", &flags, ImGuiTableFlags_ScrollX);\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_ScrollY\", &flags, ImGuiTableFlags_ScrollY);\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_NoClip\", &flags, ImGuiTableFlags_NoClip);\n        ImGui::PopItemWidth();\n        ImGui::PopID();\n        PopStyleCompact();\n\n        if (ImGui::BeginTable(\"table2\", column_count, flags, ImVec2(0.0f, TEXT_BASE_HEIGHT * 7)))\n        {\n            for (int cell = 0; cell < 10 * column_count; cell++)\n            {\n                ImGui::TableNextColumn();\n                int column = ImGui::TableGetColumnIndex();\n                int row = ImGui::TableGetRowIndex();\n\n                ImGui::PushID(cell);\n                char label[32];\n                static char text_buf[32] = \"\";\n                sprintf(label, \"Hello %d,%d\", column, row);\n                switch (contents_type)\n                {\n                case CT_ShortText:  ImGui::TextUnformatted(label); break;\n                case CT_LongText:   ImGui::Text(\"Some %s text %d,%d\\nOver two lines..\", column == 0 ? \"long\" : \"longeeer\", column, row); break;\n                case CT_ShowWidth:  ImGui::Text(\"W: %.1f\", ImGui::GetContentRegionAvail().x); break;\n                case CT_Button:     ImGui::Button(label); break;\n                case CT_FillButton: ImGui::Button(label, ImVec2(-FLT_MIN, 0.0f)); break;\n                case CT_InputText:  ImGui::SetNextItemWidth(-FLT_MIN); ImGui::InputText(\"##\", text_buf, IM_ARRAYSIZE(text_buf)); break;\n                }\n                ImGui::PopID();\n            }\n            ImGui::EndTable();\n        }\n        ImGui::TreePop();\n    }\n\n    if (open_action != -1)\n        ImGui::SetNextItemOpen(open_action != 0);\n    if (ImGui::TreeNode(\"Vertical scrolling, with clipping\"))\n    {\n        HelpMarker(\"Here we activate ScrollY, which will create a child window container to allow hosting scrollable contents.\\n\\nWe also demonstrate using ImGuiListClipper to virtualize the submission of many items.\");\n        static ImGuiTableFlags flags = ImGuiTableFlags_ScrollY | ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersV | ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable;\n\n        PushStyleCompact();\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_ScrollY\", &flags, ImGuiTableFlags_ScrollY);\n        PopStyleCompact();\n\n        // When using ScrollX or ScrollY we need to specify a size for our table container!\n        // Otherwise by default the table will fit all available space, like a BeginChild() call.\n        ImVec2 outer_size = ImVec2(0.0f, TEXT_BASE_HEIGHT * 8);\n        if (ImGui::BeginTable(\"table_scrolly\", 3, flags, outer_size))\n        {\n            ImGui::TableSetupScrollFreeze(0, 1); // Make top row always visible\n            ImGui::TableSetupColumn(\"One\", ImGuiTableColumnFlags_None);\n            ImGui::TableSetupColumn(\"Two\", ImGuiTableColumnFlags_None);\n            ImGui::TableSetupColumn(\"Three\", ImGuiTableColumnFlags_None);\n            ImGui::TableHeadersRow();\n\n            // Demonstrate using clipper for large vertical lists\n            ImGuiListClipper clipper;\n            clipper.Begin(1000);\n            while (clipper.Step())\n            {\n                for (int row = clipper.DisplayStart; row < clipper.DisplayEnd; row++)\n                {\n                    ImGui::TableNextRow();\n                    for (int column = 0; column < 3; column++)\n                    {\n                        ImGui::TableSetColumnIndex(column);\n                        ImGui::Text(\"Hello %d,%d\", column, row);\n                    }\n                }\n            }\n            ImGui::EndTable();\n        }\n        ImGui::TreePop();\n    }\n\n    if (open_action != -1)\n        ImGui::SetNextItemOpen(open_action != 0);\n    if (ImGui::TreeNode(\"Horizontal scrolling\"))\n    {\n        HelpMarker(\n            \"When ScrollX is enabled, the default sizing policy becomes ImGuiTableFlags_SizingFixedFit, \"\n            \"as automatically stretching columns doesn't make much sense with horizontal scrolling.\\n\\n\"\n            \"Also note that as of the current version, you will almost always want to enable ScrollY along with ScrollX,\"\n            \"because the container window won't automatically extend vertically to fix contents (this may be improved in future versions).\");\n        static ImGuiTableFlags flags = ImGuiTableFlags_ScrollX | ImGuiTableFlags_ScrollY | ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersV | ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable;\n        static int freeze_cols = 1;\n        static int freeze_rows = 1;\n\n        PushStyleCompact();\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_Resizable\", &flags, ImGuiTableFlags_Resizable);\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_ScrollX\", &flags, ImGuiTableFlags_ScrollX);\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_ScrollY\", &flags, ImGuiTableFlags_ScrollY);\n        ImGui::SetNextItemWidth(ImGui::GetFrameHeight());\n        ImGui::DragInt(\"freeze_cols\", &freeze_cols, 0.2f, 0, 9, NULL, ImGuiSliderFlags_NoInput);\n        ImGui::SetNextItemWidth(ImGui::GetFrameHeight());\n        ImGui::DragInt(\"freeze_rows\", &freeze_rows, 0.2f, 0, 9, NULL, ImGuiSliderFlags_NoInput);\n        PopStyleCompact();\n\n        // When using ScrollX or ScrollY we need to specify a size for our table container!\n        // Otherwise by default the table will fit all available space, like a BeginChild() call.\n        ImVec2 outer_size = ImVec2(0.0f, TEXT_BASE_HEIGHT * 8);\n        if (ImGui::BeginTable(\"table_scrollx\", 7, flags, outer_size))\n        {\n            ImGui::TableSetupScrollFreeze(freeze_cols, freeze_rows);\n            ImGui::TableSetupColumn(\"Line #\", ImGuiTableColumnFlags_NoHide); // Make the first column not hideable to match our use of TableSetupScrollFreeze()\n            ImGui::TableSetupColumn(\"One\");\n            ImGui::TableSetupColumn(\"Two\");\n            ImGui::TableSetupColumn(\"Three\");\n            ImGui::TableSetupColumn(\"Four\");\n            ImGui::TableSetupColumn(\"Five\");\n            ImGui::TableSetupColumn(\"Six\");\n            ImGui::TableHeadersRow();\n            for (int row = 0; row < 20; row++)\n            {\n                ImGui::TableNextRow();\n                for (int column = 0; column < 7; column++)\n                {\n                    // Both TableNextColumn() and TableSetColumnIndex() return true when a column is visible or performing width measurement.\n                    // Because here we know that:\n                    // - A) all our columns are contributing the same to row height\n                    // - B) column 0 is always visible,\n                    // We only always submit this one column and can skip others.\n                    // More advanced per-column clipping behaviors may benefit from polling the status flags via TableGetColumnFlags().\n                    if (!ImGui::TableSetColumnIndex(column) && column > 0)\n                        continue;\n                    if (column == 0)\n                        ImGui::Text(\"Line %d\", row);\n                    else\n                        ImGui::Text(\"Hello world %d,%d\", column, row);\n                }\n            }\n            ImGui::EndTable();\n        }\n\n        ImGui::Spacing();\n        ImGui::TextUnformatted(\"Stretch + ScrollX\");\n        ImGui::SameLine();\n        HelpMarker(\n            \"Showcase using Stretch columns + ScrollX together: \"\n            \"this is rather unusual and only makes sense when specifying an 'inner_width' for the table!\\n\"\n            \"Without an explicit value, inner_width is == outer_size.x and therefore using Stretch columns + ScrollX together doesn't make sense.\");\n        static ImGuiTableFlags flags2 = ImGuiTableFlags_SizingStretchSame | ImGuiTableFlags_ScrollX | ImGuiTableFlags_ScrollY | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_RowBg | ImGuiTableFlags_ContextMenuInBody;\n        static float inner_width = 1000.0f;\n        PushStyleCompact();\n        ImGui::PushID(\"flags3\");\n        ImGui::PushItemWidth(TEXT_BASE_WIDTH * 30);\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_ScrollX\", &flags2, ImGuiTableFlags_ScrollX);\n        ImGui::DragFloat(\"inner_width\", &inner_width, 1.0f, 0.0f, FLT_MAX, \"%.1f\");\n        ImGui::PopItemWidth();\n        ImGui::PopID();\n        PopStyleCompact();\n        if (ImGui::BeginTable(\"table2\", 7, flags2, outer_size, inner_width))\n        {\n            for (int cell = 0; cell < 20 * 7; cell++)\n            {\n                ImGui::TableNextColumn();\n                ImGui::Text(\"Hello world %d,%d\", ImGui::TableGetColumnIndex(), ImGui::TableGetRowIndex());\n            }\n            ImGui::EndTable();\n        }\n        ImGui::TreePop();\n    }\n\n    if (open_action != -1)\n        ImGui::SetNextItemOpen(open_action != 0);\n    if (ImGui::TreeNode(\"Columns flags\"))\n    {\n        // Create a first table just to show all the options/flags we want to make visible in our example!\n        const int column_count = 3;\n        const char* column_names[column_count] = { \"One\", \"Two\", \"Three\" };\n        static ImGuiTableColumnFlags column_flags[column_count] = { ImGuiTableColumnFlags_DefaultSort, ImGuiTableColumnFlags_None, ImGuiTableColumnFlags_DefaultHide };\n        static ImGuiTableColumnFlags column_flags_out[column_count] = { 0, 0, 0 }; // Output from TableGetColumnFlags()\n\n        if (ImGui::BeginTable(\"table_columns_flags_checkboxes\", column_count, ImGuiTableFlags_None))\n        {\n            PushStyleCompact();\n            for (int column = 0; column < column_count; column++)\n            {\n                ImGui::TableNextColumn();\n                ImGui::PushID(column);\n                ImGui::AlignTextToFramePadding(); // FIXME-TABLE: Workaround for wrong text baseline propagation\n                ImGui::Text(\"'%s'\", column_names[column]);\n                ImGui::Spacing();\n                ImGui::Text(\"Input flags:\");\n                EditTableColumnsFlags(&column_flags[column]);\n                ImGui::Spacing();\n                ImGui::Text(\"Output flags:\");\n                ShowTableColumnsStatusFlags(column_flags_out[column]);\n                ImGui::PopID();\n            }\n            PopStyleCompact();\n            ImGui::EndTable();\n        }\n\n        // Create the real table we care about for the example!\n        // We use a scrolling table to be able to showcase the difference between the _IsEnabled and _IsVisible flags above, otherwise in\n        // a non-scrolling table columns are always visible (unless using ImGuiTableFlags_NoKeepColumnsVisible + resizing the parent window down)\n        const ImGuiTableFlags flags\n            = ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_ScrollX | ImGuiTableFlags_ScrollY\n            | ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersV\n            | ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable | ImGuiTableFlags_Sortable;\n        ImVec2 outer_size = ImVec2(0.0f, TEXT_BASE_HEIGHT * 9);\n        if (ImGui::BeginTable(\"table_columns_flags\", column_count, flags, outer_size))\n        {\n            for (int column = 0; column < column_count; column++)\n                ImGui::TableSetupColumn(column_names[column], column_flags[column]);\n            ImGui::TableHeadersRow();\n            for (int column = 0; column < column_count; column++)\n                column_flags_out[column] = ImGui::TableGetColumnFlags(column);\n            float indent_step = (float)((int)TEXT_BASE_WIDTH / 2);\n            for (int row = 0; row < 8; row++)\n            {\n                ImGui::Indent(indent_step); // Add some indentation to demonstrate usage of per-column IndentEnable/IndentDisable flags.\n                ImGui::TableNextRow();\n                for (int column = 0; column < column_count; column++)\n                {\n                    ImGui::TableSetColumnIndex(column);\n                    ImGui::Text(\"%s %s\", (column == 0) ? \"Indented\" : \"Hello\", ImGui::TableGetColumnName(column));\n                }\n            }\n            ImGui::Unindent(indent_step * 8.0f);\n\n            ImGui::EndTable();\n        }\n        ImGui::TreePop();\n    }\n\n    if (open_action != -1)\n        ImGui::SetNextItemOpen(open_action != 0);\n    if (ImGui::TreeNode(\"Columns widths\"))\n    {\n        HelpMarker(\"Using TableSetupColumn() to setup default width.\");\n\n        static ImGuiTableFlags flags1 = ImGuiTableFlags_Borders | ImGuiTableFlags_NoBordersInBodyUntilResize;\n        PushStyleCompact();\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_Resizable\", &flags1, ImGuiTableFlags_Resizable);\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_NoBordersInBodyUntilResize\", &flags1, ImGuiTableFlags_NoBordersInBodyUntilResize);\n        PopStyleCompact();\n        if (ImGui::BeginTable(\"table1\", 3, flags1))\n        {\n            // We could also set ImGuiTableFlags_SizingFixedFit on the table and all columns will default to ImGuiTableColumnFlags_WidthFixed.\n            ImGui::TableSetupColumn(\"one\", ImGuiTableColumnFlags_WidthFixed, 100.0f); // Default to 100.0f\n            ImGui::TableSetupColumn(\"two\", ImGuiTableColumnFlags_WidthFixed, 200.0f); // Default to 200.0f\n            ImGui::TableSetupColumn(\"three\", ImGuiTableColumnFlags_WidthFixed);       // Default to auto\n            ImGui::TableHeadersRow();\n            for (int row = 0; row < 4; row++)\n            {\n                ImGui::TableNextRow();\n                for (int column = 0; column < 3; column++)\n                {\n                    ImGui::TableSetColumnIndex(column);\n                    if (row == 0)\n                        ImGui::Text(\"(w: %5.1f)\", ImGui::GetContentRegionAvail().x);\n                    else\n                        ImGui::Text(\"Hello %d,%d\", column, row);\n                }\n            }\n            ImGui::EndTable();\n        }\n\n        HelpMarker(\"Using TableSetupColumn() to setup explicit width.\\n\\nUnless _NoKeepColumnsVisible is set, fixed columns with set width may still be shrunk down if there's not enough space in the host.\");\n\n        static ImGuiTableFlags flags2 = ImGuiTableFlags_None;\n        PushStyleCompact();\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_NoKeepColumnsVisible\", &flags2, ImGuiTableFlags_NoKeepColumnsVisible);\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_BordersInnerV\", &flags2, ImGuiTableFlags_BordersInnerV);\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_BordersOuterV\", &flags2, ImGuiTableFlags_BordersOuterV);\n        PopStyleCompact();\n        if (ImGui::BeginTable(\"table2\", 4, flags2))\n        {\n            // We could also set ImGuiTableFlags_SizingFixedFit on the table and all columns will default to ImGuiTableColumnFlags_WidthFixed.\n            ImGui::TableSetupColumn(\"\", ImGuiTableColumnFlags_WidthFixed, 100.0f);\n            ImGui::TableSetupColumn(\"\", ImGuiTableColumnFlags_WidthFixed, TEXT_BASE_WIDTH * 15.0f);\n            ImGui::TableSetupColumn(\"\", ImGuiTableColumnFlags_WidthFixed, TEXT_BASE_WIDTH * 30.0f);\n            ImGui::TableSetupColumn(\"\", ImGuiTableColumnFlags_WidthFixed, TEXT_BASE_WIDTH * 15.0f);\n            for (int row = 0; row < 5; row++)\n            {\n                ImGui::TableNextRow();\n                for (int column = 0; column < 4; column++)\n                {\n                    ImGui::TableSetColumnIndex(column);\n                    if (row == 0)\n                        ImGui::Text(\"(w: %5.1f)\", ImGui::GetContentRegionAvail().x);\n                    else\n                        ImGui::Text(\"Hello %d,%d\", column, row);\n                }\n            }\n            ImGui::EndTable();\n        }\n        ImGui::TreePop();\n    }\n\n    if (open_action != -1)\n        ImGui::SetNextItemOpen(open_action != 0);\n    if (ImGui::TreeNode(\"Nested tables\"))\n    {\n        HelpMarker(\"This demonstrate embedding a table into another table cell.\");\n\n        if (ImGui::BeginTable(\"table_nested1\", 2, ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable))\n        {\n            ImGui::TableSetupColumn(\"A0\");\n            ImGui::TableSetupColumn(\"A1\");\n            ImGui::TableHeadersRow();\n\n            ImGui::TableNextColumn();\n            ImGui::Text(\"A0 Row 0\");\n            {\n                float rows_height = TEXT_BASE_HEIGHT * 2;\n                if (ImGui::BeginTable(\"table_nested2\", 2, ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable))\n                {\n                    ImGui::TableSetupColumn(\"B0\");\n                    ImGui::TableSetupColumn(\"B1\");\n                    ImGui::TableHeadersRow();\n\n                    ImGui::TableNextRow(ImGuiTableRowFlags_None, rows_height);\n                    ImGui::TableNextColumn();\n                    ImGui::Text(\"B0 Row 0\");\n                    ImGui::TableNextColumn();\n                    ImGui::Text(\"B1 Row 0\");\n                    ImGui::TableNextRow(ImGuiTableRowFlags_None, rows_height);\n                    ImGui::TableNextColumn();\n                    ImGui::Text(\"B0 Row 1\");\n                    ImGui::TableNextColumn();\n                    ImGui::Text(\"B1 Row 1\");\n\n                    ImGui::EndTable();\n                }\n            }\n            ImGui::TableNextColumn(); ImGui::Text(\"A1 Row 0\");\n            ImGui::TableNextColumn(); ImGui::Text(\"A0 Row 1\");\n            ImGui::TableNextColumn(); ImGui::Text(\"A1 Row 1\");\n            ImGui::EndTable();\n        }\n        ImGui::TreePop();\n    }\n\n    if (open_action != -1)\n        ImGui::SetNextItemOpen(open_action != 0);\n    if (ImGui::TreeNode(\"Row height\"))\n    {\n        HelpMarker(\"You can pass a 'min_row_height' to TableNextRow().\\n\\nRows are padded with 'style.CellPadding.y' on top and bottom, so effectively the minimum row height will always be >= 'style.CellPadding.y * 2.0f'.\\n\\nWe cannot honor a _maximum_ row height as that would requires a unique clipping rectangle per row.\");\n        if (ImGui::BeginTable(\"table_row_height\", 1, ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersInnerV))\n        {\n            for (int row = 0; row < 10; row++)\n            {\n                float min_row_height = (float)(int)(TEXT_BASE_HEIGHT * 0.30f * row);\n                ImGui::TableNextRow(ImGuiTableRowFlags_None, min_row_height);\n                ImGui::TableNextColumn();\n                ImGui::Text(\"min_row_height = %.2f\", min_row_height);\n            }\n            ImGui::EndTable();\n        }\n        ImGui::TreePop();\n    }\n\n    if (open_action != -1)\n        ImGui::SetNextItemOpen(open_action != 0);\n    if (ImGui::TreeNode(\"Outer size\"))\n    {\n        // Showcasing use of ImGuiTableFlags_NoHostExtendX and ImGuiTableFlags_NoHostExtendY\n        // Important to that note how the two flags have slightly different behaviors!\n        ImGui::Text(\"Using NoHostExtendX and NoHostExtendY:\");\n        PushStyleCompact();\n        static ImGuiTableFlags flags = ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_ContextMenuInBody | ImGuiTableFlags_RowBg | ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_NoHostExtendX;\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_NoHostExtendX\", &flags, ImGuiTableFlags_NoHostExtendX);\n        ImGui::SameLine(); HelpMarker(\"Make outer width auto-fit to columns, overriding outer_size.x value.\\n\\nOnly available when ScrollX/ScrollY are disabled and Stretch columns are not used.\");\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_NoHostExtendY\", &flags, ImGuiTableFlags_NoHostExtendY);\n        ImGui::SameLine(); HelpMarker(\"Make outer height stop exactly at outer_size.y (prevent auto-extending table past the limit).\\n\\nOnly available when ScrollX/ScrollY are disabled. Data below the limit will be clipped and not visible.\");\n        PopStyleCompact();\n\n        ImVec2 outer_size = ImVec2(0.0f, TEXT_BASE_HEIGHT * 5.5f);\n        if (ImGui::BeginTable(\"table1\", 3, flags, outer_size))\n        {\n            for (int row = 0; row < 10; row++)\n            {\n                ImGui::TableNextRow();\n                for (int column = 0; column < 3; column++)\n                {\n                    ImGui::TableNextColumn();\n                    ImGui::Text(\"Cell %d,%d\", column, row);\n                }\n            }\n            ImGui::EndTable();\n        }\n        ImGui::SameLine();\n        ImGui::Text(\"Hello!\");\n\n        ImGui::Spacing();\n\n        ImGui::Text(\"Using explicit size:\");\n        if (ImGui::BeginTable(\"table2\", 3, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg, ImVec2(TEXT_BASE_WIDTH * 30, 0.0f)))\n        {\n            for (int row = 0; row < 5; row++)\n            {\n                ImGui::TableNextRow();\n                for (int column = 0; column < 3; column++)\n                {\n                    ImGui::TableNextColumn();\n                    ImGui::Text(\"Cell %d,%d\", column, row);\n                }\n            }\n            ImGui::EndTable();\n        }\n        ImGui::SameLine();\n        if (ImGui::BeginTable(\"table3\", 3, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg, ImVec2(TEXT_BASE_WIDTH * 30, 0.0f)))\n        {\n            for (int row = 0; row < 3; row++)\n            {\n                ImGui::TableNextRow(0, TEXT_BASE_HEIGHT * 1.5f);\n                for (int column = 0; column < 3; column++)\n                {\n                    ImGui::TableNextColumn();\n                    ImGui::Text(\"Cell %d,%d\", column, row);\n                }\n            }\n            ImGui::EndTable();\n        }\n\n        ImGui::TreePop();\n    }\n\n    if (open_action != -1)\n        ImGui::SetNextItemOpen(open_action != 0);\n    if (ImGui::TreeNode(\"Background color\"))\n    {\n        static ImGuiTableFlags flags = ImGuiTableFlags_RowBg;\n        static int row_bg_type = 1;\n        static int row_bg_target = 1;\n        static int cell_bg_type = 1;\n\n        PushStyleCompact();\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_Borders\", &flags, ImGuiTableFlags_Borders);\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_RowBg\", &flags, ImGuiTableFlags_RowBg);\n        ImGui::SameLine(); HelpMarker(\"ImGuiTableFlags_RowBg automatically sets RowBg0 to alternative colors pulled from the Style.\");\n        ImGui::Combo(\"row bg type\", (int*)&row_bg_type, \"None\\0Red\\0Gradient\\0\");\n        ImGui::Combo(\"row bg target\", (int*)&row_bg_target, \"RowBg0\\0RowBg1\\0\"); ImGui::SameLine(); HelpMarker(\"Target RowBg0 to override the alternating odd/even colors,\\nTarget RowBg1 to blend with them.\");\n        ImGui::Combo(\"cell bg type\", (int*)&cell_bg_type, \"None\\0Blue\\0\"); ImGui::SameLine(); HelpMarker(\"We are colorizing cells to B1->C2 here.\");\n        IM_ASSERT(row_bg_type >= 0 && row_bg_type <= 2);\n        IM_ASSERT(row_bg_target >= 0 && row_bg_target <= 1);\n        IM_ASSERT(cell_bg_type >= 0 && cell_bg_type <= 1);\n        PopStyleCompact();\n\n        if (ImGui::BeginTable(\"table1\", 5, flags))\n        {\n            for (int row = 0; row < 6; row++)\n            {\n                ImGui::TableNextRow();\n\n                // Demonstrate setting a row background color with 'ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBgX, ...)'\n                // We use a transparent color so we can see the one behind in case our target is RowBg1 and RowBg0 was already targeted by the ImGuiTableFlags_RowBg flag.\n                if (row_bg_type != 0)\n                {\n                    ImU32 row_bg_color = ImGui::GetColorU32(row_bg_type == 1 ? ImVec4(0.7f, 0.3f, 0.3f, 0.65f) : ImVec4(0.2f + row * 0.1f, 0.2f, 0.2f, 0.65f)); // Flat or Gradient?\n                    ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0 + row_bg_target, row_bg_color);\n                }\n\n                // Fill cells\n                for (int column = 0; column < 5; column++)\n                {\n                    ImGui::TableSetColumnIndex(column);\n                    ImGui::Text(\"%c%c\", 'A' + row, '0' + column);\n\n                    // Change background of Cells B1->C2\n                    // Demonstrate setting a cell background color with 'ImGui::TableSetBgColor(ImGuiTableBgTarget_CellBg, ...)'\n                    // (the CellBg color will be blended over the RowBg and ColumnBg colors)\n                    // We can also pass a column number as a third parameter to TableSetBgColor() and do this outside the column loop.\n                    if (row >= 1 && row <= 2 && column >= 1 && column <= 2 && cell_bg_type == 1)\n                    {\n                        ImU32 cell_bg_color = ImGui::GetColorU32(ImVec4(0.3f, 0.3f, 0.7f, 0.65f));\n                        ImGui::TableSetBgColor(ImGuiTableBgTarget_CellBg, cell_bg_color);\n                    }\n                }\n            }\n            ImGui::EndTable();\n        }\n        ImGui::TreePop();\n    }\n\n    if (open_action != -1)\n        ImGui::SetNextItemOpen(open_action != 0);\n    if (ImGui::TreeNode(\"Tree view\"))\n    {\n        static ImGuiTableFlags flags = ImGuiTableFlags_BordersV | ImGuiTableFlags_BordersOuterH | ImGuiTableFlags_Resizable | ImGuiTableFlags_RowBg | ImGuiTableFlags_NoBordersInBody;\n\n        if (ImGui::BeginTable(\"3ways\", 3, flags))\n        {\n            // The first column will use the default _WidthStretch when ScrollX is Off and _WidthFixed when ScrollX is On\n            ImGui::TableSetupColumn(\"Name\", ImGuiTableColumnFlags_NoHide);\n            ImGui::TableSetupColumn(\"Size\", ImGuiTableColumnFlags_WidthFixed, TEXT_BASE_WIDTH * 12.0f);\n            ImGui::TableSetupColumn(\"Type\", ImGuiTableColumnFlags_WidthFixed, TEXT_BASE_WIDTH * 18.0f);\n            ImGui::TableHeadersRow();\n\n            // Simple storage to output a dummy file-system.\n            struct MyTreeNode\n            {\n                const char*     Name;\n                const char*     Type;\n                int             Size;\n                int             ChildIdx;\n                int             ChildCount;\n                static void DisplayNode(const MyTreeNode* node, const MyTreeNode* all_nodes)\n                {\n                    ImGui::TableNextRow();\n                    ImGui::TableNextColumn();\n                    const bool is_folder = (node->ChildCount > 0);\n                    if (is_folder)\n                    {\n                        bool open = ImGui::TreeNodeEx(node->Name, ImGuiTreeNodeFlags_SpanFullWidth);\n                        ImGui::TableNextColumn();\n                        ImGui::TextDisabled(\"--\");\n                        ImGui::TableNextColumn();\n                        ImGui::TextUnformatted(node->Type);\n                        if (open)\n                        {\n                            for (int child_n = 0; child_n < node->ChildCount; child_n++)\n                                DisplayNode(&all_nodes[node->ChildIdx + child_n], all_nodes);\n                            ImGui::TreePop();\n                        }\n                    }\n                    else\n                    {\n                        ImGui::TreeNodeEx(node->Name, ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_Bullet | ImGuiTreeNodeFlags_NoTreePushOnOpen | ImGuiTreeNodeFlags_SpanFullWidth);\n                        ImGui::TableNextColumn();\n                        ImGui::Text(\"%d\", node->Size);\n                        ImGui::TableNextColumn();\n                        ImGui::TextUnformatted(node->Type);\n                    }\n                }\n            };\n            static const MyTreeNode nodes[] =\n            {\n                { \"Root\",                         \"Folder\",       -1,       1, 3    }, // 0\n                { \"Music\",                        \"Folder\",       -1,       4, 2    }, // 1\n                { \"Textures\",                     \"Folder\",       -1,       6, 3    }, // 2\n                { \"desktop.ini\",                  \"System file\",  1024,    -1,-1    }, // 3\n                { \"File1_a.wav\",                  \"Audio file\",   123000,  -1,-1    }, // 4\n                { \"File1_b.wav\",                  \"Audio file\",   456000,  -1,-1    }, // 5\n                { \"Image001.png\",                 \"Image file\",   203128,  -1,-1    }, // 6\n                { \"Copy of Image001.png\",         \"Image file\",   203256,  -1,-1    }, // 7\n                { \"Copy of Image001 (Final2).png\",\"Image file\",   203512,  -1,-1    }, // 8\n            };\n\n            MyTreeNode::DisplayNode(&nodes[0], nodes);\n\n            ImGui::EndTable();\n        }\n        ImGui::TreePop();\n    }\n\n    if (open_action != -1)\n        ImGui::SetNextItemOpen(open_action != 0);\n    if (ImGui::TreeNode(\"Item width\"))\n    {\n        HelpMarker(\n            \"Showcase using PushItemWidth() and how it is preserved on a per-column basis.\\n\\n\"\n            \"Note that on auto-resizing non-resizable fixed columns, querying the content width for e.g. right-alignment doesn't make sense.\");\n        if (ImGui::BeginTable(\"table_item_width\", 3, ImGuiTableFlags_Borders))\n        {\n            ImGui::TableSetupColumn(\"small\");\n            ImGui::TableSetupColumn(\"half\");\n            ImGui::TableSetupColumn(\"right-align\");\n            ImGui::TableHeadersRow();\n\n            for (int row = 0; row < 3; row++)\n            {\n                ImGui::TableNextRow();\n                if (row == 0)\n                {\n                    // Setup ItemWidth once (instead of setting up every time, which is also possible but less efficient)\n                    ImGui::TableSetColumnIndex(0);\n                    ImGui::PushItemWidth(TEXT_BASE_WIDTH * 3.0f); // Small\n                    ImGui::TableSetColumnIndex(1);\n                    ImGui::PushItemWidth(-ImGui::GetContentRegionAvail().x * 0.5f);\n                    ImGui::TableSetColumnIndex(2);\n                    ImGui::PushItemWidth(-FLT_MIN); // Right-aligned\n                }\n\n                // Draw our contents\n                static float dummy_f = 0.0f;\n                ImGui::PushID(row);\n                ImGui::TableSetColumnIndex(0);\n                ImGui::SliderFloat(\"float0\", &dummy_f, 0.0f, 1.0f);\n                ImGui::TableSetColumnIndex(1);\n                ImGui::SliderFloat(\"float1\", &dummy_f, 0.0f, 1.0f);\n                ImGui::TableSetColumnIndex(2);\n                ImGui::SliderFloat(\"float2\", &dummy_f, 0.0f, 1.0f);\n                ImGui::PopID();\n            }\n            ImGui::EndTable();\n        }\n        ImGui::TreePop();\n    }\n\n    // Demonstrate using TableHeader() calls instead of TableHeadersRow()\n    if (open_action != -1)\n        ImGui::SetNextItemOpen(open_action != 0);\n    if (ImGui::TreeNode(\"Custom headers\"))\n    {\n        const int COLUMNS_COUNT = 3;\n        if (ImGui::BeginTable(\"table_custom_headers\", COLUMNS_COUNT, ImGuiTableFlags_Borders | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable))\n        {\n            ImGui::TableSetupColumn(\"Apricot\");\n            ImGui::TableSetupColumn(\"Banana\");\n            ImGui::TableSetupColumn(\"Cherry\");\n\n            // Dummy entire-column selection storage\n            // FIXME: It would be nice to actually demonstrate full-featured selection using those checkbox.\n            static bool column_selected[3] = {};\n\n            // Instead of calling TableHeadersRow() we'll submit custom headers ourselves\n            ImGui::TableNextRow(ImGuiTableRowFlags_Headers);\n            for (int column = 0; column < COLUMNS_COUNT; column++)\n            {\n                ImGui::TableSetColumnIndex(column);\n                const char* column_name = ImGui::TableGetColumnName(column); // Retrieve name passed to TableSetupColumn()\n                ImGui::PushID(column);\n                ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));\n                ImGui::Checkbox(\"##checkall\", &column_selected[column]);\n                ImGui::PopStyleVar();\n                ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);\n                ImGui::TableHeader(column_name);\n                ImGui::PopID();\n            }\n\n            for (int row = 0; row < 5; row++)\n            {\n                ImGui::TableNextRow();\n                for (int column = 0; column < 3; column++)\n                {\n                    char buf[32];\n                    sprintf(buf, \"Cell %d,%d\", column, row);\n                    ImGui::TableSetColumnIndex(column);\n                    ImGui::Selectable(buf, column_selected[column]);\n                }\n            }\n            ImGui::EndTable();\n        }\n        ImGui::TreePop();\n    }\n\n    // Demonstrate creating custom context menus inside columns, while playing it nice with context menus provided by TableHeadersRow()/TableHeader()\n    if (open_action != -1)\n        ImGui::SetNextItemOpen(open_action != 0);\n    if (ImGui::TreeNode(\"Context menus\"))\n    {\n        HelpMarker(\"By default, right-clicking over a TableHeadersRow()/TableHeader() line will open the default context-menu.\\nUsing ImGuiTableFlags_ContextMenuInBody we also allow right-clicking over columns body.\");\n        static ImGuiTableFlags flags1 = ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable | ImGuiTableFlags_Borders | ImGuiTableFlags_ContextMenuInBody;\n\n        PushStyleCompact();\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_ContextMenuInBody\", &flags1, ImGuiTableFlags_ContextMenuInBody);\n        PopStyleCompact();\n\n        // Context Menus: first example\n        // [1.1] Right-click on the TableHeadersRow() line to open the default table context menu.\n        // [1.2] Right-click in columns also open the default table context menu (if ImGuiTableFlags_ContextMenuInBody is set)\n        const int COLUMNS_COUNT = 3;\n        if (ImGui::BeginTable(\"table_context_menu\", COLUMNS_COUNT, flags1))\n        {\n            ImGui::TableSetupColumn(\"One\");\n            ImGui::TableSetupColumn(\"Two\");\n            ImGui::TableSetupColumn(\"Three\");\n\n            // [1.1]] Right-click on the TableHeadersRow() line to open the default table context menu.\n            ImGui::TableHeadersRow();\n\n            // Submit dummy contents\n            for (int row = 0; row < 4; row++)\n            {\n                ImGui::TableNextRow();\n                for (int column = 0; column < COLUMNS_COUNT; column++)\n                {\n                    ImGui::TableSetColumnIndex(column);\n                    ImGui::Text(\"Cell %d,%d\", column, row);\n                }\n            }\n            ImGui::EndTable();\n        }\n\n        // Context Menus: second example\n        // [2.1] Right-click on the TableHeadersRow() line to open the default table context menu.\n        // [2.2] Right-click on the \"..\" to open a custom popup\n        // [2.3] Right-click in columns to open another custom popup\n        HelpMarker(\"Demonstrate mixing table context menu (over header), item context button (over button) and custom per-colum context menu (over column body).\");\n        ImGuiTableFlags flags2 = ImGuiTableFlags_Resizable | ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable | ImGuiTableFlags_Borders;\n        if (ImGui::BeginTable(\"table_context_menu_2\", COLUMNS_COUNT, flags2))\n        {\n            ImGui::TableSetupColumn(\"One\");\n            ImGui::TableSetupColumn(\"Two\");\n            ImGui::TableSetupColumn(\"Three\");\n\n            // [2.1] Right-click on the TableHeadersRow() line to open the default table context menu.\n            ImGui::TableHeadersRow();\n            for (int row = 0; row < 4; row++)\n            {\n                ImGui::TableNextRow();\n                for (int column = 0; column < COLUMNS_COUNT; column++)\n                {\n                    // Submit dummy contents\n                    ImGui::TableSetColumnIndex(column);\n                    ImGui::Text(\"Cell %d,%d\", column, row);\n                    ImGui::SameLine();\n\n                    // [2.2] Right-click on the \"..\" to open a custom popup\n                    ImGui::PushID(row * COLUMNS_COUNT + column);\n                    ImGui::SmallButton(\"..\");\n                    if (ImGui::BeginPopupContextItem())\n                    {\n                        ImGui::Text(\"This is the popup for Button(\\\"..\\\") in Cell %d,%d\", column, row);\n                        if (ImGui::Button(\"Close\"))\n                            ImGui::CloseCurrentPopup();\n                        ImGui::EndPopup();\n                    }\n                    ImGui::PopID();\n                }\n            }\n\n            // [2.3] Right-click anywhere in columns to open another custom popup\n            // (instead of testing for !IsAnyItemHovered() we could also call OpenPopup() with ImGuiPopupFlags_NoOpenOverExistingPopup\n            // to manage popup priority as the popups triggers, here \"are we hovering a column\" are overlapping)\n            int hovered_column = -1;\n            for (int column = 0; column < COLUMNS_COUNT + 1; column++)\n            {\n                ImGui::PushID(column);\n                if (ImGui::TableGetColumnFlags(column) & ImGuiTableColumnFlags_IsHovered)\n                    hovered_column = column;\n                if (hovered_column == column && !ImGui::IsAnyItemHovered() && ImGui::IsMouseReleased(1))\n                    ImGui::OpenPopup(\"MyPopup\");\n                if (ImGui::BeginPopup(\"MyPopup\"))\n                {\n                    if (column == COLUMNS_COUNT)\n                        ImGui::Text(\"This is a custom popup for unused space after the last column.\");\n                    else\n                        ImGui::Text(\"This is a custom popup for Column %d\", column);\n                    if (ImGui::Button(\"Close\"))\n                        ImGui::CloseCurrentPopup();\n                    ImGui::EndPopup();\n                }\n                ImGui::PopID();\n            }\n\n            ImGui::EndTable();\n            ImGui::Text(\"Hovered column: %d\", hovered_column);\n        }\n        ImGui::TreePop();\n    }\n\n    // Demonstrate creating multiple tables with the same ID\n    if (open_action != -1)\n        ImGui::SetNextItemOpen(open_action != 0);\n    if (ImGui::TreeNode(\"Synced instances\"))\n    {\n        HelpMarker(\"Multiple tables with the same identifier will share their settings, width, visibility, order etc.\");\n        for (int n = 0; n < 3; n++)\n        {\n            char buf[32];\n            sprintf(buf, \"Synced Table %d\", n);\n            bool open = ImGui::CollapsingHeader(buf, ImGuiTreeNodeFlags_DefaultOpen);\n            if (open && ImGui::BeginTable(\"Table\", 3, ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable | ImGuiTableFlags_Borders | ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_NoSavedSettings))\n            {\n                ImGui::TableSetupColumn(\"One\");\n                ImGui::TableSetupColumn(\"Two\");\n                ImGui::TableSetupColumn(\"Three\");\n                ImGui::TableHeadersRow();\n                for (int cell = 0; cell < 9; cell++)\n                {\n                    ImGui::TableNextColumn();\n                    ImGui::Text(\"this cell %d\", cell);\n                }\n                ImGui::EndTable();\n            }\n        }\n        ImGui::TreePop();\n    }\n\n    // Demonstrate using Sorting facilities\n    // This is a simplified version of the \"Advanced\" example, where we mostly focus on the code necessary to handle sorting.\n    // Note that the \"Advanced\" example also showcase manually triggering a sort (e.g. if item quantities have been modified)\n    static const char* template_items_names[] =\n    {\n        \"Banana\", \"Apple\", \"Cherry\", \"Watermelon\", \"Grapefruit\", \"Strawberry\", \"Mango\",\n        \"Kiwi\", \"Orange\", \"Pineapple\", \"Blueberry\", \"Plum\", \"Coconut\", \"Pear\", \"Apricot\"\n    };\n    if (open_action != -1)\n        ImGui::SetNextItemOpen(open_action != 0);\n    if (ImGui::TreeNode(\"Sorting\"))\n    {\n        // Create item list\n        static ImVector<MyItem> items;\n        if (items.Size == 0)\n        {\n            items.resize(50, MyItem());\n            for (int n = 0; n < items.Size; n++)\n            {\n                const int template_n = n % IM_ARRAYSIZE(template_items_names);\n                MyItem& item = items[n];\n                item.ID = n;\n                item.Name = template_items_names[template_n];\n                item.Quantity = (n * n - n) % 20; // Assign default quantities\n            }\n        }\n\n        // Options\n        static ImGuiTableFlags flags =\n            ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable | ImGuiTableFlags_Sortable | ImGuiTableFlags_SortMulti\n            | ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersV | ImGuiTableFlags_NoBordersInBody\n            | ImGuiTableFlags_ScrollY;\n        PushStyleCompact();\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_SortMulti\", &flags, ImGuiTableFlags_SortMulti);\n        ImGui::SameLine(); HelpMarker(\"When sorting is enabled: hold shift when clicking headers to sort on multiple column. TableGetSortSpecs() may return specs where (SpecsCount > 1).\");\n        ImGui::CheckboxFlags(\"ImGuiTableFlags_SortTristate\", &flags, ImGuiTableFlags_SortTristate);\n        ImGui::SameLine(); HelpMarker(\"When sorting is enabled: allow no sorting, disable default sorting. TableGetSortSpecs() may return specs where (SpecsCount == 0).\");\n        PopStyleCompact();\n\n        if (ImGui::BeginTable(\"table_sorting\", 4, flags, ImVec2(0.0f, TEXT_BASE_HEIGHT * 15), 0.0f))\n        {\n            // Declare columns\n            // We use the \"user_id\" parameter of TableSetupColumn() to specify a user id that will be stored in the sort specifications.\n            // This is so our sort function can identify a column given our own identifier. We could also identify them based on their index!\n            // Demonstrate using a mixture of flags among available sort-related flags:\n            // - ImGuiTableColumnFlags_DefaultSort\n            // - ImGuiTableColumnFlags_NoSort / ImGuiTableColumnFlags_NoSortAscending / ImGuiTableColumnFlags_NoSortDescending\n            // - ImGuiTableColumnFlags_PreferSortAscending / ImGuiTableColumnFlags_PreferSortDescending\n            ImGui::TableSetupColumn(\"ID\",       ImGuiTableColumnFlags_DefaultSort          | ImGuiTableColumnFlags_WidthFixed,   0.0f, MyItemColumnID_ID);\n            ImGui::TableSetupColumn(\"Name\",                                                  ImGuiTableColumnFlags_WidthFixed,   0.0f, MyItemColumnID_Name);\n            ImGui::TableSetupColumn(\"Action\",   ImGuiTableColumnFlags_NoSort               | ImGuiTableColumnFlags_WidthFixed,   0.0f, MyItemColumnID_Action);\n            ImGui::TableSetupColumn(\"Quantity\", ImGuiTableColumnFlags_PreferSortDescending | ImGuiTableColumnFlags_WidthStretch, 0.0f, MyItemColumnID_Quantity);\n            ImGui::TableSetupScrollFreeze(0, 1); // Make row always visible\n            ImGui::TableHeadersRow();\n\n            // Sort our data if sort specs have been changed!\n            if (ImGuiTableSortSpecs* sorts_specs = ImGui::TableGetSortSpecs())\n                if (sorts_specs->SpecsDirty)\n                {\n                    MyItem::s_current_sort_specs = sorts_specs; // Store in variable accessible by the sort function.\n                    if (items.Size > 1)\n                        qsort(&items[0], (size_t)items.Size, sizeof(items[0]), MyItem::CompareWithSortSpecs);\n                    MyItem::s_current_sort_specs = NULL;\n                    sorts_specs->SpecsDirty = false;\n                }\n\n            // Demonstrate using clipper for large vertical lists\n            ImGuiListClipper clipper;\n            clipper.Begin(items.Size);\n            while (clipper.Step())\n                for (int row_n = clipper.DisplayStart; row_n < clipper.DisplayEnd; row_n++)\n                {\n                    // Display a data item\n                    MyItem* item = &items[row_n];\n                    ImGui::PushID(item->ID);\n                    ImGui::TableNextRow();\n                    ImGui::TableNextColumn();\n                    ImGui::Text(\"%04d\", item->ID);\n                    ImGui::TableNextColumn();\n                    ImGui::TextUnformatted(item->Name);\n                    ImGui::TableNextColumn();\n                    ImGui::SmallButton(\"None\");\n                    ImGui::TableNextColumn();\n                    ImGui::Text(\"%d\", item->Quantity);\n                    ImGui::PopID();\n                }\n            ImGui::EndTable();\n        }\n        ImGui::TreePop();\n    }\n\n    // In this example we'll expose most table flags and settings.\n    // For specific flags and settings refer to the corresponding section for more detailed explanation.\n    // This section is mostly useful to experiment with combining certain flags or settings with each others.\n    //ImGui::SetNextItemOpen(true, ImGuiCond_Once); // [DEBUG]\n    if (open_action != -1)\n        ImGui::SetNextItemOpen(open_action != 0);\n    if (ImGui::TreeNode(\"Advanced\"))\n    {\n        static ImGuiTableFlags flags =\n            ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable\n            | ImGuiTableFlags_Sortable | ImGuiTableFlags_SortMulti\n            | ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders | ImGuiTableFlags_NoBordersInBody\n            | ImGuiTableFlags_ScrollX | ImGuiTableFlags_ScrollY\n            | ImGuiTableFlags_SizingFixedFit;\n\n        enum ContentsType { CT_Text, CT_Button, CT_SmallButton, CT_FillButton, CT_Selectable, CT_SelectableSpanRow };\n        static int contents_type = CT_SelectableSpanRow;\n        const char* contents_type_names[] = { \"Text\", \"Button\", \"SmallButton\", \"FillButton\", \"Selectable\", \"Selectable (span row)\" };\n        static int freeze_cols = 1;\n        static int freeze_rows = 1;\n        static int items_count = IM_ARRAYSIZE(template_items_names) * 2;\n        static ImVec2 outer_size_value = ImVec2(0.0f, TEXT_BASE_HEIGHT * 12);\n        static float row_min_height = 0.0f; // Auto\n        static float inner_width_with_scroll = 0.0f; // Auto-extend\n        static bool outer_size_enabled = true;\n        static bool show_headers = true;\n        static bool show_wrapped_text = false;\n        //static ImGuiTextFilter filter;\n        //ImGui::SetNextItemOpen(true, ImGuiCond_Once); // FIXME-TABLE: Enabling this results in initial clipped first pass on table which tend to affects column sizing\n        if (ImGui::TreeNode(\"Options\"))\n        {\n            // Make the UI compact because there are so many fields\n            PushStyleCompact();\n            ImGui::PushItemWidth(TEXT_BASE_WIDTH * 28.0f);\n\n            if (ImGui::TreeNodeEx(\"Features:\", ImGuiTreeNodeFlags_DefaultOpen))\n            {\n                ImGui::CheckboxFlags(\"ImGuiTableFlags_Resizable\", &flags, ImGuiTableFlags_Resizable);\n                ImGui::CheckboxFlags(\"ImGuiTableFlags_Reorderable\", &flags, ImGuiTableFlags_Reorderable);\n                ImGui::CheckboxFlags(\"ImGuiTableFlags_Hideable\", &flags, ImGuiTableFlags_Hideable);\n                ImGui::CheckboxFlags(\"ImGuiTableFlags_Sortable\", &flags, ImGuiTableFlags_Sortable);\n                ImGui::CheckboxFlags(\"ImGuiTableFlags_NoSavedSettings\", &flags, ImGuiTableFlags_NoSavedSettings);\n                ImGui::CheckboxFlags(\"ImGuiTableFlags_ContextMenuInBody\", &flags, ImGuiTableFlags_ContextMenuInBody);\n                ImGui::TreePop();\n            }\n\n            if (ImGui::TreeNodeEx(\"Decorations:\", ImGuiTreeNodeFlags_DefaultOpen))\n            {\n                ImGui::CheckboxFlags(\"ImGuiTableFlags_RowBg\", &flags, ImGuiTableFlags_RowBg);\n                ImGui::CheckboxFlags(\"ImGuiTableFlags_BordersV\", &flags, ImGuiTableFlags_BordersV);\n                ImGui::CheckboxFlags(\"ImGuiTableFlags_BordersOuterV\", &flags, ImGuiTableFlags_BordersOuterV);\n                ImGui::CheckboxFlags(\"ImGuiTableFlags_BordersInnerV\", &flags, ImGuiTableFlags_BordersInnerV);\n                ImGui::CheckboxFlags(\"ImGuiTableFlags_BordersH\", &flags, ImGuiTableFlags_BordersH);\n                ImGui::CheckboxFlags(\"ImGuiTableFlags_BordersOuterH\", &flags, ImGuiTableFlags_BordersOuterH);\n                ImGui::CheckboxFlags(\"ImGuiTableFlags_BordersInnerH\", &flags, ImGuiTableFlags_BordersInnerH);\n                ImGui::CheckboxFlags(\"ImGuiTableFlags_NoBordersInBody\", &flags, ImGuiTableFlags_NoBordersInBody); ImGui::SameLine(); HelpMarker(\"Disable vertical borders in columns Body (borders will always appears in Headers\");\n                ImGui::CheckboxFlags(\"ImGuiTableFlags_NoBordersInBodyUntilResize\", &flags, ImGuiTableFlags_NoBordersInBodyUntilResize); ImGui::SameLine(); HelpMarker(\"Disable vertical borders in columns Body until hovered for resize (borders will always appears in Headers)\");\n                ImGui::TreePop();\n            }\n\n            if (ImGui::TreeNodeEx(\"Sizing:\", ImGuiTreeNodeFlags_DefaultOpen))\n            {\n                EditTableSizingFlags(&flags);\n                ImGui::SameLine(); HelpMarker(\"In the Advanced demo we override the policy of each column so those table-wide settings have less effect that typical.\");\n                ImGui::CheckboxFlags(\"ImGuiTableFlags_NoHostExtendX\", &flags, ImGuiTableFlags_NoHostExtendX);\n                ImGui::SameLine(); HelpMarker(\"Make outer width auto-fit to columns, overriding outer_size.x value.\\n\\nOnly available when ScrollX/ScrollY are disabled and Stretch columns are not used.\");\n                ImGui::CheckboxFlags(\"ImGuiTableFlags_NoHostExtendY\", &flags, ImGuiTableFlags_NoHostExtendY);\n                ImGui::SameLine(); HelpMarker(\"Make outer height stop exactly at outer_size.y (prevent auto-extending table past the limit).\\n\\nOnly available when ScrollX/ScrollY are disabled. Data below the limit will be clipped and not visible.\");\n                ImGui::CheckboxFlags(\"ImGuiTableFlags_NoKeepColumnsVisible\", &flags, ImGuiTableFlags_NoKeepColumnsVisible);\n                ImGui::SameLine(); HelpMarker(\"Only available if ScrollX is disabled.\");\n                ImGui::CheckboxFlags(\"ImGuiTableFlags_PreciseWidths\", &flags, ImGuiTableFlags_PreciseWidths);\n                ImGui::SameLine(); HelpMarker(\"Disable distributing remainder width to stretched columns (width allocation on a 100-wide table with 3 columns: Without this flag: 33,33,34. With this flag: 33,33,33). With larger number of columns, resizing will appear to be less smooth.\");\n                ImGui::CheckboxFlags(\"ImGuiTableFlags_NoClip\", &flags, ImGuiTableFlags_NoClip);\n                ImGui::SameLine(); HelpMarker(\"Disable clipping rectangle for every individual columns (reduce draw command count, items will be able to overflow into other columns). Generally incompatible with ScrollFreeze options.\");\n                ImGui::TreePop();\n            }\n\n            if (ImGui::TreeNodeEx(\"Padding:\", ImGuiTreeNodeFlags_DefaultOpen))\n            {\n                ImGui::CheckboxFlags(\"ImGuiTableFlags_PadOuterX\", &flags, ImGuiTableFlags_PadOuterX);\n                ImGui::CheckboxFlags(\"ImGuiTableFlags_NoPadOuterX\", &flags, ImGuiTableFlags_NoPadOuterX);\n                ImGui::CheckboxFlags(\"ImGuiTableFlags_NoPadInnerX\", &flags, ImGuiTableFlags_NoPadInnerX);\n                ImGui::TreePop();\n            }\n\n            if (ImGui::TreeNodeEx(\"Scrolling:\", ImGuiTreeNodeFlags_DefaultOpen))\n            {\n                ImGui::CheckboxFlags(\"ImGuiTableFlags_ScrollX\", &flags, ImGuiTableFlags_ScrollX);\n                ImGui::SameLine();\n                ImGui::SetNextItemWidth(ImGui::GetFrameHeight());\n                ImGui::DragInt(\"freeze_cols\", &freeze_cols, 0.2f, 0, 9, NULL, ImGuiSliderFlags_NoInput);\n                ImGui::CheckboxFlags(\"ImGuiTableFlags_ScrollY\", &flags, ImGuiTableFlags_ScrollY);\n                ImGui::SameLine();\n                ImGui::SetNextItemWidth(ImGui::GetFrameHeight());\n                ImGui::DragInt(\"freeze_rows\", &freeze_rows, 0.2f, 0, 9, NULL, ImGuiSliderFlags_NoInput);\n                ImGui::TreePop();\n            }\n\n            if (ImGui::TreeNodeEx(\"Sorting:\", ImGuiTreeNodeFlags_DefaultOpen))\n            {\n                ImGui::CheckboxFlags(\"ImGuiTableFlags_SortMulti\", &flags, ImGuiTableFlags_SortMulti);\n                ImGui::SameLine(); HelpMarker(\"When sorting is enabled: hold shift when clicking headers to sort on multiple column. TableGetSortSpecs() may return specs where (SpecsCount > 1).\");\n                ImGui::CheckboxFlags(\"ImGuiTableFlags_SortTristate\", &flags, ImGuiTableFlags_SortTristate);\n                ImGui::SameLine(); HelpMarker(\"When sorting is enabled: allow no sorting, disable default sorting. TableGetSortSpecs() may return specs where (SpecsCount == 0).\");\n                ImGui::TreePop();\n            }\n\n            if (ImGui::TreeNodeEx(\"Other:\", ImGuiTreeNodeFlags_DefaultOpen))\n            {\n                ImGui::Checkbox(\"show_headers\", &show_headers);\n                ImGui::Checkbox(\"show_wrapped_text\", &show_wrapped_text);\n\n                ImGui::DragFloat2(\"##OuterSize\", &outer_size_value.x);\n                ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);\n                ImGui::Checkbox(\"outer_size\", &outer_size_enabled);\n                ImGui::SameLine();\n                HelpMarker(\"If scrolling is disabled (ScrollX and ScrollY not set):\\n\"\n                    \"- The table is output directly in the parent window.\\n\"\n                    \"- OuterSize.x < 0.0f will right-align the table.\\n\"\n                    \"- OuterSize.x = 0.0f will narrow fit the table unless there are any Stretch column.\\n\"\n                    \"- OuterSize.y then becomes the minimum size for the table, which will extend vertically if there are more rows (unless NoHostExtendY is set).\");\n\n                // From a user point of view we will tend to use 'inner_width' differently depending on whether our table is embedding scrolling.\n                // To facilitate toying with this demo we will actually pass 0.0f to the BeginTable() when ScrollX is disabled.\n                ImGui::DragFloat(\"inner_width (when ScrollX active)\", &inner_width_with_scroll, 1.0f, 0.0f, FLT_MAX);\n\n                ImGui::DragFloat(\"row_min_height\", &row_min_height, 1.0f, 0.0f, FLT_MAX);\n                ImGui::SameLine(); HelpMarker(\"Specify height of the Selectable item.\");\n\n                ImGui::DragInt(\"items_count\", &items_count, 0.1f, 0, 9999);\n                ImGui::Combo(\"items_type (first column)\", &contents_type, contents_type_names, IM_ARRAYSIZE(contents_type_names));\n                //filter.Draw(\"filter\");\n                ImGui::TreePop();\n            }\n\n            ImGui::PopItemWidth();\n            PopStyleCompact();\n            ImGui::Spacing();\n            ImGui::TreePop();\n        }\n\n        // Update item list if we changed the number of items\n        static ImVector<MyItem> items;\n        static ImVector<int> selection;\n        static bool items_need_sort = false;\n        if (items.Size != items_count)\n        {\n            items.resize(items_count, MyItem());\n            for (int n = 0; n < items_count; n++)\n            {\n                const int template_n = n % IM_ARRAYSIZE(template_items_names);\n                MyItem& item = items[n];\n                item.ID = n;\n                item.Name = template_items_names[template_n];\n                item.Quantity = (template_n == 3) ? 10 : (template_n == 4) ? 20 : 0; // Assign default quantities\n            }\n        }\n\n        const ImDrawList* parent_draw_list = ImGui::GetWindowDrawList();\n        const int parent_draw_list_draw_cmd_count = parent_draw_list->CmdBuffer.Size;\n        ImVec2 table_scroll_cur, table_scroll_max; // For debug display\n        const ImDrawList* table_draw_list = NULL;  // \"\n\n        // Submit table\n        const float inner_width_to_use = (flags & ImGuiTableFlags_ScrollX) ? inner_width_with_scroll : 0.0f;\n        if (ImGui::BeginTable(\"table_advanced\", 6, flags, outer_size_enabled ? outer_size_value : ImVec2(0, 0), inner_width_to_use))\n        {\n            // Declare columns\n            // We use the \"user_id\" parameter of TableSetupColumn() to specify a user id that will be stored in the sort specifications.\n            // This is so our sort function can identify a column given our own identifier. We could also identify them based on their index!\n            ImGui::TableSetupColumn(\"ID\",           ImGuiTableColumnFlags_DefaultSort | ImGuiTableColumnFlags_WidthFixed | ImGuiTableColumnFlags_NoHide, 0.0f, MyItemColumnID_ID);\n            ImGui::TableSetupColumn(\"Name\",         ImGuiTableColumnFlags_WidthFixed, 0.0f, MyItemColumnID_Name);\n            ImGui::TableSetupColumn(\"Action\",       ImGuiTableColumnFlags_NoSort | ImGuiTableColumnFlags_WidthFixed, 0.0f, MyItemColumnID_Action);\n            ImGui::TableSetupColumn(\"Quantity\",     ImGuiTableColumnFlags_PreferSortDescending, 0.0f, MyItemColumnID_Quantity);\n            ImGui::TableSetupColumn(\"Description\",  (flags & ImGuiTableFlags_NoHostExtendX) ? 0 : ImGuiTableColumnFlags_WidthStretch, 0.0f, MyItemColumnID_Description);\n            ImGui::TableSetupColumn(\"Hidden\",       ImGuiTableColumnFlags_DefaultHide | ImGuiTableColumnFlags_NoSort);\n            ImGui::TableSetupScrollFreeze(freeze_cols, freeze_rows);\n\n            // Sort our data if sort specs have been changed!\n            ImGuiTableSortSpecs* sorts_specs = ImGui::TableGetSortSpecs();\n            if (sorts_specs && sorts_specs->SpecsDirty)\n                items_need_sort = true;\n            if (sorts_specs && items_need_sort && items.Size > 1)\n            {\n                MyItem::s_current_sort_specs = sorts_specs; // Store in variable accessible by the sort function.\n                qsort(&items[0], (size_t)items.Size, sizeof(items[0]), MyItem::CompareWithSortSpecs);\n                MyItem::s_current_sort_specs = NULL;\n                sorts_specs->SpecsDirty = false;\n            }\n            items_need_sort = false;\n\n            // Take note of whether we are currently sorting based on the Quantity field,\n            // we will use this to trigger sorting when we know the data of this column has been modified.\n            const bool sorts_specs_using_quantity = (ImGui::TableGetColumnFlags(3) & ImGuiTableColumnFlags_IsSorted) != 0;\n\n            // Show headers\n            if (show_headers)\n                ImGui::TableHeadersRow();\n\n            // Show data\n            // FIXME-TABLE FIXME-NAV: How we can get decent up/down even though we have the buttons here?\n            ImGui::PushButtonRepeat(true);\n#if 1\n            // Demonstrate using clipper for large vertical lists\n            ImGuiListClipper clipper;\n            clipper.Begin(items.Size);\n            while (clipper.Step())\n            {\n                for (int row_n = clipper.DisplayStart; row_n < clipper.DisplayEnd; row_n++)\n#else\n            // Without clipper\n            {\n                for (int row_n = 0; row_n < items.Size; row_n++)\n#endif\n                {\n                    MyItem* item = &items[row_n];\n                    //if (!filter.PassFilter(item->Name))\n                    //    continue;\n\n                    const bool item_is_selected = selection.contains(item->ID);\n                    ImGui::PushID(item->ID);\n                    ImGui::TableNextRow(ImGuiTableRowFlags_None, row_min_height);\n\n                    // For the demo purpose we can select among different type of items submitted in the first column\n                    ImGui::TableSetColumnIndex(0);\n                    char label[32];\n                    sprintf(label, \"%04d\", item->ID);\n                    if (contents_type == CT_Text)\n                        ImGui::TextUnformatted(label);\n                    else if (contents_type == CT_Button)\n                        ImGui::Button(label);\n                    else if (contents_type == CT_SmallButton)\n                        ImGui::SmallButton(label);\n                    else if (contents_type == CT_FillButton)\n                        ImGui::Button(label, ImVec2(-FLT_MIN, 0.0f));\n                    else if (contents_type == CT_Selectable || contents_type == CT_SelectableSpanRow)\n                    {\n                        ImGuiSelectableFlags selectable_flags = (contents_type == CT_SelectableSpanRow) ? ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowItemOverlap : ImGuiSelectableFlags_None;\n                        if (ImGui::Selectable(label, item_is_selected, selectable_flags, ImVec2(0, row_min_height)))\n                        {\n                            if (ImGui::GetIO().KeyCtrl)\n                            {\n                                if (item_is_selected)\n                                    selection.find_erase_unsorted(item->ID);\n                                else\n                                    selection.push_back(item->ID);\n                            }\n                            else\n                            {\n                                selection.clear();\n                                selection.push_back(item->ID);\n                            }\n                        }\n                    }\n\n                    if (ImGui::TableSetColumnIndex(1))\n                        ImGui::TextUnformatted(item->Name);\n\n                    // Here we demonstrate marking our data set as needing to be sorted again if we modified a quantity,\n                    // and we are currently sorting on the column showing the Quantity.\n                    // To avoid triggering a sort while holding the button, we only trigger it when the button has been released.\n                    // You will probably need a more advanced system in your code if you want to automatically sort when a specific entry changes.\n                    if (ImGui::TableSetColumnIndex(2))\n                    {\n                        if (ImGui::SmallButton(\"Chop\")) { item->Quantity += 1; }\n                        if (sorts_specs_using_quantity && ImGui::IsItemDeactivated()) { items_need_sort = true; }\n                        ImGui::SameLine();\n                        if (ImGui::SmallButton(\"Eat\")) { item->Quantity -= 1; }\n                        if (sorts_specs_using_quantity && ImGui::IsItemDeactivated()) { items_need_sort = true; }\n                    }\n\n                    if (ImGui::TableSetColumnIndex(3))\n                        ImGui::Text(\"%d\", item->Quantity);\n\n                    ImGui::TableSetColumnIndex(4);\n                    if (show_wrapped_text)\n                        ImGui::TextWrapped(\"Lorem ipsum dolor sit amet\");\n                    else\n                        ImGui::Text(\"Lorem ipsum dolor sit amet\");\n\n                    if (ImGui::TableSetColumnIndex(5))\n                        ImGui::Text(\"1234\");\n\n                    ImGui::PopID();\n                }\n            }\n            ImGui::PopButtonRepeat();\n\n            // Store some info to display debug details below\n            table_scroll_cur = ImVec2(ImGui::GetScrollX(), ImGui::GetScrollY());\n            table_scroll_max = ImVec2(ImGui::GetScrollMaxX(), ImGui::GetScrollMaxY());\n            table_draw_list = ImGui::GetWindowDrawList();\n            ImGui::EndTable();\n        }\n        static bool show_debug_details = false;\n        ImGui::Checkbox(\"Debug details\", &show_debug_details);\n        if (show_debug_details && table_draw_list)\n        {\n            ImGui::SameLine(0.0f, 0.0f);\n            const int table_draw_list_draw_cmd_count = table_draw_list->CmdBuffer.Size;\n            if (table_draw_list == parent_draw_list)\n                ImGui::Text(\": DrawCmd: +%d (in same window)\",\n                    table_draw_list_draw_cmd_count - parent_draw_list_draw_cmd_count);\n            else\n                ImGui::Text(\": DrawCmd: +%d (in child window), Scroll: (%.f/%.f) (%.f/%.f)\",\n                    table_draw_list_draw_cmd_count - 1, table_scroll_cur.x, table_scroll_max.x, table_scroll_cur.y, table_scroll_max.y);\n        }\n        ImGui::TreePop();\n    }\n\n    ImGui::PopID();\n\n    ShowDemoWindowColumns();\n\n    if (disable_indent)\n        ImGui::PopStyleVar();\n}\n\n// Demonstrate old/legacy Columns API!\n// [2020: Columns are under-featured and not maintained. Prefer using the more flexible and powerful BeginTable() API!]\nstatic void ShowDemoWindowColumns()\n{\n    bool open = ImGui::TreeNode(\"Legacy Columns API\");\n    ImGui::SameLine();\n    HelpMarker(\"Columns() is an old API! Prefer using the more flexible and powerful BeginTable() API!\");\n    if (!open)\n        return;\n\n    // Basic columns\n    if (ImGui::TreeNode(\"Basic\"))\n    {\n        ImGui::Text(\"Without border:\");\n        ImGui::Columns(3, \"mycolumns3\", false);  // 3-ways, no border\n        ImGui::Separator();\n        for (int n = 0; n < 14; n++)\n        {\n            char label[32];\n            sprintf(label, \"Item %d\", n);\n            if (ImGui::Selectable(label)) {}\n            //if (ImGui::Button(label, ImVec2(-FLT_MIN,0.0f))) {}\n            ImGui::NextColumn();\n        }\n        ImGui::Columns(1);\n        ImGui::Separator();\n\n        ImGui::Text(\"With border:\");\n        ImGui::Columns(4, \"mycolumns\"); // 4-ways, with border\n        ImGui::Separator();\n        ImGui::Text(\"ID\"); ImGui::NextColumn();\n        ImGui::Text(\"Name\"); ImGui::NextColumn();\n        ImGui::Text(\"Path\"); ImGui::NextColumn();\n        ImGui::Text(\"Hovered\"); ImGui::NextColumn();\n        ImGui::Separator();\n        const char* names[3] = { \"One\", \"Two\", \"Three\" };\n        const char* paths[3] = { \"/path/one\", \"/path/two\", \"/path/three\" };\n        static int selected = -1;\n        for (int i = 0; i < 3; i++)\n        {\n            char label[32];\n            sprintf(label, \"%04d\", i);\n            if (ImGui::Selectable(label, selected == i, ImGuiSelectableFlags_SpanAllColumns))\n                selected = i;\n            bool hovered = ImGui::IsItemHovered();\n            ImGui::NextColumn();\n            ImGui::Text(names[i]); ImGui::NextColumn();\n            ImGui::Text(paths[i]); ImGui::NextColumn();\n            ImGui::Text(\"%d\", hovered); ImGui::NextColumn();\n        }\n        ImGui::Columns(1);\n        ImGui::Separator();\n        ImGui::TreePop();\n    }\n\n    if (ImGui::TreeNode(\"Borders\"))\n    {\n        // NB: Future columns API should allow automatic horizontal borders.\n        static bool h_borders = true;\n        static bool v_borders = true;\n        static int columns_count = 4;\n        const int lines_count = 3;\n        ImGui::SetNextItemWidth(ImGui::GetFontSize() * 8);\n        ImGui::DragInt(\"##columns_count\", &columns_count, 0.1f, 2, 10, \"%d columns\");\n        if (columns_count < 2)\n            columns_count = 2;\n        ImGui::SameLine();\n        ImGui::Checkbox(\"horizontal\", &h_borders);\n        ImGui::SameLine();\n        ImGui::Checkbox(\"vertical\", &v_borders);\n        ImGui::Columns(columns_count, NULL, v_borders);\n        for (int i = 0; i < columns_count * lines_count; i++)\n        {\n            if (h_borders && ImGui::GetColumnIndex() == 0)\n                ImGui::Separator();\n            ImGui::Text(\"%c%c%c\", 'a' + i, 'a' + i, 'a' + i);\n            ImGui::Text(\"Width %.2f\", ImGui::GetColumnWidth());\n            ImGui::Text(\"Avail %.2f\", ImGui::GetContentRegionAvail().x);\n            ImGui::Text(\"Offset %.2f\", ImGui::GetColumnOffset());\n            ImGui::Text(\"Long text that is likely to clip\");\n            ImGui::Button(\"Button\", ImVec2(-FLT_MIN, 0.0f));\n            ImGui::NextColumn();\n        }\n        ImGui::Columns(1);\n        if (h_borders)\n            ImGui::Separator();\n        ImGui::TreePop();\n    }\n\n    // Create multiple items in a same cell before switching to next column\n    if (ImGui::TreeNode(\"Mixed items\"))\n    {\n        ImGui::Columns(3, \"mixed\");\n        ImGui::Separator();\n\n        ImGui::Text(\"Hello\");\n        ImGui::Button(\"Banana\");\n        ImGui::NextColumn();\n\n        ImGui::Text(\"ImGui\");\n        ImGui::Button(\"Apple\");\n        static float foo = 1.0f;\n        ImGui::InputFloat(\"red\", &foo, 0.05f, 0, \"%.3f\");\n        ImGui::Text(\"An extra line here.\");\n        ImGui::NextColumn();\n\n        ImGui::Text(\"Sailor\");\n        ImGui::Button(\"Corniflower\");\n        static float bar = 1.0f;\n        ImGui::InputFloat(\"blue\", &bar, 0.05f, 0, \"%.3f\");\n        ImGui::NextColumn();\n\n        if (ImGui::CollapsingHeader(\"Category A\")) { ImGui::Text(\"Blah blah blah\"); } ImGui::NextColumn();\n        if (ImGui::CollapsingHeader(\"Category B\")) { ImGui::Text(\"Blah blah blah\"); } ImGui::NextColumn();\n        if (ImGui::CollapsingHeader(\"Category C\")) { ImGui::Text(\"Blah blah blah\"); } ImGui::NextColumn();\n        ImGui::Columns(1);\n        ImGui::Separator();\n        ImGui::TreePop();\n    }\n\n    // Word wrapping\n    if (ImGui::TreeNode(\"Word-wrapping\"))\n    {\n        ImGui::Columns(2, \"word-wrapping\");\n        ImGui::Separator();\n        ImGui::TextWrapped(\"The quick brown fox jumps over the lazy dog.\");\n        ImGui::TextWrapped(\"Hello Left\");\n        ImGui::NextColumn();\n        ImGui::TextWrapped(\"The quick brown fox jumps over the lazy dog.\");\n        ImGui::TextWrapped(\"Hello Right\");\n        ImGui::Columns(1);\n        ImGui::Separator();\n        ImGui::TreePop();\n    }\n\n    if (ImGui::TreeNode(\"Horizontal Scrolling\"))\n    {\n        ImGui::SetNextWindowContentSize(ImVec2(1500.0f, 0.0f));\n        ImVec2 child_size = ImVec2(0, ImGui::GetFontSize() * 20.0f);\n        ImGui::BeginChild(\"##ScrollingRegion\", child_size, false, ImGuiWindowFlags_HorizontalScrollbar);\n        ImGui::Columns(10);\n\n        // Also demonstrate using clipper for large vertical lists\n        int ITEMS_COUNT = 2000;\n        ImGuiListClipper clipper;\n        clipper.Begin(ITEMS_COUNT);\n        while (clipper.Step())\n        {\n            for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++)\n                for (int j = 0; j < 10; j++)\n                {\n                    ImGui::Text(\"Line %d Column %d...\", i, j);\n                    ImGui::NextColumn();\n                }\n        }\n        ImGui::Columns(1);\n        ImGui::EndChild();\n        ImGui::TreePop();\n    }\n\n    if (ImGui::TreeNode(\"Tree\"))\n    {\n        ImGui::Columns(2, \"tree\", true);\n        for (int x = 0; x < 3; x++)\n        {\n            bool open1 = ImGui::TreeNode((void*)(intptr_t)x, \"Node%d\", x);\n            ImGui::NextColumn();\n            ImGui::Text(\"Node contents\");\n            ImGui::NextColumn();\n            if (open1)\n            {\n                for (int y = 0; y < 3; y++)\n                {\n                    bool open2 = ImGui::TreeNode((void*)(intptr_t)y, \"Node%d.%d\", x, y);\n                    ImGui::NextColumn();\n                    ImGui::Text(\"Node contents\");\n                    if (open2)\n                    {\n                        ImGui::Text(\"Even more contents\");\n                        if (ImGui::TreeNode(\"Tree in column\"))\n                        {\n                            ImGui::Text(\"The quick brown fox jumps over the lazy dog\");\n                            ImGui::TreePop();\n                        }\n                    }\n                    ImGui::NextColumn();\n                    if (open2)\n                        ImGui::TreePop();\n                }\n                ImGui::TreePop();\n            }\n        }\n        ImGui::Columns(1);\n        ImGui::TreePop();\n    }\n\n    ImGui::TreePop();\n}\n\nstatic void ShowDemoWindowMisc()\n{\n    if (ImGui::CollapsingHeader(\"Filtering\"))\n    {\n        // Helper class to easy setup a text filter.\n        // You may want to implement a more feature-full filtering scheme in your own application.\n        static ImGuiTextFilter filter;\n        ImGui::Text(\"Filter usage:\\n\"\n                    \"  \\\"\\\"         display all lines\\n\"\n                    \"  \\\"xxx\\\"      display lines containing \\\"xxx\\\"\\n\"\n                    \"  \\\"xxx,yyy\\\"  display lines containing \\\"xxx\\\" or \\\"yyy\\\"\\n\"\n                    \"  \\\"-xxx\\\"     hide lines containing \\\"xxx\\\"\");\n        filter.Draw();\n        const char* lines[] = { \"aaa1.c\", \"bbb1.c\", \"ccc1.c\", \"aaa2.cpp\", \"bbb2.cpp\", \"ccc2.cpp\", \"abc.h\", \"hello, world\" };\n        for (int i = 0; i < IM_ARRAYSIZE(lines); i++)\n            if (filter.PassFilter(lines[i]))\n                ImGui::BulletText(\"%s\", lines[i]);\n    }\n\n    if (ImGui::CollapsingHeader(\"Inputs, Navigation & Focus\"))\n    {\n        ImGuiIO& io = ImGui::GetIO();\n\n        // Display ImGuiIO output flags\n        ImGui::Text(\"WantCaptureMouse: %d\", io.WantCaptureMouse);\n        ImGui::Text(\"WantCaptureKeyboard: %d\", io.WantCaptureKeyboard);\n        ImGui::Text(\"WantTextInput: %d\", io.WantTextInput);\n        ImGui::Text(\"WantSetMousePos: %d\", io.WantSetMousePos);\n        ImGui::Text(\"NavActive: %d, NavVisible: %d\", io.NavActive, io.NavVisible);\n\n        // Display Mouse state\n        if (ImGui::TreeNode(\"Mouse State\"))\n        {\n            if (ImGui::IsMousePosValid())\n                ImGui::Text(\"Mouse pos: (%g, %g)\", io.MousePos.x, io.MousePos.y);\n            else\n                ImGui::Text(\"Mouse pos: <INVALID>\");\n            ImGui::Text(\"Mouse delta: (%g, %g)\", io.MouseDelta.x, io.MouseDelta.y);\n            ImGui::Text(\"Mouse down:\");     for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) if (ImGui::IsMouseDown(i))         { ImGui::SameLine(); ImGui::Text(\"b%d (%.02f secs)\", i, io.MouseDownDuration[i]); }\n            ImGui::Text(\"Mouse clicked:\");  for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) if (ImGui::IsMouseClicked(i))      { ImGui::SameLine(); ImGui::Text(\"b%d\", i); }\n            ImGui::Text(\"Mouse dblclick:\"); for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) if (ImGui::IsMouseDoubleClicked(i)){ ImGui::SameLine(); ImGui::Text(\"b%d\", i); }\n            ImGui::Text(\"Mouse released:\"); for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) if (ImGui::IsMouseReleased(i))     { ImGui::SameLine(); ImGui::Text(\"b%d\", i); }\n            ImGui::Text(\"Mouse wheel: %.1f\", io.MouseWheel);\n            ImGui::Text(\"Pen Pressure: %.1f\", io.PenPressure); // Note: currently unused\n            ImGui::TreePop();\n        }\n\n        // Display Keyboard/Mouse state\n        if (ImGui::TreeNode(\"Keyboard & Navigation State\"))\n        {\n            ImGui::Text(\"Keys down:\");          for (int i = 0; i < IM_ARRAYSIZE(io.KeysDown); i++) if (ImGui::IsKeyDown(i))        { ImGui::SameLine(); ImGui::Text(\"%d (0x%X) (%.02f secs)\", i, i, io.KeysDownDuration[i]); }\n            ImGui::Text(\"Keys pressed:\");       for (int i = 0; i < IM_ARRAYSIZE(io.KeysDown); i++) if (ImGui::IsKeyPressed(i))     { ImGui::SameLine(); ImGui::Text(\"%d (0x%X)\", i, i); }\n            ImGui::Text(\"Keys release:\");       for (int i = 0; i < IM_ARRAYSIZE(io.KeysDown); i++) if (ImGui::IsKeyReleased(i))    { ImGui::SameLine(); ImGui::Text(\"%d (0x%X)\", i, i); }\n            ImGui::Text(\"Keys mods: %s%s%s%s\", io.KeyCtrl ? \"CTRL \" : \"\", io.KeyShift ? \"SHIFT \" : \"\", io.KeyAlt ? \"ALT \" : \"\", io.KeySuper ? \"SUPER \" : \"\");\n            ImGui::Text(\"Chars queue:\");        for (int i = 0; i < io.InputQueueCharacters.Size; i++) { ImWchar c = io.InputQueueCharacters[i]; ImGui::SameLine();  ImGui::Text(\"\\'%c\\' (0x%04X)\", (c > ' ' && c <= 255) ? (char)c : '?', c); } // FIXME: We should convert 'c' to UTF-8 here but the functions are not public.\n\n            ImGui::Text(\"NavInputs down:\");     for (int i = 0; i < IM_ARRAYSIZE(io.NavInputs); i++) if (io.NavInputs[i] > 0.0f)              { ImGui::SameLine(); ImGui::Text(\"[%d] %.2f (%.02f secs)\", i, io.NavInputs[i], io.NavInputsDownDuration[i]); }\n            ImGui::Text(\"NavInputs pressed:\");  for (int i = 0; i < IM_ARRAYSIZE(io.NavInputs); i++) if (io.NavInputsDownDuration[i] == 0.0f) { ImGui::SameLine(); ImGui::Text(\"[%d]\", i); }\n\n            ImGui::Button(\"Hovering me sets the\\nkeyboard capture flag\");\n            if (ImGui::IsItemHovered())\n                ImGui::CaptureKeyboardFromApp(true);\n            ImGui::SameLine();\n            ImGui::Button(\"Holding me clears the\\nthe keyboard capture flag\");\n            if (ImGui::IsItemActive())\n                ImGui::CaptureKeyboardFromApp(false);\n            ImGui::TreePop();\n        }\n\n        if (ImGui::TreeNode(\"Tabbing\"))\n        {\n            ImGui::Text(\"Use TAB/SHIFT+TAB to cycle through keyboard editable fields.\");\n            static char buf[32] = \"hello\";\n            ImGui::InputText(\"1\", buf, IM_ARRAYSIZE(buf));\n            ImGui::InputText(\"2\", buf, IM_ARRAYSIZE(buf));\n            ImGui::InputText(\"3\", buf, IM_ARRAYSIZE(buf));\n            ImGui::PushAllowKeyboardFocus(false);\n            ImGui::InputText(\"4 (tab skip)\", buf, IM_ARRAYSIZE(buf));\n            ImGui::SameLine(); HelpMarker(\"Item won't be cycled through when using TAB or Shift+Tab.\");\n            ImGui::PopAllowKeyboardFocus();\n            ImGui::InputText(\"5\", buf, IM_ARRAYSIZE(buf));\n            ImGui::TreePop();\n        }\n\n        if (ImGui::TreeNode(\"Focus from code\"))\n        {\n            bool focus_1 = ImGui::Button(\"Focus on 1\"); ImGui::SameLine();\n            bool focus_2 = ImGui::Button(\"Focus on 2\"); ImGui::SameLine();\n            bool focus_3 = ImGui::Button(\"Focus on 3\");\n            int has_focus = 0;\n            static char buf[128] = \"click on a button to set focus\";\n\n            if (focus_1) ImGui::SetKeyboardFocusHere();\n            ImGui::InputText(\"1\", buf, IM_ARRAYSIZE(buf));\n            if (ImGui::IsItemActive()) has_focus = 1;\n\n            if (focus_2) ImGui::SetKeyboardFocusHere();\n            ImGui::InputText(\"2\", buf, IM_ARRAYSIZE(buf));\n            if (ImGui::IsItemActive()) has_focus = 2;\n\n            ImGui::PushAllowKeyboardFocus(false);\n            if (focus_3) ImGui::SetKeyboardFocusHere();\n            ImGui::InputText(\"3 (tab skip)\", buf, IM_ARRAYSIZE(buf));\n            if (ImGui::IsItemActive()) has_focus = 3;\n            ImGui::SameLine(); HelpMarker(\"Item won't be cycled through when using TAB or Shift+Tab.\");\n            ImGui::PopAllowKeyboardFocus();\n\n            if (has_focus)\n                ImGui::Text(\"Item with focus: %d\", has_focus);\n            else\n                ImGui::Text(\"Item with focus: <none>\");\n\n            // Use >= 0 parameter to SetKeyboardFocusHere() to focus an upcoming item\n            static float f3[3] = { 0.0f, 0.0f, 0.0f };\n            int focus_ahead = -1;\n            if (ImGui::Button(\"Focus on X\")) { focus_ahead = 0; } ImGui::SameLine();\n            if (ImGui::Button(\"Focus on Y\")) { focus_ahead = 1; } ImGui::SameLine();\n            if (ImGui::Button(\"Focus on Z\")) { focus_ahead = 2; }\n            if (focus_ahead != -1) ImGui::SetKeyboardFocusHere(focus_ahead);\n            ImGui::SliderFloat3(\"Float3\", &f3[0], 0.0f, 1.0f);\n\n            ImGui::TextWrapped(\"NB: Cursor & selection are preserved when refocusing last used item in code.\");\n            ImGui::TreePop();\n        }\n\n        if (ImGui::TreeNode(\"Dragging\"))\n        {\n            ImGui::TextWrapped(\"You can use ImGui::GetMouseDragDelta(0) to query for the dragged amount on any widget.\");\n            for (int button = 0; button < 3; button++)\n            {\n                ImGui::Text(\"IsMouseDragging(%d):\", button);\n                ImGui::Text(\"  w/ default threshold: %d,\", ImGui::IsMouseDragging(button));\n                ImGui::Text(\"  w/ zero threshold: %d,\", ImGui::IsMouseDragging(button, 0.0f));\n                ImGui::Text(\"  w/ large threshold: %d,\", ImGui::IsMouseDragging(button, 20.0f));\n            }\n\n            ImGui::Button(\"Drag Me\");\n            if (ImGui::IsItemActive())\n                ImGui::GetForegroundDrawList()->AddLine(io.MouseClickedPos[0], io.MousePos, ImGui::GetColorU32(ImGuiCol_Button), 4.0f); // Draw a line between the button and the mouse cursor\n\n            // Drag operations gets \"unlocked\" when the mouse has moved past a certain threshold\n            // (the default threshold is stored in io.MouseDragThreshold). You can request a lower or higher\n            // threshold using the second parameter of IsMouseDragging() and GetMouseDragDelta().\n            ImVec2 value_raw = ImGui::GetMouseDragDelta(0, 0.0f);\n            ImVec2 value_with_lock_threshold = ImGui::GetMouseDragDelta(0);\n            ImVec2 mouse_delta = io.MouseDelta;\n            ImGui::Text(\"GetMouseDragDelta(0):\");\n            ImGui::Text(\"  w/ default threshold: (%.1f, %.1f)\", value_with_lock_threshold.x, value_with_lock_threshold.y);\n            ImGui::Text(\"  w/ zero threshold: (%.1f, %.1f)\", value_raw.x, value_raw.y);\n            ImGui::Text(\"io.MouseDelta: (%.1f, %.1f)\", mouse_delta.x, mouse_delta.y);\n            ImGui::TreePop();\n        }\n\n        if (ImGui::TreeNode(\"Mouse cursors\"))\n        {\n            const char* mouse_cursors_names[] = { \"Arrow\", \"TextInput\", \"ResizeAll\", \"ResizeNS\", \"ResizeEW\", \"ResizeNESW\", \"ResizeNWSE\", \"Hand\", \"NotAllowed\" };\n            IM_ASSERT(IM_ARRAYSIZE(mouse_cursors_names) == ImGuiMouseCursor_COUNT);\n\n            ImGuiMouseCursor current = ImGui::GetMouseCursor();\n            ImGui::Text(\"Current mouse cursor = %d: %s\", current, mouse_cursors_names[current]);\n            ImGui::Text(\"Hover to see mouse cursors:\");\n            ImGui::SameLine(); HelpMarker(\n                \"Your application can render a different mouse cursor based on what ImGui::GetMouseCursor() returns. \"\n                \"If software cursor rendering (io.MouseDrawCursor) is set ImGui will draw the right cursor for you, \"\n                \"otherwise your backend needs to handle it.\");\n            for (int i = 0; i < ImGuiMouseCursor_COUNT; i++)\n            {\n                char label[32];\n                sprintf(label, \"Mouse cursor %d: %s\", i, mouse_cursors_names[i]);\n                ImGui::Bullet(); ImGui::Selectable(label, false);\n                if (ImGui::IsItemHovered())\n                    ImGui::SetMouseCursor(i);\n            }\n            ImGui::TreePop();\n        }\n    }\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] About Window / ShowAboutWindow()\n// Access from Dear ImGui Demo -> Tools -> About\n//-----------------------------------------------------------------------------\n\nvoid ImGui::ShowAboutWindow(bool* p_open)\n{\n    if (!ImGui::Begin(\"About Dear ImGui\", p_open, ImGuiWindowFlags_AlwaysAutoResize))\n    {\n        ImGui::End();\n        return;\n    }\n    ImGui::Text(\"Dear ImGui %s\", ImGui::GetVersion());\n    ImGui::Separator();\n    ImGui::Text(\"By Omar Cornut and all Dear ImGui contributors.\");\n    ImGui::Text(\"Dear ImGui is licensed under the MIT License, see LICENSE for more information.\");\n\n    static bool show_config_info = false;\n    ImGui::Checkbox(\"Config/Build Information\", &show_config_info);\n    if (show_config_info)\n    {\n        ImGuiIO& io = ImGui::GetIO();\n        ImGuiStyle& style = ImGui::GetStyle();\n\n        bool copy_to_clipboard = ImGui::Button(\"Copy to clipboard\");\n        ImVec2 child_size = ImVec2(0, ImGui::GetTextLineHeightWithSpacing() * 18);\n        ImGui::BeginChildFrame(ImGui::GetID(\"cfg_infos\"), child_size, ImGuiWindowFlags_NoMove);\n        if (copy_to_clipboard)\n        {\n            ImGui::LogToClipboard();\n            ImGui::LogText(\"```\\n\"); // Back quotes will make text appears without formatting when pasting on GitHub\n        }\n\n        ImGui::Text(\"Dear ImGui %s (%d)\", IMGUI_VERSION, IMGUI_VERSION_NUM);\n        ImGui::Separator();\n        ImGui::Text(\"sizeof(size_t): %d, sizeof(ImDrawIdx): %d, sizeof(ImDrawVert): %d\", (int)sizeof(size_t), (int)sizeof(ImDrawIdx), (int)sizeof(ImDrawVert));\n        ImGui::Text(\"define: __cplusplus=%d\", (int)__cplusplus);\n#ifdef IMGUI_DISABLE_OBSOLETE_FUNCTIONS\n        ImGui::Text(\"define: IMGUI_DISABLE_OBSOLETE_FUNCTIONS\");\n#endif\n#ifdef IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS\n        ImGui::Text(\"define: IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS\");\n#endif\n#ifdef IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS\n        ImGui::Text(\"define: IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS\");\n#endif\n#ifdef IMGUI_DISABLE_WIN32_FUNCTIONS\n        ImGui::Text(\"define: IMGUI_DISABLE_WIN32_FUNCTIONS\");\n#endif\n#ifdef IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS\n        ImGui::Text(\"define: IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS\");\n#endif\n#ifdef IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS\n        ImGui::Text(\"define: IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS\");\n#endif\n#ifdef IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS\n        ImGui::Text(\"define: IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS\");\n#endif\n#ifdef IMGUI_DISABLE_FILE_FUNCTIONS\n        ImGui::Text(\"define: IMGUI_DISABLE_FILE_FUNCTIONS\");\n#endif\n#ifdef IMGUI_DISABLE_DEFAULT_ALLOCATORS\n        ImGui::Text(\"define: IMGUI_DISABLE_DEFAULT_ALLOCATORS\");\n#endif\n#ifdef IMGUI_USE_BGRA_PACKED_COLOR\n        ImGui::Text(\"define: IMGUI_USE_BGRA_PACKED_COLOR\");\n#endif\n#ifdef _WIN32\n        ImGui::Text(\"define: _WIN32\");\n#endif\n#ifdef _WIN64\n        ImGui::Text(\"define: _WIN64\");\n#endif\n#ifdef __linux__\n        ImGui::Text(\"define: __linux__\");\n#endif\n#ifdef __APPLE__\n        ImGui::Text(\"define: __APPLE__\");\n#endif\n#ifdef _MSC_VER\n        ImGui::Text(\"define: _MSC_VER=%d\", _MSC_VER);\n#endif\n#ifdef _MSVC_LANG\n        ImGui::Text(\"define: _MSVC_LANG=%d\", (int)_MSVC_LANG);\n#endif\n#ifdef __MINGW32__\n        ImGui::Text(\"define: __MINGW32__\");\n#endif\n#ifdef __MINGW64__\n        ImGui::Text(\"define: __MINGW64__\");\n#endif\n#ifdef __GNUC__\n        ImGui::Text(\"define: __GNUC__=%d\", (int)__GNUC__);\n#endif\n#ifdef __clang_version__\n        ImGui::Text(\"define: __clang_version__=%s\", __clang_version__);\n#endif\n        ImGui::Separator();\n        ImGui::Text(\"io.BackendPlatformName: %s\", io.BackendPlatformName ? io.BackendPlatformName : \"NULL\");\n        ImGui::Text(\"io.BackendRendererName: %s\", io.BackendRendererName ? io.BackendRendererName : \"NULL\");\n        ImGui::Text(\"io.ConfigFlags: 0x%08X\", io.ConfigFlags);\n        if (io.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard)        ImGui::Text(\" NavEnableKeyboard\");\n        if (io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad)         ImGui::Text(\" NavEnableGamepad\");\n        if (io.ConfigFlags & ImGuiConfigFlags_NavEnableSetMousePos)     ImGui::Text(\" NavEnableSetMousePos\");\n        if (io.ConfigFlags & ImGuiConfigFlags_NavNoCaptureKeyboard)     ImGui::Text(\" NavNoCaptureKeyboard\");\n        if (io.ConfigFlags & ImGuiConfigFlags_NoMouse)                  ImGui::Text(\" NoMouse\");\n        if (io.ConfigFlags & ImGuiConfigFlags_NoMouseCursorChange)      ImGui::Text(\" NoMouseCursorChange\");\n        if (io.MouseDrawCursor)                                         ImGui::Text(\"io.MouseDrawCursor\");\n        if (io.ConfigMacOSXBehaviors)                                   ImGui::Text(\"io.ConfigMacOSXBehaviors\");\n        if (io.ConfigInputTextCursorBlink)                              ImGui::Text(\"io.ConfigInputTextCursorBlink\");\n        if (io.ConfigWindowsResizeFromEdges)                            ImGui::Text(\"io.ConfigWindowsResizeFromEdges\");\n        if (io.ConfigWindowsMoveFromTitleBarOnly)                       ImGui::Text(\"io.ConfigWindowsMoveFromTitleBarOnly\");\n        if (io.ConfigMemoryCompactTimer >= 0.0f)                        ImGui::Text(\"io.ConfigMemoryCompactTimer = %.1f\", io.ConfigMemoryCompactTimer);\n        ImGui::Text(\"io.BackendFlags: 0x%08X\", io.BackendFlags);\n        if (io.BackendFlags & ImGuiBackendFlags_HasGamepad)             ImGui::Text(\" HasGamepad\");\n        if (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors)        ImGui::Text(\" HasMouseCursors\");\n        if (io.BackendFlags & ImGuiBackendFlags_HasSetMousePos)         ImGui::Text(\" HasSetMousePos\");\n        if (io.BackendFlags & ImGuiBackendFlags_RendererHasVtxOffset)   ImGui::Text(\" RendererHasVtxOffset\");\n        ImGui::Separator();\n        ImGui::Text(\"io.Fonts: %d fonts, Flags: 0x%08X, TexSize: %d,%d\", io.Fonts->Fonts.Size, io.Fonts->Flags, io.Fonts->TexWidth, io.Fonts->TexHeight);\n        ImGui::Text(\"io.DisplaySize: %.2f,%.2f\", io.DisplaySize.x, io.DisplaySize.y);\n        ImGui::Text(\"io.DisplayFramebufferScale: %.2f,%.2f\", io.DisplayFramebufferScale.x, io.DisplayFramebufferScale.y);\n        ImGui::Separator();\n        ImGui::Text(\"style.WindowPadding: %.2f,%.2f\", style.WindowPadding.x, style.WindowPadding.y);\n        ImGui::Text(\"style.WindowBorderSize: %.2f\", style.WindowBorderSize);\n        ImGui::Text(\"style.FramePadding: %.2f,%.2f\", style.FramePadding.x, style.FramePadding.y);\n        ImGui::Text(\"style.FrameRounding: %.2f\", style.FrameRounding);\n        ImGui::Text(\"style.FrameBorderSize: %.2f\", style.FrameBorderSize);\n        ImGui::Text(\"style.ItemSpacing: %.2f,%.2f\", style.ItemSpacing.x, style.ItemSpacing.y);\n        ImGui::Text(\"style.ItemInnerSpacing: %.2f,%.2f\", style.ItemInnerSpacing.x, style.ItemInnerSpacing.y);\n\n        if (copy_to_clipboard)\n        {\n            ImGui::LogText(\"\\n```\\n\");\n            ImGui::LogFinish();\n        }\n        ImGui::EndChildFrame();\n    }\n    ImGui::End();\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] Style Editor / ShowStyleEditor()\n//-----------------------------------------------------------------------------\n// - ShowFontSelector()\n// - ShowStyleSelector()\n// - ShowStyleEditor()\n//-----------------------------------------------------------------------------\n\n// Forward declare ShowFontAtlas() which isn't worth putting in public API yet\nnamespace ImGui { IMGUI_API void ShowFontAtlas(ImFontAtlas* atlas); }\n\n// Demo helper function to select among loaded fonts.\n// Here we use the regular BeginCombo()/EndCombo() api which is more the more flexible one.\nvoid ImGui::ShowFontSelector(const char* label)\n{\n    ImGuiIO& io = ImGui::GetIO();\n    ImFont* font_current = ImGui::GetFont();\n    if (ImGui::BeginCombo(label, font_current->GetDebugName()))\n    {\n        for (int n = 0; n < io.Fonts->Fonts.Size; n++)\n        {\n            ImFont* font = io.Fonts->Fonts[n];\n            ImGui::PushID((void*)font);\n            if (ImGui::Selectable(font->GetDebugName(), font == font_current))\n                io.FontDefault = font;\n            ImGui::PopID();\n        }\n        ImGui::EndCombo();\n    }\n    ImGui::SameLine();\n    HelpMarker(\n        \"- Load additional fonts with io.Fonts->AddFontFromFileTTF().\\n\"\n        \"- The font atlas is built when calling io.Fonts->GetTexDataAsXXXX() or io.Fonts->Build().\\n\"\n        \"- Read FAQ and docs/FONTS.md for more details.\\n\"\n        \"- If you need to add/remove fonts at runtime (e.g. for DPI change), do it before calling NewFrame().\");\n}\n\n// Demo helper function to select among default colors. See ShowStyleEditor() for more advanced options.\n// Here we use the simplified Combo() api that packs items into a single literal string.\n// Useful for quick combo boxes where the choices are known locally.\nbool ImGui::ShowStyleSelector(const char* label)\n{\n    static int style_idx = -1;\n    if (ImGui::Combo(label, &style_idx, \"Dark\\0Light\\0Classic\\0\"))\n    {\n        switch (style_idx)\n        {\n        case 0: ImGui::StyleColorsDark(); break;\n        case 1: ImGui::StyleColorsLight(); break;\n        case 2: ImGui::StyleColorsClassic(); break;\n        }\n        return true;\n    }\n    return false;\n}\n\nvoid ImGui::ShowStyleEditor(ImGuiStyle* ref)\n{\n    // You can pass in a reference ImGuiStyle structure to compare to, revert to and save to\n    // (without a reference style pointer, we will use one compared locally as a reference)\n    ImGuiStyle& style = ImGui::GetStyle();\n    static ImGuiStyle ref_saved_style;\n\n    // Default to using internal storage as reference\n    static bool init = true;\n    if (init && ref == NULL)\n        ref_saved_style = style;\n    init = false;\n    if (ref == NULL)\n        ref = &ref_saved_style;\n\n    ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.50f);\n\n    if (ImGui::ShowStyleSelector(\"Colors##Selector\"))\n        ref_saved_style = style;\n    ImGui::ShowFontSelector(\"Fonts##Selector\");\n\n    // Simplified Settings (expose floating-pointer border sizes as boolean representing 0.0f or 1.0f)\n    if (ImGui::SliderFloat(\"FrameRounding\", &style.FrameRounding, 0.0f, 12.0f, \"%.0f\"))\n        style.GrabRounding = style.FrameRounding; // Make GrabRounding always the same value as FrameRounding\n    { bool border = (style.WindowBorderSize > 0.0f); if (ImGui::Checkbox(\"WindowBorder\", &border)) { style.WindowBorderSize = border ? 1.0f : 0.0f; } }\n    ImGui::SameLine();\n    { bool border = (style.FrameBorderSize > 0.0f);  if (ImGui::Checkbox(\"FrameBorder\",  &border)) { style.FrameBorderSize  = border ? 1.0f : 0.0f; } }\n    ImGui::SameLine();\n    { bool border = (style.PopupBorderSize > 0.0f);  if (ImGui::Checkbox(\"PopupBorder\",  &border)) { style.PopupBorderSize  = border ? 1.0f : 0.0f; } }\n\n    // Save/Revert button\n    if (ImGui::Button(\"Save Ref\"))\n        *ref = ref_saved_style = style;\n    ImGui::SameLine();\n    if (ImGui::Button(\"Revert Ref\"))\n        style = *ref;\n    ImGui::SameLine();\n    HelpMarker(\n        \"Save/Revert in local non-persistent storage. Default Colors definition are not affected. \"\n        \"Use \\\"Export\\\" below to save them somewhere.\");\n\n    ImGui::Separator();\n\n    if (ImGui::BeginTabBar(\"##tabs\", ImGuiTabBarFlags_None))\n    {\n        if (ImGui::BeginTabItem(\"Sizes\"))\n        {\n            ImGui::Text(\"Main\");\n            ImGui::SliderFloat2(\"WindowPadding\", (float*)&style.WindowPadding, 0.0f, 20.0f, \"%.0f\");\n            ImGui::SliderFloat2(\"FramePadding\", (float*)&style.FramePadding, 0.0f, 20.0f, \"%.0f\");\n            ImGui::SliderFloat2(\"CellPadding\", (float*)&style.CellPadding, 0.0f, 20.0f, \"%.0f\");\n            ImGui::SliderFloat2(\"ItemSpacing\", (float*)&style.ItemSpacing, 0.0f, 20.0f, \"%.0f\");\n            ImGui::SliderFloat2(\"ItemInnerSpacing\", (float*)&style.ItemInnerSpacing, 0.0f, 20.0f, \"%.0f\");\n            ImGui::SliderFloat2(\"TouchExtraPadding\", (float*)&style.TouchExtraPadding, 0.0f, 10.0f, \"%.0f\");\n            ImGui::SliderFloat(\"IndentSpacing\", &style.IndentSpacing, 0.0f, 30.0f, \"%.0f\");\n            ImGui::SliderFloat(\"ScrollbarSize\", &style.ScrollbarSize, 1.0f, 20.0f, \"%.0f\");\n            ImGui::SliderFloat(\"GrabMinSize\", &style.GrabMinSize, 1.0f, 20.0f, \"%.0f\");\n            ImGui::Text(\"Borders\");\n            ImGui::SliderFloat(\"WindowBorderSize\", &style.WindowBorderSize, 0.0f, 1.0f, \"%.0f\");\n            ImGui::SliderFloat(\"ChildBorderSize\", &style.ChildBorderSize, 0.0f, 1.0f, \"%.0f\");\n            ImGui::SliderFloat(\"PopupBorderSize\", &style.PopupBorderSize, 0.0f, 1.0f, \"%.0f\");\n            ImGui::SliderFloat(\"FrameBorderSize\", &style.FrameBorderSize, 0.0f, 1.0f, \"%.0f\");\n            ImGui::SliderFloat(\"TabBorderSize\", &style.TabBorderSize, 0.0f, 1.0f, \"%.0f\");\n            ImGui::Text(\"Rounding\");\n            ImGui::SliderFloat(\"WindowRounding\", &style.WindowRounding, 0.0f, 12.0f, \"%.0f\");\n            ImGui::SliderFloat(\"ChildRounding\", &style.ChildRounding, 0.0f, 12.0f, \"%.0f\");\n            ImGui::SliderFloat(\"FrameRounding\", &style.FrameRounding, 0.0f, 12.0f, \"%.0f\");\n            ImGui::SliderFloat(\"PopupRounding\", &style.PopupRounding, 0.0f, 12.0f, \"%.0f\");\n            ImGui::SliderFloat(\"ScrollbarRounding\", &style.ScrollbarRounding, 0.0f, 12.0f, \"%.0f\");\n            ImGui::SliderFloat(\"GrabRounding\", &style.GrabRounding, 0.0f, 12.0f, \"%.0f\");\n            ImGui::SliderFloat(\"LogSliderDeadzone\", &style.LogSliderDeadzone, 0.0f, 12.0f, \"%.0f\");\n            ImGui::SliderFloat(\"TabRounding\", &style.TabRounding, 0.0f, 12.0f, \"%.0f\");\n            ImGui::Text(\"Alignment\");\n            ImGui::SliderFloat2(\"WindowTitleAlign\", (float*)&style.WindowTitleAlign, 0.0f, 1.0f, \"%.2f\");\n            int window_menu_button_position = style.WindowMenuButtonPosition + 1;\n            if (ImGui::Combo(\"WindowMenuButtonPosition\", (int*)&window_menu_button_position, \"None\\0Left\\0Right\\0\"))\n                style.WindowMenuButtonPosition = window_menu_button_position - 1;\n            ImGui::Combo(\"ColorButtonPosition\", (int*)&style.ColorButtonPosition, \"Left\\0Right\\0\");\n            ImGui::SliderFloat2(\"ButtonTextAlign\", (float*)&style.ButtonTextAlign, 0.0f, 1.0f, \"%.2f\");\n            ImGui::SameLine(); HelpMarker(\"Alignment applies when a button is larger than its text content.\");\n            ImGui::SliderFloat2(\"SelectableTextAlign\", (float*)&style.SelectableTextAlign, 0.0f, 1.0f, \"%.2f\");\n            ImGui::SameLine(); HelpMarker(\"Alignment applies when a selectable is larger than its text content.\");\n            ImGui::Text(\"Safe Area Padding\");\n            ImGui::SameLine(); HelpMarker(\"Adjust if you cannot see the edges of your screen (e.g. on a TV where scaling has not been configured).\");\n            ImGui::SliderFloat2(\"DisplaySafeAreaPadding\", (float*)&style.DisplaySafeAreaPadding, 0.0f, 30.0f, \"%.0f\");\n            ImGui::EndTabItem();\n        }\n\n        if (ImGui::BeginTabItem(\"Colors\"))\n        {\n            static int output_dest = 0;\n            static bool output_only_modified = true;\n            if (ImGui::Button(\"Export\"))\n            {\n                if (output_dest == 0)\n                    ImGui::LogToClipboard();\n                else\n                    ImGui::LogToTTY();\n                ImGui::LogText(\"ImVec4* colors = ImGui::GetStyle().Colors;\" IM_NEWLINE);\n                for (int i = 0; i < ImGuiCol_COUNT; i++)\n                {\n                    const ImVec4& col = style.Colors[i];\n                    const char* name = ImGui::GetStyleColorName(i);\n                    if (!output_only_modified || memcmp(&col, &ref->Colors[i], sizeof(ImVec4)) != 0)\n                        ImGui::LogText(\"colors[ImGuiCol_%s]%*s= ImVec4(%.2ff, %.2ff, %.2ff, %.2ff);\" IM_NEWLINE,\n                            name, 23 - (int)strlen(name), \"\", col.x, col.y, col.z, col.w);\n                }\n                ImGui::LogFinish();\n            }\n            ImGui::SameLine(); ImGui::SetNextItemWidth(120); ImGui::Combo(\"##output_type\", &output_dest, \"To Clipboard\\0To TTY\\0\");\n            ImGui::SameLine(); ImGui::Checkbox(\"Only Modified Colors\", &output_only_modified);\n\n            static ImGuiTextFilter filter;\n            filter.Draw(\"Filter colors\", ImGui::GetFontSize() * 16);\n\n            static ImGuiColorEditFlags alpha_flags = 0;\n            if (ImGui::RadioButton(\"Opaque\", alpha_flags == ImGuiColorEditFlags_None))             { alpha_flags = ImGuiColorEditFlags_None; } ImGui::SameLine();\n            if (ImGui::RadioButton(\"Alpha\",  alpha_flags == ImGuiColorEditFlags_AlphaPreview))     { alpha_flags = ImGuiColorEditFlags_AlphaPreview; } ImGui::SameLine();\n            if (ImGui::RadioButton(\"Both\",   alpha_flags == ImGuiColorEditFlags_AlphaPreviewHalf)) { alpha_flags = ImGuiColorEditFlags_AlphaPreviewHalf; } ImGui::SameLine();\n            HelpMarker(\n                \"In the color list:\\n\"\n                \"Left-click on color square to open color picker,\\n\"\n                \"Right-click to open edit options menu.\");\n\n            ImGui::BeginChild(\"##colors\", ImVec2(0, 0), true, ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_AlwaysHorizontalScrollbar | ImGuiWindowFlags_NavFlattened);\n            ImGui::PushItemWidth(-160);\n            for (int i = 0; i < ImGuiCol_COUNT; i++)\n            {\n                const char* name = ImGui::GetStyleColorName(i);\n                if (!filter.PassFilter(name))\n                    continue;\n                ImGui::PushID(i);\n                ImGui::ColorEdit4(\"##color\", (float*)&style.Colors[i], ImGuiColorEditFlags_AlphaBar | alpha_flags);\n                if (memcmp(&style.Colors[i], &ref->Colors[i], sizeof(ImVec4)) != 0)\n                {\n                    // Tips: in a real user application, you may want to merge and use an icon font into the main font,\n                    // so instead of \"Save\"/\"Revert\" you'd use icons!\n                    // Read the FAQ and docs/FONTS.md about using icon fonts. It's really easy and super convenient!\n                    ImGui::SameLine(0.0f, style.ItemInnerSpacing.x); if (ImGui::Button(\"Save\")) { ref->Colors[i] = style.Colors[i]; }\n                    ImGui::SameLine(0.0f, style.ItemInnerSpacing.x); if (ImGui::Button(\"Revert\")) { style.Colors[i] = ref->Colors[i]; }\n                }\n                ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);\n                ImGui::TextUnformatted(name);\n                ImGui::PopID();\n            }\n            ImGui::PopItemWidth();\n            ImGui::EndChild();\n\n            ImGui::EndTabItem();\n        }\n\n        if (ImGui::BeginTabItem(\"Fonts\"))\n        {\n            ImGuiIO& io = ImGui::GetIO();\n            ImFontAtlas* atlas = io.Fonts;\n            HelpMarker(\"Read FAQ and docs/FONTS.md for details on font loading.\");\n            ImGui::ShowFontAtlas(atlas);\n\n            // Post-baking font scaling. Note that this is NOT the nice way of scaling fonts, read below.\n            // (we enforce hard clamping manually as by default DragFloat/SliderFloat allows CTRL+Click text to get out of bounds).\n            const float MIN_SCALE = 0.3f;\n            const float MAX_SCALE = 2.0f;\n            HelpMarker(\n                \"Those are old settings provided for convenience.\\n\"\n                \"However, the _correct_ way of scaling your UI is currently to reload your font at the designed size, \"\n                \"rebuild the font atlas, and call style.ScaleAllSizes() on a reference ImGuiStyle structure.\\n\"\n                \"Using those settings here will give you poor quality results.\");\n            static float window_scale = 1.0f;\n            ImGui::PushItemWidth(ImGui::GetFontSize() * 8);\n            if (ImGui::DragFloat(\"window scale\", &window_scale, 0.005f, MIN_SCALE, MAX_SCALE, \"%.2f\", ImGuiSliderFlags_AlwaysClamp)) // Scale only this window\n                ImGui::SetWindowFontScale(window_scale);\n            ImGui::DragFloat(\"global scale\", &io.FontGlobalScale, 0.005f, MIN_SCALE, MAX_SCALE, \"%.2f\", ImGuiSliderFlags_AlwaysClamp); // Scale everything\n            ImGui::PopItemWidth();\n\n            ImGui::EndTabItem();\n        }\n\n        if (ImGui::BeginTabItem(\"Rendering\"))\n        {\n            ImGui::Checkbox(\"Anti-aliased lines\", &style.AntiAliasedLines);\n            ImGui::SameLine();\n            HelpMarker(\"When disabling anti-aliasing lines, you'll probably want to disable borders in your style as well.\");\n\n            ImGui::Checkbox(\"Anti-aliased lines use texture\", &style.AntiAliasedLinesUseTex);\n            ImGui::SameLine();\n            HelpMarker(\"Faster lines using texture data. Require backend to render with bilinear filtering (not point/nearest filtering).\");\n\n            ImGui::Checkbox(\"Anti-aliased fill\", &style.AntiAliasedFill);\n            ImGui::PushItemWidth(ImGui::GetFontSize() * 8);\n            ImGui::DragFloat(\"Curve Tessellation Tolerance\", &style.CurveTessellationTol, 0.02f, 0.10f, 10.0f, \"%.2f\");\n            if (style.CurveTessellationTol < 0.10f) style.CurveTessellationTol = 0.10f;\n\n            // When editing the \"Circle Segment Max Error\" value, draw a preview of its effect on auto-tessellated circles.\n            ImGui::DragFloat(\"Circle Tessellation Max Error\", &style.CircleTessellationMaxError , 0.005f, 0.10f, 5.0f, \"%.2f\", ImGuiSliderFlags_AlwaysClamp);\n            if (ImGui::IsItemActive())\n            {\n                ImGui::SetNextWindowPos(ImGui::GetCursorScreenPos());\n                ImGui::BeginTooltip();\n                ImGui::TextUnformatted(\"(R = radius, N = number of segments)\");\n                ImGui::Spacing();\n                ImDrawList* draw_list = ImGui::GetWindowDrawList();\n                const float min_widget_width = ImGui::CalcTextSize(\"N: MMM\\nR: MMM\").x;\n                for (int n = 0; n < 8; n++)\n                {\n                    const float RAD_MIN = 5.0f;\n                    const float RAD_MAX = 70.0f;\n                    const float rad = RAD_MIN + (RAD_MAX - RAD_MIN) * (float)n / (8.0f - 1.0f);\n\n                    ImGui::BeginGroup();\n\n                    ImGui::Text(\"R: %.f\\nN: %d\", rad, draw_list->_CalcCircleAutoSegmentCount(rad));\n\n                    const float canvas_width = IM_MAX(min_widget_width, rad * 2.0f);\n                    const float offset_x     = floorf(canvas_width * 0.5f);\n                    const float offset_y     = floorf(RAD_MAX);\n\n                    const ImVec2 p1 = ImGui::GetCursorScreenPos();\n                    draw_list->AddCircle(ImVec2(p1.x + offset_x, p1.y + offset_y), rad, ImGui::GetColorU32(ImGuiCol_Text));\n                    ImGui::Dummy(ImVec2(canvas_width, RAD_MAX * 2));\n\n                    /*\n                    const ImVec2 p2 = ImGui::GetCursorScreenPos();\n                    draw_list->AddCircleFilled(ImVec2(p2.x + offset_x, p2.y + offset_y), rad, ImGui::GetColorU32(ImGuiCol_Text));\n                    ImGui::Dummy(ImVec2(canvas_width, RAD_MAX * 2));\n                    */\n\n                    ImGui::EndGroup();\n                    ImGui::SameLine();\n                }\n                ImGui::EndTooltip();\n            }\n            ImGui::SameLine();\n            HelpMarker(\"When drawing circle primitives with \\\"num_segments == 0\\\" tesselation will be calculated automatically.\");\n\n            ImGui::DragFloat(\"Global Alpha\", &style.Alpha, 0.005f, 0.20f, 1.0f, \"%.2f\"); // Not exposing zero here so user doesn't \"lose\" the UI (zero alpha clips all widgets). But application code could have a toggle to switch between zero and non-zero.\n            ImGui::DragFloat(\"Disabled Alpha\", &style.DisabledAlpha, 0.005f, 0.0f, 1.0f, \"%.2f\"); ImGui::SameLine(); HelpMarker(\"Additional alpha multiplier for disabled items (multiply over current value of Alpha).\");\n            ImGui::PopItemWidth();\n\n            ImGui::EndTabItem();\n        }\n\n        ImGui::EndTabBar();\n    }\n\n    ImGui::PopItemWidth();\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] Example App: Main Menu Bar / ShowExampleAppMainMenuBar()\n//-----------------------------------------------------------------------------\n// - ShowExampleAppMainMenuBar()\n// - ShowExampleMenuFile()\n//-----------------------------------------------------------------------------\n\n// Demonstrate creating a \"main\" fullscreen menu bar and populating it.\n// Note the difference between BeginMainMenuBar() and BeginMenuBar():\n// - BeginMenuBar() = menu-bar inside current window (which needs the ImGuiWindowFlags_MenuBar flag!)\n// - BeginMainMenuBar() = helper to create menu-bar-sized window at the top of the main viewport + call BeginMenuBar() into it.\nstatic void ShowExampleAppMainMenuBar()\n{\n    if (ImGui::BeginMainMenuBar())\n    {\n        if (ImGui::BeginMenu(\"File\"))\n        {\n            ShowExampleMenuFile();\n            ImGui::EndMenu();\n        }\n        if (ImGui::BeginMenu(\"Edit\"))\n        {\n            if (ImGui::MenuItem(\"Undo\", \"CTRL+Z\")) {}\n            if (ImGui::MenuItem(\"Redo\", \"CTRL+Y\", false, false)) {}  // Disabled item\n            ImGui::Separator();\n            if (ImGui::MenuItem(\"Cut\", \"CTRL+X\")) {}\n            if (ImGui::MenuItem(\"Copy\", \"CTRL+C\")) {}\n            if (ImGui::MenuItem(\"Paste\", \"CTRL+V\")) {}\n            ImGui::EndMenu();\n        }\n        ImGui::EndMainMenuBar();\n    }\n}\n\n// Note that shortcuts are currently provided for display only\n// (future version will add explicit flags to BeginMenu() to request processing shortcuts)\nstatic void ShowExampleMenuFile()\n{\n    ImGui::MenuItem(\"(demo menu)\", NULL, false, false);\n    if (ImGui::MenuItem(\"New\")) {}\n    if (ImGui::MenuItem(\"Open\", \"Ctrl+O\")) {}\n    if (ImGui::BeginMenu(\"Open Recent\"))\n    {\n        ImGui::MenuItem(\"fish_hat.c\");\n        ImGui::MenuItem(\"fish_hat.inl\");\n        ImGui::MenuItem(\"fish_hat.h\");\n        if (ImGui::BeginMenu(\"More..\"))\n        {\n            ImGui::MenuItem(\"Hello\");\n            ImGui::MenuItem(\"Sailor\");\n            if (ImGui::BeginMenu(\"Recurse..\"))\n            {\n                ShowExampleMenuFile();\n                ImGui::EndMenu();\n            }\n            ImGui::EndMenu();\n        }\n        ImGui::EndMenu();\n    }\n    if (ImGui::MenuItem(\"Save\", \"Ctrl+S\")) {}\n    if (ImGui::MenuItem(\"Save As..\")) {}\n\n    ImGui::Separator();\n    if (ImGui::BeginMenu(\"Options\"))\n    {\n        static bool enabled = true;\n        ImGui::MenuItem(\"Enabled\", \"\", &enabled);\n        ImGui::BeginChild(\"child\", ImVec2(0, 60), true);\n        for (int i = 0; i < 10; i++)\n            ImGui::Text(\"Scrolling Text %d\", i);\n        ImGui::EndChild();\n        static float f = 0.5f;\n        static int n = 0;\n        ImGui::SliderFloat(\"Value\", &f, 0.0f, 1.0f);\n        ImGui::InputFloat(\"Input\", &f, 0.1f);\n        ImGui::Combo(\"Combo\", &n, \"Yes\\0No\\0Maybe\\0\\0\");\n        ImGui::EndMenu();\n    }\n\n    if (ImGui::BeginMenu(\"Colors\"))\n    {\n        float sz = ImGui::GetTextLineHeight();\n        for (int i = 0; i < ImGuiCol_COUNT; i++)\n        {\n            const char* name = ImGui::GetStyleColorName((ImGuiCol)i);\n            ImVec2 p = ImGui::GetCursorScreenPos();\n            ImGui::GetWindowDrawList()->AddRectFilled(p, ImVec2(p.x + sz, p.y + sz), ImGui::GetColorU32((ImGuiCol)i));\n            ImGui::Dummy(ImVec2(sz, sz));\n            ImGui::SameLine();\n            ImGui::MenuItem(name);\n        }\n        ImGui::EndMenu();\n    }\n\n    // Here we demonstrate appending again to the \"Options\" menu (which we already created above)\n    // Of course in this demo it is a little bit silly that this function calls BeginMenu(\"Options\") twice.\n    // In a real code-base using it would make senses to use this feature from very different code locations.\n    if (ImGui::BeginMenu(\"Options\")) // <-- Append!\n    {\n        static bool b = true;\n        ImGui::Checkbox(\"SomeOption\", &b);\n        ImGui::EndMenu();\n    }\n\n    if (ImGui::BeginMenu(\"Disabled\", false)) // Disabled\n    {\n        IM_ASSERT(0);\n    }\n    if (ImGui::MenuItem(\"Checked\", NULL, true)) {}\n    if (ImGui::MenuItem(\"Quit\", \"Alt+F4\")) {}\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] Example App: Debug Console / ShowExampleAppConsole()\n//-----------------------------------------------------------------------------\n\n// Demonstrate creating a simple console window, with scrolling, filtering, completion and history.\n// For the console example, we are using a more C++ like approach of declaring a class to hold both data and functions.\nstruct ExampleAppConsole\n{\n    char                  InputBuf[256];\n    ImVector<char*>       Items;\n    ImVector<const char*> Commands;\n    ImVector<char*>       History;\n    int                   HistoryPos;    // -1: new line, 0..History.Size-1 browsing history.\n    ImGuiTextFilter       Filter;\n    bool                  AutoScroll;\n    bool                  ScrollToBottom;\n\n    ExampleAppConsole()\n    {\n        ClearLog();\n        memset(InputBuf, 0, sizeof(InputBuf));\n        HistoryPos = -1;\n\n        // \"CLASSIFY\" is here to provide the test case where \"C\"+[tab] completes to \"CL\" and display multiple matches.\n        Commands.push_back(\"HELP\");\n        Commands.push_back(\"HISTORY\");\n        Commands.push_back(\"CLEAR\");\n        Commands.push_back(\"CLASSIFY\");\n        AutoScroll = true;\n        ScrollToBottom = false;\n        AddLog(\"Welcome to Dear ImGui!\");\n    }\n    ~ExampleAppConsole()\n    {\n        ClearLog();\n        for (int i = 0; i < History.Size; i++)\n            free(History[i]);\n    }\n\n    // Portable helpers\n    static int   Stricmp(const char* s1, const char* s2)         { int d; while ((d = toupper(*s2) - toupper(*s1)) == 0 && *s1) { s1++; s2++; } return d; }\n    static int   Strnicmp(const char* s1, const char* s2, int n) { int d = 0; while (n > 0 && (d = toupper(*s2) - toupper(*s1)) == 0 && *s1) { s1++; s2++; n--; } return d; }\n    static char* Strdup(const char* s)                           { IM_ASSERT(s); size_t len = strlen(s) + 1; void* buf = malloc(len); IM_ASSERT(buf); return (char*)memcpy(buf, (const void*)s, len); }\n    static void  Strtrim(char* s)                                { char* str_end = s + strlen(s); while (str_end > s && str_end[-1] == ' ') str_end--; *str_end = 0; }\n\n    void    ClearLog()\n    {\n        for (int i = 0; i < Items.Size; i++)\n            free(Items[i]);\n        Items.clear();\n    }\n\n    void    AddLog(const char* fmt, ...) IM_FMTARGS(2)\n    {\n        // FIXME-OPT\n        char buf[1024];\n        va_list args;\n        va_start(args, fmt);\n        vsnprintf(buf, IM_ARRAYSIZE(buf), fmt, args);\n        buf[IM_ARRAYSIZE(buf)-1] = 0;\n        va_end(args);\n        Items.push_back(Strdup(buf));\n    }\n\n    void    Draw(const char* title, bool* p_open)\n    {\n        ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);\n        if (!ImGui::Begin(title, p_open))\n        {\n            ImGui::End();\n            return;\n        }\n\n        // As a specific feature guaranteed by the library, after calling Begin() the last Item represent the title bar.\n        // So e.g. IsItemHovered() will return true when hovering the title bar.\n        // Here we create a context menu only available from the title bar.\n        if (ImGui::BeginPopupContextItem())\n        {\n            if (ImGui::MenuItem(\"Close Console\"))\n                *p_open = false;\n            ImGui::EndPopup();\n        }\n\n        ImGui::TextWrapped(\n            \"This example implements a console with basic coloring, completion (TAB key) and history (Up/Down keys). A more elaborate \"\n            \"implementation may want to store entries along with extra data such as timestamp, emitter, etc.\");\n        ImGui::TextWrapped(\"Enter 'HELP' for help.\");\n\n        // TODO: display items starting from the bottom\n\n        if (ImGui::SmallButton(\"Add Debug Text\"))  { AddLog(\"%d some text\", Items.Size); AddLog(\"some more text\"); AddLog(\"display very important message here!\"); }\n        ImGui::SameLine();\n        if (ImGui::SmallButton(\"Add Debug Error\")) { AddLog(\"[error] something went wrong\"); }\n        ImGui::SameLine();\n        if (ImGui::SmallButton(\"Clear\"))           { ClearLog(); }\n        ImGui::SameLine();\n        bool copy_to_clipboard = ImGui::SmallButton(\"Copy\");\n        //static float t = 0.0f; if (ImGui::GetTime() - t > 0.02f) { t = ImGui::GetTime(); AddLog(\"Spam %f\", t); }\n\n        ImGui::Separator();\n\n        // Options menu\n        if (ImGui::BeginPopup(\"Options\"))\n        {\n            ImGui::Checkbox(\"Auto-scroll\", &AutoScroll);\n            ImGui::EndPopup();\n        }\n\n        // Options, Filter\n        if (ImGui::Button(\"Options\"))\n            ImGui::OpenPopup(\"Options\");\n        ImGui::SameLine();\n        Filter.Draw(\"Filter (\\\"incl,-excl\\\") (\\\"error\\\")\", 180);\n        ImGui::Separator();\n\n        // Reserve enough left-over height for 1 separator + 1 input text\n        const float footer_height_to_reserve = ImGui::GetStyle().ItemSpacing.y + ImGui::GetFrameHeightWithSpacing();\n        ImGui::BeginChild(\"ScrollingRegion\", ImVec2(0, -footer_height_to_reserve), false, ImGuiWindowFlags_HorizontalScrollbar);\n        if (ImGui::BeginPopupContextWindow())\n        {\n            if (ImGui::Selectable(\"Clear\")) ClearLog();\n            ImGui::EndPopup();\n        }\n\n        // Display every line as a separate entry so we can change their color or add custom widgets.\n        // If you only want raw text you can use ImGui::TextUnformatted(log.begin(), log.end());\n        // NB- if you have thousands of entries this approach may be too inefficient and may require user-side clipping\n        // to only process visible items. The clipper will automatically measure the height of your first item and then\n        // \"seek\" to display only items in the visible area.\n        // To use the clipper we can replace your standard loop:\n        //      for (int i = 0; i < Items.Size; i++)\n        //   With:\n        //      ImGuiListClipper clipper;\n        //      clipper.Begin(Items.Size);\n        //      while (clipper.Step())\n        //         for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++)\n        // - That your items are evenly spaced (same height)\n        // - That you have cheap random access to your elements (you can access them given their index,\n        //   without processing all the ones before)\n        // You cannot this code as-is if a filter is active because it breaks the 'cheap random-access' property.\n        // We would need random-access on the post-filtered list.\n        // A typical application wanting coarse clipping and filtering may want to pre-compute an array of indices\n        // or offsets of items that passed the filtering test, recomputing this array when user changes the filter,\n        // and appending newly elements as they are inserted. This is left as a task to the user until we can manage\n        // to improve this example code!\n        // If your items are of variable height:\n        // - Split them into same height items would be simpler and facilitate random-seeking into your list.\n        // - Consider using manual call to IsRectVisible() and skipping extraneous decoration from your items.\n        ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(4, 1)); // Tighten spacing\n        if (copy_to_clipboard)\n            ImGui::LogToClipboard();\n        for (int i = 0; i < Items.Size; i++)\n        {\n            const char* item = Items[i];\n            if (!Filter.PassFilter(item))\n                continue;\n\n            // Normally you would store more information in your item than just a string.\n            // (e.g. make Items[] an array of structure, store color/type etc.)\n            ImVec4 color;\n            bool has_color = false;\n            if (strstr(item, \"[error]\"))          { color = ImVec4(1.0f, 0.4f, 0.4f, 1.0f); has_color = true; }\n            else if (strncmp(item, \"# \", 2) == 0) { color = ImVec4(1.0f, 0.8f, 0.6f, 1.0f); has_color = true; }\n            if (has_color)\n                ImGui::PushStyleColor(ImGuiCol_Text, color);\n            ImGui::TextUnformatted(item);\n            if (has_color)\n                ImGui::PopStyleColor();\n        }\n        if (copy_to_clipboard)\n            ImGui::LogFinish();\n\n        if (ScrollToBottom || (AutoScroll && ImGui::GetScrollY() >= ImGui::GetScrollMaxY()))\n            ImGui::SetScrollHereY(1.0f);\n        ScrollToBottom = false;\n\n        ImGui::PopStyleVar();\n        ImGui::EndChild();\n        ImGui::Separator();\n\n        // Command-line\n        bool reclaim_focus = false;\n        ImGuiInputTextFlags input_text_flags = ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_CallbackCompletion | ImGuiInputTextFlags_CallbackHistory;\n        if (ImGui::InputText(\"Input\", InputBuf, IM_ARRAYSIZE(InputBuf), input_text_flags, &TextEditCallbackStub, (void*)this))\n        {\n            char* s = InputBuf;\n            Strtrim(s);\n            if (s[0])\n                ExecCommand(s);\n            strcpy(s, \"\");\n            reclaim_focus = true;\n        }\n\n        // Auto-focus on window apparition\n        ImGui::SetItemDefaultFocus();\n        if (reclaim_focus)\n            ImGui::SetKeyboardFocusHere(-1); // Auto focus previous widget\n\n        ImGui::End();\n    }\n\n    void    ExecCommand(const char* command_line)\n    {\n        AddLog(\"# %s\\n\", command_line);\n\n        // Insert into history. First find match and delete it so it can be pushed to the back.\n        // This isn't trying to be smart or optimal.\n        HistoryPos = -1;\n        for (int i = History.Size - 1; i >= 0; i--)\n            if (Stricmp(History[i], command_line) == 0)\n            {\n                free(History[i]);\n                History.erase(History.begin() + i);\n                break;\n            }\n        History.push_back(Strdup(command_line));\n\n        // Process command\n        if (Stricmp(command_line, \"CLEAR\") == 0)\n        {\n            ClearLog();\n        }\n        else if (Stricmp(command_line, \"HELP\") == 0)\n        {\n            AddLog(\"Commands:\");\n            for (int i = 0; i < Commands.Size; i++)\n                AddLog(\"- %s\", Commands[i]);\n        }\n        else if (Stricmp(command_line, \"HISTORY\") == 0)\n        {\n            int first = History.Size - 10;\n            for (int i = first > 0 ? first : 0; i < History.Size; i++)\n                AddLog(\"%3d: %s\\n\", i, History[i]);\n        }\n        else\n        {\n            AddLog(\"Unknown command: '%s'\\n\", command_line);\n        }\n\n        // On command input, we scroll to bottom even if AutoScroll==false\n        ScrollToBottom = true;\n    }\n\n    // In C++11 you'd be better off using lambdas for this sort of forwarding callbacks\n    static int TextEditCallbackStub(ImGuiInputTextCallbackData* data)\n    {\n        ExampleAppConsole* console = (ExampleAppConsole*)data->UserData;\n        return console->TextEditCallback(data);\n    }\n\n    int     TextEditCallback(ImGuiInputTextCallbackData* data)\n    {\n        //AddLog(\"cursor: %d, selection: %d-%d\", data->CursorPos, data->SelectionStart, data->SelectionEnd);\n        switch (data->EventFlag)\n        {\n        case ImGuiInputTextFlags_CallbackCompletion:\n            {\n                // Example of TEXT COMPLETION\n\n                // Locate beginning of current word\n                const char* word_end = data->Buf + data->CursorPos;\n                const char* word_start = word_end;\n                while (word_start > data->Buf)\n                {\n                    const char c = word_start[-1];\n                    if (c == ' ' || c == '\\t' || c == ',' || c == ';')\n                        break;\n                    word_start--;\n                }\n\n                // Build a list of candidates\n                ImVector<const char*> candidates;\n                for (int i = 0; i < Commands.Size; i++)\n                    if (Strnicmp(Commands[i], word_start, (int)(word_end - word_start)) == 0)\n                        candidates.push_back(Commands[i]);\n\n                if (candidates.Size == 0)\n                {\n                    // No match\n                    AddLog(\"No match for \\\"%.*s\\\"!\\n\", (int)(word_end - word_start), word_start);\n                }\n                else if (candidates.Size == 1)\n                {\n                    // Single match. Delete the beginning of the word and replace it entirely so we've got nice casing.\n                    data->DeleteChars((int)(word_start - data->Buf), (int)(word_end - word_start));\n                    data->InsertChars(data->CursorPos, candidates[0]);\n                    data->InsertChars(data->CursorPos, \" \");\n                }\n                else\n                {\n                    // Multiple matches. Complete as much as we can..\n                    // So inputing \"C\"+Tab will complete to \"CL\" then display \"CLEAR\" and \"CLASSIFY\" as matches.\n                    int match_len = (int)(word_end - word_start);\n                    for (;;)\n                    {\n                        int c = 0;\n                        bool all_candidates_matches = true;\n                        for (int i = 0; i < candidates.Size && all_candidates_matches; i++)\n                            if (i == 0)\n                                c = toupper(candidates[i][match_len]);\n                            else if (c == 0 || c != toupper(candidates[i][match_len]))\n                                all_candidates_matches = false;\n                        if (!all_candidates_matches)\n                            break;\n                        match_len++;\n                    }\n\n                    if (match_len > 0)\n                    {\n                        data->DeleteChars((int)(word_start - data->Buf), (int)(word_end - word_start));\n                        data->InsertChars(data->CursorPos, candidates[0], candidates[0] + match_len);\n                    }\n\n                    // List matches\n                    AddLog(\"Possible matches:\\n\");\n                    for (int i = 0; i < candidates.Size; i++)\n                        AddLog(\"- %s\\n\", candidates[i]);\n                }\n\n                break;\n            }\n        case ImGuiInputTextFlags_CallbackHistory:\n            {\n                // Example of HISTORY\n                const int prev_history_pos = HistoryPos;\n                if (data->EventKey == ImGuiKey_UpArrow)\n                {\n                    if (HistoryPos == -1)\n                        HistoryPos = History.Size - 1;\n                    else if (HistoryPos > 0)\n                        HistoryPos--;\n                }\n                else if (data->EventKey == ImGuiKey_DownArrow)\n                {\n                    if (HistoryPos != -1)\n                        if (++HistoryPos >= History.Size)\n                            HistoryPos = -1;\n                }\n\n                // A better implementation would preserve the data on the current input line along with cursor position.\n                if (prev_history_pos != HistoryPos)\n                {\n                    const char* history_str = (HistoryPos >= 0) ? History[HistoryPos] : \"\";\n                    data->DeleteChars(0, data->BufTextLen);\n                    data->InsertChars(0, history_str);\n                }\n            }\n        }\n        return 0;\n    }\n};\n\nstatic void ShowExampleAppConsole(bool* p_open)\n{\n    static ExampleAppConsole console;\n    console.Draw(\"Example: Console\", p_open);\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] Example App: Debug Log / ShowExampleAppLog()\n//-----------------------------------------------------------------------------\n\n// Usage:\n//  static ExampleAppLog my_log;\n//  my_log.AddLog(\"Hello %d world\\n\", 123);\n//  my_log.Draw(\"title\");\nstruct ExampleAppLog\n{\n    ImGuiTextBuffer     Buf;\n    ImGuiTextFilter     Filter;\n    ImVector<int>       LineOffsets; // Index to lines offset. We maintain this with AddLog() calls.\n    bool                AutoScroll;  // Keep scrolling if already at the bottom.\n\n    ExampleAppLog()\n    {\n        AutoScroll = true;\n        Clear();\n    }\n\n    void    Clear()\n    {\n        Buf.clear();\n        LineOffsets.clear();\n        LineOffsets.push_back(0);\n    }\n\n    void    AddLog(const char* fmt, ...) IM_FMTARGS(2)\n    {\n        int old_size = Buf.size();\n        va_list args;\n        va_start(args, fmt);\n        Buf.appendfv(fmt, args);\n        va_end(args);\n        for (int new_size = Buf.size(); old_size < new_size; old_size++)\n            if (Buf[old_size] == '\\n')\n                LineOffsets.push_back(old_size + 1);\n    }\n\n    void    Draw(const char* title, bool* p_open = NULL)\n    {\n        if (!ImGui::Begin(title, p_open))\n        {\n            ImGui::End();\n            return;\n        }\n\n        // Options menu\n        if (ImGui::BeginPopup(\"Options\"))\n        {\n            ImGui::Checkbox(\"Auto-scroll\", &AutoScroll);\n            ImGui::EndPopup();\n        }\n\n        // Main window\n        if (ImGui::Button(\"Options\"))\n            ImGui::OpenPopup(\"Options\");\n        ImGui::SameLine();\n        bool clear = ImGui::Button(\"Clear\");\n        ImGui::SameLine();\n        bool copy = ImGui::Button(\"Copy\");\n        ImGui::SameLine();\n        Filter.Draw(\"Filter\", -100.0f);\n\n        ImGui::Separator();\n        ImGui::BeginChild(\"scrolling\", ImVec2(0, 0), false, ImGuiWindowFlags_HorizontalScrollbar);\n\n        if (clear)\n            Clear();\n        if (copy)\n            ImGui::LogToClipboard();\n\n        ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));\n        const char* buf = Buf.begin();\n        const char* buf_end = Buf.end();\n        if (Filter.IsActive())\n        {\n            // In this example we don't use the clipper when Filter is enabled.\n            // This is because we don't have a random access on the result on our filter.\n            // A real application processing logs with ten of thousands of entries may want to store the result of\n            // search/filter.. especially if the filtering function is not trivial (e.g. reg-exp).\n            for (int line_no = 0; line_no < LineOffsets.Size; line_no++)\n            {\n                const char* line_start = buf + LineOffsets[line_no];\n                const char* line_end = (line_no + 1 < LineOffsets.Size) ? (buf + LineOffsets[line_no + 1] - 1) : buf_end;\n                if (Filter.PassFilter(line_start, line_end))\n                    ImGui::TextUnformatted(line_start, line_end);\n            }\n        }\n        else\n        {\n            // The simplest and easy way to display the entire buffer:\n            //   ImGui::TextUnformatted(buf_begin, buf_end);\n            // And it'll just work. TextUnformatted() has specialization for large blob of text and will fast-forward\n            // to skip non-visible lines. Here we instead demonstrate using the clipper to only process lines that are\n            // within the visible area.\n            // If you have tens of thousands of items and their processing cost is non-negligible, coarse clipping them\n            // on your side is recommended. Using ImGuiListClipper requires\n            // - A) random access into your data\n            // - B) items all being the  same height,\n            // both of which we can handle since we an array pointing to the beginning of each line of text.\n            // When using the filter (in the block of code above) we don't have random access into the data to display\n            // anymore, which is why we don't use the clipper. Storing or skimming through the search result would make\n            // it possible (and would be recommended if you want to search through tens of thousands of entries).\n            ImGuiListClipper clipper;\n            clipper.Begin(LineOffsets.Size);\n            while (clipper.Step())\n            {\n                for (int line_no = clipper.DisplayStart; line_no < clipper.DisplayEnd; line_no++)\n                {\n                    const char* line_start = buf + LineOffsets[line_no];\n                    const char* line_end = (line_no + 1 < LineOffsets.Size) ? (buf + LineOffsets[line_no + 1] - 1) : buf_end;\n                    ImGui::TextUnformatted(line_start, line_end);\n                }\n            }\n            clipper.End();\n        }\n        ImGui::PopStyleVar();\n\n        if (AutoScroll && ImGui::GetScrollY() >= ImGui::GetScrollMaxY())\n            ImGui::SetScrollHereY(1.0f);\n\n        ImGui::EndChild();\n        ImGui::End();\n    }\n};\n\n// Demonstrate creating a simple log window with basic filtering.\nstatic void ShowExampleAppLog(bool* p_open)\n{\n    static ExampleAppLog log;\n\n    // For the demo: add a debug button _BEFORE_ the normal log window contents\n    // We take advantage of a rarely used feature: multiple calls to Begin()/End() are appending to the _same_ window.\n    // Most of the contents of the window will be added by the log.Draw() call.\n    ImGui::SetNextWindowSize(ImVec2(500, 400), ImGuiCond_FirstUseEver);\n    ImGui::Begin(\"Example: Log\", p_open);\n    if (ImGui::SmallButton(\"[Debug] Add 5 entries\"))\n    {\n        static int counter = 0;\n        const char* categories[3] = { \"info\", \"warn\", \"error\" };\n        const char* words[] = { \"Bumfuzzled\", \"Cattywampus\", \"Snickersnee\", \"Abibliophobia\", \"Absquatulate\", \"Nincompoop\", \"Pauciloquent\" };\n        for (int n = 0; n < 5; n++)\n        {\n            const char* category = categories[counter % IM_ARRAYSIZE(categories)];\n            const char* word = words[counter % IM_ARRAYSIZE(words)];\n            log.AddLog(\"[%05d] [%s] Hello, current time is %.1f, here's a word: '%s'\\n\",\n                ImGui::GetFrameCount(), category, ImGui::GetTime(), word);\n            counter++;\n        }\n    }\n    ImGui::End();\n\n    // Actually call in the regular Log helper (which will Begin() into the same window as we just did)\n    log.Draw(\"Example: Log\", p_open);\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] Example App: Simple Layout / ShowExampleAppLayout()\n//-----------------------------------------------------------------------------\n\n// Demonstrate create a window with multiple child windows.\nstatic void ShowExampleAppLayout(bool* p_open)\n{\n    ImGui::SetNextWindowSize(ImVec2(500, 440), ImGuiCond_FirstUseEver);\n    if (ImGui::Begin(\"Example: Simple layout\", p_open, ImGuiWindowFlags_MenuBar))\n    {\n        if (ImGui::BeginMenuBar())\n        {\n            if (ImGui::BeginMenu(\"File\"))\n            {\n                if (ImGui::MenuItem(\"Close\")) *p_open = false;\n                ImGui::EndMenu();\n            }\n            ImGui::EndMenuBar();\n        }\n\n        // Left\n        static int selected = 0;\n        {\n            ImGui::BeginChild(\"left pane\", ImVec2(150, 0), true);\n            for (int i = 0; i < 100; i++)\n            {\n                // FIXME: Good candidate to use ImGuiSelectableFlags_SelectOnNav\n                char label[128];\n                sprintf(label, \"MyObject %d\", i);\n                if (ImGui::Selectable(label, selected == i))\n                    selected = i;\n            }\n            ImGui::EndChild();\n        }\n        ImGui::SameLine();\n\n        // Right\n        {\n            ImGui::BeginGroup();\n            ImGui::BeginChild(\"item view\", ImVec2(0, -ImGui::GetFrameHeightWithSpacing())); // Leave room for 1 line below us\n            ImGui::Text(\"MyObject: %d\", selected);\n            ImGui::Separator();\n            if (ImGui::BeginTabBar(\"##Tabs\", ImGuiTabBarFlags_None))\n            {\n                if (ImGui::BeginTabItem(\"Description\"))\n                {\n                    ImGui::TextWrapped(\"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. \");\n                    ImGui::EndTabItem();\n                }\n                if (ImGui::BeginTabItem(\"Details\"))\n                {\n                    ImGui::Text(\"ID: 0123456789\");\n                    ImGui::EndTabItem();\n                }\n                ImGui::EndTabBar();\n            }\n            ImGui::EndChild();\n            if (ImGui::Button(\"Revert\")) {}\n            ImGui::SameLine();\n            if (ImGui::Button(\"Save\")) {}\n            ImGui::EndGroup();\n        }\n    }\n    ImGui::End();\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] Example App: Property Editor / ShowExampleAppPropertyEditor()\n//-----------------------------------------------------------------------------\n\nstatic void ShowPlaceholderObject(const char* prefix, int uid)\n{\n    // Use object uid as identifier. Most commonly you could also use the object pointer as a base ID.\n    ImGui::PushID(uid);\n\n    // Text and Tree nodes are less high than framed widgets, using AlignTextToFramePadding() we add vertical spacing to make the tree lines equal high.\n    ImGui::TableNextRow();\n    ImGui::TableSetColumnIndex(0);\n    ImGui::AlignTextToFramePadding();\n    bool node_open = ImGui::TreeNode(\"Object\", \"%s_%u\", prefix, uid);\n    ImGui::TableSetColumnIndex(1);\n    ImGui::Text(\"my sailor is rich\");\n\n    if (node_open)\n    {\n        static float placeholder_members[8] = { 0.0f, 0.0f, 1.0f, 3.1416f, 100.0f, 999.0f };\n        for (int i = 0; i < 8; i++)\n        {\n            ImGui::PushID(i); // Use field index as identifier.\n            if (i < 2)\n            {\n                ShowPlaceholderObject(\"Child\", 424242);\n            }\n            else\n            {\n                // Here we use a TreeNode to highlight on hover (we could use e.g. Selectable as well)\n                ImGui::TableNextRow();\n                ImGui::TableSetColumnIndex(0);\n                ImGui::AlignTextToFramePadding();\n                ImGuiTreeNodeFlags flags = ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_NoTreePushOnOpen | ImGuiTreeNodeFlags_Bullet;\n                ImGui::TreeNodeEx(\"Field\", flags, \"Field_%d\", i);\n\n                ImGui::TableSetColumnIndex(1);\n                ImGui::SetNextItemWidth(-FLT_MIN);\n                if (i >= 5)\n                    ImGui::InputFloat(\"##value\", &placeholder_members[i], 1.0f);\n                else\n                    ImGui::DragFloat(\"##value\", &placeholder_members[i], 0.01f);\n                ImGui::NextColumn();\n            }\n            ImGui::PopID();\n        }\n        ImGui::TreePop();\n    }\n    ImGui::PopID();\n}\n\n// Demonstrate create a simple property editor.\nstatic void ShowExampleAppPropertyEditor(bool* p_open)\n{\n    ImGui::SetNextWindowSize(ImVec2(430, 450), ImGuiCond_FirstUseEver);\n    if (!ImGui::Begin(\"Example: Property editor\", p_open))\n    {\n        ImGui::End();\n        return;\n    }\n\n    HelpMarker(\n        \"This example shows how you may implement a property editor using two columns.\\n\"\n        \"All objects/fields data are dummies here.\\n\"\n        \"Remember that in many simple cases, you can use ImGui::SameLine(xxx) to position\\n\"\n        \"your cursor horizontally instead of using the Columns() API.\");\n\n    ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(2, 2));\n    if (ImGui::BeginTable(\"split\", 2, ImGuiTableFlags_BordersOuter | ImGuiTableFlags_Resizable))\n    {\n        // Iterate placeholder objects (all the same data)\n        for (int obj_i = 0; obj_i < 4; obj_i++)\n        {\n            ShowPlaceholderObject(\"Object\", obj_i);\n            //ImGui::Separator();\n        }\n        ImGui::EndTable();\n    }\n    ImGui::PopStyleVar();\n    ImGui::End();\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] Example App: Long Text / ShowExampleAppLongText()\n//-----------------------------------------------------------------------------\n\n// Demonstrate/test rendering huge amount of text, and the incidence of clipping.\nstatic void ShowExampleAppLongText(bool* p_open)\n{\n    ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);\n    if (!ImGui::Begin(\"Example: Long text display\", p_open))\n    {\n        ImGui::End();\n        return;\n    }\n\n    static int test_type = 0;\n    static ImGuiTextBuffer log;\n    static int lines = 0;\n    ImGui::Text(\"Printing unusually long amount of text.\");\n    ImGui::Combo(\"Test type\", &test_type,\n        \"Single call to TextUnformatted()\\0\"\n        \"Multiple calls to Text(), clipped\\0\"\n        \"Multiple calls to Text(), not clipped (slow)\\0\");\n    ImGui::Text(\"Buffer contents: %d lines, %d bytes\", lines, log.size());\n    if (ImGui::Button(\"Clear\")) { log.clear(); lines = 0; }\n    ImGui::SameLine();\n    if (ImGui::Button(\"Add 1000 lines\"))\n    {\n        for (int i = 0; i < 1000; i++)\n            log.appendf(\"%i The quick brown fox jumps over the lazy dog\\n\", lines + i);\n        lines += 1000;\n    }\n    ImGui::BeginChild(\"Log\");\n    switch (test_type)\n    {\n    case 0:\n        // Single call to TextUnformatted() with a big buffer\n        ImGui::TextUnformatted(log.begin(), log.end());\n        break;\n    case 1:\n        {\n            // Multiple calls to Text(), manually coarsely clipped - demonstrate how to use the ImGuiListClipper helper.\n            ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));\n            ImGuiListClipper clipper;\n            clipper.Begin(lines);\n            while (clipper.Step())\n                for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++)\n                    ImGui::Text(\"%i The quick brown fox jumps over the lazy dog\", i);\n            ImGui::PopStyleVar();\n            break;\n        }\n    case 2:\n        // Multiple calls to Text(), not clipped (slow)\n        ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));\n        for (int i = 0; i < lines; i++)\n            ImGui::Text(\"%i The quick brown fox jumps over the lazy dog\", i);\n        ImGui::PopStyleVar();\n        break;\n    }\n    ImGui::EndChild();\n    ImGui::End();\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] Example App: Auto Resize / ShowExampleAppAutoResize()\n//-----------------------------------------------------------------------------\n\n// Demonstrate creating a window which gets auto-resized according to its content.\nstatic void ShowExampleAppAutoResize(bool* p_open)\n{\n    if (!ImGui::Begin(\"Example: Auto-resizing window\", p_open, ImGuiWindowFlags_AlwaysAutoResize))\n    {\n        ImGui::End();\n        return;\n    }\n\n    static int lines = 10;\n    ImGui::TextUnformatted(\n        \"Window will resize every-frame to the size of its content.\\n\"\n        \"Note that you probably don't want to query the window size to\\n\"\n        \"output your content because that would create a feedback loop.\");\n    ImGui::SliderInt(\"Number of lines\", &lines, 1, 20);\n    for (int i = 0; i < lines; i++)\n        ImGui::Text(\"%*sThis is line %d\", i * 4, \"\", i); // Pad with space to extend size horizontally\n    ImGui::End();\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] Example App: Constrained Resize / ShowExampleAppConstrainedResize()\n//-----------------------------------------------------------------------------\n\n// Demonstrate creating a window with custom resize constraints.\nstatic void ShowExampleAppConstrainedResize(bool* p_open)\n{\n    struct CustomConstraints\n    {\n        // Helper functions to demonstrate programmatic constraints\n        static void Square(ImGuiSizeCallbackData* data) { data->DesiredSize.x = data->DesiredSize.y = IM_MAX(data->DesiredSize.x, data->DesiredSize.y); }\n        static void Step(ImGuiSizeCallbackData* data)   { float step = (float)(int)(intptr_t)data->UserData; data->DesiredSize = ImVec2((int)(data->DesiredSize.x / step + 0.5f) * step, (int)(data->DesiredSize.y / step + 0.5f) * step); }\n    };\n\n    const char* test_desc[] =\n    {\n        \"Resize vertical only\",\n        \"Resize horizontal only\",\n        \"Width > 100, Height > 100\",\n        \"Width 400-500\",\n        \"Height 400-500\",\n        \"Custom: Always Square\",\n        \"Custom: Fixed Steps (100)\",\n    };\n\n    static bool auto_resize = false;\n    static int type = 0;\n    static int display_lines = 10;\n    if (type == 0) ImGui::SetNextWindowSizeConstraints(ImVec2(-1, 0),    ImVec2(-1, FLT_MAX));      // Vertical only\n    if (type == 1) ImGui::SetNextWindowSizeConstraints(ImVec2(0, -1),    ImVec2(FLT_MAX, -1));      // Horizontal only\n    if (type == 2) ImGui::SetNextWindowSizeConstraints(ImVec2(100, 100), ImVec2(FLT_MAX, FLT_MAX)); // Width > 100, Height > 100\n    if (type == 3) ImGui::SetNextWindowSizeConstraints(ImVec2(400, -1),  ImVec2(500, -1));          // Width 400-500\n    if (type == 4) ImGui::SetNextWindowSizeConstraints(ImVec2(-1, 400),  ImVec2(-1, 500));          // Height 400-500\n    if (type == 5) ImGui::SetNextWindowSizeConstraints(ImVec2(0, 0),     ImVec2(FLT_MAX, FLT_MAX), CustomConstraints::Square);                     // Always Square\n    if (type == 6) ImGui::SetNextWindowSizeConstraints(ImVec2(0, 0),     ImVec2(FLT_MAX, FLT_MAX), CustomConstraints::Step, (void*)(intptr_t)100); // Fixed Step\n\n    ImGuiWindowFlags flags = auto_resize ? ImGuiWindowFlags_AlwaysAutoResize : 0;\n    if (ImGui::Begin(\"Example: Constrained Resize\", p_open, flags))\n    {\n        if (ImGui::Button(\"200x200\")) { ImGui::SetWindowSize(ImVec2(200, 200)); } ImGui::SameLine();\n        if (ImGui::Button(\"500x500\")) { ImGui::SetWindowSize(ImVec2(500, 500)); } ImGui::SameLine();\n        if (ImGui::Button(\"800x200\")) { ImGui::SetWindowSize(ImVec2(800, 200)); }\n        ImGui::SetNextItemWidth(200);\n        ImGui::Combo(\"Constraint\", &type, test_desc, IM_ARRAYSIZE(test_desc));\n        ImGui::SetNextItemWidth(200);\n        ImGui::DragInt(\"Lines\", &display_lines, 0.2f, 1, 100);\n        ImGui::Checkbox(\"Auto-resize\", &auto_resize);\n        for (int i = 0; i < display_lines; i++)\n            ImGui::Text(\"%*sHello, sailor! Making this line long enough for the example.\", i * 4, \"\");\n    }\n    ImGui::End();\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] Example App: Simple overlay / ShowExampleAppSimpleOverlay()\n//-----------------------------------------------------------------------------\n\n// Demonstrate creating a simple static window with no decoration\n// + a context-menu to choose which corner of the screen to use.\nstatic void ShowExampleAppSimpleOverlay(bool* p_open)\n{\n    static int corner = 0;\n    ImGuiIO& io = ImGui::GetIO();\n    ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav;\n    if (corner != -1)\n    {\n        const float PAD = 10.0f;\n        const ImGuiViewport* viewport = ImGui::GetMainViewport();\n        ImVec2 work_pos = viewport->WorkPos; // Use work area to avoid menu-bar/task-bar, if any!\n        ImVec2 work_size = viewport->WorkSize;\n        ImVec2 window_pos, window_pos_pivot;\n        window_pos.x = (corner & 1) ? (work_pos.x + work_size.x - PAD) : (work_pos.x + PAD);\n        window_pos.y = (corner & 2) ? (work_pos.y + work_size.y - PAD) : (work_pos.y + PAD);\n        window_pos_pivot.x = (corner & 1) ? 1.0f : 0.0f;\n        window_pos_pivot.y = (corner & 2) ? 1.0f : 0.0f;\n        ImGui::SetNextWindowPos(window_pos, ImGuiCond_Always, window_pos_pivot);\n        window_flags |= ImGuiWindowFlags_NoMove;\n    }\n    ImGui::SetNextWindowBgAlpha(0.35f); // Transparent background\n    if (ImGui::Begin(\"Example: Simple overlay\", p_open, window_flags))\n    {\n        ImGui::Text(\"Simple overlay\\n\" \"in the corner of the screen.\\n\" \"(right-click to change position)\");\n        ImGui::Separator();\n        if (ImGui::IsMousePosValid())\n            ImGui::Text(\"Mouse Position: (%.1f,%.1f)\", io.MousePos.x, io.MousePos.y);\n        else\n            ImGui::Text(\"Mouse Position: <invalid>\");\n        if (ImGui::BeginPopupContextWindow())\n        {\n            if (ImGui::MenuItem(\"Custom\",       NULL, corner == -1)) corner = -1;\n            if (ImGui::MenuItem(\"Top-left\",     NULL, corner == 0)) corner = 0;\n            if (ImGui::MenuItem(\"Top-right\",    NULL, corner == 1)) corner = 1;\n            if (ImGui::MenuItem(\"Bottom-left\",  NULL, corner == 2)) corner = 2;\n            if (ImGui::MenuItem(\"Bottom-right\", NULL, corner == 3)) corner = 3;\n            if (p_open && ImGui::MenuItem(\"Close\")) *p_open = false;\n            ImGui::EndPopup();\n        }\n    }\n    ImGui::End();\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] Example App: Fullscreen window / ShowExampleAppFullscreen()\n//-----------------------------------------------------------------------------\n\n// Demonstrate creating a window covering the entire screen/viewport\nstatic void ShowExampleAppFullscreen(bool* p_open)\n{\n    static bool use_work_area = true;\n    static ImGuiWindowFlags flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings;\n\n    // We demonstrate using the full viewport area or the work area (without menu-bars, task-bars etc.)\n    // Based on your use case you may want one of the other.\n    const ImGuiViewport* viewport = ImGui::GetMainViewport();\n    ImGui::SetNextWindowPos(use_work_area ? viewport->WorkPos : viewport->Pos);\n    ImGui::SetNextWindowSize(use_work_area ? viewport->WorkSize : viewport->Size);\n\n    if (ImGui::Begin(\"Example: Fullscreen window\", p_open, flags))\n    {\n        ImGui::Checkbox(\"Use work area instead of main area\", &use_work_area);\n        ImGui::SameLine();\n        HelpMarker(\"Main Area = entire viewport,\\nWork Area = entire viewport minus sections used by the main menu bars, task bars etc.\\n\\nEnable the main-menu bar in Examples menu to see the difference.\");\n\n        ImGui::CheckboxFlags(\"ImGuiWindowFlags_NoBackground\", &flags, ImGuiWindowFlags_NoBackground);\n        ImGui::CheckboxFlags(\"ImGuiWindowFlags_NoDecoration\", &flags, ImGuiWindowFlags_NoDecoration);\n        ImGui::Indent();\n        ImGui::CheckboxFlags(\"ImGuiWindowFlags_NoTitleBar\", &flags, ImGuiWindowFlags_NoTitleBar);\n        ImGui::CheckboxFlags(\"ImGuiWindowFlags_NoCollapse\", &flags, ImGuiWindowFlags_NoCollapse);\n        ImGui::CheckboxFlags(\"ImGuiWindowFlags_NoScrollbar\", &flags, ImGuiWindowFlags_NoScrollbar);\n        ImGui::Unindent();\n\n        if (p_open && ImGui::Button(\"Close this window\"))\n            *p_open = false;\n    }\n    ImGui::End();\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] Example App: Manipulating Window Titles / ShowExampleAppWindowTitles()\n//-----------------------------------------------------------------------------\n\n// Demonstrate using \"##\" and \"###\" in identifiers to manipulate ID generation.\n// This apply to all regular items as well.\n// Read FAQ section \"How can I have multiple widgets with the same label?\" for details.\nstatic void ShowExampleAppWindowTitles(bool*)\n{\n    const ImGuiViewport* viewport = ImGui::GetMainViewport();\n    const ImVec2 base_pos = viewport->Pos;\n\n    // By default, Windows are uniquely identified by their title.\n    // You can use the \"##\" and \"###\" markers to manipulate the display/ID.\n\n    // Using \"##\" to display same title but have unique identifier.\n    ImGui::SetNextWindowPos(ImVec2(base_pos.x + 100, base_pos.y + 100), ImGuiCond_FirstUseEver);\n    ImGui::Begin(\"Same title as another window##1\");\n    ImGui::Text(\"This is window 1.\\nMy title is the same as window 2, but my identifier is unique.\");\n    ImGui::End();\n\n    ImGui::SetNextWindowPos(ImVec2(base_pos.x + 100, base_pos.y + 200), ImGuiCond_FirstUseEver);\n    ImGui::Begin(\"Same title as another window##2\");\n    ImGui::Text(\"This is window 2.\\nMy title is the same as window 1, but my identifier is unique.\");\n    ImGui::End();\n\n    // Using \"###\" to display a changing title but keep a static identifier \"AnimatedTitle\"\n    char buf[128];\n    sprintf(buf, \"Animated title %c %d###AnimatedTitle\", \"|/-\\\\\"[(int)(ImGui::GetTime() / 0.25f) & 3], ImGui::GetFrameCount());\n    ImGui::SetNextWindowPos(ImVec2(base_pos.x + 100, base_pos.y + 300), ImGuiCond_FirstUseEver);\n    ImGui::Begin(buf);\n    ImGui::Text(\"This window has a changing title.\");\n    ImGui::End();\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] Example App: Custom Rendering using ImDrawList API / ShowExampleAppCustomRendering()\n//-----------------------------------------------------------------------------\n\n// Demonstrate using the low-level ImDrawList to draw custom shapes.\nstatic void ShowExampleAppCustomRendering(bool* p_open)\n{\n    if (!ImGui::Begin(\"Example: Custom rendering\", p_open))\n    {\n        ImGui::End();\n        return;\n    }\n\n    // Tip: If you do a lot of custom rendering, you probably want to use your own geometrical types and benefit of\n    // overloaded operators, etc. Define IM_VEC2_CLASS_EXTRA in imconfig.h to create implicit conversions between your\n    // types and ImVec2/ImVec4. Dear ImGui defines overloaded operators but they are internal to imgui.cpp and not\n    // exposed outside (to avoid messing with your types) In this example we are not using the maths operators!\n\n    if (ImGui::BeginTabBar(\"##TabBar\"))\n    {\n        if (ImGui::BeginTabItem(\"Primitives\"))\n        {\n            ImGui::PushItemWidth(-ImGui::GetFontSize() * 15);\n            ImDrawList* draw_list = ImGui::GetWindowDrawList();\n\n            // Draw gradients\n            // (note that those are currently exacerbating our sRGB/Linear issues)\n            // Calling ImGui::GetColorU32() multiplies the given colors by the current Style Alpha, but you may pass the IM_COL32() directly as well..\n            ImGui::Text(\"Gradients\");\n            ImVec2 gradient_size = ImVec2(ImGui::CalcItemWidth(), ImGui::GetFrameHeight());\n            {\n                ImVec2 p0 = ImGui::GetCursorScreenPos();\n                ImVec2 p1 = ImVec2(p0.x + gradient_size.x, p0.y + gradient_size.y);\n                ImU32 col_a = ImGui::GetColorU32(IM_COL32(0, 0, 0, 255));\n                ImU32 col_b = ImGui::GetColorU32(IM_COL32(255, 255, 255, 255));\n                draw_list->AddRectFilledMultiColor(p0, p1, col_a, col_b, col_b, col_a);\n                ImGui::InvisibleButton(\"##gradient1\", gradient_size);\n            }\n            {\n                ImVec2 p0 = ImGui::GetCursorScreenPos();\n                ImVec2 p1 = ImVec2(p0.x + gradient_size.x, p0.y + gradient_size.y);\n                ImU32 col_a = ImGui::GetColorU32(IM_COL32(0, 255, 0, 255));\n                ImU32 col_b = ImGui::GetColorU32(IM_COL32(255, 0, 0, 255));\n                draw_list->AddRectFilledMultiColor(p0, p1, col_a, col_b, col_b, col_a);\n                ImGui::InvisibleButton(\"##gradient2\", gradient_size);\n            }\n\n            // Draw a bunch of primitives\n            ImGui::Text(\"All primitives\");\n            static float sz = 36.0f;\n            static float thickness = 3.0f;\n            static int ngon_sides = 6;\n            static bool circle_segments_override = false;\n            static int circle_segments_override_v = 12;\n            static bool curve_segments_override = false;\n            static int curve_segments_override_v = 8;\n            static ImVec4 colf = ImVec4(1.0f, 1.0f, 0.4f, 1.0f);\n            ImGui::DragFloat(\"Size\", &sz, 0.2f, 2.0f, 100.0f, \"%.0f\");\n            ImGui::DragFloat(\"Thickness\", &thickness, 0.05f, 1.0f, 8.0f, \"%.02f\");\n            ImGui::SliderInt(\"N-gon sides\", &ngon_sides, 3, 12);\n            ImGui::Checkbox(\"##circlesegmentoverride\", &circle_segments_override);\n            ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);\n            circle_segments_override |= ImGui::SliderInt(\"Circle segments override\", &circle_segments_override_v, 3, 40);\n            ImGui::Checkbox(\"##curvessegmentoverride\", &curve_segments_override);\n            ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);\n            curve_segments_override |= ImGui::SliderInt(\"Curves segments override\", &curve_segments_override_v, 3, 40);\n            ImGui::ColorEdit4(\"Color\", &colf.x);\n\n            const ImVec2 p = ImGui::GetCursorScreenPos();\n            const ImU32 col = ImColor(colf);\n            const float spacing = 10.0f;\n            const ImDrawFlags corners_tl_br = ImDrawFlags_RoundCornersTopLeft | ImDrawFlags_RoundCornersBottomRight;\n            const float rounding = sz / 5.0f;\n            const int circle_segments = circle_segments_override ? circle_segments_override_v : 0;\n            const int curve_segments = curve_segments_override ? curve_segments_override_v : 0;\n            float x = p.x + 4.0f;\n            float y = p.y + 4.0f;\n            for (int n = 0; n < 2; n++)\n            {\n                // First line uses a thickness of 1.0f, second line uses the configurable thickness\n                float th = (n == 0) ? 1.0f : thickness;\n                draw_list->AddNgon(ImVec2(x + sz*0.5f, y + sz*0.5f), sz*0.5f, col, ngon_sides, th);                 x += sz + spacing;  // N-gon\n                draw_list->AddCircle(ImVec2(x + sz*0.5f, y + sz*0.5f), sz*0.5f, col, circle_segments, th);          x += sz + spacing;  // Circle\n                draw_list->AddRect(ImVec2(x, y), ImVec2(x + sz, y + sz), col, 0.0f, ImDrawFlags_None, th);          x += sz + spacing;  // Square\n                draw_list->AddRect(ImVec2(x, y), ImVec2(x + sz, y + sz), col, rounding, ImDrawFlags_None, th);      x += sz + spacing;  // Square with all rounded corners\n                draw_list->AddRect(ImVec2(x, y), ImVec2(x + sz, y + sz), col, rounding, corners_tl_br, th);         x += sz + spacing;  // Square with two rounded corners\n                draw_list->AddTriangle(ImVec2(x+sz*0.5f,y), ImVec2(x+sz, y+sz-0.5f), ImVec2(x, y+sz-0.5f), col, th);x += sz + spacing;  // Triangle\n                //draw_list->AddTriangle(ImVec2(x+sz*0.2f,y), ImVec2(x, y+sz-0.5f), ImVec2(x+sz*0.4f, y+sz-0.5f), col, th);x+= sz*0.4f + spacing; // Thin triangle\n                draw_list->AddLine(ImVec2(x, y), ImVec2(x + sz, y), col, th);                                       x += sz + spacing;  // Horizontal line (note: drawing a filled rectangle will be faster!)\n                draw_list->AddLine(ImVec2(x, y), ImVec2(x, y + sz), col, th);                                       x += spacing;       // Vertical line (note: drawing a filled rectangle will be faster!)\n                draw_list->AddLine(ImVec2(x, y), ImVec2(x + sz, y + sz), col, th);                                  x += sz + spacing;  // Diagonal line\n\n                // Quadratic Bezier Curve (3 control points)\n                ImVec2 cp3[3] = { ImVec2(x, y + sz * 0.6f), ImVec2(x + sz * 0.5f, y - sz * 0.4f), ImVec2(x + sz, y + sz) };\n                draw_list->AddBezierQuadratic(cp3[0], cp3[1], cp3[2], col, th, curve_segments); x += sz + spacing;\n\n                // Cubic Bezier Curve (4 control points)\n                ImVec2 cp4[4] = { ImVec2(x, y), ImVec2(x + sz * 1.3f, y + sz * 0.3f), ImVec2(x + sz - sz * 1.3f, y + sz - sz * 0.3f), ImVec2(x + sz, y + sz) };\n                draw_list->AddBezierCubic(cp4[0], cp4[1], cp4[2], cp4[3], col, th, curve_segments);\n\n                x = p.x + 4;\n                y += sz + spacing;\n            }\n            draw_list->AddNgonFilled(ImVec2(x + sz * 0.5f, y + sz * 0.5f), sz*0.5f, col, ngon_sides);               x += sz + spacing;  // N-gon\n            draw_list->AddCircleFilled(ImVec2(x + sz*0.5f, y + sz*0.5f), sz*0.5f, col, circle_segments);            x += sz + spacing;  // Circle\n            draw_list->AddRectFilled(ImVec2(x, y), ImVec2(x + sz, y + sz), col);                                    x += sz + spacing;  // Square\n            draw_list->AddRectFilled(ImVec2(x, y), ImVec2(x + sz, y + sz), col, 10.0f);                             x += sz + spacing;  // Square with all rounded corners\n            draw_list->AddRectFilled(ImVec2(x, y), ImVec2(x + sz, y + sz), col, 10.0f, corners_tl_br);              x += sz + spacing;  // Square with two rounded corners\n            draw_list->AddTriangleFilled(ImVec2(x+sz*0.5f,y), ImVec2(x+sz, y+sz-0.5f), ImVec2(x, y+sz-0.5f), col);  x += sz + spacing;  // Triangle\n            //draw_list->AddTriangleFilled(ImVec2(x+sz*0.2f,y), ImVec2(x, y+sz-0.5f), ImVec2(x+sz*0.4f, y+sz-0.5f), col); x += sz*0.4f + spacing; // Thin triangle\n            draw_list->AddRectFilled(ImVec2(x, y), ImVec2(x + sz, y + thickness), col);                             x += sz + spacing;  // Horizontal line (faster than AddLine, but only handle integer thickness)\n            draw_list->AddRectFilled(ImVec2(x, y), ImVec2(x + thickness, y + sz), col);                             x += spacing * 2.0f;// Vertical line (faster than AddLine, but only handle integer thickness)\n            draw_list->AddRectFilled(ImVec2(x, y), ImVec2(x + 1, y + 1), col);                                      x += sz;            // Pixel (faster than AddLine)\n            draw_list->AddRectFilledMultiColor(ImVec2(x, y), ImVec2(x + sz, y + sz), IM_COL32(0, 0, 0, 255), IM_COL32(255, 0, 0, 255), IM_COL32(255, 255, 0, 255), IM_COL32(0, 255, 0, 255));\n\n            ImGui::Dummy(ImVec2((sz + spacing) * 10.2f, (sz + spacing) * 3.0f));\n            ImGui::PopItemWidth();\n            ImGui::EndTabItem();\n        }\n\n        if (ImGui::BeginTabItem(\"Canvas\"))\n        {\n            static ImVector<ImVec2> points;\n            static ImVec2 scrolling(0.0f, 0.0f);\n            static bool opt_enable_grid = true;\n            static bool opt_enable_context_menu = true;\n            static bool adding_line = false;\n\n            ImGui::Checkbox(\"Enable grid\", &opt_enable_grid);\n            ImGui::Checkbox(\"Enable context menu\", &opt_enable_context_menu);\n            ImGui::Text(\"Mouse Left: drag to add lines,\\nMouse Right: drag to scroll, click for context menu.\");\n\n            // Typically you would use a BeginChild()/EndChild() pair to benefit from a clipping region + own scrolling.\n            // Here we demonstrate that this can be replaced by simple offsetting + custom drawing + PushClipRect/PopClipRect() calls.\n            // To use a child window instead we could use, e.g:\n            //      ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));      // Disable padding\n            //      ImGui::PushStyleColor(ImGuiCol_ChildBg, IM_COL32(50, 50, 50, 255));  // Set a background color\n            //      ImGui::BeginChild(\"canvas\", ImVec2(0.0f, 0.0f), true, ImGuiWindowFlags_NoMove);\n            //      ImGui::PopStyleColor();\n            //      ImGui::PopStyleVar();\n            //      [...]\n            //      ImGui::EndChild();\n\n            // Using InvisibleButton() as a convenience 1) it will advance the layout cursor and 2) allows us to use IsItemHovered()/IsItemActive()\n            ImVec2 canvas_p0 = ImGui::GetCursorScreenPos();      // ImDrawList API uses screen coordinates!\n            ImVec2 canvas_sz = ImGui::GetContentRegionAvail();   // Resize canvas to what's available\n            if (canvas_sz.x < 50.0f) canvas_sz.x = 50.0f;\n            if (canvas_sz.y < 50.0f) canvas_sz.y = 50.0f;\n            ImVec2 canvas_p1 = ImVec2(canvas_p0.x + canvas_sz.x, canvas_p0.y + canvas_sz.y);\n\n            // Draw border and background color\n            ImGuiIO& io = ImGui::GetIO();\n            ImDrawList* draw_list = ImGui::GetWindowDrawList();\n            draw_list->AddRectFilled(canvas_p0, canvas_p1, IM_COL32(50, 50, 50, 255));\n            draw_list->AddRect(canvas_p0, canvas_p1, IM_COL32(255, 255, 255, 255));\n\n            // This will catch our interactions\n            ImGui::InvisibleButton(\"canvas\", canvas_sz, ImGuiButtonFlags_MouseButtonLeft | ImGuiButtonFlags_MouseButtonRight);\n            const bool is_hovered = ImGui::IsItemHovered(); // Hovered\n            const bool is_active = ImGui::IsItemActive();   // Held\n            const ImVec2 origin(canvas_p0.x + scrolling.x, canvas_p0.y + scrolling.y); // Lock scrolled origin\n            const ImVec2 mouse_pos_in_canvas(io.MousePos.x - origin.x, io.MousePos.y - origin.y);\n\n            // Add first and second point\n            if (is_hovered && !adding_line && ImGui::IsMouseClicked(ImGuiMouseButton_Left))\n            {\n                points.push_back(mouse_pos_in_canvas);\n                points.push_back(mouse_pos_in_canvas);\n                adding_line = true;\n            }\n            if (adding_line)\n            {\n                points.back() = mouse_pos_in_canvas;\n                if (!ImGui::IsMouseDown(ImGuiMouseButton_Left))\n                    adding_line = false;\n            }\n\n            // Pan (we use a zero mouse threshold when there's no context menu)\n            // You may decide to make that threshold dynamic based on whether the mouse is hovering something etc.\n            const float mouse_threshold_for_pan = opt_enable_context_menu ? -1.0f : 0.0f;\n            if (is_active && ImGui::IsMouseDragging(ImGuiMouseButton_Right, mouse_threshold_for_pan))\n            {\n                scrolling.x += io.MouseDelta.x;\n                scrolling.y += io.MouseDelta.y;\n            }\n\n            // Context menu (under default mouse threshold)\n            ImVec2 drag_delta = ImGui::GetMouseDragDelta(ImGuiMouseButton_Right);\n            if (opt_enable_context_menu && ImGui::IsMouseReleased(ImGuiMouseButton_Right) && drag_delta.x == 0.0f && drag_delta.y == 0.0f)\n                ImGui::OpenPopupOnItemClick(\"context\");\n            if (ImGui::BeginPopup(\"context\"))\n            {\n                if (adding_line)\n                    points.resize(points.size() - 2);\n                adding_line = false;\n                if (ImGui::MenuItem(\"Remove one\", NULL, false, points.Size > 0)) { points.resize(points.size() - 2); }\n                if (ImGui::MenuItem(\"Remove all\", NULL, false, points.Size > 0)) { points.clear(); }\n                ImGui::EndPopup();\n            }\n\n            // Draw grid + all lines in the canvas\n            draw_list->PushClipRect(canvas_p0, canvas_p1, true);\n            if (opt_enable_grid)\n            {\n                const float GRID_STEP = 64.0f;\n                for (float x = fmodf(scrolling.x, GRID_STEP); x < canvas_sz.x; x += GRID_STEP)\n                    draw_list->AddLine(ImVec2(canvas_p0.x + x, canvas_p0.y), ImVec2(canvas_p0.x + x, canvas_p1.y), IM_COL32(200, 200, 200, 40));\n                for (float y = fmodf(scrolling.y, GRID_STEP); y < canvas_sz.y; y += GRID_STEP)\n                    draw_list->AddLine(ImVec2(canvas_p0.x, canvas_p0.y + y), ImVec2(canvas_p1.x, canvas_p0.y + y), IM_COL32(200, 200, 200, 40));\n            }\n            for (int n = 0; n < points.Size; n += 2)\n                draw_list->AddLine(ImVec2(origin.x + points[n].x, origin.y + points[n].y), ImVec2(origin.x + points[n + 1].x, origin.y + points[n + 1].y), IM_COL32(255, 255, 0, 255), 2.0f);\n            draw_list->PopClipRect();\n\n            ImGui::EndTabItem();\n        }\n\n        if (ImGui::BeginTabItem(\"BG/FG draw lists\"))\n        {\n            static bool draw_bg = true;\n            static bool draw_fg = true;\n            ImGui::Checkbox(\"Draw in Background draw list\", &draw_bg);\n            ImGui::SameLine(); HelpMarker(\"The Background draw list will be rendered below every Dear ImGui windows.\");\n            ImGui::Checkbox(\"Draw in Foreground draw list\", &draw_fg);\n            ImGui::SameLine(); HelpMarker(\"The Foreground draw list will be rendered over every Dear ImGui windows.\");\n            ImVec2 window_pos = ImGui::GetWindowPos();\n            ImVec2 window_size = ImGui::GetWindowSize();\n            ImVec2 window_center = ImVec2(window_pos.x + window_size.x * 0.5f, window_pos.y + window_size.y * 0.5f);\n            if (draw_bg)\n                ImGui::GetBackgroundDrawList()->AddCircle(window_center, window_size.x * 0.6f, IM_COL32(255, 0, 0, 200), 0, 10 + 4);\n            if (draw_fg)\n                ImGui::GetForegroundDrawList()->AddCircle(window_center, window_size.y * 0.6f, IM_COL32(0, 255, 0, 200), 0, 10);\n            ImGui::EndTabItem();\n        }\n\n        ImGui::EndTabBar();\n    }\n\n    ImGui::End();\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] Example App: Documents Handling / ShowExampleAppDocuments()\n//-----------------------------------------------------------------------------\n\n// Simplified structure to mimic a Document model\nstruct MyDocument\n{\n    const char* Name;       // Document title\n    bool        Open;       // Set when open (we keep an array of all available documents to simplify demo code!)\n    bool        OpenPrev;   // Copy of Open from last update.\n    bool        Dirty;      // Set when the document has been modified\n    bool        WantClose;  // Set when the document\n    ImVec4      Color;      // An arbitrary variable associated to the document\n\n    MyDocument(const char* name, bool open = true, const ImVec4& color = ImVec4(1.0f, 1.0f, 1.0f, 1.0f))\n    {\n        Name = name;\n        Open = OpenPrev = open;\n        Dirty = false;\n        WantClose = false;\n        Color = color;\n    }\n    void DoOpen()       { Open = true; }\n    void DoQueueClose() { WantClose = true; }\n    void DoForceClose() { Open = false; Dirty = false; }\n    void DoSave()       { Dirty = false; }\n\n    // Display placeholder contents for the Document\n    static void DisplayContents(MyDocument* doc)\n    {\n        ImGui::PushID(doc);\n        ImGui::Text(\"Document \\\"%s\\\"\", doc->Name);\n        ImGui::PushStyleColor(ImGuiCol_Text, doc->Color);\n        ImGui::TextWrapped(\"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\");\n        ImGui::PopStyleColor();\n        if (ImGui::Button(\"Modify\", ImVec2(100, 0)))\n            doc->Dirty = true;\n        ImGui::SameLine();\n        if (ImGui::Button(\"Save\", ImVec2(100, 0)))\n            doc->DoSave();\n        ImGui::ColorEdit3(\"color\", &doc->Color.x);  // Useful to test drag and drop and hold-dragged-to-open-tab behavior.\n        ImGui::PopID();\n    }\n\n    // Display context menu for the Document\n    static void DisplayContextMenu(MyDocument* doc)\n    {\n        if (!ImGui::BeginPopupContextItem())\n            return;\n\n        char buf[256];\n        sprintf(buf, \"Save %s\", doc->Name);\n        if (ImGui::MenuItem(buf, \"CTRL+S\", false, doc->Open))\n            doc->DoSave();\n        if (ImGui::MenuItem(\"Close\", \"CTRL+W\", false, doc->Open))\n            doc->DoQueueClose();\n        ImGui::EndPopup();\n    }\n};\n\nstruct ExampleAppDocuments\n{\n    ImVector<MyDocument> Documents;\n\n    ExampleAppDocuments()\n    {\n        Documents.push_back(MyDocument(\"Lettuce\",             true,  ImVec4(0.4f, 0.8f, 0.4f, 1.0f)));\n        Documents.push_back(MyDocument(\"Eggplant\",            true,  ImVec4(0.8f, 0.5f, 1.0f, 1.0f)));\n        Documents.push_back(MyDocument(\"Carrot\",              true,  ImVec4(1.0f, 0.8f, 0.5f, 1.0f)));\n        Documents.push_back(MyDocument(\"Tomato\",              false, ImVec4(1.0f, 0.3f, 0.4f, 1.0f)));\n        Documents.push_back(MyDocument(\"A Rather Long Title\", false));\n        Documents.push_back(MyDocument(\"Some Document\",       false));\n    }\n};\n\n// [Optional] Notify the system of Tabs/Windows closure that happened outside the regular tab interface.\n// If a tab has been closed programmatically (aka closed from another source such as the Checkbox() in the demo,\n// as opposed to clicking on the regular tab closing button) and stops being submitted, it will take a frame for\n// the tab bar to notice its absence. During this frame there will be a gap in the tab bar, and if the tab that has\n// disappeared was the selected one, the tab bar will report no selected tab during the frame. This will effectively\n// give the impression of a flicker for one frame.\n// We call SetTabItemClosed() to manually notify the Tab Bar or Docking system of removed tabs to avoid this glitch.\n// Note that this completely optional, and only affect tab bars with the ImGuiTabBarFlags_Reorderable flag.\nstatic void NotifyOfDocumentsClosedElsewhere(ExampleAppDocuments& app)\n{\n    for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++)\n    {\n        MyDocument* doc = &app.Documents[doc_n];\n        if (!doc->Open && doc->OpenPrev)\n            ImGui::SetTabItemClosed(doc->Name);\n        doc->OpenPrev = doc->Open;\n    }\n}\n\nvoid ShowExampleAppDocuments(bool* p_open)\n{\n    static ExampleAppDocuments app;\n\n    // Options\n    static bool opt_reorderable = true;\n    static ImGuiTabBarFlags opt_fitting_flags = ImGuiTabBarFlags_FittingPolicyDefault_;\n\n    bool window_contents_visible = ImGui::Begin(\"Example: Documents\", p_open, ImGuiWindowFlags_MenuBar);\n    if (!window_contents_visible)\n    {\n        ImGui::End();\n        return;\n    }\n\n    // Menu\n    if (ImGui::BeginMenuBar())\n    {\n        if (ImGui::BeginMenu(\"File\"))\n        {\n            int open_count = 0;\n            for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++)\n                open_count += app.Documents[doc_n].Open ? 1 : 0;\n\n            if (ImGui::BeginMenu(\"Open\", open_count < app.Documents.Size))\n            {\n                for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++)\n                {\n                    MyDocument* doc = &app.Documents[doc_n];\n                    if (!doc->Open)\n                        if (ImGui::MenuItem(doc->Name))\n                            doc->DoOpen();\n                }\n                ImGui::EndMenu();\n            }\n            if (ImGui::MenuItem(\"Close All Documents\", NULL, false, open_count > 0))\n                for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++)\n                    app.Documents[doc_n].DoQueueClose();\n            if (ImGui::MenuItem(\"Exit\", \"Alt+F4\")) {}\n            ImGui::EndMenu();\n        }\n        ImGui::EndMenuBar();\n    }\n\n    // [Debug] List documents with one checkbox for each\n    for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++)\n    {\n        MyDocument* doc = &app.Documents[doc_n];\n        if (doc_n > 0)\n            ImGui::SameLine();\n        ImGui::PushID(doc);\n        if (ImGui::Checkbox(doc->Name, &doc->Open))\n            if (!doc->Open)\n                doc->DoForceClose();\n        ImGui::PopID();\n    }\n\n    ImGui::Separator();\n\n    // About the ImGuiWindowFlags_UnsavedDocument / ImGuiTabItemFlags_UnsavedDocument flags.\n    // They have multiple effects:\n    // - Display a dot next to the title.\n    // - Tab is selected when clicking the X close button.\n    // - Closure is not assumed (will wait for user to stop submitting the tab).\n    //   Otherwise closure is assumed when pressing the X, so if you keep submitting the tab may reappear at end of tab bar.\n    //   We need to assume closure by default otherwise waiting for \"lack of submission\" on the next frame would leave an empty\n    //   hole for one-frame, both in the tab-bar and in tab-contents when closing a tab/window.\n    //   The rarely used SetTabItemClosed() function is a way to notify of programmatic closure to avoid the one-frame hole.\n\n    // Submit Tab Bar and Tabs\n    {\n        ImGuiTabBarFlags tab_bar_flags = (opt_fitting_flags) | (opt_reorderable ? ImGuiTabBarFlags_Reorderable : 0);\n        if (ImGui::BeginTabBar(\"##tabs\", tab_bar_flags))\n        {\n            if (opt_reorderable)\n                NotifyOfDocumentsClosedElsewhere(app);\n\n            // [DEBUG] Stress tests\n            //if ((ImGui::GetFrameCount() % 30) == 0) docs[1].Open ^= 1;            // [DEBUG] Automatically show/hide a tab. Test various interactions e.g. dragging with this on.\n            //if (ImGui::GetIO().KeyCtrl) ImGui::SetTabItemSelected(docs[1].Name);  // [DEBUG] Test SetTabItemSelected(), probably not very useful as-is anyway..\n\n            // Submit Tabs\n            for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++)\n            {\n                MyDocument* doc = &app.Documents[doc_n];\n                if (!doc->Open)\n                    continue;\n\n                ImGuiTabItemFlags tab_flags = (doc->Dirty ? ImGuiTabItemFlags_UnsavedDocument : 0);\n                bool visible = ImGui::BeginTabItem(doc->Name, &doc->Open, tab_flags);\n\n                // Cancel attempt to close when unsaved add to save queue so we can display a popup.\n                if (!doc->Open && doc->Dirty)\n                {\n                    doc->Open = true;\n                    doc->DoQueueClose();\n                }\n\n                MyDocument::DisplayContextMenu(doc);\n                if (visible)\n                {\n                    MyDocument::DisplayContents(doc);\n                    ImGui::EndTabItem();\n                }\n            }\n\n            ImGui::EndTabBar();\n        }\n    }\n\n    // Update closing queue\n    static ImVector<MyDocument*> close_queue;\n    if (close_queue.empty())\n    {\n        // Close queue is locked once we started a popup\n        for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++)\n        {\n            MyDocument* doc = &app.Documents[doc_n];\n            if (doc->WantClose)\n            {\n                doc->WantClose = false;\n                close_queue.push_back(doc);\n            }\n        }\n    }\n\n    // Display closing confirmation UI\n    if (!close_queue.empty())\n    {\n        int close_queue_unsaved_documents = 0;\n        for (int n = 0; n < close_queue.Size; n++)\n            if (close_queue[n]->Dirty)\n                close_queue_unsaved_documents++;\n\n        if (close_queue_unsaved_documents == 0)\n        {\n            // Close documents when all are unsaved\n            for (int n = 0; n < close_queue.Size; n++)\n                close_queue[n]->DoForceClose();\n            close_queue.clear();\n        }\n        else\n        {\n            if (!ImGui::IsPopupOpen(\"Save?\"))\n                ImGui::OpenPopup(\"Save?\");\n            if (ImGui::BeginPopupModal(\"Save?\", NULL, ImGuiWindowFlags_AlwaysAutoResize))\n            {\n                ImGui::Text(\"Save change to the following items?\");\n                float item_height = ImGui::GetTextLineHeightWithSpacing();\n                if (ImGui::BeginChildFrame(ImGui::GetID(\"frame\"), ImVec2(-FLT_MIN, 6.25f * item_height)))\n                {\n                    for (int n = 0; n < close_queue.Size; n++)\n                        if (close_queue[n]->Dirty)\n                            ImGui::Text(\"%s\", close_queue[n]->Name);\n                    ImGui::EndChildFrame();\n                }\n\n                ImVec2 button_size(ImGui::GetFontSize() * 7.0f, 0.0f);\n                if (ImGui::Button(\"Yes\", button_size))\n                {\n                    for (int n = 0; n < close_queue.Size; n++)\n                    {\n                        if (close_queue[n]->Dirty)\n                            close_queue[n]->DoSave();\n                        close_queue[n]->DoForceClose();\n                    }\n                    close_queue.clear();\n                    ImGui::CloseCurrentPopup();\n                }\n                ImGui::SameLine();\n                if (ImGui::Button(\"No\", button_size))\n                {\n                    for (int n = 0; n < close_queue.Size; n++)\n                        close_queue[n]->DoForceClose();\n                    close_queue.clear();\n                    ImGui::CloseCurrentPopup();\n                }\n                ImGui::SameLine();\n                if (ImGui::Button(\"Cancel\", button_size))\n                {\n                    close_queue.clear();\n                    ImGui::CloseCurrentPopup();\n                }\n                ImGui::EndPopup();\n            }\n        }\n    }\n\n    ImGui::End();\n}\n\n// End of Demo code\n#else\n\nvoid ImGui::ShowAboutWindow(bool*) {}\nvoid ImGui::ShowDemoWindow(bool*) {}\nvoid ImGui::ShowUserGuide() {}\nvoid ImGui::ShowStyleEditor(ImGuiStyle*) {}\n\n#endif\n\n#endif // #ifndef IMGUI_DISABLE\n"
  },
  {
    "path": "R3nzSkin/imgui/imgui_draw.cpp",
    "content": "// dear imgui, v1.84\n// (drawing and font code)\n\n/*\n\nIndex of this file:\n\n// [SECTION] STB libraries implementation\n// [SECTION] Style functions\n// [SECTION] ImDrawList\n// [SECTION] ImDrawListSplitter\n// [SECTION] ImDrawData\n// [SECTION] Helpers ShadeVertsXXX functions\n// [SECTION] ImFontConfig\n// [SECTION] ImFontAtlas\n// [SECTION] ImFontAtlas glyph ranges helpers\n// [SECTION] ImFontGlyphRangesBuilder\n// [SECTION] ImFont\n// [SECTION] ImGui Internal Render Helpers\n// [SECTION] Decompression code\n// [SECTION] Default font data (ProggyClean.ttf)\n\n*/\n\n#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)\n#define _CRT_SECURE_NO_WARNINGS\n#endif\n\n#include \"imgui.h\"\n#ifndef IMGUI_DISABLE\n\n#ifndef IMGUI_DEFINE_MATH_OPERATORS\n#define IMGUI_DEFINE_MATH_OPERATORS\n#endif\n\n#include \"imgui_internal.h\"\n#ifdef IMGUI_ENABLE_FREETYPE\n#include \"misc/freetype/imgui_freetype.h\"\n#endif\n\n#include <stdio.h>      // vsnprintf, sscanf, printf\n#if !defined(alloca)\n#if defined(__GLIBC__) || defined(__sun) || defined(__APPLE__) || defined(__NEWLIB__)\n#include <alloca.h>     // alloca (glibc uses <alloca.h>. Note that Cygwin may have _WIN32 defined, so the order matters here)\n#elif defined(_WIN32)\n#include <malloc.h>     // alloca\n#if !defined(alloca)\n#define alloca _alloca  // for clang with MS Codegen\n#endif\n#else\n#include <stdlib.h>     // alloca\n#endif\n#endif\n\n// Visual Studio warnings\n#ifdef _MSC_VER\n#pragma warning (disable: 4127)     // condition expression is constant\n#pragma warning (disable: 4505)     // unreferenced local function has been removed (stb stuff)\n#pragma warning (disable: 4996)     // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen\n#pragma warning (disable: 6255)     // [Static Analyzer] _alloca indicates failure by raising a stack overflow exception.  Consider using _malloca instead.\n#pragma warning (disable: 26451)    // [Static Analyzer] Arithmetic overflow : Using operator 'xxx' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator 'xxx' to avoid overflow(io.2).\n#pragma warning (disable: 26812)    // [Static Analyzer] The enum type 'xxx' is unscoped. Prefer 'enum class' over 'enum' (Enum.3). [MSVC Static Analyzer)\n#endif\n\n// Clang/GCC warnings with -Weverything\n#if defined(__clang__)\n#if __has_warning(\"-Wunknown-warning-option\")\n#pragma clang diagnostic ignored \"-Wunknown-warning-option\"         // warning: unknown warning group 'xxx'                      // not all warnings are known by all Clang versions and they tend to be rename-happy.. so ignoring warnings triggers new warnings on some configuration. Great!\n#endif\n#if __has_warning(\"-Walloca\")\n#pragma clang diagnostic ignored \"-Walloca\"                         // warning: use of function '__builtin_alloca' is discouraged\n#endif\n#pragma clang diagnostic ignored \"-Wunknown-pragmas\"                // warning: unknown warning group 'xxx'\n#pragma clang diagnostic ignored \"-Wold-style-cast\"                 // warning: use of old-style cast                            // yes, they are more terse.\n#pragma clang diagnostic ignored \"-Wfloat-equal\"                    // warning: comparing floating point with == or != is unsafe // storing and comparing against same constants ok.\n#pragma clang diagnostic ignored \"-Wglobal-constructors\"            // warning: declaration requires a global destructor         // similar to above, not sure what the exact difference is.\n#pragma clang diagnostic ignored \"-Wsign-conversion\"                // warning: implicit conversion changes signedness\n#pragma clang diagnostic ignored \"-Wzero-as-null-pointer-constant\"  // warning: zero as null pointer constant                    // some standard header variations use #define NULL 0\n#pragma clang diagnostic ignored \"-Wcomma\"                          // warning: possible misuse of comma operator here\n#pragma clang diagnostic ignored \"-Wreserved-id-macro\"              // warning: macro name is a reserved identifier\n#pragma clang diagnostic ignored \"-Wdouble-promotion\"               // warning: implicit conversion from 'float' to 'double' when passing argument to function  // using printf() is a misery with this as C++ va_arg ellipsis changes float to double.\n#pragma clang diagnostic ignored \"-Wimplicit-int-float-conversion\"  // warning: implicit conversion from 'xxx' to 'float' may lose precision\n#elif defined(__GNUC__)\n#pragma GCC diagnostic ignored \"-Wpragmas\"                  // warning: unknown option after '#pragma GCC diagnostic' kind\n#pragma GCC diagnostic ignored \"-Wunused-function\"          // warning: 'xxxx' defined but not used\n#pragma GCC diagnostic ignored \"-Wdouble-promotion\"         // warning: implicit conversion from 'float' to 'double' when passing argument to function\n#pragma GCC diagnostic ignored \"-Wconversion\"               // warning: conversion to 'xxxx' from 'xxxx' may alter its value\n#pragma GCC diagnostic ignored \"-Wstack-protector\"          // warning: stack protector not protecting local variables: variable length buffer\n#pragma GCC diagnostic ignored \"-Wclass-memaccess\"          // [__GNUC__ >= 8] warning: 'memset/memcpy' clearing/writing an object of type 'xxxx' with no trivial copy-assignment; use assignment or value-initialization instead\n#endif\n\n//-------------------------------------------------------------------------\n// [SECTION] STB libraries implementation\n//-------------------------------------------------------------------------\n\n// Compile time options:\n//#define IMGUI_STB_NAMESPACE           ImStb\n//#define IMGUI_STB_TRUETYPE_FILENAME   \"my_folder/stb_truetype.h\"\n//#define IMGUI_STB_RECT_PACK_FILENAME  \"my_folder/stb_rect_pack.h\"\n//#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION\n//#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION\n\n#ifdef IMGUI_STB_NAMESPACE\nnamespace IMGUI_STB_NAMESPACE\n{\n#endif\n\n#ifdef _MSC_VER\n#pragma warning (push)\n#pragma warning (disable: 4456)                             // declaration of 'xx' hides previous local declaration\n#pragma warning (disable: 6011)                             // (stb_rectpack) Dereferencing NULL pointer 'cur->next'.\n#pragma warning (disable: 6385)                             // (stb_truetype) Reading invalid data from 'buffer':  the readable size is '_Old_3`kernel_width' bytes, but '3' bytes may be read.\n#pragma warning (disable: 28182)                            // (stb_rectpack) Dereferencing NULL pointer. 'cur' contains the same NULL value as 'cur->next' did.\n#endif\n\n#if defined(__clang__)\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wunused-function\"\n#pragma clang diagnostic ignored \"-Wmissing-prototypes\"\n#pragma clang diagnostic ignored \"-Wimplicit-fallthrough\"\n#pragma clang diagnostic ignored \"-Wcast-qual\"              // warning: cast from 'const xxxx *' to 'xxx *' drops const qualifier\n#endif\n\n#if defined(__GNUC__)\n#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored \"-Wtype-limits\"              // warning: comparison is always true due to limited range of data type [-Wtype-limits]\n#pragma GCC diagnostic ignored \"-Wcast-qual\"                // warning: cast from type 'const xxxx *' to type 'xxxx *' casts away qualifiers\n#endif\n\n#ifndef STB_RECT_PACK_IMPLEMENTATION                        // in case the user already have an implementation in the _same_ compilation unit (e.g. unity builds)\n#ifndef IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION          // in case the user already have an implementation in another compilation unit\n#define STBRP_STATIC\n#define STBRP_ASSERT(x)     do { IM_ASSERT(x); } while (0)\n#define STBRP_SORT          ImQsort\n#define STB_RECT_PACK_IMPLEMENTATION\n#endif\n#ifdef IMGUI_STB_RECT_PACK_FILENAME\n#include IMGUI_STB_RECT_PACK_FILENAME\n#else\n#include \"imstb_rectpack.h\"\n#endif\n#endif\n\n#ifdef  IMGUI_ENABLE_STB_TRUETYPE\n#ifndef STB_TRUETYPE_IMPLEMENTATION                         // in case the user already have an implementation in the _same_ compilation unit (e.g. unity builds)\n#ifndef IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION           // in case the user already have an implementation in another compilation unit\n#define STBTT_malloc(x,u)   ((void)(u), IM_ALLOC(x))\n#define STBTT_free(x,u)     ((void)(u), IM_FREE(x))\n#define STBTT_assert(x)     do { IM_ASSERT(x); } while(0)\n#define STBTT_fmod(x,y)     ImFmod(x,y)\n#define STBTT_sqrt(x)       ImSqrt(x)\n#define STBTT_pow(x,y)      ImPow(x,y)\n#define STBTT_fabs(x)       ImFabs(x)\n#define STBTT_ifloor(x)     ((int)ImFloorSigned(x))\n#define STBTT_iceil(x)      ((int)ImCeil(x))\n#define STBTT_STATIC\n#define STB_TRUETYPE_IMPLEMENTATION\n#else\n#define STBTT_DEF extern\n#endif\n#ifdef IMGUI_STB_TRUETYPE_FILENAME\n#include IMGUI_STB_TRUETYPE_FILENAME\n#else\n#include \"imstb_truetype.h\"\n#endif\n#endif\n#endif // IMGUI_ENABLE_STB_TRUETYPE\n\n#if defined(__GNUC__)\n#pragma GCC diagnostic pop\n#endif\n\n#if defined(__clang__)\n#pragma clang diagnostic pop\n#endif\n\n#if defined(_MSC_VER)\n#pragma warning (pop)\n#endif\n\n#ifdef IMGUI_STB_NAMESPACE\n} // namespace ImStb\nusing namespace IMGUI_STB_NAMESPACE;\n#endif\n\n//-----------------------------------------------------------------------------\n// [SECTION] Style functions\n//-----------------------------------------------------------------------------\n\nvoid ImGui::StyleColorsDark(ImGuiStyle* dst)\n{\n    ImGuiStyle* style = dst ? dst : &ImGui::GetStyle();\n    ImVec4* colors = style->Colors;\n\n    colors[ImGuiCol_Text]                   = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);\n    colors[ImGuiCol_TextDisabled]           = ImVec4(0.50f, 0.50f, 0.50f, 1.00f);\n    colors[ImGuiCol_WindowBg]               = ImVec4(0.06f, 0.06f, 0.06f, 0.94f);\n    colors[ImGuiCol_ChildBg]                = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);\n    colors[ImGuiCol_PopupBg]                = ImVec4(0.08f, 0.08f, 0.08f, 0.94f);\n    colors[ImGuiCol_Border]                 = ImVec4(0.43f, 0.43f, 0.50f, 0.50f);\n    colors[ImGuiCol_BorderShadow]           = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);\n    colors[ImGuiCol_FrameBg]                = ImVec4(0.16f, 0.29f, 0.48f, 0.54f);\n    colors[ImGuiCol_FrameBgHovered]         = ImVec4(0.26f, 0.59f, 0.98f, 0.40f);\n    colors[ImGuiCol_FrameBgActive]          = ImVec4(0.26f, 0.59f, 0.98f, 0.67f);\n    colors[ImGuiCol_TitleBg]                = ImVec4(0.04f, 0.04f, 0.04f, 1.00f);\n    colors[ImGuiCol_TitleBgActive]          = ImVec4(0.16f, 0.29f, 0.48f, 1.00f);\n    colors[ImGuiCol_TitleBgCollapsed]       = ImVec4(0.00f, 0.00f, 0.00f, 0.51f);\n    colors[ImGuiCol_MenuBarBg]              = ImVec4(0.14f, 0.14f, 0.14f, 1.00f);\n    colors[ImGuiCol_ScrollbarBg]            = ImVec4(0.02f, 0.02f, 0.02f, 0.53f);\n    colors[ImGuiCol_ScrollbarGrab]          = ImVec4(0.31f, 0.31f, 0.31f, 1.00f);\n    colors[ImGuiCol_ScrollbarGrabHovered]   = ImVec4(0.41f, 0.41f, 0.41f, 1.00f);\n    colors[ImGuiCol_ScrollbarGrabActive]    = ImVec4(0.51f, 0.51f, 0.51f, 1.00f);\n    colors[ImGuiCol_CheckMark]              = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);\n    colors[ImGuiCol_SliderGrab]             = ImVec4(0.24f, 0.52f, 0.88f, 1.00f);\n    colors[ImGuiCol_SliderGrabActive]       = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);\n    colors[ImGuiCol_Button]                 = ImVec4(0.26f, 0.59f, 0.98f, 0.40f);\n    colors[ImGuiCol_ButtonHovered]          = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);\n    colors[ImGuiCol_ButtonActive]           = ImVec4(0.06f, 0.53f, 0.98f, 1.00f);\n    colors[ImGuiCol_Header]                 = ImVec4(0.26f, 0.59f, 0.98f, 0.31f);\n    colors[ImGuiCol_HeaderHovered]          = ImVec4(0.26f, 0.59f, 0.98f, 0.80f);\n    colors[ImGuiCol_HeaderActive]           = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);\n    colors[ImGuiCol_Separator]              = colors[ImGuiCol_Border];\n    colors[ImGuiCol_SeparatorHovered]       = ImVec4(0.10f, 0.40f, 0.75f, 0.78f);\n    colors[ImGuiCol_SeparatorActive]        = ImVec4(0.10f, 0.40f, 0.75f, 1.00f);\n    colors[ImGuiCol_ResizeGrip]             = ImVec4(0.26f, 0.59f, 0.98f, 0.20f);\n    colors[ImGuiCol_ResizeGripHovered]      = ImVec4(0.26f, 0.59f, 0.98f, 0.67f);\n    colors[ImGuiCol_ResizeGripActive]       = ImVec4(0.26f, 0.59f, 0.98f, 0.95f);\n    colors[ImGuiCol_Tab]                    = ImLerp(colors[ImGuiCol_Header],       colors[ImGuiCol_TitleBgActive], 0.80f);\n    colors[ImGuiCol_TabHovered]             = colors[ImGuiCol_HeaderHovered];\n    colors[ImGuiCol_TabActive]              = ImLerp(colors[ImGuiCol_HeaderActive], colors[ImGuiCol_TitleBgActive], 0.60f);\n    colors[ImGuiCol_TabUnfocused]           = ImLerp(colors[ImGuiCol_Tab],          colors[ImGuiCol_TitleBg], 0.80f);\n    colors[ImGuiCol_TabUnfocusedActive]     = ImLerp(colors[ImGuiCol_TabActive],    colors[ImGuiCol_TitleBg], 0.40f);\n    colors[ImGuiCol_PlotLines]              = ImVec4(0.61f, 0.61f, 0.61f, 1.00f);\n    colors[ImGuiCol_PlotLinesHovered]       = ImVec4(1.00f, 0.43f, 0.35f, 1.00f);\n    colors[ImGuiCol_PlotHistogram]          = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);\n    colors[ImGuiCol_PlotHistogramHovered]   = ImVec4(1.00f, 0.60f, 0.00f, 1.00f);\n    colors[ImGuiCol_TableHeaderBg]          = ImVec4(0.19f, 0.19f, 0.20f, 1.00f);\n    colors[ImGuiCol_TableBorderStrong]      = ImVec4(0.31f, 0.31f, 0.35f, 1.00f);   // Prefer using Alpha=1.0 here\n    colors[ImGuiCol_TableBorderLight]       = ImVec4(0.23f, 0.23f, 0.25f, 1.00f);   // Prefer using Alpha=1.0 here\n    colors[ImGuiCol_TableRowBg]             = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);\n    colors[ImGuiCol_TableRowBgAlt]          = ImVec4(1.00f, 1.00f, 1.00f, 0.06f);\n    colors[ImGuiCol_TextSelectedBg]         = ImVec4(0.26f, 0.59f, 0.98f, 0.35f);\n    colors[ImGuiCol_DragDropTarget]         = ImVec4(1.00f, 1.00f, 0.00f, 0.90f);\n    colors[ImGuiCol_NavHighlight]           = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);\n    colors[ImGuiCol_NavWindowingHighlight]  = ImVec4(1.00f, 1.00f, 1.00f, 0.70f);\n    colors[ImGuiCol_NavWindowingDimBg]      = ImVec4(0.80f, 0.80f, 0.80f, 0.20f);\n    colors[ImGuiCol_ModalWindowDimBg]       = ImVec4(0.80f, 0.80f, 0.80f, 0.35f);\n}\n\nvoid ImGui::StyleColorsClassic(ImGuiStyle* dst)\n{\n    ImGuiStyle* style = dst ? dst : &ImGui::GetStyle();\n    ImVec4* colors = style->Colors;\n\n    colors[ImGuiCol_Text]                   = ImVec4(0.90f, 0.90f, 0.90f, 1.00f);\n    colors[ImGuiCol_TextDisabled]           = ImVec4(0.60f, 0.60f, 0.60f, 1.00f);\n    colors[ImGuiCol_WindowBg]               = ImVec4(0.00f, 0.00f, 0.00f, 0.85f);\n    colors[ImGuiCol_ChildBg]                = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);\n    colors[ImGuiCol_PopupBg]                = ImVec4(0.11f, 0.11f, 0.14f, 0.92f);\n    colors[ImGuiCol_Border]                 = ImVec4(0.50f, 0.50f, 0.50f, 0.50f);\n    colors[ImGuiCol_BorderShadow]           = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);\n    colors[ImGuiCol_FrameBg]                = ImVec4(0.43f, 0.43f, 0.43f, 0.39f);\n    colors[ImGuiCol_FrameBgHovered]         = ImVec4(0.47f, 0.47f, 0.69f, 0.40f);\n    colors[ImGuiCol_FrameBgActive]          = ImVec4(0.42f, 0.41f, 0.64f, 0.69f);\n    colors[ImGuiCol_TitleBg]                = ImVec4(0.27f, 0.27f, 0.54f, 0.83f);\n    colors[ImGuiCol_TitleBgActive]          = ImVec4(0.32f, 0.32f, 0.63f, 0.87f);\n    colors[ImGuiCol_TitleBgCollapsed]       = ImVec4(0.40f, 0.40f, 0.80f, 0.20f);\n    colors[ImGuiCol_MenuBarBg]              = ImVec4(0.40f, 0.40f, 0.55f, 0.80f);\n    colors[ImGuiCol_ScrollbarBg]            = ImVec4(0.20f, 0.25f, 0.30f, 0.60f);\n    colors[ImGuiCol_ScrollbarGrab]          = ImVec4(0.40f, 0.40f, 0.80f, 0.30f);\n    colors[ImGuiCol_ScrollbarGrabHovered]   = ImVec4(0.40f, 0.40f, 0.80f, 0.40f);\n    colors[ImGuiCol_ScrollbarGrabActive]    = ImVec4(0.41f, 0.39f, 0.80f, 0.60f);\n    colors[ImGuiCol_CheckMark]              = ImVec4(0.90f, 0.90f, 0.90f, 0.50f);\n    colors[ImGuiCol_SliderGrab]             = ImVec4(1.00f, 1.00f, 1.00f, 0.30f);\n    colors[ImGuiCol_SliderGrabActive]       = ImVec4(0.41f, 0.39f, 0.80f, 0.60f);\n    colors[ImGuiCol_Button]                 = ImVec4(0.35f, 0.40f, 0.61f, 0.62f);\n    colors[ImGuiCol_ButtonHovered]          = ImVec4(0.40f, 0.48f, 0.71f, 0.79f);\n    colors[ImGuiCol_ButtonActive]           = ImVec4(0.46f, 0.54f, 0.80f, 1.00f);\n    colors[ImGuiCol_Header]                 = ImVec4(0.40f, 0.40f, 0.90f, 0.45f);\n    colors[ImGuiCol_HeaderHovered]          = ImVec4(0.45f, 0.45f, 0.90f, 0.80f);\n    colors[ImGuiCol_HeaderActive]           = ImVec4(0.53f, 0.53f, 0.87f, 0.80f);\n    colors[ImGuiCol_Separator]              = ImVec4(0.50f, 0.50f, 0.50f, 0.60f);\n    colors[ImGuiCol_SeparatorHovered]       = ImVec4(0.60f, 0.60f, 0.70f, 1.00f);\n    colors[ImGuiCol_SeparatorActive]        = ImVec4(0.70f, 0.70f, 0.90f, 1.00f);\n    colors[ImGuiCol_ResizeGrip]             = ImVec4(1.00f, 1.00f, 1.00f, 0.10f);\n    colors[ImGuiCol_ResizeGripHovered]      = ImVec4(0.78f, 0.82f, 1.00f, 0.60f);\n    colors[ImGuiCol_ResizeGripActive]       = ImVec4(0.78f, 0.82f, 1.00f, 0.90f);\n    colors[ImGuiCol_Tab]                    = ImLerp(colors[ImGuiCol_Header],       colors[ImGuiCol_TitleBgActive], 0.80f);\n    colors[ImGuiCol_TabHovered]             = colors[ImGuiCol_HeaderHovered];\n    colors[ImGuiCol_TabActive]              = ImLerp(colors[ImGuiCol_HeaderActive], colors[ImGuiCol_TitleBgActive], 0.60f);\n    colors[ImGuiCol_TabUnfocused]           = ImLerp(colors[ImGuiCol_Tab],          colors[ImGuiCol_TitleBg], 0.80f);\n    colors[ImGuiCol_TabUnfocusedActive]     = ImLerp(colors[ImGuiCol_TabActive],    colors[ImGuiCol_TitleBg], 0.40f);\n    colors[ImGuiCol_PlotLines]              = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);\n    colors[ImGuiCol_PlotLinesHovered]       = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);\n    colors[ImGuiCol_PlotHistogram]          = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);\n    colors[ImGuiCol_PlotHistogramHovered]   = ImVec4(1.00f, 0.60f, 0.00f, 1.00f);\n    colors[ImGuiCol_TableHeaderBg]          = ImVec4(0.27f, 0.27f, 0.38f, 1.00f);\n    colors[ImGuiCol_TableBorderStrong]      = ImVec4(0.31f, 0.31f, 0.45f, 1.00f);   // Prefer using Alpha=1.0 here\n    colors[ImGuiCol_TableBorderLight]       = ImVec4(0.26f, 0.26f, 0.28f, 1.00f);   // Prefer using Alpha=1.0 here\n    colors[ImGuiCol_TableRowBg]             = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);\n    colors[ImGuiCol_TableRowBgAlt]          = ImVec4(1.00f, 1.00f, 1.00f, 0.07f);\n    colors[ImGuiCol_TextSelectedBg]         = ImVec4(0.00f, 0.00f, 1.00f, 0.35f);\n    colors[ImGuiCol_DragDropTarget]         = ImVec4(1.00f, 1.00f, 0.00f, 0.90f);\n    colors[ImGuiCol_NavHighlight]           = colors[ImGuiCol_HeaderHovered];\n    colors[ImGuiCol_NavWindowingHighlight]  = ImVec4(1.00f, 1.00f, 1.00f, 0.70f);\n    colors[ImGuiCol_NavWindowingDimBg]      = ImVec4(0.80f, 0.80f, 0.80f, 0.20f);\n    colors[ImGuiCol_ModalWindowDimBg]       = ImVec4(0.20f, 0.20f, 0.20f, 0.35f);\n}\n\n// Those light colors are better suited with a thicker font than the default one + FrameBorder\nvoid ImGui::StyleColorsLight(ImGuiStyle* dst)\n{\n    ImGuiStyle* style = dst ? dst : &ImGui::GetStyle();\n    ImVec4* colors = style->Colors;\n\n    colors[ImGuiCol_Text]                   = ImVec4(0.00f, 0.00f, 0.00f, 1.00f);\n    colors[ImGuiCol_TextDisabled]           = ImVec4(0.60f, 0.60f, 0.60f, 1.00f);\n    colors[ImGuiCol_WindowBg]               = ImVec4(0.94f, 0.94f, 0.94f, 1.00f);\n    colors[ImGuiCol_ChildBg]                = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);\n    colors[ImGuiCol_PopupBg]                = ImVec4(1.00f, 1.00f, 1.00f, 0.98f);\n    colors[ImGuiCol_Border]                 = ImVec4(0.00f, 0.00f, 0.00f, 0.30f);\n    colors[ImGuiCol_BorderShadow]           = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);\n    colors[ImGuiCol_FrameBg]                = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);\n    colors[ImGuiCol_FrameBgHovered]         = ImVec4(0.26f, 0.59f, 0.98f, 0.40f);\n    colors[ImGuiCol_FrameBgActive]          = ImVec4(0.26f, 0.59f, 0.98f, 0.67f);\n    colors[ImGuiCol_TitleBg]                = ImVec4(0.96f, 0.96f, 0.96f, 1.00f);\n    colors[ImGuiCol_TitleBgActive]          = ImVec4(0.82f, 0.82f, 0.82f, 1.00f);\n    colors[ImGuiCol_TitleBgCollapsed]       = ImVec4(1.00f, 1.00f, 1.00f, 0.51f);\n    colors[ImGuiCol_MenuBarBg]              = ImVec4(0.86f, 0.86f, 0.86f, 1.00f);\n    colors[ImGuiCol_ScrollbarBg]            = ImVec4(0.98f, 0.98f, 0.98f, 0.53f);\n    colors[ImGuiCol_ScrollbarGrab]          = ImVec4(0.69f, 0.69f, 0.69f, 0.80f);\n    colors[ImGuiCol_ScrollbarGrabHovered]   = ImVec4(0.49f, 0.49f, 0.49f, 0.80f);\n    colors[ImGuiCol_ScrollbarGrabActive]    = ImVec4(0.49f, 0.49f, 0.49f, 1.00f);\n    colors[ImGuiCol_CheckMark]              = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);\n    colors[ImGuiCol_SliderGrab]             = ImVec4(0.26f, 0.59f, 0.98f, 0.78f);\n    colors[ImGuiCol_SliderGrabActive]       = ImVec4(0.46f, 0.54f, 0.80f, 0.60f);\n    colors[ImGuiCol_Button]                 = ImVec4(0.26f, 0.59f, 0.98f, 0.40f);\n    colors[ImGuiCol_ButtonHovered]          = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);\n    colors[ImGuiCol_ButtonActive]           = ImVec4(0.06f, 0.53f, 0.98f, 1.00f);\n    colors[ImGuiCol_Header]                 = ImVec4(0.26f, 0.59f, 0.98f, 0.31f);\n    colors[ImGuiCol_HeaderHovered]          = ImVec4(0.26f, 0.59f, 0.98f, 0.80f);\n    colors[ImGuiCol_HeaderActive]           = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);\n    colors[ImGuiCol_Separator]              = ImVec4(0.39f, 0.39f, 0.39f, 0.62f);\n    colors[ImGuiCol_SeparatorHovered]       = ImVec4(0.14f, 0.44f, 0.80f, 0.78f);\n    colors[ImGuiCol_SeparatorActive]        = ImVec4(0.14f, 0.44f, 0.80f, 1.00f);\n    colors[ImGuiCol_ResizeGrip]             = ImVec4(0.35f, 0.35f, 0.35f, 0.17f);\n    colors[ImGuiCol_ResizeGripHovered]      = ImVec4(0.26f, 0.59f, 0.98f, 0.67f);\n    colors[ImGuiCol_ResizeGripActive]       = ImVec4(0.26f, 0.59f, 0.98f, 0.95f);\n    colors[ImGuiCol_Tab]                    = ImLerp(colors[ImGuiCol_Header],       colors[ImGuiCol_TitleBgActive], 0.90f);\n    colors[ImGuiCol_TabHovered]             = colors[ImGuiCol_HeaderHovered];\n    colors[ImGuiCol_TabActive]              = ImLerp(colors[ImGuiCol_HeaderActive], colors[ImGuiCol_TitleBgActive], 0.60f);\n    colors[ImGuiCol_TabUnfocused]           = ImLerp(colors[ImGuiCol_Tab],          colors[ImGuiCol_TitleBg], 0.80f);\n    colors[ImGuiCol_TabUnfocusedActive]     = ImLerp(colors[ImGuiCol_TabActive],    colors[ImGuiCol_TitleBg], 0.40f);\n    colors[ImGuiCol_PlotLines]              = ImVec4(0.39f, 0.39f, 0.39f, 1.00f);\n    colors[ImGuiCol_PlotLinesHovered]       = ImVec4(1.00f, 0.43f, 0.35f, 1.00f);\n    colors[ImGuiCol_PlotHistogram]          = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);\n    colors[ImGuiCol_PlotHistogramHovered]   = ImVec4(1.00f, 0.45f, 0.00f, 1.00f);\n    colors[ImGuiCol_TableHeaderBg]          = ImVec4(0.78f, 0.87f, 0.98f, 1.00f);\n    colors[ImGuiCol_TableBorderStrong]      = ImVec4(0.57f, 0.57f, 0.64f, 1.00f);   // Prefer using Alpha=1.0 here\n    colors[ImGuiCol_TableBorderLight]       = ImVec4(0.68f, 0.68f, 0.74f, 1.00f);   // Prefer using Alpha=1.0 here\n    colors[ImGuiCol_TableRowBg]             = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);\n    colors[ImGuiCol_TableRowBgAlt]          = ImVec4(0.30f, 0.30f, 0.30f, 0.09f);\n    colors[ImGuiCol_TextSelectedBg]         = ImVec4(0.26f, 0.59f, 0.98f, 0.35f);\n    colors[ImGuiCol_DragDropTarget]         = ImVec4(0.26f, 0.59f, 0.98f, 0.95f);\n    colors[ImGuiCol_NavHighlight]           = colors[ImGuiCol_HeaderHovered];\n    colors[ImGuiCol_NavWindowingHighlight]  = ImVec4(0.70f, 0.70f, 0.70f, 0.70f);\n    colors[ImGuiCol_NavWindowingDimBg]      = ImVec4(0.20f, 0.20f, 0.20f, 0.20f);\n    colors[ImGuiCol_ModalWindowDimBg]       = ImVec4(0.20f, 0.20f, 0.20f, 0.35f);\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] ImDrawList\n//-----------------------------------------------------------------------------\n\nImDrawListSharedData::ImDrawListSharedData()\n{\n    memset(this, 0, sizeof(*this));\n    for (int i = 0; i < IM_ARRAYSIZE(ArcFastVtx); i++)\n    {\n        const float a = ((float)i * 2 * IM_PI) / (float)IM_ARRAYSIZE(ArcFastVtx);\n        ArcFastVtx[i] = ImVec2(ImCos(a), ImSin(a));\n    }\n    ArcFastRadiusCutoff = IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC_R(IM_DRAWLIST_ARCFAST_SAMPLE_MAX, CircleSegmentMaxError);\n}\n\nvoid ImDrawListSharedData::SetCircleTessellationMaxError(float max_error)\n{\n    if (CircleSegmentMaxError == max_error)\n        return;\n\n    IM_ASSERT(max_error > 0.0f);\n    CircleSegmentMaxError = max_error;\n    for (int i = 0; i < IM_ARRAYSIZE(CircleSegmentCounts); i++)\n    {\n        const float radius = (float)i;\n        CircleSegmentCounts[i] = (ImU8)((i > 0) ? IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC(radius, CircleSegmentMaxError) : 0);\n    }\n    ArcFastRadiusCutoff = IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC_R(IM_DRAWLIST_ARCFAST_SAMPLE_MAX, CircleSegmentMaxError);\n}\n\n// Initialize before use in a new frame. We always have a command ready in the buffer.\nvoid ImDrawList::_ResetForNewFrame()\n{\n    // Verify that the ImDrawCmd fields we want to memcmp() are contiguous in memory.\n    // (those should be IM_STATIC_ASSERT() in theory but with our pre C++11 setup the whole check doesn't compile with GCC)\n    IM_ASSERT(IM_OFFSETOF(ImDrawCmd, ClipRect) == 0);\n    IM_ASSERT(IM_OFFSETOF(ImDrawCmd, TextureId) == sizeof(ImVec4));\n    IM_ASSERT(IM_OFFSETOF(ImDrawCmd, VtxOffset) == sizeof(ImVec4) + sizeof(ImTextureID));\n\n    CmdBuffer.resize(0);\n    IdxBuffer.resize(0);\n    VtxBuffer.resize(0);\n    Flags = _Data->InitialFlags;\n    memset(&_CmdHeader, 0, sizeof(_CmdHeader));\n    _VtxCurrentIdx = 0;\n    _VtxWritePtr = NULL;\n    _IdxWritePtr = NULL;\n    _ClipRectStack.resize(0);\n    _TextureIdStack.resize(0);\n    _Path.resize(0);\n    _Splitter.Clear();\n    CmdBuffer.push_back(ImDrawCmd());\n    _FringeScale = 1.0f;\n}\n\nvoid ImDrawList::_ClearFreeMemory()\n{\n    CmdBuffer.clear();\n    IdxBuffer.clear();\n    VtxBuffer.clear();\n    Flags = ImDrawListFlags_None;\n    _VtxCurrentIdx = 0;\n    _VtxWritePtr = NULL;\n    _IdxWritePtr = NULL;\n    _ClipRectStack.clear();\n    _TextureIdStack.clear();\n    _Path.clear();\n    _Splitter.ClearFreeMemory();\n}\n\nImDrawList* ImDrawList::CloneOutput() const\n{\n    ImDrawList* dst = IM_NEW(ImDrawList(_Data));\n    dst->CmdBuffer = CmdBuffer;\n    dst->IdxBuffer = IdxBuffer;\n    dst->VtxBuffer = VtxBuffer;\n    dst->Flags = Flags;\n    return dst;\n}\n\nvoid ImDrawList::AddDrawCmd()\n{\n    ImDrawCmd draw_cmd;\n    draw_cmd.ClipRect = _CmdHeader.ClipRect;    // Same as calling ImDrawCmd_HeaderCopy()\n    draw_cmd.TextureId = _CmdHeader.TextureId;\n    draw_cmd.VtxOffset = _CmdHeader.VtxOffset;\n    draw_cmd.IdxOffset = IdxBuffer.Size;\n\n    IM_ASSERT(draw_cmd.ClipRect.x <= draw_cmd.ClipRect.z && draw_cmd.ClipRect.y <= draw_cmd.ClipRect.w);\n    CmdBuffer.push_back(draw_cmd);\n}\n\n// Pop trailing draw command (used before merging or presenting to user)\n// Note that this leaves the ImDrawList in a state unfit for further commands, as most code assume that CmdBuffer.Size > 0 && CmdBuffer.back().UserCallback == NULL\nvoid ImDrawList::_PopUnusedDrawCmd()\n{\n    if (CmdBuffer.Size == 0)\n        return;\n    ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];\n    if (curr_cmd->ElemCount == 0 && curr_cmd->UserCallback == NULL)\n        CmdBuffer.pop_back();\n}\n\nvoid ImDrawList::AddCallback(ImDrawCallback callback, void* callback_data)\n{\n    ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];\n    IM_ASSERT(curr_cmd->UserCallback == NULL);\n    if (curr_cmd->ElemCount != 0)\n    {\n        AddDrawCmd();\n        curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];\n    }\n    curr_cmd->UserCallback = callback;\n    curr_cmd->UserCallbackData = callback_data;\n\n    AddDrawCmd(); // Force a new command after us (see comment below)\n}\n\n// Compare ClipRect, TextureId and VtxOffset with a single memcmp()\n#define ImDrawCmd_HeaderSize                        (IM_OFFSETOF(ImDrawCmd, VtxOffset) + sizeof(unsigned int))\n#define ImDrawCmd_HeaderCompare(CMD_LHS, CMD_RHS)   (memcmp(CMD_LHS, CMD_RHS, ImDrawCmd_HeaderSize))    // Compare ClipRect, TextureId, VtxOffset\n#define ImDrawCmd_HeaderCopy(CMD_DST, CMD_SRC)      (memcpy(CMD_DST, CMD_SRC, ImDrawCmd_HeaderSize))    // Copy ClipRect, TextureId, VtxOffset\n\n// Try to merge two last draw commands\nvoid ImDrawList::_TryMergeDrawCmds()\n{\n    ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];\n    ImDrawCmd* prev_cmd = curr_cmd - 1;\n    if (ImDrawCmd_HeaderCompare(curr_cmd, prev_cmd) == 0 && curr_cmd->UserCallback == NULL && prev_cmd->UserCallback == NULL)\n    {\n        prev_cmd->ElemCount += curr_cmd->ElemCount;\n        CmdBuffer.pop_back();\n    }\n}\n\n// Our scheme may appears a bit unusual, basically we want the most-common calls AddLine AddRect etc. to not have to perform any check so we always have a command ready in the stack.\n// The cost of figuring out if a new command has to be added or if we can merge is paid in those Update** functions only.\nvoid ImDrawList::_OnChangedClipRect()\n{\n    // If current command is used with different settings we need to add a new command\n    ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];\n    if (curr_cmd->ElemCount != 0 && memcmp(&curr_cmd->ClipRect, &_CmdHeader.ClipRect, sizeof(ImVec4)) != 0)\n    {\n        AddDrawCmd();\n        return;\n    }\n    IM_ASSERT(curr_cmd->UserCallback == NULL);\n\n    // Try to merge with previous command if it matches, else use current command\n    ImDrawCmd* prev_cmd = curr_cmd - 1;\n    if (curr_cmd->ElemCount == 0 && CmdBuffer.Size > 1 && ImDrawCmd_HeaderCompare(&_CmdHeader, prev_cmd) == 0 && prev_cmd->UserCallback == NULL)\n    {\n        CmdBuffer.pop_back();\n        return;\n    }\n\n    curr_cmd->ClipRect = _CmdHeader.ClipRect;\n}\n\nvoid ImDrawList::_OnChangedTextureID()\n{\n    // If current command is used with different settings we need to add a new command\n    ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];\n    if (curr_cmd->ElemCount != 0 && curr_cmd->TextureId != _CmdHeader.TextureId)\n    {\n        AddDrawCmd();\n        return;\n    }\n    IM_ASSERT(curr_cmd->UserCallback == NULL);\n\n    // Try to merge with previous command if it matches, else use current command\n    ImDrawCmd* prev_cmd = curr_cmd - 1;\n    if (curr_cmd->ElemCount == 0 && CmdBuffer.Size > 1 && ImDrawCmd_HeaderCompare(&_CmdHeader, prev_cmd) == 0 && prev_cmd->UserCallback == NULL)\n    {\n        CmdBuffer.pop_back();\n        return;\n    }\n\n    curr_cmd->TextureId = _CmdHeader.TextureId;\n}\n\nvoid ImDrawList::_OnChangedVtxOffset()\n{\n    // We don't need to compare curr_cmd->VtxOffset != _CmdHeader.VtxOffset because we know it'll be different at the time we call this.\n    _VtxCurrentIdx = 0;\n    ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];\n    //IM_ASSERT(curr_cmd->VtxOffset != _CmdHeader.VtxOffset); // See #3349\n    if (curr_cmd->ElemCount != 0)\n    {\n        AddDrawCmd();\n        return;\n    }\n    IM_ASSERT(curr_cmd->UserCallback == NULL);\n    curr_cmd->VtxOffset = _CmdHeader.VtxOffset;\n}\n\nint ImDrawList::_CalcCircleAutoSegmentCount(float radius) const\n{\n    // Automatic segment count\n    const int radius_idx = (int)(radius + 0.999999f); // ceil to never reduce accuracy\n    if (radius_idx < IM_ARRAYSIZE(_Data->CircleSegmentCounts))\n        return _Data->CircleSegmentCounts[radius_idx]; // Use cached value\n    else\n        return IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC(radius, _Data->CircleSegmentMaxError);\n}\n\n// Render-level scissoring. This is passed down to your render function but not used for CPU-side coarse clipping. Prefer using higher-level ImGui::PushClipRect() to affect logic (hit-testing and widget culling)\nvoid ImDrawList::PushClipRect(ImVec2 cr_min, ImVec2 cr_max, bool intersect_with_current_clip_rect)\n{\n    ImVec4 cr(cr_min.x, cr_min.y, cr_max.x, cr_max.y);\n    if (intersect_with_current_clip_rect)\n    {\n        ImVec4 current = _CmdHeader.ClipRect;\n        if (cr.x < current.x) cr.x = current.x;\n        if (cr.y < current.y) cr.y = current.y;\n        if (cr.z > current.z) cr.z = current.z;\n        if (cr.w > current.w) cr.w = current.w;\n    }\n    cr.z = ImMax(cr.x, cr.z);\n    cr.w = ImMax(cr.y, cr.w);\n\n    _ClipRectStack.push_back(cr);\n    _CmdHeader.ClipRect = cr;\n    _OnChangedClipRect();\n}\n\nvoid ImDrawList::PushClipRectFullScreen()\n{\n    PushClipRect(ImVec2(_Data->ClipRectFullscreen.x, _Data->ClipRectFullscreen.y), ImVec2(_Data->ClipRectFullscreen.z, _Data->ClipRectFullscreen.w));\n}\n\nvoid ImDrawList::PopClipRect()\n{\n    _ClipRectStack.pop_back();\n    _CmdHeader.ClipRect = (_ClipRectStack.Size == 0) ? _Data->ClipRectFullscreen : _ClipRectStack.Data[_ClipRectStack.Size - 1];\n    _OnChangedClipRect();\n}\n\nvoid ImDrawList::PushTextureID(ImTextureID texture_id)\n{\n    _TextureIdStack.push_back(texture_id);\n    _CmdHeader.TextureId = texture_id;\n    _OnChangedTextureID();\n}\n\nvoid ImDrawList::PopTextureID()\n{\n    _TextureIdStack.pop_back();\n    _CmdHeader.TextureId = (_TextureIdStack.Size == 0) ? (ImTextureID)NULL : _TextureIdStack.Data[_TextureIdStack.Size - 1];\n    _OnChangedTextureID();\n}\n\n// Reserve space for a number of vertices and indices.\n// You must finish filling your reserved data before calling PrimReserve() again, as it may reallocate or\n// submit the intermediate results. PrimUnreserve() can be used to release unused allocations.\nvoid ImDrawList::PrimReserve(int idx_count, int vtx_count)\n{\n    // Large mesh support (when enabled)\n    IM_ASSERT_PARANOID(idx_count >= 0 && vtx_count >= 0);\n    if (sizeof(ImDrawIdx) == 2 && (_VtxCurrentIdx + vtx_count >= (1 << 16)) && (Flags & ImDrawListFlags_AllowVtxOffset))\n    {\n        // FIXME: In theory we should be testing that vtx_count <64k here.\n        // In practice, RenderText() relies on reserving ahead for a worst case scenario so it is currently useful for us\n        // to not make that check until we rework the text functions to handle clipping and large horizontal lines better.\n        _CmdHeader.VtxOffset = VtxBuffer.Size;\n        _OnChangedVtxOffset();\n    }\n\n    ImDrawCmd* draw_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];\n    draw_cmd->ElemCount += idx_count;\n\n    int vtx_buffer_old_size = VtxBuffer.Size;\n    VtxBuffer.resize(vtx_buffer_old_size + vtx_count);\n    _VtxWritePtr = VtxBuffer.Data + vtx_buffer_old_size;\n\n    int idx_buffer_old_size = IdxBuffer.Size;\n    IdxBuffer.resize(idx_buffer_old_size + idx_count);\n    _IdxWritePtr = IdxBuffer.Data + idx_buffer_old_size;\n}\n\n// Release the a number of reserved vertices/indices from the end of the last reservation made with PrimReserve().\nvoid ImDrawList::PrimUnreserve(int idx_count, int vtx_count)\n{\n    IM_ASSERT_PARANOID(idx_count >= 0 && vtx_count >= 0);\n\n    ImDrawCmd* draw_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];\n    draw_cmd->ElemCount -= idx_count;\n    VtxBuffer.shrink(VtxBuffer.Size - vtx_count);\n    IdxBuffer.shrink(IdxBuffer.Size - idx_count);\n}\n\n// Fully unrolled with inline call to keep our debug builds decently fast.\nvoid ImDrawList::PrimRect(const ImVec2& a, const ImVec2& c, ImU32 col)\n{\n    ImVec2 b(c.x, a.y), d(a.x, c.y), uv(_Data->TexUvWhitePixel);\n    ImDrawIdx idx = (ImDrawIdx)_VtxCurrentIdx;\n    _IdxWritePtr[0] = idx; _IdxWritePtr[1] = (ImDrawIdx)(idx+1); _IdxWritePtr[2] = (ImDrawIdx)(idx+2);\n    _IdxWritePtr[3] = idx; _IdxWritePtr[4] = (ImDrawIdx)(idx+2); _IdxWritePtr[5] = (ImDrawIdx)(idx+3);\n    _VtxWritePtr[0].pos = a; _VtxWritePtr[0].uv = uv; _VtxWritePtr[0].col = col;\n    _VtxWritePtr[1].pos = b; _VtxWritePtr[1].uv = uv; _VtxWritePtr[1].col = col;\n    _VtxWritePtr[2].pos = c; _VtxWritePtr[2].uv = uv; _VtxWritePtr[2].col = col;\n    _VtxWritePtr[3].pos = d; _VtxWritePtr[3].uv = uv; _VtxWritePtr[3].col = col;\n    _VtxWritePtr += 4;\n    _VtxCurrentIdx += 4;\n    _IdxWritePtr += 6;\n}\n\nvoid ImDrawList::PrimRectUV(const ImVec2& a, const ImVec2& c, const ImVec2& uv_a, const ImVec2& uv_c, ImU32 col)\n{\n    ImVec2 b(c.x, a.y), d(a.x, c.y), uv_b(uv_c.x, uv_a.y), uv_d(uv_a.x, uv_c.y);\n    ImDrawIdx idx = (ImDrawIdx)_VtxCurrentIdx;\n    _IdxWritePtr[0] = idx; _IdxWritePtr[1] = (ImDrawIdx)(idx+1); _IdxWritePtr[2] = (ImDrawIdx)(idx+2);\n    _IdxWritePtr[3] = idx; _IdxWritePtr[4] = (ImDrawIdx)(idx+2); _IdxWritePtr[5] = (ImDrawIdx)(idx+3);\n    _VtxWritePtr[0].pos = a; _VtxWritePtr[0].uv = uv_a; _VtxWritePtr[0].col = col;\n    _VtxWritePtr[1].pos = b; _VtxWritePtr[1].uv = uv_b; _VtxWritePtr[1].col = col;\n    _VtxWritePtr[2].pos = c; _VtxWritePtr[2].uv = uv_c; _VtxWritePtr[2].col = col;\n    _VtxWritePtr[3].pos = d; _VtxWritePtr[3].uv = uv_d; _VtxWritePtr[3].col = col;\n    _VtxWritePtr += 4;\n    _VtxCurrentIdx += 4;\n    _IdxWritePtr += 6;\n}\n\nvoid ImDrawList::PrimQuadUV(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, const ImVec2& uv_a, const ImVec2& uv_b, const ImVec2& uv_c, const ImVec2& uv_d, ImU32 col)\n{\n    ImDrawIdx idx = (ImDrawIdx)_VtxCurrentIdx;\n    _IdxWritePtr[0] = idx; _IdxWritePtr[1] = (ImDrawIdx)(idx+1); _IdxWritePtr[2] = (ImDrawIdx)(idx+2);\n    _IdxWritePtr[3] = idx; _IdxWritePtr[4] = (ImDrawIdx)(idx+2); _IdxWritePtr[5] = (ImDrawIdx)(idx+3);\n    _VtxWritePtr[0].pos = a; _VtxWritePtr[0].uv = uv_a; _VtxWritePtr[0].col = col;\n    _VtxWritePtr[1].pos = b; _VtxWritePtr[1].uv = uv_b; _VtxWritePtr[1].col = col;\n    _VtxWritePtr[2].pos = c; _VtxWritePtr[2].uv = uv_c; _VtxWritePtr[2].col = col;\n    _VtxWritePtr[3].pos = d; _VtxWritePtr[3].uv = uv_d; _VtxWritePtr[3].col = col;\n    _VtxWritePtr += 4;\n    _VtxCurrentIdx += 4;\n    _IdxWritePtr += 6;\n}\n\n// On AddPolyline() and AddConvexPolyFilled() we intentionally avoid using ImVec2 and superfluous function calls to optimize debug/non-inlined builds.\n// - Those macros expects l-values and need to be used as their own statement.\n// - Those macros are intentionally not surrounded by the 'do {} while (0)' idiom because even that translates to runtime with debug compilers.\n#define IM_NORMALIZE2F_OVER_ZERO(VX,VY)     { float d2 = VX*VX + VY*VY; if (d2 > 0.0f) { float inv_len = ImRsqrt(d2); VX *= inv_len; VY *= inv_len; } } (void)0\n#define IM_FIXNORMAL2F_MAX_INVLEN2          100.0f // 500.0f (see #4053, #3366)\n#define IM_FIXNORMAL2F(VX,VY)               { float d2 = VX*VX + VY*VY; if (d2 > 0.000001f) { float inv_len2 = 1.0f / d2; if (inv_len2 > IM_FIXNORMAL2F_MAX_INVLEN2) inv_len2 = IM_FIXNORMAL2F_MAX_INVLEN2; VX *= inv_len2; VY *= inv_len2; } } (void)0\n\n// TODO: Thickness anti-aliased lines cap are missing their AA fringe.\n// We avoid using the ImVec2 math operators here to reduce cost to a minimum for debug/non-inlined builds.\nvoid ImDrawList::AddPolyline(const ImVec2* points, const int points_count, ImU32 col, ImDrawFlags flags, float thickness)\n{\n    if (points_count < 2)\n        return;\n\n    const bool closed = (flags & ImDrawFlags_Closed) != 0;\n    const ImVec2 opaque_uv = _Data->TexUvWhitePixel;\n    const int count = closed ? points_count : points_count - 1; // The number of line segments we need to draw\n    const bool thick_line = (thickness > _FringeScale);\n\n    if (Flags & ImDrawListFlags_AntiAliasedLines)\n    {\n        // Anti-aliased stroke\n        const float AA_SIZE = _FringeScale;\n        const ImU32 col_trans = col & ~IM_COL32_A_MASK;\n\n        // Thicknesses <1.0 should behave like thickness 1.0\n        thickness = ImMax(thickness, 1.0f);\n        const int integer_thickness = (int)thickness;\n        const float fractional_thickness = thickness - integer_thickness;\n\n        // Do we want to draw this line using a texture?\n        // - For now, only draw integer-width lines using textures to avoid issues with the way scaling occurs, could be improved.\n        // - If AA_SIZE is not 1.0f we cannot use the texture path.\n        const bool use_texture = (Flags & ImDrawListFlags_AntiAliasedLinesUseTex) && (integer_thickness < IM_DRAWLIST_TEX_LINES_WIDTH_MAX) && (fractional_thickness <= 0.00001f) && (AA_SIZE == 1.0f);\n\n        // We should never hit this, because NewFrame() doesn't set ImDrawListFlags_AntiAliasedLinesUseTex unless ImFontAtlasFlags_NoBakedLines is off\n        IM_ASSERT_PARANOID(!use_texture || !(_Data->Font->ContainerAtlas->Flags & ImFontAtlasFlags_NoBakedLines));\n\n        const int idx_count = use_texture ? (count * 6) : (thick_line ? count * 18 : count * 12);\n        const int vtx_count = use_texture ? (points_count * 2) : (thick_line ? points_count * 4 : points_count * 3);\n        PrimReserve(idx_count, vtx_count);\n\n        // Temporary buffer\n        // The first <points_count> items are normals at each line point, then after that there are either 2 or 4 temp points for each line point\n        ImVec2* temp_normals = (ImVec2*)alloca(points_count * ((use_texture || !thick_line) ? 3 : 5) * sizeof(ImVec2)); //-V630\n        ImVec2* temp_points = temp_normals + points_count;\n\n        // Calculate normals (tangents) for each line segment\n        for (int i1 = 0; i1 < count; i1++)\n        {\n            const int i2 = (i1 + 1) == points_count ? 0 : i1 + 1;\n            float dx = points[i2].x - points[i1].x;\n            float dy = points[i2].y - points[i1].y;\n            IM_NORMALIZE2F_OVER_ZERO(dx, dy);\n            temp_normals[i1].x = dy;\n            temp_normals[i1].y = -dx;\n        }\n        if (!closed)\n            temp_normals[points_count - 1] = temp_normals[points_count - 2];\n\n        // If we are drawing a one-pixel-wide line without a texture, or a textured line of any width, we only need 2 or 3 vertices per point\n        if (use_texture || !thick_line)\n        {\n            // [PATH 1] Texture-based lines (thick or non-thick)\n            // [PATH 2] Non texture-based lines (non-thick)\n\n            // The width of the geometry we need to draw - this is essentially <thickness> pixels for the line itself, plus \"one pixel\" for AA.\n            // - In the texture-based path, we don't use AA_SIZE here because the +1 is tied to the generated texture\n            //   (see ImFontAtlasBuildRenderLinesTexData() function), and so alternate values won't work without changes to that code.\n            // - In the non texture-based paths, we would allow AA_SIZE to potentially be != 1.0f with a patch (e.g. fringe_scale patch to\n            //   allow scaling geometry while preserving one-screen-pixel AA fringe).\n            const float half_draw_size = use_texture ? ((thickness * 0.5f) + 1) : AA_SIZE;\n\n            // If line is not closed, the first and last points need to be generated differently as there are no normals to blend\n            if (!closed)\n            {\n                temp_points[0] = points[0] + temp_normals[0] * half_draw_size;\n                temp_points[1] = points[0] - temp_normals[0] * half_draw_size;\n                temp_points[(points_count-1)*2+0] = points[points_count-1] + temp_normals[points_count-1] * half_draw_size;\n                temp_points[(points_count-1)*2+1] = points[points_count-1] - temp_normals[points_count-1] * half_draw_size;\n            }\n\n            // Generate the indices to form a number of triangles for each line segment, and the vertices for the line edges\n            // This takes points n and n+1 and writes into n+1, with the first point in a closed line being generated from the final one (as n+1 wraps)\n            // FIXME-OPT: Merge the different loops, possibly remove the temporary buffer.\n            unsigned int idx1 = _VtxCurrentIdx; // Vertex index for start of line segment\n            for (int i1 = 0; i1 < count; i1++) // i1 is the first point of the line segment\n            {\n                const int i2 = (i1 + 1) == points_count ? 0 : i1 + 1; // i2 is the second point of the line segment\n                const unsigned int idx2 = ((i1 + 1) == points_count) ? _VtxCurrentIdx : (idx1 + (use_texture ? 2 : 3)); // Vertex index for end of segment\n\n                // Average normals\n                float dm_x = (temp_normals[i1].x + temp_normals[i2].x) * 0.5f;\n                float dm_y = (temp_normals[i1].y + temp_normals[i2].y) * 0.5f;\n                IM_FIXNORMAL2F(dm_x, dm_y);\n                dm_x *= half_draw_size; // dm_x, dm_y are offset to the outer edge of the AA area\n                dm_y *= half_draw_size;\n\n                // Add temporary vertexes for the outer edges\n                ImVec2* out_vtx = &temp_points[i2 * 2];\n                out_vtx[0].x = points[i2].x + dm_x;\n                out_vtx[0].y = points[i2].y + dm_y;\n                out_vtx[1].x = points[i2].x - dm_x;\n                out_vtx[1].y = points[i2].y - dm_y;\n\n                if (use_texture)\n                {\n                    // Add indices for two triangles\n                    _IdxWritePtr[0] = (ImDrawIdx)(idx2 + 0); _IdxWritePtr[1] = (ImDrawIdx)(idx1 + 0); _IdxWritePtr[2] = (ImDrawIdx)(idx1 + 1); // Right tri\n                    _IdxWritePtr[3] = (ImDrawIdx)(idx2 + 1); _IdxWritePtr[4] = (ImDrawIdx)(idx1 + 1); _IdxWritePtr[5] = (ImDrawIdx)(idx2 + 0); // Left tri\n                    _IdxWritePtr += 6;\n                }\n                else\n                {\n                    // Add indexes for four triangles\n                    _IdxWritePtr[0] = (ImDrawIdx)(idx2 + 0); _IdxWritePtr[1] = (ImDrawIdx)(idx1 + 0); _IdxWritePtr[2] = (ImDrawIdx)(idx1 + 2); // Right tri 1\n                    _IdxWritePtr[3] = (ImDrawIdx)(idx1 + 2); _IdxWritePtr[4] = (ImDrawIdx)(idx2 + 2); _IdxWritePtr[5] = (ImDrawIdx)(idx2 + 0); // Right tri 2\n                    _IdxWritePtr[6] = (ImDrawIdx)(idx2 + 1); _IdxWritePtr[7] = (ImDrawIdx)(idx1 + 1); _IdxWritePtr[8] = (ImDrawIdx)(idx1 + 0); // Left tri 1\n                    _IdxWritePtr[9] = (ImDrawIdx)(idx1 + 0); _IdxWritePtr[10] = (ImDrawIdx)(idx2 + 0); _IdxWritePtr[11] = (ImDrawIdx)(idx2 + 1); // Left tri 2\n                    _IdxWritePtr += 12;\n                }\n\n                idx1 = idx2;\n            }\n\n            // Add vertexes for each point on the line\n            if (use_texture)\n            {\n                // If we're using textures we only need to emit the left/right edge vertices\n                ImVec4 tex_uvs = _Data->TexUvLines[integer_thickness];\n                /*if (fractional_thickness != 0.0f) // Currently always zero when use_texture==false!\n                {\n                    const ImVec4 tex_uvs_1 = _Data->TexUvLines[integer_thickness + 1];\n                    tex_uvs.x = tex_uvs.x + (tex_uvs_1.x - tex_uvs.x) * fractional_thickness; // inlined ImLerp()\n                    tex_uvs.y = tex_uvs.y + (tex_uvs_1.y - tex_uvs.y) * fractional_thickness;\n                    tex_uvs.z = tex_uvs.z + (tex_uvs_1.z - tex_uvs.z) * fractional_thickness;\n                    tex_uvs.w = tex_uvs.w + (tex_uvs_1.w - tex_uvs.w) * fractional_thickness;\n                }*/\n                ImVec2 tex_uv0(tex_uvs.x, tex_uvs.y);\n                ImVec2 tex_uv1(tex_uvs.z, tex_uvs.w);\n                for (int i = 0; i < points_count; i++)\n                {\n                    _VtxWritePtr[0].pos = temp_points[i * 2 + 0]; _VtxWritePtr[0].uv = tex_uv0; _VtxWritePtr[0].col = col; // Left-side outer edge\n                    _VtxWritePtr[1].pos = temp_points[i * 2 + 1]; _VtxWritePtr[1].uv = tex_uv1; _VtxWritePtr[1].col = col; // Right-side outer edge\n                    _VtxWritePtr += 2;\n                }\n            }\n            else\n            {\n                // If we're not using a texture, we need the center vertex as well\n                for (int i = 0; i < points_count; i++)\n                {\n                    _VtxWritePtr[0].pos = points[i];              _VtxWritePtr[0].uv = opaque_uv; _VtxWritePtr[0].col = col;       // Center of line\n                    _VtxWritePtr[1].pos = temp_points[i * 2 + 0]; _VtxWritePtr[1].uv = opaque_uv; _VtxWritePtr[1].col = col_trans; // Left-side outer edge\n                    _VtxWritePtr[2].pos = temp_points[i * 2 + 1]; _VtxWritePtr[2].uv = opaque_uv; _VtxWritePtr[2].col = col_trans; // Right-side outer edge\n                    _VtxWritePtr += 3;\n                }\n            }\n        }\n        else\n        {\n            // [PATH 2] Non texture-based lines (thick): we need to draw the solid line core and thus require four vertices per point\n            const float half_inner_thickness = (thickness - AA_SIZE) * 0.5f;\n\n            // If line is not closed, the first and last points need to be generated differently as there are no normals to blend\n            if (!closed)\n            {\n                const int points_last = points_count - 1;\n                temp_points[0] = points[0] + temp_normals[0] * (half_inner_thickness + AA_SIZE);\n                temp_points[1] = points[0] + temp_normals[0] * (half_inner_thickness);\n                temp_points[2] = points[0] - temp_normals[0] * (half_inner_thickness);\n                temp_points[3] = points[0] - temp_normals[0] * (half_inner_thickness + AA_SIZE);\n                temp_points[points_last * 4 + 0] = points[points_last] + temp_normals[points_last] * (half_inner_thickness + AA_SIZE);\n                temp_points[points_last * 4 + 1] = points[points_last] + temp_normals[points_last] * (half_inner_thickness);\n                temp_points[points_last * 4 + 2] = points[points_last] - temp_normals[points_last] * (half_inner_thickness);\n                temp_points[points_last * 4 + 3] = points[points_last] - temp_normals[points_last] * (half_inner_thickness + AA_SIZE);\n            }\n\n            // Generate the indices to form a number of triangles for each line segment, and the vertices for the line edges\n            // This takes points n and n+1 and writes into n+1, with the first point in a closed line being generated from the final one (as n+1 wraps)\n            // FIXME-OPT: Merge the different loops, possibly remove the temporary buffer.\n            unsigned int idx1 = _VtxCurrentIdx; // Vertex index for start of line segment\n            for (int i1 = 0; i1 < count; i1++) // i1 is the first point of the line segment\n            {\n                const int i2 = (i1 + 1) == points_count ? 0 : (i1 + 1); // i2 is the second point of the line segment\n                const unsigned int idx2 = (i1 + 1) == points_count ? _VtxCurrentIdx : (idx1 + 4); // Vertex index for end of segment\n\n                // Average normals\n                float dm_x = (temp_normals[i1].x + temp_normals[i2].x) * 0.5f;\n                float dm_y = (temp_normals[i1].y + temp_normals[i2].y) * 0.5f;\n                IM_FIXNORMAL2F(dm_x, dm_y);\n                float dm_out_x = dm_x * (half_inner_thickness + AA_SIZE);\n                float dm_out_y = dm_y * (half_inner_thickness + AA_SIZE);\n                float dm_in_x = dm_x * half_inner_thickness;\n                float dm_in_y = dm_y * half_inner_thickness;\n\n                // Add temporary vertices\n                ImVec2* out_vtx = &temp_points[i2 * 4];\n                out_vtx[0].x = points[i2].x + dm_out_x;\n                out_vtx[0].y = points[i2].y + dm_out_y;\n                out_vtx[1].x = points[i2].x + dm_in_x;\n                out_vtx[1].y = points[i2].y + dm_in_y;\n                out_vtx[2].x = points[i2].x - dm_in_x;\n                out_vtx[2].y = points[i2].y - dm_in_y;\n                out_vtx[3].x = points[i2].x - dm_out_x;\n                out_vtx[3].y = points[i2].y - dm_out_y;\n\n                // Add indexes\n                _IdxWritePtr[0]  = (ImDrawIdx)(idx2 + 1); _IdxWritePtr[1]  = (ImDrawIdx)(idx1 + 1); _IdxWritePtr[2]  = (ImDrawIdx)(idx1 + 2);\n                _IdxWritePtr[3]  = (ImDrawIdx)(idx1 + 2); _IdxWritePtr[4]  = (ImDrawIdx)(idx2 + 2); _IdxWritePtr[5]  = (ImDrawIdx)(idx2 + 1);\n                _IdxWritePtr[6]  = (ImDrawIdx)(idx2 + 1); _IdxWritePtr[7]  = (ImDrawIdx)(idx1 + 1); _IdxWritePtr[8]  = (ImDrawIdx)(idx1 + 0);\n                _IdxWritePtr[9]  = (ImDrawIdx)(idx1 + 0); _IdxWritePtr[10] = (ImDrawIdx)(idx2 + 0); _IdxWritePtr[11] = (ImDrawIdx)(idx2 + 1);\n                _IdxWritePtr[12] = (ImDrawIdx)(idx2 + 2); _IdxWritePtr[13] = (ImDrawIdx)(idx1 + 2); _IdxWritePtr[14] = (ImDrawIdx)(idx1 + 3);\n                _IdxWritePtr[15] = (ImDrawIdx)(idx1 + 3); _IdxWritePtr[16] = (ImDrawIdx)(idx2 + 3); _IdxWritePtr[17] = (ImDrawIdx)(idx2 + 2);\n                _IdxWritePtr += 18;\n\n                idx1 = idx2;\n            }\n\n            // Add vertices\n            for (int i = 0; i < points_count; i++)\n            {\n                _VtxWritePtr[0].pos = temp_points[i * 4 + 0]; _VtxWritePtr[0].uv = opaque_uv; _VtxWritePtr[0].col = col_trans;\n                _VtxWritePtr[1].pos = temp_points[i * 4 + 1]; _VtxWritePtr[1].uv = opaque_uv; _VtxWritePtr[1].col = col;\n                _VtxWritePtr[2].pos = temp_points[i * 4 + 2]; _VtxWritePtr[2].uv = opaque_uv; _VtxWritePtr[2].col = col;\n                _VtxWritePtr[3].pos = temp_points[i * 4 + 3]; _VtxWritePtr[3].uv = opaque_uv; _VtxWritePtr[3].col = col_trans;\n                _VtxWritePtr += 4;\n            }\n        }\n        _VtxCurrentIdx += (ImDrawIdx)vtx_count;\n    }\n    else\n    {\n        // [PATH 4] Non texture-based, Non anti-aliased lines\n        const int idx_count = count * 6;\n        const int vtx_count = count * 4;    // FIXME-OPT: Not sharing edges\n        PrimReserve(idx_count, vtx_count);\n\n        for (int i1 = 0; i1 < count; i1++)\n        {\n            const int i2 = (i1 + 1) == points_count ? 0 : i1 + 1;\n            const ImVec2& p1 = points[i1];\n            const ImVec2& p2 = points[i2];\n\n            float dx = p2.x - p1.x;\n            float dy = p2.y - p1.y;\n            IM_NORMALIZE2F_OVER_ZERO(dx, dy);\n            dx *= (thickness * 0.5f);\n            dy *= (thickness * 0.5f);\n\n            _VtxWritePtr[0].pos.x = p1.x + dy; _VtxWritePtr[0].pos.y = p1.y - dx; _VtxWritePtr[0].uv = opaque_uv; _VtxWritePtr[0].col = col;\n            _VtxWritePtr[1].pos.x = p2.x + dy; _VtxWritePtr[1].pos.y = p2.y - dx; _VtxWritePtr[1].uv = opaque_uv; _VtxWritePtr[1].col = col;\n            _VtxWritePtr[2].pos.x = p2.x - dy; _VtxWritePtr[2].pos.y = p2.y + dx; _VtxWritePtr[2].uv = opaque_uv; _VtxWritePtr[2].col = col;\n            _VtxWritePtr[3].pos.x = p1.x - dy; _VtxWritePtr[3].pos.y = p1.y + dx; _VtxWritePtr[3].uv = opaque_uv; _VtxWritePtr[3].col = col;\n            _VtxWritePtr += 4;\n\n            _IdxWritePtr[0] = (ImDrawIdx)(_VtxCurrentIdx); _IdxWritePtr[1] = (ImDrawIdx)(_VtxCurrentIdx + 1); _IdxWritePtr[2] = (ImDrawIdx)(_VtxCurrentIdx + 2);\n            _IdxWritePtr[3] = (ImDrawIdx)(_VtxCurrentIdx); _IdxWritePtr[4] = (ImDrawIdx)(_VtxCurrentIdx + 2); _IdxWritePtr[5] = (ImDrawIdx)(_VtxCurrentIdx + 3);\n            _IdxWritePtr += 6;\n            _VtxCurrentIdx += 4;\n        }\n    }\n}\n\n// We intentionally avoid using ImVec2 and its math operators here to reduce cost to a minimum for debug/non-inlined builds.\nvoid ImDrawList::AddConvexPolyFilled(const ImVec2* points, const int points_count, ImU32 col)\n{\n    if (points_count < 3)\n        return;\n\n    const ImVec2 uv = _Data->TexUvWhitePixel;\n\n    if (Flags & ImDrawListFlags_AntiAliasedFill)\n    {\n        // Anti-aliased Fill\n        const float AA_SIZE = _FringeScale;\n        const ImU32 col_trans = col & ~IM_COL32_A_MASK;\n        const int idx_count = (points_count - 2)*3 + points_count * 6;\n        const int vtx_count = (points_count * 2);\n        PrimReserve(idx_count, vtx_count);\n\n        // Add indexes for fill\n        unsigned int vtx_inner_idx = _VtxCurrentIdx;\n        unsigned int vtx_outer_idx = _VtxCurrentIdx + 1;\n        for (int i = 2; i < points_count; i++)\n        {\n            _IdxWritePtr[0] = (ImDrawIdx)(vtx_inner_idx); _IdxWritePtr[1] = (ImDrawIdx)(vtx_inner_idx + ((i - 1) << 1)); _IdxWritePtr[2] = (ImDrawIdx)(vtx_inner_idx + (i << 1));\n            _IdxWritePtr += 3;\n        }\n\n        // Compute normals\n        ImVec2* temp_normals = (ImVec2*)alloca(points_count * sizeof(ImVec2)); //-V630\n        for (int i0 = points_count - 1, i1 = 0; i1 < points_count; i0 = i1++)\n        {\n            const ImVec2& p0 = points[i0];\n            const ImVec2& p1 = points[i1];\n            float dx = p1.x - p0.x;\n            float dy = p1.y - p0.y;\n            IM_NORMALIZE2F_OVER_ZERO(dx, dy);\n            temp_normals[i0].x = dy;\n            temp_normals[i0].y = -dx;\n        }\n\n        for (int i0 = points_count - 1, i1 = 0; i1 < points_count; i0 = i1++)\n        {\n            // Average normals\n            const ImVec2& n0 = temp_normals[i0];\n            const ImVec2& n1 = temp_normals[i1];\n            float dm_x = (n0.x + n1.x) * 0.5f;\n            float dm_y = (n0.y + n1.y) * 0.5f;\n            IM_FIXNORMAL2F(dm_x, dm_y);\n            dm_x *= AA_SIZE * 0.5f;\n            dm_y *= AA_SIZE * 0.5f;\n\n            // Add vertices\n            _VtxWritePtr[0].pos.x = (points[i1].x - dm_x); _VtxWritePtr[0].pos.y = (points[i1].y - dm_y); _VtxWritePtr[0].uv = uv; _VtxWritePtr[0].col = col;        // Inner\n            _VtxWritePtr[1].pos.x = (points[i1].x + dm_x); _VtxWritePtr[1].pos.y = (points[i1].y + dm_y); _VtxWritePtr[1].uv = uv; _VtxWritePtr[1].col = col_trans;  // Outer\n            _VtxWritePtr += 2;\n\n            // Add indexes for fringes\n            _IdxWritePtr[0] = (ImDrawIdx)(vtx_inner_idx + (i1 << 1)); _IdxWritePtr[1] = (ImDrawIdx)(vtx_inner_idx + (i0 << 1)); _IdxWritePtr[2] = (ImDrawIdx)(vtx_outer_idx + (i0 << 1));\n            _IdxWritePtr[3] = (ImDrawIdx)(vtx_outer_idx + (i0 << 1)); _IdxWritePtr[4] = (ImDrawIdx)(vtx_outer_idx + (i1 << 1)); _IdxWritePtr[5] = (ImDrawIdx)(vtx_inner_idx + (i1 << 1));\n            _IdxWritePtr += 6;\n        }\n        _VtxCurrentIdx += (ImDrawIdx)vtx_count;\n    }\n    else\n    {\n        // Non Anti-aliased Fill\n        const int idx_count = (points_count - 2)*3;\n        const int vtx_count = points_count;\n        PrimReserve(idx_count, vtx_count);\n        for (int i = 0; i < vtx_count; i++)\n        {\n            _VtxWritePtr[0].pos = points[i]; _VtxWritePtr[0].uv = uv; _VtxWritePtr[0].col = col;\n            _VtxWritePtr++;\n        }\n        for (int i = 2; i < points_count; i++)\n        {\n            _IdxWritePtr[0] = (ImDrawIdx)(_VtxCurrentIdx); _IdxWritePtr[1] = (ImDrawIdx)(_VtxCurrentIdx + i - 1); _IdxWritePtr[2] = (ImDrawIdx)(_VtxCurrentIdx + i);\n            _IdxWritePtr += 3;\n        }\n        _VtxCurrentIdx += (ImDrawIdx)vtx_count;\n    }\n}\n\nvoid ImDrawList::_PathArcToFastEx(const ImVec2& center, float radius, int a_min_sample, int a_max_sample, int a_step)\n{\n    if (radius <= 0.0f)\n    {\n        _Path.push_back(center);\n        return;\n    }\n\n    // Calculate arc auto segment step size\n    if (a_step <= 0)\n        a_step = IM_DRAWLIST_ARCFAST_SAMPLE_MAX / _CalcCircleAutoSegmentCount(radius);\n\n    // Make sure we never do steps larger than one quarter of the circle\n    a_step = ImClamp(a_step, 1, IM_DRAWLIST_ARCFAST_TABLE_SIZE / 4);\n\n    const int sample_range = ImAbs(a_max_sample - a_min_sample);\n    const int a_next_step = a_step;\n\n    int samples = sample_range + 1;\n    bool extra_max_sample = false;\n    if (a_step > 1)\n    {\n        samples            = sample_range / a_step + 1;\n        const int overstep = sample_range % a_step;\n\n        if (overstep > 0)\n        {\n            extra_max_sample = true;\n            samples++;\n\n            // When we have overstep to avoid awkwardly looking one long line and one tiny one at the end,\n            // distribute first step range evenly between them by reducing first step size.\n            if (sample_range > 0)\n                a_step -= (a_step - overstep) / 2;\n        }\n    }\n\n    _Path.resize(_Path.Size + samples);\n    ImVec2* out_ptr = _Path.Data + (_Path.Size - samples);\n\n    int sample_index = a_min_sample;\n    if (sample_index < 0 || sample_index >= IM_DRAWLIST_ARCFAST_SAMPLE_MAX)\n    {\n        sample_index = sample_index % IM_DRAWLIST_ARCFAST_SAMPLE_MAX;\n        if (sample_index < 0)\n            sample_index += IM_DRAWLIST_ARCFAST_SAMPLE_MAX;\n    }\n\n    if (a_max_sample >= a_min_sample)\n    {\n        for (int a = a_min_sample; a <= a_max_sample; a += a_step, sample_index += a_step, a_step = a_next_step)\n        {\n            // a_step is clamped to IM_DRAWLIST_ARCFAST_SAMPLE_MAX, so we have guaranteed that it will not wrap over range twice or more\n            if (sample_index >= IM_DRAWLIST_ARCFAST_SAMPLE_MAX)\n                sample_index -= IM_DRAWLIST_ARCFAST_SAMPLE_MAX;\n\n            const ImVec2 s = _Data->ArcFastVtx[sample_index];\n            out_ptr->x = center.x + s.x * radius;\n            out_ptr->y = center.y + s.y * radius;\n            out_ptr++;\n        }\n    }\n    else\n    {\n        for (int a = a_min_sample; a >= a_max_sample; a -= a_step, sample_index -= a_step, a_step = a_next_step)\n        {\n            // a_step is clamped to IM_DRAWLIST_ARCFAST_SAMPLE_MAX, so we have guaranteed that it will not wrap over range twice or more\n            if (sample_index < 0)\n                sample_index += IM_DRAWLIST_ARCFAST_SAMPLE_MAX;\n\n            const ImVec2 s = _Data->ArcFastVtx[sample_index];\n            out_ptr->x = center.x + s.x * radius;\n            out_ptr->y = center.y + s.y * radius;\n            out_ptr++;\n        }\n    }\n\n    if (extra_max_sample)\n    {\n        int normalized_max_sample = a_max_sample % IM_DRAWLIST_ARCFAST_SAMPLE_MAX;\n        if (normalized_max_sample < 0)\n            normalized_max_sample += IM_DRAWLIST_ARCFAST_SAMPLE_MAX;\n\n        const ImVec2 s = _Data->ArcFastVtx[normalized_max_sample];\n        out_ptr->x = center.x + s.x * radius;\n        out_ptr->y = center.y + s.y * radius;\n        out_ptr++;\n    }\n\n    IM_ASSERT_PARANOID(_Path.Data + _Path.Size == out_ptr);\n}\n\nvoid ImDrawList::_PathArcToN(const ImVec2& center, float radius, float a_min, float a_max, int num_segments)\n{\n    if (radius <= 0.0f)\n    {\n        _Path.push_back(center);\n        return;\n    }\n\n    // Note that we are adding a point at both a_min and a_max.\n    // If you are trying to draw a full closed circle you don't want the overlapping points!\n    _Path.reserve(_Path.Size + (num_segments + 1));\n    for (int i = 0; i <= num_segments; i++)\n    {\n        const float a = a_min + ((float)i / (float)num_segments) * (a_max - a_min);\n        _Path.push_back(ImVec2(center.x + ImCos(a) * radius, center.y + ImSin(a) * radius));\n    }\n}\n\n// 0: East, 3: South, 6: West, 9: North, 12: East\nvoid ImDrawList::PathArcToFast(const ImVec2& center, float radius, int a_min_of_12, int a_max_of_12)\n{\n    if (radius <= 0.0f)\n    {\n        _Path.push_back(center);\n        return;\n    }\n    _PathArcToFastEx(center, radius, a_min_of_12 * IM_DRAWLIST_ARCFAST_SAMPLE_MAX / 12, a_max_of_12 * IM_DRAWLIST_ARCFAST_SAMPLE_MAX / 12, 0);\n}\n\nvoid ImDrawList::PathArcTo(const ImVec2& center, float radius, float a_min, float a_max, int num_segments)\n{\n    if (radius <= 0.0f)\n    {\n        _Path.push_back(center);\n        return;\n    }\n\n    if (num_segments > 0)\n    {\n        _PathArcToN(center, radius, a_min, a_max, num_segments);\n        return;\n    }\n\n    // Automatic segment count\n    if (radius <= _Data->ArcFastRadiusCutoff)\n    {\n        const bool a_is_reverse = a_max < a_min;\n\n        // We are going to use precomputed values for mid samples.\n        // Determine first and last sample in lookup table that belong to the arc.\n        const float a_min_sample_f = IM_DRAWLIST_ARCFAST_SAMPLE_MAX * a_min / (IM_PI * 2.0f);\n        const float a_max_sample_f = IM_DRAWLIST_ARCFAST_SAMPLE_MAX * a_max / (IM_PI * 2.0f);\n\n        const int a_min_sample = a_is_reverse ? (int)ImFloorSigned(a_min_sample_f) : (int)ImCeil(a_min_sample_f);\n        const int a_max_sample = a_is_reverse ? (int)ImCeil(a_max_sample_f) : (int)ImFloorSigned(a_max_sample_f);\n        const int a_mid_samples = a_is_reverse ? ImMax(a_min_sample - a_max_sample, 0) : ImMax(a_max_sample - a_min_sample, 0);\n\n        const float a_min_segment_angle = a_min_sample * IM_PI * 2.0f / IM_DRAWLIST_ARCFAST_SAMPLE_MAX;\n        const float a_max_segment_angle = a_max_sample * IM_PI * 2.0f / IM_DRAWLIST_ARCFAST_SAMPLE_MAX;\n        const bool a_emit_start = (a_min_segment_angle - a_min) != 0.0f;\n        const bool a_emit_end = (a_max - a_max_segment_angle) != 0.0f;\n\n        _Path.reserve(_Path.Size + (a_mid_samples + 1 + (a_emit_start ? 1 : 0) + (a_emit_end ? 1 : 0)));\n        if (a_emit_start)\n            _Path.push_back(ImVec2(center.x + ImCos(a_min) * radius, center.y + ImSin(a_min) * radius));\n        if (a_mid_samples > 0)\n            _PathArcToFastEx(center, radius, a_min_sample, a_max_sample, 0);\n        if (a_emit_end)\n            _Path.push_back(ImVec2(center.x + ImCos(a_max) * radius, center.y + ImSin(a_max) * radius));\n    }\n    else\n    {\n        const float arc_length = ImAbs(a_max - a_min);\n        const int circle_segment_count = _CalcCircleAutoSegmentCount(radius);\n        const int arc_segment_count = ImMax((int)ImCeil(circle_segment_count * arc_length / (IM_PI * 2.0f)), (int)(2.0f * IM_PI / arc_length));\n        _PathArcToN(center, radius, a_min, a_max, arc_segment_count);\n    }\n}\n\nImVec2 ImBezierCubicCalc(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, float t)\n{\n    float u = 1.0f - t;\n    float w1 = u * u * u;\n    float w2 = 3 * u * u * t;\n    float w3 = 3 * u * t * t;\n    float w4 = t * t * t;\n    return ImVec2(w1 * p1.x + w2 * p2.x + w3 * p3.x + w4 * p4.x, w1 * p1.y + w2 * p2.y + w3 * p3.y + w4 * p4.y);\n}\n\nImVec2 ImBezierQuadraticCalc(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, float t)\n{\n    float u = 1.0f - t;\n    float w1 = u * u;\n    float w2 = 2 * u * t;\n    float w3 = t * t;\n    return ImVec2(w1 * p1.x + w2 * p2.x + w3 * p3.x, w1 * p1.y + w2 * p2.y + w3 * p3.y);\n}\n\n// Closely mimics ImBezierCubicClosestPointCasteljau() in imgui.cpp\nstatic void PathBezierCubicCurveToCasteljau(ImVector<ImVec2>* path, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, float tess_tol, int level)\n{\n    float dx = x4 - x1;\n    float dy = y4 - y1;\n    float d2 = (x2 - x4) * dy - (y2 - y4) * dx;\n    float d3 = (x3 - x4) * dy - (y3 - y4) * dx;\n    d2 = (d2 >= 0) ? d2 : -d2;\n    d3 = (d3 >= 0) ? d3 : -d3;\n    if ((d2 + d3) * (d2 + d3) < tess_tol * (dx * dx + dy * dy))\n    {\n        path->push_back(ImVec2(x4, y4));\n    }\n    else if (level < 10)\n    {\n        float x12 = (x1 + x2) * 0.5f, y12 = (y1 + y2) * 0.5f;\n        float x23 = (x2 + x3) * 0.5f, y23 = (y2 + y3) * 0.5f;\n        float x34 = (x3 + x4) * 0.5f, y34 = (y3 + y4) * 0.5f;\n        float x123 = (x12 + x23) * 0.5f, y123 = (y12 + y23) * 0.5f;\n        float x234 = (x23 + x34) * 0.5f, y234 = (y23 + y34) * 0.5f;\n        float x1234 = (x123 + x234) * 0.5f, y1234 = (y123 + y234) * 0.5f;\n        PathBezierCubicCurveToCasteljau(path, x1, y1, x12, y12, x123, y123, x1234, y1234, tess_tol, level + 1);\n        PathBezierCubicCurveToCasteljau(path, x1234, y1234, x234, y234, x34, y34, x4, y4, tess_tol, level + 1);\n    }\n}\n\nstatic void PathBezierQuadraticCurveToCasteljau(ImVector<ImVec2>* path, float x1, float y1, float x2, float y2, float x3, float y3, float tess_tol, int level)\n{\n    float dx = x3 - x1, dy = y3 - y1;\n    float det = (x2 - x3) * dy - (y2 - y3) * dx;\n    if (det * det * 4.0f < tess_tol * (dx * dx + dy * dy))\n    {\n        path->push_back(ImVec2(x3, y3));\n    }\n    else if (level < 10)\n    {\n        float x12 = (x1 + x2) * 0.5f, y12 = (y1 + y2) * 0.5f;\n        float x23 = (x2 + x3) * 0.5f, y23 = (y2 + y3) * 0.5f;\n        float x123 = (x12 + x23) * 0.5f, y123 = (y12 + y23) * 0.5f;\n        PathBezierQuadraticCurveToCasteljau(path, x1, y1, x12, y12, x123, y123, tess_tol, level + 1);\n        PathBezierQuadraticCurveToCasteljau(path, x123, y123, x23, y23, x3, y3, tess_tol, level + 1);\n    }\n}\n\nvoid ImDrawList::PathBezierCubicCurveTo(const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, int num_segments)\n{\n    ImVec2 p1 = _Path.back();\n    if (num_segments == 0)\n    {\n        PathBezierCubicCurveToCasteljau(&_Path, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, p4.x, p4.y, _Data->CurveTessellationTol, 0); // Auto-tessellated\n    }\n    else\n    {\n        float t_step = 1.0f / (float)num_segments;\n        for (int i_step = 1; i_step <= num_segments; i_step++)\n            _Path.push_back(ImBezierCubicCalc(p1, p2, p3, p4, t_step * i_step));\n    }\n}\n\nvoid ImDrawList::PathBezierQuadraticCurveTo(const ImVec2& p2, const ImVec2& p3, int num_segments)\n{\n    ImVec2 p1 = _Path.back();\n    if (num_segments == 0)\n    {\n        PathBezierQuadraticCurveToCasteljau(&_Path, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, _Data->CurveTessellationTol, 0);// Auto-tessellated\n    }\n    else\n    {\n        float t_step = 1.0f / (float)num_segments;\n        for (int i_step = 1; i_step <= num_segments; i_step++)\n            _Path.push_back(ImBezierQuadraticCalc(p1, p2, p3, t_step * i_step));\n    }\n}\n\nIM_STATIC_ASSERT(ImDrawFlags_RoundCornersTopLeft == (1 << 4));\nstatic inline ImDrawFlags FixRectCornerFlags(ImDrawFlags flags)\n{\n#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS\n    // Legacy Support for hard coded ~0 (used to be a suggested equivalent to ImDrawCornerFlags_All)\n    //   ~0   --> ImDrawFlags_RoundCornersAll or 0\n    if (flags == ~0)\n        return ImDrawFlags_RoundCornersAll;\n\n    // Legacy Support for hard coded 0x01 to 0x0F (matching 15 out of 16 old flags combinations)\n    //   0x01 --> ImDrawFlags_RoundCornersTopLeft (VALUE 0x01 OVERLAPS ImDrawFlags_Closed but ImDrawFlags_Closed is never valid in this path!)\n    //   0x02 --> ImDrawFlags_RoundCornersTopRight\n    //   0x03 --> ImDrawFlags_RoundCornersTopLeft | ImDrawFlags_RoundCornersTopRight\n    //   0x04 --> ImDrawFlags_RoundCornersBotLeft\n    //   0x05 --> ImDrawFlags_RoundCornersTopLeft | ImDrawFlags_RoundCornersBotLeft\n    //   ...\n    //   0x0F --> ImDrawFlags_RoundCornersAll or 0\n    // (See all values in ImDrawCornerFlags_)\n    if (flags >= 0x01 && flags <= 0x0F)\n        return (flags << 4);\n\n    // We cannot support hard coded 0x00 with 'float rounding > 0.0f' --> replace with ImDrawFlags_RoundCornersNone or use 'float rounding = 0.0f'\n#endif\n\n    // If this triggers, please update your code replacing hardcoded values with new ImDrawFlags_RoundCorners* values.\n    // Note that ImDrawFlags_Closed (== 0x01) is an invalid flag for AddRect(), AddRectFilled(), PathRect() etc...\n    IM_ASSERT((flags & 0x0F) == 0 && \"Misuse of legacy hardcoded ImDrawCornerFlags values!\");\n\n    if ((flags & ImDrawFlags_RoundCornersMask_) == 0)\n        flags |= ImDrawFlags_RoundCornersAll;\n\n    return flags;\n}\n\nvoid ImDrawList::PathRect(const ImVec2& a, const ImVec2& b, float rounding, ImDrawFlags flags)\n{\n    flags = FixRectCornerFlags(flags);\n    rounding = ImMin(rounding, ImFabs(b.x - a.x) * ( ((flags & ImDrawFlags_RoundCornersTop)  == ImDrawFlags_RoundCornersTop)  || ((flags & ImDrawFlags_RoundCornersBottom) == ImDrawFlags_RoundCornersBottom) ? 0.5f : 1.0f ) - 1.0f);\n    rounding = ImMin(rounding, ImFabs(b.y - a.y) * ( ((flags & ImDrawFlags_RoundCornersLeft) == ImDrawFlags_RoundCornersLeft) || ((flags & ImDrawFlags_RoundCornersRight)  == ImDrawFlags_RoundCornersRight)  ? 0.5f : 1.0f ) - 1.0f);\n\n    if (rounding <= 0.0f || (flags & ImDrawFlags_RoundCornersMask_) == ImDrawFlags_RoundCornersNone)\n    {\n        PathLineTo(a);\n        PathLineTo(ImVec2(b.x, a.y));\n        PathLineTo(b);\n        PathLineTo(ImVec2(a.x, b.y));\n    }\n    else\n    {\n        const float rounding_tl = (flags & ImDrawFlags_RoundCornersTopLeft)     ? rounding : 0.0f;\n        const float rounding_tr = (flags & ImDrawFlags_RoundCornersTopRight)    ? rounding : 0.0f;\n        const float rounding_br = (flags & ImDrawFlags_RoundCornersBottomRight) ? rounding : 0.0f;\n        const float rounding_bl = (flags & ImDrawFlags_RoundCornersBottomLeft)  ? rounding : 0.0f;\n        PathArcToFast(ImVec2(a.x + rounding_tl, a.y + rounding_tl), rounding_tl, 6, 9);\n        PathArcToFast(ImVec2(b.x - rounding_tr, a.y + rounding_tr), rounding_tr, 9, 12);\n        PathArcToFast(ImVec2(b.x - rounding_br, b.y - rounding_br), rounding_br, 0, 3);\n        PathArcToFast(ImVec2(a.x + rounding_bl, b.y - rounding_bl), rounding_bl, 3, 6);\n    }\n}\n\nvoid ImDrawList::AddLine(const ImVec2& p1, const ImVec2& p2, ImU32 col, float thickness)\n{\n    if ((col & IM_COL32_A_MASK) == 0)\n        return;\n    PathLineTo(p1 + ImVec2(0.5f, 0.5f));\n    PathLineTo(p2 + ImVec2(0.5f, 0.5f));\n    PathStroke(col, 0, thickness);\n}\n\n// p_min = upper-left, p_max = lower-right\n// Note we don't render 1 pixels sized rectangles properly.\nvoid ImDrawList::AddRect(const ImVec2& p_min, const ImVec2& p_max, ImU32 col, float rounding, ImDrawFlags flags, float thickness)\n{\n    if ((col & IM_COL32_A_MASK) == 0)\n        return;\n    if (Flags & ImDrawListFlags_AntiAliasedLines)\n        PathRect(p_min + ImVec2(0.50f, 0.50f), p_max - ImVec2(0.50f, 0.50f), rounding, flags);\n    else\n        PathRect(p_min + ImVec2(0.50f, 0.50f), p_max - ImVec2(0.49f, 0.49f), rounding, flags); // Better looking lower-right corner and rounded non-AA shapes.\n    PathStroke(col, ImDrawFlags_Closed, thickness);\n}\n\nvoid ImDrawList::AddRectFilled(const ImVec2& p_min, const ImVec2& p_max, ImU32 col, float rounding, ImDrawFlags flags)\n{\n    if ((col & IM_COL32_A_MASK) == 0)\n        return;\n    if (rounding <= 0.0f || (flags & ImDrawFlags_RoundCornersMask_) == ImDrawFlags_RoundCornersNone)\n    {\n        PrimReserve(6, 4);\n        PrimRect(p_min, p_max, col);\n    }\n    else\n    {\n        PathRect(p_min, p_max, rounding, flags);\n        PathFillConvex(col);\n    }\n}\n\n// p_min = upper-left, p_max = lower-right\nvoid ImDrawList::AddRectFilledMultiColor(const ImVec2& p_min, const ImVec2& p_max, ImU32 col_upr_left, ImU32 col_upr_right, ImU32 col_bot_right, ImU32 col_bot_left)\n{\n    if (((col_upr_left | col_upr_right | col_bot_right | col_bot_left) & IM_COL32_A_MASK) == 0)\n        return;\n\n    const ImVec2 uv = _Data->TexUvWhitePixel;\n    PrimReserve(6, 4);\n    PrimWriteIdx((ImDrawIdx)(_VtxCurrentIdx)); PrimWriteIdx((ImDrawIdx)(_VtxCurrentIdx + 1)); PrimWriteIdx((ImDrawIdx)(_VtxCurrentIdx + 2));\n    PrimWriteIdx((ImDrawIdx)(_VtxCurrentIdx)); PrimWriteIdx((ImDrawIdx)(_VtxCurrentIdx + 2)); PrimWriteIdx((ImDrawIdx)(_VtxCurrentIdx + 3));\n    PrimWriteVtx(p_min, uv, col_upr_left);\n    PrimWriteVtx(ImVec2(p_max.x, p_min.y), uv, col_upr_right);\n    PrimWriteVtx(p_max, uv, col_bot_right);\n    PrimWriteVtx(ImVec2(p_min.x, p_max.y), uv, col_bot_left);\n}\n\nvoid ImDrawList::AddQuad(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, ImU32 col, float thickness)\n{\n    if ((col & IM_COL32_A_MASK) == 0)\n        return;\n\n    PathLineTo(p1);\n    PathLineTo(p2);\n    PathLineTo(p3);\n    PathLineTo(p4);\n    PathStroke(col, ImDrawFlags_Closed, thickness);\n}\n\nvoid ImDrawList::AddQuadFilled(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, ImU32 col)\n{\n    if ((col & IM_COL32_A_MASK) == 0)\n        return;\n\n    PathLineTo(p1);\n    PathLineTo(p2);\n    PathLineTo(p3);\n    PathLineTo(p4);\n    PathFillConvex(col);\n}\n\nvoid ImDrawList::AddTriangle(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, ImU32 col, float thickness)\n{\n    if ((col & IM_COL32_A_MASK) == 0)\n        return;\n\n    PathLineTo(p1);\n    PathLineTo(p2);\n    PathLineTo(p3);\n    PathStroke(col, ImDrawFlags_Closed, thickness);\n}\n\nvoid ImDrawList::AddTriangleFilled(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, ImU32 col)\n{\n    if ((col & IM_COL32_A_MASK) == 0)\n        return;\n\n    PathLineTo(p1);\n    PathLineTo(p2);\n    PathLineTo(p3);\n    PathFillConvex(col);\n}\n\nvoid ImDrawList::AddCircle(const ImVec2& center, float radius, ImU32 col, int num_segments, float thickness)\n{\n    if ((col & IM_COL32_A_MASK) == 0 || radius <= 0.0f)\n        return;\n\n    if (num_segments <= 0)\n    {\n        // Use arc with automatic segment count\n        _PathArcToFastEx(center, radius - 0.5f, 0, IM_DRAWLIST_ARCFAST_SAMPLE_MAX, 0);\n        _Path.Size--;\n    }\n    else\n    {\n        // Explicit segment count (still clamp to avoid drawing insanely tessellated shapes)\n        num_segments = ImClamp(num_segments, 3, IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX);\n\n        // Because we are filling a closed shape we remove 1 from the count of segments/points\n        const float a_max = (IM_PI * 2.0f) * ((float)num_segments - 1.0f) / (float)num_segments;\n        PathArcTo(center, radius - 0.5f, 0.0f, a_max, num_segments - 1);\n    }\n\n    PathStroke(col, ImDrawFlags_Closed, thickness);\n}\n\nvoid ImDrawList::AddCircleFilled(const ImVec2& center, float radius, ImU32 col, int num_segments)\n{\n    if ((col & IM_COL32_A_MASK) == 0 || radius <= 0.0f)\n        return;\n\n    if (num_segments <= 0)\n    {\n        // Use arc with automatic segment count\n        _PathArcToFastEx(center, radius, 0, IM_DRAWLIST_ARCFAST_SAMPLE_MAX, 0);\n        _Path.Size--;\n    }\n    else\n    {\n        // Explicit segment count (still clamp to avoid drawing insanely tessellated shapes)\n        num_segments = ImClamp(num_segments, 3, IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX);\n\n        // Because we are filling a closed shape we remove 1 from the count of segments/points\n        const float a_max = (IM_PI * 2.0f) * ((float)num_segments - 1.0f) / (float)num_segments;\n        PathArcTo(center, radius, 0.0f, a_max, num_segments - 1);\n    }\n\n    PathFillConvex(col);\n}\n\n// Guaranteed to honor 'num_segments'\nvoid ImDrawList::AddNgon(const ImVec2& center, float radius, ImU32 col, int num_segments, float thickness)\n{\n    if ((col & IM_COL32_A_MASK) == 0 || num_segments <= 2)\n        return;\n\n    // Because we are filling a closed shape we remove 1 from the count of segments/points\n    const float a_max = (IM_PI * 2.0f) * ((float)num_segments - 1.0f) / (float)num_segments;\n    PathArcTo(center, radius - 0.5f, 0.0f, a_max, num_segments - 1);\n    PathStroke(col, ImDrawFlags_Closed, thickness);\n}\n\n// Guaranteed to honor 'num_segments'\nvoid ImDrawList::AddNgonFilled(const ImVec2& center, float radius, ImU32 col, int num_segments)\n{\n    if ((col & IM_COL32_A_MASK) == 0 || num_segments <= 2)\n        return;\n\n    // Because we are filling a closed shape we remove 1 from the count of segments/points\n    const float a_max = (IM_PI * 2.0f) * ((float)num_segments - 1.0f) / (float)num_segments;\n    PathArcTo(center, radius, 0.0f, a_max, num_segments - 1);\n    PathFillConvex(col);\n}\n\n// Cubic Bezier takes 4 controls points\nvoid ImDrawList::AddBezierCubic(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, ImU32 col, float thickness, int num_segments)\n{\n    if ((col & IM_COL32_A_MASK) == 0)\n        return;\n\n    PathLineTo(p1);\n    PathBezierCubicCurveTo(p2, p3, p4, num_segments);\n    PathStroke(col, 0, thickness);\n}\n\n// Quadratic Bezier takes 3 controls points\nvoid ImDrawList::AddBezierQuadratic(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, ImU32 col, float thickness, int num_segments)\n{\n    if ((col & IM_COL32_A_MASK) == 0)\n        return;\n\n    PathLineTo(p1);\n    PathBezierQuadraticCurveTo(p2, p3, num_segments);\n    PathStroke(col, 0, thickness);\n}\n\nvoid ImDrawList::AddText(const ImFont* font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end, float wrap_width, const ImVec4* cpu_fine_clip_rect)\n{\n    if ((col & IM_COL32_A_MASK) == 0)\n        return;\n\n    if (text_end == NULL)\n        text_end = text_begin + strlen(text_begin);\n    if (text_begin == text_end)\n        return;\n\n    // Pull default font/size from the shared ImDrawListSharedData instance\n    if (font == NULL)\n        font = _Data->Font;\n    if (font_size == 0.0f)\n        font_size = _Data->FontSize;\n\n    IM_ASSERT(font->ContainerAtlas->TexID == _CmdHeader.TextureId);  // Use high-level ImGui::PushFont() or low-level ImDrawList::PushTextureId() to change font.\n\n    ImVec4 clip_rect = _CmdHeader.ClipRect;\n    if (cpu_fine_clip_rect)\n    {\n        clip_rect.x = ImMax(clip_rect.x, cpu_fine_clip_rect->x);\n        clip_rect.y = ImMax(clip_rect.y, cpu_fine_clip_rect->y);\n        clip_rect.z = ImMin(clip_rect.z, cpu_fine_clip_rect->z);\n        clip_rect.w = ImMin(clip_rect.w, cpu_fine_clip_rect->w);\n    }\n    font->RenderText(this, font_size, pos, col, clip_rect, text_begin, text_end, wrap_width, cpu_fine_clip_rect != NULL);\n}\n\nvoid ImDrawList::AddText(const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end)\n{\n    AddText(NULL, 0.0f, pos, col, text_begin, text_end);\n}\n\nvoid ImDrawList::AddImage(ImTextureID user_texture_id, const ImVec2& p_min, const ImVec2& p_max, const ImVec2& uv_min, const ImVec2& uv_max, ImU32 col)\n{\n    if ((col & IM_COL32_A_MASK) == 0)\n        return;\n\n    const bool push_texture_id = user_texture_id != _CmdHeader.TextureId;\n    if (push_texture_id)\n        PushTextureID(user_texture_id);\n\n    PrimReserve(6, 4);\n    PrimRectUV(p_min, p_max, uv_min, uv_max, col);\n\n    if (push_texture_id)\n        PopTextureID();\n}\n\nvoid ImDrawList::AddImageQuad(ImTextureID user_texture_id, const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, const ImVec2& uv1, const ImVec2& uv2, const ImVec2& uv3, const ImVec2& uv4, ImU32 col)\n{\n    if ((col & IM_COL32_A_MASK) == 0)\n        return;\n\n    const bool push_texture_id = user_texture_id != _CmdHeader.TextureId;\n    if (push_texture_id)\n        PushTextureID(user_texture_id);\n\n    PrimReserve(6, 4);\n    PrimQuadUV(p1, p2, p3, p4, uv1, uv2, uv3, uv4, col);\n\n    if (push_texture_id)\n        PopTextureID();\n}\n\nvoid ImDrawList::AddImageRounded(ImTextureID user_texture_id, const ImVec2& p_min, const ImVec2& p_max, const ImVec2& uv_min, const ImVec2& uv_max, ImU32 col, float rounding, ImDrawFlags flags)\n{\n    if ((col & IM_COL32_A_MASK) == 0)\n        return;\n\n    flags = FixRectCornerFlags(flags);\n    if (rounding <= 0.0f || (flags & ImDrawFlags_RoundCornersMask_) == ImDrawFlags_RoundCornersNone)\n    {\n        AddImage(user_texture_id, p_min, p_max, uv_min, uv_max, col);\n        return;\n    }\n\n    const bool push_texture_id = user_texture_id != _CmdHeader.TextureId;\n    if (push_texture_id)\n        PushTextureID(user_texture_id);\n\n    int vert_start_idx = VtxBuffer.Size;\n    PathRect(p_min, p_max, rounding, flags);\n    PathFillConvex(col);\n    int vert_end_idx = VtxBuffer.Size;\n    ImGui::ShadeVertsLinearUV(this, vert_start_idx, vert_end_idx, p_min, p_max, uv_min, uv_max, true);\n\n    if (push_texture_id)\n        PopTextureID();\n}\n\n\n//-----------------------------------------------------------------------------\n// [SECTION] ImDrawListSplitter\n//-----------------------------------------------------------------------------\n// FIXME: This may be a little confusing, trying to be a little too low-level/optimal instead of just doing vector swap..\n//-----------------------------------------------------------------------------\n\nvoid ImDrawListSplitter::ClearFreeMemory()\n{\n    for (int i = 0; i < _Channels.Size; i++)\n    {\n        if (i == _Current)\n            memset(&_Channels[i], 0, sizeof(_Channels[i]));  // Current channel is a copy of CmdBuffer/IdxBuffer, don't destruct again\n        _Channels[i]._CmdBuffer.clear();\n        _Channels[i]._IdxBuffer.clear();\n    }\n    _Current = 0;\n    _Count = 1;\n    _Channels.clear();\n}\n\nvoid ImDrawListSplitter::Split(ImDrawList* draw_list, int channels_count)\n{\n    IM_UNUSED(draw_list);\n    IM_ASSERT(_Current == 0 && _Count <= 1 && \"Nested channel splitting is not supported. Please use separate instances of ImDrawListSplitter.\");\n    int old_channels_count = _Channels.Size;\n    if (old_channels_count < channels_count)\n    {\n        _Channels.reserve(channels_count); // Avoid over reserving since this is likely to stay stable\n        _Channels.resize(channels_count);\n    }\n    _Count = channels_count;\n\n    // Channels[] (24/32 bytes each) hold storage that we'll swap with draw_list->_CmdBuffer/_IdxBuffer\n    // The content of Channels[0] at this point doesn't matter. We clear it to make state tidy in a debugger but we don't strictly need to.\n    // When we switch to the next channel, we'll copy draw_list->_CmdBuffer/_IdxBuffer into Channels[0] and then Channels[1] into draw_list->CmdBuffer/_IdxBuffer\n    memset(&_Channels[0], 0, sizeof(ImDrawChannel));\n    for (int i = 1; i < channels_count; i++)\n    {\n        if (i >= old_channels_count)\n        {\n            IM_PLACEMENT_NEW(&_Channels[i]) ImDrawChannel();\n        }\n        else\n        {\n            _Channels[i]._CmdBuffer.resize(0);\n            _Channels[i]._IdxBuffer.resize(0);\n        }\n    }\n}\n\nvoid ImDrawListSplitter::Merge(ImDrawList* draw_list)\n{\n    // Note that we never use or rely on _Channels.Size because it is merely a buffer that we never shrink back to 0 to keep all sub-buffers ready for use.\n    if (_Count <= 1)\n        return;\n\n    SetCurrentChannel(draw_list, 0);\n    draw_list->_PopUnusedDrawCmd();\n\n    // Calculate our final buffer sizes. Also fix the incorrect IdxOffset values in each command.\n    int new_cmd_buffer_count = 0;\n    int new_idx_buffer_count = 0;\n    ImDrawCmd* last_cmd = (_Count > 0 && draw_list->CmdBuffer.Size > 0) ? &draw_list->CmdBuffer.back() : NULL;\n    int idx_offset = last_cmd ? last_cmd->IdxOffset + last_cmd->ElemCount : 0;\n    for (int i = 1; i < _Count; i++)\n    {\n        ImDrawChannel& ch = _Channels[i];\n\n        // Equivalent of PopUnusedDrawCmd() for this channel's cmdbuffer and except we don't need to test for UserCallback.\n        if (ch._CmdBuffer.Size > 0 && ch._CmdBuffer.back().ElemCount == 0)\n            ch._CmdBuffer.pop_back();\n\n        if (ch._CmdBuffer.Size > 0 && last_cmd != NULL)\n        {\n            ImDrawCmd* next_cmd = &ch._CmdBuffer[0];\n            if (ImDrawCmd_HeaderCompare(last_cmd, next_cmd) == 0 && last_cmd->UserCallback == NULL && next_cmd->UserCallback == NULL)\n            {\n                // Merge previous channel last draw command with current channel first draw command if matching.\n                last_cmd->ElemCount += next_cmd->ElemCount;\n                idx_offset += next_cmd->ElemCount;\n                ch._CmdBuffer.erase(ch._CmdBuffer.Data); // FIXME-OPT: Improve for multiple merges.\n            }\n        }\n        if (ch._CmdBuffer.Size > 0)\n            last_cmd = &ch._CmdBuffer.back();\n        new_cmd_buffer_count += ch._CmdBuffer.Size;\n        new_idx_buffer_count += ch._IdxBuffer.Size;\n        for (int cmd_n = 0; cmd_n < ch._CmdBuffer.Size; cmd_n++)\n        {\n            ch._CmdBuffer.Data[cmd_n].IdxOffset = idx_offset;\n            idx_offset += ch._CmdBuffer.Data[cmd_n].ElemCount;\n        }\n    }\n    draw_list->CmdBuffer.resize(draw_list->CmdBuffer.Size + new_cmd_buffer_count);\n    draw_list->IdxBuffer.resize(draw_list->IdxBuffer.Size + new_idx_buffer_count);\n\n    // Write commands and indices in order (they are fairly small structures, we don't copy vertices only indices)\n    ImDrawCmd* cmd_write = draw_list->CmdBuffer.Data + draw_list->CmdBuffer.Size - new_cmd_buffer_count;\n    ImDrawIdx* idx_write = draw_list->IdxBuffer.Data + draw_list->IdxBuffer.Size - new_idx_buffer_count;\n    for (int i = 1; i < _Count; i++)\n    {\n        ImDrawChannel& ch = _Channels[i];\n        if (int sz = ch._CmdBuffer.Size) { memcpy(cmd_write, ch._CmdBuffer.Data, sz * sizeof(ImDrawCmd)); cmd_write += sz; }\n        if (int sz = ch._IdxBuffer.Size) { memcpy(idx_write, ch._IdxBuffer.Data, sz * sizeof(ImDrawIdx)); idx_write += sz; }\n    }\n    draw_list->_IdxWritePtr = idx_write;\n\n    // Ensure there's always a non-callback draw command trailing the command-buffer\n    if (draw_list->CmdBuffer.Size == 0 || draw_list->CmdBuffer.back().UserCallback != NULL)\n        draw_list->AddDrawCmd();\n\n    // If current command is used with different settings we need to add a new command\n    ImDrawCmd* curr_cmd = &draw_list->CmdBuffer.Data[draw_list->CmdBuffer.Size - 1];\n    if (curr_cmd->ElemCount == 0)\n        ImDrawCmd_HeaderCopy(curr_cmd, &draw_list->_CmdHeader); // Copy ClipRect, TextureId, VtxOffset\n    else if (ImDrawCmd_HeaderCompare(curr_cmd, &draw_list->_CmdHeader) != 0)\n        draw_list->AddDrawCmd();\n\n    _Count = 1;\n}\n\nvoid ImDrawListSplitter::SetCurrentChannel(ImDrawList* draw_list, int idx)\n{\n    IM_ASSERT(idx >= 0 && idx < _Count);\n    if (_Current == idx)\n        return;\n\n    // Overwrite ImVector (12/16 bytes), four times. This is merely a silly optimization instead of doing .swap()\n    memcpy(&_Channels.Data[_Current]._CmdBuffer, &draw_list->CmdBuffer, sizeof(draw_list->CmdBuffer));\n    memcpy(&_Channels.Data[_Current]._IdxBuffer, &draw_list->IdxBuffer, sizeof(draw_list->IdxBuffer));\n    _Current = idx;\n    memcpy(&draw_list->CmdBuffer, &_Channels.Data[idx]._CmdBuffer, sizeof(draw_list->CmdBuffer));\n    memcpy(&draw_list->IdxBuffer, &_Channels.Data[idx]._IdxBuffer, sizeof(draw_list->IdxBuffer));\n    draw_list->_IdxWritePtr = draw_list->IdxBuffer.Data + draw_list->IdxBuffer.Size;\n\n    // If current command is used with different settings we need to add a new command\n    ImDrawCmd* curr_cmd = (draw_list->CmdBuffer.Size == 0) ? NULL : &draw_list->CmdBuffer.Data[draw_list->CmdBuffer.Size - 1];\n    if (curr_cmd == NULL)\n        draw_list->AddDrawCmd();\n    else if (curr_cmd->ElemCount == 0)\n        ImDrawCmd_HeaderCopy(curr_cmd, &draw_list->_CmdHeader); // Copy ClipRect, TextureId, VtxOffset\n    else if (ImDrawCmd_HeaderCompare(curr_cmd, &draw_list->_CmdHeader) != 0)\n        draw_list->AddDrawCmd();\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] ImDrawData\n//-----------------------------------------------------------------------------\n\n// For backward compatibility: convert all buffers from indexed to de-indexed, in case you cannot render indexed. Note: this is slow and most likely a waste of resources. Always prefer indexed rendering!\nvoid ImDrawData::DeIndexAllBuffers()\n{\n    ImVector<ImDrawVert> new_vtx_buffer;\n    TotalVtxCount = TotalIdxCount = 0;\n    for (int i = 0; i < CmdListsCount; i++)\n    {\n        ImDrawList* cmd_list = CmdLists[i];\n        if (cmd_list->IdxBuffer.empty())\n            continue;\n        new_vtx_buffer.resize(cmd_list->IdxBuffer.Size);\n        for (int j = 0; j < cmd_list->IdxBuffer.Size; j++)\n            new_vtx_buffer[j] = cmd_list->VtxBuffer[cmd_list->IdxBuffer[j]];\n        cmd_list->VtxBuffer.swap(new_vtx_buffer);\n        cmd_list->IdxBuffer.resize(0);\n        TotalVtxCount += cmd_list->VtxBuffer.Size;\n    }\n}\n\n// Helper to scale the ClipRect field of each ImDrawCmd.\n// Use if your final output buffer is at a different scale than draw_data->DisplaySize,\n// or if there is a difference between your window resolution and framebuffer resolution.\nvoid ImDrawData::ScaleClipRects(const ImVec2& fb_scale)\n{\n    for (int i = 0; i < CmdListsCount; i++)\n    {\n        ImDrawList* cmd_list = CmdLists[i];\n        for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)\n        {\n            ImDrawCmd* cmd = &cmd_list->CmdBuffer[cmd_i];\n            cmd->ClipRect = ImVec4(cmd->ClipRect.x * fb_scale.x, cmd->ClipRect.y * fb_scale.y, cmd->ClipRect.z * fb_scale.x, cmd->ClipRect.w * fb_scale.y);\n        }\n    }\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] Helpers ShadeVertsXXX functions\n//-----------------------------------------------------------------------------\n\n// Generic linear color gradient, write to RGB fields, leave A untouched.\nvoid ImGui::ShadeVertsLinearColorGradientKeepAlpha(ImDrawList* draw_list, int vert_start_idx, int vert_end_idx, ImVec2 gradient_p0, ImVec2 gradient_p1, ImU32 col0, ImU32 col1)\n{\n    ImVec2 gradient_extent = gradient_p1 - gradient_p0;\n    float gradient_inv_length2 = 1.0f / ImLengthSqr(gradient_extent);\n    ImDrawVert* vert_start = draw_list->VtxBuffer.Data + vert_start_idx;\n    ImDrawVert* vert_end = draw_list->VtxBuffer.Data + vert_end_idx;\n    const int col0_r = (int)(col0 >> IM_COL32_R_SHIFT) & 0xFF;\n    const int col0_g = (int)(col0 >> IM_COL32_G_SHIFT) & 0xFF;\n    const int col0_b = (int)(col0 >> IM_COL32_B_SHIFT) & 0xFF;\n    const int col_delta_r = ((int)(col1 >> IM_COL32_R_SHIFT) & 0xFF) - col0_r;\n    const int col_delta_g = ((int)(col1 >> IM_COL32_G_SHIFT) & 0xFF) - col0_g;\n    const int col_delta_b = ((int)(col1 >> IM_COL32_B_SHIFT) & 0xFF) - col0_b;\n    for (ImDrawVert* vert = vert_start; vert < vert_end; vert++)\n    {\n        float d = ImDot(vert->pos - gradient_p0, gradient_extent);\n        float t = ImClamp(d * gradient_inv_length2, 0.0f, 1.0f);\n        int r = (int)(col0_r + col_delta_r * t);\n        int g = (int)(col0_g + col_delta_g * t);\n        int b = (int)(col0_b + col_delta_b * t);\n        vert->col = (r << IM_COL32_R_SHIFT) | (g << IM_COL32_G_SHIFT) | (b << IM_COL32_B_SHIFT) | (vert->col & IM_COL32_A_MASK);\n    }\n}\n\n// Distribute UV over (a, b) rectangle\nvoid ImGui::ShadeVertsLinearUV(ImDrawList* draw_list, int vert_start_idx, int vert_end_idx, const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, bool clamp)\n{\n    const ImVec2 size = b - a;\n    const ImVec2 uv_size = uv_b - uv_a;\n    const ImVec2 scale = ImVec2(\n        size.x != 0.0f ? (uv_size.x / size.x) : 0.0f,\n        size.y != 0.0f ? (uv_size.y / size.y) : 0.0f);\n\n    ImDrawVert* vert_start = draw_list->VtxBuffer.Data + vert_start_idx;\n    ImDrawVert* vert_end = draw_list->VtxBuffer.Data + vert_end_idx;\n    if (clamp)\n    {\n        const ImVec2 min = ImMin(uv_a, uv_b);\n        const ImVec2 max = ImMax(uv_a, uv_b);\n        for (ImDrawVert* vertex = vert_start; vertex < vert_end; ++vertex)\n            vertex->uv = ImClamp(uv_a + ImMul(ImVec2(vertex->pos.x, vertex->pos.y) - a, scale), min, max);\n    }\n    else\n    {\n        for (ImDrawVert* vertex = vert_start; vertex < vert_end; ++vertex)\n            vertex->uv = uv_a + ImMul(ImVec2(vertex->pos.x, vertex->pos.y) - a, scale);\n    }\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] ImFontConfig\n//-----------------------------------------------------------------------------\n\nImFontConfig::ImFontConfig()\n{\n    memset(this, 0, sizeof(*this));\n    FontDataOwnedByAtlas = true;\n    OversampleH = 3; // FIXME: 2 may be a better default?\n    OversampleV = 1;\n    GlyphMaxAdvanceX = FLT_MAX;\n    RasterizerMultiply = 1.0f;\n    EllipsisChar = (ImWchar)-1;\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] ImFontAtlas\n//-----------------------------------------------------------------------------\n\n// A work of art lies ahead! (. = white layer, X = black layer, others are blank)\n// The 2x2 white texels on the top left are the ones we'll use everywhere in Dear ImGui to render filled shapes.\nconst int FONT_ATLAS_DEFAULT_TEX_DATA_W = 108; // Actual texture will be 2 times that + 1 spacing.\nconst int FONT_ATLAS_DEFAULT_TEX_DATA_H = 27;\nstatic const char FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS[FONT_ATLAS_DEFAULT_TEX_DATA_W * FONT_ATLAS_DEFAULT_TEX_DATA_H + 1] =\n{\n    \"..-         -XXXXXXX-    X    -           X           -XXXXXXX          -          XXXXXXX-     XX          \"\n    \"..-         -X.....X-   X.X   -          X.X          -X.....X          -          X.....X-    X..X         \"\n    \"---         -XXX.XXX-  X...X  -         X...X         -X....X           -           X....X-    X..X         \"\n    \"X           -  X.X  - X.....X -        X.....X        -X...X            -            X...X-    X..X         \"\n    \"XX          -  X.X  -X.......X-       X.......X       -X..X.X           -           X.X..X-    X..X         \"\n    \"X.X         -  X.X  -XXXX.XXXX-       XXXX.XXXX       -X.X X.X          -          X.X X.X-    X..XXX       \"\n    \"X..X        -  X.X  -   X.X   -          X.X          -XX   X.X         -         X.X   XX-    X..X..XXX    \"\n    \"X...X       -  X.X  -   X.X   -    XX    X.X    XX    -      X.X        -        X.X      -    X..X..X..XX  \"\n    \"X....X      -  X.X  -   X.X   -   X.X    X.X    X.X   -       X.X       -       X.X       -    X..X..X..X.X \"\n    \"X.....X     -  X.X  -   X.X   -  X..X    X.X    X..X  -        X.X      -      X.X        -XXX X..X..X..X..X\"\n    \"X......X    -  X.X  -   X.X   - X...XXXXXX.XXXXXX...X -         X.X   XX-XX   X.X         -X..XX........X..X\"\n    \"X.......X   -  X.X  -   X.X   -X.....................X-          X.X X.X-X.X X.X          -X...X...........X\"\n    \"X........X  -  X.X  -   X.X   - X...XXXXXX.XXXXXX...X -           X.X..X-X..X.X           - X..............X\"\n    \"X.........X -XXX.XXX-   X.X   -  X..X    X.X    X..X  -            X...X-X...X            -  X.............X\"\n    \"X..........X-X.....X-   X.X   -   X.X    X.X    X.X   -           X....X-X....X           -  X.............X\"\n    \"X......XXXXX-XXXXXXX-   X.X   -    XX    X.X    XX    -          X.....X-X.....X          -   X............X\"\n    \"X...X..X    ---------   X.X   -          X.X          -          XXXXXXX-XXXXXXX          -   X...........X \"\n    \"X..X X..X   -       -XXXX.XXXX-       XXXX.XXXX       -------------------------------------    X..........X \"\n    \"X.X  X..X   -       -X.......X-       X.......X       -    XX           XX    -           -    X..........X \"\n    \"XX    X..X  -       - X.....X -        X.....X        -   X.X           X.X   -           -     X........X  \"\n    \"      X..X          -  X...X  -         X...X         -  X..X           X..X  -           -     X........X  \"\n    \"       XX           -   X.X   -          X.X          - X...XXXXXXXXXXXXX...X -           -     XXXXXXXXXX  \"\n    \"------------        -    X    -           X           -X.....................X-           ------------------\"\n    \"                    ----------------------------------- X...XXXXXXXXXXXXX...X -                             \"\n    \"                                                      -  X..X           X..X  -                             \"\n    \"                                                      -   X.X           X.X   -                             \"\n    \"                                                      -    XX           XX    -                             \"\n};\n\nstatic const ImVec2 FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[ImGuiMouseCursor_COUNT][3] =\n{\n    // Pos ........ Size ......... Offset ......\n    { ImVec2( 0,3), ImVec2(12,19), ImVec2( 0, 0) }, // ImGuiMouseCursor_Arrow\n    { ImVec2(13,0), ImVec2( 7,16), ImVec2( 1, 8) }, // ImGuiMouseCursor_TextInput\n    { ImVec2(31,0), ImVec2(23,23), ImVec2(11,11) }, // ImGuiMouseCursor_ResizeAll\n    { ImVec2(21,0), ImVec2( 9,23), ImVec2( 4,11) }, // ImGuiMouseCursor_ResizeNS\n    { ImVec2(55,18),ImVec2(23, 9), ImVec2(11, 4) }, // ImGuiMouseCursor_ResizeEW\n    { ImVec2(73,0), ImVec2(17,17), ImVec2( 8, 8) }, // ImGuiMouseCursor_ResizeNESW\n    { ImVec2(55,0), ImVec2(17,17), ImVec2( 8, 8) }, // ImGuiMouseCursor_ResizeNWSE\n    { ImVec2(91,0), ImVec2(17,22), ImVec2( 5, 0) }, // ImGuiMouseCursor_Hand\n};\n\nImFontAtlas::ImFontAtlas()\n{\n    memset(this, 0, sizeof(*this));\n    TexGlyphPadding = 1;\n    PackIdMouseCursors = PackIdLines = -1;\n}\n\nImFontAtlas::~ImFontAtlas()\n{\n    IM_ASSERT(!Locked && \"Cannot modify a locked ImFontAtlas between NewFrame() and EndFrame/Render()!\");\n    Clear();\n}\n\nvoid    ImFontAtlas::ClearInputData()\n{\n    IM_ASSERT(!Locked && \"Cannot modify a locked ImFontAtlas between NewFrame() and EndFrame/Render()!\");\n    for (int i = 0; i < ConfigData.Size; i++)\n        if (ConfigData[i].FontData && ConfigData[i].FontDataOwnedByAtlas)\n        {\n            IM_FREE(ConfigData[i].FontData);\n            ConfigData[i].FontData = NULL;\n        }\n\n    // When clearing this we lose access to the font name and other information used to build the font.\n    for (int i = 0; i < Fonts.Size; i++)\n        if (Fonts[i]->ConfigData >= ConfigData.Data && Fonts[i]->ConfigData < ConfigData.Data + ConfigData.Size)\n        {\n            Fonts[i]->ConfigData = NULL;\n            Fonts[i]->ConfigDataCount = 0;\n        }\n    ConfigData.clear();\n    CustomRects.clear();\n    PackIdMouseCursors = PackIdLines = -1;\n    TexReady = false;\n}\n\nvoid    ImFontAtlas::ClearTexData()\n{\n    IM_ASSERT(!Locked && \"Cannot modify a locked ImFontAtlas between NewFrame() and EndFrame/Render()!\");\n    if (TexPixelsAlpha8)\n        IM_FREE(TexPixelsAlpha8);\n    if (TexPixelsRGBA32)\n        IM_FREE(TexPixelsRGBA32);\n    TexPixelsAlpha8 = NULL;\n    TexPixelsRGBA32 = NULL;\n    TexPixelsUseColors = false;\n    // Important: we leave TexReady untouched\n}\n\nvoid    ImFontAtlas::ClearFonts()\n{\n    IM_ASSERT(!Locked && \"Cannot modify a locked ImFontAtlas between NewFrame() and EndFrame/Render()!\");\n    Fonts.clear_delete();\n    TexReady = false;\n}\n\nvoid    ImFontAtlas::Clear()\n{\n    ClearInputData();\n    ClearTexData();\n    ClearFonts();\n}\n\nvoid    ImFontAtlas::GetTexDataAsAlpha8(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel)\n{\n    // Build atlas on demand\n    if (TexPixelsAlpha8 == NULL)\n        Build();\n\n    *out_pixels = TexPixelsAlpha8;\n    if (out_width) *out_width = TexWidth;\n    if (out_height) *out_height = TexHeight;\n    if (out_bytes_per_pixel) *out_bytes_per_pixel = 1;\n}\n\nvoid    ImFontAtlas::GetTexDataAsRGBA32(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel)\n{\n    // Convert to RGBA32 format on demand\n    // Although it is likely to be the most commonly used format, our font rendering is 1 channel / 8 bpp\n    if (!TexPixelsRGBA32)\n    {\n        unsigned char* pixels = NULL;\n        GetTexDataAsAlpha8(&pixels, NULL, NULL);\n        if (pixels)\n        {\n            TexPixelsRGBA32 = (unsigned int*)IM_ALLOC((size_t)TexWidth * (size_t)TexHeight * 4);\n            const unsigned char* src = pixels;\n            unsigned int* dst = TexPixelsRGBA32;\n            for (int n = TexWidth * TexHeight; n > 0; n--)\n                *dst++ = IM_COL32(255, 255, 255, (unsigned int)(*src++));\n        }\n    }\n\n    *out_pixels = (unsigned char*)TexPixelsRGBA32;\n    if (out_width) *out_width = TexWidth;\n    if (out_height) *out_height = TexHeight;\n    if (out_bytes_per_pixel) *out_bytes_per_pixel = 4;\n}\n\nImFont* ImFontAtlas::AddFont(const ImFontConfig* font_cfg)\n{\n    IM_ASSERT(!Locked && \"Cannot modify a locked ImFontAtlas between NewFrame() and EndFrame/Render()!\");\n    IM_ASSERT(font_cfg->FontData != NULL && font_cfg->FontDataSize > 0);\n    IM_ASSERT(font_cfg->SizePixels > 0.0f);\n\n    // Create new font\n    if (!font_cfg->MergeMode)\n        Fonts.push_back(IM_NEW(ImFont));\n    else\n        IM_ASSERT(!Fonts.empty() && \"Cannot use MergeMode for the first font\"); // When using MergeMode make sure that a font has already been added before. You can use ImGui::GetIO().Fonts->AddFontDefault() to add the default imgui font.\n\n    ConfigData.push_back(*font_cfg);\n    ImFontConfig& new_font_cfg = ConfigData.back();\n    if (new_font_cfg.DstFont == NULL)\n        new_font_cfg.DstFont = Fonts.back();\n    if (!new_font_cfg.FontDataOwnedByAtlas)\n    {\n        new_font_cfg.FontData = IM_ALLOC(new_font_cfg.FontDataSize);\n        new_font_cfg.FontDataOwnedByAtlas = true;\n        memcpy(new_font_cfg.FontData, font_cfg->FontData, (size_t)new_font_cfg.FontDataSize);\n    }\n\n    if (new_font_cfg.DstFont->EllipsisChar == (ImWchar)-1)\n        new_font_cfg.DstFont->EllipsisChar = font_cfg->EllipsisChar;\n\n    // Invalidate texture\n    TexReady = false;\n    ClearTexData();\n    return new_font_cfg.DstFont;\n}\n\n// Default font TTF is compressed with stb_compress then base85 encoded (see misc/fonts/binary_to_compressed_c.cpp for encoder)\nstatic unsigned int stb_decompress_length(const unsigned char* input);\nstatic unsigned int stb_decompress(unsigned char* output, const unsigned char* input, unsigned int length);\nstatic const char*  GetDefaultCompressedFontDataTTFBase85();\nstatic unsigned int Decode85Byte(char c)                                    { return c >= '\\\\' ? c-36 : c-35; }\nstatic void         Decode85(const unsigned char* src, unsigned char* dst)\n{\n    while (*src)\n    {\n        unsigned int tmp = Decode85Byte(src[0]) + 85 * (Decode85Byte(src[1]) + 85 * (Decode85Byte(src[2]) + 85 * (Decode85Byte(src[3]) + 85 * Decode85Byte(src[4]))));\n        dst[0] = ((tmp >> 0) & 0xFF); dst[1] = ((tmp >> 8) & 0xFF); dst[2] = ((tmp >> 16) & 0xFF); dst[3] = ((tmp >> 24) & 0xFF);   // We can't assume little-endianness.\n        src += 5;\n        dst += 4;\n    }\n}\n\n// Load embedded ProggyClean.ttf at size 13, disable oversampling\nImFont* ImFontAtlas::AddFontDefault(const ImFontConfig* font_cfg_template)\n{\n    ImFontConfig font_cfg = font_cfg_template ? *font_cfg_template : ImFontConfig();\n    if (!font_cfg_template)\n    {\n        font_cfg.OversampleH = font_cfg.OversampleV = 1;\n        font_cfg.PixelSnapH = true;\n    }\n    if (font_cfg.SizePixels <= 0.0f)\n        font_cfg.SizePixels = 13.0f * 1.0f;\n    if (font_cfg.Name[0] == '\\0')\n        ImFormatString(font_cfg.Name, IM_ARRAYSIZE(font_cfg.Name), \"ProggyClean.ttf, %dpx\", (int)font_cfg.SizePixels);\n    font_cfg.EllipsisChar = (ImWchar)0x0085;\n    font_cfg.GlyphOffset.y = 1.0f * IM_FLOOR(font_cfg.SizePixels / 13.0f);  // Add +1 offset per 13 units\n\n    const char* ttf_compressed_base85 = GetDefaultCompressedFontDataTTFBase85();\n    const ImWchar* glyph_ranges = font_cfg.GlyphRanges != NULL ? font_cfg.GlyphRanges : GetGlyphRangesDefault();\n    ImFont* font = AddFontFromMemoryCompressedBase85TTF(ttf_compressed_base85, font_cfg.SizePixels, &font_cfg, glyph_ranges);\n    return font;\n}\n\nImFont* ImFontAtlas::AddFontFromFileTTF(const char* filename, float size_pixels, const ImFontConfig* font_cfg_template, const ImWchar* glyph_ranges)\n{\n    IM_ASSERT(!Locked && \"Cannot modify a locked ImFontAtlas between NewFrame() and EndFrame/Render()!\");\n    size_t data_size = 0;\n    void* data = ImFileLoadToMemory(filename, \"rb\", &data_size, 0);\n    if (!data)\n    {\n        IM_ASSERT_USER_ERROR(0, \"Could not load font file!\");\n        return NULL;\n    }\n    ImFontConfig font_cfg = font_cfg_template ? *font_cfg_template : ImFontConfig();\n    if (font_cfg.Name[0] == '\\0')\n    {\n        // Store a short copy of filename into into the font name for convenience\n        const char* p;\n        for (p = filename + strlen(filename); p > filename && p[-1] != '/' && p[-1] != '\\\\'; p--) {}\n        ImFormatString(font_cfg.Name, IM_ARRAYSIZE(font_cfg.Name), \"%s, %.0fpx\", p, size_pixels);\n    }\n    return AddFontFromMemoryTTF(data, (int)data_size, size_pixels, &font_cfg, glyph_ranges);\n}\n\n// NB: Transfer ownership of 'ttf_data' to ImFontAtlas, unless font_cfg_template->FontDataOwnedByAtlas == false. Owned TTF buffer will be deleted after Build().\nImFont* ImFontAtlas::AddFontFromMemoryTTF(void* ttf_data, int ttf_size, float size_pixels, const ImFontConfig* font_cfg_template, const ImWchar* glyph_ranges)\n{\n    IM_ASSERT(!Locked && \"Cannot modify a locked ImFontAtlas between NewFrame() and EndFrame/Render()!\");\n    ImFontConfig font_cfg = font_cfg_template ? *font_cfg_template : ImFontConfig();\n    IM_ASSERT(font_cfg.FontData == NULL);\n    font_cfg.FontData = ttf_data;\n    font_cfg.FontDataSize = ttf_size;\n    font_cfg.SizePixels = size_pixels > 0.0f ? size_pixels : font_cfg.SizePixels;\n    if (glyph_ranges)\n        font_cfg.GlyphRanges = glyph_ranges;\n    return AddFont(&font_cfg);\n}\n\nImFont* ImFontAtlas::AddFontFromMemoryCompressedTTF(const void* compressed_ttf_data, int compressed_ttf_size, float size_pixels, const ImFontConfig* font_cfg_template, const ImWchar* glyph_ranges)\n{\n    const unsigned int buf_decompressed_size = stb_decompress_length((const unsigned char*)compressed_ttf_data);\n    unsigned char* buf_decompressed_data = (unsigned char*)IM_ALLOC(buf_decompressed_size);\n    stb_decompress(buf_decompressed_data, (const unsigned char*)compressed_ttf_data, (unsigned int)compressed_ttf_size);\n\n    ImFontConfig font_cfg = font_cfg_template ? *font_cfg_template : ImFontConfig();\n    IM_ASSERT(font_cfg.FontData == NULL);\n    font_cfg.FontDataOwnedByAtlas = true;\n    return AddFontFromMemoryTTF(buf_decompressed_data, (int)buf_decompressed_size, size_pixels, &font_cfg, glyph_ranges);\n}\n\nImFont* ImFontAtlas::AddFontFromMemoryCompressedBase85TTF(const char* compressed_ttf_data_base85, float size_pixels, const ImFontConfig* font_cfg, const ImWchar* glyph_ranges)\n{\n    int compressed_ttf_size = (((int)strlen(compressed_ttf_data_base85) + 4) / 5) * 4;\n    void* compressed_ttf = IM_ALLOC((size_t)compressed_ttf_size);\n    Decode85((const unsigned char*)compressed_ttf_data_base85, (unsigned char*)compressed_ttf);\n    ImFont* font = AddFontFromMemoryCompressedTTF(compressed_ttf, compressed_ttf_size, size_pixels, font_cfg, glyph_ranges);\n    IM_FREE(compressed_ttf);\n    return font;\n}\n\nint ImFontAtlas::AddCustomRectRegular(int width, int height)\n{\n    IM_ASSERT(width > 0 && width <= 0xFFFF);\n    IM_ASSERT(height > 0 && height <= 0xFFFF);\n    ImFontAtlasCustomRect r;\n    r.Width = (unsigned short)width;\n    r.Height = (unsigned short)height;\n    CustomRects.push_back(r);\n    return CustomRects.Size - 1; // Return index\n}\n\nint ImFontAtlas::AddCustomRectFontGlyph(ImFont* font, ImWchar id, int width, int height, float advance_x, const ImVec2& offset)\n{\n#ifdef IMGUI_USE_WCHAR32\n    IM_ASSERT(id <= IM_UNICODE_CODEPOINT_MAX);\n#endif\n    IM_ASSERT(font != NULL);\n    IM_ASSERT(width > 0 && width <= 0xFFFF);\n    IM_ASSERT(height > 0 && height <= 0xFFFF);\n    ImFontAtlasCustomRect r;\n    r.Width = (unsigned short)width;\n    r.Height = (unsigned short)height;\n    r.GlyphID = id;\n    r.GlyphAdvanceX = advance_x;\n    r.GlyphOffset = offset;\n    r.Font = font;\n    CustomRects.push_back(r);\n    return CustomRects.Size - 1; // Return index\n}\n\nvoid ImFontAtlas::CalcCustomRectUV(const ImFontAtlasCustomRect* rect, ImVec2* out_uv_min, ImVec2* out_uv_max) const\n{\n    IM_ASSERT(TexWidth > 0 && TexHeight > 0);   // Font atlas needs to be built before we can calculate UV coordinates\n    IM_ASSERT(rect->IsPacked());                // Make sure the rectangle has been packed\n    *out_uv_min = ImVec2((float)rect->X * TexUvScale.x, (float)rect->Y * TexUvScale.y);\n    *out_uv_max = ImVec2((float)(rect->X + rect->Width) * TexUvScale.x, (float)(rect->Y + rect->Height) * TexUvScale.y);\n}\n\nbool ImFontAtlas::GetMouseCursorTexData(ImGuiMouseCursor cursor_type, ImVec2* out_offset, ImVec2* out_size, ImVec2 out_uv_border[2], ImVec2 out_uv_fill[2])\n{\n    if (cursor_type <= ImGuiMouseCursor_None || cursor_type >= ImGuiMouseCursor_COUNT)\n        return false;\n    if (Flags & ImFontAtlasFlags_NoMouseCursors)\n        return false;\n\n    IM_ASSERT(PackIdMouseCursors != -1);\n    ImFontAtlasCustomRect* r = GetCustomRectByIndex(PackIdMouseCursors);\n    ImVec2 pos = FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[cursor_type][0] + ImVec2((float)r->X, (float)r->Y);\n    ImVec2 size = FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[cursor_type][1];\n    *out_size = size;\n    *out_offset = FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[cursor_type][2];\n    out_uv_border[0] = (pos) * TexUvScale;\n    out_uv_border[1] = (pos + size) * TexUvScale;\n    pos.x += FONT_ATLAS_DEFAULT_TEX_DATA_W + 1;\n    out_uv_fill[0] = (pos) * TexUvScale;\n    out_uv_fill[1] = (pos + size) * TexUvScale;\n    return true;\n}\n\nbool    ImFontAtlas::Build()\n{\n    IM_ASSERT(!Locked && \"Cannot modify a locked ImFontAtlas between NewFrame() and EndFrame/Render()!\");\n\n    // Default font is none are specified\n    if (ConfigData.Size == 0)\n        AddFontDefault();\n\n    // Select builder\n    // - Note that we do not reassign to atlas->FontBuilderIO, since it is likely to point to static data which\n    //   may mess with some hot-reloading schemes. If you need to assign to this (for dynamic selection) AND are\n    //   using a hot-reloading scheme that messes up static data, store your own instance of ImFontBuilderIO somewhere\n    //   and point to it instead of pointing directly to return value of the GetBuilderXXX functions.\n    const ImFontBuilderIO* builder_io = FontBuilderIO;\n    if (builder_io == NULL)\n    {\n#ifdef IMGUI_ENABLE_FREETYPE\n        builder_io = ImGuiFreeType::GetBuilderForFreeType();\n#elif defined(IMGUI_ENABLE_STB_TRUETYPE)\n        builder_io = ImFontAtlasGetBuilderForStbTruetype();\n#else\n        IM_ASSERT(0); // Invalid Build function\n#endif\n    }\n\n    // Build\n    return builder_io->FontBuilder_Build(this);\n}\n\nvoid    ImFontAtlasBuildMultiplyCalcLookupTable(unsigned char out_table[256], float in_brighten_factor)\n{\n    for (unsigned int i = 0; i < 256; i++)\n    {\n        unsigned int value = (unsigned int)(i * in_brighten_factor);\n        out_table[i] = value > 255 ? 255 : (value & 0xFF);\n    }\n}\n\nvoid    ImFontAtlasBuildMultiplyRectAlpha8(const unsigned char table[256], unsigned char* pixels, int x, int y, int w, int h, int stride)\n{\n    unsigned char* data = pixels + x + y * stride;\n    for (int j = h; j > 0; j--, data += stride)\n        for (int i = 0; i < w; i++)\n            data[i] = table[data[i]];\n}\n\n#ifdef IMGUI_ENABLE_STB_TRUETYPE\n// Temporary data for one source font (multiple source fonts can be merged into one destination ImFont)\n// (C++03 doesn't allow instancing ImVector<> with function-local types so we declare the type here.)\nstruct ImFontBuildSrcData\n{\n    stbtt_fontinfo      FontInfo;\n    stbtt_pack_range    PackRange;          // Hold the list of codepoints to pack (essentially points to Codepoints.Data)\n    stbrp_rect*         Rects;              // Rectangle to pack. We first fill in their size and the packer will give us their position.\n    stbtt_packedchar*   PackedChars;        // Output glyphs\n    const ImWchar*      SrcRanges;          // Ranges as requested by user (user is allowed to request too much, e.g. 0x0020..0xFFFF)\n    int                 DstIndex;           // Index into atlas->Fonts[] and dst_tmp_array[]\n    int                 GlyphsHighest;      // Highest requested codepoint\n    int                 GlyphsCount;        // Glyph count (excluding missing glyphs and glyphs already set by an earlier source font)\n    ImBitVector         GlyphsSet;          // Glyph bit map (random access, 1-bit per codepoint. This will be a maximum of 8KB)\n    ImVector<int>       GlyphsList;         // Glyph codepoints list (flattened version of GlyphsMap)\n};\n\n// Temporary data for one destination ImFont* (multiple source fonts can be merged into one destination ImFont)\nstruct ImFontBuildDstData\n{\n    int                 SrcCount;           // Number of source fonts targeting this destination font.\n    int                 GlyphsHighest;\n    int                 GlyphsCount;\n    ImBitVector         GlyphsSet;          // This is used to resolve collision when multiple sources are merged into a same destination font.\n};\n\nstatic void UnpackBitVectorToFlatIndexList(const ImBitVector* in, ImVector<int>* out)\n{\n    IM_ASSERT(sizeof(in->Storage.Data[0]) == sizeof(int));\n    const ImU32* it_begin = in->Storage.begin();\n    const ImU32* it_end = in->Storage.end();\n    for (const ImU32* it = it_begin; it < it_end; it++)\n        if (ImU32 entries_32 = *it)\n            for (ImU32 bit_n = 0; bit_n < 32; bit_n++)\n                if (entries_32 & ((ImU32)1 << bit_n))\n                    out->push_back((int)(((it - it_begin) << 5) + bit_n));\n}\n\nstatic bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas)\n{\n    IM_ASSERT(atlas->ConfigData.Size > 0);\n\n    ImFontAtlasBuildInit(atlas);\n\n    // Clear atlas\n    atlas->TexID = (ImTextureID)NULL;\n    atlas->TexWidth = atlas->TexHeight = 0;\n    atlas->TexUvScale = ImVec2(0.0f, 0.0f);\n    atlas->TexUvWhitePixel = ImVec2(0.0f, 0.0f);\n    atlas->ClearTexData();\n\n    // Temporary storage for building\n    ImVector<ImFontBuildSrcData> src_tmp_array;\n    ImVector<ImFontBuildDstData> dst_tmp_array;\n    src_tmp_array.resize(atlas->ConfigData.Size);\n    dst_tmp_array.resize(atlas->Fonts.Size);\n    memset(src_tmp_array.Data, 0, (size_t)src_tmp_array.size_in_bytes());\n    memset(dst_tmp_array.Data, 0, (size_t)dst_tmp_array.size_in_bytes());\n\n    // 1. Initialize font loading structure, check font data validity\n    for (int src_i = 0; src_i < atlas->ConfigData.Size; src_i++)\n    {\n        ImFontBuildSrcData& src_tmp = src_tmp_array[src_i];\n        ImFontConfig& cfg = atlas->ConfigData[src_i];\n        IM_ASSERT(cfg.DstFont && (!cfg.DstFont->IsLoaded() || cfg.DstFont->ContainerAtlas == atlas));\n\n        // Find index from cfg.DstFont (we allow the user to set cfg.DstFont. Also it makes casual debugging nicer than when storing indices)\n        src_tmp.DstIndex = -1;\n        for (int output_i = 0; output_i < atlas->Fonts.Size && src_tmp.DstIndex == -1; output_i++)\n            if (cfg.DstFont == atlas->Fonts[output_i])\n                src_tmp.DstIndex = output_i;\n        if (src_tmp.DstIndex == -1)\n        {\n            IM_ASSERT(src_tmp.DstIndex != -1); // cfg.DstFont not pointing within atlas->Fonts[] array?\n            return false;\n        }\n        // Initialize helper structure for font loading and verify that the TTF/OTF data is correct\n        const int font_offset = stbtt_GetFontOffsetForIndex((unsigned char*)cfg.FontData, cfg.FontNo);\n        IM_ASSERT(font_offset >= 0 && \"FontData is incorrect, or FontNo cannot be found.\");\n        if (!stbtt_InitFont(&src_tmp.FontInfo, (unsigned char*)cfg.FontData, font_offset))\n            return false;\n\n        // Measure highest codepoints\n        ImFontBuildDstData& dst_tmp = dst_tmp_array[src_tmp.DstIndex];\n        src_tmp.SrcRanges = cfg.GlyphRanges ? cfg.GlyphRanges : atlas->GetGlyphRangesDefault();\n        for (const ImWchar* src_range = src_tmp.SrcRanges; src_range[0] && src_range[1]; src_range += 2)\n            src_tmp.GlyphsHighest = ImMax(src_tmp.GlyphsHighest, (int)src_range[1]);\n        dst_tmp.SrcCount++;\n        dst_tmp.GlyphsHighest = ImMax(dst_tmp.GlyphsHighest, src_tmp.GlyphsHighest);\n    }\n\n    // 2. For every requested codepoint, check for their presence in the font data, and handle redundancy or overlaps between source fonts to avoid unused glyphs.\n    int total_glyphs_count = 0;\n    for (int src_i = 0; src_i < src_tmp_array.Size; src_i++)\n    {\n        ImFontBuildSrcData& src_tmp = src_tmp_array[src_i];\n        ImFontBuildDstData& dst_tmp = dst_tmp_array[src_tmp.DstIndex];\n        src_tmp.GlyphsSet.Create(src_tmp.GlyphsHighest + 1);\n        if (dst_tmp.GlyphsSet.Storage.empty())\n            dst_tmp.GlyphsSet.Create(dst_tmp.GlyphsHighest + 1);\n\n        for (const ImWchar* src_range = src_tmp.SrcRanges; src_range[0] && src_range[1]; src_range += 2)\n            for (unsigned int codepoint = src_range[0]; codepoint <= src_range[1]; codepoint++)\n            {\n                if (dst_tmp.GlyphsSet.TestBit(codepoint))    // Don't overwrite existing glyphs. We could make this an option for MergeMode (e.g. MergeOverwrite==true)\n                    continue;\n                if (!stbtt_FindGlyphIndex(&src_tmp.FontInfo, codepoint))    // It is actually in the font?\n                    continue;\n\n                // Add to avail set/counters\n                src_tmp.GlyphsCount++;\n                dst_tmp.GlyphsCount++;\n                src_tmp.GlyphsSet.SetBit(codepoint);\n                dst_tmp.GlyphsSet.SetBit(codepoint);\n                total_glyphs_count++;\n            }\n    }\n\n    // 3. Unpack our bit map into a flat list (we now have all the Unicode points that we know are requested _and_ available _and_ not overlapping another)\n    for (int src_i = 0; src_i < src_tmp_array.Size; src_i++)\n    {\n        ImFontBuildSrcData& src_tmp = src_tmp_array[src_i];\n        src_tmp.GlyphsList.reserve(src_tmp.GlyphsCount);\n        UnpackBitVectorToFlatIndexList(&src_tmp.GlyphsSet, &src_tmp.GlyphsList);\n        src_tmp.GlyphsSet.Clear();\n        IM_ASSERT(src_tmp.GlyphsList.Size == src_tmp.GlyphsCount);\n    }\n    for (int dst_i = 0; dst_i < dst_tmp_array.Size; dst_i++)\n        dst_tmp_array[dst_i].GlyphsSet.Clear();\n    dst_tmp_array.clear();\n\n    // Allocate packing character data and flag packed characters buffer as non-packed (x0=y0=x1=y1=0)\n    // (We technically don't need to zero-clear buf_rects, but let's do it for the sake of sanity)\n    ImVector<stbrp_rect> buf_rects;\n    ImVector<stbtt_packedchar> buf_packedchars;\n    buf_rects.resize(total_glyphs_count);\n    buf_packedchars.resize(total_glyphs_count);\n    memset(buf_rects.Data, 0, (size_t)buf_rects.size_in_bytes());\n    memset(buf_packedchars.Data, 0, (size_t)buf_packedchars.size_in_bytes());\n\n    // 4. Gather glyphs sizes so we can pack them in our virtual canvas.\n    int total_surface = 0;\n    int buf_rects_out_n = 0;\n    int buf_packedchars_out_n = 0;\n    for (int src_i = 0; src_i < src_tmp_array.Size; src_i++)\n    {\n        ImFontBuildSrcData& src_tmp = src_tmp_array[src_i];\n        if (src_tmp.GlyphsCount == 0)\n            continue;\n\n        src_tmp.Rects = &buf_rects[buf_rects_out_n];\n        src_tmp.PackedChars = &buf_packedchars[buf_packedchars_out_n];\n        buf_rects_out_n += src_tmp.GlyphsCount;\n        buf_packedchars_out_n += src_tmp.GlyphsCount;\n\n        // Convert our ranges in the format stb_truetype wants\n        ImFontConfig& cfg = atlas->ConfigData[src_i];\n        src_tmp.PackRange.font_size = cfg.SizePixels;\n        src_tmp.PackRange.first_unicode_codepoint_in_range = 0;\n        src_tmp.PackRange.array_of_unicode_codepoints = src_tmp.GlyphsList.Data;\n        src_tmp.PackRange.num_chars = src_tmp.GlyphsList.Size;\n        src_tmp.PackRange.chardata_for_range = src_tmp.PackedChars;\n        src_tmp.PackRange.h_oversample = (unsigned char)cfg.OversampleH;\n        src_tmp.PackRange.v_oversample = (unsigned char)cfg.OversampleV;\n\n        // Gather the sizes of all rectangles we will need to pack (this loop is based on stbtt_PackFontRangesGatherRects)\n        const float scale = (cfg.SizePixels > 0) ? stbtt_ScaleForPixelHeight(&src_tmp.FontInfo, cfg.SizePixels) : stbtt_ScaleForMappingEmToPixels(&src_tmp.FontInfo, -cfg.SizePixels);\n        const int padding = atlas->TexGlyphPadding;\n        for (int glyph_i = 0; glyph_i < src_tmp.GlyphsList.Size; glyph_i++)\n        {\n            int x0, y0, x1, y1;\n            const int glyph_index_in_font = stbtt_FindGlyphIndex(&src_tmp.FontInfo, src_tmp.GlyphsList[glyph_i]);\n            IM_ASSERT(glyph_index_in_font != 0);\n            stbtt_GetGlyphBitmapBoxSubpixel(&src_tmp.FontInfo, glyph_index_in_font, scale * cfg.OversampleH, scale * cfg.OversampleV, 0, 0, &x0, &y0, &x1, &y1);\n            src_tmp.Rects[glyph_i].w = (stbrp_coord)(x1 - x0 + padding + cfg.OversampleH - 1);\n            src_tmp.Rects[glyph_i].h = (stbrp_coord)(y1 - y0 + padding + cfg.OversampleV - 1);\n            total_surface += src_tmp.Rects[glyph_i].w * src_tmp.Rects[glyph_i].h;\n        }\n    }\n\n    // We need a width for the skyline algorithm, any width!\n    // The exact width doesn't really matter much, but some API/GPU have texture size limitations and increasing width can decrease height.\n    // User can override TexDesiredWidth and TexGlyphPadding if they wish, otherwise we use a simple heuristic to select the width based on expected surface.\n    const int surface_sqrt = (int)ImSqrt((float)total_surface) + 1;\n    atlas->TexHeight = 0;\n    if (atlas->TexDesiredWidth > 0)\n        atlas->TexWidth = atlas->TexDesiredWidth;\n    else\n        atlas->TexWidth = (surface_sqrt >= 4096 * 0.7f) ? 4096 : (surface_sqrt >= 2048 * 0.7f) ? 2048 : (surface_sqrt >= 1024 * 0.7f) ? 1024 : 512;\n\n    // 5. Start packing\n    // Pack our extra data rectangles first, so it will be on the upper-left corner of our texture (UV will have small values).\n    const int TEX_HEIGHT_MAX = 1024 * 32;\n    stbtt_pack_context spc = {};\n    stbtt_PackBegin(&spc, NULL, atlas->TexWidth, TEX_HEIGHT_MAX, 0, atlas->TexGlyphPadding, NULL);\n    ImFontAtlasBuildPackCustomRects(atlas, spc.pack_info);\n\n    // 6. Pack each source font. No rendering yet, we are working with rectangles in an infinitely tall texture at this point.\n    for (int src_i = 0; src_i < src_tmp_array.Size; src_i++)\n    {\n        ImFontBuildSrcData& src_tmp = src_tmp_array[src_i];\n        if (src_tmp.GlyphsCount == 0)\n            continue;\n\n        stbrp_pack_rects((stbrp_context*)spc.pack_info, src_tmp.Rects, src_tmp.GlyphsCount);\n\n        // Extend texture height and mark missing glyphs as non-packed so we won't render them.\n        // FIXME: We are not handling packing failure here (would happen if we got off TEX_HEIGHT_MAX or if a single if larger than TexWidth?)\n        for (int glyph_i = 0; glyph_i < src_tmp.GlyphsCount; glyph_i++)\n            if (src_tmp.Rects[glyph_i].was_packed)\n                atlas->TexHeight = ImMax(atlas->TexHeight, src_tmp.Rects[glyph_i].y + src_tmp.Rects[glyph_i].h);\n    }\n\n    // 7. Allocate texture\n    atlas->TexHeight = (atlas->Flags & ImFontAtlasFlags_NoPowerOfTwoHeight) ? (atlas->TexHeight + 1) : ImUpperPowerOfTwo(atlas->TexHeight);\n    atlas->TexUvScale = ImVec2(1.0f / atlas->TexWidth, 1.0f / atlas->TexHeight);\n    atlas->TexPixelsAlpha8 = (unsigned char*)IM_ALLOC(atlas->TexWidth * atlas->TexHeight);\n    memset(atlas->TexPixelsAlpha8, 0, atlas->TexWidth * atlas->TexHeight);\n    spc.pixels = atlas->TexPixelsAlpha8;\n    spc.height = atlas->TexHeight;\n\n    // 8. Render/rasterize font characters into the texture\n    for (int src_i = 0; src_i < src_tmp_array.Size; src_i++)\n    {\n        ImFontConfig& cfg = atlas->ConfigData[src_i];\n        ImFontBuildSrcData& src_tmp = src_tmp_array[src_i];\n        if (src_tmp.GlyphsCount == 0)\n            continue;\n\n        stbtt_PackFontRangesRenderIntoRects(&spc, &src_tmp.FontInfo, &src_tmp.PackRange, 1, src_tmp.Rects);\n\n        // Apply multiply operator\n        if (cfg.RasterizerMultiply != 1.0f)\n        {\n            unsigned char multiply_table[256];\n            ImFontAtlasBuildMultiplyCalcLookupTable(multiply_table, cfg.RasterizerMultiply);\n            stbrp_rect* r = &src_tmp.Rects[0];\n            for (int glyph_i = 0; glyph_i < src_tmp.GlyphsCount; glyph_i++, r++)\n                if (r->was_packed)\n                    ImFontAtlasBuildMultiplyRectAlpha8(multiply_table, atlas->TexPixelsAlpha8, r->x, r->y, r->w, r->h, atlas->TexWidth * 1);\n        }\n        src_tmp.Rects = NULL;\n    }\n\n    // End packing\n    stbtt_PackEnd(&spc);\n    buf_rects.clear();\n\n    // 9. Setup ImFont and glyphs for runtime\n    for (int src_i = 0; src_i < src_tmp_array.Size; src_i++)\n    {\n        ImFontBuildSrcData& src_tmp = src_tmp_array[src_i];\n        if (src_tmp.GlyphsCount == 0)\n            continue;\n\n        // When merging fonts with MergeMode=true:\n        // - We can have multiple input fonts writing into a same destination font.\n        // - dst_font->ConfigData is != from cfg which is our source configuration.\n        ImFontConfig& cfg = atlas->ConfigData[src_i];\n        ImFont* dst_font = cfg.DstFont;\n\n        const float font_scale = stbtt_ScaleForPixelHeight(&src_tmp.FontInfo, cfg.SizePixels);\n        int unscaled_ascent, unscaled_descent, unscaled_line_gap;\n        stbtt_GetFontVMetrics(&src_tmp.FontInfo, &unscaled_ascent, &unscaled_descent, &unscaled_line_gap);\n\n        const float ascent = ImFloor(unscaled_ascent * font_scale + ((unscaled_ascent > 0.0f) ? +1 : -1));\n        const float descent = ImFloor(unscaled_descent * font_scale + ((unscaled_descent > 0.0f) ? +1 : -1));\n        ImFontAtlasBuildSetupFont(atlas, dst_font, &cfg, ascent, descent);\n        const float font_off_x = cfg.GlyphOffset.x;\n        const float font_off_y = cfg.GlyphOffset.y + IM_ROUND(dst_font->Ascent);\n\n        for (int glyph_i = 0; glyph_i < src_tmp.GlyphsCount; glyph_i++)\n        {\n            // Register glyph\n            const int codepoint = src_tmp.GlyphsList[glyph_i];\n            const stbtt_packedchar& pc = src_tmp.PackedChars[glyph_i];\n            stbtt_aligned_quad q;\n            float unused_x = 0.0f, unused_y = 0.0f;\n            stbtt_GetPackedQuad(src_tmp.PackedChars, atlas->TexWidth, atlas->TexHeight, glyph_i, &unused_x, &unused_y, &q, 0);\n            dst_font->AddGlyph(&cfg, (ImWchar)codepoint, q.x0 + font_off_x, q.y0 + font_off_y, q.x1 + font_off_x, q.y1 + font_off_y, q.s0, q.t0, q.s1, q.t1, pc.xadvance);\n        }\n    }\n\n    // Cleanup\n    src_tmp_array.clear_destruct();\n\n    ImFontAtlasBuildFinish(atlas);\n    return true;\n}\n\nconst ImFontBuilderIO* ImFontAtlasGetBuilderForStbTruetype()\n{\n    static ImFontBuilderIO io;\n    io.FontBuilder_Build = ImFontAtlasBuildWithStbTruetype;\n    return &io;\n}\n\n#endif // IMGUI_ENABLE_STB_TRUETYPE\n\nvoid ImFontAtlasBuildSetupFont(ImFontAtlas* atlas, ImFont* font, ImFontConfig* font_config, float ascent, float descent)\n{\n    if (!font_config->MergeMode)\n    {\n        font->ClearOutputData();\n        font->FontSize = font_config->SizePixels;\n        font->ConfigData = font_config;\n        font->ConfigDataCount = 0;\n        font->ContainerAtlas = atlas;\n        font->Ascent = ascent;\n        font->Descent = descent;\n    }\n    font->ConfigDataCount++;\n}\n\nvoid ImFontAtlasBuildPackCustomRects(ImFontAtlas* atlas, void* stbrp_context_opaque)\n{\n    stbrp_context* pack_context = (stbrp_context*)stbrp_context_opaque;\n    IM_ASSERT(pack_context != NULL);\n\n    ImVector<ImFontAtlasCustomRect>& user_rects = atlas->CustomRects;\n    IM_ASSERT(user_rects.Size >= 1); // We expect at least the default custom rects to be registered, else something went wrong.\n\n    ImVector<stbrp_rect> pack_rects;\n    pack_rects.resize(user_rects.Size);\n    memset(pack_rects.Data, 0, (size_t)pack_rects.size_in_bytes());\n    for (int i = 0; i < user_rects.Size; i++)\n    {\n        pack_rects[i].w = user_rects[i].Width;\n        pack_rects[i].h = user_rects[i].Height;\n    }\n    stbrp_pack_rects(pack_context, &pack_rects[0], pack_rects.Size);\n    for (int i = 0; i < pack_rects.Size; i++)\n        if (pack_rects[i].was_packed)\n        {\n            user_rects[i].X = pack_rects[i].x;\n            user_rects[i].Y = pack_rects[i].y;\n            IM_ASSERT(pack_rects[i].w == user_rects[i].Width && pack_rects[i].h == user_rects[i].Height);\n            atlas->TexHeight = ImMax(atlas->TexHeight, pack_rects[i].y + pack_rects[i].h);\n        }\n}\n\nvoid ImFontAtlasBuildRender8bppRectFromString(ImFontAtlas* atlas, int x, int y, int w, int h, const char* in_str, char in_marker_char, unsigned char in_marker_pixel_value)\n{\n    IM_ASSERT(x >= 0 && x + w <= atlas->TexWidth);\n    IM_ASSERT(y >= 0 && y + h <= atlas->TexHeight);\n    unsigned char* out_pixel = atlas->TexPixelsAlpha8 + x + (y * atlas->TexWidth);\n    for (int off_y = 0; off_y < h; off_y++, out_pixel += atlas->TexWidth, in_str += w)\n        for (int off_x = 0; off_x < w; off_x++)\n            out_pixel[off_x] = (in_str[off_x] == in_marker_char) ? in_marker_pixel_value : 0x00;\n}\n\nvoid ImFontAtlasBuildRender32bppRectFromString(ImFontAtlas* atlas, int x, int y, int w, int h, const char* in_str, char in_marker_char, unsigned int in_marker_pixel_value)\n{\n    IM_ASSERT(x >= 0 && x + w <= atlas->TexWidth);\n    IM_ASSERT(y >= 0 && y + h <= atlas->TexHeight);\n    unsigned int* out_pixel = atlas->TexPixelsRGBA32 + x + (y * atlas->TexWidth);\n    for (int off_y = 0; off_y < h; off_y++, out_pixel += atlas->TexWidth, in_str += w)\n        for (int off_x = 0; off_x < w; off_x++)\n            out_pixel[off_x] = (in_str[off_x] == in_marker_char) ? in_marker_pixel_value : IM_COL32_BLACK_TRANS;\n}\n\nstatic void ImFontAtlasBuildRenderDefaultTexData(ImFontAtlas* atlas)\n{\n    ImFontAtlasCustomRect* r = atlas->GetCustomRectByIndex(atlas->PackIdMouseCursors);\n    IM_ASSERT(r->IsPacked());\n\n    const int w = atlas->TexWidth;\n    if (!(atlas->Flags & ImFontAtlasFlags_NoMouseCursors))\n    {\n        // Render/copy pixels\n        IM_ASSERT(r->Width == FONT_ATLAS_DEFAULT_TEX_DATA_W * 2 + 1 && r->Height == FONT_ATLAS_DEFAULT_TEX_DATA_H);\n        const int x_for_white = r->X;\n        const int x_for_black = r->X + FONT_ATLAS_DEFAULT_TEX_DATA_W + 1;\n        if (atlas->TexPixelsAlpha8 != NULL)\n        {\n            ImFontAtlasBuildRender8bppRectFromString(atlas, x_for_white, r->Y, FONT_ATLAS_DEFAULT_TEX_DATA_W, FONT_ATLAS_DEFAULT_TEX_DATA_H, FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS, '.', 0xFF);\n            ImFontAtlasBuildRender8bppRectFromString(atlas, x_for_black, r->Y, FONT_ATLAS_DEFAULT_TEX_DATA_W, FONT_ATLAS_DEFAULT_TEX_DATA_H, FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS, 'X', 0xFF);\n        }\n        else\n        {\n            ImFontAtlasBuildRender32bppRectFromString(atlas, x_for_white, r->Y, FONT_ATLAS_DEFAULT_TEX_DATA_W, FONT_ATLAS_DEFAULT_TEX_DATA_H, FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS, '.', IM_COL32_WHITE);\n            ImFontAtlasBuildRender32bppRectFromString(atlas, x_for_black, r->Y, FONT_ATLAS_DEFAULT_TEX_DATA_W, FONT_ATLAS_DEFAULT_TEX_DATA_H, FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS, 'X', IM_COL32_WHITE);\n        }\n    }\n    else\n    {\n        // Render 4 white pixels\n        IM_ASSERT(r->Width == 2 && r->Height == 2);\n        const int offset = (int)r->X + (int)r->Y * w;\n        if (atlas->TexPixelsAlpha8 != NULL)\n        {\n            atlas->TexPixelsAlpha8[offset] = atlas->TexPixelsAlpha8[offset + 1] = atlas->TexPixelsAlpha8[offset + w] = atlas->TexPixelsAlpha8[offset + w + 1] = 0xFF;\n        }\n        else\n        {\n            atlas->TexPixelsRGBA32[offset] = atlas->TexPixelsRGBA32[offset + 1] = atlas->TexPixelsRGBA32[offset + w] = atlas->TexPixelsRGBA32[offset + w + 1] = IM_COL32_WHITE;\n        }\n    }\n    atlas->TexUvWhitePixel = ImVec2((r->X + 0.5f) * atlas->TexUvScale.x, (r->Y + 0.5f) * atlas->TexUvScale.y);\n}\n\nstatic void ImFontAtlasBuildRenderLinesTexData(ImFontAtlas* atlas)\n{\n    if (atlas->Flags & ImFontAtlasFlags_NoBakedLines)\n        return;\n\n    // This generates a triangular shape in the texture, with the various line widths stacked on top of each other to allow interpolation between them\n    ImFontAtlasCustomRect* r = atlas->GetCustomRectByIndex(atlas->PackIdLines);\n    IM_ASSERT(r->IsPacked());\n    for (unsigned int n = 0; n < IM_DRAWLIST_TEX_LINES_WIDTH_MAX + 1; n++) // +1 because of the zero-width row\n    {\n        // Each line consists of at least two empty pixels at the ends, with a line of solid pixels in the middle\n        unsigned int y = n;\n        unsigned int line_width = n;\n        unsigned int pad_left = (r->Width - line_width) / 2;\n        unsigned int pad_right = r->Width - (pad_left + line_width);\n\n        // Write each slice\n        IM_ASSERT(pad_left + line_width + pad_right == r->Width && y < r->Height); // Make sure we're inside the texture bounds before we start writing pixels\n        if (atlas->TexPixelsAlpha8 != NULL)\n        {\n            unsigned char* write_ptr = &atlas->TexPixelsAlpha8[r->X + ((r->Y + y) * atlas->TexWidth)];\n            for (unsigned int i = 0; i < pad_left; i++)\n                *(write_ptr + i) = 0x00;\n\n            for (unsigned int i = 0; i < line_width; i++)\n                *(write_ptr + pad_left + i) = 0xFF;\n\n            for (unsigned int i = 0; i < pad_right; i++)\n                *(write_ptr + pad_left + line_width + i) = 0x00;\n        }\n        else\n        {\n            unsigned int* write_ptr = &atlas->TexPixelsRGBA32[r->X + ((r->Y + y) * atlas->TexWidth)];\n            for (unsigned int i = 0; i < pad_left; i++)\n                *(write_ptr + i) = IM_COL32_BLACK_TRANS;\n\n            for (unsigned int i = 0; i < line_width; i++)\n                *(write_ptr + pad_left + i) = IM_COL32_WHITE;\n\n            for (unsigned int i = 0; i < pad_right; i++)\n                *(write_ptr + pad_left + line_width + i) = IM_COL32_BLACK_TRANS;\n        }\n\n        // Calculate UVs for this line\n        ImVec2 uv0 = ImVec2((float)(r->X + pad_left - 1), (float)(r->Y + y)) * atlas->TexUvScale;\n        ImVec2 uv1 = ImVec2((float)(r->X + pad_left + line_width + 1), (float)(r->Y + y + 1)) * atlas->TexUvScale;\n        float half_v = (uv0.y + uv1.y) * 0.5f; // Calculate a constant V in the middle of the row to avoid sampling artifacts\n        atlas->TexUvLines[n] = ImVec4(uv0.x, half_v, uv1.x, half_v);\n    }\n}\n\n// Note: this is called / shared by both the stb_truetype and the FreeType builder\nvoid ImFontAtlasBuildInit(ImFontAtlas* atlas)\n{\n    // Register texture region for mouse cursors or standard white pixels\n    if (atlas->PackIdMouseCursors < 0)\n    {\n        if (!(atlas->Flags & ImFontAtlasFlags_NoMouseCursors))\n            atlas->PackIdMouseCursors = atlas->AddCustomRectRegular(FONT_ATLAS_DEFAULT_TEX_DATA_W * 2 + 1, FONT_ATLAS_DEFAULT_TEX_DATA_H);\n        else\n            atlas->PackIdMouseCursors = atlas->AddCustomRectRegular(2, 2);\n    }\n\n    // Register texture region for thick lines\n    // The +2 here is to give space for the end caps, whilst height +1 is to accommodate the fact we have a zero-width row\n    if (atlas->PackIdLines < 0)\n    {\n        if (!(atlas->Flags & ImFontAtlasFlags_NoBakedLines))\n            atlas->PackIdLines = atlas->AddCustomRectRegular(IM_DRAWLIST_TEX_LINES_WIDTH_MAX + 2, IM_DRAWLIST_TEX_LINES_WIDTH_MAX + 1);\n    }\n}\n\n// This is called/shared by both the stb_truetype and the FreeType builder.\nvoid ImFontAtlasBuildFinish(ImFontAtlas* atlas)\n{\n    // Render into our custom data blocks\n    IM_ASSERT(atlas->TexPixelsAlpha8 != NULL || atlas->TexPixelsRGBA32 != NULL);\n    ImFontAtlasBuildRenderDefaultTexData(atlas);\n    ImFontAtlasBuildRenderLinesTexData(atlas);\n\n    // Register custom rectangle glyphs\n    for (int i = 0; i < atlas->CustomRects.Size; i++)\n    {\n        const ImFontAtlasCustomRect* r = &atlas->CustomRects[i];\n        if (r->Font == NULL || r->GlyphID == 0)\n            continue;\n\n        // Will ignore ImFontConfig settings: GlyphMinAdvanceX, GlyphMinAdvanceY, GlyphExtraSpacing, PixelSnapH\n        IM_ASSERT(r->Font->ContainerAtlas == atlas);\n        ImVec2 uv0, uv1;\n        atlas->CalcCustomRectUV(r, &uv0, &uv1);\n        r->Font->AddGlyph(NULL, (ImWchar)r->GlyphID, r->GlyphOffset.x, r->GlyphOffset.y, r->GlyphOffset.x + r->Width, r->GlyphOffset.y + r->Height, uv0.x, uv0.y, uv1.x, uv1.y, r->GlyphAdvanceX);\n    }\n\n    // Build all fonts lookup tables\n    for (int i = 0; i < atlas->Fonts.Size; i++)\n        if (atlas->Fonts[i]->DirtyLookupTables)\n            atlas->Fonts[i]->BuildLookupTable();\n\n    atlas->TexReady = true;\n}\n\n// Retrieve list of range (2 int per range, values are inclusive)\nconst ImWchar*   ImFontAtlas::GetGlyphRangesDefault()\n{\n    static const ImWchar ranges[] =\n    {\n        0x0020, 0x00FF, // Basic Latin + Latin Supplement\n        0,\n    };\n    return &ranges[0];\n}\n\nconst ImWchar*  ImFontAtlas::GetGlyphRangesKorean()\n{\n    static const ImWchar ranges[] =\n    {\n        0x0020, 0x00FF, // Basic Latin + Latin Supplement\n        0x3131, 0x3163, // Korean alphabets\n        0xAC00, 0xD7A3, // Korean characters\n        0xFFFD, 0xFFFD, // Invalid\n        0,\n    };\n    return &ranges[0];\n}\n\nconst ImWchar*  ImFontAtlas::GetGlyphRangesChineseFull()\n{\n    static const ImWchar ranges[] =\n    {\n        0x0020, 0x00FF, // Basic Latin + Latin Supplement\n        0x2000, 0x206F, // General Punctuation\n        0x3000, 0x30FF, // CJK Symbols and Punctuations, Hiragana, Katakana\n        0x31F0, 0x31FF, // Katakana Phonetic Extensions\n        0xFF00, 0xFFEF, // Half-width characters\n        0xFFFD, 0xFFFD, // Invalid\n        0x4e00, 0x9FAF, // CJK Ideograms\n        0,\n    };\n    return &ranges[0];\n}\n\nstatic void UnpackAccumulativeOffsetsIntoRanges(int base_codepoint, const short* accumulative_offsets, int accumulative_offsets_count, ImWchar* out_ranges)\n{\n    for (int n = 0; n < accumulative_offsets_count; n++, out_ranges += 2)\n    {\n        out_ranges[0] = out_ranges[1] = (ImWchar)(base_codepoint + accumulative_offsets[n]);\n        base_codepoint += accumulative_offsets[n];\n    }\n    out_ranges[0] = 0;\n}\n\n//-------------------------------------------------------------------------\n// [SECTION] ImFontAtlas glyph ranges helpers\n//-------------------------------------------------------------------------\n\nconst ImWchar*  ImFontAtlas::GetGlyphRangesChineseSimplifiedCommon()\n{\n    // Store 2500 regularly used characters for Simplified Chinese.\n    // Sourced from https://zh.wiktionary.org/wiki/%E9%99%84%E5%BD%95:%E7%8E%B0%E4%BB%A3%E6%B1%89%E8%AF%AD%E5%B8%B8%E7%94%A8%E5%AD%97%E8%A1%A8\n    // This table covers 97.97% of all characters used during the month in July, 1987.\n    // You can use ImFontGlyphRangesBuilder to create your own ranges derived from this, by merging existing ranges or adding new characters.\n    // (Stored as accumulative offsets from the initial unicode codepoint 0x4E00. This encoding is designed to helps us compact the source code size.)\n    static const short accumulative_offsets_from_0x4E00[] =\n    {\n        0,1,2,4,1,1,1,1,2,1,3,2,1,2,2,1,1,1,1,1,5,2,1,2,3,3,3,2,2,4,1,1,1,2,1,5,2,3,1,2,1,2,1,1,2,1,1,2,2,1,4,1,1,1,1,5,10,1,2,19,2,1,2,1,2,1,2,1,2,\n        1,5,1,6,3,2,1,2,2,1,1,1,4,8,5,1,1,4,1,1,3,1,2,1,5,1,2,1,1,1,10,1,1,5,2,4,6,1,4,2,2,2,12,2,1,1,6,1,1,1,4,1,1,4,6,5,1,4,2,2,4,10,7,1,1,4,2,4,\n        2,1,4,3,6,10,12,5,7,2,14,2,9,1,1,6,7,10,4,7,13,1,5,4,8,4,1,1,2,28,5,6,1,1,5,2,5,20,2,2,9,8,11,2,9,17,1,8,6,8,27,4,6,9,20,11,27,6,68,2,2,1,1,\n        1,2,1,2,2,7,6,11,3,3,1,1,3,1,2,1,1,1,1,1,3,1,1,8,3,4,1,5,7,2,1,4,4,8,4,2,1,2,1,1,4,5,6,3,6,2,12,3,1,3,9,2,4,3,4,1,5,3,3,1,3,7,1,5,1,1,1,1,2,\n        3,4,5,2,3,2,6,1,1,2,1,7,1,7,3,4,5,15,2,2,1,5,3,22,19,2,1,1,1,1,2,5,1,1,1,6,1,1,12,8,2,9,18,22,4,1,1,5,1,16,1,2,7,10,15,1,1,6,2,4,1,2,4,1,6,\n        1,1,3,2,4,1,6,4,5,1,2,1,1,2,1,10,3,1,3,2,1,9,3,2,5,7,2,19,4,3,6,1,1,1,1,1,4,3,2,1,1,1,2,5,3,1,1,1,2,2,1,1,2,1,1,2,1,3,1,1,1,3,7,1,4,1,1,2,1,\n        1,2,1,2,4,4,3,8,1,1,1,2,1,3,5,1,3,1,3,4,6,2,2,14,4,6,6,11,9,1,15,3,1,28,5,2,5,5,3,1,3,4,5,4,6,14,3,2,3,5,21,2,7,20,10,1,2,19,2,4,28,28,2,3,\n        2,1,14,4,1,26,28,42,12,40,3,52,79,5,14,17,3,2,2,11,3,4,6,3,1,8,2,23,4,5,8,10,4,2,7,3,5,1,1,6,3,1,2,2,2,5,28,1,1,7,7,20,5,3,29,3,17,26,1,8,4,\n        27,3,6,11,23,5,3,4,6,13,24,16,6,5,10,25,35,7,3,2,3,3,14,3,6,2,6,1,4,2,3,8,2,1,1,3,3,3,4,1,1,13,2,2,4,5,2,1,14,14,1,2,2,1,4,5,2,3,1,14,3,12,\n        3,17,2,16,5,1,2,1,8,9,3,19,4,2,2,4,17,25,21,20,28,75,1,10,29,103,4,1,2,1,1,4,2,4,1,2,3,24,2,2,2,1,1,2,1,3,8,1,1,1,2,1,1,3,1,1,1,6,1,5,3,1,1,\n        1,3,4,1,1,5,2,1,5,6,13,9,16,1,1,1,1,3,2,3,2,4,5,2,5,2,2,3,7,13,7,2,2,1,1,1,1,2,3,3,2,1,6,4,9,2,1,14,2,14,2,1,18,3,4,14,4,11,41,15,23,15,23,\n        176,1,3,4,1,1,1,1,5,3,1,2,3,7,3,1,1,2,1,2,4,4,6,2,4,1,9,7,1,10,5,8,16,29,1,1,2,2,3,1,3,5,2,4,5,4,1,1,2,2,3,3,7,1,6,10,1,17,1,44,4,6,2,1,1,6,\n        5,4,2,10,1,6,9,2,8,1,24,1,2,13,7,8,8,2,1,4,1,3,1,3,3,5,2,5,10,9,4,9,12,2,1,6,1,10,1,1,7,7,4,10,8,3,1,13,4,3,1,6,1,3,5,2,1,2,17,16,5,2,16,6,\n        1,4,2,1,3,3,6,8,5,11,11,1,3,3,2,4,6,10,9,5,7,4,7,4,7,1,1,4,2,1,3,6,8,7,1,6,11,5,5,3,24,9,4,2,7,13,5,1,8,82,16,61,1,1,1,4,2,2,16,10,3,8,1,1,\n        6,4,2,1,3,1,1,1,4,3,8,4,2,2,1,1,1,1,1,6,3,5,1,1,4,6,9,2,1,1,1,2,1,7,2,1,6,1,5,4,4,3,1,8,1,3,3,1,3,2,2,2,2,3,1,6,1,2,1,2,1,3,7,1,8,2,1,2,1,5,\n        2,5,3,5,10,1,2,1,1,3,2,5,11,3,9,3,5,1,1,5,9,1,2,1,5,7,9,9,8,1,3,3,3,6,8,2,3,2,1,1,32,6,1,2,15,9,3,7,13,1,3,10,13,2,14,1,13,10,2,1,3,10,4,15,\n        2,15,15,10,1,3,9,6,9,32,25,26,47,7,3,2,3,1,6,3,4,3,2,8,5,4,1,9,4,2,2,19,10,6,2,3,8,1,2,2,4,2,1,9,4,4,4,6,4,8,9,2,3,1,1,1,1,3,5,5,1,3,8,4,6,\n        2,1,4,12,1,5,3,7,13,2,5,8,1,6,1,2,5,14,6,1,5,2,4,8,15,5,1,23,6,62,2,10,1,1,8,1,2,2,10,4,2,2,9,2,1,1,3,2,3,1,5,3,3,2,1,3,8,1,1,1,11,3,1,1,4,\n        3,7,1,14,1,2,3,12,5,2,5,1,6,7,5,7,14,11,1,3,1,8,9,12,2,1,11,8,4,4,2,6,10,9,13,1,1,3,1,5,1,3,2,4,4,1,18,2,3,14,11,4,29,4,2,7,1,3,13,9,2,2,5,\n        3,5,20,7,16,8,5,72,34,6,4,22,12,12,28,45,36,9,7,39,9,191,1,1,1,4,11,8,4,9,2,3,22,1,1,1,1,4,17,1,7,7,1,11,31,10,2,4,8,2,3,2,1,4,2,16,4,32,2,\n        3,19,13,4,9,1,5,2,14,8,1,1,3,6,19,6,5,1,16,6,2,10,8,5,1,2,3,1,5,5,1,11,6,6,1,3,3,2,6,3,8,1,1,4,10,7,5,7,7,5,8,9,2,1,3,4,1,1,3,1,3,3,2,6,16,\n        1,4,6,3,1,10,6,1,3,15,2,9,2,10,25,13,9,16,6,2,2,10,11,4,3,9,1,2,6,6,5,4,30,40,1,10,7,12,14,33,6,3,6,7,3,1,3,1,11,14,4,9,5,12,11,49,18,51,31,\n        140,31,2,2,1,5,1,8,1,10,1,4,4,3,24,1,10,1,3,6,6,16,3,4,5,2,1,4,2,57,10,6,22,2,22,3,7,22,6,10,11,36,18,16,33,36,2,5,5,1,1,1,4,10,1,4,13,2,7,\n        5,2,9,3,4,1,7,43,3,7,3,9,14,7,9,1,11,1,1,3,7,4,18,13,1,14,1,3,6,10,73,2,2,30,6,1,11,18,19,13,22,3,46,42,37,89,7,3,16,34,2,2,3,9,1,7,1,1,1,2,\n        2,4,10,7,3,10,3,9,5,28,9,2,6,13,7,3,1,3,10,2,7,2,11,3,6,21,54,85,2,1,4,2,2,1,39,3,21,2,2,5,1,1,1,4,1,1,3,4,15,1,3,2,4,4,2,3,8,2,20,1,8,7,13,\n        4,1,26,6,2,9,34,4,21,52,10,4,4,1,5,12,2,11,1,7,2,30,12,44,2,30,1,1,3,6,16,9,17,39,82,2,2,24,7,1,7,3,16,9,14,44,2,1,2,1,2,3,5,2,4,1,6,7,5,3,\n        2,6,1,11,5,11,2,1,18,19,8,1,3,24,29,2,1,3,5,2,2,1,13,6,5,1,46,11,3,5,1,1,5,8,2,10,6,12,6,3,7,11,2,4,16,13,2,5,1,1,2,2,5,2,28,5,2,23,10,8,4,\n        4,22,39,95,38,8,14,9,5,1,13,5,4,3,13,12,11,1,9,1,27,37,2,5,4,4,63,211,95,2,2,2,1,3,5,2,1,1,2,2,1,1,1,3,2,4,1,2,1,1,5,2,2,1,1,2,3,1,3,1,1,1,\n        3,1,4,2,1,3,6,1,1,3,7,15,5,3,2,5,3,9,11,4,2,22,1,6,3,8,7,1,4,28,4,16,3,3,25,4,4,27,27,1,4,1,2,2,7,1,3,5,2,28,8,2,14,1,8,6,16,25,3,3,3,14,3,\n        3,1,1,2,1,4,6,3,8,4,1,1,1,2,3,6,10,6,2,3,18,3,2,5,5,4,3,1,5,2,5,4,23,7,6,12,6,4,17,11,9,5,1,1,10,5,12,1,1,11,26,33,7,3,6,1,17,7,1,5,12,1,11,\n        2,4,1,8,14,17,23,1,2,1,7,8,16,11,9,6,5,2,6,4,16,2,8,14,1,11,8,9,1,1,1,9,25,4,11,19,7,2,15,2,12,8,52,7,5,19,2,16,4,36,8,1,16,8,24,26,4,6,2,9,\n        5,4,36,3,28,12,25,15,37,27,17,12,59,38,5,32,127,1,2,9,17,14,4,1,2,1,1,8,11,50,4,14,2,19,16,4,17,5,4,5,26,12,45,2,23,45,104,30,12,8,3,10,2,2,\n        3,3,1,4,20,7,2,9,6,15,2,20,1,3,16,4,11,15,6,134,2,5,59,1,2,2,2,1,9,17,3,26,137,10,211,59,1,2,4,1,4,1,1,1,2,6,2,3,1,1,2,3,2,3,1,3,4,4,2,3,3,\n        1,4,3,1,7,2,2,3,1,2,1,3,3,3,2,2,3,2,1,3,14,6,1,3,2,9,6,15,27,9,34,145,1,1,2,1,1,1,1,2,1,1,1,1,2,2,2,3,1,2,1,1,1,2,3,5,8,3,5,2,4,1,3,2,2,2,12,\n        4,1,1,1,10,4,5,1,20,4,16,1,15,9,5,12,2,9,2,5,4,2,26,19,7,1,26,4,30,12,15,42,1,6,8,172,1,1,4,2,1,1,11,2,2,4,2,1,2,1,10,8,1,2,1,4,5,1,2,5,1,8,\n        4,1,3,4,2,1,6,2,1,3,4,1,2,1,1,1,1,12,5,7,2,4,3,1,1,1,3,3,6,1,2,2,3,3,3,2,1,2,12,14,11,6,6,4,12,2,8,1,7,10,1,35,7,4,13,15,4,3,23,21,28,52,5,\n        26,5,6,1,7,10,2,7,53,3,2,1,1,1,2,163,532,1,10,11,1,3,3,4,8,2,8,6,2,2,23,22,4,2,2,4,2,1,3,1,3,3,5,9,8,2,1,2,8,1,10,2,12,21,20,15,105,2,3,1,1,\n        3,2,3,1,1,2,5,1,4,15,11,19,1,1,1,1,5,4,5,1,1,2,5,3,5,12,1,2,5,1,11,1,1,15,9,1,4,5,3,26,8,2,1,3,1,1,15,19,2,12,1,2,5,2,7,2,19,2,20,6,26,7,5,\n        2,2,7,34,21,13,70,2,128,1,1,2,1,1,2,1,1,3,2,2,2,15,1,4,1,3,4,42,10,6,1,49,85,8,1,2,1,1,4,4,2,3,6,1,5,7,4,3,211,4,1,2,1,2,5,1,2,4,2,2,6,5,6,\n        10,3,4,48,100,6,2,16,296,5,27,387,2,2,3,7,16,8,5,38,15,39,21,9,10,3,7,59,13,27,21,47,5,21,6\n    };\n    static ImWchar base_ranges[] = // not zero-terminated\n    {\n        0x0020, 0x00FF, // Basic Latin + Latin Supplement\n        0x2000, 0x206F, // General Punctuation\n        0x3000, 0x30FF, // CJK Symbols and Punctuations, Hiragana, Katakana\n        0x31F0, 0x31FF, // Katakana Phonetic Extensions\n        0xFF00, 0xFFEF, // Half-width characters\n        0xFFFD, 0xFFFD  // Invalid\n    };\n    static ImWchar full_ranges[IM_ARRAYSIZE(base_ranges) + IM_ARRAYSIZE(accumulative_offsets_from_0x4E00) * 2 + 1] = { 0 };\n    if (!full_ranges[0])\n    {\n        memcpy(full_ranges, base_ranges, sizeof(base_ranges));\n        UnpackAccumulativeOffsetsIntoRanges(0x4E00, accumulative_offsets_from_0x4E00, IM_ARRAYSIZE(accumulative_offsets_from_0x4E00), full_ranges + IM_ARRAYSIZE(base_ranges));\n    }\n    return &full_ranges[0];\n}\n\nconst ImWchar*  ImFontAtlas::GetGlyphRangesJapanese()\n{\n    // 2999 ideograms code points for Japanese\n    // - 2136 Joyo (meaning \"for regular use\" or \"for common use\") Kanji code points\n    // - 863 Jinmeiyo (meaning \"for personal name\") Kanji code points\n    // - Sourced from the character information database of the Information-technology Promotion Agency, Japan\n    //   - https://mojikiban.ipa.go.jp/mji/\n    //   - Available under the terms of the Creative Commons Attribution-ShareAlike 2.1 Japan (CC BY-SA 2.1 JP).\n    //     - https://creativecommons.org/licenses/by-sa/2.1/jp/deed.en\n    //     - https://creativecommons.org/licenses/by-sa/2.1/jp/legalcode\n    //   - You can generate this code by the script at:\n    //     - https://github.com/vaiorabbit/everyday_use_kanji\n    // - References:\n    //   - List of Joyo Kanji\n    //     - (Official list by the Agency for Cultural Affairs) https://www.bunka.go.jp/kokugo_nihongo/sisaku/joho/joho/kakuki/14/tosin02/index.html\n    //     - (Wikipedia) https://en.wikipedia.org/wiki/List_of_j%C5%8Dy%C5%8D_kanji\n    //   - List of Jinmeiyo Kanji\n    //     - (Official list by the Ministry of Justice) http://www.moj.go.jp/MINJI/minji86.html\n    //     - (Wikipedia) https://en.wikipedia.org/wiki/Jinmeiy%C5%8D_kanji\n    // - Missing 1 Joyo Kanji: U+20B9F (Kun'yomi: Shikaru, On'yomi: Shitsu,shichi), see https://github.com/ocornut/imgui/pull/3627 for details.\n    // You can use ImFontGlyphRangesBuilder to create your own ranges derived from this, by merging existing ranges or adding new characters.\n    // (Stored as accumulative offsets from the initial unicode codepoint 0x4E00. This encoding is designed to helps us compact the source code size.)\n    static const short accumulative_offsets_from_0x4E00[] =\n    {\n        0,1,2,4,1,1,1,1,2,1,3,3,2,2,1,5,3,5,7,5,6,1,2,1,7,2,6,3,1,8,1,1,4,1,1,18,2,11,2,6,2,1,2,1,5,1,2,1,3,1,2,1,2,3,3,1,1,2,3,1,1,1,12,7,9,1,4,5,1,\n        1,2,1,10,1,1,9,2,2,4,5,6,9,3,1,1,1,1,9,3,18,5,2,2,2,2,1,6,3,7,1,1,1,1,2,2,4,2,1,23,2,10,4,3,5,2,4,10,2,4,13,1,6,1,9,3,1,1,6,6,7,6,3,1,2,11,3,\n        2,2,3,2,15,2,2,5,4,3,6,4,1,2,5,2,12,16,6,13,9,13,2,1,1,7,16,4,7,1,19,1,5,1,2,2,7,7,8,2,6,5,4,9,18,7,4,5,9,13,11,8,15,2,1,1,1,2,1,2,2,1,2,2,8,\n        2,9,3,3,1,1,4,4,1,1,1,4,9,1,4,3,5,5,2,7,5,3,4,8,2,1,13,2,3,3,1,14,1,1,4,5,1,3,6,1,5,2,1,1,3,3,3,3,1,1,2,7,6,6,7,1,4,7,6,1,1,1,1,1,12,3,3,9,5,\n        2,6,1,5,6,1,2,3,18,2,4,14,4,1,3,6,1,1,6,3,5,5,3,2,2,2,2,12,3,1,4,2,3,2,3,11,1,7,4,1,2,1,3,17,1,9,1,24,1,1,4,2,2,4,1,2,7,1,1,1,3,1,2,2,4,15,1,\n        1,2,1,1,2,1,5,2,5,20,2,5,9,1,10,8,7,6,1,1,1,1,1,1,6,2,1,2,8,1,1,1,1,5,1,1,3,1,1,1,1,3,1,1,12,4,1,3,1,1,1,1,1,10,3,1,7,5,13,1,2,3,4,6,1,1,30,\n        2,9,9,1,15,38,11,3,1,8,24,7,1,9,8,10,2,1,9,31,2,13,6,2,9,4,49,5,2,15,2,1,10,2,1,1,1,2,2,6,15,30,35,3,14,18,8,1,16,10,28,12,19,45,38,1,3,2,3,\n        13,2,1,7,3,6,5,3,4,3,1,5,7,8,1,5,3,18,5,3,6,1,21,4,24,9,24,40,3,14,3,21,3,2,1,2,4,2,3,1,15,15,6,5,1,1,3,1,5,6,1,9,7,3,3,2,1,4,3,8,21,5,16,4,\n        5,2,10,11,11,3,6,3,2,9,3,6,13,1,2,1,1,1,1,11,12,6,6,1,4,2,6,5,2,1,1,3,3,6,13,3,1,1,5,1,2,3,3,14,2,1,2,2,2,5,1,9,5,1,1,6,12,3,12,3,4,13,2,14,\n        2,8,1,17,5,1,16,4,2,2,21,8,9,6,23,20,12,25,19,9,38,8,3,21,40,25,33,13,4,3,1,4,1,2,4,1,2,5,26,2,1,1,2,1,3,6,2,1,1,1,1,1,1,2,3,1,1,1,9,2,3,1,1,\n        1,3,6,3,2,1,1,6,6,1,8,2,2,2,1,4,1,2,3,2,7,3,2,4,1,2,1,2,2,1,1,1,1,1,3,1,2,5,4,10,9,4,9,1,1,1,1,1,1,5,3,2,1,6,4,9,6,1,10,2,31,17,8,3,7,5,40,1,\n        7,7,1,6,5,2,10,7,8,4,15,39,25,6,28,47,18,10,7,1,3,1,1,2,1,1,1,3,3,3,1,1,1,3,4,2,1,4,1,3,6,10,7,8,6,2,2,1,3,3,2,5,8,7,9,12,2,15,1,1,4,1,2,1,1,\n        1,3,2,1,3,3,5,6,2,3,2,10,1,4,2,8,1,1,1,11,6,1,21,4,16,3,1,3,1,4,2,3,6,5,1,3,1,1,3,3,4,6,1,1,10,4,2,7,10,4,7,4,2,9,4,3,1,1,1,4,1,8,3,4,1,3,1,\n        6,1,4,2,1,4,7,2,1,8,1,4,5,1,1,2,2,4,6,2,7,1,10,1,1,3,4,11,10,8,21,4,6,1,3,5,2,1,2,28,5,5,2,3,13,1,2,3,1,4,2,1,5,20,3,8,11,1,3,3,3,1,8,10,9,2,\n        10,9,2,3,1,1,2,4,1,8,3,6,1,7,8,6,11,1,4,29,8,4,3,1,2,7,13,1,4,1,6,2,6,12,12,2,20,3,2,3,6,4,8,9,2,7,34,5,1,18,6,1,1,4,4,5,7,9,1,2,2,4,3,4,1,7,\n        2,2,2,6,2,3,25,5,3,6,1,4,6,7,4,2,1,4,2,13,6,4,4,3,1,5,3,4,4,3,2,1,1,4,1,2,1,1,3,1,11,1,6,3,1,7,3,6,2,8,8,6,9,3,4,11,3,2,10,12,2,5,11,1,6,4,5,\n        3,1,8,5,4,6,6,3,5,1,1,3,2,1,2,2,6,17,12,1,10,1,6,12,1,6,6,19,9,6,16,1,13,4,4,15,7,17,6,11,9,15,12,6,7,2,1,2,2,15,9,3,21,4,6,49,18,7,3,2,3,1,\n        6,8,2,2,6,2,9,1,3,6,4,4,1,2,16,2,5,2,1,6,2,3,5,3,1,2,5,1,2,1,9,3,1,8,6,4,8,11,3,1,1,1,1,3,1,13,8,4,1,3,2,2,1,4,1,11,1,5,2,1,5,2,5,8,6,1,1,7,\n        4,3,8,3,2,7,2,1,5,1,5,2,4,7,6,2,8,5,1,11,4,5,3,6,18,1,2,13,3,3,1,21,1,1,4,1,4,1,1,1,8,1,2,2,7,1,2,4,2,2,9,2,1,1,1,4,3,6,3,12,5,1,1,1,5,6,3,2,\n        4,8,2,2,4,2,7,1,8,9,5,2,3,2,1,3,2,13,7,14,6,5,1,1,2,1,4,2,23,2,1,1,6,3,1,4,1,15,3,1,7,3,9,14,1,3,1,4,1,1,5,8,1,3,8,3,8,15,11,4,14,4,4,2,5,5,\n        1,7,1,6,14,7,7,8,5,15,4,8,6,5,6,2,1,13,1,20,15,11,9,2,5,6,2,11,2,6,2,5,1,5,8,4,13,19,25,4,1,1,11,1,34,2,5,9,14,6,2,2,6,1,1,14,1,3,14,13,1,6,\n        12,21,14,14,6,32,17,8,32,9,28,1,2,4,11,8,3,1,14,2,5,15,1,1,1,1,3,6,4,1,3,4,11,3,1,1,11,30,1,5,1,4,1,5,8,1,1,3,2,4,3,17,35,2,6,12,17,3,1,6,2,\n        1,1,12,2,7,3,3,2,1,16,2,8,3,6,5,4,7,3,3,8,1,9,8,5,1,2,1,3,2,8,1,2,9,12,1,1,2,3,8,3,24,12,4,3,7,5,8,3,3,3,3,3,3,1,23,10,3,1,2,2,6,3,1,16,1,16,\n        22,3,10,4,11,6,9,7,7,3,6,2,2,2,4,10,2,1,1,2,8,7,1,6,4,1,3,3,3,5,10,12,12,2,3,12,8,15,1,1,16,6,6,1,5,9,11,4,11,4,2,6,12,1,17,5,13,1,4,9,5,1,11,\n        2,1,8,1,5,7,28,8,3,5,10,2,17,3,38,22,1,2,18,12,10,4,38,18,1,4,44,19,4,1,8,4,1,12,1,4,31,12,1,14,7,75,7,5,10,6,6,13,3,2,11,11,3,2,5,28,15,6,18,\n        18,5,6,4,3,16,1,7,18,7,36,3,5,3,1,7,1,9,1,10,7,2,4,2,6,2,9,7,4,3,32,12,3,7,10,2,23,16,3,1,12,3,31,4,11,1,3,8,9,5,1,30,15,6,12,3,2,2,11,19,9,\n        14,2,6,2,3,19,13,17,5,3,3,25,3,14,1,1,1,36,1,3,2,19,3,13,36,9,13,31,6,4,16,34,2,5,4,2,3,3,5,1,1,1,4,3,1,17,3,2,3,5,3,1,3,2,3,5,6,3,12,11,1,3,\n        1,2,26,7,12,7,2,14,3,3,7,7,11,25,25,28,16,4,36,1,2,1,6,2,1,9,3,27,17,4,3,4,13,4,1,3,2,2,1,10,4,2,4,6,3,8,2,1,18,1,1,24,2,2,4,33,2,3,63,7,1,6,\n        40,7,3,4,4,2,4,15,18,1,16,1,1,11,2,41,14,1,3,18,13,3,2,4,16,2,17,7,15,24,7,18,13,44,2,2,3,6,1,1,7,5,1,7,1,4,3,3,5,10,8,2,3,1,8,1,1,27,4,2,1,\n        12,1,2,1,10,6,1,6,7,5,2,3,7,11,5,11,3,6,6,2,3,15,4,9,1,1,2,1,2,11,2,8,12,8,5,4,2,3,1,5,2,2,1,14,1,12,11,4,1,11,17,17,4,3,2,5,5,7,3,1,5,9,9,8,\n        2,5,6,6,13,13,2,1,2,6,1,2,2,49,4,9,1,2,10,16,7,8,4,3,2,23,4,58,3,29,1,14,19,19,11,11,2,7,5,1,3,4,6,2,18,5,12,12,17,17,3,3,2,4,1,6,2,3,4,3,1,\n        1,1,1,5,1,1,9,1,3,1,3,6,1,8,1,1,2,6,4,14,3,1,4,11,4,1,3,32,1,2,4,13,4,1,2,4,2,1,3,1,11,1,4,2,1,4,4,6,3,5,1,6,5,7,6,3,23,3,5,3,5,3,3,13,3,9,10,\n        1,12,10,2,3,18,13,7,160,52,4,2,2,3,2,14,5,4,12,4,6,4,1,20,4,11,6,2,12,27,1,4,1,2,2,7,4,5,2,28,3,7,25,8,3,19,3,6,10,2,2,1,10,2,5,4,1,3,4,1,5,\n        3,2,6,9,3,6,2,16,3,3,16,4,5,5,3,2,1,2,16,15,8,2,6,21,2,4,1,22,5,8,1,1,21,11,2,1,11,11,19,13,12,4,2,3,2,3,6,1,8,11,1,4,2,9,5,2,1,11,2,9,1,1,2,\n        14,31,9,3,4,21,14,4,8,1,7,2,2,2,5,1,4,20,3,3,4,10,1,11,9,8,2,1,4,5,14,12,14,2,17,9,6,31,4,14,1,20,13,26,5,2,7,3,6,13,2,4,2,19,6,2,2,18,9,3,5,\n        12,12,14,4,6,2,3,6,9,5,22,4,5,25,6,4,8,5,2,6,27,2,35,2,16,3,7,8,8,6,6,5,9,17,2,20,6,19,2,13,3,1,1,1,4,17,12,2,14,7,1,4,18,12,38,33,2,10,1,1,\n        2,13,14,17,11,50,6,33,20,26,74,16,23,45,50,13,38,33,6,6,7,4,4,2,1,3,2,5,8,7,8,9,3,11,21,9,13,1,3,10,6,7,1,2,2,18,5,5,1,9,9,2,68,9,19,13,2,5,\n        1,4,4,7,4,13,3,9,10,21,17,3,26,2,1,5,2,4,5,4,1,7,4,7,3,4,2,1,6,1,1,20,4,1,9,2,2,1,3,3,2,3,2,1,1,1,20,2,3,1,6,2,3,6,2,4,8,1,3,2,10,3,5,3,4,4,\n        3,4,16,1,6,1,10,2,4,2,1,1,2,10,11,2,2,3,1,24,31,4,10,10,2,5,12,16,164,15,4,16,7,9,15,19,17,1,2,1,1,5,1,1,1,1,1,3,1,4,3,1,3,1,3,1,2,1,1,3,3,7,\n        2,8,1,2,2,2,1,3,4,3,7,8,12,92,2,10,3,1,3,14,5,25,16,42,4,7,7,4,2,21,5,27,26,27,21,25,30,31,2,1,5,13,3,22,5,6,6,11,9,12,1,5,9,7,5,5,22,60,3,5,\n        13,1,1,8,1,1,3,3,2,1,9,3,3,18,4,1,2,3,7,6,3,1,2,3,9,1,3,1,3,2,1,3,1,1,1,2,1,11,3,1,6,9,1,3,2,3,1,2,1,5,1,1,4,3,4,1,2,2,4,4,1,7,2,1,2,2,3,5,13,\n        18,3,4,14,9,9,4,16,3,7,5,8,2,6,48,28,3,1,1,4,2,14,8,2,9,2,1,15,2,4,3,2,10,16,12,8,7,1,1,3,1,1,1,2,7,4,1,6,4,38,39,16,23,7,15,15,3,2,12,7,21,\n        37,27,6,5,4,8,2,10,8,8,6,5,1,2,1,3,24,1,16,17,9,23,10,17,6,1,51,55,44,13,294,9,3,6,2,4,2,2,15,1,1,1,13,21,17,68,14,8,9,4,1,4,9,3,11,7,1,1,1,\n        5,6,3,2,1,1,1,2,3,8,1,2,2,4,1,5,5,2,1,4,3,7,13,4,1,4,1,3,1,1,1,5,5,10,1,6,1,5,2,1,5,2,4,1,4,5,7,3,18,2,9,11,32,4,3,3,2,4,7,11,16,9,11,8,13,38,\n        32,8,4,2,1,1,2,1,2,4,4,1,1,1,4,1,21,3,11,1,16,1,1,6,1,3,2,4,9,8,57,7,44,1,3,3,13,3,10,1,1,7,5,2,7,21,47,63,3,15,4,7,1,16,1,1,2,8,2,3,42,15,4,\n        1,29,7,22,10,3,78,16,12,20,18,4,67,11,5,1,3,15,6,21,31,32,27,18,13,71,35,5,142,4,10,1,2,50,19,33,16,35,37,16,19,27,7,1,133,19,1,4,8,7,20,1,4,\n        4,1,10,3,1,6,1,2,51,5,40,15,24,43,22928,11,1,13,154,70,3,1,1,7,4,10,1,2,1,1,2,1,2,1,2,2,1,1,2,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,\n        3,2,1,1,1,1,2,1,1,\n    };\n    static ImWchar base_ranges[] = // not zero-terminated\n    {\n        0x0020, 0x00FF, // Basic Latin + Latin Supplement\n        0x3000, 0x30FF, // CJK Symbols and Punctuations, Hiragana, Katakana\n        0x31F0, 0x31FF, // Katakana Phonetic Extensions\n        0xFF00, 0xFFEF, // Half-width characters\n        0xFFFD, 0xFFFD  // Invalid\n    };\n    static ImWchar full_ranges[IM_ARRAYSIZE(base_ranges) + IM_ARRAYSIZE(accumulative_offsets_from_0x4E00)*2 + 1] = { 0 };\n    if (!full_ranges[0])\n    {\n        memcpy(full_ranges, base_ranges, sizeof(base_ranges));\n        UnpackAccumulativeOffsetsIntoRanges(0x4E00, accumulative_offsets_from_0x4E00, IM_ARRAYSIZE(accumulative_offsets_from_0x4E00), full_ranges + IM_ARRAYSIZE(base_ranges));\n    }\n    return &full_ranges[0];\n}\n\nconst ImWchar*  ImFontAtlas::GetGlyphRangesCyrillic()\n{\n    static const ImWchar ranges[] =\n    {\n        0x0020, 0x00FF, // Basic Latin + Latin Supplement\n        0x0400, 0x052F, // Cyrillic + Cyrillic Supplement\n        0x2DE0, 0x2DFF, // Cyrillic Extended-A\n        0xA640, 0xA69F, // Cyrillic Extended-B\n        0,\n    };\n    return &ranges[0];\n}\n\nconst ImWchar*  ImFontAtlas::GetGlyphRangesThai()\n{\n    static const ImWchar ranges[] =\n    {\n        0x0020, 0x00FF, // Basic Latin\n        0x2010, 0x205E, // Punctuations\n        0x0E00, 0x0E7F, // Thai\n        0,\n    };\n    return &ranges[0];\n}\n\nconst ImWchar*  ImFontAtlas::GetGlyphRangesVietnamese()\n{\n    static const ImWchar ranges[] =\n    {\n        0x0020, 0x00FF, // Basic Latin\n        0x0102, 0x0103,\n        0x0110, 0x0111,\n        0x0128, 0x0129,\n        0x0168, 0x0169,\n        0x01A0, 0x01A1,\n        0x01AF, 0x01B0,\n        0x1EA0, 0x1EF9,\n        0,\n    };\n    return &ranges[0];\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] ImFontGlyphRangesBuilder\n//-----------------------------------------------------------------------------\n\nvoid ImFontGlyphRangesBuilder::AddText(const char* text, const char* text_end)\n{\n    while (text_end ? (text < text_end) : *text)\n    {\n        unsigned int c = 0;\n        int c_len = ImTextCharFromUtf8(&c, text, text_end);\n        text += c_len;\n        if (c_len == 0)\n            break;\n        AddChar((ImWchar)c);\n    }\n}\n\nvoid ImFontGlyphRangesBuilder::AddRanges(const ImWchar* ranges)\n{\n    for (; ranges[0]; ranges += 2)\n        for (ImWchar c = ranges[0]; c <= ranges[1]; c++)\n            AddChar(c);\n}\n\nvoid ImFontGlyphRangesBuilder::BuildRanges(ImVector<ImWchar>* out_ranges)\n{\n    const int max_codepoint = IM_UNICODE_CODEPOINT_MAX;\n    for (int n = 0; n <= max_codepoint; n++)\n        if (GetBit(n))\n        {\n            out_ranges->push_back((ImWchar)n);\n            while (n < max_codepoint && GetBit(n + 1))\n                n++;\n            out_ranges->push_back((ImWchar)n);\n        }\n    out_ranges->push_back(0);\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] ImFont\n//-----------------------------------------------------------------------------\n\nImFont::ImFont()\n{\n    FontSize = 0.0f;\n    FallbackAdvanceX = 0.0f;\n    FallbackChar = (ImWchar)-1;\n    EllipsisChar = (ImWchar)-1;\n    DotChar = (ImWchar)-1;\n    FallbackGlyph = NULL;\n    ContainerAtlas = NULL;\n    ConfigData = NULL;\n    ConfigDataCount = 0;\n    DirtyLookupTables = false;\n    Scale = 1.0f;\n    Ascent = Descent = 0.0f;\n    MetricsTotalSurface = 0;\n    memset(Used4kPagesMap, 0, sizeof(Used4kPagesMap));\n}\n\nImFont::~ImFont()\n{\n    ClearOutputData();\n}\n\nvoid    ImFont::ClearOutputData()\n{\n    FontSize = 0.0f;\n    FallbackAdvanceX = 0.0f;\n    Glyphs.clear();\n    IndexAdvanceX.clear();\n    IndexLookup.clear();\n    FallbackGlyph = NULL;\n    ContainerAtlas = NULL;\n    DirtyLookupTables = true;\n    Ascent = Descent = 0.0f;\n    MetricsTotalSurface = 0;\n}\n\nstatic ImWchar FindFirstExistingGlyph(ImFont* font, const ImWchar* candidate_chars, int candidate_chars_count)\n{\n    for (int n = 0; n < candidate_chars_count; n++)\n        if (font->FindGlyphNoFallback(candidate_chars[n]) != NULL)\n            return candidate_chars[n];\n    return (ImWchar)-1;\n}\n\nvoid ImFont::BuildLookupTable()\n{\n    int max_codepoint = 0;\n    for (int i = 0; i != Glyphs.Size; i++)\n        max_codepoint = ImMax(max_codepoint, (int)Glyphs[i].Codepoint);\n\n    // Build lookup table\n    IM_ASSERT(Glyphs.Size < 0xFFFF); // -1 is reserved\n    IndexAdvanceX.clear();\n    IndexLookup.clear();\n    DirtyLookupTables = false;\n    memset(Used4kPagesMap, 0, sizeof(Used4kPagesMap));\n    GrowIndex(max_codepoint + 1);\n    for (int i = 0; i < Glyphs.Size; i++)\n    {\n        int codepoint = (int)Glyphs[i].Codepoint;\n        IndexAdvanceX[codepoint] = Glyphs[i].AdvanceX;\n        IndexLookup[codepoint] = (ImWchar)i;\n\n        // Mark 4K page as used\n        const int page_n = codepoint / 4096;\n        Used4kPagesMap[page_n >> 3] |= 1 << (page_n & 7);\n    }\n\n    // Create a glyph to handle TAB\n    // FIXME: Needs proper TAB handling but it needs to be contextualized (or we could arbitrary say that each string starts at \"column 0\" ?)\n    if (FindGlyph((ImWchar)' '))\n    {\n        if (Glyphs.back().Codepoint != '\\t')   // So we can call this function multiple times (FIXME: Flaky)\n            Glyphs.resize(Glyphs.Size + 1);\n        ImFontGlyph& tab_glyph = Glyphs.back();\n        tab_glyph = *FindGlyph((ImWchar)' ');\n        tab_glyph.Codepoint = '\\t';\n        tab_glyph.AdvanceX *= IM_TABSIZE;\n        IndexAdvanceX[(int)tab_glyph.Codepoint] = (float)tab_glyph.AdvanceX;\n        IndexLookup[(int)tab_glyph.Codepoint] = (ImWchar)(Glyphs.Size - 1);\n    }\n\n    // Mark special glyphs as not visible (note that AddGlyph already mark as non-visible glyphs with zero-size polygons)\n    SetGlyphVisible((ImWchar)' ', false);\n    SetGlyphVisible((ImWchar)'\\t', false);\n\n    // Ellipsis character is required for rendering elided text. We prefer using U+2026 (horizontal ellipsis).\n    // However some old fonts may contain ellipsis at U+0085. Here we auto-detect most suitable ellipsis character.\n    // FIXME: Note that 0x2026 is rarely included in our font ranges. Because of this we are more likely to use three individual dots.\n    const ImWchar ellipsis_chars[] = { (ImWchar)0x2026, (ImWchar)0x0085 };\n    const ImWchar dots_chars[] = { (ImWchar)'.', (ImWchar)0xFF0E };\n    if (EllipsisChar == (ImWchar)-1)\n        EllipsisChar = FindFirstExistingGlyph(this, ellipsis_chars, IM_ARRAYSIZE(ellipsis_chars));\n    if (DotChar == (ImWchar)-1)\n        DotChar = FindFirstExistingGlyph(this, dots_chars, IM_ARRAYSIZE(dots_chars));\n\n    // Setup fallback character\n    const ImWchar fallback_chars[] = { (ImWchar)IM_UNICODE_CODEPOINT_INVALID, (ImWchar)'?', (ImWchar)' ' };\n    FallbackGlyph = FindGlyphNoFallback(FallbackChar);\n    if (FallbackGlyph == NULL)\n    {\n        FallbackChar = FindFirstExistingGlyph(this, fallback_chars, IM_ARRAYSIZE(fallback_chars));\n        FallbackGlyph = FindGlyphNoFallback(FallbackChar);\n        if (FallbackGlyph == NULL)\n        {\n            FallbackGlyph = &Glyphs.back();\n            FallbackChar = (ImWchar)FallbackGlyph->Codepoint;\n        }\n    }\n\n    FallbackAdvanceX = FallbackGlyph->AdvanceX;\n    for (int i = 0; i < max_codepoint + 1; i++)\n        if (IndexAdvanceX[i] < 0.0f)\n            IndexAdvanceX[i] = FallbackAdvanceX;\n}\n\n// API is designed this way to avoid exposing the 4K page size\n// e.g. use with IsGlyphRangeUnused(0, 255)\nbool ImFont::IsGlyphRangeUnused(unsigned int c_begin, unsigned int c_last)\n{\n    unsigned int page_begin = (c_begin / 4096);\n    unsigned int page_last = (c_last / 4096);\n    for (unsigned int page_n = page_begin; page_n <= page_last; page_n++)\n        if ((page_n >> 3) < sizeof(Used4kPagesMap))\n            if (Used4kPagesMap[page_n >> 3] & (1 << (page_n & 7)))\n                return false;\n    return true;\n}\n\nvoid ImFont::SetGlyphVisible(ImWchar c, bool visible)\n{\n    if (ImFontGlyph* glyph = (ImFontGlyph*)(void*)FindGlyph((ImWchar)c))\n        glyph->Visible = visible ? 1 : 0;\n}\n\nvoid ImFont::GrowIndex(int new_size)\n{\n    IM_ASSERT(IndexAdvanceX.Size == IndexLookup.Size);\n    if (new_size <= IndexLookup.Size)\n        return;\n    IndexAdvanceX.resize(new_size, -1.0f);\n    IndexLookup.resize(new_size, (ImWchar)-1);\n}\n\n// x0/y0/x1/y1 are offset from the character upper-left layout position, in pixels. Therefore x0/y0 are often fairly close to zero.\n// Not to be mistaken with texture coordinates, which are held by u0/v0/u1/v1 in normalized format (0.0..1.0 on each texture axis).\n// 'cfg' is not necessarily == 'this->ConfigData' because multiple source fonts+configs can be used to build one target font.\nvoid ImFont::AddGlyph(const ImFontConfig* cfg, ImWchar codepoint, float x0, float y0, float x1, float y1, float u0, float v0, float u1, float v1, float advance_x)\n{\n    if (cfg != NULL)\n    {\n        // Clamp & recenter if needed\n        const float advance_x_original = advance_x;\n        advance_x = ImClamp(advance_x, cfg->GlyphMinAdvanceX, cfg->GlyphMaxAdvanceX);\n        if (advance_x != advance_x_original)\n        {\n            float char_off_x = cfg->PixelSnapH ? ImFloor((advance_x - advance_x_original) * 0.5f) : (advance_x - advance_x_original) * 0.5f;\n            x0 += char_off_x;\n            x1 += char_off_x;\n        }\n\n        // Snap to pixel\n        if (cfg->PixelSnapH)\n            advance_x = IM_ROUND(advance_x);\n\n        // Bake spacing\n        advance_x += cfg->GlyphExtraSpacing.x;\n    }\n\n    Glyphs.resize(Glyphs.Size + 1);\n    ImFontGlyph& glyph = Glyphs.back();\n    glyph.Codepoint = (unsigned int)codepoint;\n    glyph.Visible = (x0 != x1) && (y0 != y1);\n    glyph.Colored = false;\n    glyph.X0 = x0;\n    glyph.Y0 = y0;\n    glyph.X1 = x1;\n    glyph.Y1 = y1;\n    glyph.U0 = u0;\n    glyph.V0 = v0;\n    glyph.U1 = u1;\n    glyph.V1 = v1;\n    glyph.AdvanceX = advance_x;\n\n    // Compute rough surface usage metrics (+1 to account for average padding, +0.99 to round)\n    // We use (U1-U0)*TexWidth instead of X1-X0 to account for oversampling.\n    float pad = ContainerAtlas->TexGlyphPadding + 0.99f;\n    DirtyLookupTables = true;\n    MetricsTotalSurface += (int)((glyph.U1 - glyph.U0) * ContainerAtlas->TexWidth + pad) * (int)((glyph.V1 - glyph.V0) * ContainerAtlas->TexHeight + pad);\n}\n\nvoid ImFont::AddRemapChar(ImWchar dst, ImWchar src, bool overwrite_dst)\n{\n    IM_ASSERT(IndexLookup.Size > 0);    // Currently this can only be called AFTER the font has been built, aka after calling ImFontAtlas::GetTexDataAs*() function.\n    unsigned int index_size = (unsigned int)IndexLookup.Size;\n\n    if (dst < index_size && IndexLookup.Data[dst] == (ImWchar)-1 && !overwrite_dst) // 'dst' already exists\n        return;\n    if (src >= index_size && dst >= index_size) // both 'dst' and 'src' don't exist -> no-op\n        return;\n\n    GrowIndex(dst + 1);\n    IndexLookup[dst] = (src < index_size) ? IndexLookup.Data[src] : (ImWchar)-1;\n    IndexAdvanceX[dst] = (src < index_size) ? IndexAdvanceX.Data[src] : 1.0f;\n}\n\nconst ImFontGlyph* ImFont::FindGlyph(ImWchar c) const\n{\n    if (c >= (size_t)IndexLookup.Size)\n        return FallbackGlyph;\n    const ImWchar i = IndexLookup.Data[c];\n    if (i == (ImWchar)-1)\n        return FallbackGlyph;\n    return &Glyphs.Data[i];\n}\n\nconst ImFontGlyph* ImFont::FindGlyphNoFallback(ImWchar c) const\n{\n    if (c >= (size_t)IndexLookup.Size)\n        return NULL;\n    const ImWchar i = IndexLookup.Data[c];\n    if (i == (ImWchar)-1)\n        return NULL;\n    return &Glyphs.Data[i];\n}\n\nconst char* ImFont::CalcWordWrapPositionA(float scale, const char* text, const char* text_end, float wrap_width) const\n{\n    // Simple word-wrapping for English, not full-featured. Please submit failing cases!\n    // FIXME: Much possible improvements (don't cut things like \"word !\", \"word!!!\" but cut within \"word,,,,\", more sensible support for punctuations, support for Unicode punctuations, etc.)\n\n    // For references, possible wrap point marked with ^\n    //  \"aaa bbb, ccc,ddd. eee   fff. ggg!\"\n    //      ^    ^    ^   ^   ^__    ^    ^\n\n    // List of hardcoded separators: .,;!?'\"\n\n    // Skip extra blanks after a line returns (that includes not counting them in width computation)\n    // e.g. \"Hello    world\" --> \"Hello\" \"World\"\n\n    // Cut words that cannot possibly fit within one line.\n    // e.g.: \"The tropical fish\" with ~5 characters worth of width --> \"The tr\" \"opical\" \"fish\"\n\n    float line_width = 0.0f;\n    float word_width = 0.0f;\n    float blank_width = 0.0f;\n    wrap_width /= scale; // We work with unscaled widths to avoid scaling every characters\n\n    const char* word_end = text;\n    const char* prev_word_end = NULL;\n    bool inside_word = true;\n\n    const char* s = text;\n    while (s < text_end)\n    {\n        unsigned int c = (unsigned int)*s;\n        const char* next_s;\n        if (c < 0x80)\n            next_s = s + 1;\n        else\n            next_s = s + ImTextCharFromUtf8(&c, s, text_end);\n        if (c == 0)\n            break;\n\n        if (c < 32)\n        {\n            if (c == '\\n')\n            {\n                line_width = word_width = blank_width = 0.0f;\n                inside_word = true;\n                s = next_s;\n                continue;\n            }\n            if (c == '\\r')\n            {\n                s = next_s;\n                continue;\n            }\n        }\n\n        const float char_width = ((int)c < IndexAdvanceX.Size ? IndexAdvanceX.Data[c] : FallbackAdvanceX);\n        if (ImCharIsBlankW(c))\n        {\n            if (inside_word)\n            {\n                line_width += blank_width;\n                blank_width = 0.0f;\n                word_end = s;\n            }\n            blank_width += char_width;\n            inside_word = false;\n        }\n        else\n        {\n            word_width += char_width;\n            if (inside_word)\n            {\n                word_end = next_s;\n            }\n            else\n            {\n                prev_word_end = word_end;\n                line_width += word_width + blank_width;\n                word_width = blank_width = 0.0f;\n            }\n\n            // Allow wrapping after punctuation.\n            inside_word = (c != '.' && c != ',' && c != ';' && c != '!' && c != '?' && c != '\\\"');\n        }\n\n        // We ignore blank width at the end of the line (they can be skipped)\n        if (line_width + word_width > wrap_width)\n        {\n            // Words that cannot possibly fit within an entire line will be cut anywhere.\n            if (word_width < wrap_width)\n                s = prev_word_end ? prev_word_end : word_end;\n            break;\n        }\n\n        s = next_s;\n    }\n\n    return s;\n}\n\nImVec2 ImFont::CalcTextSizeA(float size, float max_width, float wrap_width, const char* text_begin, const char* text_end, const char** remaining) const\n{\n    if (!text_end)\n        text_end = text_begin + strlen(text_begin); // FIXME-OPT: Need to avoid this.\n\n    const float line_height = size;\n    const float scale = size / FontSize;\n\n    ImVec2 text_size = ImVec2(0, 0);\n    float line_width = 0.0f;\n\n    const bool word_wrap_enabled = (wrap_width > 0.0f);\n    const char* word_wrap_eol = NULL;\n\n    const char* s = text_begin;\n    while (s < text_end)\n    {\n        if (word_wrap_enabled)\n        {\n            // Calculate how far we can render. Requires two passes on the string data but keeps the code simple and not intrusive for what's essentially an uncommon feature.\n            if (!word_wrap_eol)\n            {\n                word_wrap_eol = CalcWordWrapPositionA(scale, s, text_end, wrap_width - line_width);\n                if (word_wrap_eol == s) // Wrap_width is too small to fit anything. Force displaying 1 character to minimize the height discontinuity.\n                    word_wrap_eol++;    // +1 may not be a character start point in UTF-8 but it's ok because we use s >= word_wrap_eol below\n            }\n\n            if (s >= word_wrap_eol)\n            {\n                if (text_size.x < line_width)\n                    text_size.x = line_width;\n                text_size.y += line_height;\n                line_width = 0.0f;\n                word_wrap_eol = NULL;\n\n                // Wrapping skips upcoming blanks\n                while (s < text_end)\n                {\n                    const char c = *s;\n                    if (ImCharIsBlankA(c)) { s++; } else if (c == '\\n') { s++; break; } else { break; }\n                }\n                continue;\n            }\n        }\n\n        // Decode and advance source\n        const char* prev_s = s;\n        unsigned int c = (unsigned int)*s;\n        if (c < 0x80)\n        {\n            s += 1;\n        }\n        else\n        {\n            s += ImTextCharFromUtf8(&c, s, text_end);\n            if (c == 0) // Malformed UTF-8?\n                break;\n        }\n\n        if (c < 32)\n        {\n            if (c == '\\n')\n            {\n                text_size.x = ImMax(text_size.x, line_width);\n                text_size.y += line_height;\n                line_width = 0.0f;\n                continue;\n            }\n            if (c == '\\r')\n                continue;\n        }\n\n        const float char_width = ((int)c < IndexAdvanceX.Size ? IndexAdvanceX.Data[c] : FallbackAdvanceX) * scale;\n        if (line_width + char_width >= max_width)\n        {\n            s = prev_s;\n            break;\n        }\n\n        line_width += char_width;\n    }\n\n    if (text_size.x < line_width)\n        text_size.x = line_width;\n\n    if (line_width > 0 || text_size.y == 0.0f)\n        text_size.y += line_height;\n\n    if (remaining)\n        *remaining = s;\n\n    return text_size;\n}\n\n// Note: as with every ImDrawList drawing function, this expects that the font atlas texture is bound.\nvoid ImFont::RenderChar(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, ImWchar c) const\n{\n    const ImFontGlyph* glyph = FindGlyph(c);\n    if (!glyph || !glyph->Visible)\n        return;\n    if (glyph->Colored)\n        col |= ~IM_COL32_A_MASK;\n    float scale = (size >= 0.0f) ? (size / FontSize) : 1.0f;\n    pos.x = IM_FLOOR(pos.x);\n    pos.y = IM_FLOOR(pos.y);\n    draw_list->PrimReserve(6, 4);\n    draw_list->PrimRectUV(ImVec2(pos.x + glyph->X0 * scale, pos.y + glyph->Y0 * scale), ImVec2(pos.x + glyph->X1 * scale, pos.y + glyph->Y1 * scale), ImVec2(glyph->U0, glyph->V0), ImVec2(glyph->U1, glyph->V1), col);\n}\n\n// Note: as with every ImDrawList drawing function, this expects that the font atlas texture is bound.\nvoid ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, const ImVec4& clip_rect, const char* text_begin, const char* text_end, float wrap_width, bool cpu_fine_clip) const\n{\n    if (!text_end)\n        text_end = text_begin + strlen(text_begin); // ImGui:: functions generally already provides a valid text_end, so this is merely to handle direct calls.\n\n    // Align to be pixel perfect\n    pos.x = IM_FLOOR(pos.x);\n    pos.y = IM_FLOOR(pos.y);\n    float x = pos.x;\n    float y = pos.y;\n    if (y > clip_rect.w)\n        return;\n\n    const float scale = size / FontSize;\n    const float line_height = FontSize * scale;\n    const bool word_wrap_enabled = (wrap_width > 0.0f);\n    const char* word_wrap_eol = NULL;\n\n    // Fast-forward to first visible line\n    const char* s = text_begin;\n    if (y + line_height < clip_rect.y && !word_wrap_enabled)\n        while (y + line_height < clip_rect.y && s < text_end)\n        {\n            s = (const char*)memchr(s, '\\n', text_end - s);\n            s = s ? s + 1 : text_end;\n            y += line_height;\n        }\n\n    // For large text, scan for the last visible line in order to avoid over-reserving in the call to PrimReserve()\n    // Note that very large horizontal line will still be affected by the issue (e.g. a one megabyte string buffer without a newline will likely crash atm)\n    if (text_end - s > 10000 && !word_wrap_enabled)\n    {\n        const char* s_end = s;\n        float y_end = y;\n        while (y_end < clip_rect.w && s_end < text_end)\n        {\n            s_end = (const char*)memchr(s_end, '\\n', text_end - s_end);\n            s_end = s_end ? s_end + 1 : text_end;\n            y_end += line_height;\n        }\n        text_end = s_end;\n    }\n    if (s == text_end)\n        return;\n\n    // Reserve vertices for remaining worse case (over-reserving is useful and easily amortized)\n    const int vtx_count_max = (int)(text_end - s) * 4;\n    const int idx_count_max = (int)(text_end - s) * 6;\n    const int idx_expected_size = draw_list->IdxBuffer.Size + idx_count_max;\n    draw_list->PrimReserve(idx_count_max, vtx_count_max);\n\n    ImDrawVert* vtx_write = draw_list->_VtxWritePtr;\n    ImDrawIdx* idx_write = draw_list->_IdxWritePtr;\n    unsigned int vtx_current_idx = draw_list->_VtxCurrentIdx;\n\n    const ImU32 col_untinted = col | ~IM_COL32_A_MASK;\n\n    while (s < text_end)\n    {\n        if (word_wrap_enabled)\n        {\n            // Calculate how far we can render. Requires two passes on the string data but keeps the code simple and not intrusive for what's essentially an uncommon feature.\n            if (!word_wrap_eol)\n            {\n                word_wrap_eol = CalcWordWrapPositionA(scale, s, text_end, wrap_width - (x - pos.x));\n                if (word_wrap_eol == s) // Wrap_width is too small to fit anything. Force displaying 1 character to minimize the height discontinuity.\n                    word_wrap_eol++;    // +1 may not be a character start point in UTF-8 but it's ok because we use s >= word_wrap_eol below\n            }\n\n            if (s >= word_wrap_eol)\n            {\n                x = pos.x;\n                y += line_height;\n                word_wrap_eol = NULL;\n\n                // Wrapping skips upcoming blanks\n                while (s < text_end)\n                {\n                    const char c = *s;\n                    if (ImCharIsBlankA(c)) { s++; } else if (c == '\\n') { s++; break; } else { break; }\n                }\n                continue;\n            }\n        }\n\n        // Decode and advance source\n        unsigned int c = (unsigned int)*s;\n        if (c < 0x80)\n        {\n            s += 1;\n        }\n        else\n        {\n            s += ImTextCharFromUtf8(&c, s, text_end);\n            if (c == 0) // Malformed UTF-8?\n                break;\n        }\n\n        if (c < 32)\n        {\n            if (c == '\\n')\n            {\n                x = pos.x;\n                y += line_height;\n                if (y > clip_rect.w)\n                    break; // break out of main loop\n                continue;\n            }\n            if (c == '\\r')\n                continue;\n        }\n\n        const ImFontGlyph* glyph = FindGlyph((ImWchar)c);\n        if (glyph == NULL)\n            continue;\n\n        float char_width = glyph->AdvanceX * scale;\n        if (glyph->Visible)\n        {\n            // We don't do a second finer clipping test on the Y axis as we've already skipped anything before clip_rect.y and exit once we pass clip_rect.w\n            float x1 = x + glyph->X0 * scale;\n            float x2 = x + glyph->X1 * scale;\n            float y1 = y + glyph->Y0 * scale;\n            float y2 = y + glyph->Y1 * scale;\n            if (x1 <= clip_rect.z && x2 >= clip_rect.x)\n            {\n                // Render a character\n                float u1 = glyph->U0;\n                float v1 = glyph->V0;\n                float u2 = glyph->U1;\n                float v2 = glyph->V1;\n\n                // CPU side clipping used to fit text in their frame when the frame is too small. Only does clipping for axis aligned quads.\n                if (cpu_fine_clip)\n                {\n                    if (x1 < clip_rect.x)\n                    {\n                        u1 = u1 + (1.0f - (x2 - clip_rect.x) / (x2 - x1)) * (u2 - u1);\n                        x1 = clip_rect.x;\n                    }\n                    if (y1 < clip_rect.y)\n                    {\n                        v1 = v1 + (1.0f - (y2 - clip_rect.y) / (y2 - y1)) * (v2 - v1);\n                        y1 = clip_rect.y;\n                    }\n                    if (x2 > clip_rect.z)\n                    {\n                        u2 = u1 + ((clip_rect.z - x1) / (x2 - x1)) * (u2 - u1);\n                        x2 = clip_rect.z;\n                    }\n                    if (y2 > clip_rect.w)\n                    {\n                        v2 = v1 + ((clip_rect.w - y1) / (y2 - y1)) * (v2 - v1);\n                        y2 = clip_rect.w;\n                    }\n                    if (y1 >= y2)\n                    {\n                        x += char_width;\n                        continue;\n                    }\n                }\n\n                // Support for untinted glyphs\n                ImU32 glyph_col = glyph->Colored ? col_untinted : col;\n\n                // We are NOT calling PrimRectUV() here because non-inlined causes too much overhead in a debug builds. Inlined here:\n                {\n                    idx_write[0] = (ImDrawIdx)(vtx_current_idx); idx_write[1] = (ImDrawIdx)(vtx_current_idx+1); idx_write[2] = (ImDrawIdx)(vtx_current_idx+2);\n                    idx_write[3] = (ImDrawIdx)(vtx_current_idx); idx_write[4] = (ImDrawIdx)(vtx_current_idx+2); idx_write[5] = (ImDrawIdx)(vtx_current_idx+3);\n                    vtx_write[0].pos.x = x1; vtx_write[0].pos.y = y1; vtx_write[0].col = glyph_col; vtx_write[0].uv.x = u1; vtx_write[0].uv.y = v1;\n                    vtx_write[1].pos.x = x2; vtx_write[1].pos.y = y1; vtx_write[1].col = glyph_col; vtx_write[1].uv.x = u2; vtx_write[1].uv.y = v1;\n                    vtx_write[2].pos.x = x2; vtx_write[2].pos.y = y2; vtx_write[2].col = glyph_col; vtx_write[2].uv.x = u2; vtx_write[2].uv.y = v2;\n                    vtx_write[3].pos.x = x1; vtx_write[3].pos.y = y2; vtx_write[3].col = glyph_col; vtx_write[3].uv.x = u1; vtx_write[3].uv.y = v2;\n                    vtx_write += 4;\n                    vtx_current_idx += 4;\n                    idx_write += 6;\n                }\n            }\n        }\n        x += char_width;\n    }\n\n    // Give back unused vertices (clipped ones, blanks) ~ this is essentially a PrimUnreserve() action.\n    draw_list->VtxBuffer.Size = (int)(vtx_write - draw_list->VtxBuffer.Data); // Same as calling shrink()\n    draw_list->IdxBuffer.Size = (int)(idx_write - draw_list->IdxBuffer.Data);\n    draw_list->CmdBuffer[draw_list->CmdBuffer.Size - 1].ElemCount -= (idx_expected_size - draw_list->IdxBuffer.Size);\n    draw_list->_VtxWritePtr = vtx_write;\n    draw_list->_IdxWritePtr = idx_write;\n    draw_list->_VtxCurrentIdx = vtx_current_idx;\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] ImGui Internal Render Helpers\n//-----------------------------------------------------------------------------\n// Vaguely redesigned to stop accessing ImGui global state:\n// - RenderArrow()\n// - RenderBullet()\n// - RenderCheckMark()\n// - RenderMouseCursor()\n// - RenderArrowPointingAt()\n// - RenderRectFilledRangeH()\n// - RenderRectFilledWithHole()\n//-----------------------------------------------------------------------------\n// Function in need of a redesign (legacy mess)\n// - RenderColorRectWithAlphaCheckerboard()\n//-----------------------------------------------------------------------------\n\n// Render an arrow aimed to be aligned with text (p_min is a position in the same space text would be positioned). To e.g. denote expanded/collapsed state\nvoid ImGui::RenderArrow(ImDrawList* draw_list, ImVec2 pos, ImU32 col, ImGuiDir dir, float scale)\n{\n    const float h = draw_list->_Data->FontSize * 1.00f;\n    float r = h * 0.40f * scale;\n    ImVec2 center = pos + ImVec2(h * 0.50f, h * 0.50f * scale);\n\n    ImVec2 a, b, c;\n    switch (dir)\n    {\n    case ImGuiDir_Up:\n    case ImGuiDir_Down:\n        if (dir == ImGuiDir_Up) r = -r;\n        a = ImVec2(+0.000f, +0.750f) * r;\n        b = ImVec2(-0.866f, -0.750f) * r;\n        c = ImVec2(+0.866f, -0.750f) * r;\n        break;\n    case ImGuiDir_Left:\n    case ImGuiDir_Right:\n        if (dir == ImGuiDir_Left) r = -r;\n        a = ImVec2(+0.750f, +0.000f) * r;\n        b = ImVec2(-0.750f, +0.866f) * r;\n        c = ImVec2(-0.750f, -0.866f) * r;\n        break;\n    case ImGuiDir_None:\n    case ImGuiDir_COUNT:\n        IM_ASSERT(0);\n        break;\n    }\n    draw_list->AddTriangleFilled(center + a, center + b, center + c, col);\n}\n\nvoid ImGui::RenderBullet(ImDrawList* draw_list, ImVec2 pos, ImU32 col)\n{\n    draw_list->AddCircleFilled(pos, draw_list->_Data->FontSize * 0.20f, col, 8);\n}\n\nvoid ImGui::RenderCheckMark(ImDrawList* draw_list, ImVec2 pos, ImU32 col, float sz)\n{\n    float thickness = ImMax(sz / 5.0f, 1.0f);\n    sz -= thickness * 0.5f;\n    pos += ImVec2(thickness * 0.25f, thickness * 0.25f);\n\n    float third = sz / 3.0f;\n    float bx = pos.x + third;\n    float by = pos.y + sz - third * 0.5f;\n    draw_list->PathLineTo(ImVec2(bx - third, by - third));\n    draw_list->PathLineTo(ImVec2(bx, by));\n    draw_list->PathLineTo(ImVec2(bx + third * 2.0f, by - third * 2.0f));\n    draw_list->PathStroke(col, 0, thickness);\n}\n\nvoid ImGui::RenderMouseCursor(ImDrawList* draw_list, ImVec2 pos, float scale, ImGuiMouseCursor mouse_cursor, ImU32 col_fill, ImU32 col_border, ImU32 col_shadow)\n{\n    if (mouse_cursor == ImGuiMouseCursor_None)\n        return;\n    IM_ASSERT(mouse_cursor > ImGuiMouseCursor_None && mouse_cursor < ImGuiMouseCursor_COUNT);\n\n    ImFontAtlas* font_atlas = draw_list->_Data->Font->ContainerAtlas;\n    ImVec2 offset, size, uv[4];\n    if (font_atlas->GetMouseCursorTexData(mouse_cursor, &offset, &size, &uv[0], &uv[2]))\n    {\n        pos -= offset;\n        ImTextureID tex_id = font_atlas->TexID;\n        draw_list->PushTextureID(tex_id);\n        draw_list->AddImage(tex_id, pos + ImVec2(1, 0) * scale, pos + (ImVec2(1, 0) + size) * scale,    uv[2], uv[3], col_shadow);\n        draw_list->AddImage(tex_id, pos + ImVec2(2, 0) * scale, pos + (ImVec2(2, 0) + size) * scale,    uv[2], uv[3], col_shadow);\n        draw_list->AddImage(tex_id, pos,                        pos + size * scale,                     uv[2], uv[3], col_border);\n        draw_list->AddImage(tex_id, pos,                        pos + size * scale,                     uv[0], uv[1], col_fill);\n        draw_list->PopTextureID();\n    }\n}\n\n// Render an arrow. 'pos' is position of the arrow tip. half_sz.x is length from base to tip. half_sz.y is length on each side.\nvoid ImGui::RenderArrowPointingAt(ImDrawList* draw_list, ImVec2 pos, ImVec2 half_sz, ImGuiDir direction, ImU32 col)\n{\n    switch (direction)\n    {\n    case ImGuiDir_Left:  draw_list->AddTriangleFilled(ImVec2(pos.x + half_sz.x, pos.y - half_sz.y), ImVec2(pos.x + half_sz.x, pos.y + half_sz.y), pos, col); return;\n    case ImGuiDir_Right: draw_list->AddTriangleFilled(ImVec2(pos.x - half_sz.x, pos.y + half_sz.y), ImVec2(pos.x - half_sz.x, pos.y - half_sz.y), pos, col); return;\n    case ImGuiDir_Up:    draw_list->AddTriangleFilled(ImVec2(pos.x + half_sz.x, pos.y + half_sz.y), ImVec2(pos.x - half_sz.x, pos.y + half_sz.y), pos, col); return;\n    case ImGuiDir_Down:  draw_list->AddTriangleFilled(ImVec2(pos.x - half_sz.x, pos.y - half_sz.y), ImVec2(pos.x + half_sz.x, pos.y - half_sz.y), pos, col); return;\n    case ImGuiDir_None: case ImGuiDir_COUNT: break; // Fix warnings\n    }\n}\n\nstatic inline float ImAcos01(float x)\n{\n    if (x <= 0.0f) return IM_PI * 0.5f;\n    if (x >= 1.0f) return 0.0f;\n    return ImAcos(x);\n    //return (-0.69813170079773212f * x * x - 0.87266462599716477f) * x + 1.5707963267948966f; // Cheap approximation, may be enough for what we do.\n}\n\n// FIXME: Cleanup and move code to ImDrawList.\nvoid ImGui::RenderRectFilledRangeH(ImDrawList* draw_list, const ImRect& rect, ImU32 col, float x_start_norm, float x_end_norm, float rounding)\n{\n    if (x_end_norm == x_start_norm)\n        return;\n    if (x_start_norm > x_end_norm)\n        ImSwap(x_start_norm, x_end_norm);\n\n    ImVec2 p0 = ImVec2(ImLerp(rect.Min.x, rect.Max.x, x_start_norm), rect.Min.y);\n    ImVec2 p1 = ImVec2(ImLerp(rect.Min.x, rect.Max.x, x_end_norm), rect.Max.y);\n    if (rounding == 0.0f)\n    {\n        draw_list->AddRectFilled(p0, p1, col, 0.0f);\n        return;\n    }\n\n    rounding = ImClamp(ImMin((rect.Max.x - rect.Min.x) * 0.5f, (rect.Max.y - rect.Min.y) * 0.5f) - 1.0f, 0.0f, rounding);\n    const float inv_rounding = 1.0f / rounding;\n    const float arc0_b = ImAcos01(1.0f - (p0.x - rect.Min.x) * inv_rounding);\n    const float arc0_e = ImAcos01(1.0f - (p1.x - rect.Min.x) * inv_rounding);\n    const float half_pi = IM_PI * 0.5f; // We will == compare to this because we know this is the exact value ImAcos01 can return.\n    const float x0 = ImMax(p0.x, rect.Min.x + rounding);\n    if (arc0_b == arc0_e)\n    {\n        draw_list->PathLineTo(ImVec2(x0, p1.y));\n        draw_list->PathLineTo(ImVec2(x0, p0.y));\n    }\n    else if (arc0_b == 0.0f && arc0_e == half_pi)\n    {\n        draw_list->PathArcToFast(ImVec2(x0, p1.y - rounding), rounding, 3, 6); // BL\n        draw_list->PathArcToFast(ImVec2(x0, p0.y + rounding), rounding, 6, 9); // TR\n    }\n    else\n    {\n        draw_list->PathArcTo(ImVec2(x0, p1.y - rounding), rounding, IM_PI - arc0_e, IM_PI - arc0_b, 3); // BL\n        draw_list->PathArcTo(ImVec2(x0, p0.y + rounding), rounding, IM_PI + arc0_b, IM_PI + arc0_e, 3); // TR\n    }\n    if (p1.x > rect.Min.x + rounding)\n    {\n        const float arc1_b = ImAcos01(1.0f - (rect.Max.x - p1.x) * inv_rounding);\n        const float arc1_e = ImAcos01(1.0f - (rect.Max.x - p0.x) * inv_rounding);\n        const float x1 = ImMin(p1.x, rect.Max.x - rounding);\n        if (arc1_b == arc1_e)\n        {\n            draw_list->PathLineTo(ImVec2(x1, p0.y));\n            draw_list->PathLineTo(ImVec2(x1, p1.y));\n        }\n        else if (arc1_b == 0.0f && arc1_e == half_pi)\n        {\n            draw_list->PathArcToFast(ImVec2(x1, p0.y + rounding), rounding, 9, 12); // TR\n            draw_list->PathArcToFast(ImVec2(x1, p1.y - rounding), rounding, 0, 3);  // BR\n        }\n        else\n        {\n            draw_list->PathArcTo(ImVec2(x1, p0.y + rounding), rounding, -arc1_e, -arc1_b, 3); // TR\n            draw_list->PathArcTo(ImVec2(x1, p1.y - rounding), rounding, +arc1_b, +arc1_e, 3); // BR\n        }\n    }\n    draw_list->PathFillConvex(col);\n}\n\nvoid ImGui::RenderRectFilledWithHole(ImDrawList* draw_list, ImRect outer, ImRect inner, ImU32 col, float rounding)\n{\n    const bool fill_L = (inner.Min.x > outer.Min.x);\n    const bool fill_R = (inner.Max.x < outer.Max.x);\n    const bool fill_U = (inner.Min.y > outer.Min.y);\n    const bool fill_D = (inner.Max.y < outer.Max.y);\n    if (fill_L) draw_list->AddRectFilled(ImVec2(outer.Min.x, inner.Min.y), ImVec2(inner.Min.x, inner.Max.y), col, rounding, (fill_U ? 0 : ImDrawFlags_RoundCornersTopLeft)  | (fill_D ? 0 : ImDrawFlags_RoundCornersBottomLeft));\n    if (fill_R) draw_list->AddRectFilled(ImVec2(inner.Max.x, inner.Min.y), ImVec2(outer.Max.x, inner.Max.y), col, rounding, (fill_U ? 0 : ImDrawFlags_RoundCornersTopRight) | (fill_D ? 0 : ImDrawFlags_RoundCornersBottomRight));\n    if (fill_U) draw_list->AddRectFilled(ImVec2(inner.Min.x, outer.Min.y), ImVec2(inner.Max.x, inner.Min.y), col, rounding, (fill_L ? 0 : ImDrawFlags_RoundCornersTopLeft)  | (fill_R ? 0 : ImDrawFlags_RoundCornersTopRight));\n    if (fill_D) draw_list->AddRectFilled(ImVec2(inner.Min.x, inner.Max.y), ImVec2(inner.Max.x, outer.Max.y), col, rounding, (fill_L ? 0 : ImDrawFlags_RoundCornersBottomLeft)  | (fill_R ? 0 : ImDrawFlags_RoundCornersBottomRight));\n    if (fill_L && fill_U) draw_list->AddRectFilled(ImVec2(outer.Min.x, outer.Min.y), ImVec2(inner.Min.x, inner.Min.y), col, rounding, ImDrawFlags_RoundCornersTopLeft);\n    if (fill_R && fill_U) draw_list->AddRectFilled(ImVec2(inner.Max.x, outer.Min.y), ImVec2(outer.Max.x, inner.Min.y), col, rounding, ImDrawFlags_RoundCornersTopRight);\n    if (fill_L && fill_D) draw_list->AddRectFilled(ImVec2(outer.Min.x, inner.Max.y), ImVec2(inner.Min.x, outer.Max.y), col, rounding, ImDrawFlags_RoundCornersBottomLeft);\n    if (fill_R && fill_D) draw_list->AddRectFilled(ImVec2(inner.Max.x, inner.Max.y), ImVec2(outer.Max.x, outer.Max.y), col, rounding, ImDrawFlags_RoundCornersBottomRight);\n}\n\n// Helper for ColorPicker4()\n// NB: This is rather brittle and will show artifact when rounding this enabled if rounded corners overlap multiple cells. Caller currently responsible for avoiding that.\n// Spent a non reasonable amount of time trying to getting this right for ColorButton with rounding+anti-aliasing+ImGuiColorEditFlags_HalfAlphaPreview flag + various grid sizes and offsets, and eventually gave up... probably more reasonable to disable rounding altogether.\n// FIXME: uses ImGui::GetColorU32\nvoid ImGui::RenderColorRectWithAlphaCheckerboard(ImDrawList* draw_list, ImVec2 p_min, ImVec2 p_max, ImU32 col, float grid_step, ImVec2 grid_off, float rounding, ImDrawFlags flags)\n{\n    if ((flags & ImDrawFlags_RoundCornersMask_) == 0)\n        flags = ImDrawFlags_RoundCornersDefault_;\n    if (((col & IM_COL32_A_MASK) >> IM_COL32_A_SHIFT) < 0xFF)\n    {\n        ImU32 col_bg1 = GetColorU32(ImAlphaBlendColors(IM_COL32(204, 204, 204, 255), col));\n        ImU32 col_bg2 = GetColorU32(ImAlphaBlendColors(IM_COL32(128, 128, 128, 255), col));\n        draw_list->AddRectFilled(p_min, p_max, col_bg1, rounding, flags);\n\n        int yi = 0;\n        for (float y = p_min.y + grid_off.y; y < p_max.y; y += grid_step, yi++)\n        {\n            float y1 = ImClamp(y, p_min.y, p_max.y), y2 = ImMin(y + grid_step, p_max.y);\n            if (y2 <= y1)\n                continue;\n            for (float x = p_min.x + grid_off.x + (yi & 1) * grid_step; x < p_max.x; x += grid_step * 2.0f)\n            {\n                float x1 = ImClamp(x, p_min.x, p_max.x), x2 = ImMin(x + grid_step, p_max.x);\n                if (x2 <= x1)\n                    continue;\n                ImDrawFlags cell_flags = ImDrawFlags_RoundCornersNone;\n                if (y1 <= p_min.y) { if (x1 <= p_min.x) cell_flags |= ImDrawFlags_RoundCornersTopLeft; if (x2 >= p_max.x) cell_flags |= ImDrawFlags_RoundCornersTopRight; }\n                if (y2 >= p_max.y) { if (x1 <= p_min.x) cell_flags |= ImDrawFlags_RoundCornersBottomLeft; if (x2 >= p_max.x) cell_flags |= ImDrawFlags_RoundCornersBottomRight; }\n\n                // Combine flags\n                cell_flags = (flags == ImDrawFlags_RoundCornersNone || cell_flags == ImDrawFlags_RoundCornersNone) ? ImDrawFlags_RoundCornersNone : (cell_flags & flags);\n                draw_list->AddRectFilled(ImVec2(x1, y1), ImVec2(x2, y2), col_bg2, rounding, cell_flags);\n            }\n        }\n    }\n    else\n    {\n        draw_list->AddRectFilled(p_min, p_max, col, rounding, flags);\n    }\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] Decompression code\n//-----------------------------------------------------------------------------\n// Compressed with stb_compress() then converted to a C array and encoded as base85.\n// Use the program in misc/fonts/binary_to_compressed_c.cpp to create the array from a TTF file.\n// The purpose of encoding as base85 instead of \"0x00,0x01,...\" style is only save on _source code_ size.\n// Decompression from stb.h (public domain) by Sean Barrett https://github.com/nothings/stb/blob/master/stb.h\n//-----------------------------------------------------------------------------\n\nstatic unsigned int stb_decompress_length(const unsigned char *input)\n{\n    return (input[8] << 24) + (input[9] << 16) + (input[10] << 8) + input[11];\n}\n\nstatic unsigned char *stb__barrier_out_e, *stb__barrier_out_b;\nstatic const unsigned char *stb__barrier_in_b;\nstatic unsigned char *stb__dout;\nstatic void stb__match(const unsigned char *data, unsigned int length)\n{\n    // INVERSE of memmove... write each byte before copying the next...\n    IM_ASSERT(stb__dout + length <= stb__barrier_out_e);\n    if (stb__dout + length > stb__barrier_out_e) { stb__dout += length; return; }\n    if (data < stb__barrier_out_b) { stb__dout = stb__barrier_out_e+1; return; }\n    while (length--) *stb__dout++ = *data++;\n}\n\nstatic void stb__lit(const unsigned char *data, unsigned int length)\n{\n    IM_ASSERT(stb__dout + length <= stb__barrier_out_e);\n    if (stb__dout + length > stb__barrier_out_e) { stb__dout += length; return; }\n    if (data < stb__barrier_in_b) { stb__dout = stb__barrier_out_e+1; return; }\n    memcpy(stb__dout, data, length);\n    stb__dout += length;\n}\n\n#define stb__in2(x)   ((i[x] << 8) + i[(x)+1])\n#define stb__in3(x)   ((i[x] << 16) + stb__in2((x)+1))\n#define stb__in4(x)   ((i[x] << 24) + stb__in3((x)+1))\n\nstatic const unsigned char *stb_decompress_token(const unsigned char *i)\n{\n    if (*i >= 0x20) { // use fewer if's for cases that expand small\n        if (*i >= 0x80)       stb__match(stb__dout-i[1]-1, i[0] - 0x80 + 1), i += 2;\n        else if (*i >= 0x40)  stb__match(stb__dout-(stb__in2(0) - 0x4000 + 1), i[2]+1), i += 3;\n        else /* *i >= 0x20 */ stb__lit(i+1, i[0] - 0x20 + 1), i += 1 + (i[0] - 0x20 + 1);\n    } else { // more ifs for cases that expand large, since overhead is amortized\n        if (*i >= 0x18)       stb__match(stb__dout-(stb__in3(0) - 0x180000 + 1), i[3]+1), i += 4;\n        else if (*i >= 0x10)  stb__match(stb__dout-(stb__in3(0) - 0x100000 + 1), stb__in2(3)+1), i += 5;\n        else if (*i >= 0x08)  stb__lit(i+2, stb__in2(0) - 0x0800 + 1), i += 2 + (stb__in2(0) - 0x0800 + 1);\n        else if (*i == 0x07)  stb__lit(i+3, stb__in2(1) + 1), i += 3 + (stb__in2(1) + 1);\n        else if (*i == 0x06)  stb__match(stb__dout-(stb__in3(1)+1), i[4]+1), i += 5;\n        else if (*i == 0x04)  stb__match(stb__dout-(stb__in3(1)+1), stb__in2(4)+1), i += 6;\n    }\n    return i;\n}\n\nstatic unsigned int stb_adler32(unsigned int adler32, unsigned char *buffer, unsigned int buflen)\n{\n    const unsigned long ADLER_MOD = 65521;\n    unsigned long s1 = adler32 & 0xffff, s2 = adler32 >> 16;\n    unsigned long blocklen = buflen % 5552;\n\n    unsigned long i;\n    while (buflen) {\n        for (i=0; i + 7 < blocklen; i += 8) {\n            s1 += buffer[0], s2 += s1;\n            s1 += buffer[1], s2 += s1;\n            s1 += buffer[2], s2 += s1;\n            s1 += buffer[3], s2 += s1;\n            s1 += buffer[4], s2 += s1;\n            s1 += buffer[5], s2 += s1;\n            s1 += buffer[6], s2 += s1;\n            s1 += buffer[7], s2 += s1;\n\n            buffer += 8;\n        }\n\n        for (; i < blocklen; ++i)\n            s1 += *buffer++, s2 += s1;\n\n        s1 %= ADLER_MOD, s2 %= ADLER_MOD;\n        buflen -= blocklen;\n        blocklen = 5552;\n    }\n    return (unsigned int)(s2 << 16) + (unsigned int)s1;\n}\n\nstatic unsigned int stb_decompress(unsigned char *output, const unsigned char *i, unsigned int /*length*/)\n{\n    if (stb__in4(0) != 0x57bC0000) return 0;\n    if (stb__in4(4) != 0)          return 0; // error! stream is > 4GB\n    const unsigned int olen = stb_decompress_length(i);\n    stb__barrier_in_b = i;\n    stb__barrier_out_e = output + olen;\n    stb__barrier_out_b = output;\n    i += 16;\n\n    stb__dout = output;\n    for (;;) {\n        const unsigned char *old_i = i;\n        i = stb_decompress_token(i);\n        if (i == old_i) {\n            if (*i == 0x05 && i[1] == 0xfa) {\n                IM_ASSERT(stb__dout == output + olen);\n                if (stb__dout != output + olen) return 0;\n                if (stb_adler32(1, output, olen) != (unsigned int) stb__in4(2))\n                    return 0;\n                return olen;\n            } else {\n                IM_ASSERT(0); /* NOTREACHED */\n                return 0;\n            }\n        }\n        IM_ASSERT(stb__dout <= output + olen);\n        if (stb__dout > output + olen)\n            return 0;\n    }\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] Default font data (ProggyClean.ttf)\n//-----------------------------------------------------------------------------\n// ProggyClean.ttf\n// Copyright (c) 2004, 2005 Tristan Grimmer\n// MIT license (see License.txt in http://www.upperbounds.net/download/ProggyClean.ttf.zip)\n// Download and more information at http://upperbounds.net\n//-----------------------------------------------------------------------------\n// File: 'ProggyClean.ttf' (41208 bytes)\n// Exported using misc/fonts/binary_to_compressed_c.cpp (with compression + base85 string encoding).\n// The purpose of encoding as base85 instead of \"0x00,0x01,...\" style is only save on _source code_ size.\n//-----------------------------------------------------------------------------\nstatic const char proggy_clean_ttf_compressed_data_base85[11980 + 1] =\n    \"7])#######hV0qs'/###[),##/l:$#Q6>##5[n42>c-TH`->>#/e>11NNV=Bv(*:.F?uu#(gRU.o0XGH`$vhLG1hxt9?W`#,5LsCp#-i>.r$<$6pD>Lb';9Crc6tgXmKVeU2cD4Eo3R/\"\n    \"2*>]b(MC;$jPfY.;h^`IWM9<Lh2TlS+f-s$o6Q<BWH`YiU.xfLq$N;$0iR/GX:U(jcW2p/W*q?-qmnUCI;jHSAiFWM.R*kU@C=GH?a9wp8f$e.-4^Qg1)Q-GL(lf(r/7GrRgwV%MS=C#\"\n    \"`8ND>Qo#t'X#(v#Y9w0#1D$CIf;W'#pWUPXOuxXuU(H9M(1<q-UE31#^-V'8IRUo7Qf./L>=Ke$$'5F%)]0^#0X@U.a<r:QLtFsLcL6##lOj)#.Y5<-R&KgLwqJfLgN&;Q?gI^#DY2uL\"\n    \"i@^rMl9t=cWq6##weg>$FBjVQTSDgEKnIS7EM9>ZY9w0#L;>>#Mx&4Mvt//L[MkA#W@lK.N'[0#7RL_&#w+F%HtG9M#XL`N&.,GM4Pg;-<nLENhvx>-VsM.M0rJfLH2eTM`*oJMHRC`N\"\n    \"kfimM2J,W-jXS:)r0wK#@Fge$U>`w'N7G#$#fB#$E^$#:9:hk+eOe--6x)F7*E%?76%^GMHePW-Z5l'&GiF#$956:rS?dA#fiK:)Yr+`&#0j@'DbG&#^$PG.Ll+DNa<XCMKEV*N)LN/N\"\n    \"*b=%Q6pia-Xg8I$<MR&,VdJe$<(7G;Ckl'&hF;;$<_=X(b.RS%%)###MPBuuE1V:v&cX&#2m#(&cV]`k9OhLMbn%s$G2,B$BfD3X*sp5#l,$R#]x_X1xKX%b5U*[r5iMfUo9U`N99hG)\"\n    \"tm+/Us9pG)XPu`<0s-)WTt(gCRxIg(%6sfh=ktMKn3j)<6<b5Sk_/0(^]AaN#(p/L>&VZ>1i%h1S9u5o@YaaW$e+b<TWFn/Z:Oh(Cx2$lNEoN^e)#CFY@@I;BOQ*sRwZtZxRcU7uW6CX\"\n    \"ow0i(?$Q[cjOd[P4d)]>ROPOpxTO7Stwi1::iB1q)C_=dV26J;2,]7op$]uQr@_V7$q^%lQwtuHY]=DX,n3L#0PHDO4f9>dC@O>HBuKPpP*E,N+b3L#lpR/MrTEH.IAQk.a>D[.e;mc.\"\n    \"x]Ip.PH^'/aqUO/$1WxLoW0[iLA<QT;5HKD+@qQ'NQ(3_PLhE48R.qAPSwQ0/WK?Z,[x?-J;jQTWA0X@KJ(_Y8N-:/M74:/-ZpKrUss?d#dZq]DAbkU*JqkL+nwX@@47`5>w=4h(9.`G\"\n    \"CRUxHPeR`5Mjol(dUWxZa(>STrPkrJiWx`5U7F#.g*jrohGg`cg:lSTvEY/EV_7H4Q9[Z%cnv;JQYZ5q.l7Zeas:HOIZOB?G<Nald$qs]@]L<J7bR*>gv:[7MI2k).'2($5FNP&EQ(,)\"\n    \"U]W]+fh18.vsai00);D3@4ku5P?DP8aJt+;qUM]=+b'8@;mViBKx0DE[-auGl8:PJ&Dj+M6OC]O^((##]`0i)drT;-7X`=-H3[igUnPG-NZlo.#k@h#=Ork$m>a>$-?Tm$UV(?#P6YY#\"\n    \"'/###xe7q.73rI3*pP/$1>s9)W,JrM7SN]'/4C#v$U`0#V.[0>xQsH$fEmPMgY2u7Kh(G%siIfLSoS+MK2eTM$=5,M8p`A.;_R%#u[K#$x4AG8.kK/HSB==-'Ie/QTtG?-.*^N-4B/ZM\"\n    \"_3YlQC7(p7q)&](`6_c)$/*JL(L-^(]$wIM`dPtOdGA,U3:w2M-0<q-]L_?^)1vw'.,MRsqVr.L;aN&#/EgJ)PBc[-f>+WomX2u7lqM2iEumMTcsF?-aT=Z-97UEnXglEn1K-bnEO`gu\"\n    \"Ft(c%=;Am_Qs@jLooI&NX;]0#j4#F14;gl8-GQpgwhrq8'=l_f-b49'UOqkLu7-##oDY2L(te+Mch&gLYtJ,MEtJfLh'x'M=$CS-ZZ%P]8bZ>#S?YY#%Q&q'3^Fw&?D)UDNrocM3A76/\"\n    \"/oL?#h7gl85[qW/NDOk%16ij;+:1a'iNIdb-ou8.P*w,v5#EI$TWS>Pot-R*H'-SEpA:g)f+O$%%`kA#G=8RMmG1&O`>to8bC]T&$,n.LoO>29sp3dt-52U%VM#q7'DHpg+#Z9%H[K<L\"\n    \"%a2E-grWVM3@2=-k22tL]4$##6We'8UJCKE[d_=%wI;'6X-GsLX4j^SgJ$##R*w,vP3wK#iiW&#*h^D&R?jp7+/u&#(AP##XU8c$fSYW-J95_-Dp[g9wcO&#M-h1OcJlc-*vpw0xUX&#\"\n    \"OQFKNX@QI'IoPp7nb,QU//MQ&ZDkKP)X<WSVL(68uVl&#c'[0#(s1X&xm$Y%B7*K:eDA323j998GXbA#pwMs-jgD$9QISB-A_(aN4xoFM^@C58D0+Q+q3n0#3U1InDjF682-SjMXJK)(\"\n    \"h$hxua_K]ul92%'BOU&#BRRh-slg8KDlr:%L71Ka:.A;%YULjDPmL<LYs8i#XwJOYaKPKc1h:'9Ke,g)b),78=I39B;xiY$bgGw-&.Zi9InXDuYa%G*f2Bq7mn9^#p1vv%#(Wi-;/Z5h\"\n    \"o;#2:;%d&#x9v68C5g?ntX0X)pT`;%pB3q7mgGN)3%(P8nTd5L7GeA-GL@+%J3u2:(Yf>et`e;)f#Km8&+DC$I46>#Kr]]u-[=99tts1.qb#q72g1WJO81q+eN'03'eM>&1XxY-caEnO\"\n    \"j%2n8)),?ILR5^.Ibn<-X-Mq7[a82Lq:F&#ce+S9wsCK*x`569E8ew'He]h:sI[2LM$[guka3ZRd6:t%IG:;$%YiJ:Nq=?eAw;/:nnDq0(CYcMpG)qLN4$##&J<j$UpK<Q4a1]MupW^-\"\n    \"sj_$%[HK%'F####QRZJ::Y3EGl4'@%FkiAOg#p[##O`gukTfBHagL<LHw%q&OV0##F=6/:chIm0@eCP8X]:kFI%hl8hgO@RcBhS-@Qb$%+m=hPDLg*%K8ln(wcf3/'DW-$.lR?n[nCH-\"\n    \"eXOONTJlh:.RYF%3'p6sq:UIMA945&^HFS87@$EP2iG<-lCO$%c`uKGD3rC$x0BL8aFn--`ke%#HMP'vh1/R&O_J9'um,.<tx[@%wsJk&bUT2`0uMv7gg#qp/ij.L56'hl;.s5CUrxjO\"\n    \"M7-##.l+Au'A&O:-T72L]P`&=;ctp'XScX*rU.>-XTt,%OVU4)S1+R-#dg0/Nn?Ku1^0f$B*P:Rowwm-`0PKjYDDM'3]d39VZHEl4,.j']Pk-M.h^&:0FACm$maq-&sgw0t7/6(^xtk%\"\n    \"LuH88Fj-ekm>GA#_>568x6(OFRl-IZp`&b,_P'$M<Jnq79VsJW/mWS*PUiq76;]/NM_>hLbxfc$mj`,O;&%W2m`Zh:/)Uetw:aJ%]K9h:TcF]u_-Sj9,VK3M.*'&0D[Ca]J9gp8,kAW]\"\n    \"%(?A%R$f<->Zts'^kn=-^@c4%-pY6qI%J%1IGxfLU9CP8cbPlXv);C=b),<2mOvP8up,UVf3839acAWAW-W?#ao/^#%KYo8fRULNd2.>%m]UK:n%r$'sw]J;5pAoO_#2mO3n,'=H5(et\"\n    \"Hg*`+RLgv>=4U8guD$I%D:W>-r5V*%j*W:Kvej.Lp$<M-SGZ':+Q_k+uvOSLiEo(<aD/K<CCc`'Lx>'?;++O'>()jLR-^u68PHm8ZFWe+ej8h:9r6L*0//c&iH&R8pRbA#Kjm%upV1g:\"\n    \"a_#Ur7FuA#(tRh#.Y5K+@?3<-8m0$PEn;J:rh6?I6uG<-`wMU'ircp0LaE_OtlMb&1#6T.#FDKu#1Lw%u%+GM+X'e?YLfjM[VO0MbuFp7;>Q&#WIo)0@F%q7c#4XAXN-U&VB<HFF*qL(\"\n    \"$/V,;(kXZejWO`<[5?\\?ewY(*9=%wDc;,u<'9t3W-(H1th3+G]ucQ]kLs7df($/*JL]@*t7Bu_G3_7mp7<iaQjO@.kLg;x3B0lqp7Hf,^Ze7-##@/c58Mo(3;knp0%)A7?-W+eI'o8)b<\"\n    \"nKnw'Ho8C=Y>pqB>0ie&jhZ[?iLR@@_AvA-iQC(=ksRZRVp7`.=+NpBC%rh&3]R:8XDmE5^V8O(x<<aG/1N$#FX$0V5Y6x'aErI3I$7x%E`v<-BY,)%-?Psf*l?%C3.mM(=/M0:JxG'?\"\n    \"7WhH%o'a<-80g0NBxoO(GH<dM]n.+%q@jH?f.UsJ2Ggs&4<-e47&Kl+f//9@`b+?.TeN_&B8Ss?v;^Trk;f#YvJkl&w$]>-+k?'(<S:68tq*WoDfZu';mM?8X[ma8W%*`-=;D.(nc7/;\"\n    \")g:T1=^J$&BRV(-lTmNB6xqB[@0*o.erM*<SWF]u2=st-*(6v>^](H.aREZSi,#1:[IXaZFOm<-ui#qUq2$##Ri;u75OK#(RtaW-K-F`S+cF]uN`-KMQ%rP/Xri.LRcB##=YL3BgM/3M\"\n    \"D?@f&1'BW-)Ju<L25gl8uhVm1hL$##*8###'A3/LkKW+(^rWX?5W_8g)a(m&K8P>#bmmWCMkk&#TR`C,5d>g)F;t,4:@_l8G/5h4vUd%&%950:VXD'QdWoY-F$BtUwmfe$YqL'8(PWX(\"\n    \"P?^@Po3$##`MSs?DWBZ/S>+4%>fX,VWv/w'KD`LP5IbH;rTV>n3cEK8U#bX]l-/V+^lj3;vlMb&[5YQ8#pekX9JP3XUC72L,,?+Ni&co7ApnO*5NK,((W-i:$,kp'UDAO(G0Sq7MVjJs\"\n    \"bIu)'Z,*[>br5fX^:FPAWr-m2KgL<LUN098kTF&#lvo58=/vjDo;.;)Ka*hLR#/k=rKbxuV`>Q_nN6'8uTG&#1T5g)uLv:873UpTLgH+#FgpH'_o1780Ph8KmxQJ8#H72L4@768@Tm&Q\"\n    \"h4CB/5OvmA&,Q&QbUoi$a_%3M01H)4x7I^&KQVgtFnV+;[Pc>[m4k//,]1?#`VY[Jr*3&&slRfLiVZJ:]?=K3Sw=[$=uRB?3xk48@aeg<Z'<$#4H)6,>e0jT6'N#(q%.O=?2S]u*(m<-\"\n    \"V8J'(1)G][68hW$5'q[GC&5j`TE?m'esFGNRM)j,ffZ?-qx8;->g4t*:CIP/[Qap7/9'#(1sao7w-.qNUdkJ)tCF&#B^;xGvn2r9FEPFFFcL@.iFNkTve$m%#QvQS8U@)2Z+3K:AKM5i\"\n    \"sZ88+dKQ)W6>J%CL<KE>`.d*(B`-n8D9oK<Up]c$X$(,)M8Zt7/[rdkqTgl-0cuGMv'?>-XV1q['-5k'cAZ69e;D_?$ZPP&s^+7])$*$#@QYi9,5P&#9r+$%CE=68>K8r0=dSC%%(@p7\"\n    \".m7jilQ02'0-VWAg<a/''3u.=4L$Y)6k/K:_[3=&jvL<L0C/2'v:^;-DIBW,B4E68:kZ;%?8(Q8BH=kO65BW?xSG&#@uU,DS*,?.+(o(#1vCS8#CHF>TlGW'b)Tq7VT9q^*^$$.:&N@@\"\n    \"$&)WHtPm*5_rO0&e%K&#-30j(E4#'Zb.o/(Tpm$>K'f@[PvFl,hfINTNU6u'0pao7%XUp9]5.>%h`8_=VYbxuel.NTSsJfLacFu3B'lQSu/m6-Oqem8T+oE--$0a/k]uj9EwsG>%veR*\"\n    \"hv^BFpQj:K'#SJ,sB-'#](j.Lg92rTw-*n%@/;39rrJF,l#qV%OrtBeC6/,;qB3ebNW[?,Hqj2L.1NP&GjUR=1D8QaS3Up&@*9wP?+lo7b?@%'k4`p0Z$22%K3+iCZj?XJN4Nm&+YF]u\"\n    \"@-W$U%VEQ/,,>>#)D<h#`)h0:<Q6909ua+&VU%n2:cG3FJ-%@Bj-DgLr`Hw&HAKjKjseK</xKT*)B,N9X3]krc12t'pgTV(Lv-tL[xg_%=M_q7a^x?7Ubd>#%8cY#YZ?=,`Wdxu/ae&#\"\n    \"w6)R89tI#6@s'(6Bf7a&?S=^ZI_kS&ai`&=tE72L_D,;^R)7[$s<Eh#c&)q.MXI%#v9ROa5FZO%sF7q7Nwb&#ptUJ:aqJe$Sl68%.D###EC><?-aF&#RNQv>o8lKN%5/$(vdfq7+ebA#\"\n    \"u1p]ovUKW&Y%q]'>$1@-[xfn$7ZTp7mM,G,Ko7a&Gu%G[RMxJs[0MM%wci.LFDK)(<c`Q8N)jEIF*+?P2a8g%)$q]o2aH8C&<SibC/q,(e:v;-b#6[$NtDZ84Je2KNvB#$P5?tQ3nt(0\"\n    \"d=j.LQf./Ll33+(;q3L-w=8dX$#WF&uIJ@-bfI>%:_i2B5CsR8&9Z&#=mPEnm0f`<&c)QL5uJ#%u%lJj+D-r;BoF&#4DoS97h5g)E#o:&S4weDF,9^Hoe`h*L+_a*NrLW-1pG_&2UdB8\"\n    \"6e%B/:=>)N4xeW.*wft-;$'58-ESqr<b?UI(_%@[P46>#U`'6AQ]m&6/`Z>#S?YY#Vc;r7U2&326d=w&H####?TZ`*4?&.MK?LP8Vxg>$[QXc%QJv92.(Db*B)gb*BM9dM*hJMAo*c&#\"\n    \"b0v=Pjer]$gG&JXDf->'StvU7505l9$AFvgYRI^&<^b68?j#q9QX4SM'RO#&sL1IM.rJfLUAj221]d##DW=m83u5;'bYx,*Sl0hL(W;;$doB&O/TQ:(Z^xBdLjL<Lni;''X.`$#8+1GD\"\n    \":k$YUWsbn8ogh6rxZ2Z9]%nd+>V#*8U_72Lh+2Q8Cj0i:6hp&$C/:p(HK>T8Y[gHQ4`4)'$Ab(Nof%V'8hL&#<NEdtg(n'=S1A(Q1/I&4([%dM`,Iu'1:_hL>SfD07&6D<fp8dHM7/g+\"\n    \"tlPN9J*rKaPct&?'uBCem^jn%9_K)<,C5K3s=5g&GmJb*[SYq7K;TRLGCsM-$$;S%:Y@r7AK0pprpL<Lrh,q7e/%KWK:50I^+m'vi`3?%Zp+<-d+$L-Sv:@.o19n$s0&39;kn;S%BSq*\"\n    \"$3WoJSCLweV[aZ'MQIjO<7;X-X;&+dMLvu#^UsGEC9WEc[X(wI7#2.(F0jV*eZf<-Qv3J-c+J5AlrB#$p(H68LvEA'q3n0#m,[`*8Ft)FcYgEud]CWfm68,(aLA$@EFTgLXoBq/UPlp7\"\n    \":d[/;r_ix=:TF`S5H-b<LI&HY(K=h#)]Lk$K14lVfm:x$H<3^Ql<M`$OhapBnkup'D#L$Pb_`N*g]2e;X/Dtg,bsj&K#2[-:iYr'_wgH)NUIR8a1n#S?Yej'h8^58UbZd+^FKD*T@;6A\"\n    \"7aQC[K8d-(v6GI$x:T<&'Gp5Uf>@M.*J:;$-rv29'M]8qMv-tLp,'886iaC=Hb*YJoKJ,(j%K=H`K.v9HggqBIiZu'QvBT.#=)0ukruV&.)3=(^1`o*Pj4<-<aN((^7('#Z0wK#5GX@7\"\n    \"u][`*S^43933A4rl][`*O4CgLEl]v$1Q3AeF37dbXk,.)vj#x'd`;qgbQR%FW,2(?LO=s%Sc68%NP'##Aotl8x=BE#j1UD([3$M(]UI2LX3RpKN@;/#f'f/&_mt&F)XdF<9t4)Qa.*kT\"\n    \"LwQ'(TTB9.xH'>#MJ+gLq9-##@HuZPN0]u:h7.T..G:;$/Usj(T7`Q8tT72LnYl<-qx8;-HV7Q-&Xdx%1a,hC=0u+HlsV>nuIQL-5<N?)NBS)QN*_I,?&)2'IM%L3I)X((e/dl2&8'<M\"\n    \":^#M*Q+[T.Xri.LYS3v%fF`68h;b-X[/En'CR.q7E)p'/kle2HM,u;^%OKC-N+Ll%F9CF<Nf'^#t2L,;27W:0O@6##U6W7:$rJfLWHj$#)woqBefIZ.PK<b*t7ed;p*_m;4ExK#h@&]>\"\n    \"_>@kXQtMacfD.m-VAb8;IReM3$wf0''hra*so568'Ip&vRs849'MRYSp%:t:h5qSgwpEr$B>Q,;s(C#$)`svQuF$##-D,##,g68@2[T;.XSdN9Qe)rpt._K-#5wF)sP'##p#C0c%-Gb%\"\n    \"hd+<-j'Ai*x&&HMkT]C'OSl##5RG[JXaHN;d'uA#x._U;.`PU@(Z3dt4r152@:v,'R.Sj'w#0<-;kPI)FfJ&#AYJ&#//)>-k=m=*XnK$>=)72L]0I%>.G690a:$##<,);?;72#?x9+d;\"\n    \"^V'9;jY@;)br#q^YQpx:X#Te$Z^'=-=bGhLf:D6&bNwZ9-ZD#n^9HhLMr5G;']d&6'wYmTFmL<LD)F^%[tC'8;+9E#C$g%#5Y>q9wI>P(9mI[>kC-ekLC/R&CH+s'B;K-M6$EB%is00:\"\n    \"+A4[7xks.LrNk0&E)wILYF@2L'0Nb$+pv<(2.768/FrY&h$^3i&@+G%JT'<-,v`3;_)I9M^AE]CN?Cl2AZg+%4iTpT3<n-&%H%b<FDj2M<hH=&Eh<2Len$b*aTX=-8QxN)k11IM1c^j%\"\n    \"9s<L<NFSo)B?+<-(GxsF,^-Eh@$4dXhN$+#rxK8'je'D7k`e;)2pYwPA'_p9&@^18ml1^[@g4t*[JOa*[=Qp7(qJ_oOL^('7fB&Hq-:sf,sNj8xq^>$U4O]GKx'm9)b@p7YsvK3w^YR-\"\n    \"CdQ*:Ir<($u&)#(&?L9Rg3H)4fiEp^iI9O8KnTj,]H?D*r7'M;PwZ9K0E^k&-cpI;.p/6_vwoFMV<->#%Xi.LxVnrU(4&8/P+:hLSKj$#U%]49t'I:rgMi'FL@a:0Y-uA[39',(vbma*\"\n    \"hU%<-SRF`Tt:542R_VV$p@[p8DV[A,?1839FWdF<TddF<9Ah-6&9tWoDlh]&1SpGMq>Ti1O*H&#(AL8[_P%.M>v^-))qOT*F5Cq0`Ye%+$B6i:7@0IX<N+T+0MlMBPQ*Vj>SsD<U4JHY\"\n    \"8kD2)2fU/M#$e.)T4,_=8hLim[&);?UkK'-x?'(:siIfL<$pFM`i<?%W(mGDHM%>iWP,##P`%/L<eXi:@Z9C.7o=@(pXdAO/NLQ8lPl+HPOQa8wD8=^GlPa8TKI1CjhsCTSLJM'/Wl>-\"\n    \"S(qw%sf/@%#B6;/U7K]uZbi^Oc^2n<bhPmUkMw>%t<)'mEVE''n`WnJra$^TKvX5B>;_aSEK',(hwa0:i4G?.Bci.(X[?b*($,=-n<.Q%`(X=?+@Am*Js0&=3bh8K]mL<LoNs'6,'85`\"\n    \"0?t/'_U59@]ddF<#LdF<eWdF<OuN/45rY<-L@&#+fm>69=Lb,OcZV/);TTm8VI;?%OtJ<(b4mq7M6:u?KRdF<gR@2L=FNU-<b[(9c/ML3m;Z[$oF3g)GAWqpARc=<ROu7cL5l;-[A]%/\"\n    \"+fsd;l#SafT/f*W]0=O'$(Tb<[)*@e775R-:Yob%g*>l*:xP?Yb.5)%w_I?7uk5JC+FS(m#i'k.'a0i)9<7b'fs'59hq$*5Uhv##pi^8+hIEBF`nvo`;'l0.^S1<-wUK2/Coh58KKhLj\"\n    \"M=SO*rfO`+qC`W-On.=AJ56>>i2@2LH6A:&5q`?9I3@@'04&p2/LVa*T-4<-i3;M9UvZd+N7>b*eIwg:CC)c<>nO&#<IGe;__.thjZl<%w(Wk2xmp4Q@I#I9,DF]u7-P=.-_:YJ]aS@V\"\n    \"?6*C()dOp7:WL,b&3Rg/.cmM9&r^>$(>.Z-I&J(Q0Hd5Q%7Co-b`-c<N(6r@ip+AurK<m86QIth*#v;-OBqi+L7wDE-Ir8K['m+DDSLwK&/.?-V%U_%3:qKNu$_b*B-kp7NaD'QdWQPK\"\n    \"Yq[@>P)hI;*_F]u`Rb[.j8_Q/<&>uu+VsH$sM9TA%?)(vmJ80),P7E>)tjD%2L=-t#fK[%`v=Q8<FfNkgg^oIbah*#8/Qt$F&:K*-(N/'+1vMB,u()-a.VUU*#[e%gAAO(S>WlA2);Sa\"\n    \">gXm8YB`1d@K#n]76-a$U,mF<fX]idqd)<3,]J7JmW4`6]uks=4-72L(jEk+:bJ0M^q-8Dm_Z?0olP1C9Sa&H[d&c$ooQUj]Exd*3ZM@-WGW2%s',B-_M%>%Ul:#/'xoFM9QX-$.QN'>\"\n    \"[%$Z$uF6pA6Ki2O5:8w*vP1<-1`[G,)-m#>0`P&#eb#.3i)rtB61(o'$?X3B</R90;eZ]%Ncq;-Tl]#F>2Qft^ae_5tKL9MUe9b*sLEQ95C&`=G?@Mj=wh*'3E>=-<)Gt*Iw)'QG:`@I\"\n    \"wOf7&]1i'S01B+Ev/Nac#9S;=;YQpg_6U`*kVY39xK,[/6Aj7:'1Bm-_1EYfa1+o&o4hp7KN_Q(OlIo@S%;jVdn0'1<Vc52=u`3^o-n1'g4v58Hj&6_t7$##?M)c<$bgQ_'SY((-xkA#\"\n    \"Y(,p'H9rIVY-b,'%bCPF7.J<Up^,(dU1VY*5#WkTU>h19w,WQhLI)3S#f$2(eb,jr*b;3Vw]*7NH%$c4Vs,eD9>XW8?N]o+(*pgC%/72LV-u<Hp,3@e^9UB1J+ak9-TN/mhKPg+AJYd$\"\n    \"MlvAF_jCK*.O-^(63adMT->W%iewS8W6m2rtCpo'RS1R84=@paTKt)>=%&1[)*vp'u+x,VrwN;&]kuO9JDbg=pO$J*.jVe;u'm0dr9l,<*wMK*Oe=g8lV_KEBFkO'oU]^=[-792#ok,)\"\n    \"i]lR8qQ2oA8wcRCZ^7w/Njh;?.stX?Q1>S1q4Bn$)K1<-rGdO'$Wr.Lc.CG)$/*JL4tNR/,SVO3,aUw'DJN:)Ss;wGn9A32ijw%FL+Z0Fn.U9;reSq)bmI32U==5ALuG&#Vf1398/pVo\"\n    \"1*c-(aY168o<`JsSbk-,1N;$>0:OUas(3:8Z972LSfF8eb=c-;>SPw7.6hn3m`9^Xkn(r.qS[0;T%&Qc=+STRxX'q1BNk3&*eu2;&8q$&x>Q#Q7^Tf+6<(d%ZVmj2bDi%.3L2n+4W'$P\"\n    \"iDDG)g,r%+?,$@?uou5tSe2aN_AQU*<h`e-GI7)?OK2A.d7_c)?wQ5AS@DL3r#7fSkgl6-++D:'A,uq7SvlB$pcpH'q3n0#_%dY#xCpr-l<F0NR@-##FEV6NTF6##$l84N1w?AO>'IAO\"\n    \"URQ##V^Fv-XFbGM7Fl(N<3DhLGF%q.1rC$#:T__&Pi68%0xi_&[qFJ(77j_&JWoF.V735&T,[R*:xFR*K5>>#`bW-?4Ne_&6Ne_&6Ne_&n`kr-#GJcM6X;uM6X;uM(.a..^2TkL%oR(#\"\n    \";u.T%fAr%4tJ8&><1=GHZ_+m9/#H1F^R#SC#*N=BA9(D?v[UiFY>>^8p,KKF.W]L29uLkLlu/+4T<XoIB&hx=T1PcDaB&;HH+-AFr?(m9HZV)FKS8JCw;SD=6[^/DZUL`EUDf]GGlG&>\"\n    \"w$)F./^n3+rlo+DB;5sIYGNk+i1t-69Jg--0pao7Sm#K)pdHW&;LuDNH@H>#/X-TI(;P>#,Gc>#0Su>#4`1?#8lC?#<xU?#@.i?#D:%@#HF7@#LRI@#P_[@#Tkn@#Xw*A#]-=A#a9OA#\"\n    \"d<F&#*;G##.GY##2Sl##6`($#:l:$#>xL$#B.`$#F:r$#JF.%#NR@%#R_R%#Vke%#Zww%#_-4&#3^Rh%Sflr-k'MS.o?.5/sWel/wpEM0%3'/1)K^f1-d>G21&v(35>V`39V7A4=onx4\"\n    \"A1OY5EI0;6Ibgr6M$HS7Q<)58C5w,;WoA*#[%T*#`1g*#d=#+#hI5+#lUG+#pbY+#tnl+#x$),#&1;,#*=M,#.I`,#2Ur,#6b.-#;w[H#iQtA#m^0B#qjBB#uvTB##-hB#'9$C#+E6C#\"\n    \"/QHC#3^ZC#7jmC#;v)D#?,<D#C8ND#GDaD#KPsD#O]/E#g1A5#KA*1#gC17#MGd;#8(02#L-d3#rWM4#Hga1#,<w0#T.j<#O#'2#CYN1#qa^:#_4m3#o@/=#eG8=#t8J5#`+78#4uI-#\"\n    \"m3B2#SB[8#Q0@8#i[*9#iOn8#1Nm;#^sN9#qh<9#:=x-#P;K2#$%X9#bC+.#Rg;<#mN=.#MTF.#RZO.#2?)4#Y#(/#[)1/#b;L/#dAU/#0Sv;#lY$0#n`-0#sf60#(F24#wrH0#%/e0#\"\n    \"TmD<#%JSMFove:CTBEXI:<eh2g)B,3h2^G3i;#d3jD>)4kMYD4lVu`4m`:&5niUA5@(A5BA1]PBB:xlBCC=2CDLXMCEUtiCf&0g2'tN?PGT4CPGT4CPGT4CPGT4CPGT4CPGT4CPGT4CP\"\n    \"GT4CPGT4CPGT4CPGT4CPGT4CPGT4CP-qekC`.9kEg^+F$kwViFJTB&5KTB&5KTB&5KTB&5KTB&5KTB&5KTB&5KTB&5KTB&5KTB&5KTB&5KTB&5KTB&5KTB&5KTB&5o,^<-28ZI'O?;xp\"\n    \"O?;xpO?;xpO?;xpO?;xpO?;xpO?;xpO?;xpO?;xpO?;xpO?;xpO?;xpO?;xpO?;xp;7q-#lLYI:xvD=#\";\n\nstatic const char* GetDefaultCompressedFontDataTTFBase85()\n{\n    return proggy_clean_ttf_compressed_data_base85;\n}\n\n#endif // #ifndef IMGUI_DISABLE\n"
  },
  {
    "path": "R3nzSkin/imgui/imgui_impl_dx11.cpp",
    "content": "// dear imgui: Renderer Backend for DirectX11\n// This needs to be used along with a Platform Backend (e.g. Win32)\n\n// Implemented features:\n//  [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID!\n//  [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices.\n\n// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.\n// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.\n// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.\n// Read online: https://github.com/ocornut/imgui/tree/master/docs\n\n// CHANGELOG\n// (minor and older changes stripped away, please see git history for details)\n//  2021-06-29: Reorganized backend to pull data from a single structure to facilitate usage with multiple-contexts (all g_XXXX access changed to bd->XXXX).\n//  2021-05-19: DirectX11: Replaced direct access to ImDrawCmd::TextureId with a call to ImDrawCmd::GetTexID(). (will become a requirement)\n//  2021-02-18: DirectX11: Change blending equation to preserve alpha in output buffer.\n//  2019-08-01: DirectX11: Fixed code querying the Geometry Shader state (would generally error with Debug layer enabled).\n//  2019-07-21: DirectX11: Backup, clear and restore Geometry Shader is any is bound when calling ImGui_ImplDX10_RenderDrawData. Clearing Hull/Domain/Compute shaders without backup/restore.\n//  2019-05-29: DirectX11: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_RendererHasVtxOffset flag.\n//  2019-04-30: DirectX11: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.\n//  2018-12-03: Misc: Added #pragma comment statement to automatically link with d3dcompiler.lib when using D3DCompile().\n//  2018-11-30: Misc: Setting up io.BackendRendererName so it can be displayed in the About Window.\n//  2018-08-01: DirectX11: Querying for IDXGIFactory instead of IDXGIFactory1 to increase compatibility.\n//  2018-07-13: DirectX11: Fixed unreleased resources in Init and Shutdown functions.\n//  2018-06-08: Misc: Extracted imgui_impl_dx11.cpp/.h away from the old combined DX11+Win32 example.\n//  2018-06-08: DirectX11: Use draw_data->DisplayPos and draw_data->DisplaySize to setup projection matrix and clipping rectangle.\n//  2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplDX11_RenderDrawData() in the .h file so you can call it yourself.\n//  2018-02-06: Misc: Removed call to ImGui::Shutdown() which is not available from 1.60 WIP, user needs to call CreateContext/DestroyContext themselves.\n//  2016-05-07: DirectX11: Disabling depth-write.\n\n#include \"imgui.h\"\n#include \"imgui_impl_dx11.h\"\n\n// DirectX\n#include <stdio.h>\n#include <d3d11.h>\n#include <d3dcompiler.h>\n#ifdef _MSC_VER\n#pragma comment(lib, \"d3dcompiler\") // Automatically link with d3dcompiler.lib as we are using D3DCompile() below.\n#endif\n\n// DirectX11 data\nstruct ImGui_ImplDX11_Data\n{\n    ID3D11Device*               pd3dDevice;\n    ID3D11DeviceContext*        pd3dDeviceContext;\n    IDXGIFactory*               pFactory;\n    ID3D11Buffer*               pVB;\n    ID3D11Buffer*               pIB;\n    ID3D11VertexShader*         pVertexShader;\n    ID3D11InputLayout*          pInputLayout;\n    ID3D11Buffer*               pVertexConstantBuffer;\n    ID3D11PixelShader*          pPixelShader;\n    ID3D11SamplerState*         pFontSampler;\n    ID3D11ShaderResourceView*   pFontTextureView;\n    ID3D11RasterizerState*      pRasterizerState;\n    ID3D11BlendState*           pBlendState;\n    ID3D11DepthStencilState*    pDepthStencilState;\n    int                         VertexBufferSize;\n    int                         IndexBufferSize;\n\n    ImGui_ImplDX11_Data()       { memset(this, 0, sizeof(*this)); VertexBufferSize = 5000; IndexBufferSize = 10000; }\n};\n\nstruct VERTEX_CONSTANT_BUFFER\n{\n    float   mvp[4][4];\n};\n\n// Backend data stored in io.BackendRendererUserData to allow support for multiple Dear ImGui contexts\n// It is STRONGLY preferred that you use docking branch with multi-viewports (== single Dear ImGui context + multiple windows) instead of multiple Dear ImGui contexts.\nstatic ImGui_ImplDX11_Data* ImGui_ImplDX11_GetBackendData()\n{\n    return ImGui::GetCurrentContext() ? (ImGui_ImplDX11_Data*)ImGui::GetIO().BackendRendererUserData : NULL;\n}\n\n// Functions\nstatic void ImGui_ImplDX11_SetupRenderState(ImDrawData* draw_data, ID3D11DeviceContext* ctx)\n{\n    ImGui_ImplDX11_Data* bd = ImGui_ImplDX11_GetBackendData();\n\n    // Setup viewport\n    D3D11_VIEWPORT vp;\n    memset(&vp, 0, sizeof(D3D11_VIEWPORT));\n    vp.Width = draw_data->DisplaySize.x;\n    vp.Height = draw_data->DisplaySize.y;\n    vp.MinDepth = 0.0f;\n    vp.MaxDepth = 1.0f;\n    vp.TopLeftX = vp.TopLeftY = 0;\n    ctx->RSSetViewports(1, &vp);\n\n    // Setup shader and vertex buffers\n    unsigned int stride = sizeof(ImDrawVert);\n    unsigned int offset = 0;\n    ctx->IASetInputLayout(bd->pInputLayout);\n    ctx->IASetVertexBuffers(0, 1, &bd->pVB, &stride, &offset);\n    ctx->IASetIndexBuffer(bd->pIB, sizeof(ImDrawIdx) == 2 ? DXGI_FORMAT_R16_UINT : DXGI_FORMAT_R32_UINT, 0);\n    ctx->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);\n    ctx->VSSetShader(bd->pVertexShader, NULL, 0);\n    ctx->VSSetConstantBuffers(0, 1, &bd->pVertexConstantBuffer);\n    ctx->PSSetShader(bd->pPixelShader, NULL, 0);\n    ctx->PSSetSamplers(0, 1, &bd->pFontSampler);\n    ctx->GSSetShader(NULL, NULL, 0);\n    ctx->HSSetShader(NULL, NULL, 0); // In theory we should backup and restore this as well.. very infrequently used..\n    ctx->DSSetShader(NULL, NULL, 0); // In theory we should backup and restore this as well.. very infrequently used..\n    ctx->CSSetShader(NULL, NULL, 0); // In theory we should backup and restore this as well.. very infrequently used..\n\n    // Setup blend state\n    const float blend_factor[4] = { 0.f, 0.f, 0.f, 0.f };\n    ctx->OMSetBlendState(bd->pBlendState, blend_factor, 0xffffffff);\n    ctx->OMSetDepthStencilState(bd->pDepthStencilState, 0);\n    ctx->RSSetState(bd->pRasterizerState);\n}\n\n// Render function\nvoid ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data)\n{\n    // Avoid rendering when minimized\n    if (draw_data->DisplaySize.x <= 0.0f || draw_data->DisplaySize.y <= 0.0f)\n        return;\n\n    ImGui_ImplDX11_Data* bd = ImGui_ImplDX11_GetBackendData();\n    ID3D11DeviceContext* ctx = bd->pd3dDeviceContext;\n\n    // Create and grow vertex/index buffers if needed\n    if (!bd->pVB || bd->VertexBufferSize < draw_data->TotalVtxCount)\n    {\n        if (bd->pVB) { bd->pVB->Release(); bd->pVB = NULL; }\n        bd->VertexBufferSize = draw_data->TotalVtxCount + 5000;\n        D3D11_BUFFER_DESC desc;\n        memset(&desc, 0, sizeof(D3D11_BUFFER_DESC));\n        desc.Usage = D3D11_USAGE_DYNAMIC;\n        desc.ByteWidth = bd->VertexBufferSize * sizeof(ImDrawVert);\n        desc.BindFlags = D3D11_BIND_VERTEX_BUFFER;\n        desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;\n        desc.MiscFlags = 0;\n        if (bd->pd3dDevice->CreateBuffer(&desc, NULL, &bd->pVB) < 0)\n            return;\n    }\n    if (!bd->pIB || bd->IndexBufferSize < draw_data->TotalIdxCount)\n    {\n        if (bd->pIB) { bd->pIB->Release(); bd->pIB = NULL; }\n        bd->IndexBufferSize = draw_data->TotalIdxCount + 10000;\n        D3D11_BUFFER_DESC desc;\n        memset(&desc, 0, sizeof(D3D11_BUFFER_DESC));\n        desc.Usage = D3D11_USAGE_DYNAMIC;\n        desc.ByteWidth = bd->IndexBufferSize * sizeof(ImDrawIdx);\n        desc.BindFlags = D3D11_BIND_INDEX_BUFFER;\n        desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;\n        if (bd->pd3dDevice->CreateBuffer(&desc, NULL, &bd->pIB) < 0)\n            return;\n    }\n\n    // Upload vertex/index data into a single contiguous GPU buffer\n    D3D11_MAPPED_SUBRESOURCE vtx_resource, idx_resource;\n    if (ctx->Map(bd->pVB, 0, D3D11_MAP_WRITE_DISCARD, 0, &vtx_resource) != S_OK)\n        return;\n    if (ctx->Map(bd->pIB, 0, D3D11_MAP_WRITE_DISCARD, 0, &idx_resource) != S_OK)\n        return;\n    ImDrawVert* vtx_dst = (ImDrawVert*)vtx_resource.pData;\n    ImDrawIdx* idx_dst = (ImDrawIdx*)idx_resource.pData;\n    for (int n = 0; n < draw_data->CmdListsCount; n++)\n    {\n        const ImDrawList* cmd_list = draw_data->CmdLists[n];\n        memcpy(vtx_dst, cmd_list->VtxBuffer.Data, cmd_list->VtxBuffer.Size * sizeof(ImDrawVert));\n        memcpy(idx_dst, cmd_list->IdxBuffer.Data, cmd_list->IdxBuffer.Size * sizeof(ImDrawIdx));\n        vtx_dst += cmd_list->VtxBuffer.Size;\n        idx_dst += cmd_list->IdxBuffer.Size;\n    }\n    ctx->Unmap(bd->pVB, 0);\n    ctx->Unmap(bd->pIB, 0);\n\n    // Setup orthographic projection matrix into our constant buffer\n    // Our visible imgui space lies from draw_data->DisplayPos (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayPos is (0,0) for single viewport apps.\n    {\n        D3D11_MAPPED_SUBRESOURCE mapped_resource;\n        if (ctx->Map(bd->pVertexConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped_resource) != S_OK)\n            return;\n        VERTEX_CONSTANT_BUFFER* constant_buffer = (VERTEX_CONSTANT_BUFFER*)mapped_resource.pData;\n        float L = draw_data->DisplayPos.x;\n        float R = draw_data->DisplayPos.x + draw_data->DisplaySize.x;\n        float T = draw_data->DisplayPos.y;\n        float B = draw_data->DisplayPos.y + draw_data->DisplaySize.y;\n        float mvp[4][4] =\n        {\n            { 2.0f/(R-L),   0.0f,           0.0f,       0.0f },\n            { 0.0f,         2.0f/(T-B),     0.0f,       0.0f },\n            { 0.0f,         0.0f,           0.5f,       0.0f },\n            { (R+L)/(L-R),  (T+B)/(B-T),    0.5f,       1.0f },\n        };\n        memcpy(&constant_buffer->mvp, mvp, sizeof(mvp));\n        ctx->Unmap(bd->pVertexConstantBuffer, 0);\n    }\n\n    // Backup DX state that will be modified to restore it afterwards (unfortunately this is very ugly looking and verbose. Close your eyes!)\n    struct BACKUP_DX11_STATE\n    {\n        UINT                        ScissorRectsCount, ViewportsCount;\n        D3D11_RECT                  ScissorRects[D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE];\n        D3D11_VIEWPORT              Viewports[D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE];\n        ID3D11RasterizerState*      RS;\n        ID3D11BlendState*           BlendState;\n        FLOAT                       BlendFactor[4];\n        UINT                        SampleMask;\n        UINT                        StencilRef;\n        ID3D11DepthStencilState*    DepthStencilState;\n        ID3D11ShaderResourceView*   PSShaderResource;\n        ID3D11SamplerState*         PSSampler;\n        ID3D11PixelShader*          PS;\n        ID3D11VertexShader*         VS;\n        ID3D11GeometryShader*       GS;\n        UINT                        PSInstancesCount, VSInstancesCount, GSInstancesCount;\n        ID3D11ClassInstance         *PSInstances[256], *VSInstances[256], *GSInstances[256];   // 256 is max according to PSSetShader documentation\n        D3D11_PRIMITIVE_TOPOLOGY    PrimitiveTopology;\n        ID3D11Buffer*               IndexBuffer, *VertexBuffer, *VSConstantBuffer;\n        UINT                        IndexBufferOffset, VertexBufferStride, VertexBufferOffset;\n        DXGI_FORMAT                 IndexBufferFormat;\n        ID3D11InputLayout*          InputLayout;\n    };\n    BACKUP_DX11_STATE old = {};\n    old.ScissorRectsCount = old.ViewportsCount = D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE;\n    ctx->RSGetScissorRects(&old.ScissorRectsCount, old.ScissorRects);\n    ctx->RSGetViewports(&old.ViewportsCount, old.Viewports);\n    ctx->RSGetState(&old.RS);\n    ctx->OMGetBlendState(&old.BlendState, old.BlendFactor, &old.SampleMask);\n    ctx->OMGetDepthStencilState(&old.DepthStencilState, &old.StencilRef);\n    ctx->PSGetShaderResources(0, 1, &old.PSShaderResource);\n    ctx->PSGetSamplers(0, 1, &old.PSSampler);\n    old.PSInstancesCount = old.VSInstancesCount = old.GSInstancesCount = 256;\n    ctx->PSGetShader(&old.PS, old.PSInstances, &old.PSInstancesCount);\n    ctx->VSGetShader(&old.VS, old.VSInstances, &old.VSInstancesCount);\n    ctx->VSGetConstantBuffers(0, 1, &old.VSConstantBuffer);\n    ctx->GSGetShader(&old.GS, old.GSInstances, &old.GSInstancesCount);\n\n    ctx->IAGetPrimitiveTopology(&old.PrimitiveTopology);\n    ctx->IAGetIndexBuffer(&old.IndexBuffer, &old.IndexBufferFormat, &old.IndexBufferOffset);\n    ctx->IAGetVertexBuffers(0, 1, &old.VertexBuffer, &old.VertexBufferStride, &old.VertexBufferOffset);\n    ctx->IAGetInputLayout(&old.InputLayout);\n\n    // Setup desired DX state\n    ImGui_ImplDX11_SetupRenderState(draw_data, ctx);\n\n    // Render command lists\n    // (Because we merged all buffers into a single one, we maintain our own offset into them)\n    int global_idx_offset = 0;\n    int global_vtx_offset = 0;\n    ImVec2 clip_off = draw_data->DisplayPos;\n    for (int n = 0; n < draw_data->CmdListsCount; n++)\n    {\n        const ImDrawList* cmd_list = draw_data->CmdLists[n];\n        for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)\n        {\n            const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];\n            if (pcmd->UserCallback != NULL)\n            {\n                // User callback, registered via ImDrawList::AddCallback()\n                // (ImDrawCallback_ResetRenderState is a special callback value used by the user to request the renderer to reset render state.)\n                if (pcmd->UserCallback == ImDrawCallback_ResetRenderState)\n                    ImGui_ImplDX11_SetupRenderState(draw_data, ctx);\n                else\n                    pcmd->UserCallback(cmd_list, pcmd);\n            }\n            else\n            {\n                // Apply scissor/clipping rectangle\n                const D3D11_RECT r = { (LONG)(pcmd->ClipRect.x - clip_off.x), (LONG)(pcmd->ClipRect.y - clip_off.y), (LONG)(pcmd->ClipRect.z - clip_off.x), (LONG)(pcmd->ClipRect.w - clip_off.y) };\n                ctx->RSSetScissorRects(1, &r);\n\n                // Bind texture, Draw\n                ID3D11ShaderResourceView* texture_srv = (ID3D11ShaderResourceView*)pcmd->GetTexID();\n                ctx->PSSetShaderResources(0, 1, &texture_srv);\n                ctx->DrawIndexed(pcmd->ElemCount, pcmd->IdxOffset + global_idx_offset, pcmd->VtxOffset + global_vtx_offset);\n            }\n        }\n        global_idx_offset += cmd_list->IdxBuffer.Size;\n        global_vtx_offset += cmd_list->VtxBuffer.Size;\n    }\n\n    // Restore modified DX state\n    ctx->RSSetScissorRects(old.ScissorRectsCount, old.ScissorRects);\n    ctx->RSSetViewports(old.ViewportsCount, old.Viewports);\n    ctx->RSSetState(old.RS); if (old.RS) old.RS->Release();\n    ctx->OMSetBlendState(old.BlendState, old.BlendFactor, old.SampleMask); if (old.BlendState) old.BlendState->Release();\n    ctx->OMSetDepthStencilState(old.DepthStencilState, old.StencilRef); if (old.DepthStencilState) old.DepthStencilState->Release();\n    ctx->PSSetShaderResources(0, 1, &old.PSShaderResource); if (old.PSShaderResource) old.PSShaderResource->Release();\n    ctx->PSSetSamplers(0, 1, &old.PSSampler); if (old.PSSampler) old.PSSampler->Release();\n    ctx->PSSetShader(old.PS, old.PSInstances, old.PSInstancesCount); if (old.PS) old.PS->Release();\n    for (UINT i = 0; i < old.PSInstancesCount; i++) if (old.PSInstances[i]) old.PSInstances[i]->Release();\n    ctx->VSSetShader(old.VS, old.VSInstances, old.VSInstancesCount); if (old.VS) old.VS->Release();\n    ctx->VSSetConstantBuffers(0, 1, &old.VSConstantBuffer); if (old.VSConstantBuffer) old.VSConstantBuffer->Release();\n    ctx->GSSetShader(old.GS, old.GSInstances, old.GSInstancesCount); if (old.GS) old.GS->Release();\n    for (UINT i = 0; i < old.VSInstancesCount; i++) if (old.VSInstances[i]) old.VSInstances[i]->Release();\n    ctx->IASetPrimitiveTopology(old.PrimitiveTopology);\n    ctx->IASetIndexBuffer(old.IndexBuffer, old.IndexBufferFormat, old.IndexBufferOffset); if (old.IndexBuffer) old.IndexBuffer->Release();\n    ctx->IASetVertexBuffers(0, 1, &old.VertexBuffer, &old.VertexBufferStride, &old.VertexBufferOffset); if (old.VertexBuffer) old.VertexBuffer->Release();\n    ctx->IASetInputLayout(old.InputLayout); if (old.InputLayout) old.InputLayout->Release();\n}\n\nstatic void ImGui_ImplDX11_CreateFontsTexture()\n{\n    // Build texture atlas\n    ImGuiIO& io = ImGui::GetIO();\n    ImGui_ImplDX11_Data* bd = ImGui_ImplDX11_GetBackendData();\n    unsigned char* pixels;\n    int width, height;\n    io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height);\n\n    // Upload texture to graphics system\n    {\n        D3D11_TEXTURE2D_DESC desc;\n        ZeroMemory(&desc, sizeof(desc));\n        desc.Width = width;\n        desc.Height = height;\n        desc.MipLevels = 1;\n        desc.ArraySize = 1;\n        desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;\n        desc.SampleDesc.Count = 1;\n        desc.Usage = D3D11_USAGE_DEFAULT;\n        desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;\n        desc.CPUAccessFlags = 0;\n\n        ID3D11Texture2D* pTexture = NULL;\n        D3D11_SUBRESOURCE_DATA subResource;\n        subResource.pSysMem = pixels;\n        subResource.SysMemPitch = desc.Width * 4;\n        subResource.SysMemSlicePitch = 0;\n        bd->pd3dDevice->CreateTexture2D(&desc, &subResource, &pTexture);\n        IM_ASSERT(pTexture != NULL);\n\n        // Create texture view\n        D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;\n        ZeroMemory(&srvDesc, sizeof(srvDesc));\n        srvDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;\n        srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;\n        srvDesc.Texture2D.MipLevels = desc.MipLevels;\n        srvDesc.Texture2D.MostDetailedMip = 0;\n        bd->pd3dDevice->CreateShaderResourceView(pTexture, &srvDesc, &bd->pFontTextureView);\n        pTexture->Release();\n    }\n\n    // Store our identifier\n    io.Fonts->SetTexID((ImTextureID)bd->pFontTextureView);\n\n    // Create texture sampler\n    {\n        D3D11_SAMPLER_DESC desc;\n        ZeroMemory(&desc, sizeof(desc));\n        desc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;\n        desc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;\n        desc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;\n        desc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;\n        desc.MipLODBias = 0.f;\n        desc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;\n        desc.MinLOD = 0.f;\n        desc.MaxLOD = 0.f;\n        bd->pd3dDevice->CreateSamplerState(&desc, &bd->pFontSampler);\n    }\n}\n\nbool    ImGui_ImplDX11_CreateDeviceObjects()\n{\n    ImGui_ImplDX11_Data* bd = ImGui_ImplDX11_GetBackendData();\n    if (!bd->pd3dDevice)\n        return false;\n    if (bd->pFontSampler)\n        ImGui_ImplDX11_InvalidateDeviceObjects();\n\n    // By using D3DCompile() from <d3dcompiler.h> / d3dcompiler.lib, we introduce a dependency to a given version of d3dcompiler_XX.dll (see D3DCOMPILER_DLL_A)\n    // If you would like to use this DX11 sample code but remove this dependency you can:\n    //  1) compile once, save the compiled shader blobs into a file or source code and pass them to CreateVertexShader()/CreatePixelShader() [preferred solution]\n    //  2) use code to detect any version of the DLL and grab a pointer to D3DCompile from the DLL.\n    // See https://github.com/ocornut/imgui/pull/638 for sources and details.\n\n    // Create the vertex shader\n    {\n        static const char* vertexShader =\n            \"cbuffer vertexBuffer : register(b0) \\\n            {\\\n              float4x4 ProjectionMatrix; \\\n            };\\\n            struct VS_INPUT\\\n            {\\\n              float2 pos : POSITION;\\\n              float4 col : COLOR0;\\\n              float2 uv  : TEXCOORD0;\\\n            };\\\n            \\\n            struct PS_INPUT\\\n            {\\\n              float4 pos : SV_POSITION;\\\n              float4 col : COLOR0;\\\n              float2 uv  : TEXCOORD0;\\\n            };\\\n            \\\n            PS_INPUT main(VS_INPUT input)\\\n            {\\\n              PS_INPUT output;\\\n              output.pos = mul( ProjectionMatrix, float4(input.pos.xy, 0.f, 1.f));\\\n              output.col = input.col;\\\n              output.uv  = input.uv;\\\n              return output;\\\n            }\";\n\n        ID3DBlob* vertexShaderBlob;\n        if (FAILED(D3DCompile(vertexShader, strlen(vertexShader), NULL, NULL, NULL, \"main\", \"vs_4_0\", 0, 0, &vertexShaderBlob, NULL)))\n            return false; // NB: Pass ID3DBlob* pErrorBlob to D3DCompile() to get error showing in (const char*)pErrorBlob->GetBufferPointer(). Make sure to Release() the blob!\n        if (bd->pd3dDevice->CreateVertexShader(vertexShaderBlob->GetBufferPointer(), vertexShaderBlob->GetBufferSize(), NULL, &bd->pVertexShader) != S_OK)\n        {\n            vertexShaderBlob->Release();\n            return false;\n        }\n\n        // Create the input layout\n        D3D11_INPUT_ELEMENT_DESC local_layout[] =\n        {\n            { \"POSITION\", 0, DXGI_FORMAT_R32G32_FLOAT,   0, (UINT)IM_OFFSETOF(ImDrawVert, pos), D3D11_INPUT_PER_VERTEX_DATA, 0 },\n            { \"TEXCOORD\", 0, DXGI_FORMAT_R32G32_FLOAT,   0, (UINT)IM_OFFSETOF(ImDrawVert, uv),  D3D11_INPUT_PER_VERTEX_DATA, 0 },\n            { \"COLOR\",    0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, (UINT)IM_OFFSETOF(ImDrawVert, col), D3D11_INPUT_PER_VERTEX_DATA, 0 },\n        };\n        if (bd->pd3dDevice->CreateInputLayout(local_layout, 3, vertexShaderBlob->GetBufferPointer(), vertexShaderBlob->GetBufferSize(), &bd->pInputLayout) != S_OK)\n        {\n            vertexShaderBlob->Release();\n            return false;\n        }\n        vertexShaderBlob->Release();\n\n        // Create the constant buffer\n        {\n            D3D11_BUFFER_DESC desc;\n            desc.ByteWidth = sizeof(VERTEX_CONSTANT_BUFFER);\n            desc.Usage = D3D11_USAGE_DYNAMIC;\n            desc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;\n            desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;\n            desc.MiscFlags = 0;\n            bd->pd3dDevice->CreateBuffer(&desc, NULL, &bd->pVertexConstantBuffer);\n        }\n    }\n\n    // Create the pixel shader\n    {\n        static const char* pixelShader =\n            \"struct PS_INPUT\\\n            {\\\n            float4 pos : SV_POSITION;\\\n            float4 col : COLOR0;\\\n            float2 uv  : TEXCOORD0;\\\n            };\\\n            sampler sampler0;\\\n            Texture2D texture0;\\\n            \\\n            float4 main(PS_INPUT input) : SV_Target\\\n            {\\\n            float4 out_col = input.col * texture0.Sample(sampler0, input.uv); \\\n            return out_col; \\\n            }\";\n\n        ID3DBlob* pixelShaderBlob;\n        if (FAILED(D3DCompile(pixelShader, strlen(pixelShader), NULL, NULL, NULL, \"main\", \"ps_4_0\", 0, 0, &pixelShaderBlob, NULL)))\n            return false; // NB: Pass ID3DBlob* pErrorBlob to D3DCompile() to get error showing in (const char*)pErrorBlob->GetBufferPointer(). Make sure to Release() the blob!\n        if (bd->pd3dDevice->CreatePixelShader(pixelShaderBlob->GetBufferPointer(), pixelShaderBlob->GetBufferSize(), NULL, &bd->pPixelShader) != S_OK)\n        {\n            pixelShaderBlob->Release();\n            return false;\n        }\n        pixelShaderBlob->Release();\n    }\n\n    // Create the blending setup\n    {\n        D3D11_BLEND_DESC desc;\n        ZeroMemory(&desc, sizeof(desc));\n        desc.AlphaToCoverageEnable = false;\n        desc.RenderTarget[0].BlendEnable = true;\n        desc.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA;\n        desc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA;\n        desc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;\n        desc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;\n        desc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA;\n        desc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;\n        desc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;\n        bd->pd3dDevice->CreateBlendState(&desc, &bd->pBlendState);\n    }\n\n    // Create the rasterizer state\n    {\n        D3D11_RASTERIZER_DESC desc;\n        ZeroMemory(&desc, sizeof(desc));\n        desc.FillMode = D3D11_FILL_SOLID;\n        desc.CullMode = D3D11_CULL_NONE;\n        desc.ScissorEnable = true;\n        desc.DepthClipEnable = true;\n        bd->pd3dDevice->CreateRasterizerState(&desc, &bd->pRasterizerState);\n    }\n\n    // Create depth-stencil State\n    {\n        D3D11_DEPTH_STENCIL_DESC desc;\n        ZeroMemory(&desc, sizeof(desc));\n        desc.DepthEnable = false;\n        desc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;\n        desc.DepthFunc = D3D11_COMPARISON_ALWAYS;\n        desc.StencilEnable = false;\n        desc.FrontFace.StencilFailOp = desc.FrontFace.StencilDepthFailOp = desc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;\n        desc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;\n        desc.BackFace = desc.FrontFace;\n        bd->pd3dDevice->CreateDepthStencilState(&desc, &bd->pDepthStencilState);\n    }\n\n    ImGui_ImplDX11_CreateFontsTexture();\n\n    return true;\n}\n\nvoid    ImGui_ImplDX11_InvalidateDeviceObjects()\n{\n    ImGui_ImplDX11_Data* bd = ImGui_ImplDX11_GetBackendData();\n    if (!bd->pd3dDevice)\n        return;\n\n    if (bd->pFontSampler)           { bd->pFontSampler->Release(); bd->pFontSampler = NULL; }\n    if (bd->pFontTextureView)       { bd->pFontTextureView->Release(); bd->pFontTextureView = NULL; ImGui::GetIO().Fonts->SetTexID(NULL); } // We copied data->pFontTextureView to io.Fonts->TexID so let's clear that as well.\n    if (bd->pIB)                    { bd->pIB->Release(); bd->pIB = NULL; }\n    if (bd->pVB)                    { bd->pVB->Release(); bd->pVB = NULL; }\n    if (bd->pBlendState)            { bd->pBlendState->Release(); bd->pBlendState = NULL; }\n    if (bd->pDepthStencilState)     { bd->pDepthStencilState->Release(); bd->pDepthStencilState = NULL; }\n    if (bd->pRasterizerState)       { bd->pRasterizerState->Release(); bd->pRasterizerState = NULL; }\n    if (bd->pPixelShader)           { bd->pPixelShader->Release(); bd->pPixelShader = NULL; }\n    if (bd->pVertexConstantBuffer)  { bd->pVertexConstantBuffer->Release(); bd->pVertexConstantBuffer = NULL; }\n    if (bd->pInputLayout)           { bd->pInputLayout->Release(); bd->pInputLayout = NULL; }\n    if (bd->pVertexShader)          { bd->pVertexShader->Release(); bd->pVertexShader = NULL; }\n}\n\nbool    ImGui_ImplDX11_Init(ID3D11Device* device, ID3D11DeviceContext* device_context)\n{\n    ImGuiIO& io = ImGui::GetIO();\n    IM_ASSERT(io.BackendRendererUserData == NULL && \"Already initialized a renderer backend!\");\n\n    // Setup backend capabilities flags\n    ImGui_ImplDX11_Data* bd = IM_NEW(ImGui_ImplDX11_Data)();\n    io.BackendRendererUserData = (void*)bd;\n    io.BackendRendererName = \"imgui_impl_dx11\";\n    io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset;  // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.\n\n    // Get factory from device\n    IDXGIDevice* pDXGIDevice = NULL;\n    IDXGIAdapter* pDXGIAdapter = NULL;\n    IDXGIFactory* pFactory = NULL;\n\n    if (device->QueryInterface(IID_PPV_ARGS(&pDXGIDevice)) == S_OK)\n        if (pDXGIDevice->GetParent(IID_PPV_ARGS(&pDXGIAdapter)) == S_OK)\n            if (pDXGIAdapter->GetParent(IID_PPV_ARGS(&pFactory)) == S_OK)\n            {\n                bd->pd3dDevice = device;\n                bd->pd3dDeviceContext = device_context;\n                bd->pFactory = pFactory;\n            }\n    if (pDXGIDevice) pDXGIDevice->Release();\n    if (pDXGIAdapter) pDXGIAdapter->Release();\n    bd->pd3dDevice->AddRef();\n    bd->pd3dDeviceContext->AddRef();\n\n    return true;\n}\n\nvoid ImGui_ImplDX11_Shutdown()\n{\n    ImGuiIO& io = ImGui::GetIO();\n    ImGui_ImplDX11_Data* bd = ImGui_ImplDX11_GetBackendData();\n\n    ImGui_ImplDX11_InvalidateDeviceObjects();\n    if (bd->pFactory)             { bd->pFactory->Release(); }\n    if (bd->pd3dDevice)           { bd->pd3dDevice->Release(); }\n    if (bd->pd3dDeviceContext)    { bd->pd3dDeviceContext->Release(); }\n    io.BackendRendererName = NULL;\n    io.BackendRendererUserData = NULL;\n    IM_DELETE(bd);\n}\n\nvoid ImGui_ImplDX11_NewFrame()\n{\n    ImGui_ImplDX11_Data* bd = ImGui_ImplDX11_GetBackendData();\n    IM_ASSERT(bd != NULL && \"Did you call ImGui_ImplDX11_Init()?\");\n\n    if (!bd->pFontSampler)\n        ImGui_ImplDX11_CreateDeviceObjects();\n}\n"
  },
  {
    "path": "R3nzSkin/imgui/imgui_impl_dx11.h",
    "content": "// dear imgui: Renderer Backend for DirectX11\n// This needs to be used along with a Platform Backend (e.g. Win32)\n\n// Implemented features:\n//  [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID!\n//  [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices.\n\n// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. \n// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.\n// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.\n// Read online: https://github.com/ocornut/imgui/tree/master/docs\n\n#pragma once\n#include \"imgui.h\"      // IMGUI_IMPL_API\n\nstruct ID3D11Device;\nstruct ID3D11DeviceContext;\n\nIMGUI_IMPL_API bool     ImGui_ImplDX11_Init(ID3D11Device* device, ID3D11DeviceContext* device_context);\nIMGUI_IMPL_API void     ImGui_ImplDX11_Shutdown();\nIMGUI_IMPL_API void     ImGui_ImplDX11_NewFrame();\nIMGUI_IMPL_API void     ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data);\n\n// Use if you want to reset your rendering device without losing Dear ImGui state.\nIMGUI_IMPL_API void     ImGui_ImplDX11_InvalidateDeviceObjects();\nIMGUI_IMPL_API bool     ImGui_ImplDX11_CreateDeviceObjects();\n"
  },
  {
    "path": "R3nzSkin/imgui/imgui_impl_win32.cpp",
    "content": "// dear imgui: Platform Backend for Windows (standard windows API for 32 and 64 bits applications)\n// This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..)\n\n// Implemented features:\n//  [X] Platform: Clipboard support (for Win32 this is actually part of core dear imgui)\n//  [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.\n//  [X] Platform: Keyboard arrays indexed using VK_* Virtual Key Codes, e.g. ImGui::IsKeyPressed(VK_SPACE).\n//  [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.\n\n// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.\n// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.\n// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.\n// Read online: https://github.com/ocornut/imgui/tree/master/docs\n\n#include \"imgui.h\"\n#include \"imgui_impl_win32.h\"\n#ifndef WIN32_LEAN_AND_MEAN\n#define WIN32_LEAN_AND_MEAN\n#endif\n#include <windows.h>\n#include <tchar.h>\n#include <dwmapi.h>\n\n// Configuration flags to add in your imconfig.h file:\n//#define IMGUI_IMPL_WIN32_DISABLE_GAMEPAD              // Disable gamepad support. This was meaningful before <1.81 but we now load XInput dynamically so the option is now less relevant.\n\n// Using XInput for gamepad (will load DLL dynamically)\n#ifndef IMGUI_IMPL_WIN32_DISABLE_GAMEPAD\n#include <xinput.h>\ntypedef DWORD (WINAPI *PFN_XInputGetCapabilities)(DWORD, DWORD, XINPUT_CAPABILITIES*);\ntypedef DWORD (WINAPI *PFN_XInputGetState)(DWORD, XINPUT_STATE*);\n#endif\n\n// CHANGELOG\n// (minor and older changes stripped away, please see git history for details)\n//  2021-08-17: Calling io.AddFocusEvent() on WM_SETFOCUS/WM_KILLFOCUS messages.\n//  2021-08-02: Inputs: Fixed keyboard modifiers being reported when host windo doesn't have focus.\n//  2021-07-29: Inputs: MousePos is correctly reported when the host platform window is hovered but not focused (using TrackMouseEvent() to receive WM_MOUSELEAVE events).\n//  2021-06-29: Reorganized backend to pull data from a single structure to facilitate usage with multiple-contexts (all g_XXXX access changed to bd->XXXX).\n//  2021-06-08: Fixed ImGui_ImplWin32_EnableDpiAwareness() and ImGui_ImplWin32_GetDpiScaleForMonitor() to handle Windows 8.1/10 features without a manifest (per-monitor DPI, and properly calls SetProcessDpiAwareness() on 8.1).\n//  2021-03-23: Inputs: Clearing keyboard down array when losing focus (WM_KILLFOCUS).\n//  2021-02-18: Added ImGui_ImplWin32_EnableAlphaCompositing(). Non Visual Studio users will need to link with dwmapi.lib (MinGW/gcc: use -ldwmapi).\n//  2021-02-17: Fixed ImGui_ImplWin32_EnableDpiAwareness() attempting to get SetProcessDpiAwareness from shcore.dll on Windows 8 whereas it is only supported on Windows 8.1.\n//  2021-01-25: Inputs: Dynamically loading XInput DLL.\n//  2020-12-04: Misc: Fixed setting of io.DisplaySize to invalid/uninitialized data when after hwnd has been closed.\n//  2020-03-03: Inputs: Calling AddInputCharacterUTF16() to support surrogate pairs leading to codepoint >= 0x10000 (for more complete CJK inputs)\n//  2020-02-17: Added ImGui_ImplWin32_EnableDpiAwareness(), ImGui_ImplWin32_GetDpiScaleForHwnd(), ImGui_ImplWin32_GetDpiScaleForMonitor() helper functions.\n//  2020-01-14: Inputs: Added support for #define IMGUI_IMPL_WIN32_DISABLE_GAMEPAD/IMGUI_IMPL_WIN32_DISABLE_LINKING_XINPUT.\n//  2019-12-05: Inputs: Added support for ImGuiMouseCursor_NotAllowed mouse cursor.\n//  2019-05-11: Inputs: Don't filter value from WM_CHAR before calling AddInputCharacter().\n//  2019-01-17: Misc: Using GetForegroundWindow()+IsChild() instead of GetActiveWindow() to be compatible with windows created in a different thread or parent.\n//  2019-01-17: Inputs: Added support for mouse buttons 4 and 5 via WM_XBUTTON* messages.\n//  2019-01-15: Inputs: Added support for XInput gamepads (if ImGuiConfigFlags_NavEnableGamepad is set by user application).\n//  2018-11-30: Misc: Setting up io.BackendPlatformName so it can be displayed in the About Window.\n//  2018-06-29: Inputs: Added support for the ImGuiMouseCursor_Hand cursor.\n//  2018-06-10: Inputs: Fixed handling of mouse wheel messages to support fine position messages (typically sent by track-pads).\n//  2018-06-08: Misc: Extracted imgui_impl_win32.cpp/.h away from the old combined DX9/DX10/DX11/DX12 examples.\n//  2018-03-20: Misc: Setup io.BackendFlags ImGuiBackendFlags_HasMouseCursors and ImGuiBackendFlags_HasSetMousePos flags + honor ImGuiConfigFlags_NoMouseCursorChange flag.\n//  2018-02-20: Inputs: Added support for mouse cursors (ImGui::GetMouseCursor() value and WM_SETCURSOR message handling).\n//  2018-02-06: Inputs: Added mapping for ImGuiKey_Space.\n//  2018-02-06: Inputs: Honoring the io.WantSetMousePos by repositioning the mouse (when using navigation and ImGuiConfigFlags_NavMoveMouse is set).\n//  2018-02-06: Misc: Removed call to ImGui::Shutdown() which is not available from 1.60 WIP, user needs to call CreateContext/DestroyContext themselves.\n//  2018-01-20: Inputs: Added Horizontal Mouse Wheel support.\n//  2018-01-08: Inputs: Added mapping for ImGuiKey_Insert.\n//  2018-01-05: Inputs: Added WM_LBUTTONDBLCLK double-click handlers for window classes with the CS_DBLCLKS flag.\n//  2017-10-23: Inputs: Added WM_SYSKEYDOWN / WM_SYSKEYUP handlers so e.g. the VK_MENU key can be read.\n//  2017-10-23: Inputs: Using Win32 ::SetCapture/::GetCapture() to retrieve mouse positions outside the client area when dragging.\n//  2016-11-12: Inputs: Only call Win32 ::SetCursor(NULL) when io.MouseDrawCursor is set.\n\nstruct ImGui_ImplWin32_Data\n{\n    HWND                        hWnd;\n    HWND                        MouseHwnd;\n    bool                        MouseTracked;\n    INT64                       Time;\n    INT64                       TicksPerSecond;\n    ImGuiMouseCursor            LastMouseCursor;\n    bool                        HasGamepad;\n    bool                        WantUpdateHasGamepad;\n\n#ifndef IMGUI_IMPL_WIN32_DISABLE_GAMEPAD\n    HMODULE                     XInputDLL;\n    PFN_XInputGetCapabilities   XInputGetCapabilities;\n    PFN_XInputGetState          XInputGetState;\n#endif\n\n    ImGui_ImplWin32_Data()      { memset(this, 0, sizeof(*this)); }\n};\n\n// Backend data stored in io.BackendPlatformUserData to allow support for multiple Dear ImGui contexts\n// It is STRONGLY preferred that you use docking branch with multi-viewports (== single Dear ImGui context + multiple windows) instead of multiple Dear ImGui contexts.\n// FIXME: multi-context support is not well tested and probably dysfunctional in this backend.\n// FIXME: some shared resources (mouse cursor shape, gamepad) are mishandled when using multi-context.\nstatic ImGui_ImplWin32_Data* ImGui_ImplWin32_GetBackendData()\n{\n    return ImGui::GetCurrentContext() ? (ImGui_ImplWin32_Data*)ImGui::GetIO().BackendPlatformUserData : NULL;\n}\n\n// Functions\nbool    ImGui_ImplWin32_Init(void* hwnd)\n{\n    ImGuiIO& io = ImGui::GetIO();\n    IM_ASSERT(io.BackendPlatformUserData == NULL && \"Already initialized a platform backend!\");\n\n    INT64 perf_frequency, perf_counter;\n    if (!::QueryPerformanceFrequency((LARGE_INTEGER*)&perf_frequency))\n        return false;\n    if (!::QueryPerformanceCounter((LARGE_INTEGER*)&perf_counter))\n        return false;\n\n    // Setup backend capabilities flags\n    ImGui_ImplWin32_Data* bd = IM_NEW(ImGui_ImplWin32_Data)();\n    io.BackendPlatformUserData = (void*)bd;\n    io.BackendPlatformName = \"imgui_impl_win32\";\n    io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors;         // We can honor GetMouseCursor() values (optional)\n    io.BackendFlags |= ImGuiBackendFlags_HasSetMousePos;          // We can honor io.WantSetMousePos requests (optional, rarely used)\n\n    bd->hWnd = (HWND)hwnd;\n    bd->WantUpdateHasGamepad = true;\n    bd->TicksPerSecond = perf_frequency;\n    bd->Time = perf_counter;\n    bd->LastMouseCursor = ImGuiMouseCursor_COUNT;\n\n    io.ImeWindowHandle = hwnd;\n\n    // Keyboard mapping. Dear ImGui will use those indices to peek into the io.KeysDown[] array that we will update during the application lifetime.\n    io.KeyMap[ImGuiKey_Tab] = VK_TAB;\n    io.KeyMap[ImGuiKey_LeftArrow] = VK_LEFT;\n    io.KeyMap[ImGuiKey_RightArrow] = VK_RIGHT;\n    io.KeyMap[ImGuiKey_UpArrow] = VK_UP;\n    io.KeyMap[ImGuiKey_DownArrow] = VK_DOWN;\n    io.KeyMap[ImGuiKey_PageUp] = VK_PRIOR;\n    io.KeyMap[ImGuiKey_PageDown] = VK_NEXT;\n    io.KeyMap[ImGuiKey_Home] = VK_HOME;\n    io.KeyMap[ImGuiKey_End] = VK_END;\n    io.KeyMap[ImGuiKey_Insert] = VK_INSERT;\n    io.KeyMap[ImGuiKey_Delete] = VK_DELETE;\n    io.KeyMap[ImGuiKey_Backspace] = VK_BACK;\n    io.KeyMap[ImGuiKey_Space] = VK_SPACE;\n    io.KeyMap[ImGuiKey_Enter] = VK_RETURN;\n    io.KeyMap[ImGuiKey_Escape] = VK_ESCAPE;\n    io.KeyMap[ImGuiKey_KeyPadEnter] = VK_RETURN;\n    io.KeyMap[ImGuiKey_A] = 'A';\n    io.KeyMap[ImGuiKey_C] = 'C';\n    io.KeyMap[ImGuiKey_V] = 'V';\n    io.KeyMap[ImGuiKey_X] = 'X';\n    io.KeyMap[ImGuiKey_Y] = 'Y';\n    io.KeyMap[ImGuiKey_Z] = 'Z';\n\n    // Dynamically load XInput library\n#ifndef IMGUI_IMPL_WIN32_DISABLE_GAMEPAD\n    const char* xinput_dll_names[] =\n    {\n        \"xinput1_4.dll\",   // Windows 8+\n        \"xinput1_3.dll\",   // DirectX SDK\n        \"xinput9_1_0.dll\", // Windows Vista, Windows 7\n        \"xinput1_2.dll\",   // DirectX SDK\n        \"xinput1_1.dll\"    // DirectX SDK\n    };\n    for (int n = 0; n < IM_ARRAYSIZE(xinput_dll_names); n++)\n        if (HMODULE dll = ::LoadLibraryA(xinput_dll_names[n]))\n        {\n            bd->XInputDLL = dll;\n            bd->XInputGetCapabilities = (PFN_XInputGetCapabilities)::GetProcAddress(dll, \"XInputGetCapabilities\");\n            bd->XInputGetState = (PFN_XInputGetState)::GetProcAddress(dll, \"XInputGetState\");\n            break;\n        }\n#endif // IMGUI_IMPL_WIN32_DISABLE_GAMEPAD\n\n    return true;\n}\n\nvoid    ImGui_ImplWin32_Shutdown()\n{\n    ImGuiIO& io = ImGui::GetIO();\n    ImGui_ImplWin32_Data* bd = ImGui_ImplWin32_GetBackendData();\n\n    // Unload XInput library\n#ifndef IMGUI_IMPL_WIN32_DISABLE_GAMEPAD\n    if (bd->XInputDLL)\n        ::FreeLibrary(bd->XInputDLL);\n#endif // IMGUI_IMPL_WIN32_DISABLE_GAMEPAD\n\n    io.BackendPlatformName = NULL;\n    io.BackendPlatformUserData = NULL;\n    IM_DELETE(bd);\n}\n\nstatic bool ImGui_ImplWin32_UpdateMouseCursor()\n{\n    ImGuiIO& io = ImGui::GetIO();\n    if (io.ConfigFlags & ImGuiConfigFlags_NoMouseCursorChange)\n        return false;\n\n    ImGuiMouseCursor imgui_cursor = ImGui::GetMouseCursor();\n    if (imgui_cursor == ImGuiMouseCursor_None || io.MouseDrawCursor)\n    {\n        // Hide OS mouse cursor if imgui is drawing it or if it wants no cursor\n        ::SetCursor(NULL);\n    }\n    else\n    {\n        // Show OS mouse cursor\n        LPTSTR win32_cursor = IDC_ARROW;\n        switch (imgui_cursor)\n        {\n        case ImGuiMouseCursor_Arrow:        win32_cursor = IDC_ARROW; break;\n        case ImGuiMouseCursor_TextInput:    win32_cursor = IDC_IBEAM; break;\n        case ImGuiMouseCursor_ResizeAll:    win32_cursor = IDC_SIZEALL; break;\n        case ImGuiMouseCursor_ResizeEW:     win32_cursor = IDC_SIZEWE; break;\n        case ImGuiMouseCursor_ResizeNS:     win32_cursor = IDC_SIZENS; break;\n        case ImGuiMouseCursor_ResizeNESW:   win32_cursor = IDC_SIZENESW; break;\n        case ImGuiMouseCursor_ResizeNWSE:   win32_cursor = IDC_SIZENWSE; break;\n        case ImGuiMouseCursor_Hand:         win32_cursor = IDC_HAND; break;\n        case ImGuiMouseCursor_NotAllowed:   win32_cursor = IDC_NO; break;\n        }\n        ::SetCursor(::LoadCursor(NULL, win32_cursor));\n    }\n    return true;\n}\n\nstatic void ImGui_ImplWin32_UpdateMousePos()\n{\n    ImGui_ImplWin32_Data* bd = ImGui_ImplWin32_GetBackendData();\n    ImGuiIO& io = ImGui::GetIO();\n    IM_ASSERT(bd->hWnd != 0);\n\n    const ImVec2 mouse_pos_prev = io.MousePos;\n    io.MousePos = ImVec2(-FLT_MAX, -FLT_MAX);\n\n    // Obtain focused and hovered window. We forward mouse input when focused or when hovered (and no other window is capturing)\n    HWND focused_window = ::GetForegroundWindow();\n    HWND hovered_window = bd->MouseHwnd;\n    HWND mouse_window = NULL;\n    if (hovered_window && (hovered_window == bd->hWnd || ::IsChild(hovered_window, bd->hWnd)))\n        mouse_window = hovered_window;\n    else if (focused_window && (focused_window == bd->hWnd || ::IsChild(focused_window, bd->hWnd)))\n        mouse_window = focused_window;\n    if (mouse_window == NULL)\n        return;\n\n    // Set OS mouse position from Dear ImGui if requested (rarely used, only when ImGuiConfigFlags_NavEnableSetMousePos is enabled by user)\n    if (io.WantSetMousePos)\n    {\n        POINT pos = { (int)mouse_pos_prev.x, (int)mouse_pos_prev.y };\n        if (::ClientToScreen(bd->hWnd, &pos))\n            ::SetCursorPos(pos.x, pos.y);\n    }\n\n    // Set Dear ImGui mouse position from OS position\n    POINT pos;\n    if (::GetCursorPos(&pos) && ::ScreenToClient(mouse_window, &pos))\n        io.MousePos = ImVec2((float)pos.x, (float)pos.y);\n}\n\n// Gamepad navigation mapping\nstatic void ImGui_ImplWin32_UpdateGamepads()\n{\n#ifndef IMGUI_IMPL_WIN32_DISABLE_GAMEPAD\n    ImGuiIO& io = ImGui::GetIO();\n    ImGui_ImplWin32_Data* bd = ImGui_ImplWin32_GetBackendData();\n    memset(io.NavInputs, 0, sizeof(io.NavInputs));\n    if ((io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) == 0)\n        return;\n\n    // Calling XInputGetState() every frame on disconnected gamepads is unfortunately too slow.\n    // Instead we refresh gamepad availability by calling XInputGetCapabilities() _only_ after receiving WM_DEVICECHANGE.\n    if (bd->WantUpdateHasGamepad)\n    {\n        XINPUT_CAPABILITIES caps;\n        bd->HasGamepad = bd->XInputGetCapabilities ? (bd->XInputGetCapabilities(0, XINPUT_FLAG_GAMEPAD, &caps) == ERROR_SUCCESS) : false;\n        bd->WantUpdateHasGamepad = false;\n    }\n\n    io.BackendFlags &= ~ImGuiBackendFlags_HasGamepad;\n    XINPUT_STATE xinput_state;\n    if (bd->HasGamepad && bd->XInputGetState && bd->XInputGetState(0, &xinput_state) == ERROR_SUCCESS)\n    {\n        const XINPUT_GAMEPAD& gamepad = xinput_state.Gamepad;\n        io.BackendFlags |= ImGuiBackendFlags_HasGamepad;\n\n        #define MAP_BUTTON(NAV_NO, BUTTON_ENUM)     { io.NavInputs[NAV_NO] = (gamepad.wButtons & BUTTON_ENUM) ? 1.0f : 0.0f; }\n        #define MAP_ANALOG(NAV_NO, VALUE, V0, V1)   { float vn = (float)(VALUE - V0) / (float)(V1 - V0); if (vn > 1.0f) vn = 1.0f; if (vn > 0.0f && io.NavInputs[NAV_NO] < vn) io.NavInputs[NAV_NO] = vn; }\n        MAP_BUTTON(ImGuiNavInput_Activate,      XINPUT_GAMEPAD_A);              // Cross / A\n        MAP_BUTTON(ImGuiNavInput_Cancel,        XINPUT_GAMEPAD_B);              // Circle / B\n        MAP_BUTTON(ImGuiNavInput_Menu,          XINPUT_GAMEPAD_X);              // Square / X\n        MAP_BUTTON(ImGuiNavInput_Input,         XINPUT_GAMEPAD_Y);              // Triangle / Y\n        MAP_BUTTON(ImGuiNavInput_DpadLeft,      XINPUT_GAMEPAD_DPAD_LEFT);      // D-Pad Left\n        MAP_BUTTON(ImGuiNavInput_DpadRight,     XINPUT_GAMEPAD_DPAD_RIGHT);     // D-Pad Right\n        MAP_BUTTON(ImGuiNavInput_DpadUp,        XINPUT_GAMEPAD_DPAD_UP);        // D-Pad Up\n        MAP_BUTTON(ImGuiNavInput_DpadDown,      XINPUT_GAMEPAD_DPAD_DOWN);      // D-Pad Down\n        MAP_BUTTON(ImGuiNavInput_FocusPrev,     XINPUT_GAMEPAD_LEFT_SHOULDER);  // L1 / LB\n        MAP_BUTTON(ImGuiNavInput_FocusNext,     XINPUT_GAMEPAD_RIGHT_SHOULDER); // R1 / RB\n        MAP_BUTTON(ImGuiNavInput_TweakSlow,     XINPUT_GAMEPAD_LEFT_SHOULDER);  // L1 / LB\n        MAP_BUTTON(ImGuiNavInput_TweakFast,     XINPUT_GAMEPAD_RIGHT_SHOULDER); // R1 / RB\n        MAP_ANALOG(ImGuiNavInput_LStickLeft,    gamepad.sThumbLX,  -XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE, -32768);\n        MAP_ANALOG(ImGuiNavInput_LStickRight,   gamepad.sThumbLX,  +XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE, +32767);\n        MAP_ANALOG(ImGuiNavInput_LStickUp,      gamepad.sThumbLY,  +XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE, +32767);\n        MAP_ANALOG(ImGuiNavInput_LStickDown,    gamepad.sThumbLY,  -XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE, -32767);\n        #undef MAP_BUTTON\n        #undef MAP_ANALOG\n    }\n#endif // #ifndef IMGUI_IMPL_WIN32_DISABLE_GAMEPAD\n}\n\nvoid    ImGui_ImplWin32_NewFrame()\n{\n    ImGuiIO& io = ImGui::GetIO();\n    ImGui_ImplWin32_Data* bd = ImGui_ImplWin32_GetBackendData();\n    IM_ASSERT(bd != NULL && \"Did you call ImGui_ImplWin32_Init()?\");\n\n    // Setup display size (every frame to accommodate for window resizing)\n    RECT rect = { 0, 0, 0, 0 };\n    ::GetClientRect(bd->hWnd, &rect);\n    io.DisplaySize = ImVec2((float)(rect.right - rect.left), (float)(rect.bottom - rect.top));\n\n    // Setup time step\n    INT64 current_time = 0;\n    ::QueryPerformanceCounter((LARGE_INTEGER*)&current_time);\n    io.DeltaTime = (float)(current_time - bd->Time) / bd->TicksPerSecond;\n    bd->Time = current_time;\n\n    // Update OS mouse position\n    ImGui_ImplWin32_UpdateMousePos();\n\n    // Update OS mouse cursor with the cursor requested by imgui\n    ImGuiMouseCursor mouse_cursor = io.MouseDrawCursor ? ImGuiMouseCursor_None : ImGui::GetMouseCursor();\n    if (bd->LastMouseCursor != mouse_cursor)\n    {\n        bd->LastMouseCursor = mouse_cursor;\n        ImGui_ImplWin32_UpdateMouseCursor();\n    }\n\n    // Update game controllers (if enabled and available)\n    ImGui_ImplWin32_UpdateGamepads();\n}\n\n// Allow compilation with old Windows SDK. MinGW doesn't have default _WIN32_WINNT/WINVER versions.\n#ifndef WM_MOUSEHWHEEL\n#define WM_MOUSEHWHEEL 0x020E\n#endif\n#ifndef DBT_DEVNODES_CHANGED\n#define DBT_DEVNODES_CHANGED 0x0007\n#endif\n\n// Win32 message handler (process Win32 mouse/keyboard inputs, etc.)\n// Call from your application's message handler.\n// When implementing your own backend, you can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if Dear ImGui wants to use your inputs.\n// - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application.\n// - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application.\n// Generally you may always pass all inputs to Dear ImGui, and hide them from your application based on those two flags.\n// PS: In this Win32 handler, we use the capture API (GetCapture/SetCapture/ReleaseCapture) to be able to read mouse coordinates when dragging mouse outside of our window bounds.\n// PS: We treat DBLCLK messages as regular mouse down messages, so this code will work on windows classes that have the CS_DBLCLKS flag set. Our own example app code doesn't set this flag.\n#if 0\n// Copy this line into your .cpp file to forward declare the function.\nextern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);\n#endif\nIMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)\n{\n    if (ImGui::GetCurrentContext() == NULL)\n        return 0;\n\n    ImGuiIO& io = ImGui::GetIO();\n    ImGui_ImplWin32_Data* bd = ImGui_ImplWin32_GetBackendData();\n\n    switch (msg)\n    {\n    case WM_MOUSEMOVE:\n        // We need to call TrackMouseEvent in order to receive WM_MOUSELEAVE events\n        bd->MouseHwnd = hwnd;\n        if (!bd->MouseTracked)\n        {\n            TRACKMOUSEEVENT tme = { sizeof(tme), TME_LEAVE, hwnd, 0 };\n            ::TrackMouseEvent(&tme);\n            bd->MouseTracked = true;\n        }\n        break;\n    case WM_MOUSELEAVE:\n        if (bd->MouseHwnd == hwnd)\n            bd->MouseHwnd = NULL;\n        bd->MouseTracked = false;\n        break;\n    case WM_LBUTTONDOWN: case WM_LBUTTONDBLCLK:\n    case WM_RBUTTONDOWN: case WM_RBUTTONDBLCLK:\n    case WM_MBUTTONDOWN: case WM_MBUTTONDBLCLK:\n    case WM_XBUTTONDOWN: case WM_XBUTTONDBLCLK:\n    {\n        int button = 0;\n        if (msg == WM_LBUTTONDOWN || msg == WM_LBUTTONDBLCLK) { button = 0; }\n        if (msg == WM_RBUTTONDOWN || msg == WM_RBUTTONDBLCLK) { button = 1; }\n        if (msg == WM_MBUTTONDOWN || msg == WM_MBUTTONDBLCLK) { button = 2; }\n        if (msg == WM_XBUTTONDOWN || msg == WM_XBUTTONDBLCLK) { button = (GET_XBUTTON_WPARAM(wParam) == XBUTTON1) ? 3 : 4; }\n        if (!ImGui::IsAnyMouseDown() && ::GetCapture() == NULL)\n            ::SetCapture(hwnd);\n        io.MouseDown[button] = true;\n        return 0;\n    }\n    case WM_LBUTTONUP:\n    case WM_RBUTTONUP:\n    case WM_MBUTTONUP:\n    case WM_XBUTTONUP:\n    {\n        int button = 0;\n        if (msg == WM_LBUTTONUP) { button = 0; }\n        if (msg == WM_RBUTTONUP) { button = 1; }\n        if (msg == WM_MBUTTONUP) { button = 2; }\n        if (msg == WM_XBUTTONUP) { button = (GET_XBUTTON_WPARAM(wParam) == XBUTTON1) ? 3 : 4; }\n        io.MouseDown[button] = false;\n        if (!ImGui::IsAnyMouseDown() && ::GetCapture() == hwnd)\n            ::ReleaseCapture();\n        return 0;\n    }\n    case WM_MOUSEWHEEL:\n        io.MouseWheel += (float)GET_WHEEL_DELTA_WPARAM(wParam) / (float)WHEEL_DELTA;\n        return 0;\n    case WM_MOUSEHWHEEL:\n        io.MouseWheelH += (float)GET_WHEEL_DELTA_WPARAM(wParam) / (float)WHEEL_DELTA;\n        return 0;\n    case WM_KEYDOWN:\n    case WM_KEYUP:\n    case WM_SYSKEYDOWN:\n    case WM_SYSKEYUP:\n    {\n        bool down = (msg == WM_KEYDOWN || msg == WM_SYSKEYDOWN);\n        if (wParam < 256)\n            io.KeysDown[wParam] = down;\n        if (wParam == VK_CONTROL)\n            io.KeyCtrl = down;\n        if (wParam == VK_SHIFT)\n            io.KeyShift = down;\n        if (wParam == VK_MENU)\n            io.KeyAlt = down;\n        return 0;\n    }\n    case WM_SETFOCUS:\n    case WM_KILLFOCUS:\n        io.AddFocusEvent(msg == WM_SETFOCUS);\n        return 0;\n    case WM_CHAR:\n        // You can also use ToAscii()+GetKeyboardState() to retrieve characters.\n        if (wParam > 0 && wParam < 0x10000)\n            io.AddInputCharacterUTF16((unsigned short)wParam);\n        return 0;\n    case WM_SETCURSOR:\n        if (LOWORD(lParam) == HTCLIENT && ImGui_ImplWin32_UpdateMouseCursor())\n            return 1;\n        return 0;\n    case WM_DEVICECHANGE:\n        if ((UINT)wParam == DBT_DEVNODES_CHANGED)\n            bd->WantUpdateHasGamepad = true;\n        return 0;\n    }\n    return 0;\n}\n\n\n//--------------------------------------------------------------------------------------------------------\n// DPI-related helpers (optional)\n//--------------------------------------------------------------------------------------------------------\n// - Use to enable DPI awareness without having to create an application manifest.\n// - Your own app may already do this via a manifest or explicit calls. This is mostly useful for our examples/ apps.\n// - In theory we could call simple functions from Windows SDK such as SetProcessDPIAware(), SetProcessDpiAwareness(), etc.\n//   but most of the functions provided by Microsoft require Windows 8.1/10+ SDK at compile time and Windows 8/10+ at runtime,\n//   neither we want to require the user to have. So we dynamically select and load those functions to avoid dependencies.\n//---------------------------------------------------------------------------------------------------------\n// This is the scheme successfully used by GLFW (from which we borrowed some of the code) and other apps aiming to be highly portable.\n// ImGui_ImplWin32_EnableDpiAwareness() is just a helper called by main.cpp, we don't call it automatically.\n// If you are trying to implement your own backend for your own engine, you may ignore that noise.\n//---------------------------------------------------------------------------------------------------------\n\n// Perform our own check with RtlVerifyVersionInfo() instead of using functions from <VersionHelpers.h> as they\n// require a manifest to be functional for checks above 8.1. See https://github.com/ocornut/imgui/issues/4200\nstatic BOOL _IsWindowsVersionOrGreater(WORD major, WORD minor, WORD)\n{\n    typedef LONG(WINAPI* PFN_RtlVerifyVersionInfo)(OSVERSIONINFOEXW*, ULONG, ULONGLONG);\n    static PFN_RtlVerifyVersionInfo RtlVerifyVersionInfoFn = NULL;\n\tif (RtlVerifyVersionInfoFn == NULL)\n\t\tif (HMODULE ntdllModule = ::GetModuleHandleA(\"ntdll.dll\"))\n\t\t\tRtlVerifyVersionInfoFn = (PFN_RtlVerifyVersionInfo)GetProcAddress(ntdllModule, \"RtlVerifyVersionInfo\");\n    if (RtlVerifyVersionInfoFn == NULL)\n        return FALSE;\n\n    RTL_OSVERSIONINFOEXW versionInfo = { };\n    ULONGLONG conditionMask = 0;\n    versionInfo.dwOSVersionInfoSize = sizeof(RTL_OSVERSIONINFOEXW);\n    versionInfo.dwMajorVersion = major;\n\tversionInfo.dwMinorVersion = minor;\n\tVER_SET_CONDITION(conditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL);\n\tVER_SET_CONDITION(conditionMask, VER_MINORVERSION, VER_GREATER_EQUAL);\n\treturn (RtlVerifyVersionInfoFn(&versionInfo, VER_MAJORVERSION | VER_MINORVERSION, conditionMask) == 0) ? TRUE : FALSE;\n}\n\n#define _IsWindowsVistaOrGreater()   _IsWindowsVersionOrGreater(HIBYTE(0x0600), LOBYTE(0x0600), 0) // _WIN32_WINNT_VISTA\n#define _IsWindows8OrGreater()       _IsWindowsVersionOrGreater(HIBYTE(0x0602), LOBYTE(0x0602), 0) // _WIN32_WINNT_WIN8\n#define _IsWindows8Point1OrGreater() _IsWindowsVersionOrGreater(HIBYTE(0x0603), LOBYTE(0x0603), 0) // _WIN32_WINNT_WINBLUE\n#define _IsWindows10OrGreater()      _IsWindowsVersionOrGreater(HIBYTE(0x0A00), LOBYTE(0x0A00), 0) // _WIN32_WINNT_WINTHRESHOLD / _WIN32_WINNT_WIN10\n\n#ifndef DPI_ENUMS_DECLARED\ntypedef enum { PROCESS_DPI_UNAWARE = 0, PROCESS_SYSTEM_DPI_AWARE = 1, PROCESS_PER_MONITOR_DPI_AWARE = 2 } PROCESS_DPI_AWARENESS;\ntypedef enum { MDT_EFFECTIVE_DPI = 0, MDT_ANGULAR_DPI = 1, MDT_RAW_DPI = 2, MDT_DEFAULT = MDT_EFFECTIVE_DPI } MONITOR_DPI_TYPE;\n#endif\n#ifndef _DPI_AWARENESS_CONTEXTS_\nDECLARE_HANDLE(DPI_AWARENESS_CONTEXT);\n#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE    (DPI_AWARENESS_CONTEXT)-3\n#endif\n#ifndef DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2\n#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 (DPI_AWARENESS_CONTEXT)-4\n#endif\ntypedef HRESULT(WINAPI* PFN_SetProcessDpiAwareness)(PROCESS_DPI_AWARENESS);                     // Shcore.lib + dll, Windows 8.1+\ntypedef HRESULT(WINAPI* PFN_GetDpiForMonitor)(HMONITOR, MONITOR_DPI_TYPE, UINT*, UINT*);        // Shcore.lib + dll, Windows 8.1+\ntypedef DPI_AWARENESS_CONTEXT(WINAPI* PFN_SetThreadDpiAwarenessContext)(DPI_AWARENESS_CONTEXT); // User32.lib + dll, Windows 10 v1607+ (Creators Update)\n\n// Helper function to enable DPI awareness without setting up a manifest\nvoid ImGui_ImplWin32_EnableDpiAwareness()\n{\n    if (_IsWindows10OrGreater())\n    {\n        static HINSTANCE user32_dll = ::LoadLibraryA(\"user32.dll\"); // Reference counted per-process\n        if (PFN_SetThreadDpiAwarenessContext SetThreadDpiAwarenessContextFn = (PFN_SetThreadDpiAwarenessContext)::GetProcAddress(user32_dll, \"SetThreadDpiAwarenessContext\"))\n        {\n            SetThreadDpiAwarenessContextFn(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);\n            return;\n        }\n    }\n    if (_IsWindows8Point1OrGreater())\n    {\n        static HINSTANCE shcore_dll = ::LoadLibraryA(\"shcore.dll\"); // Reference counted per-process\n        if (PFN_SetProcessDpiAwareness SetProcessDpiAwarenessFn = (PFN_SetProcessDpiAwareness)::GetProcAddress(shcore_dll, \"SetProcessDpiAwareness\"))\n        {\n            SetProcessDpiAwarenessFn(PROCESS_PER_MONITOR_DPI_AWARE);\n            return;\n        }\n    }\n#if _WIN32_WINNT >= 0x0600\n    ::SetProcessDPIAware();\n#endif\n}\n\n#if defined(_MSC_VER) && !defined(NOGDI)\n#pragma comment(lib, \"gdi32\")   // Link with gdi32.lib for GetDeviceCaps(). MinGW will require linking with '-lgdi32'\n#endif\n\nfloat ImGui_ImplWin32_GetDpiScaleForMonitor(void* monitor)\n{\n    UINT xdpi = 96, ydpi = 96;\n    if (_IsWindows8Point1OrGreater())\n    {\n\t\tstatic HINSTANCE shcore_dll = ::LoadLibraryA(\"shcore.dll\"); // Reference counted per-process\n\t\tstatic PFN_GetDpiForMonitor GetDpiForMonitorFn = NULL;\n\t\tif (GetDpiForMonitorFn == NULL && shcore_dll != NULL)\n            GetDpiForMonitorFn = (PFN_GetDpiForMonitor)::GetProcAddress(shcore_dll, \"GetDpiForMonitor\");\n\t\tif (GetDpiForMonitorFn != NULL)\n\t\t{\n\t\t\tGetDpiForMonitorFn((HMONITOR)monitor, MDT_EFFECTIVE_DPI, &xdpi, &ydpi);\n            IM_ASSERT(xdpi == ydpi); // Please contact me if you hit this assert!\n\t\t\treturn xdpi / 96.0f;\n\t\t}\n    }\n#ifndef NOGDI\n    const HDC dc = ::GetDC(NULL);\n    xdpi = ::GetDeviceCaps(dc, LOGPIXELSX);\n    ydpi = ::GetDeviceCaps(dc, LOGPIXELSY);\n    IM_ASSERT(xdpi == ydpi); // Please contact me if you hit this assert!\n    ::ReleaseDC(NULL, dc);\n#endif\n    return xdpi / 96.0f;\n}\n\nfloat ImGui_ImplWin32_GetDpiScaleForHwnd(void* hwnd)\n{\n    HMONITOR monitor = ::MonitorFromWindow((HWND)hwnd, MONITOR_DEFAULTTONEAREST);\n    return ImGui_ImplWin32_GetDpiScaleForMonitor(monitor);\n}\n\n//---------------------------------------------------------------------------------------------------------\n// Transparency related helpers (optional)\n//--------------------------------------------------------------------------------------------------------\n\n#if defined(_MSC_VER)\n#pragma comment(lib, \"dwmapi\")  // Link with dwmapi.lib. MinGW will require linking with '-ldwmapi'\n#endif\n\n// [experimental]\n// Borrowed from GLFW's function updateFramebufferTransparency() in src/win32_window.c\n// (the Dwm* functions are Vista era functions but we are borrowing logic from GLFW)\nvoid ImGui_ImplWin32_EnableAlphaCompositing(void* hwnd)\n{\n    if (!_IsWindowsVistaOrGreater())\n        return;\n\n    BOOL composition;\n    if (FAILED(::DwmIsCompositionEnabled(&composition)) || !composition)\n        return;\n\n    BOOL opaque;\n    DWORD color;\n    if (_IsWindows8OrGreater() || (SUCCEEDED(::DwmGetColorizationColor(&color, &opaque)) && !opaque))\n    {\n        HRGN region = ::CreateRectRgn(0, 0, -1, -1);\n        DWM_BLURBEHIND bb = {};\n        bb.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION;\n        bb.hRgnBlur = region;\n        bb.fEnable = TRUE;\n        ::DwmEnableBlurBehindWindow((HWND)hwnd, &bb);\n        ::DeleteObject(region);\n    }\n    else\n    {\n        DWM_BLURBEHIND bb = {};\n        bb.dwFlags = DWM_BB_ENABLE;\n        ::DwmEnableBlurBehindWindow((HWND)hwnd, &bb);\n    }\n}\n\n//---------------------------------------------------------------------------------------------------------\n"
  },
  {
    "path": "R3nzSkin/imgui/imgui_impl_win32.h",
    "content": "// dear imgui: Platform Backend for Windows (standard windows API for 32 and 64 bits applications)\n// This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..)\n\n// Implemented features:\n//  [X] Platform: Clipboard support (for Win32 this is actually part of core dear imgui)\n//  [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.\n//  [X] Platform: Keyboard arrays indexed using VK_* Virtual Key Codes, e.g. ImGui::IsKeyPressed(VK_SPACE).\n//  [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.\n\n// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. \n// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.\n// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.\n// Read online: https://github.com/ocornut/imgui/tree/master/docs\n\n#pragma once\n#include \"imgui.h\"      // IMGUI_IMPL_API\n\nIMGUI_IMPL_API bool     ImGui_ImplWin32_Init(void* hwnd);\nIMGUI_IMPL_API void     ImGui_ImplWin32_Shutdown();\nIMGUI_IMPL_API void     ImGui_ImplWin32_NewFrame();\n\n// Win32 message handler your application need to call.\n// - Intentionally commented out in a '#if 0' block to avoid dragging dependencies on <windows.h> from this helper.\n// - You should COPY the line below into your .cpp code to forward declare the function and then you can call it.\n#if 0\nextern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);\n#endif\n\n// DPI-related helpers (optional)\n// - Use to enable DPI awareness without having to create an application manifest.\n// - Your own app may already do this via a manifest or explicit calls. This is mostly useful for our examples/ apps.\n// - In theory we could call simple functions from Windows SDK such as SetProcessDPIAware(), SetProcessDpiAwareness(), etc.\n//   but most of the functions provided by Microsoft require Windows 8.1/10+ SDK at compile time and Windows 8/10+ at runtime,\n//   neither we want to require the user to have. So we dynamically select and load those functions to avoid dependencies.\nIMGUI_IMPL_API void     ImGui_ImplWin32_EnableDpiAwareness();\nIMGUI_IMPL_API float    ImGui_ImplWin32_GetDpiScaleForHwnd(void* hwnd);       // HWND hwnd\nIMGUI_IMPL_API float    ImGui_ImplWin32_GetDpiScaleForMonitor(void* monitor); // HMONITOR monitor\n\n// Transparency related helpers (optional) [experimental]\n// - Use to enable alpha compositing transparency with the desktop.\n// - Use together with e.g. clearing your framebuffer with zero-alpha.\nIMGUI_IMPL_API void     ImGui_ImplWin32_EnableAlphaCompositing(void* hwnd);   // HWND hwnd\n"
  },
  {
    "path": "R3nzSkin/imgui/imgui_internal.h",
    "content": "// dear imgui, v1.84\n// (internal structures/api)\n\n// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!\n// Set:\n//   #define IMGUI_DEFINE_MATH_OPERATORS\n// To implement maths operators for ImVec2 (disabled by default to not collide with using IM_VEC2_CLASS_EXTRA along with your own math types+operators)\n\n/*\n\nIndex of this file:\n\n// [SECTION] Header mess\n// [SECTION] Forward declarations\n// [SECTION] Context pointer\n// [SECTION] STB libraries includes\n// [SECTION] Macros\n// [SECTION] Generic helpers\n// [SECTION] ImDrawList support\n// [SECTION] Widgets support: flags, enums, data structures\n// [SECTION] Columns support\n// [SECTION] Multi-select support\n// [SECTION] Docking support\n// [SECTION] Viewport support\n// [SECTION] Settings support\n// [SECTION] Metrics, Debug\n// [SECTION] Generic context hooks\n// [SECTION] ImGuiContext (main imgui context)\n// [SECTION] ImGuiWindowTempData, ImGuiWindow\n// [SECTION] Tab bar, Tab item support\n// [SECTION] Table support\n// [SECTION] ImGui internal API\n// [SECTION] ImFontAtlas internal API\n// [SECTION] Test Engine specific hooks (imgui_test_engine)\n\n*/\n\n#pragma once\n#ifndef IMGUI_DISABLE\n\n//-----------------------------------------------------------------------------\n// [SECTION] Header mess\n//-----------------------------------------------------------------------------\n\n#ifndef IMGUI_VERSION\n#include \"imgui.h\"\n#endif\n\n#include <stdio.h>      // FILE*, sscanf\n#include <stdlib.h>     // NULL, malloc, free, qsort, atoi, atof\n#include <math.h>       // sqrtf, fabsf, fmodf, powf, floorf, ceilf, cosf, sinf\n#include <limits.h>     // INT_MIN, INT_MAX\n\n// Enable SSE intrinsics if available\n#if (defined __SSE__ || defined __x86_64__ || defined _M_X64) && !defined(IMGUI_DISABLE_SSE)\n#define IMGUI_ENABLE_SSE\n#include <immintrin.h>\n#endif\n\n// Visual Studio warnings\n#ifdef _MSC_VER\n#pragma warning (push)\n#pragma warning (disable: 4251)     // class 'xxx' needs to have dll-interface to be used by clients of struct 'xxx' // when IMGUI_API is set to__declspec(dllexport)\n#pragma warning (disable: 26812)    // The enum type 'xxx' is unscoped. Prefer 'enum class' over 'enum' (Enum.3). [MSVC Static Analyzer)\n#pragma warning (disable: 26495)    // [Static Analyzer] Variable 'XXX' is uninitialized. Always initialize a member variable (type.6).\n#if defined(_MSC_VER) && _MSC_VER >= 1922 // MSVC 2019 16.2 or later\n#pragma warning (disable: 5054)     // operator '|': deprecated between enumerations of different types\n#endif\n#endif\n\n// Clang/GCC warnings with -Weverything\n#if defined(__clang__)\n#pragma clang diagnostic push\n#if __has_warning(\"-Wunknown-warning-option\")\n#pragma clang diagnostic ignored \"-Wunknown-warning-option\"         // warning: unknown warning group 'xxx'\n#endif\n#pragma clang diagnostic ignored \"-Wunknown-pragmas\"                // warning: unknown warning group 'xxx'\n#pragma clang diagnostic ignored \"-Wfloat-equal\"                    // warning: comparing floating point with == or != is unsafe // storing and comparing against same constants ok, for ImFloorSigned()\n#pragma clang diagnostic ignored \"-Wunused-function\"                // for stb_textedit.h\n#pragma clang diagnostic ignored \"-Wmissing-prototypes\"             // for stb_textedit.h\n#pragma clang diagnostic ignored \"-Wold-style-cast\"\n#pragma clang diagnostic ignored \"-Wzero-as-null-pointer-constant\"\n#pragma clang diagnostic ignored \"-Wdouble-promotion\"\n#pragma clang diagnostic ignored \"-Wimplicit-int-float-conversion\"  // warning: implicit conversion from 'xxx' to 'float' may lose precision\n#elif defined(__GNUC__)\n#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored \"-Wpragmas\"              // warning: unknown option after '#pragma GCC diagnostic' kind\n#pragma GCC diagnostic ignored \"-Wclass-memaccess\"      // [__GNUC__ >= 8] warning: 'memset/memcpy' clearing/writing an object of type 'xxxx' with no trivial copy-assignment; use assignment or value-initialization instead\n#endif\n\n// Helper macros\n#if defined(__clang__)\n#define IM_NORETURN     __attribute__((noreturn))\n#else\n#define IM_NORETURN\n#endif\n\n// Legacy defines\n#ifdef IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS            // Renamed in 1.74\n#error Use IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS\n#endif\n#ifdef IMGUI_DISABLE_MATH_FUNCTIONS                     // Renamed in 1.74\n#error Use IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS\n#endif\n\n// Enable stb_truetype by default unless FreeType is enabled.\n// You can compile with both by defining both IMGUI_ENABLE_FREETYPE and IMGUI_ENABLE_STB_TRUETYPE together.\n#ifndef IMGUI_ENABLE_FREETYPE\n#define IMGUI_ENABLE_STB_TRUETYPE\n#endif\n\n//-----------------------------------------------------------------------------\n// [SECTION] Forward declarations\n//-----------------------------------------------------------------------------\n\nstruct ImBitVector;                 // Store 1-bit per value\nstruct ImRect;                      // An axis-aligned rectangle (2 points)\nstruct ImDrawDataBuilder;           // Helper to build a ImDrawData instance\nstruct ImDrawListSharedData;        // Data shared between all ImDrawList instances\nstruct ImGuiColorMod;               // Stacked color modifier, backup of modified data so we can restore it\nstruct ImGuiContext;                // Main Dear ImGui context\nstruct ImGuiContextHook;            // Hook for extensions like ImGuiTestEngine\nstruct ImGuiDataTypeInfo;           // Type information associated to a ImGuiDataType enum\nstruct ImGuiGroupData;              // Stacked storage data for BeginGroup()/EndGroup()\nstruct ImGuiInputTextState;         // Internal state of the currently focused/edited text input box\nstruct ImGuiLastItemData;           // Status storage for last submitted items\nstruct ImGuiMenuColumns;            // Simple column measurement, currently used for MenuItem() only\nstruct ImGuiNavItemData;            // Result of a gamepad/keyboard directional navigation move query result\nstruct ImGuiMetricsConfig;          // Storage for ShowMetricsWindow() and DebugNodeXXX() functions\nstruct ImGuiNextWindowData;         // Storage for SetNextWindow** functions\nstruct ImGuiNextItemData;           // Storage for SetNextItem** functions\nstruct ImGuiOldColumnData;          // Storage data for a single column for legacy Columns() api\nstruct ImGuiOldColumns;             // Storage data for a columns set for legacy Columns() api\nstruct ImGuiPopupData;              // Storage for current popup stack\nstruct ImGuiSettingsHandler;        // Storage for one type registered in the .ini file\nstruct ImGuiStackSizes;             // Storage of stack sizes for debugging/asserting\nstruct ImGuiStyleMod;               // Stacked style modifier, backup of modified data so we can restore it\nstruct ImGuiTabBar;                 // Storage for a tab bar\nstruct ImGuiTabItem;                // Storage for a tab item (within a tab bar)\nstruct ImGuiTable;                  // Storage for a table\nstruct ImGuiTableColumn;            // Storage for one column of a table\nstruct ImGuiTableTempData;          // Temporary storage for one table (one per table in the stack), shared between tables.\nstruct ImGuiTableSettings;          // Storage for a table .ini settings\nstruct ImGuiTableColumnsSettings;   // Storage for a column .ini settings\nstruct ImGuiWindow;                 // Storage for one window\nstruct ImGuiWindowTempData;         // Temporary storage for one window (that's the data which in theory we could ditch at the end of the frame, in practice we currently keep it for each window)\nstruct ImGuiWindowSettings;         // Storage for a window .ini settings (we keep one of those even if the actual window wasn't instanced during this session)\n\n// Use your programming IDE \"Go to definition\" facility on the names of the center columns to find the actual flags/enum lists.\ntypedef int ImGuiLayoutType;            // -> enum ImGuiLayoutType_         // Enum: Horizontal or vertical\ntypedef int ImGuiItemFlags;             // -> enum ImGuiItemFlags_          // Flags: for PushItemFlag()\ntypedef int ImGuiItemAddFlags;          // -> enum ImGuiItemAddFlags_       // Flags: for ItemAdd()\ntypedef int ImGuiItemStatusFlags;       // -> enum ImGuiItemStatusFlags_    // Flags: for DC.LastItemStatusFlags\ntypedef int ImGuiOldColumnFlags;        // -> enum ImGuiOldColumnFlags_     // Flags: for BeginColumns()\ntypedef int ImGuiNavHighlightFlags;     // -> enum ImGuiNavHighlightFlags_  // Flags: for RenderNavHighlight()\ntypedef int ImGuiNavDirSourceFlags;     // -> enum ImGuiNavDirSourceFlags_  // Flags: for GetNavInputAmount2d()\ntypedef int ImGuiNavMoveFlags;          // -> enum ImGuiNavMoveFlags_       // Flags: for navigation requests\ntypedef int ImGuiNextItemDataFlags;     // -> enum ImGuiNextItemDataFlags_  // Flags: for SetNextItemXXX() functions\ntypedef int ImGuiNextWindowDataFlags;   // -> enum ImGuiNextWindowDataFlags_// Flags: for SetNextWindowXXX() functions\ntypedef int ImGuiSeparatorFlags;        // -> enum ImGuiSeparatorFlags_     // Flags: for SeparatorEx()\ntypedef int ImGuiTextFlags;             // -> enum ImGuiTextFlags_          // Flags: for TextEx()\ntypedef int ImGuiTooltipFlags;          // -> enum ImGuiTooltipFlags_       // Flags: for BeginTooltipEx()\n\ntypedef void (*ImGuiErrorLogCallback)(void* user_data, const char* fmt, ...);\n\n//-----------------------------------------------------------------------------\n// [SECTION] Context pointer\n// See implementation of this variable in imgui.cpp for comments and details.\n//-----------------------------------------------------------------------------\n\n#ifndef GImGui\nextern IMGUI_API ImGuiContext* GImGui;  // Current implicit context pointer\n#endif\n\n//-------------------------------------------------------------------------\n// [SECTION] STB libraries includes\n//-------------------------------------------------------------------------\n\nnamespace ImStb\n{\n\n#undef STB_TEXTEDIT_STRING\n#undef STB_TEXTEDIT_CHARTYPE\n#define STB_TEXTEDIT_STRING             ImGuiInputTextState\n#define STB_TEXTEDIT_CHARTYPE           ImWchar\n#define STB_TEXTEDIT_GETWIDTH_NEWLINE   (-1.0f)\n#define STB_TEXTEDIT_UNDOSTATECOUNT     99\n#define STB_TEXTEDIT_UNDOCHARCOUNT      999\n#include \"imstb_textedit.h\"\n\n} // namespace ImStb\n\n//-----------------------------------------------------------------------------\n// [SECTION] Macros\n//-----------------------------------------------------------------------------\n\n// Debug Logging\n#ifndef IMGUI_DEBUG_LOG\n#define IMGUI_DEBUG_LOG(_FMT,...)       printf(\"[%05d] \" _FMT, GImGui->FrameCount, __VA_ARGS__)\n#endif\n\n// Debug Logging for selected systems. Remove the '((void)0) //' to enable.\n//#define IMGUI_DEBUG_LOG_POPUP         IMGUI_DEBUG_LOG // Enable log\n//#define IMGUI_DEBUG_LOG_NAV           IMGUI_DEBUG_LOG // Enable log\n#define IMGUI_DEBUG_LOG_POPUP(...)      ((void)0)       // Disable log\n#define IMGUI_DEBUG_LOG_NAV(...)        ((void)0)       // Disable log\n\n// Static Asserts\n#if (__cplusplus >= 201100) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201100)\n#define IM_STATIC_ASSERT(_COND)         static_assert(_COND, \"\")\n#else\n#define IM_STATIC_ASSERT(_COND)         typedef char static_assertion_##__line__[(_COND)?1:-1]\n#endif\n\n// \"Paranoid\" Debug Asserts are meant to only be enabled during specific debugging/work, otherwise would slow down the code too much.\n// We currently don't have many of those so the effect is currently negligible, but onward intent to add more aggressive ones in the code.\n//#define IMGUI_DEBUG_PARANOID\n#ifdef IMGUI_DEBUG_PARANOID\n#define IM_ASSERT_PARANOID(_EXPR)       IM_ASSERT(_EXPR)\n#else\n#define IM_ASSERT_PARANOID(_EXPR)\n#endif\n\n// Error handling\n// Down the line in some frameworks/languages we would like to have a way to redirect those to the programmer and recover from more faults.\n#ifndef IM_ASSERT_USER_ERROR\n#define IM_ASSERT_USER_ERROR(_EXP,_MSG) IM_ASSERT((_EXP) && _MSG)   // Recoverable User Error\n#endif\n\n// Misc Macros\n#define IM_PI                           3.14159265358979323846f\n#ifdef _WIN32\n#define IM_NEWLINE                      \"\\r\\n\"   // Play it nice with Windows users (Update: since 2018-05, Notepad finally appears to support Unix-style carriage returns!)\n#else\n#define IM_NEWLINE                      \"\\n\"\n#endif\n#define IM_TABSIZE                      (4)\n#define IM_MEMALIGN(_OFF,_ALIGN)        (((_OFF) + (_ALIGN - 1)) & ~(_ALIGN - 1))               // Memory align e.g. IM_ALIGN(0,4)=0, IM_ALIGN(1,4)=4, IM_ALIGN(4,4)=4, IM_ALIGN(5,4)=8\n#define IM_F32_TO_INT8_UNBOUND(_VAL)    ((int)((_VAL) * 255.0f + ((_VAL)>=0 ? 0.5f : -0.5f)))   // Unsaturated, for display purpose\n#define IM_F32_TO_INT8_SAT(_VAL)        ((int)(ImSaturate(_VAL) * 255.0f + 0.5f))               // Saturated, always output 0..255\n#define IM_FLOOR(_VAL)                  ((float)(int)(_VAL))                                    // ImFloor() is not inlined in MSVC debug builds\n#define IM_ROUND(_VAL)                  ((float)(int)((_VAL) + 0.5f))                           //\n\n// Enforce cdecl calling convention for functions called by the standard library, in case compilation settings changed the default to e.g. __vectorcall\n#ifdef _MSC_VER\n#define IMGUI_CDECL __cdecl\n#else\n#define IMGUI_CDECL\n#endif\n\n// Warnings\n#if defined(_MSC_VER) && !defined(__clang__)\n#define IM_MSVC_WARNING_SUPPRESS(XXXX)  __pragma(warning(suppress: XXXX))\n#else\n#define IM_MSVC_WARNING_SUPPRESS(XXXX)\n#endif\n\n// Debug Tools\n// Use 'Metrics->Tools->Item Picker' to break into the call-stack of a specific item.\n#ifndef IM_DEBUG_BREAK\n#if defined(__clang__)\n#define IM_DEBUG_BREAK()    __builtin_debugtrap()\n#elif defined (_MSC_VER)\n#define IM_DEBUG_BREAK()    __debugbreak()\n#else\n#define IM_DEBUG_BREAK()    IM_ASSERT(0)    // It is expected that you define IM_DEBUG_BREAK() into something that will break nicely in a debugger!\n#endif\n#endif // #ifndef IM_DEBUG_BREAK\n\n//-----------------------------------------------------------------------------\n// [SECTION] Generic helpers\n// Note that the ImXXX helpers functions are lower-level than ImGui functions.\n// ImGui functions or the ImGui context are never called/used from other ImXXX functions.\n//-----------------------------------------------------------------------------\n// - Helpers: Hashing\n// - Helpers: Sorting\n// - Helpers: Bit manipulation\n// - Helpers: String, Formatting\n// - Helpers: UTF-8 <> wchar conversions\n// - Helpers: ImVec2/ImVec4 operators\n// - Helpers: Maths\n// - Helpers: Geometry\n// - Helper: ImVec1\n// - Helper: ImVec2ih\n// - Helper: ImRect\n// - Helper: ImBitArray\n// - Helper: ImBitVector\n// - Helper: ImSpan<>, ImSpanAllocator<>\n// - Helper: ImPool<>\n// - Helper: ImChunkStream<>\n//-----------------------------------------------------------------------------\n\n// Helpers: Hashing\nIMGUI_API ImGuiID       ImHashData(const void* data, size_t data_size, ImU32 seed = 0);\nIMGUI_API ImGuiID       ImHashStr(const char* data, size_t data_size = 0, ImU32 seed = 0);\n#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS\nstatic inline ImGuiID   ImHash(const void* data, int size, ImU32 seed = 0) { return size ? ImHashData(data, (size_t)size, seed) : ImHashStr((const char*)data, 0, seed); } // [moved to ImHashStr/ImHashData in 1.68]\n#endif\n\n// Helpers: Sorting\n#define ImQsort         qsort\n\n// Helpers: Color Blending\nIMGUI_API ImU32         ImAlphaBlendColors(ImU32 col_a, ImU32 col_b);\n\n// Helpers: Bit manipulation\nstatic inline bool      ImIsPowerOfTwo(int v)           { return v != 0 && (v & (v - 1)) == 0; }\nstatic inline bool      ImIsPowerOfTwo(ImU64 v)         { return v != 0 && (v & (v - 1)) == 0; }\nstatic inline int       ImUpperPowerOfTwo(int v)        { v--; v |= v >> 1; v |= v >> 2; v |= v >> 4; v |= v >> 8; v |= v >> 16; v++; return v; }\n\n// Helpers: String, Formatting\nIMGUI_API int           ImStricmp(const char* str1, const char* str2);\nIMGUI_API int           ImStrnicmp(const char* str1, const char* str2, size_t count);\nIMGUI_API void          ImStrncpy(char* dst, const char* src, size_t count);\nIMGUI_API char*         ImStrdup(const char* str);\nIMGUI_API char*         ImStrdupcpy(char* dst, size_t* p_dst_size, const char* str);\nIMGUI_API const char*   ImStrchrRange(const char* str_begin, const char* str_end, char c);\nIMGUI_API int           ImStrlenW(const ImWchar* str);\nIMGUI_API const char*   ImStreolRange(const char* str, const char* str_end);                // End end-of-line\nIMGUI_API const ImWchar*ImStrbolW(const ImWchar* buf_mid_line, const ImWchar* buf_begin);   // Find beginning-of-line\nIMGUI_API const char*   ImStristr(const char* haystack, const char* haystack_end, const char* needle, const char* needle_end);\nIMGUI_API void          ImStrTrimBlanks(char* str);\nIMGUI_API const char*   ImStrSkipBlank(const char* str);\nIMGUI_API int           ImFormatString(char* buf, size_t buf_size, const char* fmt, ...) IM_FMTARGS(3);\nIMGUI_API int           ImFormatStringV(char* buf, size_t buf_size, const char* fmt, va_list args) IM_FMTLIST(3);\nIMGUI_API const char*   ImParseFormatFindStart(const char* format);\nIMGUI_API const char*   ImParseFormatFindEnd(const char* format);\nIMGUI_API const char*   ImParseFormatTrimDecorations(const char* format, char* buf, size_t buf_size);\nIMGUI_API int           ImParseFormatPrecision(const char* format, int default_value);\nstatic inline bool      ImCharIsBlankA(char c)          { return c == ' ' || c == '\\t'; }\nstatic inline bool      ImCharIsBlankW(unsigned int c)  { return c == ' ' || c == '\\t' || c == 0x3000; }\n\n// Helpers: UTF-8 <> wchar conversions\nIMGUI_API const char*   ImTextCharToUtf8(char out_buf[5], unsigned int c);                                                      // return out_buf\nIMGUI_API int           ImTextStrToUtf8(char* out_buf, int out_buf_size, const ImWchar* in_text, const ImWchar* in_text_end);   // return output UTF-8 bytes count\nIMGUI_API int           ImTextCharFromUtf8(unsigned int* out_char, const char* in_text, const char* in_text_end);               // read one character. return input UTF-8 bytes count\nIMGUI_API int           ImTextStrFromUtf8(ImWchar* out_buf, int out_buf_size, const char* in_text, const char* in_text_end, const char** in_remaining = NULL);   // return input UTF-8 bytes count\nIMGUI_API int           ImTextCountCharsFromUtf8(const char* in_text, const char* in_text_end);                                 // return number of UTF-8 code-points (NOT bytes count)\nIMGUI_API int           ImTextCountUtf8BytesFromChar(const char* in_text, const char* in_text_end);                             // return number of bytes to express one char in UTF-8\nIMGUI_API int           ImTextCountUtf8BytesFromStr(const ImWchar* in_text, const ImWchar* in_text_end);                        // return number of bytes to express string in UTF-8\n\n// Helpers: ImVec2/ImVec4 operators\n// We are keeping those disabled by default so they don't leak in user space, to allow user enabling implicit cast operators between ImVec2 and their own types (using IM_VEC2_CLASS_EXTRA etc.)\n// We unfortunately don't have a unary- operator for ImVec2 because this would needs to be defined inside the class itself.\n#ifdef IMGUI_DEFINE_MATH_OPERATORS\nIM_MSVC_RUNTIME_CHECKS_OFF\nstatic inline ImVec2 operator*(const ImVec2& lhs, const float rhs)              { return ImVec2(lhs.x * rhs, lhs.y * rhs); }\nstatic inline ImVec2 operator/(const ImVec2& lhs, const float rhs)              { return ImVec2(lhs.x / rhs, lhs.y / rhs); }\nstatic inline ImVec2 operator+(const ImVec2& lhs, const ImVec2& rhs)            { return ImVec2(lhs.x + rhs.x, lhs.y + rhs.y); }\nstatic inline ImVec2 operator-(const ImVec2& lhs, const ImVec2& rhs)            { return ImVec2(lhs.x - rhs.x, lhs.y - rhs.y); }\nstatic inline ImVec2 operator*(const ImVec2& lhs, const ImVec2& rhs)            { return ImVec2(lhs.x * rhs.x, lhs.y * rhs.y); }\nstatic inline ImVec2 operator/(const ImVec2& lhs, const ImVec2& rhs)            { return ImVec2(lhs.x / rhs.x, lhs.y / rhs.y); }\nstatic inline ImVec2& operator*=(ImVec2& lhs, const float rhs)                  { lhs.x *= rhs; lhs.y *= rhs; return lhs; }\nstatic inline ImVec2& operator/=(ImVec2& lhs, const float rhs)                  { lhs.x /= rhs; lhs.y /= rhs; return lhs; }\nstatic inline ImVec2& operator+=(ImVec2& lhs, const ImVec2& rhs)                { lhs.x += rhs.x; lhs.y += rhs.y; return lhs; }\nstatic inline ImVec2& operator-=(ImVec2& lhs, const ImVec2& rhs)                { lhs.x -= rhs.x; lhs.y -= rhs.y; return lhs; }\nstatic inline ImVec2& operator*=(ImVec2& lhs, const ImVec2& rhs)                { lhs.x *= rhs.x; lhs.y *= rhs.y; return lhs; }\nstatic inline ImVec2& operator/=(ImVec2& lhs, const ImVec2& rhs)                { lhs.x /= rhs.x; lhs.y /= rhs.y; return lhs; }\nstatic inline ImVec4 operator+(const ImVec4& lhs, const ImVec4& rhs)            { return ImVec4(lhs.x + rhs.x, lhs.y + rhs.y, lhs.z + rhs.z, lhs.w + rhs.w); }\nstatic inline ImVec4 operator-(const ImVec4& lhs, const ImVec4& rhs)            { return ImVec4(lhs.x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z, lhs.w - rhs.w); }\nstatic inline ImVec4 operator*(const ImVec4& lhs, const ImVec4& rhs)            { return ImVec4(lhs.x * rhs.x, lhs.y * rhs.y, lhs.z * rhs.z, lhs.w * rhs.w); }\nIM_MSVC_RUNTIME_CHECKS_RESTORE\n#endif\n\n// Helpers: File System\n#ifdef IMGUI_DISABLE_FILE_FUNCTIONS\n#define IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS\ntypedef void* ImFileHandle;\nstatic inline ImFileHandle  ImFileOpen(const char*, const char*)                    { return NULL; }\nstatic inline bool          ImFileClose(ImFileHandle)                               { return false; }\nstatic inline ImU64         ImFileGetSize(ImFileHandle)                             { return (ImU64)-1; }\nstatic inline ImU64         ImFileRead(void*, ImU64, ImU64, ImFileHandle)           { return 0; }\nstatic inline ImU64         ImFileWrite(const void*, ImU64, ImU64, ImFileHandle)    { return 0; }\n#endif\n#ifndef IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS\ntypedef FILE* ImFileHandle;\nIMGUI_API ImFileHandle      ImFileOpen(const char* filename, const char* mode);\nIMGUI_API bool              ImFileClose(ImFileHandle file);\nIMGUI_API ImU64             ImFileGetSize(ImFileHandle file);\nIMGUI_API ImU64             ImFileRead(void* data, ImU64 size, ImU64 count, ImFileHandle file);\nIMGUI_API ImU64             ImFileWrite(const void* data, ImU64 size, ImU64 count, ImFileHandle file);\n#else\n#define IMGUI_DISABLE_TTY_FUNCTIONS // Can't use stdout, fflush if we are not using default file functions\n#endif\nIMGUI_API void*             ImFileLoadToMemory(const char* filename, const char* mode, size_t* out_file_size = NULL, int padding_bytes = 0);\n\n// Helpers: Maths\nIM_MSVC_RUNTIME_CHECKS_OFF\n// - Wrapper for standard libs functions. (Note that imgui_demo.cpp does _not_ use them to keep the code easy to copy)\n#ifndef IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS\n#define ImFabs(X)           fabsf(X)\n#define ImSqrt(X)           sqrtf(X)\n#define ImFmod(X, Y)        fmodf((X), (Y))\n#define ImCos(X)            cosf(X)\n#define ImSin(X)            sinf(X)\n#define ImAcos(X)           acosf(X)\n#define ImAtan2(Y, X)       atan2f((Y), (X))\n#define ImAtof(STR)         atof(STR)\n//#define ImFloorStd(X)     floorf(X)           // We use our own, see ImFloor() and ImFloorSigned()\n#define ImCeil(X)           ceilf(X)\nstatic inline float  ImPow(float x, float y)    { return powf(x, y); }          // DragBehaviorT/SliderBehaviorT uses ImPow with either float/double and need the precision\nstatic inline double ImPow(double x, double y)  { return pow(x, y); }\nstatic inline float  ImLog(float x)             { return logf(x); }             // DragBehaviorT/SliderBehaviorT uses ImLog with either float/double and need the precision\nstatic inline double ImLog(double x)            { return log(x); }\nstatic inline int    ImAbs(int x)               { return x < 0 ? -x : x; }\nstatic inline float  ImAbs(float x)             { return fabsf(x); }\nstatic inline double ImAbs(double x)            { return fabs(x); }\nstatic inline float  ImSign(float x)            { return (x < 0.0f) ? -1.0f : ((x > 0.0f) ? 1.0f : 0.0f); } // Sign operator - returns -1, 0 or 1 based on sign of argument\nstatic inline double ImSign(double x)           { return (x < 0.0) ? -1.0 : ((x > 0.0) ? 1.0 : 0.0); }\n#ifdef IMGUI_ENABLE_SSE\nstatic inline float  ImRsqrt(float x)           { return _mm_cvtss_f32(_mm_rsqrt_ss(_mm_set_ss(x))); }\n#else\nstatic inline float  ImRsqrt(float x)           { return 1.0f / sqrtf(x); }\n#endif\nstatic inline double ImRsqrt(double x)          { return 1.0 / sqrt(x); }\n#endif\n// - ImMin/ImMax/ImClamp/ImLerp/ImSwap are used by widgets which support variety of types: signed/unsigned int/long long float/double\n// (Exceptionally using templates here but we could also redefine them for those types)\ntemplate<typename T> static inline T ImMin(T lhs, T rhs)                        { return lhs < rhs ? lhs : rhs; }\ntemplate<typename T> static inline T ImMax(T lhs, T rhs)                        { return lhs >= rhs ? lhs : rhs; }\ntemplate<typename T> static inline T ImClamp(T v, T mn, T mx)                   { return (v < mn) ? mn : (v > mx) ? mx : v; }\ntemplate<typename T> static inline T ImLerp(T a, T b, float t)                  { return (T)(a + (b - a) * t); }\ntemplate<typename T> static inline void ImSwap(T& a, T& b)                      { T tmp = a; a = b; b = tmp; }\ntemplate<typename T> static inline T ImAddClampOverflow(T a, T b, T mn, T mx)   { if (b < 0 && (a < mn - b)) return mn; if (b > 0 && (a > mx - b)) return mx; return a + b; }\ntemplate<typename T> static inline T ImSubClampOverflow(T a, T b, T mn, T mx)   { if (b > 0 && (a < mn + b)) return mn; if (b < 0 && (a > mx + b)) return mx; return a - b; }\n// - Misc maths helpers\nstatic inline ImVec2 ImMin(const ImVec2& lhs, const ImVec2& rhs)                { return ImVec2(lhs.x < rhs.x ? lhs.x : rhs.x, lhs.y < rhs.y ? lhs.y : rhs.y); }\nstatic inline ImVec2 ImMax(const ImVec2& lhs, const ImVec2& rhs)                { return ImVec2(lhs.x >= rhs.x ? lhs.x : rhs.x, lhs.y >= rhs.y ? lhs.y : rhs.y); }\nstatic inline ImVec2 ImClamp(const ImVec2& v, const ImVec2& mn, ImVec2 mx)      { return ImVec2((v.x < mn.x) ? mn.x : (v.x > mx.x) ? mx.x : v.x, (v.y < mn.y) ? mn.y : (v.y > mx.y) ? mx.y : v.y); }\nstatic inline ImVec2 ImLerp(const ImVec2& a, const ImVec2& b, float t)          { return ImVec2(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t); }\nstatic inline ImVec2 ImLerp(const ImVec2& a, const ImVec2& b, const ImVec2& t)  { return ImVec2(a.x + (b.x - a.x) * t.x, a.y + (b.y - a.y) * t.y); }\nstatic inline ImVec4 ImLerp(const ImVec4& a, const ImVec4& b, float t)          { return ImVec4(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t, a.z + (b.z - a.z) * t, a.w + (b.w - a.w) * t); }\nstatic inline float  ImSaturate(float f)                                        { return (f < 0.0f) ? 0.0f : (f > 1.0f) ? 1.0f : f; }\nstatic inline float  ImLengthSqr(const ImVec2& lhs)                             { return (lhs.x * lhs.x) + (lhs.y * lhs.y); }\nstatic inline float  ImLengthSqr(const ImVec4& lhs)                             { return (lhs.x * lhs.x) + (lhs.y * lhs.y) + (lhs.z * lhs.z) + (lhs.w * lhs.w); }\nstatic inline float  ImInvLength(const ImVec2& lhs, float fail_value)           { float d = (lhs.x * lhs.x) + (lhs.y * lhs.y); if (d > 0.0f) return ImRsqrt(d); return fail_value; }\nstatic inline float  ImFloor(float f)                                           { return (float)(int)(f); }\nstatic inline float  ImFloorSigned(float f)                                     { return (float)((f >= 0 || (int)f == f) ? (int)f : (int)f - 1); } // Decent replacement for floorf()\nstatic inline ImVec2 ImFloor(const ImVec2& v)                                   { return ImVec2((float)(int)(v.x), (float)(int)(v.y)); }\nstatic inline int    ImModPositive(int a, int b)                                { return (a + b) % b; }\nstatic inline float  ImDot(const ImVec2& a, const ImVec2& b)                    { return a.x * b.x + a.y * b.y; }\nstatic inline ImVec2 ImRotate(const ImVec2& v, float cos_a, float sin_a)        { return ImVec2(v.x * cos_a - v.y * sin_a, v.x * sin_a + v.y * cos_a); }\nstatic inline float  ImLinearSweep(float current, float target, float speed)    { if (current < target) return ImMin(current + speed, target); if (current > target) return ImMax(current - speed, target); return current; }\nstatic inline ImVec2 ImMul(const ImVec2& lhs, const ImVec2& rhs)                { return ImVec2(lhs.x * rhs.x, lhs.y * rhs.y); }\nIM_MSVC_RUNTIME_CHECKS_RESTORE\n\n// Helpers: Geometry\nIMGUI_API ImVec2     ImBezierCubicCalc(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, float t);\nIMGUI_API ImVec2     ImBezierCubicClosestPoint(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, const ImVec2& p, int num_segments);       // For curves with explicit number of segments\nIMGUI_API ImVec2     ImBezierCubicClosestPointCasteljau(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, const ImVec2& p, float tess_tol);// For auto-tessellated curves you can use tess_tol = style.CurveTessellationTol\nIMGUI_API ImVec2     ImBezierQuadraticCalc(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, float t);\nIMGUI_API ImVec2     ImLineClosestPoint(const ImVec2& a, const ImVec2& b, const ImVec2& p);\nIMGUI_API bool       ImTriangleContainsPoint(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p);\nIMGUI_API ImVec2     ImTriangleClosestPoint(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p);\nIMGUI_API void       ImTriangleBarycentricCoords(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p, float& out_u, float& out_v, float& out_w);\ninline float         ImTriangleArea(const ImVec2& a, const ImVec2& b, const ImVec2& c) { return ImFabs((a.x * (b.y - c.y)) + (b.x * (c.y - a.y)) + (c.x * (a.y - b.y))) * 0.5f; }\nIMGUI_API ImGuiDir   ImGetDirQuadrantFromDelta(float dx, float dy);\n\n// Helper: ImVec1 (1D vector)\n// (this odd construct is used to facilitate the transition between 1D and 2D, and the maintenance of some branches/patches)\nIM_MSVC_RUNTIME_CHECKS_OFF\nstruct ImVec1\n{\n    float   x;\n    ImVec1()         { x = 0.0f; }\n    ImVec1(float _x) { x = _x; }\n};\n\n// Helper: ImVec2ih (2D vector, half-size integer, for long-term packed storage)\nstruct ImVec2ih\n{\n    short   x, y;\n    ImVec2ih()                           { x = y = 0; }\n    ImVec2ih(short _x, short _y)         { x = _x; y = _y; }\n    explicit ImVec2ih(const ImVec2& rhs) { x = (short)rhs.x; y = (short)rhs.y; }\n};\n\n// Helper: ImRect (2D axis aligned bounding-box)\n// NB: we can't rely on ImVec2 math operators being available here!\nstruct IMGUI_API ImRect\n{\n    ImVec2      Min;    // Upper-left\n    ImVec2      Max;    // Lower-right\n\n    ImRect()                                        : Min(0.0f, 0.0f), Max(0.0f, 0.0f)  {}\n    ImRect(const ImVec2& min, const ImVec2& max)    : Min(min), Max(max)                {}\n    ImRect(const ImVec4& v)                         : Min(v.x, v.y), Max(v.z, v.w)      {}\n    ImRect(float x1, float y1, float x2, float y2)  : Min(x1, y1), Max(x2, y2)          {}\n\n    ImVec2      GetCenter() const                   { return ImVec2((Min.x + Max.x) * 0.5f, (Min.y + Max.y) * 0.5f); }\n    ImVec2      GetSize() const                     { return ImVec2(Max.x - Min.x, Max.y - Min.y); }\n    float       GetWidth() const                    { return Max.x - Min.x; }\n    float       GetHeight() const                   { return Max.y - Min.y; }\n    float       GetArea() const                     { return (Max.x - Min.x) * (Max.y - Min.y); }\n    ImVec2      GetTL() const                       { return Min; }                   // Top-left\n    ImVec2      GetTR() const                       { return ImVec2(Max.x, Min.y); }  // Top-right\n    ImVec2      GetBL() const                       { return ImVec2(Min.x, Max.y); }  // Bottom-left\n    ImVec2      GetBR() const                       { return Max; }                   // Bottom-right\n    bool        Contains(const ImVec2& p) const     { return p.x     >= Min.x && p.y     >= Min.y && p.x     <  Max.x && p.y     <  Max.y; }\n    bool        Contains(const ImRect& r) const     { return r.Min.x >= Min.x && r.Min.y >= Min.y && r.Max.x <= Max.x && r.Max.y <= Max.y; }\n    bool        Overlaps(const ImRect& r) const     { return r.Min.y <  Max.y && r.Max.y >  Min.y && r.Min.x <  Max.x && r.Max.x >  Min.x; }\n    void        Add(const ImVec2& p)                { if (Min.x > p.x)     Min.x = p.x;     if (Min.y > p.y)     Min.y = p.y;     if (Max.x < p.x)     Max.x = p.x;     if (Max.y < p.y)     Max.y = p.y; }\n    void        Add(const ImRect& r)                { if (Min.x > r.Min.x) Min.x = r.Min.x; if (Min.y > r.Min.y) Min.y = r.Min.y; if (Max.x < r.Max.x) Max.x = r.Max.x; if (Max.y < r.Max.y) Max.y = r.Max.y; }\n    void        Expand(const float amount)          { Min.x -= amount;   Min.y -= amount;   Max.x += amount;   Max.y += amount; }\n    void        Expand(const ImVec2& amount)        { Min.x -= amount.x; Min.y -= amount.y; Max.x += amount.x; Max.y += amount.y; }\n    void        Translate(const ImVec2& d)          { Min.x += d.x; Min.y += d.y; Max.x += d.x; Max.y += d.y; }\n    void        TranslateX(float dx)                { Min.x += dx; Max.x += dx; }\n    void        TranslateY(float dy)                { Min.y += dy; Max.y += dy; }\n    void        ClipWith(const ImRect& r)           { Min = ImMax(Min, r.Min); Max = ImMin(Max, r.Max); }                   // Simple version, may lead to an inverted rectangle, which is fine for Contains/Overlaps test but not for display.\n    void        ClipWithFull(const ImRect& r)       { Min = ImClamp(Min, r.Min, r.Max); Max = ImClamp(Max, r.Min, r.Max); } // Full version, ensure both points are fully clipped.\n    void        Floor()                             { Min.x = IM_FLOOR(Min.x); Min.y = IM_FLOOR(Min.y); Max.x = IM_FLOOR(Max.x); Max.y = IM_FLOOR(Max.y); }\n    bool        IsInverted() const                  { return Min.x > Max.x || Min.y > Max.y; }\n    ImVec4      ToVec4() const                      { return ImVec4(Min.x, Min.y, Max.x, Max.y); }\n};\nIM_MSVC_RUNTIME_CHECKS_RESTORE\n\n// Helper: ImBitArray\ninline bool     ImBitArrayTestBit(const ImU32* arr, int n)      { ImU32 mask = (ImU32)1 << (n & 31); return (arr[n >> 5] & mask) != 0; }\ninline void     ImBitArrayClearBit(ImU32* arr, int n)           { ImU32 mask = (ImU32)1 << (n & 31); arr[n >> 5] &= ~mask; }\ninline void     ImBitArraySetBit(ImU32* arr, int n)             { ImU32 mask = (ImU32)1 << (n & 31); arr[n >> 5] |= mask; }\ninline void     ImBitArraySetBitRange(ImU32* arr, int n, int n2) // Works on range [n..n2)\n{\n    n2--;\n    while (n <= n2)\n    {\n        int a_mod = (n & 31);\n        int b_mod = (n2 > (n | 31) ? 31 : (n2 & 31)) + 1;\n        ImU32 mask = (ImU32)(((ImU64)1 << b_mod) - 1) & ~(ImU32)(((ImU64)1 << a_mod) - 1);\n        arr[n >> 5] |= mask;\n        n = (n + 32) & ~31;\n    }\n}\n\n// Helper: ImBitArray class (wrapper over ImBitArray functions)\n// Store 1-bit per value.\ntemplate<int BITCOUNT>\nstruct IMGUI_API ImBitArray\n{\n    ImU32           Storage[(BITCOUNT + 31) >> 5];\n    ImBitArray()                                { ClearAllBits(); }\n    void            ClearAllBits()              { memset(Storage, 0, sizeof(Storage)); }\n    void            SetAllBits()                { memset(Storage, 255, sizeof(Storage)); }\n    bool            TestBit(int n) const        { IM_ASSERT(n < BITCOUNT); return ImBitArrayTestBit(Storage, n); }\n    void            SetBit(int n)               { IM_ASSERT(n < BITCOUNT); ImBitArraySetBit(Storage, n); }\n    void            ClearBit(int n)             { IM_ASSERT(n < BITCOUNT); ImBitArrayClearBit(Storage, n); }\n    void            SetBitRange(int n, int n2)  { ImBitArraySetBitRange(Storage, n, n2); } // Works on range [n..n2)\n};\n\n// Helper: ImBitVector\n// Store 1-bit per value.\nstruct IMGUI_API ImBitVector\n{\n    ImVector<ImU32> Storage;\n    void            Create(int sz)              { Storage.resize((sz + 31) >> 5); memset(Storage.Data, 0, (size_t)Storage.Size * sizeof(Storage.Data[0])); }\n    void            Clear()                     { Storage.clear(); }\n    bool            TestBit(int n) const        { IM_ASSERT(n < (Storage.Size << 5)); return ImBitArrayTestBit(Storage.Data, n); }\n    void            SetBit(int n)               { IM_ASSERT(n < (Storage.Size << 5)); ImBitArraySetBit(Storage.Data, n); }\n    void            ClearBit(int n)             { IM_ASSERT(n < (Storage.Size << 5)); ImBitArrayClearBit(Storage.Data, n); }\n};\n\n// Helper: ImSpan<>\n// Pointing to a span of data we don't own.\ntemplate<typename T>\nstruct ImSpan\n{\n    T*                  Data;\n    T*                  DataEnd;\n\n    // Constructors, destructor\n    inline ImSpan()                                 { Data = DataEnd = NULL; }\n    inline ImSpan(T* data, int size)                { Data = data; DataEnd = data + size; }\n    inline ImSpan(T* data, T* data_end)             { Data = data; DataEnd = data_end; }\n\n    inline void         set(T* data, int size)      { Data = data; DataEnd = data + size; }\n    inline void         set(T* data, T* data_end)   { Data = data; DataEnd = data_end; }\n    inline int          size() const                { return (int)(ptrdiff_t)(DataEnd - Data); }\n    inline int          size_in_bytes() const       { return (int)(ptrdiff_t)(DataEnd - Data) * (int)sizeof(T); }\n    inline T&           operator[](int i)           { T* p = Data + i; IM_ASSERT(p >= Data && p < DataEnd); return *p; }\n    inline const T&     operator[](int i) const     { const T* p = Data + i; IM_ASSERT(p >= Data && p < DataEnd); return *p; }\n\n    inline T*           begin()                     { return Data; }\n    inline const T*     begin() const               { return Data; }\n    inline T*           end()                       { return DataEnd; }\n    inline const T*     end() const                 { return DataEnd; }\n\n    // Utilities\n    inline int  index_from_ptr(const T* it) const   { IM_ASSERT(it >= Data && it < DataEnd); const ptrdiff_t off = it - Data; return (int)off; }\n};\n\n// Helper: ImSpanAllocator<>\n// Facilitate storing multiple chunks into a single large block (the \"arena\")\n// - Usage: call Reserve() N times, allocate GetArenaSizeInBytes() worth, pass it to SetArenaBasePtr(), call GetSpan() N times to retrieve the aligned ranges.\ntemplate<int CHUNKS>\nstruct ImSpanAllocator\n{\n    char*   BasePtr;\n    int     CurrOff;\n    int     CurrIdx;\n    int     Offsets[CHUNKS];\n    int     Sizes[CHUNKS];\n\n    ImSpanAllocator()                               { memset(this, 0, sizeof(*this)); }\n    inline void  Reserve(int n, size_t sz, int a=4) { IM_ASSERT(n == CurrIdx && n < CHUNKS); CurrOff = IM_MEMALIGN(CurrOff, a); Offsets[n] = CurrOff; Sizes[n] = (int)sz; CurrIdx++; CurrOff += (int)sz; }\n    inline int   GetArenaSizeInBytes()              { return CurrOff; }\n    inline void  SetArenaBasePtr(void* base_ptr)    { BasePtr = (char*)base_ptr; }\n    inline void* GetSpanPtrBegin(int n)             { IM_ASSERT(n >= 0 && n < CHUNKS && CurrIdx == CHUNKS); return (void*)(BasePtr + Offsets[n]); }\n    inline void* GetSpanPtrEnd(int n)               { IM_ASSERT(n >= 0 && n < CHUNKS && CurrIdx == CHUNKS); return (void*)(BasePtr + Offsets[n] + Sizes[n]); }\n    template<typename T>\n    inline void  GetSpan(int n, ImSpan<T>* span)    { span->set((T*)GetSpanPtrBegin(n), (T*)GetSpanPtrEnd(n)); }\n};\n\n// Helper: ImPool<>\n// Basic keyed storage for contiguous instances, slow/amortized insertion, O(1) indexable, O(Log N) queries by ID over a dense/hot buffer,\n// Honor constructor/destructor. Add/remove invalidate all pointers. Indexes have the same lifetime as the associated object.\ntypedef int ImPoolIdx;\ntemplate<typename T>\nstruct IMGUI_API ImPool\n{\n    ImVector<T>     Buf;        // Contiguous data\n    ImGuiStorage    Map;        // ID->Index\n    ImPoolIdx       FreeIdx;    // Next free idx to use\n    ImPoolIdx       AliveCount; // Number of active/alive items (for display purpose)\n\n    ImPool()    { FreeIdx = AliveCount = 0; }\n    ~ImPool()   { Clear(); }\n    T*          GetByKey(ImGuiID key)               { int idx = Map.GetInt(key, -1); return (idx != -1) ? &Buf[idx] : NULL; }\n    T*          GetByIndex(ImPoolIdx n)             { return &Buf[n]; }\n    ImPoolIdx   GetIndex(const T* p) const          { IM_ASSERT(p >= Buf.Data && p < Buf.Data + Buf.Size); return (ImPoolIdx)(p - Buf.Data); }\n    T*          GetOrAddByKey(ImGuiID key)          { int* p_idx = Map.GetIntRef(key, -1); if (*p_idx != -1) return &Buf[*p_idx]; *p_idx = FreeIdx; return Add(); }\n    bool        Contains(const T* p) const          { return (p >= Buf.Data && p < Buf.Data + Buf.Size); }\n    void        Clear()                             { for (int n = 0; n < Map.Data.Size; n++) { int idx = Map.Data[n].val_i; if (idx != -1) Buf[idx].~T(); } Map.Clear(); Buf.clear(); FreeIdx = AliveCount = 0; }\n    T*          Add()                               { int idx = FreeIdx; if (idx == Buf.Size) { Buf.resize(Buf.Size + 1); FreeIdx++; } else { FreeIdx = *(int*)&Buf[idx]; } IM_PLACEMENT_NEW(&Buf[idx]) T(); AliveCount++; return &Buf[idx]; }\n    void        Remove(ImGuiID key, const T* p)     { Remove(key, GetIndex(p)); }\n    void        Remove(ImGuiID key, ImPoolIdx idx)  { Buf[idx].~T(); *(int*)&Buf[idx] = FreeIdx; FreeIdx = idx; Map.SetInt(key, -1); AliveCount--; }\n    void        Reserve(int capacity)               { Buf.reserve(capacity); Map.Data.reserve(capacity); }\n\n    // To iterate a ImPool: for (int n = 0; n < pool.GetMapSize(); n++) if (T* t = pool.TryGetMapData(n)) { ... }\n    // Can be avoided if you know .Remove() has never been called on the pool, or AliveCount == GetMapSize()\n    int         GetAliveCount() const               { return AliveCount; }      // Number of active/alive items in the pool (for display purpose)\n    int         GetBufSize() const                  { return Buf.Size; }\n    int         GetMapSize() const                  { return Map.Data.Size; }   // It is the map we need iterate to find valid items, since we don't have \"alive\" storage anywhere\n    T*          TryGetMapData(ImPoolIdx n)          { int idx = Map.Data[n].val_i; if (idx == -1) return NULL; return GetByIndex(idx); }\n#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS\n    int         GetSize()                           { return GetMapSize(); } // For ImPlot: should use GetMapSize() from (IMGUI_VERSION_NUM >= 18304)\n#endif\n};\n\n// Helper: ImChunkStream<>\n// Build and iterate a contiguous stream of variable-sized structures.\n// This is used by Settings to store persistent data while reducing allocation count.\n// We store the chunk size first, and align the final size on 4 bytes boundaries.\n// The tedious/zealous amount of casting is to avoid -Wcast-align warnings.\ntemplate<typename T>\nstruct IMGUI_API ImChunkStream\n{\n    ImVector<char>  Buf;\n\n    void    clear()                     { Buf.clear(); }\n    bool    empty() const               { return Buf.Size == 0; }\n    int     size() const                { return Buf.Size; }\n    T*      alloc_chunk(size_t sz)      { size_t HDR_SZ = 4; sz = IM_MEMALIGN(HDR_SZ + sz, 4u); int off = Buf.Size; Buf.resize(off + (int)sz); ((int*)(void*)(Buf.Data + off))[0] = (int)sz; return (T*)(void*)(Buf.Data + off + (int)HDR_SZ); }\n    T*      begin()                     { size_t HDR_SZ = 4; if (!Buf.Data) return NULL; return (T*)(void*)(Buf.Data + HDR_SZ); }\n    T*      next_chunk(T* p)            { size_t HDR_SZ = 4; IM_ASSERT(p >= begin() && p < end()); p = (T*)(void*)((char*)(void*)p + chunk_size(p)); if (p == (T*)(void*)((char*)end() + HDR_SZ)) return (T*)0; IM_ASSERT(p < end()); return p; }\n    int     chunk_size(const T* p)      { return ((const int*)p)[-1]; }\n    T*      end()                       { return (T*)(void*)(Buf.Data + Buf.Size); }\n    int     offset_from_ptr(const T* p) { IM_ASSERT(p >= begin() && p < end()); const ptrdiff_t off = (const char*)p - Buf.Data; return (int)off; }\n    T*      ptr_from_offset(int off)    { IM_ASSERT(off >= 4 && off < Buf.Size); return (T*)(void*)(Buf.Data + off); }\n    void    swap(ImChunkStream<T>& rhs) { rhs.Buf.swap(Buf); }\n\n};\n\n//-----------------------------------------------------------------------------\n// [SECTION] ImDrawList support\n//-----------------------------------------------------------------------------\n\n// ImDrawList: Helper function to calculate a circle's segment count given its radius and a \"maximum error\" value.\n// Estimation of number of circle segment based on error is derived using method described in https://stackoverflow.com/a/2244088/15194693\n// Number of segments (N) is calculated using equation:\n//   N = ceil ( pi / acos(1 - error / r) )     where r > 0, error <= r\n// Our equation is significantly simpler that one in the post thanks for choosing segment that is\n// perpendicular to X axis. Follow steps in the article from this starting condition and you will\n// will get this result.\n//\n// Rendering circles with an odd number of segments, while mathematically correct will produce\n// asymmetrical results on the raster grid. Therefore we're rounding N to next even number (7->8, 8->8, 9->10 etc.)\n//\n#define IM_ROUNDUP_TO_EVEN(_V)                                  ((((_V) + 1) / 2) * 2)\n#define IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MIN                     4\n#define IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX                     512\n#define IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC(_RAD,_MAXERROR)    ImClamp(IM_ROUNDUP_TO_EVEN((int)ImCeil(IM_PI / ImAcos(1 - ImMin((_MAXERROR), (_RAD)) / (_RAD)))), IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MIN, IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX)\n\n// Raw equation from IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC rewritten for 'r' and 'error'.\n#define IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC_R(_N,_MAXERROR)    ((_MAXERROR) / (1 - ImCos(IM_PI / ImMax((float)(_N), IM_PI))))\n#define IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC_ERROR(_N,_RAD)     ((1 - ImCos(IM_PI / ImMax((float)(_N), IM_PI))) / (_RAD))\n\n// ImDrawList: Lookup table size for adaptive arc drawing, cover full circle.\n#ifndef IM_DRAWLIST_ARCFAST_TABLE_SIZE\n#define IM_DRAWLIST_ARCFAST_TABLE_SIZE                          48 // Number of samples in lookup table.\n#endif\n#define IM_DRAWLIST_ARCFAST_SAMPLE_MAX                          IM_DRAWLIST_ARCFAST_TABLE_SIZE // Sample index _PathArcToFastEx() for 360 angle.\n\n// Data shared between all ImDrawList instances\n// You may want to create your own instance of this if you want to use ImDrawList completely without ImGui. In that case, watch out for future changes to this structure.\nstruct IMGUI_API ImDrawListSharedData\n{\n    ImVec2          TexUvWhitePixel;            // UV of white pixel in the atlas\n    ImFont*         Font;                       // Current/default font (optional, for simplified AddText overload)\n    float           FontSize;                   // Current/default font size (optional, for simplified AddText overload)\n    float           CurveTessellationTol;       // Tessellation tolerance when using PathBezierCurveTo()\n    float           CircleSegmentMaxError;      // Number of circle segments to use per pixel of radius for AddCircle() etc\n    ImVec4          ClipRectFullscreen;         // Value for PushClipRectFullscreen()\n    ImDrawListFlags InitialFlags;               // Initial flags at the beginning of the frame (it is possible to alter flags on a per-drawlist basis afterwards)\n\n    // [Internal] Lookup tables\n    ImVec2          ArcFastVtx[IM_DRAWLIST_ARCFAST_TABLE_SIZE]; // Sample points on the quarter of the circle.\n    float           ArcFastRadiusCutoff;                        // Cutoff radius after which arc drawing will fallback to slower PathArcTo()\n    ImU8            CircleSegmentCounts[64];    // Precomputed segment count for given radius before we calculate it dynamically (to avoid calculation overhead)\n    const ImVec4*   TexUvLines;                 // UV of anti-aliased lines in the atlas\n\n    ImDrawListSharedData();\n    void SetCircleTessellationMaxError(float max_error);\n};\n\nstruct ImDrawDataBuilder\n{\n    ImVector<ImDrawList*>   Layers[2];           // Global layers for: regular, tooltip\n\n    void Clear()                    { for (int n = 0; n < IM_ARRAYSIZE(Layers); n++) Layers[n].resize(0); }\n    void ClearFreeMemory()          { for (int n = 0; n < IM_ARRAYSIZE(Layers); n++) Layers[n].clear(); }\n    int  GetDrawListCount() const   { int count = 0; for (int n = 0; n < IM_ARRAYSIZE(Layers); n++) count += Layers[n].Size; return count; }\n    IMGUI_API void FlattenIntoSingleLayer();\n};\n\n//-----------------------------------------------------------------------------\n// [SECTION] Widgets support: flags, enums, data structures\n//-----------------------------------------------------------------------------\n\n// Transient per-window flags, reset at the beginning of the frame. For child window, inherited from parent on first Begin().\n// This is going to be exposed in imgui.h when stabilized enough.\nenum ImGuiItemFlags_\n{\n    ImGuiItemFlags_None                     = 0,\n    ImGuiItemFlags_NoTabStop                = 1 << 0,  // false     // Disable keyboard tabbing (FIXME: should merge with _NoNav)\n    ImGuiItemFlags_ButtonRepeat             = 1 << 1,  // false     // Button() will return true multiple times based on io.KeyRepeatDelay and io.KeyRepeatRate settings.\n    ImGuiItemFlags_Disabled                 = 1 << 2,  // false     // Disable interactions but doesn't affect visuals. See BeginDisabled()/EndDisabled(). See github.com/ocornut/imgui/issues/211\n    ImGuiItemFlags_NoNav                    = 1 << 3,  // false     // Disable keyboard/gamepad directional navigation (FIXME: should merge with _NoTabStop)\n    ImGuiItemFlags_NoNavDefaultFocus        = 1 << 4,  // false     // Disable item being a candidate for default focus (e.g. used by title bar items)\n    ImGuiItemFlags_SelectableDontClosePopup = 1 << 5,  // false     // Disable MenuItem/Selectable() automatically closing their popup window\n    ImGuiItemFlags_MixedValue               = 1 << 6,  // false     // [BETA] Represent a mixed/indeterminate value, generally multi-selection where values differ. Currently only supported by Checkbox() (later should support all sorts of widgets)\n    ImGuiItemFlags_ReadOnly                 = 1 << 7   // false     // [ALPHA] Allow hovering interactions but underlying value is not changed.\n};\n\n// Flags for ItemAdd()\n// FIXME-NAV: _Focusable is _ALMOST_ what you would expect to be called '_TabStop' but because SetKeyboardFocusHere() works on items with no TabStop we distinguish Focusable from TabStop.\nenum ImGuiItemAddFlags_\n{\n    ImGuiItemAddFlags_None                  = 0,\n    ImGuiItemAddFlags_Focusable             = 1 << 0    // FIXME-NAV: In current/legacy scheme, Focusable+TabStop support are opt-in by widgets. We will transition it toward being opt-out, so this flag is expected to eventually disappear.\n};\n\n// Storage for LastItem data\nenum ImGuiItemStatusFlags_\n{\n    ImGuiItemStatusFlags_None               = 0,\n    ImGuiItemStatusFlags_HoveredRect        = 1 << 0,   // Mouse position is within item rectangle (does NOT mean that the window is in correct z-order and can be hovered!, this is only one part of the most-common IsItemHovered test)\n    ImGuiItemStatusFlags_HasDisplayRect     = 1 << 1,   // window->DC.LastItemDisplayRect is valid\n    ImGuiItemStatusFlags_Edited             = 1 << 2,   // Value exposed by item was edited in the current frame (should match the bool return value of most widgets)\n    ImGuiItemStatusFlags_ToggledSelection   = 1 << 3,   // Set when Selectable(), TreeNode() reports toggling a selection. We can't report \"Selected\", only state changes, in order to easily handle clipping with less issues.\n    ImGuiItemStatusFlags_ToggledOpen        = 1 << 4,   // Set when TreeNode() reports toggling their open state.\n    ImGuiItemStatusFlags_HasDeactivated     = 1 << 5,   // Set if the widget/group is able to provide data for the ImGuiItemStatusFlags_Deactivated flag.\n    ImGuiItemStatusFlags_Deactivated        = 1 << 6,   // Only valid if ImGuiItemStatusFlags_HasDeactivated is set.\n    ImGuiItemStatusFlags_HoveredWindow      = 1 << 7,   // Override the HoveredWindow test to allow cross-window hover testing.\n    ImGuiItemStatusFlags_FocusedByCode      = 1 << 8,   // Set when the Focusable item just got focused from code.\n    ImGuiItemStatusFlags_FocusedByTabbing   = 1 << 9,   // Set when the Focusable item just got focused by Tabbing.\n    ImGuiItemStatusFlags_Focused            = ImGuiItemStatusFlags_FocusedByCode | ImGuiItemStatusFlags_FocusedByTabbing\n\n#ifdef IMGUI_ENABLE_TEST_ENGINE\n    , // [imgui_tests only]\n    ImGuiItemStatusFlags_Openable           = 1 << 20,  //\n    ImGuiItemStatusFlags_Opened             = 1 << 21,  //\n    ImGuiItemStatusFlags_Checkable          = 1 << 22,  //\n    ImGuiItemStatusFlags_Checked            = 1 << 23   //\n#endif\n};\n\n// Extend ImGuiInputTextFlags_\nenum ImGuiInputTextFlagsPrivate_\n{\n    // [Internal]\n    ImGuiInputTextFlags_Multiline           = 1 << 26,  // For internal use by InputTextMultiline()\n    ImGuiInputTextFlags_NoMarkEdited        = 1 << 27,  // For internal use by functions using InputText() before reformatting data\n    ImGuiInputTextFlags_MergedItem          = 1 << 28   // For internal use by TempInputText(), will skip calling ItemAdd(). Require bounding-box to strictly match.\n};\n\n// Extend ImGuiButtonFlags_\nenum ImGuiButtonFlagsPrivate_\n{\n    ImGuiButtonFlags_PressedOnClick         = 1 << 4,   // return true on click (mouse down event)\n    ImGuiButtonFlags_PressedOnClickRelease  = 1 << 5,   // [Default] return true on click + release on same item <-- this is what the majority of Button are using\n    ImGuiButtonFlags_PressedOnClickReleaseAnywhere = 1 << 6, // return true on click + release even if the release event is not done while hovering the item\n    ImGuiButtonFlags_PressedOnRelease       = 1 << 7,   // return true on release (default requires click+release)\n    ImGuiButtonFlags_PressedOnDoubleClick   = 1 << 8,   // return true on double-click (default requires click+release)\n    ImGuiButtonFlags_PressedOnDragDropHold  = 1 << 9,   // return true when held into while we are drag and dropping another item (used by e.g. tree nodes, collapsing headers)\n    ImGuiButtonFlags_Repeat                 = 1 << 10,  // hold to repeat\n    ImGuiButtonFlags_FlattenChildren        = 1 << 11,  // allow interactions even if a child window is overlapping\n    ImGuiButtonFlags_AllowItemOverlap       = 1 << 12,  // require previous frame HoveredId to either match id or be null before being usable, use along with SetItemAllowOverlap()\n    ImGuiButtonFlags_DontClosePopups        = 1 << 13,  // disable automatically closing parent popup on press // [UNUSED]\n    //ImGuiButtonFlags_Disabled             = 1 << 14,  // disable interactions -> use BeginDisabled() or ImGuiItemFlags_Disabled\n    ImGuiButtonFlags_AlignTextBaseLine      = 1 << 15,  // vertically align button to match text baseline - ButtonEx() only // FIXME: Should be removed and handled by SmallButton(), not possible currently because of DC.CursorPosPrevLine\n    ImGuiButtonFlags_NoKeyModifiers         = 1 << 16,  // disable mouse interaction if a key modifier is held\n    ImGuiButtonFlags_NoHoldingActiveId      = 1 << 17,  // don't set ActiveId while holding the mouse (ImGuiButtonFlags_PressedOnClick only)\n    ImGuiButtonFlags_NoNavFocus             = 1 << 18,  // don't override navigation focus when activated\n    ImGuiButtonFlags_NoHoveredOnFocus       = 1 << 19,  // don't report as hovered when nav focus is on this item\n    ImGuiButtonFlags_PressedOnMask_         = ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnClickReleaseAnywhere | ImGuiButtonFlags_PressedOnRelease | ImGuiButtonFlags_PressedOnDoubleClick | ImGuiButtonFlags_PressedOnDragDropHold,\n    ImGuiButtonFlags_PressedOnDefault_      = ImGuiButtonFlags_PressedOnClickRelease\n};\n\n// Extend ImGuiComboFlags_\nenum ImGuiComboFlagsPrivate_\n{\n    ImGuiComboFlags_CustomPreview           = 1 << 20   // enable BeginComboPreview()\n};\n\n// Extend ImGuiSliderFlags_\nenum ImGuiSliderFlagsPrivate_\n{\n    ImGuiSliderFlags_Vertical               = 1 << 20,  // Should this slider be orientated vertically?\n    ImGuiSliderFlags_ReadOnly               = 1 << 21\n};\n\n// Extend ImGuiSelectableFlags_\nenum ImGuiSelectableFlagsPrivate_\n{\n    // NB: need to be in sync with last value of ImGuiSelectableFlags_\n    ImGuiSelectableFlags_NoHoldingActiveID      = 1 << 20,\n    ImGuiSelectableFlags_SelectOnNav            = 1 << 21,  // (WIP) Auto-select when moved into. This is not exposed in public API as to handle multi-select and modifiers we will need user to explicitly control focus scope. May be replaced with a BeginSelection() API.\n    ImGuiSelectableFlags_SelectOnClick          = 1 << 22,  // Override button behavior to react on Click (default is Click+Release)\n    ImGuiSelectableFlags_SelectOnRelease        = 1 << 23,  // Override button behavior to react on Release (default is Click+Release)\n    ImGuiSelectableFlags_SpanAvailWidth         = 1 << 24,  // Span all avail width even if we declared less for layout purpose. FIXME: We may be able to remove this (added in 6251d379, 2bcafc86 for menus)\n    ImGuiSelectableFlags_DrawHoveredWhenHeld    = 1 << 25,  // Always show active when held, even is not hovered. This concept could probably be renamed/formalized somehow.\n    ImGuiSelectableFlags_SetNavIdOnHover        = 1 << 26,  // Set Nav/Focus ID on mouse hover (used by MenuItem)\n    ImGuiSelectableFlags_NoPadWithHalfSpacing   = 1 << 27   // Disable padding each side with ItemSpacing * 0.5f\n};\n\n// Extend ImGuiTreeNodeFlags_\nenum ImGuiTreeNodeFlagsPrivate_\n{\n    ImGuiTreeNodeFlags_ClipLabelForTrailingButton = 1 << 20\n};\n\nenum ImGuiSeparatorFlags_\n{\n    ImGuiSeparatorFlags_None                = 0,\n    ImGuiSeparatorFlags_Horizontal          = 1 << 0,   // Axis default to current layout type, so generally Horizontal unless e.g. in a menu bar\n    ImGuiSeparatorFlags_Vertical            = 1 << 1,\n    ImGuiSeparatorFlags_SpanAllColumns      = 1 << 2\n};\n\nenum ImGuiTextFlags_\n{\n    ImGuiTextFlags_None = 0,\n    ImGuiTextFlags_NoWidthForLargeClippedText = 1 << 0\n};\n\nenum ImGuiTooltipFlags_\n{\n    ImGuiTooltipFlags_None = 0,\n    ImGuiTooltipFlags_OverridePreviousTooltip = 1 << 0      // Override will clear/ignore previously submitted tooltip (defaults to append)\n};\n\n// FIXME: this is in development, not exposed/functional as a generic feature yet.\n// Horizontal/Vertical enums are fixed to 0/1 so they may be used to index ImVec2\nenum ImGuiLayoutType_\n{\n    ImGuiLayoutType_Horizontal = 0,\n    ImGuiLayoutType_Vertical = 1\n};\n\nenum ImGuiLogType\n{\n    ImGuiLogType_None = 0,\n    ImGuiLogType_TTY,\n    ImGuiLogType_File,\n    ImGuiLogType_Buffer,\n    ImGuiLogType_Clipboard\n};\n\n// X/Y enums are fixed to 0/1 so they may be used to index ImVec2\nenum ImGuiAxis\n{\n    ImGuiAxis_None = -1,\n    ImGuiAxis_X = 0,\n    ImGuiAxis_Y = 1\n};\n\nenum ImGuiPlotType\n{\n    ImGuiPlotType_Lines,\n    ImGuiPlotType_Histogram\n};\n\nenum ImGuiInputSource\n{\n    ImGuiInputSource_None = 0,\n    ImGuiInputSource_Mouse,\n    ImGuiInputSource_Keyboard,\n    ImGuiInputSource_Gamepad,\n    ImGuiInputSource_Nav,               // Stored in g.ActiveIdSource only\n    ImGuiInputSource_Clipboard,         // Currently only used by InputText()\n    ImGuiInputSource_COUNT\n};\n\n// FIXME-NAV: Clarify/expose various repeat delay/rate\nenum ImGuiInputReadMode\n{\n    ImGuiInputReadMode_Down,\n    ImGuiInputReadMode_Pressed,\n    ImGuiInputReadMode_Released,\n    ImGuiInputReadMode_Repeat,\n    ImGuiInputReadMode_RepeatSlow,\n    ImGuiInputReadMode_RepeatFast\n};\n\nenum ImGuiNavHighlightFlags_\n{\n    ImGuiNavHighlightFlags_None         = 0,\n    ImGuiNavHighlightFlags_TypeDefault  = 1 << 0,\n    ImGuiNavHighlightFlags_TypeThin     = 1 << 1,\n    ImGuiNavHighlightFlags_AlwaysDraw   = 1 << 2,       // Draw rectangular highlight if (g.NavId == id) _even_ when using the mouse.\n    ImGuiNavHighlightFlags_NoRounding   = 1 << 3\n};\n\nenum ImGuiNavDirSourceFlags_\n{\n    ImGuiNavDirSourceFlags_None         = 0,\n    ImGuiNavDirSourceFlags_Keyboard     = 1 << 0,\n    ImGuiNavDirSourceFlags_PadDPad      = 1 << 1,\n    ImGuiNavDirSourceFlags_PadLStick    = 1 << 2\n};\n\nenum ImGuiNavMoveFlags_\n{\n    ImGuiNavMoveFlags_None                  = 0,\n    ImGuiNavMoveFlags_LoopX                 = 1 << 0,   // On failed request, restart from opposite side\n    ImGuiNavMoveFlags_LoopY                 = 1 << 1,\n    ImGuiNavMoveFlags_WrapX                 = 1 << 2,   // On failed request, request from opposite side one line down (when NavDir==right) or one line up (when NavDir==left)\n    ImGuiNavMoveFlags_WrapY                 = 1 << 3,   // This is not super useful for provided for completeness\n    ImGuiNavMoveFlags_AllowCurrentNavId     = 1 << 4,   // Allow scoring and considering the current NavId as a move target candidate. This is used when the move source is offset (e.g. pressing PageDown actually needs to send a Up move request, if we are pressing PageDown from the bottom-most item we need to stay in place)\n    ImGuiNavMoveFlags_AlsoScoreVisibleSet   = 1 << 5,   // Store alternate result in NavMoveResultLocalVisibleSet that only comprise elements that are already fully visible.\n    ImGuiNavMoveFlags_ScrollToEdge          = 1 << 6\n};\n\nenum ImGuiNavForward\n{\n    ImGuiNavForward_None,\n    ImGuiNavForward_ForwardQueued,\n    ImGuiNavForward_ForwardActive\n};\n\nenum ImGuiNavLayer\n{\n    ImGuiNavLayer_Main  = 0,    // Main scrolling layer\n    ImGuiNavLayer_Menu  = 1,    // Menu layer (access with Alt/ImGuiNavInput_Menu)\n    ImGuiNavLayer_COUNT\n};\n\nenum ImGuiPopupPositionPolicy\n{\n    ImGuiPopupPositionPolicy_Default,\n    ImGuiPopupPositionPolicy_ComboBox,\n    ImGuiPopupPositionPolicy_Tooltip\n};\n\nstruct ImGuiDataTypeTempStorage\n{\n    ImU8        Data[8];        // Can fit any data up to ImGuiDataType_COUNT\n};\n\n// Type information associated to one ImGuiDataType. Retrieve with DataTypeGetInfo().\nstruct ImGuiDataTypeInfo\n{\n    size_t      Size;           // Size in bytes\n    const char* Name;           // Short descriptive name for the type, for debugging\n    const char* PrintFmt;       // Default printf format for the type\n    const char* ScanFmt;        // Default scanf format for the type\n};\n\n// Extend ImGuiDataType_\nenum ImGuiDataTypePrivate_\n{\n    ImGuiDataType_String = ImGuiDataType_COUNT + 1,\n    ImGuiDataType_Pointer,\n    ImGuiDataType_ID\n};\n\n// Stacked color modifier, backup of modified data so we can restore it\nstruct ImGuiColorMod\n{\n    ImGuiCol    Col;\n    ImVec4      BackupValue;\n};\n\n// Stacked style modifier, backup of modified data so we can restore it. Data type inferred from the variable.\nstruct ImGuiStyleMod\n{\n    ImGuiStyleVar   VarIdx;\n    union           { int BackupInt[2]; float BackupFloat[2]; };\n    ImGuiStyleMod(ImGuiStyleVar idx, int v)     { VarIdx = idx; BackupInt[0] = v; }\n    ImGuiStyleMod(ImGuiStyleVar idx, float v)   { VarIdx = idx; BackupFloat[0] = v; }\n    ImGuiStyleMod(ImGuiStyleVar idx, ImVec2 v)  { VarIdx = idx; BackupFloat[0] = v.x; BackupFloat[1] = v.y; }\n};\n\n// Storage data for BeginComboPreview()/EndComboPreview()\nstruct IMGUI_API ImGuiComboPreviewData\n{\n    ImRect          PreviewRect;\n    ImVec2          BackupCursorPos;\n    ImVec2          BackupCursorMaxPos;\n    ImVec2          BackupCursorPosPrevLine;\n    float           BackupPrevLineTextBaseOffset;\n    ImGuiLayoutType BackupLayout;\n\n    ImGuiComboPreviewData() { memset(this, 0, sizeof(*this)); }\n};\n\n// Stacked storage data for BeginGroup()/EndGroup()\nstruct IMGUI_API ImGuiGroupData\n{\n    ImGuiID     WindowID;\n    ImVec2      BackupCursorPos;\n    ImVec2      BackupCursorMaxPos;\n    ImVec1      BackupIndent;\n    ImVec1      BackupGroupOffset;\n    ImVec2      BackupCurrLineSize;\n    float       BackupCurrLineTextBaseOffset;\n    ImGuiID     BackupActiveIdIsAlive;\n    bool        BackupActiveIdPreviousFrameIsAlive;\n    bool        BackupHoveredIdIsAlive;\n    bool        EmitItem;\n};\n\n// Simple column measurement, currently used for MenuItem() only.. This is very short-sighted/throw-away code and NOT a generic helper.\nstruct IMGUI_API ImGuiMenuColumns\n{\n    ImU32       TotalWidth;\n    ImU32       NextTotalWidth;\n    ImU16       Spacing;\n    ImU16       OffsetIcon;         // Always zero for now\n    ImU16       OffsetLabel;        // Offsets are locked in Update()\n    ImU16       OffsetShortcut;\n    ImU16       OffsetMark;\n    ImU16       Widths[4];          // Width of:   Icon, Label, Shortcut, Mark  (accumulators for current frame)\n\n    ImGuiMenuColumns() { memset(this, 0, sizeof(*this)); }\n    void        Update(float spacing, bool window_reappearing);\n    float       DeclColumns(float w_icon, float w_label, float w_shortcut, float w_mark);\n    void        CalcNextTotalWidth(bool update_offsets);\n};\n\n// Internal state of the currently focused/edited text input box\n// For a given item ID, access with ImGui::GetInputTextState()\nstruct IMGUI_API ImGuiInputTextState\n{\n    ImGuiID                 ID;                     // widget id owning the text state\n    int                     CurLenW, CurLenA;       // we need to maintain our buffer length in both UTF-8 and wchar format. UTF-8 length is valid even if TextA is not.\n    ImVector<ImWchar>       TextW;                  // edit buffer, we need to persist but can't guarantee the persistence of the user-provided buffer. so we copy into own buffer.\n    ImVector<char>          TextA;                  // temporary UTF8 buffer for callbacks and other operations. this is not updated in every code-path! size=capacity.\n    ImVector<char>          InitialTextA;           // backup of end-user buffer at the time of focus (in UTF-8, unaltered)\n    bool                    TextAIsValid;           // temporary UTF8 buffer is not initially valid before we make the widget active (until then we pull the data from user argument)\n    int                     BufCapacityA;           // end-user buffer capacity\n    float                   ScrollX;                // horizontal scrolling/offset\n    ImStb::STB_TexteditState Stb;                   // state for stb_textedit.h\n    float                   CursorAnim;             // timer for cursor blink, reset on every user action so the cursor reappears immediately\n    bool                    CursorFollow;           // set when we want scrolling to follow the current cursor position (not always!)\n    bool                    SelectedAllMouseLock;   // after a double-click to select all, we ignore further mouse drags to update selection\n    bool                    Edited;                 // edited this frame\n    ImGuiInputTextFlags     Flags;                  // copy of InputText() flags\n    ImGuiInputTextCallback  UserCallback;           // \"\n    void*                   UserCallbackData;       // \"\n\n    ImGuiInputTextState()                   { memset(this, 0, sizeof(*this)); }\n    void        ClearText()                 { CurLenW = CurLenA = 0; TextW[0] = 0; TextA[0] = 0; CursorClamp(); }\n    void        ClearFreeMemory()           { TextW.clear(); TextA.clear(); InitialTextA.clear(); }\n    int         GetUndoAvailCount() const   { return Stb.undostate.undo_point; }\n    int         GetRedoAvailCount() const   { return STB_TEXTEDIT_UNDOSTATECOUNT - Stb.undostate.redo_point; }\n    void        OnKeyPressed(int key);      // Cannot be inline because we call in code in stb_textedit.h implementation\n\n    // Cursor & Selection\n    void        CursorAnimReset()           { CursorAnim = -0.30f; }                                   // After a user-input the cursor stays on for a while without blinking\n    void        CursorClamp()               { Stb.cursor = ImMin(Stb.cursor, CurLenW); Stb.select_start = ImMin(Stb.select_start, CurLenW); Stb.select_end = ImMin(Stb.select_end, CurLenW); }\n    bool        HasSelection() const        { return Stb.select_start != Stb.select_end; }\n    void        ClearSelection()            { Stb.select_start = Stb.select_end = Stb.cursor; }\n    int         GetCursorPos() const        { return Stb.cursor; }\n    int         GetSelectionStart() const   { return Stb.select_start; }\n    int         GetSelectionEnd() const     { return Stb.select_end; }\n    void        SelectAll()                 { Stb.select_start = 0; Stb.cursor = Stb.select_end = CurLenW; Stb.has_preferred_x = 0; }\n};\n\n// Storage for current popup stack\nstruct ImGuiPopupData\n{\n    ImGuiID             PopupId;        // Set on OpenPopup()\n    ImGuiWindow*        Window;         // Resolved on BeginPopup() - may stay unresolved if user never calls OpenPopup()\n    ImGuiWindow*        SourceWindow;   // Set on OpenPopup() copy of NavWindow at the time of opening the popup\n    int                 OpenFrameCount; // Set on OpenPopup()\n    ImGuiID             OpenParentId;   // Set on OpenPopup(), we need this to differentiate multiple menu sets from each others (e.g. inside menu bar vs loose menu items)\n    ImVec2              OpenPopupPos;   // Set on OpenPopup(), preferred popup position (typically == OpenMousePos when using mouse)\n    ImVec2              OpenMousePos;   // Set on OpenPopup(), copy of mouse position at the time of opening popup\n\n    ImGuiPopupData()    { memset(this, 0, sizeof(*this)); OpenFrameCount = -1; }\n};\n\nstruct ImGuiNavItemData\n{\n    ImGuiWindow*        Window;         // Init,Move    // Best candidate window (result->ItemWindow->RootWindowForNav == request->Window)\n    ImGuiID             ID;             // Init,Move    // Best candidate item ID\n    ImGuiID             FocusScopeId;   // Init,Move    // Best candidate focus scope ID\n    ImRect              RectRel;        // Init,Move    // Best candidate bounding box in window relative space\n    float               DistBox;        //      Move    // Best candidate box distance to current NavId\n    float               DistCenter;     //      Move    // Best candidate center distance to current NavId\n    float               DistAxial;      //      Move    // Best candidate axial distance to current NavId\n\n    ImGuiNavItemData()  { Clear(); }\n    void Clear()        { Window = NULL; ID = FocusScopeId = 0; RectRel = ImRect(); DistBox = DistCenter = DistAxial = FLT_MAX; }\n};\n\nenum ImGuiNextWindowDataFlags_\n{\n    ImGuiNextWindowDataFlags_None               = 0,\n    ImGuiNextWindowDataFlags_HasPos             = 1 << 0,\n    ImGuiNextWindowDataFlags_HasSize            = 1 << 1,\n    ImGuiNextWindowDataFlags_HasContentSize     = 1 << 2,\n    ImGuiNextWindowDataFlags_HasCollapsed       = 1 << 3,\n    ImGuiNextWindowDataFlags_HasSizeConstraint  = 1 << 4,\n    ImGuiNextWindowDataFlags_HasFocus           = 1 << 5,\n    ImGuiNextWindowDataFlags_HasBgAlpha         = 1 << 6,\n    ImGuiNextWindowDataFlags_HasScroll          = 1 << 7\n};\n\n// Storage for SetNexWindow** functions\nstruct ImGuiNextWindowData\n{\n    ImGuiNextWindowDataFlags    Flags;\n    ImGuiCond                   PosCond;\n    ImGuiCond                   SizeCond;\n    ImGuiCond                   CollapsedCond;\n    ImVec2                      PosVal;\n    ImVec2                      PosPivotVal;\n    ImVec2                      SizeVal;\n    ImVec2                      ContentSizeVal;\n    ImVec2                      ScrollVal;\n    bool                        CollapsedVal;\n    ImRect                      SizeConstraintRect;\n    ImGuiSizeCallback           SizeCallback;\n    void*                       SizeCallbackUserData;\n    float                       BgAlphaVal;             // Override background alpha\n    ImVec2                      MenuBarOffsetMinVal;    // (Always on) This is not exposed publicly, so we don't clear it and it doesn't have a corresponding flag (could we? for consistency?)\n\n    ImGuiNextWindowData()       { memset(this, 0, sizeof(*this)); }\n    inline void ClearFlags()    { Flags = ImGuiNextWindowDataFlags_None; }\n};\n\nenum ImGuiNextItemDataFlags_\n{\n    ImGuiNextItemDataFlags_None     = 0,\n    ImGuiNextItemDataFlags_HasWidth = 1 << 0,\n    ImGuiNextItemDataFlags_HasOpen  = 1 << 1\n};\n\nstruct ImGuiNextItemData\n{\n    ImGuiNextItemDataFlags      Flags;\n    float                       Width;          // Set by SetNextItemWidth()\n    ImGuiID                     FocusScopeId;   // Set by SetNextItemMultiSelectData() (!= 0 signify value has been set, so it's an alternate version of HasSelectionData, we don't use Flags for this because they are cleared too early. This is mostly used for debugging)\n    ImGuiCond                   OpenCond;\n    bool                        OpenVal;        // Set by SetNextItemOpen()\n\n    ImGuiNextItemData()         { memset(this, 0, sizeof(*this)); }\n    inline void ClearFlags()    { Flags = ImGuiNextItemDataFlags_None; } // Also cleared manually by ItemAdd()!\n};\n\n// Status storage for the last submitted item\nstruct ImGuiLastItemData\n{\n    ImGuiID                 ID;\n    ImGuiItemFlags          InFlags;            // See ImGuiItemFlags_\n    ImGuiItemStatusFlags    StatusFlags;        // See ImGuiItemStatusFlags_\n    ImRect                  Rect;\n    ImRect                  DisplayRect;\n\n    ImGuiLastItemData()     { memset(this, 0, sizeof(*this)); }\n};\n\n// Data saved for each window pushed into the stack\nstruct ImGuiWindowStackData\n{\n    ImGuiWindow*            Window;\n    ImGuiLastItemData       ParentLastItemDataBackup;\n};\n\nstruct ImGuiShrinkWidthItem\n{\n    int         Index;\n    float       Width;\n};\n\nstruct ImGuiPtrOrIndex\n{\n    void*       Ptr;            // Either field can be set, not both. e.g. Dock node tab bars are loose while BeginTabBar() ones are in a pool.\n    int         Index;          // Usually index in a main pool.\n\n    ImGuiPtrOrIndex(void* ptr)  { Ptr = ptr; Index = -1; }\n    ImGuiPtrOrIndex(int index)  { Ptr = NULL; Index = index; }\n};\n\n//-----------------------------------------------------------------------------\n// [SECTION] Columns support\n//-----------------------------------------------------------------------------\n\n// Flags for internal's BeginColumns(). Prefix using BeginTable() nowadays!\nenum ImGuiOldColumnFlags_\n{\n    ImGuiOldColumnFlags_None                    = 0,\n    ImGuiOldColumnFlags_NoBorder                = 1 << 0,   // Disable column dividers\n    ImGuiOldColumnFlags_NoResize                = 1 << 1,   // Disable resizing columns when clicking on the dividers\n    ImGuiOldColumnFlags_NoPreserveWidths        = 1 << 2,   // Disable column width preservation when adjusting columns\n    ImGuiOldColumnFlags_NoForceWithinWindow     = 1 << 3,   // Disable forcing columns to fit within window\n    ImGuiOldColumnFlags_GrowParentContentsSize  = 1 << 4    // (WIP) Restore pre-1.51 behavior of extending the parent window contents size but _without affecting the columns width at all_. Will eventually remove.\n\n    // Obsolete names (will be removed)\n#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS\n    , ImGuiColumnsFlags_None                    = ImGuiOldColumnFlags_None,\n    ImGuiColumnsFlags_NoBorder                  = ImGuiOldColumnFlags_NoBorder,\n    ImGuiColumnsFlags_NoResize                  = ImGuiOldColumnFlags_NoResize,\n    ImGuiColumnsFlags_NoPreserveWidths          = ImGuiOldColumnFlags_NoPreserveWidths,\n    ImGuiColumnsFlags_NoForceWithinWindow       = ImGuiOldColumnFlags_NoForceWithinWindow,\n    ImGuiColumnsFlags_GrowParentContentsSize    = ImGuiOldColumnFlags_GrowParentContentsSize\n#endif\n};\n\nstruct ImGuiOldColumnData\n{\n    float               OffsetNorm;         // Column start offset, normalized 0.0 (far left) -> 1.0 (far right)\n    float               OffsetNormBeforeResize;\n    ImGuiOldColumnFlags Flags;              // Not exposed\n    ImRect              ClipRect;\n\n    ImGuiOldColumnData() { memset(this, 0, sizeof(*this)); }\n};\n\nstruct ImGuiOldColumns\n{\n    ImGuiID             ID;\n    ImGuiOldColumnFlags Flags;\n    bool                IsFirstFrame;\n    bool                IsBeingResized;\n    int                 Current;\n    int                 Count;\n    float               OffMinX, OffMaxX;       // Offsets from HostWorkRect.Min.x\n    float               LineMinY, LineMaxY;\n    float               HostCursorPosY;         // Backup of CursorPos at the time of BeginColumns()\n    float               HostCursorMaxPosX;      // Backup of CursorMaxPos at the time of BeginColumns()\n    ImRect              HostInitialClipRect;    // Backup of ClipRect at the time of BeginColumns()\n    ImRect              HostBackupClipRect;     // Backup of ClipRect during PushColumnsBackground()/PopColumnsBackground()\n    ImRect              HostBackupParentWorkRect;//Backup of WorkRect at the time of BeginColumns()\n    ImVector<ImGuiOldColumnData> Columns;\n    ImDrawListSplitter  Splitter;\n\n    ImGuiOldColumns()   { memset(this, 0, sizeof(*this)); }\n};\n\n//-----------------------------------------------------------------------------\n// [SECTION] Multi-select support\n//-----------------------------------------------------------------------------\n\n#ifdef IMGUI_HAS_MULTI_SELECT\n// <this is filled in 'range_select' branch>\n#endif // #ifdef IMGUI_HAS_MULTI_SELECT\n\n//-----------------------------------------------------------------------------\n// [SECTION] Docking support\n//-----------------------------------------------------------------------------\n\n#ifdef IMGUI_HAS_DOCK\n// <this is filled in 'docking' branch>\n#endif // #ifdef IMGUI_HAS_DOCK\n\n//-----------------------------------------------------------------------------\n// [SECTION] Viewport support\n//-----------------------------------------------------------------------------\n\n// ImGuiViewport Private/Internals fields (cardinal sin: we are using inheritance!)\n// Every instance of ImGuiViewport is in fact a ImGuiViewportP.\nstruct ImGuiViewportP : public ImGuiViewport\n{\n    int                 DrawListsLastFrame[2];  // Last frame number the background (0) and foreground (1) draw lists were used\n    ImDrawList*         DrawLists[2];           // Convenience background (0) and foreground (1) draw lists. We use them to draw software mouser cursor when io.MouseDrawCursor is set and to draw most debug overlays.\n    ImDrawData          DrawDataP;\n    ImDrawDataBuilder   DrawDataBuilder;\n\n    ImVec2              WorkOffsetMin;          // Work Area: Offset from Pos to top-left corner of Work Area. Generally (0,0) or (0,+main_menu_bar_height). Work Area is Full Area but without menu-bars/status-bars (so WorkArea always fit inside Pos/Size!)\n    ImVec2              WorkOffsetMax;          // Work Area: Offset from Pos+Size to bottom-right corner of Work Area. Generally (0,0) or (0,-status_bar_height).\n    ImVec2              BuildWorkOffsetMin;     // Work Area: Offset being built during current frame. Generally >= 0.0f.\n    ImVec2              BuildWorkOffsetMax;     // Work Area: Offset being built during current frame. Generally <= 0.0f.\n\n    ImGuiViewportP()    { DrawListsLastFrame[0] = DrawListsLastFrame[1] = -1; DrawLists[0] = DrawLists[1] = NULL; }\n    ~ImGuiViewportP()   { if (DrawLists[0]) IM_DELETE(DrawLists[0]); if (DrawLists[1]) IM_DELETE(DrawLists[1]); }\n\n    // Calculate work rect pos/size given a set of offset (we have 1 pair of offset for rect locked from last frame data, and 1 pair for currently building rect)\n    ImVec2  CalcWorkRectPos(const ImVec2& off_min) const                            { return ImVec2(Pos.x + off_min.x, Pos.y + off_min.y); }\n    ImVec2  CalcWorkRectSize(const ImVec2& off_min, const ImVec2& off_max) const    { return ImVec2(ImMax(0.0f, Size.x - off_min.x + off_max.x), ImMax(0.0f, Size.y - off_min.y + off_max.y)); }\n    void    UpdateWorkRect()            { WorkPos = CalcWorkRectPos(WorkOffsetMin); WorkSize = CalcWorkRectSize(WorkOffsetMin, WorkOffsetMax); } // Update public fields\n\n    // Helpers to retrieve ImRect (we don't need to store BuildWorkRect as every access tend to change it, hence the code asymmetry)\n    ImRect  GetMainRect() const         { return ImRect(Pos.x, Pos.y, Pos.x + Size.x, Pos.y + Size.y); }\n    ImRect  GetWorkRect() const         { return ImRect(WorkPos.x, WorkPos.y, WorkPos.x + WorkSize.x, WorkPos.y + WorkSize.y); }\n    ImRect  GetBuildWorkRect() const    { ImVec2 pos = CalcWorkRectPos(BuildWorkOffsetMin); ImVec2 size = CalcWorkRectSize(BuildWorkOffsetMin, BuildWorkOffsetMax); return ImRect(pos.x, pos.y, pos.x + size.x, pos.y + size.y); }\n};\n\n//-----------------------------------------------------------------------------\n// [SECTION] Settings support\n//-----------------------------------------------------------------------------\n\n// Windows data saved in imgui.ini file\n// Because we never destroy or rename ImGuiWindowSettings, we can store the names in a separate buffer easily.\n// (this is designed to be stored in a ImChunkStream buffer, with the variable-length Name following our structure)\nstruct ImGuiWindowSettings\n{\n    ImGuiID     ID;\n    ImVec2ih    Pos;\n    ImVec2ih    Size;\n    bool        Collapsed;\n    bool        WantApply;      // Set when loaded from .ini data (to enable merging/loading .ini data into an already running context)\n\n    ImGuiWindowSettings()       { memset(this, 0, sizeof(*this)); }\n    char* GetName()             { return (char*)(this + 1); }\n};\n\nstruct ImGuiSettingsHandler\n{\n    const char* TypeName;       // Short description stored in .ini file. Disallowed characters: '[' ']'\n    ImGuiID     TypeHash;       // == ImHashStr(TypeName)\n    void        (*ClearAllFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler);                                // Clear all settings data\n    void        (*ReadInitFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler);                                // Read: Called before reading (in registration order)\n    void*       (*ReadOpenFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler, const char* name);              // Read: Called when entering into a new ini entry e.g. \"[Window][Name]\"\n    void        (*ReadLineFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler, void* entry, const char* line); // Read: Called for every line of text within an ini entry\n    void        (*ApplyAllFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler);                                // Read: Called after reading (in registration order)\n    void        (*WriteAllFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* out_buf);      // Write: Output every entries into 'out_buf'\n    void*       UserData;\n\n    ImGuiSettingsHandler() { memset(this, 0, sizeof(*this)); }\n};\n\n//-----------------------------------------------------------------------------\n// [SECTION] Metrics, Debug\n//-----------------------------------------------------------------------------\n\nstruct ImGuiMetricsConfig\n{\n    bool        ShowWindowsRects;\n    bool        ShowWindowsBeginOrder;\n    bool        ShowTablesRects;\n    bool        ShowDrawCmdMesh;\n    bool        ShowDrawCmdBoundingBoxes;\n    int         ShowWindowsRectsType;\n    int         ShowTablesRectsType;\n\n    ImGuiMetricsConfig()\n    {\n        ShowWindowsRects = false;\n        ShowWindowsBeginOrder = false;\n        ShowTablesRects = false;\n        ShowDrawCmdMesh = true;\n        ShowDrawCmdBoundingBoxes = true;\n        ShowWindowsRectsType = -1;\n        ShowTablesRectsType = -1;\n    }\n};\n\nstruct IMGUI_API ImGuiStackSizes\n{\n    short   SizeOfIDStack;\n    short   SizeOfColorStack;\n    short   SizeOfStyleVarStack;\n    short   SizeOfFontStack;\n    short   SizeOfFocusScopeStack;\n    short   SizeOfGroupStack;\n    short   SizeOfBeginPopupStack;\n\n    ImGuiStackSizes() { memset(this, 0, sizeof(*this)); }\n    void SetToCurrentState();\n    void CompareWithCurrentState();\n};\n\n//-----------------------------------------------------------------------------\n// [SECTION] Generic context hooks\n//-----------------------------------------------------------------------------\n\ntypedef void (*ImGuiContextHookCallback)(ImGuiContext* ctx, ImGuiContextHook* hook);\nenum ImGuiContextHookType { ImGuiContextHookType_NewFramePre, ImGuiContextHookType_NewFramePost, ImGuiContextHookType_EndFramePre, ImGuiContextHookType_EndFramePost, ImGuiContextHookType_RenderPre, ImGuiContextHookType_RenderPost, ImGuiContextHookType_Shutdown, ImGuiContextHookType_PendingRemoval_ };\n\nstruct ImGuiContextHook\n{\n    ImGuiID                     HookId;     // A unique ID assigned by AddContextHook()\n    ImGuiContextHookType        Type;\n    ImGuiID                     Owner;\n    ImGuiContextHookCallback    Callback;\n    void*                       UserData;\n\n    ImGuiContextHook()          { memset(this, 0, sizeof(*this)); }\n};\n\n//-----------------------------------------------------------------------------\n// [SECTION] ImGuiContext (main imgui context)\n//-----------------------------------------------------------------------------\n\nstruct ImGuiContext\n{\n    bool                    Initialized;\n    bool                    FontAtlasOwnedByContext;            // IO.Fonts-> is owned by the ImGuiContext and will be destructed along with it.\n    ImGuiIO                 IO;\n    ImGuiStyle              Style;\n    ImFont*                 Font;                               // (Shortcut) == FontStack.empty() ? IO.Font : FontStack.back()\n    float                   FontSize;                           // (Shortcut) == FontBaseSize * g.CurrentWindow->FontWindowScale == window->FontSize(). Text height for current window.\n    float                   FontBaseSize;                       // (Shortcut) == IO.FontGlobalScale * Font->Scale * Font->FontSize. Base text height.\n    ImDrawListSharedData    DrawListSharedData;\n    double                  Time;\n    int                     FrameCount;\n    int                     FrameCountEnded;\n    int                     FrameCountRendered;\n    bool                    WithinFrameScope;                   // Set by NewFrame(), cleared by EndFrame()\n    bool                    WithinFrameScopeWithImplicitWindow; // Set by NewFrame(), cleared by EndFrame() when the implicit debug window has been pushed\n    bool                    WithinEndChild;                     // Set within EndChild()\n    bool                    GcCompactAll;                       // Request full GC\n    bool                    TestEngineHookItems;                // Will call test engine hooks: ImGuiTestEngineHook_ItemAdd(), ImGuiTestEngineHook_ItemInfo(), ImGuiTestEngineHook_Log()\n    ImGuiID                 TestEngineHookIdInfo;               // Will call test engine hooks: ImGuiTestEngineHook_IdInfo() from GetID()\n    void*                   TestEngine;                         // Test engine user data\n\n    // Windows state\n    ImVector<ImGuiWindow*>  Windows;                            // Windows, sorted in display order, back to front\n    ImVector<ImGuiWindow*>  WindowsFocusOrder;                  // Root windows, sorted in focus order, back to front.\n    ImVector<ImGuiWindow*>  WindowsTempSortBuffer;              // Temporary buffer used in EndFrame() to reorder windows so parents are kept before their child\n    ImVector<ImGuiWindowStackData> CurrentWindowStack;\n    ImGuiStorage            WindowsById;                        // Map window's ImGuiID to ImGuiWindow*\n    int                     WindowsActiveCount;                 // Number of unique windows submitted by frame\n    ImVec2                  WindowsHoverPadding;                // Padding around resizable windows for which hovering on counts as hovering the window == ImMax(style.TouchExtraPadding, WINDOWS_HOVER_PADDING)\n    ImGuiWindow*            CurrentWindow;                      // Window being drawn into\n    ImGuiWindow*            HoveredWindow;                      // Window the mouse is hovering. Will typically catch mouse inputs.\n    ImGuiWindow*            HoveredWindowUnderMovingWindow;     // Hovered window ignoring MovingWindow. Only set if MovingWindow is set.\n    ImGuiWindow*            MovingWindow;                       // Track the window we clicked on (in order to preserve focus). The actual window that is moved is generally MovingWindow->RootWindow.\n    ImGuiWindow*            WheelingWindow;                     // Track the window we started mouse-wheeling on. Until a timer elapse or mouse has moved, generally keep scrolling the same window even if during the course of scrolling the mouse ends up hovering a child window.\n    ImVec2                  WheelingWindowRefMousePos;\n    float                   WheelingWindowTimer;\n\n    // Item/widgets state and tracking information\n    ImGuiID                 HoveredId;                          // Hovered widget, filled during the frame\n    ImGuiID                 HoveredIdPreviousFrame;\n    bool                    HoveredIdAllowOverlap;\n    bool                    HoveredIdUsingMouseWheel;           // Hovered widget will use mouse wheel. Blocks scrolling the underlying window.\n    bool                    HoveredIdPreviousFrameUsingMouseWheel;\n    bool                    HoveredIdDisabled;                  // At least one widget passed the rect test, but has been discarded by disabled flag or popup inhibit. May be true even if HoveredId == 0.\n    float                   HoveredIdTimer;                     // Measure contiguous hovering time\n    float                   HoveredIdNotActiveTimer;            // Measure contiguous hovering time where the item has not been active\n    ImGuiID                 ActiveId;                           // Active widget\n    ImGuiID                 ActiveIdIsAlive;                    // Active widget has been seen this frame (we can't use a bool as the ActiveId may change within the frame)\n    float                   ActiveIdTimer;\n    bool                    ActiveIdIsJustActivated;            // Set at the time of activation for one frame\n    bool                    ActiveIdAllowOverlap;               // Active widget allows another widget to steal active id (generally for overlapping widgets, but not always)\n    bool                    ActiveIdNoClearOnFocusLoss;         // Disable losing active id if the active id window gets unfocused.\n    bool                    ActiveIdHasBeenPressedBefore;       // Track whether the active id led to a press (this is to allow changing between PressOnClick and PressOnRelease without pressing twice). Used by range_select branch.\n    bool                    ActiveIdHasBeenEditedBefore;        // Was the value associated to the widget Edited over the course of the Active state.\n    bool                    ActiveIdHasBeenEditedThisFrame;\n    bool                    ActiveIdUsingMouseWheel;            // Active widget will want to read mouse wheel. Blocks scrolling the underlying window.\n    ImU32                   ActiveIdUsingNavDirMask;            // Active widget will want to read those nav move requests (e.g. can activate a button and move away from it)\n    ImU32                   ActiveIdUsingNavInputMask;          // Active widget will want to read those nav inputs.\n    ImU64                   ActiveIdUsingKeyInputMask;          // Active widget will want to read those key inputs. When we grow the ImGuiKey enum we'll need to either to order the enum to make useful keys come first, either redesign this into e.g. a small array.\n    ImVec2                  ActiveIdClickOffset;                // Clicked offset from upper-left corner, if applicable (currently only set by ButtonBehavior)\n    ImGuiWindow*            ActiveIdWindow;\n    ImGuiInputSource        ActiveIdSource;                     // Activating with mouse or nav (gamepad/keyboard)\n    int                     ActiveIdMouseButton;\n    ImGuiID                 ActiveIdPreviousFrame;\n    bool                    ActiveIdPreviousFrameIsAlive;\n    bool                    ActiveIdPreviousFrameHasBeenEditedBefore;\n    ImGuiWindow*            ActiveIdPreviousFrameWindow;\n    ImGuiID                 LastActiveId;                       // Store the last non-zero ActiveId, useful for animation.\n    float                   LastActiveIdTimer;                  // Store the last non-zero ActiveId timer since the beginning of activation, useful for animation.\n\n    // Next window/item data\n    ImGuiItemFlags          CurrentItemFlags;                      // == g.ItemFlagsStack.back()\n    ImGuiNextItemData       NextItemData;                       // Storage for SetNextItem** functions\n    ImGuiLastItemData       LastItemData;                       // Storage for last submitted item (setup by ItemAdd)\n    ImGuiNextWindowData     NextWindowData;                     // Storage for SetNextWindow** functions\n\n    // Shared stacks\n    ImVector<ImGuiColorMod> ColorStack;                         // Stack for PushStyleColor()/PopStyleColor() - inherited by Begin()\n    ImVector<ImGuiStyleMod> StyleVarStack;                      // Stack for PushStyleVar()/PopStyleVar() - inherited by Begin()\n    ImVector<ImFont*>       FontStack;                          // Stack for PushFont()/PopFont() - inherited by Begin()\n    ImVector<ImGuiID>       FocusScopeStack;                    // Stack for PushFocusScope()/PopFocusScope() - not inherited by Begin(), unless child window\n    ImVector<ImGuiItemFlags>ItemFlagsStack;                     // Stack for PushItemFlag()/PopItemFlag() - inherited by Begin()\n    ImVector<ImGuiGroupData>GroupStack;                         // Stack for BeginGroup()/EndGroup() - not inherited by Begin()\n    ImVector<ImGuiPopupData>OpenPopupStack;                     // Which popups are open (persistent)\n    ImVector<ImGuiPopupData>BeginPopupStack;                    // Which level of BeginPopup() we are in (reset every frame)\n\n    // Viewports\n    ImVector<ImGuiViewportP*> Viewports;                        // Active viewports (Size==1 in 'master' branch). Each viewports hold their copy of ImDrawData.\n\n    // Gamepad/keyboard Navigation\n    ImGuiWindow*            NavWindow;                          // Focused window for navigation. Could be called 'FocusWindow'\n    ImGuiID                 NavId;                              // Focused item for navigation\n    ImGuiID                 NavFocusScopeId;                    // Identify a selection scope (selection code often wants to \"clear other items\" when landing on an item of the selection set)\n    ImGuiID                 NavActivateId;                      // ~~ (g.ActiveId == 0) && IsNavInputPressed(ImGuiNavInput_Activate) ? NavId : 0, also set when calling ActivateItem()\n    ImGuiID                 NavActivateDownId;                  // ~~ IsNavInputDown(ImGuiNavInput_Activate) ? NavId : 0\n    ImGuiID                 NavActivatePressedId;               // ~~ IsNavInputPressed(ImGuiNavInput_Activate) ? NavId : 0\n    ImGuiID                 NavInputId;                         // ~~ IsNavInputPressed(ImGuiNavInput_Input) ? NavId : 0\n    ImGuiID                 NavJustTabbedId;                    // Just tabbed to this id.\n    ImGuiID                 NavJustMovedToId;                   // Just navigated to this id (result of a successfully MoveRequest).\n    ImGuiID                 NavJustMovedToFocusScopeId;         // Just navigated to this focus scope id (result of a successfully MoveRequest).\n    ImGuiKeyModFlags        NavJustMovedToKeyMods;\n    ImGuiID                 NavNextActivateId;                  // Set by ActivateItem(), queued until next frame.\n    ImGuiInputSource        NavInputSource;                     // Keyboard or Gamepad mode? THIS WILL ONLY BE None or NavGamepad or NavKeyboard.\n    ImRect                  NavScoringRect;                     // Rectangle used for scoring, in screen space. Based of window->NavRectRel[], modified for directional navigation scoring.\n    int                     NavScoringCount;                    // Metrics for debugging\n    ImGuiNavLayer           NavLayer;                           // Layer we are navigating on. For now the system is hard-coded for 0=main contents and 1=menu/title bar, may expose layers later.\n    int                     NavIdTabCounter;                    // == NavWindow->DC.FocusIdxTabCounter at time of NavId processing\n    bool                    NavIdIsAlive;                       // Nav widget has been seen this frame ~~ NavRectRel is valid\n    bool                    NavMousePosDirty;                   // When set we will update mouse position if (io.ConfigFlags & ImGuiConfigFlags_NavEnableSetMousePos) if set (NB: this not enabled by default)\n    bool                    NavDisableHighlight;                // When user starts using mouse, we hide gamepad/keyboard highlight (NB: but they are still available, which is why NavDisableHighlight isn't always != NavDisableMouseHover)\n    bool                    NavDisableMouseHover;               // When user starts using gamepad/keyboard, we hide mouse hovering highlight until mouse is touched again.\n    bool                    NavAnyRequest;                      // ~~ NavMoveRequest || NavInitRequest\n    bool                    NavInitRequest;                     // Init request for appearing window to select first item\n    bool                    NavInitRequestFromMove;\n    ImGuiID                 NavInitResultId;                    // Init request result (first item of the window, or one for which SetItemDefaultFocus() was called)\n    ImRect                  NavInitResultRectRel;               // Init request result rectangle (relative to parent window)\n    bool                    NavMoveRequest;                     // Move request for this frame\n    ImGuiNavMoveFlags       NavMoveRequestFlags;\n    ImGuiNavForward         NavMoveRequestForward;              // None / ForwardQueued / ForwardActive (this is used to navigate sibling parent menus from a child menu)\n    ImGuiKeyModFlags        NavMoveRequestKeyMods;\n    ImGuiDir                NavMoveDir, NavMoveDirLast;         // Direction of the move request (left/right/up/down), direction of the previous move request\n    ImGuiDir                NavMoveClipDir;                     // FIXME-NAV: Describe the purpose of this better. Might want to rename?\n    ImGuiNavItemData        NavMoveResultLocal;                 // Best move request candidate within NavWindow\n    ImGuiNavItemData        NavMoveResultLocalVisibleSet;       // Best move request candidate within NavWindow that are mostly visible (when using ImGuiNavMoveFlags_AlsoScoreVisibleSet flag)\n    ImGuiNavItemData        NavMoveResultOther;                 // Best move request candidate within NavWindow's flattened hierarchy (when using ImGuiWindowFlags_NavFlattened flag)\n    ImGuiWindow*            NavWrapRequestWindow;               // Window which requested trying nav wrap-around.\n    ImGuiNavMoveFlags       NavWrapRequestFlags;                // Wrap-around operation flags.\n\n    // Navigation: Windowing (CTRL+TAB for list, or Menu button + keys or directional pads to move/resize)\n    ImGuiWindow*            NavWindowingTarget;                 // Target window when doing CTRL+Tab (or Pad Menu + FocusPrev/Next), this window is temporarily displayed top-most!\n    ImGuiWindow*            NavWindowingTargetAnim;             // Record of last valid NavWindowingTarget until DimBgRatio and NavWindowingHighlightAlpha becomes 0.0f, so the fade-out can stay on it.\n    ImGuiWindow*            NavWindowingListWindow;             // Internal window actually listing the CTRL+Tab contents\n    float                   NavWindowingTimer;\n    float                   NavWindowingHighlightAlpha;\n    bool                    NavWindowingToggleLayer;\n\n    // Legacy Focus/Tabbing system (older than Nav, active even if Nav is disabled, misnamed. FIXME-NAV: This needs a redesign!)\n    ImGuiWindow*            TabFocusRequestCurrWindow;          //\n    ImGuiWindow*            TabFocusRequestNextWindow;          //\n    int                     TabFocusRequestCurrCounterRegular;  // Any item being requested for focus, stored as an index (we on layout to be stable between the frame pressing TAB and the next frame, semi-ouch)\n    int                     TabFocusRequestCurrCounterTabStop;  // Tab item being requested for focus, stored as an index\n    int                     TabFocusRequestNextCounterRegular;  // Stored for next frame\n    int                     TabFocusRequestNextCounterTabStop;  // \"\n    bool                    TabFocusPressed;                    // Set in NewFrame() when user pressed Tab\n\n    // Render\n    float                   DimBgRatio;                         // 0.0..1.0 animation when fading in a dimming background (for modal window and CTRL+TAB list)\n    ImGuiMouseCursor        MouseCursor;\n\n    // Drag and Drop\n    bool                    DragDropActive;\n    bool                    DragDropWithinSource;               // Set when within a BeginDragDropXXX/EndDragDropXXX block for a drag source.\n    bool                    DragDropWithinTarget;               // Set when within a BeginDragDropXXX/EndDragDropXXX block for a drag target.\n    ImGuiDragDropFlags      DragDropSourceFlags;\n    int                     DragDropSourceFrameCount;\n    int                     DragDropMouseButton;\n    ImGuiPayload            DragDropPayload;\n    ImRect                  DragDropTargetRect;                 // Store rectangle of current target candidate (we favor small targets when overlapping)\n    ImGuiID                 DragDropTargetId;\n    ImGuiDragDropFlags      DragDropAcceptFlags;\n    float                   DragDropAcceptIdCurrRectSurface;    // Target item surface (we resolve overlapping targets by prioritizing the smaller surface)\n    ImGuiID                 DragDropAcceptIdCurr;               // Target item id (set at the time of accepting the payload)\n    ImGuiID                 DragDropAcceptIdPrev;               // Target item id from previous frame (we need to store this to allow for overlapping drag and drop targets)\n    int                     DragDropAcceptFrameCount;           // Last time a target expressed a desire to accept the source\n    ImGuiID                 DragDropHoldJustPressedId;          // Set when holding a payload just made ButtonBehavior() return a press.\n    ImVector<unsigned char> DragDropPayloadBufHeap;             // We don't expose the ImVector<> directly, ImGuiPayload only holds pointer+size\n    unsigned char           DragDropPayloadBufLocal[16];        // Local buffer for small payloads\n\n    // Table\n    ImGuiTable*                     CurrentTable;\n    int                             CurrentTableStackIdx;\n    ImPool<ImGuiTable>              Tables;\n    ImVector<ImGuiTableTempData>    TablesTempDataStack;\n    ImVector<float>                 TablesLastTimeActive;       // Last used timestamp of each tables (SOA, for efficient GC)\n    ImVector<ImDrawChannel>         DrawChannelsTempMergeBuffer;\n\n    // Tab bars\n    ImGuiTabBar*                    CurrentTabBar;\n    ImPool<ImGuiTabBar>             TabBars;\n    ImVector<ImGuiPtrOrIndex>       CurrentTabBarStack;\n    ImVector<ImGuiShrinkWidthItem>  ShrinkWidthBuffer;\n\n    // Widget state\n    ImVec2                  LastValidMousePos;\n    ImGuiInputTextState     InputTextState;\n    ImFont                  InputTextPasswordFont;\n    ImGuiID                 TempInputId;                        // Temporary text input when CTRL+clicking on a slider, etc.\n    ImGuiColorEditFlags     ColorEditOptions;                   // Store user options for color edit widgets\n    float                   ColorEditLastHue;                   // Backup of last Hue associated to LastColor[3], so we can restore Hue in lossy RGB<>HSV round trips\n    float                   ColorEditLastSat;                   // Backup of last Saturation associated to LastColor[3], so we can restore Saturation in lossy RGB<>HSV round trips\n    float                   ColorEditLastColor[3];\n    ImVec4                  ColorPickerRef;                     // Initial/reference color at the time of opening the color picker.\n    ImGuiComboPreviewData   ComboPreviewData;\n    float                   SliderCurrentAccum;                 // Accumulated slider delta when using navigation controls.\n    bool                    SliderCurrentAccumDirty;            // Has the accumulated slider delta changed since last time we tried to apply it?\n    bool                    DragCurrentAccumDirty;\n    float                   DragCurrentAccum;                   // Accumulator for dragging modification. Always high-precision, not rounded by end-user precision settings\n    float                   DragSpeedDefaultRatio;              // If speed == 0.0f, uses (max-min) * DragSpeedDefaultRatio\n    float                   DisabledAlphaBackup;                // Backup for style.Alpha for BeginDisabled()\n    float                   ScrollbarClickDeltaToGrabCenter;    // Distance between mouse and center of grab box, normalized in parent space. Use storage?\n    int                     TooltipOverrideCount;\n    float                   TooltipSlowDelay;                   // Time before slow tooltips appears (FIXME: This is temporary until we merge in tooltip timer+priority work)\n    ImVector<char>          ClipboardHandlerData;               // If no custom clipboard handler is defined\n    ImVector<ImGuiID>       MenusIdSubmittedThisFrame;          // A list of menu IDs that were rendered at least once\n\n    // Platform support\n    ImVec2                  PlatformImePos;                     // Cursor position request & last passed to the OS Input Method Editor\n    ImVec2                  PlatformImeLastPos;\n    char                    PlatformLocaleDecimalPoint;         // '.' or *localeconv()->decimal_point\n\n    // Settings\n    bool                    SettingsLoaded;\n    float                   SettingsDirtyTimer;                 // Save .ini Settings to memory when time reaches zero\n    ImGuiTextBuffer         SettingsIniData;                    // In memory .ini settings\n    ImVector<ImGuiSettingsHandler>      SettingsHandlers;       // List of .ini settings handlers\n    ImChunkStream<ImGuiWindowSettings>  SettingsWindows;        // ImGuiWindow .ini settings entries\n    ImChunkStream<ImGuiTableSettings>   SettingsTables;         // ImGuiTable .ini settings entries\n    ImVector<ImGuiContextHook>          Hooks;                  // Hooks for extensions (e.g. test engine)\n    ImGuiID                             HookIdNext;             // Next available HookId\n\n    // Capture/Logging\n    bool                    LogEnabled;                         // Currently capturing\n    ImGuiLogType            LogType;                            // Capture target\n    ImFileHandle            LogFile;                            // If != NULL log to stdout/ file\n    ImGuiTextBuffer         LogBuffer;                          // Accumulation buffer when log to clipboard. This is pointer so our GImGui static constructor doesn't call heap allocators.\n    const char*             LogNextPrefix;\n    const char*             LogNextSuffix;\n    float                   LogLinePosY;\n    bool                    LogLineFirstItem;\n    int                     LogDepthRef;\n    int                     LogDepthToExpand;\n    int                     LogDepthToExpandDefault;            // Default/stored value for LogDepthMaxExpand if not specified in the LogXXX function call.\n\n    // Debug Tools\n    bool                    DebugItemPickerActive;              // Item picker is active (started with DebugStartItemPicker())\n    ImGuiID                 DebugItemPickerBreakId;             // Will call IM_DEBUG_BREAK() when encountering this id\n    ImGuiMetricsConfig      DebugMetricsConfig;\n\n    // Misc\n    float                   FramerateSecPerFrame[120];          // Calculate estimate of framerate for user over the last 2 seconds.\n    int                     FramerateSecPerFrameIdx;\n    int                     FramerateSecPerFrameCount;\n    float                   FramerateSecPerFrameAccum;\n    int                     WantCaptureMouseNextFrame;          // Explicit capture via CaptureKeyboardFromApp()/CaptureMouseFromApp() sets those flags\n    int                     WantCaptureKeyboardNextFrame;\n    int                     WantTextInputNextFrame;\n    char                    TempBuffer[1024 * 3 + 1];           // Temporary text buffer\n\n    ImGuiContext(ImFontAtlas* shared_font_atlas)\n    {\n        Initialized = false;\n        FontAtlasOwnedByContext = shared_font_atlas ? false : true;\n        Font = NULL;\n        FontSize = FontBaseSize = 0.0f;\n        IO.Fonts = shared_font_atlas ? shared_font_atlas : IM_NEW(ImFontAtlas)();\n        Time = 0.0f;\n        FrameCount = 0;\n        FrameCountEnded = FrameCountRendered = -1;\n        WithinFrameScope = WithinFrameScopeWithImplicitWindow = WithinEndChild = false;\n        GcCompactAll = false;\n        TestEngineHookItems = false;\n        TestEngineHookIdInfo = 0;\n        TestEngine = NULL;\n\n        WindowsActiveCount = 0;\n        CurrentWindow = NULL;\n        HoveredWindow = NULL;\n        HoveredWindowUnderMovingWindow = NULL;\n        MovingWindow = NULL;\n        WheelingWindow = NULL;\n        WheelingWindowTimer = 0.0f;\n\n        HoveredId = HoveredIdPreviousFrame = 0;\n        HoveredIdAllowOverlap = false;\n        HoveredIdUsingMouseWheel = HoveredIdPreviousFrameUsingMouseWheel = false;\n        HoveredIdDisabled = false;\n        HoveredIdTimer = HoveredIdNotActiveTimer = 0.0f;\n        ActiveId = 0;\n        ActiveIdIsAlive = 0;\n        ActiveIdTimer = 0.0f;\n        ActiveIdIsJustActivated = false;\n        ActiveIdAllowOverlap = false;\n        ActiveIdNoClearOnFocusLoss = false;\n        ActiveIdHasBeenPressedBefore = false;\n        ActiveIdHasBeenEditedBefore = false;\n        ActiveIdHasBeenEditedThisFrame = false;\n        ActiveIdUsingMouseWheel = false;\n        ActiveIdUsingNavDirMask = 0x00;\n        ActiveIdUsingNavInputMask = 0x00;\n        ActiveIdUsingKeyInputMask = 0x00;\n        ActiveIdClickOffset = ImVec2(-1, -1);\n        ActiveIdWindow = NULL;\n        ActiveIdSource = ImGuiInputSource_None;\n        ActiveIdMouseButton = -1;\n        ActiveIdPreviousFrame = 0;\n        ActiveIdPreviousFrameIsAlive = false;\n        ActiveIdPreviousFrameHasBeenEditedBefore = false;\n        ActiveIdPreviousFrameWindow = NULL;\n        LastActiveId = 0;\n        LastActiveIdTimer = 0.0f;\n\n        CurrentItemFlags = ImGuiItemFlags_None;\n\n        NavWindow = NULL;\n        NavId = NavFocusScopeId = NavActivateId = NavActivateDownId = NavActivatePressedId = NavInputId = 0;\n        NavJustTabbedId = NavJustMovedToId = NavJustMovedToFocusScopeId = NavNextActivateId = 0;\n        NavJustMovedToKeyMods = ImGuiKeyModFlags_None;\n        NavInputSource = ImGuiInputSource_None;\n        NavScoringRect = ImRect();\n        NavScoringCount = 0;\n        NavLayer = ImGuiNavLayer_Main;\n        NavIdTabCounter = INT_MAX;\n        NavIdIsAlive = false;\n        NavMousePosDirty = false;\n        NavDisableHighlight = true;\n        NavDisableMouseHover = false;\n        NavAnyRequest = false;\n        NavInitRequest = false;\n        NavInitRequestFromMove = false;\n        NavInitResultId = 0;\n        NavMoveRequest = false;\n        NavMoveRequestFlags = ImGuiNavMoveFlags_None;\n        NavMoveRequestForward = ImGuiNavForward_None;\n        NavMoveRequestKeyMods = ImGuiKeyModFlags_None;\n        NavMoveDir = NavMoveDirLast = NavMoveClipDir = ImGuiDir_None;\n        NavWrapRequestWindow = NULL;\n        NavWrapRequestFlags = ImGuiNavMoveFlags_None;\n\n        NavWindowingTarget = NavWindowingTargetAnim = NavWindowingListWindow = NULL;\n        NavWindowingTimer = NavWindowingHighlightAlpha = 0.0f;\n        NavWindowingToggleLayer = false;\n\n        TabFocusRequestCurrWindow = TabFocusRequestNextWindow = NULL;\n        TabFocusRequestCurrCounterRegular = TabFocusRequestCurrCounterTabStop = INT_MAX;\n        TabFocusRequestNextCounterRegular = TabFocusRequestNextCounterTabStop = INT_MAX;\n        TabFocusPressed = false;\n\n        DimBgRatio = 0.0f;\n        MouseCursor = ImGuiMouseCursor_Arrow;\n\n        DragDropActive = DragDropWithinSource = DragDropWithinTarget = false;\n        DragDropSourceFlags = ImGuiDragDropFlags_None;\n        DragDropSourceFrameCount = -1;\n        DragDropMouseButton = -1;\n        DragDropTargetId = 0;\n        DragDropAcceptFlags = ImGuiDragDropFlags_None;\n        DragDropAcceptIdCurrRectSurface = 0.0f;\n        DragDropAcceptIdPrev = DragDropAcceptIdCurr = 0;\n        DragDropAcceptFrameCount = -1;\n        DragDropHoldJustPressedId = 0;\n        memset(DragDropPayloadBufLocal, 0, sizeof(DragDropPayloadBufLocal));\n\n        CurrentTable = NULL;\n        CurrentTableStackIdx = -1;\n        CurrentTabBar = NULL;\n\n        LastValidMousePos = ImVec2(0.0f, 0.0f);\n        TempInputId = 0;\n        ColorEditOptions = ImGuiColorEditFlags_DefaultOptions_;\n        ColorEditLastHue = ColorEditLastSat = 0.0f;\n        ColorEditLastColor[0] = ColorEditLastColor[1] = ColorEditLastColor[2] = FLT_MAX;\n        SliderCurrentAccum = 0.0f;\n        SliderCurrentAccumDirty = false;\n        DragCurrentAccumDirty = false;\n        DragCurrentAccum = 0.0f;\n        DragSpeedDefaultRatio = 1.0f / 100.0f;\n        DisabledAlphaBackup = 0.0f;\n        ScrollbarClickDeltaToGrabCenter = 0.0f;\n        TooltipOverrideCount = 0;\n        TooltipSlowDelay = 0.50f;\n\n        PlatformImePos = PlatformImeLastPos = ImVec2(FLT_MAX, FLT_MAX);\n        PlatformLocaleDecimalPoint = '.';\n\n        SettingsLoaded = false;\n        SettingsDirtyTimer = 0.0f;\n        HookIdNext = 0;\n\n        LogEnabled = false;\n        LogType = ImGuiLogType_None;\n        LogNextPrefix = LogNextSuffix = NULL;\n        LogFile = NULL;\n        LogLinePosY = FLT_MAX;\n        LogLineFirstItem = false;\n        LogDepthRef = 0;\n        LogDepthToExpand = LogDepthToExpandDefault = 2;\n\n        DebugItemPickerActive = false;\n        DebugItemPickerBreakId = 0;\n\n        memset(FramerateSecPerFrame, 0, sizeof(FramerateSecPerFrame));\n        FramerateSecPerFrameIdx = FramerateSecPerFrameCount = 0;\n        FramerateSecPerFrameAccum = 0.0f;\n        WantCaptureMouseNextFrame = WantCaptureKeyboardNextFrame = WantTextInputNextFrame = -1;\n        memset(TempBuffer, 0, sizeof(TempBuffer));\n    }\n};\n\n//-----------------------------------------------------------------------------\n// [SECTION] ImGuiWindowTempData, ImGuiWindow\n//-----------------------------------------------------------------------------\n\n// Transient per-window data, reset at the beginning of the frame. This used to be called ImGuiDrawContext, hence the DC variable name in ImGuiWindow.\n// (That's theory, in practice the delimitation between ImGuiWindow and ImGuiWindowTempData is quite tenuous and could be reconsidered..)\n// (This doesn't need a constructor because we zero-clear it as part of ImGuiWindow and all frame-temporary data are setup on Begin)\nstruct IMGUI_API ImGuiWindowTempData\n{\n    // Layout\n    ImVec2                  CursorPos;              // Current emitting position, in absolute coordinates.\n    ImVec2                  CursorPosPrevLine;\n    ImVec2                  CursorStartPos;         // Initial position after Begin(), generally ~ window position + WindowPadding.\n    ImVec2                  CursorMaxPos;           // Used to implicitly calculate ContentSize at the beginning of next frame, for scrolling range and auto-resize. Always growing during the frame.\n    ImVec2                  IdealMaxPos;            // Used to implicitly calculate ContentSizeIdeal at the beginning of next frame, for auto-resize only. Always growing during the frame.\n    ImVec2                  CurrLineSize;\n    ImVec2                  PrevLineSize;\n    float                   CurrLineTextBaseOffset; // Baseline offset (0.0f by default on a new line, generally == style.FramePadding.y when a framed item has been added).\n    float                   PrevLineTextBaseOffset;\n    ImVec1                  Indent;                 // Indentation / start position from left of window (increased by TreePush/TreePop, etc.)\n    ImVec1                  ColumnsOffset;          // Offset to the current column (if ColumnsCurrent > 0). FIXME: This and the above should be a stack to allow use cases like Tree->Column->Tree. Need revamp columns API.\n    ImVec1                  GroupOffset;\n\n    // Keyboard/Gamepad navigation\n    ImGuiNavLayer           NavLayerCurrent;        // Current layer, 0..31 (we currently only use 0..1)\n    short                   NavLayersActiveMask;    // Which layers have been written to (result from previous frame)\n    short                   NavLayersActiveMaskNext;// Which layers have been written to (accumulator for current frame)\n    ImGuiID                 NavFocusScopeIdCurrent; // Current focus scope ID while appending\n    bool                    NavHideHighlightOneFrame;\n    bool                    NavHasScroll;           // Set when scrolling can be used (ScrollMax > 0.0f)\n\n    // Miscellaneous\n    bool                    MenuBarAppending;       // FIXME: Remove this\n    ImVec2                  MenuBarOffset;          // MenuBarOffset.x is sort of equivalent of a per-layer CursorPos.x, saved/restored as we switch to the menu bar. The only situation when MenuBarOffset.y is > 0 if when (SafeAreaPadding.y > FramePadding.y), often used on TVs.\n    ImGuiMenuColumns        MenuColumns;            // Simplified columns storage for menu items measurement\n    int                     TreeDepth;              // Current tree depth.\n    ImU32                   TreeJumpToParentOnPopMask; // Store a copy of !g.NavIdIsAlive for TreeDepth 0..31.. Could be turned into a ImU64 if necessary.\n    ImVector<ImGuiWindow*>  ChildWindows;\n    ImGuiStorage*           StateStorage;           // Current persistent per-window storage (store e.g. tree node open/close state)\n    ImGuiOldColumns*        CurrentColumns;         // Current columns set\n    int                     CurrentTableIdx;        // Current table index (into g.Tables)\n    ImGuiLayoutType         LayoutType;\n    ImGuiLayoutType         ParentLayoutType;       // Layout type of parent window at the time of Begin()\n    int                     FocusCounterRegular;    // (Legacy Focus/Tabbing system) Sequential counter, start at -1 and increase as assigned via FocusableItemRegister() (FIXME-NAV: Needs redesign)\n    int                     FocusCounterTabStop;    // (Legacy Focus/Tabbing system) Same, but only count widgets which you can Tab through.\n\n    // Local parameters stacks\n    // We store the current settings outside of the vectors to increase memory locality (reduce cache misses). The vectors are rarely modified. Also it allows us to not heap allocate for short-lived windows which are not using those settings.\n    float                   ItemWidth;              // Current item width (>0.0: width in pixels, <0.0: align xx pixels to the right of window).\n    float                   TextWrapPos;            // Current text wrap pos.\n    ImVector<float>         ItemWidthStack;         // Store item widths to restore (attention: .back() is not == ItemWidth)\n    ImVector<float>         TextWrapPosStack;       // Store text wrap pos to restore (attention: .back() is not == TextWrapPos)\n    ImGuiStackSizes         StackSizesOnBegin;      // Store size of various stacks for asserting\n};\n\n// Storage for one window\nstruct IMGUI_API ImGuiWindow\n{\n    char*                   Name;                               // Window name, owned by the window.\n    ImGuiID                 ID;                                 // == ImHashStr(Name)\n    ImGuiWindowFlags        Flags;                              // See enum ImGuiWindowFlags_\n    ImVec2                  Pos;                                // Position (always rounded-up to nearest pixel)\n    ImVec2                  Size;                               // Current size (==SizeFull or collapsed title bar size)\n    ImVec2                  SizeFull;                           // Size when non collapsed\n    ImVec2                  ContentSize;                        // Size of contents/scrollable client area (calculated from the extents reach of the cursor) from previous frame. Does not include window decoration or window padding.\n    ImVec2                  ContentSizeIdeal;\n    ImVec2                  ContentSizeExplicit;                // Size of contents/scrollable client area explicitly request by the user via SetNextWindowContentSize().\n    ImVec2                  WindowPadding;                      // Window padding at the time of Begin().\n    float                   WindowRounding;                     // Window rounding at the time of Begin(). May be clamped lower to avoid rendering artifacts with title bar, menu bar etc.\n    float                   WindowBorderSize;                   // Window border size at the time of Begin().\n    int                     NameBufLen;                         // Size of buffer storing Name. May be larger than strlen(Name)!\n    ImGuiID                 MoveId;                             // == window->GetID(\"#MOVE\")\n    ImGuiID                 ChildId;                            // ID of corresponding item in parent window (for navigation to return from child window to parent window)\n    ImVec2                  Scroll;\n    ImVec2                  ScrollMax;\n    ImVec2                  ScrollTarget;                       // target scroll position. stored as cursor position with scrolling canceled out, so the highest point is always 0.0f. (FLT_MAX for no change)\n    ImVec2                  ScrollTargetCenterRatio;            // 0.0f = scroll so that target position is at top, 0.5f = scroll so that target position is centered\n    ImVec2                  ScrollTargetEdgeSnapDist;           // 0.0f = no snapping, >0.0f snapping threshold\n    ImVec2                  ScrollbarSizes;                     // Size taken by each scrollbars on their smaller axis. Pay attention! ScrollbarSizes.x == width of the vertical scrollbar, ScrollbarSizes.y = height of the horizontal scrollbar.\n    bool                    ScrollbarX, ScrollbarY;             // Are scrollbars visible?\n    bool                    Active;                             // Set to true on Begin(), unless Collapsed\n    bool                    WasActive;\n    bool                    WriteAccessed;                      // Set to true when any widget access the current window\n    bool                    Collapsed;                          // Set when collapsing window to become only title-bar\n    bool                    WantCollapseToggle;\n    bool                    SkipItems;                          // Set when items can safely be all clipped (e.g. window not visible or collapsed)\n    bool                    Appearing;                          // Set during the frame where the window is appearing (or re-appearing)\n    bool                    Hidden;                             // Do not display (== HiddenFrames*** > 0)\n    bool                    IsFallbackWindow;                   // Set on the \"Debug##Default\" window.\n    bool                    HasCloseButton;                     // Set when the window has a close button (p_open != NULL)\n    signed char             ResizeBorderHeld;                   // Current border being held for resize (-1: none, otherwise 0-3)\n    short                   BeginCount;                         // Number of Begin() during the current frame (generally 0 or 1, 1+ if appending via multiple Begin/End pairs)\n    short                   BeginOrderWithinParent;             // Begin() order within immediate parent window, if we are a child window. Otherwise 0.\n    short                   BeginOrderWithinContext;            // Begin() order within entire imgui context. This is mostly used for debugging submission order related issues.\n    short                   FocusOrder;                         // Order within WindowsFocusOrder[], altered when windows are focused.\n    ImGuiID                 PopupId;                            // ID in the popup stack when this window is used as a popup/menu (because we use generic Name/ID for recycling)\n    ImS8                    AutoFitFramesX, AutoFitFramesY;\n    ImS8                    AutoFitChildAxises;\n    bool                    AutoFitOnlyGrows;\n    ImGuiDir                AutoPosLastDirection;\n    ImS8                    HiddenFramesCanSkipItems;           // Hide the window for N frames\n    ImS8                    HiddenFramesCannotSkipItems;        // Hide the window for N frames while allowing items to be submitted so we can measure their size\n    ImS8                    HiddenFramesForRenderOnly;          // Hide the window until frame N at Render() time only\n    ImS8                    DisableInputsFrames;                // Disable window interactions for N frames\n    ImGuiCond               SetWindowPosAllowFlags : 8;         // store acceptable condition flags for SetNextWindowPos() use.\n    ImGuiCond               SetWindowSizeAllowFlags : 8;        // store acceptable condition flags for SetNextWindowSize() use.\n    ImGuiCond               SetWindowCollapsedAllowFlags : 8;   // store acceptable condition flags for SetNextWindowCollapsed() use.\n    ImVec2                  SetWindowPosVal;                    // store window position when using a non-zero Pivot (position set needs to be processed when we know the window size)\n    ImVec2                  SetWindowPosPivot;                  // store window pivot for positioning. ImVec2(0, 0) when positioning from top-left corner; ImVec2(0.5f, 0.5f) for centering; ImVec2(1, 1) for bottom right.\n\n    ImVector<ImGuiID>       IDStack;                            // ID stack. ID are hashes seeded with the value at the top of the stack. (In theory this should be in the TempData structure)\n    ImGuiWindowTempData     DC;                                 // Temporary per-window data, reset at the beginning of the frame. This used to be called ImGuiDrawContext, hence the \"DC\" variable name.\n\n    // The best way to understand what those rectangles are is to use the 'Metrics->Tools->Show Windows Rectangles' viewer.\n    // The main 'OuterRect', omitted as a field, is window->Rect().\n    ImRect                  OuterRectClipped;                   // == Window->Rect() just after setup in Begin(). == window->Rect() for root window.\n    ImRect                  InnerRect;                          // Inner rectangle (omit title bar, menu bar, scroll bar)\n    ImRect                  InnerClipRect;                      // == InnerRect shrunk by WindowPadding*0.5f on each side, clipped within viewport or parent clip rect.\n    ImRect                  WorkRect;                           // Initially covers the whole scrolling region. Reduced by containers e.g columns/tables when active. Shrunk by WindowPadding*1.0f on each side. This is meant to replace ContentRegionRect over time (from 1.71+ onward).\n    ImRect                  ParentWorkRect;                     // Backup of WorkRect before entering a container such as columns/tables. Used by e.g. SpanAllColumns functions to easily access. Stacked containers are responsible for maintaining this. // FIXME-WORKRECT: Could be a stack?\n    ImRect                  ClipRect;                           // Current clipping/scissoring rectangle, evolve as we are using PushClipRect(), etc. == DrawList->clip_rect_stack.back().\n    ImRect                  ContentRegionRect;                  // FIXME: This is currently confusing/misleading. It is essentially WorkRect but not handling of scrolling. We currently rely on it as right/bottom aligned sizing operation need some size to rely on.\n    ImVec2ih                HitTestHoleSize;                    // Define an optional rectangular hole where mouse will pass-through the window.\n    ImVec2ih                HitTestHoleOffset;\n\n    int                     LastFrameActive;                    // Last frame number the window was Active.\n    float                   LastTimeActive;                     // Last timestamp the window was Active (using float as we don't need high precision there)\n    float                   ItemWidthDefault;\n    ImGuiStorage            StateStorage;\n    ImVector<ImGuiOldColumns> ColumnsStorage;\n    float                   FontWindowScale;                    // User scale multiplier per-window, via SetWindowFontScale()\n    int                     SettingsOffset;                     // Offset into SettingsWindows[] (offsets are always valid as we only grow the array from the back)\n\n    ImDrawList*             DrawList;                           // == &DrawListInst (for backward compatibility reason with code using imgui_internal.h we keep this a pointer)\n    ImDrawList              DrawListInst;\n    ImGuiWindow*            ParentWindow;                       // If we are a child _or_ popup window, this is pointing to our parent. Otherwise NULL.\n    ImGuiWindow*            RootWindow;                         // Point to ourself or first ancestor that is not a child window == Top-level window.\n    ImGuiWindow*            RootWindowForTitleBarHighlight;     // Point to ourself or first ancestor which will display TitleBgActive color when this window is active.\n    ImGuiWindow*            RootWindowForNav;                   // Point to ourself or first ancestor which doesn't have the NavFlattened flag.\n\n    ImGuiWindow*            NavLastChildNavWindow;              // When going to the menu bar, we remember the child window we came from. (This could probably be made implicit if we kept g.Windows sorted by last focused including child window.)\n    ImGuiID                 NavLastIds[ImGuiNavLayer_COUNT];    // Last known NavId for this window, per layer (0/1)\n    ImRect                  NavRectRel[ImGuiNavLayer_COUNT];    // Reference rectangle, in window relative space\n\n    int                     MemoryDrawListIdxCapacity;          // Backup of last idx/vtx count, so when waking up the window we can preallocate and avoid iterative alloc/copy\n    int                     MemoryDrawListVtxCapacity;\n    bool                    MemoryCompacted;                    // Set when window extraneous data have been garbage collected\n\npublic:\n    ImGuiWindow(ImGuiContext* context, const char* name);\n    ~ImGuiWindow();\n\n    ImGuiID     GetID(const char* str, const char* str_end = NULL);\n    ImGuiID     GetID(const void* ptr);\n    ImGuiID     GetID(int n);\n    ImGuiID     GetIDNoKeepAlive(const char* str, const char* str_end = NULL);\n    ImGuiID     GetIDNoKeepAlive(const void* ptr);\n    ImGuiID     GetIDNoKeepAlive(int n);\n    ImGuiID     GetIDFromRectangle(const ImRect& r_abs);\n\n    // We don't use g.FontSize because the window may be != g.CurrentWidow.\n    ImRect      Rect() const            { return ImRect(Pos.x, Pos.y, Pos.x + Size.x, Pos.y + Size.y); }\n    float       CalcFontSize() const    { ImGuiContext& g = *GImGui; float scale = g.FontBaseSize * FontWindowScale; if (ParentWindow) scale *= ParentWindow->FontWindowScale; return scale; }\n    float       TitleBarHeight() const  { ImGuiContext& g = *GImGui; return (Flags & ImGuiWindowFlags_NoTitleBar) ? 0.0f : CalcFontSize() + g.Style.FramePadding.y * 2.0f; }\n    ImRect      TitleBarRect() const    { return ImRect(Pos, ImVec2(Pos.x + SizeFull.x, Pos.y + TitleBarHeight())); }\n    float       MenuBarHeight() const   { ImGuiContext& g = *GImGui; return (Flags & ImGuiWindowFlags_MenuBar) ? DC.MenuBarOffset.y + CalcFontSize() + g.Style.FramePadding.y * 2.0f : 0.0f; }\n    ImRect      MenuBarRect() const     { float y1 = Pos.y + TitleBarHeight(); return ImRect(Pos.x, y1, Pos.x + SizeFull.x, y1 + MenuBarHeight()); }\n};\n\n//-----------------------------------------------------------------------------\n// [SECTION] Tab bar, Tab item support\n//-----------------------------------------------------------------------------\n\n// Extend ImGuiTabBarFlags_\nenum ImGuiTabBarFlagsPrivate_\n{\n    ImGuiTabBarFlags_DockNode                   = 1 << 20,  // Part of a dock node [we don't use this in the master branch but it facilitate branch syncing to keep this around]\n    ImGuiTabBarFlags_IsFocused                  = 1 << 21,\n    ImGuiTabBarFlags_SaveSettings               = 1 << 22   // FIXME: Settings are handled by the docking system, this only request the tab bar to mark settings dirty when reordering tabs\n};\n\n// Extend ImGuiTabItemFlags_\nenum ImGuiTabItemFlagsPrivate_\n{\n    ImGuiTabItemFlags_SectionMask_              = ImGuiTabItemFlags_Leading | ImGuiTabItemFlags_Trailing,\n    ImGuiTabItemFlags_NoCloseButton             = 1 << 20,  // Track whether p_open was set or not (we'll need this info on the next frame to recompute ContentWidth during layout)\n    ImGuiTabItemFlags_Button                    = 1 << 21   // Used by TabItemButton, change the tab item behavior to mimic a button\n};\n\n// Storage for one active tab item (sizeof() 40 bytes)\nstruct ImGuiTabItem\n{\n    ImGuiID             ID;\n    ImGuiTabItemFlags   Flags;\n    int                 LastFrameVisible;\n    int                 LastFrameSelected;      // This allows us to infer an ordered list of the last activated tabs with little maintenance\n    float               Offset;                 // Position relative to beginning of tab\n    float               Width;                  // Width currently displayed\n    float               ContentWidth;           // Width of label, stored during BeginTabItem() call\n    ImS32               NameOffset;             // When Window==NULL, offset to name within parent ImGuiTabBar::TabsNames\n    ImS16               BeginOrder;             // BeginTabItem() order, used to re-order tabs after toggling ImGuiTabBarFlags_Reorderable\n    ImS16               IndexDuringLayout;      // Index only used during TabBarLayout()\n    bool                WantClose;              // Marked as closed by SetTabItemClosed()\n\n    ImGuiTabItem()      { memset(this, 0, sizeof(*this)); LastFrameVisible = LastFrameSelected = -1; NameOffset = -1; BeginOrder = IndexDuringLayout = -1; }\n};\n\n// Storage for a tab bar (sizeof() 152 bytes)\nstruct ImGuiTabBar\n{\n    ImVector<ImGuiTabItem> Tabs;\n    ImGuiTabBarFlags    Flags;\n    ImGuiID             ID;                     // Zero for tab-bars used by docking\n    ImGuiID             SelectedTabId;          // Selected tab/window\n    ImGuiID             NextSelectedTabId;      // Next selected tab/window. Will also trigger a scrolling animation\n    ImGuiID             VisibleTabId;           // Can occasionally be != SelectedTabId (e.g. when previewing contents for CTRL+TAB preview)\n    int                 CurrFrameVisible;\n    int                 PrevFrameVisible;\n    ImRect              BarRect;\n    float               CurrTabsContentsHeight;\n    float               PrevTabsContentsHeight; // Record the height of contents submitted below the tab bar\n    float               WidthAllTabs;           // Actual width of all tabs (locked during layout)\n    float               WidthAllTabsIdeal;      // Ideal width if all tabs were visible and not clipped\n    float               ScrollingAnim;\n    float               ScrollingTarget;\n    float               ScrollingTargetDistToVisibility;\n    float               ScrollingSpeed;\n    float               ScrollingRectMinX;\n    float               ScrollingRectMaxX;\n    ImGuiID             ReorderRequestTabId;\n    ImS16               ReorderRequestOffset;\n    ImS8                BeginCount;\n    bool                WantLayout;\n    bool                VisibleTabWasSubmitted;\n    bool                TabsAddedNew;           // Set to true when a new tab item or button has been added to the tab bar during last frame\n    ImS16               TabsActiveCount;        // Number of tabs submitted this frame.\n    ImS16               LastTabItemIdx;         // Index of last BeginTabItem() tab for use by EndTabItem()\n    float               ItemSpacingY;\n    ImVec2              FramePadding;           // style.FramePadding locked at the time of BeginTabBar()\n    ImVec2              BackupCursorPos;\n    ImGuiTextBuffer     TabsNames;              // For non-docking tab bar we re-append names in a contiguous buffer.\n\n    ImGuiTabBar();\n    int                 GetTabOrder(const ImGuiTabItem* tab) const  { return Tabs.index_from_ptr(tab); }\n    const char*         GetTabName(const ImGuiTabItem* tab) const\n    {\n        IM_ASSERT(tab->NameOffset != -1 && tab->NameOffset < TabsNames.Buf.Size);\n        return TabsNames.Buf.Data + tab->NameOffset;\n    }\n};\n\n//-----------------------------------------------------------------------------\n// [SECTION] Table support\n//-----------------------------------------------------------------------------\n\n#define IM_COL32_DISABLE                IM_COL32(0,0,0,1)   // Special sentinel code which cannot be used as a regular color.\n#define IMGUI_TABLE_MAX_COLUMNS         64                  // sizeof(ImU64) * 8. This is solely because we frequently encode columns set in a ImU64.\n#define IMGUI_TABLE_MAX_DRAW_CHANNELS   (4 + 64 * 2)        // See TableSetupDrawChannels()\n\n// Our current column maximum is 64 but we may raise that in the future.\ntypedef ImS8 ImGuiTableColumnIdx;\ntypedef ImU8 ImGuiTableDrawChannelIdx;\n\n// [Internal] sizeof() ~ 104\n// We use the terminology \"Enabled\" to refer to a column that is not Hidden by user/api.\n// We use the terminology \"Clipped\" to refer to a column that is out of sight because of scrolling/clipping.\n// This is in contrast with some user-facing api such as IsItemVisible() / IsRectVisible() which use \"Visible\" to mean \"not clipped\".\nstruct ImGuiTableColumn\n{\n    ImGuiTableColumnFlags   Flags;                          // Flags after some patching (not directly same as provided by user). See ImGuiTableColumnFlags_\n    float                   WidthGiven;                     // Final/actual width visible == (MaxX - MinX), locked in TableUpdateLayout(). May be > WidthRequest to honor minimum width, may be < WidthRequest to honor shrinking columns down in tight space.\n    float                   MinX;                           // Absolute positions\n    float                   MaxX;\n    float                   WidthRequest;                   // Master width absolute value when !(Flags & _WidthStretch). When Stretch this is derived every frame from StretchWeight in TableUpdateLayout()\n    float                   WidthAuto;                      // Automatic width\n    float                   StretchWeight;                  // Master width weight when (Flags & _WidthStretch). Often around ~1.0f initially.\n    float                   InitStretchWeightOrWidth;       // Value passed to TableSetupColumn(). For Width it is a content width (_without padding_).\n    ImRect                  ClipRect;                       // Clipping rectangle for the column\n    ImGuiID                 UserID;                         // Optional, value passed to TableSetupColumn()\n    float                   WorkMinX;                       // Contents region min ~(MinX + CellPaddingX + CellSpacingX1) == cursor start position when entering column\n    float                   WorkMaxX;                       // Contents region max ~(MaxX - CellPaddingX - CellSpacingX2)\n    float                   ItemWidth;                      // Current item width for the column, preserved across rows\n    float                   ContentMaxXFrozen;              // Contents maximum position for frozen rows (apart from headers), from which we can infer content width.\n    float                   ContentMaxXUnfrozen;\n    float                   ContentMaxXHeadersUsed;         // Contents maximum position for headers rows (regardless of freezing). TableHeader() automatically softclip itself + report ideal desired size, to avoid creating extraneous draw calls\n    float                   ContentMaxXHeadersIdeal;\n    ImS16                   NameOffset;                     // Offset into parent ColumnsNames[]\n    ImGuiTableColumnIdx     DisplayOrder;                   // Index within Table's IndexToDisplayOrder[] (column may be reordered by users)\n    ImGuiTableColumnIdx     IndexWithinEnabledSet;          // Index within enabled/visible set (<= IndexToDisplayOrder)\n    ImGuiTableColumnIdx     PrevEnabledColumn;              // Index of prev enabled/visible column within Columns[], -1 if first enabled/visible column\n    ImGuiTableColumnIdx     NextEnabledColumn;              // Index of next enabled/visible column within Columns[], -1 if last enabled/visible column\n    ImGuiTableColumnIdx     SortOrder;                      // Index of this column within sort specs, -1 if not sorting on this column, 0 for single-sort, may be >0 on multi-sort\n    ImGuiTableDrawChannelIdx DrawChannelCurrent;            // Index within DrawSplitter.Channels[]\n    ImGuiTableDrawChannelIdx DrawChannelFrozen;             // Draw channels for frozen rows (often headers)\n    ImGuiTableDrawChannelIdx DrawChannelUnfrozen;           // Draw channels for unfrozen rows\n    bool                    IsEnabled;                      // IsUserEnabled && (Flags & ImGuiTableColumnFlags_Disabled) == 0\n    bool                    IsUserEnabled;                  // Is the column not marked Hidden by the user? (unrelated to being off view, e.g. clipped by scrolling).\n    bool                    IsUserEnabledNextFrame;\n    bool                    IsVisibleX;                     // Is actually in view (e.g. overlapping the host window clipping rectangle, not scrolled).\n    bool                    IsVisibleY;\n    bool                    IsRequestOutput;                // Return value for TableSetColumnIndex() / TableNextColumn(): whether we request user to output contents or not.\n    bool                    IsSkipItems;                    // Do we want item submissions to this column to be completely ignored (no layout will happen).\n    bool                    IsPreserveWidthAuto;\n    ImS8                    NavLayerCurrent;                // ImGuiNavLayer in 1 byte\n    ImU8                    AutoFitQueue;                   // Queue of 8 values for the next 8 frames to request auto-fit\n    ImU8                    CannotSkipItemsQueue;           // Queue of 8 values for the next 8 frames to disable Clipped/SkipItem\n    ImU8                    SortDirection : 2;              // ImGuiSortDirection_Ascending or ImGuiSortDirection_Descending\n    ImU8                    SortDirectionsAvailCount : 2;   // Number of available sort directions (0 to 3)\n    ImU8                    SortDirectionsAvailMask : 4;    // Mask of available sort directions (1-bit each)\n    ImU8                    SortDirectionsAvailList;        // Ordered of available sort directions (2-bits each)\n\n    ImGuiTableColumn()\n    {\n        memset(this, 0, sizeof(*this));\n        StretchWeight = WidthRequest = -1.0f;\n        NameOffset = -1;\n        DisplayOrder = IndexWithinEnabledSet = -1;\n        PrevEnabledColumn = NextEnabledColumn = -1;\n        SortOrder = -1;\n        SortDirection = ImGuiSortDirection_None;\n        DrawChannelCurrent = DrawChannelFrozen = DrawChannelUnfrozen = (ImU8)-1;\n    }\n};\n\n// Transient cell data stored per row.\n// sizeof() ~ 6\nstruct ImGuiTableCellData\n{\n    ImU32                       BgColor;    // Actual color\n    ImGuiTableColumnIdx         Column;     // Column number\n};\n\n// FIXME-TABLE: more transient data could be stored in a per-stacked table structure: DrawSplitter, SortSpecs, incoming RowData\nstruct ImGuiTable\n{\n    ImGuiID                     ID;\n    ImGuiTableFlags             Flags;\n    void*                       RawData;                    // Single allocation to hold Columns[], DisplayOrderToIndex[] and RowCellData[]\n    ImGuiTableTempData*         TempData;                   // Transient data while table is active. Point within g.CurrentTableStack[]\n    ImSpan<ImGuiTableColumn>    Columns;                    // Point within RawData[]\n    ImSpan<ImGuiTableColumnIdx> DisplayOrderToIndex;        // Point within RawData[]. Store display order of columns (when not reordered, the values are 0...Count-1)\n    ImSpan<ImGuiTableCellData>  RowCellData;                // Point within RawData[]. Store cells background requests for current row.\n    ImU64                       EnabledMaskByDisplayOrder;  // Column DisplayOrder -> IsEnabled map\n    ImU64                       EnabledMaskByIndex;         // Column Index -> IsEnabled map (== not hidden by user/api) in a format adequate for iterating column without touching cold data\n    ImU64                       VisibleMaskByIndex;         // Column Index -> IsVisibleX|IsVisibleY map (== not hidden by user/api && not hidden by scrolling/cliprect)\n    ImU64                       RequestOutputMaskByIndex;   // Column Index -> IsVisible || AutoFit (== expect user to submit items)\n    ImGuiTableFlags             SettingsLoadedFlags;        // Which data were loaded from the .ini file (e.g. when order is not altered we won't save order)\n    int                         SettingsOffset;             // Offset in g.SettingsTables\n    int                         LastFrameActive;\n    int                         ColumnsCount;               // Number of columns declared in BeginTable()\n    int                         CurrentRow;\n    int                         CurrentColumn;\n    ImS16                       InstanceCurrent;            // Count of BeginTable() calls with same ID in the same frame (generally 0). This is a little bit similar to BeginCount for a window, but multiple table with same ID look are multiple tables, they are just synched.\n    ImS16                       InstanceInteracted;         // Mark which instance (generally 0) of the same ID is being interacted with\n    float                       RowPosY1;\n    float                       RowPosY2;\n    float                       RowMinHeight;               // Height submitted to TableNextRow()\n    float                       RowTextBaseline;\n    float                       RowIndentOffsetX;\n    ImGuiTableRowFlags          RowFlags : 16;              // Current row flags, see ImGuiTableRowFlags_\n    ImGuiTableRowFlags          LastRowFlags : 16;\n    int                         RowBgColorCounter;          // Counter for alternating background colors (can be fast-forwarded by e.g clipper), not same as CurrentRow because header rows typically don't increase this.\n    ImU32                       RowBgColor[2];              // Background color override for current row.\n    ImU32                       BorderColorStrong;\n    ImU32                       BorderColorLight;\n    float                       BorderX1;\n    float                       BorderX2;\n    float                       HostIndentX;\n    float                       MinColumnWidth;\n    float                       OuterPaddingX;\n    float                       CellPaddingX;               // Padding from each borders\n    float                       CellPaddingY;\n    float                       CellSpacingX1;              // Spacing between non-bordered cells\n    float                       CellSpacingX2;\n    float                       LastOuterHeight;            // Outer height from last frame\n    float                       LastFirstRowHeight;         // Height of first row from last frame\n    float                       InnerWidth;                 // User value passed to BeginTable(), see comments at the top of BeginTable() for details.\n    float                       ColumnsGivenWidth;          // Sum of current column width\n    float                       ColumnsAutoFitWidth;        // Sum of ideal column width in order nothing to be clipped, used for auto-fitting and content width submission in outer window\n    float                       ResizedColumnNextWidth;\n    float                       ResizeLockMinContentsX2;    // Lock minimum contents width while resizing down in order to not create feedback loops. But we allow growing the table.\n    float                       RefScale;                   // Reference scale to be able to rescale columns on font/dpi changes.\n    ImRect                      OuterRect;                  // Note: for non-scrolling table, OuterRect.Max.y is often FLT_MAX until EndTable(), unless a height has been specified in BeginTable().\n    ImRect                      InnerRect;                  // InnerRect but without decoration. As with OuterRect, for non-scrolling tables, InnerRect.Max.y is\n    ImRect                      WorkRect;\n    ImRect                      InnerClipRect;\n    ImRect                      BgClipRect;                 // We use this to cpu-clip cell background color fill\n    ImRect                      Bg0ClipRectForDrawCmd;      // Actual ImDrawCmd clip rect for BG0/1 channel. This tends to be == OuterWindow->ClipRect at BeginTable() because output in BG0/BG1 is cpu-clipped\n    ImRect                      Bg2ClipRectForDrawCmd;      // Actual ImDrawCmd clip rect for BG2 channel. This tends to be a correct, tight-fit, because output to BG2 are done by widgets relying on regular ClipRect.\n    ImRect                      HostClipRect;               // This is used to check if we can eventually merge our columns draw calls into the current draw call of the current window.\n    ImRect                      HostBackupInnerClipRect;    // Backup of InnerWindow->ClipRect during PushTableBackground()/PopTableBackground()\n    ImGuiWindow*                OuterWindow;                // Parent window for the table\n    ImGuiWindow*                InnerWindow;                // Window holding the table data (== OuterWindow or a child window)\n    ImGuiTextBuffer             ColumnsNames;               // Contiguous buffer holding columns names\n    ImDrawListSplitter*         DrawSplitter;               // Shortcut to TempData->DrawSplitter while in table. Isolate draw commands per columns to avoid switching clip rect constantly\n    ImGuiTableColumnSortSpecs   SortSpecsSingle;\n    ImVector<ImGuiTableColumnSortSpecs> SortSpecsMulti;     // FIXME-OPT: Using a small-vector pattern would be good.\n    ImGuiTableSortSpecs         SortSpecs;                  // Public facing sorts specs, this is what we return in TableGetSortSpecs()\n    ImGuiTableColumnIdx         SortSpecsCount;\n    ImGuiTableColumnIdx         ColumnsEnabledCount;        // Number of enabled columns (<= ColumnsCount)\n    ImGuiTableColumnIdx         ColumnsEnabledFixedCount;   // Number of enabled columns (<= ColumnsCount)\n    ImGuiTableColumnIdx         DeclColumnsCount;           // Count calls to TableSetupColumn()\n    ImGuiTableColumnIdx         HoveredColumnBody;          // Index of column whose visible region is being hovered. Important: == ColumnsCount when hovering empty region after the right-most column!\n    ImGuiTableColumnIdx         HoveredColumnBorder;        // Index of column whose right-border is being hovered (for resizing).\n    ImGuiTableColumnIdx         AutoFitSingleColumn;        // Index of single column requesting auto-fit.\n    ImGuiTableColumnIdx         ResizedColumn;              // Index of column being resized. Reset when InstanceCurrent==0.\n    ImGuiTableColumnIdx         LastResizedColumn;          // Index of column being resized from previous frame.\n    ImGuiTableColumnIdx         HeldHeaderColumn;           // Index of column header being held.\n    ImGuiTableColumnIdx         ReorderColumn;              // Index of column being reordered. (not cleared)\n    ImGuiTableColumnIdx         ReorderColumnDir;           // -1 or +1\n    ImGuiTableColumnIdx         LeftMostEnabledColumn;      // Index of left-most non-hidden column.\n    ImGuiTableColumnIdx         RightMostEnabledColumn;     // Index of right-most non-hidden column.\n    ImGuiTableColumnIdx         LeftMostStretchedColumn;    // Index of left-most stretched column.\n    ImGuiTableColumnIdx         RightMostStretchedColumn;   // Index of right-most stretched column.\n    ImGuiTableColumnIdx         ContextPopupColumn;         // Column right-clicked on, of -1 if opening context menu from a neutral/empty spot\n    ImGuiTableColumnIdx         FreezeRowsRequest;          // Requested frozen rows count\n    ImGuiTableColumnIdx         FreezeRowsCount;            // Actual frozen row count (== FreezeRowsRequest, or == 0 when no scrolling offset)\n    ImGuiTableColumnIdx         FreezeColumnsRequest;       // Requested frozen columns count\n    ImGuiTableColumnIdx         FreezeColumnsCount;         // Actual frozen columns count (== FreezeColumnsRequest, or == 0 when no scrolling offset)\n    ImGuiTableColumnIdx         RowCellDataCurrent;         // Index of current RowCellData[] entry in current row\n    ImGuiTableDrawChannelIdx    DummyDrawChannel;           // Redirect non-visible columns here.\n    ImGuiTableDrawChannelIdx    Bg2DrawChannelCurrent;      // For Selectable() and other widgets drawing across columns after the freezing line. Index within DrawSplitter.Channels[]\n    ImGuiTableDrawChannelIdx    Bg2DrawChannelUnfrozen;\n    bool                        IsLayoutLocked;             // Set by TableUpdateLayout() which is called when beginning the first row.\n    bool                        IsInsideRow;                // Set when inside TableBeginRow()/TableEndRow().\n    bool                        IsInitializing;\n    bool                        IsSortSpecsDirty;\n    bool                        IsUsingHeaders;             // Set when the first row had the ImGuiTableRowFlags_Headers flag.\n    bool                        IsContextPopupOpen;         // Set when default context menu is open (also see: ContextPopupColumn, InstanceInteracted).\n    bool                        IsSettingsRequestLoad;\n    bool                        IsSettingsDirty;            // Set when table settings have changed and needs to be reported into ImGuiTableSetttings data.\n    bool                        IsDefaultDisplayOrder;      // Set when display order is unchanged from default (DisplayOrder contains 0...Count-1)\n    bool                        IsResetAllRequest;\n    bool                        IsResetDisplayOrderRequest;\n    bool                        IsUnfrozenRows;             // Set when we got past the frozen row.\n    bool                        IsDefaultSizingPolicy;      // Set if user didn't explicitly set a sizing policy in BeginTable()\n    bool                        MemoryCompacted;\n    bool                        HostSkipItems;              // Backup of InnerWindow->SkipItem at the end of BeginTable(), because we will overwrite InnerWindow->SkipItem on a per-column basis\n\n    IMGUI_API ImGuiTable()      { memset(this, 0, sizeof(*this)); LastFrameActive = -1; }\n    IMGUI_API ~ImGuiTable()     { IM_FREE(RawData); }\n};\n\n// Transient data that are only needed between BeginTable() and EndTable(), those buffers are shared (1 per level of stacked table).\n// - Accessing those requires chasing an extra pointer so for very frequently used data we leave them in the main table structure.\n// - We also leave out of this structure data that tend to be particularly useful for debugging/metrics.\nstruct ImGuiTableTempData\n{\n    int                         TableIndex;                 // Index in g.Tables.Buf[] pool\n    float                       LastTimeActive;             // Last timestamp this structure was used\n\n    ImVec2                      UserOuterSize;              // outer_size.x passed to BeginTable()\n    ImDrawListSplitter          DrawSplitter;\n\n    ImRect                      HostBackupWorkRect;         // Backup of InnerWindow->WorkRect at the end of BeginTable()\n    ImRect                      HostBackupParentWorkRect;   // Backup of InnerWindow->ParentWorkRect at the end of BeginTable()\n    ImVec2                      HostBackupPrevLineSize;     // Backup of InnerWindow->DC.PrevLineSize at the end of BeginTable()\n    ImVec2                      HostBackupCurrLineSize;     // Backup of InnerWindow->DC.CurrLineSize at the end of BeginTable()\n    ImVec2                      HostBackupCursorMaxPos;     // Backup of InnerWindow->DC.CursorMaxPos at the end of BeginTable()\n    ImVec1                      HostBackupColumnsOffset;    // Backup of OuterWindow->DC.ColumnsOffset at the end of BeginTable()\n    float                       HostBackupItemWidth;        // Backup of OuterWindow->DC.ItemWidth at the end of BeginTable()\n    int                         HostBackupItemWidthStackSize;//Backup of OuterWindow->DC.ItemWidthStack.Size at the end of BeginTable()\n\n    IMGUI_API ImGuiTableTempData() { memset(this, 0, sizeof(*this)); LastTimeActive = -1.0f; }\n};\n\n// sizeof() ~ 12\nstruct ImGuiTableColumnSettings\n{\n    float                   WidthOrWeight;\n    ImGuiID                 UserID;\n    ImGuiTableColumnIdx     Index;\n    ImGuiTableColumnIdx     DisplayOrder;\n    ImGuiTableColumnIdx     SortOrder;\n    ImU8                    SortDirection : 2;\n    ImU8                    IsEnabled : 1; // \"Visible\" in ini file\n    ImU8                    IsStretch : 1;\n\n    ImGuiTableColumnSettings()\n    {\n        WidthOrWeight = 0.0f;\n        UserID = 0;\n        Index = -1;\n        DisplayOrder = SortOrder = -1;\n        SortDirection = ImGuiSortDirection_None;\n        IsEnabled = 1;\n        IsStretch = 0;\n    }\n};\n\n// This is designed to be stored in a single ImChunkStream (1 header followed by N ImGuiTableColumnSettings, etc.)\nstruct ImGuiTableSettings\n{\n    ImGuiID                     ID;                     // Set to 0 to invalidate/delete the setting\n    ImGuiTableFlags             SaveFlags;              // Indicate data we want to save using the Resizable/Reorderable/Sortable/Hideable flags (could be using its own flags..)\n    float                       RefScale;               // Reference scale to be able to rescale columns on font/dpi changes.\n    ImGuiTableColumnIdx         ColumnsCount;\n    ImGuiTableColumnIdx         ColumnsCountMax;        // Maximum number of columns this settings instance can store, we can recycle a settings instance with lower number of columns but not higher\n    bool                        WantApply;              // Set when loaded from .ini data (to enable merging/loading .ini data into an already running context)\n\n    ImGuiTableSettings()        { memset(this, 0, sizeof(*this)); }\n    ImGuiTableColumnSettings*   GetColumnSettings()     { return (ImGuiTableColumnSettings*)(this + 1); }\n};\n\n//-----------------------------------------------------------------------------\n// [SECTION] ImGui internal API\n// No guarantee of forward compatibility here!\n//-----------------------------------------------------------------------------\n\nnamespace ImGui\n{\n    // Windows\n    // We should always have a CurrentWindow in the stack (there is an implicit \"Debug\" window)\n    // If this ever crash because g.CurrentWindow is NULL it means that either\n    // - ImGui::NewFrame() has never been called, which is illegal.\n    // - You are calling ImGui functions after ImGui::EndFrame()/ImGui::Render() and before the next ImGui::NewFrame(), which is also illegal.\n    inline    ImGuiWindow*  GetCurrentWindowRead()      { ImGuiContext& g = *GImGui; return g.CurrentWindow; }\n    inline    ImGuiWindow*  GetCurrentWindow()          { ImGuiContext& g = *GImGui; g.CurrentWindow->WriteAccessed = true; return g.CurrentWindow; }\n    IMGUI_API ImGuiWindow*  FindWindowByID(ImGuiID id);\n    IMGUI_API ImGuiWindow*  FindWindowByName(const char* name);\n    IMGUI_API void          UpdateWindowParentAndRootLinks(ImGuiWindow* window, ImGuiWindowFlags flags, ImGuiWindow* parent_window);\n    IMGUI_API ImVec2        CalcWindowNextAutoFitSize(ImGuiWindow* window);\n    IMGUI_API bool          IsWindowChildOf(ImGuiWindow* window, ImGuiWindow* potential_parent);\n    IMGUI_API bool          IsWindowAbove(ImGuiWindow* potential_above, ImGuiWindow* potential_below);\n    IMGUI_API bool          IsWindowNavFocusable(ImGuiWindow* window);\n    IMGUI_API void          SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiCond cond = 0);\n    IMGUI_API void          SetWindowSize(ImGuiWindow* window, const ImVec2& size, ImGuiCond cond = 0);\n    IMGUI_API void          SetWindowCollapsed(ImGuiWindow* window, bool collapsed, ImGuiCond cond = 0);\n    IMGUI_API void          SetWindowHitTestHole(ImGuiWindow* window, const ImVec2& pos, const ImVec2& size);\n\n    // Windows: Display Order and Focus Order\n    IMGUI_API void          FocusWindow(ImGuiWindow* window);\n    IMGUI_API void          FocusTopMostWindowUnderOne(ImGuiWindow* under_this_window, ImGuiWindow* ignore_window);\n    IMGUI_API void          BringWindowToFocusFront(ImGuiWindow* window);\n    IMGUI_API void          BringWindowToDisplayFront(ImGuiWindow* window);\n    IMGUI_API void          BringWindowToDisplayBack(ImGuiWindow* window);\n\n    // Fonts, drawing\n    IMGUI_API void          SetCurrentFont(ImFont* font);\n    inline ImFont*          GetDefaultFont() { ImGuiContext& g = *GImGui; return g.IO.FontDefault ? g.IO.FontDefault : g.IO.Fonts->Fonts[0]; }\n    inline ImDrawList*      GetForegroundDrawList(ImGuiWindow* window) { IM_UNUSED(window); return GetForegroundDrawList(); } // This seemingly unnecessary wrapper simplifies compatibility between the 'master' and 'docking' branches.\n    IMGUI_API ImDrawList*   GetBackgroundDrawList(ImGuiViewport* viewport);                     // get background draw list for the given viewport. this draw list will be the first rendering one. Useful to quickly draw shapes/text behind dear imgui contents.\n    IMGUI_API ImDrawList*   GetForegroundDrawList(ImGuiViewport* viewport);                     // get foreground draw list for the given viewport. this draw list will be the last rendered one. Useful to quickly draw shapes/text over dear imgui contents.\n\n    // Init\n    IMGUI_API void          Initialize(ImGuiContext* context);\n    IMGUI_API void          Shutdown(ImGuiContext* context);    // Since 1.60 this is a _private_ function. You can call DestroyContext() to destroy the context created by CreateContext().\n\n    // NewFrame\n    IMGUI_API void          UpdateHoveredWindowAndCaptureFlags();\n    IMGUI_API void          StartMouseMovingWindow(ImGuiWindow* window);\n    IMGUI_API void          UpdateMouseMovingWindowNewFrame();\n    IMGUI_API void          UpdateMouseMovingWindowEndFrame();\n\n    // Generic context hooks\n    IMGUI_API ImGuiID       AddContextHook(ImGuiContext* context, const ImGuiContextHook* hook);\n    IMGUI_API void          RemoveContextHook(ImGuiContext* context, ImGuiID hook_to_remove);\n    IMGUI_API void          CallContextHooks(ImGuiContext* context, ImGuiContextHookType type);\n\n    // Settings\n    IMGUI_API void                  MarkIniSettingsDirty();\n    IMGUI_API void                  MarkIniSettingsDirty(ImGuiWindow* window);\n    IMGUI_API void                  ClearIniSettings();\n    IMGUI_API ImGuiWindowSettings*  CreateNewWindowSettings(const char* name);\n    IMGUI_API ImGuiWindowSettings*  FindWindowSettings(ImGuiID id);\n    IMGUI_API ImGuiWindowSettings*  FindOrCreateWindowSettings(const char* name);\n    IMGUI_API ImGuiSettingsHandler* FindSettingsHandler(const char* type_name);\n\n    // Scrolling\n    IMGUI_API void          SetNextWindowScroll(const ImVec2& scroll); // Use -1.0f on one axis to leave as-is\n    IMGUI_API void          SetScrollX(ImGuiWindow* window, float scroll_x);\n    IMGUI_API void          SetScrollY(ImGuiWindow* window, float scroll_y);\n    IMGUI_API void          SetScrollFromPosX(ImGuiWindow* window, float local_x, float center_x_ratio);\n    IMGUI_API void          SetScrollFromPosY(ImGuiWindow* window, float local_y, float center_y_ratio);\n    IMGUI_API ImVec2        ScrollToBringRectIntoView(ImGuiWindow* window, const ImRect& item_rect);\n\n    // Basic Accessors\n    inline ImGuiID          GetItemID()     { ImGuiContext& g = *GImGui; return g.LastItemData.ID; }   // Get ID of last item (~~ often same ImGui::GetID(label) beforehand)\n    inline ImGuiItemStatusFlags GetItemStatusFlags(){ ImGuiContext& g = *GImGui; return g.LastItemData.StatusFlags; }\n    inline ImGuiItemFlags   GetItemFlags()  { ImGuiContext& g = *GImGui; return g.LastItemData.InFlags; }\n    inline ImGuiID          GetActiveID()   { ImGuiContext& g = *GImGui; return g.ActiveId; }\n    inline ImGuiID          GetFocusID()    { ImGuiContext& g = *GImGui; return g.NavId; }\n    IMGUI_API void          SetActiveID(ImGuiID id, ImGuiWindow* window);\n    IMGUI_API void          SetFocusID(ImGuiID id, ImGuiWindow* window);\n    IMGUI_API void          ClearActiveID();\n    IMGUI_API ImGuiID       GetHoveredID();\n    IMGUI_API void          SetHoveredID(ImGuiID id);\n    IMGUI_API void          KeepAliveID(ImGuiID id);\n    IMGUI_API void          MarkItemEdited(ImGuiID id);     // Mark data associated to given item as \"edited\", used by IsItemDeactivatedAfterEdit() function.\n    IMGUI_API void          PushOverrideID(ImGuiID id);     // Push given value as-is at the top of the ID stack (whereas PushID combines old and new hashes)\n    IMGUI_API ImGuiID       GetIDWithSeed(const char* str_id_begin, const char* str_id_end, ImGuiID seed);\n\n    // Basic Helpers for widget code\n    IMGUI_API void          ItemSize(const ImVec2& size, float text_baseline_y = -1.0f);\n    IMGUI_API void          ItemSize(const ImRect& bb, float text_baseline_y = -1.0f);\n    IMGUI_API bool          ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb = NULL, ImGuiItemAddFlags flags = 0);\n    IMGUI_API bool          ItemHoverable(const ImRect& bb, ImGuiID id);\n    IMGUI_API void          ItemFocusable(ImGuiWindow* window, ImGuiID id);\n    IMGUI_API bool          IsClippedEx(const ImRect& bb, ImGuiID id, bool clip_even_when_logged);\n    IMGUI_API ImVec2        CalcItemSize(ImVec2 size, float default_w, float default_h);\n    IMGUI_API float         CalcWrapWidthForPos(const ImVec2& pos, float wrap_pos_x);\n    IMGUI_API void          PushMultiItemsWidths(int components, float width_full);\n    IMGUI_API bool          IsItemToggledSelection();                                   // Was the last item selection toggled? (after Selectable(), TreeNode() etc. We only returns toggle _event_ in order to handle clipping correctly)\n    IMGUI_API ImVec2        GetContentRegionMaxAbs();\n    IMGUI_API void          ShrinkWidths(ImGuiShrinkWidthItem* items, int count, float width_excess);\n\n    // Parameter stacks\n    IMGUI_API void          PushItemFlag(ImGuiItemFlags option, bool enabled);\n    IMGUI_API void          PopItemFlag();\n\n#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS\n    // If you have old/custom copy-and-pasted widgets that used FocusableItemRegister():\n    //  (Old) IMGUI_VERSION_NUM  < 18209: using 'ItemAdd(....)'                              and 'bool focused = FocusableItemRegister(...)'\n    //  (New) IMGUI_VERSION_NUM >= 18209: using 'ItemAdd(..., ImGuiItemAddFlags_Focusable)'  and 'bool focused = (GetItemStatusFlags() & ImGuiItemStatusFlags_Focused) != 0'\n    // Widget code are simplified as there's no need to call FocusableItemUnregister() while managing the transition from regular widget to TempInputText()\n    inline bool FocusableItemRegister(ImGuiWindow* window, ImGuiID id)   { IM_ASSERT(0); IM_UNUSED(window); IM_UNUSED(id); return false; } // -> pass ImGuiItemAddFlags_Focusable flag to ItemAdd()\n    inline IM_NORETURN void FocusableItemUnregister(ImGuiWindow* window) { IM_ASSERT(0); IM_UNUSED(window); }                              // -> unnecessary: TempInputText() uses ImGuiInputTextFlags_MergedItem\n#endif\n\n    // Logging/Capture\n    IMGUI_API void          LogBegin(ImGuiLogType type, int auto_open_depth);           // -> BeginCapture() when we design v2 api, for now stay under the radar by using the old name.\n    IMGUI_API void          LogToBuffer(int auto_open_depth = -1);                      // Start logging/capturing to internal buffer\n    IMGUI_API void          LogRenderedText(const ImVec2* ref_pos, const char* text, const char* text_end = NULL);\n    IMGUI_API void          LogSetNextTextDecoration(const char* prefix, const char* suffix);\n\n    // Popups, Modals, Tooltips\n    IMGUI_API bool          BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, bool border, ImGuiWindowFlags flags);\n    IMGUI_API void          OpenPopupEx(ImGuiID id, ImGuiPopupFlags popup_flags = ImGuiPopupFlags_None);\n    IMGUI_API void          ClosePopupToLevel(int remaining, bool restore_focus_to_window_under_popup);\n    IMGUI_API void          ClosePopupsOverWindow(ImGuiWindow* ref_window, bool restore_focus_to_window_under_popup);\n    IMGUI_API bool          IsPopupOpen(ImGuiID id, ImGuiPopupFlags popup_flags);\n    IMGUI_API bool          BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags);\n    IMGUI_API void          BeginTooltipEx(ImGuiWindowFlags extra_flags, ImGuiTooltipFlags tooltip_flags);\n    IMGUI_API ImRect        GetPopupAllowedExtentRect(ImGuiWindow* window);\n    IMGUI_API ImGuiWindow*  GetTopMostPopupModal();\n    IMGUI_API ImVec2        FindBestWindowPosForPopup(ImGuiWindow* window);\n    IMGUI_API ImVec2        FindBestWindowPosForPopupEx(const ImVec2& ref_pos, const ImVec2& size, ImGuiDir* last_dir, const ImRect& r_outer, const ImRect& r_avoid, ImGuiPopupPositionPolicy policy);\n    IMGUI_API bool          BeginViewportSideBar(const char* name, ImGuiViewport* viewport, ImGuiDir dir, float size, ImGuiWindowFlags window_flags);\n\n    // Menus\n    IMGUI_API bool          MenuItemEx(const char* label, const char* icon, const char* shortcut = NULL, bool selected = false, bool enabled = true);\n\n    // Combos\n    IMGUI_API bool          BeginComboPopup(ImGuiID popup_id, const ImRect& bb, ImGuiComboFlags flags);\n    IMGUI_API bool          BeginComboPreview();\n    IMGUI_API void          EndComboPreview();\n\n    // Gamepad/Keyboard Navigation\n    IMGUI_API void          NavInitWindow(ImGuiWindow* window, bool force_reinit);\n    IMGUI_API bool          NavMoveRequestButNoResultYet();\n    IMGUI_API void          NavMoveRequestCancel();\n    IMGUI_API void          NavMoveRequestForward(ImGuiDir move_dir, ImGuiDir clip_dir, const ImRect& bb_rel, ImGuiNavMoveFlags move_flags);\n    IMGUI_API void          NavMoveRequestTryWrapping(ImGuiWindow* window, ImGuiNavMoveFlags move_flags);\n    IMGUI_API float         GetNavInputAmount(ImGuiNavInput n, ImGuiInputReadMode mode);\n    IMGUI_API ImVec2        GetNavInputAmount2d(ImGuiNavDirSourceFlags dir_sources, ImGuiInputReadMode mode, float slow_factor = 0.0f, float fast_factor = 0.0f);\n    IMGUI_API int           CalcTypematicRepeatAmount(float t0, float t1, float repeat_delay, float repeat_rate);\n    IMGUI_API void          ActivateItem(ImGuiID id);   // Remotely activate a button, checkbox, tree node etc. given its unique ID. activation is queued and processed on the next frame when the item is encountered again.\n    IMGUI_API void          SetNavID(ImGuiID id, ImGuiNavLayer nav_layer, ImGuiID focus_scope_id, const ImRect& rect_rel);\n\n    // Focus Scope (WIP)\n    // This is generally used to identify a selection set (multiple of which may be in the same window), as selection\n    // patterns generally need to react (e.g. clear selection) when landing on an item of the set.\n    IMGUI_API void          PushFocusScope(ImGuiID id);\n    IMGUI_API void          PopFocusScope();\n    inline ImGuiID          GetFocusedFocusScope()          { ImGuiContext& g = *GImGui; return g.NavFocusScopeId; }                            // Focus scope which is actually active\n    inline ImGuiID          GetFocusScope()                 { ImGuiContext& g = *GImGui; return g.CurrentWindow->DC.NavFocusScopeIdCurrent; }   // Focus scope we are outputting into, set by PushFocusScope()\n\n    // Inputs\n    // FIXME: Eventually we should aim to move e.g. IsActiveIdUsingKey() into IsKeyXXX functions.\n    IMGUI_API void          SetItemUsingMouseWheel();\n    IMGUI_API void          SetActiveIdUsingNavAndKeys();\n    inline bool             IsActiveIdUsingNavDir(ImGuiDir dir)                         { ImGuiContext& g = *GImGui; return (g.ActiveIdUsingNavDirMask & (1 << dir)) != 0; }\n    inline bool             IsActiveIdUsingNavInput(ImGuiNavInput input)                { ImGuiContext& g = *GImGui; return (g.ActiveIdUsingNavInputMask & (1 << input)) != 0; }\n    inline bool             IsActiveIdUsingKey(ImGuiKey key)                            { ImGuiContext& g = *GImGui; IM_ASSERT(key < 64); return (g.ActiveIdUsingKeyInputMask & ((ImU64)1 << key)) != 0; }\n    IMGUI_API bool          IsMouseDragPastThreshold(ImGuiMouseButton button, float lock_threshold = -1.0f);\n    inline bool             IsKeyPressedMap(ImGuiKey key, bool repeat = true)           { ImGuiContext& g = *GImGui; const int key_index = g.IO.KeyMap[key]; return (key_index >= 0) ? IsKeyPressed(key_index, repeat) : false; }\n    inline bool             IsNavInputDown(ImGuiNavInput n)                             { ImGuiContext& g = *GImGui; return g.IO.NavInputs[n] > 0.0f; }\n    inline bool             IsNavInputTest(ImGuiNavInput n, ImGuiInputReadMode rm)      { return (GetNavInputAmount(n, rm) > 0.0f); }\n    IMGUI_API ImGuiKeyModFlags GetMergedKeyModFlags();\n\n    // Drag and Drop\n    IMGUI_API bool          BeginDragDropTargetCustom(const ImRect& bb, ImGuiID id);\n    IMGUI_API void          ClearDragDrop();\n    IMGUI_API bool          IsDragDropPayloadBeingAccepted();\n\n    // Internal Columns API (this is not exposed because we will encourage transitioning to the Tables API)\n    IMGUI_API void          SetWindowClipRectBeforeSetChannel(ImGuiWindow* window, const ImRect& clip_rect);\n    IMGUI_API void          BeginColumns(const char* str_id, int count, ImGuiOldColumnFlags flags = 0); // setup number of columns. use an identifier to distinguish multiple column sets. close with EndColumns().\n    IMGUI_API void          EndColumns();                                                               // close columns\n    IMGUI_API void          PushColumnClipRect(int column_index);\n    IMGUI_API void          PushColumnsBackground();\n    IMGUI_API void          PopColumnsBackground();\n    IMGUI_API ImGuiID       GetColumnsID(const char* str_id, int count);\n    IMGUI_API ImGuiOldColumns* FindOrCreateColumns(ImGuiWindow* window, ImGuiID id);\n    IMGUI_API float         GetColumnOffsetFromNorm(const ImGuiOldColumns* columns, float offset_norm);\n    IMGUI_API float         GetColumnNormFromOffset(const ImGuiOldColumns* columns, float offset);\n\n    // Tables: Candidates for public API\n    IMGUI_API void          TableOpenContextMenu(int column_n = -1);\n    IMGUI_API void          TableSetColumnWidth(int column_n, float width);\n    IMGUI_API void          TableSetColumnSortDirection(int column_n, ImGuiSortDirection sort_direction, bool append_to_sort_specs);\n    IMGUI_API int           TableGetHoveredColumn(); // May use (TableGetColumnFlags() & ImGuiTableColumnFlags_IsHovered) instead. Return hovered column. return -1 when table is not hovered. return columns_count if the unused space at the right of visible columns is hovered.\n    IMGUI_API float         TableGetHeaderRowHeight();\n    IMGUI_API void          TablePushBackgroundChannel();\n    IMGUI_API void          TablePopBackgroundChannel();\n\n    // Tables: Internals\n    inline    ImGuiTable*   GetCurrentTable() { ImGuiContext& g = *GImGui; return g.CurrentTable; }\n    IMGUI_API ImGuiTable*   TableFindByID(ImGuiID id);\n    IMGUI_API bool          BeginTableEx(const char* name, ImGuiID id, int columns_count, ImGuiTableFlags flags = 0, const ImVec2& outer_size = ImVec2(0, 0), float inner_width = 0.0f);\n    IMGUI_API void          TableBeginInitMemory(ImGuiTable* table, int columns_count);\n    IMGUI_API void          TableBeginApplyRequests(ImGuiTable* table);\n    IMGUI_API void          TableSetupDrawChannels(ImGuiTable* table);\n    IMGUI_API void          TableUpdateLayout(ImGuiTable* table);\n    IMGUI_API void          TableUpdateBorders(ImGuiTable* table);\n    IMGUI_API void          TableUpdateColumnsWeightFromWidth(ImGuiTable* table);\n    IMGUI_API void          TableDrawBorders(ImGuiTable* table);\n    IMGUI_API void          TableDrawContextMenu(ImGuiTable* table);\n    IMGUI_API void          TableMergeDrawChannels(ImGuiTable* table);\n    IMGUI_API void          TableSortSpecsSanitize(ImGuiTable* table);\n    IMGUI_API void          TableSortSpecsBuild(ImGuiTable* table);\n    IMGUI_API ImGuiSortDirection TableGetColumnNextSortDirection(ImGuiTableColumn* column);\n    IMGUI_API void          TableFixColumnSortDirection(ImGuiTable* table, ImGuiTableColumn* column);\n    IMGUI_API float         TableGetColumnWidthAuto(ImGuiTable* table, ImGuiTableColumn* column);\n    IMGUI_API void          TableBeginRow(ImGuiTable* table);\n    IMGUI_API void          TableEndRow(ImGuiTable* table);\n    IMGUI_API void          TableBeginCell(ImGuiTable* table, int column_n);\n    IMGUI_API void          TableEndCell(ImGuiTable* table);\n    IMGUI_API ImRect        TableGetCellBgRect(const ImGuiTable* table, int column_n);\n    IMGUI_API const char*   TableGetColumnName(const ImGuiTable* table, int column_n);\n    IMGUI_API ImGuiID       TableGetColumnResizeID(const ImGuiTable* table, int column_n, int instance_no = 0);\n    IMGUI_API float         TableGetMaxColumnWidth(const ImGuiTable* table, int column_n);\n    IMGUI_API void          TableSetColumnWidthAutoSingle(ImGuiTable* table, int column_n);\n    IMGUI_API void          TableSetColumnWidthAutoAll(ImGuiTable* table);\n    IMGUI_API void          TableRemove(ImGuiTable* table);\n    IMGUI_API void          TableGcCompactTransientBuffers(ImGuiTable* table);\n    IMGUI_API void          TableGcCompactTransientBuffers(ImGuiTableTempData* table);\n    IMGUI_API void          TableGcCompactSettings();\n\n    // Tables: Settings\n    IMGUI_API void                  TableLoadSettings(ImGuiTable* table);\n    IMGUI_API void                  TableSaveSettings(ImGuiTable* table);\n    IMGUI_API void                  TableResetSettings(ImGuiTable* table);\n    IMGUI_API ImGuiTableSettings*   TableGetBoundSettings(ImGuiTable* table);\n    IMGUI_API void                  TableSettingsInstallHandler(ImGuiContext* context);\n    IMGUI_API ImGuiTableSettings*   TableSettingsCreate(ImGuiID id, int columns_count);\n    IMGUI_API ImGuiTableSettings*   TableSettingsFindByID(ImGuiID id);\n\n    // Tab Bars\n    IMGUI_API bool          BeginTabBarEx(ImGuiTabBar* tab_bar, const ImRect& bb, ImGuiTabBarFlags flags);\n    IMGUI_API ImGuiTabItem* TabBarFindTabByID(ImGuiTabBar* tab_bar, ImGuiID tab_id);\n    IMGUI_API void          TabBarRemoveTab(ImGuiTabBar* tab_bar, ImGuiID tab_id);\n    IMGUI_API void          TabBarCloseTab(ImGuiTabBar* tab_bar, ImGuiTabItem* tab);\n    IMGUI_API void          TabBarQueueReorder(ImGuiTabBar* tab_bar, const ImGuiTabItem* tab, int offset);\n    IMGUI_API void          TabBarQueueReorderFromMousePos(ImGuiTabBar* tab_bar, const ImGuiTabItem* tab, ImVec2 mouse_pos);\n    IMGUI_API bool          TabBarProcessReorder(ImGuiTabBar* tab_bar);\n    IMGUI_API bool          TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, ImGuiTabItemFlags flags);\n    IMGUI_API ImVec2        TabItemCalcSize(const char* label, bool has_close_button);\n    IMGUI_API void          TabItemBackground(ImDrawList* draw_list, const ImRect& bb, ImGuiTabItemFlags flags, ImU32 col);\n    IMGUI_API void          TabItemLabelAndCloseButton(ImDrawList* draw_list, const ImRect& bb, ImGuiTabItemFlags flags, ImVec2 frame_padding, const char* label, ImGuiID tab_id, ImGuiID close_button_id, bool is_contents_visible, bool* out_just_closed, bool* out_text_clipped);\n\n    // Render helpers\n    // AVOID USING OUTSIDE OF IMGUI.CPP! NOT FOR PUBLIC CONSUMPTION. THOSE FUNCTIONS ARE A MESS. THEIR SIGNATURE AND BEHAVIOR WILL CHANGE, THEY NEED TO BE REFACTORED INTO SOMETHING DECENT.\n    // NB: All position are in absolute pixels coordinates (we are never using window coordinates internally)\n    IMGUI_API void          RenderText(ImVec2 pos, const char* text, const char* text_end = NULL, bool hide_text_after_hash = true);\n    IMGUI_API void          RenderTextWrapped(ImVec2 pos, const char* text, const char* text_end, float wrap_width);\n    IMGUI_API void          RenderTextClipped(const ImVec2& pos_min, const ImVec2& pos_max, const char* text, const char* text_end, const ImVec2* text_size_if_known, const ImVec2& align = ImVec2(0, 0), const ImRect* clip_rect = NULL);\n    IMGUI_API void          RenderTextClippedEx(ImDrawList* draw_list, const ImVec2& pos_min, const ImVec2& pos_max, const char* text, const char* text_end, const ImVec2* text_size_if_known, const ImVec2& align = ImVec2(0, 0), const ImRect* clip_rect = NULL);\n    IMGUI_API void          RenderTextEllipsis(ImDrawList* draw_list, const ImVec2& pos_min, const ImVec2& pos_max, float clip_max_x, float ellipsis_max_x, const char* text, const char* text_end, const ImVec2* text_size_if_known);\n    IMGUI_API void          RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border = true, float rounding = 0.0f);\n    IMGUI_API void          RenderFrameBorder(ImVec2 p_min, ImVec2 p_max, float rounding = 0.0f);\n    IMGUI_API void          RenderColorRectWithAlphaCheckerboard(ImDrawList* draw_list, ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, float grid_step, ImVec2 grid_off, float rounding = 0.0f, ImDrawFlags flags = 0);\n    IMGUI_API void          RenderNavHighlight(const ImRect& bb, ImGuiID id, ImGuiNavHighlightFlags flags = ImGuiNavHighlightFlags_TypeDefault); // Navigation highlight\n    IMGUI_API const char*   FindRenderedTextEnd(const char* text, const char* text_end = NULL); // Find the optional ## from which we stop displaying text.\n\n    // Render helpers (those functions don't access any ImGui state!)\n    IMGUI_API void          RenderArrow(ImDrawList* draw_list, ImVec2 pos, ImU32 col, ImGuiDir dir, float scale = 1.0f);\n    IMGUI_API void          RenderBullet(ImDrawList* draw_list, ImVec2 pos, ImU32 col);\n    IMGUI_API void          RenderCheckMark(ImDrawList* draw_list, ImVec2 pos, ImU32 col, float sz);\n    IMGUI_API void          RenderMouseCursor(ImDrawList* draw_list, ImVec2 pos, float scale, ImGuiMouseCursor mouse_cursor, ImU32 col_fill, ImU32 col_border, ImU32 col_shadow);\n    IMGUI_API void          RenderArrowPointingAt(ImDrawList* draw_list, ImVec2 pos, ImVec2 half_sz, ImGuiDir direction, ImU32 col);\n    IMGUI_API void          RenderRectFilledRangeH(ImDrawList* draw_list, const ImRect& rect, ImU32 col, float x_start_norm, float x_end_norm, float rounding);\n    IMGUI_API void          RenderRectFilledWithHole(ImDrawList* draw_list, ImRect outer, ImRect inner, ImU32 col, float rounding);\n\n#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS\n    // [1.71: 2019/06/07: Updating prototypes of some of the internal functions. Leaving those for reference for a short while]\n    inline void RenderArrow(ImVec2 pos, ImGuiDir dir, float scale=1.0f) { ImGuiWindow* window = GetCurrentWindow(); RenderArrow(window->DrawList, pos, GetColorU32(ImGuiCol_Text), dir, scale); }\n    inline void RenderBullet(ImVec2 pos)                                { ImGuiWindow* window = GetCurrentWindow(); RenderBullet(window->DrawList, pos, GetColorU32(ImGuiCol_Text)); }\n#endif\n\n    // Widgets\n    IMGUI_API void          TextEx(const char* text, const char* text_end = NULL, ImGuiTextFlags flags = 0);\n    IMGUI_API bool          ButtonEx(const char* label, const ImVec2& size_arg = ImVec2(0, 0), ImGuiButtonFlags flags = 0);\n    IMGUI_API bool          CloseButton(ImGuiID id, const ImVec2& pos);\n    IMGUI_API bool          CollapseButton(ImGuiID id, const ImVec2& pos);\n    IMGUI_API bool          ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size_arg, ImGuiButtonFlags flags = 0);\n    IMGUI_API void          Scrollbar(ImGuiAxis axis);\n    IMGUI_API bool          ScrollbarEx(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float* p_scroll_v, float avail_v, float contents_v, ImDrawFlags flags);\n    IMGUI_API bool          ImageButtonEx(ImGuiID id, ImTextureID texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec2& padding, const ImVec4& bg_col, const ImVec4& tint_col);\n    IMGUI_API ImRect        GetWindowScrollbarRect(ImGuiWindow* window, ImGuiAxis axis);\n    IMGUI_API ImGuiID       GetWindowScrollbarID(ImGuiWindow* window, ImGuiAxis axis);\n    IMGUI_API ImGuiID       GetWindowResizeCornerID(ImGuiWindow* window, int n); // 0..3: corners\n    IMGUI_API ImGuiID       GetWindowResizeBorderID(ImGuiWindow* window, ImGuiDir dir);\n    IMGUI_API void          SeparatorEx(ImGuiSeparatorFlags flags);\n    IMGUI_API bool          CheckboxFlags(const char* label, ImS64* flags, ImS64 flags_value);\n    IMGUI_API bool          CheckboxFlags(const char* label, ImU64* flags, ImU64 flags_value);\n\n    // Widgets low-level behaviors\n    IMGUI_API bool          ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool* out_held, ImGuiButtonFlags flags = 0);\n    IMGUI_API bool          DragBehavior(ImGuiID id, ImGuiDataType data_type, void* p_v, float v_speed, const void* p_min, const void* p_max, const char* format, ImGuiSliderFlags flags);\n    IMGUI_API bool          SliderBehavior(const ImRect& bb, ImGuiID id, ImGuiDataType data_type, void* p_v, const void* p_min, const void* p_max, const char* format, ImGuiSliderFlags flags, ImRect* out_grab_bb);\n    IMGUI_API bool          SplitterBehavior(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float* size1, float* size2, float min_size1, float min_size2, float hover_extend = 0.0f, float hover_visibility_delay = 0.0f);\n    IMGUI_API bool          TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* label, const char* label_end = NULL);\n    IMGUI_API bool          TreeNodeBehaviorIsOpen(ImGuiID id, ImGuiTreeNodeFlags flags = 0);                     // Consume previous SetNextItemOpen() data, if any. May return true when logging\n    IMGUI_API void          TreePushOverrideID(ImGuiID id);\n\n    // Template functions are instantiated in imgui_widgets.cpp for a finite number of types.\n    // To use them externally (for custom widget) you may need an \"extern template\" statement in your code in order to link to existing instances and silence Clang warnings (see #2036).\n    // e.g. \" extern template IMGUI_API float RoundScalarWithFormatT<float, float>(const char* format, ImGuiDataType data_type, float v); \"\n    template<typename T, typename SIGNED_T, typename FLOAT_T>   IMGUI_API float ScaleRatioFromValueT(ImGuiDataType data_type, T v, T v_min, T v_max, bool is_logarithmic, float logarithmic_zero_epsilon, float zero_deadzone_size);\n    template<typename T, typename SIGNED_T, typename FLOAT_T>   IMGUI_API T     ScaleValueFromRatioT(ImGuiDataType data_type, float t, T v_min, T v_max, bool is_logarithmic, float logarithmic_zero_epsilon, float zero_deadzone_size);\n    template<typename T, typename SIGNED_T, typename FLOAT_T>   IMGUI_API bool  DragBehaviorT(ImGuiDataType data_type, T* v, float v_speed, T v_min, T v_max, const char* format, ImGuiSliderFlags flags);\n    template<typename T, typename SIGNED_T, typename FLOAT_T>   IMGUI_API bool  SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_type, T* v, T v_min, T v_max, const char* format, ImGuiSliderFlags flags, ImRect* out_grab_bb);\n    template<typename T, typename SIGNED_T>                     IMGUI_API T     RoundScalarWithFormatT(const char* format, ImGuiDataType data_type, T v);\n    template<typename T>                                        IMGUI_API bool  CheckboxFlagsT(const char* label, T* flags, T flags_value);\n\n    // Data type helpers\n    IMGUI_API const ImGuiDataTypeInfo*  DataTypeGetInfo(ImGuiDataType data_type);\n    IMGUI_API int           DataTypeFormatString(char* buf, int buf_size, ImGuiDataType data_type, const void* p_data, const char* format);\n    IMGUI_API void          DataTypeApplyOp(ImGuiDataType data_type, int op, void* output, const void* arg_1, const void* arg_2);\n    IMGUI_API bool          DataTypeApplyOpFromText(const char* buf, const char* initial_value_buf, ImGuiDataType data_type, void* p_data, const char* format);\n    IMGUI_API int           DataTypeCompare(ImGuiDataType data_type, const void* arg_1, const void* arg_2);\n    IMGUI_API bool          DataTypeClamp(ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max);\n\n    // InputText\n    IMGUI_API bool          InputTextEx(const char* label, const char* hint, char* buf, int buf_size, const ImVec2& size_arg, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback = NULL, void* user_data = NULL);\n    IMGUI_API bool          TempInputText(const ImRect& bb, ImGuiID id, const char* label, char* buf, int buf_size, ImGuiInputTextFlags flags);\n    IMGUI_API bool          TempInputScalar(const ImRect& bb, ImGuiID id, const char* label, ImGuiDataType data_type, void* p_data, const char* format, const void* p_clamp_min = NULL, const void* p_clamp_max = NULL);\n    inline bool             TempInputIsActive(ImGuiID id)       { ImGuiContext& g = *GImGui; return (g.ActiveId == id && g.TempInputId == id); }\n    inline ImGuiInputTextState* GetInputTextState(ImGuiID id)   { ImGuiContext& g = *GImGui; return (g.InputTextState.ID == id) ? &g.InputTextState : NULL; } // Get input text state if active\n\n    // Color\n    IMGUI_API void          ColorTooltip(const char* text, const float* col, ImGuiColorEditFlags flags);\n    IMGUI_API void          ColorEditOptionsPopup(const float* col, ImGuiColorEditFlags flags);\n    IMGUI_API void          ColorPickerOptionsPopup(const float* ref_col, ImGuiColorEditFlags flags);\n\n    // Plot\n    IMGUI_API int           PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 frame_size);\n\n    // Shade functions (write over already created vertices)\n    IMGUI_API void          ShadeVertsLinearColorGradientKeepAlpha(ImDrawList* draw_list, int vert_start_idx, int vert_end_idx, ImVec2 gradient_p0, ImVec2 gradient_p1, ImU32 col0, ImU32 col1);\n    IMGUI_API void          ShadeVertsLinearUV(ImDrawList* draw_list, int vert_start_idx, int vert_end_idx, const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, bool clamp);\n\n    // Garbage collection\n    IMGUI_API void          GcCompactTransientMiscBuffers();\n    IMGUI_API void          GcCompactTransientWindowBuffers(ImGuiWindow* window);\n    IMGUI_API void          GcAwakeTransientWindowBuffers(ImGuiWindow* window);\n\n    // Debug Tools\n    IMGUI_API void          ErrorCheckEndFrameRecover(ImGuiErrorLogCallback log_callback, void* user_data = NULL);\n    inline void             DebugDrawItemRect(ImU32 col = IM_COL32(255,0,0,255))    { ImGuiContext& g = *GImGui; ImGuiWindow* window = g.CurrentWindow; GetForegroundDrawList(window)->AddRect(g.LastItemData.Rect.Min, g.LastItemData.Rect.Max, col); }\n    inline void             DebugStartItemPicker()                                  { ImGuiContext& g = *GImGui; g.DebugItemPickerActive = true; }\n\n    IMGUI_API void          ShowFontAtlas(ImFontAtlas* atlas);\n    IMGUI_API void          DebugNodeColumns(ImGuiOldColumns* columns);\n    IMGUI_API void          DebugNodeDrawList(ImGuiWindow* window, const ImDrawList* draw_list, const char* label);\n    IMGUI_API void          DebugNodeDrawCmdShowMeshAndBoundingBox(ImDrawList* out_draw_list, const ImDrawList* draw_list, const ImDrawCmd* draw_cmd, bool show_mesh, bool show_aabb);\n    IMGUI_API void          DebugNodeFont(ImFont* font);\n    IMGUI_API void          DebugNodeStorage(ImGuiStorage* storage, const char* label);\n    IMGUI_API void          DebugNodeTabBar(ImGuiTabBar* tab_bar, const char* label);\n    IMGUI_API void          DebugNodeTable(ImGuiTable* table);\n    IMGUI_API void          DebugNodeTableSettings(ImGuiTableSettings* settings);\n    IMGUI_API void          DebugNodeWindow(ImGuiWindow* window, const char* label);\n    IMGUI_API void          DebugNodeWindowSettings(ImGuiWindowSettings* settings);\n    IMGUI_API void          DebugNodeWindowsList(ImVector<ImGuiWindow*>* windows, const char* label);\n    IMGUI_API void          DebugNodeViewport(ImGuiViewportP* viewport);\n    IMGUI_API void          DebugRenderViewportThumbnail(ImDrawList* draw_list, ImGuiViewportP* viewport, const ImRect& bb);\n\n} // namespace ImGui\n\n\n//-----------------------------------------------------------------------------\n// [SECTION] ImFontAtlas internal API\n//-----------------------------------------------------------------------------\n\n// This structure is likely to evolve as we add support for incremental atlas updates\nstruct ImFontBuilderIO\n{\n    bool    (*FontBuilder_Build)(ImFontAtlas* atlas);\n};\n\n// Helper for font builder\nIMGUI_API const ImFontBuilderIO* ImFontAtlasGetBuilderForStbTruetype();\nIMGUI_API void      ImFontAtlasBuildInit(ImFontAtlas* atlas);\nIMGUI_API void      ImFontAtlasBuildSetupFont(ImFontAtlas* atlas, ImFont* font, ImFontConfig* font_config, float ascent, float descent);\nIMGUI_API void      ImFontAtlasBuildPackCustomRects(ImFontAtlas* atlas, void* stbrp_context_opaque);\nIMGUI_API void      ImFontAtlasBuildFinish(ImFontAtlas* atlas);\nIMGUI_API void      ImFontAtlasBuildRender8bppRectFromString(ImFontAtlas* atlas, int x, int y, int w, int h, const char* in_str, char in_marker_char, unsigned char in_marker_pixel_value);\nIMGUI_API void      ImFontAtlasBuildRender32bppRectFromString(ImFontAtlas* atlas, int x, int y, int w, int h, const char* in_str, char in_marker_char, unsigned int in_marker_pixel_value);\nIMGUI_API void      ImFontAtlasBuildMultiplyCalcLookupTable(unsigned char out_table[256], float in_multiply_factor);\nIMGUI_API void      ImFontAtlasBuildMultiplyRectAlpha8(const unsigned char table[256], unsigned char* pixels, int x, int y, int w, int h, int stride);\n\n//-----------------------------------------------------------------------------\n// [SECTION] Test Engine specific hooks (imgui_test_engine)\n//-----------------------------------------------------------------------------\n\n#ifdef IMGUI_ENABLE_TEST_ENGINE\nextern void         ImGuiTestEngineHook_ItemAdd(ImGuiContext* ctx, const ImRect& bb, ImGuiID id);\nextern void         ImGuiTestEngineHook_ItemInfo(ImGuiContext* ctx, ImGuiID id, const char* label, ImGuiItemStatusFlags flags);\nextern void         ImGuiTestEngineHook_IdInfo(ImGuiContext* ctx, ImGuiDataType data_type, ImGuiID id, const void* data_id);\nextern void         ImGuiTestEngineHook_IdInfo(ImGuiContext* ctx, ImGuiDataType data_type, ImGuiID id, const void* data_id, const void* data_id_end);\nextern void         ImGuiTestEngineHook_Log(ImGuiContext* ctx, const char* fmt, ...);\n#define IMGUI_TEST_ENGINE_ITEM_ADD(_BB,_ID)                 if (g.TestEngineHookItems) ImGuiTestEngineHook_ItemAdd(&g, _BB, _ID)               // Register item bounding box\n#define IMGUI_TEST_ENGINE_ITEM_INFO(_ID,_LABEL,_FLAGS)      if (g.TestEngineHookItems) ImGuiTestEngineHook_ItemInfo(&g, _ID, _LABEL, _FLAGS)   // Register item label and status flags (optional)\n#define IMGUI_TEST_ENGINE_LOG(_FMT,...)                     if (g.TestEngineHookItems) ImGuiTestEngineHook_Log(&g, _FMT, __VA_ARGS__)          // Custom log entry from user land into test log\n#define IMGUI_TEST_ENGINE_ID_INFO(_ID,_TYPE,_DATA)          if (g.TestEngineHookIdInfo == _ID) ImGuiTestEngineHook_IdInfo(&g, _TYPE, _ID, (const void*)(_DATA));\n#define IMGUI_TEST_ENGINE_ID_INFO2(_ID,_TYPE,_DATA,_DATA2)  if (g.TestEngineHookIdInfo == _ID) ImGuiTestEngineHook_IdInfo(&g, _TYPE, _ID, (const void*)(_DATA), (const void*)(_DATA2));\n#else\n#define IMGUI_TEST_ENGINE_ITEM_INFO(_ID,_LABEL,_FLAGS)      ((void)0)\n#endif\n\n//-----------------------------------------------------------------------------\n\n#if defined(__clang__)\n#pragma clang diagnostic pop\n#elif defined(__GNUC__)\n#pragma GCC diagnostic pop\n#endif\n\n#ifdef _MSC_VER\n#pragma warning (pop)\n#endif\n\n#endif // #ifndef IMGUI_DISABLE\n"
  },
  {
    "path": "R3nzSkin/imgui/imgui_tables.cpp",
    "content": "// dear imgui, v1.84\n// (tables and columns code)\n\n/*\n\nIndex of this file:\n\n// [SECTION] Commentary\n// [SECTION] Header mess\n// [SECTION] Tables: Main code\n// [SECTION] Tables: Simple accessors\n// [SECTION] Tables: Row changes\n// [SECTION] Tables: Columns changes\n// [SECTION] Tables: Columns width management\n// [SECTION] Tables: Drawing\n// [SECTION] Tables: Sorting\n// [SECTION] Tables: Headers\n// [SECTION] Tables: Context Menu\n// [SECTION] Tables: Settings (.ini data)\n// [SECTION] Tables: Garbage Collection\n// [SECTION] Tables: Debugging\n// [SECTION] Columns, BeginColumns, EndColumns, etc.\n\n*/\n\n// Navigating this file:\n// - In Visual Studio IDE: CTRL+comma (\"Edit.NavigateTo\") can follow symbols in comments, whereas CTRL+F12 (\"Edit.GoToImplementation\") cannot.\n// - With Visual Assist installed: ALT+G (\"VAssistX.GoToImplementation\") can also follow symbols in comments.\n\n//-----------------------------------------------------------------------------\n// [SECTION] Commentary\n//-----------------------------------------------------------------------------\n\n//-----------------------------------------------------------------------------\n// Typical tables call flow: (root level is generally public API):\n//-----------------------------------------------------------------------------\n// - BeginTable()                               user begin into a table\n//    | BeginChild()                            - (if ScrollX/ScrollY is set)\n//    | TableBeginInitMemory()                  - first time table is used\n//    | TableResetSettings()                    - on settings reset\n//    | TableLoadSettings()                     - on settings load\n//    | TableBeginApplyRequests()               - apply queued resizing/reordering/hiding requests\n//    | - TableSetColumnWidth()                 - apply resizing width (for mouse resize, often requested by previous frame)\n//    |    - TableUpdateColumnsWeightFromWidth()- recompute columns weights (of stretch columns) from their respective width\n// - TableSetupColumn()                         user submit columns details (optional)\n// - TableSetupScrollFreeze()                   user submit scroll freeze information (optional)\n//-----------------------------------------------------------------------------\n// - TableUpdateLayout() [Internal]             followup to BeginTable(): setup everything: widths, columns positions, clipping rectangles. Automatically called by the FIRST call to TableNextRow() or TableHeadersRow().\n//    | TableSetupDrawChannels()                - setup ImDrawList channels\n//    | TableUpdateBorders()                    - detect hovering columns for resize, ahead of contents submission\n//    | TableDrawContextMenu()                  - draw right-click context menu\n//-----------------------------------------------------------------------------\n// - TableHeadersRow() or TableHeader()         user submit a headers row (optional)\n//    | TableSortSpecsClickColumn()             - when left-clicked: alter sort order and sort direction\n//    | TableOpenContextMenu()                  - when right-clicked: trigger opening of the default context menu\n// - TableGetSortSpecs()                        user queries updated sort specs (optional, generally after submitting headers)\n// - TableNextRow()                             user begin into a new row (also automatically called by TableHeadersRow())\n//    | TableEndRow()                           - finish existing row\n//    | TableBeginRow()                         - add a new row\n// - TableSetColumnIndex() / TableNextColumn()  user begin into a cell\n//    | TableEndCell()                          - close existing column/cell\n//    | TableBeginCell()                        - enter into current column/cell\n// - [...]                                      user emit contents\n//-----------------------------------------------------------------------------\n// - EndTable()                                 user ends the table\n//    | TableDrawBorders()                      - draw outer borders, inner vertical borders\n//    | TableMergeDrawChannels()                - merge draw channels if clipping isn't required\n//    | EndChild()                              - (if ScrollX/ScrollY is set)\n//-----------------------------------------------------------------------------\n\n//-----------------------------------------------------------------------------\n// TABLE SIZING\n//-----------------------------------------------------------------------------\n// (Read carefully because this is subtle but it does make sense!)\n//-----------------------------------------------------------------------------\n// About 'outer_size':\n// Its meaning needs to differ slightly depending on if we are using ScrollX/ScrollY flags.\n// Default value is ImVec2(0.0f, 0.0f).\n//   X\n//   - outer_size.x <= 0.0f  ->  Right-align from window/work-rect right-most edge. With -FLT_MIN or 0.0f will align exactly on right-most edge.\n//   - outer_size.x  > 0.0f  ->  Set Fixed width.\n//   Y with ScrollX/ScrollY disabled: we output table directly in current window\n//   - outer_size.y  < 0.0f  ->  Bottom-align (but will auto extend, unless _NoHostExtendY is set). Not meaningful is parent window can vertically scroll.\n//   - outer_size.y  = 0.0f  ->  No minimum height (but will auto extend, unless _NoHostExtendY is set)\n//   - outer_size.y  > 0.0f  ->  Set Minimum height (but will auto extend, unless _NoHostExtenY is set)\n//   Y with ScrollX/ScrollY enabled: using a child window for scrolling\n//   - outer_size.y  < 0.0f  ->  Bottom-align. Not meaningful is parent window can vertically scroll.\n//   - outer_size.y  = 0.0f  ->  Bottom-align, consistent with BeginChild(). Not recommended unless table is last item in parent window.\n//   - outer_size.y  > 0.0f  ->  Set Exact height. Recommended when using Scrolling on any axis.\n//-----------------------------------------------------------------------------\n// Outer size is also affected by the NoHostExtendX/NoHostExtendY flags.\n// Important to that note how the two flags have slightly different behaviors!\n//   - ImGuiTableFlags_NoHostExtendX -> Make outer width auto-fit to columns (overriding outer_size.x value). Only available when ScrollX/ScrollY are disabled and Stretch columns are not used.\n//   - ImGuiTableFlags_NoHostExtendY -> Make outer height stop exactly at outer_size.y (prevent auto-extending table past the limit). Only available when ScrollX/ScrollY is disabled. Data below the limit will be clipped and not visible.\n// In theory ImGuiTableFlags_NoHostExtendY could be the default and any non-scrolling tables with outer_size.y != 0.0f would use exact height.\n// This would be consistent but perhaps less useful and more confusing (as vertically clipped items are not easily noticeable)\n//-----------------------------------------------------------------------------\n// About 'inner_width':\n//   With ScrollX disabled:\n//   - inner_width          ->  *ignored*\n//   With ScrollX enabled:\n//   - inner_width  < 0.0f  ->  *illegal* fit in known width (right align from outer_size.x) <-- weird\n//   - inner_width  = 0.0f  ->  fit in outer_width: Fixed size columns will take space they need (if avail, otherwise shrink down), Stretch columns becomes Fixed columns.\n//   - inner_width  > 0.0f  ->  override scrolling width, generally to be larger than outer_size.x. Fixed column take space they need (if avail, otherwise shrink down), Stretch columns share remaining space!\n//-----------------------------------------------------------------------------\n// Details:\n// - If you want to use Stretch columns with ScrollX, you generally need to specify 'inner_width' otherwise the concept\n//   of \"available space\" doesn't make sense.\n// - Even if not really useful, we allow 'inner_width < outer_size.x' for consistency and to facilitate understanding\n//   of what the value does.\n//-----------------------------------------------------------------------------\n\n//-----------------------------------------------------------------------------\n// COLUMNS SIZING POLICIES\n//-----------------------------------------------------------------------------\n// About overriding column sizing policy and width/weight with TableSetupColumn():\n// We use a default parameter of 'init_width_or_weight == -1'.\n//   - with ImGuiTableColumnFlags_WidthFixed,    init_width  <= 0 (default)  --> width is automatic\n//   - with ImGuiTableColumnFlags_WidthFixed,    init_width  >  0 (explicit) --> width is custom\n//   - with ImGuiTableColumnFlags_WidthStretch,  init_weight <= 0 (default)  --> weight is 1.0f\n//   - with ImGuiTableColumnFlags_WidthStretch,  init_weight >  0 (explicit) --> weight is custom\n// Widths are specified _without_ CellPadding. If you specify a width of 100.0f, the column will be cover (100.0f + Padding * 2.0f)\n// and you can fit a 100.0f wide item in it without clipping and with full padding.\n//-----------------------------------------------------------------------------\n// About default sizing policy (if you don't specify a ImGuiTableColumnFlags_WidthXXXX flag)\n//   - with Table policy ImGuiTableFlags_SizingFixedFit      --> default Column policy is ImGuiTableColumnFlags_WidthFixed, default Width is equal to contents width\n//   - with Table policy ImGuiTableFlags_SizingFixedSame     --> default Column policy is ImGuiTableColumnFlags_WidthFixed, default Width is max of all contents width\n//   - with Table policy ImGuiTableFlags_SizingStretchSame   --> default Column policy is ImGuiTableColumnFlags_WidthStretch, default Weight is 1.0f\n//   - with Table policy ImGuiTableFlags_SizingStretchWeight --> default Column policy is ImGuiTableColumnFlags_WidthStretch, default Weight is proportional to contents\n// Default Width and default Weight can be overridden when calling TableSetupColumn().\n//-----------------------------------------------------------------------------\n// About mixing Fixed/Auto and Stretch columns together:\n//   - the typical use of mixing sizing policies is: any number of LEADING Fixed columns, followed by one or two TRAILING Stretch columns.\n//   - using mixed policies with ScrollX does not make much sense, as using Stretch columns with ScrollX does not make much sense in the first place!\n//     that is, unless 'inner_width' is passed to BeginTable() to explicitly provide a total width to layout columns in.\n//   - when using ImGuiTableFlags_SizingFixedSame with mixed columns, only the Fixed/Auto columns will match their widths to the width of the maximum contents.\n//   - when using ImGuiTableFlags_SizingStretchSame with mixed columns, only the Stretch columns will match their weight/widths.\n//-----------------------------------------------------------------------------\n// About using column width:\n// If a column is manual resizable or has a width specified with TableSetupColumn():\n//   - you may use GetContentRegionAvail().x to query the width available in a given column.\n//   - right-side alignment features such as SetNextItemWidth(-x) or PushItemWidth(-x) will rely on this width.\n// If the column is not resizable and has no width specified with TableSetupColumn():\n//   - its width will be automatic and be set to the max of items submitted.\n//   - therefore you generally cannot have ALL items of the columns use e.g. SetNextItemWidth(-FLT_MIN).\n//   - but if the column has one or more items of known/fixed size, this will become the reference width used by SetNextItemWidth(-FLT_MIN).\n//-----------------------------------------------------------------------------\n\n\n//-----------------------------------------------------------------------------\n// TABLES CLIPPING/CULLING\n//-----------------------------------------------------------------------------\n// About clipping/culling of Rows in Tables:\n// - For large numbers of rows, it is recommended you use ImGuiListClipper to only submit visible rows.\n//   ImGuiListClipper is reliant on the fact that rows are of equal height.\n//   See 'Demo->Tables->Vertical Scrolling' or 'Demo->Tables->Advanced' for a demo of using the clipper.\n// - Note that auto-resizing columns don't play well with using the clipper.\n//   By default a table with _ScrollX but without _Resizable will have column auto-resize.\n//   So, if you want to use the clipper, make sure to either enable _Resizable, either setup columns width explicitly with _WidthFixed.\n//-----------------------------------------------------------------------------\n// About clipping/culling of Columns in Tables:\n// - Both TableSetColumnIndex() and TableNextColumn() return true when the column is visible or performing\n//   width measurements. Otherwise, you may skip submitting the contents of a cell/column, BUT ONLY if you know\n//   it is not going to contribute to row height.\n//   In many situations, you may skip submitting contents for every column but one (e.g. the first one).\n// - Case A: column is not hidden by user, and at least partially in sight (most common case).\n// - Case B: column is clipped / out of sight (because of scrolling or parent ClipRect): TableNextColumn() return false as a hint but we still allow layout output.\n// - Case C: column is hidden explicitly by the user (e.g. via the context menu, or _DefaultHide column flag, etc.).\n//\n//                        [A]         [B]          [C]\n//  TableNextColumn():    true        false        false       -> [userland] when TableNextColumn() / TableSetColumnIndex() return false, user can skip submitting items but only if the column doesn't contribute to row height.\n//          SkipItems:    false       false        true        -> [internal] when SkipItems is true, most widgets will early out if submitted, resulting is no layout output.\n//           ClipRect:    normal      zero-width   zero-width  -> [internal] when ClipRect is zero, ItemAdd() will return false and most widgets will early out mid-way.\n//  ImDrawList output:    normal      dummy        dummy       -> [internal] when using the dummy channel, ImDrawList submissions (if any) will be wasted (because cliprect is zero-width anyway).\n//\n// - We need to distinguish those cases because non-hidden columns that are clipped outside of scrolling bounds should still contribute their height to the row.\n//   However, in the majority of cases, the contribution to row height is the same for all columns, or the tallest cells are known by the programmer.\n//-----------------------------------------------------------------------------\n// About clipping/culling of whole Tables:\n// - Scrolling tables with a known outer size can be clipped earlier as BeginTable() will return false.\n//-----------------------------------------------------------------------------\n\n//-----------------------------------------------------------------------------\n// [SECTION] Header mess\n//-----------------------------------------------------------------------------\n\n#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)\n#define _CRT_SECURE_NO_WARNINGS\n#endif\n\n#include \"imgui.h\"\n#ifndef IMGUI_DISABLE\n\n#ifndef IMGUI_DEFINE_MATH_OPERATORS\n#define IMGUI_DEFINE_MATH_OPERATORS\n#endif\n#include \"imgui_internal.h\"\n\n// System includes\n#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier\n#include <stddef.h>     // intptr_t\n#else\n#include <stdint.h>     // intptr_t\n#endif\n\n// Visual Studio warnings\n#ifdef _MSC_VER\n#pragma warning (disable: 4127)     // condition expression is constant\n#pragma warning (disable: 4996)     // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen\n#if defined(_MSC_VER) && _MSC_VER >= 1922 // MSVC 2019 16.2 or later\n#pragma warning (disable: 5054)     // operator '|': deprecated between enumerations of different types\n#endif\n#pragma warning (disable: 26451)    // [Static Analyzer] Arithmetic overflow : Using operator 'xxx' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator 'xxx' to avoid overflow(io.2).\n#pragma warning (disable: 26812)    // [Static Analyzer] The enum type 'xxx' is unscoped. Prefer 'enum class' over 'enum' (Enum.3).\n#endif\n\n// Clang/GCC warnings with -Weverything\n#if defined(__clang__)\n#if __has_warning(\"-Wunknown-warning-option\")\n#pragma clang diagnostic ignored \"-Wunknown-warning-option\"         // warning: unknown warning group 'xxx'                      // not all warnings are known by all Clang versions and they tend to be rename-happy.. so ignoring warnings triggers new warnings on some configuration. Great!\n#endif\n#pragma clang diagnostic ignored \"-Wunknown-pragmas\"                // warning: unknown warning group 'xxx'\n#pragma clang diagnostic ignored \"-Wold-style-cast\"                 // warning: use of old-style cast                            // yes, they are more terse.\n#pragma clang diagnostic ignored \"-Wfloat-equal\"                    // warning: comparing floating point with == or != is unsafe // storing and comparing against same constants (typically 0.0f) is ok.\n#pragma clang diagnostic ignored \"-Wformat-nonliteral\"              // warning: format string is not a string literal            // passing non-literal to vsnformat(). yes, user passing incorrect format strings can crash the code.\n#pragma clang diagnostic ignored \"-Wsign-conversion\"                // warning: implicit conversion changes signedness\n#pragma clang diagnostic ignored \"-Wzero-as-null-pointer-constant\"  // warning: zero as null pointer constant                    // some standard header variations use #define NULL 0\n#pragma clang diagnostic ignored \"-Wdouble-promotion\"               // warning: implicit conversion from 'float' to 'double' when passing argument to function  // using printf() is a misery with this as C++ va_arg ellipsis changes float to double.\n#pragma clang diagnostic ignored \"-Wenum-enum-conversion\"           // warning: bitwise operation between different enumeration types ('XXXFlags_' and 'XXXFlagsPrivate_')\n#pragma clang diagnostic ignored \"-Wdeprecated-enum-enum-conversion\"// warning: bitwise operation between different enumeration types ('XXXFlags_' and 'XXXFlagsPrivate_') is deprecated\n#pragma clang diagnostic ignored \"-Wimplicit-int-float-conversion\"  // warning: implicit conversion from 'xxx' to 'float' may lose precision\n#elif defined(__GNUC__)\n#pragma GCC diagnostic ignored \"-Wpragmas\"                          // warning: unknown option after '#pragma GCC diagnostic' kind\n#pragma GCC diagnostic ignored \"-Wformat-nonliteral\"                // warning: format not a string literal, format string not checked\n#pragma GCC diagnostic ignored \"-Wclass-memaccess\"                  // [__GNUC__ >= 8] warning: 'memset/memcpy' clearing/writing an object of type 'xxxx' with no trivial copy-assignment; use assignment or value-initialization instead\n#endif\n\n//-----------------------------------------------------------------------------\n// [SECTION] Tables: Main code\n//-----------------------------------------------------------------------------\n// - TableFixFlags() [Internal]\n// - TableFindByID() [Internal]\n// - BeginTable()\n// - BeginTableEx() [Internal]\n// - TableBeginInitMemory() [Internal]\n// - TableBeginApplyRequests() [Internal]\n// - TableSetupColumnFlags() [Internal]\n// - TableUpdateLayout() [Internal]\n// - TableUpdateBorders() [Internal]\n// - EndTable()\n// - TableSetupColumn()\n// - TableSetupScrollFreeze()\n//-----------------------------------------------------------------------------\n\n// Configuration\nstatic const int TABLE_DRAW_CHANNEL_BG0 = 0;\nstatic const int TABLE_DRAW_CHANNEL_BG2_FROZEN = 1;\nstatic const int TABLE_DRAW_CHANNEL_NOCLIP = 2;                     // When using ImGuiTableFlags_NoClip (this becomes the last visible channel)\nstatic const float TABLE_BORDER_SIZE                     = 1.0f;    // FIXME-TABLE: Currently hard-coded because of clipping assumptions with outer borders rendering.\nstatic const float TABLE_RESIZE_SEPARATOR_HALF_THICKNESS = 4.0f;    // Extend outside inner borders.\nstatic const float TABLE_RESIZE_SEPARATOR_FEEDBACK_TIMER = 0.06f;   // Delay/timer before making the hover feedback (color+cursor) visible because tables/columns tends to be more cramped.\n\n// Helper\ninline ImGuiTableFlags TableFixFlags(ImGuiTableFlags flags, ImGuiWindow* outer_window)\n{\n    // Adjust flags: set default sizing policy\n    if ((flags & ImGuiTableFlags_SizingMask_) == 0)\n        flags |= ((flags & ImGuiTableFlags_ScrollX) || (outer_window->Flags & ImGuiWindowFlags_AlwaysAutoResize)) ? ImGuiTableFlags_SizingFixedFit : ImGuiTableFlags_SizingStretchSame;\n\n    // Adjust flags: enable NoKeepColumnsVisible when using ImGuiTableFlags_SizingFixedSame\n    if ((flags & ImGuiTableFlags_SizingMask_) == ImGuiTableFlags_SizingFixedSame)\n        flags |= ImGuiTableFlags_NoKeepColumnsVisible;\n\n    // Adjust flags: enforce borders when resizable\n    if (flags & ImGuiTableFlags_Resizable)\n        flags |= ImGuiTableFlags_BordersInnerV;\n\n    // Adjust flags: disable NoHostExtendX/NoHostExtendY if we have any scrolling going on\n    if (flags & (ImGuiTableFlags_ScrollX | ImGuiTableFlags_ScrollY))\n        flags &= ~(ImGuiTableFlags_NoHostExtendX | ImGuiTableFlags_NoHostExtendY);\n\n    // Adjust flags: NoBordersInBodyUntilResize takes priority over NoBordersInBody\n    if (flags & ImGuiTableFlags_NoBordersInBodyUntilResize)\n        flags &= ~ImGuiTableFlags_NoBordersInBody;\n\n    // Adjust flags: disable saved settings if there's nothing to save\n    if ((flags & (ImGuiTableFlags_Resizable | ImGuiTableFlags_Hideable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Sortable)) == 0)\n        flags |= ImGuiTableFlags_NoSavedSettings;\n\n    // Inherit _NoSavedSettings from top-level window (child windows always have _NoSavedSettings set)\n    if (outer_window->RootWindow->Flags & ImGuiWindowFlags_NoSavedSettings)\n        flags |= ImGuiTableFlags_NoSavedSettings;\n\n    return flags;\n}\n\nImGuiTable* ImGui::TableFindByID(ImGuiID id)\n{\n    ImGuiContext& g = *GImGui;\n    return g.Tables.GetByKey(id);\n}\n\n// Read about \"TABLE SIZING\" at the top of this file.\nbool    ImGui::BeginTable(const char* str_id, int columns_count, ImGuiTableFlags flags, const ImVec2& outer_size, float inner_width)\n{\n    ImGuiID id = GetID(str_id);\n    return BeginTableEx(str_id, id, columns_count, flags, outer_size, inner_width);\n}\n\nbool    ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImGuiTableFlags flags, const ImVec2& outer_size, float inner_width)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* outer_window = GetCurrentWindow();\n    if (outer_window->SkipItems) // Consistent with other tables + beneficial side effect that assert on miscalling EndTable() will be more visible.\n        return false;\n\n    // Sanity checks\n    IM_ASSERT(columns_count > 0 && columns_count <= IMGUI_TABLE_MAX_COLUMNS && \"Only 1..64 columns allowed!\");\n    if (flags & ImGuiTableFlags_ScrollX)\n        IM_ASSERT(inner_width >= 0.0f);\n\n    // If an outer size is specified ahead we will be able to early out when not visible. Exact clipping rules may evolve.\n    const bool use_child_window = (flags & (ImGuiTableFlags_ScrollX | ImGuiTableFlags_ScrollY)) != 0;\n    const ImVec2 avail_size = GetContentRegionAvail();\n    ImVec2 actual_outer_size = CalcItemSize(outer_size, ImMax(avail_size.x, 1.0f), use_child_window ? ImMax(avail_size.y, 1.0f) : 0.0f);\n    ImRect outer_rect(outer_window->DC.CursorPos, outer_window->DC.CursorPos + actual_outer_size);\n    if (use_child_window && IsClippedEx(outer_rect, 0, false))\n    {\n        ItemSize(outer_rect);\n        return false;\n    }\n\n    // Acquire storage for the table\n    ImGuiTable* table = g.Tables.GetOrAddByKey(id);\n    const int instance_no = (table->LastFrameActive != g.FrameCount) ? 0 : table->InstanceCurrent + 1;\n    const ImGuiID instance_id = id + instance_no;\n    const ImGuiTableFlags table_last_flags = table->Flags;\n    if (instance_no > 0)\n        IM_ASSERT(table->ColumnsCount == columns_count && \"BeginTable(): Cannot change columns count mid-frame while preserving same ID\");\n\n    // Acquire temporary buffers\n    const int table_idx = g.Tables.GetIndex(table);\n    g.CurrentTableStackIdx++;\n    if (g.CurrentTableStackIdx + 1 > g.TablesTempDataStack.Size)\n        g.TablesTempDataStack.resize(g.CurrentTableStackIdx + 1, ImGuiTableTempData());\n    ImGuiTableTempData* temp_data = table->TempData = &g.TablesTempDataStack[g.CurrentTableStackIdx];\n    temp_data->TableIndex = table_idx;\n    table->DrawSplitter = &table->TempData->DrawSplitter;\n    table->DrawSplitter->Clear();\n\n    // Fix flags\n    table->IsDefaultSizingPolicy = (flags & ImGuiTableFlags_SizingMask_) == 0;\n    flags = TableFixFlags(flags, outer_window);\n\n    // Initialize\n    table->ID = id;\n    table->Flags = flags;\n    table->InstanceCurrent = (ImS16)instance_no;\n    table->LastFrameActive = g.FrameCount;\n    table->OuterWindow = table->InnerWindow = outer_window;\n    table->ColumnsCount = columns_count;\n    table->IsLayoutLocked = false;\n    table->InnerWidth = inner_width;\n    temp_data->UserOuterSize = outer_size;\n\n    // When not using a child window, WorkRect.Max will grow as we append contents.\n    if (use_child_window)\n    {\n        // Ensure no vertical scrollbar appears if we only want horizontal one, to make flag consistent\n        // (we have no other way to disable vertical scrollbar of a window while keeping the horizontal one showing)\n        ImVec2 override_content_size(FLT_MAX, FLT_MAX);\n        if ((flags & ImGuiTableFlags_ScrollX) && !(flags & ImGuiTableFlags_ScrollY))\n            override_content_size.y = FLT_MIN;\n\n        // Ensure specified width (when not specified, Stretched columns will act as if the width == OuterWidth and\n        // never lead to any scrolling). We don't handle inner_width < 0.0f, we could potentially use it to right-align\n        // based on the right side of the child window work rect, which would require knowing ahead if we are going to\n        // have decoration taking horizontal spaces (typically a vertical scrollbar).\n        if ((flags & ImGuiTableFlags_ScrollX) && inner_width > 0.0f)\n            override_content_size.x = inner_width;\n\n        if (override_content_size.x != FLT_MAX || override_content_size.y != FLT_MAX)\n            SetNextWindowContentSize(ImVec2(override_content_size.x != FLT_MAX ? override_content_size.x : 0.0f, override_content_size.y != FLT_MAX ? override_content_size.y : 0.0f));\n\n        // Reset scroll if we are reactivating it\n        if ((table_last_flags & (ImGuiTableFlags_ScrollX | ImGuiTableFlags_ScrollY)) == 0)\n            SetNextWindowScroll(ImVec2(0.0f, 0.0f));\n\n        // Create scrolling region (without border and zero window padding)\n        ImGuiWindowFlags child_flags = (flags & ImGuiTableFlags_ScrollX) ? ImGuiWindowFlags_HorizontalScrollbar : ImGuiWindowFlags_None;\n        BeginChildEx(name, instance_id, outer_rect.GetSize(), false, child_flags);\n        table->InnerWindow = g.CurrentWindow;\n        table->WorkRect = table->InnerWindow->WorkRect;\n        table->OuterRect = table->InnerWindow->Rect();\n        table->InnerRect = table->InnerWindow->InnerRect;\n        IM_ASSERT(table->InnerWindow->WindowPadding.x == 0.0f && table->InnerWindow->WindowPadding.y == 0.0f && table->InnerWindow->WindowBorderSize == 0.0f);\n    }\n    else\n    {\n        // For non-scrolling tables, WorkRect == OuterRect == InnerRect.\n        // But at this point we do NOT have a correct value for .Max.y (unless a height has been explicitly passed in). It will only be updated in EndTable().\n        table->WorkRect = table->OuterRect = table->InnerRect = outer_rect;\n    }\n\n    // Push a standardized ID for both child-using and not-child-using tables\n    PushOverrideID(instance_id);\n\n    // Backup a copy of host window members we will modify\n    ImGuiWindow* inner_window = table->InnerWindow;\n    table->HostIndentX = inner_window->DC.Indent.x;\n    table->HostClipRect = inner_window->ClipRect;\n    table->HostSkipItems = inner_window->SkipItems;\n    temp_data->HostBackupWorkRect = inner_window->WorkRect;\n    temp_data->HostBackupParentWorkRect = inner_window->ParentWorkRect;\n    temp_data->HostBackupColumnsOffset = outer_window->DC.ColumnsOffset;\n    temp_data->HostBackupPrevLineSize = inner_window->DC.PrevLineSize;\n    temp_data->HostBackupCurrLineSize = inner_window->DC.CurrLineSize;\n    temp_data->HostBackupCursorMaxPos = inner_window->DC.CursorMaxPos;\n    temp_data->HostBackupItemWidth = outer_window->DC.ItemWidth;\n    temp_data->HostBackupItemWidthStackSize = outer_window->DC.ItemWidthStack.Size;\n    inner_window->DC.PrevLineSize = inner_window->DC.CurrLineSize = ImVec2(0.0f, 0.0f);\n\n    // Padding and Spacing\n    // - None               ........Content..... Pad .....Content........\n    // - PadOuter           | Pad ..Content..... Pad .....Content.. Pad |\n    // - PadInner           ........Content.. Pad | Pad ..Content........\n    // - PadOuter+PadInner  | Pad ..Content.. Pad | Pad ..Content.. Pad |\n    const bool pad_outer_x = (flags & ImGuiTableFlags_NoPadOuterX) ? false : (flags & ImGuiTableFlags_PadOuterX) ? true : (flags & ImGuiTableFlags_BordersOuterV) != 0;\n    const bool pad_inner_x = (flags & ImGuiTableFlags_NoPadInnerX) ? false : true;\n    const float inner_spacing_for_border = (flags & ImGuiTableFlags_BordersInnerV) ? TABLE_BORDER_SIZE : 0.0f;\n    const float inner_spacing_explicit = (pad_inner_x && (flags & ImGuiTableFlags_BordersInnerV) == 0) ? g.Style.CellPadding.x : 0.0f;\n    const float inner_padding_explicit = (pad_inner_x && (flags & ImGuiTableFlags_BordersInnerV) != 0) ? g.Style.CellPadding.x : 0.0f;\n    table->CellSpacingX1 = inner_spacing_explicit + inner_spacing_for_border;\n    table->CellSpacingX2 = inner_spacing_explicit;\n    table->CellPaddingX = inner_padding_explicit;\n    table->CellPaddingY = g.Style.CellPadding.y;\n\n    const float outer_padding_for_border = (flags & ImGuiTableFlags_BordersOuterV) ? TABLE_BORDER_SIZE : 0.0f;\n    const float outer_padding_explicit = pad_outer_x ? g.Style.CellPadding.x : 0.0f;\n    table->OuterPaddingX = (outer_padding_for_border + outer_padding_explicit) - table->CellPaddingX;\n\n    table->CurrentColumn = -1;\n    table->CurrentRow = -1;\n    table->RowBgColorCounter = 0;\n    table->LastRowFlags = ImGuiTableRowFlags_None;\n    table->InnerClipRect = (inner_window == outer_window) ? table->WorkRect : inner_window->ClipRect;\n    table->InnerClipRect.ClipWith(table->WorkRect);     // We need this to honor inner_width\n    table->InnerClipRect.ClipWithFull(table->HostClipRect);\n    table->InnerClipRect.Max.y = (flags & ImGuiTableFlags_NoHostExtendY) ? ImMin(table->InnerClipRect.Max.y, inner_window->WorkRect.Max.y) : inner_window->ClipRect.Max.y;\n\n    table->RowPosY1 = table->RowPosY2 = table->WorkRect.Min.y; // This is needed somehow\n    table->RowTextBaseline = 0.0f; // This will be cleared again by TableBeginRow()\n    table->FreezeRowsRequest = table->FreezeRowsCount = 0; // This will be setup by TableSetupScrollFreeze(), if any\n    table->FreezeColumnsRequest = table->FreezeColumnsCount = 0;\n    table->IsUnfrozenRows = true;\n    table->DeclColumnsCount = 0;\n\n    // Using opaque colors facilitate overlapping elements of the grid\n    table->BorderColorStrong = GetColorU32(ImGuiCol_TableBorderStrong);\n    table->BorderColorLight = GetColorU32(ImGuiCol_TableBorderLight);\n\n    // Make table current\n    g.CurrentTable = table;\n    outer_window->DC.CurrentTableIdx = table_idx;\n    if (inner_window != outer_window) // So EndChild() within the inner window can restore the table properly.\n        inner_window->DC.CurrentTableIdx = table_idx;\n\n    if ((table_last_flags & ImGuiTableFlags_Reorderable) && (flags & ImGuiTableFlags_Reorderable) == 0)\n        table->IsResetDisplayOrderRequest = true;\n\n    // Mark as used\n    if (table_idx >= g.TablesLastTimeActive.Size)\n        g.TablesLastTimeActive.resize(table_idx + 1, -1.0f);\n    g.TablesLastTimeActive[table_idx] = (float)g.Time;\n    temp_data->LastTimeActive = (float)g.Time;\n    table->MemoryCompacted = false;\n\n    // Setup memory buffer (clear data if columns count changed)\n    ImGuiTableColumn* old_columns_to_preserve = NULL;\n    void* old_columns_raw_data = NULL;\n    const int old_columns_count = table->Columns.size();\n    if (old_columns_count != 0 && old_columns_count != columns_count)\n    {\n        // Attempt to preserve width on column count change (#4046)\n        old_columns_to_preserve = table->Columns.Data;\n        old_columns_raw_data = table->RawData;\n        table->RawData = NULL;\n    }\n    if (table->RawData == NULL)\n    {\n        TableBeginInitMemory(table, columns_count);\n        table->IsInitializing = table->IsSettingsRequestLoad = true;\n    }\n    if (table->IsResetAllRequest)\n        TableResetSettings(table);\n    if (table->IsInitializing)\n    {\n        // Initialize\n        table->SettingsOffset = -1;\n        table->IsSortSpecsDirty = true;\n        table->InstanceInteracted = -1;\n        table->ContextPopupColumn = -1;\n        table->ReorderColumn = table->ResizedColumn = table->LastResizedColumn = -1;\n        table->AutoFitSingleColumn = -1;\n        table->HoveredColumnBody = table->HoveredColumnBorder = -1;\n        for (int n = 0; n < columns_count; n++)\n        {\n            ImGuiTableColumn* column = &table->Columns[n];\n            if (old_columns_to_preserve && n < old_columns_count)\n            {\n                // FIXME: We don't attempt to preserve column order in this path.\n                *column = old_columns_to_preserve[n];\n            }\n            else\n            {\n                float width_auto = column->WidthAuto;\n                *column = ImGuiTableColumn();\n                column->WidthAuto = width_auto;\n                column->IsPreserveWidthAuto = true; // Preserve WidthAuto when reinitializing a live table: not technically necessary but remove a visible flicker\n                column->IsEnabled = column->IsUserEnabled = column->IsUserEnabledNextFrame = true;\n            }\n            column->DisplayOrder = table->DisplayOrderToIndex[n] = (ImGuiTableColumnIdx)n;\n        }\n    }\n    if (old_columns_raw_data)\n        IM_FREE(old_columns_raw_data);\n\n    // Load settings\n    if (table->IsSettingsRequestLoad)\n        TableLoadSettings(table);\n\n    // Handle DPI/font resize\n    // This is designed to facilitate DPI changes with the assumption that e.g. style.CellPadding has been scaled as well.\n    // It will also react to changing fonts with mixed results. It doesn't need to be perfect but merely provide a decent transition.\n    // FIXME-DPI: Provide consistent standards for reference size. Perhaps using g.CurrentDpiScale would be more self explanatory.\n    // This is will lead us to non-rounded WidthRequest in columns, which should work but is a poorly tested path.\n    const float new_ref_scale_unit = g.FontSize; // g.Font->GetCharAdvance('A') ?\n    if (table->RefScale != 0.0f && table->RefScale != new_ref_scale_unit)\n    {\n        const float scale_factor = new_ref_scale_unit / table->RefScale;\n        //IMGUI_DEBUG_LOG(\"[table] %08X RefScaleUnit %.3f -> %.3f, scaling width by %.3f\\n\", table->ID, table->RefScaleUnit, new_ref_scale_unit, scale_factor);\n        for (int n = 0; n < columns_count; n++)\n            table->Columns[n].WidthRequest = table->Columns[n].WidthRequest * scale_factor;\n    }\n    table->RefScale = new_ref_scale_unit;\n\n    // Disable output until user calls TableNextRow() or TableNextColumn() leading to the TableUpdateLayout() call..\n    // This is not strictly necessary but will reduce cases were \"out of table\" output will be misleading to the user.\n    // Because we cannot safely assert in EndTable() when no rows have been created, this seems like our best option.\n    inner_window->SkipItems = true;\n\n    // Clear names\n    // At this point the ->NameOffset field of each column will be invalid until TableUpdateLayout() or the first call to TableSetupColumn()\n    if (table->ColumnsNames.Buf.Size > 0)\n        table->ColumnsNames.Buf.resize(0);\n\n    // Apply queued resizing/reordering/hiding requests\n    TableBeginApplyRequests(table);\n\n    return true;\n}\n\n// For reference, the average total _allocation count_ for a table is:\n// + 0 (for ImGuiTable instance, we are pooling allocations in g.Tables)\n// + 1 (for table->RawData allocated below)\n// + 1 (for table->ColumnsNames, if names are used)\n// + 1 (for table->Splitter._Channels)\n// + 2 * active_channels_count (for ImDrawCmd and ImDrawIdx buffers inside channels)\n// Where active_channels_count is variable but often == columns_count or columns_count + 1, see TableSetupDrawChannels() for details.\n// Unused channels don't perform their +2 allocations.\nvoid ImGui::TableBeginInitMemory(ImGuiTable* table, int columns_count)\n{\n    // Allocate single buffer for our arrays\n    ImSpanAllocator<3> span_allocator;\n    span_allocator.Reserve(0, columns_count * sizeof(ImGuiTableColumn));\n    span_allocator.Reserve(1, columns_count * sizeof(ImGuiTableColumnIdx));\n    span_allocator.Reserve(2, columns_count * sizeof(ImGuiTableCellData), 4);\n    table->RawData = IM_ALLOC(span_allocator.GetArenaSizeInBytes());\n    memset(table->RawData, 0, span_allocator.GetArenaSizeInBytes());\n    span_allocator.SetArenaBasePtr(table->RawData);\n    span_allocator.GetSpan(0, &table->Columns);\n    span_allocator.GetSpan(1, &table->DisplayOrderToIndex);\n    span_allocator.GetSpan(2, &table->RowCellData);\n}\n\n// Apply queued resizing/reordering/hiding requests\nvoid ImGui::TableBeginApplyRequests(ImGuiTable* table)\n{\n    // Handle resizing request\n    // (We process this at the first TableBegin of the frame)\n    // FIXME-TABLE: Contains columns if our work area doesn't allow for scrolling?\n    if (table->InstanceCurrent == 0)\n    {\n        if (table->ResizedColumn != -1 && table->ResizedColumnNextWidth != FLT_MAX)\n            TableSetColumnWidth(table->ResizedColumn, table->ResizedColumnNextWidth);\n        table->LastResizedColumn = table->ResizedColumn;\n        table->ResizedColumnNextWidth = FLT_MAX;\n        table->ResizedColumn = -1;\n\n        // Process auto-fit for single column, which is a special case for stretch columns and fixed columns with FixedSame policy.\n        // FIXME-TABLE: Would be nice to redistribute available stretch space accordingly to other weights, instead of giving it all to siblings.\n        if (table->AutoFitSingleColumn != -1)\n        {\n            TableSetColumnWidth(table->AutoFitSingleColumn, table->Columns[table->AutoFitSingleColumn].WidthAuto);\n            table->AutoFitSingleColumn = -1;\n        }\n    }\n\n    // Handle reordering request\n    // Note: we don't clear ReorderColumn after handling the request.\n    if (table->InstanceCurrent == 0)\n    {\n        if (table->HeldHeaderColumn == -1 && table->ReorderColumn != -1)\n            table->ReorderColumn = -1;\n        table->HeldHeaderColumn = -1;\n        if (table->ReorderColumn != -1 && table->ReorderColumnDir != 0)\n        {\n            // We need to handle reordering across hidden columns.\n            // In the configuration below, moving C to the right of E will lead to:\n            //    ... C [D] E  --->  ... [D] E  C   (Column name/index)\n            //    ... 2  3  4        ...  2  3  4   (Display order)\n            const int reorder_dir = table->ReorderColumnDir;\n            IM_ASSERT(reorder_dir == -1 || reorder_dir == +1);\n            IM_ASSERT(table->Flags & ImGuiTableFlags_Reorderable);\n            ImGuiTableColumn* src_column = &table->Columns[table->ReorderColumn];\n            ImGuiTableColumn* dst_column = &table->Columns[(reorder_dir == -1) ? src_column->PrevEnabledColumn : src_column->NextEnabledColumn];\n            IM_UNUSED(dst_column);\n            const int src_order = src_column->DisplayOrder;\n            const int dst_order = dst_column->DisplayOrder;\n            src_column->DisplayOrder = (ImGuiTableColumnIdx)dst_order;\n            for (int order_n = src_order + reorder_dir; order_n != dst_order + reorder_dir; order_n += reorder_dir)\n                table->Columns[table->DisplayOrderToIndex[order_n]].DisplayOrder -= (ImGuiTableColumnIdx)reorder_dir;\n            IM_ASSERT(dst_column->DisplayOrder == dst_order - reorder_dir);\n\n            // Display order is stored in both columns->IndexDisplayOrder and table->DisplayOrder[],\n            // rebuild the later from the former.\n            for (int column_n = 0; column_n < table->ColumnsCount; column_n++)\n                table->DisplayOrderToIndex[table->Columns[column_n].DisplayOrder] = (ImGuiTableColumnIdx)column_n;\n            table->ReorderColumnDir = 0;\n            table->IsSettingsDirty = true;\n        }\n    }\n\n    // Handle display order reset request\n    if (table->IsResetDisplayOrderRequest)\n    {\n        for (int n = 0; n < table->ColumnsCount; n++)\n            table->DisplayOrderToIndex[n] = table->Columns[n].DisplayOrder = (ImGuiTableColumnIdx)n;\n        table->IsResetDisplayOrderRequest = false;\n        table->IsSettingsDirty = true;\n    }\n}\n\n// Adjust flags: default width mode + stretch columns are not allowed when auto extending\nstatic void TableSetupColumnFlags(ImGuiTable* table, ImGuiTableColumn* column, ImGuiTableColumnFlags flags_in)\n{\n    ImGuiTableColumnFlags flags = flags_in;\n\n    // Sizing Policy\n    if ((flags & ImGuiTableColumnFlags_WidthMask_) == 0)\n    {\n        const ImGuiTableFlags table_sizing_policy = (table->Flags & ImGuiTableFlags_SizingMask_);\n        if (table_sizing_policy == ImGuiTableFlags_SizingFixedFit || table_sizing_policy == ImGuiTableFlags_SizingFixedSame)\n            flags |= ImGuiTableColumnFlags_WidthFixed;\n        else\n            flags |= ImGuiTableColumnFlags_WidthStretch;\n    }\n    else\n    {\n        IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiTableColumnFlags_WidthMask_)); // Check that only 1 of each set is used.\n    }\n\n    // Resize\n    if ((table->Flags & ImGuiTableFlags_Resizable) == 0)\n        flags |= ImGuiTableColumnFlags_NoResize;\n\n    // Sorting\n    if ((flags & ImGuiTableColumnFlags_NoSortAscending) && (flags & ImGuiTableColumnFlags_NoSortDescending))\n        flags |= ImGuiTableColumnFlags_NoSort;\n\n    // Indentation\n    if ((flags & ImGuiTableColumnFlags_IndentMask_) == 0)\n        flags |= (table->Columns.index_from_ptr(column) == 0) ? ImGuiTableColumnFlags_IndentEnable : ImGuiTableColumnFlags_IndentDisable;\n\n    // Alignment\n    //if ((flags & ImGuiTableColumnFlags_AlignMask_) == 0)\n    //    flags |= ImGuiTableColumnFlags_AlignCenter;\n    //IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiTableColumnFlags_AlignMask_)); // Check that only 1 of each set is used.\n\n    // Preserve status flags\n    column->Flags = flags | (column->Flags & ImGuiTableColumnFlags_StatusMask_);\n\n    // Build an ordered list of available sort directions\n    column->SortDirectionsAvailCount = column->SortDirectionsAvailMask = column->SortDirectionsAvailList = 0;\n    if (table->Flags & ImGuiTableFlags_Sortable)\n    {\n        int count = 0, mask = 0, list = 0;\n        if ((flags & ImGuiTableColumnFlags_PreferSortAscending)  != 0 && (flags & ImGuiTableColumnFlags_NoSortAscending)  == 0) { mask |= 1 << ImGuiSortDirection_Ascending;  list |= ImGuiSortDirection_Ascending  << (count << 1); count++; }\n        if ((flags & ImGuiTableColumnFlags_PreferSortDescending) != 0 && (flags & ImGuiTableColumnFlags_NoSortDescending) == 0) { mask |= 1 << ImGuiSortDirection_Descending; list |= ImGuiSortDirection_Descending << (count << 1); count++; }\n        if ((flags & ImGuiTableColumnFlags_PreferSortAscending)  == 0 && (flags & ImGuiTableColumnFlags_NoSortAscending)  == 0) { mask |= 1 << ImGuiSortDirection_Ascending;  list |= ImGuiSortDirection_Ascending  << (count << 1); count++; }\n        if ((flags & ImGuiTableColumnFlags_PreferSortDescending) == 0 && (flags & ImGuiTableColumnFlags_NoSortDescending) == 0) { mask |= 1 << ImGuiSortDirection_Descending; list |= ImGuiSortDirection_Descending << (count << 1); count++; }\n        if ((table->Flags & ImGuiTableFlags_SortTristate) || count == 0) { mask |= 1 << ImGuiSortDirection_None; count++; }\n        column->SortDirectionsAvailList = (ImU8)list;\n        column->SortDirectionsAvailMask = (ImU8)mask;\n        column->SortDirectionsAvailCount = (ImU8)count;\n        ImGui::TableFixColumnSortDirection(table, column);\n    }\n}\n\n// Layout columns for the frame. This is in essence the followup to BeginTable().\n// Runs on the first call to TableNextRow(), to give a chance for TableSetupColumn() to be called first.\n// FIXME-TABLE: Our width (and therefore our WorkRect) will be minimal in the first frame for _WidthAuto columns.\n// Increase feedback side-effect with widgets relying on WorkRect.Max.x... Maybe provide a default distribution for _WidthAuto columns?\nvoid ImGui::TableUpdateLayout(ImGuiTable* table)\n{\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(table->IsLayoutLocked == false);\n\n    const ImGuiTableFlags table_sizing_policy = (table->Flags & ImGuiTableFlags_SizingMask_);\n    table->IsDefaultDisplayOrder = true;\n    table->ColumnsEnabledCount = 0;\n    table->EnabledMaskByIndex = 0x00;\n    table->EnabledMaskByDisplayOrder = 0x00;\n    table->LeftMostEnabledColumn = -1;\n    table->MinColumnWidth = ImMax(1.0f, g.Style.FramePadding.x * 1.0f); // g.Style.ColumnsMinSpacing; // FIXME-TABLE\n\n    // [Part 1] Apply/lock Enabled and Order states. Calculate auto/ideal width for columns. Count fixed/stretch columns.\n    // Process columns in their visible orders as we are building the Prev/Next indices.\n    int count_fixed = 0;                // Number of columns that have fixed sizing policies\n    int count_stretch = 0;              // Number of columns that have stretch sizing policies\n    int prev_visible_column_idx = -1;\n    bool has_auto_fit_request = false;\n    bool has_resizable = false;\n    float stretch_sum_width_auto = 0.0f;\n    float fixed_max_width_auto = 0.0f;\n    for (int order_n = 0; order_n < table->ColumnsCount; order_n++)\n    {\n        const int column_n = table->DisplayOrderToIndex[order_n];\n        if (column_n != order_n)\n            table->IsDefaultDisplayOrder = false;\n        ImGuiTableColumn* column = &table->Columns[column_n];\n\n        // Clear column setup if not submitted by user. Currently we make it mandatory to call TableSetupColumn() every frame.\n        // It would easily work without but we're not ready to guarantee it since e.g. names need resubmission anyway.\n        // We take a slight shortcut but in theory we could be calling TableSetupColumn() here with dummy values, it should yield the same effect.\n        if (table->DeclColumnsCount <= column_n)\n        {\n            TableSetupColumnFlags(table, column, ImGuiTableColumnFlags_None);\n            column->NameOffset = -1;\n            column->UserID = 0;\n            column->InitStretchWeightOrWidth = -1.0f;\n        }\n\n        // Update Enabled state, mark settings and sort specs dirty\n        if (!(table->Flags & ImGuiTableFlags_Hideable) || (column->Flags & ImGuiTableColumnFlags_NoHide))\n            column->IsUserEnabledNextFrame = true;\n        if (column->IsUserEnabled != column->IsUserEnabledNextFrame)\n        {\n            column->IsUserEnabled = column->IsUserEnabledNextFrame;\n            table->IsSettingsDirty = true;\n        }\n        column->IsEnabled = column->IsUserEnabled && (column->Flags & ImGuiTableColumnFlags_Disabled) == 0;\n\n        if (column->SortOrder != -1 && !column->IsEnabled)\n            table->IsSortSpecsDirty = true;\n        if (column->SortOrder > 0 && !(table->Flags & ImGuiTableFlags_SortMulti))\n            table->IsSortSpecsDirty = true;\n\n        // Auto-fit unsized columns\n        const bool start_auto_fit = (column->Flags & ImGuiTableColumnFlags_WidthFixed) ? (column->WidthRequest < 0.0f) : (column->StretchWeight < 0.0f);\n        if (start_auto_fit)\n            column->AutoFitQueue = column->CannotSkipItemsQueue = (1 << 3) - 1; // Fit for three frames\n\n        if (!column->IsEnabled)\n        {\n            column->IndexWithinEnabledSet = -1;\n            continue;\n        }\n\n        // Mark as enabled and link to previous/next enabled column\n        column->PrevEnabledColumn = (ImGuiTableColumnIdx)prev_visible_column_idx;\n        column->NextEnabledColumn = -1;\n        if (prev_visible_column_idx != -1)\n            table->Columns[prev_visible_column_idx].NextEnabledColumn = (ImGuiTableColumnIdx)column_n;\n        else\n            table->LeftMostEnabledColumn = (ImGuiTableColumnIdx)column_n;\n        column->IndexWithinEnabledSet = table->ColumnsEnabledCount++;\n        table->EnabledMaskByIndex |= (ImU64)1 << column_n;\n        table->EnabledMaskByDisplayOrder |= (ImU64)1 << column->DisplayOrder;\n        prev_visible_column_idx = column_n;\n        IM_ASSERT(column->IndexWithinEnabledSet <= column->DisplayOrder);\n\n        // Calculate ideal/auto column width (that's the width required for all contents to be visible without clipping)\n        // Combine width from regular rows + width from headers unless requested not to.\n        if (!column->IsPreserveWidthAuto)\n            column->WidthAuto = TableGetColumnWidthAuto(table, column);\n\n        // Non-resizable columns keep their requested width (apply user value regardless of IsPreserveWidthAuto)\n        const bool column_is_resizable = (column->Flags & ImGuiTableColumnFlags_NoResize) == 0;\n        if (column_is_resizable)\n            has_resizable = true;\n        if ((column->Flags & ImGuiTableColumnFlags_WidthFixed) && column->InitStretchWeightOrWidth > 0.0f && !column_is_resizable)\n            column->WidthAuto = column->InitStretchWeightOrWidth;\n\n        if (column->AutoFitQueue != 0x00)\n            has_auto_fit_request = true;\n        if (column->Flags & ImGuiTableColumnFlags_WidthStretch)\n        {\n            stretch_sum_width_auto += column->WidthAuto;\n            count_stretch++;\n        }\n        else\n        {\n            fixed_max_width_auto = ImMax(fixed_max_width_auto, column->WidthAuto);\n            count_fixed++;\n        }\n    }\n    if ((table->Flags & ImGuiTableFlags_Sortable) && table->SortSpecsCount == 0 && !(table->Flags & ImGuiTableFlags_SortTristate))\n        table->IsSortSpecsDirty = true;\n    table->RightMostEnabledColumn = (ImGuiTableColumnIdx)prev_visible_column_idx;\n    IM_ASSERT(table->LeftMostEnabledColumn >= 0 && table->RightMostEnabledColumn >= 0);\n\n    // [Part 2] Disable child window clipping while fitting columns. This is not strictly necessary but makes it possible\n    // to avoid the column fitting having to wait until the first visible frame of the child container (may or not be a good thing).\n    // FIXME-TABLE: for always auto-resizing columns may not want to do that all the time.\n    if (has_auto_fit_request && table->OuterWindow != table->InnerWindow)\n        table->InnerWindow->SkipItems = false;\n    if (has_auto_fit_request)\n        table->IsSettingsDirty = true;\n\n    // [Part 3] Fix column flags and record a few extra information.\n    float sum_width_requests = 0.0f;        // Sum of all width for fixed and auto-resize columns, excluding width contributed by Stretch columns but including spacing/padding.\n    float stretch_sum_weights = 0.0f;       // Sum of all weights for stretch columns.\n    table->LeftMostStretchedColumn = table->RightMostStretchedColumn = -1;\n    for (int column_n = 0; column_n < table->ColumnsCount; column_n++)\n    {\n        if (!(table->EnabledMaskByIndex & ((ImU64)1 << column_n)))\n            continue;\n        ImGuiTableColumn* column = &table->Columns[column_n];\n\n        const bool column_is_resizable = (column->Flags & ImGuiTableColumnFlags_NoResize) == 0;\n        if (column->Flags & ImGuiTableColumnFlags_WidthFixed)\n        {\n            // Apply same widths policy\n            float width_auto = column->WidthAuto;\n            if (table_sizing_policy == ImGuiTableFlags_SizingFixedSame && (column->AutoFitQueue != 0x00 || !column_is_resizable))\n                width_auto = fixed_max_width_auto;\n\n            // Apply automatic width\n            // Latch initial size for fixed columns and update it constantly for auto-resizing column (unless clipped!)\n            if (column->AutoFitQueue != 0x00)\n                column->WidthRequest = width_auto;\n            else if ((column->Flags & ImGuiTableColumnFlags_WidthFixed) && !column_is_resizable && (table->RequestOutputMaskByIndex & ((ImU64)1 << column_n)))\n                column->WidthRequest = width_auto;\n\n            // FIXME-TABLE: Increase minimum size during init frame to avoid biasing auto-fitting widgets\n            // (e.g. TextWrapped) too much. Otherwise what tends to happen is that TextWrapped would output a very\n            // large height (= first frame scrollbar display very off + clipper would skip lots of items).\n            // This is merely making the side-effect less extreme, but doesn't properly fixes it.\n            // FIXME: Move this to ->WidthGiven to avoid temporary lossyless?\n            // FIXME: This break IsPreserveWidthAuto from not flickering if the stored WidthAuto was smaller.\n            if (column->AutoFitQueue > 0x01 && table->IsInitializing && !column->IsPreserveWidthAuto)\n                column->WidthRequest = ImMax(column->WidthRequest, table->MinColumnWidth * 4.0f); // FIXME-TABLE: Another constant/scale?\n            sum_width_requests += column->WidthRequest;\n        }\n        else\n        {\n            // Initialize stretch weight\n            if (column->AutoFitQueue != 0x00 || column->StretchWeight < 0.0f || !column_is_resizable)\n            {\n                if (column->InitStretchWeightOrWidth > 0.0f)\n                    column->StretchWeight = column->InitStretchWeightOrWidth;\n                else if (table_sizing_policy == ImGuiTableFlags_SizingStretchProp)\n                    column->StretchWeight = (column->WidthAuto / stretch_sum_width_auto) * count_stretch;\n                else\n                    column->StretchWeight = 1.0f;\n            }\n\n            stretch_sum_weights += column->StretchWeight;\n            if (table->LeftMostStretchedColumn == -1 || table->Columns[table->LeftMostStretchedColumn].DisplayOrder > column->DisplayOrder)\n                table->LeftMostStretchedColumn = (ImGuiTableColumnIdx)column_n;\n            if (table->RightMostStretchedColumn == -1 || table->Columns[table->RightMostStretchedColumn].DisplayOrder < column->DisplayOrder)\n                table->RightMostStretchedColumn = (ImGuiTableColumnIdx)column_n;\n        }\n        column->IsPreserveWidthAuto = false;\n        sum_width_requests += table->CellPaddingX * 2.0f;\n    }\n    table->ColumnsEnabledFixedCount = (ImGuiTableColumnIdx)count_fixed;\n\n    // [Part 4] Apply final widths based on requested widths\n    const ImRect work_rect = table->WorkRect;\n    const float width_spacings = (table->OuterPaddingX * 2.0f) + (table->CellSpacingX1 + table->CellSpacingX2) * (table->ColumnsEnabledCount - 1);\n    const float width_avail = ((table->Flags & ImGuiTableFlags_ScrollX) && table->InnerWidth == 0.0f) ? table->InnerClipRect.GetWidth() : work_rect.GetWidth();\n    const float width_avail_for_stretched_columns = width_avail - width_spacings - sum_width_requests;\n    float width_remaining_for_stretched_columns = width_avail_for_stretched_columns;\n    table->ColumnsGivenWidth = width_spacings + (table->CellPaddingX * 2.0f) * table->ColumnsEnabledCount;\n    for (int column_n = 0; column_n < table->ColumnsCount; column_n++)\n    {\n        if (!(table->EnabledMaskByIndex & ((ImU64)1 << column_n)))\n            continue;\n        ImGuiTableColumn* column = &table->Columns[column_n];\n\n        // Allocate width for stretched/weighted columns (StretchWeight gets converted into WidthRequest)\n        if (column->Flags & ImGuiTableColumnFlags_WidthStretch)\n        {\n            float weight_ratio = column->StretchWeight / stretch_sum_weights;\n            column->WidthRequest = IM_FLOOR(ImMax(width_avail_for_stretched_columns * weight_ratio, table->MinColumnWidth) + 0.01f);\n            width_remaining_for_stretched_columns -= column->WidthRequest;\n        }\n\n        // [Resize Rule 1] The right-most Visible column is not resizable if there is at least one Stretch column\n        // See additional comments in TableSetColumnWidth().\n        if (column->NextEnabledColumn == -1 && table->LeftMostStretchedColumn != -1)\n            column->Flags |= ImGuiTableColumnFlags_NoDirectResize_;\n\n        // Assign final width, record width in case we will need to shrink\n        column->WidthGiven = ImFloor(ImMax(column->WidthRequest, table->MinColumnWidth));\n        table->ColumnsGivenWidth += column->WidthGiven;\n    }\n\n    // [Part 5] Redistribute stretch remainder width due to rounding (remainder width is < 1.0f * number of Stretch column).\n    // Using right-to-left distribution (more likely to match resizing cursor).\n    if (width_remaining_for_stretched_columns >= 1.0f && !(table->Flags & ImGuiTableFlags_PreciseWidths))\n        for (int order_n = table->ColumnsCount - 1; stretch_sum_weights > 0.0f && width_remaining_for_stretched_columns >= 1.0f && order_n >= 0; order_n--)\n        {\n            if (!(table->EnabledMaskByDisplayOrder & ((ImU64)1 << order_n)))\n                continue;\n            ImGuiTableColumn* column = &table->Columns[table->DisplayOrderToIndex[order_n]];\n            if (!(column->Flags & ImGuiTableColumnFlags_WidthStretch))\n                continue;\n            column->WidthRequest += 1.0f;\n            column->WidthGiven += 1.0f;\n            width_remaining_for_stretched_columns -= 1.0f;\n        }\n\n    table->HoveredColumnBody = -1;\n    table->HoveredColumnBorder = -1;\n    const ImRect mouse_hit_rect(table->OuterRect.Min.x, table->OuterRect.Min.y, table->OuterRect.Max.x, ImMax(table->OuterRect.Max.y, table->OuterRect.Min.y + table->LastOuterHeight));\n    const bool is_hovering_table = ItemHoverable(mouse_hit_rect, 0);\n\n    // [Part 6] Setup final position, offset, skip/clip states and clipping rectangles, detect hovered column\n    // Process columns in their visible orders as we are comparing the visible order and adjusting host_clip_rect while looping.\n    int visible_n = 0;\n    bool offset_x_frozen = (table->FreezeColumnsCount > 0);\n    float offset_x = ((table->FreezeColumnsCount > 0) ? table->OuterRect.Min.x : work_rect.Min.x) + table->OuterPaddingX - table->CellSpacingX1;\n    ImRect host_clip_rect = table->InnerClipRect;\n    //host_clip_rect.Max.x += table->CellPaddingX + table->CellSpacingX2;\n    table->VisibleMaskByIndex = 0x00;\n    table->RequestOutputMaskByIndex = 0x00;\n    for (int order_n = 0; order_n < table->ColumnsCount; order_n++)\n    {\n        const int column_n = table->DisplayOrderToIndex[order_n];\n        ImGuiTableColumn* column = &table->Columns[column_n];\n\n        column->NavLayerCurrent = (ImS8)((table->FreezeRowsCount > 0 || column_n < table->FreezeColumnsCount) ? ImGuiNavLayer_Menu : ImGuiNavLayer_Main);\n\n        if (offset_x_frozen && table->FreezeColumnsCount == visible_n)\n        {\n            offset_x += work_rect.Min.x - table->OuterRect.Min.x;\n            offset_x_frozen = false;\n        }\n\n        // Clear status flags\n        column->Flags &= ~ImGuiTableColumnFlags_StatusMask_;\n\n        if ((table->EnabledMaskByDisplayOrder & ((ImU64)1 << order_n)) == 0)\n        {\n            // Hidden column: clear a few fields and we are done with it for the remainder of the function.\n            // We set a zero-width clip rect but set Min.y/Max.y properly to not interfere with the clipper.\n            column->MinX = column->MaxX = column->WorkMinX = column->ClipRect.Min.x = column->ClipRect.Max.x = offset_x;\n            column->WidthGiven = 0.0f;\n            column->ClipRect.Min.y = work_rect.Min.y;\n            column->ClipRect.Max.y = FLT_MAX;\n            column->ClipRect.ClipWithFull(host_clip_rect);\n            column->IsVisibleX = column->IsVisibleY = column->IsRequestOutput = false;\n            column->IsSkipItems = true;\n            column->ItemWidth = 1.0f;\n            continue;\n        }\n\n        // Detect hovered column\n        if (is_hovering_table && g.IO.MousePos.x >= column->ClipRect.Min.x && g.IO.MousePos.x < column->ClipRect.Max.x)\n            table->HoveredColumnBody = (ImGuiTableColumnIdx)column_n;\n\n        // Lock start position\n        column->MinX = offset_x;\n\n        // Lock width based on start position and minimum/maximum width for this position\n        float max_width = TableGetMaxColumnWidth(table, column_n);\n        column->WidthGiven = ImMin(column->WidthGiven, max_width);\n        column->WidthGiven = ImMax(column->WidthGiven, ImMin(column->WidthRequest, table->MinColumnWidth));\n        column->MaxX = offset_x + column->WidthGiven + table->CellSpacingX1 + table->CellSpacingX2 + table->CellPaddingX * 2.0f;\n\n        // Lock other positions\n        // - ClipRect.Min.x: Because merging draw commands doesn't compare min boundaries, we make ClipRect.Min.x match left bounds to be consistent regardless of merging.\n        // - ClipRect.Max.x: using WorkMaxX instead of MaxX (aka including padding) makes things more consistent when resizing down, tho slightly detrimental to visibility in very-small column.\n        // - ClipRect.Max.x: using MaxX makes it easier for header to receive hover highlight with no discontinuity and display sorting arrow.\n        // - FIXME-TABLE: We want equal width columns to have equal (ClipRect.Max.x - WorkMinX) width, which means ClipRect.max.x cannot stray off host_clip_rect.Max.x else right-most column may appear shorter.\n        column->WorkMinX = column->MinX + table->CellPaddingX + table->CellSpacingX1;\n        column->WorkMaxX = column->MaxX - table->CellPaddingX - table->CellSpacingX2; // Expected max\n        column->ItemWidth = ImFloor(column->WidthGiven * 0.65f);\n        column->ClipRect.Min.x = column->MinX;\n        column->ClipRect.Min.y = work_rect.Min.y;\n        column->ClipRect.Max.x = column->MaxX; //column->WorkMaxX;\n        column->ClipRect.Max.y = FLT_MAX;\n        column->ClipRect.ClipWithFull(host_clip_rect);\n\n        // Mark column as Clipped (not in sight)\n        // Note that scrolling tables (where inner_window != outer_window) handle Y clipped earlier in BeginTable() so IsVisibleY really only applies to non-scrolling tables.\n        // FIXME-TABLE: Because InnerClipRect.Max.y is conservatively ==outer_window->ClipRect.Max.y, we never can mark columns _Above_ the scroll line as not IsVisibleY.\n        // Taking advantage of LastOuterHeight would yield good results there...\n        // FIXME-TABLE: Y clipping is disabled because it effectively means not submitting will reduce contents width which is fed to outer_window->DC.CursorMaxPos.x,\n        // and this may be used (e.g. typically by outer_window using AlwaysAutoResize or outer_window's horizontal scrollbar, but could be something else).\n        // Possible solution to preserve last known content width for clipped column. Test 'table_reported_size' fails when enabling Y clipping and window is resized small.\n        column->IsVisibleX = (column->ClipRect.Max.x > column->ClipRect.Min.x);\n        column->IsVisibleY = true; // (column->ClipRect.Max.y > column->ClipRect.Min.y);\n        const bool is_visible = column->IsVisibleX; //&& column->IsVisibleY;\n        if (is_visible)\n            table->VisibleMaskByIndex |= ((ImU64)1 << column_n);\n\n        // Mark column as requesting output from user. Note that fixed + non-resizable sets are auto-fitting at all times and therefore always request output.\n        column->IsRequestOutput = is_visible || column->AutoFitQueue != 0 || column->CannotSkipItemsQueue != 0;\n        if (column->IsRequestOutput)\n            table->RequestOutputMaskByIndex |= ((ImU64)1 << column_n);\n\n        // Mark column as SkipItems (ignoring all items/layout)\n        column->IsSkipItems = !column->IsEnabled || table->HostSkipItems;\n        if (column->IsSkipItems)\n            IM_ASSERT(!is_visible);\n\n        // Update status flags\n        column->Flags |= ImGuiTableColumnFlags_IsEnabled;\n        if (is_visible)\n            column->Flags |= ImGuiTableColumnFlags_IsVisible;\n        if (column->SortOrder != -1)\n            column->Flags |= ImGuiTableColumnFlags_IsSorted;\n        if (table->HoveredColumnBody == column_n)\n            column->Flags |= ImGuiTableColumnFlags_IsHovered;\n\n        // Alignment\n        // FIXME-TABLE: This align based on the whole column width, not per-cell, and therefore isn't useful in\n        // many cases (to be able to honor this we might be able to store a log of cells width, per row, for\n        // visible rows, but nav/programmatic scroll would have visible artifacts.)\n        //if (column->Flags & ImGuiTableColumnFlags_AlignRight)\n        //    column->WorkMinX = ImMax(column->WorkMinX, column->MaxX - column->ContentWidthRowsUnfrozen);\n        //else if (column->Flags & ImGuiTableColumnFlags_AlignCenter)\n        //    column->WorkMinX = ImLerp(column->WorkMinX, ImMax(column->StartX, column->MaxX - column->ContentWidthRowsUnfrozen), 0.5f);\n\n        // Reset content width variables\n        column->ContentMaxXFrozen = column->ContentMaxXUnfrozen = column->WorkMinX;\n        column->ContentMaxXHeadersUsed = column->ContentMaxXHeadersIdeal = column->WorkMinX;\n\n        // Don't decrement auto-fit counters until container window got a chance to submit its items\n        if (table->HostSkipItems == false)\n        {\n            column->AutoFitQueue >>= 1;\n            column->CannotSkipItemsQueue >>= 1;\n        }\n\n        if (visible_n < table->FreezeColumnsCount)\n            host_clip_rect.Min.x = ImClamp(column->MaxX + TABLE_BORDER_SIZE, host_clip_rect.Min.x, host_clip_rect.Max.x);\n\n        offset_x += column->WidthGiven + table->CellSpacingX1 + table->CellSpacingX2 + table->CellPaddingX * 2.0f;\n        visible_n++;\n    }\n\n    // [Part 7] Detect/store when we are hovering the unused space after the right-most column (so e.g. context menus can react on it)\n    // Clear Resizable flag if none of our column are actually resizable (either via an explicit _NoResize flag, either\n    // because of using _WidthAuto/_WidthStretch). This will hide the resizing option from the context menu.\n    const float unused_x1 = ImMax(table->WorkRect.Min.x, table->Columns[table->RightMostEnabledColumn].ClipRect.Max.x);\n    if (is_hovering_table && table->HoveredColumnBody == -1)\n    {\n        if (g.IO.MousePos.x >= unused_x1)\n            table->HoveredColumnBody = (ImGuiTableColumnIdx)table->ColumnsCount;\n    }\n    if (has_resizable == false && (table->Flags & ImGuiTableFlags_Resizable))\n        table->Flags &= ~ImGuiTableFlags_Resizable;\n\n    // [Part 8] Lock actual OuterRect/WorkRect right-most position.\n    // This is done late to handle the case of fixed-columns tables not claiming more widths that they need.\n    // Because of this we are careful with uses of WorkRect and InnerClipRect before this point.\n    if (table->RightMostStretchedColumn != -1)\n        table->Flags &= ~ImGuiTableFlags_NoHostExtendX;\n    if (table->Flags & ImGuiTableFlags_NoHostExtendX)\n    {\n        table->OuterRect.Max.x = table->WorkRect.Max.x = unused_x1;\n        table->InnerClipRect.Max.x = ImMin(table->InnerClipRect.Max.x, unused_x1);\n    }\n    table->InnerWindow->ParentWorkRect = table->WorkRect;\n    table->BorderX1 = table->InnerClipRect.Min.x;// +((table->Flags & ImGuiTableFlags_BordersOuter) ? 0.0f : -1.0f);\n    table->BorderX2 = table->InnerClipRect.Max.x;// +((table->Flags & ImGuiTableFlags_BordersOuter) ? 0.0f : +1.0f);\n\n    // [Part 9] Allocate draw channels and setup background cliprect\n    TableSetupDrawChannels(table);\n\n    // [Part 10] Hit testing on borders\n    if (table->Flags & ImGuiTableFlags_Resizable)\n        TableUpdateBorders(table);\n    table->LastFirstRowHeight = 0.0f;\n    table->IsLayoutLocked = true;\n    table->IsUsingHeaders = false;\n\n    // [Part 11] Context menu\n    if (table->IsContextPopupOpen && table->InstanceCurrent == table->InstanceInteracted)\n    {\n        const ImGuiID context_menu_id = ImHashStr(\"##ContextMenu\", 0, table->ID);\n        if (BeginPopupEx(context_menu_id, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoSavedSettings))\n        {\n            TableDrawContextMenu(table);\n            EndPopup();\n        }\n        else\n        {\n            table->IsContextPopupOpen = false;\n        }\n    }\n\n    // [Part 13] Sanitize and build sort specs before we have a change to use them for display.\n    // This path will only be exercised when sort specs are modified before header rows (e.g. init or visibility change)\n    if (table->IsSortSpecsDirty && (table->Flags & ImGuiTableFlags_Sortable))\n        TableSortSpecsBuild(table);\n\n    // Initial state\n    ImGuiWindow* inner_window = table->InnerWindow;\n    if (table->Flags & ImGuiTableFlags_NoClip)\n        table->DrawSplitter->SetCurrentChannel(inner_window->DrawList, TABLE_DRAW_CHANNEL_NOCLIP);\n    else\n        inner_window->DrawList->PushClipRect(inner_window->ClipRect.Min, inner_window->ClipRect.Max, false);\n}\n\n// Process hit-testing on resizing borders. Actual size change will be applied in EndTable()\n// - Set table->HoveredColumnBorder with a short delay/timer to reduce feedback noise\n// - Submit ahead of table contents and header, use ImGuiButtonFlags_AllowItemOverlap to prioritize widgets\n//   overlapping the same area.\nvoid ImGui::TableUpdateBorders(ImGuiTable* table)\n{\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(table->Flags & ImGuiTableFlags_Resizable);\n\n    // At this point OuterRect height may be zero or under actual final height, so we rely on temporal coherency and\n    // use the final height from last frame. Because this is only affecting _interaction_ with columns, it is not\n    // really problematic (whereas the actual visual will be displayed in EndTable() and using the current frame height).\n    // Actual columns highlight/render will be performed in EndTable() and not be affected.\n    const float hit_half_width = TABLE_RESIZE_SEPARATOR_HALF_THICKNESS;\n    const float hit_y1 = table->OuterRect.Min.y;\n    const float hit_y2_body = ImMax(table->OuterRect.Max.y, hit_y1 + table->LastOuterHeight);\n    const float hit_y2_head = hit_y1 + table->LastFirstRowHeight;\n\n    for (int order_n = 0; order_n < table->ColumnsCount; order_n++)\n    {\n        if (!(table->EnabledMaskByDisplayOrder & ((ImU64)1 << order_n)))\n            continue;\n\n        const int column_n = table->DisplayOrderToIndex[order_n];\n        ImGuiTableColumn* column = &table->Columns[column_n];\n        if (column->Flags & (ImGuiTableColumnFlags_NoResize | ImGuiTableColumnFlags_NoDirectResize_))\n            continue;\n\n        // ImGuiTableFlags_NoBordersInBodyUntilResize will be honored in TableDrawBorders()\n        const float border_y2_hit = (table->Flags & ImGuiTableFlags_NoBordersInBody) ? hit_y2_head : hit_y2_body;\n        if ((table->Flags & ImGuiTableFlags_NoBordersInBody) && table->IsUsingHeaders == false)\n            continue;\n\n        if (!column->IsVisibleX && table->LastResizedColumn != column_n)\n            continue;\n\n        ImGuiID column_id = TableGetColumnResizeID(table, column_n, table->InstanceCurrent);\n        ImRect hit_rect(column->MaxX - hit_half_width, hit_y1, column->MaxX + hit_half_width, border_y2_hit);\n        //GetForegroundDrawList()->AddRect(hit_rect.Min, hit_rect.Max, IM_COL32(255, 0, 0, 100));\n        KeepAliveID(column_id);\n\n        bool hovered = false, held = false;\n        bool pressed = ButtonBehavior(hit_rect, column_id, &hovered, &held, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_AllowItemOverlap | ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_PressedOnDoubleClick);\n        if (pressed && IsMouseDoubleClicked(0))\n        {\n            TableSetColumnWidthAutoSingle(table, column_n);\n            ClearActiveID();\n            held = hovered = false;\n        }\n        if (held)\n        {\n            if (table->LastResizedColumn == -1)\n                table->ResizeLockMinContentsX2 = table->RightMostEnabledColumn != -1 ? table->Columns[table->RightMostEnabledColumn].MaxX : -FLT_MAX;\n            table->ResizedColumn = (ImGuiTableColumnIdx)column_n;\n            table->InstanceInteracted = table->InstanceCurrent;\n        }\n        if ((hovered && g.HoveredIdTimer > TABLE_RESIZE_SEPARATOR_FEEDBACK_TIMER) || held)\n        {\n            table->HoveredColumnBorder = (ImGuiTableColumnIdx)column_n;\n            SetMouseCursor(ImGuiMouseCursor_ResizeEW);\n        }\n    }\n}\n\nvoid    ImGui::EndTable()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiTable* table = g.CurrentTable;\n    IM_ASSERT(table != NULL && \"Only call EndTable() if BeginTable() returns true!\");\n\n    // This assert would be very useful to catch a common error... unfortunately it would probably trigger in some\n    // cases, and for consistency user may sometimes output empty tables (and still benefit from e.g. outer border)\n    //IM_ASSERT(table->IsLayoutLocked && \"Table unused: never called TableNextRow(), is that the intent?\");\n\n    // If the user never got to call TableNextRow() or TableNextColumn(), we call layout ourselves to ensure all our\n    // code paths are consistent (instead of just hoping that TableBegin/TableEnd will work), get borders drawn, etc.\n    if (!table->IsLayoutLocked)\n        TableUpdateLayout(table);\n\n    const ImGuiTableFlags flags = table->Flags;\n    ImGuiWindow* inner_window = table->InnerWindow;\n    ImGuiWindow* outer_window = table->OuterWindow;\n    ImGuiTableTempData* temp_data = table->TempData;\n    IM_ASSERT(inner_window == g.CurrentWindow);\n    IM_ASSERT(outer_window == inner_window || outer_window == inner_window->ParentWindow);\n\n    if (table->IsInsideRow)\n        TableEndRow(table);\n\n    // Context menu in columns body\n    if (flags & ImGuiTableFlags_ContextMenuInBody)\n        if (table->HoveredColumnBody != -1 && !IsAnyItemHovered() && IsMouseReleased(ImGuiMouseButton_Right))\n            TableOpenContextMenu((int)table->HoveredColumnBody);\n\n    // Finalize table height\n    inner_window->DC.PrevLineSize = temp_data->HostBackupPrevLineSize;\n    inner_window->DC.CurrLineSize = temp_data->HostBackupCurrLineSize;\n    inner_window->DC.CursorMaxPos = temp_data->HostBackupCursorMaxPos;\n    const float inner_content_max_y = table->RowPosY2;\n    IM_ASSERT(table->RowPosY2 == inner_window->DC.CursorPos.y);\n    if (inner_window != outer_window)\n        inner_window->DC.CursorMaxPos.y = inner_content_max_y;\n    else if (!(flags & ImGuiTableFlags_NoHostExtendY))\n        table->OuterRect.Max.y = table->InnerRect.Max.y = ImMax(table->OuterRect.Max.y, inner_content_max_y); // Patch OuterRect/InnerRect height\n    table->WorkRect.Max.y = ImMax(table->WorkRect.Max.y, table->OuterRect.Max.y);\n    table->LastOuterHeight = table->OuterRect.GetHeight();\n\n    // Setup inner scrolling range\n    // FIXME: This ideally should be done earlier, in BeginTable() SetNextWindowContentSize call, just like writing to inner_window->DC.CursorMaxPos.y,\n    // but since the later is likely to be impossible to do we'd rather update both axises together.\n    if (table->Flags & ImGuiTableFlags_ScrollX)\n    {\n        const float outer_padding_for_border = (table->Flags & ImGuiTableFlags_BordersOuterV) ? TABLE_BORDER_SIZE : 0.0f;\n        float max_pos_x = table->InnerWindow->DC.CursorMaxPos.x;\n        if (table->RightMostEnabledColumn != -1)\n            max_pos_x = ImMax(max_pos_x, table->Columns[table->RightMostEnabledColumn].WorkMaxX + table->CellPaddingX + table->OuterPaddingX - outer_padding_for_border);\n        if (table->ResizedColumn != -1)\n            max_pos_x = ImMax(max_pos_x, table->ResizeLockMinContentsX2);\n        table->InnerWindow->DC.CursorMaxPos.x = max_pos_x;\n    }\n\n    // Pop clipping rect\n    if (!(flags & ImGuiTableFlags_NoClip))\n        inner_window->DrawList->PopClipRect();\n    inner_window->ClipRect = inner_window->DrawList->_ClipRectStack.back();\n\n    // Draw borders\n    if ((flags & ImGuiTableFlags_Borders) != 0)\n        TableDrawBorders(table);\n\n#if 0\n    // Strip out dummy channel draw calls\n    // We have no way to prevent user submitting direct ImDrawList calls into a hidden column (but ImGui:: calls will be clipped out)\n    // Pros: remove draw calls which will have no effect. since they'll have zero-size cliprect they may be early out anyway.\n    // Cons: making it harder for users watching metrics/debugger to spot the wasted vertices.\n    if (table->DummyDrawChannel != (ImGuiTableColumnIdx)-1)\n    {\n        ImDrawChannel* dummy_channel = &table->DrawSplitter._Channels[table->DummyDrawChannel];\n        dummy_channel->_CmdBuffer.resize(0);\n        dummy_channel->_IdxBuffer.resize(0);\n    }\n#endif\n\n    // Flatten channels and merge draw calls\n    ImDrawListSplitter* splitter = table->DrawSplitter;\n    splitter->SetCurrentChannel(inner_window->DrawList, 0);\n    if ((table->Flags & ImGuiTableFlags_NoClip) == 0)\n        TableMergeDrawChannels(table);\n    splitter->Merge(inner_window->DrawList);\n\n    // Update ColumnsAutoFitWidth to get us ahead for host using our size to auto-resize without waiting for next BeginTable()\n    const float width_spacings = (table->OuterPaddingX * 2.0f) + (table->CellSpacingX1 + table->CellSpacingX2) * (table->ColumnsEnabledCount - 1);\n    table->ColumnsAutoFitWidth = width_spacings + (table->CellPaddingX * 2.0f) * table->ColumnsEnabledCount;\n    for (int column_n = 0; column_n < table->ColumnsCount; column_n++)\n        if (table->EnabledMaskByIndex & ((ImU64)1 << column_n))\n        {\n            ImGuiTableColumn* column = &table->Columns[column_n];\n            if ((column->Flags & ImGuiTableColumnFlags_WidthFixed) && !(column->Flags & ImGuiTableColumnFlags_NoResize))\n                table->ColumnsAutoFitWidth += column->WidthRequest;\n            else\n                table->ColumnsAutoFitWidth += TableGetColumnWidthAuto(table, column);\n        }\n\n    // Update scroll\n    if ((table->Flags & ImGuiTableFlags_ScrollX) == 0 && inner_window != outer_window)\n    {\n        inner_window->Scroll.x = 0.0f;\n    }\n    else if (table->LastResizedColumn != -1 && table->ResizedColumn == -1 && inner_window->ScrollbarX && table->InstanceInteracted == table->InstanceCurrent)\n    {\n        // When releasing a column being resized, scroll to keep the resulting column in sight\n        const float neighbor_width_to_keep_visible = table->MinColumnWidth + table->CellPaddingX * 2.0f;\n        ImGuiTableColumn* column = &table->Columns[table->LastResizedColumn];\n        if (column->MaxX < table->InnerClipRect.Min.x)\n            SetScrollFromPosX(inner_window, column->MaxX - inner_window->Pos.x - neighbor_width_to_keep_visible, 1.0f);\n        else if (column->MaxX > table->InnerClipRect.Max.x)\n            SetScrollFromPosX(inner_window, column->MaxX - inner_window->Pos.x + neighbor_width_to_keep_visible, 1.0f);\n    }\n\n    // Apply resizing/dragging at the end of the frame\n    if (table->ResizedColumn != -1 && table->InstanceCurrent == table->InstanceInteracted)\n    {\n        ImGuiTableColumn* column = &table->Columns[table->ResizedColumn];\n        const float new_x2 = (g.IO.MousePos.x - g.ActiveIdClickOffset.x + TABLE_RESIZE_SEPARATOR_HALF_THICKNESS);\n        const float new_width = ImFloor(new_x2 - column->MinX - table->CellSpacingX1 - table->CellPaddingX * 2.0f);\n        table->ResizedColumnNextWidth = new_width;\n    }\n\n    // Pop from id stack\n    IM_ASSERT_USER_ERROR(inner_window->IDStack.back() == table->ID + table->InstanceCurrent, \"Mismatching PushID/PopID!\");\n    IM_ASSERT_USER_ERROR(outer_window->DC.ItemWidthStack.Size >= temp_data->HostBackupItemWidthStackSize, \"Too many PopItemWidth!\");\n    PopID();\n\n    // Restore window data that we modified\n    const ImVec2 backup_outer_max_pos = outer_window->DC.CursorMaxPos;\n    inner_window->WorkRect = temp_data->HostBackupWorkRect;\n    inner_window->ParentWorkRect = temp_data->HostBackupParentWorkRect;\n    inner_window->SkipItems = table->HostSkipItems;\n    outer_window->DC.CursorPos = table->OuterRect.Min;\n    outer_window->DC.ItemWidth = temp_data->HostBackupItemWidth;\n    outer_window->DC.ItemWidthStack.Size = temp_data->HostBackupItemWidthStackSize;\n    outer_window->DC.ColumnsOffset = temp_data->HostBackupColumnsOffset;\n\n    // Layout in outer window\n    // (FIXME: To allow auto-fit and allow desirable effect of SameLine() we dissociate 'used' vs 'ideal' size by overriding\n    // CursorPosPrevLine and CursorMaxPos manually. That should be a more general layout feature, see same problem e.g. #3414)\n    if (inner_window != outer_window)\n    {\n        EndChild();\n    }\n    else\n    {\n        ItemSize(table->OuterRect.GetSize());\n        ItemAdd(table->OuterRect, 0);\n    }\n\n    // Override declared contents width/height to enable auto-resize while not needlessly adding a scrollbar\n    if (table->Flags & ImGuiTableFlags_NoHostExtendX)\n    {\n        // FIXME-TABLE: Could we remove this section?\n        // ColumnsAutoFitWidth may be one frame ahead here since for Fixed+NoResize is calculated from latest contents\n        IM_ASSERT((table->Flags & ImGuiTableFlags_ScrollX) == 0);\n        outer_window->DC.CursorMaxPos.x = ImMax(backup_outer_max_pos.x, table->OuterRect.Min.x + table->ColumnsAutoFitWidth);\n    }\n    else if (temp_data->UserOuterSize.x <= 0.0f)\n    {\n        const float decoration_size = (table->Flags & ImGuiTableFlags_ScrollX) ? inner_window->ScrollbarSizes.x : 0.0f;\n        outer_window->DC.IdealMaxPos.x = ImMax(outer_window->DC.IdealMaxPos.x, table->OuterRect.Min.x + table->ColumnsAutoFitWidth + decoration_size - temp_data->UserOuterSize.x);\n        outer_window->DC.CursorMaxPos.x = ImMax(backup_outer_max_pos.x, ImMin(table->OuterRect.Max.x, table->OuterRect.Min.x + table->ColumnsAutoFitWidth));\n    }\n    else\n    {\n        outer_window->DC.CursorMaxPos.x = ImMax(backup_outer_max_pos.x, table->OuterRect.Max.x);\n    }\n    if (temp_data->UserOuterSize.y <= 0.0f)\n    {\n        const float decoration_size = (table->Flags & ImGuiTableFlags_ScrollY) ? inner_window->ScrollbarSizes.y : 0.0f;\n        outer_window->DC.IdealMaxPos.y = ImMax(outer_window->DC.IdealMaxPos.y, inner_content_max_y + decoration_size - temp_data->UserOuterSize.y);\n        outer_window->DC.CursorMaxPos.y = ImMax(backup_outer_max_pos.y, ImMin(table->OuterRect.Max.y, inner_content_max_y));\n    }\n    else\n    {\n        // OuterRect.Max.y may already have been pushed downward from the initial value (unless ImGuiTableFlags_NoHostExtendY is set)\n        outer_window->DC.CursorMaxPos.y = ImMax(backup_outer_max_pos.y, table->OuterRect.Max.y);\n    }\n\n    // Save settings\n    if (table->IsSettingsDirty)\n        TableSaveSettings(table);\n    table->IsInitializing = false;\n\n    // Clear or restore current table, if any\n    IM_ASSERT(g.CurrentWindow == outer_window && g.CurrentTable == table);\n    IM_ASSERT(g.CurrentTableStackIdx >= 0);\n    g.CurrentTableStackIdx--;\n    temp_data = g.CurrentTableStackIdx >= 0 ? &g.TablesTempDataStack[g.CurrentTableStackIdx] : NULL;\n    g.CurrentTable = temp_data ? g.Tables.GetByIndex(temp_data->TableIndex) : NULL;\n    if (g.CurrentTable)\n    {\n        g.CurrentTable->TempData = temp_data;\n        g.CurrentTable->DrawSplitter = &temp_data->DrawSplitter;\n    }\n    outer_window->DC.CurrentTableIdx = g.CurrentTable ? g.Tables.GetIndex(g.CurrentTable) : -1;\n}\n\n// See \"COLUMN SIZING POLICIES\" comments at the top of this file\n// If (init_width_or_weight <= 0.0f) it is ignored\nvoid ImGui::TableSetupColumn(const char* label, ImGuiTableColumnFlags flags, float init_width_or_weight, ImGuiID user_id)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiTable* table = g.CurrentTable;\n    IM_ASSERT(table != NULL && \"Need to call TableSetupColumn() after BeginTable()!\");\n    IM_ASSERT(table->IsLayoutLocked == false && \"Need to call call TableSetupColumn() before first row!\");\n    IM_ASSERT((flags & ImGuiTableColumnFlags_StatusMask_) == 0 && \"Illegal to pass StatusMask values to TableSetupColumn()\");\n    if (table->DeclColumnsCount >= table->ColumnsCount)\n    {\n        IM_ASSERT_USER_ERROR(table->DeclColumnsCount < table->ColumnsCount, \"Called TableSetupColumn() too many times!\");\n        return;\n    }\n\n    ImGuiTableColumn* column = &table->Columns[table->DeclColumnsCount];\n    table->DeclColumnsCount++;\n\n    // Assert when passing a width or weight if policy is entirely left to default, to avoid storing width into weight and vice-versa.\n    // Give a grace to users of ImGuiTableFlags_ScrollX.\n    if (table->IsDefaultSizingPolicy && (flags & ImGuiTableColumnFlags_WidthMask_) == 0 && (flags & ImGuiTableFlags_ScrollX) == 0)\n        IM_ASSERT(init_width_or_weight <= 0.0f && \"Can only specify width/weight if sizing policy is set explicitly in either Table or Column.\");\n\n    // When passing a width automatically enforce WidthFixed policy\n    // (whereas TableSetupColumnFlags would default to WidthAuto if table is not Resizable)\n    if ((flags & ImGuiTableColumnFlags_WidthMask_) == 0 && init_width_or_weight > 0.0f)\n        if ((table->Flags & ImGuiTableFlags_SizingMask_) == ImGuiTableFlags_SizingFixedFit || (table->Flags & ImGuiTableFlags_SizingMask_) == ImGuiTableFlags_SizingFixedSame)\n            flags |= ImGuiTableColumnFlags_WidthFixed;\n\n    TableSetupColumnFlags(table, column, flags);\n    column->UserID = user_id;\n    flags = column->Flags;\n\n    // Initialize defaults\n    column->InitStretchWeightOrWidth = init_width_or_weight;\n    if (table->IsInitializing)\n    {\n        // Init width or weight\n        if (column->WidthRequest < 0.0f && column->StretchWeight < 0.0f)\n        {\n            if ((flags & ImGuiTableColumnFlags_WidthFixed) && init_width_or_weight > 0.0f)\n                column->WidthRequest = init_width_or_weight;\n            if (flags & ImGuiTableColumnFlags_WidthStretch)\n                column->StretchWeight = (init_width_or_weight > 0.0f) ? init_width_or_weight : -1.0f;\n\n            // Disable auto-fit if an explicit width/weight has been specified\n            if (init_width_or_weight > 0.0f)\n                column->AutoFitQueue = 0x00;\n        }\n\n        // Init default visibility/sort state\n        if ((flags & ImGuiTableColumnFlags_DefaultHide) && (table->SettingsLoadedFlags & ImGuiTableFlags_Hideable) == 0)\n            column->IsUserEnabled = column->IsUserEnabledNextFrame = false;\n        if (flags & ImGuiTableColumnFlags_DefaultSort && (table->SettingsLoadedFlags & ImGuiTableFlags_Sortable) == 0)\n        {\n            column->SortOrder = 0; // Multiple columns using _DefaultSort will be reassigned unique SortOrder values when building the sort specs.\n            column->SortDirection = (column->Flags & ImGuiTableColumnFlags_PreferSortDescending) ? (ImS8)ImGuiSortDirection_Descending : (ImU8)(ImGuiSortDirection_Ascending);\n        }\n    }\n\n    // Store name (append with zero-terminator in contiguous buffer)\n    column->NameOffset = -1;\n    if (label != NULL && label[0] != 0)\n    {\n        column->NameOffset = (ImS16)table->ColumnsNames.size();\n        table->ColumnsNames.append(label, label + strlen(label) + 1);\n    }\n}\n\n// [Public]\nvoid ImGui::TableSetupScrollFreeze(int columns, int rows)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiTable* table = g.CurrentTable;\n    IM_ASSERT(table != NULL && \"Need to call TableSetupColumn() after BeginTable()!\");\n    IM_ASSERT(table->IsLayoutLocked == false && \"Need to call TableSetupColumn() before first row!\");\n    IM_ASSERT(columns >= 0 && columns < IMGUI_TABLE_MAX_COLUMNS);\n    IM_ASSERT(rows >= 0 && rows < 128); // Arbitrary limit\n\n    table->FreezeColumnsRequest = (table->Flags & ImGuiTableFlags_ScrollX) ? (ImGuiTableColumnIdx)ImMin(columns, table->ColumnsCount) : 0;\n    table->FreezeColumnsCount = (table->InnerWindow->Scroll.x != 0.0f) ? table->FreezeColumnsRequest : 0;\n    table->FreezeRowsRequest = (table->Flags & ImGuiTableFlags_ScrollY) ? (ImGuiTableColumnIdx)rows : 0;\n    table->FreezeRowsCount = (table->InnerWindow->Scroll.y != 0.0f) ? table->FreezeRowsRequest : 0;\n    table->IsUnfrozenRows = (table->FreezeRowsCount == 0); // Make sure this is set before TableUpdateLayout() so ImGuiListClipper can benefit from it.b\n\n    // Ensure frozen columns are ordered in their section. We still allow multiple frozen columns to be reordered.\n    for (int column_n = 0; column_n < table->FreezeColumnsRequest; column_n++)\n    {\n        int order_n = table->DisplayOrderToIndex[column_n];\n        if (order_n != column_n && order_n >= table->FreezeColumnsRequest)\n        {\n            ImSwap(table->Columns[table->DisplayOrderToIndex[order_n]].DisplayOrder, table->Columns[table->DisplayOrderToIndex[column_n]].DisplayOrder);\n            ImSwap(table->DisplayOrderToIndex[order_n], table->DisplayOrderToIndex[column_n]);\n        }\n    }\n}\n\n//-----------------------------------------------------------------------------\n// [SECTION] Tables: Simple accessors\n//-----------------------------------------------------------------------------\n// - TableGetColumnCount()\n// - TableGetColumnName()\n// - TableGetColumnName() [Internal]\n// - TableSetColumnEnabled()\n// - TableGetColumnFlags()\n// - TableGetCellBgRect() [Internal]\n// - TableGetColumnResizeID() [Internal]\n// - TableGetHoveredColumn() [Internal]\n// - TableSetBgColor()\n//-----------------------------------------------------------------------------\n\nint ImGui::TableGetColumnCount()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiTable* table = g.CurrentTable;\n    return table ? table->ColumnsCount : 0;\n}\n\nconst char* ImGui::TableGetColumnName(int column_n)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiTable* table = g.CurrentTable;\n    if (!table)\n        return NULL;\n    if (column_n < 0)\n        column_n = table->CurrentColumn;\n    return TableGetColumnName(table, column_n);\n}\n\nconst char* ImGui::TableGetColumnName(const ImGuiTable* table, int column_n)\n{\n    if (table->IsLayoutLocked == false && column_n >= table->DeclColumnsCount)\n        return \"\"; // NameOffset is invalid at this point\n    const ImGuiTableColumn* column = &table->Columns[column_n];\n    if (column->NameOffset == -1)\n        return \"\";\n    return &table->ColumnsNames.Buf[column->NameOffset];\n}\n\n// Change user accessible enabled/disabled state of a column (often perceived as \"showing/hiding\" from users point of view)\n// Note that end-user can use the context menu to change this themselves (right-click in headers, or right-click in columns body with ImGuiTableFlags_ContextMenuInBody)\n// - Require table to have the ImGuiTableFlags_Hideable flag because we are manipulating user accessible state.\n// - Request will be applied during next layout, which happens on the first call to TableNextRow() after BeginTable().\n// - For the getter you can test (TableGetColumnFlags() & ImGuiTableColumnFlags_IsEnabled) != 0.\n// - Alternative: the ImGuiTableColumnFlags_Disabled is an overriding/master disable flag which will also hide the column from context menu.\nvoid ImGui::TableSetColumnEnabled(int column_n, bool enabled)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiTable* table = g.CurrentTable;\n    IM_ASSERT(table != NULL);\n    if (!table)\n        return;\n    IM_ASSERT(table->Flags & ImGuiTableFlags_Hideable); // See comments above\n    if (column_n < 0)\n        column_n = table->CurrentColumn;\n    IM_ASSERT(column_n >= 0 && column_n < table->ColumnsCount);\n    ImGuiTableColumn* column = &table->Columns[column_n];\n    column->IsUserEnabledNextFrame = enabled;\n}\n\n// We allow querying for an extra column in order to poll the IsHovered state of the right-most section\nImGuiTableColumnFlags ImGui::TableGetColumnFlags(int column_n)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiTable* table = g.CurrentTable;\n    if (!table)\n        return ImGuiTableColumnFlags_None;\n    if (column_n < 0)\n        column_n = table->CurrentColumn;\n    if (column_n == table->ColumnsCount)\n        return (table->HoveredColumnBody == column_n) ? ImGuiTableColumnFlags_IsHovered : ImGuiTableColumnFlags_None;\n    return table->Columns[column_n].Flags;\n}\n\n// Return the cell rectangle based on currently known height.\n// - Important: we generally don't know our row height until the end of the row, so Max.y will be incorrect in many situations.\n//   The only case where this is correct is if we provided a min_row_height to TableNextRow() and don't go below it.\n// - Important: if ImGuiTableFlags_PadOuterX is set but ImGuiTableFlags_PadInnerX is not set, the outer-most left and right\n//   columns report a small offset so their CellBgRect can extend up to the outer border.\nImRect ImGui::TableGetCellBgRect(const ImGuiTable* table, int column_n)\n{\n    const ImGuiTableColumn* column = &table->Columns[column_n];\n    float x1 = column->MinX;\n    float x2 = column->MaxX;\n    if (column->PrevEnabledColumn == -1)\n        x1 -= table->CellSpacingX1;\n    if (column->NextEnabledColumn == -1)\n        x2 += table->CellSpacingX2;\n    return ImRect(x1, table->RowPosY1, x2, table->RowPosY2);\n}\n\n// Return the resizing ID for the right-side of the given column.\nImGuiID ImGui::TableGetColumnResizeID(const ImGuiTable* table, int column_n, int instance_no)\n{\n    IM_ASSERT(column_n >= 0 && column_n < table->ColumnsCount);\n    ImGuiID id = table->ID + 1 + (instance_no * table->ColumnsCount) + column_n;\n    return id;\n}\n\n// Return -1 when table is not hovered. return columns_count if the unused space at the right of visible columns is hovered.\nint ImGui::TableGetHoveredColumn()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiTable* table = g.CurrentTable;\n    if (!table)\n        return -1;\n    return (int)table->HoveredColumnBody;\n}\n\nvoid ImGui::TableSetBgColor(ImGuiTableBgTarget target, ImU32 color, int column_n)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiTable* table = g.CurrentTable;\n    IM_ASSERT(target != ImGuiTableBgTarget_None);\n\n    if (color == IM_COL32_DISABLE)\n        color = 0;\n\n    // We cannot draw neither the cell or row background immediately as we don't know the row height at this point in time.\n    switch (target)\n    {\n    case ImGuiTableBgTarget_CellBg:\n    {\n        if (table->RowPosY1 > table->InnerClipRect.Max.y) // Discard\n            return;\n        if (column_n == -1)\n            column_n = table->CurrentColumn;\n        if ((table->VisibleMaskByIndex & ((ImU64)1 << column_n)) == 0)\n            return;\n        if (table->RowCellDataCurrent < 0 || table->RowCellData[table->RowCellDataCurrent].Column != column_n)\n            table->RowCellDataCurrent++;\n        ImGuiTableCellData* cell_data = &table->RowCellData[table->RowCellDataCurrent];\n        cell_data->BgColor = color;\n        cell_data->Column = (ImGuiTableColumnIdx)column_n;\n        break;\n    }\n    case ImGuiTableBgTarget_RowBg0:\n    case ImGuiTableBgTarget_RowBg1:\n    {\n        if (table->RowPosY1 > table->InnerClipRect.Max.y) // Discard\n            return;\n        IM_ASSERT(column_n == -1);\n        int bg_idx = (target == ImGuiTableBgTarget_RowBg1) ? 1 : 0;\n        table->RowBgColor[bg_idx] = color;\n        break;\n    }\n    default:\n        IM_ASSERT(0);\n    }\n}\n\n//-------------------------------------------------------------------------\n// [SECTION] Tables: Row changes\n//-------------------------------------------------------------------------\n// - TableGetRowIndex()\n// - TableNextRow()\n// - TableBeginRow() [Internal]\n// - TableEndRow() [Internal]\n//-------------------------------------------------------------------------\n\n// [Public] Note: for row coloring we use ->RowBgColorCounter which is the same value without counting header rows\nint ImGui::TableGetRowIndex()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiTable* table = g.CurrentTable;\n    if (!table)\n        return 0;\n    return table->CurrentRow;\n}\n\n// [Public] Starts into the first cell of a new row\nvoid ImGui::TableNextRow(ImGuiTableRowFlags row_flags, float row_min_height)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiTable* table = g.CurrentTable;\n\n    if (!table->IsLayoutLocked)\n        TableUpdateLayout(table);\n    if (table->IsInsideRow)\n        TableEndRow(table);\n\n    table->LastRowFlags = table->RowFlags;\n    table->RowFlags = row_flags;\n    table->RowMinHeight = row_min_height;\n    TableBeginRow(table);\n\n    // We honor min_row_height requested by user, but cannot guarantee per-row maximum height,\n    // because that would essentially require a unique clipping rectangle per-cell.\n    table->RowPosY2 += table->CellPaddingY * 2.0f;\n    table->RowPosY2 = ImMax(table->RowPosY2, table->RowPosY1 + row_min_height);\n\n    // Disable output until user calls TableNextColumn()\n    table->InnerWindow->SkipItems = true;\n}\n\n// [Internal] Called by TableNextRow()\nvoid ImGui::TableBeginRow(ImGuiTable* table)\n{\n    ImGuiWindow* window = table->InnerWindow;\n    IM_ASSERT(!table->IsInsideRow);\n\n    // New row\n    table->CurrentRow++;\n    table->CurrentColumn = -1;\n    table->RowBgColor[0] = table->RowBgColor[1] = IM_COL32_DISABLE;\n    table->RowCellDataCurrent = -1;\n    table->IsInsideRow = true;\n\n    // Begin frozen rows\n    float next_y1 = table->RowPosY2;\n    if (table->CurrentRow == 0 && table->FreezeRowsCount > 0)\n        next_y1 = window->DC.CursorPos.y = table->OuterRect.Min.y;\n\n    table->RowPosY1 = table->RowPosY2 = next_y1;\n    table->RowTextBaseline = 0.0f;\n    table->RowIndentOffsetX = window->DC.Indent.x - table->HostIndentX; // Lock indent\n    window->DC.PrevLineTextBaseOffset = 0.0f;\n    window->DC.CursorMaxPos.y = next_y1;\n\n    // Making the header BG color non-transparent will allow us to overlay it multiple times when handling smooth dragging.\n    if (table->RowFlags & ImGuiTableRowFlags_Headers)\n    {\n        TableSetBgColor(ImGuiTableBgTarget_RowBg0, GetColorU32(ImGuiCol_TableHeaderBg));\n        if (table->CurrentRow == 0)\n            table->IsUsingHeaders = true;\n    }\n}\n\n// [Internal] Called by TableNextRow()\nvoid ImGui::TableEndRow(ImGuiTable* table)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    IM_ASSERT(window == table->InnerWindow);\n    IM_ASSERT(table->IsInsideRow);\n\n    if (table->CurrentColumn != -1)\n        TableEndCell(table);\n\n    // Logging\n    if (g.LogEnabled)\n        LogRenderedText(NULL, \"|\");\n\n    // Position cursor at the bottom of our row so it can be used for e.g. clipping calculation. However it is\n    // likely that the next call to TableBeginCell() will reposition the cursor to take account of vertical padding.\n    window->DC.CursorPos.y = table->RowPosY2;\n\n    // Row background fill\n    const float bg_y1 = table->RowPosY1;\n    const float bg_y2 = table->RowPosY2;\n    const bool unfreeze_rows_actual = (table->CurrentRow + 1 == table->FreezeRowsCount);\n    const bool unfreeze_rows_request = (table->CurrentRow + 1 == table->FreezeRowsRequest);\n    if (table->CurrentRow == 0)\n        table->LastFirstRowHeight = bg_y2 - bg_y1;\n\n    const bool is_visible = (bg_y2 >= table->InnerClipRect.Min.y && bg_y1 <= table->InnerClipRect.Max.y);\n    if (is_visible)\n    {\n        // Decide of background color for the row\n        ImU32 bg_col0 = 0;\n        ImU32 bg_col1 = 0;\n        if (table->RowBgColor[0] != IM_COL32_DISABLE)\n            bg_col0 = table->RowBgColor[0];\n        else if (table->Flags & ImGuiTableFlags_RowBg)\n            bg_col0 = GetColorU32((table->RowBgColorCounter & 1) ? ImGuiCol_TableRowBgAlt : ImGuiCol_TableRowBg);\n        if (table->RowBgColor[1] != IM_COL32_DISABLE)\n            bg_col1 = table->RowBgColor[1];\n\n        // Decide of top border color\n        ImU32 border_col = 0;\n        const float border_size = TABLE_BORDER_SIZE;\n        if (table->CurrentRow > 0 || table->InnerWindow == table->OuterWindow)\n            if (table->Flags & ImGuiTableFlags_BordersInnerH)\n                border_col = (table->LastRowFlags & ImGuiTableRowFlags_Headers) ? table->BorderColorStrong : table->BorderColorLight;\n\n        const bool draw_cell_bg_color = table->RowCellDataCurrent >= 0;\n        const bool draw_strong_bottom_border = unfreeze_rows_actual;\n        if ((bg_col0 | bg_col1 | border_col) != 0 || draw_strong_bottom_border || draw_cell_bg_color)\n        {\n            // In theory we could call SetWindowClipRectBeforeSetChannel() but since we know TableEndRow() is\n            // always followed by a change of clipping rectangle we perform the smallest overwrite possible here.\n            if ((table->Flags & ImGuiTableFlags_NoClip) == 0)\n                window->DrawList->_CmdHeader.ClipRect = table->Bg0ClipRectForDrawCmd.ToVec4();\n            table->DrawSplitter->SetCurrentChannel(window->DrawList, TABLE_DRAW_CHANNEL_BG0);\n        }\n\n        // Draw row background\n        // We soft/cpu clip this so all backgrounds and borders can share the same clipping rectangle\n        if (bg_col0 || bg_col1)\n        {\n            ImRect row_rect(table->WorkRect.Min.x, bg_y1, table->WorkRect.Max.x, bg_y2);\n            row_rect.ClipWith(table->BgClipRect);\n            if (bg_col0 != 0 && row_rect.Min.y < row_rect.Max.y)\n                window->DrawList->AddRectFilled(row_rect.Min, row_rect.Max, bg_col0);\n            if (bg_col1 != 0 && row_rect.Min.y < row_rect.Max.y)\n                window->DrawList->AddRectFilled(row_rect.Min, row_rect.Max, bg_col1);\n        }\n\n        // Draw cell background color\n        if (draw_cell_bg_color)\n        {\n            ImGuiTableCellData* cell_data_end = &table->RowCellData[table->RowCellDataCurrent];\n            for (ImGuiTableCellData* cell_data = &table->RowCellData[0]; cell_data <= cell_data_end; cell_data++)\n            {\n                const ImGuiTableColumn* column = &table->Columns[cell_data->Column];\n                ImRect cell_bg_rect = TableGetCellBgRect(table, cell_data->Column);\n                cell_bg_rect.ClipWith(table->BgClipRect);\n                cell_bg_rect.Min.x = ImMax(cell_bg_rect.Min.x, column->ClipRect.Min.x);     // So that first column after frozen one gets clipped\n                cell_bg_rect.Max.x = ImMin(cell_bg_rect.Max.x, column->MaxX);\n                window->DrawList->AddRectFilled(cell_bg_rect.Min, cell_bg_rect.Max, cell_data->BgColor);\n            }\n        }\n\n        // Draw top border\n        if (border_col && bg_y1 >= table->BgClipRect.Min.y && bg_y1 < table->BgClipRect.Max.y)\n            window->DrawList->AddLine(ImVec2(table->BorderX1, bg_y1), ImVec2(table->BorderX2, bg_y1), border_col, border_size);\n\n        // Draw bottom border at the row unfreezing mark (always strong)\n        if (draw_strong_bottom_border && bg_y2 >= table->BgClipRect.Min.y && bg_y2 < table->BgClipRect.Max.y)\n            window->DrawList->AddLine(ImVec2(table->BorderX1, bg_y2), ImVec2(table->BorderX2, bg_y2), table->BorderColorStrong, border_size);\n    }\n\n    // End frozen rows (when we are past the last frozen row line, teleport cursor and alter clipping rectangle)\n    // We need to do that in TableEndRow() instead of TableBeginRow() so the list clipper can mark end of row and\n    // get the new cursor position.\n    if (unfreeze_rows_request)\n        for (int column_n = 0; column_n < table->ColumnsCount; column_n++)\n        {\n            ImGuiTableColumn* column = &table->Columns[column_n];\n            column->NavLayerCurrent = (ImS8)((column_n < table->FreezeColumnsCount) ? ImGuiNavLayer_Menu : ImGuiNavLayer_Main);\n        }\n    if (unfreeze_rows_actual)\n    {\n        IM_ASSERT(table->IsUnfrozenRows == false);\n        table->IsUnfrozenRows = true;\n\n        // BgClipRect starts as table->InnerClipRect, reduce it now and make BgClipRectForDrawCmd == BgClipRect\n        float y0 = ImMax(table->RowPosY2 + 1, window->InnerClipRect.Min.y);\n        table->BgClipRect.Min.y = table->Bg2ClipRectForDrawCmd.Min.y = ImMin(y0, window->InnerClipRect.Max.y);\n        table->BgClipRect.Max.y = table->Bg2ClipRectForDrawCmd.Max.y = window->InnerClipRect.Max.y;\n        table->Bg2DrawChannelCurrent = table->Bg2DrawChannelUnfrozen;\n        IM_ASSERT(table->Bg2ClipRectForDrawCmd.Min.y <= table->Bg2ClipRectForDrawCmd.Max.y);\n\n        float row_height = table->RowPosY2 - table->RowPosY1;\n        table->RowPosY2 = window->DC.CursorPos.y = table->WorkRect.Min.y + table->RowPosY2 - table->OuterRect.Min.y;\n        table->RowPosY1 = table->RowPosY2 - row_height;\n        for (int column_n = 0; column_n < table->ColumnsCount; column_n++)\n        {\n            ImGuiTableColumn* column = &table->Columns[column_n];\n            column->DrawChannelCurrent = column->DrawChannelUnfrozen;\n            column->ClipRect.Min.y = table->Bg2ClipRectForDrawCmd.Min.y;\n        }\n\n        // Update cliprect ahead of TableBeginCell() so clipper can access to new ClipRect->Min.y\n        SetWindowClipRectBeforeSetChannel(window, table->Columns[0].ClipRect);\n        table->DrawSplitter->SetCurrentChannel(window->DrawList, table->Columns[0].DrawChannelCurrent);\n    }\n\n    if (!(table->RowFlags & ImGuiTableRowFlags_Headers))\n        table->RowBgColorCounter++;\n    table->IsInsideRow = false;\n}\n\n//-------------------------------------------------------------------------\n// [SECTION] Tables: Columns changes\n//-------------------------------------------------------------------------\n// - TableGetColumnIndex()\n// - TableSetColumnIndex()\n// - TableNextColumn()\n// - TableBeginCell() [Internal]\n// - TableEndCell() [Internal]\n//-------------------------------------------------------------------------\n\nint ImGui::TableGetColumnIndex()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiTable* table = g.CurrentTable;\n    if (!table)\n        return 0;\n    return table->CurrentColumn;\n}\n\n// [Public] Append into a specific column\nbool ImGui::TableSetColumnIndex(int column_n)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiTable* table = g.CurrentTable;\n    if (!table)\n        return false;\n\n    if (table->CurrentColumn != column_n)\n    {\n        if (table->CurrentColumn != -1)\n            TableEndCell(table);\n        IM_ASSERT(column_n >= 0 && table->ColumnsCount);\n        TableBeginCell(table, column_n);\n    }\n\n    // Return whether the column is visible. User may choose to skip submitting items based on this return value,\n    // however they shouldn't skip submitting for columns that may have the tallest contribution to row height.\n    return (table->RequestOutputMaskByIndex & ((ImU64)1 << column_n)) != 0;\n}\n\n// [Public] Append into the next column, wrap and create a new row when already on last column\nbool ImGui::TableNextColumn()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiTable* table = g.CurrentTable;\n    if (!table)\n        return false;\n\n    if (table->IsInsideRow && table->CurrentColumn + 1 < table->ColumnsCount)\n    {\n        if (table->CurrentColumn != -1)\n            TableEndCell(table);\n        TableBeginCell(table, table->CurrentColumn + 1);\n    }\n    else\n    {\n        TableNextRow();\n        TableBeginCell(table, 0);\n    }\n\n    // Return whether the column is visible. User may choose to skip submitting items based on this return value,\n    // however they shouldn't skip submitting for columns that may have the tallest contribution to row height.\n    int column_n = table->CurrentColumn;\n    return (table->RequestOutputMaskByIndex & ((ImU64)1 << column_n)) != 0;\n}\n\n\n// [Internal] Called by TableSetColumnIndex()/TableNextColumn()\n// This is called very frequently, so we need to be mindful of unnecessary overhead.\n// FIXME-TABLE FIXME-OPT: Could probably shortcut some things for non-active or clipped columns.\nvoid ImGui::TableBeginCell(ImGuiTable* table, int column_n)\n{\n    ImGuiTableColumn* column = &table->Columns[column_n];\n    ImGuiWindow* window = table->InnerWindow;\n    table->CurrentColumn = column_n;\n\n    // Start position is roughly ~~ CellRect.Min + CellPadding + Indent\n    float start_x = column->WorkMinX;\n    if (column->Flags & ImGuiTableColumnFlags_IndentEnable)\n        start_x += table->RowIndentOffsetX; // ~~ += window.DC.Indent.x - table->HostIndentX, except we locked it for the row.\n\n    window->DC.CursorPos.x = start_x;\n    window->DC.CursorPos.y = table->RowPosY1 + table->CellPaddingY;\n    window->DC.CursorMaxPos.x = window->DC.CursorPos.x;\n    window->DC.ColumnsOffset.x = start_x - window->Pos.x - window->DC.Indent.x; // FIXME-WORKRECT\n    window->DC.CurrLineTextBaseOffset = table->RowTextBaseline;\n    window->DC.NavLayerCurrent = (ImGuiNavLayer)column->NavLayerCurrent;\n\n    window->WorkRect.Min.y = window->DC.CursorPos.y;\n    window->WorkRect.Min.x = column->WorkMinX;\n    window->WorkRect.Max.x = column->WorkMaxX;\n    window->DC.ItemWidth = column->ItemWidth;\n\n    // To allow ImGuiListClipper to function we propagate our row height\n    if (!column->IsEnabled)\n        window->DC.CursorPos.y = ImMax(window->DC.CursorPos.y, table->RowPosY2);\n\n    window->SkipItems = column->IsSkipItems;\n    if (column->IsSkipItems)\n    {\n        ImGuiContext& g = *GImGui;\n        g.LastItemData.ID = 0;\n        g.LastItemData.StatusFlags = 0;\n    }\n\n    if (table->Flags & ImGuiTableFlags_NoClip)\n    {\n        // FIXME: if we end up drawing all borders/bg in EndTable, could remove this and just assert that channel hasn't changed.\n        table->DrawSplitter->SetCurrentChannel(window->DrawList, TABLE_DRAW_CHANNEL_NOCLIP);\n        //IM_ASSERT(table->DrawSplitter._Current == TABLE_DRAW_CHANNEL_NOCLIP);\n    }\n    else\n    {\n        // FIXME-TABLE: Could avoid this if draw channel is dummy channel?\n        SetWindowClipRectBeforeSetChannel(window, column->ClipRect);\n        table->DrawSplitter->SetCurrentChannel(window->DrawList, column->DrawChannelCurrent);\n    }\n\n    // Logging\n    ImGuiContext& g = *GImGui;\n    if (g.LogEnabled && !column->IsSkipItems)\n    {\n        LogRenderedText(&window->DC.CursorPos, \"|\");\n        g.LogLinePosY = FLT_MAX;\n    }\n}\n\n// [Internal] Called by TableNextRow()/TableSetColumnIndex()/TableNextColumn()\nvoid ImGui::TableEndCell(ImGuiTable* table)\n{\n    ImGuiTableColumn* column = &table->Columns[table->CurrentColumn];\n    ImGuiWindow* window = table->InnerWindow;\n\n    // Report maximum position so we can infer content size per column.\n    float* p_max_pos_x;\n    if (table->RowFlags & ImGuiTableRowFlags_Headers)\n        p_max_pos_x = &column->ContentMaxXHeadersUsed;  // Useful in case user submit contents in header row that is not a TableHeader() call\n    else\n        p_max_pos_x = table->IsUnfrozenRows ? &column->ContentMaxXUnfrozen : &column->ContentMaxXFrozen;\n    *p_max_pos_x = ImMax(*p_max_pos_x, window->DC.CursorMaxPos.x);\n    table->RowPosY2 = ImMax(table->RowPosY2, window->DC.CursorMaxPos.y + table->CellPaddingY);\n    column->ItemWidth = window->DC.ItemWidth;\n\n    // Propagate text baseline for the entire row\n    // FIXME-TABLE: Here we propagate text baseline from the last line of the cell.. instead of the first one.\n    table->RowTextBaseline = ImMax(table->RowTextBaseline, window->DC.PrevLineTextBaseOffset);\n}\n\n//-------------------------------------------------------------------------\n// [SECTION] Tables: Columns width management\n//-------------------------------------------------------------------------\n// - TableGetMaxColumnWidth() [Internal]\n// - TableGetColumnWidthAuto() [Internal]\n// - TableSetColumnWidth()\n// - TableSetColumnWidthAutoSingle() [Internal]\n// - TableSetColumnWidthAutoAll() [Internal]\n// - TableUpdateColumnsWeightFromWidth() [Internal]\n//-------------------------------------------------------------------------\n\n// Maximum column content width given current layout. Use column->MinX so this value on a per-column basis.\nfloat ImGui::TableGetMaxColumnWidth(const ImGuiTable* table, int column_n)\n{\n    const ImGuiTableColumn* column = &table->Columns[column_n];\n    float max_width = FLT_MAX;\n    const float min_column_distance = table->MinColumnWidth + table->CellPaddingX * 2.0f + table->CellSpacingX1 + table->CellSpacingX2;\n    if (table->Flags & ImGuiTableFlags_ScrollX)\n    {\n        // Frozen columns can't reach beyond visible width else scrolling will naturally break.\n        // (we use DisplayOrder as within a set of multiple frozen column reordering is possible)\n        if (column->DisplayOrder < table->FreezeColumnsRequest)\n        {\n            max_width = (table->InnerClipRect.Max.x - (table->FreezeColumnsRequest - column->DisplayOrder) * min_column_distance) - column->MinX;\n            max_width = max_width - table->OuterPaddingX - table->CellPaddingX - table->CellSpacingX2;\n        }\n    }\n    else if ((table->Flags & ImGuiTableFlags_NoKeepColumnsVisible) == 0)\n    {\n        // If horizontal scrolling if disabled, we apply a final lossless shrinking of columns in order to make\n        // sure they are all visible. Because of this we also know that all of the columns will always fit in\n        // table->WorkRect and therefore in table->InnerRect (because ScrollX is off)\n        // FIXME-TABLE: This is solved incorrectly but also quite a difficult problem to fix as we also want ClipRect width to match.\n        // See \"table_width_distrib\" and \"table_width_keep_visible\" tests\n        max_width = table->WorkRect.Max.x - (table->ColumnsEnabledCount - column->IndexWithinEnabledSet - 1) * min_column_distance - column->MinX;\n        //max_width -= table->CellSpacingX1;\n        max_width -= table->CellSpacingX2;\n        max_width -= table->CellPaddingX * 2.0f;\n        max_width -= table->OuterPaddingX;\n    }\n    return max_width;\n}\n\n// Note this is meant to be stored in column->WidthAuto, please generally use the WidthAuto field\nfloat ImGui::TableGetColumnWidthAuto(ImGuiTable* table, ImGuiTableColumn* column)\n{\n    const float content_width_body = ImMax(column->ContentMaxXFrozen, column->ContentMaxXUnfrozen) - column->WorkMinX;\n    const float content_width_headers = column->ContentMaxXHeadersIdeal - column->WorkMinX;\n    float width_auto = content_width_body;\n    if (!(column->Flags & ImGuiTableColumnFlags_NoHeaderWidth))\n        width_auto = ImMax(width_auto, content_width_headers);\n\n    // Non-resizable fixed columns preserve their requested width\n    if ((column->Flags & ImGuiTableColumnFlags_WidthFixed) && column->InitStretchWeightOrWidth > 0.0f)\n        if (!(table->Flags & ImGuiTableFlags_Resizable) || (column->Flags & ImGuiTableColumnFlags_NoResize))\n            width_auto = column->InitStretchWeightOrWidth;\n\n    return ImMax(width_auto, table->MinColumnWidth);\n}\n\n// 'width' = inner column width, without padding\nvoid ImGui::TableSetColumnWidth(int column_n, float width)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiTable* table = g.CurrentTable;\n    IM_ASSERT(table != NULL && table->IsLayoutLocked == false);\n    IM_ASSERT(column_n >= 0 && column_n < table->ColumnsCount);\n    ImGuiTableColumn* column_0 = &table->Columns[column_n];\n    float column_0_width = width;\n\n    // Apply constraints early\n    // Compare both requested and actual given width to avoid overwriting requested width when column is stuck (minimum size, bounded)\n    IM_ASSERT(table->MinColumnWidth > 0.0f);\n    const float min_width = table->MinColumnWidth;\n    const float max_width = ImMax(min_width, TableGetMaxColumnWidth(table, column_n));\n    column_0_width = ImClamp(column_0_width, min_width, max_width);\n    if (column_0->WidthGiven == column_0_width || column_0->WidthRequest == column_0_width)\n        return;\n\n    //IMGUI_DEBUG_LOG(\"TableSetColumnWidth(%d, %.1f->%.1f)\\n\", column_0_idx, column_0->WidthGiven, column_0_width);\n    ImGuiTableColumn* column_1 = (column_0->NextEnabledColumn != -1) ? &table->Columns[column_0->NextEnabledColumn] : NULL;\n\n    // In this surprisingly not simple because of how we support mixing Fixed and multiple Stretch columns.\n    // - All fixed: easy.\n    // - All stretch: easy.\n    // - One or more fixed + one stretch: easy.\n    // - One or more fixed + more than one stretch: tricky.\n    // Qt when manual resize is enabled only support a single _trailing_ stretch column.\n\n    // When forwarding resize from Wn| to Fn+1| we need to be considerate of the _NoResize flag on Fn+1.\n    // FIXME-TABLE: Find a way to rewrite all of this so interactions feel more consistent for the user.\n    // Scenarios:\n    // - F1 F2 F3  resize from F1| or F2|   --> ok: alter ->WidthRequested of Fixed column. Subsequent columns will be offset.\n    // - F1 F2 F3  resize from F3|          --> ok: alter ->WidthRequested of Fixed column. If active, ScrollX extent can be altered.\n    // - F1 F2 W3  resize from F1| or F2|   --> ok: alter ->WidthRequested of Fixed column. If active, ScrollX extent can be altered, but it doesn't make much sense as the Stretch column will always be minimal size.\n    // - F1 F2 W3  resize from W3|          --> ok: no-op (disabled by Resize Rule 1)\n    // - W1 W2 W3  resize from W1| or W2|   --> ok\n    // - W1 W2 W3  resize from W3|          --> ok: no-op (disabled by Resize Rule 1)\n    // - W1 F2 F3  resize from F3|          --> ok: no-op (disabled by Resize Rule 1)\n    // - W1 F2     resize from F2|          --> ok: no-op (disabled by Resize Rule 1)\n    // - W1 W2 F3  resize from W1| or W2|   --> ok\n    // - W1 F2 W3  resize from W1| or F2|   --> ok\n    // - F1 W2 F3  resize from W2|          --> ok\n    // - F1 W3 F2  resize from W3|          --> ok\n    // - W1 F2 F3  resize from W1|          --> ok: equivalent to resizing |F2. F3 will not move.\n    // - W1 F2 F3  resize from F2|          --> ok\n    // All resizes from a Wx columns are locking other columns.\n\n    // Possible improvements:\n    // - W1 W2 W3  resize W1|               --> to not be stuck, both W2 and W3 would stretch down. Seems possible to fix. Would be most beneficial to simplify resize of all-weighted columns.\n    // - W3 F1 F2  resize W3|               --> to not be stuck past F1|, both F1 and F2 would need to stretch down, which would be lossy or ambiguous. Seems hard to fix.\n\n    // [Resize Rule 1] Can't resize from right of right-most visible column if there is any Stretch column. Implemented in TableUpdateLayout().\n\n    // If we have all Fixed columns OR resizing a Fixed column that doesn't come after a Stretch one, we can do an offsetting resize.\n    // This is the preferred resize path\n    if (column_0->Flags & ImGuiTableColumnFlags_WidthFixed)\n        if (!column_1 || table->LeftMostStretchedColumn == -1 || table->Columns[table->LeftMostStretchedColumn].DisplayOrder >= column_0->DisplayOrder)\n        {\n            column_0->WidthRequest = column_0_width;\n            table->IsSettingsDirty = true;\n            return;\n        }\n\n    // We can also use previous column if there's no next one (this is used when doing an auto-fit on the right-most stretch column)\n    if (column_1 == NULL)\n        column_1 = (column_0->PrevEnabledColumn != -1) ? &table->Columns[column_0->PrevEnabledColumn] : NULL;\n    if (column_1 == NULL)\n        return;\n\n    // Resizing from right-side of a Stretch column before a Fixed column forward sizing to left-side of fixed column.\n    // (old_a + old_b == new_a + new_b) --> (new_a == old_a + old_b - new_b)\n    float column_1_width = ImMax(column_1->WidthRequest - (column_0_width - column_0->WidthRequest), min_width);\n    column_0_width = column_0->WidthRequest + column_1->WidthRequest - column_1_width;\n    IM_ASSERT(column_0_width > 0.0f && column_1_width > 0.0f);\n    column_0->WidthRequest = column_0_width;\n    column_1->WidthRequest = column_1_width;\n    if ((column_0->Flags | column_1->Flags) & ImGuiTableColumnFlags_WidthStretch)\n        TableUpdateColumnsWeightFromWidth(table);\n    table->IsSettingsDirty = true;\n}\n\n// Disable clipping then auto-fit, will take 2 frames\n// (we don't take a shortcut for unclipped columns to reduce inconsistencies when e.g. resizing multiple columns)\nvoid ImGui::TableSetColumnWidthAutoSingle(ImGuiTable* table, int column_n)\n{\n    // Single auto width uses auto-fit\n    ImGuiTableColumn* column = &table->Columns[column_n];\n    if (!column->IsEnabled)\n        return;\n    column->CannotSkipItemsQueue = (1 << 0);\n    table->AutoFitSingleColumn = (ImGuiTableColumnIdx)column_n;\n}\n\nvoid ImGui::TableSetColumnWidthAutoAll(ImGuiTable* table)\n{\n    for (int column_n = 0; column_n < table->ColumnsCount; column_n++)\n    {\n        ImGuiTableColumn* column = &table->Columns[column_n];\n        if (!column->IsEnabled && !(column->Flags & ImGuiTableColumnFlags_WidthStretch)) // Cannot reset weight of hidden stretch column\n            continue;\n        column->CannotSkipItemsQueue = (1 << 0);\n        column->AutoFitQueue = (1 << 1);\n    }\n}\n\nvoid ImGui::TableUpdateColumnsWeightFromWidth(ImGuiTable* table)\n{\n    IM_ASSERT(table->LeftMostStretchedColumn != -1 && table->RightMostStretchedColumn != -1);\n\n    // Measure existing quantity\n    float visible_weight = 0.0f;\n    float visible_width = 0.0f;\n    for (int column_n = 0; column_n < table->ColumnsCount; column_n++)\n    {\n        ImGuiTableColumn* column = &table->Columns[column_n];\n        if (!column->IsEnabled || !(column->Flags & ImGuiTableColumnFlags_WidthStretch))\n            continue;\n        IM_ASSERT(column->StretchWeight > 0.0f);\n        visible_weight += column->StretchWeight;\n        visible_width += column->WidthRequest;\n    }\n    IM_ASSERT(visible_weight > 0.0f && visible_width > 0.0f);\n\n    // Apply new weights\n    for (int column_n = 0; column_n < table->ColumnsCount; column_n++)\n    {\n        ImGuiTableColumn* column = &table->Columns[column_n];\n        if (!column->IsEnabled || !(column->Flags & ImGuiTableColumnFlags_WidthStretch))\n            continue;\n        column->StretchWeight = (column->WidthRequest / visible_width) * visible_weight;\n        IM_ASSERT(column->StretchWeight > 0.0f);\n    }\n}\n\n//-------------------------------------------------------------------------\n// [SECTION] Tables: Drawing\n//-------------------------------------------------------------------------\n// - TablePushBackgroundChannel() [Internal]\n// - TablePopBackgroundChannel() [Internal]\n// - TableSetupDrawChannels() [Internal]\n// - TableMergeDrawChannels() [Internal]\n// - TableDrawBorders() [Internal]\n//-------------------------------------------------------------------------\n\n// Bg2 is used by Selectable (and possibly other widgets) to render to the background.\n// Unlike our Bg0/1 channel which we uses for RowBg/CellBg/Borders and where we guarantee all shapes to be CPU-clipped, the Bg2 channel being widgets-facing will rely on regular ClipRect.\nvoid ImGui::TablePushBackgroundChannel()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    ImGuiTable* table = g.CurrentTable;\n\n    // Optimization: avoid SetCurrentChannel() + PushClipRect()\n    table->HostBackupInnerClipRect = window->ClipRect;\n    SetWindowClipRectBeforeSetChannel(window, table->Bg2ClipRectForDrawCmd);\n    table->DrawSplitter->SetCurrentChannel(window->DrawList, table->Bg2DrawChannelCurrent);\n}\n\nvoid ImGui::TablePopBackgroundChannel()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    ImGuiTable* table = g.CurrentTable;\n    ImGuiTableColumn* column = &table->Columns[table->CurrentColumn];\n\n    // Optimization: avoid PopClipRect() + SetCurrentChannel()\n    SetWindowClipRectBeforeSetChannel(window, table->HostBackupInnerClipRect);\n    table->DrawSplitter->SetCurrentChannel(window->DrawList, column->DrawChannelCurrent);\n}\n\n// Allocate draw channels. Called by TableUpdateLayout()\n// - We allocate them following storage order instead of display order so reordering columns won't needlessly\n//   increase overall dormant memory cost.\n// - We isolate headers draw commands in their own channels instead of just altering clip rects.\n//   This is in order to facilitate merging of draw commands.\n// - After crossing FreezeRowsCount, all columns see their current draw channel changed to a second set of channels.\n// - We only use the dummy draw channel so we can push a null clipping rectangle into it without affecting other\n//   channels, while simplifying per-row/per-cell overhead. It will be empty and discarded when merged.\n// - We allocate 1 or 2 background draw channels. This is because we know TablePushBackgroundChannel() is only used for\n//   horizontal spanning. If we allowed vertical spanning we'd need one background draw channel per merge group (1-4).\n// Draw channel allocation (before merging):\n// - NoClip                       --> 2+D+1 channels: bg0/1 + bg2 + foreground (same clip rect == always 1 draw call)\n// - Clip                         --> 2+D+N channels\n// - FreezeRows                   --> 2+D+N*2 (unless scrolling value is zero)\n// - FreezeRows || FreezeColunns  --> 3+D+N*2 (unless scrolling value is zero)\n// Where D is 1 if any column is clipped or hidden (dummy channel) otherwise 0.\nvoid ImGui::TableSetupDrawChannels(ImGuiTable* table)\n{\n    const int freeze_row_multiplier = (table->FreezeRowsCount > 0) ? 2 : 1;\n    const int channels_for_row = (table->Flags & ImGuiTableFlags_NoClip) ? 1 : table->ColumnsEnabledCount;\n    const int channels_for_bg = 1 + 1 * freeze_row_multiplier;\n    const int channels_for_dummy = (table->ColumnsEnabledCount < table->ColumnsCount || table->VisibleMaskByIndex != table->EnabledMaskByIndex) ? +1 : 0;\n    const int channels_total = channels_for_bg + (channels_for_row * freeze_row_multiplier) + channels_for_dummy;\n    table->DrawSplitter->Split(table->InnerWindow->DrawList, channels_total);\n    table->DummyDrawChannel = (ImGuiTableDrawChannelIdx)((channels_for_dummy > 0) ? channels_total - 1 : -1);\n    table->Bg2DrawChannelCurrent = TABLE_DRAW_CHANNEL_BG2_FROZEN;\n    table->Bg2DrawChannelUnfrozen = (ImGuiTableDrawChannelIdx)((table->FreezeRowsCount > 0) ? 2 + channels_for_row : TABLE_DRAW_CHANNEL_BG2_FROZEN);\n\n    int draw_channel_current = 2;\n    for (int column_n = 0; column_n < table->ColumnsCount; column_n++)\n    {\n        ImGuiTableColumn* column = &table->Columns[column_n];\n        if (column->IsVisibleX && column->IsVisibleY)\n        {\n            column->DrawChannelFrozen = (ImGuiTableDrawChannelIdx)(draw_channel_current);\n            column->DrawChannelUnfrozen = (ImGuiTableDrawChannelIdx)(draw_channel_current + (table->FreezeRowsCount > 0 ? channels_for_row + 1 : 0));\n            if (!(table->Flags & ImGuiTableFlags_NoClip))\n                draw_channel_current++;\n        }\n        else\n        {\n            column->DrawChannelFrozen = column->DrawChannelUnfrozen = table->DummyDrawChannel;\n        }\n        column->DrawChannelCurrent = column->DrawChannelFrozen;\n    }\n\n    // Initial draw cmd starts with a BgClipRect that matches the one of its host, to facilitate merge draw commands by default.\n    // All our cell highlight are manually clipped with BgClipRect. When unfreezing it will be made smaller to fit scrolling rect.\n    // (This technically isn't part of setting up draw channels, but is reasonably related to be done here)\n    table->BgClipRect = table->InnerClipRect;\n    table->Bg0ClipRectForDrawCmd = table->OuterWindow->ClipRect;\n    table->Bg2ClipRectForDrawCmd = table->HostClipRect;\n    IM_ASSERT(table->BgClipRect.Min.y <= table->BgClipRect.Max.y);\n}\n\n// This function reorder draw channels based on matching clip rectangle, to facilitate merging them. Called by EndTable().\n// For simplicity we call it TableMergeDrawChannels() but in fact it only reorder channels + overwrite ClipRect,\n// actual merging is done by table->DrawSplitter.Merge() which is called right after TableMergeDrawChannels().\n//\n// Columns where the contents didn't stray off their local clip rectangle can be merged. To achieve\n// this we merge their clip rect and make them contiguous in the channel list, so they can be merged\n// by the call to DrawSplitter.Merge() following to the call to this function.\n// We reorder draw commands by arranging them into a maximum of 4 distinct groups:\n//\n//   1 group:               2 groups:              2 groups:              4 groups:\n//   [ 0. ] no freeze       [ 0. ] row freeze      [ 01 ] col freeze      [ 01 ] row+col freeze\n//   [ .. ]  or no scroll   [ 2. ]  and v-scroll   [ .. ]  and h-scroll   [ 23 ]  and v+h-scroll\n//\n// Each column itself can use 1 channel (row freeze disabled) or 2 channels (row freeze enabled).\n// When the contents of a column didn't stray off its limit, we move its channels into the corresponding group\n// based on its position (within frozen rows/columns groups or not).\n// At the end of the operation our 1-4 groups will each have a ImDrawCmd using the same ClipRect.\n// This function assume that each column are pointing to a distinct draw channel,\n// otherwise merge_group->ChannelsCount will not match set bit count of merge_group->ChannelsMask.\n//\n// Column channels will not be merged into one of the 1-4 groups in the following cases:\n// - The contents stray off its clipping rectangle (we only compare the MaxX value, not the MinX value).\n//   Direct ImDrawList calls won't be taken into account by default, if you use them make sure the ImGui:: bounds\n//   matches, by e.g. calling SetCursorScreenPos().\n// - The channel uses more than one draw command itself. We drop all our attempt at merging stuff here..\n//   we could do better but it's going to be rare and probably not worth the hassle.\n// Columns for which the draw channel(s) haven't been merged with other will use their own ImDrawCmd.\n//\n// This function is particularly tricky to understand.. take a breath.\nvoid ImGui::TableMergeDrawChannels(ImGuiTable* table)\n{\n    ImGuiContext& g = *GImGui;\n    ImDrawListSplitter* splitter = table->DrawSplitter;\n    const bool has_freeze_v = (table->FreezeRowsCount > 0);\n    const bool has_freeze_h = (table->FreezeColumnsCount > 0);\n    IM_ASSERT(splitter->_Current == 0);\n\n    // Track which groups we are going to attempt to merge, and which channels goes into each group.\n    struct MergeGroup\n    {\n        ImRect  ClipRect;\n        int     ChannelsCount;\n        ImBitArray<IMGUI_TABLE_MAX_DRAW_CHANNELS> ChannelsMask;\n\n        MergeGroup() { ChannelsCount = 0; }\n    };\n    int merge_group_mask = 0x00;\n    MergeGroup merge_groups[4];\n\n    // 1. Scan channels and take note of those which can be merged\n    for (int column_n = 0; column_n < table->ColumnsCount; column_n++)\n    {\n        if ((table->VisibleMaskByIndex & ((ImU64)1 << column_n)) == 0)\n            continue;\n        ImGuiTableColumn* column = &table->Columns[column_n];\n\n        const int merge_group_sub_count = has_freeze_v ? 2 : 1;\n        for (int merge_group_sub_n = 0; merge_group_sub_n < merge_group_sub_count; merge_group_sub_n++)\n        {\n            const int channel_no = (merge_group_sub_n == 0) ? column->DrawChannelFrozen : column->DrawChannelUnfrozen;\n\n            // Don't attempt to merge if there are multiple draw calls within the column\n            ImDrawChannel* src_channel = &splitter->_Channels[channel_no];\n            if (src_channel->_CmdBuffer.Size > 0 && src_channel->_CmdBuffer.back().ElemCount == 0)\n                src_channel->_CmdBuffer.pop_back();\n            if (src_channel->_CmdBuffer.Size != 1)\n                continue;\n\n            // Find out the width of this merge group and check if it will fit in our column\n            // (note that we assume that rendering didn't stray on the left direction. we should need a CursorMinPos to detect it)\n            if (!(column->Flags & ImGuiTableColumnFlags_NoClip))\n            {\n                float content_max_x;\n                if (!has_freeze_v)\n                    content_max_x = ImMax(column->ContentMaxXUnfrozen, column->ContentMaxXHeadersUsed); // No row freeze\n                else if (merge_group_sub_n == 0)\n                    content_max_x = ImMax(column->ContentMaxXFrozen, column->ContentMaxXHeadersUsed);   // Row freeze: use width before freeze\n                else\n                    content_max_x = column->ContentMaxXUnfrozen;                                        // Row freeze: use width after freeze\n                if (content_max_x > column->ClipRect.Max.x)\n                    continue;\n            }\n\n            const int merge_group_n = (has_freeze_h && column_n < table->FreezeColumnsCount ? 0 : 1) + (has_freeze_v && merge_group_sub_n == 0 ? 0 : 2);\n            IM_ASSERT(channel_no < IMGUI_TABLE_MAX_DRAW_CHANNELS);\n            MergeGroup* merge_group = &merge_groups[merge_group_n];\n            if (merge_group->ChannelsCount == 0)\n                merge_group->ClipRect = ImRect(+FLT_MAX, +FLT_MAX, -FLT_MAX, -FLT_MAX);\n            merge_group->ChannelsMask.SetBit(channel_no);\n            merge_group->ChannelsCount++;\n            merge_group->ClipRect.Add(src_channel->_CmdBuffer[0].ClipRect);\n            merge_group_mask |= (1 << merge_group_n);\n        }\n\n        // Invalidate current draw channel\n        // (we don't clear DrawChannelFrozen/DrawChannelUnfrozen solely to facilitate debugging/later inspection of data)\n        column->DrawChannelCurrent = (ImGuiTableDrawChannelIdx)-1;\n    }\n\n    // [DEBUG] Display merge groups\n#if 0\n    if (g.IO.KeyShift)\n        for (int merge_group_n = 0; merge_group_n < IM_ARRAYSIZE(merge_groups); merge_group_n++)\n        {\n            MergeGroup* merge_group = &merge_groups[merge_group_n];\n            if (merge_group->ChannelsCount == 0)\n                continue;\n            char buf[32];\n            ImFormatString(buf, 32, \"MG%d:%d\", merge_group_n, merge_group->ChannelsCount);\n            ImVec2 text_pos = merge_group->ClipRect.Min + ImVec2(4, 4);\n            ImVec2 text_size = CalcTextSize(buf, NULL);\n            GetForegroundDrawList()->AddRectFilled(text_pos, text_pos + text_size, IM_COL32(0, 0, 0, 255));\n            GetForegroundDrawList()->AddText(text_pos, IM_COL32(255, 255, 0, 255), buf, NULL);\n            GetForegroundDrawList()->AddRect(merge_group->ClipRect.Min, merge_group->ClipRect.Max, IM_COL32(255, 255, 0, 255));\n        }\n#endif\n\n    // 2. Rewrite channel list in our preferred order\n    if (merge_group_mask != 0)\n    {\n        // We skip channel 0 (Bg0/Bg1) and 1 (Bg2 frozen) from the shuffling since they won't move - see channels allocation in TableSetupDrawChannels().\n        const int LEADING_DRAW_CHANNELS = 2;\n        g.DrawChannelsTempMergeBuffer.resize(splitter->_Count - LEADING_DRAW_CHANNELS); // Use shared temporary storage so the allocation gets amortized\n        ImDrawChannel* dst_tmp = g.DrawChannelsTempMergeBuffer.Data;\n        ImBitArray<IMGUI_TABLE_MAX_DRAW_CHANNELS> remaining_mask;                       // We need 132-bit of storage\n        remaining_mask.SetBitRange(LEADING_DRAW_CHANNELS, splitter->_Count);\n        remaining_mask.ClearBit(table->Bg2DrawChannelUnfrozen);\n        IM_ASSERT(has_freeze_v == false || table->Bg2DrawChannelUnfrozen != TABLE_DRAW_CHANNEL_BG2_FROZEN);\n        int remaining_count = splitter->_Count - (has_freeze_v ? LEADING_DRAW_CHANNELS + 1 : LEADING_DRAW_CHANNELS);\n        //ImRect host_rect = (table->InnerWindow == table->OuterWindow) ? table->InnerClipRect : table->HostClipRect;\n        ImRect host_rect = table->HostClipRect;\n        for (int merge_group_n = 0; merge_group_n < IM_ARRAYSIZE(merge_groups); merge_group_n++)\n        {\n            if (int merge_channels_count = merge_groups[merge_group_n].ChannelsCount)\n            {\n                MergeGroup* merge_group = &merge_groups[merge_group_n];\n                ImRect merge_clip_rect = merge_group->ClipRect;\n\n                // Extend outer-most clip limits to match those of host, so draw calls can be merged even if\n                // outer-most columns have some outer padding offsetting them from their parent ClipRect.\n                // The principal cases this is dealing with are:\n                // - On a same-window table (not scrolling = single group), all fitting columns ClipRect -> will extend and match host ClipRect -> will merge\n                // - Columns can use padding and have left-most ClipRect.Min.x and right-most ClipRect.Max.x != from host ClipRect -> will extend and match host ClipRect -> will merge\n                // FIXME-TABLE FIXME-WORKRECT: We are wasting a merge opportunity on tables without scrolling if column doesn't fit\n                // within host clip rect, solely because of the half-padding difference between window->WorkRect and window->InnerClipRect.\n                if ((merge_group_n & 1) == 0 || !has_freeze_h)\n                    merge_clip_rect.Min.x = ImMin(merge_clip_rect.Min.x, host_rect.Min.x);\n                if ((merge_group_n & 2) == 0 || !has_freeze_v)\n                    merge_clip_rect.Min.y = ImMin(merge_clip_rect.Min.y, host_rect.Min.y);\n                if ((merge_group_n & 1) != 0)\n                    merge_clip_rect.Max.x = ImMax(merge_clip_rect.Max.x, host_rect.Max.x);\n                if ((merge_group_n & 2) != 0 && (table->Flags & ImGuiTableFlags_NoHostExtendY) == 0)\n                    merge_clip_rect.Max.y = ImMax(merge_clip_rect.Max.y, host_rect.Max.y);\n#if 0\n                GetOverlayDrawList()->AddRect(merge_group->ClipRect.Min, merge_group->ClipRect.Max, IM_COL32(255, 0, 0, 200), 0.0f, 0, 1.0f);\n                GetOverlayDrawList()->AddLine(merge_group->ClipRect.Min, merge_clip_rect.Min, IM_COL32(255, 100, 0, 200));\n                GetOverlayDrawList()->AddLine(merge_group->ClipRect.Max, merge_clip_rect.Max, IM_COL32(255, 100, 0, 200));\n#endif\n                remaining_count -= merge_group->ChannelsCount;\n                for (int n = 0; n < IM_ARRAYSIZE(remaining_mask.Storage); n++)\n                    remaining_mask.Storage[n] &= ~merge_group->ChannelsMask.Storage[n];\n                for (int n = 0; n < splitter->_Count && merge_channels_count != 0; n++)\n                {\n                    // Copy + overwrite new clip rect\n                    if (!merge_group->ChannelsMask.TestBit(n))\n                        continue;\n                    merge_group->ChannelsMask.ClearBit(n);\n                    merge_channels_count--;\n\n                    ImDrawChannel* channel = &splitter->_Channels[n];\n                    IM_ASSERT(channel->_CmdBuffer.Size == 1 && merge_clip_rect.Contains(ImRect(channel->_CmdBuffer[0].ClipRect)));\n                    channel->_CmdBuffer[0].ClipRect = merge_clip_rect.ToVec4();\n                    memcpy(dst_tmp++, channel, sizeof(ImDrawChannel));\n                }\n            }\n\n            // Make sure Bg2DrawChannelUnfrozen appears in the middle of our groups (whereas Bg0/Bg1 and Bg2 frozen are fixed to 0 and 1)\n            if (merge_group_n == 1 && has_freeze_v)\n                memcpy(dst_tmp++, &splitter->_Channels[table->Bg2DrawChannelUnfrozen], sizeof(ImDrawChannel));\n        }\n\n        // Append unmergeable channels that we didn't reorder at the end of the list\n        for (int n = 0; n < splitter->_Count && remaining_count != 0; n++)\n        {\n            if (!remaining_mask.TestBit(n))\n                continue;\n            ImDrawChannel* channel = &splitter->_Channels[n];\n            memcpy(dst_tmp++, channel, sizeof(ImDrawChannel));\n            remaining_count--;\n        }\n        IM_ASSERT(dst_tmp == g.DrawChannelsTempMergeBuffer.Data + g.DrawChannelsTempMergeBuffer.Size);\n        memcpy(splitter->_Channels.Data + LEADING_DRAW_CHANNELS, g.DrawChannelsTempMergeBuffer.Data, (splitter->_Count - LEADING_DRAW_CHANNELS) * sizeof(ImDrawChannel));\n    }\n}\n\n// FIXME-TABLE: This is a mess, need to redesign how we render borders (as some are also done in TableEndRow)\nvoid ImGui::TableDrawBorders(ImGuiTable* table)\n{\n    ImGuiWindow* inner_window = table->InnerWindow;\n    if (!table->OuterWindow->ClipRect.Overlaps(table->OuterRect))\n        return;\n\n    ImDrawList* inner_drawlist = inner_window->DrawList;\n    table->DrawSplitter->SetCurrentChannel(inner_drawlist, TABLE_DRAW_CHANNEL_BG0);\n    inner_drawlist->PushClipRect(table->Bg0ClipRectForDrawCmd.Min, table->Bg0ClipRectForDrawCmd.Max, false);\n\n    // Draw inner border and resizing feedback\n    const float border_size = TABLE_BORDER_SIZE;\n    const float draw_y1 = table->InnerRect.Min.y;\n    const float draw_y2_body = table->InnerRect.Max.y;\n    const float draw_y2_head = table->IsUsingHeaders ? ImMin(table->InnerRect.Max.y, (table->FreezeRowsCount >= 1 ? table->InnerRect.Min.y : table->WorkRect.Min.y) + table->LastFirstRowHeight) : draw_y1;\n    if (table->Flags & ImGuiTableFlags_BordersInnerV)\n    {\n        for (int order_n = 0; order_n < table->ColumnsCount; order_n++)\n        {\n            if (!(table->EnabledMaskByDisplayOrder & ((ImU64)1 << order_n)))\n                continue;\n\n            const int column_n = table->DisplayOrderToIndex[order_n];\n            ImGuiTableColumn* column = &table->Columns[column_n];\n            const bool is_hovered = (table->HoveredColumnBorder == column_n);\n            const bool is_resized = (table->ResizedColumn == column_n) && (table->InstanceInteracted == table->InstanceCurrent);\n            const bool is_resizable = (column->Flags & (ImGuiTableColumnFlags_NoResize | ImGuiTableColumnFlags_NoDirectResize_)) == 0;\n            const bool is_frozen_separator = (table->FreezeColumnsCount == order_n + 1);\n            if (column->MaxX > table->InnerClipRect.Max.x && !is_resized)\n                continue;\n\n            // Decide whether right-most column is visible\n            if (column->NextEnabledColumn == -1 && !is_resizable)\n                if ((table->Flags & ImGuiTableFlags_SizingMask_) != ImGuiTableFlags_SizingFixedSame || (table->Flags & ImGuiTableFlags_NoHostExtendX))\n                    continue;\n            if (column->MaxX <= column->ClipRect.Min.x) // FIXME-TABLE FIXME-STYLE: Assume BorderSize==1, this is problematic if we want to increase the border size..\n                continue;\n\n            // Draw in outer window so right-most column won't be clipped\n            // Always draw full height border when being resized/hovered, or on the delimitation of frozen column scrolling.\n            ImU32 col;\n            float draw_y2;\n            if (is_hovered || is_resized || is_frozen_separator)\n            {\n                draw_y2 = draw_y2_body;\n                col = is_resized ? GetColorU32(ImGuiCol_SeparatorActive) : is_hovered ? GetColorU32(ImGuiCol_SeparatorHovered) : table->BorderColorStrong;\n            }\n            else\n            {\n                draw_y2 = (table->Flags & (ImGuiTableFlags_NoBordersInBody | ImGuiTableFlags_NoBordersInBodyUntilResize)) ? draw_y2_head : draw_y2_body;\n                col = (table->Flags & (ImGuiTableFlags_NoBordersInBody | ImGuiTableFlags_NoBordersInBodyUntilResize)) ? table->BorderColorStrong : table->BorderColorLight;\n            }\n\n            if (draw_y2 > draw_y1)\n                inner_drawlist->AddLine(ImVec2(column->MaxX, draw_y1), ImVec2(column->MaxX, draw_y2), col, border_size);\n        }\n    }\n\n    // Draw outer border\n    // FIXME: could use AddRect or explicit VLine/HLine helper?\n    if (table->Flags & ImGuiTableFlags_BordersOuter)\n    {\n        // Display outer border offset by 1 which is a simple way to display it without adding an extra draw call\n        // (Without the offset, in outer_window it would be rendered behind cells, because child windows are above their\n        // parent. In inner_window, it won't reach out over scrollbars. Another weird solution would be to display part\n        // of it in inner window, and the part that's over scrollbars in the outer window..)\n        // Either solution currently won't allow us to use a larger border size: the border would clipped.\n        const ImRect outer_border = table->OuterRect;\n        const ImU32 outer_col = table->BorderColorStrong;\n        if ((table->Flags & ImGuiTableFlags_BordersOuter) == ImGuiTableFlags_BordersOuter)\n        {\n            inner_drawlist->AddRect(outer_border.Min, outer_border.Max, outer_col, 0.0f, 0, border_size);\n        }\n        else if (table->Flags & ImGuiTableFlags_BordersOuterV)\n        {\n            inner_drawlist->AddLine(outer_border.Min, ImVec2(outer_border.Min.x, outer_border.Max.y), outer_col, border_size);\n            inner_drawlist->AddLine(ImVec2(outer_border.Max.x, outer_border.Min.y), outer_border.Max, outer_col, border_size);\n        }\n        else if (table->Flags & ImGuiTableFlags_BordersOuterH)\n        {\n            inner_drawlist->AddLine(outer_border.Min, ImVec2(outer_border.Max.x, outer_border.Min.y), outer_col, border_size);\n            inner_drawlist->AddLine(ImVec2(outer_border.Min.x, outer_border.Max.y), outer_border.Max, outer_col, border_size);\n        }\n    }\n    if ((table->Flags & ImGuiTableFlags_BordersInnerH) && table->RowPosY2 < table->OuterRect.Max.y)\n    {\n        // Draw bottom-most row border\n        const float border_y = table->RowPosY2;\n        if (border_y >= table->BgClipRect.Min.y && border_y < table->BgClipRect.Max.y)\n            inner_drawlist->AddLine(ImVec2(table->BorderX1, border_y), ImVec2(table->BorderX2, border_y), table->BorderColorLight, border_size);\n    }\n\n    inner_drawlist->PopClipRect();\n}\n\n//-------------------------------------------------------------------------\n// [SECTION] Tables: Sorting\n//-------------------------------------------------------------------------\n// - TableGetSortSpecs()\n// - TableFixColumnSortDirection() [Internal]\n// - TableGetColumnNextSortDirection() [Internal]\n// - TableSetColumnSortDirection() [Internal]\n// - TableSortSpecsSanitize() [Internal]\n// - TableSortSpecsBuild() [Internal]\n//-------------------------------------------------------------------------\n\n// Return NULL if no sort specs (most often when ImGuiTableFlags_Sortable is not set)\n// You can sort your data again when 'SpecsChanged == true'. It will be true with sorting specs have changed since\n// last call, or the first time.\n// Lifetime: don't hold on this pointer over multiple frames or past any subsequent call to BeginTable()!\nImGuiTableSortSpecs* ImGui::TableGetSortSpecs()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiTable* table = g.CurrentTable;\n    IM_ASSERT(table != NULL);\n\n    if (!(table->Flags & ImGuiTableFlags_Sortable))\n        return NULL;\n\n    // Require layout (in case TableHeadersRow() hasn't been called) as it may alter IsSortSpecsDirty in some paths.\n    if (!table->IsLayoutLocked)\n        TableUpdateLayout(table);\n\n    TableSortSpecsBuild(table);\n\n    return &table->SortSpecs;\n}\n\nstatic inline ImGuiSortDirection TableGetColumnAvailSortDirection(ImGuiTableColumn* column, int n)\n{\n    IM_ASSERT(n < column->SortDirectionsAvailCount);\n    return (column->SortDirectionsAvailList >> (n << 1)) & 0x03;\n}\n\n// Fix sort direction if currently set on a value which is unavailable (e.g. activating NoSortAscending/NoSortDescending)\nvoid ImGui::TableFixColumnSortDirection(ImGuiTable* table, ImGuiTableColumn* column)\n{\n    if (column->SortOrder == -1 || (column->SortDirectionsAvailMask & (1 << column->SortDirection)) != 0)\n        return;\n    column->SortDirection = (ImU8)TableGetColumnAvailSortDirection(column, 0);\n    table->IsSortSpecsDirty = true;\n}\n\n// Calculate next sort direction that would be set after clicking the column\n// - If the PreferSortDescending flag is set, we will default to a Descending direction on the first click.\n// - Note that the PreferSortAscending flag is never checked, it is essentially the default and therefore a no-op.\nIM_STATIC_ASSERT(ImGuiSortDirection_None == 0 && ImGuiSortDirection_Ascending == 1 && ImGuiSortDirection_Descending == 2);\nImGuiSortDirection ImGui::TableGetColumnNextSortDirection(ImGuiTableColumn* column)\n{\n    IM_ASSERT(column->SortDirectionsAvailCount > 0);\n    if (column->SortOrder == -1)\n        return TableGetColumnAvailSortDirection(column, 0);\n    for (int n = 0; n < 3; n++)\n        if (column->SortDirection == TableGetColumnAvailSortDirection(column, n))\n            return TableGetColumnAvailSortDirection(column, (n + 1) % column->SortDirectionsAvailCount);\n    IM_ASSERT(0);\n    return ImGuiSortDirection_None;\n}\n\n// Note that the NoSortAscending/NoSortDescending flags are processed in TableSortSpecsSanitize(), and they may change/revert\n// the value of SortDirection. We could technically also do it here but it would be unnecessary and duplicate code.\nvoid ImGui::TableSetColumnSortDirection(int column_n, ImGuiSortDirection sort_direction, bool append_to_sort_specs)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiTable* table = g.CurrentTable;\n\n    if (!(table->Flags & ImGuiTableFlags_SortMulti))\n        append_to_sort_specs = false;\n    if (!(table->Flags & ImGuiTableFlags_SortTristate))\n        IM_ASSERT(sort_direction != ImGuiSortDirection_None);\n\n    ImGuiTableColumnIdx sort_order_max = 0;\n    if (append_to_sort_specs)\n        for (int other_column_n = 0; other_column_n < table->ColumnsCount; other_column_n++)\n            sort_order_max = ImMax(sort_order_max, table->Columns[other_column_n].SortOrder);\n\n    ImGuiTableColumn* column = &table->Columns[column_n];\n    column->SortDirection = (ImU8)sort_direction;\n    if (column->SortDirection == ImGuiSortDirection_None)\n        column->SortOrder = -1;\n    else if (column->SortOrder == -1 || !append_to_sort_specs)\n        column->SortOrder = append_to_sort_specs ? sort_order_max + 1 : 0;\n\n    for (int other_column_n = 0; other_column_n < table->ColumnsCount; other_column_n++)\n    {\n        ImGuiTableColumn* other_column = &table->Columns[other_column_n];\n        if (other_column != column && !append_to_sort_specs)\n            other_column->SortOrder = -1;\n        TableFixColumnSortDirection(table, other_column);\n    }\n    table->IsSettingsDirty = true;\n    table->IsSortSpecsDirty = true;\n}\n\nvoid ImGui::TableSortSpecsSanitize(ImGuiTable* table)\n{\n    IM_ASSERT(table->Flags & ImGuiTableFlags_Sortable);\n\n    // Clear SortOrder from hidden column and verify that there's no gap or duplicate.\n    int sort_order_count = 0;\n    ImU64 sort_order_mask = 0x00;\n    for (int column_n = 0; column_n < table->ColumnsCount; column_n++)\n    {\n        ImGuiTableColumn* column = &table->Columns[column_n];\n        if (column->SortOrder != -1 && !column->IsEnabled)\n            column->SortOrder = -1;\n        if (column->SortOrder == -1)\n            continue;\n        sort_order_count++;\n        sort_order_mask |= ((ImU64)1 << column->SortOrder);\n        IM_ASSERT(sort_order_count < (int)sizeof(sort_order_mask) * 8);\n    }\n\n    const bool need_fix_linearize = ((ImU64)1 << sort_order_count) != (sort_order_mask + 1);\n    const bool need_fix_single_sort_order = (sort_order_count > 1) && !(table->Flags & ImGuiTableFlags_SortMulti);\n    if (need_fix_linearize || need_fix_single_sort_order)\n    {\n        ImU64 fixed_mask = 0x00;\n        for (int sort_n = 0; sort_n < sort_order_count; sort_n++)\n        {\n            // Fix: Rewrite sort order fields if needed so they have no gap or duplicate.\n            // (e.g. SortOrder 0 disappeared, SortOrder 1..2 exists --> rewrite then as SortOrder 0..1)\n            int column_with_smallest_sort_order = -1;\n            for (int column_n = 0; column_n < table->ColumnsCount; column_n++)\n                if ((fixed_mask & ((ImU64)1 << (ImU64)column_n)) == 0 && table->Columns[column_n].SortOrder != -1)\n                    if (column_with_smallest_sort_order == -1 || table->Columns[column_n].SortOrder < table->Columns[column_with_smallest_sort_order].SortOrder)\n                        column_with_smallest_sort_order = column_n;\n            IM_ASSERT(column_with_smallest_sort_order != -1);\n            fixed_mask |= ((ImU64)1 << column_with_smallest_sort_order);\n            table->Columns[column_with_smallest_sort_order].SortOrder = (ImGuiTableColumnIdx)sort_n;\n\n            // Fix: Make sure only one column has a SortOrder if ImGuiTableFlags_MultiSortable is not set.\n            if (need_fix_single_sort_order)\n            {\n                sort_order_count = 1;\n                for (int column_n = 0; column_n < table->ColumnsCount; column_n++)\n                    if (column_n != column_with_smallest_sort_order)\n                        table->Columns[column_n].SortOrder = -1;\n                break;\n            }\n        }\n    }\n\n    // Fallback default sort order (if no column had the ImGuiTableColumnFlags_DefaultSort flag)\n    if (sort_order_count == 0 && !(table->Flags & ImGuiTableFlags_SortTristate))\n        for (int column_n = 0; column_n < table->ColumnsCount; column_n++)\n        {\n            ImGuiTableColumn* column = &table->Columns[column_n];\n            if (column->IsEnabled && !(column->Flags & ImGuiTableColumnFlags_NoSort))\n            {\n                sort_order_count = 1;\n                column->SortOrder = 0;\n                column->SortDirection = (ImU8)TableGetColumnAvailSortDirection(column, 0);\n                break;\n            }\n        }\n\n    table->SortSpecsCount = (ImGuiTableColumnIdx)sort_order_count;\n}\n\nvoid ImGui::TableSortSpecsBuild(ImGuiTable* table)\n{\n    bool dirty = table->IsSortSpecsDirty;\n    if (dirty)\n    {\n        TableSortSpecsSanitize(table);\n        table->SortSpecsMulti.resize(table->SortSpecsCount <= 1 ? 0 : table->SortSpecsCount);\n        table->SortSpecs.SpecsDirty = true; // Mark as dirty for user\n        table->IsSortSpecsDirty = false; // Mark as not dirty for us\n    }\n\n    // Write output\n    ImGuiTableColumnSortSpecs* sort_specs = (table->SortSpecsCount == 0) ? NULL : (table->SortSpecsCount == 1) ? &table->SortSpecsSingle : table->SortSpecsMulti.Data;\n    if (dirty && sort_specs != NULL)\n        for (int column_n = 0; column_n < table->ColumnsCount; column_n++)\n        {\n            ImGuiTableColumn* column = &table->Columns[column_n];\n            if (column->SortOrder == -1)\n                continue;\n            IM_ASSERT(column->SortOrder < table->SortSpecsCount);\n            ImGuiTableColumnSortSpecs* sort_spec = &sort_specs[column->SortOrder];\n            sort_spec->ColumnUserID = column->UserID;\n            sort_spec->ColumnIndex = (ImGuiTableColumnIdx)column_n;\n            sort_spec->SortOrder = (ImGuiTableColumnIdx)column->SortOrder;\n            sort_spec->SortDirection = column->SortDirection;\n        }\n\n    table->SortSpecs.Specs = sort_specs;\n    table->SortSpecs.SpecsCount = table->SortSpecsCount;\n}\n\n//-------------------------------------------------------------------------\n// [SECTION] Tables: Headers\n//-------------------------------------------------------------------------\n// - TableGetHeaderRowHeight() [Internal]\n// - TableHeadersRow()\n// - TableHeader()\n//-------------------------------------------------------------------------\n\nfloat ImGui::TableGetHeaderRowHeight()\n{\n    // Caring for a minor edge case:\n    // Calculate row height, for the unlikely case that some labels may be taller than others.\n    // If we didn't do that, uneven header height would highlight but smaller one before the tallest wouldn't catch input for all height.\n    // In your custom header row you may omit this all together and just call TableNextRow() without a height...\n    float row_height = GetTextLineHeight();\n    int columns_count = TableGetColumnCount();\n    for (int column_n = 0; column_n < columns_count; column_n++)\n    {\n        ImGuiTableColumnFlags flags = TableGetColumnFlags(column_n);\n        if ((flags & ImGuiTableColumnFlags_IsEnabled) && !(flags & ImGuiTableColumnFlags_NoHeaderLabel))\n            row_height = ImMax(row_height, CalcTextSize(TableGetColumnName(column_n)).y);\n    }\n    row_height += GetStyle().CellPadding.y * 2.0f;\n    return row_height;\n}\n\n// [Public] This is a helper to output TableHeader() calls based on the column names declared in TableSetupColumn().\n// The intent is that advanced users willing to create customized headers would not need to use this helper\n// and can create their own! For example: TableHeader() may be preceeded by Checkbox() or other custom widgets.\n// See 'Demo->Tables->Custom headers' for a demonstration of implementing a custom version of this.\n// This code is constructed to not make much use of internal functions, as it is intended to be a template to copy.\n// FIXME-TABLE: TableOpenContextMenu() and TableGetHeaderRowHeight() are not public.\nvoid ImGui::TableHeadersRow()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiTable* table = g.CurrentTable;\n    IM_ASSERT(table != NULL && \"Need to call TableHeadersRow() after BeginTable()!\");\n\n    // Layout if not already done (this is automatically done by TableNextRow, we do it here solely to facilitate stepping in debugger as it is frequent to step in TableUpdateLayout)\n    if (!table->IsLayoutLocked)\n        TableUpdateLayout(table);\n\n    // Open row\n    const float row_y1 = GetCursorScreenPos().y;\n    const float row_height = TableGetHeaderRowHeight();\n    TableNextRow(ImGuiTableRowFlags_Headers, row_height);\n    if (table->HostSkipItems) // Merely an optimization, you may skip in your own code.\n        return;\n\n    const int columns_count = TableGetColumnCount();\n    for (int column_n = 0; column_n < columns_count; column_n++)\n    {\n        if (!TableSetColumnIndex(column_n))\n            continue;\n\n        // Push an id to allow unnamed labels (generally accidental, but let's behave nicely with them)\n        // - in your own code you may omit the PushID/PopID all-together, provided you know they won't collide\n        // - table->InstanceCurrent is only >0 when we use multiple BeginTable/EndTable calls with same identifier.\n        const char* name = (TableGetColumnFlags(column_n) & ImGuiTableColumnFlags_NoHeaderLabel) ? \"\" : TableGetColumnName(column_n);\n        PushID(table->InstanceCurrent * table->ColumnsCount + column_n);\n        TableHeader(name);\n        PopID();\n    }\n\n    // Allow opening popup from the right-most section after the last column.\n    ImVec2 mouse_pos = ImGui::GetMousePos();\n    if (IsMouseReleased(1) && TableGetHoveredColumn() == columns_count)\n        if (mouse_pos.y >= row_y1 && mouse_pos.y < row_y1 + row_height)\n            TableOpenContextMenu(-1); // Will open a non-column-specific popup.\n}\n\n// Emit a column header (text + optional sort order)\n// We cpu-clip text here so that all columns headers can be merged into a same draw call.\n// Note that because of how we cpu-clip and display sorting indicators, you _cannot_ use SameLine() after a TableHeader()\nvoid ImGui::TableHeader(const char* label)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    if (window->SkipItems)\n        return;\n\n    ImGuiTable* table = g.CurrentTable;\n    IM_ASSERT(table != NULL && \"Need to call TableHeader() after BeginTable()!\");\n    IM_ASSERT(table->CurrentColumn != -1);\n    const int column_n = table->CurrentColumn;\n    ImGuiTableColumn* column = &table->Columns[column_n];\n\n    // Label\n    if (label == NULL)\n        label = \"\";\n    const char* label_end = FindRenderedTextEnd(label);\n    ImVec2 label_size = CalcTextSize(label, label_end, true);\n    ImVec2 label_pos = window->DC.CursorPos;\n\n    // If we already got a row height, there's use that.\n    // FIXME-TABLE: Padding problem if the correct outer-padding CellBgRect strays off our ClipRect?\n    ImRect cell_r = TableGetCellBgRect(table, column_n);\n    float label_height = ImMax(label_size.y, table->RowMinHeight - table->CellPaddingY * 2.0f);\n\n    // Calculate ideal size for sort order arrow\n    float w_arrow = 0.0f;\n    float w_sort_text = 0.0f;\n    char sort_order_suf[4] = \"\";\n    const float ARROW_SCALE = 0.65f;\n    if ((table->Flags & ImGuiTableFlags_Sortable) && !(column->Flags & ImGuiTableColumnFlags_NoSort))\n    {\n        w_arrow = ImFloor(g.FontSize * ARROW_SCALE + g.Style.FramePadding.x);\n        if (column->SortOrder > 0)\n        {\n            ImFormatString(sort_order_suf, IM_ARRAYSIZE(sort_order_suf), \"%d\", column->SortOrder + 1);\n            w_sort_text = g.Style.ItemInnerSpacing.x + CalcTextSize(sort_order_suf).x;\n        }\n    }\n\n    // We feed our unclipped width to the column without writing on CursorMaxPos, so that column is still considering for merging.\n    float max_pos_x = label_pos.x + label_size.x + w_sort_text + w_arrow;\n    column->ContentMaxXHeadersUsed = ImMax(column->ContentMaxXHeadersUsed, column->WorkMaxX);\n    column->ContentMaxXHeadersIdeal = ImMax(column->ContentMaxXHeadersIdeal, max_pos_x);\n\n    // Keep header highlighted when context menu is open.\n    const bool selected = (table->IsContextPopupOpen && table->ContextPopupColumn == column_n && table->InstanceInteracted == table->InstanceCurrent);\n    ImGuiID id = window->GetID(label);\n    ImRect bb(cell_r.Min.x, cell_r.Min.y, cell_r.Max.x, ImMax(cell_r.Max.y, cell_r.Min.y + label_height + g.Style.CellPadding.y * 2.0f));\n    ItemSize(ImVec2(0.0f, label_height)); // Don't declare unclipped width, it'll be fed ContentMaxPosHeadersIdeal\n    if (!ItemAdd(bb, id))\n        return;\n\n    //GetForegroundDrawList()->AddRect(cell_r.Min, cell_r.Max, IM_COL32(255, 0, 0, 255)); // [DEBUG]\n    //GetForegroundDrawList()->AddRect(bb.Min, bb.Max, IM_COL32(255, 0, 0, 255)); // [DEBUG]\n\n    // Using AllowItemOverlap mode because we cover the whole cell, and we want user to be able to submit subsequent items.\n    bool hovered, held;\n    bool pressed = ButtonBehavior(bb, id, &hovered, &held, ImGuiButtonFlags_AllowItemOverlap);\n    if (g.ActiveId != id)\n        SetItemAllowOverlap();\n    if (held || hovered || selected)\n    {\n        const ImU32 col = GetColorU32(held ? ImGuiCol_HeaderActive : hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header);\n        //RenderFrame(bb.Min, bb.Max, col, false, 0.0f);\n        TableSetBgColor(ImGuiTableBgTarget_CellBg, col, table->CurrentColumn);\n    }\n    else\n    {\n        // Submit single cell bg color in the case we didn't submit a full header row\n        if ((table->RowFlags & ImGuiTableRowFlags_Headers) == 0)\n            TableSetBgColor(ImGuiTableBgTarget_CellBg, GetColorU32(ImGuiCol_TableHeaderBg), table->CurrentColumn);\n    }\n    RenderNavHighlight(bb, id, ImGuiNavHighlightFlags_TypeThin | ImGuiNavHighlightFlags_NoRounding);\n    if (held)\n        table->HeldHeaderColumn = (ImGuiTableColumnIdx)column_n;\n    window->DC.CursorPos.y -= g.Style.ItemSpacing.y * 0.5f;\n\n    // Drag and drop to re-order columns.\n    // FIXME-TABLE: Scroll request while reordering a column and it lands out of the scrolling zone.\n    if (held && (table->Flags & ImGuiTableFlags_Reorderable) && IsMouseDragging(0) && !g.DragDropActive)\n    {\n        // While moving a column it will jump on the other side of the mouse, so we also test for MouseDelta.x\n        table->ReorderColumn = (ImGuiTableColumnIdx)column_n;\n        table->InstanceInteracted = table->InstanceCurrent;\n\n        // We don't reorder: through the frozen<>unfrozen line, or through a column that is marked with ImGuiTableColumnFlags_NoReorder.\n        if (g.IO.MouseDelta.x < 0.0f && g.IO.MousePos.x < cell_r.Min.x)\n            if (ImGuiTableColumn* prev_column = (column->PrevEnabledColumn != -1) ? &table->Columns[column->PrevEnabledColumn] : NULL)\n                if (!((column->Flags | prev_column->Flags) & ImGuiTableColumnFlags_NoReorder))\n                    if ((column->IndexWithinEnabledSet < table->FreezeColumnsRequest) == (prev_column->IndexWithinEnabledSet < table->FreezeColumnsRequest))\n                        table->ReorderColumnDir = -1;\n        if (g.IO.MouseDelta.x > 0.0f && g.IO.MousePos.x > cell_r.Max.x)\n            if (ImGuiTableColumn* next_column = (column->NextEnabledColumn != -1) ? &table->Columns[column->NextEnabledColumn] : NULL)\n                if (!((column->Flags | next_column->Flags) & ImGuiTableColumnFlags_NoReorder))\n                    if ((column->IndexWithinEnabledSet < table->FreezeColumnsRequest) == (next_column->IndexWithinEnabledSet < table->FreezeColumnsRequest))\n                        table->ReorderColumnDir = +1;\n    }\n\n    // Sort order arrow\n    const float ellipsis_max = cell_r.Max.x - w_arrow - w_sort_text;\n    if ((table->Flags & ImGuiTableFlags_Sortable) && !(column->Flags & ImGuiTableColumnFlags_NoSort))\n    {\n        if (column->SortOrder != -1)\n        {\n            float x = ImMax(cell_r.Min.x, cell_r.Max.x - w_arrow - w_sort_text);\n            float y = label_pos.y;\n            if (column->SortOrder > 0)\n            {\n                PushStyleColor(ImGuiCol_Text, GetColorU32(ImGuiCol_Text, 0.70f));\n                RenderText(ImVec2(x + g.Style.ItemInnerSpacing.x, y), sort_order_suf);\n                PopStyleColor();\n                x += w_sort_text;\n            }\n            RenderArrow(window->DrawList, ImVec2(x, y), GetColorU32(ImGuiCol_Text), column->SortDirection == ImGuiSortDirection_Ascending ? ImGuiDir_Up : ImGuiDir_Down, ARROW_SCALE);\n        }\n\n        // Handle clicking on column header to adjust Sort Order\n        if (pressed && table->ReorderColumn != column_n)\n        {\n            ImGuiSortDirection sort_direction = TableGetColumnNextSortDirection(column);\n            TableSetColumnSortDirection(column_n, sort_direction, g.IO.KeyShift);\n        }\n    }\n\n    // Render clipped label. Clipping here ensure that in the majority of situations, all our header cells will\n    // be merged into a single draw call.\n    //window->DrawList->AddCircleFilled(ImVec2(ellipsis_max, label_pos.y), 40, IM_COL32_WHITE);\n    RenderTextEllipsis(window->DrawList, label_pos, ImVec2(ellipsis_max, label_pos.y + label_height + g.Style.FramePadding.y), ellipsis_max, ellipsis_max, label, label_end, &label_size);\n\n    const bool text_clipped = label_size.x > (ellipsis_max - label_pos.x);\n    if (text_clipped && hovered && g.HoveredIdNotActiveTimer > g.TooltipSlowDelay)\n        SetTooltip(\"%.*s\", (int)(label_end - label), label);\n\n    // We don't use BeginPopupContextItem() because we want the popup to stay up even after the column is hidden\n    if (IsMouseReleased(1) && IsItemHovered())\n        TableOpenContextMenu(column_n);\n}\n\n//-------------------------------------------------------------------------\n// [SECTION] Tables: Context Menu\n//-------------------------------------------------------------------------\n// - TableOpenContextMenu() [Internal]\n// - TableDrawContextMenu() [Internal]\n//-------------------------------------------------------------------------\n\n// Use -1 to open menu not specific to a given column.\nvoid ImGui::TableOpenContextMenu(int column_n)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiTable* table = g.CurrentTable;\n    if (column_n == -1 && table->CurrentColumn != -1)   // When called within a column automatically use this one (for consistency)\n        column_n = table->CurrentColumn;\n    if (column_n == table->ColumnsCount)                // To facilitate using with TableGetHoveredColumn()\n        column_n = -1;\n    IM_ASSERT(column_n >= -1 && column_n < table->ColumnsCount);\n    if (table->Flags & (ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable))\n    {\n        table->IsContextPopupOpen = true;\n        table->ContextPopupColumn = (ImGuiTableColumnIdx)column_n;\n        table->InstanceInteracted = table->InstanceCurrent;\n        const ImGuiID context_menu_id = ImHashStr(\"##ContextMenu\", 0, table->ID);\n        OpenPopupEx(context_menu_id, ImGuiPopupFlags_None);\n    }\n}\n\n// Output context menu into current window (generally a popup)\n// FIXME-TABLE: Ideally this should be writable by the user. Full programmatic access to that data?\nvoid ImGui::TableDrawContextMenu(ImGuiTable* table)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    if (window->SkipItems)\n        return;\n\n    bool want_separator = false;\n    const int column_n = (table->ContextPopupColumn >= 0 && table->ContextPopupColumn < table->ColumnsCount) ? table->ContextPopupColumn : -1;\n    ImGuiTableColumn* column = (column_n != -1) ? &table->Columns[column_n] : NULL;\n\n    // Sizing\n    if (table->Flags & ImGuiTableFlags_Resizable)\n    {\n        if (column != NULL)\n        {\n            const bool can_resize = !(column->Flags & ImGuiTableColumnFlags_NoResize) && column->IsEnabled;\n            if (MenuItem(\"Size column to fit###SizeOne\", NULL, false, can_resize))\n                TableSetColumnWidthAutoSingle(table, column_n);\n        }\n\n        const char* size_all_desc;\n        if (table->ColumnsEnabledFixedCount == table->ColumnsEnabledCount && (table->Flags & ImGuiTableFlags_SizingMask_) != ImGuiTableFlags_SizingFixedSame)\n            size_all_desc = \"Size all columns to fit###SizeAll\";        // All fixed\n        else\n            size_all_desc = \"Size all columns to default###SizeAll\";    // All stretch or mixed\n        if (MenuItem(size_all_desc, NULL))\n            TableSetColumnWidthAutoAll(table);\n        want_separator = true;\n    }\n\n    // Ordering\n    if (table->Flags & ImGuiTableFlags_Reorderable)\n    {\n        if (MenuItem(\"Reset order\", NULL, false, !table->IsDefaultDisplayOrder))\n            table->IsResetDisplayOrderRequest = true;\n        want_separator = true;\n    }\n\n    // Reset all (should work but seems unnecessary/noisy to expose?)\n    //if (MenuItem(\"Reset all\"))\n    //    table->IsResetAllRequest = true;\n\n    // Sorting\n    // (modify TableOpenContextMenu() to add _Sortable flag if enabling this)\n#if 0\n    if ((table->Flags & ImGuiTableFlags_Sortable) && column != NULL && (column->Flags & ImGuiTableColumnFlags_NoSort) == 0)\n    {\n        if (want_separator)\n            Separator();\n        want_separator = true;\n\n        bool append_to_sort_specs = g.IO.KeyShift;\n        if (MenuItem(\"Sort in Ascending Order\", NULL, column->SortOrder != -1 && column->SortDirection == ImGuiSortDirection_Ascending, (column->Flags & ImGuiTableColumnFlags_NoSortAscending) == 0))\n            TableSetColumnSortDirection(table, column_n, ImGuiSortDirection_Ascending, append_to_sort_specs);\n        if (MenuItem(\"Sort in Descending Order\", NULL, column->SortOrder != -1 && column->SortDirection == ImGuiSortDirection_Descending, (column->Flags & ImGuiTableColumnFlags_NoSortDescending) == 0))\n            TableSetColumnSortDirection(table, column_n, ImGuiSortDirection_Descending, append_to_sort_specs);\n    }\n#endif\n\n    // Hiding / Visibility\n    if (table->Flags & ImGuiTableFlags_Hideable)\n    {\n        if (want_separator)\n            Separator();\n        want_separator = true;\n\n        PushItemFlag(ImGuiItemFlags_SelectableDontClosePopup, true);\n        for (int other_column_n = 0; other_column_n < table->ColumnsCount; other_column_n++)\n        {\n            ImGuiTableColumn* other_column = &table->Columns[other_column_n];\n            if (other_column->Flags & ImGuiTableColumnFlags_Disabled)\n                continue;\n\n            const char* name = TableGetColumnName(table, other_column_n);\n            if (name == NULL || name[0] == 0)\n                name = \"<Unknown>\";\n\n            // Make sure we can't hide the last active column\n            bool menu_item_active = (other_column->Flags & ImGuiTableColumnFlags_NoHide) ? false : true;\n            if (other_column->IsUserEnabled && table->ColumnsEnabledCount <= 1)\n                menu_item_active = false;\n            if (MenuItem(name, NULL, other_column->IsUserEnabled, menu_item_active))\n                other_column->IsUserEnabledNextFrame = !other_column->IsUserEnabled;\n        }\n        PopItemFlag();\n    }\n}\n\n//-------------------------------------------------------------------------\n// [SECTION] Tables: Settings (.ini data)\n//-------------------------------------------------------------------------\n// FIXME: The binding/finding/creating flow are too confusing.\n//-------------------------------------------------------------------------\n// - TableSettingsInit() [Internal]\n// - TableSettingsCalcChunkSize() [Internal]\n// - TableSettingsCreate() [Internal]\n// - TableSettingsFindByID() [Internal]\n// - TableGetBoundSettings() [Internal]\n// - TableResetSettings()\n// - TableSaveSettings() [Internal]\n// - TableLoadSettings() [Internal]\n// - TableSettingsHandler_ClearAll() [Internal]\n// - TableSettingsHandler_ApplyAll() [Internal]\n// - TableSettingsHandler_ReadOpen() [Internal]\n// - TableSettingsHandler_ReadLine() [Internal]\n// - TableSettingsHandler_WriteAll() [Internal]\n// - TableSettingsInstallHandler() [Internal]\n//-------------------------------------------------------------------------\n// [Init] 1: TableSettingsHandler_ReadXXXX()   Load and parse .ini file into TableSettings.\n// [Main] 2: TableLoadSettings()               When table is created, bind Table to TableSettings, serialize TableSettings data into Table.\n// [Main] 3: TableSaveSettings()               When table properties are modified, serialize Table data into bound or new TableSettings, mark .ini as dirty.\n// [Main] 4: TableSettingsHandler_WriteAll()   When .ini file is dirty (which can come from other source), save TableSettings into .ini file.\n//-------------------------------------------------------------------------\n\n// Clear and initialize empty settings instance\nstatic void TableSettingsInit(ImGuiTableSettings* settings, ImGuiID id, int columns_count, int columns_count_max)\n{\n    IM_PLACEMENT_NEW(settings) ImGuiTableSettings();\n    ImGuiTableColumnSettings* settings_column = settings->GetColumnSettings();\n    for (int n = 0; n < columns_count_max; n++, settings_column++)\n        IM_PLACEMENT_NEW(settings_column) ImGuiTableColumnSettings();\n    settings->ID = id;\n    settings->ColumnsCount = (ImGuiTableColumnIdx)columns_count;\n    settings->ColumnsCountMax = (ImGuiTableColumnIdx)columns_count_max;\n    settings->WantApply = true;\n}\n\nstatic size_t TableSettingsCalcChunkSize(int columns_count)\n{\n    return sizeof(ImGuiTableSettings) + (size_t)columns_count * sizeof(ImGuiTableColumnSettings);\n}\n\nImGuiTableSettings* ImGui::TableSettingsCreate(ImGuiID id, int columns_count)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiTableSettings* settings = g.SettingsTables.alloc_chunk(TableSettingsCalcChunkSize(columns_count));\n    TableSettingsInit(settings, id, columns_count, columns_count);\n    return settings;\n}\n\n// Find existing settings\nImGuiTableSettings* ImGui::TableSettingsFindByID(ImGuiID id)\n{\n    // FIXME-OPT: Might want to store a lookup map for this?\n    ImGuiContext& g = *GImGui;\n    for (ImGuiTableSettings* settings = g.SettingsTables.begin(); settings != NULL; settings = g.SettingsTables.next_chunk(settings))\n        if (settings->ID == id)\n            return settings;\n    return NULL;\n}\n\n// Get settings for a given table, NULL if none\nImGuiTableSettings* ImGui::TableGetBoundSettings(ImGuiTable* table)\n{\n    if (table->SettingsOffset != -1)\n    {\n        ImGuiContext& g = *GImGui;\n        ImGuiTableSettings* settings = g.SettingsTables.ptr_from_offset(table->SettingsOffset);\n        IM_ASSERT(settings->ID == table->ID);\n        if (settings->ColumnsCountMax >= table->ColumnsCount)\n            return settings; // OK\n        settings->ID = 0; // Invalidate storage, we won't fit because of a count change\n    }\n    return NULL;\n}\n\n// Restore initial state of table (with or without saved settings)\nvoid ImGui::TableResetSettings(ImGuiTable* table)\n{\n    table->IsInitializing = table->IsSettingsDirty = true;\n    table->IsResetAllRequest = false;\n    table->IsSettingsRequestLoad = false;                   // Don't reload from ini\n    table->SettingsLoadedFlags = ImGuiTableFlags_None;      // Mark as nothing loaded so our initialized data becomes authoritative\n}\n\nvoid ImGui::TableSaveSettings(ImGuiTable* table)\n{\n    table->IsSettingsDirty = false;\n    if (table->Flags & ImGuiTableFlags_NoSavedSettings)\n        return;\n\n    // Bind or create settings data\n    ImGuiContext& g = *GImGui;\n    ImGuiTableSettings* settings = TableGetBoundSettings(table);\n    if (settings == NULL)\n    {\n        settings = TableSettingsCreate(table->ID, table->ColumnsCount);\n        table->SettingsOffset = g.SettingsTables.offset_from_ptr(settings);\n    }\n    settings->ColumnsCount = (ImGuiTableColumnIdx)table->ColumnsCount;\n\n    // Serialize ImGuiTable/ImGuiTableColumn into ImGuiTableSettings/ImGuiTableColumnSettings\n    IM_ASSERT(settings->ID == table->ID);\n    IM_ASSERT(settings->ColumnsCount == table->ColumnsCount && settings->ColumnsCountMax >= settings->ColumnsCount);\n    ImGuiTableColumn* column = table->Columns.Data;\n    ImGuiTableColumnSettings* column_settings = settings->GetColumnSettings();\n\n    bool save_ref_scale = false;\n    settings->SaveFlags = ImGuiTableFlags_None;\n    for (int n = 0; n < table->ColumnsCount; n++, column++, column_settings++)\n    {\n        const float width_or_weight = (column->Flags & ImGuiTableColumnFlags_WidthStretch) ? column->StretchWeight : column->WidthRequest;\n        column_settings->WidthOrWeight = width_or_weight;\n        column_settings->Index = (ImGuiTableColumnIdx)n;\n        column_settings->DisplayOrder = column->DisplayOrder;\n        column_settings->SortOrder = column->SortOrder;\n        column_settings->SortDirection = column->SortDirection;\n        column_settings->IsEnabled = column->IsUserEnabled;\n        column_settings->IsStretch = (column->Flags & ImGuiTableColumnFlags_WidthStretch) ? 1 : 0;\n        if ((column->Flags & ImGuiTableColumnFlags_WidthStretch) == 0)\n            save_ref_scale = true;\n\n        // We skip saving some data in the .ini file when they are unnecessary to restore our state.\n        // Note that fixed width where initial width was derived from auto-fit will always be saved as InitStretchWeightOrWidth will be 0.0f.\n        // FIXME-TABLE: We don't have logic to easily compare SortOrder to DefaultSortOrder yet so it's always saved when present.\n        if (width_or_weight != column->InitStretchWeightOrWidth)\n            settings->SaveFlags |= ImGuiTableFlags_Resizable;\n        if (column->DisplayOrder != n)\n            settings->SaveFlags |= ImGuiTableFlags_Reorderable;\n        if (column->SortOrder != -1)\n            settings->SaveFlags |= ImGuiTableFlags_Sortable;\n        if (column->IsUserEnabled != ((column->Flags & ImGuiTableColumnFlags_DefaultHide) == 0))\n            settings->SaveFlags |= ImGuiTableFlags_Hideable;\n    }\n    settings->SaveFlags &= table->Flags;\n    settings->RefScale = save_ref_scale ? table->RefScale : 0.0f;\n\n    MarkIniSettingsDirty();\n}\n\nvoid ImGui::TableLoadSettings(ImGuiTable* table)\n{\n    ImGuiContext& g = *GImGui;\n    table->IsSettingsRequestLoad = false;\n    if (table->Flags & ImGuiTableFlags_NoSavedSettings)\n        return;\n\n    // Bind settings\n    ImGuiTableSettings* settings;\n    if (table->SettingsOffset == -1)\n    {\n        settings = TableSettingsFindByID(table->ID);\n        if (settings == NULL)\n            return;\n        if (settings->ColumnsCount != table->ColumnsCount) // Allow settings if columns count changed. We could otherwise decide to return...\n            table->IsSettingsDirty = true;\n        table->SettingsOffset = g.SettingsTables.offset_from_ptr(settings);\n    }\n    else\n    {\n        settings = TableGetBoundSettings(table);\n    }\n\n    table->SettingsLoadedFlags = settings->SaveFlags;\n    table->RefScale = settings->RefScale;\n\n    // Serialize ImGuiTableSettings/ImGuiTableColumnSettings into ImGuiTable/ImGuiTableColumn\n    ImGuiTableColumnSettings* column_settings = settings->GetColumnSettings();\n    ImU64 display_order_mask = 0;\n    for (int data_n = 0; data_n < settings->ColumnsCount; data_n++, column_settings++)\n    {\n        int column_n = column_settings->Index;\n        if (column_n < 0 || column_n >= table->ColumnsCount)\n            continue;\n\n        ImGuiTableColumn* column = &table->Columns[column_n];\n        if (settings->SaveFlags & ImGuiTableFlags_Resizable)\n        {\n            if (column_settings->IsStretch)\n                column->StretchWeight = column_settings->WidthOrWeight;\n            else\n                column->WidthRequest = column_settings->WidthOrWeight;\n            column->AutoFitQueue = 0x00;\n        }\n        if (settings->SaveFlags & ImGuiTableFlags_Reorderable)\n            column->DisplayOrder = column_settings->DisplayOrder;\n        else\n            column->DisplayOrder = (ImGuiTableColumnIdx)column_n;\n        display_order_mask |= (ImU64)1 << column->DisplayOrder;\n        column->IsUserEnabled = column->IsUserEnabledNextFrame = column_settings->IsEnabled;\n        column->SortOrder = column_settings->SortOrder;\n        column->SortDirection = column_settings->SortDirection;\n    }\n\n    // Validate and fix invalid display order data\n    const ImU64 expected_display_order_mask = (settings->ColumnsCount == 64) ? ~0 : ((ImU64)1 << settings->ColumnsCount) - 1;\n    if (display_order_mask != expected_display_order_mask)\n        for (int column_n = 0; column_n < table->ColumnsCount; column_n++)\n            table->Columns[column_n].DisplayOrder = (ImGuiTableColumnIdx)column_n;\n\n    // Rebuild index\n    for (int column_n = 0; column_n < table->ColumnsCount; column_n++)\n        table->DisplayOrderToIndex[table->Columns[column_n].DisplayOrder] = (ImGuiTableColumnIdx)column_n;\n}\n\nstatic void TableSettingsHandler_ClearAll(ImGuiContext* ctx, ImGuiSettingsHandler*)\n{\n    ImGuiContext& g = *ctx;\n    for (int i = 0; i != g.Tables.GetMapSize(); i++)\n        if (ImGuiTable* table = g.Tables.TryGetMapData(i))\n            table->SettingsOffset = -1;\n    g.SettingsTables.clear();\n}\n\n// Apply to existing windows (if any)\nstatic void TableSettingsHandler_ApplyAll(ImGuiContext* ctx, ImGuiSettingsHandler*)\n{\n    ImGuiContext& g = *ctx;\n    for (int i = 0; i != g.Tables.GetMapSize(); i++)\n        if (ImGuiTable* table = g.Tables.TryGetMapData(i))\n        {\n            table->IsSettingsRequestLoad = true;\n            table->SettingsOffset = -1;\n        }\n}\n\nstatic void* TableSettingsHandler_ReadOpen(ImGuiContext*, ImGuiSettingsHandler*, const char* name)\n{\n    ImGuiID id = 0;\n    int columns_count = 0;\n    if (sscanf(name, \"0x%08X,%d\", &id, &columns_count) < 2)\n        return NULL;\n\n    if (ImGuiTableSettings* settings = ImGui::TableSettingsFindByID(id))\n    {\n        if (settings->ColumnsCountMax >= columns_count)\n        {\n            TableSettingsInit(settings, id, columns_count, settings->ColumnsCountMax); // Recycle\n            return settings;\n        }\n        settings->ID = 0; // Invalidate storage, we won't fit because of a count change\n    }\n    return ImGui::TableSettingsCreate(id, columns_count);\n}\n\nstatic void TableSettingsHandler_ReadLine(ImGuiContext*, ImGuiSettingsHandler*, void* entry, const char* line)\n{\n    // \"Column 0  UserID=0x42AD2D21 Width=100 Visible=1 Order=0 Sort=0v\"\n    ImGuiTableSettings* settings = (ImGuiTableSettings*)entry;\n    float f = 0.0f;\n    int column_n = 0, r = 0, n = 0;\n\n    if (sscanf(line, \"RefScale=%f\", &f) == 1) { settings->RefScale = f; return; }\n\n    if (sscanf(line, \"Column %d%n\", &column_n, &r) == 1)\n    {\n        if (column_n < 0 || column_n >= settings->ColumnsCount)\n            return;\n        line = ImStrSkipBlank(line + r);\n        char c = 0;\n        ImGuiTableColumnSettings* column = settings->GetColumnSettings() + column_n;\n        column->Index = (ImGuiTableColumnIdx)column_n;\n        if (sscanf(line, \"UserID=0x%08X%n\", (ImU32*)&n, &r)==1) { line = ImStrSkipBlank(line + r); column->UserID = (ImGuiID)n; }\n        if (sscanf(line, \"Width=%d%n\", &n, &r) == 1)            { line = ImStrSkipBlank(line + r); column->WidthOrWeight = (float)n; column->IsStretch = 0; settings->SaveFlags |= ImGuiTableFlags_Resizable; }\n        if (sscanf(line, \"Weight=%f%n\", &f, &r) == 1)           { line = ImStrSkipBlank(line + r); column->WidthOrWeight = f; column->IsStretch = 1; settings->SaveFlags |= ImGuiTableFlags_Resizable; }\n        if (sscanf(line, \"Visible=%d%n\", &n, &r) == 1)          { line = ImStrSkipBlank(line + r); column->IsEnabled = (ImU8)n; settings->SaveFlags |= ImGuiTableFlags_Hideable; }\n        if (sscanf(line, \"Order=%d%n\", &n, &r) == 1)            { line = ImStrSkipBlank(line + r); column->DisplayOrder = (ImGuiTableColumnIdx)n; settings->SaveFlags |= ImGuiTableFlags_Reorderable; }\n        if (sscanf(line, \"Sort=%d%c%n\", &n, &c, &r) == 2)       { line = ImStrSkipBlank(line + r); column->SortOrder = (ImGuiTableColumnIdx)n; column->SortDirection = (c == '^') ? ImGuiSortDirection_Descending : ImGuiSortDirection_Ascending; settings->SaveFlags |= ImGuiTableFlags_Sortable; }\n    }\n}\n\nstatic void TableSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* buf)\n{\n    ImGuiContext& g = *ctx;\n    for (ImGuiTableSettings* settings = g.SettingsTables.begin(); settings != NULL; settings = g.SettingsTables.next_chunk(settings))\n    {\n        if (settings->ID == 0) // Skip ditched settings\n            continue;\n\n        // TableSaveSettings() may clear some of those flags when we establish that the data can be stripped\n        // (e.g. Order was unchanged)\n        const bool save_size    = (settings->SaveFlags & ImGuiTableFlags_Resizable) != 0;\n        const bool save_visible = (settings->SaveFlags & ImGuiTableFlags_Hideable) != 0;\n        const bool save_order   = (settings->SaveFlags & ImGuiTableFlags_Reorderable) != 0;\n        const bool save_sort    = (settings->SaveFlags & ImGuiTableFlags_Sortable) != 0;\n        if (!save_size && !save_visible && !save_order && !save_sort)\n            continue;\n\n        buf->reserve(buf->size() + 30 + settings->ColumnsCount * 50); // ballpark reserve\n        buf->appendf(\"[%s][0x%08X,%d]\\n\", handler->TypeName, settings->ID, settings->ColumnsCount);\n        if (settings->RefScale != 0.0f)\n            buf->appendf(\"RefScale=%g\\n\", settings->RefScale);\n        ImGuiTableColumnSettings* column = settings->GetColumnSettings();\n        for (int column_n = 0; column_n < settings->ColumnsCount; column_n++, column++)\n        {\n            // \"Column 0  UserID=0x42AD2D21 Width=100 Visible=1 Order=0 Sort=0v\"\n            bool save_column = column->UserID != 0 || save_size || save_visible || save_order || (save_sort && column->SortOrder != -1);\n            if (!save_column)\n                continue;\n            buf->appendf(\"Column %-2d\", column_n);\n            if (column->UserID != 0)                    buf->appendf(\" UserID=%08X\", column->UserID);\n            if (save_size && column->IsStretch)         buf->appendf(\" Weight=%.4f\", column->WidthOrWeight);\n            if (save_size && !column->IsStretch)        buf->appendf(\" Width=%d\", (int)column->WidthOrWeight);\n            if (save_visible)                           buf->appendf(\" Visible=%d\", column->IsEnabled);\n            if (save_order)                             buf->appendf(\" Order=%d\", column->DisplayOrder);\n            if (save_sort && column->SortOrder != -1)   buf->appendf(\" Sort=%d%c\", column->SortOrder, (column->SortDirection == ImGuiSortDirection_Ascending) ? 'v' : '^');\n            buf->append(\"\\n\");\n        }\n        buf->append(\"\\n\");\n    }\n}\n\nvoid ImGui::TableSettingsInstallHandler(ImGuiContext* context)\n{\n    ImGuiContext& g = *context;\n    ImGuiSettingsHandler ini_handler;\n    ini_handler.TypeName = \"Table\";\n    ini_handler.TypeHash = ImHashStr(\"Table\");\n    ini_handler.ClearAllFn = TableSettingsHandler_ClearAll;\n    ini_handler.ReadOpenFn = TableSettingsHandler_ReadOpen;\n    ini_handler.ReadLineFn = TableSettingsHandler_ReadLine;\n    ini_handler.ApplyAllFn = TableSettingsHandler_ApplyAll;\n    ini_handler.WriteAllFn = TableSettingsHandler_WriteAll;\n    g.SettingsHandlers.push_back(ini_handler);\n}\n\n//-------------------------------------------------------------------------\n// [SECTION] Tables: Garbage Collection\n//-------------------------------------------------------------------------\n// - TableRemove() [Internal]\n// - TableGcCompactTransientBuffers() [Internal]\n// - TableGcCompactSettings() [Internal]\n//-------------------------------------------------------------------------\n\n// Remove Table (currently only used by TestEngine)\nvoid ImGui::TableRemove(ImGuiTable* table)\n{\n    //IMGUI_DEBUG_LOG(\"TableRemove() id=0x%08X\\n\", table->ID);\n    ImGuiContext& g = *GImGui;\n    int table_idx = g.Tables.GetIndex(table);\n    //memset(table->RawData.Data, 0, table->RawData.size_in_bytes());\n    //memset(table, 0, sizeof(ImGuiTable));\n    g.Tables.Remove(table->ID, table);\n    g.TablesLastTimeActive[table_idx] = -1.0f;\n}\n\n// Free up/compact internal Table buffers for when it gets unused\nvoid ImGui::TableGcCompactTransientBuffers(ImGuiTable* table)\n{\n    //IMGUI_DEBUG_LOG(\"TableGcCompactTransientBuffers() id=0x%08X\\n\", table->ID);\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(table->MemoryCompacted == false);\n    table->SortSpecs.Specs = NULL;\n    table->SortSpecsMulti.clear();\n    table->IsSortSpecsDirty = true; // FIXME: shouldn't have to leak into user performing a sort\n    table->ColumnsNames.clear();\n    table->MemoryCompacted = true;\n    for (int n = 0; n < table->ColumnsCount; n++)\n        table->Columns[n].NameOffset = -1;\n    g.TablesLastTimeActive[g.Tables.GetIndex(table)] = -1.0f;\n}\n\nvoid ImGui::TableGcCompactTransientBuffers(ImGuiTableTempData* temp_data)\n{\n    temp_data->DrawSplitter.ClearFreeMemory();\n    temp_data->LastTimeActive = -1.0f;\n}\n\n// Compact and remove unused settings data (currently only used by TestEngine)\nvoid ImGui::TableGcCompactSettings()\n{\n    ImGuiContext& g = *GImGui;\n    int required_memory = 0;\n    for (ImGuiTableSettings* settings = g.SettingsTables.begin(); settings != NULL; settings = g.SettingsTables.next_chunk(settings))\n        if (settings->ID != 0)\n            required_memory += (int)TableSettingsCalcChunkSize(settings->ColumnsCount);\n    if (required_memory == g.SettingsTables.Buf.Size)\n        return;\n    ImChunkStream<ImGuiTableSettings> new_chunk_stream;\n    new_chunk_stream.Buf.reserve(required_memory);\n    for (ImGuiTableSettings* settings = g.SettingsTables.begin(); settings != NULL; settings = g.SettingsTables.next_chunk(settings))\n        if (settings->ID != 0)\n            memcpy(new_chunk_stream.alloc_chunk(TableSettingsCalcChunkSize(settings->ColumnsCount)), settings, TableSettingsCalcChunkSize(settings->ColumnsCount));\n    g.SettingsTables.swap(new_chunk_stream);\n}\n\n\n//-------------------------------------------------------------------------\n// [SECTION] Tables: Debugging\n//-------------------------------------------------------------------------\n// - DebugNodeTable() [Internal]\n//-------------------------------------------------------------------------\n\n#ifndef IMGUI_DISABLE_METRICS_WINDOW\n\nstatic const char* DebugNodeTableGetSizingPolicyDesc(ImGuiTableFlags sizing_policy)\n{\n    sizing_policy &= ImGuiTableFlags_SizingMask_;\n    if (sizing_policy == ImGuiTableFlags_SizingFixedFit)    { return \"FixedFit\"; }\n    if (sizing_policy == ImGuiTableFlags_SizingFixedSame)   { return \"FixedSame\"; }\n    if (sizing_policy == ImGuiTableFlags_SizingStretchProp) { return \"StretchProp\"; }\n    if (sizing_policy == ImGuiTableFlags_SizingStretchSame) { return \"StretchSame\"; }\n    return \"N/A\";\n}\n\nvoid ImGui::DebugNodeTable(ImGuiTable* table)\n{\n    char buf[512];\n    char* p = buf;\n    const char* buf_end = buf + IM_ARRAYSIZE(buf);\n    const bool is_active = (table->LastFrameActive >= ImGui::GetFrameCount() - 2); // Note that fully clipped early out scrolling tables will appear as inactive here.\n    ImFormatString(p, buf_end - p, \"Table 0x%08X (%d columns, in '%s')%s\", table->ID, table->ColumnsCount, table->OuterWindow->Name, is_active ? \"\" : \" *Inactive*\");\n    if (!is_active) { PushStyleColor(ImGuiCol_Text, GetStyleColorVec4(ImGuiCol_TextDisabled)); }\n    bool open = TreeNode(table, \"%s\", buf);\n    if (!is_active) { PopStyleColor(); }\n    if (IsItemHovered())\n        GetForegroundDrawList()->AddRect(table->OuterRect.Min, table->OuterRect.Max, IM_COL32(255, 255, 0, 255));\n    if (IsItemVisible() && table->HoveredColumnBody != -1)\n        GetForegroundDrawList()->AddRect(GetItemRectMin(), GetItemRectMax(), IM_COL32(255, 255, 0, 255));\n    if (!open)\n        return;\n    bool clear_settings = SmallButton(\"Clear settings\");\n    BulletText(\"OuterRect: Pos: (%.1f,%.1f) Size: (%.1f,%.1f) Sizing: '%s'\", table->OuterRect.Min.x, table->OuterRect.Min.y, table->OuterRect.GetWidth(), table->OuterRect.GetHeight(), DebugNodeTableGetSizingPolicyDesc(table->Flags));\n    BulletText(\"ColumnsGivenWidth: %.1f, ColumnsAutoFitWidth: %.1f, InnerWidth: %.1f%s\", table->ColumnsGivenWidth, table->ColumnsAutoFitWidth, table->InnerWidth, table->InnerWidth == 0.0f ? \" (auto)\" : \"\");\n    BulletText(\"CellPaddingX: %.1f, CellSpacingX: %.1f/%.1f, OuterPaddingX: %.1f\", table->CellPaddingX, table->CellSpacingX1, table->CellSpacingX2, table->OuterPaddingX);\n    BulletText(\"HoveredColumnBody: %d, HoveredColumnBorder: %d\", table->HoveredColumnBody, table->HoveredColumnBorder);\n    BulletText(\"ResizedColumn: %d, ReorderColumn: %d, HeldHeaderColumn: %d\", table->ResizedColumn, table->ReorderColumn, table->HeldHeaderColumn);\n    //BulletText(\"BgDrawChannels: %d/%d\", 0, table->BgDrawChannelUnfrozen);\n    float sum_weights = 0.0f;\n    for (int n = 0; n < table->ColumnsCount; n++)\n        if (table->Columns[n].Flags & ImGuiTableColumnFlags_WidthStretch)\n            sum_weights += table->Columns[n].StretchWeight;\n    for (int n = 0; n < table->ColumnsCount; n++)\n    {\n        ImGuiTableColumn* column = &table->Columns[n];\n        const char* name = TableGetColumnName(table, n);\n        ImFormatString(buf, IM_ARRAYSIZE(buf),\n            \"Column %d order %d '%s': offset %+.2f to %+.2f%s\\n\"\n            \"Enabled: %d, VisibleX/Y: %d/%d, RequestOutput: %d, SkipItems: %d, DrawChannels: %d,%d\\n\"\n            \"WidthGiven: %.1f, Request/Auto: %.1f/%.1f, StretchWeight: %.3f (%.1f%%)\\n\"\n            \"MinX: %.1f, MaxX: %.1f (%+.1f), ClipRect: %.1f to %.1f (+%.1f)\\n\"\n            \"ContentWidth: %.1f,%.1f, HeadersUsed/Ideal %.1f/%.1f\\n\"\n            \"Sort: %d%s, UserID: 0x%08X, Flags: 0x%04X: %s%s%s..\",\n            n, column->DisplayOrder, name, column->MinX - table->WorkRect.Min.x, column->MaxX - table->WorkRect.Min.x, (n < table->FreezeColumnsRequest) ? \" (Frozen)\" : \"\",\n            column->IsEnabled, column->IsVisibleX, column->IsVisibleY, column->IsRequestOutput, column->IsSkipItems, column->DrawChannelFrozen, column->DrawChannelUnfrozen,\n            column->WidthGiven, column->WidthRequest, column->WidthAuto, column->StretchWeight, column->StretchWeight > 0.0f ? (column->StretchWeight / sum_weights) * 100.0f : 0.0f,\n            column->MinX, column->MaxX, column->MaxX - column->MinX, column->ClipRect.Min.x, column->ClipRect.Max.x, column->ClipRect.Max.x - column->ClipRect.Min.x,\n            column->ContentMaxXFrozen - column->WorkMinX, column->ContentMaxXUnfrozen - column->WorkMinX, column->ContentMaxXHeadersUsed - column->WorkMinX, column->ContentMaxXHeadersIdeal - column->WorkMinX,\n            column->SortOrder, (column->SortDirection == ImGuiSortDirection_Ascending) ? \" (Asc)\" : (column->SortDirection == ImGuiSortDirection_Descending) ? \" (Des)\" : \"\", column->UserID, column->Flags,\n            (column->Flags & ImGuiTableColumnFlags_WidthStretch) ? \"WidthStretch \" : \"\",\n            (column->Flags & ImGuiTableColumnFlags_WidthFixed) ? \"WidthFixed \" : \"\",\n            (column->Flags & ImGuiTableColumnFlags_NoResize) ? \"NoResize \" : \"\");\n        Bullet();\n        Selectable(buf);\n        if (IsItemHovered())\n        {\n            ImRect r(column->MinX, table->OuterRect.Min.y, column->MaxX, table->OuterRect.Max.y);\n            GetForegroundDrawList()->AddRect(r.Min, r.Max, IM_COL32(255, 255, 0, 255));\n        }\n    }\n    if (ImGuiTableSettings* settings = TableGetBoundSettings(table))\n        DebugNodeTableSettings(settings);\n    if (clear_settings)\n        table->IsResetAllRequest = true;\n    TreePop();\n}\n\nvoid ImGui::DebugNodeTableSettings(ImGuiTableSettings* settings)\n{\n    if (!TreeNode((void*)(intptr_t)settings->ID, \"Settings 0x%08X (%d columns)\", settings->ID, settings->ColumnsCount))\n        return;\n    BulletText(\"SaveFlags: 0x%08X\", settings->SaveFlags);\n    BulletText(\"ColumnsCount: %d (max %d)\", settings->ColumnsCount, settings->ColumnsCountMax);\n    for (int n = 0; n < settings->ColumnsCount; n++)\n    {\n        ImGuiTableColumnSettings* column_settings = &settings->GetColumnSettings()[n];\n        ImGuiSortDirection sort_dir = (column_settings->SortOrder != -1) ? (ImGuiSortDirection)column_settings->SortDirection : ImGuiSortDirection_None;\n        BulletText(\"Column %d Order %d SortOrder %d %s Vis %d %s %7.3f UserID 0x%08X\",\n            n, column_settings->DisplayOrder, column_settings->SortOrder,\n            (sort_dir == ImGuiSortDirection_Ascending) ? \"Asc\" : (sort_dir == ImGuiSortDirection_Descending) ? \"Des\" : \"---\",\n            column_settings->IsEnabled, column_settings->IsStretch ? \"Weight\" : \"Width \", column_settings->WidthOrWeight, column_settings->UserID);\n    }\n    TreePop();\n}\n\n#else // #ifndef IMGUI_DISABLE_METRICS_WINDOW\n\nvoid ImGui::DebugNodeTable(ImGuiTable*) {}\nvoid ImGui::DebugNodeTableSettings(ImGuiTableSettings*) {}\n\n#endif\n\n\n//-------------------------------------------------------------------------\n// [SECTION] Columns, BeginColumns, EndColumns, etc.\n// (This is a legacy API, prefer using BeginTable/EndTable!)\n//-------------------------------------------------------------------------\n// FIXME: sizing is lossy when columns width is very small (default width may turn negative etc.)\n//-------------------------------------------------------------------------\n// - SetWindowClipRectBeforeSetChannel() [Internal]\n// - GetColumnIndex()\n// - GetColumnsCount()\n// - GetColumnOffset()\n// - GetColumnWidth()\n// - SetColumnOffset()\n// - SetColumnWidth()\n// - PushColumnClipRect() [Internal]\n// - PushColumnsBackground() [Internal]\n// - PopColumnsBackground() [Internal]\n// - FindOrCreateColumns() [Internal]\n// - GetColumnsID() [Internal]\n// - BeginColumns()\n// - NextColumn()\n// - EndColumns()\n// - Columns()\n//-------------------------------------------------------------------------\n\n// [Internal] Small optimization to avoid calls to PopClipRect/SetCurrentChannel/PushClipRect in sequences,\n// they would meddle many times with the underlying ImDrawCmd.\n// Instead, we do a preemptive overwrite of clipping rectangle _without_ altering the command-buffer and let\n// the subsequent single call to SetCurrentChannel() does it things once.\nvoid ImGui::SetWindowClipRectBeforeSetChannel(ImGuiWindow* window, const ImRect& clip_rect)\n{\n    ImVec4 clip_rect_vec4 = clip_rect.ToVec4();\n    window->ClipRect = clip_rect;\n    window->DrawList->_CmdHeader.ClipRect = clip_rect_vec4;\n    window->DrawList->_ClipRectStack.Data[window->DrawList->_ClipRectStack.Size - 1] = clip_rect_vec4;\n}\n\nint ImGui::GetColumnIndex()\n{\n    ImGuiWindow* window = GetCurrentWindowRead();\n    return window->DC.CurrentColumns ? window->DC.CurrentColumns->Current : 0;\n}\n\nint ImGui::GetColumnsCount()\n{\n    ImGuiWindow* window = GetCurrentWindowRead();\n    return window->DC.CurrentColumns ? window->DC.CurrentColumns->Count : 1;\n}\n\nfloat ImGui::GetColumnOffsetFromNorm(const ImGuiOldColumns* columns, float offset_norm)\n{\n    return offset_norm * (columns->OffMaxX - columns->OffMinX);\n}\n\nfloat ImGui::GetColumnNormFromOffset(const ImGuiOldColumns* columns, float offset)\n{\n    return offset / (columns->OffMaxX - columns->OffMinX);\n}\n\nstatic const float COLUMNS_HIT_RECT_HALF_WIDTH = 4.0f;\n\nstatic float GetDraggedColumnOffset(ImGuiOldColumns* columns, int column_index)\n{\n    // Active (dragged) column always follow mouse. The reason we need this is that dragging a column to the right edge of an auto-resizing\n    // window creates a feedback loop because we store normalized positions. So while dragging we enforce absolute positioning.\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    IM_ASSERT(column_index > 0); // We are not supposed to drag column 0.\n    IM_ASSERT(g.ActiveId == columns->ID + ImGuiID(column_index));\n\n    float x = g.IO.MousePos.x - g.ActiveIdClickOffset.x + COLUMNS_HIT_RECT_HALF_WIDTH - window->Pos.x;\n    x = ImMax(x, ImGui::GetColumnOffset(column_index - 1) + g.Style.ColumnsMinSpacing);\n    if ((columns->Flags & ImGuiOldColumnFlags_NoPreserveWidths))\n        x = ImMin(x, ImGui::GetColumnOffset(column_index + 1) - g.Style.ColumnsMinSpacing);\n\n    return x;\n}\n\nfloat ImGui::GetColumnOffset(int column_index)\n{\n    ImGuiWindow* window = GetCurrentWindowRead();\n    ImGuiOldColumns* columns = window->DC.CurrentColumns;\n    if (columns == NULL)\n        return 0.0f;\n\n    if (column_index < 0)\n        column_index = columns->Current;\n    IM_ASSERT(column_index < columns->Columns.Size);\n\n    const float t = columns->Columns[column_index].OffsetNorm;\n    const float x_offset = ImLerp(columns->OffMinX, columns->OffMaxX, t);\n    return x_offset;\n}\n\nstatic float GetColumnWidthEx(ImGuiOldColumns* columns, int column_index, bool before_resize = false)\n{\n    if (column_index < 0)\n        column_index = columns->Current;\n\n    float offset_norm;\n    if (before_resize)\n        offset_norm = columns->Columns[column_index + 1].OffsetNormBeforeResize - columns->Columns[column_index].OffsetNormBeforeResize;\n    else\n        offset_norm = columns->Columns[column_index + 1].OffsetNorm - columns->Columns[column_index].OffsetNorm;\n    return ImGui::GetColumnOffsetFromNorm(columns, offset_norm);\n}\n\nfloat ImGui::GetColumnWidth(int column_index)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    ImGuiOldColumns* columns = window->DC.CurrentColumns;\n    if (columns == NULL)\n        return GetContentRegionAvail().x;\n\n    if (column_index < 0)\n        column_index = columns->Current;\n    return GetColumnOffsetFromNorm(columns, columns->Columns[column_index + 1].OffsetNorm - columns->Columns[column_index].OffsetNorm);\n}\n\nvoid ImGui::SetColumnOffset(int column_index, float offset)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    ImGuiOldColumns* columns = window->DC.CurrentColumns;\n    IM_ASSERT(columns != NULL);\n\n    if (column_index < 0)\n        column_index = columns->Current;\n    IM_ASSERT(column_index < columns->Columns.Size);\n\n    const bool preserve_width = !(columns->Flags & ImGuiOldColumnFlags_NoPreserveWidths) && (column_index < columns->Count - 1);\n    const float width = preserve_width ? GetColumnWidthEx(columns, column_index, columns->IsBeingResized) : 0.0f;\n\n    if (!(columns->Flags & ImGuiOldColumnFlags_NoForceWithinWindow))\n        offset = ImMin(offset, columns->OffMaxX - g.Style.ColumnsMinSpacing * (columns->Count - column_index));\n    columns->Columns[column_index].OffsetNorm = GetColumnNormFromOffset(columns, offset - columns->OffMinX);\n\n    if (preserve_width)\n        SetColumnOffset(column_index + 1, offset + ImMax(g.Style.ColumnsMinSpacing, width));\n}\n\nvoid ImGui::SetColumnWidth(int column_index, float width)\n{\n    ImGuiWindow* window = GetCurrentWindowRead();\n    ImGuiOldColumns* columns = window->DC.CurrentColumns;\n    IM_ASSERT(columns != NULL);\n\n    if (column_index < 0)\n        column_index = columns->Current;\n    SetColumnOffset(column_index + 1, GetColumnOffset(column_index) + width);\n}\n\nvoid ImGui::PushColumnClipRect(int column_index)\n{\n    ImGuiWindow* window = GetCurrentWindowRead();\n    ImGuiOldColumns* columns = window->DC.CurrentColumns;\n    if (column_index < 0)\n        column_index = columns->Current;\n\n    ImGuiOldColumnData* column = &columns->Columns[column_index];\n    PushClipRect(column->ClipRect.Min, column->ClipRect.Max, false);\n}\n\n// Get into the columns background draw command (which is generally the same draw command as before we called BeginColumns)\nvoid ImGui::PushColumnsBackground()\n{\n    ImGuiWindow* window = GetCurrentWindowRead();\n    ImGuiOldColumns* columns = window->DC.CurrentColumns;\n    if (columns->Count == 1)\n        return;\n\n    // Optimization: avoid SetCurrentChannel() + PushClipRect()\n    columns->HostBackupClipRect = window->ClipRect;\n    SetWindowClipRectBeforeSetChannel(window, columns->HostInitialClipRect);\n    columns->Splitter.SetCurrentChannel(window->DrawList, 0);\n}\n\nvoid ImGui::PopColumnsBackground()\n{\n    ImGuiWindow* window = GetCurrentWindowRead();\n    ImGuiOldColumns* columns = window->DC.CurrentColumns;\n    if (columns->Count == 1)\n        return;\n\n    // Optimization: avoid PopClipRect() + SetCurrentChannel()\n    SetWindowClipRectBeforeSetChannel(window, columns->HostBackupClipRect);\n    columns->Splitter.SetCurrentChannel(window->DrawList, columns->Current + 1);\n}\n\nImGuiOldColumns* ImGui::FindOrCreateColumns(ImGuiWindow* window, ImGuiID id)\n{\n    // We have few columns per window so for now we don't need bother much with turning this into a faster lookup.\n    for (int n = 0; n < window->ColumnsStorage.Size; n++)\n        if (window->ColumnsStorage[n].ID == id)\n            return &window->ColumnsStorage[n];\n\n    window->ColumnsStorage.push_back(ImGuiOldColumns());\n    ImGuiOldColumns* columns = &window->ColumnsStorage.back();\n    columns->ID = id;\n    return columns;\n}\n\nImGuiID ImGui::GetColumnsID(const char* str_id, int columns_count)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n\n    // Differentiate column ID with an arbitrary prefix for cases where users name their columns set the same as another widget.\n    // In addition, when an identifier isn't explicitly provided we include the number of columns in the hash to make it uniquer.\n    PushID(0x11223347 + (str_id ? 0 : columns_count));\n    ImGuiID id = window->GetID(str_id ? str_id : \"columns\");\n    PopID();\n\n    return id;\n}\n\nvoid ImGui::BeginColumns(const char* str_id, int columns_count, ImGuiOldColumnFlags flags)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = GetCurrentWindow();\n\n    IM_ASSERT(columns_count >= 1);\n    IM_ASSERT(window->DC.CurrentColumns == NULL);   // Nested columns are currently not supported\n\n    // Acquire storage for the columns set\n    ImGuiID id = GetColumnsID(str_id, columns_count);\n    ImGuiOldColumns* columns = FindOrCreateColumns(window, id);\n    IM_ASSERT(columns->ID == id);\n    columns->Current = 0;\n    columns->Count = columns_count;\n    columns->Flags = flags;\n    window->DC.CurrentColumns = columns;\n\n    columns->HostCursorPosY = window->DC.CursorPos.y;\n    columns->HostCursorMaxPosX = window->DC.CursorMaxPos.x;\n    columns->HostInitialClipRect = window->ClipRect;\n    columns->HostBackupParentWorkRect = window->ParentWorkRect;\n    window->ParentWorkRect = window->WorkRect;\n\n    // Set state for first column\n    // We aim so that the right-most column will have the same clipping width as other after being clipped by parent ClipRect\n    const float column_padding = g.Style.ItemSpacing.x;\n    const float half_clip_extend_x = ImFloor(ImMax(window->WindowPadding.x * 0.5f, window->WindowBorderSize));\n    const float max_1 = window->WorkRect.Max.x + column_padding - ImMax(column_padding - window->WindowPadding.x, 0.0f);\n    const float max_2 = window->WorkRect.Max.x + half_clip_extend_x;\n    columns->OffMinX = window->DC.Indent.x - column_padding + ImMax(column_padding - window->WindowPadding.x, 0.0f);\n    columns->OffMaxX = ImMax(ImMin(max_1, max_2) - window->Pos.x, columns->OffMinX + 1.0f);\n    columns->LineMinY = columns->LineMaxY = window->DC.CursorPos.y;\n\n    // Clear data if columns count changed\n    if (columns->Columns.Size != 0 && columns->Columns.Size != columns_count + 1)\n        columns->Columns.resize(0);\n\n    // Initialize default widths\n    columns->IsFirstFrame = (columns->Columns.Size == 0);\n    if (columns->Columns.Size == 0)\n    {\n        columns->Columns.reserve(columns_count + 1);\n        for (int n = 0; n < columns_count + 1; n++)\n        {\n            ImGuiOldColumnData column;\n            column.OffsetNorm = n / (float)columns_count;\n            columns->Columns.push_back(column);\n        }\n    }\n\n    for (int n = 0; n < columns_count; n++)\n    {\n        // Compute clipping rectangle\n        ImGuiOldColumnData* column = &columns->Columns[n];\n        float clip_x1 = IM_ROUND(window->Pos.x + GetColumnOffset(n));\n        float clip_x2 = IM_ROUND(window->Pos.x + GetColumnOffset(n + 1) - 1.0f);\n        column->ClipRect = ImRect(clip_x1, -FLT_MAX, clip_x2, +FLT_MAX);\n        column->ClipRect.ClipWithFull(window->ClipRect);\n    }\n\n    if (columns->Count > 1)\n    {\n        columns->Splitter.Split(window->DrawList, 1 + columns->Count);\n        columns->Splitter.SetCurrentChannel(window->DrawList, 1);\n        PushColumnClipRect(0);\n    }\n\n    // We don't generally store Indent.x inside ColumnsOffset because it may be manipulated by the user.\n    float offset_0 = GetColumnOffset(columns->Current);\n    float offset_1 = GetColumnOffset(columns->Current + 1);\n    float width = offset_1 - offset_0;\n    PushItemWidth(width * 0.65f);\n    window->DC.ColumnsOffset.x = ImMax(column_padding - window->WindowPadding.x, 0.0f);\n    window->DC.CursorPos.x = IM_FLOOR(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x);\n    window->WorkRect.Max.x = window->Pos.x + offset_1 - column_padding;\n}\n\nvoid ImGui::NextColumn()\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems || window->DC.CurrentColumns == NULL)\n        return;\n\n    ImGuiContext& g = *GImGui;\n    ImGuiOldColumns* columns = window->DC.CurrentColumns;\n\n    if (columns->Count == 1)\n    {\n        window->DC.CursorPos.x = IM_FLOOR(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x);\n        IM_ASSERT(columns->Current == 0);\n        return;\n    }\n\n    // Next column\n    if (++columns->Current == columns->Count)\n        columns->Current = 0;\n\n    PopItemWidth();\n\n    // Optimization: avoid PopClipRect() + SetCurrentChannel() + PushClipRect()\n    // (which would needlessly attempt to update commands in the wrong channel, then pop or overwrite them),\n    ImGuiOldColumnData* column = &columns->Columns[columns->Current];\n    SetWindowClipRectBeforeSetChannel(window, column->ClipRect);\n    columns->Splitter.SetCurrentChannel(window->DrawList, columns->Current + 1);\n\n    const float column_padding = g.Style.ItemSpacing.x;\n    columns->LineMaxY = ImMax(columns->LineMaxY, window->DC.CursorPos.y);\n    if (columns->Current > 0)\n    {\n        // Columns 1+ ignore IndentX (by canceling it out)\n        // FIXME-COLUMNS: Unnecessary, could be locked?\n        window->DC.ColumnsOffset.x = GetColumnOffset(columns->Current) - window->DC.Indent.x + column_padding;\n    }\n    else\n    {\n        // New row/line: column 0 honor IndentX.\n        window->DC.ColumnsOffset.x = ImMax(column_padding - window->WindowPadding.x, 0.0f);\n        columns->LineMinY = columns->LineMaxY;\n    }\n    window->DC.CursorPos.x = IM_FLOOR(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x);\n    window->DC.CursorPos.y = columns->LineMinY;\n    window->DC.CurrLineSize = ImVec2(0.0f, 0.0f);\n    window->DC.CurrLineTextBaseOffset = 0.0f;\n\n    // FIXME-COLUMNS: Share code with BeginColumns() - move code on columns setup.\n    float offset_0 = GetColumnOffset(columns->Current);\n    float offset_1 = GetColumnOffset(columns->Current + 1);\n    float width = offset_1 - offset_0;\n    PushItemWidth(width * 0.65f);\n    window->WorkRect.Max.x = window->Pos.x + offset_1 - column_padding;\n}\n\nvoid ImGui::EndColumns()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = GetCurrentWindow();\n    ImGuiOldColumns* columns = window->DC.CurrentColumns;\n    IM_ASSERT(columns != NULL);\n\n    PopItemWidth();\n    if (columns->Count > 1)\n    {\n        PopClipRect();\n        columns->Splitter.Merge(window->DrawList);\n    }\n\n    const ImGuiOldColumnFlags flags = columns->Flags;\n    columns->LineMaxY = ImMax(columns->LineMaxY, window->DC.CursorPos.y);\n    window->DC.CursorPos.y = columns->LineMaxY;\n    if (!(flags & ImGuiOldColumnFlags_GrowParentContentsSize))\n        window->DC.CursorMaxPos.x = columns->HostCursorMaxPosX;  // Restore cursor max pos, as columns don't grow parent\n\n    // Draw columns borders and handle resize\n    // The IsBeingResized flag ensure we preserve pre-resize columns width so back-and-forth are not lossy\n    bool is_being_resized = false;\n    if (!(flags & ImGuiOldColumnFlags_NoBorder) && !window->SkipItems)\n    {\n        // We clip Y boundaries CPU side because very long triangles are mishandled by some GPU drivers.\n        const float y1 = ImMax(columns->HostCursorPosY, window->ClipRect.Min.y);\n        const float y2 = ImMin(window->DC.CursorPos.y, window->ClipRect.Max.y);\n        int dragging_column = -1;\n        for (int n = 1; n < columns->Count; n++)\n        {\n            ImGuiOldColumnData* column = &columns->Columns[n];\n            float x = window->Pos.x + GetColumnOffset(n);\n            const ImGuiID column_id = columns->ID + ImGuiID(n);\n            const float column_hit_hw = COLUMNS_HIT_RECT_HALF_WIDTH;\n            const ImRect column_hit_rect(ImVec2(x - column_hit_hw, y1), ImVec2(x + column_hit_hw, y2));\n            KeepAliveID(column_id);\n            if (IsClippedEx(column_hit_rect, column_id, false))\n                continue;\n\n            bool hovered = false, held = false;\n            if (!(flags & ImGuiOldColumnFlags_NoResize))\n            {\n                ButtonBehavior(column_hit_rect, column_id, &hovered, &held);\n                if (hovered || held)\n                    g.MouseCursor = ImGuiMouseCursor_ResizeEW;\n                if (held && !(column->Flags & ImGuiOldColumnFlags_NoResize))\n                    dragging_column = n;\n            }\n\n            // Draw column\n            const ImU32 col = GetColorU32(held ? ImGuiCol_SeparatorActive : hovered ? ImGuiCol_SeparatorHovered : ImGuiCol_Separator);\n            const float xi = IM_FLOOR(x);\n            window->DrawList->AddLine(ImVec2(xi, y1 + 1.0f), ImVec2(xi, y2), col);\n        }\n\n        // Apply dragging after drawing the column lines, so our rendered lines are in sync with how items were displayed during the frame.\n        if (dragging_column != -1)\n        {\n            if (!columns->IsBeingResized)\n                for (int n = 0; n < columns->Count + 1; n++)\n                    columns->Columns[n].OffsetNormBeforeResize = columns->Columns[n].OffsetNorm;\n            columns->IsBeingResized = is_being_resized = true;\n            float x = GetDraggedColumnOffset(columns, dragging_column);\n            SetColumnOffset(dragging_column, x);\n        }\n    }\n    columns->IsBeingResized = is_being_resized;\n\n    window->WorkRect = window->ParentWorkRect;\n    window->ParentWorkRect = columns->HostBackupParentWorkRect;\n    window->DC.CurrentColumns = NULL;\n    window->DC.ColumnsOffset.x = 0.0f;\n    window->DC.CursorPos.x = IM_FLOOR(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x);\n}\n\nvoid ImGui::Columns(int columns_count, const char* id, bool border)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    IM_ASSERT(columns_count >= 1);\n\n    ImGuiOldColumnFlags flags = (border ? 0 : ImGuiOldColumnFlags_NoBorder);\n    //flags |= ImGuiOldColumnFlags_NoPreserveWidths; // NB: Legacy behavior\n    ImGuiOldColumns* columns = window->DC.CurrentColumns;\n    if (columns != NULL && columns->Count == columns_count && columns->Flags == flags)\n        return;\n\n    if (columns != NULL)\n        EndColumns();\n\n    if (columns_count != 1)\n        BeginColumns(id, columns_count, flags);\n}\n\n//-------------------------------------------------------------------------\n\n#endif // #ifndef IMGUI_DISABLE\n"
  },
  {
    "path": "R3nzSkin/imgui/imgui_widgets.cpp",
    "content": "// dear imgui, v1.84\n// (widgets code)\n\n/*\n\nIndex of this file:\n\n// [SECTION] Forward Declarations\n// [SECTION] Widgets: Text, etc.\n// [SECTION] Widgets: Main (Button, Image, Checkbox, RadioButton, ProgressBar, Bullet, etc.)\n// [SECTION] Widgets: Low-level Layout helpers (Spacing, Dummy, NewLine, Separator, etc.)\n// [SECTION] Widgets: ComboBox\n// [SECTION] Data Type and Data Formatting Helpers\n// [SECTION] Widgets: DragScalar, DragFloat, DragInt, etc.\n// [SECTION] Widgets: SliderScalar, SliderFloat, SliderInt, etc.\n// [SECTION] Widgets: InputScalar, InputFloat, InputInt, etc.\n// [SECTION] Widgets: InputText, InputTextMultiline\n// [SECTION] Widgets: ColorEdit, ColorPicker, ColorButton, etc.\n// [SECTION] Widgets: TreeNode, CollapsingHeader, etc.\n// [SECTION] Widgets: Selectable\n// [SECTION] Widgets: ListBox\n// [SECTION] Widgets: PlotLines, PlotHistogram\n// [SECTION] Widgets: Value helpers\n// [SECTION] Widgets: MenuItem, BeginMenu, EndMenu, etc.\n// [SECTION] Widgets: BeginTabBar, EndTabBar, etc.\n// [SECTION] Widgets: BeginTabItem, EndTabItem, etc.\n// [SECTION] Widgets: Columns, BeginColumns, EndColumns, etc.\n\n*/\n\n#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)\n#define _CRT_SECURE_NO_WARNINGS\n#endif\n\n#include \"imgui.h\"\n#ifndef IMGUI_DISABLE\n\n#ifndef IMGUI_DEFINE_MATH_OPERATORS\n#define IMGUI_DEFINE_MATH_OPERATORS\n#endif\n#include \"imgui_internal.h\"\n\n// System includes\n#include <ctype.h>      // toupper\n#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier\n#include <stddef.h>     // intptr_t\n#else\n#include <stdint.h>     // intptr_t\n#endif\n\n//-------------------------------------------------------------------------\n// Warnings\n//-------------------------------------------------------------------------\n\n// Visual Studio warnings\n#ifdef _MSC_VER\n#pragma warning (disable: 4127)     // condition expression is constant\n#pragma warning (disable: 4996)     // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen\n#if defined(_MSC_VER) && _MSC_VER >= 1922 // MSVC 2019 16.2 or later\n#pragma warning (disable: 5054)     // operator '|': deprecated between enumerations of different types\n#endif\n#pragma warning (disable: 26451)    // [Static Analyzer] Arithmetic overflow : Using operator 'xxx' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator 'xxx' to avoid overflow(io.2).\n#pragma warning (disable: 26812)    // [Static Analyzer] The enum type 'xxx' is unscoped. Prefer 'enum class' over 'enum' (Enum.3).\n#endif\n\n// Clang/GCC warnings with -Weverything\n#if defined(__clang__)\n#if __has_warning(\"-Wunknown-warning-option\")\n#pragma clang diagnostic ignored \"-Wunknown-warning-option\"         // warning: unknown warning group 'xxx'                      // not all warnings are known by all Clang versions and they tend to be rename-happy.. so ignoring warnings triggers new warnings on some configuration. Great!\n#endif\n#pragma clang diagnostic ignored \"-Wunknown-pragmas\"                // warning: unknown warning group 'xxx'\n#pragma clang diagnostic ignored \"-Wold-style-cast\"                 // warning: use of old-style cast                            // yes, they are more terse.\n#pragma clang diagnostic ignored \"-Wfloat-equal\"                    // warning: comparing floating point with == or != is unsafe // storing and comparing against same constants (typically 0.0f) is ok.\n#pragma clang diagnostic ignored \"-Wformat-nonliteral\"              // warning: format string is not a string literal            // passing non-literal to vsnformat(). yes, user passing incorrect format strings can crash the code.\n#pragma clang diagnostic ignored \"-Wsign-conversion\"                // warning: implicit conversion changes signedness\n#pragma clang diagnostic ignored \"-Wzero-as-null-pointer-constant\"  // warning: zero as null pointer constant                    // some standard header variations use #define NULL 0\n#pragma clang diagnostic ignored \"-Wdouble-promotion\"               // warning: implicit conversion from 'float' to 'double' when passing argument to function  // using printf() is a misery with this as C++ va_arg ellipsis changes float to double.\n#pragma clang diagnostic ignored \"-Wenum-enum-conversion\"           // warning: bitwise operation between different enumeration types ('XXXFlags_' and 'XXXFlagsPrivate_')\n#pragma clang diagnostic ignored \"-Wdeprecated-enum-enum-conversion\"// warning: bitwise operation between different enumeration types ('XXXFlags_' and 'XXXFlagsPrivate_') is deprecated\n#pragma clang diagnostic ignored \"-Wimplicit-int-float-conversion\"  // warning: implicit conversion from 'xxx' to 'float' may lose precision\n#elif defined(__GNUC__)\n#pragma GCC diagnostic ignored \"-Wpragmas\"                          // warning: unknown option after '#pragma GCC diagnostic' kind\n#pragma GCC diagnostic ignored \"-Wformat-nonliteral\"                // warning: format not a string literal, format string not checked\n#pragma GCC diagnostic ignored \"-Wclass-memaccess\"                  // [__GNUC__ >= 8] warning: 'memset/memcpy' clearing/writing an object of type 'xxxx' with no trivial copy-assignment; use assignment or value-initialization instead\n#endif\n\n//-------------------------------------------------------------------------\n// Data\n//-------------------------------------------------------------------------\n\n// Widgets\nstatic const float          DRAGDROP_HOLD_TO_OPEN_TIMER = 0.70f;    // Time for drag-hold to activate items accepting the ImGuiButtonFlags_PressedOnDragDropHold button behavior.\nstatic const float          DRAG_MOUSE_THRESHOLD_FACTOR = 0.50f;    // Multiplier for the default value of io.MouseDragThreshold to make DragFloat/DragInt react faster to mouse drags.\n\n// Those MIN/MAX values are not define because we need to point to them\nstatic const signed char    IM_S8_MIN  = -128;\nstatic const signed char    IM_S8_MAX  = 127;\nstatic const unsigned char  IM_U8_MIN  = 0;\nstatic const unsigned char  IM_U8_MAX  = 0xFF;\nstatic const signed short   IM_S16_MIN = -32768;\nstatic const signed short   IM_S16_MAX = 32767;\nstatic const unsigned short IM_U16_MIN = 0;\nstatic const unsigned short IM_U16_MAX = 0xFFFF;\nstatic const ImS32          IM_S32_MIN = INT_MIN;    // (-2147483647 - 1), (0x80000000);\nstatic const ImS32          IM_S32_MAX = INT_MAX;    // (2147483647), (0x7FFFFFFF)\nstatic const ImU32          IM_U32_MIN = 0;\nstatic const ImU32          IM_U32_MAX = UINT_MAX;   // (0xFFFFFFFF)\n#ifdef LLONG_MIN\nstatic const ImS64          IM_S64_MIN = LLONG_MIN;  // (-9223372036854775807ll - 1ll);\nstatic const ImS64          IM_S64_MAX = LLONG_MAX;  // (9223372036854775807ll);\n#else\nstatic const ImS64          IM_S64_MIN = -9223372036854775807LL - 1;\nstatic const ImS64          IM_S64_MAX = 9223372036854775807LL;\n#endif\nstatic const ImU64          IM_U64_MIN = 0;\n#ifdef ULLONG_MAX\nstatic const ImU64          IM_U64_MAX = ULLONG_MAX; // (0xFFFFFFFFFFFFFFFFull);\n#else\nstatic const ImU64          IM_U64_MAX = (2ULL * 9223372036854775807LL + 1);\n#endif\n\n//-------------------------------------------------------------------------\n// [SECTION] Forward Declarations\n//-------------------------------------------------------------------------\n\n// For InputTextEx()\nstatic bool             InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data, ImGuiInputSource input_source);\nstatic int              InputTextCalcTextLenAndLineCount(const char* text_begin, const char** out_text_end);\nstatic ImVec2           InputTextCalcTextSizeW(const ImWchar* text_begin, const ImWchar* text_end, const ImWchar** remaining = NULL, ImVec2* out_offset = NULL, bool stop_on_new_line = false);\n\n//-------------------------------------------------------------------------\n// [SECTION] Widgets: Text, etc.\n//-------------------------------------------------------------------------\n// - TextEx() [Internal]\n// - TextUnformatted()\n// - Text()\n// - TextV()\n// - TextColored()\n// - TextColoredV()\n// - TextDisabled()\n// - TextDisabledV()\n// - TextWrapped()\n// - TextWrappedV()\n// - LabelText()\n// - LabelTextV()\n// - BulletText()\n// - BulletTextV()\n//-------------------------------------------------------------------------\n\nvoid ImGui::TextEx(const char* text, const char* text_end, ImGuiTextFlags flags)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return;\n\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(text != NULL);\n    const char* text_begin = text;\n    if (text_end == NULL)\n        text_end = text + strlen(text); // FIXME-OPT\n\n    const ImVec2 text_pos(window->DC.CursorPos.x, window->DC.CursorPos.y + window->DC.CurrLineTextBaseOffset);\n    const float wrap_pos_x = window->DC.TextWrapPos;\n    const bool wrap_enabled = (wrap_pos_x >= 0.0f);\n    if (text_end - text > 2000 && !wrap_enabled)\n    {\n        // Long text!\n        // Perform manual coarse clipping to optimize for long multi-line text\n        // - From this point we will only compute the width of lines that are visible. Optimization only available when word-wrapping is disabled.\n        // - We also don't vertically center the text within the line full height, which is unlikely to matter because we are likely the biggest and only item on the line.\n        // - We use memchr(), pay attention that well optimized versions of those str/mem functions are much faster than a casually written loop.\n        const char* line = text;\n        const float line_height = GetTextLineHeight();\n        ImVec2 text_size(0, 0);\n\n        // Lines to skip (can't skip when logging text)\n        ImVec2 pos = text_pos;\n        if (!g.LogEnabled)\n        {\n            int lines_skippable = (int)((window->ClipRect.Min.y - text_pos.y) / line_height);\n            if (lines_skippable > 0)\n            {\n                int lines_skipped = 0;\n                while (line < text_end && lines_skipped < lines_skippable)\n                {\n                    const char* line_end = (const char*)memchr(line, '\\n', text_end - line);\n                    if (!line_end)\n                        line_end = text_end;\n                    if ((flags & ImGuiTextFlags_NoWidthForLargeClippedText) == 0)\n                        text_size.x = ImMax(text_size.x, CalcTextSize(line, line_end).x);\n                    line = line_end + 1;\n                    lines_skipped++;\n                }\n                pos.y += lines_skipped * line_height;\n            }\n        }\n\n        // Lines to render\n        if (line < text_end)\n        {\n            ImRect line_rect(pos, pos + ImVec2(FLT_MAX, line_height));\n            while (line < text_end)\n            {\n                if (IsClippedEx(line_rect, 0, false))\n                    break;\n\n                const char* line_end = (const char*)memchr(line, '\\n', text_end - line);\n                if (!line_end)\n                    line_end = text_end;\n                text_size.x = ImMax(text_size.x, CalcTextSize(line, line_end).x);\n                RenderText(pos, line, line_end, false);\n                line = line_end + 1;\n                line_rect.Min.y += line_height;\n                line_rect.Max.y += line_height;\n                pos.y += line_height;\n            }\n\n            // Count remaining lines\n            int lines_skipped = 0;\n            while (line < text_end)\n            {\n                const char* line_end = (const char*)memchr(line, '\\n', text_end - line);\n                if (!line_end)\n                    line_end = text_end;\n                if ((flags & ImGuiTextFlags_NoWidthForLargeClippedText) == 0)\n                    text_size.x = ImMax(text_size.x, CalcTextSize(line, line_end).x);\n                line = line_end + 1;\n                lines_skipped++;\n            }\n            pos.y += lines_skipped * line_height;\n        }\n        text_size.y = (pos - text_pos).y;\n\n        ImRect bb(text_pos, text_pos + text_size);\n        ItemSize(text_size, 0.0f);\n        ItemAdd(bb, 0);\n    }\n    else\n    {\n        const float wrap_width = wrap_enabled ? CalcWrapWidthForPos(window->DC.CursorPos, wrap_pos_x) : 0.0f;\n        const ImVec2 text_size = CalcTextSize(text_begin, text_end, false, wrap_width);\n\n        ImRect bb(text_pos, text_pos + text_size);\n        ItemSize(text_size, 0.0f);\n        if (!ItemAdd(bb, 0))\n            return;\n\n        // Render (we don't hide text after ## in this end-user function)\n        RenderTextWrapped(bb.Min, text_begin, text_end, wrap_width);\n    }\n}\n\nvoid ImGui::TextUnformatted(const char* text, const char* text_end)\n{\n    TextEx(text, text_end, ImGuiTextFlags_NoWidthForLargeClippedText);\n}\n\nvoid ImGui::Text(const char* fmt, ...)\n{\n    va_list args;\n    va_start(args, fmt);\n    TextV(fmt, args);\n    va_end(args);\n}\n\nvoid ImGui::TextV(const char* fmt, va_list args)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return;\n\n    ImGuiContext& g = *GImGui;\n    const char* text_end = g.TempBuffer + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args);\n    TextEx(g.TempBuffer, text_end, ImGuiTextFlags_NoWidthForLargeClippedText);\n}\n\nvoid ImGui::TextColored(const ImVec4& col, const char* fmt, ...)\n{\n    va_list args;\n    va_start(args, fmt);\n    TextColoredV(col, fmt, args);\n    va_end(args);\n}\n\nvoid ImGui::TextColoredV(const ImVec4& col, const char* fmt, va_list args)\n{\n    PushStyleColor(ImGuiCol_Text, col);\n    if (fmt[0] == '%' && fmt[1] == 's' && fmt[2] == 0)\n        TextEx(va_arg(args, const char*), NULL, ImGuiTextFlags_NoWidthForLargeClippedText); // Skip formatting\n    else\n        TextV(fmt, args);\n    PopStyleColor();\n}\n\nvoid ImGui::TextDisabled(const char* fmt, ...)\n{\n    va_list args;\n    va_start(args, fmt);\n    TextDisabledV(fmt, args);\n    va_end(args);\n}\n\nvoid ImGui::TextDisabledV(const char* fmt, va_list args)\n{\n    ImGuiContext& g = *GImGui;\n    PushStyleColor(ImGuiCol_Text, g.Style.Colors[ImGuiCol_TextDisabled]);\n    if (fmt[0] == '%' && fmt[1] == 's' && fmt[2] == 0)\n        TextEx(va_arg(args, const char*), NULL, ImGuiTextFlags_NoWidthForLargeClippedText); // Skip formatting\n    else\n        TextV(fmt, args);\n    PopStyleColor();\n}\n\nvoid ImGui::TextWrapped(const char* fmt, ...)\n{\n    va_list args;\n    va_start(args, fmt);\n    TextWrappedV(fmt, args);\n    va_end(args);\n}\n\nvoid ImGui::TextWrappedV(const char* fmt, va_list args)\n{\n    ImGuiContext& g = *GImGui;\n    bool need_backup = (g.CurrentWindow->DC.TextWrapPos < 0.0f);  // Keep existing wrap position if one is already set\n    if (need_backup)\n        PushTextWrapPos(0.0f);\n    if (fmt[0] == '%' && fmt[1] == 's' && fmt[2] == 0)\n        TextEx(va_arg(args, const char*), NULL, ImGuiTextFlags_NoWidthForLargeClippedText); // Skip formatting\n    else\n        TextV(fmt, args);\n    if (need_backup)\n        PopTextWrapPos();\n}\n\nvoid ImGui::LabelText(const char* label, const char* fmt, ...)\n{\n    va_list args;\n    va_start(args, fmt);\n    LabelTextV(label, fmt, args);\n    va_end(args);\n}\n\n// Add a label+text combo aligned to other label+value widgets\nvoid ImGui::LabelTextV(const char* label, const char* fmt, va_list args)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return;\n\n    ImGuiContext& g = *GImGui;\n    const ImGuiStyle& style = g.Style;\n    const float w = CalcItemWidth();\n\n    const char* value_text_begin = &g.TempBuffer[0];\n    const char* value_text_end = value_text_begin + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args);\n    const ImVec2 value_size = CalcTextSize(value_text_begin, value_text_end, false);\n    const ImVec2 label_size = CalcTextSize(label, NULL, true);\n\n    const ImVec2 pos = window->DC.CursorPos;\n    const ImRect value_bb(pos, pos + ImVec2(w, value_size.y + style.FramePadding.y * 2));\n    const ImRect total_bb(pos, pos + ImVec2(w + (label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f), ImMax(value_size.y, label_size.y) + style.FramePadding.y * 2));\n    ItemSize(total_bb, style.FramePadding.y);\n    if (!ItemAdd(total_bb, 0))\n        return;\n\n    // Render\n    RenderTextClipped(value_bb.Min + style.FramePadding, value_bb.Max, value_text_begin, value_text_end, &value_size, ImVec2(0.0f, 0.0f));\n    if (label_size.x > 0.0f)\n        RenderText(ImVec2(value_bb.Max.x + style.ItemInnerSpacing.x, value_bb.Min.y + style.FramePadding.y), label);\n}\n\nvoid ImGui::BulletText(const char* fmt, ...)\n{\n    va_list args;\n    va_start(args, fmt);\n    BulletTextV(fmt, args);\n    va_end(args);\n}\n\n// Text with a little bullet aligned to the typical tree node.\nvoid ImGui::BulletTextV(const char* fmt, va_list args)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return;\n\n    ImGuiContext& g = *GImGui;\n    const ImGuiStyle& style = g.Style;\n\n    const char* text_begin = g.TempBuffer;\n    const char* text_end = text_begin + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args);\n    const ImVec2 label_size = CalcTextSize(text_begin, text_end, false);\n    const ImVec2 total_size = ImVec2(g.FontSize + (label_size.x > 0.0f ? (label_size.x + style.FramePadding.x * 2) : 0.0f), label_size.y);  // Empty text doesn't add padding\n    ImVec2 pos = window->DC.CursorPos;\n    pos.y += window->DC.CurrLineTextBaseOffset;\n    ItemSize(total_size, 0.0f);\n    const ImRect bb(pos, pos + total_size);\n    if (!ItemAdd(bb, 0))\n        return;\n\n    // Render\n    ImU32 text_col = GetColorU32(ImGuiCol_Text);\n    RenderBullet(window->DrawList, bb.Min + ImVec2(style.FramePadding.x + g.FontSize * 0.5f, g.FontSize * 0.5f), text_col);\n    RenderText(bb.Min + ImVec2(g.FontSize + style.FramePadding.x * 2, 0.0f), text_begin, text_end, false);\n}\n\n//-------------------------------------------------------------------------\n// [SECTION] Widgets: Main\n//-------------------------------------------------------------------------\n// - ButtonBehavior() [Internal]\n// - Button()\n// - SmallButton()\n// - InvisibleButton()\n// - ArrowButton()\n// - CloseButton() [Internal]\n// - CollapseButton() [Internal]\n// - GetWindowScrollbarID() [Internal]\n// - GetWindowScrollbarRect() [Internal]\n// - Scrollbar() [Internal]\n// - ScrollbarEx() [Internal]\n// - Image()\n// - ImageButton()\n// - Checkbox()\n// - CheckboxFlagsT() [Internal]\n// - CheckboxFlags()\n// - RadioButton()\n// - ProgressBar()\n// - Bullet()\n//-------------------------------------------------------------------------\n\n// The ButtonBehavior() function is key to many interactions and used by many/most widgets.\n// Because we handle so many cases (keyboard/gamepad navigation, drag and drop) and many specific behavior (via ImGuiButtonFlags_),\n// this code is a little complex.\n// By far the most common path is interacting with the Mouse using the default ImGuiButtonFlags_PressedOnClickRelease button behavior.\n// See the series of events below and the corresponding state reported by dear imgui:\n//------------------------------------------------------------------------------------------------------------------------------------------------\n// with PressedOnClickRelease:             return-value  IsItemHovered()  IsItemActive()  IsItemActivated()  IsItemDeactivated()  IsItemClicked()\n//   Frame N+0 (mouse is outside bb)        -             -                -               -                  -                    -\n//   Frame N+1 (mouse moves inside bb)      -             true             -               -                  -                    -\n//   Frame N+2 (mouse button is down)       -             true             true            true               -                    true\n//   Frame N+3 (mouse button is down)       -             true             true            -                  -                    -\n//   Frame N+4 (mouse moves outside bb)     -             -                true            -                  -                    -\n//   Frame N+5 (mouse moves inside bb)      -             true             true            -                  -                    -\n//   Frame N+6 (mouse button is released)   true          true             -               -                  true                 -\n//   Frame N+7 (mouse button is released)   -             true             -               -                  -                    -\n//   Frame N+8 (mouse moves outside bb)     -             -                -               -                  -                    -\n//------------------------------------------------------------------------------------------------------------------------------------------------\n// with PressedOnClick:                    return-value  IsItemHovered()  IsItemActive()  IsItemActivated()  IsItemDeactivated()  IsItemClicked()\n//   Frame N+2 (mouse button is down)       true          true             true            true               -                    true\n//   Frame N+3 (mouse button is down)       -             true             true            -                  -                    -\n//   Frame N+6 (mouse button is released)   -             true             -               -                  true                 -\n//   Frame N+7 (mouse button is released)   -             true             -               -                  -                    -\n//------------------------------------------------------------------------------------------------------------------------------------------------\n// with PressedOnRelease:                  return-value  IsItemHovered()  IsItemActive()  IsItemActivated()  IsItemDeactivated()  IsItemClicked()\n//   Frame N+2 (mouse button is down)       -             true             -               -                  -                    true\n//   Frame N+3 (mouse button is down)       -             true             -               -                  -                    -\n//   Frame N+6 (mouse button is released)   true          true             -               -                  -                    -\n//   Frame N+7 (mouse button is released)   -             true             -               -                  -                    -\n//------------------------------------------------------------------------------------------------------------------------------------------------\n// with PressedOnDoubleClick:              return-value  IsItemHovered()  IsItemActive()  IsItemActivated()  IsItemDeactivated()  IsItemClicked()\n//   Frame N+0 (mouse button is down)       -             true             -               -                  -                    true\n//   Frame N+1 (mouse button is down)       -             true             -               -                  -                    -\n//   Frame N+2 (mouse button is released)   -             true             -               -                  -                    -\n//   Frame N+3 (mouse button is released)   -             true             -               -                  -                    -\n//   Frame N+4 (mouse button is down)       true          true             true            true               -                    true\n//   Frame N+5 (mouse button is down)       -             true             true            -                  -                    -\n//   Frame N+6 (mouse button is released)   -             true             -               -                  true                 -\n//   Frame N+7 (mouse button is released)   -             true             -               -                  -                    -\n//------------------------------------------------------------------------------------------------------------------------------------------------\n// Note that some combinations are supported,\n// - PressedOnDragDropHold can generally be associated with any flag.\n// - PressedOnDoubleClick can be associated by PressedOnClickRelease/PressedOnRelease, in which case the second release event won't be reported.\n//------------------------------------------------------------------------------------------------------------------------------------------------\n// The behavior of the return-value changes when ImGuiButtonFlags_Repeat is set:\n//                                         Repeat+                  Repeat+           Repeat+             Repeat+\n//                                         PressedOnClickRelease    PressedOnClick    PressedOnRelease    PressedOnDoubleClick\n//-------------------------------------------------------------------------------------------------------------------------------------------------\n//   Frame N+0 (mouse button is down)       -                        true              -                   true\n//   ...                                    -                        -                 -                   -\n//   Frame N + RepeatDelay                  true                     true              -                   true\n//   ...                                    -                        -                 -                   -\n//   Frame N + RepeatDelay + RepeatRate*N   true                     true              -                   true\n//-------------------------------------------------------------------------------------------------------------------------------------------------\n\nbool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool* out_held, ImGuiButtonFlags flags)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = GetCurrentWindow();\n\n    // Default only reacts to left mouse button\n    if ((flags & ImGuiButtonFlags_MouseButtonMask_) == 0)\n        flags |= ImGuiButtonFlags_MouseButtonDefault_;\n\n    // Default behavior requires click + release inside bounding box\n    if ((flags & ImGuiButtonFlags_PressedOnMask_) == 0)\n        flags |= ImGuiButtonFlags_PressedOnDefault_;\n\n    ImGuiWindow* backup_hovered_window = g.HoveredWindow;\n    const bool flatten_hovered_children = (flags & ImGuiButtonFlags_FlattenChildren) && g.HoveredWindow && g.HoveredWindow->RootWindow == window;\n    if (flatten_hovered_children)\n        g.HoveredWindow = window;\n\n#ifdef IMGUI_ENABLE_TEST_ENGINE\n    if (id != 0 && g.LastItemData.ID != id)\n        IMGUI_TEST_ENGINE_ITEM_ADD(bb, id);\n#endif\n\n    bool pressed = false;\n    bool hovered = ItemHoverable(bb, id);\n\n    // Drag source doesn't report as hovered\n    if (hovered && g.DragDropActive && g.DragDropPayload.SourceId == id && !(g.DragDropSourceFlags & ImGuiDragDropFlags_SourceNoDisableHover))\n        hovered = false;\n\n    // Special mode for Drag and Drop where holding button pressed for a long time while dragging another item triggers the button\n    if (g.DragDropActive && (flags & ImGuiButtonFlags_PressedOnDragDropHold) && !(g.DragDropSourceFlags & ImGuiDragDropFlags_SourceNoHoldToOpenOthers))\n        if (IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem))\n        {\n            hovered = true;\n            SetHoveredID(id);\n            if (g.HoveredIdTimer - g.IO.DeltaTime <= DRAGDROP_HOLD_TO_OPEN_TIMER && g.HoveredIdTimer >= DRAGDROP_HOLD_TO_OPEN_TIMER)\n            {\n                pressed = true;\n                g.DragDropHoldJustPressedId = id;\n                FocusWindow(window);\n            }\n        }\n\n    if (flatten_hovered_children)\n        g.HoveredWindow = backup_hovered_window;\n\n    // AllowOverlap mode (rarely used) requires previous frame HoveredId to be null or to match. This allows using patterns where a later submitted widget overlaps a previous one.\n    if (hovered && (flags & ImGuiButtonFlags_AllowItemOverlap) && (g.HoveredIdPreviousFrame != id && g.HoveredIdPreviousFrame != 0))\n        hovered = false;\n\n    // Mouse handling\n    if (hovered)\n    {\n        if (!(flags & ImGuiButtonFlags_NoKeyModifiers) || (!g.IO.KeyCtrl && !g.IO.KeyShift && !g.IO.KeyAlt))\n        {\n            // Poll buttons\n            int mouse_button_clicked = -1;\n            int mouse_button_released = -1;\n            if ((flags & ImGuiButtonFlags_MouseButtonLeft) && g.IO.MouseClicked[0])         { mouse_button_clicked = 0; }\n            else if ((flags & ImGuiButtonFlags_MouseButtonRight) && g.IO.MouseClicked[1])   { mouse_button_clicked = 1; }\n            else if ((flags & ImGuiButtonFlags_MouseButtonMiddle) && g.IO.MouseClicked[2])  { mouse_button_clicked = 2; }\n            if ((flags & ImGuiButtonFlags_MouseButtonLeft) && g.IO.MouseReleased[0])        { mouse_button_released = 0; }\n            else if ((flags & ImGuiButtonFlags_MouseButtonRight) && g.IO.MouseReleased[1])  { mouse_button_released = 1; }\n            else if ((flags & ImGuiButtonFlags_MouseButtonMiddle) && g.IO.MouseReleased[2]) { mouse_button_released = 2; }\n\n            if (mouse_button_clicked != -1 && g.ActiveId != id)\n            {\n                if (flags & (ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnClickReleaseAnywhere))\n                {\n                    SetActiveID(id, window);\n                    g.ActiveIdMouseButton = mouse_button_clicked;\n                    if (!(flags & ImGuiButtonFlags_NoNavFocus))\n                        SetFocusID(id, window);\n                    FocusWindow(window);\n                }\n                if ((flags & ImGuiButtonFlags_PressedOnClick) || ((flags & ImGuiButtonFlags_PressedOnDoubleClick) && g.IO.MouseDoubleClicked[mouse_button_clicked]))\n                {\n                    pressed = true;\n                    if (flags & ImGuiButtonFlags_NoHoldingActiveId)\n                        ClearActiveID();\n                    else\n                        SetActiveID(id, window); // Hold on ID\n                    g.ActiveIdMouseButton = mouse_button_clicked;\n                    FocusWindow(window);\n                }\n            }\n            if ((flags & ImGuiButtonFlags_PressedOnRelease) && mouse_button_released != -1)\n            {\n                // Repeat mode trumps on release behavior\n                const bool has_repeated_at_least_once = (flags & ImGuiButtonFlags_Repeat) && g.IO.MouseDownDurationPrev[mouse_button_released] >= g.IO.KeyRepeatDelay;\n                if (!has_repeated_at_least_once)\n                    pressed = true;\n                ClearActiveID();\n            }\n\n            // 'Repeat' mode acts when held regardless of _PressedOn flags (see table above).\n            // Relies on repeat logic of IsMouseClicked() but we may as well do it ourselves if we end up exposing finer RepeatDelay/RepeatRate settings.\n            if (g.ActiveId == id && (flags & ImGuiButtonFlags_Repeat))\n                if (g.IO.MouseDownDuration[g.ActiveIdMouseButton] > 0.0f && IsMouseClicked(g.ActiveIdMouseButton, true))\n                    pressed = true;\n        }\n\n        if (pressed)\n            g.NavDisableHighlight = true;\n    }\n\n    // Gamepad/Keyboard navigation\n    // We report navigated item as hovered but we don't set g.HoveredId to not interfere with mouse.\n    if (g.NavId == id && !g.NavDisableHighlight && g.NavDisableMouseHover && (g.ActiveId == 0 || g.ActiveId == id || g.ActiveId == window->MoveId))\n        if (!(flags & ImGuiButtonFlags_NoHoveredOnFocus))\n            hovered = true;\n    if (g.NavActivateDownId == id)\n    {\n        bool nav_activated_by_code = (g.NavActivateId == id);\n        bool nav_activated_by_inputs = IsNavInputTest(ImGuiNavInput_Activate, (flags & ImGuiButtonFlags_Repeat) ? ImGuiInputReadMode_Repeat : ImGuiInputReadMode_Pressed);\n        if (nav_activated_by_code || nav_activated_by_inputs)\n            pressed = true;\n        if (nav_activated_by_code || nav_activated_by_inputs || g.ActiveId == id)\n        {\n            // Set active id so it can be queried by user via IsItemActive(), equivalent of holding the mouse button.\n            g.NavActivateId = id; // This is so SetActiveId assign a Nav source\n            SetActiveID(id, window);\n            if ((nav_activated_by_code || nav_activated_by_inputs) && !(flags & ImGuiButtonFlags_NoNavFocus))\n                SetFocusID(id, window);\n        }\n    }\n\n    // Process while held\n    bool held = false;\n    if (g.ActiveId == id)\n    {\n        if (g.ActiveIdSource == ImGuiInputSource_Mouse)\n        {\n            if (g.ActiveIdIsJustActivated)\n                g.ActiveIdClickOffset = g.IO.MousePos - bb.Min;\n\n            const int mouse_button = g.ActiveIdMouseButton;\n            IM_ASSERT(mouse_button >= 0 && mouse_button < ImGuiMouseButton_COUNT);\n            if (g.IO.MouseDown[mouse_button])\n            {\n                held = true;\n            }\n            else\n            {\n                bool release_in = hovered && (flags & ImGuiButtonFlags_PressedOnClickRelease) != 0;\n                bool release_anywhere = (flags & ImGuiButtonFlags_PressedOnClickReleaseAnywhere) != 0;\n                if ((release_in || release_anywhere) && !g.DragDropActive)\n                {\n                    // Report as pressed when releasing the mouse (this is the most common path)\n                    bool is_double_click_release = (flags & ImGuiButtonFlags_PressedOnDoubleClick) && g.IO.MouseDownWasDoubleClick[mouse_button];\n                    bool is_repeating_already = (flags & ImGuiButtonFlags_Repeat) && g.IO.MouseDownDurationPrev[mouse_button] >= g.IO.KeyRepeatDelay; // Repeat mode trumps <on release>\n                    if (!is_double_click_release && !is_repeating_already)\n                        pressed = true;\n                }\n                ClearActiveID();\n            }\n            if (!(flags & ImGuiButtonFlags_NoNavFocus))\n                g.NavDisableHighlight = true;\n        }\n        else if (g.ActiveIdSource == ImGuiInputSource_Nav)\n        {\n            // When activated using Nav, we hold on the ActiveID until activation button is released\n            if (g.NavActivateDownId != id)\n                ClearActiveID();\n        }\n        if (pressed)\n            g.ActiveIdHasBeenPressedBefore = true;\n    }\n\n    if (out_hovered) *out_hovered = hovered;\n    if (out_held) *out_held = held;\n\n    return pressed;\n}\n\nbool ImGui::ButtonEx(const char* label, const ImVec2& size_arg, ImGuiButtonFlags flags)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return false;\n\n    ImGuiContext& g = *GImGui;\n    const ImGuiStyle& style = g.Style;\n    const ImGuiID id = window->GetID(label);\n    const ImVec2 label_size = CalcTextSize(label, NULL, true);\n\n    ImVec2 pos = window->DC.CursorPos;\n    if ((flags & ImGuiButtonFlags_AlignTextBaseLine) && style.FramePadding.y < window->DC.CurrLineTextBaseOffset) // Try to vertically align buttons that are smaller/have no padding so that text baseline matches (bit hacky, since it shouldn't be a flag)\n        pos.y += window->DC.CurrLineTextBaseOffset - style.FramePadding.y;\n    ImVec2 size = CalcItemSize(size_arg, label_size.x + style.FramePadding.x * 2.0f, label_size.y + style.FramePadding.y * 2.0f);\n\n    const ImRect bb(pos, pos + size);\n    ItemSize(size, style.FramePadding.y);\n    if (!ItemAdd(bb, id))\n        return false;\n\n    if (g.LastItemData.InFlags & ImGuiItemFlags_ButtonRepeat)\n        flags |= ImGuiButtonFlags_Repeat;\n\n    bool hovered, held;\n    bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags);\n\n    // Render\n    const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);\n    RenderNavHighlight(bb, id);\n    RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding);\n\n    if (g.LogEnabled)\n        LogSetNextTextDecoration(\"[\", \"]\");\n    RenderTextClipped(bb.Min + style.FramePadding, bb.Max - style.FramePadding, label, NULL, &label_size, style.ButtonTextAlign, &bb);\n\n    // Automatically close popups\n    //if (pressed && !(flags & ImGuiButtonFlags_DontClosePopups) && (window->Flags & ImGuiWindowFlags_Popup))\n    //    CloseCurrentPopup();\n\n    IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags);\n    return pressed;\n}\n\nbool ImGui::Button(const char* label, const ImVec2& size_arg)\n{\n    return ButtonEx(label, size_arg, ImGuiButtonFlags_None);\n}\n\n// Small buttons fits within text without additional vertical spacing.\nbool ImGui::SmallButton(const char* label)\n{\n    ImGuiContext& g = *GImGui;\n    float backup_padding_y = g.Style.FramePadding.y;\n    g.Style.FramePadding.y = 0.0f;\n    bool pressed = ButtonEx(label, ImVec2(0, 0), ImGuiButtonFlags_AlignTextBaseLine);\n    g.Style.FramePadding.y = backup_padding_y;\n    return pressed;\n}\n\n// Tip: use ImGui::PushID()/PopID() to push indices or pointers in the ID stack.\n// Then you can keep 'str_id' empty or the same for all your buttons (instead of creating a string based on a non-string id)\nbool ImGui::InvisibleButton(const char* str_id, const ImVec2& size_arg, ImGuiButtonFlags flags)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return false;\n\n    // Cannot use zero-size for InvisibleButton(). Unlike Button() there is not way to fallback using the label size.\n    IM_ASSERT(size_arg.x != 0.0f && size_arg.y != 0.0f);\n\n    const ImGuiID id = window->GetID(str_id);\n    ImVec2 size = CalcItemSize(size_arg, 0.0f, 0.0f);\n    const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);\n    ItemSize(size);\n    if (!ItemAdd(bb, id))\n        return false;\n\n    bool hovered, held;\n    bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags);\n\n    return pressed;\n}\n\nbool ImGui::ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size, ImGuiButtonFlags flags)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return false;\n\n    ImGuiContext& g = *GImGui;\n    const ImGuiID id = window->GetID(str_id);\n    const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);\n    const float default_size = GetFrameHeight();\n    ItemSize(size, (size.y >= default_size) ? g.Style.FramePadding.y : -1.0f);\n    if (!ItemAdd(bb, id))\n        return false;\n\n    if (g.LastItemData.InFlags & ImGuiItemFlags_ButtonRepeat)\n        flags |= ImGuiButtonFlags_Repeat;\n\n    bool hovered, held;\n    bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags);\n\n    // Render\n    const ImU32 bg_col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);\n    const ImU32 text_col = GetColorU32(ImGuiCol_Text);\n    RenderNavHighlight(bb, id);\n    RenderFrame(bb.Min, bb.Max, bg_col, true, g.Style.FrameRounding);\n    RenderArrow(window->DrawList, bb.Min + ImVec2(ImMax(0.0f, (size.x - g.FontSize) * 0.5f), ImMax(0.0f, (size.y - g.FontSize) * 0.5f)), text_col, dir);\n\n    return pressed;\n}\n\nbool ImGui::ArrowButton(const char* str_id, ImGuiDir dir)\n{\n    float sz = GetFrameHeight();\n    return ArrowButtonEx(str_id, dir, ImVec2(sz, sz), ImGuiButtonFlags_None);\n}\n\n// Button to close a window\nbool ImGui::CloseButton(ImGuiID id, const ImVec2& pos)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n\n    // Tweak 1: Shrink hit-testing area if button covers an abnormally large proportion of the visible region. That's in order to facilitate moving the window away. (#3825)\n    // This may better be applied as a general hit-rect reduction mechanism for all widgets to ensure the area to move window is always accessible?\n    const ImRect bb(pos, pos + ImVec2(g.FontSize, g.FontSize) + g.Style.FramePadding * 2.0f);\n    ImRect bb_interact = bb;\n    const float area_to_visible_ratio = window->OuterRectClipped.GetArea() / bb.GetArea();\n    if (area_to_visible_ratio < 1.5f)\n        bb_interact.Expand(ImFloor(bb_interact.GetSize() * -0.25f));\n\n    // Tweak 2: We intentionally allow interaction when clipped so that a mechanical Alt,Right,Activate sequence can always close a window.\n    // (this isn't the regular behavior of buttons, but it doesn't affect the user much because navigation tends to keep items visible).\n    bool is_clipped = !ItemAdd(bb_interact, id);\n\n    bool hovered, held;\n    bool pressed = ButtonBehavior(bb_interact, id, &hovered, &held);\n    if (is_clipped)\n        return pressed;\n\n    // Render\n    // FIXME: Clarify this mess\n    ImU32 col = GetColorU32(held ? ImGuiCol_ButtonActive : ImGuiCol_ButtonHovered);\n    ImVec2 center = bb.GetCenter();\n    if (hovered)\n        window->DrawList->AddCircleFilled(center, ImMax(2.0f, g.FontSize * 0.5f + 1.0f), col, 12);\n\n    float cross_extent = g.FontSize * 0.5f * 0.7071f - 1.0f;\n    ImU32 cross_col = GetColorU32(ImGuiCol_Text);\n    center -= ImVec2(0.5f, 0.5f);\n    window->DrawList->AddLine(center + ImVec2(+cross_extent, +cross_extent), center + ImVec2(-cross_extent, -cross_extent), cross_col, 1.0f);\n    window->DrawList->AddLine(center + ImVec2(+cross_extent, -cross_extent), center + ImVec2(-cross_extent, +cross_extent), cross_col, 1.0f);\n\n    return pressed;\n}\n\nbool ImGui::CollapseButton(ImGuiID id, const ImVec2& pos)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n\n    ImRect bb(pos, pos + ImVec2(g.FontSize, g.FontSize) + g.Style.FramePadding * 2.0f);\n    ItemAdd(bb, id);\n    bool hovered, held;\n    bool pressed = ButtonBehavior(bb, id, &hovered, &held, ImGuiButtonFlags_None);\n\n    // Render\n    ImU32 bg_col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);\n    ImU32 text_col = GetColorU32(ImGuiCol_Text);\n    ImVec2 center = bb.GetCenter();\n    if (hovered || held)\n        window->DrawList->AddCircleFilled(center/*+ ImVec2(0.0f, -0.5f)*/, g.FontSize * 0.5f + 1.0f, bg_col, 12);\n    RenderArrow(window->DrawList, bb.Min + g.Style.FramePadding, text_col, window->Collapsed ? ImGuiDir_Right : ImGuiDir_Down, 1.0f);\n\n    // Switch to moving the window after mouse is moved beyond the initial drag threshold\n    if (IsItemActive() && IsMouseDragging(0))\n        StartMouseMovingWindow(window);\n\n    return pressed;\n}\n\nImGuiID ImGui::GetWindowScrollbarID(ImGuiWindow* window, ImGuiAxis axis)\n{\n    return window->GetIDNoKeepAlive(axis == ImGuiAxis_X ? \"#SCROLLX\" : \"#SCROLLY\");\n}\n\n// Return scrollbar rectangle, must only be called for corresponding axis if window->ScrollbarX/Y is set.\nImRect ImGui::GetWindowScrollbarRect(ImGuiWindow* window, ImGuiAxis axis)\n{\n    const ImRect outer_rect = window->Rect();\n    const ImRect inner_rect = window->InnerRect;\n    const float border_size = window->WindowBorderSize;\n    const float scrollbar_size = window->ScrollbarSizes[axis ^ 1]; // (ScrollbarSizes.x = width of Y scrollbar; ScrollbarSizes.y = height of X scrollbar)\n    IM_ASSERT(scrollbar_size > 0.0f);\n    if (axis == ImGuiAxis_X)\n        return ImRect(inner_rect.Min.x, ImMax(outer_rect.Min.y, outer_rect.Max.y - border_size - scrollbar_size), inner_rect.Max.x, outer_rect.Max.y);\n    else\n        return ImRect(ImMax(outer_rect.Min.x, outer_rect.Max.x - border_size - scrollbar_size), inner_rect.Min.y, outer_rect.Max.x, inner_rect.Max.y);\n}\n\nvoid ImGui::Scrollbar(ImGuiAxis axis)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n\n    const ImGuiID id = GetWindowScrollbarID(window, axis);\n    KeepAliveID(id);\n\n    // Calculate scrollbar bounding box\n    ImRect bb = GetWindowScrollbarRect(window, axis);\n    ImDrawFlags rounding_corners = ImDrawFlags_RoundCornersNone;\n    if (axis == ImGuiAxis_X)\n    {\n        rounding_corners |= ImDrawFlags_RoundCornersBottomLeft;\n        if (!window->ScrollbarY)\n            rounding_corners |= ImDrawFlags_RoundCornersBottomRight;\n    }\n    else\n    {\n        if ((window->Flags & ImGuiWindowFlags_NoTitleBar) && !(window->Flags & ImGuiWindowFlags_MenuBar))\n            rounding_corners |= ImDrawFlags_RoundCornersTopRight;\n        if (!window->ScrollbarX)\n            rounding_corners |= ImDrawFlags_RoundCornersBottomRight;\n    }\n    float size_avail = window->InnerRect.Max[axis] - window->InnerRect.Min[axis];\n    float size_contents = window->ContentSize[axis] + window->WindowPadding[axis] * 2.0f;\n    ScrollbarEx(bb, id, axis, &window->Scroll[axis], size_avail, size_contents, rounding_corners);\n}\n\n// Vertical/Horizontal scrollbar\n// The entire piece of code below is rather confusing because:\n// - We handle absolute seeking (when first clicking outside the grab) and relative manipulation (afterward or when clicking inside the grab)\n// - We store values as normalized ratio and in a form that allows the window content to change while we are holding on a scrollbar\n// - We handle both horizontal and vertical scrollbars, which makes the terminology not ideal.\n// Still, the code should probably be made simpler..\nbool ImGui::ScrollbarEx(const ImRect& bb_frame, ImGuiID id, ImGuiAxis axis, float* p_scroll_v, float size_avail_v, float size_contents_v, ImDrawFlags flags)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    if (window->SkipItems)\n        return false;\n\n    const float bb_frame_width = bb_frame.GetWidth();\n    const float bb_frame_height = bb_frame.GetHeight();\n    if (bb_frame_width <= 0.0f || bb_frame_height <= 0.0f)\n        return false;\n\n    // When we are too small, start hiding and disabling the grab (this reduce visual noise on very small window and facilitate using the window resize grab)\n    float alpha = 1.0f;\n    if ((axis == ImGuiAxis_Y) && bb_frame_height < g.FontSize + g.Style.FramePadding.y * 2.0f)\n        alpha = ImSaturate((bb_frame_height - g.FontSize) / (g.Style.FramePadding.y * 2.0f));\n    if (alpha <= 0.0f)\n        return false;\n\n    const ImGuiStyle& style = g.Style;\n    const bool allow_interaction = (alpha >= 1.0f);\n\n    ImRect bb = bb_frame;\n    bb.Expand(ImVec2(-ImClamp(IM_FLOOR((bb_frame_width - 2.0f) * 0.5f), 0.0f, 3.0f), -ImClamp(IM_FLOOR((bb_frame_height - 2.0f) * 0.5f), 0.0f, 3.0f)));\n\n    // V denote the main, longer axis of the scrollbar (= height for a vertical scrollbar)\n    const float scrollbar_size_v = (axis == ImGuiAxis_X) ? bb.GetWidth() : bb.GetHeight();\n\n    // Calculate the height of our grabbable box. It generally represent the amount visible (vs the total scrollable amount)\n    // But we maintain a minimum size in pixel to allow for the user to still aim inside.\n    IM_ASSERT(ImMax(size_contents_v, size_avail_v) > 0.0f); // Adding this assert to check if the ImMax(XXX,1.0f) is still needed. PLEASE CONTACT ME if this triggers.\n    const float win_size_v = ImMax(ImMax(size_contents_v, size_avail_v), 1.0f);\n    const float grab_h_pixels = ImClamp(scrollbar_size_v * (size_avail_v / win_size_v), style.GrabMinSize, scrollbar_size_v);\n    const float grab_h_norm = grab_h_pixels / scrollbar_size_v;\n\n    // Handle input right away. None of the code of Begin() is relying on scrolling position before calling Scrollbar().\n    bool held = false;\n    bool hovered = false;\n    ButtonBehavior(bb, id, &hovered, &held, ImGuiButtonFlags_NoNavFocus);\n\n    float scroll_max = ImMax(1.0f, size_contents_v - size_avail_v);\n    float scroll_ratio = ImSaturate(*p_scroll_v / scroll_max);\n    float grab_v_norm = scroll_ratio * (scrollbar_size_v - grab_h_pixels) / scrollbar_size_v; // Grab position in normalized space\n    if (held && allow_interaction && grab_h_norm < 1.0f)\n    {\n        float scrollbar_pos_v = bb.Min[axis];\n        float mouse_pos_v = g.IO.MousePos[axis];\n\n        // Click position in scrollbar normalized space (0.0f->1.0f)\n        const float clicked_v_norm = ImSaturate((mouse_pos_v - scrollbar_pos_v) / scrollbar_size_v);\n        SetHoveredID(id);\n\n        bool seek_absolute = false;\n        if (g.ActiveIdIsJustActivated)\n        {\n            // On initial click calculate the distance between mouse and the center of the grab\n            seek_absolute = (clicked_v_norm < grab_v_norm || clicked_v_norm > grab_v_norm + grab_h_norm);\n            if (seek_absolute)\n                g.ScrollbarClickDeltaToGrabCenter = 0.0f;\n            else\n                g.ScrollbarClickDeltaToGrabCenter = clicked_v_norm - grab_v_norm - grab_h_norm * 0.5f;\n        }\n\n        // Apply scroll (p_scroll_v will generally point on one member of window->Scroll)\n        // It is ok to modify Scroll here because we are being called in Begin() after the calculation of ContentSize and before setting up our starting position\n        const float scroll_v_norm = ImSaturate((clicked_v_norm - g.ScrollbarClickDeltaToGrabCenter - grab_h_norm * 0.5f) / (1.0f - grab_h_norm));\n        *p_scroll_v = IM_ROUND(scroll_v_norm * scroll_max);//(win_size_contents_v - win_size_v));\n\n        // Update values for rendering\n        scroll_ratio = ImSaturate(*p_scroll_v / scroll_max);\n        grab_v_norm = scroll_ratio * (scrollbar_size_v - grab_h_pixels) / scrollbar_size_v;\n\n        // Update distance to grab now that we have seeked and saturated\n        if (seek_absolute)\n            g.ScrollbarClickDeltaToGrabCenter = clicked_v_norm - grab_v_norm - grab_h_norm * 0.5f;\n    }\n\n    // Render\n    const ImU32 bg_col = GetColorU32(ImGuiCol_ScrollbarBg);\n    const ImU32 grab_col = GetColorU32(held ? ImGuiCol_ScrollbarGrabActive : hovered ? ImGuiCol_ScrollbarGrabHovered : ImGuiCol_ScrollbarGrab, alpha);\n    window->DrawList->AddRectFilled(bb_frame.Min, bb_frame.Max, bg_col, window->WindowRounding, flags);\n    ImRect grab_rect;\n    if (axis == ImGuiAxis_X)\n        grab_rect = ImRect(ImLerp(bb.Min.x, bb.Max.x, grab_v_norm), bb.Min.y, ImLerp(bb.Min.x, bb.Max.x, grab_v_norm) + grab_h_pixels, bb.Max.y);\n    else\n        grab_rect = ImRect(bb.Min.x, ImLerp(bb.Min.y, bb.Max.y, grab_v_norm), bb.Max.x, ImLerp(bb.Min.y, bb.Max.y, grab_v_norm) + grab_h_pixels);\n    window->DrawList->AddRectFilled(grab_rect.Min, grab_rect.Max, grab_col, style.ScrollbarRounding);\n\n    return held;\n}\n\nvoid ImGui::Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec4& tint_col, const ImVec4& border_col)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return;\n\n    ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);\n    if (border_col.w > 0.0f)\n        bb.Max += ImVec2(2, 2);\n    ItemSize(bb);\n    if (!ItemAdd(bb, 0))\n        return;\n\n    if (border_col.w > 0.0f)\n    {\n        window->DrawList->AddRect(bb.Min, bb.Max, GetColorU32(border_col), 0.0f);\n        window->DrawList->AddImage(user_texture_id, bb.Min + ImVec2(1, 1), bb.Max - ImVec2(1, 1), uv0, uv1, GetColorU32(tint_col));\n    }\n    else\n    {\n        window->DrawList->AddImage(user_texture_id, bb.Min, bb.Max, uv0, uv1, GetColorU32(tint_col));\n    }\n}\n\n// ImageButton() is flawed as 'id' is always derived from 'texture_id' (see #2464 #1390)\n// We provide this internal helper to write your own variant while we figure out how to redesign the public ImageButton() API.\nbool ImGui::ImageButtonEx(ImGuiID id, ImTextureID texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec2& padding, const ImVec4& bg_col, const ImVec4& tint_col)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return false;\n\n    const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size + padding * 2);\n    ItemSize(bb);\n    if (!ItemAdd(bb, id))\n        return false;\n\n    bool hovered, held;\n    bool pressed = ButtonBehavior(bb, id, &hovered, &held);\n\n    // Render\n    const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);\n    RenderNavHighlight(bb, id);\n    RenderFrame(bb.Min, bb.Max, col, true, ImClamp((float)ImMin(padding.x, padding.y), 0.0f, g.Style.FrameRounding));\n    if (bg_col.w > 0.0f)\n        window->DrawList->AddRectFilled(bb.Min + padding, bb.Max - padding, GetColorU32(bg_col));\n    window->DrawList->AddImage(texture_id, bb.Min + padding, bb.Max - padding, uv0, uv1, GetColorU32(tint_col));\n\n    return pressed;\n}\n\n// frame_padding < 0: uses FramePadding from style (default)\n// frame_padding = 0: no framing\n// frame_padding > 0: set framing size\nbool ImGui::ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, int frame_padding, const ImVec4& bg_col, const ImVec4& tint_col)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    if (window->SkipItems)\n        return false;\n\n    // Default to using texture ID as ID. User can still push string/integer prefixes.\n    PushID((void*)(intptr_t)user_texture_id);\n    const ImGuiID id = window->GetID(\"#image\");\n    PopID();\n\n    const ImVec2 padding = (frame_padding >= 0) ? ImVec2((float)frame_padding, (float)frame_padding) : g.Style.FramePadding;\n    return ImageButtonEx(id, user_texture_id, size, uv0, uv1, padding, bg_col, tint_col);\n}\n\nbool ImGui::Checkbox(const char* label, bool* v)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return false;\n\n    ImGuiContext& g = *GImGui;\n    const ImGuiStyle& style = g.Style;\n    const ImGuiID id = window->GetID(label);\n    const ImVec2 label_size = CalcTextSize(label, NULL, true);\n\n    const float square_sz = GetFrameHeight();\n    const ImVec2 pos = window->DC.CursorPos;\n    const ImRect total_bb(pos, pos + ImVec2(square_sz + (label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f), label_size.y + style.FramePadding.y * 2.0f));\n    ItemSize(total_bb, style.FramePadding.y);\n    if (!ItemAdd(total_bb, id))\n    {\n        IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags | ImGuiItemStatusFlags_Checkable | (*v ? ImGuiItemStatusFlags_Checked : 0));\n        return false;\n    }\n\n    bool hovered, held;\n    bool pressed = ButtonBehavior(total_bb, id, &hovered, &held);\n    if (pressed)\n    {\n        *v = !(*v);\n        MarkItemEdited(id);\n    }\n\n    const ImRect check_bb(pos, pos + ImVec2(square_sz, square_sz));\n    RenderNavHighlight(total_bb, id);\n    RenderFrame(check_bb.Min, check_bb.Max, GetColorU32((held && hovered) ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg), true, style.FrameRounding);\n    ImU32 check_col = GetColorU32(ImGuiCol_CheckMark);\n    bool mixed_value = (g.LastItemData.InFlags & ImGuiItemFlags_MixedValue) != 0;\n    if (mixed_value)\n    {\n        // Undocumented tristate/mixed/indeterminate checkbox (#2644)\n        // This may seem awkwardly designed because the aim is to make ImGuiItemFlags_MixedValue supported by all widgets (not just checkbox)\n        ImVec2 pad(ImMax(1.0f, IM_FLOOR(square_sz / 3.6f)), ImMax(1.0f, IM_FLOOR(square_sz / 3.6f)));\n        window->DrawList->AddRectFilled(check_bb.Min + pad, check_bb.Max - pad, check_col, style.FrameRounding);\n    }\n    else if (*v)\n    {\n        const float pad = ImMax(1.0f, IM_FLOOR(square_sz / 6.0f));\n        RenderCheckMark(window->DrawList, check_bb.Min + ImVec2(pad, pad), check_col, square_sz - pad * 2.0f);\n    }\n\n    ImVec2 label_pos = ImVec2(check_bb.Max.x + style.ItemInnerSpacing.x, check_bb.Min.y + style.FramePadding.y);\n    if (g.LogEnabled)\n        LogRenderedText(&label_pos, mixed_value ? \"[~]\" : *v ? \"[x]\" : \"[ ]\");\n    if (label_size.x > 0.0f)\n        RenderText(label_pos, label);\n\n    IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags | ImGuiItemStatusFlags_Checkable | (*v ? ImGuiItemStatusFlags_Checked : 0));\n    return pressed;\n}\n\ntemplate<typename T>\nbool ImGui::CheckboxFlagsT(const char* label, T* flags, T flags_value)\n{\n    bool all_on = (*flags & flags_value) == flags_value;\n    bool any_on = (*flags & flags_value) != 0;\n    bool pressed;\n    if (!all_on && any_on)\n    {\n        ImGuiContext& g = *GImGui;\n        ImGuiItemFlags backup_item_flags = g.CurrentItemFlags;\n        g.CurrentItemFlags |= ImGuiItemFlags_MixedValue;\n        pressed = Checkbox(label, &all_on);\n        g.CurrentItemFlags = backup_item_flags;\n    }\n    else\n    {\n        pressed = Checkbox(label, &all_on);\n\n    }\n    if (pressed)\n    {\n        if (all_on)\n            *flags |= flags_value;\n        else\n            *flags &= ~flags_value;\n    }\n    return pressed;\n}\n\nbool ImGui::CheckboxFlags(const char* label, int* flags, int flags_value)\n{\n    return CheckboxFlagsT(label, flags, flags_value);\n}\n\nbool ImGui::CheckboxFlags(const char* label, unsigned int* flags, unsigned int flags_value)\n{\n    return CheckboxFlagsT(label, flags, flags_value);\n}\n\nbool ImGui::CheckboxFlags(const char* label, ImS64* flags, ImS64 flags_value)\n{\n    return CheckboxFlagsT(label, flags, flags_value);\n}\n\nbool ImGui::CheckboxFlags(const char* label, ImU64* flags, ImU64 flags_value)\n{\n    return CheckboxFlagsT(label, flags, flags_value);\n}\n\nbool ImGui::RadioButton(const char* label, bool active)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return false;\n\n    ImGuiContext& g = *GImGui;\n    const ImGuiStyle& style = g.Style;\n    const ImGuiID id = window->GetID(label);\n    const ImVec2 label_size = CalcTextSize(label, NULL, true);\n\n    const float square_sz = GetFrameHeight();\n    const ImVec2 pos = window->DC.CursorPos;\n    const ImRect check_bb(pos, pos + ImVec2(square_sz, square_sz));\n    const ImRect total_bb(pos, pos + ImVec2(square_sz + (label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f), label_size.y + style.FramePadding.y * 2.0f));\n    ItemSize(total_bb, style.FramePadding.y);\n    if (!ItemAdd(total_bb, id))\n        return false;\n\n    ImVec2 center = check_bb.GetCenter();\n    center.x = IM_ROUND(center.x);\n    center.y = IM_ROUND(center.y);\n    const float radius = (square_sz - 1.0f) * 0.5f;\n\n    bool hovered, held;\n    bool pressed = ButtonBehavior(total_bb, id, &hovered, &held);\n    if (pressed)\n        MarkItemEdited(id);\n\n    RenderNavHighlight(total_bb, id);\n    window->DrawList->AddCircleFilled(center, radius, GetColorU32((held && hovered) ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg), 16);\n    if (active)\n    {\n        const float pad = ImMax(1.0f, IM_FLOOR(square_sz / 6.0f));\n        window->DrawList->AddCircleFilled(center, radius - pad, GetColorU32(ImGuiCol_CheckMark), 16);\n    }\n\n    if (style.FrameBorderSize > 0.0f)\n    {\n        window->DrawList->AddCircle(center + ImVec2(1, 1), radius, GetColorU32(ImGuiCol_BorderShadow), 16, style.FrameBorderSize);\n        window->DrawList->AddCircle(center, radius, GetColorU32(ImGuiCol_Border), 16, style.FrameBorderSize);\n    }\n\n    ImVec2 label_pos = ImVec2(check_bb.Max.x + style.ItemInnerSpacing.x, check_bb.Min.y + style.FramePadding.y);\n    if (g.LogEnabled)\n        LogRenderedText(&label_pos, active ? \"(x)\" : \"( )\");\n    if (label_size.x > 0.0f)\n        RenderText(label_pos, label);\n\n    IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags);\n    return pressed;\n}\n\n// FIXME: This would work nicely if it was a public template, e.g. 'template<T> RadioButton(const char* label, T* v, T v_button)', but I'm not sure how we would expose it..\nbool ImGui::RadioButton(const char* label, int* v, int v_button)\n{\n    const bool pressed = RadioButton(label, *v == v_button);\n    if (pressed)\n        *v = v_button;\n    return pressed;\n}\n\n// size_arg (for each axis) < 0.0f: align to end, 0.0f: auto, > 0.0f: specified size\nvoid ImGui::ProgressBar(float fraction, const ImVec2& size_arg, const char* overlay)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return;\n\n    ImGuiContext& g = *GImGui;\n    const ImGuiStyle& style = g.Style;\n\n    ImVec2 pos = window->DC.CursorPos;\n    ImVec2 size = CalcItemSize(size_arg, CalcItemWidth(), g.FontSize + style.FramePadding.y * 2.0f);\n    ImRect bb(pos, pos + size);\n    ItemSize(size, style.FramePadding.y);\n    if (!ItemAdd(bb, 0))\n        return;\n\n    // Render\n    fraction = ImSaturate(fraction);\n    RenderFrame(bb.Min, bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding);\n    bb.Expand(ImVec2(-style.FrameBorderSize, -style.FrameBorderSize));\n    const ImVec2 fill_br = ImVec2(ImLerp(bb.Min.x, bb.Max.x, fraction), bb.Max.y);\n    RenderRectFilledRangeH(window->DrawList, bb, GetColorU32(ImGuiCol_PlotHistogram), 0.0f, fraction, style.FrameRounding);\n\n    // Default displaying the fraction as percentage string, but user can override it\n    char overlay_buf[32];\n    if (!overlay)\n    {\n        ImFormatString(overlay_buf, IM_ARRAYSIZE(overlay_buf), \"%.0f%%\", fraction * 100 + 0.01f);\n        overlay = overlay_buf;\n    }\n\n    ImVec2 overlay_size = CalcTextSize(overlay, NULL);\n    if (overlay_size.x > 0.0f)\n        RenderTextClipped(ImVec2(ImClamp(fill_br.x + style.ItemSpacing.x, bb.Min.x, bb.Max.x - overlay_size.x - style.ItemInnerSpacing.x), bb.Min.y), bb.Max, overlay, NULL, &overlay_size, ImVec2(0.0f, 0.5f), &bb);\n}\n\nvoid ImGui::Bullet()\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return;\n\n    ImGuiContext& g = *GImGui;\n    const ImGuiStyle& style = g.Style;\n    const float line_height = ImMax(ImMin(window->DC.CurrLineSize.y, g.FontSize + g.Style.FramePadding.y * 2), g.FontSize);\n    const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(g.FontSize, line_height));\n    ItemSize(bb);\n    if (!ItemAdd(bb, 0))\n    {\n        SameLine(0, style.FramePadding.x * 2);\n        return;\n    }\n\n    // Render and stay on same line\n    ImU32 text_col = GetColorU32(ImGuiCol_Text);\n    RenderBullet(window->DrawList, bb.Min + ImVec2(style.FramePadding.x + g.FontSize * 0.5f, line_height * 0.5f), text_col);\n    SameLine(0, style.FramePadding.x * 2.0f);\n}\n\n//-------------------------------------------------------------------------\n// [SECTION] Widgets: Low-level Layout helpers\n//-------------------------------------------------------------------------\n// - Spacing()\n// - Dummy()\n// - NewLine()\n// - AlignTextToFramePadding()\n// - SeparatorEx() [Internal]\n// - Separator()\n// - SplitterBehavior() [Internal]\n// - ShrinkWidths() [Internal]\n//-------------------------------------------------------------------------\n\nvoid ImGui::Spacing()\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return;\n    ItemSize(ImVec2(0, 0));\n}\n\nvoid ImGui::Dummy(const ImVec2& size)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return;\n\n    const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);\n    ItemSize(size);\n    ItemAdd(bb, 0);\n}\n\nvoid ImGui::NewLine()\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return;\n\n    ImGuiContext& g = *GImGui;\n    const ImGuiLayoutType backup_layout_type = window->DC.LayoutType;\n    window->DC.LayoutType = ImGuiLayoutType_Vertical;\n    if (window->DC.CurrLineSize.y > 0.0f)     // In the event that we are on a line with items that is smaller that FontSize high, we will preserve its height.\n        ItemSize(ImVec2(0, 0));\n    else\n        ItemSize(ImVec2(0.0f, g.FontSize));\n    window->DC.LayoutType = backup_layout_type;\n}\n\nvoid ImGui::AlignTextToFramePadding()\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return;\n\n    ImGuiContext& g = *GImGui;\n    window->DC.CurrLineSize.y = ImMax(window->DC.CurrLineSize.y, g.FontSize + g.Style.FramePadding.y * 2);\n    window->DC.CurrLineTextBaseOffset = ImMax(window->DC.CurrLineTextBaseOffset, g.Style.FramePadding.y);\n}\n\n// Horizontal/vertical separating line\nvoid ImGui::SeparatorEx(ImGuiSeparatorFlags flags)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return;\n\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(ImIsPowerOfTwo(flags & (ImGuiSeparatorFlags_Horizontal | ImGuiSeparatorFlags_Vertical)));   // Check that only 1 option is selected\n\n    float thickness_draw = 1.0f;\n    float thickness_layout = 0.0f;\n    if (flags & ImGuiSeparatorFlags_Vertical)\n    {\n        // Vertical separator, for menu bars (use current line height). Not exposed because it is misleading and it doesn't have an effect on regular layout.\n        float y1 = window->DC.CursorPos.y;\n        float y2 = window->DC.CursorPos.y + window->DC.CurrLineSize.y;\n        const ImRect bb(ImVec2(window->DC.CursorPos.x, y1), ImVec2(window->DC.CursorPos.x + thickness_draw, y2));\n        ItemSize(ImVec2(thickness_layout, 0.0f));\n        if (!ItemAdd(bb, 0))\n            return;\n\n        // Draw\n        window->DrawList->AddLine(ImVec2(bb.Min.x, bb.Min.y), ImVec2(bb.Min.x, bb.Max.y), GetColorU32(ImGuiCol_Separator));\n        if (g.LogEnabled)\n            LogText(\" |\");\n    }\n    else if (flags & ImGuiSeparatorFlags_Horizontal)\n    {\n        // Horizontal Separator\n        float x1 = window->Pos.x;\n        float x2 = window->Pos.x + window->Size.x;\n\n        // FIXME-WORKRECT: old hack (#205) until we decide of consistent behavior with WorkRect/Indent and Separator\n        if (g.GroupStack.Size > 0 && g.GroupStack.back().WindowID == window->ID)\n            x1 += window->DC.Indent.x;\n\n        ImGuiOldColumns* columns = (flags & ImGuiSeparatorFlags_SpanAllColumns) ? window->DC.CurrentColumns : NULL;\n        if (columns)\n            PushColumnsBackground();\n\n        // We don't provide our width to the layout so that it doesn't get feed back into AutoFit\n        const ImRect bb(ImVec2(x1, window->DC.CursorPos.y), ImVec2(x2, window->DC.CursorPos.y + thickness_draw));\n        ItemSize(ImVec2(0.0f, thickness_layout));\n        const bool item_visible = ItemAdd(bb, 0);\n        if (item_visible)\n        {\n            // Draw\n            window->DrawList->AddLine(bb.Min, ImVec2(bb.Max.x, bb.Min.y), GetColorU32(ImGuiCol_Separator));\n            if (g.LogEnabled)\n                LogRenderedText(&bb.Min, \"--------------------------------\\n\");\n\n        }\n        if (columns)\n        {\n            PopColumnsBackground();\n            columns->LineMinY = window->DC.CursorPos.y;\n        }\n    }\n}\n\nvoid ImGui::Separator()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    if (window->SkipItems)\n        return;\n\n    // Those flags should eventually be overridable by the user\n    ImGuiSeparatorFlags flags = (window->DC.LayoutType == ImGuiLayoutType_Horizontal) ? ImGuiSeparatorFlags_Vertical : ImGuiSeparatorFlags_Horizontal;\n    flags |= ImGuiSeparatorFlags_SpanAllColumns;\n    SeparatorEx(flags);\n}\n\n// Using 'hover_visibility_delay' allows us to hide the highlight and mouse cursor for a short time, which can be convenient to reduce visual noise.\nbool ImGui::SplitterBehavior(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float* size1, float* size2, float min_size1, float min_size2, float hover_extend, float hover_visibility_delay)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n\n    const ImGuiItemFlags item_flags_backup = g.CurrentItemFlags;\n    g.CurrentItemFlags |= ImGuiItemFlags_NoNav | ImGuiItemFlags_NoNavDefaultFocus;\n    bool item_add = ItemAdd(bb, id);\n    g.CurrentItemFlags = item_flags_backup;\n    if (!item_add)\n        return false;\n\n    bool hovered, held;\n    ImRect bb_interact = bb;\n    bb_interact.Expand(axis == ImGuiAxis_Y ? ImVec2(0.0f, hover_extend) : ImVec2(hover_extend, 0.0f));\n    ButtonBehavior(bb_interact, id, &hovered, &held, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_AllowItemOverlap);\n    if (hovered)\n        g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_HoveredRect; // for IsItemHovered(), because bb_interact is larger than bb\n    if (g.ActiveId != id)\n        SetItemAllowOverlap();\n\n    if (held || (hovered && g.HoveredIdPreviousFrame == id && g.HoveredIdTimer >= hover_visibility_delay))\n        SetMouseCursor(axis == ImGuiAxis_Y ? ImGuiMouseCursor_ResizeNS : ImGuiMouseCursor_ResizeEW);\n\n    ImRect bb_render = bb;\n    if (held)\n    {\n        ImVec2 mouse_delta_2d = g.IO.MousePos - g.ActiveIdClickOffset - bb_interact.Min;\n        float mouse_delta = (axis == ImGuiAxis_Y) ? mouse_delta_2d.y : mouse_delta_2d.x;\n\n        // Minimum pane size\n        float size_1_maximum_delta = ImMax(0.0f, *size1 - min_size1);\n        float size_2_maximum_delta = ImMax(0.0f, *size2 - min_size2);\n        if (mouse_delta < -size_1_maximum_delta)\n            mouse_delta = -size_1_maximum_delta;\n        if (mouse_delta > size_2_maximum_delta)\n            mouse_delta = size_2_maximum_delta;\n\n        // Apply resize\n        if (mouse_delta != 0.0f)\n        {\n            if (mouse_delta < 0.0f)\n                IM_ASSERT(*size1 + mouse_delta >= min_size1);\n            if (mouse_delta > 0.0f)\n                IM_ASSERT(*size2 - mouse_delta >= min_size2);\n            *size1 += mouse_delta;\n            *size2 -= mouse_delta;\n            bb_render.Translate((axis == ImGuiAxis_X) ? ImVec2(mouse_delta, 0.0f) : ImVec2(0.0f, mouse_delta));\n            MarkItemEdited(id);\n        }\n    }\n\n    // Render\n    const ImU32 col = GetColorU32(held ? ImGuiCol_SeparatorActive : (hovered && g.HoveredIdTimer >= hover_visibility_delay) ? ImGuiCol_SeparatorHovered : ImGuiCol_Separator);\n    window->DrawList->AddRectFilled(bb_render.Min, bb_render.Max, col, 0.0f);\n\n    return held;\n}\n\nstatic int IMGUI_CDECL ShrinkWidthItemComparer(const void* lhs, const void* rhs)\n{\n    const ImGuiShrinkWidthItem* a = (const ImGuiShrinkWidthItem*)lhs;\n    const ImGuiShrinkWidthItem* b = (const ImGuiShrinkWidthItem*)rhs;\n    if (int d = (int)(b->Width - a->Width))\n        return d;\n    return (b->Index - a->Index);\n}\n\n// Shrink excess width from a set of item, by removing width from the larger items first.\n// Set items Width to -1.0f to disable shrinking this item.\nvoid ImGui::ShrinkWidths(ImGuiShrinkWidthItem* items, int count, float width_excess)\n{\n    if (count == 1)\n    {\n        if (items[0].Width >= 0.0f)\n            items[0].Width = ImMax(items[0].Width - width_excess, 1.0f);\n        return;\n    }\n    ImQsort(items, (size_t)count, sizeof(ImGuiShrinkWidthItem), ShrinkWidthItemComparer);\n    int count_same_width = 1;\n    while (width_excess > 0.0f && count_same_width < count)\n    {\n        while (count_same_width < count && items[0].Width <= items[count_same_width].Width)\n            count_same_width++;\n        float max_width_to_remove_per_item = (count_same_width < count && items[count_same_width].Width >= 0.0f) ? (items[0].Width - items[count_same_width].Width) : (items[0].Width - 1.0f);\n        if (max_width_to_remove_per_item <= 0.0f)\n            break;\n        float width_to_remove_per_item = ImMin(width_excess / count_same_width, max_width_to_remove_per_item);\n        for (int item_n = 0; item_n < count_same_width; item_n++)\n            items[item_n].Width -= width_to_remove_per_item;\n        width_excess -= width_to_remove_per_item * count_same_width;\n    }\n\n    // Round width and redistribute remainder left-to-right (could make it an option of the function?)\n    // Ensure that e.g. the right-most tab of a shrunk tab-bar always reaches exactly at the same distance from the right-most edge of the tab bar separator.\n    width_excess = 0.0f;\n    for (int n = 0; n < count; n++)\n    {\n        float width_rounded = ImFloor(items[n].Width);\n        width_excess += items[n].Width - width_rounded;\n        items[n].Width = width_rounded;\n    }\n    if (width_excess > 0.0f)\n        for (int n = 0; n < count; n++)\n            if (items[n].Index < (int)(width_excess + 0.01f))\n                items[n].Width += 1.0f;\n}\n\n//-------------------------------------------------------------------------\n// [SECTION] Widgets: ComboBox\n//-------------------------------------------------------------------------\n// - CalcMaxPopupHeightFromItemCount() [Internal]\n// - BeginCombo()\n// - BeginComboPopup() [Internal]\n// - EndCombo()\n// - BeginComboPreview() [Internal]\n// - EndComboPreview() [Internal]\n// - Combo()\n//-------------------------------------------------------------------------\n\nstatic float CalcMaxPopupHeightFromItemCount(int items_count)\n{\n    ImGuiContext& g = *GImGui;\n    if (items_count <= 0)\n        return FLT_MAX;\n    return (g.FontSize + g.Style.ItemSpacing.y) * items_count - g.Style.ItemSpacing.y + (g.Style.WindowPadding.y * 2);\n}\n\nbool ImGui::BeginCombo(const char* label, const char* preview_value, ImGuiComboFlags flags)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = GetCurrentWindow();\n\n    ImGuiNextWindowDataFlags backup_next_window_data_flags = g.NextWindowData.Flags;\n    g.NextWindowData.ClearFlags(); // We behave like Begin() and need to consume those values\n    if (window->SkipItems)\n        return false;\n\n    const ImGuiStyle& style = g.Style;\n    const ImGuiID id = window->GetID(label);\n    IM_ASSERT((flags & (ImGuiComboFlags_NoArrowButton | ImGuiComboFlags_NoPreview)) != (ImGuiComboFlags_NoArrowButton | ImGuiComboFlags_NoPreview)); // Can't use both flags together\n\n    const float arrow_size = (flags & ImGuiComboFlags_NoArrowButton) ? 0.0f : GetFrameHeight();\n    const ImVec2 label_size = CalcTextSize(label, NULL, true);\n    const float w = (flags & ImGuiComboFlags_NoPreview) ? arrow_size : CalcItemWidth();\n    const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y * 2.0f));\n    const ImRect total_bb(bb.Min, bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));\n    ItemSize(total_bb, style.FramePadding.y);\n    if (!ItemAdd(total_bb, id, &bb))\n        return false;\n\n    // Open on click\n    bool hovered, held;\n    bool pressed = ButtonBehavior(bb, id, &hovered, &held);\n    const ImGuiID popup_id = ImHashStr(\"##ComboPopup\", 0, id);\n    bool popup_open = IsPopupOpen(popup_id, ImGuiPopupFlags_None);\n    if ((pressed || g.NavActivateId == id) && !popup_open)\n    {\n        OpenPopupEx(popup_id, ImGuiPopupFlags_None);\n        popup_open = true;\n    }\n\n    // Render shape\n    const ImU32 frame_col = GetColorU32(hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg);\n    const float value_x2 = ImMax(bb.Min.x, bb.Max.x - arrow_size);\n    RenderNavHighlight(bb, id);\n    if (!(flags & ImGuiComboFlags_NoPreview))\n        window->DrawList->AddRectFilled(bb.Min, ImVec2(value_x2, bb.Max.y), frame_col, style.FrameRounding, (flags & ImGuiComboFlags_NoArrowButton) ? ImDrawFlags_RoundCornersAll : ImDrawFlags_RoundCornersLeft);\n    if (!(flags & ImGuiComboFlags_NoArrowButton))\n    {\n        ImU32 bg_col = GetColorU32((popup_open || hovered) ? ImGuiCol_ButtonHovered : ImGuiCol_Button);\n        ImU32 text_col = GetColorU32(ImGuiCol_Text);\n        window->DrawList->AddRectFilled(ImVec2(value_x2, bb.Min.y), bb.Max, bg_col, style.FrameRounding, (w <= arrow_size) ? ImDrawFlags_RoundCornersAll : ImDrawFlags_RoundCornersRight);\n        if (value_x2 + arrow_size - style.FramePadding.x <= bb.Max.x)\n            RenderArrow(window->DrawList, ImVec2(value_x2 + style.FramePadding.y, bb.Min.y + style.FramePadding.y), text_col, ImGuiDir_Down, 1.0f);\n    }\n    RenderFrameBorder(bb.Min, bb.Max, style.FrameRounding);\n\n    // Custom preview\n    if (flags & ImGuiComboFlags_CustomPreview)\n    {\n        g.ComboPreviewData.PreviewRect = ImRect(bb.Min.x, bb.Min.y, value_x2, bb.Max.y);\n        IM_ASSERT(preview_value == NULL || preview_value[0] == 0);\n        preview_value = NULL;\n    }\n\n    // Render preview and label\n    if (preview_value != NULL && !(flags & ImGuiComboFlags_NoPreview))\n    {\n        if (g.LogEnabled)\n            LogSetNextTextDecoration(\"{\", \"}\");\n        RenderTextClipped(bb.Min + style.FramePadding, ImVec2(value_x2, bb.Max.y), preview_value, NULL, NULL);\n    }\n    if (label_size.x > 0)\n        RenderText(ImVec2(bb.Max.x + style.ItemInnerSpacing.x, bb.Min.y + style.FramePadding.y), label);\n\n    if (!popup_open)\n        return false;\n\n    g.NextWindowData.Flags = backup_next_window_data_flags;\n    return BeginComboPopup(popup_id, bb, flags);\n}\n\nbool ImGui::BeginComboPopup(ImGuiID popup_id, const ImRect& bb, ImGuiComboFlags flags)\n{\n    ImGuiContext& g = *GImGui;\n    if (!IsPopupOpen(popup_id, ImGuiPopupFlags_None))\n    {\n        g.NextWindowData.ClearFlags();\n        return false;\n    }\n\n    // Set popup size\n    float w = bb.GetWidth();\n    if (g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSizeConstraint)\n    {\n        g.NextWindowData.SizeConstraintRect.Min.x = ImMax(g.NextWindowData.SizeConstraintRect.Min.x, w);\n    }\n    else\n    {\n        if ((flags & ImGuiComboFlags_HeightMask_) == 0)\n            flags |= ImGuiComboFlags_HeightRegular;\n        IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiComboFlags_HeightMask_)); // Only one\n        int popup_max_height_in_items = -1;\n        if (flags & ImGuiComboFlags_HeightRegular)     popup_max_height_in_items = 8;\n        else if (flags & ImGuiComboFlags_HeightSmall)  popup_max_height_in_items = 4;\n        else if (flags & ImGuiComboFlags_HeightLarge)  popup_max_height_in_items = 20;\n        SetNextWindowSizeConstraints(ImVec2(w, 0.0f), ImVec2(FLT_MAX, CalcMaxPopupHeightFromItemCount(popup_max_height_in_items)));\n    }\n\n    // This is essentially a specialized version of BeginPopupEx()\n    char name[16];\n    ImFormatString(name, IM_ARRAYSIZE(name), \"##Combo_%02d\", g.BeginPopupStack.Size); // Recycle windows based on depth\n\n    // Set position given a custom constraint (peak into expected window size so we can position it)\n    // FIXME: This might be easier to express with an hypothetical SetNextWindowPosConstraints() function?\n    // FIXME: This might be moved to Begin() or at least around the same spot where Tooltips and other Popups are calling FindBestWindowPosForPopupEx()?\n    if (ImGuiWindow* popup_window = FindWindowByName(name))\n        if (popup_window->WasActive)\n        {\n            // Always override 'AutoPosLastDirection' to not leave a chance for a past value to affect us.\n            ImVec2 size_expected = CalcWindowNextAutoFitSize(popup_window);\n            popup_window->AutoPosLastDirection = (flags & ImGuiComboFlags_PopupAlignLeft) ? ImGuiDir_Left : ImGuiDir_Down; // Left = \"Below, Toward Left\", Down = \"Below, Toward Right (default)\"\n            ImRect r_outer = GetPopupAllowedExtentRect(popup_window);\n            ImVec2 pos = FindBestWindowPosForPopupEx(bb.GetBL(), size_expected, &popup_window->AutoPosLastDirection, r_outer, bb, ImGuiPopupPositionPolicy_ComboBox);\n            SetNextWindowPos(pos);\n        }\n\n    // We don't use BeginPopupEx() solely because we have a custom name string, which we could make an argument to BeginPopupEx()\n    ImGuiWindowFlags window_flags = ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_Popup | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoMove;\n    PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(g.Style.FramePadding.x, g.Style.WindowPadding.y)); // Horizontally align ourselves with the framed text\n    bool ret = Begin(name, NULL, window_flags);\n    PopStyleVar();\n    if (!ret)\n    {\n        EndPopup();\n        IM_ASSERT(0);   // This should never happen as we tested for IsPopupOpen() above\n        return false;\n    }\n    return true;\n}\n\nvoid ImGui::EndCombo()\n{\n    EndPopup();\n}\n\n// Call directly after the BeginCombo/EndCombo block. The preview is designed to only host non-interactive elements\n// (Experimental, see GitHub issues: #1658, #4168)\nbool ImGui::BeginComboPreview()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    ImGuiComboPreviewData* preview_data = &g.ComboPreviewData;\n\n    if (window->SkipItems || !window->ClipRect.Overlaps(g.LastItemData.Rect)) // FIXME: Because we don't have a ImGuiItemStatusFlags_Visible flag to test last ItemAdd() result\n        return false;\n    IM_ASSERT(g.LastItemData.Rect.Min.x == preview_data->PreviewRect.Min.x && g.LastItemData.Rect.Min.y == preview_data->PreviewRect.Min.y); // Didn't call after BeginCombo/EndCombo block or forgot to pass ImGuiComboFlags_CustomPreview flag?\n    if (!window->ClipRect.Contains(preview_data->PreviewRect)) // Narrower test (optional)\n        return false;\n\n    // FIXME: This could be contained in a PushWorkRect() api\n    preview_data->BackupCursorPos = window->DC.CursorPos;\n    preview_data->BackupCursorMaxPos = window->DC.CursorMaxPos;\n    preview_data->BackupCursorPosPrevLine = window->DC.CursorPosPrevLine;\n    preview_data->BackupPrevLineTextBaseOffset = window->DC.PrevLineTextBaseOffset;\n    preview_data->BackupLayout = window->DC.LayoutType;\n    window->DC.CursorPos = preview_data->PreviewRect.Min + g.Style.FramePadding;\n    window->DC.CursorMaxPos = window->DC.CursorPos;\n    window->DC.LayoutType = ImGuiLayoutType_Horizontal;\n    PushClipRect(preview_data->PreviewRect.Min, preview_data->PreviewRect.Max, true);\n\n    return true;\n}\n\nvoid ImGui::EndComboPreview()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    ImGuiComboPreviewData* preview_data = &g.ComboPreviewData;\n\n    // FIXME: Using CursorMaxPos approximation instead of correct AABB which we will store in ImDrawCmd in the future\n    ImDrawList* draw_list = window->DrawList;\n    if (window->DC.CursorMaxPos.x < preview_data->PreviewRect.Max.x && window->DC.CursorMaxPos.y < preview_data->PreviewRect.Max.y)\n        if (draw_list->CmdBuffer.Size > 1) // Unlikely case that the PushClipRect() didn't create a command\n        {\n            draw_list->_CmdHeader.ClipRect = draw_list->CmdBuffer[draw_list->CmdBuffer.Size - 1].ClipRect = draw_list->CmdBuffer[draw_list->CmdBuffer.Size - 2].ClipRect;\n            draw_list->_TryMergeDrawCmds();\n        }\n    PopClipRect();\n    window->DC.CursorPos = preview_data->BackupCursorPos;\n    window->DC.CursorMaxPos = ImMax(window->DC.CursorMaxPos, preview_data->BackupCursorMaxPos);\n    window->DC.CursorPosPrevLine = preview_data->BackupCursorPosPrevLine;\n    window->DC.PrevLineTextBaseOffset = preview_data->BackupPrevLineTextBaseOffset;\n    window->DC.LayoutType = preview_data->BackupLayout;\n    preview_data->PreviewRect = ImRect();\n}\n\n// Getter for the old Combo() API: const char*[]\nstatic bool Items_ArrayGetter(void* data, int idx, const char** out_text)\n{\n    const char* const* items = (const char* const*)data;\n    if (out_text)\n        *out_text = items[idx];\n    return true;\n}\n\n// Getter for the old Combo() API: \"item1\\0item2\\0item3\\0\"\nstatic bool Items_SingleStringGetter(void* data, int idx, const char** out_text)\n{\n    // FIXME-OPT: we could pre-compute the indices to fasten this. But only 1 active combo means the waste is limited.\n    const char* items_separated_by_zeros = (const char*)data;\n    int items_count = 0;\n    const char* p = items_separated_by_zeros;\n    while (*p)\n    {\n        if (idx == items_count)\n            break;\n        p += strlen(p) + 1;\n        items_count++;\n    }\n    if (!*p)\n        return false;\n    if (out_text)\n        *out_text = p;\n    return true;\n}\n\n// Old API, prefer using BeginCombo() nowadays if you can.\nbool ImGui::Combo(const char* label, int* current_item, bool (*items_getter)(void*, int, const char**), void* data, int items_count, int popup_max_height_in_items)\n{\n    ImGuiContext& g = *GImGui;\n\n    // Call the getter to obtain the preview string which is a parameter to BeginCombo()\n    const char* preview_value = NULL;\n    if (*current_item >= 0 && *current_item < items_count)\n        items_getter(data, *current_item, &preview_value);\n\n    // The old Combo() API exposed \"popup_max_height_in_items\". The new more general BeginCombo() API doesn't have/need it, but we emulate it here.\n    if (popup_max_height_in_items != -1 && !(g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSizeConstraint))\n        SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, CalcMaxPopupHeightFromItemCount(popup_max_height_in_items)));\n\n    if (!BeginCombo(label, preview_value, ImGuiComboFlags_None))\n        return false;\n\n    // Display items\n    // FIXME-OPT: Use clipper (but we need to disable it on the appearing frame to make sure our call to SetItemDefaultFocus() is processed)\n    bool value_changed = false;\n    for (int i = 0; i < items_count; i++)\n    {\n        PushID((void*)(intptr_t)i);\n        const bool item_selected = (i == *current_item);\n        const char* item_text;\n        if (!items_getter(data, i, &item_text))\n            item_text = \"*Unknown item*\";\n        if (Selectable(item_text, item_selected))\n        {\n            value_changed = true;\n            *current_item = i;\n        }\n        if (item_selected)\n            SetItemDefaultFocus();\n        PopID();\n    }\n\n    EndCombo();\n\n    if (value_changed)\n        MarkItemEdited(g.LastItemData.ID);\n\n    return value_changed;\n}\n\n// Combo box helper allowing to pass an array of strings.\nbool ImGui::Combo(const char* label, int* current_item, const char* const items[], int items_count, int height_in_items)\n{\n    const bool value_changed = Combo(label, current_item, Items_ArrayGetter, (void*)items, items_count, height_in_items);\n    return value_changed;\n}\n\n// Combo box helper allowing to pass all items in a single string literal holding multiple zero-terminated items \"item1\\0item2\\0\"\nbool ImGui::Combo(const char* label, int* current_item, const char* items_separated_by_zeros, int height_in_items)\n{\n    int items_count = 0;\n    const char* p = items_separated_by_zeros;       // FIXME-OPT: Avoid computing this, or at least only when combo is open\n    while (*p)\n    {\n        p += strlen(p) + 1;\n        items_count++;\n    }\n    bool value_changed = Combo(label, current_item, Items_SingleStringGetter, (void*)items_separated_by_zeros, items_count, height_in_items);\n    return value_changed;\n}\n\n//-------------------------------------------------------------------------\n// [SECTION] Data Type and Data Formatting Helpers [Internal]\n//-------------------------------------------------------------------------\n// - PatchFormatStringFloatToInt()\n// - DataTypeGetInfo()\n// - DataTypeFormatString()\n// - DataTypeApplyOp()\n// - DataTypeApplyOpFromText()\n// - DataTypeClamp()\n// - GetMinimumStepAtDecimalPrecision\n// - RoundScalarWithFormat<>()\n//-------------------------------------------------------------------------\n\nstatic const ImGuiDataTypeInfo GDataTypeInfo[] =\n{\n    { sizeof(char),             \"S8\",   \"%d\",   \"%d\"    },  // ImGuiDataType_S8\n    { sizeof(unsigned char),    \"U8\",   \"%u\",   \"%u\"    },\n    { sizeof(short),            \"S16\",  \"%d\",   \"%d\"    },  // ImGuiDataType_S16\n    { sizeof(unsigned short),   \"U16\",  \"%u\",   \"%u\"    },\n    { sizeof(int),              \"S32\",  \"%d\",   \"%d\"    },  // ImGuiDataType_S32\n    { sizeof(unsigned int),     \"U32\",  \"%u\",   \"%u\"    },\n#ifdef _MSC_VER\n    { sizeof(ImS64),            \"S64\",  \"%I64d\",\"%I64d\" },  // ImGuiDataType_S64\n    { sizeof(ImU64),            \"U64\",  \"%I64u\",\"%I64u\" },\n#else\n    { sizeof(ImS64),            \"S64\",  \"%lld\", \"%lld\"  },  // ImGuiDataType_S64\n    { sizeof(ImU64),            \"U64\",  \"%llu\", \"%llu\"  },\n#endif\n    { sizeof(float),            \"float\", \"%.3f\",\"%f\"    },  // ImGuiDataType_Float (float are promoted to double in va_arg)\n    { sizeof(double),           \"double\",\"%f\",  \"%lf\"   },  // ImGuiDataType_Double\n};\nIM_STATIC_ASSERT(IM_ARRAYSIZE(GDataTypeInfo) == ImGuiDataType_COUNT);\n\n// FIXME-LEGACY: Prior to 1.61 our DragInt() function internally used floats and because of this the compile-time default value for format was \"%.0f\".\n// Even though we changed the compile-time default, we expect users to have carried %f around, which would break the display of DragInt() calls.\n// To honor backward compatibility we are rewriting the format string, unless IMGUI_DISABLE_OBSOLETE_FUNCTIONS is enabled. What could possibly go wrong?!\nstatic const char* PatchFormatStringFloatToInt(const char* fmt)\n{\n    if (fmt[0] == '%' && fmt[1] == '.' && fmt[2] == '0' && fmt[3] == 'f' && fmt[4] == 0) // Fast legacy path for \"%.0f\" which is expected to be the most common case.\n        return \"%d\";\n    const char* fmt_start = ImParseFormatFindStart(fmt);    // Find % (if any, and ignore %%)\n    const char* fmt_end = ImParseFormatFindEnd(fmt_start);  // Find end of format specifier, which itself is an exercise of confidence/recklessness (because snprintf is dependent on libc or user).\n    if (fmt_end > fmt_start && fmt_end[-1] == 'f')\n    {\n#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS\n        if (fmt_start == fmt && fmt_end[0] == 0)\n            return \"%d\";\n        ImGuiContext& g = *GImGui;\n        ImFormatString(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), \"%.*s%%d%s\", (int)(fmt_start - fmt), fmt, fmt_end); // Honor leading and trailing decorations, but lose alignment/precision.\n        return g.TempBuffer;\n#else\n        IM_ASSERT(0 && \"DragInt(): Invalid format string!\"); // Old versions used a default parameter of \"%.0f\", please replace with e.g. \"%d\"\n#endif\n    }\n    return fmt;\n}\n\nconst ImGuiDataTypeInfo* ImGui::DataTypeGetInfo(ImGuiDataType data_type)\n{\n    IM_ASSERT(data_type >= 0 && data_type < ImGuiDataType_COUNT);\n    return &GDataTypeInfo[data_type];\n}\n\nint ImGui::DataTypeFormatString(char* buf, int buf_size, ImGuiDataType data_type, const void* p_data, const char* format)\n{\n    // Signedness doesn't matter when pushing integer arguments\n    if (data_type == ImGuiDataType_S32 || data_type == ImGuiDataType_U32)\n        return ImFormatString(buf, buf_size, format, *(const ImU32*)p_data);\n    if (data_type == ImGuiDataType_S64 || data_type == ImGuiDataType_U64)\n        return ImFormatString(buf, buf_size, format, *(const ImU64*)p_data);\n    if (data_type == ImGuiDataType_Float)\n        return ImFormatString(buf, buf_size, format, *(const float*)p_data);\n    if (data_type == ImGuiDataType_Double)\n        return ImFormatString(buf, buf_size, format, *(const double*)p_data);\n    if (data_type == ImGuiDataType_S8)\n        return ImFormatString(buf, buf_size, format, *(const ImS8*)p_data);\n    if (data_type == ImGuiDataType_U8)\n        return ImFormatString(buf, buf_size, format, *(const ImU8*)p_data);\n    if (data_type == ImGuiDataType_S16)\n        return ImFormatString(buf, buf_size, format, *(const ImS16*)p_data);\n    if (data_type == ImGuiDataType_U16)\n        return ImFormatString(buf, buf_size, format, *(const ImU16*)p_data);\n    IM_ASSERT(0);\n    return 0;\n}\n\nvoid ImGui::DataTypeApplyOp(ImGuiDataType data_type, int op, void* output, const void* arg1, const void* arg2)\n{\n    IM_ASSERT(op == '+' || op == '-');\n    switch (data_type)\n    {\n        case ImGuiDataType_S8:\n            if (op == '+') { *(ImS8*)output  = ImAddClampOverflow(*(const ImS8*)arg1,  *(const ImS8*)arg2,  IM_S8_MIN,  IM_S8_MAX); }\n            if (op == '-') { *(ImS8*)output  = ImSubClampOverflow(*(const ImS8*)arg1,  *(const ImS8*)arg2,  IM_S8_MIN,  IM_S8_MAX); }\n            return;\n        case ImGuiDataType_U8:\n            if (op == '+') { *(ImU8*)output  = ImAddClampOverflow(*(const ImU8*)arg1,  *(const ImU8*)arg2,  IM_U8_MIN,  IM_U8_MAX); }\n            if (op == '-') { *(ImU8*)output  = ImSubClampOverflow(*(const ImU8*)arg1,  *(const ImU8*)arg2,  IM_U8_MIN,  IM_U8_MAX); }\n            return;\n        case ImGuiDataType_S16:\n            if (op == '+') { *(ImS16*)output = ImAddClampOverflow(*(const ImS16*)arg1, *(const ImS16*)arg2, IM_S16_MIN, IM_S16_MAX); }\n            if (op == '-') { *(ImS16*)output = ImSubClampOverflow(*(const ImS16*)arg1, *(const ImS16*)arg2, IM_S16_MIN, IM_S16_MAX); }\n            return;\n        case ImGuiDataType_U16:\n            if (op == '+') { *(ImU16*)output = ImAddClampOverflow(*(const ImU16*)arg1, *(const ImU16*)arg2, IM_U16_MIN, IM_U16_MAX); }\n            if (op == '-') { *(ImU16*)output = ImSubClampOverflow(*(const ImU16*)arg1, *(const ImU16*)arg2, IM_U16_MIN, IM_U16_MAX); }\n            return;\n        case ImGuiDataType_S32:\n            if (op == '+') { *(ImS32*)output = ImAddClampOverflow(*(const ImS32*)arg1, *(const ImS32*)arg2, IM_S32_MIN, IM_S32_MAX); }\n            if (op == '-') { *(ImS32*)output = ImSubClampOverflow(*(const ImS32*)arg1, *(const ImS32*)arg2, IM_S32_MIN, IM_S32_MAX); }\n            return;\n        case ImGuiDataType_U32:\n            if (op == '+') { *(ImU32*)output = ImAddClampOverflow(*(const ImU32*)arg1, *(const ImU32*)arg2, IM_U32_MIN, IM_U32_MAX); }\n            if (op == '-') { *(ImU32*)output = ImSubClampOverflow(*(const ImU32*)arg1, *(const ImU32*)arg2, IM_U32_MIN, IM_U32_MAX); }\n            return;\n        case ImGuiDataType_S64:\n            if (op == '+') { *(ImS64*)output = ImAddClampOverflow(*(const ImS64*)arg1, *(const ImS64*)arg2, IM_S64_MIN, IM_S64_MAX); }\n            if (op == '-') { *(ImS64*)output = ImSubClampOverflow(*(const ImS64*)arg1, *(const ImS64*)arg2, IM_S64_MIN, IM_S64_MAX); }\n            return;\n        case ImGuiDataType_U64:\n            if (op == '+') { *(ImU64*)output = ImAddClampOverflow(*(const ImU64*)arg1, *(const ImU64*)arg2, IM_U64_MIN, IM_U64_MAX); }\n            if (op == '-') { *(ImU64*)output = ImSubClampOverflow(*(const ImU64*)arg1, *(const ImU64*)arg2, IM_U64_MIN, IM_U64_MAX); }\n            return;\n        case ImGuiDataType_Float:\n            if (op == '+') { *(float*)output = *(const float*)arg1 + *(const float*)arg2; }\n            if (op == '-') { *(float*)output = *(const float*)arg1 - *(const float*)arg2; }\n            return;\n        case ImGuiDataType_Double:\n            if (op == '+') { *(double*)output = *(const double*)arg1 + *(const double*)arg2; }\n            if (op == '-') { *(double*)output = *(const double*)arg1 - *(const double*)arg2; }\n            return;\n        case ImGuiDataType_COUNT: break;\n    }\n    IM_ASSERT(0);\n}\n\n// User can input math operators (e.g. +100) to edit a numerical values.\n// NB: This is _not_ a full expression evaluator. We should probably add one and replace this dumb mess..\nbool ImGui::DataTypeApplyOpFromText(const char* buf, const char* initial_value_buf, ImGuiDataType data_type, void* p_data, const char* format)\n{\n    while (ImCharIsBlankA(*buf))\n        buf++;\n\n    // We don't support '-' op because it would conflict with inputing negative value.\n    // Instead you can use +-100 to subtract from an existing value\n    char op = buf[0];\n    if (op == '+' || op == '*' || op == '/')\n    {\n        buf++;\n        while (ImCharIsBlankA(*buf))\n            buf++;\n    }\n    else\n    {\n        op = 0;\n    }\n    if (!buf[0])\n        return false;\n\n    // Copy the value in an opaque buffer so we can compare at the end of the function if it changed at all.\n    const ImGuiDataTypeInfo* type_info = DataTypeGetInfo(data_type);\n    ImGuiDataTypeTempStorage data_backup;\n    memcpy(&data_backup, p_data, type_info->Size);\n\n    if (format == NULL)\n        format = type_info->ScanFmt;\n\n    // FIXME-LEGACY: The aim is to remove those operators and write a proper expression evaluator at some point..\n    int arg1i = 0;\n    if (data_type == ImGuiDataType_S32)\n    {\n        int* v = (int*)p_data;\n        int arg0i = *v;\n        float arg1f = 0.0f;\n        if (op && sscanf(initial_value_buf, format, &arg0i) < 1)\n            return false;\n        // Store operand in a float so we can use fractional value for multipliers (*1.1), but constant always parsed as integer so we can fit big integers (e.g. 2000000003) past float precision\n        if (op == '+')      { if (sscanf(buf, \"%d\", &arg1i)) *v = (int)(arg0i + arg1i); }                   // Add (use \"+-\" to subtract)\n        else if (op == '*') { if (sscanf(buf, \"%f\", &arg1f)) *v = (int)(arg0i * arg1f); }                   // Multiply\n        else if (op == '/') { if (sscanf(buf, \"%f\", &arg1f) && arg1f != 0.0f) *v = (int)(arg0i / arg1f); }  // Divide\n        else                { if (sscanf(buf, format, &arg1i) == 1) *v = arg1i; }                           // Assign constant\n    }\n    else if (data_type == ImGuiDataType_Float)\n    {\n        // For floats we have to ignore format with precision (e.g. \"%.2f\") because sscanf doesn't take them in\n        format = \"%f\";\n        float* v = (float*)p_data;\n        float arg0f = *v, arg1f = 0.0f;\n        if (op && sscanf(initial_value_buf, format, &arg0f) < 1)\n            return false;\n        if (sscanf(buf, format, &arg1f) < 1)\n            return false;\n        if (op == '+')      { *v = arg0f + arg1f; }                    // Add (use \"+-\" to subtract)\n        else if (op == '*') { *v = arg0f * arg1f; }                    // Multiply\n        else if (op == '/') { if (arg1f != 0.0f) *v = arg0f / arg1f; } // Divide\n        else                { *v = arg1f; }                            // Assign constant\n    }\n    else if (data_type == ImGuiDataType_Double)\n    {\n        format = \"%lf\"; // scanf differentiate float/double unlike printf which forces everything to double because of ellipsis\n        double* v = (double*)p_data;\n        double arg0f = *v, arg1f = 0.0;\n        if (op && sscanf(initial_value_buf, format, &arg0f) < 1)\n            return false;\n        if (sscanf(buf, format, &arg1f) < 1)\n            return false;\n        if (op == '+')      { *v = arg0f + arg1f; }                    // Add (use \"+-\" to subtract)\n        else if (op == '*') { *v = arg0f * arg1f; }                    // Multiply\n        else if (op == '/') { if (arg1f != 0.0f) *v = arg0f / arg1f; } // Divide\n        else                { *v = arg1f; }                            // Assign constant\n    }\n    else if (data_type == ImGuiDataType_U32 || data_type == ImGuiDataType_S64 || data_type == ImGuiDataType_U64)\n    {\n        // All other types assign constant\n        // We don't bother handling support for legacy operators since they are a little too crappy. Instead we will later implement a proper expression evaluator in the future.\n        if (sscanf(buf, format, p_data) < 1)\n            return false;\n    }\n    else\n    {\n        // Small types need a 32-bit buffer to receive the result from scanf()\n        int v32;\n        if (sscanf(buf, format, &v32) < 1)\n            return false;\n        if (data_type == ImGuiDataType_S8)\n            *(ImS8*)p_data = (ImS8)ImClamp(v32, (int)IM_S8_MIN, (int)IM_S8_MAX);\n        else if (data_type == ImGuiDataType_U8)\n            *(ImU8*)p_data = (ImU8)ImClamp(v32, (int)IM_U8_MIN, (int)IM_U8_MAX);\n        else if (data_type == ImGuiDataType_S16)\n            *(ImS16*)p_data = (ImS16)ImClamp(v32, (int)IM_S16_MIN, (int)IM_S16_MAX);\n        else if (data_type == ImGuiDataType_U16)\n            *(ImU16*)p_data = (ImU16)ImClamp(v32, (int)IM_U16_MIN, (int)IM_U16_MAX);\n        else\n            IM_ASSERT(0);\n    }\n\n    return memcmp(&data_backup, p_data, type_info->Size) != 0;\n}\n\ntemplate<typename T>\nstatic int DataTypeCompareT(const T* lhs, const T* rhs)\n{\n    if (*lhs < *rhs) return -1;\n    if (*lhs > *rhs) return +1;\n    return 0;\n}\n\nint ImGui::DataTypeCompare(ImGuiDataType data_type, const void* arg_1, const void* arg_2)\n{\n    switch (data_type)\n    {\n    case ImGuiDataType_S8:     return DataTypeCompareT<ImS8  >((const ImS8*  )arg_1, (const ImS8*  )arg_2);\n    case ImGuiDataType_U8:     return DataTypeCompareT<ImU8  >((const ImU8*  )arg_1, (const ImU8*  )arg_2);\n    case ImGuiDataType_S16:    return DataTypeCompareT<ImS16 >((const ImS16* )arg_1, (const ImS16* )arg_2);\n    case ImGuiDataType_U16:    return DataTypeCompareT<ImU16 >((const ImU16* )arg_1, (const ImU16* )arg_2);\n    case ImGuiDataType_S32:    return DataTypeCompareT<ImS32 >((const ImS32* )arg_1, (const ImS32* )arg_2);\n    case ImGuiDataType_U32:    return DataTypeCompareT<ImU32 >((const ImU32* )arg_1, (const ImU32* )arg_2);\n    case ImGuiDataType_S64:    return DataTypeCompareT<ImS64 >((const ImS64* )arg_1, (const ImS64* )arg_2);\n    case ImGuiDataType_U64:    return DataTypeCompareT<ImU64 >((const ImU64* )arg_1, (const ImU64* )arg_2);\n    case ImGuiDataType_Float:  return DataTypeCompareT<float >((const float* )arg_1, (const float* )arg_2);\n    case ImGuiDataType_Double: return DataTypeCompareT<double>((const double*)arg_1, (const double*)arg_2);\n    case ImGuiDataType_COUNT:  break;\n    }\n    IM_ASSERT(0);\n    return 0;\n}\n\ntemplate<typename T>\nstatic bool DataTypeClampT(T* v, const T* v_min, const T* v_max)\n{\n    // Clamp, both sides are optional, return true if modified\n    if (v_min && *v < *v_min) { *v = *v_min; return true; }\n    if (v_max && *v > *v_max) { *v = *v_max; return true; }\n    return false;\n}\n\nbool ImGui::DataTypeClamp(ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max)\n{\n    switch (data_type)\n    {\n    case ImGuiDataType_S8:     return DataTypeClampT<ImS8  >((ImS8*  )p_data, (const ImS8*  )p_min, (const ImS8*  )p_max);\n    case ImGuiDataType_U8:     return DataTypeClampT<ImU8  >((ImU8*  )p_data, (const ImU8*  )p_min, (const ImU8*  )p_max);\n    case ImGuiDataType_S16:    return DataTypeClampT<ImS16 >((ImS16* )p_data, (const ImS16* )p_min, (const ImS16* )p_max);\n    case ImGuiDataType_U16:    return DataTypeClampT<ImU16 >((ImU16* )p_data, (const ImU16* )p_min, (const ImU16* )p_max);\n    case ImGuiDataType_S32:    return DataTypeClampT<ImS32 >((ImS32* )p_data, (const ImS32* )p_min, (const ImS32* )p_max);\n    case ImGuiDataType_U32:    return DataTypeClampT<ImU32 >((ImU32* )p_data, (const ImU32* )p_min, (const ImU32* )p_max);\n    case ImGuiDataType_S64:    return DataTypeClampT<ImS64 >((ImS64* )p_data, (const ImS64* )p_min, (const ImS64* )p_max);\n    case ImGuiDataType_U64:    return DataTypeClampT<ImU64 >((ImU64* )p_data, (const ImU64* )p_min, (const ImU64* )p_max);\n    case ImGuiDataType_Float:  return DataTypeClampT<float >((float* )p_data, (const float* )p_min, (const float* )p_max);\n    case ImGuiDataType_Double: return DataTypeClampT<double>((double*)p_data, (const double*)p_min, (const double*)p_max);\n    case ImGuiDataType_COUNT:  break;\n    }\n    IM_ASSERT(0);\n    return false;\n}\n\nstatic float GetMinimumStepAtDecimalPrecision(int decimal_precision)\n{\n    static const float min_steps[10] = { 1.0f, 0.1f, 0.01f, 0.001f, 0.0001f, 0.00001f, 0.000001f, 0.0000001f, 0.00000001f, 0.000000001f };\n    if (decimal_precision < 0)\n        return FLT_MIN;\n    return (decimal_precision < IM_ARRAYSIZE(min_steps)) ? min_steps[decimal_precision] : ImPow(10.0f, (float)-decimal_precision);\n}\n\ntemplate<typename TYPE>\nstatic const char* ImAtoi(const char* src, TYPE* output)\n{\n    int negative = 0;\n    if (*src == '-') { negative = 1; src++; }\n    if (*src == '+') { src++; }\n    TYPE v = 0;\n    while (*src >= '0' && *src <= '9')\n        v = (v * 10) + (*src++ - '0');\n    *output = negative ? -v : v;\n    return src;\n}\n\n// Sanitize format\n// - Zero terminate so extra characters after format (e.g. \"%f123\") don't confuse atof/atoi\n// - stb_sprintf.h supports several new modifiers which format numbers in a way that also makes them incompatible atof/atoi.\nstatic void SanitizeFormatString(const char* fmt, char* fmt_out, size_t fmt_out_size)\n{\n    IM_UNUSED(fmt_out_size);\n    const char* fmt_end = ImParseFormatFindEnd(fmt);\n    IM_ASSERT((size_t)(fmt_end - fmt + 1) < fmt_out_size); // Format is too long, let us know if this happens to you!\n    while (fmt < fmt_end)\n    {\n        char c = *(fmt++);\n        if (c != '\\'' && c != '$' && c != '_') // Custom flags provided by stb_sprintf.h. POSIX 2008 also supports '.\n            *(fmt_out++) = c;\n    }\n    *fmt_out = 0; // Zero-terminate\n}\n\ntemplate<typename TYPE, typename SIGNEDTYPE>\nTYPE ImGui::RoundScalarWithFormatT(const char* format, ImGuiDataType data_type, TYPE v)\n{\n    const char* fmt_start = ImParseFormatFindStart(format);\n    if (fmt_start[0] != '%' || fmt_start[1] == '%') // Don't apply if the value is not visible in the format string\n        return v;\n\n    // Sanitize format\n    char fmt_sanitized[32];\n    SanitizeFormatString(fmt_start, fmt_sanitized, IM_ARRAYSIZE(fmt_sanitized));\n    fmt_start = fmt_sanitized;\n\n    // Format value with our rounding, and read back\n    char v_str[64];\n    ImFormatString(v_str, IM_ARRAYSIZE(v_str), fmt_start, v);\n    const char* p = v_str;\n    while (*p == ' ')\n        p++;\n    if (data_type == ImGuiDataType_Float || data_type == ImGuiDataType_Double)\n        v = (TYPE)ImAtof(p);\n    else\n        ImAtoi(p, (SIGNEDTYPE*)&v);\n    return v;\n}\n\n//-------------------------------------------------------------------------\n// [SECTION] Widgets: DragScalar, DragFloat, DragInt, etc.\n//-------------------------------------------------------------------------\n// - DragBehaviorT<>() [Internal]\n// - DragBehavior() [Internal]\n// - DragScalar()\n// - DragScalarN()\n// - DragFloat()\n// - DragFloat2()\n// - DragFloat3()\n// - DragFloat4()\n// - DragFloatRange2()\n// - DragInt()\n// - DragInt2()\n// - DragInt3()\n// - DragInt4()\n// - DragIntRange2()\n//-------------------------------------------------------------------------\n\n// This is called by DragBehavior() when the widget is active (held by mouse or being manipulated with Nav controls)\ntemplate<typename TYPE, typename SIGNEDTYPE, typename FLOATTYPE>\nbool ImGui::DragBehaviorT(ImGuiDataType data_type, TYPE* v, float v_speed, const TYPE v_min, const TYPE v_max, const char* format, ImGuiSliderFlags flags)\n{\n    ImGuiContext& g = *GImGui;\n    const ImGuiAxis axis = (flags & ImGuiSliderFlags_Vertical) ? ImGuiAxis_Y : ImGuiAxis_X;\n    const bool is_clamped = (v_min < v_max);\n    const bool is_logarithmic = (flags & ImGuiSliderFlags_Logarithmic) != 0;\n    const bool is_floating_point = (data_type == ImGuiDataType_Float) || (data_type == ImGuiDataType_Double);\n\n    // Default tweak speed\n    if (v_speed == 0.0f && is_clamped && (v_max - v_min < FLT_MAX))\n        v_speed = (float)((v_max - v_min) * g.DragSpeedDefaultRatio);\n\n    // Inputs accumulates into g.DragCurrentAccum, which is flushed into the current value as soon as it makes a difference with our precision settings\n    float adjust_delta = 0.0f;\n    if (g.ActiveIdSource == ImGuiInputSource_Mouse && IsMousePosValid() && IsMouseDragPastThreshold(0, g.IO.MouseDragThreshold * DRAG_MOUSE_THRESHOLD_FACTOR))\n    {\n        adjust_delta = g.IO.MouseDelta[axis];\n        if (g.IO.KeyAlt)\n            adjust_delta *= 1.0f / 100.0f;\n        if (g.IO.KeyShift)\n            adjust_delta *= 10.0f;\n    }\n    else if (g.ActiveIdSource == ImGuiInputSource_Nav)\n    {\n        const int decimal_precision = is_floating_point ? ImParseFormatPrecision(format, 3) : 0;\n        adjust_delta = GetNavInputAmount2d(ImGuiNavDirSourceFlags_Keyboard | ImGuiNavDirSourceFlags_PadDPad, ImGuiInputReadMode_RepeatFast, 1.0f / 10.0f, 10.0f)[axis];\n        v_speed = ImMax(v_speed, GetMinimumStepAtDecimalPrecision(decimal_precision));\n    }\n    adjust_delta *= v_speed;\n\n    // For vertical drag we currently assume that Up=higher value (like we do with vertical sliders). This may become a parameter.\n    if (axis == ImGuiAxis_Y)\n        adjust_delta = -adjust_delta;\n\n    // For logarithmic use our range is effectively 0..1 so scale the delta into that range\n    if (is_logarithmic && (v_max - v_min < FLT_MAX) && ((v_max - v_min) > 0.000001f)) // Epsilon to avoid /0\n        adjust_delta /= (float)(v_max - v_min);\n\n    // Clear current value on activation\n    // Avoid altering values and clamping when we are _already_ past the limits and heading in the same direction, so e.g. if range is 0..255, current value is 300 and we are pushing to the right side, keep the 300.\n    bool is_just_activated = g.ActiveIdIsJustActivated;\n    bool is_already_past_limits_and_pushing_outward = is_clamped && ((*v >= v_max && adjust_delta > 0.0f) || (*v <= v_min && adjust_delta < 0.0f));\n    if (is_just_activated || is_already_past_limits_and_pushing_outward)\n    {\n        g.DragCurrentAccum = 0.0f;\n        g.DragCurrentAccumDirty = false;\n    }\n    else if (adjust_delta != 0.0f)\n    {\n        g.DragCurrentAccum += adjust_delta;\n        g.DragCurrentAccumDirty = true;\n    }\n\n    if (!g.DragCurrentAccumDirty)\n        return false;\n\n    TYPE v_cur = *v;\n    FLOATTYPE v_old_ref_for_accum_remainder = (FLOATTYPE)0.0f;\n\n    float logarithmic_zero_epsilon = 0.0f; // Only valid when is_logarithmic is true\n    const float zero_deadzone_halfsize = 0.0f; // Drag widgets have no deadzone (as it doesn't make sense)\n    if (is_logarithmic)\n    {\n        // When using logarithmic sliders, we need to clamp to avoid hitting zero, but our choice of clamp value greatly affects slider precision. We attempt to use the specified precision to estimate a good lower bound.\n        const int decimal_precision = is_floating_point ? ImParseFormatPrecision(format, 3) : 1;\n        logarithmic_zero_epsilon = ImPow(0.1f, (float)decimal_precision);\n\n        // Convert to parametric space, apply delta, convert back\n        float v_old_parametric = ScaleRatioFromValueT<TYPE, SIGNEDTYPE, FLOATTYPE>(data_type, v_cur, v_min, v_max, is_logarithmic, logarithmic_zero_epsilon, zero_deadzone_halfsize);\n        float v_new_parametric = v_old_parametric + g.DragCurrentAccum;\n        v_cur = ScaleValueFromRatioT<TYPE, SIGNEDTYPE, FLOATTYPE>(data_type, v_new_parametric, v_min, v_max, is_logarithmic, logarithmic_zero_epsilon, zero_deadzone_halfsize);\n        v_old_ref_for_accum_remainder = v_old_parametric;\n    }\n    else\n    {\n        v_cur += (SIGNEDTYPE)g.DragCurrentAccum;\n    }\n\n    // Round to user desired precision based on format string\n    if (!(flags & ImGuiSliderFlags_NoRoundToFormat))\n        v_cur = RoundScalarWithFormatT<TYPE, SIGNEDTYPE>(format, data_type, v_cur);\n\n    // Preserve remainder after rounding has been applied. This also allow slow tweaking of values.\n    g.DragCurrentAccumDirty = false;\n    if (is_logarithmic)\n    {\n        // Convert to parametric space, apply delta, convert back\n        float v_new_parametric = ScaleRatioFromValueT<TYPE, SIGNEDTYPE, FLOATTYPE>(data_type, v_cur, v_min, v_max, is_logarithmic, logarithmic_zero_epsilon, zero_deadzone_halfsize);\n        g.DragCurrentAccum -= (float)(v_new_parametric - v_old_ref_for_accum_remainder);\n    }\n    else\n    {\n        g.DragCurrentAccum -= (float)((SIGNEDTYPE)v_cur - (SIGNEDTYPE)*v);\n    }\n\n    // Lose zero sign for float/double\n    if (v_cur == (TYPE)-0)\n        v_cur = (TYPE)0;\n\n    // Clamp values (+ handle overflow/wrap-around for integer types)\n    if (*v != v_cur && is_clamped)\n    {\n        if (v_cur < v_min || (v_cur > *v && adjust_delta < 0.0f && !is_floating_point))\n            v_cur = v_min;\n        if (v_cur > v_max || (v_cur < *v && adjust_delta > 0.0f && !is_floating_point))\n            v_cur = v_max;\n    }\n\n    // Apply result\n    if (*v == v_cur)\n        return false;\n    *v = v_cur;\n    return true;\n}\n\nbool ImGui::DragBehavior(ImGuiID id, ImGuiDataType data_type, void* p_v, float v_speed, const void* p_min, const void* p_max, const char* format, ImGuiSliderFlags flags)\n{\n    // Read imgui.cpp \"API BREAKING CHANGES\" section for 1.78 if you hit this assert.\n    IM_ASSERT((flags == 1 || (flags & ImGuiSliderFlags_InvalidMask_) == 0) && \"Invalid ImGuiSliderFlags flags! Has the 'float power' argument been mistakenly cast to flags? Call function with ImGuiSliderFlags_Logarithmic flags instead.\");\n\n    ImGuiContext& g = *GImGui;\n    if (g.ActiveId == id)\n    {\n        if (g.ActiveIdSource == ImGuiInputSource_Mouse && !g.IO.MouseDown[0])\n            ClearActiveID();\n        else if (g.ActiveIdSource == ImGuiInputSource_Nav && g.NavActivatePressedId == id && !g.ActiveIdIsJustActivated)\n            ClearActiveID();\n    }\n    if (g.ActiveId != id)\n        return false;\n    if ((g.LastItemData.InFlags & ImGuiItemFlags_ReadOnly) || (flags & ImGuiSliderFlags_ReadOnly))\n        return false;\n\n    switch (data_type)\n    {\n    case ImGuiDataType_S8:     { ImS32 v32 = (ImS32)*(ImS8*)p_v;  bool r = DragBehaviorT<ImS32, ImS32, float>(ImGuiDataType_S32, &v32, v_speed, p_min ? *(const ImS8*) p_min : IM_S8_MIN,  p_max ? *(const ImS8*)p_max  : IM_S8_MAX,  format, flags); if (r) *(ImS8*)p_v = (ImS8)v32; return r; }\n    case ImGuiDataType_U8:     { ImU32 v32 = (ImU32)*(ImU8*)p_v;  bool r = DragBehaviorT<ImU32, ImS32, float>(ImGuiDataType_U32, &v32, v_speed, p_min ? *(const ImU8*) p_min : IM_U8_MIN,  p_max ? *(const ImU8*)p_max  : IM_U8_MAX,  format, flags); if (r) *(ImU8*)p_v = (ImU8)v32; return r; }\n    case ImGuiDataType_S16:    { ImS32 v32 = (ImS32)*(ImS16*)p_v; bool r = DragBehaviorT<ImS32, ImS32, float>(ImGuiDataType_S32, &v32, v_speed, p_min ? *(const ImS16*)p_min : IM_S16_MIN, p_max ? *(const ImS16*)p_max : IM_S16_MAX, format, flags); if (r) *(ImS16*)p_v = (ImS16)v32; return r; }\n    case ImGuiDataType_U16:    { ImU32 v32 = (ImU32)*(ImU16*)p_v; bool r = DragBehaviorT<ImU32, ImS32, float>(ImGuiDataType_U32, &v32, v_speed, p_min ? *(const ImU16*)p_min : IM_U16_MIN, p_max ? *(const ImU16*)p_max : IM_U16_MAX, format, flags); if (r) *(ImU16*)p_v = (ImU16)v32; return r; }\n    case ImGuiDataType_S32:    return DragBehaviorT<ImS32, ImS32, float >(data_type, (ImS32*)p_v,  v_speed, p_min ? *(const ImS32* )p_min : IM_S32_MIN, p_max ? *(const ImS32* )p_max : IM_S32_MAX, format, flags);\n    case ImGuiDataType_U32:    return DragBehaviorT<ImU32, ImS32, float >(data_type, (ImU32*)p_v,  v_speed, p_min ? *(const ImU32* )p_min : IM_U32_MIN, p_max ? *(const ImU32* )p_max : IM_U32_MAX, format, flags);\n    case ImGuiDataType_S64:    return DragBehaviorT<ImS64, ImS64, double>(data_type, (ImS64*)p_v,  v_speed, p_min ? *(const ImS64* )p_min : IM_S64_MIN, p_max ? *(const ImS64* )p_max : IM_S64_MAX, format, flags);\n    case ImGuiDataType_U64:    return DragBehaviorT<ImU64, ImS64, double>(data_type, (ImU64*)p_v,  v_speed, p_min ? *(const ImU64* )p_min : IM_U64_MIN, p_max ? *(const ImU64* )p_max : IM_U64_MAX, format, flags);\n    case ImGuiDataType_Float:  return DragBehaviorT<float, float, float >(data_type, (float*)p_v,  v_speed, p_min ? *(const float* )p_min : -FLT_MAX,   p_max ? *(const float* )p_max : FLT_MAX,    format, flags);\n    case ImGuiDataType_Double: return DragBehaviorT<double,double,double>(data_type, (double*)p_v, v_speed, p_min ? *(const double*)p_min : -DBL_MAX,   p_max ? *(const double*)p_max : DBL_MAX,    format, flags);\n    case ImGuiDataType_COUNT:  break;\n    }\n    IM_ASSERT(0);\n    return false;\n}\n\n// Note: p_data, p_min and p_max are _pointers_ to a memory address holding the data. For a Drag widget, p_min and p_max are optional.\n// Read code of e.g. DragFloat(), DragInt() etc. or examples in 'Demo->Widgets->Data Types' to understand how to use this function directly.\nbool ImGui::DragScalar(const char* label, ImGuiDataType data_type, void* p_data, float v_speed, const void* p_min, const void* p_max, const char* format, ImGuiSliderFlags flags)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return false;\n\n    ImGuiContext& g = *GImGui;\n    const ImGuiStyle& style = g.Style;\n    const ImGuiID id = window->GetID(label);\n    const float w = CalcItemWidth();\n\n    const ImVec2 label_size = CalcTextSize(label, NULL, true);\n    const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y * 2.0f));\n    const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));\n\n    const bool temp_input_allowed = (flags & ImGuiSliderFlags_NoInput) == 0;\n    ItemSize(total_bb, style.FramePadding.y);\n    if (!ItemAdd(total_bb, id, &frame_bb, temp_input_allowed ? ImGuiItemAddFlags_Focusable : 0))\n        return false;\n\n    // Default format string when passing NULL\n    if (format == NULL)\n        format = DataTypeGetInfo(data_type)->PrintFmt;\n    else if (data_type == ImGuiDataType_S32 && strcmp(format, \"%d\") != 0) // (FIXME-LEGACY: Patch old \"%.0f\" format string to use \"%d\", read function more details.)\n        format = PatchFormatStringFloatToInt(format);\n\n    // Tabbing or CTRL-clicking on Drag turns it into an InputText\n    const bool hovered = ItemHoverable(frame_bb, id);\n    bool temp_input_is_active = temp_input_allowed && TempInputIsActive(id);\n    if (!temp_input_is_active)\n    {\n        const bool focus_requested = temp_input_allowed && (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_Focused) != 0;\n        const bool clicked = (hovered && g.IO.MouseClicked[0]);\n        const bool double_clicked = (hovered && g.IO.MouseDoubleClicked[0]);\n        if (focus_requested || clicked || double_clicked || g.NavActivateId == id || g.NavInputId == id)\n        {\n            SetActiveID(id, window);\n            SetFocusID(id, window);\n            FocusWindow(window);\n            g.ActiveIdUsingNavDirMask = (1 << ImGuiDir_Left) | (1 << ImGuiDir_Right);\n            if (temp_input_allowed && (focus_requested || (clicked && g.IO.KeyCtrl) || double_clicked || g.NavInputId == id))\n                temp_input_is_active = true;\n        }\n        // Experimental: simple click (without moving) turns Drag into an InputText\n        // FIXME: Currently polling ImGuiConfigFlags_IsTouchScreen, may either poll an hypothetical ImGuiBackendFlags_HasKeyboard and/or an explicit drag settings.\n        if (g.IO.ConfigDragClickToInputText && temp_input_allowed && !temp_input_is_active)\n            if (g.ActiveId == id && hovered && g.IO.MouseReleased[0] && !IsMouseDragPastThreshold(0, g.IO.MouseDragThreshold * DRAG_MOUSE_THRESHOLD_FACTOR))\n            {\n                g.NavInputId = id;\n                temp_input_is_active = true;\n            }\n    }\n\n    if (temp_input_is_active)\n    {\n        // Only clamp CTRL+Click input when ImGuiSliderFlags_AlwaysClamp is set\n        const bool is_clamp_input = (flags & ImGuiSliderFlags_AlwaysClamp) != 0 && (p_min == NULL || p_max == NULL || DataTypeCompare(data_type, p_min, p_max) < 0);\n        return TempInputScalar(frame_bb, id, label, data_type, p_data, format, is_clamp_input ? p_min : NULL, is_clamp_input ? p_max : NULL);\n    }\n\n    // Draw frame\n    const ImU32 frame_col = GetColorU32(g.ActiveId == id ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg);\n    RenderNavHighlight(frame_bb, id);\n    RenderFrame(frame_bb.Min, frame_bb.Max, frame_col, true, style.FrameRounding);\n\n    // Drag behavior\n    const bool value_changed = DragBehavior(id, data_type, p_data, v_speed, p_min, p_max, format, flags);\n    if (value_changed)\n        MarkItemEdited(id);\n\n    // Display value using user-provided display format so user can add prefix/suffix/decorations to the value.\n    char value_buf[64];\n    const char* value_buf_end = value_buf + DataTypeFormatString(value_buf, IM_ARRAYSIZE(value_buf), data_type, p_data, format);\n    if (g.LogEnabled)\n        LogSetNextTextDecoration(\"{\", \"}\");\n    RenderTextClipped(frame_bb.Min, frame_bb.Max, value_buf, value_buf_end, NULL, ImVec2(0.5f, 0.5f));\n\n    if (label_size.x > 0.0f)\n        RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);\n\n    IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags);\n    return value_changed;\n}\n\nbool ImGui::DragScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, float v_speed, const void* p_min, const void* p_max, const char* format, ImGuiSliderFlags flags)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return false;\n\n    ImGuiContext& g = *GImGui;\n    bool value_changed = false;\n    BeginGroup();\n    PushID(label);\n    PushMultiItemsWidths(components, CalcItemWidth());\n    size_t type_size = GDataTypeInfo[data_type].Size;\n    for (int i = 0; i < components; i++)\n    {\n        PushID(i);\n        if (i > 0)\n            SameLine(0, g.Style.ItemInnerSpacing.x);\n        value_changed |= DragScalar(\"\", data_type, p_data, v_speed, p_min, p_max, format, flags);\n        PopID();\n        PopItemWidth();\n        p_data = (void*)((char*)p_data + type_size);\n    }\n    PopID();\n\n    const char* label_end = FindRenderedTextEnd(label);\n    if (label != label_end)\n    {\n        SameLine(0, g.Style.ItemInnerSpacing.x);\n        TextEx(label, label_end);\n    }\n\n    EndGroup();\n    return value_changed;\n}\n\nbool ImGui::DragFloat(const char* label, float* v, float v_speed, float v_min, float v_max, const char* format, ImGuiSliderFlags flags)\n{\n    return DragScalar(label, ImGuiDataType_Float, v, v_speed, &v_min, &v_max, format, flags);\n}\n\nbool ImGui::DragFloat2(const char* label, float v[2], float v_speed, float v_min, float v_max, const char* format, ImGuiSliderFlags flags)\n{\n    return DragScalarN(label, ImGuiDataType_Float, v, 2, v_speed, &v_min, &v_max, format, flags);\n}\n\nbool ImGui::DragFloat3(const char* label, float v[3], float v_speed, float v_min, float v_max, const char* format, ImGuiSliderFlags flags)\n{\n    return DragScalarN(label, ImGuiDataType_Float, v, 3, v_speed, &v_min, &v_max, format, flags);\n}\n\nbool ImGui::DragFloat4(const char* label, float v[4], float v_speed, float v_min, float v_max, const char* format, ImGuiSliderFlags flags)\n{\n    return DragScalarN(label, ImGuiDataType_Float, v, 4, v_speed, &v_min, &v_max, format, flags);\n}\n\n// NB: You likely want to specify the ImGuiSliderFlags_AlwaysClamp when using this.\nbool ImGui::DragFloatRange2(const char* label, float* v_current_min, float* v_current_max, float v_speed, float v_min, float v_max, const char* format, const char* format_max, ImGuiSliderFlags flags)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return false;\n\n    ImGuiContext& g = *GImGui;\n    PushID(label);\n    BeginGroup();\n    PushMultiItemsWidths(2, CalcItemWidth());\n\n    float min_min = (v_min >= v_max) ? -FLT_MAX : v_min;\n    float min_max = (v_min >= v_max) ? *v_current_max : ImMin(v_max, *v_current_max);\n    ImGuiSliderFlags min_flags = flags | ((min_min == min_max) ? ImGuiSliderFlags_ReadOnly : 0);\n    bool value_changed = DragScalar(\"##min\", ImGuiDataType_Float, v_current_min, v_speed, &min_min, &min_max, format, min_flags);\n    PopItemWidth();\n    SameLine(0, g.Style.ItemInnerSpacing.x);\n\n    float max_min = (v_min >= v_max) ? *v_current_min : ImMax(v_min, *v_current_min);\n    float max_max = (v_min >= v_max) ? FLT_MAX : v_max;\n    ImGuiSliderFlags max_flags = flags | ((max_min == max_max) ? ImGuiSliderFlags_ReadOnly : 0);\n    value_changed |= DragScalar(\"##max\", ImGuiDataType_Float, v_current_max, v_speed, &max_min, &max_max, format_max ? format_max : format, max_flags);\n    PopItemWidth();\n    SameLine(0, g.Style.ItemInnerSpacing.x);\n\n    TextEx(label, FindRenderedTextEnd(label));\n    EndGroup();\n    PopID();\n\n    return value_changed;\n}\n\n// NB: v_speed is float to allow adjusting the drag speed with more precision\nbool ImGui::DragInt(const char* label, int* v, float v_speed, int v_min, int v_max, const char* format, ImGuiSliderFlags flags)\n{\n    return DragScalar(label, ImGuiDataType_S32, v, v_speed, &v_min, &v_max, format, flags);\n}\n\nbool ImGui::DragInt2(const char* label, int v[2], float v_speed, int v_min, int v_max, const char* format, ImGuiSliderFlags flags)\n{\n    return DragScalarN(label, ImGuiDataType_S32, v, 2, v_speed, &v_min, &v_max, format, flags);\n}\n\nbool ImGui::DragInt3(const char* label, int v[3], float v_speed, int v_min, int v_max, const char* format, ImGuiSliderFlags flags)\n{\n    return DragScalarN(label, ImGuiDataType_S32, v, 3, v_speed, &v_min, &v_max, format, flags);\n}\n\nbool ImGui::DragInt4(const char* label, int v[4], float v_speed, int v_min, int v_max, const char* format, ImGuiSliderFlags flags)\n{\n    return DragScalarN(label, ImGuiDataType_S32, v, 4, v_speed, &v_min, &v_max, format, flags);\n}\n\n// NB: You likely want to specify the ImGuiSliderFlags_AlwaysClamp when using this.\nbool ImGui::DragIntRange2(const char* label, int* v_current_min, int* v_current_max, float v_speed, int v_min, int v_max, const char* format, const char* format_max, ImGuiSliderFlags flags)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return false;\n\n    ImGuiContext& g = *GImGui;\n    PushID(label);\n    BeginGroup();\n    PushMultiItemsWidths(2, CalcItemWidth());\n\n    int min_min = (v_min >= v_max) ? INT_MIN : v_min;\n    int min_max = (v_min >= v_max) ? *v_current_max : ImMin(v_max, *v_current_max);\n    ImGuiSliderFlags min_flags = flags | ((min_min == min_max) ? ImGuiSliderFlags_ReadOnly : 0);\n    bool value_changed = DragInt(\"##min\", v_current_min, v_speed, min_min, min_max, format, min_flags);\n    PopItemWidth();\n    SameLine(0, g.Style.ItemInnerSpacing.x);\n\n    int max_min = (v_min >= v_max) ? *v_current_min : ImMax(v_min, *v_current_min);\n    int max_max = (v_min >= v_max) ? INT_MAX : v_max;\n    ImGuiSliderFlags max_flags = flags | ((max_min == max_max) ? ImGuiSliderFlags_ReadOnly : 0);\n    value_changed |= DragInt(\"##max\", v_current_max, v_speed, max_min, max_max, format_max ? format_max : format, max_flags);\n    PopItemWidth();\n    SameLine(0, g.Style.ItemInnerSpacing.x);\n\n    TextEx(label, FindRenderedTextEnd(label));\n    EndGroup();\n    PopID();\n\n    return value_changed;\n}\n\n#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS\n\n// Obsolete versions with power parameter. See https://github.com/ocornut/imgui/issues/3361 for details.\nbool ImGui::DragScalar(const char* label, ImGuiDataType data_type, void* p_data, float v_speed, const void* p_min, const void* p_max, const char* format, float power)\n{\n    ImGuiSliderFlags drag_flags = ImGuiSliderFlags_None;\n    if (power != 1.0f)\n    {\n        IM_ASSERT(power == 1.0f && \"Call function with ImGuiSliderFlags_Logarithmic flags instead of using the old 'float power' function!\");\n        IM_ASSERT(p_min != NULL && p_max != NULL);  // When using a power curve the drag needs to have known bounds\n        drag_flags |= ImGuiSliderFlags_Logarithmic;   // Fallback for non-asserting paths\n    }\n    return DragScalar(label, data_type, p_data, v_speed, p_min, p_max, format, drag_flags);\n}\n\nbool ImGui::DragScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, float v_speed, const void* p_min, const void* p_max, const char* format, float power)\n{\n    ImGuiSliderFlags drag_flags = ImGuiSliderFlags_None;\n    if (power != 1.0f)\n    {\n        IM_ASSERT(power == 1.0f && \"Call function with ImGuiSliderFlags_Logarithmic flags instead of using the old 'float power' function!\");\n        IM_ASSERT(p_min != NULL && p_max != NULL);  // When using a power curve the drag needs to have known bounds\n        drag_flags |= ImGuiSliderFlags_Logarithmic;   // Fallback for non-asserting paths\n    }\n    return DragScalarN(label, data_type, p_data, components, v_speed, p_min, p_max, format, drag_flags);\n}\n\n#endif // IMGUI_DISABLE_OBSOLETE_FUNCTIONS\n\n//-------------------------------------------------------------------------\n// [SECTION] Widgets: SliderScalar, SliderFloat, SliderInt, etc.\n//-------------------------------------------------------------------------\n// - ScaleRatioFromValueT<> [Internal]\n// - ScaleValueFromRatioT<> [Internal]\n// - SliderBehaviorT<>() [Internal]\n// - SliderBehavior() [Internal]\n// - SliderScalar()\n// - SliderScalarN()\n// - SliderFloat()\n// - SliderFloat2()\n// - SliderFloat3()\n// - SliderFloat4()\n// - SliderAngle()\n// - SliderInt()\n// - SliderInt2()\n// - SliderInt3()\n// - SliderInt4()\n// - VSliderScalar()\n// - VSliderFloat()\n// - VSliderInt()\n//-------------------------------------------------------------------------\n\n// Convert a value v in the output space of a slider into a parametric position on the slider itself (the logical opposite of ScaleValueFromRatioT)\ntemplate<typename TYPE, typename SIGNEDTYPE, typename FLOATTYPE>\nfloat ImGui::ScaleRatioFromValueT(ImGuiDataType data_type, TYPE v, TYPE v_min, TYPE v_max, bool is_logarithmic, float logarithmic_zero_epsilon, float zero_deadzone_halfsize)\n{\n    if (v_min == v_max)\n        return 0.0f;\n    IM_UNUSED(data_type);\n\n    const TYPE v_clamped = (v_min < v_max) ? ImClamp(v, v_min, v_max) : ImClamp(v, v_max, v_min);\n    if (is_logarithmic)\n    {\n        bool flipped = v_max < v_min;\n\n        if (flipped) // Handle the case where the range is backwards\n            ImSwap(v_min, v_max);\n\n        // Fudge min/max to avoid getting close to log(0)\n        FLOATTYPE v_min_fudged = (ImAbs((FLOATTYPE)v_min) < logarithmic_zero_epsilon) ? ((v_min < 0.0f) ? -logarithmic_zero_epsilon : logarithmic_zero_epsilon) : (FLOATTYPE)v_min;\n        FLOATTYPE v_max_fudged = (ImAbs((FLOATTYPE)v_max) < logarithmic_zero_epsilon) ? ((v_max < 0.0f) ? -logarithmic_zero_epsilon : logarithmic_zero_epsilon) : (FLOATTYPE)v_max;\n\n        // Awkward special cases - we need ranges of the form (-100 .. 0) to convert to (-100 .. -epsilon), not (-100 .. epsilon)\n        if ((v_min == 0.0f) && (v_max < 0.0f))\n            v_min_fudged = -logarithmic_zero_epsilon;\n        else if ((v_max == 0.0f) && (v_min < 0.0f))\n            v_max_fudged = -logarithmic_zero_epsilon;\n\n        float result;\n\n        if (v_clamped <= v_min_fudged)\n            result = 0.0f; // Workaround for values that are in-range but below our fudge\n        else if (v_clamped >= v_max_fudged)\n            result = 1.0f; // Workaround for values that are in-range but above our fudge\n        else if ((v_min * v_max) < 0.0f) // Range crosses zero, so split into two portions\n        {\n            float zero_point_center = (-(float)v_min) / ((float)v_max - (float)v_min); // The zero point in parametric space.  There's an argument we should take the logarithmic nature into account when calculating this, but for now this should do (and the most common case of a symmetrical range works fine)\n            float zero_point_snap_L = zero_point_center - zero_deadzone_halfsize;\n            float zero_point_snap_R = zero_point_center + zero_deadzone_halfsize;\n            if (v == 0.0f)\n                result = zero_point_center; // Special case for exactly zero\n            else if (v < 0.0f)\n                result = (1.0f - (float)(ImLog(-(FLOATTYPE)v_clamped / logarithmic_zero_epsilon) / ImLog(-v_min_fudged / logarithmic_zero_epsilon))) * zero_point_snap_L;\n            else\n                result = zero_point_snap_R + ((float)(ImLog((FLOATTYPE)v_clamped / logarithmic_zero_epsilon) / ImLog(v_max_fudged / logarithmic_zero_epsilon)) * (1.0f - zero_point_snap_R));\n        }\n        else if ((v_min < 0.0f) || (v_max < 0.0f)) // Entirely negative slider\n            result = 1.0f - (float)(ImLog(-(FLOATTYPE)v_clamped / -v_max_fudged) / ImLog(-v_min_fudged / -v_max_fudged));\n        else\n            result = (float)(ImLog((FLOATTYPE)v_clamped / v_min_fudged) / ImLog(v_max_fudged / v_min_fudged));\n\n        return flipped ? (1.0f - result) : result;\n    }\n\n    // Linear slider\n    return (float)((FLOATTYPE)(SIGNEDTYPE)(v_clamped - v_min) / (FLOATTYPE)(SIGNEDTYPE)(v_max - v_min));\n}\n\n// Convert a parametric position on a slider into a value v in the output space (the logical opposite of ScaleRatioFromValueT)\ntemplate<typename TYPE, typename SIGNEDTYPE, typename FLOATTYPE>\nTYPE ImGui::ScaleValueFromRatioT(ImGuiDataType data_type, float t, TYPE v_min, TYPE v_max, bool is_logarithmic, float logarithmic_zero_epsilon, float zero_deadzone_halfsize)\n{\n    if (v_min == v_max)\n        return v_min;\n    const bool is_floating_point = (data_type == ImGuiDataType_Float) || (data_type == ImGuiDataType_Double);\n\n    TYPE result;\n    if (is_logarithmic)\n    {\n        // We special-case the extents because otherwise our fudging can lead to \"mathematically correct\" but non-intuitive behaviors like a fully-left slider not actually reaching the minimum value\n        if (t <= 0.0f)\n            result = v_min;\n        else if (t >= 1.0f)\n            result = v_max;\n        else\n        {\n            bool flipped = v_max < v_min; // Check if range is \"backwards\"\n\n            // Fudge min/max to avoid getting silly results close to zero\n            FLOATTYPE v_min_fudged = (ImAbs((FLOATTYPE)v_min) < logarithmic_zero_epsilon) ? ((v_min < 0.0f) ? -logarithmic_zero_epsilon : logarithmic_zero_epsilon) : (FLOATTYPE)v_min;\n            FLOATTYPE v_max_fudged = (ImAbs((FLOATTYPE)v_max) < logarithmic_zero_epsilon) ? ((v_max < 0.0f) ? -logarithmic_zero_epsilon : logarithmic_zero_epsilon) : (FLOATTYPE)v_max;\n\n            if (flipped)\n                ImSwap(v_min_fudged, v_max_fudged);\n\n            // Awkward special case - we need ranges of the form (-100 .. 0) to convert to (-100 .. -epsilon), not (-100 .. epsilon)\n            if ((v_max == 0.0f) && (v_min < 0.0f))\n                v_max_fudged = -logarithmic_zero_epsilon;\n\n            float t_with_flip = flipped ? (1.0f - t) : t; // t, but flipped if necessary to account for us flipping the range\n\n            if ((v_min * v_max) < 0.0f) // Range crosses zero, so we have to do this in two parts\n            {\n                float zero_point_center = (-(float)ImMin(v_min, v_max)) / ImAbs((float)v_max - (float)v_min); // The zero point in parametric space\n                float zero_point_snap_L = zero_point_center - zero_deadzone_halfsize;\n                float zero_point_snap_R = zero_point_center + zero_deadzone_halfsize;\n                if (t_with_flip >= zero_point_snap_L && t_with_flip <= zero_point_snap_R)\n                    result = (TYPE)0.0f; // Special case to make getting exactly zero possible (the epsilon prevents it otherwise)\n                else if (t_with_flip < zero_point_center)\n                    result = (TYPE)-(logarithmic_zero_epsilon * ImPow(-v_min_fudged / logarithmic_zero_epsilon, (FLOATTYPE)(1.0f - (t_with_flip / zero_point_snap_L))));\n                else\n                    result = (TYPE)(logarithmic_zero_epsilon * ImPow(v_max_fudged / logarithmic_zero_epsilon, (FLOATTYPE)((t_with_flip - zero_point_snap_R) / (1.0f - zero_point_snap_R))));\n            }\n            else if ((v_min < 0.0f) || (v_max < 0.0f)) // Entirely negative slider\n                result = (TYPE)-(-v_max_fudged * ImPow(-v_min_fudged / -v_max_fudged, (FLOATTYPE)(1.0f - t_with_flip)));\n            else\n                result = (TYPE)(v_min_fudged * ImPow(v_max_fudged / v_min_fudged, (FLOATTYPE)t_with_flip));\n        }\n    }\n    else\n    {\n        // Linear slider\n        if (is_floating_point)\n        {\n            result = ImLerp(v_min, v_max, t);\n        }\n        else\n        {\n            // - For integer values we want the clicking position to match the grab box so we round above\n            //   This code is carefully tuned to work with large values (e.g. high ranges of U64) while preserving this property..\n            // - Not doing a *1.0 multiply at the end of a range as it tends to be lossy. While absolute aiming at a large s64/u64\n            //   range is going to be imprecise anyway, with this check we at least make the edge values matches expected limits.\n            if (t < 1.0)\n            {\n                FLOATTYPE v_new_off_f = (SIGNEDTYPE)(v_max - v_min) * t;\n                result = (TYPE)((SIGNEDTYPE)v_min + (SIGNEDTYPE)(v_new_off_f + (FLOATTYPE)(v_min > v_max ? -0.5 : 0.5)));\n            }\n            else\n            {\n                result = v_max;\n            }\n        }\n    }\n\n    return result;\n}\n\n// FIXME: Move more of the code into SliderBehavior()\ntemplate<typename TYPE, typename SIGNEDTYPE, typename FLOATTYPE>\nbool ImGui::SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_type, TYPE* v, const TYPE v_min, const TYPE v_max, const char* format, ImGuiSliderFlags flags, ImRect* out_grab_bb)\n{\n    ImGuiContext& g = *GImGui;\n    const ImGuiStyle& style = g.Style;\n\n    const ImGuiAxis axis = (flags & ImGuiSliderFlags_Vertical) ? ImGuiAxis_Y : ImGuiAxis_X;\n    const bool is_logarithmic = (flags & ImGuiSliderFlags_Logarithmic) != 0;\n    const bool is_floating_point = (data_type == ImGuiDataType_Float) || (data_type == ImGuiDataType_Double);\n\n    const float grab_padding = 2.0f;\n    const float slider_sz = (bb.Max[axis] - bb.Min[axis]) - grab_padding * 2.0f;\n    float grab_sz = style.GrabMinSize;\n    SIGNEDTYPE v_range = (v_min < v_max ? v_max - v_min : v_min - v_max);\n    if (!is_floating_point && v_range >= 0)                                             // v_range < 0 may happen on integer overflows\n        grab_sz = ImMax((float)(slider_sz / (v_range + 1)), style.GrabMinSize);  // For integer sliders: if possible have the grab size represent 1 unit\n    grab_sz = ImMin(grab_sz, slider_sz);\n    const float slider_usable_sz = slider_sz - grab_sz;\n    const float slider_usable_pos_min = bb.Min[axis] + grab_padding + grab_sz * 0.5f;\n    const float slider_usable_pos_max = bb.Max[axis] - grab_padding - grab_sz * 0.5f;\n\n    float logarithmic_zero_epsilon = 0.0f; // Only valid when is_logarithmic is true\n    float zero_deadzone_halfsize = 0.0f; // Only valid when is_logarithmic is true\n    if (is_logarithmic)\n    {\n        // When using logarithmic sliders, we need to clamp to avoid hitting zero, but our choice of clamp value greatly affects slider precision. We attempt to use the specified precision to estimate a good lower bound.\n        const int decimal_precision = is_floating_point ? ImParseFormatPrecision(format, 3) : 1;\n        logarithmic_zero_epsilon = ImPow(0.1f, (float)decimal_precision);\n        zero_deadzone_halfsize = (style.LogSliderDeadzone * 0.5f) / ImMax(slider_usable_sz, 1.0f);\n    }\n\n    // Process interacting with the slider\n    bool value_changed = false;\n    if (g.ActiveId == id)\n    {\n        bool set_new_value = false;\n        float clicked_t = 0.0f;\n        if (g.ActiveIdSource == ImGuiInputSource_Mouse)\n        {\n            if (!g.IO.MouseDown[0])\n            {\n                ClearActiveID();\n            }\n            else\n            {\n                const float mouse_abs_pos = g.IO.MousePos[axis];\n                clicked_t = (slider_usable_sz > 0.0f) ? ImClamp((mouse_abs_pos - slider_usable_pos_min) / slider_usable_sz, 0.0f, 1.0f) : 0.0f;\n                if (axis == ImGuiAxis_Y)\n                    clicked_t = 1.0f - clicked_t;\n                set_new_value = true;\n            }\n        }\n        else if (g.ActiveIdSource == ImGuiInputSource_Nav)\n        {\n            if (g.ActiveIdIsJustActivated)\n            {\n                g.SliderCurrentAccum = 0.0f; // Reset any stored nav delta upon activation\n                g.SliderCurrentAccumDirty = false;\n            }\n\n            const ImVec2 input_delta2 = GetNavInputAmount2d(ImGuiNavDirSourceFlags_Keyboard | ImGuiNavDirSourceFlags_PadDPad, ImGuiInputReadMode_RepeatFast, 0.0f, 0.0f);\n            float input_delta = (axis == ImGuiAxis_X) ? input_delta2.x : -input_delta2.y;\n            if (input_delta != 0.0f)\n            {\n                const int decimal_precision = is_floating_point ? ImParseFormatPrecision(format, 3) : 0;\n                if (decimal_precision > 0)\n                {\n                    input_delta /= 100.0f;    // Gamepad/keyboard tweak speeds in % of slider bounds\n                    if (IsNavInputDown(ImGuiNavInput_TweakSlow))\n                        input_delta /= 10.0f;\n                }\n                else\n                {\n                    if ((v_range >= -100.0f && v_range <= 100.0f) || IsNavInputDown(ImGuiNavInput_TweakSlow))\n                        input_delta = ((input_delta < 0.0f) ? -1.0f : +1.0f) / (float)v_range; // Gamepad/keyboard tweak speeds in integer steps\n                    else\n                        input_delta /= 100.0f;\n                }\n                if (IsNavInputDown(ImGuiNavInput_TweakFast))\n                    input_delta *= 10.0f;\n\n                g.SliderCurrentAccum += input_delta;\n                g.SliderCurrentAccumDirty = true;\n            }\n\n            float delta = g.SliderCurrentAccum;\n            if (g.NavActivatePressedId == id && !g.ActiveIdIsJustActivated)\n            {\n                ClearActiveID();\n            }\n            else if (g.SliderCurrentAccumDirty)\n            {\n                clicked_t = ScaleRatioFromValueT<TYPE, SIGNEDTYPE, FLOATTYPE>(data_type, *v, v_min, v_max, is_logarithmic, logarithmic_zero_epsilon, zero_deadzone_halfsize);\n\n                if ((clicked_t >= 1.0f && delta > 0.0f) || (clicked_t <= 0.0f && delta < 0.0f)) // This is to avoid applying the saturation when already past the limits\n                {\n                    set_new_value = false;\n                    g.SliderCurrentAccum = 0.0f; // If pushing up against the limits, don't continue to accumulate\n                }\n                else\n                {\n                    set_new_value = true;\n                    float old_clicked_t = clicked_t;\n                    clicked_t = ImSaturate(clicked_t + delta);\n\n                    // Calculate what our \"new\" clicked_t will be, and thus how far we actually moved the slider, and subtract this from the accumulator\n                    TYPE v_new = ScaleValueFromRatioT<TYPE, SIGNEDTYPE, FLOATTYPE>(data_type, clicked_t, v_min, v_max, is_logarithmic, logarithmic_zero_epsilon, zero_deadzone_halfsize);\n                    if (!(flags & ImGuiSliderFlags_NoRoundToFormat))\n                        v_new = RoundScalarWithFormatT<TYPE, SIGNEDTYPE>(format, data_type, v_new);\n                    float new_clicked_t = ScaleRatioFromValueT<TYPE, SIGNEDTYPE, FLOATTYPE>(data_type, v_new, v_min, v_max, is_logarithmic, logarithmic_zero_epsilon, zero_deadzone_halfsize);\n\n                    if (delta > 0)\n                        g.SliderCurrentAccum -= ImMin(new_clicked_t - old_clicked_t, delta);\n                    else\n                        g.SliderCurrentAccum -= ImMax(new_clicked_t - old_clicked_t, delta);\n                }\n\n                g.SliderCurrentAccumDirty = false;\n            }\n        }\n\n        if (set_new_value)\n        {\n            TYPE v_new = ScaleValueFromRatioT<TYPE, SIGNEDTYPE, FLOATTYPE>(data_type, clicked_t, v_min, v_max, is_logarithmic, logarithmic_zero_epsilon, zero_deadzone_halfsize);\n\n            // Round to user desired precision based on format string\n            if (!(flags & ImGuiSliderFlags_NoRoundToFormat))\n                v_new = RoundScalarWithFormatT<TYPE, SIGNEDTYPE>(format, data_type, v_new);\n\n            // Apply result\n            if (*v != v_new)\n            {\n                *v = v_new;\n                value_changed = true;\n            }\n        }\n    }\n\n    if (slider_sz < 1.0f)\n    {\n        *out_grab_bb = ImRect(bb.Min, bb.Min);\n    }\n    else\n    {\n        // Output grab position so it can be displayed by the caller\n        float grab_t = ScaleRatioFromValueT<TYPE, SIGNEDTYPE, FLOATTYPE>(data_type, *v, v_min, v_max, is_logarithmic, logarithmic_zero_epsilon, zero_deadzone_halfsize);\n        if (axis == ImGuiAxis_Y)\n            grab_t = 1.0f - grab_t;\n        const float grab_pos = ImLerp(slider_usable_pos_min, slider_usable_pos_max, grab_t);\n        if (axis == ImGuiAxis_X)\n            *out_grab_bb = ImRect(grab_pos - grab_sz * 0.5f, bb.Min.y + grab_padding, grab_pos + grab_sz * 0.5f, bb.Max.y - grab_padding);\n        else\n            *out_grab_bb = ImRect(bb.Min.x + grab_padding, grab_pos - grab_sz * 0.5f, bb.Max.x - grab_padding, grab_pos + grab_sz * 0.5f);\n    }\n\n    return value_changed;\n}\n\n// For 32-bit and larger types, slider bounds are limited to half the natural type range.\n// So e.g. an integer Slider between INT_MAX-10 and INT_MAX will fail, but an integer Slider between INT_MAX/2-10 and INT_MAX/2 will be ok.\n// It would be possible to lift that limitation with some work but it doesn't seem to be worth it for sliders.\nbool ImGui::SliderBehavior(const ImRect& bb, ImGuiID id, ImGuiDataType data_type, void* p_v, const void* p_min, const void* p_max, const char* format, ImGuiSliderFlags flags, ImRect* out_grab_bb)\n{\n    // Read imgui.cpp \"API BREAKING CHANGES\" section for 1.78 if you hit this assert.\n    IM_ASSERT((flags == 1 || (flags & ImGuiSliderFlags_InvalidMask_) == 0) && \"Invalid ImGuiSliderFlags flag!  Has the 'float power' argument been mistakenly cast to flags? Call function with ImGuiSliderFlags_Logarithmic flags instead.\");\n\n    ImGuiContext& g = *GImGui;\n    if ((g.LastItemData.InFlags & ImGuiItemFlags_ReadOnly) || (flags & ImGuiSliderFlags_ReadOnly))\n        return false;\n\n    switch (data_type)\n    {\n    case ImGuiDataType_S8:  { ImS32 v32 = (ImS32)*(ImS8*)p_v;  bool r = SliderBehaviorT<ImS32, ImS32, float>(bb, id, ImGuiDataType_S32, &v32, *(const ImS8*)p_min,  *(const ImS8*)p_max,  format, flags, out_grab_bb); if (r) *(ImS8*)p_v  = (ImS8)v32;  return r; }\n    case ImGuiDataType_U8:  { ImU32 v32 = (ImU32)*(ImU8*)p_v;  bool r = SliderBehaviorT<ImU32, ImS32, float>(bb, id, ImGuiDataType_U32, &v32, *(const ImU8*)p_min,  *(const ImU8*)p_max,  format, flags, out_grab_bb); if (r) *(ImU8*)p_v  = (ImU8)v32;  return r; }\n    case ImGuiDataType_S16: { ImS32 v32 = (ImS32)*(ImS16*)p_v; bool r = SliderBehaviorT<ImS32, ImS32, float>(bb, id, ImGuiDataType_S32, &v32, *(const ImS16*)p_min, *(const ImS16*)p_max, format, flags, out_grab_bb); if (r) *(ImS16*)p_v = (ImS16)v32; return r; }\n    case ImGuiDataType_U16: { ImU32 v32 = (ImU32)*(ImU16*)p_v; bool r = SliderBehaviorT<ImU32, ImS32, float>(bb, id, ImGuiDataType_U32, &v32, *(const ImU16*)p_min, *(const ImU16*)p_max, format, flags, out_grab_bb); if (r) *(ImU16*)p_v = (ImU16)v32; return r; }\n    case ImGuiDataType_S32:\n        IM_ASSERT(*(const ImS32*)p_min >= IM_S32_MIN / 2 && *(const ImS32*)p_max <= IM_S32_MAX / 2);\n        return SliderBehaviorT<ImS32, ImS32, float >(bb, id, data_type, (ImS32*)p_v,  *(const ImS32*)p_min,  *(const ImS32*)p_max,  format, flags, out_grab_bb);\n    case ImGuiDataType_U32:\n        IM_ASSERT(*(const ImU32*)p_max <= IM_U32_MAX / 2);\n        return SliderBehaviorT<ImU32, ImS32, float >(bb, id, data_type, (ImU32*)p_v,  *(const ImU32*)p_min,  *(const ImU32*)p_max,  format, flags, out_grab_bb);\n    case ImGuiDataType_S64:\n        IM_ASSERT(*(const ImS64*)p_min >= IM_S64_MIN / 2 && *(const ImS64*)p_max <= IM_S64_MAX / 2);\n        return SliderBehaviorT<ImS64, ImS64, double>(bb, id, data_type, (ImS64*)p_v,  *(const ImS64*)p_min,  *(const ImS64*)p_max,  format, flags, out_grab_bb);\n    case ImGuiDataType_U64:\n        IM_ASSERT(*(const ImU64*)p_max <= IM_U64_MAX / 2);\n        return SliderBehaviorT<ImU64, ImS64, double>(bb, id, data_type, (ImU64*)p_v,  *(const ImU64*)p_min,  *(const ImU64*)p_max,  format, flags, out_grab_bb);\n    case ImGuiDataType_Float:\n        IM_ASSERT(*(const float*)p_min >= -FLT_MAX / 2.0f && *(const float*)p_max <= FLT_MAX / 2.0f);\n        return SliderBehaviorT<float, float, float >(bb, id, data_type, (float*)p_v,  *(const float*)p_min,  *(const float*)p_max,  format, flags, out_grab_bb);\n    case ImGuiDataType_Double:\n        IM_ASSERT(*(const double*)p_min >= -DBL_MAX / 2.0f && *(const double*)p_max <= DBL_MAX / 2.0f);\n        return SliderBehaviorT<double, double, double>(bb, id, data_type, (double*)p_v, *(const double*)p_min, *(const double*)p_max, format, flags, out_grab_bb);\n    case ImGuiDataType_COUNT: break;\n    }\n    IM_ASSERT(0);\n    return false;\n}\n\n// Note: p_data, p_min and p_max are _pointers_ to a memory address holding the data. For a slider, they are all required.\n// Read code of e.g. SliderFloat(), SliderInt() etc. or examples in 'Demo->Widgets->Data Types' to understand how to use this function directly.\nbool ImGui::SliderScalar(const char* label, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, const char* format, ImGuiSliderFlags flags)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return false;\n\n    ImGuiContext& g = *GImGui;\n    const ImGuiStyle& style = g.Style;\n    const ImGuiID id = window->GetID(label);\n    const float w = CalcItemWidth();\n\n    const ImVec2 label_size = CalcTextSize(label, NULL, true);\n    const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y * 2.0f));\n    const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));\n\n    const bool temp_input_allowed = (flags & ImGuiSliderFlags_NoInput) == 0;\n    ItemSize(total_bb, style.FramePadding.y);\n    if (!ItemAdd(total_bb, id, &frame_bb, temp_input_allowed ? ImGuiItemAddFlags_Focusable : 0))\n        return false;\n\n    // Default format string when passing NULL\n    if (format == NULL)\n        format = DataTypeGetInfo(data_type)->PrintFmt;\n    else if (data_type == ImGuiDataType_S32 && strcmp(format, \"%d\") != 0) // (FIXME-LEGACY: Patch old \"%.0f\" format string to use \"%d\", read function more details.)\n        format = PatchFormatStringFloatToInt(format);\n\n    // Tabbing or CTRL-clicking on Slider turns it into an input box\n    const bool hovered = ItemHoverable(frame_bb, id);\n    bool temp_input_is_active = temp_input_allowed && TempInputIsActive(id);\n    if (!temp_input_is_active)\n    {\n        const bool focus_requested = temp_input_allowed && (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_Focused) != 0;\n        const bool clicked = (hovered && g.IO.MouseClicked[0]);\n        if (focus_requested || clicked || g.NavActivateId == id || g.NavInputId == id)\n        {\n            SetActiveID(id, window);\n            SetFocusID(id, window);\n            FocusWindow(window);\n            g.ActiveIdUsingNavDirMask |= (1 << ImGuiDir_Left) | (1 << ImGuiDir_Right);\n            if (temp_input_allowed && (focus_requested || (clicked && g.IO.KeyCtrl) || g.NavInputId == id))\n                temp_input_is_active = true;\n        }\n    }\n\n    if (temp_input_is_active)\n    {\n        // Only clamp CTRL+Click input when ImGuiSliderFlags_AlwaysClamp is set\n        const bool is_clamp_input = (flags & ImGuiSliderFlags_AlwaysClamp) != 0;\n        return TempInputScalar(frame_bb, id, label, data_type, p_data, format, is_clamp_input ? p_min : NULL, is_clamp_input ? p_max : NULL);\n    }\n\n    // Draw frame\n    const ImU32 frame_col = GetColorU32(g.ActiveId == id ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg);\n    RenderNavHighlight(frame_bb, id);\n    RenderFrame(frame_bb.Min, frame_bb.Max, frame_col, true, g.Style.FrameRounding);\n\n    // Slider behavior\n    ImRect grab_bb;\n    const bool value_changed = SliderBehavior(frame_bb, id, data_type, p_data, p_min, p_max, format, flags, &grab_bb);\n    if (value_changed)\n        MarkItemEdited(id);\n\n    // Render grab\n    if (grab_bb.Max.x > grab_bb.Min.x)\n        window->DrawList->AddRectFilled(grab_bb.Min, grab_bb.Max, GetColorU32(g.ActiveId == id ? ImGuiCol_SliderGrabActive : ImGuiCol_SliderGrab), style.GrabRounding);\n\n    // Display value using user-provided display format so user can add prefix/suffix/decorations to the value.\n    char value_buf[64];\n    const char* value_buf_end = value_buf + DataTypeFormatString(value_buf, IM_ARRAYSIZE(value_buf), data_type, p_data, format);\n    if (g.LogEnabled)\n        LogSetNextTextDecoration(\"{\", \"}\");\n    RenderTextClipped(frame_bb.Min, frame_bb.Max, value_buf, value_buf_end, NULL, ImVec2(0.5f, 0.5f));\n\n    if (label_size.x > 0.0f)\n        RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);\n\n    IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags);\n    return value_changed;\n}\n\n// Add multiple sliders on 1 line for compact edition of multiple components\nbool ImGui::SliderScalarN(const char* label, ImGuiDataType data_type, void* v, int components, const void* v_min, const void* v_max, const char* format, ImGuiSliderFlags flags)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return false;\n\n    ImGuiContext& g = *GImGui;\n    bool value_changed = false;\n    BeginGroup();\n    PushID(label);\n    PushMultiItemsWidths(components, CalcItemWidth());\n    size_t type_size = GDataTypeInfo[data_type].Size;\n    for (int i = 0; i < components; i++)\n    {\n        PushID(i);\n        if (i > 0)\n            SameLine(0, g.Style.ItemInnerSpacing.x);\n        value_changed |= SliderScalar(\"\", data_type, v, v_min, v_max, format, flags);\n        PopID();\n        PopItemWidth();\n        v = (void*)((char*)v + type_size);\n    }\n    PopID();\n\n    const char* label_end = FindRenderedTextEnd(label);\n    if (label != label_end)\n    {\n        SameLine(0, g.Style.ItemInnerSpacing.x);\n        TextEx(label, label_end);\n    }\n\n    EndGroup();\n    return value_changed;\n}\n\nbool ImGui::SliderFloat(const char* label, float* v, float v_min, float v_max, const char* format, ImGuiSliderFlags flags)\n{\n    return SliderScalar(label, ImGuiDataType_Float, v, &v_min, &v_max, format, flags);\n}\n\nbool ImGui::SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* format, ImGuiSliderFlags flags)\n{\n    return SliderScalarN(label, ImGuiDataType_Float, v, 2, &v_min, &v_max, format, flags);\n}\n\nbool ImGui::SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* format, ImGuiSliderFlags flags)\n{\n    return SliderScalarN(label, ImGuiDataType_Float, v, 3, &v_min, &v_max, format, flags);\n}\n\nbool ImGui::SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* format, ImGuiSliderFlags flags)\n{\n    return SliderScalarN(label, ImGuiDataType_Float, v, 4, &v_min, &v_max, format, flags);\n}\n\nbool ImGui::SliderAngle(const char* label, float* v_rad, float v_degrees_min, float v_degrees_max, const char* format, ImGuiSliderFlags flags)\n{\n    if (format == NULL)\n        format = \"%.0f deg\";\n    float v_deg = (*v_rad) * 360.0f / (2 * IM_PI);\n    bool value_changed = SliderFloat(label, &v_deg, v_degrees_min, v_degrees_max, format, flags);\n    *v_rad = v_deg * (2 * IM_PI) / 360.0f;\n    return value_changed;\n}\n\nbool ImGui::SliderInt(const char* label, int* v, int v_min, int v_max, const char* format, ImGuiSliderFlags flags)\n{\n    return SliderScalar(label, ImGuiDataType_S32, v, &v_min, &v_max, format, flags);\n}\n\nbool ImGui::SliderInt2(const char* label, int v[2], int v_min, int v_max, const char* format, ImGuiSliderFlags flags)\n{\n    return SliderScalarN(label, ImGuiDataType_S32, v, 2, &v_min, &v_max, format, flags);\n}\n\nbool ImGui::SliderInt3(const char* label, int v[3], int v_min, int v_max, const char* format, ImGuiSliderFlags flags)\n{\n    return SliderScalarN(label, ImGuiDataType_S32, v, 3, &v_min, &v_max, format, flags);\n}\n\nbool ImGui::SliderInt4(const char* label, int v[4], int v_min, int v_max, const char* format, ImGuiSliderFlags flags)\n{\n    return SliderScalarN(label, ImGuiDataType_S32, v, 4, &v_min, &v_max, format, flags);\n}\n\nbool ImGui::VSliderScalar(const char* label, const ImVec2& size, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, const char* format, ImGuiSliderFlags flags)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return false;\n\n    ImGuiContext& g = *GImGui;\n    const ImGuiStyle& style = g.Style;\n    const ImGuiID id = window->GetID(label);\n\n    const ImVec2 label_size = CalcTextSize(label, NULL, true);\n    const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + size);\n    const ImRect bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));\n\n    ItemSize(bb, style.FramePadding.y);\n    if (!ItemAdd(frame_bb, id))\n        return false;\n\n    // Default format string when passing NULL\n    if (format == NULL)\n        format = DataTypeGetInfo(data_type)->PrintFmt;\n    else if (data_type == ImGuiDataType_S32 && strcmp(format, \"%d\") != 0) // (FIXME-LEGACY: Patch old \"%.0f\" format string to use \"%d\", read function more details.)\n        format = PatchFormatStringFloatToInt(format);\n\n    const bool hovered = ItemHoverable(frame_bb, id);\n    if ((hovered && g.IO.MouseClicked[0]) || g.NavActivateId == id || g.NavInputId == id)\n    {\n        SetActiveID(id, window);\n        SetFocusID(id, window);\n        FocusWindow(window);\n        g.ActiveIdUsingNavDirMask |= (1 << ImGuiDir_Up) | (1 << ImGuiDir_Down);\n    }\n\n    // Draw frame\n    const ImU32 frame_col = GetColorU32(g.ActiveId == id ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg);\n    RenderNavHighlight(frame_bb, id);\n    RenderFrame(frame_bb.Min, frame_bb.Max, frame_col, true, g.Style.FrameRounding);\n\n    // Slider behavior\n    ImRect grab_bb;\n    const bool value_changed = SliderBehavior(frame_bb, id, data_type, p_data, p_min, p_max, format, flags | ImGuiSliderFlags_Vertical, &grab_bb);\n    if (value_changed)\n        MarkItemEdited(id);\n\n    // Render grab\n    if (grab_bb.Max.y > grab_bb.Min.y)\n        window->DrawList->AddRectFilled(grab_bb.Min, grab_bb.Max, GetColorU32(g.ActiveId == id ? ImGuiCol_SliderGrabActive : ImGuiCol_SliderGrab), style.GrabRounding);\n\n    // Display value using user-provided display format so user can add prefix/suffix/decorations to the value.\n    // For the vertical slider we allow centered text to overlap the frame padding\n    char value_buf[64];\n    const char* value_buf_end = value_buf + DataTypeFormatString(value_buf, IM_ARRAYSIZE(value_buf), data_type, p_data, format);\n    RenderTextClipped(ImVec2(frame_bb.Min.x, frame_bb.Min.y + style.FramePadding.y), frame_bb.Max, value_buf, value_buf_end, NULL, ImVec2(0.5f, 0.0f));\n    if (label_size.x > 0.0f)\n        RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);\n\n    return value_changed;\n}\n\nbool ImGui::VSliderFloat(const char* label, const ImVec2& size, float* v, float v_min, float v_max, const char* format, ImGuiSliderFlags flags)\n{\n    return VSliderScalar(label, size, ImGuiDataType_Float, v, &v_min, &v_max, format, flags);\n}\n\nbool ImGui::VSliderInt(const char* label, const ImVec2& size, int* v, int v_min, int v_max, const char* format, ImGuiSliderFlags flags)\n{\n    return VSliderScalar(label, size, ImGuiDataType_S32, v, &v_min, &v_max, format, flags);\n}\n\n#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS\n\n// Obsolete versions with power parameter. See https://github.com/ocornut/imgui/issues/3361 for details.\nbool ImGui::SliderScalar(const char* label, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, const char* format, float power)\n{\n    ImGuiSliderFlags slider_flags = ImGuiSliderFlags_None;\n    if (power != 1.0f)\n    {\n        IM_ASSERT(power == 1.0f && \"Call function with ImGuiSliderFlags_Logarithmic flags instead of using the old 'float power' function!\");\n        slider_flags |= ImGuiSliderFlags_Logarithmic;   // Fallback for non-asserting paths\n    }\n    return SliderScalar(label, data_type, p_data, p_min, p_max, format, slider_flags);\n}\n\nbool ImGui::SliderScalarN(const char* label, ImGuiDataType data_type, void* v, int components, const void* v_min, const void* v_max, const char* format, float power)\n{\n    ImGuiSliderFlags slider_flags = ImGuiSliderFlags_None;\n    if (power != 1.0f)\n    {\n        IM_ASSERT(power == 1.0f && \"Call function with ImGuiSliderFlags_Logarithmic flags instead of using the old 'float power' function!\");\n        slider_flags |= ImGuiSliderFlags_Logarithmic;   // Fallback for non-asserting paths\n    }\n    return SliderScalarN(label, data_type, v, components, v_min, v_max, format, slider_flags);\n}\n\n#endif // IMGUI_DISABLE_OBSOLETE_FUNCTIONS\n\n//-------------------------------------------------------------------------\n// [SECTION] Widgets: InputScalar, InputFloat, InputInt, etc.\n//-------------------------------------------------------------------------\n// - ImParseFormatFindStart() [Internal]\n// - ImParseFormatFindEnd() [Internal]\n// - ImParseFormatTrimDecorations() [Internal]\n// - ImParseFormatPrecision() [Internal]\n// - TempInputTextScalar() [Internal]\n// - InputScalar()\n// - InputScalarN()\n// - InputFloat()\n// - InputFloat2()\n// - InputFloat3()\n// - InputFloat4()\n// - InputInt()\n// - InputInt2()\n// - InputInt3()\n// - InputInt4()\n// - InputDouble()\n//-------------------------------------------------------------------------\n\n// We don't use strchr() because our strings are usually very short and often start with '%'\nconst char* ImParseFormatFindStart(const char* fmt)\n{\n    while (char c = fmt[0])\n    {\n        if (c == '%' && fmt[1] != '%')\n            return fmt;\n        else if (c == '%')\n            fmt++;\n        fmt++;\n    }\n    return fmt;\n}\n\nconst char* ImParseFormatFindEnd(const char* fmt)\n{\n    // Printf/scanf types modifiers: I/L/h/j/l/t/w/z. Other uppercase letters qualify as types aka end of the format.\n    if (fmt[0] != '%')\n        return fmt;\n    const unsigned int ignored_uppercase_mask = (1 << ('I'-'A')) | (1 << ('L'-'A'));\n    const unsigned int ignored_lowercase_mask = (1 << ('h'-'a')) | (1 << ('j'-'a')) | (1 << ('l'-'a')) | (1 << ('t'-'a')) | (1 << ('w'-'a')) | (1 << ('z'-'a'));\n    for (char c; (c = *fmt) != 0; fmt++)\n    {\n        if (c >= 'A' && c <= 'Z' && ((1 << (c - 'A')) & ignored_uppercase_mask) == 0)\n            return fmt + 1;\n        if (c >= 'a' && c <= 'z' && ((1 << (c - 'a')) & ignored_lowercase_mask) == 0)\n            return fmt + 1;\n    }\n    return fmt;\n}\n\n// Extract the format out of a format string with leading or trailing decorations\n//  fmt = \"blah blah\"  -> return fmt\n//  fmt = \"%.3f\"       -> return fmt\n//  fmt = \"hello %.3f\" -> return fmt + 6\n//  fmt = \"%.3f hello\" -> return buf written with \"%.3f\"\nconst char* ImParseFormatTrimDecorations(const char* fmt, char* buf, size_t buf_size)\n{\n    const char* fmt_start = ImParseFormatFindStart(fmt);\n    if (fmt_start[0] != '%')\n        return fmt;\n    const char* fmt_end = ImParseFormatFindEnd(fmt_start);\n    if (fmt_end[0] == 0) // If we only have leading decoration, we don't need to copy the data.\n        return fmt_start;\n    ImStrncpy(buf, fmt_start, ImMin((size_t)(fmt_end - fmt_start) + 1, buf_size));\n    return buf;\n}\n\n// Parse display precision back from the display format string\n// FIXME: This is still used by some navigation code path to infer a minimum tweak step, but we should aim to rework widgets so it isn't needed.\nint ImParseFormatPrecision(const char* fmt, int default_precision)\n{\n    fmt = ImParseFormatFindStart(fmt);\n    if (fmt[0] != '%')\n        return default_precision;\n    fmt++;\n    while (*fmt >= '0' && *fmt <= '9')\n        fmt++;\n    int precision = INT_MAX;\n    if (*fmt == '.')\n    {\n        fmt = ImAtoi<int>(fmt + 1, &precision);\n        if (precision < 0 || precision > 99)\n            precision = default_precision;\n    }\n    if (*fmt == 'e' || *fmt == 'E') // Maximum precision with scientific notation\n        precision = -1;\n    if ((*fmt == 'g' || *fmt == 'G') && precision == INT_MAX)\n        precision = -1;\n    return (precision == INT_MAX) ? default_precision : precision;\n}\n\n// Create text input in place of another active widget (e.g. used when doing a CTRL+Click on drag/slider widgets)\n// FIXME: Facilitate using this in variety of other situations.\nbool ImGui::TempInputText(const ImRect& bb, ImGuiID id, const char* label, char* buf, int buf_size, ImGuiInputTextFlags flags)\n{\n    // On the first frame, g.TempInputTextId == 0, then on subsequent frames it becomes == id.\n    // We clear ActiveID on the first frame to allow the InputText() taking it back.\n    ImGuiContext& g = *GImGui;\n    const bool init = (g.TempInputId != id);\n    if (init)\n        ClearActiveID();\n\n    g.CurrentWindow->DC.CursorPos = bb.Min;\n    bool value_changed = InputTextEx(label, NULL, buf, buf_size, bb.GetSize(), flags | ImGuiInputTextFlags_MergedItem);\n    if (init)\n    {\n        // First frame we started displaying the InputText widget, we expect it to take the active id.\n        IM_ASSERT(g.ActiveId == id);\n        g.TempInputId = g.ActiveId;\n    }\n    return value_changed;\n}\n\n// Note that Drag/Slider functions are only forwarding the min/max values clamping values if the ImGuiSliderFlags_AlwaysClamp flag is set!\n// This is intended: this way we allow CTRL+Click manual input to set a value out of bounds, for maximum flexibility.\n// However this may not be ideal for all uses, as some user code may break on out of bound values.\nbool ImGui::TempInputScalar(const ImRect& bb, ImGuiID id, const char* label, ImGuiDataType data_type, void* p_data, const char* format, const void* p_clamp_min, const void* p_clamp_max)\n{\n    ImGuiContext& g = *GImGui;\n\n    char fmt_buf[32];\n    char data_buf[32];\n    format = ImParseFormatTrimDecorations(format, fmt_buf, IM_ARRAYSIZE(fmt_buf));\n    DataTypeFormatString(data_buf, IM_ARRAYSIZE(data_buf), data_type, p_data, format);\n    ImStrTrimBlanks(data_buf);\n\n    ImGuiInputTextFlags flags = ImGuiInputTextFlags_AutoSelectAll | ImGuiInputTextFlags_NoMarkEdited;\n    flags |= ((data_type == ImGuiDataType_Float || data_type == ImGuiDataType_Double) ? ImGuiInputTextFlags_CharsScientific : ImGuiInputTextFlags_CharsDecimal);\n    bool value_changed = false;\n    if (TempInputText(bb, id, label, data_buf, IM_ARRAYSIZE(data_buf), flags))\n    {\n        // Backup old value\n        size_t data_type_size = DataTypeGetInfo(data_type)->Size;\n        ImGuiDataTypeTempStorage data_backup;\n        memcpy(&data_backup, p_data, data_type_size);\n\n        // Apply new value (or operations) then clamp\n        DataTypeApplyOpFromText(data_buf, g.InputTextState.InitialTextA.Data, data_type, p_data, NULL);\n        if (p_clamp_min || p_clamp_max)\n        {\n            if (p_clamp_min && p_clamp_max && DataTypeCompare(data_type, p_clamp_min, p_clamp_max) > 0)\n                ImSwap(p_clamp_min, p_clamp_max);\n            DataTypeClamp(data_type, p_data, p_clamp_min, p_clamp_max);\n        }\n\n        // Only mark as edited if new value is different\n        value_changed = memcmp(&data_backup, p_data, data_type_size) != 0;\n        if (value_changed)\n            MarkItemEdited(id);\n    }\n    return value_changed;\n}\n\n// Note: p_data, p_step, p_step_fast are _pointers_ to a memory address holding the data. For an Input widget, p_step and p_step_fast are optional.\n// Read code of e.g. InputFloat(), InputInt() etc. or examples in 'Demo->Widgets->Data Types' to understand how to use this function directly.\nbool ImGui::InputScalar(const char* label, ImGuiDataType data_type, void* p_data, const void* p_step, const void* p_step_fast, const char* format, ImGuiInputTextFlags flags)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return false;\n\n    ImGuiContext& g = *GImGui;\n    ImGuiStyle& style = g.Style;\n\n    if (format == NULL)\n        format = DataTypeGetInfo(data_type)->PrintFmt;\n\n    char buf[64];\n    DataTypeFormatString(buf, IM_ARRAYSIZE(buf), data_type, p_data, format);\n\n    bool value_changed = false;\n    if ((flags & (ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsScientific)) == 0)\n        flags |= ImGuiInputTextFlags_CharsDecimal;\n    flags |= ImGuiInputTextFlags_AutoSelectAll;\n    flags |= ImGuiInputTextFlags_NoMarkEdited;  // We call MarkItemEdited() ourselves by comparing the actual data rather than the string.\n\n    if (p_step != NULL)\n    {\n        const float button_size = GetFrameHeight();\n\n        BeginGroup(); // The only purpose of the group here is to allow the caller to query item data e.g. IsItemActive()\n        PushID(label);\n        SetNextItemWidth(ImMax(1.0f, CalcItemWidth() - (button_size + style.ItemInnerSpacing.x) * 2));\n        if (InputText(\"\", buf, IM_ARRAYSIZE(buf), flags)) // PushId(label) + \"\" gives us the expected ID from outside point of view\n            value_changed = DataTypeApplyOpFromText(buf, g.InputTextState.InitialTextA.Data, data_type, p_data, format);\n\n        // Step buttons\n        const ImVec2 backup_frame_padding = style.FramePadding;\n        style.FramePadding.x = style.FramePadding.y;\n        ImGuiButtonFlags button_flags = ImGuiButtonFlags_Repeat | ImGuiButtonFlags_DontClosePopups;\n        if (flags & ImGuiInputTextFlags_ReadOnly)\n            BeginDisabled(true);\n        SameLine(0, style.ItemInnerSpacing.x);\n        if (ButtonEx(\"-\", ImVec2(button_size, button_size), button_flags))\n        {\n            DataTypeApplyOp(data_type, '-', p_data, p_data, g.IO.KeyCtrl && p_step_fast ? p_step_fast : p_step);\n            value_changed = true;\n        }\n        SameLine(0, style.ItemInnerSpacing.x);\n        if (ButtonEx(\"+\", ImVec2(button_size, button_size), button_flags))\n        {\n            DataTypeApplyOp(data_type, '+', p_data, p_data, g.IO.KeyCtrl && p_step_fast ? p_step_fast : p_step);\n            value_changed = true;\n        }\n        if (flags & ImGuiInputTextFlags_ReadOnly)\n            EndDisabled();\n\n        const char* label_end = FindRenderedTextEnd(label);\n        if (label != label_end)\n        {\n            SameLine(0, style.ItemInnerSpacing.x);\n            TextEx(label, label_end);\n        }\n        style.FramePadding = backup_frame_padding;\n\n        PopID();\n        EndGroup();\n    }\n    else\n    {\n        if (InputText(label, buf, IM_ARRAYSIZE(buf), flags))\n            value_changed = DataTypeApplyOpFromText(buf, g.InputTextState.InitialTextA.Data, data_type, p_data, format);\n    }\n    if (value_changed)\n        MarkItemEdited(g.LastItemData.ID);\n\n    return value_changed;\n}\n\nbool ImGui::InputScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, const void* p_step, const void* p_step_fast, const char* format, ImGuiInputTextFlags flags)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return false;\n\n    ImGuiContext& g = *GImGui;\n    bool value_changed = false;\n    BeginGroup();\n    PushID(label);\n    PushMultiItemsWidths(components, CalcItemWidth());\n    size_t type_size = GDataTypeInfo[data_type].Size;\n    for (int i = 0; i < components; i++)\n    {\n        PushID(i);\n        if (i > 0)\n            SameLine(0, g.Style.ItemInnerSpacing.x);\n        value_changed |= InputScalar(\"\", data_type, p_data, p_step, p_step_fast, format, flags);\n        PopID();\n        PopItemWidth();\n        p_data = (void*)((char*)p_data + type_size);\n    }\n    PopID();\n\n    const char* label_end = FindRenderedTextEnd(label);\n    if (label != label_end)\n    {\n        SameLine(0.0f, g.Style.ItemInnerSpacing.x);\n        TextEx(label, label_end);\n    }\n\n    EndGroup();\n    return value_changed;\n}\n\nbool ImGui::InputFloat(const char* label, float* v, float step, float step_fast, const char* format, ImGuiInputTextFlags flags)\n{\n    flags |= ImGuiInputTextFlags_CharsScientific;\n    return InputScalar(label, ImGuiDataType_Float, (void*)v, (void*)(step > 0.0f ? &step : NULL), (void*)(step_fast > 0.0f ? &step_fast : NULL), format, flags);\n}\n\nbool ImGui::InputFloat2(const char* label, float v[2], const char* format, ImGuiInputTextFlags flags)\n{\n    return InputScalarN(label, ImGuiDataType_Float, v, 2, NULL, NULL, format, flags);\n}\n\nbool ImGui::InputFloat3(const char* label, float v[3], const char* format, ImGuiInputTextFlags flags)\n{\n    return InputScalarN(label, ImGuiDataType_Float, v, 3, NULL, NULL, format, flags);\n}\n\nbool ImGui::InputFloat4(const char* label, float v[4], const char* format, ImGuiInputTextFlags flags)\n{\n    return InputScalarN(label, ImGuiDataType_Float, v, 4, NULL, NULL, format, flags);\n}\n\nbool ImGui::InputInt(const char* label, int* v, int step, int step_fast, ImGuiInputTextFlags flags)\n{\n    // Hexadecimal input provided as a convenience but the flag name is awkward. Typically you'd use InputText() to parse your own data, if you want to handle prefixes.\n    const char* format = (flags & ImGuiInputTextFlags_CharsHexadecimal) ? \"%08X\" : \"%d\";\n    return InputScalar(label, ImGuiDataType_S32, (void*)v, (void*)(step > 0 ? &step : NULL), (void*)(step_fast > 0 ? &step_fast : NULL), format, flags);\n}\n\nbool ImGui::InputInt2(const char* label, int v[2], ImGuiInputTextFlags flags)\n{\n    return InputScalarN(label, ImGuiDataType_S32, v, 2, NULL, NULL, \"%d\", flags);\n}\n\nbool ImGui::InputInt3(const char* label, int v[3], ImGuiInputTextFlags flags)\n{\n    return InputScalarN(label, ImGuiDataType_S32, v, 3, NULL, NULL, \"%d\", flags);\n}\n\nbool ImGui::InputInt4(const char* label, int v[4], ImGuiInputTextFlags flags)\n{\n    return InputScalarN(label, ImGuiDataType_S32, v, 4, NULL, NULL, \"%d\", flags);\n}\n\nbool ImGui::InputDouble(const char* label, double* v, double step, double step_fast, const char* format, ImGuiInputTextFlags flags)\n{\n    flags |= ImGuiInputTextFlags_CharsScientific;\n    return InputScalar(label, ImGuiDataType_Double, (void*)v, (void*)(step > 0.0 ? &step : NULL), (void*)(step_fast > 0.0 ? &step_fast : NULL), format, flags);\n}\n\n//-------------------------------------------------------------------------\n// [SECTION] Widgets: InputText, InputTextMultiline, InputTextWithHint\n//-------------------------------------------------------------------------\n// - InputText()\n// - InputTextWithHint()\n// - InputTextMultiline()\n// - InputTextEx() [Internal]\n//-------------------------------------------------------------------------\n\nbool ImGui::InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data)\n{\n    IM_ASSERT(!(flags & ImGuiInputTextFlags_Multiline)); // call InputTextMultiline()\n    return InputTextEx(label, NULL, buf, (int)buf_size, ImVec2(0, 0), flags, callback, user_data);\n}\n\nbool ImGui::InputTextMultiline(const char* label, char* buf, size_t buf_size, const ImVec2& size, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data)\n{\n    return InputTextEx(label, NULL, buf, (int)buf_size, size, flags | ImGuiInputTextFlags_Multiline, callback, user_data);\n}\n\nbool ImGui::InputTextWithHint(const char* label, const char* hint, char* buf, size_t buf_size, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data)\n{\n    IM_ASSERT(!(flags & ImGuiInputTextFlags_Multiline)); // call InputTextMultiline()\n    return InputTextEx(label, hint, buf, (int)buf_size, ImVec2(0, 0), flags, callback, user_data);\n}\n\nstatic int InputTextCalcTextLenAndLineCount(const char* text_begin, const char** out_text_end)\n{\n    int line_count = 0;\n    const char* s = text_begin;\n    while (char c = *s++) // We are only matching for \\n so we can ignore UTF-8 decoding\n        if (c == '\\n')\n            line_count++;\n    s--;\n    if (s[0] != '\\n' && s[0] != '\\r')\n        line_count++;\n    *out_text_end = s;\n    return line_count;\n}\n\nstatic ImVec2 InputTextCalcTextSizeW(const ImWchar* text_begin, const ImWchar* text_end, const ImWchar** remaining, ImVec2* out_offset, bool stop_on_new_line)\n{\n    ImGuiContext& g = *GImGui;\n    ImFont* font = g.Font;\n    const float line_height = g.FontSize;\n    const float scale = line_height / font->FontSize;\n\n    ImVec2 text_size = ImVec2(0, 0);\n    float line_width = 0.0f;\n\n    const ImWchar* s = text_begin;\n    while (s < text_end)\n    {\n        unsigned int c = (unsigned int)(*s++);\n        if (c == '\\n')\n        {\n            text_size.x = ImMax(text_size.x, line_width);\n            text_size.y += line_height;\n            line_width = 0.0f;\n            if (stop_on_new_line)\n                break;\n            continue;\n        }\n        if (c == '\\r')\n            continue;\n\n        const float char_width = font->GetCharAdvance((ImWchar)c) * scale;\n        line_width += char_width;\n    }\n\n    if (text_size.x < line_width)\n        text_size.x = line_width;\n\n    if (out_offset)\n        *out_offset = ImVec2(line_width, text_size.y + line_height);  // offset allow for the possibility of sitting after a trailing \\n\n\n    if (line_width > 0 || text_size.y == 0.0f)                        // whereas size.y will ignore the trailing \\n\n        text_size.y += line_height;\n\n    if (remaining)\n        *remaining = s;\n\n    return text_size;\n}\n\n// Wrapper for stb_textedit.h to edit text (our wrapper is for: statically sized buffer, single-line, wchar characters. InputText converts between UTF-8 and wchar)\nnamespace ImStb\n{\n\nstatic int     STB_TEXTEDIT_STRINGLEN(const ImGuiInputTextState* obj)                             { return obj->CurLenW; }\nstatic ImWchar STB_TEXTEDIT_GETCHAR(const ImGuiInputTextState* obj, int idx)                      { return obj->TextW[idx]; }\nstatic float   STB_TEXTEDIT_GETWIDTH(ImGuiInputTextState* obj, int line_start_idx, int char_idx)  { ImWchar c = obj->TextW[line_start_idx + char_idx]; if (c == '\\n') return STB_TEXTEDIT_GETWIDTH_NEWLINE; ImGuiContext& g = *GImGui; return g.Font->GetCharAdvance(c) * (g.FontSize / g.Font->FontSize); }\nstatic int     STB_TEXTEDIT_KEYTOTEXT(int key)                                                    { return key >= 0x200000 ? 0 : key; }\nstatic ImWchar STB_TEXTEDIT_NEWLINE = '\\n';\nstatic void    STB_TEXTEDIT_LAYOUTROW(StbTexteditRow* r, ImGuiInputTextState* obj, int line_start_idx)\n{\n    const ImWchar* text = obj->TextW.Data;\n    const ImWchar* text_remaining = NULL;\n    const ImVec2 size = InputTextCalcTextSizeW(text + line_start_idx, text + obj->CurLenW, &text_remaining, NULL, true);\n    r->x0 = 0.0f;\n    r->x1 = size.x;\n    r->baseline_y_delta = size.y;\n    r->ymin = 0.0f;\n    r->ymax = size.y;\n    r->num_chars = (int)(text_remaining - (text + line_start_idx));\n}\n\n// When ImGuiInputTextFlags_Password is set, we don't want actions such as CTRL+Arrow to leak the fact that underlying data are blanks or separators.\nstatic bool is_separator(unsigned int c)                                        { return ImCharIsBlankW(c) || c==',' || c==';' || c=='(' || c==')' || c=='{' || c=='}' || c=='[' || c==']' || c=='|'; }\nstatic int  is_word_boundary_from_right(ImGuiInputTextState* obj, int idx)      { if (obj->Flags & ImGuiInputTextFlags_Password) return 0; return idx > 0 ? (is_separator(obj->TextW[idx - 1]) && !is_separator(obj->TextW[idx]) ) : 1; }\nstatic int  STB_TEXTEDIT_MOVEWORDLEFT_IMPL(ImGuiInputTextState* obj, int idx)   { idx--; while (idx >= 0 && !is_word_boundary_from_right(obj, idx)) idx--; return idx < 0 ? 0 : idx; }\n#ifdef __APPLE__    // FIXME: Move setting to IO structure\nstatic int  is_word_boundary_from_left(ImGuiInputTextState* obj, int idx)       { if (obj->Flags & ImGuiInputTextFlags_Password) return 0; return idx > 0 ? (!is_separator(obj->TextW[idx - 1]) && is_separator(obj->TextW[idx]) ) : 1; }\nstatic int  STB_TEXTEDIT_MOVEWORDRIGHT_IMPL(ImGuiInputTextState* obj, int idx)  { idx++; int len = obj->CurLenW; while (idx < len && !is_word_boundary_from_left(obj, idx)) idx++; return idx > len ? len : idx; }\n#else\nstatic int  STB_TEXTEDIT_MOVEWORDRIGHT_IMPL(ImGuiInputTextState* obj, int idx)  { idx++; int len = obj->CurLenW; while (idx < len && !is_word_boundary_from_right(obj, idx)) idx++; return idx > len ? len : idx; }\n#endif\n#define STB_TEXTEDIT_MOVEWORDLEFT   STB_TEXTEDIT_MOVEWORDLEFT_IMPL    // They need to be #define for stb_textedit.h\n#define STB_TEXTEDIT_MOVEWORDRIGHT  STB_TEXTEDIT_MOVEWORDRIGHT_IMPL\n\nstatic void STB_TEXTEDIT_DELETECHARS(ImGuiInputTextState* obj, int pos, int n)\n{\n    ImWchar* dst = obj->TextW.Data + pos;\n\n    // We maintain our buffer length in both UTF-8 and wchar formats\n    obj->Edited = true;\n    obj->CurLenA -= ImTextCountUtf8BytesFromStr(dst, dst + n);\n    obj->CurLenW -= n;\n\n    // Offset remaining text (FIXME-OPT: Use memmove)\n    const ImWchar* src = obj->TextW.Data + pos + n;\n    while (ImWchar c = *src++)\n        *dst++ = c;\n    *dst = '\\0';\n}\n\nstatic bool STB_TEXTEDIT_INSERTCHARS(ImGuiInputTextState* obj, int pos, const ImWchar* new_text, int new_text_len)\n{\n    const bool is_resizable = (obj->Flags & ImGuiInputTextFlags_CallbackResize) != 0;\n    const int text_len = obj->CurLenW;\n    IM_ASSERT(pos <= text_len);\n\n    const int new_text_len_utf8 = ImTextCountUtf8BytesFromStr(new_text, new_text + new_text_len);\n    if (!is_resizable && (new_text_len_utf8 + obj->CurLenA + 1 > obj->BufCapacityA))\n        return false;\n\n    // Grow internal buffer if needed\n    if (new_text_len + text_len + 1 > obj->TextW.Size)\n    {\n        if (!is_resizable)\n            return false;\n        IM_ASSERT(text_len < obj->TextW.Size);\n        obj->TextW.resize(text_len + ImClamp(new_text_len * 4, 32, ImMax(256, new_text_len)) + 1);\n    }\n\n    ImWchar* text = obj->TextW.Data;\n    if (pos != text_len)\n        memmove(text + pos + new_text_len, text + pos, (size_t)(text_len - pos) * sizeof(ImWchar));\n    memcpy(text + pos, new_text, (size_t)new_text_len * sizeof(ImWchar));\n\n    obj->Edited = true;\n    obj->CurLenW += new_text_len;\n    obj->CurLenA += new_text_len_utf8;\n    obj->TextW[obj->CurLenW] = '\\0';\n\n    return true;\n}\n\n// We don't use an enum so we can build even with conflicting symbols (if another user of stb_textedit.h leak their STB_TEXTEDIT_K_* symbols)\n#define STB_TEXTEDIT_K_LEFT         0x200000 // keyboard input to move cursor left\n#define STB_TEXTEDIT_K_RIGHT        0x200001 // keyboard input to move cursor right\n#define STB_TEXTEDIT_K_UP           0x200002 // keyboard input to move cursor up\n#define STB_TEXTEDIT_K_DOWN         0x200003 // keyboard input to move cursor down\n#define STB_TEXTEDIT_K_LINESTART    0x200004 // keyboard input to move cursor to start of line\n#define STB_TEXTEDIT_K_LINEEND      0x200005 // keyboard input to move cursor to end of line\n#define STB_TEXTEDIT_K_TEXTSTART    0x200006 // keyboard input to move cursor to start of text\n#define STB_TEXTEDIT_K_TEXTEND      0x200007 // keyboard input to move cursor to end of text\n#define STB_TEXTEDIT_K_DELETE       0x200008 // keyboard input to delete selection or character under cursor\n#define STB_TEXTEDIT_K_BACKSPACE    0x200009 // keyboard input to delete selection or character left of cursor\n#define STB_TEXTEDIT_K_UNDO         0x20000A // keyboard input to perform undo\n#define STB_TEXTEDIT_K_REDO         0x20000B // keyboard input to perform redo\n#define STB_TEXTEDIT_K_WORDLEFT     0x20000C // keyboard input to move cursor left one word\n#define STB_TEXTEDIT_K_WORDRIGHT    0x20000D // keyboard input to move cursor right one word\n#define STB_TEXTEDIT_K_PGUP         0x20000E // keyboard input to move cursor up a page\n#define STB_TEXTEDIT_K_PGDOWN       0x20000F // keyboard input to move cursor down a page\n#define STB_TEXTEDIT_K_SHIFT        0x400000\n\n#define STB_TEXTEDIT_IMPLEMENTATION\n#include \"imstb_textedit.h\"\n\n// stb_textedit internally allows for a single undo record to do addition and deletion, but somehow, calling\n// the stb_textedit_paste() function creates two separate records, so we perform it manually. (FIXME: Report to nothings/stb?)\nstatic void stb_textedit_replace(ImGuiInputTextState* str, STB_TexteditState* state, const STB_TEXTEDIT_CHARTYPE* text, int text_len)\n{\n    stb_text_makeundo_replace(str, state, 0, str->CurLenW, text_len);\n    ImStb::STB_TEXTEDIT_DELETECHARS(str, 0, str->CurLenW);\n    if (text_len <= 0)\n        return;\n    if (ImStb::STB_TEXTEDIT_INSERTCHARS(str, 0, text, text_len))\n    {\n        state->cursor = text_len;\n        state->has_preferred_x = 0;\n        return;\n    }\n    IM_ASSERT(0); // Failed to insert character, normally shouldn't happen because of how we currently use stb_textedit_replace()\n}\n\n} // namespace ImStb\n\nvoid ImGuiInputTextState::OnKeyPressed(int key)\n{\n    stb_textedit_key(this, &Stb, key);\n    CursorFollow = true;\n    CursorAnimReset();\n}\n\nImGuiInputTextCallbackData::ImGuiInputTextCallbackData()\n{\n    memset(this, 0, sizeof(*this));\n}\n\n// Public API to manipulate UTF-8 text\n// We expose UTF-8 to the user (unlike the STB_TEXTEDIT_* functions which are manipulating wchar)\n// FIXME: The existence of this rarely exercised code path is a bit of a nuisance.\nvoid ImGuiInputTextCallbackData::DeleteChars(int pos, int bytes_count)\n{\n    IM_ASSERT(pos + bytes_count <= BufTextLen);\n    char* dst = Buf + pos;\n    const char* src = Buf + pos + bytes_count;\n    while (char c = *src++)\n        *dst++ = c;\n    *dst = '\\0';\n\n    if (CursorPos >= pos + bytes_count)\n        CursorPos -= bytes_count;\n    else if (CursorPos >= pos)\n        CursorPos = pos;\n    SelectionStart = SelectionEnd = CursorPos;\n    BufDirty = true;\n    BufTextLen -= bytes_count;\n}\n\nvoid ImGuiInputTextCallbackData::InsertChars(int pos, const char* new_text, const char* new_text_end)\n{\n    const bool is_resizable = (Flags & ImGuiInputTextFlags_CallbackResize) != 0;\n    const int new_text_len = new_text_end ? (int)(new_text_end - new_text) : (int)strlen(new_text);\n    if (new_text_len + BufTextLen >= BufSize)\n    {\n        if (!is_resizable)\n            return;\n\n        // Contrary to STB_TEXTEDIT_INSERTCHARS() this is working in the UTF8 buffer, hence the mildly similar code (until we remove the U16 buffer altogether!)\n        ImGuiContext& g = *GImGui;\n        ImGuiInputTextState* edit_state = &g.InputTextState;\n        IM_ASSERT(edit_state->ID != 0 && g.ActiveId == edit_state->ID);\n        IM_ASSERT(Buf == edit_state->TextA.Data);\n        int new_buf_size = BufTextLen + ImClamp(new_text_len * 4, 32, ImMax(256, new_text_len)) + 1;\n        edit_state->TextA.reserve(new_buf_size + 1);\n        Buf = edit_state->TextA.Data;\n        BufSize = edit_state->BufCapacityA = new_buf_size;\n    }\n\n    if (BufTextLen != pos)\n        memmove(Buf + pos + new_text_len, Buf + pos, (size_t)(BufTextLen - pos));\n    memcpy(Buf + pos, new_text, (size_t)new_text_len * sizeof(char));\n    Buf[BufTextLen + new_text_len] = '\\0';\n\n    if (CursorPos >= pos)\n        CursorPos += new_text_len;\n    SelectionStart = SelectionEnd = CursorPos;\n    BufDirty = true;\n    BufTextLen += new_text_len;\n}\n\n// Return false to discard a character.\nstatic bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data, ImGuiInputSource input_source)\n{\n    IM_ASSERT(input_source == ImGuiInputSource_Keyboard || input_source == ImGuiInputSource_Clipboard);\n    unsigned int c = *p_char;\n\n    // Filter non-printable (NB: isprint is unreliable! see #2467)\n    bool apply_named_filters = true;\n    if (c < 0x20)\n    {\n        bool pass = false;\n        pass |= (c == '\\n' && (flags & ImGuiInputTextFlags_Multiline));\n        pass |= (c == '\\t' && (flags & ImGuiInputTextFlags_AllowTabInput));\n        if (!pass)\n            return false;\n        apply_named_filters = false; // Override named filters below so newline and tabs can still be inserted.\n    }\n\n    if (input_source != ImGuiInputSource_Clipboard)\n    {\n        // We ignore Ascii representation of delete (emitted from Backspace on OSX, see #2578, #2817)\n        if (c == 127)\n            return false;\n\n        // Filter private Unicode range. GLFW on OSX seems to send private characters for special keys like arrow keys (FIXME)\n        if (c >= 0xE000 && c <= 0xF8FF)\n            return false;\n    }\n\n    // Filter Unicode ranges we are not handling in this build\n    if (c > IM_UNICODE_CODEPOINT_MAX)\n        return false;\n\n    // Generic named filters\n    if (apply_named_filters && (flags & (ImGuiInputTextFlags_CharsDecimal | ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsUppercase | ImGuiInputTextFlags_CharsNoBlank | ImGuiInputTextFlags_CharsScientific)))\n    {\n        // The libc allows overriding locale, with e.g. 'setlocale(LC_NUMERIC, \"de_DE.UTF-8\");' which affect the output/input of printf/scanf.\n        // The standard mandate that programs starts in the \"C\" locale where the decimal point is '.'.\n        // We don't really intend to provide widespread support for it, but out of empathy for people stuck with using odd API, we support the bare minimum aka overriding the decimal point.\n        // Change the default decimal_point with:\n        //   ImGui::GetCurrentContext()->PlatformLocaleDecimalPoint = *localeconv()->decimal_point;\n        ImGuiContext& g = *GImGui;\n        const unsigned c_decimal_point = (unsigned int)g.PlatformLocaleDecimalPoint;\n\n        // Allow 0-9 . - + * /\n        if (flags & ImGuiInputTextFlags_CharsDecimal)\n            if (!(c >= '0' && c <= '9') && (c != c_decimal_point) && (c != '-') && (c != '+') && (c != '*') && (c != '/'))\n                return false;\n\n        // Allow 0-9 . - + * / e E\n        if (flags & ImGuiInputTextFlags_CharsScientific)\n            if (!(c >= '0' && c <= '9') && (c != c_decimal_point) && (c != '-') && (c != '+') && (c != '*') && (c != '/') && (c != 'e') && (c != 'E'))\n                return false;\n\n        // Allow 0-9 a-F A-F\n        if (flags & ImGuiInputTextFlags_CharsHexadecimal)\n            if (!(c >= '0' && c <= '9') && !(c >= 'a' && c <= 'f') && !(c >= 'A' && c <= 'F'))\n                return false;\n\n        // Turn a-z into A-Z\n        if (flags & ImGuiInputTextFlags_CharsUppercase)\n            if (c >= 'a' && c <= 'z')\n                *p_char = (c += (unsigned int)('A' - 'a'));\n\n        if (flags & ImGuiInputTextFlags_CharsNoBlank)\n            if (ImCharIsBlankW(c))\n                return false;\n    }\n\n    // Custom callback filter\n    if (flags & ImGuiInputTextFlags_CallbackCharFilter)\n    {\n        ImGuiInputTextCallbackData callback_data;\n        memset(&callback_data, 0, sizeof(ImGuiInputTextCallbackData));\n        callback_data.EventFlag = ImGuiInputTextFlags_CallbackCharFilter;\n        callback_data.EventChar = (ImWchar)c;\n        callback_data.Flags = flags;\n        callback_data.UserData = user_data;\n        if (callback(&callback_data) != 0)\n            return false;\n        *p_char = callback_data.EventChar;\n        if (!callback_data.EventChar)\n            return false;\n    }\n\n    return true;\n}\n\n// Edit a string of text\n// - buf_size account for the zero-terminator, so a buf_size of 6 can hold \"Hello\" but not \"Hello!\".\n//   This is so we can easily call InputText() on static arrays using ARRAYSIZE() and to match\n//   Note that in std::string world, capacity() would omit 1 byte used by the zero-terminator.\n// - When active, hold on a privately held copy of the text (and apply back to 'buf'). So changing 'buf' while the InputText is active has no effect.\n// - If you want to use ImGui::InputText() with std::string, see misc/cpp/imgui_stdlib.h\n// (FIXME: Rather confusing and messy function, among the worse part of our codebase, expecting to rewrite a V2 at some point.. Partly because we are\n//  doing UTF8 > U16 > UTF8 conversions on the go to easily interface with stb_textedit. Ideally should stay in UTF-8 all the time. See https://github.com/nothings/stb/issues/188)\nbool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_size, const ImVec2& size_arg, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* callback_user_data)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return false;\n\n    IM_ASSERT(buf != NULL && buf_size >= 0);\n    IM_ASSERT(!((flags & ImGuiInputTextFlags_CallbackHistory) && (flags & ImGuiInputTextFlags_Multiline)));        // Can't use both together (they both use up/down keys)\n    IM_ASSERT(!((flags & ImGuiInputTextFlags_CallbackCompletion) && (flags & ImGuiInputTextFlags_AllowTabInput))); // Can't use both together (they both use tab key)\n\n    ImGuiContext& g = *GImGui;\n    ImGuiIO& io = g.IO;\n    const ImGuiStyle& style = g.Style;\n\n    const bool RENDER_SELECTION_WHEN_INACTIVE = false;\n    const bool is_multiline = (flags & ImGuiInputTextFlags_Multiline) != 0;\n    const bool is_readonly = (flags & ImGuiInputTextFlags_ReadOnly) != 0;\n    const bool is_password = (flags & ImGuiInputTextFlags_Password) != 0;\n    const bool is_undoable = (flags & ImGuiInputTextFlags_NoUndoRedo) == 0;\n    const bool is_resizable = (flags & ImGuiInputTextFlags_CallbackResize) != 0;\n    if (is_resizable)\n        IM_ASSERT(callback != NULL); // Must provide a callback if you set the ImGuiInputTextFlags_CallbackResize flag!\n\n    if (is_multiline) // Open group before calling GetID() because groups tracks id created within their scope,\n        BeginGroup();\n    const ImGuiID id = window->GetID(label);\n    const ImVec2 label_size = CalcTextSize(label, NULL, true);\n    const ImVec2 frame_size = CalcItemSize(size_arg, CalcItemWidth(), (is_multiline ? g.FontSize * 8.0f : label_size.y) + style.FramePadding.y * 2.0f); // Arbitrary default of 8 lines high for multi-line\n    const ImVec2 total_size = ImVec2(frame_size.x + (label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f), frame_size.y);\n\n    const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + frame_size);\n    const ImRect total_bb(frame_bb.Min, frame_bb.Min + total_size);\n\n    ImGuiWindow* draw_window = window;\n    ImVec2 inner_size = frame_size;\n    ImGuiItemStatusFlags item_status_flags = 0;\n    if (is_multiline)\n    {\n        if (!ItemAdd(total_bb, id, &frame_bb, ImGuiItemAddFlags_Focusable))\n        {\n            ItemSize(total_bb, style.FramePadding.y);\n            EndGroup();\n            return false;\n        }\n        item_status_flags = g.LastItemData.StatusFlags;\n\n        // We reproduce the contents of BeginChildFrame() in order to provide 'label' so our window internal data are easier to read/debug.\n        PushStyleColor(ImGuiCol_ChildBg, style.Colors[ImGuiCol_FrameBg]);\n        PushStyleVar(ImGuiStyleVar_ChildRounding, style.FrameRounding);\n        PushStyleVar(ImGuiStyleVar_ChildBorderSize, style.FrameBorderSize);\n        bool child_visible = BeginChildEx(label, id, frame_bb.GetSize(), true, ImGuiWindowFlags_NoMove);\n        PopStyleVar(2);\n        PopStyleColor();\n        if (!child_visible)\n        {\n            EndChild();\n            EndGroup();\n            return false;\n        }\n        draw_window = g.CurrentWindow; // Child window\n        draw_window->DC.NavLayersActiveMaskNext |= (1 << draw_window->DC.NavLayerCurrent); // This is to ensure that EndChild() will display a navigation highlight so we can \"enter\" into it.\n        draw_window->DC.CursorPos += style.FramePadding;\n        inner_size.x -= draw_window->ScrollbarSizes.x;\n    }\n    else\n    {\n        // Support for internal ImGuiInputTextFlags_MergedItem flag, which could be redesigned as an ItemFlags if needed (with test performed in ItemAdd)\n        ItemSize(total_bb, style.FramePadding.y);\n        if (!(flags & ImGuiInputTextFlags_MergedItem))\n            if (!ItemAdd(total_bb, id, &frame_bb, ImGuiItemAddFlags_Focusable))\n                return false;\n        item_status_flags = g.LastItemData.StatusFlags;\n    }\n    const bool hovered = ItemHoverable(frame_bb, id);\n    if (hovered)\n        g.MouseCursor = ImGuiMouseCursor_TextInput;\n\n    // We are only allowed to access the state if we are already the active widget.\n    ImGuiInputTextState* state = GetInputTextState(id);\n\n    const bool focus_requested_by_code = (item_status_flags & ImGuiItemStatusFlags_FocusedByCode) != 0;\n    const bool focus_requested_by_tabbing = (item_status_flags & ImGuiItemStatusFlags_FocusedByTabbing) != 0;\n\n    const bool user_clicked = hovered && io.MouseClicked[0];\n    const bool user_nav_input_start = (g.ActiveId != id) && ((g.NavInputId == id) || (g.NavActivateId == id && g.NavInputSource == ImGuiInputSource_Keyboard));\n    const bool user_scroll_finish = is_multiline && state != NULL && g.ActiveId == 0 && g.ActiveIdPreviousFrame == GetWindowScrollbarID(draw_window, ImGuiAxis_Y);\n    const bool user_scroll_active = is_multiline && state != NULL && g.ActiveId == GetWindowScrollbarID(draw_window, ImGuiAxis_Y);\n\n    bool clear_active_id = false;\n    bool select_all = (g.ActiveId != id) && ((flags & ImGuiInputTextFlags_AutoSelectAll) != 0 || user_nav_input_start) && (!is_multiline);\n\n    float scroll_y = is_multiline ? draw_window->Scroll.y : FLT_MAX;\n\n    const bool init_changed_specs = (state != NULL && state->Stb.single_line != !is_multiline);\n    const bool init_make_active = (user_clicked || user_scroll_finish || user_nav_input_start || focus_requested_by_code || focus_requested_by_tabbing);\n    const bool init_state = (init_make_active || user_scroll_active);\n    if ((init_state && g.ActiveId != id) || init_changed_specs)\n    {\n        // Access state even if we don't own it yet.\n        state = &g.InputTextState;\n        state->CursorAnimReset();\n\n        // Take a copy of the initial buffer value (both in original UTF-8 format and converted to wchar)\n        // From the moment we focused we are ignoring the content of 'buf' (unless we are in read-only mode)\n        const int buf_len = (int)strlen(buf);\n        state->InitialTextA.resize(buf_len + 1);    // UTF-8. we use +1 to make sure that .Data is always pointing to at least an empty string.\n        memcpy(state->InitialTextA.Data, buf, buf_len + 1);\n\n        // Start edition\n        const char* buf_end = NULL;\n        state->TextW.resize(buf_size + 1);          // wchar count <= UTF-8 count. we use +1 to make sure that .Data is always pointing to at least an empty string.\n        state->TextA.resize(0);\n        state->TextAIsValid = false;                // TextA is not valid yet (we will display buf until then)\n        state->CurLenW = ImTextStrFromUtf8(state->TextW.Data, buf_size, buf, NULL, &buf_end);\n        state->CurLenA = (int)(buf_end - buf);      // We can't get the result from ImStrncpy() above because it is not UTF-8 aware. Here we'll cut off malformed UTF-8.\n\n        // Preserve cursor position and undo/redo stack if we come back to same widget\n        // FIXME: For non-readonly widgets we might be able to require that TextAIsValid && TextA == buf ? (untested) and discard undo stack if user buffer has changed.\n        const bool recycle_state = (state->ID == id && !init_changed_specs);\n        if (recycle_state)\n        {\n            // Recycle existing cursor/selection/undo stack but clamp position\n            // Note a single mouse click will override the cursor/position immediately by calling stb_textedit_click handler.\n            state->CursorClamp();\n        }\n        else\n        {\n            state->ID = id;\n            state->ScrollX = 0.0f;\n            stb_textedit_initialize_state(&state->Stb, !is_multiline);\n            if (!is_multiline && focus_requested_by_code)\n                select_all = true;\n        }\n        if (flags & ImGuiInputTextFlags_AlwaysOverwrite)\n            state->Stb.insert_mode = 1; // stb field name is indeed incorrect (see #2863)\n        if (!is_multiline && (focus_requested_by_tabbing || (user_clicked && io.KeyCtrl)))\n            select_all = true;\n    }\n\n    if (g.ActiveId != id && init_make_active)\n    {\n        IM_ASSERT(state && state->ID == id);\n        SetActiveID(id, window);\n        SetFocusID(id, window);\n        FocusWindow(window);\n\n        // Declare our inputs\n        IM_ASSERT(ImGuiNavInput_COUNT < 32);\n        g.ActiveIdUsingNavDirMask |= (1 << ImGuiDir_Left) | (1 << ImGuiDir_Right);\n        if (is_multiline || (flags & ImGuiInputTextFlags_CallbackHistory))\n            g.ActiveIdUsingNavDirMask |= (1 << ImGuiDir_Up) | (1 << ImGuiDir_Down);\n        g.ActiveIdUsingNavInputMask |= (1 << ImGuiNavInput_Cancel);\n        g.ActiveIdUsingKeyInputMask |= ((ImU64)1 << ImGuiKey_Home) | ((ImU64)1 << ImGuiKey_End);\n        if (is_multiline)\n            g.ActiveIdUsingKeyInputMask |= ((ImU64)1 << ImGuiKey_PageUp) | ((ImU64)1 << ImGuiKey_PageDown);\n        if (flags & (ImGuiInputTextFlags_CallbackCompletion | ImGuiInputTextFlags_AllowTabInput))  // Disable keyboard tabbing out as we will use the \\t character.\n            g.ActiveIdUsingKeyInputMask |= ((ImU64)1 << ImGuiKey_Tab);\n    }\n\n    // We have an edge case if ActiveId was set through another widget (e.g. widget being swapped), clear id immediately (don't wait until the end of the function)\n    if (g.ActiveId == id && state == NULL)\n        ClearActiveID();\n\n    // Release focus when we click outside\n    if (g.ActiveId == id && io.MouseClicked[0] && !init_state && !init_make_active) //-V560\n        clear_active_id = true;\n\n    // Lock the decision of whether we are going to take the path displaying the cursor or selection\n    const bool render_cursor = (g.ActiveId == id) || (state && user_scroll_active);\n    bool render_selection = state && state->HasSelection() && (RENDER_SELECTION_WHEN_INACTIVE || render_cursor);\n    bool value_changed = false;\n    bool enter_pressed = false;\n\n    // When read-only we always use the live data passed to the function\n    // FIXME-OPT: Because our selection/cursor code currently needs the wide text we need to convert it when active, which is not ideal :(\n    if (is_readonly && state != NULL && (render_cursor || render_selection))\n    {\n        const char* buf_end = NULL;\n        state->TextW.resize(buf_size + 1);\n        state->CurLenW = ImTextStrFromUtf8(state->TextW.Data, state->TextW.Size, buf, NULL, &buf_end);\n        state->CurLenA = (int)(buf_end - buf);\n        state->CursorClamp();\n        render_selection &= state->HasSelection();\n    }\n\n    // Select the buffer to render.\n    const bool buf_display_from_state = (render_cursor || render_selection || g.ActiveId == id) && !is_readonly && state && state->TextAIsValid;\n    const bool is_displaying_hint = (hint != NULL && (buf_display_from_state ? state->TextA.Data : buf)[0] == 0);\n\n    // Password pushes a temporary font with only a fallback glyph\n    if (is_password && !is_displaying_hint)\n    {\n        const ImFontGlyph* glyph = g.Font->FindGlyph('*');\n        ImFont* password_font = &g.InputTextPasswordFont;\n        password_font->FontSize = g.Font->FontSize;\n        password_font->Scale = g.Font->Scale;\n        password_font->Ascent = g.Font->Ascent;\n        password_font->Descent = g.Font->Descent;\n        password_font->ContainerAtlas = g.Font->ContainerAtlas;\n        password_font->FallbackGlyph = glyph;\n        password_font->FallbackAdvanceX = glyph->AdvanceX;\n        IM_ASSERT(password_font->Glyphs.empty() && password_font->IndexAdvanceX.empty() && password_font->IndexLookup.empty());\n        PushFont(password_font);\n    }\n\n    // Process mouse inputs and character inputs\n    int backup_current_text_length = 0;\n    if (g.ActiveId == id)\n    {\n        IM_ASSERT(state != NULL);\n        backup_current_text_length = state->CurLenA;\n        state->Edited = false;\n        state->BufCapacityA = buf_size;\n        state->Flags = flags;\n        state->UserCallback = callback;\n        state->UserCallbackData = callback_user_data;\n\n        // Although we are active we don't prevent mouse from hovering other elements unless we are interacting right now with the widget.\n        // Down the line we should have a cleaner library-wide concept of Selected vs Active.\n        g.ActiveIdAllowOverlap = !io.MouseDown[0];\n        g.WantTextInputNextFrame = 1;\n\n        // Edit in progress\n        const float mouse_x = (io.MousePos.x - frame_bb.Min.x - style.FramePadding.x) + state->ScrollX;\n        const float mouse_y = (is_multiline ? (io.MousePos.y - draw_window->DC.CursorPos.y) : (g.FontSize * 0.5f));\n\n        const bool is_osx = io.ConfigMacOSXBehaviors;\n        if (select_all || (hovered && !is_osx && io.MouseDoubleClicked[0]))\n        {\n            state->SelectAll();\n            state->SelectedAllMouseLock = true;\n        }\n        else if (hovered && is_osx && io.MouseDoubleClicked[0])\n        {\n            // Double-click select a word only, OS X style (by simulating keystrokes)\n            state->OnKeyPressed(STB_TEXTEDIT_K_WORDLEFT);\n            state->OnKeyPressed(STB_TEXTEDIT_K_WORDRIGHT | STB_TEXTEDIT_K_SHIFT);\n        }\n        else if (io.MouseClicked[0] && !state->SelectedAllMouseLock)\n        {\n            if (hovered)\n            {\n                stb_textedit_click(state, &state->Stb, mouse_x, mouse_y);\n                state->CursorAnimReset();\n            }\n        }\n        else if (io.MouseDown[0] && !state->SelectedAllMouseLock && (io.MouseDelta.x != 0.0f || io.MouseDelta.y != 0.0f))\n        {\n            stb_textedit_drag(state, &state->Stb, mouse_x, mouse_y);\n            state->CursorAnimReset();\n            state->CursorFollow = true;\n        }\n        if (state->SelectedAllMouseLock && !io.MouseDown[0])\n            state->SelectedAllMouseLock = false;\n\n        // It is ill-defined whether the backend needs to send a \\t character when pressing the TAB keys.\n        // Win32 and GLFW naturally do it but not SDL.\n        const bool ignore_char_inputs = (io.KeyCtrl && !io.KeyAlt) || (is_osx && io.KeySuper);\n        if ((flags & ImGuiInputTextFlags_AllowTabInput) && IsKeyPressedMap(ImGuiKey_Tab) && !ignore_char_inputs && !io.KeyShift && !is_readonly)\n            if (!io.InputQueueCharacters.contains('\\t'))\n            {\n                unsigned int c = '\\t'; // Insert TAB\n                if (InputTextFilterCharacter(&c, flags, callback, callback_user_data, ImGuiInputSource_Keyboard))\n                    state->OnKeyPressed((int)c);\n            }\n\n        // Process regular text input (before we check for Return because using some IME will effectively send a Return?)\n        // We ignore CTRL inputs, but need to allow ALT+CTRL as some keyboards (e.g. German) use AltGR (which _is_ Alt+Ctrl) to input certain characters.\n        if (io.InputQueueCharacters.Size > 0)\n        {\n            if (!ignore_char_inputs && !is_readonly && !user_nav_input_start)\n                for (int n = 0; n < io.InputQueueCharacters.Size; n++)\n                {\n                    // Insert character if they pass filtering\n                    unsigned int c = (unsigned int)io.InputQueueCharacters[n];\n                    if (c == '\\t' && io.KeyShift)\n                        continue;\n                    if (InputTextFilterCharacter(&c, flags, callback, callback_user_data, ImGuiInputSource_Keyboard))\n                        state->OnKeyPressed((int)c);\n                }\n\n            // Consume characters\n            io.InputQueueCharacters.resize(0);\n        }\n    }\n\n    // Process other shortcuts/key-presses\n    bool cancel_edit = false;\n    if (g.ActiveId == id && !g.ActiveIdIsJustActivated && !clear_active_id)\n    {\n        IM_ASSERT(state != NULL);\n        IM_ASSERT(io.KeyMods == GetMergedKeyModFlags() && \"Mismatching io.KeyCtrl/io.KeyShift/io.KeyAlt/io.KeySuper vs io.KeyMods\"); // We rarely do this check, but if anything let's do it here.\n\n        const int row_count_per_page = ImMax((int)((inner_size.y - style.FramePadding.y) / g.FontSize), 1);\n        state->Stb.row_count_per_page = row_count_per_page;\n\n        const int k_mask = (io.KeyShift ? STB_TEXTEDIT_K_SHIFT : 0);\n        const bool is_osx = io.ConfigMacOSXBehaviors;\n        const bool is_osx_shift_shortcut = is_osx && (io.KeyMods == (ImGuiKeyModFlags_Super | ImGuiKeyModFlags_Shift));\n        const bool is_wordmove_key_down = is_osx ? io.KeyAlt : io.KeyCtrl;                     // OS X style: Text editing cursor movement using Alt instead of Ctrl\n        const bool is_startend_key_down = is_osx && io.KeySuper && !io.KeyCtrl && !io.KeyAlt;  // OS X style: Line/Text Start and End using Cmd+Arrows instead of Home/End\n        const bool is_ctrl_key_only = (io.KeyMods == ImGuiKeyModFlags_Ctrl);\n        const bool is_shift_key_only = (io.KeyMods == ImGuiKeyModFlags_Shift);\n        const bool is_shortcut_key = g.IO.ConfigMacOSXBehaviors ? (io.KeyMods == ImGuiKeyModFlags_Super) : (io.KeyMods == ImGuiKeyModFlags_Ctrl);\n\n        const bool is_cut   = ((is_shortcut_key && IsKeyPressedMap(ImGuiKey_X)) || (is_shift_key_only && IsKeyPressedMap(ImGuiKey_Delete))) && !is_readonly && !is_password && (!is_multiline || state->HasSelection());\n        const bool is_copy  = ((is_shortcut_key && IsKeyPressedMap(ImGuiKey_C)) || (is_ctrl_key_only  && IsKeyPressedMap(ImGuiKey_Insert))) && !is_password && (!is_multiline || state->HasSelection());\n        const bool is_paste = ((is_shortcut_key && IsKeyPressedMap(ImGuiKey_V)) || (is_shift_key_only && IsKeyPressedMap(ImGuiKey_Insert))) && !is_readonly;\n        const bool is_undo  = ((is_shortcut_key && IsKeyPressedMap(ImGuiKey_Z)) && !is_readonly && is_undoable);\n        const bool is_redo  = ((is_shortcut_key && IsKeyPressedMap(ImGuiKey_Y)) || (is_osx_shift_shortcut && IsKeyPressedMap(ImGuiKey_Z))) && !is_readonly && is_undoable;\n\n        if (IsKeyPressedMap(ImGuiKey_LeftArrow))                        { state->OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_LINESTART : is_wordmove_key_down ? STB_TEXTEDIT_K_WORDLEFT : STB_TEXTEDIT_K_LEFT) | k_mask); }\n        else if (IsKeyPressedMap(ImGuiKey_RightArrow))                  { state->OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_LINEEND : is_wordmove_key_down ? STB_TEXTEDIT_K_WORDRIGHT : STB_TEXTEDIT_K_RIGHT) | k_mask); }\n        else if (IsKeyPressedMap(ImGuiKey_UpArrow) && is_multiline)     { if (io.KeyCtrl) SetScrollY(draw_window, ImMax(draw_window->Scroll.y - g.FontSize, 0.0f)); else state->OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_TEXTSTART : STB_TEXTEDIT_K_UP) | k_mask); }\n        else if (IsKeyPressedMap(ImGuiKey_DownArrow) && is_multiline)   { if (io.KeyCtrl) SetScrollY(draw_window, ImMin(draw_window->Scroll.y + g.FontSize, GetScrollMaxY())); else state->OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_TEXTEND : STB_TEXTEDIT_K_DOWN) | k_mask); }\n        else if (IsKeyPressedMap(ImGuiKey_PageUp) && is_multiline)      { state->OnKeyPressed(STB_TEXTEDIT_K_PGUP | k_mask); scroll_y -= row_count_per_page * g.FontSize; }\n        else if (IsKeyPressedMap(ImGuiKey_PageDown) && is_multiline)    { state->OnKeyPressed(STB_TEXTEDIT_K_PGDOWN | k_mask); scroll_y += row_count_per_page * g.FontSize; }\n        else if (IsKeyPressedMap(ImGuiKey_Home))                        { state->OnKeyPressed(io.KeyCtrl ? STB_TEXTEDIT_K_TEXTSTART | k_mask : STB_TEXTEDIT_K_LINESTART | k_mask); }\n        else if (IsKeyPressedMap(ImGuiKey_End))                         { state->OnKeyPressed(io.KeyCtrl ? STB_TEXTEDIT_K_TEXTEND | k_mask : STB_TEXTEDIT_K_LINEEND | k_mask); }\n        else if (IsKeyPressedMap(ImGuiKey_Delete) && !is_readonly)      { state->OnKeyPressed(STB_TEXTEDIT_K_DELETE | k_mask); }\n        else if (IsKeyPressedMap(ImGuiKey_Backspace) && !is_readonly)\n        {\n            if (!state->HasSelection())\n            {\n                if (is_wordmove_key_down)\n                    state->OnKeyPressed(STB_TEXTEDIT_K_WORDLEFT | STB_TEXTEDIT_K_SHIFT);\n                else if (is_osx && io.KeySuper && !io.KeyAlt && !io.KeyCtrl)\n                    state->OnKeyPressed(STB_TEXTEDIT_K_LINESTART | STB_TEXTEDIT_K_SHIFT);\n            }\n            state->OnKeyPressed(STB_TEXTEDIT_K_BACKSPACE | k_mask);\n        }\n        else if (IsKeyPressedMap(ImGuiKey_Enter) || IsKeyPressedMap(ImGuiKey_KeyPadEnter))\n        {\n            bool ctrl_enter_for_new_line = (flags & ImGuiInputTextFlags_CtrlEnterForNewLine) != 0;\n            if (!is_multiline || (ctrl_enter_for_new_line && !io.KeyCtrl) || (!ctrl_enter_for_new_line && io.KeyCtrl))\n            {\n                enter_pressed = clear_active_id = true;\n            }\n            else if (!is_readonly)\n            {\n                unsigned int c = '\\n'; // Insert new line\n                if (InputTextFilterCharacter(&c, flags, callback, callback_user_data, ImGuiInputSource_Keyboard))\n                    state->OnKeyPressed((int)c);\n            }\n        }\n        else if (IsKeyPressedMap(ImGuiKey_Escape))\n        {\n            clear_active_id = cancel_edit = true;\n        }\n        else if (is_undo || is_redo)\n        {\n            state->OnKeyPressed(is_undo ? STB_TEXTEDIT_K_UNDO : STB_TEXTEDIT_K_REDO);\n            state->ClearSelection();\n        }\n        else if (is_shortcut_key && IsKeyPressedMap(ImGuiKey_A))\n        {\n            state->SelectAll();\n            state->CursorFollow = true;\n        }\n        else if (is_cut || is_copy)\n        {\n            // Cut, Copy\n            if (io.SetClipboardTextFn)\n            {\n                const int ib = state->HasSelection() ? ImMin(state->Stb.select_start, state->Stb.select_end) : 0;\n                const int ie = state->HasSelection() ? ImMax(state->Stb.select_start, state->Stb.select_end) : state->CurLenW;\n                const int clipboard_data_len = ImTextCountUtf8BytesFromStr(state->TextW.Data + ib, state->TextW.Data + ie) + 1;\n                char* clipboard_data = (char*)IM_ALLOC(clipboard_data_len * sizeof(char));\n                ImTextStrToUtf8(clipboard_data, clipboard_data_len, state->TextW.Data + ib, state->TextW.Data + ie);\n                SetClipboardText(clipboard_data);\n                MemFree(clipboard_data);\n            }\n            if (is_cut)\n            {\n                if (!state->HasSelection())\n                    state->SelectAll();\n                state->CursorFollow = true;\n                stb_textedit_cut(state, &state->Stb);\n            }\n        }\n        else if (is_paste)\n        {\n            if (const char* clipboard = GetClipboardText())\n            {\n                // Filter pasted buffer\n                const int clipboard_len = (int)strlen(clipboard);\n                ImWchar* clipboard_filtered = (ImWchar*)IM_ALLOC((clipboard_len + 1) * sizeof(ImWchar));\n                int clipboard_filtered_len = 0;\n                for (const char* s = clipboard; *s; )\n                {\n                    unsigned int c;\n                    s += ImTextCharFromUtf8(&c, s, NULL);\n                    if (c == 0)\n                        break;\n                    if (!InputTextFilterCharacter(&c, flags, callback, callback_user_data, ImGuiInputSource_Clipboard))\n                        continue;\n                    clipboard_filtered[clipboard_filtered_len++] = (ImWchar)c;\n                }\n                clipboard_filtered[clipboard_filtered_len] = 0;\n                if (clipboard_filtered_len > 0) // If everything was filtered, ignore the pasting operation\n                {\n                    stb_textedit_paste(state, &state->Stb, clipboard_filtered, clipboard_filtered_len);\n                    state->CursorFollow = true;\n                }\n                MemFree(clipboard_filtered);\n            }\n        }\n\n        // Update render selection flag after events have been handled, so selection highlight can be displayed during the same frame.\n        render_selection |= state->HasSelection() && (RENDER_SELECTION_WHEN_INACTIVE || render_cursor);\n    }\n\n    // Process callbacks and apply result back to user's buffer.\n    if (g.ActiveId == id)\n    {\n        IM_ASSERT(state != NULL);\n        const char* apply_new_text = NULL;\n        int apply_new_text_length = 0;\n        if (cancel_edit)\n        {\n            // Restore initial value. Only return true if restoring to the initial value changes the current buffer contents.\n            if (!is_readonly && strcmp(buf, state->InitialTextA.Data) != 0)\n            {\n                // Push records into the undo stack so we can CTRL+Z the revert operation itself\n                apply_new_text = state->InitialTextA.Data;\n                apply_new_text_length = state->InitialTextA.Size - 1;\n                ImVector<ImWchar> w_text;\n                if (apply_new_text_length > 0)\n                {\n                    w_text.resize(ImTextCountCharsFromUtf8(apply_new_text, apply_new_text + apply_new_text_length) + 1);\n                    ImTextStrFromUtf8(w_text.Data, w_text.Size, apply_new_text, apply_new_text + apply_new_text_length);\n                }\n                stb_textedit_replace(state, &state->Stb, w_text.Data, (apply_new_text_length > 0) ? (w_text.Size - 1) : 0);\n            }\n        }\n\n        // When using 'ImGuiInputTextFlags_EnterReturnsTrue' as a special case we reapply the live buffer back to the input buffer before clearing ActiveId, even though strictly speaking it wasn't modified on this frame.\n        // If we didn't do that, code like InputInt() with ImGuiInputTextFlags_EnterReturnsTrue would fail.\n        // This also allows the user to use InputText() with ImGuiInputTextFlags_EnterReturnsTrue without maintaining any user-side storage (please note that if you use this property along ImGuiInputTextFlags_CallbackResize you can end up with your temporary string object unnecessarily allocating once a frame, either store your string data, either if you don't then don't use ImGuiInputTextFlags_CallbackResize).\n        bool apply_edit_back_to_user_buffer = !cancel_edit || (enter_pressed && (flags & ImGuiInputTextFlags_EnterReturnsTrue) != 0);\n        if (apply_edit_back_to_user_buffer)\n        {\n            // Apply new value immediately - copy modified buffer back\n            // Note that as soon as the input box is active, the in-widget value gets priority over any underlying modification of the input buffer\n            // FIXME: We actually always render 'buf' when calling DrawList->AddText, making the comment above incorrect.\n            // FIXME-OPT: CPU waste to do this every time the widget is active, should mark dirty state from the stb_textedit callbacks.\n            if (!is_readonly)\n            {\n                state->TextAIsValid = true;\n                state->TextA.resize(state->TextW.Size * 4 + 1);\n                ImTextStrToUtf8(state->TextA.Data, state->TextA.Size, state->TextW.Data, NULL);\n            }\n\n            // User callback\n            if ((flags & (ImGuiInputTextFlags_CallbackCompletion | ImGuiInputTextFlags_CallbackHistory | ImGuiInputTextFlags_CallbackEdit | ImGuiInputTextFlags_CallbackAlways)) != 0)\n            {\n                IM_ASSERT(callback != NULL);\n\n                // The reason we specify the usage semantic (Completion/History) is that Completion needs to disable keyboard TABBING at the moment.\n                ImGuiInputTextFlags event_flag = 0;\n                ImGuiKey event_key = ImGuiKey_COUNT;\n                if ((flags & ImGuiInputTextFlags_CallbackCompletion) != 0 && IsKeyPressedMap(ImGuiKey_Tab))\n                {\n                    event_flag = ImGuiInputTextFlags_CallbackCompletion;\n                    event_key = ImGuiKey_Tab;\n                }\n                else if ((flags & ImGuiInputTextFlags_CallbackHistory) != 0 && IsKeyPressedMap(ImGuiKey_UpArrow))\n                {\n                    event_flag = ImGuiInputTextFlags_CallbackHistory;\n                    event_key = ImGuiKey_UpArrow;\n                }\n                else if ((flags & ImGuiInputTextFlags_CallbackHistory) != 0 && IsKeyPressedMap(ImGuiKey_DownArrow))\n                {\n                    event_flag = ImGuiInputTextFlags_CallbackHistory;\n                    event_key = ImGuiKey_DownArrow;\n                }\n                else if ((flags & ImGuiInputTextFlags_CallbackEdit) && state->Edited)\n                {\n                    event_flag = ImGuiInputTextFlags_CallbackEdit;\n                }\n                else if (flags & ImGuiInputTextFlags_CallbackAlways)\n                {\n                    event_flag = ImGuiInputTextFlags_CallbackAlways;\n                }\n\n                if (event_flag)\n                {\n                    ImGuiInputTextCallbackData callback_data;\n                    memset(&callback_data, 0, sizeof(ImGuiInputTextCallbackData));\n                    callback_data.EventFlag = event_flag;\n                    callback_data.Flags = flags;\n                    callback_data.UserData = callback_user_data;\n\n                    callback_data.EventKey = event_key;\n                    callback_data.Buf = state->TextA.Data;\n                    callback_data.BufTextLen = state->CurLenA;\n                    callback_data.BufSize = state->BufCapacityA;\n                    callback_data.BufDirty = false;\n\n                    // We have to convert from wchar-positions to UTF-8-positions, which can be pretty slow (an incentive to ditch the ImWchar buffer, see https://github.com/nothings/stb/issues/188)\n                    ImWchar* text = state->TextW.Data;\n                    const int utf8_cursor_pos = callback_data.CursorPos = ImTextCountUtf8BytesFromStr(text, text + state->Stb.cursor);\n                    const int utf8_selection_start = callback_data.SelectionStart = ImTextCountUtf8BytesFromStr(text, text + state->Stb.select_start);\n                    const int utf8_selection_end = callback_data.SelectionEnd = ImTextCountUtf8BytesFromStr(text, text + state->Stb.select_end);\n\n                    // Call user code\n                    callback(&callback_data);\n\n                    // Read back what user may have modified\n                    IM_ASSERT(callback_data.Buf == state->TextA.Data);  // Invalid to modify those fields\n                    IM_ASSERT(callback_data.BufSize == state->BufCapacityA);\n                    IM_ASSERT(callback_data.Flags == flags);\n                    const bool buf_dirty = callback_data.BufDirty;\n                    if (callback_data.CursorPos != utf8_cursor_pos || buf_dirty)            { state->Stb.cursor = ImTextCountCharsFromUtf8(callback_data.Buf, callback_data.Buf + callback_data.CursorPos); state->CursorFollow = true; }\n                    if (callback_data.SelectionStart != utf8_selection_start || buf_dirty)  { state->Stb.select_start = (callback_data.SelectionStart == callback_data.CursorPos) ? state->Stb.cursor : ImTextCountCharsFromUtf8(callback_data.Buf, callback_data.Buf + callback_data.SelectionStart); }\n                    if (callback_data.SelectionEnd != utf8_selection_end || buf_dirty)      { state->Stb.select_end = (callback_data.SelectionEnd == callback_data.SelectionStart) ? state->Stb.select_start : ImTextCountCharsFromUtf8(callback_data.Buf, callback_data.Buf + callback_data.SelectionEnd); }\n                    if (buf_dirty)\n                    {\n                        IM_ASSERT(callback_data.BufTextLen == (int)strlen(callback_data.Buf)); // You need to maintain BufTextLen if you change the text!\n                        if (callback_data.BufTextLen > backup_current_text_length && is_resizable)\n                            state->TextW.resize(state->TextW.Size + (callback_data.BufTextLen - backup_current_text_length));\n                        state->CurLenW = ImTextStrFromUtf8(state->TextW.Data, state->TextW.Size, callback_data.Buf, NULL);\n                        state->CurLenA = callback_data.BufTextLen;  // Assume correct length and valid UTF-8 from user, saves us an extra strlen()\n                        state->CursorAnimReset();\n                    }\n                }\n            }\n\n            // Will copy result string if modified\n            if (!is_readonly && strcmp(state->TextA.Data, buf) != 0)\n            {\n                apply_new_text = state->TextA.Data;\n                apply_new_text_length = state->CurLenA;\n            }\n        }\n\n        // Copy result to user buffer\n        if (apply_new_text)\n        {\n            // We cannot test for 'backup_current_text_length != apply_new_text_length' here because we have no guarantee that the size\n            // of our owned buffer matches the size of the string object held by the user, and by design we allow InputText() to be used\n            // without any storage on user's side.\n            IM_ASSERT(apply_new_text_length >= 0);\n            if (is_resizable)\n            {\n                ImGuiInputTextCallbackData callback_data;\n                callback_data.EventFlag = ImGuiInputTextFlags_CallbackResize;\n                callback_data.Flags = flags;\n                callback_data.Buf = buf;\n                callback_data.BufTextLen = apply_new_text_length;\n                callback_data.BufSize = ImMax(buf_size, apply_new_text_length + 1);\n                callback_data.UserData = callback_user_data;\n                callback(&callback_data);\n                buf = callback_data.Buf;\n                buf_size = callback_data.BufSize;\n                apply_new_text_length = ImMin(callback_data.BufTextLen, buf_size - 1);\n                IM_ASSERT(apply_new_text_length <= buf_size);\n            }\n            //IMGUI_DEBUG_LOG(\"InputText(\\\"%s\\\"): apply_new_text length %d\\n\", label, apply_new_text_length);\n\n            // If the underlying buffer resize was denied or not carried to the next frame, apply_new_text_length+1 may be >= buf_size.\n            ImStrncpy(buf, apply_new_text, ImMin(apply_new_text_length + 1, buf_size));\n            value_changed = true;\n        }\n\n        // Clear temporary user storage\n        state->Flags = ImGuiInputTextFlags_None;\n        state->UserCallback = NULL;\n        state->UserCallbackData = NULL;\n    }\n\n    // Release active ID at the end of the function (so e.g. pressing Return still does a final application of the value)\n    if (clear_active_id && g.ActiveId == id)\n        ClearActiveID();\n\n    // Render frame\n    if (!is_multiline)\n    {\n        RenderNavHighlight(frame_bb, id);\n        RenderFrame(frame_bb.Min, frame_bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding);\n    }\n\n    const ImVec4 clip_rect(frame_bb.Min.x, frame_bb.Min.y, frame_bb.Min.x + inner_size.x, frame_bb.Min.y + inner_size.y); // Not using frame_bb.Max because we have adjusted size\n    ImVec2 draw_pos = is_multiline ? draw_window->DC.CursorPos : frame_bb.Min + style.FramePadding;\n    ImVec2 text_size(0.0f, 0.0f);\n\n    // Set upper limit of single-line InputTextEx() at 2 million characters strings. The current pathological worst case is a long line\n    // without any carriage return, which would makes ImFont::RenderText() reserve too many vertices and probably crash. Avoid it altogether.\n    // Note that we only use this limit on single-line InputText(), so a pathologically large line on a InputTextMultiline() would still crash.\n    const int buf_display_max_length = 2 * 1024 * 1024;\n    const char* buf_display = buf_display_from_state ? state->TextA.Data : buf; //-V595\n    const char* buf_display_end = NULL; // We have specialized paths below for setting the length\n    if (is_displaying_hint)\n    {\n        buf_display = hint;\n        buf_display_end = hint + strlen(hint);\n    }\n\n    // Render text. We currently only render selection when the widget is active or while scrolling.\n    // FIXME: We could remove the '&& render_cursor' to keep rendering selection when inactive.\n    if (render_cursor || render_selection)\n    {\n        IM_ASSERT(state != NULL);\n        if (!is_displaying_hint)\n            buf_display_end = buf_display + state->CurLenA;\n\n        // Render text (with cursor and selection)\n        // This is going to be messy. We need to:\n        // - Display the text (this alone can be more easily clipped)\n        // - Handle scrolling, highlight selection, display cursor (those all requires some form of 1d->2d cursor position calculation)\n        // - Measure text height (for scrollbar)\n        // We are attempting to do most of that in **one main pass** to minimize the computation cost (non-negligible for large amount of text) + 2nd pass for selection rendering (we could merge them by an extra refactoring effort)\n        // FIXME: This should occur on buf_display but we'd need to maintain cursor/select_start/select_end for UTF-8.\n        const ImWchar* text_begin = state->TextW.Data;\n        ImVec2 cursor_offset, select_start_offset;\n\n        {\n            // Find lines numbers straddling 'cursor' (slot 0) and 'select_start' (slot 1) positions.\n            const ImWchar* searches_input_ptr[2] = { NULL, NULL };\n            int searches_result_line_no[2] = { -1000, -1000 };\n            int searches_remaining = 0;\n            if (render_cursor)\n            {\n                searches_input_ptr[0] = text_begin + state->Stb.cursor;\n                searches_result_line_no[0] = -1;\n                searches_remaining++;\n            }\n            if (render_selection)\n            {\n                searches_input_ptr[1] = text_begin + ImMin(state->Stb.select_start, state->Stb.select_end);\n                searches_result_line_no[1] = -1;\n                searches_remaining++;\n            }\n\n            // Iterate all lines to find our line numbers\n            // In multi-line mode, we never exit the loop until all lines are counted, so add one extra to the searches_remaining counter.\n            searches_remaining += is_multiline ? 1 : 0;\n            int line_count = 0;\n            //for (const ImWchar* s = text_begin; (s = (const ImWchar*)wcschr((const wchar_t*)s, (wchar_t)'\\n')) != NULL; s++)  // FIXME-OPT: Could use this when wchar_t are 16-bit\n            for (const ImWchar* s = text_begin; *s != 0; s++)\n                if (*s == '\\n')\n                {\n                    line_count++;\n                    if (searches_result_line_no[0] == -1 && s >= searches_input_ptr[0]) { searches_result_line_no[0] = line_count; if (--searches_remaining <= 0) break; }\n                    if (searches_result_line_no[1] == -1 && s >= searches_input_ptr[1]) { searches_result_line_no[1] = line_count; if (--searches_remaining <= 0) break; }\n                }\n            line_count++;\n            if (searches_result_line_no[0] == -1)\n                searches_result_line_no[0] = line_count;\n            if (searches_result_line_no[1] == -1)\n                searches_result_line_no[1] = line_count;\n\n            // Calculate 2d position by finding the beginning of the line and measuring distance\n            cursor_offset.x = InputTextCalcTextSizeW(ImStrbolW(searches_input_ptr[0], text_begin), searches_input_ptr[0]).x;\n            cursor_offset.y = searches_result_line_no[0] * g.FontSize;\n            if (searches_result_line_no[1] >= 0)\n            {\n                select_start_offset.x = InputTextCalcTextSizeW(ImStrbolW(searches_input_ptr[1], text_begin), searches_input_ptr[1]).x;\n                select_start_offset.y = searches_result_line_no[1] * g.FontSize;\n            }\n\n            // Store text height (note that we haven't calculated text width at all, see GitHub issues #383, #1224)\n            if (is_multiline)\n                text_size = ImVec2(inner_size.x, line_count * g.FontSize);\n        }\n\n        // Scroll\n        if (render_cursor && state->CursorFollow)\n        {\n            // Horizontal scroll in chunks of quarter width\n            if (!(flags & ImGuiInputTextFlags_NoHorizontalScroll))\n            {\n                const float scroll_increment_x = inner_size.x * 0.25f;\n                const float visible_width = inner_size.x - style.FramePadding.x;\n                if (cursor_offset.x < state->ScrollX)\n                    state->ScrollX = IM_FLOOR(ImMax(0.0f, cursor_offset.x - scroll_increment_x));\n                else if (cursor_offset.x - visible_width >= state->ScrollX)\n                    state->ScrollX = IM_FLOOR(cursor_offset.x - visible_width + scroll_increment_x);\n            }\n            else\n            {\n                state->ScrollX = 0.0f;\n            }\n\n            // Vertical scroll\n            if (is_multiline)\n            {\n                // Test if cursor is vertically visible\n                if (cursor_offset.y - g.FontSize < scroll_y)\n                    scroll_y = ImMax(0.0f, cursor_offset.y - g.FontSize);\n                else if (cursor_offset.y - inner_size.y >= scroll_y)\n                    scroll_y = cursor_offset.y - inner_size.y + style.FramePadding.y * 2.0f;\n                const float scroll_max_y = ImMax((text_size.y + style.FramePadding.y * 2.0f) - inner_size.y, 0.0f);\n                scroll_y = ImClamp(scroll_y, 0.0f, scroll_max_y);\n                draw_pos.y += (draw_window->Scroll.y - scroll_y);   // Manipulate cursor pos immediately avoid a frame of lag\n                draw_window->Scroll.y = scroll_y;\n            }\n\n            state->CursorFollow = false;\n        }\n\n        // Draw selection\n        const ImVec2 draw_scroll = ImVec2(state->ScrollX, 0.0f);\n        if (render_selection)\n        {\n            const ImWchar* text_selected_begin = text_begin + ImMin(state->Stb.select_start, state->Stb.select_end);\n            const ImWchar* text_selected_end = text_begin + ImMax(state->Stb.select_start, state->Stb.select_end);\n\n            ImU32 bg_color = GetColorU32(ImGuiCol_TextSelectedBg, render_cursor ? 1.0f : 0.6f); // FIXME: current code flow mandate that render_cursor is always true here, we are leaving the transparent one for tests.\n            float bg_offy_up = is_multiline ? 0.0f : -1.0f;    // FIXME: those offsets should be part of the style? they don't play so well with multi-line selection.\n            float bg_offy_dn = is_multiline ? 0.0f : 2.0f;\n            ImVec2 rect_pos = draw_pos + select_start_offset - draw_scroll;\n            for (const ImWchar* p = text_selected_begin; p < text_selected_end; )\n            {\n                if (rect_pos.y > clip_rect.w + g.FontSize)\n                    break;\n                if (rect_pos.y < clip_rect.y)\n                {\n                    //p = (const ImWchar*)wmemchr((const wchar_t*)p, '\\n', text_selected_end - p);  // FIXME-OPT: Could use this when wchar_t are 16-bit\n                    //p = p ? p + 1 : text_selected_end;\n                    while (p < text_selected_end)\n                        if (*p++ == '\\n')\n                            break;\n                }\n                else\n                {\n                    ImVec2 rect_size = InputTextCalcTextSizeW(p, text_selected_end, &p, NULL, true);\n                    if (rect_size.x <= 0.0f) rect_size.x = IM_FLOOR(g.Font->GetCharAdvance((ImWchar)' ') * 0.50f); // So we can see selected empty lines\n                    ImRect rect(rect_pos + ImVec2(0.0f, bg_offy_up - g.FontSize), rect_pos + ImVec2(rect_size.x, bg_offy_dn));\n                    rect.ClipWith(clip_rect);\n                    if (rect.Overlaps(clip_rect))\n                        draw_window->DrawList->AddRectFilled(rect.Min, rect.Max, bg_color);\n                }\n                rect_pos.x = draw_pos.x - draw_scroll.x;\n                rect_pos.y += g.FontSize;\n            }\n        }\n\n        // We test for 'buf_display_max_length' as a way to avoid some pathological cases (e.g. single-line 1 MB string) which would make ImDrawList crash.\n        if (is_multiline || (buf_display_end - buf_display) < buf_display_max_length)\n        {\n            ImU32 col = GetColorU32(is_displaying_hint ? ImGuiCol_TextDisabled : ImGuiCol_Text);\n            draw_window->DrawList->AddText(g.Font, g.FontSize, draw_pos - draw_scroll, col, buf_display, buf_display_end, 0.0f, is_multiline ? NULL : &clip_rect);\n        }\n\n        // Draw blinking cursor\n        if (render_cursor)\n        {\n            state->CursorAnim += io.DeltaTime;\n            bool cursor_is_visible = (!g.IO.ConfigInputTextCursorBlink) || (state->CursorAnim <= 0.0f) || ImFmod(state->CursorAnim, 1.20f) <= 0.80f;\n            ImVec2 cursor_screen_pos = ImFloor(draw_pos + cursor_offset - draw_scroll);\n            ImRect cursor_screen_rect(cursor_screen_pos.x, cursor_screen_pos.y - g.FontSize + 0.5f, cursor_screen_pos.x + 1.0f, cursor_screen_pos.y - 1.5f);\n            if (cursor_is_visible && cursor_screen_rect.Overlaps(clip_rect))\n                draw_window->DrawList->AddLine(cursor_screen_rect.Min, cursor_screen_rect.GetBL(), GetColorU32(ImGuiCol_Text));\n\n            // Notify OS of text input position for advanced IME (-1 x offset so that Windows IME can cover our cursor. Bit of an extra nicety.)\n            if (!is_readonly)\n                g.PlatformImePos = ImVec2(cursor_screen_pos.x - 1.0f, cursor_screen_pos.y - g.FontSize);\n        }\n    }\n    else\n    {\n        // Render text only (no selection, no cursor)\n        if (is_multiline)\n            text_size = ImVec2(inner_size.x, InputTextCalcTextLenAndLineCount(buf_display, &buf_display_end) * g.FontSize); // We don't need width\n        else if (!is_displaying_hint && g.ActiveId == id)\n            buf_display_end = buf_display + state->CurLenA;\n        else if (!is_displaying_hint)\n            buf_display_end = buf_display + strlen(buf_display);\n\n        if (is_multiline || (buf_display_end - buf_display) < buf_display_max_length)\n        {\n            ImU32 col = GetColorU32(is_displaying_hint ? ImGuiCol_TextDisabled : ImGuiCol_Text);\n            draw_window->DrawList->AddText(g.Font, g.FontSize, draw_pos, col, buf_display, buf_display_end, 0.0f, is_multiline ? NULL : &clip_rect);\n        }\n    }\n\n    if (is_password && !is_displaying_hint)\n        PopFont();\n\n    if (is_multiline)\n    {\n        Dummy(ImVec2(text_size.x, text_size.y + style.FramePadding.y));\n        EndChild();\n        EndGroup();\n    }\n\n    // Log as text\n    if (g.LogEnabled && (!is_password || is_displaying_hint))\n    {\n        LogSetNextTextDecoration(\"{\", \"}\");\n        LogRenderedText(&draw_pos, buf_display, buf_display_end);\n    }\n\n    if (label_size.x > 0)\n        RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);\n\n    if (value_changed && !(flags & ImGuiInputTextFlags_NoMarkEdited))\n        MarkItemEdited(id);\n\n    IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags);\n    if ((flags & ImGuiInputTextFlags_EnterReturnsTrue) != 0)\n        return enter_pressed;\n    else\n        return value_changed;\n}\n\n//-------------------------------------------------------------------------\n// [SECTION] Widgets: ColorEdit, ColorPicker, ColorButton, etc.\n//-------------------------------------------------------------------------\n// - ColorEdit3()\n// - ColorEdit4()\n// - ColorPicker3()\n// - RenderColorRectWithAlphaCheckerboard() [Internal]\n// - ColorPicker4()\n// - ColorButton()\n// - SetColorEditOptions()\n// - ColorTooltip() [Internal]\n// - ColorEditOptionsPopup() [Internal]\n// - ColorPickerOptionsPopup() [Internal]\n//-------------------------------------------------------------------------\n\nbool ImGui::ColorEdit3(const char* label, float col[3], ImGuiColorEditFlags flags)\n{\n    return ColorEdit4(label, col, flags | ImGuiColorEditFlags_NoAlpha);\n}\n\n// Edit colors components (each component in 0.0f..1.0f range).\n// See enum ImGuiColorEditFlags_ for available options. e.g. Only access 3 floats if ImGuiColorEditFlags_NoAlpha flag is set.\n// With typical options: Left-click on color square to open color picker. Right-click to open option menu. CTRL-Click over input fields to edit them and TAB to go to next item.\nbool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flags)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return false;\n\n    ImGuiContext& g = *GImGui;\n    const ImGuiStyle& style = g.Style;\n    const float square_sz = GetFrameHeight();\n    const float w_full = CalcItemWidth();\n    const float w_button = (flags & ImGuiColorEditFlags_NoSmallPreview) ? 0.0f : (square_sz + style.ItemInnerSpacing.x);\n    const float w_inputs = w_full - w_button;\n    const char* label_display_end = FindRenderedTextEnd(label);\n    g.NextItemData.ClearFlags();\n\n    BeginGroup();\n    PushID(label);\n\n    // If we're not showing any slider there's no point in doing any HSV conversions\n    const ImGuiColorEditFlags flags_untouched = flags;\n    if (flags & ImGuiColorEditFlags_NoInputs)\n        flags = (flags & (~ImGuiColorEditFlags_DisplayMask_)) | ImGuiColorEditFlags_DisplayRGB | ImGuiColorEditFlags_NoOptions;\n\n    // Context menu: display and modify options (before defaults are applied)\n    if (!(flags & ImGuiColorEditFlags_NoOptions))\n        ColorEditOptionsPopup(col, flags);\n\n    // Read stored options\n    if (!(flags & ImGuiColorEditFlags_DisplayMask_))\n        flags |= (g.ColorEditOptions & ImGuiColorEditFlags_DisplayMask_);\n    if (!(flags & ImGuiColorEditFlags_DataTypeMask_))\n        flags |= (g.ColorEditOptions & ImGuiColorEditFlags_DataTypeMask_);\n    if (!(flags & ImGuiColorEditFlags_PickerMask_))\n        flags |= (g.ColorEditOptions & ImGuiColorEditFlags_PickerMask_);\n    if (!(flags & ImGuiColorEditFlags_InputMask_))\n        flags |= (g.ColorEditOptions & ImGuiColorEditFlags_InputMask_);\n    flags |= (g.ColorEditOptions & ~(ImGuiColorEditFlags_DisplayMask_ | ImGuiColorEditFlags_DataTypeMask_ | ImGuiColorEditFlags_PickerMask_ | ImGuiColorEditFlags_InputMask_));\n    IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiColorEditFlags_DisplayMask_)); // Check that only 1 is selected\n    IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiColorEditFlags_InputMask_));   // Check that only 1 is selected\n\n    const bool alpha = (flags & ImGuiColorEditFlags_NoAlpha) == 0;\n    const bool hdr = (flags & ImGuiColorEditFlags_HDR) != 0;\n    const int components = alpha ? 4 : 3;\n\n    // Convert to the formats we need\n    float f[4] = { col[0], col[1], col[2], alpha ? col[3] : 1.0f };\n    if ((flags & ImGuiColorEditFlags_InputHSV) && (flags & ImGuiColorEditFlags_DisplayRGB))\n        ColorConvertHSVtoRGB(f[0], f[1], f[2], f[0], f[1], f[2]);\n    else if ((flags & ImGuiColorEditFlags_InputRGB) && (flags & ImGuiColorEditFlags_DisplayHSV))\n    {\n        // Hue is lost when converting from greyscale rgb (saturation=0). Restore it.\n        ColorConvertRGBtoHSV(f[0], f[1], f[2], f[0], f[1], f[2]);\n        if (memcmp(g.ColorEditLastColor, col, sizeof(float) * 3) == 0)\n        {\n            if (f[1] == 0)\n                f[0] = g.ColorEditLastHue;\n            if (f[2] == 0)\n                f[1] = g.ColorEditLastSat;\n        }\n    }\n    int i[4] = { IM_F32_TO_INT8_UNBOUND(f[0]), IM_F32_TO_INT8_UNBOUND(f[1]), IM_F32_TO_INT8_UNBOUND(f[2]), IM_F32_TO_INT8_UNBOUND(f[3]) };\n\n    bool value_changed = false;\n    bool value_changed_as_float = false;\n\n    const ImVec2 pos = window->DC.CursorPos;\n    const float inputs_offset_x = (style.ColorButtonPosition == ImGuiDir_Left) ? w_button : 0.0f;\n    window->DC.CursorPos.x = pos.x + inputs_offset_x;\n\n    if ((flags & (ImGuiColorEditFlags_DisplayRGB | ImGuiColorEditFlags_DisplayHSV)) != 0 && (flags & ImGuiColorEditFlags_NoInputs) == 0)\n    {\n        // RGB/HSV 0..255 Sliders\n        const float w_item_one  = ImMax(1.0f, IM_FLOOR((w_inputs - (style.ItemInnerSpacing.x) * (components - 1)) / (float)components));\n        const float w_item_last = ImMax(1.0f, IM_FLOOR(w_inputs - (w_item_one + style.ItemInnerSpacing.x) * (components - 1)));\n\n        const bool hide_prefix = (w_item_one <= CalcTextSize((flags & ImGuiColorEditFlags_Float) ? \"M:0.000\" : \"M:000\").x);\n        static const char* ids[4] = { \"##X\", \"##Y\", \"##Z\", \"##W\" };\n        static const char* fmt_table_int[3][4] =\n        {\n            {   \"%3d\",   \"%3d\",   \"%3d\",   \"%3d\" }, // Short display\n            { \"R:%3d\", \"G:%3d\", \"B:%3d\", \"A:%3d\" }, // Long display for RGBA\n            { \"H:%3d\", \"S:%3d\", \"V:%3d\", \"A:%3d\" }  // Long display for HSVA\n        };\n        static const char* fmt_table_float[3][4] =\n        {\n            {   \"%0.3f\",   \"%0.3f\",   \"%0.3f\",   \"%0.3f\" }, // Short display\n            { \"R:%0.3f\", \"G:%0.3f\", \"B:%0.3f\", \"A:%0.3f\" }, // Long display for RGBA\n            { \"H:%0.3f\", \"S:%0.3f\", \"V:%0.3f\", \"A:%0.3f\" }  // Long display for HSVA\n        };\n        const int fmt_idx = hide_prefix ? 0 : (flags & ImGuiColorEditFlags_DisplayHSV) ? 2 : 1;\n\n        for (int n = 0; n < components; n++)\n        {\n            if (n > 0)\n                SameLine(0, style.ItemInnerSpacing.x);\n            SetNextItemWidth((n + 1 < components) ? w_item_one : w_item_last);\n\n            // FIXME: When ImGuiColorEditFlags_HDR flag is passed HS values snap in weird ways when SV values go below 0.\n            if (flags & ImGuiColorEditFlags_Float)\n            {\n                value_changed |= DragFloat(ids[n], &f[n], 1.0f / 255.0f, 0.0f, hdr ? 0.0f : 1.0f, fmt_table_float[fmt_idx][n]);\n                value_changed_as_float |= value_changed;\n            }\n            else\n            {\n                value_changed |= DragInt(ids[n], &i[n], 1.0f, 0, hdr ? 0 : 255, fmt_table_int[fmt_idx][n]);\n            }\n            if (!(flags & ImGuiColorEditFlags_NoOptions))\n                OpenPopupOnItemClick(\"context\");\n        }\n    }\n    else if ((flags & ImGuiColorEditFlags_DisplayHex) != 0 && (flags & ImGuiColorEditFlags_NoInputs) == 0)\n    {\n        // RGB Hexadecimal Input\n        char buf[64];\n        if (alpha)\n            ImFormatString(buf, IM_ARRAYSIZE(buf), \"#%02X%02X%02X%02X\", ImClamp(i[0], 0, 255), ImClamp(i[1], 0, 255), ImClamp(i[2], 0, 255), ImClamp(i[3], 0, 255));\n        else\n            ImFormatString(buf, IM_ARRAYSIZE(buf), \"#%02X%02X%02X\", ImClamp(i[0], 0, 255), ImClamp(i[1], 0, 255), ImClamp(i[2], 0, 255));\n        SetNextItemWidth(w_inputs);\n        if (InputText(\"##Text\", buf, IM_ARRAYSIZE(buf), ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsUppercase))\n        {\n            value_changed = true;\n            char* p = buf;\n            while (*p == '#' || ImCharIsBlankA(*p))\n                p++;\n            i[0] = i[1] = i[2] = 0;\n            i[3] = 0xFF; // alpha default to 255 is not parsed by scanf (e.g. inputting #FFFFFF omitting alpha)\n            int r;\n            if (alpha)\n                r = sscanf(p, \"%02X%02X%02X%02X\", (unsigned int*)&i[0], (unsigned int*)&i[1], (unsigned int*)&i[2], (unsigned int*)&i[3]); // Treat at unsigned (%X is unsigned)\n            else\n                r = sscanf(p, \"%02X%02X%02X\", (unsigned int*)&i[0], (unsigned int*)&i[1], (unsigned int*)&i[2]);\n            IM_UNUSED(r); // Fixes C6031: Return value ignored: 'sscanf'.\n        }\n        if (!(flags & ImGuiColorEditFlags_NoOptions))\n            OpenPopupOnItemClick(\"context\");\n    }\n\n    ImGuiWindow* picker_active_window = NULL;\n    if (!(flags & ImGuiColorEditFlags_NoSmallPreview))\n    {\n        const float button_offset_x = ((flags & ImGuiColorEditFlags_NoInputs) || (style.ColorButtonPosition == ImGuiDir_Left)) ? 0.0f : w_inputs + style.ItemInnerSpacing.x;\n        window->DC.CursorPos = ImVec2(pos.x + button_offset_x, pos.y);\n\n        const ImVec4 col_v4(col[0], col[1], col[2], alpha ? col[3] : 1.0f);\n        if (ColorButton(\"##ColorButton\", col_v4, flags))\n        {\n            if (!(flags & ImGuiColorEditFlags_NoPicker))\n            {\n                // Store current color and open a picker\n                g.ColorPickerRef = col_v4;\n                OpenPopup(\"picker\");\n                SetNextWindowPos(g.LastItemData.Rect.GetBL() + ImVec2(-1, style.ItemSpacing.y));\n            }\n        }\n        if (!(flags & ImGuiColorEditFlags_NoOptions))\n            OpenPopupOnItemClick(\"context\");\n\n        if (BeginPopup(\"picker\"))\n        {\n            picker_active_window = g.CurrentWindow;\n            if (label != label_display_end)\n            {\n                TextEx(label, label_display_end);\n                Spacing();\n            }\n            ImGuiColorEditFlags picker_flags_to_forward = ImGuiColorEditFlags_DataTypeMask_ | ImGuiColorEditFlags_PickerMask_ | ImGuiColorEditFlags_InputMask_ | ImGuiColorEditFlags_HDR | ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_AlphaBar;\n            ImGuiColorEditFlags picker_flags = (flags_untouched & picker_flags_to_forward) | ImGuiColorEditFlags_DisplayMask_ | ImGuiColorEditFlags_NoLabel | ImGuiColorEditFlags_AlphaPreviewHalf;\n            SetNextItemWidth(square_sz * 12.0f); // Use 256 + bar sizes?\n            value_changed |= ColorPicker4(\"##picker\", col, picker_flags, &g.ColorPickerRef.x);\n            EndPopup();\n        }\n    }\n\n    if (label != label_display_end && !(flags & ImGuiColorEditFlags_NoLabel))\n    {\n        const float text_offset_x = (flags & ImGuiColorEditFlags_NoInputs) ? w_button : w_full + style.ItemInnerSpacing.x;\n        window->DC.CursorPos = ImVec2(pos.x + text_offset_x, pos.y + style.FramePadding.y);\n        TextEx(label, label_display_end);\n    }\n\n    // Convert back\n    if (value_changed && picker_active_window == NULL)\n    {\n        if (!value_changed_as_float)\n            for (int n = 0; n < 4; n++)\n                f[n] = i[n] / 255.0f;\n        if ((flags & ImGuiColorEditFlags_DisplayHSV) && (flags & ImGuiColorEditFlags_InputRGB))\n        {\n            g.ColorEditLastHue = f[0];\n            g.ColorEditLastSat = f[1];\n            ColorConvertHSVtoRGB(f[0], f[1], f[2], f[0], f[1], f[2]);\n            memcpy(g.ColorEditLastColor, f, sizeof(float) * 3);\n        }\n        if ((flags & ImGuiColorEditFlags_DisplayRGB) && (flags & ImGuiColorEditFlags_InputHSV))\n            ColorConvertRGBtoHSV(f[0], f[1], f[2], f[0], f[1], f[2]);\n\n        col[0] = f[0];\n        col[1] = f[1];\n        col[2] = f[2];\n        if (alpha)\n            col[3] = f[3];\n    }\n\n    PopID();\n    EndGroup();\n\n    // Drag and Drop Target\n    // NB: The flag test is merely an optional micro-optimization, BeginDragDropTarget() does the same test.\n    if ((g.LastItemData.StatusFlags & ImGuiItemStatusFlags_HoveredRect) && !(flags & ImGuiColorEditFlags_NoDragDrop) && BeginDragDropTarget())\n    {\n        bool accepted_drag_drop = false;\n        if (const ImGuiPayload* payload = AcceptDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_3F))\n        {\n            memcpy((float*)col, payload->Data, sizeof(float) * 3); // Preserve alpha if any //-V512\n            value_changed = accepted_drag_drop = true;\n        }\n        if (const ImGuiPayload* payload = AcceptDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_4F))\n        {\n            memcpy((float*)col, payload->Data, sizeof(float) * components);\n            value_changed = accepted_drag_drop = true;\n        }\n\n        // Drag-drop payloads are always RGB\n        if (accepted_drag_drop && (flags & ImGuiColorEditFlags_InputHSV))\n            ColorConvertRGBtoHSV(col[0], col[1], col[2], col[0], col[1], col[2]);\n        EndDragDropTarget();\n    }\n\n    // When picker is being actively used, use its active id so IsItemActive() will function on ColorEdit4().\n    if (picker_active_window && g.ActiveId != 0 && g.ActiveIdWindow == picker_active_window)\n        g.LastItemData.ID = g.ActiveId;\n\n    if (value_changed)\n        MarkItemEdited(g.LastItemData.ID);\n\n    return value_changed;\n}\n\nbool ImGui::ColorPicker3(const char* label, float col[3], ImGuiColorEditFlags flags)\n{\n    float col4[4] = { col[0], col[1], col[2], 1.0f };\n    if (!ColorPicker4(label, col4, flags | ImGuiColorEditFlags_NoAlpha))\n        return false;\n    col[0] = col4[0]; col[1] = col4[1]; col[2] = col4[2];\n    return true;\n}\n\n// Helper for ColorPicker4()\nstatic void RenderArrowsForVerticalBar(ImDrawList* draw_list, ImVec2 pos, ImVec2 half_sz, float bar_w, float alpha)\n{\n    ImU32 alpha8 = IM_F32_TO_INT8_SAT(alpha);\n    ImGui::RenderArrowPointingAt(draw_list, ImVec2(pos.x + half_sz.x + 1,         pos.y), ImVec2(half_sz.x + 2, half_sz.y + 1), ImGuiDir_Right, IM_COL32(0,0,0,alpha8));\n    ImGui::RenderArrowPointingAt(draw_list, ImVec2(pos.x + half_sz.x,             pos.y), half_sz,                              ImGuiDir_Right, IM_COL32(255,255,255,alpha8));\n    ImGui::RenderArrowPointingAt(draw_list, ImVec2(pos.x + bar_w - half_sz.x - 1, pos.y), ImVec2(half_sz.x + 2, half_sz.y + 1), ImGuiDir_Left,  IM_COL32(0,0,0,alpha8));\n    ImGui::RenderArrowPointingAt(draw_list, ImVec2(pos.x + bar_w - half_sz.x,     pos.y), half_sz,                              ImGuiDir_Left,  IM_COL32(255,255,255,alpha8));\n}\n\n// Note: ColorPicker4() only accesses 3 floats if ImGuiColorEditFlags_NoAlpha flag is set.\n// (In C++ the 'float col[4]' notation for a function argument is equivalent to 'float* col', we only specify a size to facilitate understanding of the code.)\n// FIXME: we adjust the big color square height based on item width, which may cause a flickering feedback loop (if automatic height makes a vertical scrollbar appears, affecting automatic width..)\n// FIXME: this is trying to be aware of style.Alpha but not fully correct. Also, the color wheel will have overlapping glitches with (style.Alpha < 1.0)\nbool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags flags, const float* ref_col)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return false;\n\n    ImDrawList* draw_list = window->DrawList;\n    ImGuiStyle& style = g.Style;\n    ImGuiIO& io = g.IO;\n\n    const float width = CalcItemWidth();\n    g.NextItemData.ClearFlags();\n\n    PushID(label);\n    BeginGroup();\n\n    if (!(flags & ImGuiColorEditFlags_NoSidePreview))\n        flags |= ImGuiColorEditFlags_NoSmallPreview;\n\n    // Context menu: display and store options.\n    if (!(flags & ImGuiColorEditFlags_NoOptions))\n        ColorPickerOptionsPopup(col, flags);\n\n    // Read stored options\n    if (!(flags & ImGuiColorEditFlags_PickerMask_))\n        flags |= ((g.ColorEditOptions & ImGuiColorEditFlags_PickerMask_) ? g.ColorEditOptions : ImGuiColorEditFlags_DefaultOptions_) & ImGuiColorEditFlags_PickerMask_;\n    if (!(flags & ImGuiColorEditFlags_InputMask_))\n        flags |= ((g.ColorEditOptions & ImGuiColorEditFlags_InputMask_) ? g.ColorEditOptions : ImGuiColorEditFlags_DefaultOptions_) & ImGuiColorEditFlags_InputMask_;\n    IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiColorEditFlags_PickerMask_)); // Check that only 1 is selected\n    IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiColorEditFlags_InputMask_));  // Check that only 1 is selected\n    if (!(flags & ImGuiColorEditFlags_NoOptions))\n        flags |= (g.ColorEditOptions & ImGuiColorEditFlags_AlphaBar);\n\n    // Setup\n    int components = (flags & ImGuiColorEditFlags_NoAlpha) ? 3 : 4;\n    bool alpha_bar = (flags & ImGuiColorEditFlags_AlphaBar) && !(flags & ImGuiColorEditFlags_NoAlpha);\n    ImVec2 picker_pos = window->DC.CursorPos;\n    float square_sz = GetFrameHeight();\n    float bars_width = square_sz; // Arbitrary smallish width of Hue/Alpha picking bars\n    float sv_picker_size = ImMax(bars_width * 1, width - (alpha_bar ? 2 : 1) * (bars_width + style.ItemInnerSpacing.x)); // Saturation/Value picking box\n    float bar0_pos_x = picker_pos.x + sv_picker_size + style.ItemInnerSpacing.x;\n    float bar1_pos_x = bar0_pos_x + bars_width + style.ItemInnerSpacing.x;\n    float bars_triangles_half_sz = IM_FLOOR(bars_width * 0.20f);\n\n    float backup_initial_col[4];\n    memcpy(backup_initial_col, col, components * sizeof(float));\n\n    float wheel_thickness = sv_picker_size * 0.08f;\n    float wheel_r_outer = sv_picker_size * 0.50f;\n    float wheel_r_inner = wheel_r_outer - wheel_thickness;\n    ImVec2 wheel_center(picker_pos.x + (sv_picker_size + bars_width)*0.5f, picker_pos.y + sv_picker_size * 0.5f);\n\n    // Note: the triangle is displayed rotated with triangle_pa pointing to Hue, but most coordinates stays unrotated for logic.\n    float triangle_r = wheel_r_inner - (int)(sv_picker_size * 0.027f);\n    ImVec2 triangle_pa = ImVec2(triangle_r, 0.0f); // Hue point.\n    ImVec2 triangle_pb = ImVec2(triangle_r * -0.5f, triangle_r * -0.866025f); // Black point.\n    ImVec2 triangle_pc = ImVec2(triangle_r * -0.5f, triangle_r * +0.866025f); // White point.\n\n    float H = col[0], S = col[1], V = col[2];\n    float R = col[0], G = col[1], B = col[2];\n    if (flags & ImGuiColorEditFlags_InputRGB)\n    {\n        // Hue is lost when converting from greyscale rgb (saturation=0). Restore it.\n        ColorConvertRGBtoHSV(R, G, B, H, S, V);\n        if (memcmp(g.ColorEditLastColor, col, sizeof(float) * 3) == 0)\n        {\n            if (S == 0)\n                H = g.ColorEditLastHue;\n            if (V == 0)\n                S = g.ColorEditLastSat;\n        }\n    }\n    else if (flags & ImGuiColorEditFlags_InputHSV)\n    {\n        ColorConvertHSVtoRGB(H, S, V, R, G, B);\n    }\n\n    bool value_changed = false, value_changed_h = false, value_changed_sv = false;\n\n    PushItemFlag(ImGuiItemFlags_NoNav, true);\n    if (flags & ImGuiColorEditFlags_PickerHueWheel)\n    {\n        // Hue wheel + SV triangle logic\n        InvisibleButton(\"hsv\", ImVec2(sv_picker_size + style.ItemInnerSpacing.x + bars_width, sv_picker_size));\n        if (IsItemActive())\n        {\n            ImVec2 initial_off = g.IO.MouseClickedPos[0] - wheel_center;\n            ImVec2 current_off = g.IO.MousePos - wheel_center;\n            float initial_dist2 = ImLengthSqr(initial_off);\n            if (initial_dist2 >= (wheel_r_inner - 1) * (wheel_r_inner - 1) && initial_dist2 <= (wheel_r_outer + 1) * (wheel_r_outer + 1))\n            {\n                // Interactive with Hue wheel\n                H = ImAtan2(current_off.y, current_off.x) / IM_PI * 0.5f;\n                if (H < 0.0f)\n                    H += 1.0f;\n                value_changed = value_changed_h = true;\n            }\n            float cos_hue_angle = ImCos(-H * 2.0f * IM_PI);\n            float sin_hue_angle = ImSin(-H * 2.0f * IM_PI);\n            if (ImTriangleContainsPoint(triangle_pa, triangle_pb, triangle_pc, ImRotate(initial_off, cos_hue_angle, sin_hue_angle)))\n            {\n                // Interacting with SV triangle\n                ImVec2 current_off_unrotated = ImRotate(current_off, cos_hue_angle, sin_hue_angle);\n                if (!ImTriangleContainsPoint(triangle_pa, triangle_pb, triangle_pc, current_off_unrotated))\n                    current_off_unrotated = ImTriangleClosestPoint(triangle_pa, triangle_pb, triangle_pc, current_off_unrotated);\n                float uu, vv, ww;\n                ImTriangleBarycentricCoords(triangle_pa, triangle_pb, triangle_pc, current_off_unrotated, uu, vv, ww);\n                V = ImClamp(1.0f - vv, 0.0001f, 1.0f);\n                S = ImClamp(uu / V, 0.0001f, 1.0f);\n                value_changed = value_changed_sv = true;\n            }\n        }\n        if (!(flags & ImGuiColorEditFlags_NoOptions))\n            OpenPopupOnItemClick(\"context\");\n    }\n    else if (flags & ImGuiColorEditFlags_PickerHueBar)\n    {\n        // SV rectangle logic\n        InvisibleButton(\"sv\", ImVec2(sv_picker_size, sv_picker_size));\n        if (IsItemActive())\n        {\n            S = ImSaturate((io.MousePos.x - picker_pos.x) / (sv_picker_size - 1));\n            V = 1.0f - ImSaturate((io.MousePos.y - picker_pos.y) / (sv_picker_size - 1));\n            value_changed = value_changed_sv = true;\n        }\n        if (!(flags & ImGuiColorEditFlags_NoOptions))\n            OpenPopupOnItemClick(\"context\");\n\n        // Hue bar logic\n        SetCursorScreenPos(ImVec2(bar0_pos_x, picker_pos.y));\n        InvisibleButton(\"hue\", ImVec2(bars_width, sv_picker_size));\n        if (IsItemActive())\n        {\n            H = ImSaturate((io.MousePos.y - picker_pos.y) / (sv_picker_size - 1));\n            value_changed = value_changed_h = true;\n        }\n    }\n\n    // Alpha bar logic\n    if (alpha_bar)\n    {\n        SetCursorScreenPos(ImVec2(bar1_pos_x, picker_pos.y));\n        InvisibleButton(\"alpha\", ImVec2(bars_width, sv_picker_size));\n        if (IsItemActive())\n        {\n            col[3] = 1.0f - ImSaturate((io.MousePos.y - picker_pos.y) / (sv_picker_size - 1));\n            value_changed = true;\n        }\n    }\n    PopItemFlag(); // ImGuiItemFlags_NoNav\n\n    if (!(flags & ImGuiColorEditFlags_NoSidePreview))\n    {\n        SameLine(0, style.ItemInnerSpacing.x);\n        BeginGroup();\n    }\n\n    if (!(flags & ImGuiColorEditFlags_NoLabel))\n    {\n        const char* label_display_end = FindRenderedTextEnd(label);\n        if (label != label_display_end)\n        {\n            if ((flags & ImGuiColorEditFlags_NoSidePreview))\n                SameLine(0, style.ItemInnerSpacing.x);\n            TextEx(label, label_display_end);\n        }\n    }\n\n    if (!(flags & ImGuiColorEditFlags_NoSidePreview))\n    {\n        PushItemFlag(ImGuiItemFlags_NoNavDefaultFocus, true);\n        ImVec4 col_v4(col[0], col[1], col[2], (flags & ImGuiColorEditFlags_NoAlpha) ? 1.0f : col[3]);\n        if ((flags & ImGuiColorEditFlags_NoLabel))\n            Text(\"Current\");\n\n        ImGuiColorEditFlags sub_flags_to_forward = ImGuiColorEditFlags_InputMask_ | ImGuiColorEditFlags_HDR | ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_AlphaPreviewHalf | ImGuiColorEditFlags_NoTooltip;\n        ColorButton(\"##current\", col_v4, (flags & sub_flags_to_forward), ImVec2(square_sz * 3, square_sz * 2));\n        if (ref_col != NULL)\n        {\n            Text(\"Original\");\n            ImVec4 ref_col_v4(ref_col[0], ref_col[1], ref_col[2], (flags & ImGuiColorEditFlags_NoAlpha) ? 1.0f : ref_col[3]);\n            if (ColorButton(\"##original\", ref_col_v4, (flags & sub_flags_to_forward), ImVec2(square_sz * 3, square_sz * 2)))\n            {\n                memcpy(col, ref_col, components * sizeof(float));\n                value_changed = true;\n            }\n        }\n        PopItemFlag();\n        EndGroup();\n    }\n\n    // Convert back color to RGB\n    if (value_changed_h || value_changed_sv)\n    {\n        if (flags & ImGuiColorEditFlags_InputRGB)\n        {\n            ColorConvertHSVtoRGB(H >= 1.0f ? H - 10 * 1e-6f : H, S > 0.0f ? S : 10 * 1e-6f, V > 0.0f ? V : 1e-6f, col[0], col[1], col[2]);\n            g.ColorEditLastHue = H;\n            g.ColorEditLastSat = S;\n            memcpy(g.ColorEditLastColor, col, sizeof(float) * 3);\n        }\n        else if (flags & ImGuiColorEditFlags_InputHSV)\n        {\n            col[0] = H;\n            col[1] = S;\n            col[2] = V;\n        }\n    }\n\n    // R,G,B and H,S,V slider color editor\n    bool value_changed_fix_hue_wrap = false;\n    if ((flags & ImGuiColorEditFlags_NoInputs) == 0)\n    {\n        PushItemWidth((alpha_bar ? bar1_pos_x : bar0_pos_x) + bars_width - picker_pos.x);\n        ImGuiColorEditFlags sub_flags_to_forward = ImGuiColorEditFlags_DataTypeMask_ | ImGuiColorEditFlags_InputMask_ | ImGuiColorEditFlags_HDR | ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_NoOptions | ImGuiColorEditFlags_NoSmallPreview | ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_AlphaPreviewHalf;\n        ImGuiColorEditFlags sub_flags = (flags & sub_flags_to_forward) | ImGuiColorEditFlags_NoPicker;\n        if (flags & ImGuiColorEditFlags_DisplayRGB || (flags & ImGuiColorEditFlags_DisplayMask_) == 0)\n            if (ColorEdit4(\"##rgb\", col, sub_flags | ImGuiColorEditFlags_DisplayRGB))\n            {\n                // FIXME: Hackily differentiating using the DragInt (ActiveId != 0 && !ActiveIdAllowOverlap) vs. using the InputText or DropTarget.\n                // For the later we don't want to run the hue-wrap canceling code. If you are well versed in HSV picker please provide your input! (See #2050)\n                value_changed_fix_hue_wrap = (g.ActiveId != 0 && !g.ActiveIdAllowOverlap);\n                value_changed = true;\n            }\n        if (flags & ImGuiColorEditFlags_DisplayHSV || (flags & ImGuiColorEditFlags_DisplayMask_) == 0)\n            value_changed |= ColorEdit4(\"##hsv\", col, sub_flags | ImGuiColorEditFlags_DisplayHSV);\n        if (flags & ImGuiColorEditFlags_DisplayHex || (flags & ImGuiColorEditFlags_DisplayMask_) == 0)\n            value_changed |= ColorEdit4(\"##hex\", col, sub_flags | ImGuiColorEditFlags_DisplayHex);\n        PopItemWidth();\n    }\n\n    // Try to cancel hue wrap (after ColorEdit4 call), if any\n    if (value_changed_fix_hue_wrap && (flags & ImGuiColorEditFlags_InputRGB))\n    {\n        float new_H, new_S, new_V;\n        ColorConvertRGBtoHSV(col[0], col[1], col[2], new_H, new_S, new_V);\n        if (new_H <= 0 && H > 0)\n        {\n            if (new_V <= 0 && V != new_V)\n                ColorConvertHSVtoRGB(H, S, new_V <= 0 ? V * 0.5f : new_V, col[0], col[1], col[2]);\n            else if (new_S <= 0)\n                ColorConvertHSVtoRGB(H, new_S <= 0 ? S * 0.5f : new_S, new_V, col[0], col[1], col[2]);\n        }\n    }\n\n    if (value_changed)\n    {\n        if (flags & ImGuiColorEditFlags_InputRGB)\n        {\n            R = col[0];\n            G = col[1];\n            B = col[2];\n            ColorConvertRGBtoHSV(R, G, B, H, S, V);\n            if (memcmp(g.ColorEditLastColor, col, sizeof(float) * 3) == 0) // Fix local Hue as display below will use it immediately.\n            {\n                if (S == 0)\n                    H = g.ColorEditLastHue;\n                if (V == 0)\n                    S = g.ColorEditLastSat;\n            }\n        }\n        else if (flags & ImGuiColorEditFlags_InputHSV)\n        {\n            H = col[0];\n            S = col[1];\n            V = col[2];\n            ColorConvertHSVtoRGB(H, S, V, R, G, B);\n        }\n    }\n\n    const int style_alpha8 = IM_F32_TO_INT8_SAT(style.Alpha);\n    const ImU32 col_black = IM_COL32(0,0,0,style_alpha8);\n    const ImU32 col_white = IM_COL32(255,255,255,style_alpha8);\n    const ImU32 col_midgrey = IM_COL32(128,128,128,style_alpha8);\n    const ImU32 col_hues[6 + 1] = { IM_COL32(255,0,0,style_alpha8), IM_COL32(255,255,0,style_alpha8), IM_COL32(0,255,0,style_alpha8), IM_COL32(0,255,255,style_alpha8), IM_COL32(0,0,255,style_alpha8), IM_COL32(255,0,255,style_alpha8), IM_COL32(255,0,0,style_alpha8) };\n\n    ImVec4 hue_color_f(1, 1, 1, style.Alpha); ColorConvertHSVtoRGB(H, 1, 1, hue_color_f.x, hue_color_f.y, hue_color_f.z);\n    ImU32 hue_color32 = ColorConvertFloat4ToU32(hue_color_f);\n    ImU32 user_col32_striped_of_alpha = ColorConvertFloat4ToU32(ImVec4(R, G, B, style.Alpha)); // Important: this is still including the main rendering/style alpha!!\n\n    ImVec2 sv_cursor_pos;\n\n    if (flags & ImGuiColorEditFlags_PickerHueWheel)\n    {\n        // Render Hue Wheel\n        const float aeps = 0.5f / wheel_r_outer; // Half a pixel arc length in radians (2pi cancels out).\n        const int segment_per_arc = ImMax(4, (int)wheel_r_outer / 12);\n        for (int n = 0; n < 6; n++)\n        {\n            const float a0 = (n)     /6.0f * 2.0f * IM_PI - aeps;\n            const float a1 = (n+1.0f)/6.0f * 2.0f * IM_PI + aeps;\n            const int vert_start_idx = draw_list->VtxBuffer.Size;\n            draw_list->PathArcTo(wheel_center, (wheel_r_inner + wheel_r_outer)*0.5f, a0, a1, segment_per_arc);\n            draw_list->PathStroke(col_white, 0, wheel_thickness);\n            const int vert_end_idx = draw_list->VtxBuffer.Size;\n\n            // Paint colors over existing vertices\n            ImVec2 gradient_p0(wheel_center.x + ImCos(a0) * wheel_r_inner, wheel_center.y + ImSin(a0) * wheel_r_inner);\n            ImVec2 gradient_p1(wheel_center.x + ImCos(a1) * wheel_r_inner, wheel_center.y + ImSin(a1) * wheel_r_inner);\n            ShadeVertsLinearColorGradientKeepAlpha(draw_list, vert_start_idx, vert_end_idx, gradient_p0, gradient_p1, col_hues[n], col_hues[n + 1]);\n        }\n\n        // Render Cursor + preview on Hue Wheel\n        float cos_hue_angle = ImCos(H * 2.0f * IM_PI);\n        float sin_hue_angle = ImSin(H * 2.0f * IM_PI);\n        ImVec2 hue_cursor_pos(wheel_center.x + cos_hue_angle * (wheel_r_inner + wheel_r_outer) * 0.5f, wheel_center.y + sin_hue_angle * (wheel_r_inner + wheel_r_outer) * 0.5f);\n        float hue_cursor_rad = value_changed_h ? wheel_thickness * 0.65f : wheel_thickness * 0.55f;\n        int hue_cursor_segments = ImClamp((int)(hue_cursor_rad / 1.4f), 9, 32);\n        draw_list->AddCircleFilled(hue_cursor_pos, hue_cursor_rad, hue_color32, hue_cursor_segments);\n        draw_list->AddCircle(hue_cursor_pos, hue_cursor_rad + 1, col_midgrey, hue_cursor_segments);\n        draw_list->AddCircle(hue_cursor_pos, hue_cursor_rad, col_white, hue_cursor_segments);\n\n        // Render SV triangle (rotated according to hue)\n        ImVec2 tra = wheel_center + ImRotate(triangle_pa, cos_hue_angle, sin_hue_angle);\n        ImVec2 trb = wheel_center + ImRotate(triangle_pb, cos_hue_angle, sin_hue_angle);\n        ImVec2 trc = wheel_center + ImRotate(triangle_pc, cos_hue_angle, sin_hue_angle);\n        ImVec2 uv_white = GetFontTexUvWhitePixel();\n        draw_list->PrimReserve(6, 6);\n        draw_list->PrimVtx(tra, uv_white, hue_color32);\n        draw_list->PrimVtx(trb, uv_white, hue_color32);\n        draw_list->PrimVtx(trc, uv_white, col_white);\n        draw_list->PrimVtx(tra, uv_white, 0);\n        draw_list->PrimVtx(trb, uv_white, col_black);\n        draw_list->PrimVtx(trc, uv_white, 0);\n        draw_list->AddTriangle(tra, trb, trc, col_midgrey, 1.5f);\n        sv_cursor_pos = ImLerp(ImLerp(trc, tra, ImSaturate(S)), trb, ImSaturate(1 - V));\n    }\n    else if (flags & ImGuiColorEditFlags_PickerHueBar)\n    {\n        // Render SV Square\n        draw_list->AddRectFilledMultiColor(picker_pos, picker_pos + ImVec2(sv_picker_size, sv_picker_size), col_white, hue_color32, hue_color32, col_white);\n        draw_list->AddRectFilledMultiColor(picker_pos, picker_pos + ImVec2(sv_picker_size, sv_picker_size), 0, 0, col_black, col_black);\n        RenderFrameBorder(picker_pos, picker_pos + ImVec2(sv_picker_size, sv_picker_size), 0.0f);\n        sv_cursor_pos.x = ImClamp(IM_ROUND(picker_pos.x + ImSaturate(S)     * sv_picker_size), picker_pos.x + 2, picker_pos.x + sv_picker_size - 2); // Sneakily prevent the circle to stick out too much\n        sv_cursor_pos.y = ImClamp(IM_ROUND(picker_pos.y + ImSaturate(1 - V) * sv_picker_size), picker_pos.y + 2, picker_pos.y + sv_picker_size - 2);\n\n        // Render Hue Bar\n        for (int i = 0; i < 6; ++i)\n            draw_list->AddRectFilledMultiColor(ImVec2(bar0_pos_x, picker_pos.y + i * (sv_picker_size / 6)), ImVec2(bar0_pos_x + bars_width, picker_pos.y + (i + 1) * (sv_picker_size / 6)), col_hues[i], col_hues[i], col_hues[i + 1], col_hues[i + 1]);\n        float bar0_line_y = IM_ROUND(picker_pos.y + H * sv_picker_size);\n        RenderFrameBorder(ImVec2(bar0_pos_x, picker_pos.y), ImVec2(bar0_pos_x + bars_width, picker_pos.y + sv_picker_size), 0.0f);\n        RenderArrowsForVerticalBar(draw_list, ImVec2(bar0_pos_x - 1, bar0_line_y), ImVec2(bars_triangles_half_sz + 1, bars_triangles_half_sz), bars_width + 2.0f, style.Alpha);\n    }\n\n    // Render cursor/preview circle (clamp S/V within 0..1 range because floating points colors may lead HSV values to be out of range)\n    float sv_cursor_rad = value_changed_sv ? 10.0f : 6.0f;\n    draw_list->AddCircleFilled(sv_cursor_pos, sv_cursor_rad, user_col32_striped_of_alpha, 12);\n    draw_list->AddCircle(sv_cursor_pos, sv_cursor_rad + 1, col_midgrey, 12);\n    draw_list->AddCircle(sv_cursor_pos, sv_cursor_rad, col_white, 12);\n\n    // Render alpha bar\n    if (alpha_bar)\n    {\n        float alpha = ImSaturate(col[3]);\n        ImRect bar1_bb(bar1_pos_x, picker_pos.y, bar1_pos_x + bars_width, picker_pos.y + sv_picker_size);\n        RenderColorRectWithAlphaCheckerboard(draw_list, bar1_bb.Min, bar1_bb.Max, 0, bar1_bb.GetWidth() / 2.0f, ImVec2(0.0f, 0.0f));\n        draw_list->AddRectFilledMultiColor(bar1_bb.Min, bar1_bb.Max, user_col32_striped_of_alpha, user_col32_striped_of_alpha, user_col32_striped_of_alpha & ~IM_COL32_A_MASK, user_col32_striped_of_alpha & ~IM_COL32_A_MASK);\n        float bar1_line_y = IM_ROUND(picker_pos.y + (1.0f - alpha) * sv_picker_size);\n        RenderFrameBorder(bar1_bb.Min, bar1_bb.Max, 0.0f);\n        RenderArrowsForVerticalBar(draw_list, ImVec2(bar1_pos_x - 1, bar1_line_y), ImVec2(bars_triangles_half_sz + 1, bars_triangles_half_sz), bars_width + 2.0f, style.Alpha);\n    }\n\n    EndGroup();\n\n    if (value_changed && memcmp(backup_initial_col, col, components * sizeof(float)) == 0)\n        value_changed = false;\n    if (value_changed)\n        MarkItemEdited(g.LastItemData.ID);\n\n    PopID();\n\n    return value_changed;\n}\n\n// A little color square. Return true when clicked.\n// FIXME: May want to display/ignore the alpha component in the color display? Yet show it in the tooltip.\n// 'desc_id' is not called 'label' because we don't display it next to the button, but only in the tooltip.\n// Note that 'col' may be encoded in HSV if ImGuiColorEditFlags_InputHSV is set.\nbool ImGui::ColorButton(const char* desc_id, const ImVec4& col, ImGuiColorEditFlags flags, ImVec2 size)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return false;\n\n    ImGuiContext& g = *GImGui;\n    const ImGuiID id = window->GetID(desc_id);\n    float default_size = GetFrameHeight();\n    if (size.x == 0.0f)\n        size.x = default_size;\n    if (size.y == 0.0f)\n        size.y = default_size;\n    const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);\n    ItemSize(bb, (size.y >= default_size) ? g.Style.FramePadding.y : 0.0f);\n    if (!ItemAdd(bb, id))\n        return false;\n\n    bool hovered, held;\n    bool pressed = ButtonBehavior(bb, id, &hovered, &held);\n\n    if (flags & ImGuiColorEditFlags_NoAlpha)\n        flags &= ~(ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_AlphaPreviewHalf);\n\n    ImVec4 col_rgb = col;\n    if (flags & ImGuiColorEditFlags_InputHSV)\n        ColorConvertHSVtoRGB(col_rgb.x, col_rgb.y, col_rgb.z, col_rgb.x, col_rgb.y, col_rgb.z);\n\n    ImVec4 col_rgb_without_alpha(col_rgb.x, col_rgb.y, col_rgb.z, 1.0f);\n    float grid_step = ImMin(size.x, size.y) / 2.99f;\n    float rounding = ImMin(g.Style.FrameRounding, grid_step * 0.5f);\n    ImRect bb_inner = bb;\n    float off = 0.0f;\n    if ((flags & ImGuiColorEditFlags_NoBorder) == 0)\n    {\n        off = -0.75f; // The border (using Col_FrameBg) tends to look off when color is near-opaque and rounding is enabled. This offset seemed like a good middle ground to reduce those artifacts.\n        bb_inner.Expand(off);\n    }\n    if ((flags & ImGuiColorEditFlags_AlphaPreviewHalf) && col_rgb.w < 1.0f)\n    {\n        float mid_x = IM_ROUND((bb_inner.Min.x + bb_inner.Max.x) * 0.5f);\n        RenderColorRectWithAlphaCheckerboard(window->DrawList, ImVec2(bb_inner.Min.x + grid_step, bb_inner.Min.y), bb_inner.Max, GetColorU32(col_rgb), grid_step, ImVec2(-grid_step + off, off), rounding, ImDrawFlags_RoundCornersRight);\n        window->DrawList->AddRectFilled(bb_inner.Min, ImVec2(mid_x, bb_inner.Max.y), GetColorU32(col_rgb_without_alpha), rounding, ImDrawFlags_RoundCornersLeft);\n    }\n    else\n    {\n        // Because GetColorU32() multiplies by the global style Alpha and we don't want to display a checkerboard if the source code had no alpha\n        ImVec4 col_source = (flags & ImGuiColorEditFlags_AlphaPreview) ? col_rgb : col_rgb_without_alpha;\n        if (col_source.w < 1.0f)\n            RenderColorRectWithAlphaCheckerboard(window->DrawList, bb_inner.Min, bb_inner.Max, GetColorU32(col_source), grid_step, ImVec2(off, off), rounding);\n        else\n            window->DrawList->AddRectFilled(bb_inner.Min, bb_inner.Max, GetColorU32(col_source), rounding);\n    }\n    RenderNavHighlight(bb, id);\n    if ((flags & ImGuiColorEditFlags_NoBorder) == 0)\n    {\n        if (g.Style.FrameBorderSize > 0.0f)\n            RenderFrameBorder(bb.Min, bb.Max, rounding);\n        else\n            window->DrawList->AddRect(bb.Min, bb.Max, GetColorU32(ImGuiCol_FrameBg), rounding); // Color button are often in need of some sort of border\n    }\n\n    // Drag and Drop Source\n    // NB: The ActiveId test is merely an optional micro-optimization, BeginDragDropSource() does the same test.\n    if (g.ActiveId == id && !(flags & ImGuiColorEditFlags_NoDragDrop) && BeginDragDropSource())\n    {\n        if (flags & ImGuiColorEditFlags_NoAlpha)\n            SetDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_3F, &col_rgb, sizeof(float) * 3, ImGuiCond_Once);\n        else\n            SetDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_4F, &col_rgb, sizeof(float) * 4, ImGuiCond_Once);\n        ColorButton(desc_id, col, flags);\n        SameLine();\n        TextEx(\"Color\");\n        EndDragDropSource();\n    }\n\n    // Tooltip\n    if (!(flags & ImGuiColorEditFlags_NoTooltip) && hovered)\n        ColorTooltip(desc_id, &col.x, flags & (ImGuiColorEditFlags_InputMask_ | ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_AlphaPreviewHalf));\n\n    return pressed;\n}\n\n// Initialize/override default color options\nvoid ImGui::SetColorEditOptions(ImGuiColorEditFlags flags)\n{\n    ImGuiContext& g = *GImGui;\n    if ((flags & ImGuiColorEditFlags_DisplayMask_) == 0)\n        flags |= ImGuiColorEditFlags_DefaultOptions_ & ImGuiColorEditFlags_DisplayMask_;\n    if ((flags & ImGuiColorEditFlags_DataTypeMask_) == 0)\n        flags |= ImGuiColorEditFlags_DefaultOptions_ & ImGuiColorEditFlags_DataTypeMask_;\n    if ((flags & ImGuiColorEditFlags_PickerMask_) == 0)\n        flags |= ImGuiColorEditFlags_DefaultOptions_ & ImGuiColorEditFlags_PickerMask_;\n    if ((flags & ImGuiColorEditFlags_InputMask_) == 0)\n        flags |= ImGuiColorEditFlags_DefaultOptions_ & ImGuiColorEditFlags_InputMask_;\n    IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiColorEditFlags_DisplayMask_));    // Check only 1 option is selected\n    IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiColorEditFlags_DataTypeMask_));   // Check only 1 option is selected\n    IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiColorEditFlags_PickerMask_));     // Check only 1 option is selected\n    IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiColorEditFlags_InputMask_));      // Check only 1 option is selected\n    g.ColorEditOptions = flags;\n}\n\n// Note: only access 3 floats if ImGuiColorEditFlags_NoAlpha flag is set.\nvoid ImGui::ColorTooltip(const char* text, const float* col, ImGuiColorEditFlags flags)\n{\n    ImGuiContext& g = *GImGui;\n\n    BeginTooltipEx(0, ImGuiTooltipFlags_OverridePreviousTooltip);\n    const char* text_end = text ? FindRenderedTextEnd(text, NULL) : text;\n    if (text_end > text)\n    {\n        TextEx(text, text_end);\n        Separator();\n    }\n\n    ImVec2 sz(g.FontSize * 3 + g.Style.FramePadding.y * 2, g.FontSize * 3 + g.Style.FramePadding.y * 2);\n    ImVec4 cf(col[0], col[1], col[2], (flags & ImGuiColorEditFlags_NoAlpha) ? 1.0f : col[3]);\n    int cr = IM_F32_TO_INT8_SAT(col[0]), cg = IM_F32_TO_INT8_SAT(col[1]), cb = IM_F32_TO_INT8_SAT(col[2]), ca = (flags & ImGuiColorEditFlags_NoAlpha) ? 255 : IM_F32_TO_INT8_SAT(col[3]);\n    ColorButton(\"##preview\", cf, (flags & (ImGuiColorEditFlags_InputMask_ | ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_AlphaPreviewHalf)) | ImGuiColorEditFlags_NoTooltip, sz);\n    SameLine();\n    if ((flags & ImGuiColorEditFlags_InputRGB) || !(flags & ImGuiColorEditFlags_InputMask_))\n    {\n        if (flags & ImGuiColorEditFlags_NoAlpha)\n            Text(\"#%02X%02X%02X\\nR: %d, G: %d, B: %d\\n(%.3f, %.3f, %.3f)\", cr, cg, cb, cr, cg, cb, col[0], col[1], col[2]);\n        else\n            Text(\"#%02X%02X%02X%02X\\nR:%d, G:%d, B:%d, A:%d\\n(%.3f, %.3f, %.3f, %.3f)\", cr, cg, cb, ca, cr, cg, cb, ca, col[0], col[1], col[2], col[3]);\n    }\n    else if (flags & ImGuiColorEditFlags_InputHSV)\n    {\n        if (flags & ImGuiColorEditFlags_NoAlpha)\n            Text(\"H: %.3f, S: %.3f, V: %.3f\", col[0], col[1], col[2]);\n        else\n            Text(\"H: %.3f, S: %.3f, V: %.3f, A: %.3f\", col[0], col[1], col[2], col[3]);\n    }\n    EndTooltip();\n}\n\nvoid ImGui::ColorEditOptionsPopup(const float* col, ImGuiColorEditFlags flags)\n{\n    bool allow_opt_inputs = !(flags & ImGuiColorEditFlags_DisplayMask_);\n    bool allow_opt_datatype = !(flags & ImGuiColorEditFlags_DataTypeMask_);\n    if ((!allow_opt_inputs && !allow_opt_datatype) || !BeginPopup(\"context\"))\n        return;\n    ImGuiContext& g = *GImGui;\n    ImGuiColorEditFlags opts = g.ColorEditOptions;\n    if (allow_opt_inputs)\n    {\n        if (RadioButton(\"RGB\", (opts & ImGuiColorEditFlags_DisplayRGB) != 0)) opts = (opts & ~ImGuiColorEditFlags_DisplayMask_) | ImGuiColorEditFlags_DisplayRGB;\n        if (RadioButton(\"HSV\", (opts & ImGuiColorEditFlags_DisplayHSV) != 0)) opts = (opts & ~ImGuiColorEditFlags_DisplayMask_) | ImGuiColorEditFlags_DisplayHSV;\n        if (RadioButton(\"Hex\", (opts & ImGuiColorEditFlags_DisplayHex) != 0)) opts = (opts & ~ImGuiColorEditFlags_DisplayMask_) | ImGuiColorEditFlags_DisplayHex;\n    }\n    if (allow_opt_datatype)\n    {\n        if (allow_opt_inputs) Separator();\n        if (RadioButton(\"0..255\",     (opts & ImGuiColorEditFlags_Uint8) != 0)) opts = (opts & ~ImGuiColorEditFlags_DataTypeMask_) | ImGuiColorEditFlags_Uint8;\n        if (RadioButton(\"0.00..1.00\", (opts & ImGuiColorEditFlags_Float) != 0)) opts = (opts & ~ImGuiColorEditFlags_DataTypeMask_) | ImGuiColorEditFlags_Float;\n    }\n\n    if (allow_opt_inputs || allow_opt_datatype)\n        Separator();\n    if (Button(\"Copy as..\", ImVec2(-1, 0)))\n        OpenPopup(\"Copy\");\n    if (BeginPopup(\"Copy\"))\n    {\n        int cr = IM_F32_TO_INT8_SAT(col[0]), cg = IM_F32_TO_INT8_SAT(col[1]), cb = IM_F32_TO_INT8_SAT(col[2]), ca = (flags & ImGuiColorEditFlags_NoAlpha) ? 255 : IM_F32_TO_INT8_SAT(col[3]);\n        char buf[64];\n        ImFormatString(buf, IM_ARRAYSIZE(buf), \"(%.3ff, %.3ff, %.3ff, %.3ff)\", col[0], col[1], col[2], (flags & ImGuiColorEditFlags_NoAlpha) ? 1.0f : col[3]);\n        if (Selectable(buf))\n            SetClipboardText(buf);\n        ImFormatString(buf, IM_ARRAYSIZE(buf), \"(%d,%d,%d,%d)\", cr, cg, cb, ca);\n        if (Selectable(buf))\n            SetClipboardText(buf);\n        ImFormatString(buf, IM_ARRAYSIZE(buf), \"#%02X%02X%02X\", cr, cg, cb);\n        if (Selectable(buf))\n            SetClipboardText(buf);\n        if (!(flags & ImGuiColorEditFlags_NoAlpha))\n        {\n            ImFormatString(buf, IM_ARRAYSIZE(buf), \"#%02X%02X%02X%02X\", cr, cg, cb, ca);\n            if (Selectable(buf))\n                SetClipboardText(buf);\n        }\n        EndPopup();\n    }\n\n    g.ColorEditOptions = opts;\n    EndPopup();\n}\n\nvoid ImGui::ColorPickerOptionsPopup(const float* ref_col, ImGuiColorEditFlags flags)\n{\n    bool allow_opt_picker = !(flags & ImGuiColorEditFlags_PickerMask_);\n    bool allow_opt_alpha_bar = !(flags & ImGuiColorEditFlags_NoAlpha) && !(flags & ImGuiColorEditFlags_AlphaBar);\n    if ((!allow_opt_picker && !allow_opt_alpha_bar) || !BeginPopup(\"context\"))\n        return;\n    ImGuiContext& g = *GImGui;\n    if (allow_opt_picker)\n    {\n        ImVec2 picker_size(g.FontSize * 8, ImMax(g.FontSize * 8 - (GetFrameHeight() + g.Style.ItemInnerSpacing.x), 1.0f)); // FIXME: Picker size copied from main picker function\n        PushItemWidth(picker_size.x);\n        for (int picker_type = 0; picker_type < 2; picker_type++)\n        {\n            // Draw small/thumbnail version of each picker type (over an invisible button for selection)\n            if (picker_type > 0) Separator();\n            PushID(picker_type);\n            ImGuiColorEditFlags picker_flags = ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoOptions | ImGuiColorEditFlags_NoLabel | ImGuiColorEditFlags_NoSidePreview | (flags & ImGuiColorEditFlags_NoAlpha);\n            if (picker_type == 0) picker_flags |= ImGuiColorEditFlags_PickerHueBar;\n            if (picker_type == 1) picker_flags |= ImGuiColorEditFlags_PickerHueWheel;\n            ImVec2 backup_pos = GetCursorScreenPos();\n            if (Selectable(\"##selectable\", false, 0, picker_size)) // By default, Selectable() is closing popup\n                g.ColorEditOptions = (g.ColorEditOptions & ~ImGuiColorEditFlags_PickerMask_) | (picker_flags & ImGuiColorEditFlags_PickerMask_);\n            SetCursorScreenPos(backup_pos);\n            ImVec4 previewing_ref_col;\n            memcpy(&previewing_ref_col, ref_col, sizeof(float) * ((picker_flags & ImGuiColorEditFlags_NoAlpha) ? 3 : 4));\n            ColorPicker4(\"##previewing_picker\", &previewing_ref_col.x, picker_flags);\n            PopID();\n        }\n        PopItemWidth();\n    }\n    if (allow_opt_alpha_bar)\n    {\n        if (allow_opt_picker) Separator();\n        CheckboxFlags(\"Alpha Bar\", &g.ColorEditOptions, ImGuiColorEditFlags_AlphaBar);\n    }\n    EndPopup();\n}\n\n//-------------------------------------------------------------------------\n// [SECTION] Widgets: TreeNode, CollapsingHeader, etc.\n//-------------------------------------------------------------------------\n// - TreeNode()\n// - TreeNodeV()\n// - TreeNodeEx()\n// - TreeNodeExV()\n// - TreeNodeBehavior() [Internal]\n// - TreePush()\n// - TreePop()\n// - GetTreeNodeToLabelSpacing()\n// - SetNextItemOpen()\n// - CollapsingHeader()\n//-------------------------------------------------------------------------\n\nbool ImGui::TreeNode(const char* str_id, const char* fmt, ...)\n{\n    va_list args;\n    va_start(args, fmt);\n    bool is_open = TreeNodeExV(str_id, 0, fmt, args);\n    va_end(args);\n    return is_open;\n}\n\nbool ImGui::TreeNode(const void* ptr_id, const char* fmt, ...)\n{\n    va_list args;\n    va_start(args, fmt);\n    bool is_open = TreeNodeExV(ptr_id, 0, fmt, args);\n    va_end(args);\n    return is_open;\n}\n\nbool ImGui::TreeNode(const char* label)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return false;\n    return TreeNodeBehavior(window->GetID(label), 0, label, NULL);\n}\n\nbool ImGui::TreeNodeV(const char* str_id, const char* fmt, va_list args)\n{\n    return TreeNodeExV(str_id, 0, fmt, args);\n}\n\nbool ImGui::TreeNodeV(const void* ptr_id, const char* fmt, va_list args)\n{\n    return TreeNodeExV(ptr_id, 0, fmt, args);\n}\n\nbool ImGui::TreeNodeEx(const char* label, ImGuiTreeNodeFlags flags)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return false;\n\n    return TreeNodeBehavior(window->GetID(label), flags, label, NULL);\n}\n\nbool ImGui::TreeNodeEx(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, ...)\n{\n    va_list args;\n    va_start(args, fmt);\n    bool is_open = TreeNodeExV(str_id, flags, fmt, args);\n    va_end(args);\n    return is_open;\n}\n\nbool ImGui::TreeNodeEx(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, ...)\n{\n    va_list args;\n    va_start(args, fmt);\n    bool is_open = TreeNodeExV(ptr_id, flags, fmt, args);\n    va_end(args);\n    return is_open;\n}\n\nbool ImGui::TreeNodeExV(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return false;\n\n    ImGuiContext& g = *GImGui;\n    const char* label_end = g.TempBuffer + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args);\n    return TreeNodeBehavior(window->GetID(str_id), flags, g.TempBuffer, label_end);\n}\n\nbool ImGui::TreeNodeExV(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return false;\n\n    ImGuiContext& g = *GImGui;\n    const char* label_end = g.TempBuffer + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args);\n    return TreeNodeBehavior(window->GetID(ptr_id), flags, g.TempBuffer, label_end);\n}\n\nbool ImGui::TreeNodeBehaviorIsOpen(ImGuiID id, ImGuiTreeNodeFlags flags)\n{\n    if (flags & ImGuiTreeNodeFlags_Leaf)\n        return true;\n\n    // We only write to the tree storage if the user clicks (or explicitly use the SetNextItemOpen function)\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    ImGuiStorage* storage = window->DC.StateStorage;\n\n    bool is_open;\n    if (g.NextItemData.Flags & ImGuiNextItemDataFlags_HasOpen)\n    {\n        if (g.NextItemData.OpenCond & ImGuiCond_Always)\n        {\n            is_open = g.NextItemData.OpenVal;\n            storage->SetInt(id, is_open);\n        }\n        else\n        {\n            // We treat ImGuiCond_Once and ImGuiCond_FirstUseEver the same because tree node state are not saved persistently.\n            const int stored_value = storage->GetInt(id, -1);\n            if (stored_value == -1)\n            {\n                is_open = g.NextItemData.OpenVal;\n                storage->SetInt(id, is_open);\n            }\n            else\n            {\n                is_open = stored_value != 0;\n            }\n        }\n    }\n    else\n    {\n        is_open = storage->GetInt(id, (flags & ImGuiTreeNodeFlags_DefaultOpen) ? 1 : 0) != 0;\n    }\n\n    // When logging is enabled, we automatically expand tree nodes (but *NOT* collapsing headers.. seems like sensible behavior).\n    // NB- If we are above max depth we still allow manually opened nodes to be logged.\n    if (g.LogEnabled && !(flags & ImGuiTreeNodeFlags_NoAutoOpenOnLog) && (window->DC.TreeDepth - g.LogDepthRef) < g.LogDepthToExpand)\n        is_open = true;\n\n    return is_open;\n}\n\nbool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* label, const char* label_end)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return false;\n\n    ImGuiContext& g = *GImGui;\n    const ImGuiStyle& style = g.Style;\n    const bool display_frame = (flags & ImGuiTreeNodeFlags_Framed) != 0;\n    const ImVec2 padding = (display_frame || (flags & ImGuiTreeNodeFlags_FramePadding)) ? style.FramePadding : ImVec2(style.FramePadding.x, ImMin(window->DC.CurrLineTextBaseOffset, style.FramePadding.y));\n\n    if (!label_end)\n        label_end = FindRenderedTextEnd(label);\n    const ImVec2 label_size = CalcTextSize(label, label_end, false);\n\n    // We vertically grow up to current line height up the typical widget height.\n    const float frame_height = ImMax(ImMin(window->DC.CurrLineSize.y, g.FontSize + style.FramePadding.y * 2), label_size.y + padding.y * 2);\n    ImRect frame_bb;\n    frame_bb.Min.x = (flags & ImGuiTreeNodeFlags_SpanFullWidth) ? window->WorkRect.Min.x : window->DC.CursorPos.x;\n    frame_bb.Min.y = window->DC.CursorPos.y;\n    frame_bb.Max.x = window->WorkRect.Max.x;\n    frame_bb.Max.y = window->DC.CursorPos.y + frame_height;\n    if (display_frame)\n    {\n        // Framed header expand a little outside the default padding, to the edge of InnerClipRect\n        // (FIXME: May remove this at some point and make InnerClipRect align with WindowPadding.x instead of WindowPadding.x*0.5f)\n        frame_bb.Min.x -= IM_FLOOR(window->WindowPadding.x * 0.5f - 1.0f);\n        frame_bb.Max.x += IM_FLOOR(window->WindowPadding.x * 0.5f);\n    }\n\n    const float text_offset_x = g.FontSize + (display_frame ? padding.x * 3 : padding.x * 2);           // Collapser arrow width + Spacing\n    const float text_offset_y = ImMax(padding.y, window->DC.CurrLineTextBaseOffset);                    // Latch before ItemSize changes it\n    const float text_width = g.FontSize + (label_size.x > 0.0f ? label_size.x + padding.x * 2 : 0.0f);  // Include collapser\n    ImVec2 text_pos(window->DC.CursorPos.x + text_offset_x, window->DC.CursorPos.y + text_offset_y);\n    ItemSize(ImVec2(text_width, frame_height), padding.y);\n\n    // For regular tree nodes, we arbitrary allow to click past 2 worth of ItemSpacing\n    ImRect interact_bb = frame_bb;\n    if (!display_frame && (flags & (ImGuiTreeNodeFlags_SpanAvailWidth | ImGuiTreeNodeFlags_SpanFullWidth)) == 0)\n        interact_bb.Max.x = frame_bb.Min.x + text_width + style.ItemSpacing.x * 2.0f;\n\n    // Store a flag for the current depth to tell if we will allow closing this node when navigating one of its child.\n    // For this purpose we essentially compare if g.NavIdIsAlive went from 0 to 1 between TreeNode() and TreePop().\n    // This is currently only support 32 level deep and we are fine with (1 << Depth) overflowing into a zero.\n    const bool is_leaf = (flags & ImGuiTreeNodeFlags_Leaf) != 0;\n    bool is_open = TreeNodeBehaviorIsOpen(id, flags);\n    if (is_open && !g.NavIdIsAlive && (flags & ImGuiTreeNodeFlags_NavLeftJumpsBackHere) && !(flags & ImGuiTreeNodeFlags_NoTreePushOnOpen))\n        window->DC.TreeJumpToParentOnPopMask |= (1 << window->DC.TreeDepth);\n\n    bool item_add = ItemAdd(interact_bb, id);\n    g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_HasDisplayRect;\n    g.LastItemData.DisplayRect = frame_bb;\n\n    if (!item_add)\n    {\n        if (is_open && !(flags & ImGuiTreeNodeFlags_NoTreePushOnOpen))\n            TreePushOverrideID(id);\n        IMGUI_TEST_ENGINE_ITEM_INFO(g.LastItemData.ID, label, g.LastItemData.StatusFlags | (is_leaf ? 0 : ImGuiItemStatusFlags_Openable) | (is_open ? ImGuiItemStatusFlags_Opened : 0));\n        return is_open;\n    }\n\n    ImGuiButtonFlags button_flags = ImGuiTreeNodeFlags_None;\n    if (flags & ImGuiTreeNodeFlags_AllowItemOverlap)\n        button_flags |= ImGuiButtonFlags_AllowItemOverlap;\n    if (!is_leaf)\n        button_flags |= ImGuiButtonFlags_PressedOnDragDropHold;\n\n    // We allow clicking on the arrow section with keyboard modifiers held, in order to easily\n    // allow browsing a tree while preserving selection with code implementing multi-selection patterns.\n    // When clicking on the rest of the tree node we always disallow keyboard modifiers.\n    const float arrow_hit_x1 = (text_pos.x - text_offset_x) - style.TouchExtraPadding.x;\n    const float arrow_hit_x2 = (text_pos.x - text_offset_x) + (g.FontSize + padding.x * 2.0f) + style.TouchExtraPadding.x;\n    const bool is_mouse_x_over_arrow = (g.IO.MousePos.x >= arrow_hit_x1 && g.IO.MousePos.x < arrow_hit_x2);\n    if (window != g.HoveredWindow || !is_mouse_x_over_arrow)\n        button_flags |= ImGuiButtonFlags_NoKeyModifiers;\n\n    // Open behaviors can be altered with the _OpenOnArrow and _OnOnDoubleClick flags.\n    // Some alteration have subtle effects (e.g. toggle on MouseUp vs MouseDown events) due to requirements for multi-selection and drag and drop support.\n    // - Single-click on label = Toggle on MouseUp (default, when _OpenOnArrow=0)\n    // - Single-click on arrow = Toggle on MouseDown (when _OpenOnArrow=0)\n    // - Single-click on arrow = Toggle on MouseDown (when _OpenOnArrow=1)\n    // - Double-click on label = Toggle on MouseDoubleClick (when _OpenOnDoubleClick=1)\n    // - Double-click on arrow = Toggle on MouseDoubleClick (when _OpenOnDoubleClick=1 and _OpenOnArrow=0)\n    // It is rather standard that arrow click react on Down rather than Up.\n    // We set ImGuiButtonFlags_PressedOnClickRelease on OpenOnDoubleClick because we want the item to be active on the initial MouseDown in order for drag and drop to work.\n    if (is_mouse_x_over_arrow)\n        button_flags |= ImGuiButtonFlags_PressedOnClick;\n    else if (flags & ImGuiTreeNodeFlags_OpenOnDoubleClick)\n        button_flags |= ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnDoubleClick;\n    else\n        button_flags |= ImGuiButtonFlags_PressedOnClickRelease;\n\n    bool selected = (flags & ImGuiTreeNodeFlags_Selected) != 0;\n    const bool was_selected = selected;\n\n    bool hovered, held;\n    bool pressed = ButtonBehavior(interact_bb, id, &hovered, &held, button_flags);\n    bool toggled = false;\n    if (!is_leaf)\n    {\n        if (pressed && g.DragDropHoldJustPressedId != id)\n        {\n            if ((flags & (ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_OpenOnDoubleClick)) == 0 || (g.NavActivateId == id))\n                toggled = true;\n            if (flags & ImGuiTreeNodeFlags_OpenOnArrow)\n                toggled |= is_mouse_x_over_arrow && !g.NavDisableMouseHover; // Lightweight equivalent of IsMouseHoveringRect() since ButtonBehavior() already did the job\n            if ((flags & ImGuiTreeNodeFlags_OpenOnDoubleClick) && g.IO.MouseDoubleClicked[0])\n                toggled = true;\n        }\n        else if (pressed && g.DragDropHoldJustPressedId == id)\n        {\n            IM_ASSERT(button_flags & ImGuiButtonFlags_PressedOnDragDropHold);\n            if (!is_open) // When using Drag and Drop \"hold to open\" we keep the node highlighted after opening, but never close it again.\n                toggled = true;\n        }\n\n        if (g.NavId == id && g.NavMoveRequest && g.NavMoveDir == ImGuiDir_Left && is_open)\n        {\n            toggled = true;\n            NavMoveRequestCancel();\n        }\n        if (g.NavId == id && g.NavMoveRequest && g.NavMoveDir == ImGuiDir_Right && !is_open) // If there's something upcoming on the line we may want to give it the priority?\n        {\n            toggled = true;\n            NavMoveRequestCancel();\n        }\n\n        if (toggled)\n        {\n            is_open = !is_open;\n            window->DC.StateStorage->SetInt(id, is_open);\n            g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_ToggledOpen;\n        }\n    }\n    if (flags & ImGuiTreeNodeFlags_AllowItemOverlap)\n        SetItemAllowOverlap();\n\n    // In this branch, TreeNodeBehavior() cannot toggle the selection so this will never trigger.\n    if (selected != was_selected) //-V547\n        g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_ToggledSelection;\n\n    // Render\n    const ImU32 text_col = GetColorU32(ImGuiCol_Text);\n    ImGuiNavHighlightFlags nav_highlight_flags = ImGuiNavHighlightFlags_TypeThin;\n    if (display_frame)\n    {\n        // Framed type\n        const ImU32 bg_col = GetColorU32((held && hovered) ? ImGuiCol_HeaderActive : hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header);\n        RenderFrame(frame_bb.Min, frame_bb.Max, bg_col, true, style.FrameRounding);\n        RenderNavHighlight(frame_bb, id, nav_highlight_flags);\n        if (flags & ImGuiTreeNodeFlags_Bullet)\n            RenderBullet(window->DrawList, ImVec2(text_pos.x - text_offset_x * 0.60f, text_pos.y + g.FontSize * 0.5f), text_col);\n        else if (!is_leaf)\n            RenderArrow(window->DrawList, ImVec2(text_pos.x - text_offset_x + padding.x, text_pos.y), text_col, is_open ? ImGuiDir_Down : ImGuiDir_Right, 1.0f);\n        else // Leaf without bullet, left-adjusted text\n            text_pos.x -= text_offset_x;\n        if (flags & ImGuiTreeNodeFlags_ClipLabelForTrailingButton)\n            frame_bb.Max.x -= g.FontSize + style.FramePadding.x;\n\n        if (g.LogEnabled)\n            LogSetNextTextDecoration(\"###\", \"###\");\n        RenderTextClipped(text_pos, frame_bb.Max, label, label_end, &label_size);\n    }\n    else\n    {\n        // Unframed typed for tree nodes\n        if (hovered || selected)\n        {\n            const ImU32 bg_col = GetColorU32((held && hovered) ? ImGuiCol_HeaderActive : hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header);\n            RenderFrame(frame_bb.Min, frame_bb.Max, bg_col, false);\n        }\n        RenderNavHighlight(frame_bb, id, nav_highlight_flags);\n        if (flags & ImGuiTreeNodeFlags_Bullet)\n            RenderBullet(window->DrawList, ImVec2(text_pos.x - text_offset_x * 0.5f, text_pos.y + g.FontSize * 0.5f), text_col);\n        else if (!is_leaf)\n            RenderArrow(window->DrawList, ImVec2(text_pos.x - text_offset_x + padding.x, text_pos.y + g.FontSize * 0.15f), text_col, is_open ? ImGuiDir_Down : ImGuiDir_Right, 0.70f);\n        if (g.LogEnabled)\n            LogSetNextTextDecoration(\">\", NULL);\n        RenderText(text_pos, label, label_end, false);\n    }\n\n    if (is_open && !(flags & ImGuiTreeNodeFlags_NoTreePushOnOpen))\n        TreePushOverrideID(id);\n    IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags | (is_leaf ? 0 : ImGuiItemStatusFlags_Openable) | (is_open ? ImGuiItemStatusFlags_Opened : 0));\n    return is_open;\n}\n\nvoid ImGui::TreePush(const char* str_id)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    Indent();\n    window->DC.TreeDepth++;\n    PushID(str_id ? str_id : \"#TreePush\");\n}\n\nvoid ImGui::TreePush(const void* ptr_id)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    Indent();\n    window->DC.TreeDepth++;\n    PushID(ptr_id ? ptr_id : (const void*)\"#TreePush\");\n}\n\nvoid ImGui::TreePushOverrideID(ImGuiID id)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    Indent();\n    window->DC.TreeDepth++;\n    window->IDStack.push_back(id);\n}\n\nvoid ImGui::TreePop()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    Unindent();\n\n    window->DC.TreeDepth--;\n    ImU32 tree_depth_mask = (1 << window->DC.TreeDepth);\n\n    // Handle Left arrow to move to parent tree node (when ImGuiTreeNodeFlags_NavLeftJumpsBackHere is enabled)\n    if (g.NavMoveDir == ImGuiDir_Left && g.NavWindow == window && NavMoveRequestButNoResultYet())\n        if (g.NavIdIsAlive && (window->DC.TreeJumpToParentOnPopMask & tree_depth_mask))\n        {\n            SetNavID(window->IDStack.back(), g.NavLayer, 0, ImRect());\n            NavMoveRequestCancel();\n        }\n    window->DC.TreeJumpToParentOnPopMask &= tree_depth_mask - 1;\n\n    IM_ASSERT(window->IDStack.Size > 1); // There should always be 1 element in the IDStack (pushed during window creation). If this triggers you called TreePop/PopID too much.\n    PopID();\n}\n\n// Horizontal distance preceding label when using TreeNode() or Bullet()\nfloat ImGui::GetTreeNodeToLabelSpacing()\n{\n    ImGuiContext& g = *GImGui;\n    return g.FontSize + (g.Style.FramePadding.x * 2.0f);\n}\n\n// Set next TreeNode/CollapsingHeader open state.\nvoid ImGui::SetNextItemOpen(bool is_open, ImGuiCond cond)\n{\n    ImGuiContext& g = *GImGui;\n    if (g.CurrentWindow->SkipItems)\n        return;\n    g.NextItemData.Flags |= ImGuiNextItemDataFlags_HasOpen;\n    g.NextItemData.OpenVal = is_open;\n    g.NextItemData.OpenCond = cond ? cond : ImGuiCond_Always;\n}\n\n// CollapsingHeader returns true when opened but do not indent nor push into the ID stack (because of the ImGuiTreeNodeFlags_NoTreePushOnOpen flag).\n// This is basically the same as calling TreeNodeEx(label, ImGuiTreeNodeFlags_CollapsingHeader). You can remove the _NoTreePushOnOpen flag if you want behavior closer to normal TreeNode().\nbool ImGui::CollapsingHeader(const char* label, ImGuiTreeNodeFlags flags)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return false;\n\n    return TreeNodeBehavior(window->GetID(label), flags | ImGuiTreeNodeFlags_CollapsingHeader, label);\n}\n\n// p_visible == NULL                        : regular collapsing header\n// p_visible != NULL && *p_visible == true  : show a small close button on the corner of the header, clicking the button will set *p_visible = false\n// p_visible != NULL && *p_visible == false : do not show the header at all\n// Do not mistake this with the Open state of the header itself, which you can adjust with SetNextItemOpen() or ImGuiTreeNodeFlags_DefaultOpen.\nbool ImGui::CollapsingHeader(const char* label, bool* p_visible, ImGuiTreeNodeFlags flags)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return false;\n\n    if (p_visible && !*p_visible)\n        return false;\n\n    ImGuiID id = window->GetID(label);\n    flags |= ImGuiTreeNodeFlags_CollapsingHeader;\n    if (p_visible)\n        flags |= ImGuiTreeNodeFlags_AllowItemOverlap | ImGuiTreeNodeFlags_ClipLabelForTrailingButton;\n    bool is_open = TreeNodeBehavior(id, flags, label);\n    if (p_visible != NULL)\n    {\n        // Create a small overlapping close button\n        // FIXME: We can evolve this into user accessible helpers to add extra buttons on title bars, headers, etc.\n        // FIXME: CloseButton can overlap into text, need find a way to clip the text somehow.\n        ImGuiContext& g = *GImGui;\n        ImGuiLastItemData last_item_backup = g.LastItemData;\n        float button_size = g.FontSize;\n        float button_x = ImMax(g.LastItemData.Rect.Min.x, g.LastItemData.Rect.Max.x - g.Style.FramePadding.x * 2.0f - button_size);\n        float button_y = g.LastItemData.Rect.Min.y;\n        ImGuiID close_button_id = GetIDWithSeed(\"#CLOSE\", NULL, id);\n        if (CloseButton(close_button_id, ImVec2(button_x, button_y)))\n            *p_visible = false;\n        g.LastItemData = last_item_backup;\n    }\n\n    return is_open;\n}\n\n//-------------------------------------------------------------------------\n// [SECTION] Widgets: Selectable\n//-------------------------------------------------------------------------\n// - Selectable()\n//-------------------------------------------------------------------------\n\n// Tip: pass a non-visible label (e.g. \"##hello\") then you can use the space to draw other text or image.\n// But you need to make sure the ID is unique, e.g. enclose calls in PushID/PopID or use ##unique_id.\n// With this scheme, ImGuiSelectableFlags_SpanAllColumns and ImGuiSelectableFlags_AllowItemOverlap are also frequently used flags.\n// FIXME: Selectable() with (size.x == 0.0f) and (SelectableTextAlign.x > 0.0f) followed by SameLine() is currently not supported.\nbool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags flags, const ImVec2& size_arg)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return false;\n\n    ImGuiContext& g = *GImGui;\n    const ImGuiStyle& style = g.Style;\n\n    // Submit label or explicit size to ItemSize(), whereas ItemAdd() will submit a larger/spanning rectangle.\n    ImGuiID id = window->GetID(label);\n    ImVec2 label_size = CalcTextSize(label, NULL, true);\n    ImVec2 size(size_arg.x != 0.0f ? size_arg.x : label_size.x, size_arg.y != 0.0f ? size_arg.y : label_size.y);\n    ImVec2 pos = window->DC.CursorPos;\n    pos.y += window->DC.CurrLineTextBaseOffset;\n    ItemSize(size, 0.0f);\n\n    // Fill horizontal space\n    // We don't support (size < 0.0f) in Selectable() because the ItemSpacing extension would make explicitly right-aligned sizes not visibly match other widgets.\n    const bool span_all_columns = (flags & ImGuiSelectableFlags_SpanAllColumns) != 0;\n    const float min_x = span_all_columns ? window->ParentWorkRect.Min.x : pos.x;\n    const float max_x = span_all_columns ? window->ParentWorkRect.Max.x : window->WorkRect.Max.x;\n    if (size_arg.x == 0.0f || (flags & ImGuiSelectableFlags_SpanAvailWidth))\n        size.x = ImMax(label_size.x, max_x - min_x);\n\n    // Text stays at the submission position, but bounding box may be extended on both sides\n    const ImVec2 text_min = pos;\n    const ImVec2 text_max(min_x + size.x, pos.y + size.y);\n\n    // Selectables are meant to be tightly packed together with no click-gap, so we extend their box to cover spacing between selectable.\n    ImRect bb(min_x, pos.y, text_max.x, text_max.y);\n    if ((flags & ImGuiSelectableFlags_NoPadWithHalfSpacing) == 0)\n    {\n        const float spacing_x = span_all_columns ? 0.0f : style.ItemSpacing.x;\n        const float spacing_y = style.ItemSpacing.y;\n        const float spacing_L = IM_FLOOR(spacing_x * 0.50f);\n        const float spacing_U = IM_FLOOR(spacing_y * 0.50f);\n        bb.Min.x -= spacing_L;\n        bb.Min.y -= spacing_U;\n        bb.Max.x += (spacing_x - spacing_L);\n        bb.Max.y += (spacing_y - spacing_U);\n    }\n    //if (g.IO.KeyCtrl) { GetForegroundDrawList()->AddRect(bb.Min, bb.Max, IM_COL32(0, 255, 0, 255)); }\n\n    // Modify ClipRect for the ItemAdd(), faster than doing a PushColumnsBackground/PushTableBackground for every Selectable..\n    const float backup_clip_rect_min_x = window->ClipRect.Min.x;\n    const float backup_clip_rect_max_x = window->ClipRect.Max.x;\n    if (span_all_columns)\n    {\n        window->ClipRect.Min.x = window->ParentWorkRect.Min.x;\n        window->ClipRect.Max.x = window->ParentWorkRect.Max.x;\n    }\n\n    bool item_add;\n    const bool disabled_item = (flags & ImGuiSelectableFlags_Disabled) != 0;\n    if (disabled_item)\n    {\n        ImGuiItemFlags backup_item_flags = g.CurrentItemFlags;\n        g.CurrentItemFlags |= ImGuiItemFlags_Disabled;\n        item_add = ItemAdd(bb, id);\n        g.CurrentItemFlags = backup_item_flags;\n    }\n    else\n    {\n        item_add = ItemAdd(bb, id);\n    }\n\n    if (span_all_columns)\n    {\n        window->ClipRect.Min.x = backup_clip_rect_min_x;\n        window->ClipRect.Max.x = backup_clip_rect_max_x;\n    }\n\n    if (!item_add)\n        return false;\n\n    const bool disabled_global = (g.CurrentItemFlags & ImGuiItemFlags_Disabled) != 0;\n    if (disabled_item && !disabled_global) // Only testing this as an optimization\n        BeginDisabled(true);\n\n    // FIXME: We can standardize the behavior of those two, we could also keep the fast path of override ClipRect + full push on render only,\n    // which would be advantageous since most selectable are not selected.\n    if (span_all_columns && window->DC.CurrentColumns)\n        PushColumnsBackground();\n    else if (span_all_columns && g.CurrentTable)\n        TablePushBackgroundChannel();\n\n    // We use NoHoldingActiveID on menus so user can click and _hold_ on a menu then drag to browse child entries\n    ImGuiButtonFlags button_flags = 0;\n    if (flags & ImGuiSelectableFlags_NoHoldingActiveID) { button_flags |= ImGuiButtonFlags_NoHoldingActiveId; }\n    if (flags & ImGuiSelectableFlags_SelectOnClick)     { button_flags |= ImGuiButtonFlags_PressedOnClick; }\n    if (flags & ImGuiSelectableFlags_SelectOnRelease)   { button_flags |= ImGuiButtonFlags_PressedOnRelease; }\n    if (flags & ImGuiSelectableFlags_AllowDoubleClick)  { button_flags |= ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnDoubleClick; }\n    if (flags & ImGuiSelectableFlags_AllowItemOverlap)  { button_flags |= ImGuiButtonFlags_AllowItemOverlap; }\n\n    const bool was_selected = selected;\n    bool hovered, held;\n    bool pressed = ButtonBehavior(bb, id, &hovered, &held, button_flags);\n\n    // Auto-select when moved into\n    // - This will be more fully fleshed in the range-select branch\n    // - This is not exposed as it won't nicely work with some user side handling of shift/control\n    // - We cannot do 'if (g.NavJustMovedToId != id) { selected = false; pressed = was_selected; }' for two reasons\n    //   - (1) it would require focus scope to be set, need exposing PushFocusScope() or equivalent (e.g. BeginSelection() calling PushFocusScope())\n    //   - (2) usage will fail with clipped items\n    //   The multi-select API aim to fix those issues, e.g. may be replaced with a BeginSelection() API.\n    if ((flags & ImGuiSelectableFlags_SelectOnNav) && g.NavJustMovedToId != 0 && g.NavJustMovedToFocusScopeId == window->DC.NavFocusScopeIdCurrent)\n        if (g.NavJustMovedToId == id)\n            selected = pressed = true;\n\n    // Update NavId when clicking or when Hovering (this doesn't happen on most widgets), so navigation can be resumed with gamepad/keyboard\n    if (pressed || (hovered && (flags & ImGuiSelectableFlags_SetNavIdOnHover)))\n    {\n        if (!g.NavDisableMouseHover && g.NavWindow == window && g.NavLayer == window->DC.NavLayerCurrent)\n        {\n            SetNavID(id, window->DC.NavLayerCurrent, window->DC.NavFocusScopeIdCurrent, ImRect(bb.Min - window->Pos, bb.Max - window->Pos));\n            g.NavDisableHighlight = true;\n        }\n    }\n    if (pressed)\n        MarkItemEdited(id);\n\n    if (flags & ImGuiSelectableFlags_AllowItemOverlap)\n        SetItemAllowOverlap();\n\n    // In this branch, Selectable() cannot toggle the selection so this will never trigger.\n    if (selected != was_selected) //-V547\n        g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_ToggledSelection;\n\n    // Render\n    if (held && (flags & ImGuiSelectableFlags_DrawHoveredWhenHeld))\n        hovered = true;\n    if (hovered || selected)\n    {\n        const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_HeaderActive : hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header);\n        RenderFrame(bb.Min, bb.Max, col, false, 0.0f);\n    }\n    RenderNavHighlight(bb, id, ImGuiNavHighlightFlags_TypeThin | ImGuiNavHighlightFlags_NoRounding);\n\n    if (span_all_columns && window->DC.CurrentColumns)\n        PopColumnsBackground();\n    else if (span_all_columns && g.CurrentTable)\n        TablePopBackgroundChannel();\n\n    RenderTextClipped(text_min, text_max, label, NULL, &label_size, style.SelectableTextAlign, &bb);\n\n    // Automatically close popups\n    if (pressed && (window->Flags & ImGuiWindowFlags_Popup) && !(flags & ImGuiSelectableFlags_DontClosePopups) && !(g.LastItemData.InFlags & ImGuiItemFlags_SelectableDontClosePopup))\n        CloseCurrentPopup();\n\n    if (disabled_item && !disabled_global)\n        EndDisabled();\n\n    IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags);\n    return pressed; //-V1020\n}\n\nbool ImGui::Selectable(const char* label, bool* p_selected, ImGuiSelectableFlags flags, const ImVec2& size_arg)\n{\n    if (Selectable(label, *p_selected, flags, size_arg))\n    {\n        *p_selected = !*p_selected;\n        return true;\n    }\n    return false;\n}\n\n//-------------------------------------------------------------------------\n// [SECTION] Widgets: ListBox\n//-------------------------------------------------------------------------\n// - BeginListBox()\n// - EndListBox()\n// - ListBox()\n//-------------------------------------------------------------------------\n\n// Tip: To have a list filling the entire window width, use size.x = -FLT_MIN and pass an non-visible label e.g. \"##empty\"\n// Tip: If your vertical size is calculated from an item count (e.g. 10 * item_height) consider adding a fractional part to facilitate seeing scrolling boundaries (e.g. 10.25 * item_height).\nbool ImGui::BeginListBox(const char* label, const ImVec2& size_arg)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return false;\n\n    const ImGuiStyle& style = g.Style;\n    const ImGuiID id = GetID(label);\n    const ImVec2 label_size = CalcTextSize(label, NULL, true);\n\n    // Size default to hold ~7.25 items.\n    // Fractional number of items helps seeing that we can scroll down/up without looking at scrollbar.\n    ImVec2 size = ImFloor(CalcItemSize(size_arg, CalcItemWidth(), GetTextLineHeightWithSpacing() * 7.25f + style.FramePadding.y * 2.0f));\n    ImVec2 frame_size = ImVec2(size.x, ImMax(size.y, label_size.y));\n    ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + frame_size);\n    ImRect bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));\n    g.NextItemData.ClearFlags();\n\n    if (!IsRectVisible(bb.Min, bb.Max))\n    {\n        ItemSize(bb.GetSize(), style.FramePadding.y);\n        ItemAdd(bb, 0, &frame_bb);\n        return false;\n    }\n\n    // FIXME-OPT: We could omit the BeginGroup() if label_size.x but would need to omit the EndGroup() as well.\n    BeginGroup();\n    if (label_size.x > 0.0f)\n    {\n        ImVec2 label_pos = ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y);\n        RenderText(label_pos, label);\n        window->DC.CursorMaxPos = ImMax(window->DC.CursorMaxPos, label_pos + label_size);\n    }\n\n    BeginChildFrame(id, frame_bb.GetSize());\n    return true;\n}\n\n#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS\n// OBSOLETED in 1.81 (from February 2021)\nbool ImGui::ListBoxHeader(const char* label, int items_count, int height_in_items)\n{\n    // If height_in_items == -1, default height is maximum 7.\n    ImGuiContext& g = *GImGui;\n    float height_in_items_f = (height_in_items < 0 ? ImMin(items_count, 7) : height_in_items) + 0.25f;\n    ImVec2 size;\n    size.x = 0.0f;\n    size.y = GetTextLineHeightWithSpacing() * height_in_items_f + g.Style.FramePadding.y * 2.0f;\n    return BeginListBox(label, size);\n}\n#endif\n\nvoid ImGui::EndListBox()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    IM_ASSERT((window->Flags & ImGuiWindowFlags_ChildWindow) && \"Mismatched BeginListBox/EndListBox calls. Did you test the return value of BeginListBox?\");\n    IM_UNUSED(window);\n\n    EndChildFrame();\n    EndGroup(); // This is only required to be able to do IsItemXXX query on the whole ListBox including label\n}\n\nbool ImGui::ListBox(const char* label, int* current_item, const char* const items[], int items_count, int height_items)\n{\n    const bool value_changed = ListBox(label, current_item, Items_ArrayGetter, (void*)items, items_count, height_items);\n    return value_changed;\n}\n\n// This is merely a helper around BeginListBox(), EndListBox().\n// Considering using those directly to submit custom data or store selection differently.\nbool ImGui::ListBox(const char* label, int* current_item, bool (*items_getter)(void*, int, const char**), void* data, int items_count, int height_in_items)\n{\n    ImGuiContext& g = *GImGui;\n\n    // Calculate size from \"height_in_items\"\n    if (height_in_items < 0)\n        height_in_items = ImMin(items_count, 7);\n    float height_in_items_f = height_in_items + 0.25f;\n    ImVec2 size(0.0f, ImFloor(GetTextLineHeightWithSpacing() * height_in_items_f + g.Style.FramePadding.y * 2.0f));\n\n    if (!BeginListBox(label, size))\n        return false;\n\n    // Assume all items have even height (= 1 line of text). If you need items of different height,\n    // you can create a custom version of ListBox() in your code without using the clipper.\n    bool value_changed = false;\n    ImGuiListClipper clipper;\n    clipper.Begin(items_count, GetTextLineHeightWithSpacing()); // We know exactly our line height here so we pass it as a minor optimization, but generally you don't need to.\n    while (clipper.Step())\n        for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++)\n        {\n            const char* item_text;\n            if (!items_getter(data, i, &item_text))\n                item_text = \"*Unknown item*\";\n\n            PushID(i);\n            const bool item_selected = (i == *current_item);\n            if (Selectable(item_text, item_selected))\n            {\n                *current_item = i;\n                value_changed = true;\n            }\n            if (item_selected)\n                SetItemDefaultFocus();\n            PopID();\n        }\n    EndListBox();\n\n    if (value_changed)\n        MarkItemEdited(g.LastItemData.ID);\n\n    return value_changed;\n}\n\n//-------------------------------------------------------------------------\n// [SECTION] Widgets: PlotLines, PlotHistogram\n//-------------------------------------------------------------------------\n// - PlotEx() [Internal]\n// - PlotLines()\n// - PlotHistogram()\n//-------------------------------------------------------------------------\n// Plot/Graph widgets are not very good.\n// Consider writing your own, or using a third-party one, see:\n// - ImPlot https://github.com/epezent/implot\n// - others https://github.com/ocornut/imgui/wiki/Useful-Extensions\n//-------------------------------------------------------------------------\n\nint ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 frame_size)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return -1;\n\n    const ImGuiStyle& style = g.Style;\n    const ImGuiID id = window->GetID(label);\n\n    const ImVec2 label_size = CalcTextSize(label, NULL, true);\n    if (frame_size.x == 0.0f)\n        frame_size.x = CalcItemWidth();\n    if (frame_size.y == 0.0f)\n        frame_size.y = label_size.y + (style.FramePadding.y * 2);\n\n    const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + frame_size);\n    const ImRect inner_bb(frame_bb.Min + style.FramePadding, frame_bb.Max - style.FramePadding);\n    const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0));\n    ItemSize(total_bb, style.FramePadding.y);\n    if (!ItemAdd(total_bb, 0, &frame_bb))\n        return -1;\n    const bool hovered = ItemHoverable(frame_bb, id);\n\n    // Determine scale from values if not specified\n    if (scale_min == FLT_MAX || scale_max == FLT_MAX)\n    {\n        float v_min = FLT_MAX;\n        float v_max = -FLT_MAX;\n        for (int i = 0; i < values_count; i++)\n        {\n            const float v = values_getter(data, i);\n            if (v != v) // Ignore NaN values\n                continue;\n            v_min = ImMin(v_min, v);\n            v_max = ImMax(v_max, v);\n        }\n        if (scale_min == FLT_MAX)\n            scale_min = v_min;\n        if (scale_max == FLT_MAX)\n            scale_max = v_max;\n    }\n\n    RenderFrame(frame_bb.Min, frame_bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding);\n\n    const int values_count_min = (plot_type == ImGuiPlotType_Lines) ? 2 : 1;\n    int idx_hovered = -1;\n    if (values_count >= values_count_min)\n    {\n        int res_w = ImMin((int)frame_size.x, values_count) + ((plot_type == ImGuiPlotType_Lines) ? -1 : 0);\n        int item_count = values_count + ((plot_type == ImGuiPlotType_Lines) ? -1 : 0);\n\n        // Tooltip on hover\n        if (hovered && inner_bb.Contains(g.IO.MousePos))\n        {\n            const float t = ImClamp((g.IO.MousePos.x - inner_bb.Min.x) / (inner_bb.Max.x - inner_bb.Min.x), 0.0f, 0.9999f);\n            const int v_idx = (int)(t * item_count);\n            IM_ASSERT(v_idx >= 0 && v_idx < values_count);\n\n            const float v0 = values_getter(data, (v_idx + values_offset) % values_count);\n            const float v1 = values_getter(data, (v_idx + 1 + values_offset) % values_count);\n            if (plot_type == ImGuiPlotType_Lines)\n                SetTooltip(\"%d: %8.4g\\n%d: %8.4g\", v_idx, v0, v_idx + 1, v1);\n            else if (plot_type == ImGuiPlotType_Histogram)\n                SetTooltip(\"%d: %8.4g\", v_idx, v0);\n            idx_hovered = v_idx;\n        }\n\n        const float t_step = 1.0f / (float)res_w;\n        const float inv_scale = (scale_min == scale_max) ? 0.0f : (1.0f / (scale_max - scale_min));\n\n        float v0 = values_getter(data, (0 + values_offset) % values_count);\n        float t0 = 0.0f;\n        ImVec2 tp0 = ImVec2( t0, 1.0f - ImSaturate((v0 - scale_min) * inv_scale) );                       // Point in the normalized space of our target rectangle\n        float histogram_zero_line_t = (scale_min * scale_max < 0.0f) ? (-scale_min * inv_scale) : (scale_min < 0.0f ? 0.0f : 1.0f);   // Where does the zero line stands\n\n        const ImU32 col_base = GetColorU32((plot_type == ImGuiPlotType_Lines) ? ImGuiCol_PlotLines : ImGuiCol_PlotHistogram);\n        const ImU32 col_hovered = GetColorU32((plot_type == ImGuiPlotType_Lines) ? ImGuiCol_PlotLinesHovered : ImGuiCol_PlotHistogramHovered);\n\n        for (int n = 0; n < res_w; n++)\n        {\n            const float t1 = t0 + t_step;\n            const int v1_idx = (int)(t0 * item_count + 0.5f);\n            IM_ASSERT(v1_idx >= 0 && v1_idx < values_count);\n            const float v1 = values_getter(data, (v1_idx + values_offset + 1) % values_count);\n            const ImVec2 tp1 = ImVec2( t1, 1.0f - ImSaturate((v1 - scale_min) * inv_scale) );\n\n            // NB: Draw calls are merged together by the DrawList system. Still, we should render our batch are lower level to save a bit of CPU.\n            ImVec2 pos0 = ImLerp(inner_bb.Min, inner_bb.Max, tp0);\n            ImVec2 pos1 = ImLerp(inner_bb.Min, inner_bb.Max, (plot_type == ImGuiPlotType_Lines) ? tp1 : ImVec2(tp1.x, histogram_zero_line_t));\n            if (plot_type == ImGuiPlotType_Lines)\n            {\n                window->DrawList->AddLine(pos0, pos1, idx_hovered == v1_idx ? col_hovered : col_base);\n            }\n            else if (plot_type == ImGuiPlotType_Histogram)\n            {\n                if (pos1.x >= pos0.x + 2.0f)\n                    pos1.x -= 1.0f;\n                window->DrawList->AddRectFilled(pos0, pos1, idx_hovered == v1_idx ? col_hovered : col_base);\n            }\n\n            t0 = t1;\n            tp0 = tp1;\n        }\n    }\n\n    // Text overlay\n    if (overlay_text)\n        RenderTextClipped(ImVec2(frame_bb.Min.x, frame_bb.Min.y + style.FramePadding.y), frame_bb.Max, overlay_text, NULL, NULL, ImVec2(0.5f, 0.0f));\n\n    if (label_size.x > 0.0f)\n        RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, inner_bb.Min.y), label);\n\n    // Return hovered index or -1 if none are hovered.\n    // This is currently not exposed in the public API because we need a larger redesign of the whole thing, but in the short-term we are making it available in PlotEx().\n    return idx_hovered;\n}\n\nstruct ImGuiPlotArrayGetterData\n{\n    const float* Values;\n    int Stride;\n\n    ImGuiPlotArrayGetterData(const float* values, int stride) { Values = values; Stride = stride; }\n};\n\nstatic float Plot_ArrayGetter(void* data, int idx)\n{\n    ImGuiPlotArrayGetterData* plot_data = (ImGuiPlotArrayGetterData*)data;\n    const float v = *(const float*)(const void*)((const unsigned char*)plot_data->Values + (size_t)idx * plot_data->Stride);\n    return v;\n}\n\nvoid ImGui::PlotLines(const char* label, const float* values, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 graph_size, int stride)\n{\n    ImGuiPlotArrayGetterData data(values, stride);\n    PlotEx(ImGuiPlotType_Lines, label, &Plot_ArrayGetter, (void*)&data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size);\n}\n\nvoid ImGui::PlotLines(const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 graph_size)\n{\n    PlotEx(ImGuiPlotType_Lines, label, values_getter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size);\n}\n\nvoid ImGui::PlotHistogram(const char* label, const float* values, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 graph_size, int stride)\n{\n    ImGuiPlotArrayGetterData data(values, stride);\n    PlotEx(ImGuiPlotType_Histogram, label, &Plot_ArrayGetter, (void*)&data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size);\n}\n\nvoid ImGui::PlotHistogram(const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 graph_size)\n{\n    PlotEx(ImGuiPlotType_Histogram, label, values_getter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size);\n}\n\n//-------------------------------------------------------------------------\n// [SECTION] Widgets: Value helpers\n// Those is not very useful, legacy API.\n//-------------------------------------------------------------------------\n// - Value()\n//-------------------------------------------------------------------------\n\nvoid ImGui::Value(const char* prefix, bool b)\n{\n    Text(\"%s: %s\", prefix, (b ? \"true\" : \"false\"));\n}\n\nvoid ImGui::Value(const char* prefix, int v)\n{\n    Text(\"%s: %d\", prefix, v);\n}\n\nvoid ImGui::Value(const char* prefix, unsigned int v)\n{\n    Text(\"%s: %d\", prefix, v);\n}\n\nvoid ImGui::Value(const char* prefix, float v, const char* float_format)\n{\n    if (float_format)\n    {\n        char fmt[64];\n        ImFormatString(fmt, IM_ARRAYSIZE(fmt), \"%%s: %s\", float_format);\n        Text(fmt, prefix, v);\n    }\n    else\n    {\n        Text(\"%s: %.3f\", prefix, v);\n    }\n}\n\n//-------------------------------------------------------------------------\n// [SECTION] MenuItem, BeginMenu, EndMenu, etc.\n//-------------------------------------------------------------------------\n// - ImGuiMenuColumns [Internal]\n// - BeginMenuBar()\n// - EndMenuBar()\n// - BeginMainMenuBar()\n// - EndMainMenuBar()\n// - BeginMenu()\n// - EndMenu()\n// - MenuItemEx() [Internal]\n// - MenuItem()\n//-------------------------------------------------------------------------\n\n// Helpers for internal use\nvoid ImGuiMenuColumns::Update(float spacing, bool window_reappearing)\n{\n    if (window_reappearing)\n        memset(Widths, 0, sizeof(Widths));\n    Spacing = (ImU16)spacing;\n    CalcNextTotalWidth(true);\n    memset(Widths, 0, sizeof(Widths));\n    TotalWidth = NextTotalWidth;\n    NextTotalWidth = 0;\n}\n\nvoid ImGuiMenuColumns::CalcNextTotalWidth(bool update_offsets)\n{\n    ImU16 offset = 0;\n    bool want_spacing = false;\n    for (int i = 0; i < IM_ARRAYSIZE(Widths); i++)\n    {\n        ImU16 width = Widths[i];\n        if (want_spacing && width > 0)\n            offset += Spacing;\n        want_spacing |= (width > 0);\n        if (update_offsets)\n        {\n            if (i == 1) { OffsetLabel = offset; }\n            if (i == 2) { OffsetShortcut = offset; }\n            if (i == 3) { OffsetMark = offset; }\n        }\n        offset += width;\n    }\n    NextTotalWidth = offset;\n}\n\nfloat ImGuiMenuColumns::DeclColumns(float w_icon, float w_label, float w_shortcut, float w_mark)\n{\n    Widths[0] = ImMax(Widths[0], (ImU16)w_icon);\n    Widths[1] = ImMax(Widths[1], (ImU16)w_label);\n    Widths[2] = ImMax(Widths[2], (ImU16)w_shortcut);\n    Widths[3] = ImMax(Widths[3], (ImU16)w_mark);\n    CalcNextTotalWidth(false);\n    return (float)ImMax(TotalWidth, NextTotalWidth);\n}\n\n// FIXME: Provided a rectangle perhaps e.g. a BeginMenuBarEx() could be used anywhere..\n// Currently the main responsibility of this function being to setup clip-rect + horizontal layout + menu navigation layer.\n// Ideally we also want this to be responsible for claiming space out of the main window scrolling rectangle, in which case ImGuiWindowFlags_MenuBar will become unnecessary.\n// Then later the same system could be used for multiple menu-bars, scrollbars, side-bars.\nbool ImGui::BeginMenuBar()\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return false;\n    if (!(window->Flags & ImGuiWindowFlags_MenuBar))\n        return false;\n\n    IM_ASSERT(!window->DC.MenuBarAppending);\n    BeginGroup(); // Backup position on layer 0 // FIXME: Misleading to use a group for that backup/restore\n    PushID(\"##menubar\");\n\n    // We don't clip with current window clipping rectangle as it is already set to the area below. However we clip with window full rect.\n    // We remove 1 worth of rounding to Max.x to that text in long menus and small windows don't tend to display over the lower-right rounded area, which looks particularly glitchy.\n    ImRect bar_rect = window->MenuBarRect();\n    ImRect clip_rect(IM_ROUND(bar_rect.Min.x + window->WindowBorderSize), IM_ROUND(bar_rect.Min.y + window->WindowBorderSize), IM_ROUND(ImMax(bar_rect.Min.x, bar_rect.Max.x - ImMax(window->WindowRounding, window->WindowBorderSize))), IM_ROUND(bar_rect.Max.y));\n    clip_rect.ClipWith(window->OuterRectClipped);\n    PushClipRect(clip_rect.Min, clip_rect.Max, false);\n\n    // We overwrite CursorMaxPos because BeginGroup sets it to CursorPos (essentially the .EmitItem hack in EndMenuBar() would need something analogous here, maybe a BeginGroupEx() with flags).\n    window->DC.CursorPos = window->DC.CursorMaxPos = ImVec2(bar_rect.Min.x + window->DC.MenuBarOffset.x, bar_rect.Min.y + window->DC.MenuBarOffset.y);\n    window->DC.LayoutType = ImGuiLayoutType_Horizontal;\n    window->DC.NavLayerCurrent = ImGuiNavLayer_Menu;\n    window->DC.MenuBarAppending = true;\n    AlignTextToFramePadding();\n    return true;\n}\n\nvoid ImGui::EndMenuBar()\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return;\n    ImGuiContext& g = *GImGui;\n\n    // Nav: When a move request within one of our child menu failed, capture the request to navigate among our siblings.\n    if (NavMoveRequestButNoResultYet() && (g.NavMoveDir == ImGuiDir_Left || g.NavMoveDir == ImGuiDir_Right) && (g.NavWindow->Flags & ImGuiWindowFlags_ChildMenu))\n    {\n        ImGuiWindow* nav_earliest_child = g.NavWindow;\n        while (nav_earliest_child->ParentWindow && (nav_earliest_child->ParentWindow->Flags & ImGuiWindowFlags_ChildMenu))\n            nav_earliest_child = nav_earliest_child->ParentWindow;\n        if (nav_earliest_child->ParentWindow == window && nav_earliest_child->DC.ParentLayoutType == ImGuiLayoutType_Horizontal && g.NavMoveRequestForward == ImGuiNavForward_None)\n        {\n            // To do so we claim focus back, restore NavId and then process the movement request for yet another frame.\n            // This involve a one-frame delay which isn't very problematic in this situation. We could remove it by scoring in advance for multiple window (probably not worth the hassle/cost)\n            const ImGuiNavLayer layer = ImGuiNavLayer_Menu;\n            IM_ASSERT(window->DC.NavLayersActiveMaskNext & (1 << layer)); // Sanity check\n            FocusWindow(window);\n            SetNavID(window->NavLastIds[layer], layer, 0, window->NavRectRel[layer]);\n            g.NavDisableHighlight = true; // Hide highlight for the current frame so we don't see the intermediary selection.\n            g.NavDisableMouseHover = g.NavMousePosDirty = true;\n            g.NavMoveRequestForward = ImGuiNavForward_ForwardQueued;\n            NavMoveRequestCancel();\n        }\n    }\n\n    IM_MSVC_WARNING_SUPPRESS(6011); // Static Analysis false positive \"warning C6011: Dereferencing NULL pointer 'window'\"\n    IM_ASSERT(window->Flags & ImGuiWindowFlags_MenuBar);\n    IM_ASSERT(window->DC.MenuBarAppending);\n    PopClipRect();\n    PopID();\n    window->DC.MenuBarOffset.x = window->DC.CursorPos.x - window->Pos.x; // Save horizontal position so next append can reuse it. This is kinda equivalent to a per-layer CursorPos.\n    g.GroupStack.back().EmitItem = false;\n    EndGroup(); // Restore position on layer 0\n    window->DC.LayoutType = ImGuiLayoutType_Vertical;\n    window->DC.NavLayerCurrent = ImGuiNavLayer_Main;\n    window->DC.MenuBarAppending = false;\n}\n\n// Important: calling order matters!\n// FIXME: Somehow overlapping with docking tech.\n// FIXME: The \"rect-cut\" aspect of this could be formalized into a lower-level helper (rect-cut: https://halt.software/dead-simple-layouts)\nbool ImGui::BeginViewportSideBar(const char* name, ImGuiViewport* viewport_p, ImGuiDir dir, float axis_size, ImGuiWindowFlags window_flags)\n{\n    IM_ASSERT(dir != ImGuiDir_None);\n\n    ImGuiWindow* bar_window = FindWindowByName(name);\n    if (bar_window == NULL || bar_window->BeginCount == 0)\n    {\n        // Calculate and set window size/position\n        ImGuiViewportP* viewport = (ImGuiViewportP*)(void*)(viewport_p ? viewport_p : GetMainViewport());\n        ImRect avail_rect = viewport->GetBuildWorkRect();\n        ImGuiAxis axis = (dir == ImGuiDir_Up || dir == ImGuiDir_Down) ? ImGuiAxis_Y : ImGuiAxis_X;\n        ImVec2 pos = avail_rect.Min;\n        if (dir == ImGuiDir_Right || dir == ImGuiDir_Down)\n            pos[axis] = avail_rect.Max[axis] - axis_size;\n        ImVec2 size = avail_rect.GetSize();\n        size[axis] = axis_size;\n        SetNextWindowPos(pos);\n        SetNextWindowSize(size);\n\n        // Report our size into work area (for next frame) using actual window size\n        if (dir == ImGuiDir_Up || dir == ImGuiDir_Left)\n            viewport->BuildWorkOffsetMin[axis] += axis_size;\n        else if (dir == ImGuiDir_Down || dir == ImGuiDir_Right)\n            viewport->BuildWorkOffsetMax[axis] -= axis_size;\n    }\n\n    window_flags |= ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove;\n    PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);\n    PushStyleVar(ImGuiStyleVar_WindowMinSize, ImVec2(0, 0)); // Lift normal size constraint\n    bool is_open = Begin(name, NULL, window_flags);\n    PopStyleVar(2);\n\n    return is_open;\n}\n\nbool ImGui::BeginMainMenuBar()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiViewportP* viewport = (ImGuiViewportP*)(void*)GetMainViewport();\n\n    // For the main menu bar, which cannot be moved, we honor g.Style.DisplaySafeAreaPadding to ensure text can be visible on a TV set.\n    // FIXME: This could be generalized as an opt-in way to clamp window->DC.CursorStartPos to avoid SafeArea?\n    // FIXME: Consider removing support for safe area down the line... it's messy. Nowadays consoles have support for TV calibration in OS settings.\n    g.NextWindowData.MenuBarOffsetMinVal = ImVec2(g.Style.DisplaySafeAreaPadding.x, ImMax(g.Style.DisplaySafeAreaPadding.y - g.Style.FramePadding.y, 0.0f));\n    ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_MenuBar;\n    float height = GetFrameHeight();\n    bool is_open = BeginViewportSideBar(\"##MainMenuBar\", viewport, ImGuiDir_Up, height, window_flags);\n    g.NextWindowData.MenuBarOffsetMinVal = ImVec2(0.0f, 0.0f);\n\n    if (is_open)\n        BeginMenuBar();\n    else\n        End();\n    return is_open;\n}\n\nvoid ImGui::EndMainMenuBar()\n{\n    EndMenuBar();\n\n    // When the user has left the menu layer (typically: closed menus through activation of an item), we restore focus to the previous window\n    // FIXME: With this strategy we won't be able to restore a NULL focus.\n    ImGuiContext& g = *GImGui;\n    if (g.CurrentWindow == g.NavWindow && g.NavLayer == ImGuiNavLayer_Main && !g.NavAnyRequest)\n        FocusTopMostWindowUnderOne(g.NavWindow, NULL);\n\n    End();\n}\n\nbool ImGui::BeginMenu(const char* label, bool enabled)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return false;\n\n    ImGuiContext& g = *GImGui;\n    const ImGuiStyle& style = g.Style;\n    const ImGuiID id = window->GetID(label);\n    bool menu_is_open = IsPopupOpen(id, ImGuiPopupFlags_None);\n\n    // Sub-menus are ChildWindow so that mouse can be hovering across them (otherwise top-most popup menu would steal focus and not allow hovering on parent menu)\n    ImGuiWindowFlags flags = ImGuiWindowFlags_ChildMenu | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoNavFocus;\n    if (window->Flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_ChildMenu))\n        flags |= ImGuiWindowFlags_ChildWindow;\n\n    // If a menu with same the ID was already submitted, we will append to it, matching the behavior of Begin().\n    // We are relying on a O(N) search - so O(N log N) over the frame - which seems like the most efficient for the expected small amount of BeginMenu() calls per frame.\n    // If somehow this is ever becoming a problem we can switch to use e.g. ImGuiStorage mapping key to last frame used.\n    if (g.MenusIdSubmittedThisFrame.contains(id))\n    {\n        if (menu_is_open)\n            menu_is_open = BeginPopupEx(id, flags); // menu_is_open can be 'false' when the popup is completely clipped (e.g. zero size display)\n        else\n            g.NextWindowData.ClearFlags();          // we behave like Begin() and need to consume those values\n        return menu_is_open;\n    }\n\n    // Tag menu as used. Next time BeginMenu() with same ID is called it will append to existing menu\n    g.MenusIdSubmittedThisFrame.push_back(id);\n\n    ImVec2 label_size = CalcTextSize(label, NULL, true);\n    bool pressed;\n    bool menuset_is_open = !(window->Flags & ImGuiWindowFlags_Popup) && (g.OpenPopupStack.Size > g.BeginPopupStack.Size && g.OpenPopupStack[g.BeginPopupStack.Size].OpenParentId == window->IDStack.back());\n    ImGuiWindow* backed_nav_window = g.NavWindow;\n    if (menuset_is_open)\n        g.NavWindow = window;  // Odd hack to allow hovering across menus of a same menu-set (otherwise we wouldn't be able to hover parent)\n\n    // The reference position stored in popup_pos will be used by Begin() to find a suitable position for the child menu,\n    // However the final position is going to be different! It is chosen by FindBestWindowPosForPopup().\n    // e.g. Menus tend to overlap each other horizontally to amplify relative Z-ordering.\n    ImVec2 popup_pos, pos = window->DC.CursorPos;\n    PushID(label);\n    if (!enabled)\n        BeginDisabled();\n    const ImGuiMenuColumns* offsets = &window->DC.MenuColumns;\n    if (window->DC.LayoutType == ImGuiLayoutType_Horizontal)\n    {\n        // Menu inside an horizontal menu bar\n        // Selectable extend their highlight by half ItemSpacing in each direction.\n        // For ChildMenu, the popup position will be overwritten by the call to FindBestWindowPosForPopup() in Begin()\n        popup_pos = ImVec2(pos.x - 1.0f - IM_FLOOR(style.ItemSpacing.x * 0.5f), pos.y - style.FramePadding.y + window->MenuBarHeight());\n        window->DC.CursorPos.x += IM_FLOOR(style.ItemSpacing.x * 0.5f);\n        PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(style.ItemSpacing.x * 2.0f, style.ItemSpacing.y));\n        float w = label_size.x;\n        ImVec2 text_pos(window->DC.CursorPos.x + offsets->OffsetLabel, window->DC.CursorPos.y + window->DC.CurrLineTextBaseOffset);\n        pressed = Selectable(\"\", menu_is_open, ImGuiSelectableFlags_NoHoldingActiveID | ImGuiSelectableFlags_SelectOnClick | ImGuiSelectableFlags_DontClosePopups, ImVec2(w, 0.0f));\n        RenderText(text_pos, label);\n        PopStyleVar();\n        window->DC.CursorPos.x += IM_FLOOR(style.ItemSpacing.x * (-1.0f + 0.5f)); // -1 spacing to compensate the spacing added when Selectable() did a SameLine(). It would also work to call SameLine() ourselves after the PopStyleVar().\n    }\n    else\n    {\n        // Menu inside a menu\n        // (In a typical menu window where all items are BeginMenu() or MenuItem() calls, extra_w will always be 0.0f.\n        //  Only when they are other items sticking out we're going to add spacing, yet only register minimum width into the layout system.\n        popup_pos = ImVec2(pos.x, pos.y - style.WindowPadding.y);\n        float icon_w = 0.0f; // FIXME: This not currently exposed for BeginMenu() however you can call window->DC.MenuColumns.DeclColumns(w, 0, 0, 0) yourself\n        float checkmark_w = IM_FLOOR(g.FontSize * 1.20f);\n        float min_w = window->DC.MenuColumns.DeclColumns(icon_w, label_size.x, 0.0f, checkmark_w); // Feedback to next frame\n        float extra_w = ImMax(0.0f, GetContentRegionAvail().x - min_w);\n        ImVec2 text_pos(window->DC.CursorPos.x + offsets->OffsetLabel, window->DC.CursorPos.y + window->DC.CurrLineTextBaseOffset);\n        pressed = Selectable(\"\", menu_is_open, ImGuiSelectableFlags_NoHoldingActiveID | ImGuiSelectableFlags_SelectOnClick | ImGuiSelectableFlags_DontClosePopups | ImGuiSelectableFlags_SpanAvailWidth, ImVec2(min_w, 0.0f));\n        RenderText(text_pos, label);\n        RenderArrow(window->DrawList, pos + ImVec2(offsets->OffsetMark + extra_w + g.FontSize * 0.30f, 0.0f), GetColorU32(ImGuiCol_Text), ImGuiDir_Right);\n    }\n    if (!enabled)\n        EndDisabled();\n\n    const bool hovered = (g.HoveredId == id) && enabled;\n    if (menuset_is_open)\n        g.NavWindow = backed_nav_window;\n\n    bool want_open = false;\n    bool want_close = false;\n    if (window->DC.LayoutType == ImGuiLayoutType_Vertical) // (window->Flags & (ImGuiWindowFlags_Popup|ImGuiWindowFlags_ChildMenu))\n    {\n        // Close menu when not hovering it anymore unless we are moving roughly in the direction of the menu\n        // Implement http://bjk5.com/post/44698559168/breaking-down-amazons-mega-dropdown to avoid using timers, so menus feels more reactive.\n        bool moving_toward_other_child_menu = false;\n\n        ImGuiWindow* child_menu_window = (g.BeginPopupStack.Size < g.OpenPopupStack.Size && g.OpenPopupStack[g.BeginPopupStack.Size].SourceWindow == window) ? g.OpenPopupStack[g.BeginPopupStack.Size].Window : NULL;\n        if (g.HoveredWindow == window && child_menu_window != NULL && !(window->Flags & ImGuiWindowFlags_MenuBar))\n        {\n            // FIXME-DPI: Values should be derived from a master \"scale\" factor.\n            ImRect next_window_rect = child_menu_window->Rect();\n            ImVec2 ta = g.IO.MousePos - g.IO.MouseDelta;\n            ImVec2 tb = (window->Pos.x < child_menu_window->Pos.x) ? next_window_rect.GetTL() : next_window_rect.GetTR();\n            ImVec2 tc = (window->Pos.x < child_menu_window->Pos.x) ? next_window_rect.GetBL() : next_window_rect.GetBR();\n            float extra = ImClamp(ImFabs(ta.x - tb.x) * 0.30f, 5.0f, 30.0f);    // add a bit of extra slack.\n            ta.x += (window->Pos.x < child_menu_window->Pos.x) ? -0.5f : +0.5f; // to avoid numerical issues\n            tb.y = ta.y + ImMax((tb.y - extra) - ta.y, -100.0f);                // triangle is maximum 200 high to limit the slope and the bias toward large sub-menus // FIXME: Multiply by fb_scale?\n            tc.y = ta.y + ImMin((tc.y + extra) - ta.y, +100.0f);\n            moving_toward_other_child_menu = ImTriangleContainsPoint(ta, tb, tc, g.IO.MousePos);\n            //GetForegroundDrawList()->AddTriangleFilled(ta, tb, tc, moving_within_opened_triangle ? IM_COL32(0,128,0,128) : IM_COL32(128,0,0,128)); // [DEBUG]\n        }\n\n        // FIXME: Hovering a disabled BeginMenu or MenuItem won't close us\n        if (menu_is_open && !hovered && g.HoveredWindow == window && g.HoveredIdPreviousFrame != 0 && g.HoveredIdPreviousFrame != id && !moving_toward_other_child_menu)\n            want_close = true;\n\n        if (!menu_is_open && hovered && pressed) // Click to open\n            want_open = true;\n        else if (!menu_is_open && hovered && !moving_toward_other_child_menu) // Hover to open\n            want_open = true;\n\n        if (g.NavActivateId == id)\n        {\n            want_close = menu_is_open;\n            want_open = !menu_is_open;\n        }\n        if (g.NavId == id && g.NavMoveRequest && g.NavMoveDir == ImGuiDir_Right) // Nav-Right to open\n        {\n            want_open = true;\n            NavMoveRequestCancel();\n        }\n    }\n    else\n    {\n        // Menu bar\n        if (menu_is_open && pressed && menuset_is_open) // Click an open menu again to close it\n        {\n            want_close = true;\n            want_open = menu_is_open = false;\n        }\n        else if (pressed || (hovered && menuset_is_open && !menu_is_open)) // First click to open, then hover to open others\n        {\n            want_open = true;\n        }\n        else if (g.NavId == id && g.NavMoveRequest && g.NavMoveDir == ImGuiDir_Down) // Nav-Down to open\n        {\n            want_open = true;\n            NavMoveRequestCancel();\n        }\n    }\n\n    if (!enabled) // explicitly close if an open menu becomes disabled, facilitate users code a lot in pattern such as 'if (BeginMenu(\"options\", has_object)) { ..use object.. }'\n        want_close = true;\n    if (want_close && IsPopupOpen(id, ImGuiPopupFlags_None))\n        ClosePopupToLevel(g.BeginPopupStack.Size, true);\n\n    IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags | ImGuiItemStatusFlags_Openable | (menu_is_open ? ImGuiItemStatusFlags_Opened : 0));\n    PopID();\n\n    if (!menu_is_open && want_open && g.OpenPopupStack.Size > g.BeginPopupStack.Size)\n    {\n        // Don't recycle same menu level in the same frame, first close the other menu and yield for a frame.\n        OpenPopup(label);\n        return false;\n    }\n\n    menu_is_open |= want_open;\n    if (want_open)\n        OpenPopup(label);\n\n    if (menu_is_open)\n    {\n        SetNextWindowPos(popup_pos, ImGuiCond_Always); // Note: this is super misleading! The value will serve as reference for FindBestWindowPosForPopup(), not actual pos.\n        menu_is_open = BeginPopupEx(id, flags); // menu_is_open can be 'false' when the popup is completely clipped (e.g. zero size display)\n    }\n    else\n    {\n        g.NextWindowData.ClearFlags(); // We behave like Begin() and need to consume those values\n    }\n\n    return menu_is_open;\n}\n\nvoid ImGui::EndMenu()\n{\n    // Nav: When a left move request _within our child menu_ failed, close ourselves (the _parent_ menu).\n    // A menu doesn't close itself because EndMenuBar() wants the catch the last Left<>Right inputs.\n    // However, it means that with the current code, a BeginMenu() from outside another menu or a menu-bar won't be closable with the Left direction.\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    if (g.NavWindow && g.NavWindow->ParentWindow == window && g.NavMoveDir == ImGuiDir_Left && NavMoveRequestButNoResultYet() && window->DC.LayoutType == ImGuiLayoutType_Vertical)\n    {\n        ClosePopupToLevel(g.BeginPopupStack.Size, true);\n        NavMoveRequestCancel();\n    }\n\n    EndPopup();\n}\n\nbool ImGui::MenuItemEx(const char* label, const char* icon, const char* shortcut, bool selected, bool enabled)\n{\n    ImGuiWindow* window = GetCurrentWindow();\n    if (window->SkipItems)\n        return false;\n\n    ImGuiContext& g = *GImGui;\n    ImGuiStyle& style = g.Style;\n    ImVec2 pos = window->DC.CursorPos;\n    ImVec2 label_size = CalcTextSize(label, NULL, true);\n\n    // We've been using the equivalent of ImGuiSelectableFlags_SetNavIdOnHover on all Selectable() since early Nav system days (commit 43ee5d73),\n    // but I am unsure whether this should be kept at all. For now moved it to be an opt-in feature used by menus only.\n    bool pressed;\n    PushID(label);\n    if (!enabled)\n        BeginDisabled(true);\n    const ImGuiSelectableFlags flags = ImGuiSelectableFlags_SelectOnRelease | ImGuiSelectableFlags_SetNavIdOnHover;\n    const ImGuiMenuColumns* offsets = &window->DC.MenuColumns;\n    if (window->DC.LayoutType == ImGuiLayoutType_Horizontal)\n    {\n        // Mimic the exact layout spacing of BeginMenu() to allow MenuItem() inside a menu bar, which is a little misleading but may be useful\n        // Note that in this situation: we don't render the shortcut, we render a highlight instead of the selected tick mark.\n        float w = label_size.x;\n        window->DC.CursorPos.x += IM_FLOOR(style.ItemSpacing.x * 0.5f);\n        PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(style.ItemSpacing.x * 2.0f, style.ItemSpacing.y));\n        pressed = Selectable(\"\", selected, flags, ImVec2(w, 0.0f));\n        PopStyleVar();\n        RenderText(pos + ImVec2(offsets->OffsetLabel, 0.0f), label);\n        window->DC.CursorPos.x += IM_FLOOR(style.ItemSpacing.x * (-1.0f + 0.5f)); // -1 spacing to compensate the spacing added when Selectable() did a SameLine(). It would also work to call SameLine() ourselves after the PopStyleVar().\n    }\n    else\n    {\n        // Menu item inside a vertical menu\n        // (In a typical menu window where all items are BeginMenu() or MenuItem() calls, extra_w will always be 0.0f.\n        //  Only when they are other items sticking out we're going to add spacing, yet only register minimum width into the layout system.\n        float icon_w = (icon && icon[0]) ? CalcTextSize(icon, NULL).x : 0.0f;\n        float shortcut_w = (shortcut && shortcut[0]) ? CalcTextSize(shortcut, NULL).x : 0.0f;\n        float checkmark_w = IM_FLOOR(g.FontSize * 1.20f);\n        float min_w = window->DC.MenuColumns.DeclColumns(icon_w, label_size.x, shortcut_w, checkmark_w); // Feedback for next frame\n        float stretch_w = ImMax(0.0f, GetContentRegionAvail().x - min_w);\n        pressed = Selectable(\"\", false, flags | ImGuiSelectableFlags_SpanAvailWidth, ImVec2(min_w, 0.0f));\n        RenderText(pos + ImVec2(offsets->OffsetLabel, 0.0f), label);\n        if (icon_w > 0.0f)\n            RenderText(pos + ImVec2(offsets->OffsetIcon, 0.0f), icon);\n        if (shortcut_w > 0.0f)\n        {\n            PushStyleColor(ImGuiCol_Text, style.Colors[ImGuiCol_TextDisabled]);\n            RenderText(pos + ImVec2(offsets->OffsetShortcut + stretch_w, 0.0f), shortcut, NULL, false);\n            PopStyleColor();\n        }\n        if (selected)\n            RenderCheckMark(window->DrawList, pos + ImVec2(offsets->OffsetMark + stretch_w + g.FontSize * 0.40f, g.FontSize * 0.134f * 0.5f), GetColorU32(ImGuiCol_Text), g.FontSize  * 0.866f);\n    }\n    IMGUI_TEST_ENGINE_ITEM_INFO(g.LastItemData.ID, label, g.LastItemData.StatusFlags | ImGuiItemStatusFlags_Checkable | (selected ? ImGuiItemStatusFlags_Checked : 0));\n    if (!enabled)\n        EndDisabled();\n    PopID();\n\n    return pressed;\n}\n\nbool ImGui::MenuItem(const char* label, const char* shortcut, bool selected, bool enabled)\n{\n    return MenuItemEx(label, NULL, shortcut, selected, enabled);\n}\n\nbool ImGui::MenuItem(const char* label, const char* shortcut, bool* p_selected, bool enabled)\n{\n    if (MenuItemEx(label, NULL, shortcut, p_selected ? *p_selected : false, enabled))\n    {\n        if (p_selected)\n            *p_selected = !*p_selected;\n        return true;\n    }\n    return false;\n}\n\n//-------------------------------------------------------------------------\n// [SECTION] Widgets: BeginTabBar, EndTabBar, etc.\n//-------------------------------------------------------------------------\n// - BeginTabBar()\n// - BeginTabBarEx() [Internal]\n// - EndTabBar()\n// - TabBarLayout() [Internal]\n// - TabBarCalcTabID() [Internal]\n// - TabBarCalcMaxTabWidth() [Internal]\n// - TabBarFindTabById() [Internal]\n// - TabBarRemoveTab() [Internal]\n// - TabBarCloseTab() [Internal]\n// - TabBarScrollClamp() [Internal]\n// - TabBarScrollToTab() [Internal]\n// - TabBarQueueChangeTabOrder() [Internal]\n// - TabBarScrollingButtons() [Internal]\n// - TabBarTabListPopupButton() [Internal]\n//-------------------------------------------------------------------------\n\nstruct ImGuiTabBarSection\n{\n    int                 TabCount;               // Number of tabs in this section.\n    float               Width;                  // Sum of width of tabs in this section (after shrinking down)\n    float               Spacing;                // Horizontal spacing at the end of the section.\n\n    ImGuiTabBarSection() { memset(this, 0, sizeof(*this)); }\n};\n\nnamespace ImGui\n{\n    static void             TabBarLayout(ImGuiTabBar* tab_bar);\n    static ImU32            TabBarCalcTabID(ImGuiTabBar* tab_bar, const char* label);\n    static float            TabBarCalcMaxTabWidth();\n    static float            TabBarScrollClamp(ImGuiTabBar* tab_bar, float scrolling);\n    static void             TabBarScrollToTab(ImGuiTabBar* tab_bar, ImGuiID tab_id, ImGuiTabBarSection* sections);\n    static ImGuiTabItem*    TabBarScrollingButtons(ImGuiTabBar* tab_bar);\n    static ImGuiTabItem*    TabBarTabListPopupButton(ImGuiTabBar* tab_bar);\n}\n\nImGuiTabBar::ImGuiTabBar()\n{\n    memset(this, 0, sizeof(*this));\n    CurrFrameVisible = PrevFrameVisible = -1;\n    LastTabItemIdx = -1;\n}\n\nstatic inline int TabItemGetSectionIdx(const ImGuiTabItem* tab)\n{\n    return (tab->Flags & ImGuiTabItemFlags_Leading) ? 0 : (tab->Flags & ImGuiTabItemFlags_Trailing) ? 2 : 1;\n}\n\nstatic int IMGUI_CDECL TabItemComparerBySection(const void* lhs, const void* rhs)\n{\n    const ImGuiTabItem* a = (const ImGuiTabItem*)lhs;\n    const ImGuiTabItem* b = (const ImGuiTabItem*)rhs;\n    const int a_section = TabItemGetSectionIdx(a);\n    const int b_section = TabItemGetSectionIdx(b);\n    if (a_section != b_section)\n        return a_section - b_section;\n    return (int)(a->IndexDuringLayout - b->IndexDuringLayout);\n}\n\nstatic int IMGUI_CDECL TabItemComparerByBeginOrder(const void* lhs, const void* rhs)\n{\n    const ImGuiTabItem* a = (const ImGuiTabItem*)lhs;\n    const ImGuiTabItem* b = (const ImGuiTabItem*)rhs;\n    return (int)(a->BeginOrder - b->BeginOrder);\n}\n\nstatic ImGuiTabBar* GetTabBarFromTabBarRef(const ImGuiPtrOrIndex& ref)\n{\n    ImGuiContext& g = *GImGui;\n    return ref.Ptr ? (ImGuiTabBar*)ref.Ptr : g.TabBars.GetByIndex(ref.Index);\n}\n\nstatic ImGuiPtrOrIndex GetTabBarRefFromTabBar(ImGuiTabBar* tab_bar)\n{\n    ImGuiContext& g = *GImGui;\n    if (g.TabBars.Contains(tab_bar))\n        return ImGuiPtrOrIndex(g.TabBars.GetIndex(tab_bar));\n    return ImGuiPtrOrIndex(tab_bar);\n}\n\nbool    ImGui::BeginTabBar(const char* str_id, ImGuiTabBarFlags flags)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    if (window->SkipItems)\n        return false;\n\n    ImGuiID id = window->GetID(str_id);\n    ImGuiTabBar* tab_bar = g.TabBars.GetOrAddByKey(id);\n    ImRect tab_bar_bb = ImRect(window->DC.CursorPos.x, window->DC.CursorPos.y, window->WorkRect.Max.x, window->DC.CursorPos.y + g.FontSize + g.Style.FramePadding.y * 2);\n    tab_bar->ID = id;\n    return BeginTabBarEx(tab_bar, tab_bar_bb, flags | ImGuiTabBarFlags_IsFocused);\n}\n\nbool    ImGui::BeginTabBarEx(ImGuiTabBar* tab_bar, const ImRect& tab_bar_bb, ImGuiTabBarFlags flags)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    if (window->SkipItems)\n        return false;\n\n    if ((flags & ImGuiTabBarFlags_DockNode) == 0)\n        PushOverrideID(tab_bar->ID);\n\n    // Add to stack\n    g.CurrentTabBarStack.push_back(GetTabBarRefFromTabBar(tab_bar));\n    g.CurrentTabBar = tab_bar;\n\n    // Append with multiple BeginTabBar()/EndTabBar() pairs.\n    tab_bar->BackupCursorPos = window->DC.CursorPos;\n    if (tab_bar->CurrFrameVisible == g.FrameCount)\n    {\n        window->DC.CursorPos = ImVec2(tab_bar->BarRect.Min.x, tab_bar->BarRect.Max.y + tab_bar->ItemSpacingY);\n        tab_bar->BeginCount++;\n        return true;\n    }\n\n    // Ensure correct ordering when toggling ImGuiTabBarFlags_Reorderable flag, or when a new tab was added while being not reorderable\n    if ((flags & ImGuiTabBarFlags_Reorderable) != (tab_bar->Flags & ImGuiTabBarFlags_Reorderable) || (tab_bar->TabsAddedNew && !(flags & ImGuiTabBarFlags_Reorderable)))\n        if (tab_bar->Tabs.Size > 1)\n            ImQsort(tab_bar->Tabs.Data, tab_bar->Tabs.Size, sizeof(ImGuiTabItem), TabItemComparerByBeginOrder);\n    tab_bar->TabsAddedNew = false;\n\n    // Flags\n    if ((flags & ImGuiTabBarFlags_FittingPolicyMask_) == 0)\n        flags |= ImGuiTabBarFlags_FittingPolicyDefault_;\n\n    tab_bar->Flags = flags;\n    tab_bar->BarRect = tab_bar_bb;\n    tab_bar->WantLayout = true; // Layout will be done on the first call to ItemTab()\n    tab_bar->PrevFrameVisible = tab_bar->CurrFrameVisible;\n    tab_bar->CurrFrameVisible = g.FrameCount;\n    tab_bar->PrevTabsContentsHeight = tab_bar->CurrTabsContentsHeight;\n    tab_bar->CurrTabsContentsHeight = 0.0f;\n    tab_bar->ItemSpacingY = g.Style.ItemSpacing.y;\n    tab_bar->FramePadding = g.Style.FramePadding;\n    tab_bar->TabsActiveCount = 0;\n    tab_bar->BeginCount = 1;\n\n    // Set cursor pos in a way which only be used in the off-chance the user erroneously submits item before BeginTabItem(): items will overlap\n    window->DC.CursorPos = ImVec2(tab_bar->BarRect.Min.x, tab_bar->BarRect.Max.y + tab_bar->ItemSpacingY);\n\n    // Draw separator\n    const ImU32 col = GetColorU32((flags & ImGuiTabBarFlags_IsFocused) ? ImGuiCol_TabActive : ImGuiCol_TabUnfocusedActive);\n    const float y = tab_bar->BarRect.Max.y - 1.0f;\n    {\n        const float separator_min_x = tab_bar->BarRect.Min.x - IM_FLOOR(window->WindowPadding.x * 0.5f);\n        const float separator_max_x = tab_bar->BarRect.Max.x + IM_FLOOR(window->WindowPadding.x * 0.5f);\n        window->DrawList->AddLine(ImVec2(separator_min_x, y), ImVec2(separator_max_x, y), col, 1.0f);\n    }\n    return true;\n}\n\nvoid    ImGui::EndTabBar()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    if (window->SkipItems)\n        return;\n\n    ImGuiTabBar* tab_bar = g.CurrentTabBar;\n    if (tab_bar == NULL)\n    {\n        IM_ASSERT_USER_ERROR(tab_bar != NULL, \"Mismatched BeginTabBar()/EndTabBar()!\");\n        return;\n    }\n\n    // Fallback in case no TabItem have been submitted\n    if (tab_bar->WantLayout)\n        TabBarLayout(tab_bar);\n\n    // Restore the last visible height if no tab is visible, this reduce vertical flicker/movement when a tabs gets removed without calling SetTabItemClosed().\n    const bool tab_bar_appearing = (tab_bar->PrevFrameVisible + 1 < g.FrameCount);\n    if (tab_bar->VisibleTabWasSubmitted || tab_bar->VisibleTabId == 0 || tab_bar_appearing)\n    {\n        tab_bar->CurrTabsContentsHeight = ImMax(window->DC.CursorPos.y - tab_bar->BarRect.Max.y, tab_bar->CurrTabsContentsHeight);\n        window->DC.CursorPos.y = tab_bar->BarRect.Max.y + tab_bar->CurrTabsContentsHeight;\n    }\n    else\n    {\n        window->DC.CursorPos.y = tab_bar->BarRect.Max.y + tab_bar->PrevTabsContentsHeight;\n    }\n    if (tab_bar->BeginCount > 1)\n        window->DC.CursorPos = tab_bar->BackupCursorPos;\n\n    if ((tab_bar->Flags & ImGuiTabBarFlags_DockNode) == 0)\n        PopID();\n\n    g.CurrentTabBarStack.pop_back();\n    g.CurrentTabBar = g.CurrentTabBarStack.empty() ? NULL : GetTabBarFromTabBarRef(g.CurrentTabBarStack.back());\n}\n\n// This is called only once a frame before by the first call to ItemTab()\n// The reason we're not calling it in BeginTabBar() is to leave a chance to the user to call the SetTabItemClosed() functions.\nstatic void ImGui::TabBarLayout(ImGuiTabBar* tab_bar)\n{\n    ImGuiContext& g = *GImGui;\n    tab_bar->WantLayout = false;\n\n    // Garbage collect by compacting list\n    // Detect if we need to sort out tab list (e.g. in rare case where a tab changed section)\n    int tab_dst_n = 0;\n    bool need_sort_by_section = false;\n    ImGuiTabBarSection sections[3]; // Layout sections: Leading, Central, Trailing\n    for (int tab_src_n = 0; tab_src_n < tab_bar->Tabs.Size; tab_src_n++)\n    {\n        ImGuiTabItem* tab = &tab_bar->Tabs[tab_src_n];\n        if (tab->LastFrameVisible < tab_bar->PrevFrameVisible || tab->WantClose)\n        {\n            // Remove tab\n            if (tab_bar->VisibleTabId == tab->ID) { tab_bar->VisibleTabId = 0; }\n            if (tab_bar->SelectedTabId == tab->ID) { tab_bar->SelectedTabId = 0; }\n            if (tab_bar->NextSelectedTabId == tab->ID) { tab_bar->NextSelectedTabId = 0; }\n            continue;\n        }\n        if (tab_dst_n != tab_src_n)\n            tab_bar->Tabs[tab_dst_n] = tab_bar->Tabs[tab_src_n];\n\n        tab = &tab_bar->Tabs[tab_dst_n];\n        tab->IndexDuringLayout = (ImS16)tab_dst_n;\n\n        // We will need sorting if tabs have changed section (e.g. moved from one of Leading/Central/Trailing to another)\n        int curr_tab_section_n = TabItemGetSectionIdx(tab);\n        if (tab_dst_n > 0)\n        {\n            ImGuiTabItem* prev_tab = &tab_bar->Tabs[tab_dst_n - 1];\n            int prev_tab_section_n = TabItemGetSectionIdx(prev_tab);\n            if (curr_tab_section_n == 0 && prev_tab_section_n != 0)\n                need_sort_by_section = true;\n            if (prev_tab_section_n == 2 && curr_tab_section_n != 2)\n                need_sort_by_section = true;\n        }\n\n        sections[curr_tab_section_n].TabCount++;\n        tab_dst_n++;\n    }\n    if (tab_bar->Tabs.Size != tab_dst_n)\n        tab_bar->Tabs.resize(tab_dst_n);\n\n    if (need_sort_by_section)\n        ImQsort(tab_bar->Tabs.Data, tab_bar->Tabs.Size, sizeof(ImGuiTabItem), TabItemComparerBySection);\n\n    // Calculate spacing between sections\n    sections[0].Spacing = sections[0].TabCount > 0 && (sections[1].TabCount + sections[2].TabCount) > 0 ? g.Style.ItemInnerSpacing.x : 0.0f;\n    sections[1].Spacing = sections[1].TabCount > 0 && sections[2].TabCount > 0 ? g.Style.ItemInnerSpacing.x : 0.0f;\n\n    // Setup next selected tab\n    ImGuiID scroll_to_tab_id = 0;\n    if (tab_bar->NextSelectedTabId)\n    {\n        tab_bar->SelectedTabId = tab_bar->NextSelectedTabId;\n        tab_bar->NextSelectedTabId = 0;\n        scroll_to_tab_id = tab_bar->SelectedTabId;\n    }\n\n    // Process order change request (we could probably process it when requested but it's just saner to do it in a single spot).\n    if (tab_bar->ReorderRequestTabId != 0)\n    {\n        if (TabBarProcessReorder(tab_bar))\n            if (tab_bar->ReorderRequestTabId == tab_bar->SelectedTabId)\n                scroll_to_tab_id = tab_bar->ReorderRequestTabId;\n        tab_bar->ReorderRequestTabId = 0;\n    }\n\n    // Tab List Popup (will alter tab_bar->BarRect and therefore the available width!)\n    const bool tab_list_popup_button = (tab_bar->Flags & ImGuiTabBarFlags_TabListPopupButton) != 0;\n    if (tab_list_popup_button)\n        if (ImGuiTabItem* tab_to_select = TabBarTabListPopupButton(tab_bar)) // NB: Will alter BarRect.Min.x!\n            scroll_to_tab_id = tab_bar->SelectedTabId = tab_to_select->ID;\n\n    // Leading/Trailing tabs will be shrink only if central one aren't visible anymore, so layout the shrink data as: leading, trailing, central\n    // (whereas our tabs are stored as: leading, central, trailing)\n    int shrink_buffer_indexes[3] = { 0, sections[0].TabCount + sections[2].TabCount, sections[0].TabCount };\n    g.ShrinkWidthBuffer.resize(tab_bar->Tabs.Size);\n\n    // Compute ideal tabs widths + store them into shrink buffer\n    ImGuiTabItem* most_recently_selected_tab = NULL;\n    int curr_section_n = -1;\n    bool found_selected_tab_id = false;\n    for (int tab_n = 0; tab_n < tab_bar->Tabs.Size; tab_n++)\n    {\n        ImGuiTabItem* tab = &tab_bar->Tabs[tab_n];\n        IM_ASSERT(tab->LastFrameVisible >= tab_bar->PrevFrameVisible);\n\n        if ((most_recently_selected_tab == NULL || most_recently_selected_tab->LastFrameSelected < tab->LastFrameSelected) && !(tab->Flags & ImGuiTabItemFlags_Button))\n            most_recently_selected_tab = tab;\n        if (tab->ID == tab_bar->SelectedTabId)\n            found_selected_tab_id = true;\n        if (scroll_to_tab_id == 0 && g.NavJustMovedToId == tab->ID)\n            scroll_to_tab_id = tab->ID;\n\n        // Refresh tab width immediately, otherwise changes of style e.g. style.FramePadding.x would noticeably lag in the tab bar.\n        // Additionally, when using TabBarAddTab() to manipulate tab bar order we occasionally insert new tabs that don't have a width yet,\n        // and we cannot wait for the next BeginTabItem() call. We cannot compute this width within TabBarAddTab() because font size depends on the active window.\n        const char* tab_name = tab_bar->GetTabName(tab);\n        const bool has_close_button = (tab->Flags & ImGuiTabItemFlags_NoCloseButton) ? false : true;\n        tab->ContentWidth = TabItemCalcSize(tab_name, has_close_button).x;\n\n        int section_n = TabItemGetSectionIdx(tab);\n        ImGuiTabBarSection* section = &sections[section_n];\n        section->Width += tab->ContentWidth + (section_n == curr_section_n ? g.Style.ItemInnerSpacing.x : 0.0f);\n        curr_section_n = section_n;\n\n        // Store data so we can build an array sorted by width if we need to shrink tabs down\n        IM_MSVC_WARNING_SUPPRESS(6385);\n        int shrink_buffer_index = shrink_buffer_indexes[section_n]++;\n        g.ShrinkWidthBuffer[shrink_buffer_index].Index = tab_n;\n        g.ShrinkWidthBuffer[shrink_buffer_index].Width = tab->ContentWidth;\n\n        IM_ASSERT(tab->ContentWidth > 0.0f);\n        tab->Width = tab->ContentWidth;\n    }\n\n    // Compute total ideal width (used for e.g. auto-resizing a window)\n    tab_bar->WidthAllTabsIdeal = 0.0f;\n    for (int section_n = 0; section_n < 3; section_n++)\n        tab_bar->WidthAllTabsIdeal += sections[section_n].Width + sections[section_n].Spacing;\n\n    // Horizontal scrolling buttons\n    // (note that TabBarScrollButtons() will alter BarRect.Max.x)\n    if ((tab_bar->WidthAllTabsIdeal > tab_bar->BarRect.GetWidth() && tab_bar->Tabs.Size > 1) && !(tab_bar->Flags & ImGuiTabBarFlags_NoTabListScrollingButtons) && (tab_bar->Flags & ImGuiTabBarFlags_FittingPolicyScroll))\n        if (ImGuiTabItem* scroll_and_select_tab = TabBarScrollingButtons(tab_bar))\n        {\n            scroll_to_tab_id = scroll_and_select_tab->ID;\n            if ((scroll_and_select_tab->Flags & ImGuiTabItemFlags_Button) == 0)\n                tab_bar->SelectedTabId = scroll_to_tab_id;\n        }\n\n    // Shrink widths if full tabs don't fit in their allocated space\n    float section_0_w = sections[0].Width + sections[0].Spacing;\n    float section_1_w = sections[1].Width + sections[1].Spacing;\n    float section_2_w = sections[2].Width + sections[2].Spacing;\n    bool central_section_is_visible = (section_0_w + section_2_w) < tab_bar->BarRect.GetWidth();\n    float width_excess;\n    if (central_section_is_visible)\n        width_excess = ImMax(section_1_w - (tab_bar->BarRect.GetWidth() - section_0_w - section_2_w), 0.0f); // Excess used to shrink central section\n    else\n        width_excess = (section_0_w + section_2_w) - tab_bar->BarRect.GetWidth(); // Excess used to shrink leading/trailing section\n\n    // With ImGuiTabBarFlags_FittingPolicyScroll policy, we will only shrink leading/trailing if the central section is not visible anymore\n    if (width_excess > 0.0f && ((tab_bar->Flags & ImGuiTabBarFlags_FittingPolicyResizeDown) || !central_section_is_visible))\n    {\n        int shrink_data_count = (central_section_is_visible ? sections[1].TabCount : sections[0].TabCount + sections[2].TabCount);\n        int shrink_data_offset = (central_section_is_visible ? sections[0].TabCount + sections[2].TabCount : 0);\n        ShrinkWidths(g.ShrinkWidthBuffer.Data + shrink_data_offset, shrink_data_count, width_excess);\n\n        // Apply shrunk values into tabs and sections\n        for (int tab_n = shrink_data_offset; tab_n < shrink_data_offset + shrink_data_count; tab_n++)\n        {\n            ImGuiTabItem* tab = &tab_bar->Tabs[g.ShrinkWidthBuffer[tab_n].Index];\n            float shrinked_width = IM_FLOOR(g.ShrinkWidthBuffer[tab_n].Width);\n            if (shrinked_width < 0.0f)\n                continue;\n\n            int section_n = TabItemGetSectionIdx(tab);\n            sections[section_n].Width -= (tab->Width - shrinked_width);\n            tab->Width = shrinked_width;\n        }\n    }\n\n    // Layout all active tabs\n    int section_tab_index = 0;\n    float tab_offset = 0.0f;\n    tab_bar->WidthAllTabs = 0.0f;\n    for (int section_n = 0; section_n < 3; section_n++)\n    {\n        ImGuiTabBarSection* section = &sections[section_n];\n        if (section_n == 2)\n            tab_offset = ImMin(ImMax(0.0f, tab_bar->BarRect.GetWidth() - section->Width), tab_offset);\n\n        for (int tab_n = 0; tab_n < section->TabCount; tab_n++)\n        {\n            ImGuiTabItem* tab = &tab_bar->Tabs[section_tab_index + tab_n];\n            tab->Offset = tab_offset;\n            tab_offset += tab->Width + (tab_n < section->TabCount - 1 ? g.Style.ItemInnerSpacing.x : 0.0f);\n        }\n        tab_bar->WidthAllTabs += ImMax(section->Width + section->Spacing, 0.0f);\n        tab_offset += section->Spacing;\n        section_tab_index += section->TabCount;\n    }\n\n    // If we have lost the selected tab, select the next most recently active one\n    if (found_selected_tab_id == false)\n        tab_bar->SelectedTabId = 0;\n    if (tab_bar->SelectedTabId == 0 && tab_bar->NextSelectedTabId == 0 && most_recently_selected_tab != NULL)\n        scroll_to_tab_id = tab_bar->SelectedTabId = most_recently_selected_tab->ID;\n\n    // Lock in visible tab\n    tab_bar->VisibleTabId = tab_bar->SelectedTabId;\n    tab_bar->VisibleTabWasSubmitted = false;\n\n    // Update scrolling\n    if (scroll_to_tab_id != 0)\n        TabBarScrollToTab(tab_bar, scroll_to_tab_id, sections);\n    tab_bar->ScrollingAnim = TabBarScrollClamp(tab_bar, tab_bar->ScrollingAnim);\n    tab_bar->ScrollingTarget = TabBarScrollClamp(tab_bar, tab_bar->ScrollingTarget);\n    if (tab_bar->ScrollingAnim != tab_bar->ScrollingTarget)\n    {\n        // Scrolling speed adjust itself so we can always reach our target in 1/3 seconds.\n        // Teleport if we are aiming far off the visible line\n        tab_bar->ScrollingSpeed = ImMax(tab_bar->ScrollingSpeed, 70.0f * g.FontSize);\n        tab_bar->ScrollingSpeed = ImMax(tab_bar->ScrollingSpeed, ImFabs(tab_bar->ScrollingTarget - tab_bar->ScrollingAnim) / 0.3f);\n        const bool teleport = (tab_bar->PrevFrameVisible + 1 < g.FrameCount) || (tab_bar->ScrollingTargetDistToVisibility > 10.0f * g.FontSize);\n        tab_bar->ScrollingAnim = teleport ? tab_bar->ScrollingTarget : ImLinearSweep(tab_bar->ScrollingAnim, tab_bar->ScrollingTarget, g.IO.DeltaTime * tab_bar->ScrollingSpeed);\n    }\n    else\n    {\n        tab_bar->ScrollingSpeed = 0.0f;\n    }\n    tab_bar->ScrollingRectMinX = tab_bar->BarRect.Min.x + sections[0].Width + sections[0].Spacing;\n    tab_bar->ScrollingRectMaxX = tab_bar->BarRect.Max.x - sections[2].Width - sections[1].Spacing;\n\n    // Clear name buffers\n    if ((tab_bar->Flags & ImGuiTabBarFlags_DockNode) == 0)\n        tab_bar->TabsNames.Buf.resize(0);\n\n    // Actual layout in host window (we don't do it in BeginTabBar() so as not to waste an extra frame)\n    ImGuiWindow* window = g.CurrentWindow;\n    window->DC.CursorPos = tab_bar->BarRect.Min;\n    ItemSize(ImVec2(tab_bar->WidthAllTabs, tab_bar->BarRect.GetHeight()), tab_bar->FramePadding.y);\n    window->DC.IdealMaxPos.x = ImMax(window->DC.IdealMaxPos.x, tab_bar->BarRect.Min.x + tab_bar->WidthAllTabsIdeal);\n}\n\n// Dockables uses Name/ID in the global namespace. Non-dockable items use the ID stack.\nstatic ImU32   ImGui::TabBarCalcTabID(ImGuiTabBar* tab_bar, const char* label)\n{\n    if (tab_bar->Flags & ImGuiTabBarFlags_DockNode)\n    {\n        ImGuiID id = ImHashStr(label);\n        KeepAliveID(id);\n        return id;\n    }\n    else\n    {\n        ImGuiWindow* window = GImGui->CurrentWindow;\n        return window->GetID(label);\n    }\n}\n\nstatic float ImGui::TabBarCalcMaxTabWidth()\n{\n    ImGuiContext& g = *GImGui;\n    return g.FontSize * 20.0f;\n}\n\nImGuiTabItem* ImGui::TabBarFindTabByID(ImGuiTabBar* tab_bar, ImGuiID tab_id)\n{\n    if (tab_id != 0)\n        for (int n = 0; n < tab_bar->Tabs.Size; n++)\n            if (tab_bar->Tabs[n].ID == tab_id)\n                return &tab_bar->Tabs[n];\n    return NULL;\n}\n\n// The *TabId fields be already set by the docking system _before_ the actual TabItem was created, so we clear them regardless.\nvoid ImGui::TabBarRemoveTab(ImGuiTabBar* tab_bar, ImGuiID tab_id)\n{\n    if (ImGuiTabItem* tab = TabBarFindTabByID(tab_bar, tab_id))\n        tab_bar->Tabs.erase(tab);\n    if (tab_bar->VisibleTabId == tab_id)      { tab_bar->VisibleTabId = 0; }\n    if (tab_bar->SelectedTabId == tab_id)     { tab_bar->SelectedTabId = 0; }\n    if (tab_bar->NextSelectedTabId == tab_id) { tab_bar->NextSelectedTabId = 0; }\n}\n\n// Called on manual closure attempt\nvoid ImGui::TabBarCloseTab(ImGuiTabBar* tab_bar, ImGuiTabItem* tab)\n{\n    IM_ASSERT(!(tab->Flags & ImGuiTabItemFlags_Button));\n    if (!(tab->Flags & ImGuiTabItemFlags_UnsavedDocument))\n    {\n        // This will remove a frame of lag for selecting another tab on closure.\n        // However we don't run it in the case where the 'Unsaved' flag is set, so user gets a chance to fully undo the closure\n        tab->WantClose = true;\n        if (tab_bar->VisibleTabId == tab->ID)\n        {\n            tab->LastFrameVisible = -1;\n            tab_bar->SelectedTabId = tab_bar->NextSelectedTabId = 0;\n        }\n    }\n    else\n    {\n        // Actually select before expecting closure attempt (on an UnsavedDocument tab user is expect to e.g. show a popup)\n        if (tab_bar->VisibleTabId != tab->ID)\n            tab_bar->NextSelectedTabId = tab->ID;\n    }\n}\n\nstatic float ImGui::TabBarScrollClamp(ImGuiTabBar* tab_bar, float scrolling)\n{\n    scrolling = ImMin(scrolling, tab_bar->WidthAllTabs - tab_bar->BarRect.GetWidth());\n    return ImMax(scrolling, 0.0f);\n}\n\n// Note: we may scroll to tab that are not selected! e.g. using keyboard arrow keys\nstatic void ImGui::TabBarScrollToTab(ImGuiTabBar* tab_bar, ImGuiID tab_id, ImGuiTabBarSection* sections)\n{\n    ImGuiTabItem* tab = TabBarFindTabByID(tab_bar, tab_id);\n    if (tab == NULL)\n        return;\n    if (tab->Flags & ImGuiTabItemFlags_SectionMask_)\n        return;\n\n    ImGuiContext& g = *GImGui;\n    float margin = g.FontSize * 1.0f; // When to scroll to make Tab N+1 visible always make a bit of N visible to suggest more scrolling area (since we don't have a scrollbar)\n    int order = tab_bar->GetTabOrder(tab);\n\n    // Scrolling happens only in the central section (leading/trailing sections are not scrolling)\n    // FIXME: This is all confusing.\n    float scrollable_width = tab_bar->BarRect.GetWidth() - sections[0].Width - sections[2].Width - sections[1].Spacing;\n\n    // We make all tabs positions all relative Sections[0].Width to make code simpler\n    float tab_x1 = tab->Offset - sections[0].Width + (order > sections[0].TabCount - 1 ? -margin : 0.0f);\n    float tab_x2 = tab->Offset - sections[0].Width + tab->Width + (order + 1 < tab_bar->Tabs.Size - sections[2].TabCount ? margin : 1.0f);\n    tab_bar->ScrollingTargetDistToVisibility = 0.0f;\n    if (tab_bar->ScrollingTarget > tab_x1 || (tab_x2 - tab_x1 >= scrollable_width))\n    {\n        // Scroll to the left\n        tab_bar->ScrollingTargetDistToVisibility = ImMax(tab_bar->ScrollingAnim - tab_x2, 0.0f);\n        tab_bar->ScrollingTarget = tab_x1;\n    }\n    else if (tab_bar->ScrollingTarget < tab_x2 - scrollable_width)\n    {\n        // Scroll to the right\n        tab_bar->ScrollingTargetDistToVisibility = ImMax((tab_x1 - scrollable_width) - tab_bar->ScrollingAnim, 0.0f);\n        tab_bar->ScrollingTarget = tab_x2 - scrollable_width;\n    }\n}\n\nvoid ImGui::TabBarQueueReorder(ImGuiTabBar* tab_bar, const ImGuiTabItem* tab, int offset)\n{\n    IM_ASSERT(offset != 0);\n    IM_ASSERT(tab_bar->ReorderRequestTabId == 0);\n    tab_bar->ReorderRequestTabId = tab->ID;\n    tab_bar->ReorderRequestOffset = (ImS16)offset;\n}\n\nvoid ImGui::TabBarQueueReorderFromMousePos(ImGuiTabBar* tab_bar, const ImGuiTabItem* src_tab, ImVec2 mouse_pos)\n{\n    ImGuiContext& g = *GImGui;\n    IM_ASSERT(tab_bar->ReorderRequestTabId == 0);\n    if ((tab_bar->Flags & ImGuiTabBarFlags_Reorderable) == 0)\n        return;\n\n    const bool is_central_section = (src_tab->Flags & ImGuiTabItemFlags_SectionMask_) == 0;\n    const float bar_offset = tab_bar->BarRect.Min.x - (is_central_section ? tab_bar->ScrollingTarget : 0);\n\n    // Count number of contiguous tabs we are crossing over\n    const int dir = (bar_offset + src_tab->Offset) > mouse_pos.x ? -1 : +1;\n    const int src_idx = tab_bar->Tabs.index_from_ptr(src_tab);\n    int dst_idx = src_idx;\n    for (int i = src_idx; i >= 0 && i < tab_bar->Tabs.Size; i += dir)\n    {\n        // Reordered tabs must share the same section\n        const ImGuiTabItem* dst_tab = &tab_bar->Tabs[i];\n        if (dst_tab->Flags & ImGuiTabItemFlags_NoReorder)\n            break;\n        if ((dst_tab->Flags & ImGuiTabItemFlags_SectionMask_) != (src_tab->Flags & ImGuiTabItemFlags_SectionMask_))\n            break;\n        dst_idx = i;\n\n        // Include spacing after tab, so when mouse cursor is between tabs we would not continue checking further tabs that are not hovered.\n        const float x1 = bar_offset + dst_tab->Offset - g.Style.ItemInnerSpacing.x;\n        const float x2 = bar_offset + dst_tab->Offset + dst_tab->Width + g.Style.ItemInnerSpacing.x;\n        //GetForegroundDrawList()->AddRect(ImVec2(x1, tab_bar->BarRect.Min.y), ImVec2(x2, tab_bar->BarRect.Max.y), IM_COL32(255, 0, 0, 255));\n        if ((dir < 0 && mouse_pos.x > x1) || (dir > 0 && mouse_pos.x < x2))\n            break;\n    }\n\n    if (dst_idx != src_idx)\n        TabBarQueueReorder(tab_bar, src_tab, dst_idx - src_idx);\n}\n\nbool ImGui::TabBarProcessReorder(ImGuiTabBar* tab_bar)\n{\n    ImGuiTabItem* tab1 = TabBarFindTabByID(tab_bar, tab_bar->ReorderRequestTabId);\n    if (tab1 == NULL || (tab1->Flags & ImGuiTabItemFlags_NoReorder))\n        return false;\n\n    //IM_ASSERT(tab_bar->Flags & ImGuiTabBarFlags_Reorderable); // <- this may happen when using debug tools\n    int tab2_order = tab_bar->GetTabOrder(tab1) + tab_bar->ReorderRequestOffset;\n    if (tab2_order < 0 || tab2_order >= tab_bar->Tabs.Size)\n        return false;\n\n    // Reordered tabs must share the same section\n    // (Note: TabBarQueueReorderFromMousePos() also has a similar test but since we allow direct calls to TabBarQueueReorder() we do it here too)\n    ImGuiTabItem* tab2 = &tab_bar->Tabs[tab2_order];\n    if (tab2->Flags & ImGuiTabItemFlags_NoReorder)\n        return false;\n    if ((tab1->Flags & ImGuiTabItemFlags_SectionMask_) != (tab2->Flags & ImGuiTabItemFlags_SectionMask_))\n        return false;\n\n    ImGuiTabItem item_tmp = *tab1;\n    ImGuiTabItem* src_tab = (tab_bar->ReorderRequestOffset > 0) ? tab1 + 1 : tab2;\n    ImGuiTabItem* dst_tab = (tab_bar->ReorderRequestOffset > 0) ? tab1 : tab2 + 1;\n    const int move_count = (tab_bar->ReorderRequestOffset > 0) ? tab_bar->ReorderRequestOffset : -tab_bar->ReorderRequestOffset;\n    memmove(dst_tab, src_tab, move_count * sizeof(ImGuiTabItem));\n    *tab2 = item_tmp;\n\n    if (tab_bar->Flags & ImGuiTabBarFlags_SaveSettings)\n        MarkIniSettingsDirty();\n    return true;\n}\n\nstatic ImGuiTabItem* ImGui::TabBarScrollingButtons(ImGuiTabBar* tab_bar)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n\n    const ImVec2 arrow_button_size(g.FontSize - 2.0f, g.FontSize + g.Style.FramePadding.y * 2.0f);\n    const float scrolling_buttons_width = arrow_button_size.x * 2.0f;\n\n    const ImVec2 backup_cursor_pos = window->DC.CursorPos;\n    //window->DrawList->AddRect(ImVec2(tab_bar->BarRect.Max.x - scrolling_buttons_width, tab_bar->BarRect.Min.y), ImVec2(tab_bar->BarRect.Max.x, tab_bar->BarRect.Max.y), IM_COL32(255,0,0,255));\n\n    int select_dir = 0;\n    ImVec4 arrow_col = g.Style.Colors[ImGuiCol_Text];\n    arrow_col.w *= 0.5f;\n\n    PushStyleColor(ImGuiCol_Text, arrow_col);\n    PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));\n    const float backup_repeat_delay = g.IO.KeyRepeatDelay;\n    const float backup_repeat_rate = g.IO.KeyRepeatRate;\n    g.IO.KeyRepeatDelay = 0.250f;\n    g.IO.KeyRepeatRate = 0.200f;\n    float x = ImMax(tab_bar->BarRect.Min.x, tab_bar->BarRect.Max.x - scrolling_buttons_width);\n    window->DC.CursorPos = ImVec2(x, tab_bar->BarRect.Min.y);\n    if (ArrowButtonEx(\"##<\", ImGuiDir_Left, arrow_button_size, ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_Repeat))\n        select_dir = -1;\n    window->DC.CursorPos = ImVec2(x + arrow_button_size.x, tab_bar->BarRect.Min.y);\n    if (ArrowButtonEx(\"##>\", ImGuiDir_Right, arrow_button_size, ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_Repeat))\n        select_dir = +1;\n    PopStyleColor(2);\n    g.IO.KeyRepeatRate = backup_repeat_rate;\n    g.IO.KeyRepeatDelay = backup_repeat_delay;\n\n    ImGuiTabItem* tab_to_scroll_to = NULL;\n    if (select_dir != 0)\n        if (ImGuiTabItem* tab_item = TabBarFindTabByID(tab_bar, tab_bar->SelectedTabId))\n        {\n            int selected_order = tab_bar->GetTabOrder(tab_item);\n            int target_order = selected_order + select_dir;\n\n            // Skip tab item buttons until another tab item is found or end is reached\n            while (tab_to_scroll_to == NULL)\n            {\n                // If we are at the end of the list, still scroll to make our tab visible\n                tab_to_scroll_to = &tab_bar->Tabs[(target_order >= 0 && target_order < tab_bar->Tabs.Size) ? target_order : selected_order];\n\n                // Cross through buttons\n                // (even if first/last item is a button, return it so we can update the scroll)\n                if (tab_to_scroll_to->Flags & ImGuiTabItemFlags_Button)\n                {\n                    target_order += select_dir;\n                    selected_order += select_dir;\n                    tab_to_scroll_to = (target_order < 0 || target_order >= tab_bar->Tabs.Size) ? tab_to_scroll_to : NULL;\n                }\n            }\n        }\n    window->DC.CursorPos = backup_cursor_pos;\n    tab_bar->BarRect.Max.x -= scrolling_buttons_width + 1.0f;\n\n    return tab_to_scroll_to;\n}\n\nstatic ImGuiTabItem* ImGui::TabBarTabListPopupButton(ImGuiTabBar* tab_bar)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n\n    // We use g.Style.FramePadding.y to match the square ArrowButton size\n    const float tab_list_popup_button_width = g.FontSize + g.Style.FramePadding.y;\n    const ImVec2 backup_cursor_pos = window->DC.CursorPos;\n    window->DC.CursorPos = ImVec2(tab_bar->BarRect.Min.x - g.Style.FramePadding.y, tab_bar->BarRect.Min.y);\n    tab_bar->BarRect.Min.x += tab_list_popup_button_width;\n\n    ImVec4 arrow_col = g.Style.Colors[ImGuiCol_Text];\n    arrow_col.w *= 0.5f;\n    PushStyleColor(ImGuiCol_Text, arrow_col);\n    PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));\n    bool open = BeginCombo(\"##v\", NULL, ImGuiComboFlags_NoPreview | ImGuiComboFlags_HeightLargest);\n    PopStyleColor(2);\n\n    ImGuiTabItem* tab_to_select = NULL;\n    if (open)\n    {\n        for (int tab_n = 0; tab_n < tab_bar->Tabs.Size; tab_n++)\n        {\n            ImGuiTabItem* tab = &tab_bar->Tabs[tab_n];\n            if (tab->Flags & ImGuiTabItemFlags_Button)\n                continue;\n\n            const char* tab_name = tab_bar->GetTabName(tab);\n            if (Selectable(tab_name, tab_bar->SelectedTabId == tab->ID))\n                tab_to_select = tab;\n        }\n        EndCombo();\n    }\n\n    window->DC.CursorPos = backup_cursor_pos;\n    return tab_to_select;\n}\n\n//-------------------------------------------------------------------------\n// [SECTION] Widgets: BeginTabItem, EndTabItem, etc.\n//-------------------------------------------------------------------------\n// - BeginTabItem()\n// - EndTabItem()\n// - TabItemButton()\n// - TabItemEx() [Internal]\n// - SetTabItemClosed()\n// - TabItemCalcSize() [Internal]\n// - TabItemBackground() [Internal]\n// - TabItemLabelAndCloseButton() [Internal]\n//-------------------------------------------------------------------------\n\nbool    ImGui::BeginTabItem(const char* label, bool* p_open, ImGuiTabItemFlags flags)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    if (window->SkipItems)\n        return false;\n\n    ImGuiTabBar* tab_bar = g.CurrentTabBar;\n    if (tab_bar == NULL)\n    {\n        IM_ASSERT_USER_ERROR(tab_bar, \"Needs to be called between BeginTabBar() and EndTabBar()!\");\n        return false;\n    }\n    IM_ASSERT(!(flags & ImGuiTabItemFlags_Button)); // BeginTabItem() Can't be used with button flags, use TabItemButton() instead!\n\n    bool ret = TabItemEx(tab_bar, label, p_open, flags);\n    if (ret && !(flags & ImGuiTabItemFlags_NoPushId))\n    {\n        ImGuiTabItem* tab = &tab_bar->Tabs[tab_bar->LastTabItemIdx];\n        PushOverrideID(tab->ID); // We already hashed 'label' so push into the ID stack directly instead of doing another hash through PushID(label)\n    }\n    return ret;\n}\n\nvoid    ImGui::EndTabItem()\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    if (window->SkipItems)\n        return;\n\n    ImGuiTabBar* tab_bar = g.CurrentTabBar;\n    if (tab_bar == NULL)\n    {\n        IM_ASSERT_USER_ERROR(tab_bar != NULL, \"Needs to be called between BeginTabBar() and EndTabBar()!\");\n        return;\n    }\n    IM_ASSERT(tab_bar->LastTabItemIdx >= 0);\n    ImGuiTabItem* tab = &tab_bar->Tabs[tab_bar->LastTabItemIdx];\n    if (!(tab->Flags & ImGuiTabItemFlags_NoPushId))\n        PopID();\n}\n\nbool    ImGui::TabItemButton(const char* label, ImGuiTabItemFlags flags)\n{\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    if (window->SkipItems)\n        return false;\n\n    ImGuiTabBar* tab_bar = g.CurrentTabBar;\n    if (tab_bar == NULL)\n    {\n        IM_ASSERT_USER_ERROR(tab_bar != NULL, \"Needs to be called between BeginTabBar() and EndTabBar()!\");\n        return false;\n    }\n    return TabItemEx(tab_bar, label, NULL, flags | ImGuiTabItemFlags_Button | ImGuiTabItemFlags_NoReorder);\n}\n\nbool    ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, ImGuiTabItemFlags flags)\n{\n    // Layout whole tab bar if not already done\n    if (tab_bar->WantLayout)\n        TabBarLayout(tab_bar);\n\n    ImGuiContext& g = *GImGui;\n    ImGuiWindow* window = g.CurrentWindow;\n    if (window->SkipItems)\n        return false;\n\n    const ImGuiStyle& style = g.Style;\n    const ImGuiID id = TabBarCalcTabID(tab_bar, label);\n\n    // If the user called us with *p_open == false, we early out and don't render.\n    // We make a call to ItemAdd() so that attempts to use a contextual popup menu with an implicit ID won't use an older ID.\n    IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags);\n    if (p_open && !*p_open)\n    {\n        PushItemFlag(ImGuiItemFlags_NoNav | ImGuiItemFlags_NoNavDefaultFocus, true);\n        ItemAdd(ImRect(), id);\n        PopItemFlag();\n        return false;\n    }\n\n    IM_ASSERT(!p_open || !(flags & ImGuiTabItemFlags_Button));\n    IM_ASSERT((flags & (ImGuiTabItemFlags_Leading | ImGuiTabItemFlags_Trailing)) != (ImGuiTabItemFlags_Leading | ImGuiTabItemFlags_Trailing)); // Can't use both Leading and Trailing\n\n    // Store into ImGuiTabItemFlags_NoCloseButton, also honor ImGuiTabItemFlags_NoCloseButton passed by user (although not documented)\n    if (flags & ImGuiTabItemFlags_NoCloseButton)\n        p_open = NULL;\n    else if (p_open == NULL)\n        flags |= ImGuiTabItemFlags_NoCloseButton;\n\n    // Calculate tab contents size\n    ImVec2 size = TabItemCalcSize(label, p_open != NULL);\n\n    // Acquire tab data\n    ImGuiTabItem* tab = TabBarFindTabByID(tab_bar, id);\n    bool tab_is_new = false;\n    if (tab == NULL)\n    {\n        tab_bar->Tabs.push_back(ImGuiTabItem());\n        tab = &tab_bar->Tabs.back();\n        tab->ID = id;\n        tab->Width = size.x;\n        tab_bar->TabsAddedNew = true;\n        tab_is_new = true;\n    }\n    tab_bar->LastTabItemIdx = (ImS16)tab_bar->Tabs.index_from_ptr(tab);\n    tab->ContentWidth = size.x;\n    tab->BeginOrder = tab_bar->TabsActiveCount++;\n\n    const bool tab_bar_appearing = (tab_bar->PrevFrameVisible + 1 < g.FrameCount);\n    const bool tab_bar_focused = (tab_bar->Flags & ImGuiTabBarFlags_IsFocused) != 0;\n    const bool tab_appearing = (tab->LastFrameVisible + 1 < g.FrameCount);\n    const bool is_tab_button = (flags & ImGuiTabItemFlags_Button) != 0;\n    tab->LastFrameVisible = g.FrameCount;\n    tab->Flags = flags;\n\n    // Append name with zero-terminator\n    tab->NameOffset = (ImS32)tab_bar->TabsNames.size();\n    tab_bar->TabsNames.append(label, label + strlen(label) + 1);\n\n    // Update selected tab\n    if (tab_appearing && (tab_bar->Flags & ImGuiTabBarFlags_AutoSelectNewTabs) && tab_bar->NextSelectedTabId == 0)\n        if (!tab_bar_appearing || tab_bar->SelectedTabId == 0)\n            if (!is_tab_button)\n                tab_bar->NextSelectedTabId = id;  // New tabs gets activated\n    if ((flags & ImGuiTabItemFlags_SetSelected) && (tab_bar->SelectedTabId != id)) // SetSelected can only be passed on explicit tab bar\n        if (!is_tab_button)\n            tab_bar->NextSelectedTabId = id;\n\n    // Lock visibility\n    // (Note: tab_contents_visible != tab_selected... because CTRL+TAB operations may preview some tabs without selecting them!)\n    bool tab_contents_visible = (tab_bar->VisibleTabId == id);\n    if (tab_contents_visible)\n        tab_bar->VisibleTabWasSubmitted = true;\n\n    // On the very first frame of a tab bar we let first tab contents be visible to minimize appearing glitches\n    if (!tab_contents_visible && tab_bar->SelectedTabId == 0 && tab_bar_appearing)\n        if (tab_bar->Tabs.Size == 1 && !(tab_bar->Flags & ImGuiTabBarFlags_AutoSelectNewTabs))\n            tab_contents_visible = true;\n\n    // Note that tab_is_new is not necessarily the same as tab_appearing! When a tab bar stops being submitted\n    // and then gets submitted again, the tabs will have 'tab_appearing=true' but 'tab_is_new=false'.\n    if (tab_appearing && (!tab_bar_appearing || tab_is_new))\n    {\n        PushItemFlag(ImGuiItemFlags_NoNav | ImGuiItemFlags_NoNavDefaultFocus, true);\n        ItemAdd(ImRect(), id);\n        PopItemFlag();\n        if (is_tab_button)\n            return false;\n        return tab_contents_visible;\n    }\n\n    if (tab_bar->SelectedTabId == id)\n        tab->LastFrameSelected = g.FrameCount;\n\n    // Backup current layout position\n    const ImVec2 backup_main_cursor_pos = window->DC.CursorPos;\n\n    // Layout\n    const bool is_central_section = (tab->Flags & ImGuiTabItemFlags_SectionMask_) == 0;\n    size.x = tab->Width;\n    if (is_central_section)\n        window->DC.CursorPos = tab_bar->BarRect.Min + ImVec2(IM_FLOOR(tab->Offset - tab_bar->ScrollingAnim), 0.0f);\n    else\n        window->DC.CursorPos = tab_bar->BarRect.Min + ImVec2(tab->Offset, 0.0f);\n    ImVec2 pos = window->DC.CursorPos;\n    ImRect bb(pos, pos + size);\n\n    // We don't have CPU clipping primitives to clip the CloseButton (until it becomes a texture), so need to add an extra draw call (temporary in the case of vertical animation)\n    const bool want_clip_rect = is_central_section && (bb.Min.x < tab_bar->ScrollingRectMinX || bb.Max.x > tab_bar->ScrollingRectMaxX);\n    if (want_clip_rect)\n        PushClipRect(ImVec2(ImMax(bb.Min.x, tab_bar->ScrollingRectMinX), bb.Min.y - 1), ImVec2(tab_bar->ScrollingRectMaxX, bb.Max.y), true);\n\n    ImVec2 backup_cursor_max_pos = window->DC.CursorMaxPos;\n    ItemSize(bb.GetSize(), style.FramePadding.y);\n    window->DC.CursorMaxPos = backup_cursor_max_pos;\n\n    if (!ItemAdd(bb, id))\n    {\n        if (want_clip_rect)\n            PopClipRect();\n        window->DC.CursorPos = backup_main_cursor_pos;\n        return tab_contents_visible;\n    }\n\n    // Click to Select a tab\n    ImGuiButtonFlags button_flags = ((is_tab_button ? ImGuiButtonFlags_PressedOnClickRelease : ImGuiButtonFlags_PressedOnClick) | ImGuiButtonFlags_AllowItemOverlap);\n    if (g.DragDropActive)\n        button_flags |= ImGuiButtonFlags_PressedOnDragDropHold;\n    bool hovered, held;\n    bool pressed = ButtonBehavior(bb, id, &hovered, &held, button_flags);\n    if (pressed && !is_tab_button)\n        tab_bar->NextSelectedTabId = id;\n\n    // Allow the close button to overlap unless we are dragging (in which case we don't want any overlapping tabs to be hovered)\n    if (g.ActiveId != id)\n        SetItemAllowOverlap();\n\n    // Drag and drop: re-order tabs\n    if (held && !tab_appearing && IsMouseDragging(0))\n    {\n        if (!g.DragDropActive && (tab_bar->Flags & ImGuiTabBarFlags_Reorderable))\n        {\n            // While moving a tab it will jump on the other side of the mouse, so we also test for MouseDelta.x\n            if (g.IO.MouseDelta.x < 0.0f && g.IO.MousePos.x < bb.Min.x)\n            {\n                TabBarQueueReorderFromMousePos(tab_bar, tab, g.IO.MousePos);\n            }\n            else if (g.IO.MouseDelta.x > 0.0f && g.IO.MousePos.x > bb.Max.x)\n            {\n                TabBarQueueReorderFromMousePos(tab_bar, tab, g.IO.MousePos);\n            }\n        }\n    }\n\n#if 0\n    if (hovered && g.HoveredIdNotActiveTimer > TOOLTIP_DELAY && bb.GetWidth() < tab->ContentWidth)\n    {\n        // Enlarge tab display when hovering\n        bb.Max.x = bb.Min.x + IM_FLOOR(ImLerp(bb.GetWidth(), tab->ContentWidth, ImSaturate((g.HoveredIdNotActiveTimer - 0.40f) * 6.0f)));\n        display_draw_list = GetForegroundDrawList(window);\n        TabItemBackground(display_draw_list, bb, flags, GetColorU32(ImGuiCol_TitleBgActive));\n    }\n#endif\n\n    // Render tab shape\n    ImDrawList* display_draw_list = window->DrawList;\n    const ImU32 tab_col = GetColorU32((held || hovered) ? ImGuiCol_TabHovered : tab_contents_visible ? (tab_bar_focused ? ImGuiCol_TabActive : ImGuiCol_TabUnfocusedActive) : (tab_bar_focused ? ImGuiCol_Tab : ImGuiCol_TabUnfocused));\n    TabItemBackground(display_draw_list, bb, flags, tab_col);\n    RenderNavHighlight(bb, id);\n\n    // Select with right mouse button. This is so the common idiom for context menu automatically highlight the current widget.\n    const bool hovered_unblocked = IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup);\n    if (hovered_unblocked && (IsMouseClicked(1) || IsMouseReleased(1)))\n        if (!is_tab_button)\n            tab_bar->NextSelectedTabId = id;\n\n    if (tab_bar->Flags & ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)\n        flags |= ImGuiTabItemFlags_NoCloseWithMiddleMouseButton;\n\n    // Render tab label, process close button\n    const ImGuiID close_button_id = p_open ? GetIDWithSeed(\"#CLOSE\", NULL, id) : 0;\n    bool just_closed;\n    bool text_clipped;\n    TabItemLabelAndCloseButton(display_draw_list, bb, flags, tab_bar->FramePadding, label, id, close_button_id, tab_contents_visible, &just_closed, &text_clipped);\n    if (just_closed && p_open != NULL)\n    {\n        *p_open = false;\n        TabBarCloseTab(tab_bar, tab);\n    }\n\n    // Restore main window position so user can draw there\n    if (want_clip_rect)\n        PopClipRect();\n    window->DC.CursorPos = backup_main_cursor_pos;\n\n    // Tooltip\n    // (Won't work over the close button because ItemOverlap systems messes up with HoveredIdTimer-> seems ok)\n    // (We test IsItemHovered() to discard e.g. when another item is active or drag and drop over the tab bar, which g.HoveredId ignores)\n    // FIXME: This is a mess.\n    // FIXME: We may want disabled tab to still display the tooltip?\n    if (text_clipped && g.HoveredId == id && !held && g.HoveredIdNotActiveTimer > g.TooltipSlowDelay && IsItemHovered())\n        if (!(tab_bar->Flags & ImGuiTabBarFlags_NoTooltip) && !(tab->Flags & ImGuiTabItemFlags_NoTooltip))\n            SetTooltip(\"%.*s\", (int)(FindRenderedTextEnd(label) - label), label);\n\n    IM_ASSERT(!is_tab_button || !(tab_bar->SelectedTabId == tab->ID && is_tab_button)); // TabItemButton should not be selected\n    if (is_tab_button)\n        return pressed;\n    return tab_contents_visible;\n}\n\n// [Public] This is call is 100% optional but it allows to remove some one-frame glitches when a tab has been unexpectedly removed.\n// To use it to need to call the function SetTabItemClosed() between BeginTabBar() and EndTabBar().\n// Tabs closed by the close button will automatically be flagged to avoid this issue.\nvoid    ImGui::SetTabItemClosed(const char* label)\n{\n    ImGuiContext& g = *GImGui;\n    bool is_within_manual_tab_bar = g.CurrentTabBar && !(g.CurrentTabBar->Flags & ImGuiTabBarFlags_DockNode);\n    if (is_within_manual_tab_bar)\n    {\n        ImGuiTabBar* tab_bar = g.CurrentTabBar;\n        ImGuiID tab_id = TabBarCalcTabID(tab_bar, label);\n        if (ImGuiTabItem* tab = TabBarFindTabByID(tab_bar, tab_id))\n            tab->WantClose = true; // Will be processed by next call to TabBarLayout()\n    }\n}\n\nImVec2 ImGui::TabItemCalcSize(const char* label, bool has_close_button)\n{\n    ImGuiContext& g = *GImGui;\n    ImVec2 label_size = CalcTextSize(label, NULL, true);\n    ImVec2 size = ImVec2(label_size.x + g.Style.FramePadding.x, label_size.y + g.Style.FramePadding.y * 2.0f);\n    if (has_close_button)\n        size.x += g.Style.FramePadding.x + (g.Style.ItemInnerSpacing.x + g.FontSize); // We use Y intentionally to fit the close button circle.\n    else\n        size.x += g.Style.FramePadding.x + 1.0f;\n    return ImVec2(ImMin(size.x, TabBarCalcMaxTabWidth()), size.y);\n}\n\nvoid ImGui::TabItemBackground(ImDrawList* draw_list, const ImRect& bb, ImGuiTabItemFlags flags, ImU32 col)\n{\n    // While rendering tabs, we trim 1 pixel off the top of our bounding box so they can fit within a regular frame height while looking \"detached\" from it.\n    ImGuiContext& g = *GImGui;\n    const float width = bb.GetWidth();\n    IM_UNUSED(flags);\n    IM_ASSERT(width > 0.0f);\n    const float rounding = ImMax(0.0f, ImMin((flags & ImGuiTabItemFlags_Button) ? g.Style.FrameRounding : g.Style.TabRounding, width * 0.5f - 1.0f));\n    const float y1 = bb.Min.y + 1.0f;\n    const float y2 = bb.Max.y - 1.0f;\n    draw_list->PathLineTo(ImVec2(bb.Min.x, y2));\n    draw_list->PathArcToFast(ImVec2(bb.Min.x + rounding, y1 + rounding), rounding, 6, 9);\n    draw_list->PathArcToFast(ImVec2(bb.Max.x - rounding, y1 + rounding), rounding, 9, 12);\n    draw_list->PathLineTo(ImVec2(bb.Max.x, y2));\n    draw_list->PathFillConvex(col);\n    if (g.Style.TabBorderSize > 0.0f)\n    {\n        draw_list->PathLineTo(ImVec2(bb.Min.x + 0.5f, y2));\n        draw_list->PathArcToFast(ImVec2(bb.Min.x + rounding + 0.5f, y1 + rounding + 0.5f), rounding, 6, 9);\n        draw_list->PathArcToFast(ImVec2(bb.Max.x - rounding - 0.5f, y1 + rounding + 0.5f), rounding, 9, 12);\n        draw_list->PathLineTo(ImVec2(bb.Max.x - 0.5f, y2));\n        draw_list->PathStroke(GetColorU32(ImGuiCol_Border), 0, g.Style.TabBorderSize);\n    }\n}\n\n// Render text label (with custom clipping) + Unsaved Document marker + Close Button logic\n// We tend to lock style.FramePadding for a given tab-bar, hence the 'frame_padding' parameter.\nvoid ImGui::TabItemLabelAndCloseButton(ImDrawList* draw_list, const ImRect& bb, ImGuiTabItemFlags flags, ImVec2 frame_padding, const char* label, ImGuiID tab_id, ImGuiID close_button_id, bool is_contents_visible, bool* out_just_closed, bool* out_text_clipped)\n{\n    ImGuiContext& g = *GImGui;\n    ImVec2 label_size = CalcTextSize(label, NULL, true);\n\n    if (out_just_closed)\n        *out_just_closed = false;\n    if (out_text_clipped)\n        *out_text_clipped = false;\n\n    if (bb.GetWidth() <= 1.0f)\n        return;\n\n    // In Style V2 we'll have full override of all colors per state (e.g. focused, selected)\n    // But right now if you want to alter text color of tabs this is what you need to do.\n#if 0\n    const float backup_alpha = g.Style.Alpha;\n    if (!is_contents_visible)\n        g.Style.Alpha *= 0.7f;\n#endif\n\n    // Render text label (with clipping + alpha gradient) + unsaved marker\n    ImRect text_pixel_clip_bb(bb.Min.x + frame_padding.x, bb.Min.y + frame_padding.y, bb.Max.x - frame_padding.x, bb.Max.y);\n    ImRect text_ellipsis_clip_bb = text_pixel_clip_bb;\n\n    // Return clipped state ignoring the close button\n    if (out_text_clipped)\n    {\n        *out_text_clipped = (text_ellipsis_clip_bb.Min.x + label_size.x) > text_pixel_clip_bb.Max.x;\n        //draw_list->AddCircle(text_ellipsis_clip_bb.Min, 3.0f, *out_text_clipped ? IM_COL32(255, 0, 0, 255) : IM_COL32(0, 255, 0, 255));\n    }\n\n    const float button_sz = g.FontSize;\n    const ImVec2 button_pos(ImMax(bb.Min.x, bb.Max.x - frame_padding.x * 2.0f - button_sz), bb.Min.y);\n\n    // Close Button & Unsaved Marker\n    // We are relying on a subtle and confusing distinction between 'hovered' and 'g.HoveredId' which happens because we are using ImGuiButtonFlags_AllowOverlapMode + SetItemAllowOverlap()\n    //  'hovered' will be true when hovering the Tab but NOT when hovering the close button\n    //  'g.HoveredId==id' will be true when hovering the Tab including when hovering the close button\n    //  'g.ActiveId==close_button_id' will be true when we are holding on the close button, in which case both hovered booleans are false\n    bool close_button_pressed = false;\n    bool close_button_visible = false;\n    if (close_button_id != 0)\n        if (is_contents_visible || bb.GetWidth() >= ImMax(button_sz, g.Style.TabMinWidthForCloseButton))\n            if (g.HoveredId == tab_id || g.HoveredId == close_button_id || g.ActiveId == tab_id || g.ActiveId == close_button_id)\n                close_button_visible = true;\n    bool unsaved_marker_visible = (flags & ImGuiTabItemFlags_UnsavedDocument) != 0 && (button_pos.x + button_sz <= bb.Max.x);\n\n    if (close_button_visible)\n    {\n        ImGuiLastItemData last_item_backup = g.LastItemData;\n        PushStyleVar(ImGuiStyleVar_FramePadding, frame_padding);\n        if (CloseButton(close_button_id, button_pos))\n            close_button_pressed = true;\n        PopStyleVar();\n        g.LastItemData = last_item_backup;\n\n        // Close with middle mouse button\n        if (!(flags & ImGuiTabItemFlags_NoCloseWithMiddleMouseButton) && IsMouseClicked(2))\n            close_button_pressed = true;\n    }\n    else if (unsaved_marker_visible)\n    {\n        const ImRect bullet_bb(button_pos, button_pos + ImVec2(button_sz, button_sz) + g.Style.FramePadding * 2.0f);\n        RenderBullet(draw_list, bullet_bb.GetCenter(), GetColorU32(ImGuiCol_Text));\n    }\n\n    // This is all rather complicated\n    // (the main idea is that because the close button only appears on hover, we don't want it to alter the ellipsis position)\n    // FIXME: if FramePadding is noticeably large, ellipsis_max_x will be wrong here (e.g. #3497), maybe for consistency that parameter of RenderTextEllipsis() shouldn't exist..\n    float ellipsis_max_x = close_button_visible ? text_pixel_clip_bb.Max.x : bb.Max.x - 1.0f;\n    if (close_button_visible || unsaved_marker_visible)\n    {\n        text_pixel_clip_bb.Max.x -= close_button_visible ? (button_sz) : (button_sz * 0.80f);\n        text_ellipsis_clip_bb.Max.x -= unsaved_marker_visible ? (button_sz * 0.80f) : 0.0f;\n        ellipsis_max_x = text_pixel_clip_bb.Max.x;\n    }\n    RenderTextEllipsis(draw_list, text_ellipsis_clip_bb.Min, text_ellipsis_clip_bb.Max, text_pixel_clip_bb.Max.x, ellipsis_max_x, label, NULL, &label_size);\n\n#if 0\n    if (!is_contents_visible)\n        g.Style.Alpha = backup_alpha;\n#endif\n\n    if (out_just_closed)\n        *out_just_closed = close_button_pressed;\n}\n\n\n#endif // #ifndef IMGUI_DISABLE\n"
  },
  {
    "path": "R3nzSkin/imgui/imstb_rectpack.h",
    "content": "// [DEAR IMGUI]\n// This is a slightly modified version of stb_rect_pack.h 1.00.\n// Those changes would need to be pushed into nothings/stb:\n// - Added STBRP__CDECL\n// Grep for [DEAR IMGUI] to find the changes.\n\n// stb_rect_pack.h - v1.00 - public domain - rectangle packing\n// Sean Barrett 2014\n//\n// Useful for e.g. packing rectangular textures into an atlas.\n// Does not do rotation.\n//\n// Not necessarily the awesomest packing method, but better than\n// the totally naive one in stb_truetype (which is primarily what\n// this is meant to replace).\n//\n// Has only had a few tests run, may have issues.\n//\n// More docs to come.\n//\n// No memory allocations; uses qsort() and assert() from stdlib.\n// Can override those by defining STBRP_SORT and STBRP_ASSERT.\n//\n// This library currently uses the Skyline Bottom-Left algorithm.\n//\n// Please note: better rectangle packers are welcome! Please\n// implement them to the same API, but with a different init\n// function.\n//\n// Credits\n//\n//  Library\n//    Sean Barrett\n//  Minor features\n//    Martins Mozeiko\n//    github:IntellectualKitty\n//\n//  Bugfixes / warning fixes\n//    Jeremy Jaussaud\n//    Fabian Giesen\n//\n// Version history:\n//\n//     1.00  (2019-02-25)  avoid small space waste; gracefully fail too-wide rectangles\n//     0.99  (2019-02-07)  warning fixes\n//     0.11  (2017-03-03)  return packing success/fail result\n//     0.10  (2016-10-25)  remove cast-away-const to avoid warnings\n//     0.09  (2016-08-27)  fix compiler warnings\n//     0.08  (2015-09-13)  really fix bug with empty rects (w=0 or h=0)\n//     0.07  (2015-09-13)  fix bug with empty rects (w=0 or h=0)\n//     0.06  (2015-04-15)  added STBRP_SORT to allow replacing qsort\n//     0.05:  added STBRP_ASSERT to allow replacing assert\n//     0.04:  fixed minor bug in STBRP_LARGE_RECTS support\n//     0.01:  initial release\n//\n// LICENSE\n//\n//   See end of file for license information.\n\n//////////////////////////////////////////////////////////////////////////////\n//\n//       INCLUDE SECTION\n//\n\n#ifndef STB_INCLUDE_STB_RECT_PACK_H\n#define STB_INCLUDE_STB_RECT_PACK_H\n\n#define STB_RECT_PACK_VERSION  1\n\n#ifdef STBRP_STATIC\n#define STBRP_DEF static\n#else\n#define STBRP_DEF extern\n#endif\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\ntypedef struct stbrp_context stbrp_context;\ntypedef struct stbrp_node    stbrp_node;\ntypedef struct stbrp_rect    stbrp_rect;\n\n#ifdef STBRP_LARGE_RECTS\ntypedef int            stbrp_coord;\n#else\ntypedef unsigned short stbrp_coord;\n#endif\n\nSTBRP_DEF int stbrp_pack_rects (stbrp_context *context, stbrp_rect *rects, int num_rects);\n// Assign packed locations to rectangles. The rectangles are of type\n// 'stbrp_rect' defined below, stored in the array 'rects', and there\n// are 'num_rects' many of them.\n//\n// Rectangles which are successfully packed have the 'was_packed' flag\n// set to a non-zero value and 'x' and 'y' store the minimum location\n// on each axis (i.e. bottom-left in cartesian coordinates, top-left\n// if you imagine y increasing downwards). Rectangles which do not fit\n// have the 'was_packed' flag set to 0.\n//\n// You should not try to access the 'rects' array from another thread\n// while this function is running, as the function temporarily reorders\n// the array while it executes.\n//\n// To pack into another rectangle, you need to call stbrp_init_target\n// again. To continue packing into the same rectangle, you can call\n// this function again. Calling this multiple times with multiple rect\n// arrays will probably produce worse packing results than calling it\n// a single time with the full rectangle array, but the option is\n// available.\n//\n// The function returns 1 if all of the rectangles were successfully\n// packed and 0 otherwise.\n\nstruct stbrp_rect\n{\n   // reserved for your use:\n   int            id;\n\n   // input:\n   stbrp_coord    w, h;\n\n   // output:\n   stbrp_coord    x, y;\n   int            was_packed;  // non-zero if valid packing\n\n}; // 16 bytes, nominally\n\n\nSTBRP_DEF void stbrp_init_target (stbrp_context *context, int width, int height, stbrp_node *nodes, int num_nodes);\n// Initialize a rectangle packer to:\n//    pack a rectangle that is 'width' by 'height' in dimensions\n//    using temporary storage provided by the array 'nodes', which is 'num_nodes' long\n//\n// You must call this function every time you start packing into a new target.\n//\n// There is no \"shutdown\" function. The 'nodes' memory must stay valid for\n// the following stbrp_pack_rects() call (or calls), but can be freed after\n// the call (or calls) finish.\n//\n// Note: to guarantee best results, either:\n//       1. make sure 'num_nodes' >= 'width'\n//   or  2. call stbrp_allow_out_of_mem() defined below with 'allow_out_of_mem = 1'\n//\n// If you don't do either of the above things, widths will be quantized to multiples\n// of small integers to guarantee the algorithm doesn't run out of temporary storage.\n//\n// If you do #2, then the non-quantized algorithm will be used, but the algorithm\n// may run out of temporary storage and be unable to pack some rectangles.\n\nSTBRP_DEF void stbrp_setup_allow_out_of_mem (stbrp_context *context, int allow_out_of_mem);\n// Optionally call this function after init but before doing any packing to\n// change the handling of the out-of-temp-memory scenario, described above.\n// If you call init again, this will be reset to the default (false).\n\n\nSTBRP_DEF void stbrp_setup_heuristic (stbrp_context *context, int heuristic);\n// Optionally select which packing heuristic the library should use. Different\n// heuristics will produce better/worse results for different data sets.\n// If you call init again, this will be reset to the default.\n\nenum\n{\n   STBRP_HEURISTIC_Skyline_default=0,\n   STBRP_HEURISTIC_Skyline_BL_sortHeight = STBRP_HEURISTIC_Skyline_default,\n   STBRP_HEURISTIC_Skyline_BF_sortHeight\n};\n\n\n//////////////////////////////////////////////////////////////////////////////\n//\n// the details of the following structures don't matter to you, but they must\n// be visible so you can handle the memory allocations for them\n\nstruct stbrp_node\n{\n   stbrp_coord  x,y;\n   stbrp_node  *next;\n};\n\nstruct stbrp_context\n{\n   int width;\n   int height;\n   int align;\n   int init_mode;\n   int heuristic;\n   int num_nodes;\n   stbrp_node *active_head;\n   stbrp_node *free_head;\n   stbrp_node extra[2]; // we allocate two extra nodes so optimal user-node-count is 'width' not 'width+2'\n};\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif\n\n//////////////////////////////////////////////////////////////////////////////\n//\n//     IMPLEMENTATION SECTION\n//\n\n#ifdef STB_RECT_PACK_IMPLEMENTATION\n#ifndef STBRP_SORT\n#include <stdlib.h>\n#define STBRP_SORT qsort\n#endif\n\n#ifndef STBRP_ASSERT\n#include <assert.h>\n#define STBRP_ASSERT assert\n#endif\n\n// [DEAR IMGUI] Added STBRP__CDECL\n#ifdef _MSC_VER\n#define STBRP__NOTUSED(v)  (void)(v)\n#define STBRP__CDECL __cdecl\n#else\n#define STBRP__NOTUSED(v)  (void)sizeof(v)\n#define STBRP__CDECL\n#endif\n\nenum\n{\n   STBRP__INIT_skyline = 1\n};\n\nSTBRP_DEF void stbrp_setup_heuristic(stbrp_context *context, int heuristic)\n{\n   switch (context->init_mode) {\n      case STBRP__INIT_skyline:\n         STBRP_ASSERT(heuristic == STBRP_HEURISTIC_Skyline_BL_sortHeight || heuristic == STBRP_HEURISTIC_Skyline_BF_sortHeight);\n         context->heuristic = heuristic;\n         break;\n      default:\n         STBRP_ASSERT(0);\n   }\n}\n\nSTBRP_DEF void stbrp_setup_allow_out_of_mem(stbrp_context *context, int allow_out_of_mem)\n{\n   if (allow_out_of_mem)\n      // if it's ok to run out of memory, then don't bother aligning them;\n      // this gives better packing, but may fail due to OOM (even though\n      // the rectangles easily fit). @TODO a smarter approach would be to only\n      // quantize once we've hit OOM, then we could get rid of this parameter.\n      context->align = 1;\n   else {\n      // if it's not ok to run out of memory, then quantize the widths\n      // so that num_nodes is always enough nodes.\n      //\n      // I.e. num_nodes * align >= width\n      //                  align >= width / num_nodes\n      //                  align = ceil(width/num_nodes)\n\n      context->align = (context->width + context->num_nodes-1) / context->num_nodes;\n   }\n}\n\nSTBRP_DEF void stbrp_init_target(stbrp_context *context, int width, int height, stbrp_node *nodes, int num_nodes)\n{\n   int i;\n#ifndef STBRP_LARGE_RECTS\n   STBRP_ASSERT(width <= 0xffff && height <= 0xffff);\n#endif\n\n   for (i=0; i < num_nodes-1; ++i)\n      nodes[i].next = &nodes[i+1];\n   nodes[i].next = NULL;\n   context->init_mode = STBRP__INIT_skyline;\n   context->heuristic = STBRP_HEURISTIC_Skyline_default;\n   context->free_head = &nodes[0];\n   context->active_head = &context->extra[0];\n   context->width = width;\n   context->height = height;\n   context->num_nodes = num_nodes;\n   stbrp_setup_allow_out_of_mem(context, 0);\n\n   // node 0 is the full width, node 1 is the sentinel (lets us not store width explicitly)\n   context->extra[0].x = 0;\n   context->extra[0].y = 0;\n   context->extra[0].next = &context->extra[1];\n   context->extra[1].x = (stbrp_coord) width;\n#ifdef STBRP_LARGE_RECTS\n   context->extra[1].y = (1<<30);\n#else\n   context->extra[1].y = 65535;\n#endif\n   context->extra[1].next = NULL;\n}\n\n// find minimum y position if it starts at x1\nstatic int stbrp__skyline_find_min_y(stbrp_context *c, stbrp_node *first, int x0, int width, int *pwaste)\n{\n   stbrp_node *node = first;\n   int x1 = x0 + width;\n   int min_y, visited_width, waste_area;\n\n   STBRP__NOTUSED(c);\n\n   STBRP_ASSERT(first->x <= x0);\n\n   #if 0\n   // skip in case we're past the node\n   while (node->next->x <= x0)\n      ++node;\n   #else\n   STBRP_ASSERT(node->next->x > x0); // we ended up handling this in the caller for efficiency\n   #endif\n\n   STBRP_ASSERT(node->x <= x0);\n\n   min_y = 0;\n   waste_area = 0;\n   visited_width = 0;\n   while (node->x < x1) {\n      if (node->y > min_y) {\n         // raise min_y higher.\n         // we've accounted for all waste up to min_y,\n         // but we'll now add more waste for everything we've visted\n         waste_area += visited_width * (node->y - min_y);\n         min_y = node->y;\n         // the first time through, visited_width might be reduced\n         if (node->x < x0)\n            visited_width += node->next->x - x0;\n         else\n            visited_width += node->next->x - node->x;\n      } else {\n         // add waste area\n         int under_width = node->next->x - node->x;\n         if (under_width + visited_width > width)\n            under_width = width - visited_width;\n         waste_area += under_width * (min_y - node->y);\n         visited_width += under_width;\n      }\n      node = node->next;\n   }\n\n   *pwaste = waste_area;\n   return min_y;\n}\n\ntypedef struct\n{\n   int x,y;\n   stbrp_node **prev_link;\n} stbrp__findresult;\n\nstatic stbrp__findresult stbrp__skyline_find_best_pos(stbrp_context *c, int width, int height)\n{\n   int best_waste = (1<<30), best_x, best_y = (1 << 30);\n   stbrp__findresult fr;\n   stbrp_node **prev, *node, *tail, **best = NULL;\n\n   // align to multiple of c->align\n   width = (width + c->align - 1);\n   width -= width % c->align;\n   STBRP_ASSERT(width % c->align == 0);\n\n   // if it can't possibly fit, bail immediately\n   if (width > c->width || height > c->height) {\n      fr.prev_link = NULL;\n      fr.x = fr.y = 0;\n      return fr;\n   }\n\n   node = c->active_head;\n   prev = &c->active_head;\n   while (node->x + width <= c->width) {\n      int y,waste;\n      y = stbrp__skyline_find_min_y(c, node, node->x, width, &waste);\n      if (c->heuristic == STBRP_HEURISTIC_Skyline_BL_sortHeight) { // actually just want to test BL\n         // bottom left\n         if (y < best_y) {\n            best_y = y;\n            best = prev;\n         }\n      } else {\n         // best-fit\n         if (y + height <= c->height) {\n            // can only use it if it first vertically\n            if (y < best_y || (y == best_y && waste < best_waste)) {\n               best_y = y;\n               best_waste = waste;\n               best = prev;\n            }\n         }\n      }\n      prev = &node->next;\n      node = node->next;\n   }\n\n   best_x = (best == NULL) ? 0 : (*best)->x;\n\n   // if doing best-fit (BF), we also have to try aligning right edge to each node position\n   //\n   // e.g, if fitting\n   //\n   //     ____________________\n   //    |____________________|\n   //\n   //            into\n   //\n   //   |                         |\n   //   |             ____________|\n   //   |____________|\n   //\n   // then right-aligned reduces waste, but bottom-left BL is always chooses left-aligned\n   //\n   // This makes BF take about 2x the time\n\n   if (c->heuristic == STBRP_HEURISTIC_Skyline_BF_sortHeight) {\n      tail = c->active_head;\n      node = c->active_head;\n      prev = &c->active_head;\n      // find first node that's admissible\n      while (tail->x < width)\n         tail = tail->next;\n      while (tail) {\n         int xpos = tail->x - width;\n         int y,waste;\n         STBRP_ASSERT(xpos >= 0);\n         // find the left position that matches this\n         while (node->next->x <= xpos) {\n            prev = &node->next;\n            node = node->next;\n         }\n         STBRP_ASSERT(node->next->x > xpos && node->x <= xpos);\n         y = stbrp__skyline_find_min_y(c, node, xpos, width, &waste);\n         if (y + height <= c->height) {\n            if (y <= best_y) {\n               if (y < best_y || waste < best_waste || (waste==best_waste && xpos < best_x)) {\n                  best_x = xpos;\n                  STBRP_ASSERT(y <= best_y);\n                  best_y = y;\n                  best_waste = waste;\n                  best = prev;\n               }\n            }\n         }\n         tail = tail->next;\n      }\n   }\n\n   fr.prev_link = best;\n   fr.x = best_x;\n   fr.y = best_y;\n   return fr;\n}\n\nstatic stbrp__findresult stbrp__skyline_pack_rectangle(stbrp_context *context, int width, int height)\n{\n   // find best position according to heuristic\n   stbrp__findresult res = stbrp__skyline_find_best_pos(context, width, height);\n   stbrp_node *node, *cur;\n\n   // bail if:\n   //    1. it failed\n   //    2. the best node doesn't fit (we don't always check this)\n   //    3. we're out of memory\n   if (res.prev_link == NULL || res.y + height > context->height || context->free_head == NULL) {\n      res.prev_link = NULL;\n      return res;\n   }\n\n   // on success, create new node\n   node = context->free_head;\n   node->x = (stbrp_coord) res.x;\n   node->y = (stbrp_coord) (res.y + height);\n\n   context->free_head = node->next;\n\n   // insert the new node into the right starting point, and\n   // let 'cur' point to the remaining nodes needing to be\n   // stiched back in\n\n   cur = *res.prev_link;\n   if (cur->x < res.x) {\n      // preserve the existing one, so start testing with the next one\n      stbrp_node *next = cur->next;\n      cur->next = node;\n      cur = next;\n   } else {\n      *res.prev_link = node;\n   }\n\n   // from here, traverse cur and free the nodes, until we get to one\n   // that shouldn't be freed\n   while (cur->next && cur->next->x <= res.x + width) {\n      stbrp_node *next = cur->next;\n      // move the current node to the free list\n      cur->next = context->free_head;\n      context->free_head = cur;\n      cur = next;\n   }\n\n   // stitch the list back in\n   node->next = cur;\n\n   if (cur->x < res.x + width)\n      cur->x = (stbrp_coord) (res.x + width);\n\n#ifdef _DEBUG\n   cur = context->active_head;\n   while (cur->x < context->width) {\n      STBRP_ASSERT(cur->x < cur->next->x);\n      cur = cur->next;\n   }\n   STBRP_ASSERT(cur->next == NULL);\n\n   {\n      int count=0;\n      cur = context->active_head;\n      while (cur) {\n         cur = cur->next;\n         ++count;\n      }\n      cur = context->free_head;\n      while (cur) {\n         cur = cur->next;\n         ++count;\n      }\n      STBRP_ASSERT(count == context->num_nodes+2);\n   }\n#endif\n\n   return res;\n}\n\n// [DEAR IMGUI] Added STBRP__CDECL\nstatic int STBRP__CDECL rect_height_compare(const void *a, const void *b)\n{\n   const stbrp_rect *p = (const stbrp_rect *) a;\n   const stbrp_rect *q = (const stbrp_rect *) b;\n   if (p->h > q->h)\n      return -1;\n   if (p->h < q->h)\n      return  1;\n   return (p->w > q->w) ? -1 : (p->w < q->w);\n}\n\n// [DEAR IMGUI] Added STBRP__CDECL\nstatic int STBRP__CDECL rect_original_order(const void *a, const void *b)\n{\n   const stbrp_rect *p = (const stbrp_rect *) a;\n   const stbrp_rect *q = (const stbrp_rect *) b;\n   return (p->was_packed < q->was_packed) ? -1 : (p->was_packed > q->was_packed);\n}\n\n#ifdef STBRP_LARGE_RECTS\n#define STBRP__MAXVAL  0xffffffff\n#else\n#define STBRP__MAXVAL  0xffff\n#endif\n\nSTBRP_DEF int stbrp_pack_rects(stbrp_context *context, stbrp_rect *rects, int num_rects)\n{\n   int i, all_rects_packed = 1;\n\n   // we use the 'was_packed' field internally to allow sorting/unsorting\n   for (i=0; i < num_rects; ++i) {\n      rects[i].was_packed = i;\n   }\n\n   // sort according to heuristic\n   STBRP_SORT(rects, num_rects, sizeof(rects[0]), rect_height_compare);\n\n   for (i=0; i < num_rects; ++i) {\n      if (rects[i].w == 0 || rects[i].h == 0) {\n         rects[i].x = rects[i].y = 0;  // empty rect needs no space\n      } else {\n         stbrp__findresult fr = stbrp__skyline_pack_rectangle(context, rects[i].w, rects[i].h);\n         if (fr.prev_link) {\n            rects[i].x = (stbrp_coord) fr.x;\n            rects[i].y = (stbrp_coord) fr.y;\n         } else {\n            rects[i].x = rects[i].y = STBRP__MAXVAL;\n         }\n      }\n   }\n\n   // unsort\n   STBRP_SORT(rects, num_rects, sizeof(rects[0]), rect_original_order);\n\n   // set was_packed flags and all_rects_packed status\n   for (i=0; i < num_rects; ++i) {\n      rects[i].was_packed = !(rects[i].x == STBRP__MAXVAL && rects[i].y == STBRP__MAXVAL);\n      if (!rects[i].was_packed)\n         all_rects_packed = 0;\n   }\n\n   // return the all_rects_packed status\n   return all_rects_packed;\n}\n#endif\n\n/*\n------------------------------------------------------------------------------\nThis software is available under 2 licenses -- choose whichever you prefer.\n------------------------------------------------------------------------------\nALTERNATIVE A - MIT License\nCopyright (c) 2017 Sean Barrett\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n------------------------------------------------------------------------------\nALTERNATIVE B - Public Domain (www.unlicense.org)\nThis is free and unencumbered software released into the public domain.\nAnyone is free to copy, modify, publish, use, compile, sell, or distribute this\nsoftware, either in source code form or as a compiled binary, for any purpose,\ncommercial or non-commercial, and by any means.\nIn jurisdictions that recognize copyright laws, the author or authors of this\nsoftware dedicate any and all copyright interest in the software to the public\ndomain. We make this dedication for the benefit of the public at large and to\nthe detriment of our heirs and successors. We intend this dedication to be an\novert act of relinquishment in perpetuity of all present and future rights to\nthis software under copyright law.\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\nACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n------------------------------------------------------------------------------\n*/\n"
  },
  {
    "path": "R3nzSkin/imgui/imstb_textedit.h",
    "content": "// [DEAR IMGUI]\n// This is a slightly modified version of stb_textedit.h 1.13.\n// Those changes would need to be pushed into nothings/stb:\n// - Fix in stb_textedit_discard_redo (see https://github.com/nothings/stb/issues/321)\n// Grep for [DEAR IMGUI] to find the changes.\n\n// stb_textedit.h - v1.13  - public domain - Sean Barrett\n// Development of this library was sponsored by RAD Game Tools\n//\n// This C header file implements the guts of a multi-line text-editing\n// widget; you implement display, word-wrapping, and low-level string\n// insertion/deletion, and stb_textedit will map user inputs into\n// insertions & deletions, plus updates to the cursor position,\n// selection state, and undo state.\n//\n// It is intended for use in games and other systems that need to build\n// their own custom widgets and which do not have heavy text-editing\n// requirements (this library is not recommended for use for editing large\n// texts, as its performance does not scale and it has limited undo).\n//\n// Non-trivial behaviors are modelled after Windows text controls.\n//\n//\n// LICENSE\n//\n// See end of file for license information.\n//\n//\n// DEPENDENCIES\n//\n// Uses the C runtime function 'memmove', which you can override\n// by defining STB_TEXTEDIT_memmove before the implementation.\n// Uses no other functions. Performs no runtime allocations.\n//\n//\n// VERSION HISTORY\n//\n//   1.13 (2019-02-07) fix bug in undo size management\n//   1.12 (2018-01-29) user can change STB_TEXTEDIT_KEYTYPE, fix redo to avoid crash\n//   1.11 (2017-03-03) fix HOME on last line, dragging off single-line textfield\n//   1.10 (2016-10-25) supress warnings about casting away const with -Wcast-qual\n//   1.9  (2016-08-27) customizable move-by-word\n//   1.8  (2016-04-02) better keyboard handling when mouse button is down\n//   1.7  (2015-09-13) change y range handling in case baseline is non-0\n//   1.6  (2015-04-15) allow STB_TEXTEDIT_memmove\n//   1.5  (2014-09-10) add support for secondary keys for OS X\n//   1.4  (2014-08-17) fix signed/unsigned warnings\n//   1.3  (2014-06-19) fix mouse clicking to round to nearest char boundary\n//   1.2  (2014-05-27) fix some RAD types that had crept into the new code\n//   1.1  (2013-12-15) move-by-word (requires STB_TEXTEDIT_IS_SPACE )\n//   1.0  (2012-07-26) improve documentation, initial public release\n//   0.3  (2012-02-24) bugfixes, single-line mode; insert mode\n//   0.2  (2011-11-28) fixes to undo/redo\n//   0.1  (2010-07-08) initial version\n//\n// ADDITIONAL CONTRIBUTORS\n//\n//   Ulf Winklemann: move-by-word in 1.1\n//   Fabian Giesen: secondary key inputs in 1.5\n//   Martins Mozeiko: STB_TEXTEDIT_memmove in 1.6\n//\n//   Bugfixes:\n//      Scott Graham\n//      Daniel Keller\n//      Omar Cornut\n//      Dan Thompson\n//\n// USAGE\n//\n// This file behaves differently depending on what symbols you define\n// before including it.\n//\n//\n// Header-file mode:\n//\n//   If you do not define STB_TEXTEDIT_IMPLEMENTATION before including this,\n//   it will operate in \"header file\" mode. In this mode, it declares a\n//   single public symbol, STB_TexteditState, which encapsulates the current\n//   state of a text widget (except for the string, which you will store\n//   separately).\n//\n//   To compile in this mode, you must define STB_TEXTEDIT_CHARTYPE to a\n//   primitive type that defines a single character (e.g. char, wchar_t, etc).\n//\n//   To save space or increase undo-ability, you can optionally define the\n//   following things that are used by the undo system:\n//\n//      STB_TEXTEDIT_POSITIONTYPE         small int type encoding a valid cursor position\n//      STB_TEXTEDIT_UNDOSTATECOUNT       the number of undo states to allow\n//      STB_TEXTEDIT_UNDOCHARCOUNT        the number of characters to store in the undo buffer\n//\n//   If you don't define these, they are set to permissive types and\n//   moderate sizes. The undo system does no memory allocations, so\n//   it grows STB_TexteditState by the worst-case storage which is (in bytes):\n//\n//        [4 + 3 * sizeof(STB_TEXTEDIT_POSITIONTYPE)] * STB_TEXTEDIT_UNDOSTATE_COUNT\n//      +          sizeof(STB_TEXTEDIT_CHARTYPE)      * STB_TEXTEDIT_UNDOCHAR_COUNT\n//\n//\n// Implementation mode:\n//\n//   If you define STB_TEXTEDIT_IMPLEMENTATION before including this, it\n//   will compile the implementation of the text edit widget, depending\n//   on a large number of symbols which must be defined before the include.\n//\n//   The implementation is defined only as static functions. You will then\n//   need to provide your own APIs in the same file which will access the\n//   static functions.\n//\n//   The basic concept is that you provide a \"string\" object which\n//   behaves like an array of characters. stb_textedit uses indices to\n//   refer to positions in the string, implicitly representing positions\n//   in the displayed textedit. This is true for both plain text and\n//   rich text; even with rich text stb_truetype interacts with your\n//   code as if there was an array of all the displayed characters.\n//\n// Symbols that must be the same in header-file and implementation mode:\n//\n//     STB_TEXTEDIT_CHARTYPE             the character type\n//     STB_TEXTEDIT_POSITIONTYPE         small type that is a valid cursor position\n//     STB_TEXTEDIT_UNDOSTATECOUNT       the number of undo states to allow\n//     STB_TEXTEDIT_UNDOCHARCOUNT        the number of characters to store in the undo buffer\n//\n// Symbols you must define for implementation mode:\n//\n//    STB_TEXTEDIT_STRING               the type of object representing a string being edited,\n//                                      typically this is a wrapper object with other data you need\n//\n//    STB_TEXTEDIT_STRINGLEN(obj)       the length of the string (ideally O(1))\n//    STB_TEXTEDIT_LAYOUTROW(&r,obj,n)  returns the results of laying out a line of characters\n//                                        starting from character #n (see discussion below)\n//    STB_TEXTEDIT_GETWIDTH(obj,n,i)    returns the pixel delta from the xpos of the i'th character\n//                                        to the xpos of the i+1'th char for a line of characters\n//                                        starting at character #n (i.e. accounts for kerning\n//                                        with previous char)\n//    STB_TEXTEDIT_KEYTOTEXT(k)         maps a keyboard input to an insertable character\n//                                        (return type is int, -1 means not valid to insert)\n//    STB_TEXTEDIT_GETCHAR(obj,i)       returns the i'th character of obj, 0-based\n//    STB_TEXTEDIT_NEWLINE              the character returned by _GETCHAR() we recognize\n//                                        as manually wordwrapping for end-of-line positioning\n//\n//    STB_TEXTEDIT_DELETECHARS(obj,i,n)      delete n characters starting at i\n//    STB_TEXTEDIT_INSERTCHARS(obj,i,c*,n)   insert n characters at i (pointed to by STB_TEXTEDIT_CHARTYPE*)\n//\n//    STB_TEXTEDIT_K_SHIFT       a power of two that is or'd in to a keyboard input to represent the shift key\n//\n//    STB_TEXTEDIT_K_LEFT        keyboard input to move cursor left\n//    STB_TEXTEDIT_K_RIGHT       keyboard input to move cursor right\n//    STB_TEXTEDIT_K_UP          keyboard input to move cursor up\n//    STB_TEXTEDIT_K_DOWN        keyboard input to move cursor down\n//    STB_TEXTEDIT_K_PGUP        keyboard input to move cursor up a page\n//    STB_TEXTEDIT_K_PGDOWN      keyboard input to move cursor down a page\n//    STB_TEXTEDIT_K_LINESTART   keyboard input to move cursor to start of line  // e.g. HOME\n//    STB_TEXTEDIT_K_LINEEND     keyboard input to move cursor to end of line    // e.g. END\n//    STB_TEXTEDIT_K_TEXTSTART   keyboard input to move cursor to start of text  // e.g. ctrl-HOME\n//    STB_TEXTEDIT_K_TEXTEND     keyboard input to move cursor to end of text    // e.g. ctrl-END\n//    STB_TEXTEDIT_K_DELETE      keyboard input to delete selection or character under cursor\n//    STB_TEXTEDIT_K_BACKSPACE   keyboard input to delete selection or character left of cursor\n//    STB_TEXTEDIT_K_UNDO        keyboard input to perform undo\n//    STB_TEXTEDIT_K_REDO        keyboard input to perform redo\n//\n// Optional:\n//    STB_TEXTEDIT_K_INSERT              keyboard input to toggle insert mode\n//    STB_TEXTEDIT_IS_SPACE(ch)          true if character is whitespace (e.g. 'isspace'),\n//                                          required for default WORDLEFT/WORDRIGHT handlers\n//    STB_TEXTEDIT_MOVEWORDLEFT(obj,i)   custom handler for WORDLEFT, returns index to move cursor to\n//    STB_TEXTEDIT_MOVEWORDRIGHT(obj,i)  custom handler for WORDRIGHT, returns index to move cursor to\n//    STB_TEXTEDIT_K_WORDLEFT            keyboard input to move cursor left one word // e.g. ctrl-LEFT\n//    STB_TEXTEDIT_K_WORDRIGHT           keyboard input to move cursor right one word // e.g. ctrl-RIGHT\n//    STB_TEXTEDIT_K_LINESTART2          secondary keyboard input to move cursor to start of line\n//    STB_TEXTEDIT_K_LINEEND2            secondary keyboard input to move cursor to end of line\n//    STB_TEXTEDIT_K_TEXTSTART2          secondary keyboard input to move cursor to start of text\n//    STB_TEXTEDIT_K_TEXTEND2            secondary keyboard input to move cursor to end of text\n//\n// Keyboard input must be encoded as a single integer value; e.g. a character code\n// and some bitflags that represent shift states. to simplify the interface, SHIFT must\n// be a bitflag, so we can test the shifted state of cursor movements to allow selection,\n// i.e. (STB_TEXTEDIT_K_RIGHT|STB_TEXTEDIT_K_SHIFT) should be shifted right-arrow.\n//\n// You can encode other things, such as CONTROL or ALT, in additional bits, and\n// then test for their presence in e.g. STB_TEXTEDIT_K_WORDLEFT. For example,\n// my Windows implementations add an additional CONTROL bit, and an additional KEYDOWN\n// bit. Then all of the STB_TEXTEDIT_K_ values bitwise-or in the KEYDOWN bit,\n// and I pass both WM_KEYDOWN and WM_CHAR events to the \"key\" function in the\n// API below. The control keys will only match WM_KEYDOWN events because of the\n// keydown bit I add, and STB_TEXTEDIT_KEYTOTEXT only tests for the KEYDOWN\n// bit so it only decodes WM_CHAR events.\n//\n// STB_TEXTEDIT_LAYOUTROW returns information about the shape of one displayed\n// row of characters assuming they start on the i'th character--the width and\n// the height and the number of characters consumed. This allows this library\n// to traverse the entire layout incrementally. You need to compute word-wrapping\n// here.\n//\n// Each textfield keeps its own insert mode state, which is not how normal\n// applications work. To keep an app-wide insert mode, update/copy the\n// \"insert_mode\" field of STB_TexteditState before/after calling API functions.\n//\n// API\n//\n//    void stb_textedit_initialize_state(STB_TexteditState *state, int is_single_line)\n//\n//    void stb_textedit_click(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, float x, float y)\n//    void stb_textedit_drag(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, float x, float y)\n//    int  stb_textedit_cut(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)\n//    int  stb_textedit_paste(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, STB_TEXTEDIT_CHARTYPE *text, int len)\n//    void stb_textedit_key(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, STB_TEXEDIT_KEYTYPE key)\n//\n//    Each of these functions potentially updates the string and updates the\n//    state.\n//\n//      initialize_state:\n//          set the textedit state to a known good default state when initially\n//          constructing the textedit.\n//\n//      click:\n//          call this with the mouse x,y on a mouse down; it will update the cursor\n//          and reset the selection start/end to the cursor point. the x,y must\n//          be relative to the text widget, with (0,0) being the top left.\n//\n//      drag:\n//          call this with the mouse x,y on a mouse drag/up; it will update the\n//          cursor and the selection end point\n//\n//      cut:\n//          call this to delete the current selection; returns true if there was\n//          one. you should FIRST copy the current selection to the system paste buffer.\n//          (To copy, just copy the current selection out of the string yourself.)\n//\n//      paste:\n//          call this to paste text at the current cursor point or over the current\n//          selection if there is one.\n//\n//      key:\n//          call this for keyboard inputs sent to the textfield. you can use it\n//          for \"key down\" events or for \"translated\" key events. if you need to\n//          do both (as in Win32), or distinguish Unicode characters from control\n//          inputs, set a high bit to distinguish the two; then you can define the\n//          various definitions like STB_TEXTEDIT_K_LEFT have the is-key-event bit\n//          set, and make STB_TEXTEDIT_KEYTOCHAR check that the is-key-event bit is\n//          clear. STB_TEXTEDIT_KEYTYPE defaults to int, but you can #define it to\n//          anything other type you wante before including.\n//\n//\n//   When rendering, you can read the cursor position and selection state from\n//   the STB_TexteditState.\n//\n//\n// Notes:\n//\n// This is designed to be usable in IMGUI, so it allows for the possibility of\n// running in an IMGUI that has NOT cached the multi-line layout. For this\n// reason, it provides an interface that is compatible with computing the\n// layout incrementally--we try to make sure we make as few passes through\n// as possible. (For example, to locate the mouse pointer in the text, we\n// could define functions that return the X and Y positions of characters\n// and binary search Y and then X, but if we're doing dynamic layout this\n// will run the layout algorithm many times, so instead we manually search\n// forward in one pass. Similar logic applies to e.g. up-arrow and\n// down-arrow movement.)\n//\n// If it's run in a widget that *has* cached the layout, then this is less\n// efficient, but it's not horrible on modern computers. But you wouldn't\n// want to edit million-line files with it.\n\n\n////////////////////////////////////////////////////////////////////////////\n////////////////////////////////////////////////////////////////////////////\n////\n////   Header-file mode\n////\n////\n\n#ifndef INCLUDE_STB_TEXTEDIT_H\n#define INCLUDE_STB_TEXTEDIT_H\n\n////////////////////////////////////////////////////////////////////////\n//\n//     STB_TexteditState\n//\n// Definition of STB_TexteditState which you should store\n// per-textfield; it includes cursor position, selection state,\n// and undo state.\n//\n\n#ifndef STB_TEXTEDIT_UNDOSTATECOUNT\n#define STB_TEXTEDIT_UNDOSTATECOUNT   99\n#endif\n#ifndef STB_TEXTEDIT_UNDOCHARCOUNT\n#define STB_TEXTEDIT_UNDOCHARCOUNT   999\n#endif\n#ifndef STB_TEXTEDIT_CHARTYPE\n#define STB_TEXTEDIT_CHARTYPE        int\n#endif\n#ifndef STB_TEXTEDIT_POSITIONTYPE\n#define STB_TEXTEDIT_POSITIONTYPE    int\n#endif\n\ntypedef struct\n{\n   // private data\n   STB_TEXTEDIT_POSITIONTYPE  where;\n   STB_TEXTEDIT_POSITIONTYPE  insert_length;\n   STB_TEXTEDIT_POSITIONTYPE  delete_length;\n   int                        char_storage;\n} StbUndoRecord;\n\ntypedef struct\n{\n   // private data\n   StbUndoRecord          undo_rec [STB_TEXTEDIT_UNDOSTATECOUNT];\n   STB_TEXTEDIT_CHARTYPE  undo_char[STB_TEXTEDIT_UNDOCHARCOUNT];\n   short undo_point, redo_point;\n   int undo_char_point, redo_char_point;\n} StbUndoState;\n\ntypedef struct\n{\n   /////////////////////\n   //\n   // public data\n   //\n\n   int cursor;\n   // position of the text cursor within the string\n\n   int select_start;          // selection start point\n   int select_end;\n   // selection start and end point in characters; if equal, no selection.\n   // note that start may be less than or greater than end (e.g. when\n   // dragging the mouse, start is where the initial click was, and you\n   // can drag in either direction)\n\n   unsigned char insert_mode;\n   // each textfield keeps its own insert mode state. to keep an app-wide\n   // insert mode, copy this value in/out of the app state\n\n   int row_count_per_page;\n   // page size in number of row.\n   // this value MUST be set to >0 for pageup or pagedown in multilines documents.\n\n   /////////////////////\n   //\n   // private data\n   //\n   unsigned char cursor_at_end_of_line; // not implemented yet\n   unsigned char initialized;\n   unsigned char has_preferred_x;\n   unsigned char single_line;\n   unsigned char padding1, padding2, padding3;\n   float preferred_x; // this determines where the cursor up/down tries to seek to along x\n   StbUndoState undostate;\n} STB_TexteditState;\n\n\n////////////////////////////////////////////////////////////////////////\n//\n//     StbTexteditRow\n//\n// Result of layout query, used by stb_textedit to determine where\n// the text in each row is.\n\n// result of layout query\ntypedef struct\n{\n   float x0,x1;             // starting x location, end x location (allows for align=right, etc)\n   float baseline_y_delta;  // position of baseline relative to previous row's baseline\n   float ymin,ymax;         // height of row above and below baseline\n   int num_chars;\n} StbTexteditRow;\n#endif //INCLUDE_STB_TEXTEDIT_H\n\n\n////////////////////////////////////////////////////////////////////////////\n////////////////////////////////////////////////////////////////////////////\n////\n////   Implementation mode\n////\n////\n\n\n// implementation isn't include-guarded, since it might have indirectly\n// included just the \"header\" portion\n#ifdef STB_TEXTEDIT_IMPLEMENTATION\n\n#ifndef STB_TEXTEDIT_memmove\n#include <string.h>\n#define STB_TEXTEDIT_memmove memmove\n#endif\n\n\n/////////////////////////////////////////////////////////////////////////////\n//\n//      Mouse input handling\n//\n\n// traverse the layout to locate the nearest character to a display position\nstatic int stb_text_locate_coord(STB_TEXTEDIT_STRING *str, float x, float y)\n{\n   StbTexteditRow r;\n   int n = STB_TEXTEDIT_STRINGLEN(str);\n   float base_y = 0, prev_x;\n   int i=0, k;\n\n   r.x0 = r.x1 = 0;\n   r.ymin = r.ymax = 0;\n   r.num_chars = 0;\n\n   // search rows to find one that straddles 'y'\n   while (i < n) {\n      STB_TEXTEDIT_LAYOUTROW(&r, str, i);\n      if (r.num_chars <= 0)\n         return n;\n\n      if (i==0 && y < base_y + r.ymin)\n         return 0;\n\n      if (y < base_y + r.ymax)\n         break;\n\n      i += r.num_chars;\n      base_y += r.baseline_y_delta;\n   }\n\n   // below all text, return 'after' last character\n   if (i >= n)\n      return n;\n\n   // check if it's before the beginning of the line\n   if (x < r.x0)\n      return i;\n\n   // check if it's before the end of the line\n   if (x < r.x1) {\n      // search characters in row for one that straddles 'x'\n      prev_x = r.x0;\n      for (k=0; k < r.num_chars; ++k) {\n         float w = STB_TEXTEDIT_GETWIDTH(str, i, k);\n         if (x < prev_x+w) {\n            if (x < prev_x+w/2)\n               return k+i;\n            else\n               return k+i+1;\n         }\n         prev_x += w;\n      }\n      // shouldn't happen, but if it does, fall through to end-of-line case\n   }\n\n   // if the last character is a newline, return that. otherwise return 'after' the last character\n   if (STB_TEXTEDIT_GETCHAR(str, i+r.num_chars-1) == STB_TEXTEDIT_NEWLINE)\n      return i+r.num_chars-1;\n   else\n      return i+r.num_chars;\n}\n\n// API click: on mouse down, move the cursor to the clicked location, and reset the selection\nstatic void stb_textedit_click(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, float x, float y)\n{\n   // In single-line mode, just always make y = 0. This lets the drag keep working if the mouse\n   // goes off the top or bottom of the text\n   if( state->single_line )\n   {\n      StbTexteditRow r;\n      STB_TEXTEDIT_LAYOUTROW(&r, str, 0);\n      y = r.ymin;\n   }\n\n   state->cursor = stb_text_locate_coord(str, x, y);\n   state->select_start = state->cursor;\n   state->select_end = state->cursor;\n   state->has_preferred_x = 0;\n}\n\n// API drag: on mouse drag, move the cursor and selection endpoint to the clicked location\nstatic void stb_textedit_drag(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, float x, float y)\n{\n   int p = 0;\n\n   // In single-line mode, just always make y = 0. This lets the drag keep working if the mouse\n   // goes off the top or bottom of the text\n   if( state->single_line )\n   {\n      StbTexteditRow r;\n      STB_TEXTEDIT_LAYOUTROW(&r, str, 0);\n      y = r.ymin;\n   }\n\n   if (state->select_start == state->select_end)\n      state->select_start = state->cursor;\n\n   p = stb_text_locate_coord(str, x, y);\n   state->cursor = state->select_end = p;\n}\n\n/////////////////////////////////////////////////////////////////////////////\n//\n//      Keyboard input handling\n//\n\n// forward declarations\nstatic void stb_text_undo(STB_TEXTEDIT_STRING *str, STB_TexteditState *state);\nstatic void stb_text_redo(STB_TEXTEDIT_STRING *str, STB_TexteditState *state);\nstatic void stb_text_makeundo_delete(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, int where, int length);\nstatic void stb_text_makeundo_insert(STB_TexteditState *state, int where, int length);\nstatic void stb_text_makeundo_replace(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, int where, int old_length, int new_length);\n\ntypedef struct\n{\n   float x,y;    // position of n'th character\n   float height; // height of line\n   int first_char, length; // first char of row, and length\n   int prev_first;  // first char of previous row\n} StbFindState;\n\n// find the x/y location of a character, and remember info about the previous row in\n// case we get a move-up event (for page up, we'll have to rescan)\nstatic void stb_textedit_find_charpos(StbFindState *find, STB_TEXTEDIT_STRING *str, int n, int single_line)\n{\n   StbTexteditRow r;\n   int prev_start = 0;\n   int z = STB_TEXTEDIT_STRINGLEN(str);\n   int i=0, first;\n\n   if (n == z) {\n      // if it's at the end, then find the last line -- simpler than trying to\n      // explicitly handle this case in the regular code\n      if (single_line) {\n         STB_TEXTEDIT_LAYOUTROW(&r, str, 0);\n         find->y = 0;\n         find->first_char = 0;\n         find->length = z;\n         find->height = r.ymax - r.ymin;\n         find->x = r.x1;\n      } else {\n         find->y = 0;\n         find->x = 0;\n         find->height = 1;\n         while (i < z) {\n            STB_TEXTEDIT_LAYOUTROW(&r, str, i);\n            prev_start = i;\n            i += r.num_chars;\n         }\n         find->first_char = i;\n         find->length = 0;\n         find->prev_first = prev_start;\n      }\n      return;\n   }\n\n   // search rows to find the one that straddles character n\n   find->y = 0;\n\n   for(;;) {\n      STB_TEXTEDIT_LAYOUTROW(&r, str, i);\n      if (n < i + r.num_chars)\n         break;\n      prev_start = i;\n      i += r.num_chars;\n      find->y += r.baseline_y_delta;\n   }\n\n   find->first_char = first = i;\n   find->length = r.num_chars;\n   find->height = r.ymax - r.ymin;\n   find->prev_first = prev_start;\n\n   // now scan to find xpos\n   find->x = r.x0;\n   for (i=0; first+i < n; ++i)\n      find->x += STB_TEXTEDIT_GETWIDTH(str, first, i);\n}\n\n#define STB_TEXT_HAS_SELECTION(s)   ((s)->select_start != (s)->select_end)\n\n// make the selection/cursor state valid if client altered the string\nstatic void stb_textedit_clamp(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)\n{\n   int n = STB_TEXTEDIT_STRINGLEN(str);\n   if (STB_TEXT_HAS_SELECTION(state)) {\n      if (state->select_start > n) state->select_start = n;\n      if (state->select_end   > n) state->select_end = n;\n      // if clamping forced them to be equal, move the cursor to match\n      if (state->select_start == state->select_end)\n         state->cursor = state->select_start;\n   }\n   if (state->cursor > n) state->cursor = n;\n}\n\n// delete characters while updating undo\nstatic void stb_textedit_delete(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, int where, int len)\n{\n   stb_text_makeundo_delete(str, state, where, len);\n   STB_TEXTEDIT_DELETECHARS(str, where, len);\n   state->has_preferred_x = 0;\n}\n\n// delete the section\nstatic void stb_textedit_delete_selection(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)\n{\n   stb_textedit_clamp(str, state);\n   if (STB_TEXT_HAS_SELECTION(state)) {\n      if (state->select_start < state->select_end) {\n         stb_textedit_delete(str, state, state->select_start, state->select_end - state->select_start);\n         state->select_end = state->cursor = state->select_start;\n      } else {\n         stb_textedit_delete(str, state, state->select_end, state->select_start - state->select_end);\n         state->select_start = state->cursor = state->select_end;\n      }\n      state->has_preferred_x = 0;\n   }\n}\n\n// canoncialize the selection so start <= end\nstatic void stb_textedit_sortselection(STB_TexteditState *state)\n{\n   if (state->select_end < state->select_start) {\n      int temp = state->select_end;\n      state->select_end = state->select_start;\n      state->select_start = temp;\n   }\n}\n\n// move cursor to first character of selection\nstatic void stb_textedit_move_to_first(STB_TexteditState *state)\n{\n   if (STB_TEXT_HAS_SELECTION(state)) {\n      stb_textedit_sortselection(state);\n      state->cursor = state->select_start;\n      state->select_end = state->select_start;\n      state->has_preferred_x = 0;\n   }\n}\n\n// move cursor to last character of selection\nstatic void stb_textedit_move_to_last(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)\n{\n   if (STB_TEXT_HAS_SELECTION(state)) {\n      stb_textedit_sortselection(state);\n      stb_textedit_clamp(str, state);\n      state->cursor = state->select_end;\n      state->select_start = state->select_end;\n      state->has_preferred_x = 0;\n   }\n}\n\n#ifdef STB_TEXTEDIT_IS_SPACE\nstatic int is_word_boundary( STB_TEXTEDIT_STRING *str, int idx )\n{\n   return idx > 0 ? (STB_TEXTEDIT_IS_SPACE( STB_TEXTEDIT_GETCHAR(str,idx-1) ) && !STB_TEXTEDIT_IS_SPACE( STB_TEXTEDIT_GETCHAR(str, idx) ) ) : 1;\n}\n\n#ifndef STB_TEXTEDIT_MOVEWORDLEFT\nstatic int stb_textedit_move_to_word_previous( STB_TEXTEDIT_STRING *str, int c )\n{\n   --c; // always move at least one character\n   while( c >= 0 && !is_word_boundary( str, c ) )\n      --c;\n\n   if( c < 0 )\n      c = 0;\n\n   return c;\n}\n#define STB_TEXTEDIT_MOVEWORDLEFT stb_textedit_move_to_word_previous\n#endif\n\n#ifndef STB_TEXTEDIT_MOVEWORDRIGHT\nstatic int stb_textedit_move_to_word_next( STB_TEXTEDIT_STRING *str, int c )\n{\n   const int len = STB_TEXTEDIT_STRINGLEN(str);\n   ++c; // always move at least one character\n   while( c < len && !is_word_boundary( str, c ) )\n      ++c;\n\n   if( c > len )\n      c = len;\n\n   return c;\n}\n#define STB_TEXTEDIT_MOVEWORDRIGHT stb_textedit_move_to_word_next\n#endif\n\n#endif\n\n// update selection and cursor to match each other\nstatic void stb_textedit_prep_selection_at_cursor(STB_TexteditState *state)\n{\n   if (!STB_TEXT_HAS_SELECTION(state))\n      state->select_start = state->select_end = state->cursor;\n   else\n      state->cursor = state->select_end;\n}\n\n// API cut: delete selection\nstatic int stb_textedit_cut(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)\n{\n   if (STB_TEXT_HAS_SELECTION(state)) {\n      stb_textedit_delete_selection(str,state); // implicitly clamps\n      state->has_preferred_x = 0;\n      return 1;\n   }\n   return 0;\n}\n\n// API paste: replace existing selection with passed-in text\nstatic int stb_textedit_paste_internal(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, STB_TEXTEDIT_CHARTYPE *text, int len)\n{\n   // if there's a selection, the paste should delete it\n   stb_textedit_clamp(str, state);\n   stb_textedit_delete_selection(str,state);\n   // try to insert the characters\n   if (STB_TEXTEDIT_INSERTCHARS(str, state->cursor, text, len)) {\n      stb_text_makeundo_insert(state, state->cursor, len);\n      state->cursor += len;\n      state->has_preferred_x = 0;\n      return 1;\n   }\n   // [DEAR IMGUI]\n   //// remove the undo since we didn't actually insert the characters\n   //if (state->undostate.undo_point)\n   //   --state->undostate.undo_point;\n   // note: paste failure will leave deleted selection, may be restored with an undo (see https://github.com/nothings/stb/issues/734 for details)\n   return 0;\n}\n\n#ifndef STB_TEXTEDIT_KEYTYPE\n#define STB_TEXTEDIT_KEYTYPE int\n#endif\n\n// API key: process a keyboard input\nstatic void stb_textedit_key(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, STB_TEXTEDIT_KEYTYPE key)\n{\nretry:\n   switch (key) {\n      default: {\n         int c = STB_TEXTEDIT_KEYTOTEXT(key);\n         if (c > 0) {\n            STB_TEXTEDIT_CHARTYPE ch = (STB_TEXTEDIT_CHARTYPE) c;\n\n            // can't add newline in single-line mode\n            if (c == '\\n' && state->single_line)\n               break;\n\n            if (state->insert_mode && !STB_TEXT_HAS_SELECTION(state) && state->cursor < STB_TEXTEDIT_STRINGLEN(str)) {\n               stb_text_makeundo_replace(str, state, state->cursor, 1, 1);\n               STB_TEXTEDIT_DELETECHARS(str, state->cursor, 1);\n               if (STB_TEXTEDIT_INSERTCHARS(str, state->cursor, &ch, 1)) {\n                  ++state->cursor;\n                  state->has_preferred_x = 0;\n               }\n            } else {\n               stb_textedit_delete_selection(str,state); // implicitly clamps\n               if (STB_TEXTEDIT_INSERTCHARS(str, state->cursor, &ch, 1)) {\n                  stb_text_makeundo_insert(state, state->cursor, 1);\n                  ++state->cursor;\n                  state->has_preferred_x = 0;\n               }\n            }\n         }\n         break;\n      }\n\n#ifdef STB_TEXTEDIT_K_INSERT\n      case STB_TEXTEDIT_K_INSERT:\n         state->insert_mode = !state->insert_mode;\n         break;\n#endif\n\n      case STB_TEXTEDIT_K_UNDO:\n         stb_text_undo(str, state);\n         state->has_preferred_x = 0;\n         break;\n\n      case STB_TEXTEDIT_K_REDO:\n         stb_text_redo(str, state);\n         state->has_preferred_x = 0;\n         break;\n\n      case STB_TEXTEDIT_K_LEFT:\n         // if currently there's a selection, move cursor to start of selection\n         if (STB_TEXT_HAS_SELECTION(state))\n            stb_textedit_move_to_first(state);\n         else\n            if (state->cursor > 0)\n               --state->cursor;\n         state->has_preferred_x = 0;\n         break;\n\n      case STB_TEXTEDIT_K_RIGHT:\n         // if currently there's a selection, move cursor to end of selection\n         if (STB_TEXT_HAS_SELECTION(state))\n            stb_textedit_move_to_last(str, state);\n         else\n            ++state->cursor;\n         stb_textedit_clamp(str, state);\n         state->has_preferred_x = 0;\n         break;\n\n      case STB_TEXTEDIT_K_LEFT | STB_TEXTEDIT_K_SHIFT:\n         stb_textedit_clamp(str, state);\n         stb_textedit_prep_selection_at_cursor(state);\n         // move selection left\n         if (state->select_end > 0)\n            --state->select_end;\n         state->cursor = state->select_end;\n         state->has_preferred_x = 0;\n         break;\n\n#ifdef STB_TEXTEDIT_MOVEWORDLEFT\n      case STB_TEXTEDIT_K_WORDLEFT:\n         if (STB_TEXT_HAS_SELECTION(state))\n            stb_textedit_move_to_first(state);\n         else {\n            state->cursor = STB_TEXTEDIT_MOVEWORDLEFT(str, state->cursor);\n            stb_textedit_clamp( str, state );\n         }\n         break;\n\n      case STB_TEXTEDIT_K_WORDLEFT | STB_TEXTEDIT_K_SHIFT:\n         if( !STB_TEXT_HAS_SELECTION( state ) )\n            stb_textedit_prep_selection_at_cursor(state);\n\n         state->cursor = STB_TEXTEDIT_MOVEWORDLEFT(str, state->cursor);\n         state->select_end = state->cursor;\n\n         stb_textedit_clamp( str, state );\n         break;\n#endif\n\n#ifdef STB_TEXTEDIT_MOVEWORDRIGHT\n      case STB_TEXTEDIT_K_WORDRIGHT:\n         if (STB_TEXT_HAS_SELECTION(state))\n            stb_textedit_move_to_last(str, state);\n         else {\n            state->cursor = STB_TEXTEDIT_MOVEWORDRIGHT(str, state->cursor);\n            stb_textedit_clamp( str, state );\n         }\n         break;\n\n      case STB_TEXTEDIT_K_WORDRIGHT | STB_TEXTEDIT_K_SHIFT:\n         if( !STB_TEXT_HAS_SELECTION( state ) )\n            stb_textedit_prep_selection_at_cursor(state);\n\n         state->cursor = STB_TEXTEDIT_MOVEWORDRIGHT(str, state->cursor);\n         state->select_end = state->cursor;\n\n         stb_textedit_clamp( str, state );\n         break;\n#endif\n\n      case STB_TEXTEDIT_K_RIGHT | STB_TEXTEDIT_K_SHIFT:\n         stb_textedit_prep_selection_at_cursor(state);\n         // move selection right\n         ++state->select_end;\n         stb_textedit_clamp(str, state);\n         state->cursor = state->select_end;\n         state->has_preferred_x = 0;\n         break;\n\n      case STB_TEXTEDIT_K_DOWN:\n      case STB_TEXTEDIT_K_DOWN | STB_TEXTEDIT_K_SHIFT:\n      case STB_TEXTEDIT_K_PGDOWN:\n      case STB_TEXTEDIT_K_PGDOWN | STB_TEXTEDIT_K_SHIFT: {\n         StbFindState find;\n         StbTexteditRow row;\n         int i, j, sel = (key & STB_TEXTEDIT_K_SHIFT) != 0;\n         int is_page = (key & ~STB_TEXTEDIT_K_SHIFT) == STB_TEXTEDIT_K_PGDOWN;\n         int row_count = is_page ? state->row_count_per_page : 1;\n\n         if (!is_page && state->single_line) {\n            // on windows, up&down in single-line behave like left&right\n            key = STB_TEXTEDIT_K_RIGHT | (key & STB_TEXTEDIT_K_SHIFT);\n            goto retry;\n         }\n\n         if (sel)\n            stb_textedit_prep_selection_at_cursor(state);\n         else if (STB_TEXT_HAS_SELECTION(state))\n            stb_textedit_move_to_last(str, state);\n\n         // compute current position of cursor point\n         stb_textedit_clamp(str, state);\n         stb_textedit_find_charpos(&find, str, state->cursor, state->single_line);\n\n         for (j = 0; j < row_count; ++j) {\n            float x, goal_x = state->has_preferred_x ? state->preferred_x : find.x;\n            int start = find.first_char + find.length;\n\n            if (find.length == 0)\n               break;\n\n            // [DEAR IMGUI]\n            // going down while being on the last line shouldn't bring us to that line end\n            if (STB_TEXTEDIT_GETCHAR(str, find.first_char + find.length - 1) != STB_TEXTEDIT_NEWLINE)\n               break;\n\n            // now find character position down a row\n            state->cursor = start;\n            STB_TEXTEDIT_LAYOUTROW(&row, str, state->cursor);\n            x = row.x0;\n            for (i=0; i < row.num_chars; ++i) {\n               float dx = STB_TEXTEDIT_GETWIDTH(str, start, i);\n               #ifdef STB_TEXTEDIT_GETWIDTH_NEWLINE\n               if (dx == STB_TEXTEDIT_GETWIDTH_NEWLINE)\n                  break;\n               #endif\n               x += dx;\n               if (x > goal_x)\n                  break;\n               ++state->cursor;\n            }\n            stb_textedit_clamp(str, state);\n\n            state->has_preferred_x = 1;\n            state->preferred_x = goal_x;\n\n            if (sel)\n               state->select_end = state->cursor;\n\n            // go to next line\n            find.first_char = find.first_char + find.length;\n            find.length = row.num_chars;\n         }\n         break;\n      }\n\n      case STB_TEXTEDIT_K_UP:\n      case STB_TEXTEDIT_K_UP | STB_TEXTEDIT_K_SHIFT:\n      case STB_TEXTEDIT_K_PGUP:\n      case STB_TEXTEDIT_K_PGUP | STB_TEXTEDIT_K_SHIFT: {\n         StbFindState find;\n         StbTexteditRow row;\n         int i, j, prev_scan, sel = (key & STB_TEXTEDIT_K_SHIFT) != 0;\n         int is_page = (key & ~STB_TEXTEDIT_K_SHIFT) == STB_TEXTEDIT_K_PGUP;\n         int row_count = is_page ? state->row_count_per_page : 1;\n\n         if (!is_page && state->single_line) {\n            // on windows, up&down become left&right\n            key = STB_TEXTEDIT_K_LEFT | (key & STB_TEXTEDIT_K_SHIFT);\n            goto retry;\n         }\n\n         if (sel)\n            stb_textedit_prep_selection_at_cursor(state);\n         else if (STB_TEXT_HAS_SELECTION(state))\n            stb_textedit_move_to_first(state);\n\n         // compute current position of cursor point\n         stb_textedit_clamp(str, state);\n         stb_textedit_find_charpos(&find, str, state->cursor, state->single_line);\n\n         for (j = 0; j < row_count; ++j) {\n            float  x, goal_x = state->has_preferred_x ? state->preferred_x : find.x;\n\n            // can only go up if there's a previous row\n            if (find.prev_first == find.first_char)\n               break;\n\n            // now find character position up a row\n            state->cursor = find.prev_first;\n            STB_TEXTEDIT_LAYOUTROW(&row, str, state->cursor);\n            x = row.x0;\n            for (i=0; i < row.num_chars; ++i) {\n               float dx = STB_TEXTEDIT_GETWIDTH(str, find.prev_first, i);\n               #ifdef STB_TEXTEDIT_GETWIDTH_NEWLINE\n               if (dx == STB_TEXTEDIT_GETWIDTH_NEWLINE)\n                  break;\n               #endif\n               x += dx;\n               if (x > goal_x)\n                  break;\n               ++state->cursor;\n            }\n            stb_textedit_clamp(str, state);\n\n            state->has_preferred_x = 1;\n            state->preferred_x = goal_x;\n\n            if (sel)\n               state->select_end = state->cursor;\n\n            // go to previous line\n            // (we need to scan previous line the hard way. maybe we could expose this as a new API function?)\n            prev_scan = find.prev_first > 0 ? find.prev_first - 1 : 0;\n            while (prev_scan > 0 && STB_TEXTEDIT_GETCHAR(str, prev_scan - 1) != STB_TEXTEDIT_NEWLINE)\n               --prev_scan;\n            find.first_char = find.prev_first;\n            find.prev_first = prev_scan;\n         }\n         break;\n      }\n\n      case STB_TEXTEDIT_K_DELETE:\n      case STB_TEXTEDIT_K_DELETE | STB_TEXTEDIT_K_SHIFT:\n         if (STB_TEXT_HAS_SELECTION(state))\n            stb_textedit_delete_selection(str, state);\n         else {\n            int n = STB_TEXTEDIT_STRINGLEN(str);\n            if (state->cursor < n)\n               stb_textedit_delete(str, state, state->cursor, 1);\n         }\n         state->has_preferred_x = 0;\n         break;\n\n      case STB_TEXTEDIT_K_BACKSPACE:\n      case STB_TEXTEDIT_K_BACKSPACE | STB_TEXTEDIT_K_SHIFT:\n         if (STB_TEXT_HAS_SELECTION(state))\n            stb_textedit_delete_selection(str, state);\n         else {\n            stb_textedit_clamp(str, state);\n            if (state->cursor > 0) {\n               stb_textedit_delete(str, state, state->cursor-1, 1);\n               --state->cursor;\n            }\n         }\n         state->has_preferred_x = 0;\n         break;\n\n#ifdef STB_TEXTEDIT_K_TEXTSTART2\n      case STB_TEXTEDIT_K_TEXTSTART2:\n#endif\n      case STB_TEXTEDIT_K_TEXTSTART:\n         state->cursor = state->select_start = state->select_end = 0;\n         state->has_preferred_x = 0;\n         break;\n\n#ifdef STB_TEXTEDIT_K_TEXTEND2\n      case STB_TEXTEDIT_K_TEXTEND2:\n#endif\n      case STB_TEXTEDIT_K_TEXTEND:\n         state->cursor = STB_TEXTEDIT_STRINGLEN(str);\n         state->select_start = state->select_end = 0;\n         state->has_preferred_x = 0;\n         break;\n\n#ifdef STB_TEXTEDIT_K_TEXTSTART2\n      case STB_TEXTEDIT_K_TEXTSTART2 | STB_TEXTEDIT_K_SHIFT:\n#endif\n      case STB_TEXTEDIT_K_TEXTSTART | STB_TEXTEDIT_K_SHIFT:\n         stb_textedit_prep_selection_at_cursor(state);\n         state->cursor = state->select_end = 0;\n         state->has_preferred_x = 0;\n         break;\n\n#ifdef STB_TEXTEDIT_K_TEXTEND2\n      case STB_TEXTEDIT_K_TEXTEND2 | STB_TEXTEDIT_K_SHIFT:\n#endif\n      case STB_TEXTEDIT_K_TEXTEND | STB_TEXTEDIT_K_SHIFT:\n         stb_textedit_prep_selection_at_cursor(state);\n         state->cursor = state->select_end = STB_TEXTEDIT_STRINGLEN(str);\n         state->has_preferred_x = 0;\n         break;\n\n\n#ifdef STB_TEXTEDIT_K_LINESTART2\n      case STB_TEXTEDIT_K_LINESTART2:\n#endif\n      case STB_TEXTEDIT_K_LINESTART:\n         stb_textedit_clamp(str, state);\n         stb_textedit_move_to_first(state);\n         if (state->single_line)\n            state->cursor = 0;\n         else while (state->cursor > 0 && STB_TEXTEDIT_GETCHAR(str, state->cursor-1) != STB_TEXTEDIT_NEWLINE)\n            --state->cursor;\n         state->has_preferred_x = 0;\n         break;\n\n#ifdef STB_TEXTEDIT_K_LINEEND2\n      case STB_TEXTEDIT_K_LINEEND2:\n#endif\n      case STB_TEXTEDIT_K_LINEEND: {\n         int n = STB_TEXTEDIT_STRINGLEN(str);\n         stb_textedit_clamp(str, state);\n         stb_textedit_move_to_first(state);\n         if (state->single_line)\n             state->cursor = n;\n         else while (state->cursor < n && STB_TEXTEDIT_GETCHAR(str, state->cursor) != STB_TEXTEDIT_NEWLINE)\n             ++state->cursor;\n         state->has_preferred_x = 0;\n         break;\n      }\n\n#ifdef STB_TEXTEDIT_K_LINESTART2\n      case STB_TEXTEDIT_K_LINESTART2 | STB_TEXTEDIT_K_SHIFT:\n#endif\n      case STB_TEXTEDIT_K_LINESTART | STB_TEXTEDIT_K_SHIFT:\n         stb_textedit_clamp(str, state);\n         stb_textedit_prep_selection_at_cursor(state);\n         if (state->single_line)\n            state->cursor = 0;\n         else while (state->cursor > 0 && STB_TEXTEDIT_GETCHAR(str, state->cursor-1) != STB_TEXTEDIT_NEWLINE)\n            --state->cursor;\n         state->select_end = state->cursor;\n         state->has_preferred_x = 0;\n         break;\n\n#ifdef STB_TEXTEDIT_K_LINEEND2\n      case STB_TEXTEDIT_K_LINEEND2 | STB_TEXTEDIT_K_SHIFT:\n#endif\n      case STB_TEXTEDIT_K_LINEEND | STB_TEXTEDIT_K_SHIFT: {\n         int n = STB_TEXTEDIT_STRINGLEN(str);\n         stb_textedit_clamp(str, state);\n         stb_textedit_prep_selection_at_cursor(state);\n         if (state->single_line)\n             state->cursor = n;\n         else while (state->cursor < n && STB_TEXTEDIT_GETCHAR(str, state->cursor) != STB_TEXTEDIT_NEWLINE)\n            ++state->cursor;\n         state->select_end = state->cursor;\n         state->has_preferred_x = 0;\n         break;\n      }\n   }\n}\n\n/////////////////////////////////////////////////////////////////////////////\n//\n//      Undo processing\n//\n// @OPTIMIZE: the undo/redo buffer should be circular\n\nstatic void stb_textedit_flush_redo(StbUndoState *state)\n{\n   state->redo_point = STB_TEXTEDIT_UNDOSTATECOUNT;\n   state->redo_char_point = STB_TEXTEDIT_UNDOCHARCOUNT;\n}\n\n// discard the oldest entry in the undo list\nstatic void stb_textedit_discard_undo(StbUndoState *state)\n{\n   if (state->undo_point > 0) {\n      // if the 0th undo state has characters, clean those up\n      if (state->undo_rec[0].char_storage >= 0) {\n         int n = state->undo_rec[0].insert_length, i;\n         // delete n characters from all other records\n         state->undo_char_point -= n;\n         STB_TEXTEDIT_memmove(state->undo_char, state->undo_char + n, (size_t) (state->undo_char_point*sizeof(STB_TEXTEDIT_CHARTYPE)));\n         for (i=0; i < state->undo_point; ++i)\n            if (state->undo_rec[i].char_storage >= 0)\n               state->undo_rec[i].char_storage -= n; // @OPTIMIZE: get rid of char_storage and infer it\n      }\n      --state->undo_point;\n      STB_TEXTEDIT_memmove(state->undo_rec, state->undo_rec+1, (size_t) (state->undo_point*sizeof(state->undo_rec[0])));\n   }\n}\n\n// discard the oldest entry in the redo list--it's bad if this\n// ever happens, but because undo & redo have to store the actual\n// characters in different cases, the redo character buffer can\n// fill up even though the undo buffer didn't\nstatic void stb_textedit_discard_redo(StbUndoState *state)\n{\n   int k = STB_TEXTEDIT_UNDOSTATECOUNT-1;\n\n   if (state->redo_point <= k) {\n      // if the k'th undo state has characters, clean those up\n      if (state->undo_rec[k].char_storage >= 0) {\n         int n = state->undo_rec[k].insert_length, i;\n         // move the remaining redo character data to the end of the buffer\n         state->redo_char_point += n;\n         STB_TEXTEDIT_memmove(state->undo_char + state->redo_char_point, state->undo_char + state->redo_char_point-n, (size_t) ((STB_TEXTEDIT_UNDOCHARCOUNT - state->redo_char_point)*sizeof(STB_TEXTEDIT_CHARTYPE)));\n         // adjust the position of all the other records to account for above memmove\n         for (i=state->redo_point; i < k; ++i)\n            if (state->undo_rec[i].char_storage >= 0)\n               state->undo_rec[i].char_storage += n;\n      }\n      // now move all the redo records towards the end of the buffer; the first one is at 'redo_point'\n      // [DEAR IMGUI]\n      size_t move_size = (size_t)((STB_TEXTEDIT_UNDOSTATECOUNT - state->redo_point - 1) * sizeof(state->undo_rec[0]));\n      const char* buf_begin = (char*)state->undo_rec; (void)buf_begin;\n      const char* buf_end   = (char*)state->undo_rec + sizeof(state->undo_rec); (void)buf_end;\n      IM_ASSERT(((char*)(state->undo_rec + state->redo_point)) >= buf_begin);\n      IM_ASSERT(((char*)(state->undo_rec + state->redo_point + 1) + move_size) <= buf_end);\n      STB_TEXTEDIT_memmove(state->undo_rec + state->redo_point+1, state->undo_rec + state->redo_point, move_size);\n\n      // now move redo_point to point to the new one\n      ++state->redo_point;\n   }\n}\n\nstatic StbUndoRecord *stb_text_create_undo_record(StbUndoState *state, int numchars)\n{\n   // any time we create a new undo record, we discard redo\n   stb_textedit_flush_redo(state);\n\n   // if we have no free records, we have to make room, by sliding the\n   // existing records down\n   if (state->undo_point == STB_TEXTEDIT_UNDOSTATECOUNT)\n      stb_textedit_discard_undo(state);\n\n   // if the characters to store won't possibly fit in the buffer, we can't undo\n   if (numchars > STB_TEXTEDIT_UNDOCHARCOUNT) {\n      state->undo_point = 0;\n      state->undo_char_point = 0;\n      return NULL;\n   }\n\n   // if we don't have enough free characters in the buffer, we have to make room\n   while (state->undo_char_point + numchars > STB_TEXTEDIT_UNDOCHARCOUNT)\n      stb_textedit_discard_undo(state);\n\n   return &state->undo_rec[state->undo_point++];\n}\n\nstatic STB_TEXTEDIT_CHARTYPE *stb_text_createundo(StbUndoState *state, int pos, int insert_len, int delete_len)\n{\n   StbUndoRecord *r = stb_text_create_undo_record(state, insert_len);\n   if (r == NULL)\n      return NULL;\n\n   r->where = pos;\n   r->insert_length = (STB_TEXTEDIT_POSITIONTYPE) insert_len;\n   r->delete_length = (STB_TEXTEDIT_POSITIONTYPE) delete_len;\n\n   if (insert_len == 0) {\n      r->char_storage = -1;\n      return NULL;\n   } else {\n      r->char_storage = state->undo_char_point;\n      state->undo_char_point += insert_len;\n      return &state->undo_char[r->char_storage];\n   }\n}\n\nstatic void stb_text_undo(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)\n{\n   StbUndoState *s = &state->undostate;\n   StbUndoRecord u, *r;\n   if (s->undo_point == 0)\n      return;\n\n   // we need to do two things: apply the undo record, and create a redo record\n   u = s->undo_rec[s->undo_point-1];\n   r = &s->undo_rec[s->redo_point-1];\n   r->char_storage = -1;\n\n   r->insert_length = u.delete_length;\n   r->delete_length = u.insert_length;\n   r->where = u.where;\n\n   if (u.delete_length) {\n      // if the undo record says to delete characters, then the redo record will\n      // need to re-insert the characters that get deleted, so we need to store\n      // them.\n\n      // there are three cases:\n      //    there's enough room to store the characters\n      //    characters stored for *redoing* don't leave room for redo\n      //    characters stored for *undoing* don't leave room for redo\n      // if the last is true, we have to bail\n\n      if (s->undo_char_point + u.delete_length >= STB_TEXTEDIT_UNDOCHARCOUNT) {\n         // the undo records take up too much character space; there's no space to store the redo characters\n         r->insert_length = 0;\n      } else {\n         int i;\n\n         // there's definitely room to store the characters eventually\n         while (s->undo_char_point + u.delete_length > s->redo_char_point) {\n            // should never happen:\n            if (s->redo_point == STB_TEXTEDIT_UNDOSTATECOUNT)\n               return;\n            // there's currently not enough room, so discard a redo record\n            stb_textedit_discard_redo(s);\n         }\n         r = &s->undo_rec[s->redo_point-1];\n\n         r->char_storage = s->redo_char_point - u.delete_length;\n         s->redo_char_point = s->redo_char_point - u.delete_length;\n\n         // now save the characters\n         for (i=0; i < u.delete_length; ++i)\n            s->undo_char[r->char_storage + i] = STB_TEXTEDIT_GETCHAR(str, u.where + i);\n      }\n\n      // now we can carry out the deletion\n      STB_TEXTEDIT_DELETECHARS(str, u.where, u.delete_length);\n   }\n\n   // check type of recorded action:\n   if (u.insert_length) {\n      // easy case: was a deletion, so we need to insert n characters\n      STB_TEXTEDIT_INSERTCHARS(str, u.where, &s->undo_char[u.char_storage], u.insert_length);\n      s->undo_char_point -= u.insert_length;\n   }\n\n   state->cursor = u.where + u.insert_length;\n\n   s->undo_point--;\n   s->redo_point--;\n}\n\nstatic void stb_text_redo(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)\n{\n   StbUndoState *s = &state->undostate;\n   StbUndoRecord *u, r;\n   if (s->redo_point == STB_TEXTEDIT_UNDOSTATECOUNT)\n      return;\n\n   // we need to do two things: apply the redo record, and create an undo record\n   u = &s->undo_rec[s->undo_point];\n   r = s->undo_rec[s->redo_point];\n\n   // we KNOW there must be room for the undo record, because the redo record\n   // was derived from an undo record\n\n   u->delete_length = r.insert_length;\n   u->insert_length = r.delete_length;\n   u->where = r.where;\n   u->char_storage = -1;\n\n   if (r.delete_length) {\n      // the redo record requires us to delete characters, so the undo record\n      // needs to store the characters\n\n      if (s->undo_char_point + u->insert_length > s->redo_char_point) {\n         u->insert_length = 0;\n         u->delete_length = 0;\n      } else {\n         int i;\n         u->char_storage = s->undo_char_point;\n         s->undo_char_point = s->undo_char_point + u->insert_length;\n\n         // now save the characters\n         for (i=0; i < u->insert_length; ++i)\n            s->undo_char[u->char_storage + i] = STB_TEXTEDIT_GETCHAR(str, u->where + i);\n      }\n\n      STB_TEXTEDIT_DELETECHARS(str, r.where, r.delete_length);\n   }\n\n   if (r.insert_length) {\n      // easy case: need to insert n characters\n      STB_TEXTEDIT_INSERTCHARS(str, r.where, &s->undo_char[r.char_storage], r.insert_length);\n      s->redo_char_point += r.insert_length;\n   }\n\n   state->cursor = r.where + r.insert_length;\n\n   s->undo_point++;\n   s->redo_point++;\n}\n\nstatic void stb_text_makeundo_insert(STB_TexteditState *state, int where, int length)\n{\n   stb_text_createundo(&state->undostate, where, 0, length);\n}\n\nstatic void stb_text_makeundo_delete(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, int where, int length)\n{\n   int i;\n   STB_TEXTEDIT_CHARTYPE *p = stb_text_createundo(&state->undostate, where, length, 0);\n   if (p) {\n      for (i=0; i < length; ++i)\n         p[i] = STB_TEXTEDIT_GETCHAR(str, where+i);\n   }\n}\n\nstatic void stb_text_makeundo_replace(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, int where, int old_length, int new_length)\n{\n   int i;\n   STB_TEXTEDIT_CHARTYPE *p = stb_text_createundo(&state->undostate, where, old_length, new_length);\n   if (p) {\n      for (i=0; i < old_length; ++i)\n         p[i] = STB_TEXTEDIT_GETCHAR(str, where+i);\n   }\n}\n\n// reset the state to default\nstatic void stb_textedit_clear_state(STB_TexteditState *state, int is_single_line)\n{\n   state->undostate.undo_point = 0;\n   state->undostate.undo_char_point = 0;\n   state->undostate.redo_point = STB_TEXTEDIT_UNDOSTATECOUNT;\n   state->undostate.redo_char_point = STB_TEXTEDIT_UNDOCHARCOUNT;\n   state->select_end = state->select_start = 0;\n   state->cursor = 0;\n   state->has_preferred_x = 0;\n   state->preferred_x = 0;\n   state->cursor_at_end_of_line = 0;\n   state->initialized = 1;\n   state->single_line = (unsigned char) is_single_line;\n   state->insert_mode = 0;\n   state->row_count_per_page = 0;\n}\n\n// API initialize\nstatic void stb_textedit_initialize_state(STB_TexteditState *state, int is_single_line)\n{\n   stb_textedit_clear_state(state, is_single_line);\n}\n\n#if defined(__GNUC__) || defined(__clang__)\n#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored \"-Wcast-qual\"\n#endif\n\nstatic int stb_textedit_paste(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, STB_TEXTEDIT_CHARTYPE const *ctext, int len)\n{\n   return stb_textedit_paste_internal(str, state, (STB_TEXTEDIT_CHARTYPE *) ctext, len);\n}\n\n#if defined(__GNUC__) || defined(__clang__)\n#pragma GCC diagnostic pop\n#endif\n\n#endif//STB_TEXTEDIT_IMPLEMENTATION\n\n/*\n------------------------------------------------------------------------------\nThis software is available under 2 licenses -- choose whichever you prefer.\n------------------------------------------------------------------------------\nALTERNATIVE A - MIT License\nCopyright (c) 2017 Sean Barrett\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n------------------------------------------------------------------------------\nALTERNATIVE B - Public Domain (www.unlicense.org)\nThis is free and unencumbered software released into the public domain.\nAnyone is free to copy, modify, publish, use, compile, sell, or distribute this\nsoftware, either in source code form or as a compiled binary, for any purpose,\ncommercial or non-commercial, and by any means.\nIn jurisdictions that recognize copyright laws, the author or authors of this\nsoftware dedicate any and all copyright interest in the software to the public\ndomain. We make this dedication for the benefit of the public at large and to\nthe detriment of our heirs and successors. We intend this dedication to be an\novert act of relinquishment in perpetuity of all present and future rights to\nthis software under copyright law.\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\nACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n------------------------------------------------------------------------------\n*/\n"
  },
  {
    "path": "R3nzSkin/imgui/imstb_truetype.h",
    "content": "// [DEAR IMGUI]\n// This is a slightly modified version of stb_truetype.h 1.20.\n// Mostly fixing for compiler and static analyzer warnings.\n// Grep for [DEAR IMGUI] to find the changes.\n\n// stb_truetype.h - v1.20 - public domain\n// authored from 2009-2016 by Sean Barrett / RAD Game Tools\n//\n//   This library processes TrueType files:\n//        parse files\n//        extract glyph metrics\n//        extract glyph shapes\n//        render glyphs to one-channel bitmaps with antialiasing (box filter)\n//        render glyphs to one-channel SDF bitmaps (signed-distance field/function)\n//\n//   Todo:\n//        non-MS cmaps\n//        crashproof on bad data\n//        hinting? (no longer patented)\n//        cleartype-style AA?\n//        optimize: use simple memory allocator for intermediates\n//        optimize: build edge-list directly from curves\n//        optimize: rasterize directly from curves?\n//\n// ADDITIONAL CONTRIBUTORS\n//\n//   Mikko Mononen: compound shape support, more cmap formats\n//   Tor Andersson: kerning, subpixel rendering\n//   Dougall Johnson: OpenType / Type 2 font handling\n//   Daniel Ribeiro Maciel: basic GPOS-based kerning\n//\n//   Misc other:\n//       Ryan Gordon\n//       Simon Glass\n//       github:IntellectualKitty\n//       Imanol Celaya\n//       Daniel Ribeiro Maciel\n//\n//   Bug/warning reports/fixes:\n//       \"Zer\" on mollyrocket       Fabian \"ryg\" Giesen\n//       Cass Everitt               Martins Mozeiko\n//       stoiko (Haemimont Games)   Cap Petschulat\n//       Brian Hook                 Omar Cornut\n//       Walter van Niftrik         github:aloucks\n//       David Gow                  Peter LaValle\n//       David Given                Sergey Popov\n//       Ivan-Assen Ivanov          Giumo X. Clanjor\n//       Anthony Pesch              Higor Euripedes\n//       Johan Duparc               Thomas Fields\n//       Hou Qiming                 Derek Vinyard\n//       Rob Loach                  Cort Stratton\n//       Kenney Phillis Jr.         github:oyvindjam\n//       Brian Costabile            github:vassvik\n//\n// VERSION HISTORY\n//\n//   1.20 (2019-02-07) PackFontRange skips missing codepoints; GetScaleFontVMetrics()\n//   1.19 (2018-02-11) GPOS kerning, STBTT_fmod\n//   1.18 (2018-01-29) add missing function\n//   1.17 (2017-07-23) make more arguments const; doc fix\n//   1.16 (2017-07-12) SDF support\n//   1.15 (2017-03-03) make more arguments const\n//   1.14 (2017-01-16) num-fonts-in-TTC function\n//   1.13 (2017-01-02) support OpenType fonts, certain Apple fonts\n//   1.12 (2016-10-25) suppress warnings about casting away const with -Wcast-qual\n//   1.11 (2016-04-02) fix unused-variable warning\n//   1.10 (2016-04-02) user-defined fabs(); rare memory leak; remove duplicate typedef\n//   1.09 (2016-01-16) warning fix; avoid crash on outofmem; use allocation userdata properly\n//   1.08 (2015-09-13) document stbtt_Rasterize(); fixes for vertical & horizontal edges\n//   1.07 (2015-08-01) allow PackFontRanges to accept arrays of sparse codepoints;\n//                     variant PackFontRanges to pack and render in separate phases;\n//                     fix stbtt_GetFontOFfsetForIndex (never worked for non-0 input?);\n//                     fixed an assert() bug in the new rasterizer\n//                     replace assert() with STBTT_assert() in new rasterizer\n//\n//   Full history can be found at the end of this file.\n//\n// LICENSE\n//\n//   See end of file for license information.\n//\n// USAGE\n//\n//   Include this file in whatever places need to refer to it. In ONE C/C++\n//   file, write:\n//      #define STB_TRUETYPE_IMPLEMENTATION\n//   before the #include of this file. This expands out the actual\n//   implementation into that C/C++ file.\n//\n//   To make the implementation private to the file that generates the implementation,\n//      #define STBTT_STATIC\n//\n//   Simple 3D API (don't ship this, but it's fine for tools and quick start)\n//           stbtt_BakeFontBitmap()               -- bake a font to a bitmap for use as texture\n//           stbtt_GetBakedQuad()                 -- compute quad to draw for a given char\n//\n//   Improved 3D API (more shippable):\n//           #include \"stb_rect_pack.h\"           -- optional, but you really want it\n//           stbtt_PackBegin()\n//           stbtt_PackSetOversampling()          -- for improved quality on small fonts\n//           stbtt_PackFontRanges()               -- pack and renders\n//           stbtt_PackEnd()\n//           stbtt_GetPackedQuad()\n//\n//   \"Load\" a font file from a memory buffer (you have to keep the buffer loaded)\n//           stbtt_InitFont()\n//           stbtt_GetFontOffsetForIndex()        -- indexing for TTC font collections\n//           stbtt_GetNumberOfFonts()             -- number of fonts for TTC font collections\n//\n//   Render a unicode codepoint to a bitmap\n//           stbtt_GetCodepointBitmap()           -- allocates and returns a bitmap\n//           stbtt_MakeCodepointBitmap()          -- renders into bitmap you provide\n//           stbtt_GetCodepointBitmapBox()        -- how big the bitmap must be\n//\n//   Character advance/positioning\n//           stbtt_GetCodepointHMetrics()\n//           stbtt_GetFontVMetrics()\n//           stbtt_GetFontVMetricsOS2()\n//           stbtt_GetCodepointKernAdvance()\n//\n//   Starting with version 1.06, the rasterizer was replaced with a new,\n//   faster and generally-more-precise rasterizer. The new rasterizer more\n//   accurately measures pixel coverage for anti-aliasing, except in the case\n//   where multiple shapes overlap, in which case it overestimates the AA pixel\n//   coverage. Thus, anti-aliasing of intersecting shapes may look wrong. If\n//   this turns out to be a problem, you can re-enable the old rasterizer with\n//        #define STBTT_RASTERIZER_VERSION 1\n//   which will incur about a 15% speed hit.\n//\n// ADDITIONAL DOCUMENTATION\n//\n//   Immediately after this block comment are a series of sample programs.\n//\n//   After the sample programs is the \"header file\" section. This section\n//   includes documentation for each API function.\n//\n//   Some important concepts to understand to use this library:\n//\n//      Codepoint\n//         Characters are defined by unicode codepoints, e.g. 65 is\n//         uppercase A, 231 is lowercase c with a cedilla, 0x7e30 is\n//         the hiragana for \"ma\".\n//\n//      Glyph\n//         A visual character shape (every codepoint is rendered as\n//         some glyph)\n//\n//      Glyph index\n//         A font-specific integer ID representing a glyph\n//\n//      Baseline\n//         Glyph shapes are defined relative to a baseline, which is the\n//         bottom of uppercase characters. Characters extend both above\n//         and below the baseline.\n//\n//      Current Point\n//         As you draw text to the screen, you keep track of a \"current point\"\n//         which is the origin of each character. The current point's vertical\n//         position is the baseline. Even \"baked fonts\" use this model.\n//\n//      Vertical Font Metrics\n//         The vertical qualities of the font, used to vertically position\n//         and space the characters. See docs for stbtt_GetFontVMetrics.\n//\n//      Font Size in Pixels or Points\n//         The preferred interface for specifying font sizes in stb_truetype\n//         is to specify how tall the font's vertical extent should be in pixels.\n//         If that sounds good enough, skip the next paragraph.\n//\n//         Most font APIs instead use \"points\", which are a common typographic\n//         measurement for describing font size, defined as 72 points per inch.\n//         stb_truetype provides a point API for compatibility. However, true\n//         \"per inch\" conventions don't make much sense on computer displays\n//         since different monitors have different number of pixels per\n//         inch. For example, Windows traditionally uses a convention that\n//         there are 96 pixels per inch, thus making 'inch' measurements have\n//         nothing to do with inches, and thus effectively defining a point to\n//         be 1.333 pixels. Additionally, the TrueType font data provides\n//         an explicit scale factor to scale a given font's glyphs to points,\n//         but the author has observed that this scale factor is often wrong\n//         for non-commercial fonts, thus making fonts scaled in points\n//         according to the TrueType spec incoherently sized in practice.\n//\n// DETAILED USAGE:\n//\n//  Scale:\n//    Select how high you want the font to be, in points or pixels.\n//    Call ScaleForPixelHeight or ScaleForMappingEmToPixels to compute\n//    a scale factor SF that will be used by all other functions.\n//\n//  Baseline:\n//    You need to select a y-coordinate that is the baseline of where\n//    your text will appear. Call GetFontBoundingBox to get the baseline-relative\n//    bounding box for all characters. SF*-y0 will be the distance in pixels\n//    that the worst-case character could extend above the baseline, so if\n//    you want the top edge of characters to appear at the top of the\n//    screen where y=0, then you would set the baseline to SF*-y0.\n//\n//  Current point:\n//    Set the current point where the first character will appear. The\n//    first character could extend left of the current point; this is font\n//    dependent. You can either choose a current point that is the leftmost\n//    point and hope, or add some padding, or check the bounding box or\n//    left-side-bearing of the first character to be displayed and set\n//    the current point based on that.\n//\n//  Displaying a character:\n//    Compute the bounding box of the character. It will contain signed values\n//    relative to <current_point, baseline>. I.e. if it returns x0,y0,x1,y1,\n//    then the character should be displayed in the rectangle from\n//    <current_point+SF*x0, baseline+SF*y0> to <current_point+SF*x1,baseline+SF*y1).\n//\n//  Advancing for the next character:\n//    Call GlyphHMetrics, and compute 'current_point += SF * advance'.\n//\n//\n// ADVANCED USAGE\n//\n//   Quality:\n//\n//    - Use the functions with Subpixel at the end to allow your characters\n//      to have subpixel positioning. Since the font is anti-aliased, not\n//      hinted, this is very import for quality. (This is not possible with\n//      baked fonts.)\n//\n//    - Kerning is now supported, and if you're supporting subpixel rendering\n//      then kerning is worth using to give your text a polished look.\n//\n//   Performance:\n//\n//    - Convert Unicode codepoints to glyph indexes and operate on the glyphs;\n//      if you don't do this, stb_truetype is forced to do the conversion on\n//      every call.\n//\n//    - There are a lot of memory allocations. We should modify it to take\n//      a temp buffer and allocate from the temp buffer (without freeing),\n//      should help performance a lot.\n//\n// NOTES\n//\n//   The system uses the raw data found in the .ttf file without changing it\n//   and without building auxiliary data structures. This is a bit inefficient\n//   on little-endian systems (the data is big-endian), but assuming you're\n//   caching the bitmaps or glyph shapes this shouldn't be a big deal.\n//\n//   It appears to be very hard to programmatically determine what font a\n//   given file is in a general way. I provide an API for this, but I don't\n//   recommend it.\n//\n//\n// SOURCE STATISTICS (based on v0.6c, 2050 LOC)\n//\n//   Documentation & header file        520 LOC  \\___ 660 LOC documentation\n//   Sample code                        140 LOC  /\n//   Truetype parsing                   620 LOC  ---- 620 LOC TrueType\n//   Software rasterization             240 LOC  \\.\n//   Curve tessellation                 120 LOC   \\__ 550 LOC Bitmap creation\n//   Bitmap management                  100 LOC   /\n//   Baked bitmap interface              70 LOC  /\n//   Font name matching & access        150 LOC  ---- 150\n//   C runtime library abstraction       60 LOC  ----  60\n//\n//\n// PERFORMANCE MEASUREMENTS FOR 1.06:\n//\n//                      32-bit     64-bit\n//   Previous release:  8.83 s     7.68 s\n//   Pool allocations:  7.72 s     6.34 s\n//   Inline sort     :  6.54 s     5.65 s\n//   New rasterizer  :  5.63 s     5.00 s\n\n//////////////////////////////////////////////////////////////////////////////\n//////////////////////////////////////////////////////////////////////////////\n////\n////  SAMPLE PROGRAMS\n////\n//\n//  Incomplete text-in-3d-api example, which draws quads properly aligned to be lossless\n//\n#if 0\n#define STB_TRUETYPE_IMPLEMENTATION  // force following include to generate implementation\n#include \"stb_truetype.h\"\n\nunsigned char ttf_buffer[1<<20];\nunsigned char temp_bitmap[512*512];\n\nstbtt_bakedchar cdata[96]; // ASCII 32..126 is 95 glyphs\nGLuint ftex;\n\nvoid my_stbtt_initfont(void)\n{\n   fread(ttf_buffer, 1, 1<<20, fopen(\"c:/windows/fonts/times.ttf\", \"rb\"));\n   stbtt_BakeFontBitmap(ttf_buffer,0, 32.0, temp_bitmap,512,512, 32,96, cdata); // no guarantee this fits!\n   // can free ttf_buffer at this point\n   glGenTextures(1, &ftex);\n   glBindTexture(GL_TEXTURE_2D, ftex);\n   glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, 512,512, 0, GL_ALPHA, GL_UNSIGNED_BYTE, temp_bitmap);\n   // can free temp_bitmap at this point\n   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n}\n\nvoid my_stbtt_print(float x, float y, char *text)\n{\n   // assume orthographic projection with units = screen pixels, origin at top left\n   glEnable(GL_TEXTURE_2D);\n   glBindTexture(GL_TEXTURE_2D, ftex);\n   glBegin(GL_QUADS);\n   while (*text) {\n      if (*text >= 32 && *text < 128) {\n         stbtt_aligned_quad q;\n         stbtt_GetBakedQuad(cdata, 512,512, *text-32, &x,&y,&q,1);//1=opengl & d3d10+,0=d3d9\n         glTexCoord2f(q.s0,q.t1); glVertex2f(q.x0,q.y0);\n         glTexCoord2f(q.s1,q.t1); glVertex2f(q.x1,q.y0);\n         glTexCoord2f(q.s1,q.t0); glVertex2f(q.x1,q.y1);\n         glTexCoord2f(q.s0,q.t0); glVertex2f(q.x0,q.y1);\n      }\n      ++text;\n   }\n   glEnd();\n}\n#endif\n//\n//\n//////////////////////////////////////////////////////////////////////////////\n//\n// Complete program (this compiles): get a single bitmap, print as ASCII art\n//\n#if 0\n#include <stdio.h>\n#define STB_TRUETYPE_IMPLEMENTATION  // force following include to generate implementation\n#include \"stb_truetype.h\"\n\nchar ttf_buffer[1<<25];\n\nint main(int argc, char **argv)\n{\n   stbtt_fontinfo font;\n   unsigned char *bitmap;\n   int w,h,i,j,c = (argc > 1 ? atoi(argv[1]) : 'a'), s = (argc > 2 ? atoi(argv[2]) : 20);\n\n   fread(ttf_buffer, 1, 1<<25, fopen(argc > 3 ? argv[3] : \"c:/windows/fonts/arialbd.ttf\", \"rb\"));\n\n   stbtt_InitFont(&font, ttf_buffer, stbtt_GetFontOffsetForIndex(ttf_buffer,0));\n   bitmap = stbtt_GetCodepointBitmap(&font, 0,stbtt_ScaleForPixelHeight(&font, s), c, &w, &h, 0,0);\n\n   for (j=0; j < h; ++j) {\n      for (i=0; i < w; ++i)\n         putchar(\" .:ioVM@\"[bitmap[j*w+i]>>5]);\n      putchar('\\n');\n   }\n   return 0;\n}\n#endif\n//\n// Output:\n//\n//     .ii.\n//    @@@@@@.\n//   V@Mio@@o\n//   :i.  V@V\n//     :oM@@M\n//   :@@@MM@M\n//   @@o  o@M\n//  :@@.  M@M\n//   @@@o@@@@\n//   :M@@V:@@.\n//\n//////////////////////////////////////////////////////////////////////////////\n//\n// Complete program: print \"Hello World!\" banner, with bugs\n//\n#if 0\nchar buffer[24<<20];\nunsigned char screen[20][79];\n\nint main(int arg, char **argv)\n{\n   stbtt_fontinfo font;\n   int i,j,ascent,baseline,ch=0;\n   float scale, xpos=2; // leave a little padding in case the character extends left\n   char *text = \"Heljo World!\"; // intentionally misspelled to show 'lj' brokenness\n\n   fread(buffer, 1, 1000000, fopen(\"c:/windows/fonts/arialbd.ttf\", \"rb\"));\n   stbtt_InitFont(&font, buffer, 0);\n\n   scale = stbtt_ScaleForPixelHeight(&font, 15);\n   stbtt_GetFontVMetrics(&font, &ascent,0,0);\n   baseline = (int) (ascent*scale);\n\n   while (text[ch]) {\n      int advance,lsb,x0,y0,x1,y1;\n      float x_shift = xpos - (float) floor(xpos);\n      stbtt_GetCodepointHMetrics(&font, text[ch], &advance, &lsb);\n      stbtt_GetCodepointBitmapBoxSubpixel(&font, text[ch], scale,scale,x_shift,0, &x0,&y0,&x1,&y1);\n      stbtt_MakeCodepointBitmapSubpixel(&font, &screen[baseline + y0][(int) xpos + x0], x1-x0,y1-y0, 79, scale,scale,x_shift,0, text[ch]);\n      // note that this stomps the old data, so where character boxes overlap (e.g. 'lj') it's wrong\n      // because this API is really for baking character bitmaps into textures. if you want to render\n      // a sequence of characters, you really need to render each bitmap to a temp buffer, then\n      // \"alpha blend\" that into the working buffer\n      xpos += (advance * scale);\n      if (text[ch+1])\n         xpos += scale*stbtt_GetCodepointKernAdvance(&font, text[ch],text[ch+1]);\n      ++ch;\n   }\n\n   for (j=0; j < 20; ++j) {\n      for (i=0; i < 78; ++i)\n         putchar(\" .:ioVM@\"[screen[j][i]>>5]);\n      putchar('\\n');\n   }\n\n   return 0;\n}\n#endif\n\n\n//////////////////////////////////////////////////////////////////////////////\n//////////////////////////////////////////////////////////////////////////////\n////\n////   INTEGRATION WITH YOUR CODEBASE\n////\n////   The following sections allow you to supply alternate definitions\n////   of C library functions used by stb_truetype, e.g. if you don't\n////   link with the C runtime library.\n\n#ifdef STB_TRUETYPE_IMPLEMENTATION\n   // #define your own (u)stbtt_int8/16/32 before including to override this\n   #ifndef stbtt_uint8\n   typedef unsigned char   stbtt_uint8;\n   typedef signed   char   stbtt_int8;\n   typedef unsigned short  stbtt_uint16;\n   typedef signed   short  stbtt_int16;\n   typedef unsigned int    stbtt_uint32;\n   typedef signed   int    stbtt_int32;\n   #endif\n\n   typedef char stbtt__check_size32[sizeof(stbtt_int32)==4 ? 1 : -1];\n   typedef char stbtt__check_size16[sizeof(stbtt_int16)==2 ? 1 : -1];\n\n   // e.g. #define your own STBTT_ifloor/STBTT_iceil() to avoid math.h\n   #ifndef STBTT_ifloor\n   #include <math.h>\n   #define STBTT_ifloor(x)   ((int) floor(x))\n   #define STBTT_iceil(x)    ((int) ceil(x))\n   #endif\n\n   #ifndef STBTT_sqrt\n   #include <math.h>\n   #define STBTT_sqrt(x)      sqrt(x)\n   #define STBTT_pow(x,y)     pow(x,y)\n   #endif\n\n   #ifndef STBTT_fmod\n   #include <math.h>\n   #define STBTT_fmod(x,y)    fmod(x,y)\n   #endif\n\n   #ifndef STBTT_cos\n   #include <math.h>\n   #define STBTT_cos(x)       cos(x)\n   #define STBTT_acos(x)      acos(x)\n   #endif\n\n   #ifndef STBTT_fabs\n   #include <math.h>\n   #define STBTT_fabs(x)      fabs(x)\n   #endif\n\n   // #define your own functions \"STBTT_malloc\" / \"STBTT_free\" to avoid malloc.h\n   #ifndef STBTT_malloc\n   #include <stdlib.h>\n   #define STBTT_malloc(x,u)  ((void)(u),malloc(x))\n   #define STBTT_free(x,u)    ((void)(u),free(x))\n   #endif\n\n   #ifndef STBTT_assert\n   #include <assert.h>\n   #define STBTT_assert(x)    assert(x)\n   #endif\n\n   #ifndef STBTT_strlen\n   #include <string.h>\n   #define STBTT_strlen(x)    strlen(x)\n   #endif\n\n   #ifndef STBTT_memcpy\n   #include <string.h>\n   #define STBTT_memcpy       memcpy\n   #define STBTT_memset       memset\n   #endif\n#endif\n\n///////////////////////////////////////////////////////////////////////////////\n///////////////////////////////////////////////////////////////////////////////\n////\n////   INTERFACE\n////\n////\n\n#ifndef __STB_INCLUDE_STB_TRUETYPE_H__\n#define __STB_INCLUDE_STB_TRUETYPE_H__\n\n#ifdef STBTT_STATIC\n#define STBTT_DEF static\n#else\n#define STBTT_DEF extern\n#endif\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n// private structure\ntypedef struct\n{\n   unsigned char *data;\n   int cursor;\n   int size;\n} stbtt__buf;\n\n//////////////////////////////////////////////////////////////////////////////\n//\n// TEXTURE BAKING API\n//\n// If you use this API, you only have to call two functions ever.\n//\n\ntypedef struct\n{\n   unsigned short x0,y0,x1,y1; // coordinates of bbox in bitmap\n   float xoff,yoff,xadvance;\n} stbtt_bakedchar;\n\nSTBTT_DEF int stbtt_BakeFontBitmap(const unsigned char *data, int offset,  // font location (use offset=0 for plain .ttf)\n                                float pixel_height,                     // height of font in pixels\n                                unsigned char *pixels, int pw, int ph,  // bitmap to be filled in\n                                int first_char, int num_chars,          // characters to bake\n                                stbtt_bakedchar *chardata);             // you allocate this, it's num_chars long\n// if return is positive, the first unused row of the bitmap\n// if return is negative, returns the negative of the number of characters that fit\n// if return is 0, no characters fit and no rows were used\n// This uses a very crappy packing.\n\ntypedef struct\n{\n   float x0,y0,s0,t0; // top-left\n   float x1,y1,s1,t1; // bottom-right\n} stbtt_aligned_quad;\n\nSTBTT_DEF void stbtt_GetBakedQuad(const stbtt_bakedchar *chardata, int pw, int ph,  // same data as above\n                               int char_index,             // character to display\n                               float *xpos, float *ypos,   // pointers to current position in screen pixel space\n                               stbtt_aligned_quad *q,      // output: quad to draw\n                               int opengl_fillrule);       // true if opengl fill rule; false if DX9 or earlier\n// Call GetBakedQuad with char_index = 'character - first_char', and it\n// creates the quad you need to draw and advances the current position.\n//\n// The coordinate system used assumes y increases downwards.\n//\n// Characters will extend both above and below the current position;\n// see discussion of \"BASELINE\" above.\n//\n// It's inefficient; you might want to c&p it and optimize it.\n\nSTBTT_DEF void stbtt_GetScaledFontVMetrics(const unsigned char *fontdata, int index, float size, float *ascent, float *descent, float *lineGap);\n// Query the font vertical metrics without having to create a font first.\n\n\n//////////////////////////////////////////////////////////////////////////////\n//\n// NEW TEXTURE BAKING API\n//\n// This provides options for packing multiple fonts into one atlas, not\n// perfectly but better than nothing.\n\ntypedef struct\n{\n   unsigned short x0,y0,x1,y1; // coordinates of bbox in bitmap\n   float xoff,yoff,xadvance;\n   float xoff2,yoff2;\n} stbtt_packedchar;\n\ntypedef struct stbtt_pack_context stbtt_pack_context;\ntypedef struct stbtt_fontinfo stbtt_fontinfo;\n#ifndef STB_RECT_PACK_VERSION\ntypedef struct stbrp_rect stbrp_rect;\n#endif\n\nSTBTT_DEF int  stbtt_PackBegin(stbtt_pack_context *spc, unsigned char *pixels, int width, int height, int stride_in_bytes, int padding, void *alloc_context);\n// Initializes a packing context stored in the passed-in stbtt_pack_context.\n// Future calls using this context will pack characters into the bitmap passed\n// in here: a 1-channel bitmap that is width * height. stride_in_bytes is\n// the distance from one row to the next (or 0 to mean they are packed tightly\n// together). \"padding\" is the amount of padding to leave between each\n// character (normally you want '1' for bitmaps you'll use as textures with\n// bilinear filtering).\n//\n// Returns 0 on failure, 1 on success.\n\nSTBTT_DEF void stbtt_PackEnd  (stbtt_pack_context *spc);\n// Cleans up the packing context and frees all memory.\n\n#define STBTT_POINT_SIZE(x)   (-(x))\n\nSTBTT_DEF int  stbtt_PackFontRange(stbtt_pack_context *spc, const unsigned char *fontdata, int font_index, float font_size,\n                                int first_unicode_char_in_range, int num_chars_in_range, stbtt_packedchar *chardata_for_range);\n// Creates character bitmaps from the font_index'th font found in fontdata (use\n// font_index=0 if you don't know what that is). It creates num_chars_in_range\n// bitmaps for characters with unicode values starting at first_unicode_char_in_range\n// and increasing. Data for how to render them is stored in chardata_for_range;\n// pass these to stbtt_GetPackedQuad to get back renderable quads.\n//\n// font_size is the full height of the character from ascender to descender,\n// as computed by stbtt_ScaleForPixelHeight. To use a point size as computed\n// by stbtt_ScaleForMappingEmToPixels, wrap the point size in STBTT_POINT_SIZE()\n// and pass that result as 'font_size':\n//       ...,                  20 , ... // font max minus min y is 20 pixels tall\n//       ..., STBTT_POINT_SIZE(20), ... // 'M' is 20 pixels tall\n\ntypedef struct\n{\n   float font_size;\n   int first_unicode_codepoint_in_range;  // if non-zero, then the chars are continuous, and this is the first codepoint\n   int *array_of_unicode_codepoints;       // if non-zero, then this is an array of unicode codepoints\n   int num_chars;\n   stbtt_packedchar *chardata_for_range; // output\n   unsigned char h_oversample, v_oversample; // don't set these, they're used internally\n} stbtt_pack_range;\n\nSTBTT_DEF int  stbtt_PackFontRanges(stbtt_pack_context *spc, const unsigned char *fontdata, int font_index, stbtt_pack_range *ranges, int num_ranges);\n// Creates character bitmaps from multiple ranges of characters stored in\n// ranges. This will usually create a better-packed bitmap than multiple\n// calls to stbtt_PackFontRange. Note that you can call this multiple\n// times within a single PackBegin/PackEnd.\n\nSTBTT_DEF void stbtt_PackSetOversampling(stbtt_pack_context *spc, unsigned int h_oversample, unsigned int v_oversample);\n// Oversampling a font increases the quality by allowing higher-quality subpixel\n// positioning, and is especially valuable at smaller text sizes.\n//\n// This function sets the amount of oversampling for all following calls to\n// stbtt_PackFontRange(s) or stbtt_PackFontRangesGatherRects for a given\n// pack context. The default (no oversampling) is achieved by h_oversample=1\n// and v_oversample=1. The total number of pixels required is\n// h_oversample*v_oversample larger than the default; for example, 2x2\n// oversampling requires 4x the storage of 1x1. For best results, render\n// oversampled textures with bilinear filtering. Look at the readme in\n// stb/tests/oversample for information about oversampled fonts\n//\n// To use with PackFontRangesGather etc., you must set it before calls\n// call to PackFontRangesGatherRects.\n\nSTBTT_DEF void stbtt_PackSetSkipMissingCodepoints(stbtt_pack_context *spc, int skip);\n// If skip != 0, this tells stb_truetype to skip any codepoints for which\n// there is no corresponding glyph. If skip=0, which is the default, then\n// codepoints without a glyph recived the font's \"missing character\" glyph,\n// typically an empty box by convention.\n\nSTBTT_DEF void stbtt_GetPackedQuad(const stbtt_packedchar *chardata, int pw, int ph,  // same data as above\n                               int char_index,             // character to display\n                               float *xpos, float *ypos,   // pointers to current position in screen pixel space\n                               stbtt_aligned_quad *q,      // output: quad to draw\n                               int align_to_integer);\n\nSTBTT_DEF int  stbtt_PackFontRangesGatherRects(stbtt_pack_context *spc, const stbtt_fontinfo *info, stbtt_pack_range *ranges, int num_ranges, stbrp_rect *rects);\nSTBTT_DEF void stbtt_PackFontRangesPackRects(stbtt_pack_context *spc, stbrp_rect *rects, int num_rects);\nSTBTT_DEF int  stbtt_PackFontRangesRenderIntoRects(stbtt_pack_context *spc, const stbtt_fontinfo *info, stbtt_pack_range *ranges, int num_ranges, stbrp_rect *rects);\n// Calling these functions in sequence is roughly equivalent to calling\n// stbtt_PackFontRanges(). If you more control over the packing of multiple\n// fonts, or if you want to pack custom data into a font texture, take a look\n// at the source to of stbtt_PackFontRanges() and create a custom version\n// using these functions, e.g. call GatherRects multiple times,\n// building up a single array of rects, then call PackRects once,\n// then call RenderIntoRects repeatedly. This may result in a\n// better packing than calling PackFontRanges multiple times\n// (or it may not).\n\n// this is an opaque structure that you shouldn't mess with which holds\n// all the context needed from PackBegin to PackEnd.\nstruct stbtt_pack_context {\n   void *user_allocator_context;\n   void *pack_info;\n   int   width;\n   int   height;\n   int   stride_in_bytes;\n   int   padding;\n   int   skip_missing;\n   unsigned int   h_oversample, v_oversample;\n   unsigned char *pixels;\n   void  *nodes;\n};\n\n//////////////////////////////////////////////////////////////////////////////\n//\n// FONT LOADING\n//\n//\n\nSTBTT_DEF int stbtt_GetNumberOfFonts(const unsigned char *data);\n// This function will determine the number of fonts in a font file.  TrueType\n// collection (.ttc) files may contain multiple fonts, while TrueType font\n// (.ttf) files only contain one font. The number of fonts can be used for\n// indexing with the previous function where the index is between zero and one\n// less than the total fonts. If an error occurs, -1 is returned.\n\nSTBTT_DEF int stbtt_GetFontOffsetForIndex(const unsigned char *data, int index);\n// Each .ttf/.ttc file may have more than one font. Each font has a sequential\n// index number starting from 0. Call this function to get the font offset for\n// a given index; it returns -1 if the index is out of range. A regular .ttf\n// file will only define one font and it always be at offset 0, so it will\n// return '0' for index 0, and -1 for all other indices.\n\n// The following structure is defined publicly so you can declare one on\n// the stack or as a global or etc, but you should treat it as opaque.\nstruct stbtt_fontinfo\n{\n   void           * userdata;\n   unsigned char  * data;              // pointer to .ttf file\n   int              fontstart;         // offset of start of font\n\n   int numGlyphs;                     // number of glyphs, needed for range checking\n\n   int loca,head,glyf,hhea,hmtx,kern,gpos; // table locations as offset from start of .ttf\n   int index_map;                     // a cmap mapping for our chosen character encoding\n   int indexToLocFormat;              // format needed to map from glyph index to glyph\n\n   stbtt__buf cff;                    // cff font data\n   stbtt__buf charstrings;            // the charstring index\n   stbtt__buf gsubrs;                 // global charstring subroutines index\n   stbtt__buf subrs;                  // private charstring subroutines index\n   stbtt__buf fontdicts;              // array of font dicts\n   stbtt__buf fdselect;               // map from glyph to fontdict\n};\n\nSTBTT_DEF int stbtt_InitFont(stbtt_fontinfo *info, const unsigned char *data, int offset);\n// Given an offset into the file that defines a font, this function builds\n// the necessary cached info for the rest of the system. You must allocate\n// the stbtt_fontinfo yourself, and stbtt_InitFont will fill it out. You don't\n// need to do anything special to free it, because the contents are pure\n// value data with no additional data structures. Returns 0 on failure.\n\n\n//////////////////////////////////////////////////////////////////////////////\n//\n// CHARACTER TO GLYPH-INDEX CONVERSIOn\n\nSTBTT_DEF int stbtt_FindGlyphIndex(const stbtt_fontinfo *info, int unicode_codepoint);\n// If you're going to perform multiple operations on the same character\n// and you want a speed-up, call this function with the character you're\n// going to process, then use glyph-based functions instead of the\n// codepoint-based functions.\n// Returns 0 if the character codepoint is not defined in the font.\n\n\n//////////////////////////////////////////////////////////////////////////////\n//\n// CHARACTER PROPERTIES\n//\n\nSTBTT_DEF float stbtt_ScaleForPixelHeight(const stbtt_fontinfo *info, float pixels);\n// computes a scale factor to produce a font whose \"height\" is 'pixels' tall.\n// Height is measured as the distance from the highest ascender to the lowest\n// descender; in other words, it's equivalent to calling stbtt_GetFontVMetrics\n// and computing:\n//       scale = pixels / (ascent - descent)\n// so if you prefer to measure height by the ascent only, use a similar calculation.\n\nSTBTT_DEF float stbtt_ScaleForMappingEmToPixels(const stbtt_fontinfo *info, float pixels);\n// computes a scale factor to produce a font whose EM size is mapped to\n// 'pixels' tall. This is probably what traditional APIs compute, but\n// I'm not positive.\n\nSTBTT_DEF void stbtt_GetFontVMetrics(const stbtt_fontinfo *info, int *ascent, int *descent, int *lineGap);\n// ascent is the coordinate above the baseline the font extends; descent\n// is the coordinate below the baseline the font extends (i.e. it is typically negative)\n// lineGap is the spacing between one row's descent and the next row's ascent...\n// so you should advance the vertical position by \"*ascent - *descent + *lineGap\"\n//   these are expressed in unscaled coordinates, so you must multiply by\n//   the scale factor for a given size\n\nSTBTT_DEF int  stbtt_GetFontVMetricsOS2(const stbtt_fontinfo *info, int *typoAscent, int *typoDescent, int *typoLineGap);\n// analogous to GetFontVMetrics, but returns the \"typographic\" values from the OS/2\n// table (specific to MS/Windows TTF files).\n//\n// Returns 1 on success (table present), 0 on failure.\n\nSTBTT_DEF void stbtt_GetFontBoundingBox(const stbtt_fontinfo *info, int *x0, int *y0, int *x1, int *y1);\n// the bounding box around all possible characters\n\nSTBTT_DEF void stbtt_GetCodepointHMetrics(const stbtt_fontinfo *info, int codepoint, int *advanceWidth, int *leftSideBearing);\n// leftSideBearing is the offset from the current horizontal position to the left edge of the character\n// advanceWidth is the offset from the current horizontal position to the next horizontal position\n//   these are expressed in unscaled coordinates\n\nSTBTT_DEF int  stbtt_GetCodepointKernAdvance(const stbtt_fontinfo *info, int ch1, int ch2);\n// an additional amount to add to the 'advance' value between ch1 and ch2\n\nSTBTT_DEF int stbtt_GetCodepointBox(const stbtt_fontinfo *info, int codepoint, int *x0, int *y0, int *x1, int *y1);\n// Gets the bounding box of the visible part of the glyph, in unscaled coordinates\n\nSTBTT_DEF void stbtt_GetGlyphHMetrics(const stbtt_fontinfo *info, int glyph_index, int *advanceWidth, int *leftSideBearing);\nSTBTT_DEF int  stbtt_GetGlyphKernAdvance(const stbtt_fontinfo *info, int glyph1, int glyph2);\nSTBTT_DEF int  stbtt_GetGlyphBox(const stbtt_fontinfo *info, int glyph_index, int *x0, int *y0, int *x1, int *y1);\n// as above, but takes one or more glyph indices for greater efficiency\n\n\n//////////////////////////////////////////////////////////////////////////////\n//\n// GLYPH SHAPES (you probably don't need these, but they have to go before\n// the bitmaps for C declaration-order reasons)\n//\n\n#ifndef STBTT_vmove // you can predefine these to use different values (but why?)\n   enum {\n      STBTT_vmove=1,\n      STBTT_vline,\n      STBTT_vcurve,\n      STBTT_vcubic\n   };\n#endif\n\n#ifndef stbtt_vertex // you can predefine this to use different values\n                   // (we share this with other code at RAD)\n   #define stbtt_vertex_type short // can't use stbtt_int16 because that's not visible in the header file\n   typedef struct\n   {\n      stbtt_vertex_type x,y,cx,cy,cx1,cy1;\n      unsigned char type,padding;\n   } stbtt_vertex;\n#endif\n\nSTBTT_DEF int stbtt_IsGlyphEmpty(const stbtt_fontinfo *info, int glyph_index);\n// returns non-zero if nothing is drawn for this glyph\n\nSTBTT_DEF int stbtt_GetCodepointShape(const stbtt_fontinfo *info, int unicode_codepoint, stbtt_vertex **vertices);\nSTBTT_DEF int stbtt_GetGlyphShape(const stbtt_fontinfo *info, int glyph_index, stbtt_vertex **vertices);\n// returns # of vertices and fills *vertices with the pointer to them\n//   these are expressed in \"unscaled\" coordinates\n//\n// The shape is a series of contours. Each one starts with\n// a STBTT_moveto, then consists of a series of mixed\n// STBTT_lineto and STBTT_curveto segments. A lineto\n// draws a line from previous endpoint to its x,y; a curveto\n// draws a quadratic bezier from previous endpoint to\n// its x,y, using cx,cy as the bezier control point.\n\nSTBTT_DEF void stbtt_FreeShape(const stbtt_fontinfo *info, stbtt_vertex *vertices);\n// frees the data allocated above\n\n//////////////////////////////////////////////////////////////////////////////\n//\n// BITMAP RENDERING\n//\n\nSTBTT_DEF void stbtt_FreeBitmap(unsigned char *bitmap, void *userdata);\n// frees the bitmap allocated below\n\nSTBTT_DEF unsigned char *stbtt_GetCodepointBitmap(const stbtt_fontinfo *info, float scale_x, float scale_y, int codepoint, int *width, int *height, int *xoff, int *yoff);\n// allocates a large-enough single-channel 8bpp bitmap and renders the\n// specified character/glyph at the specified scale into it, with\n// antialiasing. 0 is no coverage (transparent), 255 is fully covered (opaque).\n// *width & *height are filled out with the width & height of the bitmap,\n// which is stored left-to-right, top-to-bottom.\n//\n// xoff/yoff are the offset it pixel space from the glyph origin to the top-left of the bitmap\n\nSTBTT_DEF unsigned char *stbtt_GetCodepointBitmapSubpixel(const stbtt_fontinfo *info, float scale_x, float scale_y, float shift_x, float shift_y, int codepoint, int *width, int *height, int *xoff, int *yoff);\n// the same as stbtt_GetCodepoitnBitmap, but you can specify a subpixel\n// shift for the character\n\nSTBTT_DEF void stbtt_MakeCodepointBitmap(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, int codepoint);\n// the same as stbtt_GetCodepointBitmap, but you pass in storage for the bitmap\n// in the form of 'output', with row spacing of 'out_stride' bytes. the bitmap\n// is clipped to out_w/out_h bytes. Call stbtt_GetCodepointBitmapBox to get the\n// width and height and positioning info for it first.\n\nSTBTT_DEF void stbtt_MakeCodepointBitmapSubpixel(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int codepoint);\n// same as stbtt_MakeCodepointBitmap, but you can specify a subpixel\n// shift for the character\n\nSTBTT_DEF void stbtt_MakeCodepointBitmapSubpixelPrefilter(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int oversample_x, int oversample_y, float *sub_x, float *sub_y, int codepoint);\n// same as stbtt_MakeCodepointBitmapSubpixel, but prefiltering\n// is performed (see stbtt_PackSetOversampling)\n\nSTBTT_DEF void stbtt_GetCodepointBitmapBox(const stbtt_fontinfo *font, int codepoint, float scale_x, float scale_y, int *ix0, int *iy0, int *ix1, int *iy1);\n// get the bbox of the bitmap centered around the glyph origin; so the\n// bitmap width is ix1-ix0, height is iy1-iy0, and location to place\n// the bitmap top left is (leftSideBearing*scale,iy0).\n// (Note that the bitmap uses y-increases-down, but the shape uses\n// y-increases-up, so CodepointBitmapBox and CodepointBox are inverted.)\n\nSTBTT_DEF void stbtt_GetCodepointBitmapBoxSubpixel(const stbtt_fontinfo *font, int codepoint, float scale_x, float scale_y, float shift_x, float shift_y, int *ix0, int *iy0, int *ix1, int *iy1);\n// same as stbtt_GetCodepointBitmapBox, but you can specify a subpixel\n// shift for the character\n\n// the following functions are equivalent to the above functions, but operate\n// on glyph indices instead of Unicode codepoints (for efficiency)\nSTBTT_DEF unsigned char *stbtt_GetGlyphBitmap(const stbtt_fontinfo *info, float scale_x, float scale_y, int glyph, int *width, int *height, int *xoff, int *yoff);\nSTBTT_DEF unsigned char *stbtt_GetGlyphBitmapSubpixel(const stbtt_fontinfo *info, float scale_x, float scale_y, float shift_x, float shift_y, int glyph, int *width, int *height, int *xoff, int *yoff);\nSTBTT_DEF void stbtt_MakeGlyphBitmap(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, int glyph);\nSTBTT_DEF void stbtt_MakeGlyphBitmapSubpixel(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int glyph);\nSTBTT_DEF void stbtt_MakeGlyphBitmapSubpixelPrefilter(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int oversample_x, int oversample_y, float *sub_x, float *sub_y, int glyph);\nSTBTT_DEF void stbtt_GetGlyphBitmapBox(const stbtt_fontinfo *font, int glyph, float scale_x, float scale_y, int *ix0, int *iy0, int *ix1, int *iy1);\nSTBTT_DEF void stbtt_GetGlyphBitmapBoxSubpixel(const stbtt_fontinfo *font, int glyph, float scale_x, float scale_y,float shift_x, float shift_y, int *ix0, int *iy0, int *ix1, int *iy1);\n\n\n// @TODO: don't expose this structure\ntypedef struct\n{\n   int w,h,stride;\n   unsigned char *pixels;\n} stbtt__bitmap;\n\n// rasterize a shape with quadratic beziers into a bitmap\nSTBTT_DEF void stbtt_Rasterize(stbtt__bitmap *result,        // 1-channel bitmap to draw into\n                               float flatness_in_pixels,     // allowable error of curve in pixels\n                               stbtt_vertex *vertices,       // array of vertices defining shape\n                               int num_verts,                // number of vertices in above array\n                               float scale_x, float scale_y, // scale applied to input vertices\n                               float shift_x, float shift_y, // translation applied to input vertices\n                               int x_off, int y_off,         // another translation applied to input\n                               int invert,                   // if non-zero, vertically flip shape\n                               void *userdata);              // context for to STBTT_MALLOC\n\n//////////////////////////////////////////////////////////////////////////////\n//\n// Signed Distance Function (or Field) rendering\n\nSTBTT_DEF void stbtt_FreeSDF(unsigned char *bitmap, void *userdata);\n// frees the SDF bitmap allocated below\n\nSTBTT_DEF unsigned char * stbtt_GetGlyphSDF(const stbtt_fontinfo *info, float scale, int glyph, int padding, unsigned char onedge_value, float pixel_dist_scale, int *width, int *height, int *xoff, int *yoff);\nSTBTT_DEF unsigned char * stbtt_GetCodepointSDF(const stbtt_fontinfo *info, float scale, int codepoint, int padding, unsigned char onedge_value, float pixel_dist_scale, int *width, int *height, int *xoff, int *yoff);\n// These functions compute a discretized SDF field for a single character, suitable for storing\n// in a single-channel texture, sampling with bilinear filtering, and testing against\n// larger than some threshold to produce scalable fonts.\n//        info              --  the font\n//        scale             --  controls the size of the resulting SDF bitmap, same as it would be creating a regular bitmap\n//        glyph/codepoint   --  the character to generate the SDF for\n//        padding           --  extra \"pixels\" around the character which are filled with the distance to the character (not 0),\n//                                 which allows effects like bit outlines\n//        onedge_value      --  value 0-255 to test the SDF against to reconstruct the character (i.e. the isocontour of the character)\n//        pixel_dist_scale  --  what value the SDF should increase by when moving one SDF \"pixel\" away from the edge (on the 0..255 scale)\n//                                 if positive, > onedge_value is inside; if negative, < onedge_value is inside\n//        width,height      --  output height & width of the SDF bitmap (including padding)\n//        xoff,yoff         --  output origin of the character\n//        return value      --  a 2D array of bytes 0..255, width*height in size\n//\n// pixel_dist_scale & onedge_value are a scale & bias that allows you to make\n// optimal use of the limited 0..255 for your application, trading off precision\n// and special effects. SDF values outside the range 0..255 are clamped to 0..255.\n//\n// Example:\n//      scale = stbtt_ScaleForPixelHeight(22)\n//      padding = 5\n//      onedge_value = 180\n//      pixel_dist_scale = 180/5.0 = 36.0\n//\n//      This will create an SDF bitmap in which the character is about 22 pixels\n//      high but the whole bitmap is about 22+5+5=32 pixels high. To produce a filled\n//      shape, sample the SDF at each pixel and fill the pixel if the SDF value\n//      is greater than or equal to 180/255. (You'll actually want to antialias,\n//      which is beyond the scope of this example.) Additionally, you can compute\n//      offset outlines (e.g. to stroke the character border inside & outside,\n//      or only outside). For example, to fill outside the character up to 3 SDF\n//      pixels, you would compare against (180-36.0*3)/255 = 72/255. The above\n//      choice of variables maps a range from 5 pixels outside the shape to\n//      2 pixels inside the shape to 0..255; this is intended primarily for apply\n//      outside effects only (the interior range is needed to allow proper\n//      antialiasing of the font at *smaller* sizes)\n//\n// The function computes the SDF analytically at each SDF pixel, not by e.g.\n// building a higher-res bitmap and approximating it. In theory the quality\n// should be as high as possible for an SDF of this size & representation, but\n// unclear if this is true in practice (perhaps building a higher-res bitmap\n// and computing from that can allow drop-out prevention).\n//\n// The algorithm has not been optimized at all, so expect it to be slow\n// if computing lots of characters or very large sizes.\n\n\n\n//////////////////////////////////////////////////////////////////////////////\n//\n// Finding the right font...\n//\n// You should really just solve this offline, keep your own tables\n// of what font is what, and don't try to get it out of the .ttf file.\n// That's because getting it out of the .ttf file is really hard, because\n// the names in the file can appear in many possible encodings, in many\n// possible languages, and e.g. if you need a case-insensitive comparison,\n// the details of that depend on the encoding & language in a complex way\n// (actually underspecified in truetype, but also gigantic).\n//\n// But you can use the provided functions in two possible ways:\n//     stbtt_FindMatchingFont() will use *case-sensitive* comparisons on\n//             unicode-encoded names to try to find the font you want;\n//             you can run this before calling stbtt_InitFont()\n//\n//     stbtt_GetFontNameString() lets you get any of the various strings\n//             from the file yourself and do your own comparisons on them.\n//             You have to have called stbtt_InitFont() first.\n\n\nSTBTT_DEF int stbtt_FindMatchingFont(const unsigned char *fontdata, const char *name, int flags);\n// returns the offset (not index) of the font that matches, or -1 if none\n//   if you use STBTT_MACSTYLE_DONTCARE, use a font name like \"Arial Bold\".\n//   if you use any other flag, use a font name like \"Arial\"; this checks\n//     the 'macStyle' header field; i don't know if fonts set this consistently\n#define STBTT_MACSTYLE_DONTCARE     0\n#define STBTT_MACSTYLE_BOLD         1\n#define STBTT_MACSTYLE_ITALIC       2\n#define STBTT_MACSTYLE_UNDERSCORE   4\n#define STBTT_MACSTYLE_NONE         8   // <= not same as 0, this makes us check the bitfield is 0\n\nSTBTT_DEF int stbtt_CompareUTF8toUTF16_bigendian(const char *s1, int len1, const char *s2, int len2);\n// returns 1/0 whether the first string interpreted as utf8 is identical to\n// the second string interpreted as big-endian utf16... useful for strings from next func\n\nSTBTT_DEF const char *stbtt_GetFontNameString(const stbtt_fontinfo *font, int *length, int platformID, int encodingID, int languageID, int nameID);\n// returns the string (which may be big-endian double byte, e.g. for unicode)\n// and puts the length in bytes in *length.\n//\n// some of the values for the IDs are below; for more see the truetype spec:\n//     http://developer.apple.com/textfonts/TTRefMan/RM06/Chap6name.html\n//     http://www.microsoft.com/typography/otspec/name.htm\n\nenum { // platformID\n   STBTT_PLATFORM_ID_UNICODE   =0,\n   STBTT_PLATFORM_ID_MAC       =1,\n   STBTT_PLATFORM_ID_ISO       =2,\n   STBTT_PLATFORM_ID_MICROSOFT =3\n};\n\nenum { // encodingID for STBTT_PLATFORM_ID_UNICODE\n   STBTT_UNICODE_EID_UNICODE_1_0    =0,\n   STBTT_UNICODE_EID_UNICODE_1_1    =1,\n   STBTT_UNICODE_EID_ISO_10646      =2,\n   STBTT_UNICODE_EID_UNICODE_2_0_BMP=3,\n   STBTT_UNICODE_EID_UNICODE_2_0_FULL=4\n};\n\nenum { // encodingID for STBTT_PLATFORM_ID_MICROSOFT\n   STBTT_MS_EID_SYMBOL        =0,\n   STBTT_MS_EID_UNICODE_BMP   =1,\n   STBTT_MS_EID_SHIFTJIS      =2,\n   STBTT_MS_EID_UNICODE_FULL  =10\n};\n\nenum { // encodingID for STBTT_PLATFORM_ID_MAC; same as Script Manager codes\n   STBTT_MAC_EID_ROMAN        =0,   STBTT_MAC_EID_ARABIC       =4,\n   STBTT_MAC_EID_JAPANESE     =1,   STBTT_MAC_EID_HEBREW       =5,\n   STBTT_MAC_EID_CHINESE_TRAD =2,   STBTT_MAC_EID_GREEK        =6,\n   STBTT_MAC_EID_KOREAN       =3,   STBTT_MAC_EID_RUSSIAN      =7\n};\n\nenum { // languageID for STBTT_PLATFORM_ID_MICROSOFT; same as LCID...\n       // problematic because there are e.g. 16 english LCIDs and 16 arabic LCIDs\n   STBTT_MS_LANG_ENGLISH     =0x0409,   STBTT_MS_LANG_ITALIAN     =0x0410,\n   STBTT_MS_LANG_CHINESE     =0x0804,   STBTT_MS_LANG_JAPANESE    =0x0411,\n   STBTT_MS_LANG_DUTCH       =0x0413,   STBTT_MS_LANG_KOREAN      =0x0412,\n   STBTT_MS_LANG_FRENCH      =0x040c,   STBTT_MS_LANG_RUSSIAN     =0x0419,\n   STBTT_MS_LANG_GERMAN      =0x0407,   STBTT_MS_LANG_SPANISH     =0x0409,\n   STBTT_MS_LANG_HEBREW      =0x040d,   STBTT_MS_LANG_SWEDISH     =0x041D\n};\n\nenum { // languageID for STBTT_PLATFORM_ID_MAC\n   STBTT_MAC_LANG_ENGLISH      =0 ,   STBTT_MAC_LANG_JAPANESE     =11,\n   STBTT_MAC_LANG_ARABIC       =12,   STBTT_MAC_LANG_KOREAN       =23,\n   STBTT_MAC_LANG_DUTCH        =4 ,   STBTT_MAC_LANG_RUSSIAN      =32,\n   STBTT_MAC_LANG_FRENCH       =1 ,   STBTT_MAC_LANG_SPANISH      =6 ,\n   STBTT_MAC_LANG_GERMAN       =2 ,   STBTT_MAC_LANG_SWEDISH      =5 ,\n   STBTT_MAC_LANG_HEBREW       =10,   STBTT_MAC_LANG_CHINESE_SIMPLIFIED =33,\n   STBTT_MAC_LANG_ITALIAN      =3 ,   STBTT_MAC_LANG_CHINESE_TRAD =19\n};\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif // __STB_INCLUDE_STB_TRUETYPE_H__\n\n///////////////////////////////////////////////////////////////////////////////\n///////////////////////////////////////////////////////////////////////////////\n////\n////   IMPLEMENTATION\n////\n////\n\n#ifdef STB_TRUETYPE_IMPLEMENTATION\n\n#ifndef STBTT_MAX_OVERSAMPLE\n#define STBTT_MAX_OVERSAMPLE   8\n#endif\n\n#if STBTT_MAX_OVERSAMPLE > 255\n#error \"STBTT_MAX_OVERSAMPLE cannot be > 255\"\n#endif\n\ntypedef int stbtt__test_oversample_pow2[(STBTT_MAX_OVERSAMPLE & (STBTT_MAX_OVERSAMPLE-1)) == 0 ? 1 : -1];\n\n#ifndef STBTT_RASTERIZER_VERSION\n#define STBTT_RASTERIZER_VERSION 2\n#endif\n\n#ifdef _MSC_VER\n#define STBTT__NOTUSED(v)  (void)(v)\n#else\n#define STBTT__NOTUSED(v)  (void)sizeof(v)\n#endif\n\n//////////////////////////////////////////////////////////////////////////\n//\n// stbtt__buf helpers to parse data from file\n//\n\nstatic stbtt_uint8 stbtt__buf_get8(stbtt__buf *b)\n{\n   if (b->cursor >= b->size)\n      return 0;\n   return b->data[b->cursor++];\n}\n\nstatic stbtt_uint8 stbtt__buf_peek8(stbtt__buf *b)\n{\n   if (b->cursor >= b->size)\n      return 0;\n   return b->data[b->cursor];\n}\n\nstatic void stbtt__buf_seek(stbtt__buf *b, int o)\n{\n   STBTT_assert(!(o > b->size || o < 0));\n   b->cursor = (o > b->size || o < 0) ? b->size : o;\n}\n\nstatic void stbtt__buf_skip(stbtt__buf *b, int o)\n{\n   stbtt__buf_seek(b, b->cursor + o);\n}\n\nstatic stbtt_uint32 stbtt__buf_get(stbtt__buf *b, int n)\n{\n   stbtt_uint32 v = 0;\n   int i;\n   STBTT_assert(n >= 1 && n <= 4);\n   for (i = 0; i < n; i++)\n      v = (v << 8) | stbtt__buf_get8(b);\n   return v;\n}\n\nstatic stbtt__buf stbtt__new_buf(const void *p, size_t size)\n{\n   stbtt__buf r;\n   STBTT_assert(size < 0x40000000);\n   r.data = (stbtt_uint8*) p;\n   r.size = (int) size;\n   r.cursor = 0;\n   return r;\n}\n\n#define stbtt__buf_get16(b)  stbtt__buf_get((b), 2)\n#define stbtt__buf_get32(b)  stbtt__buf_get((b), 4)\n\nstatic stbtt__buf stbtt__buf_range(const stbtt__buf *b, int o, int s)\n{\n   stbtt__buf r = stbtt__new_buf(NULL, 0);\n   if (o < 0 || s < 0 || o > b->size || s > b->size - o) return r;\n   r.data = b->data + o;\n   r.size = s;\n   return r;\n}\n\nstatic stbtt__buf stbtt__cff_get_index(stbtt__buf *b)\n{\n   int count, start, offsize;\n   start = b->cursor;\n   count = stbtt__buf_get16(b);\n   if (count) {\n      offsize = stbtt__buf_get8(b);\n      STBTT_assert(offsize >= 1 && offsize <= 4);\n      stbtt__buf_skip(b, offsize * count);\n      stbtt__buf_skip(b, stbtt__buf_get(b, offsize) - 1);\n   }\n   return stbtt__buf_range(b, start, b->cursor - start);\n}\n\nstatic stbtt_uint32 stbtt__cff_int(stbtt__buf *b)\n{\n   int b0 = stbtt__buf_get8(b);\n   if (b0 >= 32 && b0 <= 246)       return b0 - 139;\n   else if (b0 >= 247 && b0 <= 250) return (b0 - 247)*256 + stbtt__buf_get8(b) + 108;\n   else if (b0 >= 251 && b0 <= 254) return -(b0 - 251)*256 - stbtt__buf_get8(b) - 108;\n   else if (b0 == 28)               return stbtt__buf_get16(b);\n   else if (b0 == 29)               return stbtt__buf_get32(b);\n   STBTT_assert(0);\n   return 0;\n}\n\nstatic void stbtt__cff_skip_operand(stbtt__buf *b) {\n   int v, b0 = stbtt__buf_peek8(b);\n   STBTT_assert(b0 >= 28);\n   if (b0 == 30) {\n      stbtt__buf_skip(b, 1);\n      while (b->cursor < b->size) {\n         v = stbtt__buf_get8(b);\n         if ((v & 0xF) == 0xF || (v >> 4) == 0xF)\n            break;\n      }\n   } else {\n      stbtt__cff_int(b);\n   }\n}\n\nstatic stbtt__buf stbtt__dict_get(stbtt__buf *b, int key)\n{\n   stbtt__buf_seek(b, 0);\n   while (b->cursor < b->size) {\n      int start = b->cursor, end, op;\n      while (stbtt__buf_peek8(b) >= 28)\n         stbtt__cff_skip_operand(b);\n      end = b->cursor;\n      op = stbtt__buf_get8(b);\n      if (op == 12)  op = stbtt__buf_get8(b) | 0x100;\n      if (op == key) return stbtt__buf_range(b, start, end-start);\n   }\n   return stbtt__buf_range(b, 0, 0);\n}\n\nstatic void stbtt__dict_get_ints(stbtt__buf *b, int key, int outcount, stbtt_uint32 *out)\n{\n   int i;\n   stbtt__buf operands = stbtt__dict_get(b, key);\n   for (i = 0; i < outcount && operands.cursor < operands.size; i++)\n      out[i] = stbtt__cff_int(&operands);\n}\n\nstatic int stbtt__cff_index_count(stbtt__buf *b)\n{\n   stbtt__buf_seek(b, 0);\n   return stbtt__buf_get16(b);\n}\n\nstatic stbtt__buf stbtt__cff_index_get(stbtt__buf b, int i)\n{\n   int count, offsize, start, end;\n   stbtt__buf_seek(&b, 0);\n   count = stbtt__buf_get16(&b);\n   offsize = stbtt__buf_get8(&b);\n   STBTT_assert(i >= 0 && i < count);\n   STBTT_assert(offsize >= 1 && offsize <= 4);\n   stbtt__buf_skip(&b, i*offsize);\n   start = stbtt__buf_get(&b, offsize);\n   end = stbtt__buf_get(&b, offsize);\n   return stbtt__buf_range(&b, 2+(count+1)*offsize+start, end - start);\n}\n\n//////////////////////////////////////////////////////////////////////////\n//\n// accessors to parse data from file\n//\n\n// on platforms that don't allow misaligned reads, if we want to allow\n// truetype fonts that aren't padded to alignment, define ALLOW_UNALIGNED_TRUETYPE\n\n#define ttBYTE(p)     (* (stbtt_uint8 *) (p))\n#define ttCHAR(p)     (* (stbtt_int8 *) (p))\n#define ttFixed(p)    ttLONG(p)\n\nstatic stbtt_uint16 ttUSHORT(stbtt_uint8 *p) { return p[0]*256 + p[1]; }\nstatic stbtt_int16 ttSHORT(stbtt_uint8 *p)   { return p[0]*256 + p[1]; }\nstatic stbtt_uint32 ttULONG(stbtt_uint8 *p)  { return (p[0]<<24) + (p[1]<<16) + (p[2]<<8) + p[3]; }\nstatic stbtt_int32 ttLONG(stbtt_uint8 *p)    { return (p[0]<<24) + (p[1]<<16) + (p[2]<<8) + p[3]; }\n\n#define stbtt_tag4(p,c0,c1,c2,c3) ((p)[0] == (c0) && (p)[1] == (c1) && (p)[2] == (c2) && (p)[3] == (c3))\n#define stbtt_tag(p,str)           stbtt_tag4(p,str[0],str[1],str[2],str[3])\n\nstatic int stbtt__isfont(stbtt_uint8 *font)\n{\n   // check the version number\n   if (stbtt_tag4(font, '1',0,0,0))  return 1; // TrueType 1\n   if (stbtt_tag(font, \"typ1\"))   return 1; // TrueType with type 1 font -- we don't support this!\n   if (stbtt_tag(font, \"OTTO\"))   return 1; // OpenType with CFF\n   if (stbtt_tag4(font, 0,1,0,0)) return 1; // OpenType 1.0\n   if (stbtt_tag(font, \"true\"))   return 1; // Apple specification for TrueType fonts\n   return 0;\n}\n\n// @OPTIMIZE: binary search\nstatic stbtt_uint32 stbtt__find_table(stbtt_uint8 *data, stbtt_uint32 fontstart, const char *tag)\n{\n   stbtt_int32 num_tables = ttUSHORT(data+fontstart+4);\n   stbtt_uint32 tabledir = fontstart + 12;\n   stbtt_int32 i;\n   for (i=0; i < num_tables; ++i) {\n      stbtt_uint32 loc = tabledir + 16*i;\n      if (stbtt_tag(data+loc+0, tag))\n         return ttULONG(data+loc+8);\n   }\n   return 0;\n}\n\nstatic int stbtt_GetFontOffsetForIndex_internal(unsigned char *font_collection, int index)\n{\n   // if it's just a font, there's only one valid index\n   if (stbtt__isfont(font_collection))\n      return index == 0 ? 0 : -1;\n\n   // check if it's a TTC\n   if (stbtt_tag(font_collection, \"ttcf\")) {\n      // version 1?\n      if (ttULONG(font_collection+4) == 0x00010000 || ttULONG(font_collection+4) == 0x00020000) {\n         stbtt_int32 n = ttLONG(font_collection+8);\n         if (index >= n)\n            return -1;\n         return ttULONG(font_collection+12+index*4);\n      }\n   }\n   return -1;\n}\n\nstatic int stbtt_GetNumberOfFonts_internal(unsigned char *font_collection)\n{\n   // if it's just a font, there's only one valid font\n   if (stbtt__isfont(font_collection))\n      return 1;\n\n   // check if it's a TTC\n   if (stbtt_tag(font_collection, \"ttcf\")) {\n      // version 1?\n      if (ttULONG(font_collection+4) == 0x00010000 || ttULONG(font_collection+4) == 0x00020000) {\n         return ttLONG(font_collection+8);\n      }\n   }\n   return 0;\n}\n\nstatic stbtt__buf stbtt__get_subrs(stbtt__buf cff, stbtt__buf fontdict)\n{\n   stbtt_uint32 subrsoff = 0, private_loc[2] = { 0, 0 };\n   stbtt__buf pdict;\n   stbtt__dict_get_ints(&fontdict, 18, 2, private_loc);\n   if (!private_loc[1] || !private_loc[0]) return stbtt__new_buf(NULL, 0);\n   pdict = stbtt__buf_range(&cff, private_loc[1], private_loc[0]);\n   stbtt__dict_get_ints(&pdict, 19, 1, &subrsoff);\n   if (!subrsoff) return stbtt__new_buf(NULL, 0);\n   stbtt__buf_seek(&cff, private_loc[1]+subrsoff);\n   return stbtt__cff_get_index(&cff);\n}\n\nstatic int stbtt_InitFont_internal(stbtt_fontinfo *info, unsigned char *data, int fontstart)\n{\n   stbtt_uint32 cmap, t;\n   stbtt_int32 i,numTables;\n\n   info->data = data;\n   info->fontstart = fontstart;\n   info->cff = stbtt__new_buf(NULL, 0);\n\n   cmap = stbtt__find_table(data, fontstart, \"cmap\");       // required\n   info->loca = stbtt__find_table(data, fontstart, \"loca\"); // required\n   info->head = stbtt__find_table(data, fontstart, \"head\"); // required\n   info->glyf = stbtt__find_table(data, fontstart, \"glyf\"); // required\n   info->hhea = stbtt__find_table(data, fontstart, \"hhea\"); // required\n   info->hmtx = stbtt__find_table(data, fontstart, \"hmtx\"); // required\n   info->kern = stbtt__find_table(data, fontstart, \"kern\"); // not required\n   info->gpos = stbtt__find_table(data, fontstart, \"GPOS\"); // not required\n\n   if (!cmap || !info->head || !info->hhea || !info->hmtx)\n      return 0;\n   if (info->glyf) {\n      // required for truetype\n      if (!info->loca) return 0;\n   } else {\n      // initialization for CFF / Type2 fonts (OTF)\n      stbtt__buf b, topdict, topdictidx;\n      stbtt_uint32 cstype = 2, charstrings = 0, fdarrayoff = 0, fdselectoff = 0;\n      stbtt_uint32 cff;\n\n      cff = stbtt__find_table(data, fontstart, \"CFF \");\n      if (!cff) return 0;\n\n      info->fontdicts = stbtt__new_buf(NULL, 0);\n      info->fdselect = stbtt__new_buf(NULL, 0);\n\n      // @TODO this should use size from table (not 512MB)\n      info->cff = stbtt__new_buf(data+cff, 512*1024*1024);\n      b = info->cff;\n\n      // read the header\n      stbtt__buf_skip(&b, 2);\n      stbtt__buf_seek(&b, stbtt__buf_get8(&b)); // hdrsize\n\n      // @TODO the name INDEX could list multiple fonts,\n      // but we just use the first one.\n      stbtt__cff_get_index(&b);  // name INDEX\n      topdictidx = stbtt__cff_get_index(&b);\n      topdict = stbtt__cff_index_get(topdictidx, 0);\n      stbtt__cff_get_index(&b);  // string INDEX\n      info->gsubrs = stbtt__cff_get_index(&b);\n\n      stbtt__dict_get_ints(&topdict, 17, 1, &charstrings);\n      stbtt__dict_get_ints(&topdict, 0x100 | 6, 1, &cstype);\n      stbtt__dict_get_ints(&topdict, 0x100 | 36, 1, &fdarrayoff);\n      stbtt__dict_get_ints(&topdict, 0x100 | 37, 1, &fdselectoff);\n      info->subrs = stbtt__get_subrs(b, topdict);\n\n      // we only support Type 2 charstrings\n      if (cstype != 2) return 0;\n      if (charstrings == 0) return 0;\n\n      if (fdarrayoff) {\n         // looks like a CID font\n         if (!fdselectoff) return 0;\n         stbtt__buf_seek(&b, fdarrayoff);\n         info->fontdicts = stbtt__cff_get_index(&b);\n         info->fdselect = stbtt__buf_range(&b, fdselectoff, b.size-fdselectoff);\n      }\n\n      stbtt__buf_seek(&b, charstrings);\n      info->charstrings = stbtt__cff_get_index(&b);\n   }\n\n   t = stbtt__find_table(data, fontstart, \"maxp\");\n   if (t)\n      info->numGlyphs = ttUSHORT(data+t+4);\n   else\n      info->numGlyphs = 0xffff;\n\n   // find a cmap encoding table we understand *now* to avoid searching\n   // later. (todo: could make this installable)\n   // the same regardless of glyph.\n   numTables = ttUSHORT(data + cmap + 2);\n   info->index_map = 0;\n   for (i=0; i < numTables; ++i) {\n      stbtt_uint32 encoding_record = cmap + 4 + 8 * i;\n      // find an encoding we understand:\n      switch(ttUSHORT(data+encoding_record)) {\n         case STBTT_PLATFORM_ID_MICROSOFT:\n            switch (ttUSHORT(data+encoding_record+2)) {\n               case STBTT_MS_EID_UNICODE_BMP:\n               case STBTT_MS_EID_UNICODE_FULL:\n                  // MS/Unicode\n                  info->index_map = cmap + ttULONG(data+encoding_record+4);\n                  break;\n            }\n            break;\n        case STBTT_PLATFORM_ID_UNICODE:\n            // Mac/iOS has these\n            // all the encodingIDs are unicode, so we don't bother to check it\n            info->index_map = cmap + ttULONG(data+encoding_record+4);\n            break;\n      }\n   }\n   if (info->index_map == 0)\n      return 0;\n\n   info->indexToLocFormat = ttUSHORT(data+info->head + 50);\n   return 1;\n}\n\nSTBTT_DEF int stbtt_FindGlyphIndex(const stbtt_fontinfo *info, int unicode_codepoint)\n{\n   stbtt_uint8 *data = info->data;\n   stbtt_uint32 index_map = info->index_map;\n\n   stbtt_uint16 format = ttUSHORT(data + index_map + 0);\n   if (format == 0) { // apple byte encoding\n      stbtt_int32 bytes = ttUSHORT(data + index_map + 2);\n      if (unicode_codepoint < bytes-6)\n         return ttBYTE(data + index_map + 6 + unicode_codepoint);\n      return 0;\n   } else if (format == 6) {\n      stbtt_uint32 first = ttUSHORT(data + index_map + 6);\n      stbtt_uint32 count = ttUSHORT(data + index_map + 8);\n      if ((stbtt_uint32) unicode_codepoint >= first && (stbtt_uint32) unicode_codepoint < first+count)\n         return ttUSHORT(data + index_map + 10 + (unicode_codepoint - first)*2);\n      return 0;\n   } else if (format == 2) {\n      STBTT_assert(0); // @TODO: high-byte mapping for japanese/chinese/korean\n      return 0;\n   } else if (format == 4) { // standard mapping for windows fonts: binary search collection of ranges\n      stbtt_uint16 segcount = ttUSHORT(data+index_map+6) >> 1;\n      stbtt_uint16 searchRange = ttUSHORT(data+index_map+8) >> 1;\n      stbtt_uint16 entrySelector = ttUSHORT(data+index_map+10);\n      stbtt_uint16 rangeShift = ttUSHORT(data+index_map+12) >> 1;\n\n      // do a binary search of the segments\n      stbtt_uint32 endCount = index_map + 14;\n      stbtt_uint32 search = endCount;\n\n      if (unicode_codepoint > 0xffff)\n         return 0;\n\n      // they lie from endCount .. endCount + segCount\n      // but searchRange is the nearest power of two, so...\n      if (unicode_codepoint >= ttUSHORT(data + search + rangeShift*2))\n         search += rangeShift*2;\n\n      // now decrement to bias correctly to find smallest\n      search -= 2;\n      while (entrySelector) {\n         stbtt_uint16 end;\n         searchRange >>= 1;\n         end = ttUSHORT(data + search + searchRange*2);\n         if (unicode_codepoint > end)\n            search += searchRange*2;\n         --entrySelector;\n      }\n      search += 2;\n\n      {\n         stbtt_uint16 offset, start;\n         stbtt_uint16 item = (stbtt_uint16) ((search - endCount) >> 1);\n\n         STBTT_assert(unicode_codepoint <= ttUSHORT(data + endCount + 2*item));\n         start = ttUSHORT(data + index_map + 14 + segcount*2 + 2 + 2*item);\n         if (unicode_codepoint < start)\n            return 0;\n\n         offset = ttUSHORT(data + index_map + 14 + segcount*6 + 2 + 2*item);\n         if (offset == 0)\n            return (stbtt_uint16) (unicode_codepoint + ttSHORT(data + index_map + 14 + segcount*4 + 2 + 2*item));\n\n         return ttUSHORT(data + offset + (unicode_codepoint-start)*2 + index_map + 14 + segcount*6 + 2 + 2*item);\n      }\n   } else if (format == 12 || format == 13) {\n      stbtt_uint32 ngroups = ttULONG(data+index_map+12);\n      stbtt_int32 low,high;\n      low = 0; high = (stbtt_int32)ngroups;\n      // Binary search the right group.\n      while (low < high) {\n         stbtt_int32 mid = low + ((high-low) >> 1); // rounds down, so low <= mid < high\n         stbtt_uint32 start_char = ttULONG(data+index_map+16+mid*12);\n         stbtt_uint32 end_char = ttULONG(data+index_map+16+mid*12+4);\n         if ((stbtt_uint32) unicode_codepoint < start_char)\n            high = mid;\n         else if ((stbtt_uint32) unicode_codepoint > end_char)\n            low = mid+1;\n         else {\n            stbtt_uint32 start_glyph = ttULONG(data+index_map+16+mid*12+8);\n            if (format == 12)\n               return start_glyph + unicode_codepoint-start_char;\n            else // format == 13\n               return start_glyph;\n         }\n      }\n      return 0; // not found\n   }\n   // @TODO\n   STBTT_assert(0);\n   return 0;\n}\n\nSTBTT_DEF int stbtt_GetCodepointShape(const stbtt_fontinfo *info, int unicode_codepoint, stbtt_vertex **vertices)\n{\n   return stbtt_GetGlyphShape(info, stbtt_FindGlyphIndex(info, unicode_codepoint), vertices);\n}\n\nstatic void stbtt_setvertex(stbtt_vertex *v, stbtt_uint8 type, stbtt_int32 x, stbtt_int32 y, stbtt_int32 cx, stbtt_int32 cy)\n{\n   v->type = type;\n   v->x = (stbtt_int16) x;\n   v->y = (stbtt_int16) y;\n   v->cx = (stbtt_int16) cx;\n   v->cy = (stbtt_int16) cy;\n}\n\nstatic int stbtt__GetGlyfOffset(const stbtt_fontinfo *info, int glyph_index)\n{\n   int g1,g2;\n\n   STBTT_assert(!info->cff.size);\n\n   if (glyph_index >= info->numGlyphs) return -1; // glyph index out of range\n   if (info->indexToLocFormat >= 2)    return -1; // unknown index->glyph map format\n\n   if (info->indexToLocFormat == 0) {\n      g1 = info->glyf + ttUSHORT(info->data + info->loca + glyph_index * 2) * 2;\n      g2 = info->glyf + ttUSHORT(info->data + info->loca + glyph_index * 2 + 2) * 2;\n   } else {\n      g1 = info->glyf + ttULONG (info->data + info->loca + glyph_index * 4);\n      g2 = info->glyf + ttULONG (info->data + info->loca + glyph_index * 4 + 4);\n   }\n\n   return g1==g2 ? -1 : g1; // if length is 0, return -1\n}\n\nstatic int stbtt__GetGlyphInfoT2(const stbtt_fontinfo *info, int glyph_index, int *x0, int *y0, int *x1, int *y1);\n\nSTBTT_DEF int stbtt_GetGlyphBox(const stbtt_fontinfo *info, int glyph_index, int *x0, int *y0, int *x1, int *y1)\n{\n   if (info->cff.size) {\n      stbtt__GetGlyphInfoT2(info, glyph_index, x0, y0, x1, y1);\n   } else {\n      int g = stbtt__GetGlyfOffset(info, glyph_index);\n      if (g < 0) return 0;\n\n      if (x0) *x0 = ttSHORT(info->data + g + 2);\n      if (y0) *y0 = ttSHORT(info->data + g + 4);\n      if (x1) *x1 = ttSHORT(info->data + g + 6);\n      if (y1) *y1 = ttSHORT(info->data + g + 8);\n   }\n   return 1;\n}\n\nSTBTT_DEF int stbtt_GetCodepointBox(const stbtt_fontinfo *info, int codepoint, int *x0, int *y0, int *x1, int *y1)\n{\n   return stbtt_GetGlyphBox(info, stbtt_FindGlyphIndex(info,codepoint), x0,y0,x1,y1);\n}\n\nSTBTT_DEF int stbtt_IsGlyphEmpty(const stbtt_fontinfo *info, int glyph_index)\n{\n   stbtt_int16 numberOfContours;\n   int g;\n   if (info->cff.size)\n      return stbtt__GetGlyphInfoT2(info, glyph_index, NULL, NULL, NULL, NULL) == 0;\n   g = stbtt__GetGlyfOffset(info, glyph_index);\n   if (g < 0) return 1;\n   numberOfContours = ttSHORT(info->data + g);\n   return numberOfContours == 0;\n}\n\nstatic int stbtt__close_shape(stbtt_vertex *vertices, int num_vertices, int was_off, int start_off,\n    stbtt_int32 sx, stbtt_int32 sy, stbtt_int32 scx, stbtt_int32 scy, stbtt_int32 cx, stbtt_int32 cy)\n{\n   if (start_off) {\n      if (was_off)\n         stbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve, (cx+scx)>>1, (cy+scy)>>1, cx,cy);\n      stbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve, sx,sy,scx,scy);\n   } else {\n      if (was_off)\n         stbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve,sx,sy,cx,cy);\n      else\n         stbtt_setvertex(&vertices[num_vertices++], STBTT_vline,sx,sy,0,0);\n   }\n   return num_vertices;\n}\n\nstatic int stbtt__GetGlyphShapeTT(const stbtt_fontinfo *info, int glyph_index, stbtt_vertex **pvertices)\n{\n   stbtt_int16 numberOfContours;\n   stbtt_uint8 *endPtsOfContours;\n   stbtt_uint8 *data = info->data;\n   stbtt_vertex *vertices=0;\n   int num_vertices=0;\n   int g = stbtt__GetGlyfOffset(info, glyph_index);\n\n   *pvertices = NULL;\n\n   if (g < 0) return 0;\n\n   numberOfContours = ttSHORT(data + g);\n\n   if (numberOfContours > 0) {\n      stbtt_uint8 flags=0,flagcount;\n      stbtt_int32 ins, i,j=0,m,n, next_move, was_off=0, off, start_off=0;\n      stbtt_int32 x,y,cx,cy,sx,sy, scx,scy;\n      stbtt_uint8 *points;\n      endPtsOfContours = (data + g + 10);\n      ins = ttUSHORT(data + g + 10 + numberOfContours * 2);\n      points = data + g + 10 + numberOfContours * 2 + 2 + ins;\n\n      n = 1+ttUSHORT(endPtsOfContours + numberOfContours*2-2);\n\n      m = n + 2*numberOfContours;  // a loose bound on how many vertices we might need\n      vertices = (stbtt_vertex *) STBTT_malloc(m * sizeof(vertices[0]), info->userdata);\n      if (vertices == 0)\n         return 0;\n\n      next_move = 0;\n      flagcount=0;\n\n      // in first pass, we load uninterpreted data into the allocated array\n      // above, shifted to the end of the array so we won't overwrite it when\n      // we create our final data starting from the front\n\n      off = m - n; // starting offset for uninterpreted data, regardless of how m ends up being calculated\n\n      // first load flags\n\n      for (i=0; i < n; ++i) {\n         if (flagcount == 0) {\n            flags = *points++;\n            if (flags & 8)\n               flagcount = *points++;\n         } else\n            --flagcount;\n         vertices[off+i].type = flags;\n      }\n\n      // now load x coordinates\n      x=0;\n      for (i=0; i < n; ++i) {\n         flags = vertices[off+i].type;\n         if (flags & 2) {\n            stbtt_int16 dx = *points++;\n            x += (flags & 16) ? dx : -dx; // ???\n         } else {\n            if (!(flags & 16)) {\n               x = x + (stbtt_int16) (points[0]*256 + points[1]);\n               points += 2;\n            }\n         }\n         vertices[off+i].x = (stbtt_int16) x;\n      }\n\n      // now load y coordinates\n      y=0;\n      for (i=0; i < n; ++i) {\n         flags = vertices[off+i].type;\n         if (flags & 4) {\n            stbtt_int16 dy = *points++;\n            y += (flags & 32) ? dy : -dy; // ???\n         } else {\n            if (!(flags & 32)) {\n               y = y + (stbtt_int16) (points[0]*256 + points[1]);\n               points += 2;\n            }\n         }\n         vertices[off+i].y = (stbtt_int16) y;\n      }\n\n      // now convert them to our format\n      num_vertices=0;\n      sx = sy = cx = cy = scx = scy = 0;\n      for (i=0; i < n; ++i) {\n         flags = vertices[off+i].type;\n         x     = (stbtt_int16) vertices[off+i].x;\n         y     = (stbtt_int16) vertices[off+i].y;\n\n         if (next_move == i) {\n            if (i != 0)\n               num_vertices = stbtt__close_shape(vertices, num_vertices, was_off, start_off, sx,sy,scx,scy,cx,cy);\n\n            // now start the new one\n            start_off = !(flags & 1);\n            if (start_off) {\n               // if we start off with an off-curve point, then when we need to find a point on the curve\n               // where we can start, and we need to save some state for when we wraparound.\n               scx = x;\n               scy = y;\n               if (!(vertices[off+i+1].type & 1)) {\n                  // next point is also a curve point, so interpolate an on-point curve\n                  sx = (x + (stbtt_int32) vertices[off+i+1].x) >> 1;\n                  sy = (y + (stbtt_int32) vertices[off+i+1].y) >> 1;\n               } else {\n                  // otherwise just use the next point as our start point\n                  sx = (stbtt_int32) vertices[off+i+1].x;\n                  sy = (stbtt_int32) vertices[off+i+1].y;\n                  ++i; // we're using point i+1 as the starting point, so skip it\n               }\n            } else {\n               sx = x;\n               sy = y;\n            }\n            stbtt_setvertex(&vertices[num_vertices++], STBTT_vmove,sx,sy,0,0);\n            was_off = 0;\n            next_move = 1 + ttUSHORT(endPtsOfContours+j*2);\n            ++j;\n         } else {\n            if (!(flags & 1)) { // if it's a curve\n               if (was_off) // two off-curve control points in a row means interpolate an on-curve midpoint\n                  stbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve, (cx+x)>>1, (cy+y)>>1, cx, cy);\n               cx = x;\n               cy = y;\n               was_off = 1;\n            } else {\n               if (was_off)\n                  stbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve, x,y, cx, cy);\n               else\n                  stbtt_setvertex(&vertices[num_vertices++], STBTT_vline, x,y,0,0);\n               was_off = 0;\n            }\n         }\n      }\n      num_vertices = stbtt__close_shape(vertices, num_vertices, was_off, start_off, sx,sy,scx,scy,cx,cy);\n   } else if (numberOfContours == -1) {\n      // Compound shapes.\n      int more = 1;\n      stbtt_uint8 *comp = data + g + 10;\n      num_vertices = 0;\n      vertices = 0;\n      while (more) {\n         stbtt_uint16 flags, gidx;\n         int comp_num_verts = 0, i;\n         stbtt_vertex *comp_verts = 0, *tmp = 0;\n         float mtx[6] = {1,0,0,1,0,0}, m, n;\n\n         flags = ttSHORT(comp); comp+=2;\n         gidx = ttSHORT(comp); comp+=2;\n\n         if (flags & 2) { // XY values\n            if (flags & 1) { // shorts\n               mtx[4] = ttSHORT(comp); comp+=2;\n               mtx[5] = ttSHORT(comp); comp+=2;\n            } else {\n               mtx[4] = ttCHAR(comp); comp+=1;\n               mtx[5] = ttCHAR(comp); comp+=1;\n            }\n         }\n         else {\n            // @TODO handle matching point\n            STBTT_assert(0);\n         }\n         if (flags & (1<<3)) { // WE_HAVE_A_SCALE\n            mtx[0] = mtx[3] = ttSHORT(comp)/16384.0f; comp+=2;\n            mtx[1] = mtx[2] = 0;\n         } else if (flags & (1<<6)) { // WE_HAVE_AN_X_AND_YSCALE\n            mtx[0] = ttSHORT(comp)/16384.0f; comp+=2;\n            mtx[1] = mtx[2] = 0;\n            mtx[3] = ttSHORT(comp)/16384.0f; comp+=2;\n         } else if (flags & (1<<7)) { // WE_HAVE_A_TWO_BY_TWO\n            mtx[0] = ttSHORT(comp)/16384.0f; comp+=2;\n            mtx[1] = ttSHORT(comp)/16384.0f; comp+=2;\n            mtx[2] = ttSHORT(comp)/16384.0f; comp+=2;\n            mtx[3] = ttSHORT(comp)/16384.0f; comp+=2;\n         }\n\n         // Find transformation scales.\n         m = (float) STBTT_sqrt(mtx[0]*mtx[0] + mtx[1]*mtx[1]);\n         n = (float) STBTT_sqrt(mtx[2]*mtx[2] + mtx[3]*mtx[3]);\n\n         // Get indexed glyph.\n         comp_num_verts = stbtt_GetGlyphShape(info, gidx, &comp_verts);\n         if (comp_num_verts > 0) {\n            // Transform vertices.\n            for (i = 0; i < comp_num_verts; ++i) {\n               stbtt_vertex* v = &comp_verts[i];\n               stbtt_vertex_type x,y;\n               x=v->x; y=v->y;\n               v->x = (stbtt_vertex_type)(m * (mtx[0]*x + mtx[2]*y + mtx[4]));\n               v->y = (stbtt_vertex_type)(n * (mtx[1]*x + mtx[3]*y + mtx[5]));\n               x=v->cx; y=v->cy;\n               v->cx = (stbtt_vertex_type)(m * (mtx[0]*x + mtx[2]*y + mtx[4]));\n               v->cy = (stbtt_vertex_type)(n * (mtx[1]*x + mtx[3]*y + mtx[5]));\n            }\n            // Append vertices.\n            tmp = (stbtt_vertex*)STBTT_malloc((num_vertices+comp_num_verts)*sizeof(stbtt_vertex), info->userdata);\n            if (!tmp) {\n               if (vertices) STBTT_free(vertices, info->userdata);\n               if (comp_verts) STBTT_free(comp_verts, info->userdata);\n               return 0;\n            }\n            if (num_vertices > 0) STBTT_memcpy(tmp, vertices, num_vertices*sizeof(stbtt_vertex)); //-V595\n            STBTT_memcpy(tmp+num_vertices, comp_verts, comp_num_verts*sizeof(stbtt_vertex));\n            if (vertices) STBTT_free(vertices, info->userdata);\n            vertices = tmp;\n            STBTT_free(comp_verts, info->userdata);\n            num_vertices += comp_num_verts;\n         }\n         // More components ?\n         more = flags & (1<<5);\n      }\n   } else if (numberOfContours < 0) {\n      // @TODO other compound variations?\n      STBTT_assert(0);\n   } else {\n      // numberOfCounters == 0, do nothing\n   }\n\n   *pvertices = vertices;\n   return num_vertices;\n}\n\ntypedef struct\n{\n   int bounds;\n   int started;\n   float first_x, first_y;\n   float x, y;\n   stbtt_int32 min_x, max_x, min_y, max_y;\n\n   stbtt_vertex *pvertices;\n   int num_vertices;\n} stbtt__csctx;\n\n#define STBTT__CSCTX_INIT(bounds) {bounds,0, 0,0, 0,0, 0,0,0,0, NULL, 0}\n\nstatic void stbtt__track_vertex(stbtt__csctx *c, stbtt_int32 x, stbtt_int32 y)\n{\n   if (x > c->max_x || !c->started) c->max_x = x;\n   if (y > c->max_y || !c->started) c->max_y = y;\n   if (x < c->min_x || !c->started) c->min_x = x;\n   if (y < c->min_y || !c->started) c->min_y = y;\n   c->started = 1;\n}\n\nstatic void stbtt__csctx_v(stbtt__csctx *c, stbtt_uint8 type, stbtt_int32 x, stbtt_int32 y, stbtt_int32 cx, stbtt_int32 cy, stbtt_int32 cx1, stbtt_int32 cy1)\n{\n   if (c->bounds) {\n      stbtt__track_vertex(c, x, y);\n      if (type == STBTT_vcubic) {\n         stbtt__track_vertex(c, cx, cy);\n         stbtt__track_vertex(c, cx1, cy1);\n      }\n   } else {\n      stbtt_setvertex(&c->pvertices[c->num_vertices], type, x, y, cx, cy);\n      c->pvertices[c->num_vertices].cx1 = (stbtt_int16) cx1;\n      c->pvertices[c->num_vertices].cy1 = (stbtt_int16) cy1;\n   }\n   c->num_vertices++;\n}\n\nstatic void stbtt__csctx_close_shape(stbtt__csctx *ctx)\n{\n   if (ctx->first_x != ctx->x || ctx->first_y != ctx->y)\n      stbtt__csctx_v(ctx, STBTT_vline, (int)ctx->first_x, (int)ctx->first_y, 0, 0, 0, 0);\n}\n\nstatic void stbtt__csctx_rmove_to(stbtt__csctx *ctx, float dx, float dy)\n{\n   stbtt__csctx_close_shape(ctx);\n   ctx->first_x = ctx->x = ctx->x + dx;\n   ctx->first_y = ctx->y = ctx->y + dy;\n   stbtt__csctx_v(ctx, STBTT_vmove, (int)ctx->x, (int)ctx->y, 0, 0, 0, 0);\n}\n\nstatic void stbtt__csctx_rline_to(stbtt__csctx *ctx, float dx, float dy)\n{\n   ctx->x += dx;\n   ctx->y += dy;\n   stbtt__csctx_v(ctx, STBTT_vline, (int)ctx->x, (int)ctx->y, 0, 0, 0, 0);\n}\n\nstatic void stbtt__csctx_rccurve_to(stbtt__csctx *ctx, float dx1, float dy1, float dx2, float dy2, float dx3, float dy3)\n{\n   float cx1 = ctx->x + dx1;\n   float cy1 = ctx->y + dy1;\n   float cx2 = cx1 + dx2;\n   float cy2 = cy1 + dy2;\n   ctx->x = cx2 + dx3;\n   ctx->y = cy2 + dy3;\n   stbtt__csctx_v(ctx, STBTT_vcubic, (int)ctx->x, (int)ctx->y, (int)cx1, (int)cy1, (int)cx2, (int)cy2);\n}\n\nstatic stbtt__buf stbtt__get_subr(stbtt__buf idx, int n)\n{\n   int count = stbtt__cff_index_count(&idx);\n   int bias = 107;\n   if (count >= 33900)\n      bias = 32768;\n   else if (count >= 1240)\n      bias = 1131;\n   n += bias;\n   if (n < 0 || n >= count)\n      return stbtt__new_buf(NULL, 0);\n   return stbtt__cff_index_get(idx, n);\n}\n\nstatic stbtt__buf stbtt__cid_get_glyph_subrs(const stbtt_fontinfo *info, int glyph_index)\n{\n   stbtt__buf fdselect = info->fdselect;\n   int nranges, start, end, v, fmt, fdselector = -1, i;\n\n   stbtt__buf_seek(&fdselect, 0);\n   fmt = stbtt__buf_get8(&fdselect);\n   if (fmt == 0) {\n      // untested\n      stbtt__buf_skip(&fdselect, glyph_index);\n      fdselector = stbtt__buf_get8(&fdselect);\n   } else if (fmt == 3) {\n      nranges = stbtt__buf_get16(&fdselect);\n      start = stbtt__buf_get16(&fdselect);\n      for (i = 0; i < nranges; i++) {\n         v = stbtt__buf_get8(&fdselect);\n         end = stbtt__buf_get16(&fdselect);\n         if (glyph_index >= start && glyph_index < end) {\n            fdselector = v;\n            break;\n         }\n         start = end;\n      }\n   }\n   if (fdselector == -1) stbtt__new_buf(NULL, 0);\n   return stbtt__get_subrs(info->cff, stbtt__cff_index_get(info->fontdicts, fdselector));\n}\n\nstatic int stbtt__run_charstring(const stbtt_fontinfo *info, int glyph_index, stbtt__csctx *c)\n{\n   int in_header = 1, maskbits = 0, subr_stack_height = 0, sp = 0, v, i, b0;\n   int has_subrs = 0, clear_stack;\n   float s[48];\n   stbtt__buf subr_stack[10], subrs = info->subrs, b;\n   float f;\n\n#define STBTT__CSERR(s) (0)\n\n   // this currently ignores the initial width value, which isn't needed if we have hmtx\n   b = stbtt__cff_index_get(info->charstrings, glyph_index);\n   while (b.cursor < b.size) {\n      i = 0;\n      clear_stack = 1;\n      b0 = stbtt__buf_get8(&b);\n      switch (b0) {\n      // @TODO implement hinting\n      case 0x13: // hintmask\n      case 0x14: // cntrmask\n         if (in_header)\n            maskbits += (sp / 2); // implicit \"vstem\"\n         in_header = 0;\n         stbtt__buf_skip(&b, (maskbits + 7) / 8);\n         break;\n\n      case 0x01: // hstem\n      case 0x03: // vstem\n      case 0x12: // hstemhm\n      case 0x17: // vstemhm\n         maskbits += (sp / 2);\n         break;\n\n      case 0x15: // rmoveto\n         in_header = 0;\n         if (sp < 2) return STBTT__CSERR(\"rmoveto stack\");\n         stbtt__csctx_rmove_to(c, s[sp-2], s[sp-1]);\n         break;\n      case 0x04: // vmoveto\n         in_header = 0;\n         if (sp < 1) return STBTT__CSERR(\"vmoveto stack\");\n         stbtt__csctx_rmove_to(c, 0, s[sp-1]);\n         break;\n      case 0x16: // hmoveto\n         in_header = 0;\n         if (sp < 1) return STBTT__CSERR(\"hmoveto stack\");\n         stbtt__csctx_rmove_to(c, s[sp-1], 0);\n         break;\n\n      case 0x05: // rlineto\n         if (sp < 2) return STBTT__CSERR(\"rlineto stack\");\n         for (; i + 1 < sp; i += 2)\n            stbtt__csctx_rline_to(c, s[i], s[i+1]);\n         break;\n\n      // hlineto/vlineto and vhcurveto/hvcurveto alternate horizontal and vertical\n      // starting from a different place.\n\n      case 0x07: // vlineto\n         if (sp < 1) return STBTT__CSERR(\"vlineto stack\");\n         goto vlineto;\n      case 0x06: // hlineto\n         if (sp < 1) return STBTT__CSERR(\"hlineto stack\");\n         for (;;) {\n            if (i >= sp) break;\n            stbtt__csctx_rline_to(c, s[i], 0);\n            i++;\n      vlineto:\n            if (i >= sp) break;\n            stbtt__csctx_rline_to(c, 0, s[i]);\n            i++;\n         }\n         break;\n\n      case 0x1F: // hvcurveto\n         if (sp < 4) return STBTT__CSERR(\"hvcurveto stack\");\n         goto hvcurveto;\n      case 0x1E: // vhcurveto\n         if (sp < 4) return STBTT__CSERR(\"vhcurveto stack\");\n         for (;;) {\n            if (i + 3 >= sp) break;\n            stbtt__csctx_rccurve_to(c, 0, s[i], s[i+1], s[i+2], s[i+3], (sp - i == 5) ? s[i + 4] : 0.0f);\n            i += 4;\n      hvcurveto:\n            if (i + 3 >= sp) break;\n            stbtt__csctx_rccurve_to(c, s[i], 0, s[i+1], s[i+2], (sp - i == 5) ? s[i+4] : 0.0f, s[i+3]);\n            i += 4;\n         }\n         break;\n\n      case 0x08: // rrcurveto\n         if (sp < 6) return STBTT__CSERR(\"rcurveline stack\");\n         for (; i + 5 < sp; i += 6)\n            stbtt__csctx_rccurve_to(c, s[i], s[i+1], s[i+2], s[i+3], s[i+4], s[i+5]);\n         break;\n\n      case 0x18: // rcurveline\n         if (sp < 8) return STBTT__CSERR(\"rcurveline stack\");\n         for (; i + 5 < sp - 2; i += 6)\n            stbtt__csctx_rccurve_to(c, s[i], s[i+1], s[i+2], s[i+3], s[i+4], s[i+5]);\n         if (i + 1 >= sp) return STBTT__CSERR(\"rcurveline stack\");\n         stbtt__csctx_rline_to(c, s[i], s[i+1]);\n         break;\n\n      case 0x19: // rlinecurve\n         if (sp < 8) return STBTT__CSERR(\"rlinecurve stack\");\n         for (; i + 1 < sp - 6; i += 2)\n            stbtt__csctx_rline_to(c, s[i], s[i+1]);\n         if (i + 5 >= sp) return STBTT__CSERR(\"rlinecurve stack\");\n         stbtt__csctx_rccurve_to(c, s[i], s[i+1], s[i+2], s[i+3], s[i+4], s[i+5]);\n         break;\n\n      case 0x1A: // vvcurveto\n      case 0x1B: // hhcurveto\n         if (sp < 4) return STBTT__CSERR(\"(vv|hh)curveto stack\");\n         f = 0.0;\n         if (sp & 1) { f = s[i]; i++; }\n         for (; i + 3 < sp; i += 4) {\n            if (b0 == 0x1B)\n               stbtt__csctx_rccurve_to(c, s[i], f, s[i+1], s[i+2], s[i+3], 0.0);\n            else\n               stbtt__csctx_rccurve_to(c, f, s[i], s[i+1], s[i+2], 0.0, s[i+3]);\n            f = 0.0;\n         }\n         break;\n\n      case 0x0A: // callsubr\n         if (!has_subrs) {\n            if (info->fdselect.size)\n               subrs = stbtt__cid_get_glyph_subrs(info, glyph_index);\n            has_subrs = 1;\n         }\n         // fallthrough\n      case 0x1D: // callgsubr\n         if (sp < 1) return STBTT__CSERR(\"call(g|)subr stack\");\n         v = (int) s[--sp];\n         if (subr_stack_height >= 10) return STBTT__CSERR(\"recursion limit\");\n         subr_stack[subr_stack_height++] = b;\n         b = stbtt__get_subr(b0 == 0x0A ? subrs : info->gsubrs, v);\n         if (b.size == 0) return STBTT__CSERR(\"subr not found\");\n         b.cursor = 0;\n         clear_stack = 0;\n         break;\n\n      case 0x0B: // return\n         if (subr_stack_height <= 0) return STBTT__CSERR(\"return outside subr\");\n         b = subr_stack[--subr_stack_height];\n         clear_stack = 0;\n         break;\n\n      case 0x0E: // endchar\n         stbtt__csctx_close_shape(c);\n         return 1;\n\n      case 0x0C: { // two-byte escape\n         float dx1, dx2, dx3, dx4, dx5, dx6, dy1, dy2, dy3, dy4, dy5, dy6;\n         float dx, dy;\n         int b1 = stbtt__buf_get8(&b);\n         switch (b1) {\n         // @TODO These \"flex\" implementations ignore the flex-depth and resolution,\n         // and always draw beziers.\n         case 0x22: // hflex\n            if (sp < 7) return STBTT__CSERR(\"hflex stack\");\n            dx1 = s[0];\n            dx2 = s[1];\n            dy2 = s[2];\n            dx3 = s[3];\n            dx4 = s[4];\n            dx5 = s[5];\n            dx6 = s[6];\n            stbtt__csctx_rccurve_to(c, dx1, 0, dx2, dy2, dx3, 0);\n            stbtt__csctx_rccurve_to(c, dx4, 0, dx5, -dy2, dx6, 0);\n            break;\n\n         case 0x23: // flex\n            if (sp < 13) return STBTT__CSERR(\"flex stack\");\n            dx1 = s[0];\n            dy1 = s[1];\n            dx2 = s[2];\n            dy2 = s[3];\n            dx3 = s[4];\n            dy3 = s[5];\n            dx4 = s[6];\n            dy4 = s[7];\n            dx5 = s[8];\n            dy5 = s[9];\n            dx6 = s[10];\n            dy6 = s[11];\n            //fd is s[12]\n            stbtt__csctx_rccurve_to(c, dx1, dy1, dx2, dy2, dx3, dy3);\n            stbtt__csctx_rccurve_to(c, dx4, dy4, dx5, dy5, dx6, dy6);\n            break;\n\n         case 0x24: // hflex1\n            if (sp < 9) return STBTT__CSERR(\"hflex1 stack\");\n            dx1 = s[0];\n            dy1 = s[1];\n            dx2 = s[2];\n            dy2 = s[3];\n            dx3 = s[4];\n            dx4 = s[5];\n            dx5 = s[6];\n            dy5 = s[7];\n            dx6 = s[8];\n            stbtt__csctx_rccurve_to(c, dx1, dy1, dx2, dy2, dx3, 0);\n            stbtt__csctx_rccurve_to(c, dx4, 0, dx5, dy5, dx6, -(dy1+dy2+dy5));\n            break;\n\n         case 0x25: // flex1\n            if (sp < 11) return STBTT__CSERR(\"flex1 stack\");\n            dx1 = s[0];\n            dy1 = s[1];\n            dx2 = s[2];\n            dy2 = s[3];\n            dx3 = s[4];\n            dy3 = s[5];\n            dx4 = s[6];\n            dy4 = s[7];\n            dx5 = s[8];\n            dy5 = s[9];\n            dx6 = dy6 = s[10];\n            dx = dx1+dx2+dx3+dx4+dx5;\n            dy = dy1+dy2+dy3+dy4+dy5;\n            if (STBTT_fabs(dx) > STBTT_fabs(dy))\n               dy6 = -dy;\n            else\n               dx6 = -dx;\n            stbtt__csctx_rccurve_to(c, dx1, dy1, dx2, dy2, dx3, dy3);\n            stbtt__csctx_rccurve_to(c, dx4, dy4, dx5, dy5, dx6, dy6);\n            break;\n\n         default:\n            return STBTT__CSERR(\"unimplemented\");\n         }\n      } break;\n\n      default:\n         if (b0 != 255 && b0 != 28 && (b0 < 32 || b0 > 254)) //-V560\n            return STBTT__CSERR(\"reserved operator\");\n\n         // push immediate\n         if (b0 == 255) {\n            f = (float)(stbtt_int32)stbtt__buf_get32(&b) / 0x10000;\n         } else {\n            stbtt__buf_skip(&b, -1);\n            f = (float)(stbtt_int16)stbtt__cff_int(&b);\n         }\n         if (sp >= 48) return STBTT__CSERR(\"push stack overflow\");\n         s[sp++] = f;\n         clear_stack = 0;\n         break;\n      }\n      if (clear_stack) sp = 0;\n   }\n   return STBTT__CSERR(\"no endchar\");\n\n#undef STBTT__CSERR\n}\n\nstatic int stbtt__GetGlyphShapeT2(const stbtt_fontinfo *info, int glyph_index, stbtt_vertex **pvertices)\n{\n   // runs the charstring twice, once to count and once to output (to avoid realloc)\n   stbtt__csctx count_ctx = STBTT__CSCTX_INIT(1);\n   stbtt__csctx output_ctx = STBTT__CSCTX_INIT(0);\n   if (stbtt__run_charstring(info, glyph_index, &count_ctx)) {\n      *pvertices = (stbtt_vertex*)STBTT_malloc(count_ctx.num_vertices*sizeof(stbtt_vertex), info->userdata);\n      output_ctx.pvertices = *pvertices;\n      if (stbtt__run_charstring(info, glyph_index, &output_ctx)) {\n         STBTT_assert(output_ctx.num_vertices == count_ctx.num_vertices);\n         return output_ctx.num_vertices;\n      }\n   }\n   *pvertices = NULL;\n   return 0;\n}\n\nstatic int stbtt__GetGlyphInfoT2(const stbtt_fontinfo *info, int glyph_index, int *x0, int *y0, int *x1, int *y1)\n{\n   stbtt__csctx c = STBTT__CSCTX_INIT(1);\n   int r = stbtt__run_charstring(info, glyph_index, &c);\n   if (x0)  *x0 = r ? c.min_x : 0;\n   if (y0)  *y0 = r ? c.min_y : 0;\n   if (x1)  *x1 = r ? c.max_x : 0;\n   if (y1)  *y1 = r ? c.max_y : 0;\n   return r ? c.num_vertices : 0;\n}\n\nSTBTT_DEF int stbtt_GetGlyphShape(const stbtt_fontinfo *info, int glyph_index, stbtt_vertex **pvertices)\n{\n   if (!info->cff.size)\n      return stbtt__GetGlyphShapeTT(info, glyph_index, pvertices);\n   else\n      return stbtt__GetGlyphShapeT2(info, glyph_index, pvertices);\n}\n\nSTBTT_DEF void stbtt_GetGlyphHMetrics(const stbtt_fontinfo *info, int glyph_index, int *advanceWidth, int *leftSideBearing)\n{\n   stbtt_uint16 numOfLongHorMetrics = ttUSHORT(info->data+info->hhea + 34);\n   if (glyph_index < numOfLongHorMetrics) {\n      if (advanceWidth)     *advanceWidth    = ttSHORT(info->data + info->hmtx + 4*glyph_index);\n      if (leftSideBearing)  *leftSideBearing = ttSHORT(info->data + info->hmtx + 4*glyph_index + 2);\n   } else {\n      if (advanceWidth)     *advanceWidth    = ttSHORT(info->data + info->hmtx + 4*(numOfLongHorMetrics-1));\n      if (leftSideBearing)  *leftSideBearing = ttSHORT(info->data + info->hmtx + 4*numOfLongHorMetrics + 2*(glyph_index - numOfLongHorMetrics));\n   }\n}\n\nstatic int  stbtt__GetGlyphKernInfoAdvance(const stbtt_fontinfo *info, int glyph1, int glyph2)\n{\n   stbtt_uint8 *data = info->data + info->kern;\n   stbtt_uint32 needle, straw;\n   int l, r, m;\n\n   // we only look at the first table. it must be 'horizontal' and format 0.\n   if (!info->kern)\n      return 0;\n   if (ttUSHORT(data+2) < 1) // number of tables, need at least 1\n      return 0;\n   if (ttUSHORT(data+8) != 1) // horizontal flag must be set in format\n      return 0;\n\n   l = 0;\n   r = ttUSHORT(data+10) - 1;\n   needle = glyph1 << 16 | glyph2;\n   while (l <= r) {\n      m = (l + r) >> 1;\n      straw = ttULONG(data+18+(m*6)); // note: unaligned read\n      if (needle < straw)\n         r = m - 1;\n      else if (needle > straw)\n         l = m + 1;\n      else\n         return ttSHORT(data+22+(m*6));\n   }\n   return 0;\n}\n\nstatic stbtt_int32  stbtt__GetCoverageIndex(stbtt_uint8 *coverageTable, int glyph)\n{\n    stbtt_uint16 coverageFormat = ttUSHORT(coverageTable);\n    switch(coverageFormat) {\n        case 1: {\n            stbtt_uint16 glyphCount = ttUSHORT(coverageTable + 2);\n\n            // Binary search.\n            stbtt_int32 l=0, r=glyphCount-1, m;\n            int straw, needle=glyph;\n            while (l <= r) {\n                stbtt_uint8 *glyphArray = coverageTable + 4;\n                stbtt_uint16 glyphID;\n                m = (l + r) >> 1;\n                glyphID = ttUSHORT(glyphArray + 2 * m);\n                straw = glyphID;\n                if (needle < straw)\n                    r = m - 1;\n                else if (needle > straw)\n                    l = m + 1;\n                else {\n                     return m;\n                }\n            }\n        } break;\n\n        case 2: {\n            stbtt_uint16 rangeCount = ttUSHORT(coverageTable + 2);\n            stbtt_uint8 *rangeArray = coverageTable + 4;\n\n            // Binary search.\n            stbtt_int32 l=0, r=rangeCount-1, m;\n            int strawStart, strawEnd, needle=glyph;\n            while (l <= r) {\n                stbtt_uint8 *rangeRecord;\n                m = (l + r) >> 1;\n                rangeRecord = rangeArray + 6 * m;\n                strawStart = ttUSHORT(rangeRecord);\n                strawEnd = ttUSHORT(rangeRecord + 2);\n                if (needle < strawStart)\n                    r = m - 1;\n                else if (needle > strawEnd)\n                    l = m + 1;\n                else {\n                    stbtt_uint16 startCoverageIndex = ttUSHORT(rangeRecord + 4);\n                    return startCoverageIndex + glyph - strawStart;\n                }\n            }\n        } break;\n\n        default: {\n            // There are no other cases.\n            STBTT_assert(0);\n        } break;\n    }\n\n    return -1;\n}\n\nstatic stbtt_int32  stbtt__GetGlyphClass(stbtt_uint8 *classDefTable, int glyph)\n{\n    stbtt_uint16 classDefFormat = ttUSHORT(classDefTable);\n    switch(classDefFormat)\n    {\n        case 1: {\n            stbtt_uint16 startGlyphID = ttUSHORT(classDefTable + 2);\n            stbtt_uint16 glyphCount = ttUSHORT(classDefTable + 4);\n            stbtt_uint8 *classDef1ValueArray = classDefTable + 6;\n\n            if (glyph >= startGlyphID && glyph < startGlyphID + glyphCount)\n                return (stbtt_int32)ttUSHORT(classDef1ValueArray + 2 * (glyph - startGlyphID));\n\n            // [DEAR IMGUI] Commented to fix static analyzer warning\n            //classDefTable = classDef1ValueArray + 2 * glyphCount;\n        } break;\n\n        case 2: {\n            stbtt_uint16 classRangeCount = ttUSHORT(classDefTable + 2);\n            stbtt_uint8 *classRangeRecords = classDefTable + 4;\n\n            // Binary search.\n            stbtt_int32 l=0, r=classRangeCount-1, m;\n            int strawStart, strawEnd, needle=glyph;\n            while (l <= r) {\n                stbtt_uint8 *classRangeRecord;\n                m = (l + r) >> 1;\n                classRangeRecord = classRangeRecords + 6 * m;\n                strawStart = ttUSHORT(classRangeRecord);\n                strawEnd = ttUSHORT(classRangeRecord + 2);\n                if (needle < strawStart)\n                    r = m - 1;\n                else if (needle > strawEnd)\n                    l = m + 1;\n                else\n                    return (stbtt_int32)ttUSHORT(classRangeRecord + 4);\n            }\n\n            // [DEAR IMGUI] Commented to fix static analyzer warning\n            //classDefTable = classRangeRecords + 6 * classRangeCount;\n        } break;\n\n        default: {\n            // There are no other cases.\n            STBTT_assert(0);\n        } break;\n    }\n\n    return -1;\n}\n\n// Define to STBTT_assert(x) if you want to break on unimplemented formats.\n#define STBTT_GPOS_TODO_assert(x)\n\nstatic stbtt_int32  stbtt__GetGlyphGPOSInfoAdvance(const stbtt_fontinfo *info, int glyph1, int glyph2)\n{\n    stbtt_uint16 lookupListOffset;\n    stbtt_uint8 *lookupList;\n    stbtt_uint16 lookupCount;\n    stbtt_uint8 *data;\n    stbtt_int32 i;\n\n    if (!info->gpos) return 0;\n\n    data = info->data + info->gpos;\n\n    if (ttUSHORT(data+0) != 1) return 0; // Major version 1\n    if (ttUSHORT(data+2) != 0) return 0; // Minor version 0\n\n    lookupListOffset = ttUSHORT(data+8);\n    lookupList = data + lookupListOffset;\n    lookupCount = ttUSHORT(lookupList);\n\n    for (i=0; i<lookupCount; ++i) {\n        stbtt_uint16 lookupOffset = ttUSHORT(lookupList + 2 + 2 * i);\n        stbtt_uint8 *lookupTable = lookupList + lookupOffset;\n\n        stbtt_uint16 lookupType = ttUSHORT(lookupTable);\n        stbtt_uint16 subTableCount = ttUSHORT(lookupTable + 4);\n        stbtt_uint8 *subTableOffsets = lookupTable + 6;\n        switch(lookupType) {\n            case 2: { // Pair Adjustment Positioning Subtable\n                stbtt_int32 sti;\n                for (sti=0; sti<subTableCount; sti++) {\n                    stbtt_uint16 subtableOffset = ttUSHORT(subTableOffsets + 2 * sti);\n                    stbtt_uint8 *table = lookupTable + subtableOffset;\n                    stbtt_uint16 posFormat = ttUSHORT(table);\n                    stbtt_uint16 coverageOffset = ttUSHORT(table + 2);\n                    stbtt_int32 coverageIndex = stbtt__GetCoverageIndex(table + coverageOffset, glyph1);\n                    if (coverageIndex == -1) continue;\n\n                    switch (posFormat) {\n                        case 1: {\n                            stbtt_int32 l, r, m;\n                            int straw, needle;\n                            stbtt_uint16 valueFormat1 = ttUSHORT(table + 4);\n                            stbtt_uint16 valueFormat2 = ttUSHORT(table + 6);\n                            stbtt_int32 valueRecordPairSizeInBytes = 2;\n                            stbtt_uint16 pairSetCount = ttUSHORT(table + 8);\n                            stbtt_uint16 pairPosOffset = ttUSHORT(table + 10 + 2 * coverageIndex);\n                            stbtt_uint8 *pairValueTable = table + pairPosOffset;\n                            stbtt_uint16 pairValueCount = ttUSHORT(pairValueTable);\n                            stbtt_uint8 *pairValueArray = pairValueTable + 2;\n                            // TODO: Support more formats.\n                            STBTT_GPOS_TODO_assert(valueFormat1 == 4);\n                            if (valueFormat1 != 4) return 0;\n                            STBTT_GPOS_TODO_assert(valueFormat2 == 0);\n                            if (valueFormat2 != 0) return 0;\n\n                            STBTT_assert(coverageIndex < pairSetCount);\n                            STBTT__NOTUSED(pairSetCount);\n\n                            needle=glyph2;\n                            r=pairValueCount-1;\n                            l=0;\n\n                            // Binary search.\n                            while (l <= r) {\n                                stbtt_uint16 secondGlyph;\n                                stbtt_uint8 *pairValue;\n                                m = (l + r) >> 1;\n                                pairValue = pairValueArray + (2 + valueRecordPairSizeInBytes) * m;\n                                secondGlyph = ttUSHORT(pairValue);\n                                straw = secondGlyph;\n                                if (needle < straw)\n                                    r = m - 1;\n                                else if (needle > straw)\n                                    l = m + 1;\n                                else {\n                                    stbtt_int16 xAdvance = ttSHORT(pairValue + 2);\n                                    return xAdvance;\n                                }\n                            }\n                        } break;\n\n                        case 2: {\n                            stbtt_uint16 valueFormat1 = ttUSHORT(table + 4);\n                            stbtt_uint16 valueFormat2 = ttUSHORT(table + 6);\n\n                            stbtt_uint16 classDef1Offset = ttUSHORT(table + 8);\n                            stbtt_uint16 classDef2Offset = ttUSHORT(table + 10);\n                            int glyph1class = stbtt__GetGlyphClass(table + classDef1Offset, glyph1);\n                            int glyph2class = stbtt__GetGlyphClass(table + classDef2Offset, glyph2);\n\n                            stbtt_uint16 class1Count = ttUSHORT(table + 12);\n                            stbtt_uint16 class2Count = ttUSHORT(table + 14);\n                            STBTT_assert(glyph1class < class1Count);\n                            STBTT_assert(glyph2class < class2Count);\n\n                            // TODO: Support more formats.\n                            STBTT_GPOS_TODO_assert(valueFormat1 == 4);\n                            if (valueFormat1 != 4) return 0;\n                            STBTT_GPOS_TODO_assert(valueFormat2 == 0);\n                            if (valueFormat2 != 0) return 0;\n\n                            if (glyph1class >= 0 && glyph1class < class1Count && glyph2class >= 0 && glyph2class < class2Count) {\n                                stbtt_uint8 *class1Records = table + 16;\n                                stbtt_uint8 *class2Records = class1Records + 2 * (glyph1class * class2Count);\n                                stbtt_int16 xAdvance = ttSHORT(class2Records + 2 * glyph2class);\n                                return xAdvance;\n                            }\n                        } break;\n\n                        default: {\n                            // There are no other cases.\n                            STBTT_assert(0);\n                            break;\n                        } // [DEAR IMGUI] removed ;\n                    }\n                }\n                break;\n            } // [DEAR IMGUI] removed ;\n\n            default:\n                // TODO: Implement other stuff.\n                break;\n        }\n    }\n\n    return 0;\n}\n\nSTBTT_DEF int  stbtt_GetGlyphKernAdvance(const stbtt_fontinfo *info, int g1, int g2)\n{\n   int xAdvance = 0;\n\n   if (info->gpos)\n      xAdvance += stbtt__GetGlyphGPOSInfoAdvance(info, g1, g2);\n\n   if (info->kern)\n      xAdvance += stbtt__GetGlyphKernInfoAdvance(info, g1, g2);\n\n   return xAdvance;\n}\n\nSTBTT_DEF int  stbtt_GetCodepointKernAdvance(const stbtt_fontinfo *info, int ch1, int ch2)\n{\n   if (!info->kern && !info->gpos) // if no kerning table, don't waste time looking up both codepoint->glyphs\n      return 0;\n   return stbtt_GetGlyphKernAdvance(info, stbtt_FindGlyphIndex(info,ch1), stbtt_FindGlyphIndex(info,ch2));\n}\n\nSTBTT_DEF void stbtt_GetCodepointHMetrics(const stbtt_fontinfo *info, int codepoint, int *advanceWidth, int *leftSideBearing)\n{\n   stbtt_GetGlyphHMetrics(info, stbtt_FindGlyphIndex(info,codepoint), advanceWidth, leftSideBearing);\n}\n\nSTBTT_DEF void stbtt_GetFontVMetrics(const stbtt_fontinfo *info, int *ascent, int *descent, int *lineGap)\n{\n   if (ascent ) *ascent  = ttSHORT(info->data+info->hhea + 4);\n   if (descent) *descent = ttSHORT(info->data+info->hhea + 6);\n   if (lineGap) *lineGap = ttSHORT(info->data+info->hhea + 8);\n}\n\nSTBTT_DEF int  stbtt_GetFontVMetricsOS2(const stbtt_fontinfo *info, int *typoAscent, int *typoDescent, int *typoLineGap)\n{\n   int tab = stbtt__find_table(info->data, info->fontstart, \"OS/2\");\n   if (!tab)\n      return 0;\n   if (typoAscent ) *typoAscent  = ttSHORT(info->data+tab + 68);\n   if (typoDescent) *typoDescent = ttSHORT(info->data+tab + 70);\n   if (typoLineGap) *typoLineGap = ttSHORT(info->data+tab + 72);\n   return 1;\n}\n\nSTBTT_DEF void stbtt_GetFontBoundingBox(const stbtt_fontinfo *info, int *x0, int *y0, int *x1, int *y1)\n{\n   *x0 = ttSHORT(info->data + info->head + 36);\n   *y0 = ttSHORT(info->data + info->head + 38);\n   *x1 = ttSHORT(info->data + info->head + 40);\n   *y1 = ttSHORT(info->data + info->head + 42);\n}\n\nSTBTT_DEF float stbtt_ScaleForPixelHeight(const stbtt_fontinfo *info, float height)\n{\n   int fheight = ttSHORT(info->data + info->hhea + 4) - ttSHORT(info->data + info->hhea + 6);\n   return (float) height / fheight;\n}\n\nSTBTT_DEF float stbtt_ScaleForMappingEmToPixels(const stbtt_fontinfo *info, float pixels)\n{\n   int unitsPerEm = ttUSHORT(info->data + info->head + 18);\n   return pixels / unitsPerEm;\n}\n\nSTBTT_DEF void stbtt_FreeShape(const stbtt_fontinfo *info, stbtt_vertex *v)\n{\n   STBTT_free(v, info->userdata);\n}\n\n//////////////////////////////////////////////////////////////////////////////\n//\n// antialiasing software rasterizer\n//\n\nSTBTT_DEF void stbtt_GetGlyphBitmapBoxSubpixel(const stbtt_fontinfo *font, int glyph, float scale_x, float scale_y,float shift_x, float shift_y, int *ix0, int *iy0, int *ix1, int *iy1)\n{\n   int x0=0,y0=0,x1,y1; // =0 suppresses compiler warning\n   if (!stbtt_GetGlyphBox(font, glyph, &x0,&y0,&x1,&y1)) {\n      // e.g. space character\n      if (ix0) *ix0 = 0;\n      if (iy0) *iy0 = 0;\n      if (ix1) *ix1 = 0;\n      if (iy1) *iy1 = 0;\n   } else {\n      // move to integral bboxes (treating pixels as little squares, what pixels get touched)?\n      if (ix0) *ix0 = STBTT_ifloor( x0 * scale_x + shift_x);\n      if (iy0) *iy0 = STBTT_ifloor(-y1 * scale_y + shift_y);\n      if (ix1) *ix1 = STBTT_iceil ( x1 * scale_x + shift_x);\n      if (iy1) *iy1 = STBTT_iceil (-y0 * scale_y + shift_y);\n   }\n}\n\nSTBTT_DEF void stbtt_GetGlyphBitmapBox(const stbtt_fontinfo *font, int glyph, float scale_x, float scale_y, int *ix0, int *iy0, int *ix1, int *iy1)\n{\n   stbtt_GetGlyphBitmapBoxSubpixel(font, glyph, scale_x, scale_y,0.0f,0.0f, ix0, iy0, ix1, iy1);\n}\n\nSTBTT_DEF void stbtt_GetCodepointBitmapBoxSubpixel(const stbtt_fontinfo *font, int codepoint, float scale_x, float scale_y, float shift_x, float shift_y, int *ix0, int *iy0, int *ix1, int *iy1)\n{\n   stbtt_GetGlyphBitmapBoxSubpixel(font, stbtt_FindGlyphIndex(font,codepoint), scale_x, scale_y,shift_x,shift_y, ix0,iy0,ix1,iy1);\n}\n\nSTBTT_DEF void stbtt_GetCodepointBitmapBox(const stbtt_fontinfo *font, int codepoint, float scale_x, float scale_y, int *ix0, int *iy0, int *ix1, int *iy1)\n{\n   stbtt_GetCodepointBitmapBoxSubpixel(font, codepoint, scale_x, scale_y,0.0f,0.0f, ix0,iy0,ix1,iy1);\n}\n\n//////////////////////////////////////////////////////////////////////////////\n//\n//  Rasterizer\n\ntypedef struct stbtt__hheap_chunk\n{\n   struct stbtt__hheap_chunk *next;\n} stbtt__hheap_chunk;\n\ntypedef struct stbtt__hheap\n{\n   struct stbtt__hheap_chunk *head;\n   void   *first_free;\n   int    num_remaining_in_head_chunk;\n} stbtt__hheap;\n\nstatic void *stbtt__hheap_alloc(stbtt__hheap *hh, size_t size, void *userdata)\n{\n   if (hh->first_free) {\n      void *p = hh->first_free;\n      hh->first_free = * (void **) p;\n      return p;\n   } else {\n      if (hh->num_remaining_in_head_chunk == 0) {\n         int count = (size < 32 ? 2000 : size < 128 ? 800 : 100);\n         stbtt__hheap_chunk *c = (stbtt__hheap_chunk *) STBTT_malloc(sizeof(stbtt__hheap_chunk) + size * count, userdata);\n         if (c == NULL)\n            return NULL;\n         c->next = hh->head;\n         hh->head = c;\n         hh->num_remaining_in_head_chunk = count;\n      }\n      --hh->num_remaining_in_head_chunk;\n      return (char *) (hh->head) + sizeof(stbtt__hheap_chunk) + size * hh->num_remaining_in_head_chunk;\n   }\n}\n\nstatic void stbtt__hheap_free(stbtt__hheap *hh, void *p)\n{\n   *(void **) p = hh->first_free;\n   hh->first_free = p;\n}\n\nstatic void stbtt__hheap_cleanup(stbtt__hheap *hh, void *userdata)\n{\n   stbtt__hheap_chunk *c = hh->head;\n   while (c) {\n      stbtt__hheap_chunk *n = c->next;\n      STBTT_free(c, userdata);\n      c = n;\n   }\n}\n\ntypedef struct stbtt__edge {\n   float x0,y0, x1,y1;\n   int invert;\n} stbtt__edge;\n\n\ntypedef struct stbtt__active_edge\n{\n   struct stbtt__active_edge *next;\n   #if STBTT_RASTERIZER_VERSION==1\n   int x,dx;\n   float ey;\n   int direction;\n   #elif STBTT_RASTERIZER_VERSION==2\n   float fx,fdx,fdy;\n   float direction;\n   float sy;\n   float ey;\n   #else\n   #error \"Unrecognized value of STBTT_RASTERIZER_VERSION\"\n   #endif\n} stbtt__active_edge;\n\n#if STBTT_RASTERIZER_VERSION == 1\n#define STBTT_FIXSHIFT   10\n#define STBTT_FIX        (1 << STBTT_FIXSHIFT)\n#define STBTT_FIXMASK    (STBTT_FIX-1)\n\nstatic stbtt__active_edge *stbtt__new_active(stbtt__hheap *hh, stbtt__edge *e, int off_x, float start_point, void *userdata)\n{\n   stbtt__active_edge *z = (stbtt__active_edge *) stbtt__hheap_alloc(hh, sizeof(*z), userdata);\n   float dxdy = (e->x1 - e->x0) / (e->y1 - e->y0);\n   STBTT_assert(z != NULL);\n   if (!z) return z;\n\n   // round dx down to avoid overshooting\n   if (dxdy < 0)\n      z->dx = -STBTT_ifloor(STBTT_FIX * -dxdy);\n   else\n      z->dx = STBTT_ifloor(STBTT_FIX * dxdy);\n\n   z->x = STBTT_ifloor(STBTT_FIX * e->x0 + z->dx * (start_point - e->y0)); // use z->dx so when we offset later it's by the same amount\n   z->x -= off_x * STBTT_FIX;\n\n   z->ey = e->y1;\n   z->next = 0;\n   z->direction = e->invert ? 1 : -1;\n   return z;\n}\n#elif STBTT_RASTERIZER_VERSION == 2\nstatic stbtt__active_edge *stbtt__new_active(stbtt__hheap *hh, stbtt__edge *e, int off_x, float start_point, void *userdata)\n{\n   stbtt__active_edge *z = (stbtt__active_edge *) stbtt__hheap_alloc(hh, sizeof(*z), userdata);\n   float dxdy = (e->x1 - e->x0) / (e->y1 - e->y0);\n   STBTT_assert(z != NULL);\n   //STBTT_assert(e->y0 <= start_point);\n   if (!z) return z;\n   z->fdx = dxdy;\n   z->fdy = dxdy != 0.0f ? (1.0f/dxdy) : 0.0f;\n   z->fx = e->x0 + dxdy * (start_point - e->y0);\n   z->fx -= off_x;\n   z->direction = e->invert ? 1.0f : -1.0f;\n   z->sy = e->y0;\n   z->ey = e->y1;\n   z->next = 0;\n   return z;\n}\n#else\n#error \"Unrecognized value of STBTT_RASTERIZER_VERSION\"\n#endif\n\n#if STBTT_RASTERIZER_VERSION == 1\n// note: this routine clips fills that extend off the edges... ideally this\n// wouldn't happen, but it could happen if the truetype glyph bounding boxes\n// are wrong, or if the user supplies a too-small bitmap\nstatic void stbtt__fill_active_edges(unsigned char *scanline, int len, stbtt__active_edge *e, int max_weight)\n{\n   // non-zero winding fill\n   int x0=0, w=0;\n\n   while (e) {\n      if (w == 0) {\n         // if we're currently at zero, we need to record the edge start point\n         x0 = e->x; w += e->direction;\n      } else {\n         int x1 = e->x; w += e->direction;\n         // if we went to zero, we need to draw\n         if (w == 0) {\n            int i = x0 >> STBTT_FIXSHIFT;\n            int j = x1 >> STBTT_FIXSHIFT;\n\n            if (i < len && j >= 0) {\n               if (i == j) {\n                  // x0,x1 are the same pixel, so compute combined coverage\n                  scanline[i] = scanline[i] + (stbtt_uint8) ((x1 - x0) * max_weight >> STBTT_FIXSHIFT);\n               } else {\n                  if (i >= 0) // add antialiasing for x0\n                     scanline[i] = scanline[i] + (stbtt_uint8) (((STBTT_FIX - (x0 & STBTT_FIXMASK)) * max_weight) >> STBTT_FIXSHIFT);\n                  else\n                     i = -1; // clip\n\n                  if (j < len) // add antialiasing for x1\n                     scanline[j] = scanline[j] + (stbtt_uint8) (((x1 & STBTT_FIXMASK) * max_weight) >> STBTT_FIXSHIFT);\n                  else\n                     j = len; // clip\n\n                  for (++i; i < j; ++i) // fill pixels between x0 and x1\n                     scanline[i] = scanline[i] + (stbtt_uint8) max_weight;\n               }\n            }\n         }\n      }\n\n      e = e->next;\n   }\n}\n\nstatic void stbtt__rasterize_sorted_edges(stbtt__bitmap *result, stbtt__edge *e, int n, int vsubsample, int off_x, int off_y, void *userdata)\n{\n   stbtt__hheap hh = { 0, 0, 0 };\n   stbtt__active_edge *active = NULL;\n   int y,j=0;\n   int max_weight = (255 / vsubsample);  // weight per vertical scanline\n   int s; // vertical subsample index\n   unsigned char scanline_data[512], *scanline;\n\n   if (result->w > 512)\n      scanline = (unsigned char *) STBTT_malloc(result->w, userdata);\n   else\n      scanline = scanline_data;\n\n   y = off_y * vsubsample;\n   e[n].y0 = (off_y + result->h) * (float) vsubsample + 1;\n\n   while (j < result->h) {\n      STBTT_memset(scanline, 0, result->w);\n      for (s=0; s < vsubsample; ++s) {\n         // find center of pixel for this scanline\n         float scan_y = y + 0.5f;\n         stbtt__active_edge **step = &active;\n\n         // update all active edges;\n         // remove all active edges that terminate before the center of this scanline\n         while (*step) {\n            stbtt__active_edge * z = *step;\n            if (z->ey <= scan_y) {\n               *step = z->next; // delete from list\n               STBTT_assert(z->direction);\n               z->direction = 0;\n               stbtt__hheap_free(&hh, z);\n            } else {\n               z->x += z->dx; // advance to position for current scanline\n               step = &((*step)->next); // advance through list\n            }\n         }\n\n         // resort the list if needed\n         for(;;) {\n            int changed=0;\n            step = &active;\n            while (*step && (*step)->next) {\n               if ((*step)->x > (*step)->next->x) {\n                  stbtt__active_edge *t = *step;\n                  stbtt__active_edge *q = t->next;\n\n                  t->next = q->next;\n                  q->next = t;\n                  *step = q;\n                  changed = 1;\n               }\n               step = &(*step)->next;\n            }\n            if (!changed) break;\n         }\n\n         // insert all edges that start before the center of this scanline -- omit ones that also end on this scanline\n         while (e->y0 <= scan_y) {\n            if (e->y1 > scan_y) {\n               stbtt__active_edge *z = stbtt__new_active(&hh, e, off_x, scan_y, userdata);\n               if (z != NULL) {\n                  // find insertion point\n                  if (active == NULL)\n                     active = z;\n                  else if (z->x < active->x) {\n                     // insert at front\n                     z->next = active;\n                     active = z;\n                  } else {\n                     // find thing to insert AFTER\n                     stbtt__active_edge *p = active;\n                     while (p->next && p->next->x < z->x)\n                        p = p->next;\n                     // at this point, p->next->x is NOT < z->x\n                     z->next = p->next;\n                     p->next = z;\n                  }\n               }\n            }\n            ++e;\n         }\n\n         // now process all active edges in XOR fashion\n         if (active)\n            stbtt__fill_active_edges(scanline, result->w, active, max_weight);\n\n         ++y;\n      }\n      STBTT_memcpy(result->pixels + j * result->stride, scanline, result->w);\n      ++j;\n   }\n\n   stbtt__hheap_cleanup(&hh, userdata);\n\n   if (scanline != scanline_data)\n      STBTT_free(scanline, userdata);\n}\n\n#elif STBTT_RASTERIZER_VERSION == 2\n\n// the edge passed in here does not cross the vertical line at x or the vertical line at x+1\n// (i.e. it has already been clipped to those)\nstatic void stbtt__handle_clipped_edge(float *scanline, int x, stbtt__active_edge *e, float x0, float y0, float x1, float y1)\n{\n   if (y0 == y1) return;\n   STBTT_assert(y0 < y1);\n   STBTT_assert(e->sy <= e->ey);\n   if (y0 > e->ey) return;\n   if (y1 < e->sy) return;\n   if (y0 < e->sy) {\n      x0 += (x1-x0) * (e->sy - y0) / (y1-y0);\n      y0 = e->sy;\n   }\n   if (y1 > e->ey) {\n      x1 += (x1-x0) * (e->ey - y1) / (y1-y0);\n      y1 = e->ey;\n   }\n\n   if (x0 == x)\n      STBTT_assert(x1 <= x+1);\n   else if (x0 == x+1)\n      STBTT_assert(x1 >= x);\n   else if (x0 <= x)\n      STBTT_assert(x1 <= x);\n   else if (x0 >= x+1)\n      STBTT_assert(x1 >= x+1);\n   else\n      STBTT_assert(x1 >= x && x1 <= x+1);\n\n   if (x0 <= x && x1 <= x)\n      scanline[x] += e->direction * (y1-y0);\n   else if (x0 >= x+1 && x1 >= x+1)\n      ;\n   else {\n      STBTT_assert(x0 >= x && x0 <= x+1 && x1 >= x && x1 <= x+1);\n      scanline[x] += e->direction * (y1-y0) * (1-((x0-x)+(x1-x))/2); // coverage = 1 - average x position\n   }\n}\n\nstatic void stbtt__fill_active_edges_new(float *scanline, float *scanline_fill, int len, stbtt__active_edge *e, float y_top)\n{\n   float y_bottom = y_top+1;\n\n   while (e) {\n      // brute force every pixel\n\n      // compute intersection points with top & bottom\n      STBTT_assert(e->ey >= y_top);\n\n      if (e->fdx == 0) {\n         float x0 = e->fx;\n         if (x0 < len) {\n            if (x0 >= 0) {\n               stbtt__handle_clipped_edge(scanline,(int) x0,e, x0,y_top, x0,y_bottom);\n               stbtt__handle_clipped_edge(scanline_fill-1,(int) x0+1,e, x0,y_top, x0,y_bottom);\n            } else {\n               stbtt__handle_clipped_edge(scanline_fill-1,0,e, x0,y_top, x0,y_bottom);\n            }\n         }\n      } else {\n         float x0 = e->fx;\n         float dx = e->fdx;\n         float xb = x0 + dx;\n         float x_top, x_bottom;\n         float sy0,sy1;\n         float dy = e->fdy;\n         STBTT_assert(e->sy <= y_bottom && e->ey >= y_top);\n\n         // compute endpoints of line segment clipped to this scanline (if the\n         // line segment starts on this scanline. x0 is the intersection of the\n         // line with y_top, but that may be off the line segment.\n         if (e->sy > y_top) {\n            x_top = x0 + dx * (e->sy - y_top);\n            sy0 = e->sy;\n         } else {\n            x_top = x0;\n            sy0 = y_top;\n         }\n         if (e->ey < y_bottom) {\n            x_bottom = x0 + dx * (e->ey - y_top);\n            sy1 = e->ey;\n         } else {\n            x_bottom = xb;\n            sy1 = y_bottom;\n         }\n\n         if (x_top >= 0 && x_bottom >= 0 && x_top < len && x_bottom < len) {\n            // from here on, we don't have to range check x values\n\n            if ((int) x_top == (int) x_bottom) {\n               float height;\n               // simple case, only spans one pixel\n               int x = (int) x_top;\n               height = sy1 - sy0;\n               STBTT_assert(x >= 0 && x < len);\n               scanline[x] += e->direction * (1-((x_top - x) + (x_bottom-x))/2)  * height;\n               scanline_fill[x] += e->direction * height; // everything right of this pixel is filled\n            } else {\n               int x,x1,x2;\n               float y_crossing, step, sign, area;\n               // covers 2+ pixels\n               if (x_top > x_bottom) {\n                  // flip scanline vertically; signed area is the same\n                  float t;\n                  sy0 = y_bottom - (sy0 - y_top);\n                  sy1 = y_bottom - (sy1 - y_top);\n                  t = sy0, sy0 = sy1, sy1 = t;\n                  t = x_bottom, x_bottom = x_top, x_top = t;\n                  dx = -dx;\n                  dy = -dy;\n                  t = x0, x0 = xb, xb = t;\n                  // [DEAR IMGUI] Fix static analyzer warning\n                  (void)dx; // [ImGui: fix static analyzer warning]\n               }\n\n               x1 = (int) x_top;\n               x2 = (int) x_bottom;\n               // compute intersection with y axis at x1+1\n               y_crossing = (x1+1 - x0) * dy + y_top;\n\n               sign = e->direction;\n               // area of the rectangle covered from y0..y_crossing\n               area = sign * (y_crossing-sy0);\n               // area of the triangle (x_top,y0), (x+1,y0), (x+1,y_crossing)\n               scanline[x1] += area * (1-((x_top - x1)+(x1+1-x1))/2);\n\n               step = sign * dy;\n               for (x = x1+1; x < x2; ++x) {\n                  scanline[x] += area + step/2;\n                  area += step;\n               }\n               y_crossing += dy * (x2 - (x1+1));\n\n               STBTT_assert(STBTT_fabs(area) <= 1.01f);\n\n               scanline[x2] += area + sign * (1-((x2-x2)+(x_bottom-x2))/2) * (sy1-y_crossing);\n\n               scanline_fill[x2] += sign * (sy1-sy0);\n            }\n         } else {\n            // if edge goes outside of box we're drawing, we require\n            // clipping logic. since this does not match the intended use\n            // of this library, we use a different, very slow brute\n            // force implementation\n            int x;\n            for (x=0; x < len; ++x) {\n               // cases:\n               //\n               // there can be up to two intersections with the pixel. any intersection\n               // with left or right edges can be handled by splitting into two (or three)\n               // regions. intersections with top & bottom do not necessitate case-wise logic.\n               //\n               // the old way of doing this found the intersections with the left & right edges,\n               // then used some simple logic to produce up to three segments in sorted order\n               // from top-to-bottom. however, this had a problem: if an x edge was epsilon\n               // across the x border, then the corresponding y position might not be distinct\n               // from the other y segment, and it might ignored as an empty segment. to avoid\n               // that, we need to explicitly produce segments based on x positions.\n\n               // rename variables to clearly-defined pairs\n               float y0 = y_top;\n               float x1 = (float) (x);\n               float x2 = (float) (x+1);\n               float x3 = xb;\n               float y3 = y_bottom;\n\n               // x = e->x + e->dx * (y-y_top)\n               // (y-y_top) = (x - e->x) / e->dx\n               // y = (x - e->x) / e->dx + y_top\n               float y1 = (x - x0) / dx + y_top;\n               float y2 = (x+1 - x0) / dx + y_top;\n\n               if (x0 < x1 && x3 > x2) {         // three segments descending down-right\n                  stbtt__handle_clipped_edge(scanline,x,e, x0,y0, x1,y1);\n                  stbtt__handle_clipped_edge(scanline,x,e, x1,y1, x2,y2);\n                  stbtt__handle_clipped_edge(scanline,x,e, x2,y2, x3,y3);\n               } else if (x3 < x1 && x0 > x2) {  // three segments descending down-left\n                  stbtt__handle_clipped_edge(scanline,x,e, x0,y0, x2,y2);\n                  stbtt__handle_clipped_edge(scanline,x,e, x2,y2, x1,y1);\n                  stbtt__handle_clipped_edge(scanline,x,e, x1,y1, x3,y3);\n               } else if (x0 < x1 && x3 > x1) {  // two segments across x, down-right\n                  stbtt__handle_clipped_edge(scanline,x,e, x0,y0, x1,y1);\n                  stbtt__handle_clipped_edge(scanline,x,e, x1,y1, x3,y3);\n               } else if (x3 < x1 && x0 > x1) {  // two segments across x, down-left\n                  stbtt__handle_clipped_edge(scanline,x,e, x0,y0, x1,y1);\n                  stbtt__handle_clipped_edge(scanline,x,e, x1,y1, x3,y3);\n               } else if (x0 < x2 && x3 > x2) {  // two segments across x+1, down-right\n                  stbtt__handle_clipped_edge(scanline,x,e, x0,y0, x2,y2);\n                  stbtt__handle_clipped_edge(scanline,x,e, x2,y2, x3,y3);\n               } else if (x3 < x2 && x0 > x2) {  // two segments across x+1, down-left\n                  stbtt__handle_clipped_edge(scanline,x,e, x0,y0, x2,y2);\n                  stbtt__handle_clipped_edge(scanline,x,e, x2,y2, x3,y3);\n               } else {  // one segment\n                  stbtt__handle_clipped_edge(scanline,x,e, x0,y0, x3,y3);\n               }\n            }\n         }\n      }\n      e = e->next;\n   }\n}\n\n// directly AA rasterize edges w/o supersampling\nstatic void stbtt__rasterize_sorted_edges(stbtt__bitmap *result, stbtt__edge *e, int n, int vsubsample, int off_x, int off_y, void *userdata)\n{\n   stbtt__hheap hh = { 0, 0, 0 };\n   stbtt__active_edge *active = NULL;\n   int y,j=0, i;\n   float scanline_data[129], *scanline, *scanline2;\n\n   STBTT__NOTUSED(vsubsample);\n\n   if (result->w > 64)\n      scanline = (float *) STBTT_malloc((result->w*2+1) * sizeof(float), userdata);\n   else\n      scanline = scanline_data;\n\n   scanline2 = scanline + result->w;\n\n   y = off_y;\n   e[n].y0 = (float) (off_y + result->h) + 1;\n\n   while (j < result->h) {\n      // find center of pixel for this scanline\n      float scan_y_top    = y + 0.0f;\n      float scan_y_bottom = y + 1.0f;\n      stbtt__active_edge **step = &active;\n\n      STBTT_memset(scanline , 0, result->w*sizeof(scanline[0]));\n      STBTT_memset(scanline2, 0, (result->w+1)*sizeof(scanline[0]));\n\n      // update all active edges;\n      // remove all active edges that terminate before the top of this scanline\n      while (*step) {\n         stbtt__active_edge * z = *step;\n         if (z->ey <= scan_y_top) {\n            *step = z->next; // delete from list\n            STBTT_assert(z->direction);\n            z->direction = 0;\n            stbtt__hheap_free(&hh, z);\n         } else {\n            step = &((*step)->next); // advance through list\n         }\n      }\n\n      // insert all edges that start before the bottom of this scanline\n      while (e->y0 <= scan_y_bottom) {\n         if (e->y0 != e->y1) {\n            stbtt__active_edge *z = stbtt__new_active(&hh, e, off_x, scan_y_top, userdata);\n            if (z != NULL) {\n               if (j == 0 && off_y != 0) {\n                  if (z->ey < scan_y_top) {\n                     // this can happen due to subpixel positioning and some kind of fp rounding error i think\n                     z->ey = scan_y_top;\n                  }\n               }\n               STBTT_assert(z->ey >= scan_y_top); // if we get really unlucky a tiny bit of an edge can be out of bounds\n               // insert at front\n               z->next = active;\n               active = z;\n            }\n         }\n         ++e;\n      }\n\n      // now process all active edges\n      if (active)\n         stbtt__fill_active_edges_new(scanline, scanline2+1, result->w, active, scan_y_top);\n\n      {\n         float sum = 0;\n         for (i=0; i < result->w; ++i) {\n            float k;\n            int m;\n            sum += scanline2[i];\n            k = scanline[i] + sum;\n            k = (float) STBTT_fabs(k)*255 + 0.5f;\n            m = (int) k;\n            if (m > 255) m = 255;\n            result->pixels[j*result->stride + i] = (unsigned char) m;\n         }\n      }\n      // advance all the edges\n      step = &active;\n      while (*step) {\n         stbtt__active_edge *z = *step;\n         z->fx += z->fdx; // advance to position for current scanline\n         step = &((*step)->next); // advance through list\n      }\n\n      ++y;\n      ++j;\n   }\n\n   stbtt__hheap_cleanup(&hh, userdata);\n\n   if (scanline != scanline_data)\n      STBTT_free(scanline, userdata);\n}\n#else\n#error \"Unrecognized value of STBTT_RASTERIZER_VERSION\"\n#endif\n\n#define STBTT__COMPARE(a,b)  ((a)->y0 < (b)->y0)\n\nstatic void stbtt__sort_edges_ins_sort(stbtt__edge *p, int n)\n{\n   int i,j;\n   for (i=1; i < n; ++i) {\n      stbtt__edge t = p[i], *a = &t;\n      j = i;\n      while (j > 0) {\n         stbtt__edge *b = &p[j-1];\n         int c = STBTT__COMPARE(a,b);\n         if (!c) break;\n         p[j] = p[j-1];\n         --j;\n      }\n      if (i != j)\n         p[j] = t;\n   }\n}\n\nstatic void stbtt__sort_edges_quicksort(stbtt__edge *p, int n)\n{\n   /* threshold for transitioning to insertion sort */\n   while (n > 12) {\n      stbtt__edge t;\n      int c01,c12,c,m,i,j;\n\n      /* compute median of three */\n      m = n >> 1;\n      c01 = STBTT__COMPARE(&p[0],&p[m]);\n      c12 = STBTT__COMPARE(&p[m],&p[n-1]);\n      /* if 0 >= mid >= end, or 0 < mid < end, then use mid */\n      if (c01 != c12) {\n         /* otherwise, we'll need to swap something else to middle */\n         int z;\n         c = STBTT__COMPARE(&p[0],&p[n-1]);\n         /* 0>mid && mid<n:  0>n => n; 0<n => 0 */\n         /* 0<mid && mid>n:  0>n => 0; 0<n => n */\n         z = (c == c12) ? 0 : n-1;\n         t = p[z];\n         p[z] = p[m];\n         p[m] = t;\n      }\n      /* now p[m] is the median-of-three */\n      /* swap it to the beginning so it won't move around */\n      t = p[0];\n      p[0] = p[m];\n      p[m] = t;\n\n      /* partition loop */\n      i=1;\n      j=n-1;\n      for(;;) {\n         /* handling of equality is crucial here */\n         /* for sentinels & efficiency with duplicates */\n         for (;;++i) {\n            if (!STBTT__COMPARE(&p[i], &p[0])) break;\n         }\n         for (;;--j) {\n            if (!STBTT__COMPARE(&p[0], &p[j])) break;\n         }\n         /* make sure we haven't crossed */\n         if (i >= j) break;\n         t = p[i];\n         p[i] = p[j];\n         p[j] = t;\n\n         ++i;\n         --j;\n      }\n      /* recurse on smaller side, iterate on larger */\n      if (j < (n-i)) {\n         stbtt__sort_edges_quicksort(p,j);\n         p = p+i;\n         n = n-i;\n      } else {\n         stbtt__sort_edges_quicksort(p+i, n-i);\n         n = j;\n      }\n   }\n}\n\nstatic void stbtt__sort_edges(stbtt__edge *p, int n)\n{\n   stbtt__sort_edges_quicksort(p, n);\n   stbtt__sort_edges_ins_sort(p, n);\n}\n\ntypedef struct\n{\n   float x,y;\n} stbtt__point;\n\nstatic void stbtt__rasterize(stbtt__bitmap *result, stbtt__point *pts, int *wcount, int windings, float scale_x, float scale_y, float shift_x, float shift_y, int off_x, int off_y, int invert, void *userdata)\n{\n   float y_scale_inv = invert ? -scale_y : scale_y;\n   stbtt__edge *e;\n   int n,i,j,k,m;\n#if STBTT_RASTERIZER_VERSION == 1\n   int vsubsample = result->h < 8 ? 15 : 5;\n#elif STBTT_RASTERIZER_VERSION == 2\n   int vsubsample = 1;\n#else\n   #error \"Unrecognized value of STBTT_RASTERIZER_VERSION\"\n#endif\n   // vsubsample should divide 255 evenly; otherwise we won't reach full opacity\n\n   // now we have to blow out the windings into explicit edge lists\n   n = 0;\n   for (i=0; i < windings; ++i)\n      n += wcount[i];\n\n   e = (stbtt__edge *) STBTT_malloc(sizeof(*e) * (n+1), userdata); // add an extra one as a sentinel\n   if (e == 0) return;\n   n = 0;\n\n   m=0;\n   for (i=0; i < windings; ++i) {\n      stbtt__point *p = pts + m;\n      m += wcount[i];\n      j = wcount[i]-1;\n      for (k=0; k < wcount[i]; j=k++) {\n         int a=k,b=j;\n         // skip the edge if horizontal\n         if (p[j].y == p[k].y)\n            continue;\n         // add edge from j to k to the list\n         e[n].invert = 0;\n         if (invert ? p[j].y > p[k].y : p[j].y < p[k].y) {\n            e[n].invert = 1;\n            a=j,b=k;\n         }\n         e[n].x0 = p[a].x * scale_x + shift_x;\n         e[n].y0 = (p[a].y * y_scale_inv + shift_y) * vsubsample;\n         e[n].x1 = p[b].x * scale_x + shift_x;\n         e[n].y1 = (p[b].y * y_scale_inv + shift_y) * vsubsample;\n         ++n;\n      }\n   }\n\n   // now sort the edges by their highest point (should snap to integer, and then by x)\n   //STBTT_sort(e, n, sizeof(e[0]), stbtt__edge_compare);\n   stbtt__sort_edges(e, n);\n\n   // now, traverse the scanlines and find the intersections on each scanline, use xor winding rule\n   stbtt__rasterize_sorted_edges(result, e, n, vsubsample, off_x, off_y, userdata);\n\n   STBTT_free(e, userdata);\n}\n\nstatic void stbtt__add_point(stbtt__point *points, int n, float x, float y)\n{\n   if (!points) return; // during first pass, it's unallocated\n   points[n].x = x;\n   points[n].y = y;\n}\n\n// tessellate until threshold p is happy... @TODO warped to compensate for non-linear stretching\nstatic int stbtt__tesselate_curve(stbtt__point *points, int *num_points, float x0, float y0, float x1, float y1, float x2, float y2, float objspace_flatness_squared, int n)\n{\n   // midpoint\n   float mx = (x0 + 2*x1 + x2)/4;\n   float my = (y0 + 2*y1 + y2)/4;\n   // versus directly drawn line\n   float dx = (x0+x2)/2 - mx;\n   float dy = (y0+y2)/2 - my;\n   if (n > 16) // 65536 segments on one curve better be enough!\n      return 1;\n   if (dx*dx+dy*dy > objspace_flatness_squared) { // half-pixel error allowed... need to be smaller if AA\n      stbtt__tesselate_curve(points, num_points, x0,y0, (x0+x1)/2.0f,(y0+y1)/2.0f, mx,my, objspace_flatness_squared,n+1);\n      stbtt__tesselate_curve(points, num_points, mx,my, (x1+x2)/2.0f,(y1+y2)/2.0f, x2,y2, objspace_flatness_squared,n+1);\n   } else {\n      stbtt__add_point(points, *num_points,x2,y2);\n      *num_points = *num_points+1;\n   }\n   return 1;\n}\n\nstatic void stbtt__tesselate_cubic(stbtt__point *points, int *num_points, float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3, float objspace_flatness_squared, int n)\n{\n   // @TODO this \"flatness\" calculation is just made-up nonsense that seems to work well enough\n   float dx0 = x1-x0;\n   float dy0 = y1-y0;\n   float dx1 = x2-x1;\n   float dy1 = y2-y1;\n   float dx2 = x3-x2;\n   float dy2 = y3-y2;\n   float dx = x3-x0;\n   float dy = y3-y0;\n   float longlen = (float) (STBTT_sqrt(dx0*dx0+dy0*dy0)+STBTT_sqrt(dx1*dx1+dy1*dy1)+STBTT_sqrt(dx2*dx2+dy2*dy2));\n   float shortlen = (float) STBTT_sqrt(dx*dx+dy*dy);\n   float flatness_squared = longlen*longlen-shortlen*shortlen;\n\n   if (n > 16) // 65536 segments on one curve better be enough!\n      return;\n\n   if (flatness_squared > objspace_flatness_squared) {\n      float x01 = (x0+x1)/2;\n      float y01 = (y0+y1)/2;\n      float x12 = (x1+x2)/2;\n      float y12 = (y1+y2)/2;\n      float x23 = (x2+x3)/2;\n      float y23 = (y2+y3)/2;\n\n      float xa = (x01+x12)/2;\n      float ya = (y01+y12)/2;\n      float xb = (x12+x23)/2;\n      float yb = (y12+y23)/2;\n\n      float mx = (xa+xb)/2;\n      float my = (ya+yb)/2;\n\n      stbtt__tesselate_cubic(points, num_points, x0,y0, x01,y01, xa,ya, mx,my, objspace_flatness_squared,n+1);\n      stbtt__tesselate_cubic(points, num_points, mx,my, xb,yb, x23,y23, x3,y3, objspace_flatness_squared,n+1);\n   } else {\n      stbtt__add_point(points, *num_points,x3,y3);\n      *num_points = *num_points+1;\n   }\n}\n\n// returns number of contours\nstatic stbtt__point *stbtt_FlattenCurves(stbtt_vertex *vertices, int num_verts, float objspace_flatness, int **contour_lengths, int *num_contours, void *userdata)\n{\n   stbtt__point *points=0;\n   int num_points=0;\n\n   float objspace_flatness_squared = objspace_flatness * objspace_flatness;\n   int i,n=0,start=0, pass;\n\n   // count how many \"moves\" there are to get the contour count\n   for (i=0; i < num_verts; ++i)\n      if (vertices[i].type == STBTT_vmove)\n         ++n;\n\n   *num_contours = n;\n   if (n == 0) return 0;\n\n   *contour_lengths = (int *) STBTT_malloc(sizeof(**contour_lengths) * n, userdata);\n\n   if (*contour_lengths == 0) {\n      *num_contours = 0;\n      return 0;\n   }\n\n   // make two passes through the points so we don't need to realloc\n   for (pass=0; pass < 2; ++pass) {\n      float x=0,y=0;\n      if (pass == 1) {\n         points = (stbtt__point *) STBTT_malloc(num_points * sizeof(points[0]), userdata);\n         if (points == NULL) goto error;\n      }\n      num_points = 0;\n      n= -1;\n      for (i=0; i < num_verts; ++i) {\n         switch (vertices[i].type) {\n            case STBTT_vmove:\n               // start the next contour\n               if (n >= 0)\n                  (*contour_lengths)[n] = num_points - start;\n               ++n;\n               start = num_points;\n\n               x = vertices[i].x, y = vertices[i].y;\n               stbtt__add_point(points, num_points++, x,y);\n               break;\n            case STBTT_vline:\n               x = vertices[i].x, y = vertices[i].y;\n               stbtt__add_point(points, num_points++, x, y);\n               break;\n            case STBTT_vcurve:\n               stbtt__tesselate_curve(points, &num_points, x,y,\n                                        vertices[i].cx, vertices[i].cy,\n                                        vertices[i].x,  vertices[i].y,\n                                        objspace_flatness_squared, 0);\n               x = vertices[i].x, y = vertices[i].y;\n               break;\n            case STBTT_vcubic:\n               stbtt__tesselate_cubic(points, &num_points, x,y,\n                                        vertices[i].cx, vertices[i].cy,\n                                        vertices[i].cx1, vertices[i].cy1,\n                                        vertices[i].x,  vertices[i].y,\n                                        objspace_flatness_squared, 0);\n               x = vertices[i].x, y = vertices[i].y;\n               break;\n         }\n      }\n      (*contour_lengths)[n] = num_points - start;\n   }\n\n   return points;\nerror:\n   STBTT_free(points, userdata);\n   STBTT_free(*contour_lengths, userdata);\n   *contour_lengths = 0;\n   *num_contours = 0;\n   return NULL;\n}\n\nSTBTT_DEF void stbtt_Rasterize(stbtt__bitmap *result, float flatness_in_pixels, stbtt_vertex *vertices, int num_verts, float scale_x, float scale_y, float shift_x, float shift_y, int x_off, int y_off, int invert, void *userdata)\n{\n   float scale            = scale_x > scale_y ? scale_y : scale_x;\n   int winding_count      = 0;\n   int *winding_lengths   = NULL;\n   stbtt__point *windings = stbtt_FlattenCurves(vertices, num_verts, flatness_in_pixels / scale, &winding_lengths, &winding_count, userdata);\n   if (windings) {\n      stbtt__rasterize(result, windings, winding_lengths, winding_count, scale_x, scale_y, shift_x, shift_y, x_off, y_off, invert, userdata);\n      STBTT_free(winding_lengths, userdata);\n      STBTT_free(windings, userdata);\n   }\n}\n\nSTBTT_DEF void stbtt_FreeBitmap(unsigned char *bitmap, void *userdata)\n{\n   STBTT_free(bitmap, userdata);\n}\n\nSTBTT_DEF unsigned char *stbtt_GetGlyphBitmapSubpixel(const stbtt_fontinfo *info, float scale_x, float scale_y, float shift_x, float shift_y, int glyph, int *width, int *height, int *xoff, int *yoff)\n{\n   int ix0,iy0,ix1,iy1;\n   stbtt__bitmap gbm;\n   stbtt_vertex *vertices;\n   int num_verts = stbtt_GetGlyphShape(info, glyph, &vertices);\n\n   if (scale_x == 0) scale_x = scale_y;\n   if (scale_y == 0) {\n      if (scale_x == 0) {\n         STBTT_free(vertices, info->userdata);\n         return NULL;\n      }\n      scale_y = scale_x;\n   }\n\n   stbtt_GetGlyphBitmapBoxSubpixel(info, glyph, scale_x, scale_y, shift_x, shift_y, &ix0,&iy0,&ix1,&iy1);\n\n   // now we get the size\n   gbm.w = (ix1 - ix0);\n   gbm.h = (iy1 - iy0);\n   gbm.pixels = NULL; // in case we error\n\n   if (width ) *width  = gbm.w;\n   if (height) *height = gbm.h;\n   if (xoff  ) *xoff   = ix0;\n   if (yoff  ) *yoff   = iy0;\n\n   if (gbm.w && gbm.h) {\n      gbm.pixels = (unsigned char *) STBTT_malloc(gbm.w * gbm.h, info->userdata);\n      if (gbm.pixels) {\n         gbm.stride = gbm.w;\n\n         stbtt_Rasterize(&gbm, 0.35f, vertices, num_verts, scale_x, scale_y, shift_x, shift_y, ix0, iy0, 1, info->userdata);\n      }\n   }\n   STBTT_free(vertices, info->userdata);\n   return gbm.pixels;\n}\n\nSTBTT_DEF unsigned char *stbtt_GetGlyphBitmap(const stbtt_fontinfo *info, float scale_x, float scale_y, int glyph, int *width, int *height, int *xoff, int *yoff)\n{\n   return stbtt_GetGlyphBitmapSubpixel(info, scale_x, scale_y, 0.0f, 0.0f, glyph, width, height, xoff, yoff);\n}\n\nSTBTT_DEF void stbtt_MakeGlyphBitmapSubpixel(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int glyph)\n{\n   int ix0,iy0;\n   stbtt_vertex *vertices;\n   int num_verts = stbtt_GetGlyphShape(info, glyph, &vertices);\n   stbtt__bitmap gbm;\n\n   stbtt_GetGlyphBitmapBoxSubpixel(info, glyph, scale_x, scale_y, shift_x, shift_y, &ix0,&iy0,0,0);\n   gbm.pixels = output;\n   gbm.w = out_w;\n   gbm.h = out_h;\n   gbm.stride = out_stride;\n\n   if (gbm.w && gbm.h)\n      stbtt_Rasterize(&gbm, 0.35f, vertices, num_verts, scale_x, scale_y, shift_x, shift_y, ix0,iy0, 1, info->userdata);\n\n   STBTT_free(vertices, info->userdata);\n}\n\nSTBTT_DEF void stbtt_MakeGlyphBitmap(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, int glyph)\n{\n   stbtt_MakeGlyphBitmapSubpixel(info, output, out_w, out_h, out_stride, scale_x, scale_y, 0.0f,0.0f, glyph);\n}\n\nSTBTT_DEF unsigned char *stbtt_GetCodepointBitmapSubpixel(const stbtt_fontinfo *info, float scale_x, float scale_y, float shift_x, float shift_y, int codepoint, int *width, int *height, int *xoff, int *yoff)\n{\n   return stbtt_GetGlyphBitmapSubpixel(info, scale_x, scale_y,shift_x,shift_y, stbtt_FindGlyphIndex(info,codepoint), width,height,xoff,yoff);\n}\n\nSTBTT_DEF void stbtt_MakeCodepointBitmapSubpixelPrefilter(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int oversample_x, int oversample_y, float *sub_x, float *sub_y, int codepoint)\n{\n   stbtt_MakeGlyphBitmapSubpixelPrefilter(info, output, out_w, out_h, out_stride, scale_x, scale_y, shift_x, shift_y, oversample_x, oversample_y, sub_x, sub_y, stbtt_FindGlyphIndex(info,codepoint));\n}\n\nSTBTT_DEF void stbtt_MakeCodepointBitmapSubpixel(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int codepoint)\n{\n   stbtt_MakeGlyphBitmapSubpixel(info, output, out_w, out_h, out_stride, scale_x, scale_y, shift_x, shift_y, stbtt_FindGlyphIndex(info,codepoint));\n}\n\nSTBTT_DEF unsigned char *stbtt_GetCodepointBitmap(const stbtt_fontinfo *info, float scale_x, float scale_y, int codepoint, int *width, int *height, int *xoff, int *yoff)\n{\n   return stbtt_GetCodepointBitmapSubpixel(info, scale_x, scale_y, 0.0f,0.0f, codepoint, width,height,xoff,yoff);\n}\n\nSTBTT_DEF void stbtt_MakeCodepointBitmap(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, int codepoint)\n{\n   stbtt_MakeCodepointBitmapSubpixel(info, output, out_w, out_h, out_stride, scale_x, scale_y, 0.0f,0.0f, codepoint);\n}\n\n//////////////////////////////////////////////////////////////////////////////\n//\n// bitmap baking\n//\n// This is SUPER-CRAPPY packing to keep source code small\n\nstatic int stbtt_BakeFontBitmap_internal(unsigned char *data, int offset,  // font location (use offset=0 for plain .ttf)\n                                float pixel_height,                     // height of font in pixels\n                                unsigned char *pixels, int pw, int ph,  // bitmap to be filled in\n                                int first_char, int num_chars,          // characters to bake\n                                stbtt_bakedchar *chardata)\n{\n   float scale;\n   int x,y,bottom_y, i;\n   stbtt_fontinfo f;\n   f.userdata = NULL;\n   if (!stbtt_InitFont(&f, data, offset))\n      return -1;\n   STBTT_memset(pixels, 0, pw*ph); // background of 0 around pixels\n   x=y=1;\n   bottom_y = 1;\n\n   scale = stbtt_ScaleForPixelHeight(&f, pixel_height);\n\n   for (i=0; i < num_chars; ++i) {\n      int advance, lsb, x0,y0,x1,y1,gw,gh;\n      int g = stbtt_FindGlyphIndex(&f, first_char + i);\n      stbtt_GetGlyphHMetrics(&f, g, &advance, &lsb);\n      stbtt_GetGlyphBitmapBox(&f, g, scale,scale, &x0,&y0,&x1,&y1);\n      gw = x1-x0;\n      gh = y1-y0;\n      if (x + gw + 1 >= pw)\n         y = bottom_y, x = 1; // advance to next row\n      if (y + gh + 1 >= ph) // check if it fits vertically AFTER potentially moving to next row\n         return -i;\n      STBTT_assert(x+gw < pw);\n      STBTT_assert(y+gh < ph);\n      stbtt_MakeGlyphBitmap(&f, pixels+x+y*pw, gw,gh,pw, scale,scale, g);\n      chardata[i].x0 = (stbtt_int16) x;\n      chardata[i].y0 = (stbtt_int16) y;\n      chardata[i].x1 = (stbtt_int16) (x + gw);\n      chardata[i].y1 = (stbtt_int16) (y + gh);\n      chardata[i].xadvance = scale * advance;\n      chardata[i].xoff     = (float) x0;\n      chardata[i].yoff     = (float) y0;\n      x = x + gw + 1;\n      if (y+gh+1 > bottom_y)\n         bottom_y = y+gh+1;\n   }\n   return bottom_y;\n}\n\nSTBTT_DEF void stbtt_GetBakedQuad(const stbtt_bakedchar *chardata, int pw, int ph, int char_index, float *xpos, float *ypos, stbtt_aligned_quad *q, int opengl_fillrule)\n{\n   float d3d_bias = opengl_fillrule ? 0 : -0.5f;\n   float ipw = 1.0f / pw, iph = 1.0f / ph;\n   const stbtt_bakedchar *b = chardata + char_index;\n   int round_x = STBTT_ifloor((*xpos + b->xoff) + 0.5f);\n   int round_y = STBTT_ifloor((*ypos + b->yoff) + 0.5f);\n\n   q->x0 = round_x + d3d_bias;\n   q->y0 = round_y + d3d_bias;\n   q->x1 = round_x + b->x1 - b->x0 + d3d_bias;\n   q->y1 = round_y + b->y1 - b->y0 + d3d_bias;\n\n   q->s0 = b->x0 * ipw;\n   q->t0 = b->y0 * iph;\n   q->s1 = b->x1 * ipw;\n   q->t1 = b->y1 * iph;\n\n   *xpos += b->xadvance;\n}\n\n//////////////////////////////////////////////////////////////////////////////\n//\n// rectangle packing replacement routines if you don't have stb_rect_pack.h\n//\n\n#ifndef STB_RECT_PACK_VERSION\n\ntypedef int stbrp_coord;\n\n////////////////////////////////////////////////////////////////////////////////////\n//                                                                                //\n//                                                                                //\n// COMPILER WARNING ?!?!?                                                         //\n//                                                                                //\n//                                                                                //\n// if you get a compile warning due to these symbols being defined more than      //\n// once, move #include \"stb_rect_pack.h\" before #include \"stb_truetype.h\"         //\n//                                                                                //\n////////////////////////////////////////////////////////////////////////////////////\n\ntypedef struct\n{\n   int width,height;\n   int x,y,bottom_y;\n} stbrp_context;\n\ntypedef struct\n{\n   unsigned char x;\n} stbrp_node;\n\nstruct stbrp_rect\n{\n   stbrp_coord x,y;\n   int id,w,h,was_packed;\n};\n\nstatic void stbrp_init_target(stbrp_context *con, int pw, int ph, stbrp_node *nodes, int num_nodes)\n{\n   con->width  = pw;\n   con->height = ph;\n   con->x = 0;\n   con->y = 0;\n   con->bottom_y = 0;\n   STBTT__NOTUSED(nodes);\n   STBTT__NOTUSED(num_nodes);\n}\n\nstatic void stbrp_pack_rects(stbrp_context *con, stbrp_rect *rects, int num_rects)\n{\n   int i;\n   for (i=0; i < num_rects; ++i) {\n      if (con->x + rects[i].w > con->width) {\n         con->x = 0;\n         con->y = con->bottom_y;\n      }\n      if (con->y + rects[i].h > con->height)\n         break;\n      rects[i].x = con->x;\n      rects[i].y = con->y;\n      rects[i].was_packed = 1;\n      con->x += rects[i].w;\n      if (con->y + rects[i].h > con->bottom_y)\n         con->bottom_y = con->y + rects[i].h;\n   }\n   for (   ; i < num_rects; ++i)\n      rects[i].was_packed = 0;\n}\n#endif\n\n//////////////////////////////////////////////////////////////////////////////\n//\n// bitmap baking\n//\n// This is SUPER-AWESOME (tm Ryan Gordon) packing using stb_rect_pack.h. If\n// stb_rect_pack.h isn't available, it uses the BakeFontBitmap strategy.\n\nSTBTT_DEF int stbtt_PackBegin(stbtt_pack_context *spc, unsigned char *pixels, int pw, int ph, int stride_in_bytes, int padding, void *alloc_context)\n{\n   stbrp_context *context = (stbrp_context *) STBTT_malloc(sizeof(*context)            ,alloc_context);\n   int            num_nodes = pw - padding;\n   stbrp_node    *nodes   = (stbrp_node    *) STBTT_malloc(sizeof(*nodes  ) * num_nodes,alloc_context);\n\n   if (context == NULL || nodes == NULL) {\n      if (context != NULL) STBTT_free(context, alloc_context);\n      if (nodes   != NULL) STBTT_free(nodes  , alloc_context);\n      return 0;\n   }\n\n   spc->user_allocator_context = alloc_context;\n   spc->width = pw;\n   spc->height = ph;\n   spc->pixels = pixels;\n   spc->pack_info = context;\n   spc->nodes = nodes;\n   spc->padding = padding;\n   spc->stride_in_bytes = stride_in_bytes != 0 ? stride_in_bytes : pw;\n   spc->h_oversample = 1;\n   spc->v_oversample = 1;\n   spc->skip_missing = 0;\n\n   stbrp_init_target(context, pw-padding, ph-padding, nodes, num_nodes);\n\n   if (pixels)\n      STBTT_memset(pixels, 0, pw*ph); // background of 0 around pixels\n\n   return 1;\n}\n\nSTBTT_DEF void stbtt_PackEnd  (stbtt_pack_context *spc)\n{\n   STBTT_free(spc->nodes    , spc->user_allocator_context);\n   STBTT_free(spc->pack_info, spc->user_allocator_context);\n}\n\nSTBTT_DEF void stbtt_PackSetOversampling(stbtt_pack_context *spc, unsigned int h_oversample, unsigned int v_oversample)\n{\n   STBTT_assert(h_oversample <= STBTT_MAX_OVERSAMPLE);\n   STBTT_assert(v_oversample <= STBTT_MAX_OVERSAMPLE);\n   if (h_oversample <= STBTT_MAX_OVERSAMPLE)\n      spc->h_oversample = h_oversample;\n   if (v_oversample <= STBTT_MAX_OVERSAMPLE)\n      spc->v_oversample = v_oversample;\n}\n\nSTBTT_DEF void stbtt_PackSetSkipMissingCodepoints(stbtt_pack_context *spc, int skip)\n{\n   spc->skip_missing = skip;\n}\n\n#define STBTT__OVER_MASK  (STBTT_MAX_OVERSAMPLE-1)\n\nstatic void stbtt__h_prefilter(unsigned char *pixels, int w, int h, int stride_in_bytes, unsigned int kernel_width)\n{\n   unsigned char buffer[STBTT_MAX_OVERSAMPLE];\n   int safe_w = w - kernel_width;\n   int j;\n   STBTT_memset(buffer, 0, STBTT_MAX_OVERSAMPLE); // suppress bogus warning from VS2013 -analyze\n   for (j=0; j < h; ++j) {\n      int i;\n      unsigned int total;\n      STBTT_memset(buffer, 0, kernel_width);\n\n      total = 0;\n\n      // make kernel_width a constant in common cases so compiler can optimize out the divide\n      switch (kernel_width) {\n         case 2:\n            for (i=0; i <= safe_w; ++i) {\n               total += pixels[i] - buffer[i & STBTT__OVER_MASK];\n               buffer[(i+kernel_width) & STBTT__OVER_MASK] = pixels[i];\n               pixels[i] = (unsigned char) (total / 2);\n            }\n            break;\n         case 3:\n            for (i=0; i <= safe_w; ++i) {\n               total += pixels[i] - buffer[i & STBTT__OVER_MASK];\n               buffer[(i+kernel_width) & STBTT__OVER_MASK] = pixels[i];\n               pixels[i] = (unsigned char) (total / 3);\n            }\n            break;\n         case 4:\n            for (i=0; i <= safe_w; ++i) {\n               total += pixels[i] - buffer[i & STBTT__OVER_MASK];\n               buffer[(i+kernel_width) & STBTT__OVER_MASK] = pixels[i];\n               pixels[i] = (unsigned char) (total / 4);\n            }\n            break;\n         case 5:\n            for (i=0; i <= safe_w; ++i) {\n               total += pixels[i] - buffer[i & STBTT__OVER_MASK];\n               buffer[(i+kernel_width) & STBTT__OVER_MASK] = pixels[i];\n               pixels[i] = (unsigned char) (total / 5);\n            }\n            break;\n         default:\n            for (i=0; i <= safe_w; ++i) {\n               total += pixels[i] - buffer[i & STBTT__OVER_MASK];\n               buffer[(i+kernel_width) & STBTT__OVER_MASK] = pixels[i];\n               pixels[i] = (unsigned char) (total / kernel_width);\n            }\n            break;\n      }\n\n      for (; i < w; ++i) {\n         STBTT_assert(pixels[i] == 0);\n         total -= buffer[i & STBTT__OVER_MASK];\n         pixels[i] = (unsigned char) (total / kernel_width);\n      }\n\n      pixels += stride_in_bytes;\n   }\n}\n\nstatic void stbtt__v_prefilter(unsigned char *pixels, int w, int h, int stride_in_bytes, unsigned int kernel_width)\n{\n   unsigned char buffer[STBTT_MAX_OVERSAMPLE];\n   int safe_h = h - kernel_width;\n   int j;\n   STBTT_memset(buffer, 0, STBTT_MAX_OVERSAMPLE); // suppress bogus warning from VS2013 -analyze\n   for (j=0; j < w; ++j) {\n      int i;\n      unsigned int total;\n      STBTT_memset(buffer, 0, kernel_width);\n\n      total = 0;\n\n      // make kernel_width a constant in common cases so compiler can optimize out the divide\n      switch (kernel_width) {\n         case 2:\n            for (i=0; i <= safe_h; ++i) {\n               total += pixels[i*stride_in_bytes] - buffer[i & STBTT__OVER_MASK];\n               buffer[(i+kernel_width) & STBTT__OVER_MASK] = pixels[i*stride_in_bytes];\n               pixels[i*stride_in_bytes] = (unsigned char) (total / 2);\n            }\n            break;\n         case 3:\n            for (i=0; i <= safe_h; ++i) {\n               total += pixels[i*stride_in_bytes] - buffer[i & STBTT__OVER_MASK];\n               buffer[(i+kernel_width) & STBTT__OVER_MASK] = pixels[i*stride_in_bytes];\n               pixels[i*stride_in_bytes] = (unsigned char) (total / 3);\n            }\n            break;\n         case 4:\n            for (i=0; i <= safe_h; ++i) {\n               total += pixels[i*stride_in_bytes] - buffer[i & STBTT__OVER_MASK];\n               buffer[(i+kernel_width) & STBTT__OVER_MASK] = pixels[i*stride_in_bytes];\n               pixels[i*stride_in_bytes] = (unsigned char) (total / 4);\n            }\n            break;\n         case 5:\n            for (i=0; i <= safe_h; ++i) {\n               total += pixels[i*stride_in_bytes] - buffer[i & STBTT__OVER_MASK];\n               buffer[(i+kernel_width) & STBTT__OVER_MASK] = pixels[i*stride_in_bytes];\n               pixels[i*stride_in_bytes] = (unsigned char) (total / 5);\n            }\n            break;\n         default:\n            for (i=0; i <= safe_h; ++i) {\n               total += pixels[i*stride_in_bytes] - buffer[i & STBTT__OVER_MASK];\n               buffer[(i+kernel_width) & STBTT__OVER_MASK] = pixels[i*stride_in_bytes];\n               pixels[i*stride_in_bytes] = (unsigned char) (total / kernel_width);\n            }\n            break;\n      }\n\n      for (; i < h; ++i) {\n         STBTT_assert(pixels[i*stride_in_bytes] == 0);\n         total -= buffer[i & STBTT__OVER_MASK];\n         pixels[i*stride_in_bytes] = (unsigned char) (total / kernel_width);\n      }\n\n      pixels += 1;\n   }\n}\n\nstatic float stbtt__oversample_shift(int oversample)\n{\n   if (!oversample)\n      return 0.0f;\n\n   // The prefilter is a box filter of width \"oversample\",\n   // which shifts phase by (oversample - 1)/2 pixels in\n   // oversampled space. We want to shift in the opposite\n   // direction to counter this.\n   return (float)-(oversample - 1) / (2.0f * (float)oversample);\n}\n\n// rects array must be big enough to accommodate all characters in the given ranges\nSTBTT_DEF int stbtt_PackFontRangesGatherRects(stbtt_pack_context *spc, const stbtt_fontinfo *info, stbtt_pack_range *ranges, int num_ranges, stbrp_rect *rects)\n{\n   int i,j,k;\n\n   k=0;\n   for (i=0; i < num_ranges; ++i) {\n      float fh = ranges[i].font_size;\n      float scale = fh > 0 ? stbtt_ScaleForPixelHeight(info, fh) : stbtt_ScaleForMappingEmToPixels(info, -fh);\n      ranges[i].h_oversample = (unsigned char) spc->h_oversample;\n      ranges[i].v_oversample = (unsigned char) spc->v_oversample;\n      for (j=0; j < ranges[i].num_chars; ++j) {\n         int x0,y0,x1,y1;\n         int codepoint = ranges[i].array_of_unicode_codepoints == NULL ? ranges[i].first_unicode_codepoint_in_range + j : ranges[i].array_of_unicode_codepoints[j];\n         int glyph = stbtt_FindGlyphIndex(info, codepoint);\n         if (glyph == 0 && spc->skip_missing) {\n            rects[k].w = rects[k].h = 0;\n         } else {\n            stbtt_GetGlyphBitmapBoxSubpixel(info,glyph,\n                                            scale * spc->h_oversample,\n                                            scale * spc->v_oversample,\n                                            0,0,\n                                            &x0,&y0,&x1,&y1);\n            rects[k].w = (stbrp_coord) (x1-x0 + spc->padding + spc->h_oversample-1);\n            rects[k].h = (stbrp_coord) (y1-y0 + spc->padding + spc->v_oversample-1);\n         }\n         ++k;\n      }\n   }\n\n   return k;\n}\n\nSTBTT_DEF void stbtt_MakeGlyphBitmapSubpixelPrefilter(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int prefilter_x, int prefilter_y, float *sub_x, float *sub_y, int glyph)\n{\n   stbtt_MakeGlyphBitmapSubpixel(info,\n                                 output,\n                                 out_w - (prefilter_x - 1),\n                                 out_h - (prefilter_y - 1),\n                                 out_stride,\n                                 scale_x,\n                                 scale_y,\n                                 shift_x,\n                                 shift_y,\n                                 glyph);\n\n   if (prefilter_x > 1)\n      stbtt__h_prefilter(output, out_w, out_h, out_stride, prefilter_x);\n\n   if (prefilter_y > 1)\n      stbtt__v_prefilter(output, out_w, out_h, out_stride, prefilter_y);\n\n   *sub_x = stbtt__oversample_shift(prefilter_x);\n   *sub_y = stbtt__oversample_shift(prefilter_y);\n}\n\n// rects array must be big enough to accommodate all characters in the given ranges\nSTBTT_DEF int stbtt_PackFontRangesRenderIntoRects(stbtt_pack_context *spc, const stbtt_fontinfo *info, stbtt_pack_range *ranges, int num_ranges, stbrp_rect *rects)\n{\n   int i,j,k, return_value = 1;\n\n   // save current values\n   int old_h_over = spc->h_oversample;\n   int old_v_over = spc->v_oversample;\n\n   k = 0;\n   for (i=0; i < num_ranges; ++i) {\n      float fh = ranges[i].font_size;\n      float scale = fh > 0 ? stbtt_ScaleForPixelHeight(info, fh) : stbtt_ScaleForMappingEmToPixels(info, -fh);\n      float recip_h,recip_v,sub_x,sub_y;\n      spc->h_oversample = ranges[i].h_oversample;\n      spc->v_oversample = ranges[i].v_oversample;\n      recip_h = 1.0f / spc->h_oversample;\n      recip_v = 1.0f / spc->v_oversample;\n      sub_x = stbtt__oversample_shift(spc->h_oversample);\n      sub_y = stbtt__oversample_shift(spc->v_oversample);\n      for (j=0; j < ranges[i].num_chars; ++j) {\n         stbrp_rect *r = &rects[k];\n         if (r->was_packed && r->w != 0 && r->h != 0) {\n            stbtt_packedchar *bc = &ranges[i].chardata_for_range[j];\n            int advance, lsb, x0,y0,x1,y1;\n            int codepoint = ranges[i].array_of_unicode_codepoints == NULL ? ranges[i].first_unicode_codepoint_in_range + j : ranges[i].array_of_unicode_codepoints[j];\n            int glyph = stbtt_FindGlyphIndex(info, codepoint);\n            stbrp_coord pad = (stbrp_coord) spc->padding;\n\n            // pad on left and top\n            r->x += pad;\n            r->y += pad;\n            r->w -= pad;\n            r->h -= pad;\n            stbtt_GetGlyphHMetrics(info, glyph, &advance, &lsb);\n            stbtt_GetGlyphBitmapBox(info, glyph,\n                                    scale * spc->h_oversample,\n                                    scale * spc->v_oversample,\n                                    &x0,&y0,&x1,&y1);\n            stbtt_MakeGlyphBitmapSubpixel(info,\n                                          spc->pixels + r->x + r->y*spc->stride_in_bytes,\n                                          r->w - spc->h_oversample+1,\n                                          r->h - spc->v_oversample+1,\n                                          spc->stride_in_bytes,\n                                          scale * spc->h_oversample,\n                                          scale * spc->v_oversample,\n                                          0,0,\n                                          glyph);\n\n            if (spc->h_oversample > 1)\n               stbtt__h_prefilter(spc->pixels + r->x + r->y*spc->stride_in_bytes,\n                                  r->w, r->h, spc->stride_in_bytes,\n                                  spc->h_oversample);\n\n            if (spc->v_oversample > 1)\n               stbtt__v_prefilter(spc->pixels + r->x + r->y*spc->stride_in_bytes,\n                                  r->w, r->h, spc->stride_in_bytes,\n                                  spc->v_oversample);\n\n            bc->x0       = (stbtt_int16)  r->x;\n            bc->y0       = (stbtt_int16)  r->y;\n            bc->x1       = (stbtt_int16) (r->x + r->w);\n            bc->y1       = (stbtt_int16) (r->y + r->h);\n            bc->xadvance =                scale * advance;\n            bc->xoff     =       (float)  x0 * recip_h + sub_x;\n            bc->yoff     =       (float)  y0 * recip_v + sub_y;\n            bc->xoff2    =                (x0 + r->w) * recip_h + sub_x;\n            bc->yoff2    =                (y0 + r->h) * recip_v + sub_y;\n         } else {\n            return_value = 0; // if any fail, report failure\n         }\n\n         ++k;\n      }\n   }\n\n   // restore original values\n   spc->h_oversample = old_h_over;\n   spc->v_oversample = old_v_over;\n\n   return return_value;\n}\n\nSTBTT_DEF void stbtt_PackFontRangesPackRects(stbtt_pack_context *spc, stbrp_rect *rects, int num_rects)\n{\n   stbrp_pack_rects((stbrp_context *) spc->pack_info, rects, num_rects);\n}\n\nSTBTT_DEF int stbtt_PackFontRanges(stbtt_pack_context *spc, const unsigned char *fontdata, int font_index, stbtt_pack_range *ranges, int num_ranges)\n{\n   stbtt_fontinfo info;\n   int i,j,n, return_value; // [DEAR IMGUI] removed = 1\n   //stbrp_context *context = (stbrp_context *) spc->pack_info;\n   stbrp_rect    *rects;\n\n   // flag all characters as NOT packed\n   for (i=0; i < num_ranges; ++i)\n      for (j=0; j < ranges[i].num_chars; ++j)\n         ranges[i].chardata_for_range[j].x0 =\n         ranges[i].chardata_for_range[j].y0 =\n         ranges[i].chardata_for_range[j].x1 =\n         ranges[i].chardata_for_range[j].y1 = 0;\n\n   n = 0;\n   for (i=0; i < num_ranges; ++i)\n      n += ranges[i].num_chars;\n\n   rects = (stbrp_rect *) STBTT_malloc(sizeof(*rects) * n, spc->user_allocator_context);\n   if (rects == NULL)\n      return 0;\n\n   info.userdata = spc->user_allocator_context;\n   stbtt_InitFont(&info, fontdata, stbtt_GetFontOffsetForIndex(fontdata,font_index));\n\n   n = stbtt_PackFontRangesGatherRects(spc, &info, ranges, num_ranges, rects);\n\n   stbtt_PackFontRangesPackRects(spc, rects, n);\n\n   return_value = stbtt_PackFontRangesRenderIntoRects(spc, &info, ranges, num_ranges, rects);\n\n   STBTT_free(rects, spc->user_allocator_context);\n   return return_value;\n}\n\nSTBTT_DEF int stbtt_PackFontRange(stbtt_pack_context *spc, const unsigned char *fontdata, int font_index, float font_size,\n            int first_unicode_codepoint_in_range, int num_chars_in_range, stbtt_packedchar *chardata_for_range)\n{\n   stbtt_pack_range range;\n   range.first_unicode_codepoint_in_range = first_unicode_codepoint_in_range;\n   range.array_of_unicode_codepoints = NULL;\n   range.num_chars                   = num_chars_in_range;\n   range.chardata_for_range          = chardata_for_range;\n   range.font_size                   = font_size;\n   return stbtt_PackFontRanges(spc, fontdata, font_index, &range, 1);\n}\n\nSTBTT_DEF void stbtt_GetScaledFontVMetrics(const unsigned char *fontdata, int index, float size, float *ascent, float *descent, float *lineGap)\n{\n   int i_ascent, i_descent, i_lineGap;\n   float scale;\n   stbtt_fontinfo info;\n   stbtt_InitFont(&info, fontdata, stbtt_GetFontOffsetForIndex(fontdata, index));\n   scale = size > 0 ? stbtt_ScaleForPixelHeight(&info, size) : stbtt_ScaleForMappingEmToPixels(&info, -size);\n   stbtt_GetFontVMetrics(&info, &i_ascent, &i_descent, &i_lineGap);\n   *ascent  = (float) i_ascent  * scale;\n   *descent = (float) i_descent * scale;\n   *lineGap = (float) i_lineGap * scale;\n}\n\nSTBTT_DEF void stbtt_GetPackedQuad(const stbtt_packedchar *chardata, int pw, int ph, int char_index, float *xpos, float *ypos, stbtt_aligned_quad *q, int align_to_integer)\n{\n   float ipw = 1.0f / pw, iph = 1.0f / ph;\n   const stbtt_packedchar *b = chardata + char_index;\n\n   if (align_to_integer) {\n      float x = (float) STBTT_ifloor((*xpos + b->xoff) + 0.5f);\n      float y = (float) STBTT_ifloor((*ypos + b->yoff) + 0.5f);\n      q->x0 = x;\n      q->y0 = y;\n      q->x1 = x + b->xoff2 - b->xoff;\n      q->y1 = y + b->yoff2 - b->yoff;\n   } else {\n      q->x0 = *xpos + b->xoff;\n      q->y0 = *ypos + b->yoff;\n      q->x1 = *xpos + b->xoff2;\n      q->y1 = *ypos + b->yoff2;\n   }\n\n   q->s0 = b->x0 * ipw;\n   q->t0 = b->y0 * iph;\n   q->s1 = b->x1 * ipw;\n   q->t1 = b->y1 * iph;\n\n   *xpos += b->xadvance;\n}\n\n//////////////////////////////////////////////////////////////////////////////\n//\n// sdf computation\n//\n\n#define STBTT_min(a,b)  ((a) < (b) ? (a) : (b))\n#define STBTT_max(a,b)  ((a) < (b) ? (b) : (a))\n\nstatic int stbtt__ray_intersect_bezier(float orig[2], float ray[2], float q0[2], float q1[2], float q2[2], float hits[2][2])\n{\n   float q0perp = q0[1]*ray[0] - q0[0]*ray[1];\n   float q1perp = q1[1]*ray[0] - q1[0]*ray[1];\n   float q2perp = q2[1]*ray[0] - q2[0]*ray[1];\n   float roperp = orig[1]*ray[0] - orig[0]*ray[1];\n\n   float a = q0perp - 2*q1perp + q2perp;\n   float b = q1perp - q0perp;\n   float c = q0perp - roperp;\n\n   float s0 = 0., s1 = 0.;\n   int num_s = 0;\n\n   if (a != 0.0) {\n      float discr = b*b - a*c;\n      if (discr > 0.0) {\n         float rcpna = -1 / a;\n         float d = (float) STBTT_sqrt(discr);\n         s0 = (b+d) * rcpna;\n         s1 = (b-d) * rcpna;\n         if (s0 >= 0.0 && s0 <= 1.0)\n            num_s = 1;\n         if (d > 0.0 && s1 >= 0.0 && s1 <= 1.0) {\n            if (num_s == 0) s0 = s1;\n            ++num_s;\n         }\n      }\n   } else {\n      // 2*b*s + c = 0\n      // s = -c / (2*b)\n      s0 = c / (-2 * b);\n      if (s0 >= 0.0 && s0 <= 1.0)\n         num_s = 1;\n   }\n\n   if (num_s == 0)\n      return 0;\n   else {\n      float rcp_len2 = 1 / (ray[0]*ray[0] + ray[1]*ray[1]);\n      float rayn_x = ray[0] * rcp_len2, rayn_y = ray[1] * rcp_len2;\n\n      float q0d =   q0[0]*rayn_x +   q0[1]*rayn_y;\n      float q1d =   q1[0]*rayn_x +   q1[1]*rayn_y;\n      float q2d =   q2[0]*rayn_x +   q2[1]*rayn_y;\n      float rod = orig[0]*rayn_x + orig[1]*rayn_y;\n\n      float q10d = q1d - q0d;\n      float q20d = q2d - q0d;\n      float q0rd = q0d - rod;\n\n      hits[0][0] = q0rd + s0*(2.0f - 2.0f*s0)*q10d + s0*s0*q20d;\n      hits[0][1] = a*s0+b;\n\n      if (num_s > 1) {\n         hits[1][0] = q0rd + s1*(2.0f - 2.0f*s1)*q10d + s1*s1*q20d;\n         hits[1][1] = a*s1+b;\n         return 2;\n      } else {\n         return 1;\n      }\n   }\n}\n\nstatic int equal(float *a, float *b)\n{\n   return (a[0] == b[0] && a[1] == b[1]);\n}\n\nstatic int stbtt__compute_crossings_x(float x, float y, int nverts, stbtt_vertex *verts)\n{\n   int i;\n   float orig[2], ray[2] = { 1, 0 };\n   float y_frac;\n   int winding = 0;\n\n   orig[0] = x;\n   //orig[1] = y; // [DEAR IMGUI] commented double assignment\n\n   // make sure y never passes through a vertex of the shape\n   y_frac = (float) STBTT_fmod(y, 1.0f);\n   if (y_frac < 0.01f)\n      y += 0.01f;\n   else if (y_frac > 0.99f)\n      y -= 0.01f;\n   orig[1] = y;\n\n   // test a ray from (-infinity,y) to (x,y)\n   for (i=0; i < nverts; ++i) {\n      if (verts[i].type == STBTT_vline) {\n         int x0 = (int) verts[i-1].x, y0 = (int) verts[i-1].y;\n         int x1 = (int) verts[i  ].x, y1 = (int) verts[i  ].y;\n         if (y > STBTT_min(y0,y1) && y < STBTT_max(y0,y1) && x > STBTT_min(x0,x1)) {\n            float x_inter = (y - y0) / (y1 - y0) * (x1-x0) + x0;\n            if (x_inter < x)\n               winding += (y0 < y1) ? 1 : -1;\n         }\n      }\n      if (verts[i].type == STBTT_vcurve) {\n         int x0 = (int) verts[i-1].x , y0 = (int) verts[i-1].y ;\n         int x1 = (int) verts[i  ].cx, y1 = (int) verts[i  ].cy;\n         int x2 = (int) verts[i  ].x , y2 = (int) verts[i  ].y ;\n         int ax = STBTT_min(x0,STBTT_min(x1,x2)), ay = STBTT_min(y0,STBTT_min(y1,y2));\n         int by = STBTT_max(y0,STBTT_max(y1,y2));\n         if (y > ay && y < by && x > ax) {\n            float q0[2],q1[2],q2[2];\n            float hits[2][2];\n            q0[0] = (float)x0;\n            q0[1] = (float)y0;\n            q1[0] = (float)x1;\n            q1[1] = (float)y1;\n            q2[0] = (float)x2;\n            q2[1] = (float)y2;\n            if (equal(q0,q1) || equal(q1,q2)) {\n               x0 = (int)verts[i-1].x;\n               y0 = (int)verts[i-1].y;\n               x1 = (int)verts[i  ].x;\n               y1 = (int)verts[i  ].y;\n               if (y > STBTT_min(y0,y1) && y < STBTT_max(y0,y1) && x > STBTT_min(x0,x1)) {\n                  float x_inter = (y - y0) / (y1 - y0) * (x1-x0) + x0;\n                  if (x_inter < x)\n                     winding += (y0 < y1) ? 1 : -1;\n               }\n            } else {\n               int num_hits = stbtt__ray_intersect_bezier(orig, ray, q0, q1, q2, hits);\n               if (num_hits >= 1)\n                  if (hits[0][0] < 0)\n                     winding += (hits[0][1] < 0 ? -1 : 1);\n               if (num_hits >= 2)\n                  if (hits[1][0] < 0)\n                     winding += (hits[1][1] < 0 ? -1 : 1);\n            }\n         }\n      }\n   }\n   return winding;\n}\n\nstatic float stbtt__cuberoot( float x )\n{\n   if (x<0)\n      return -(float) STBTT_pow(-x,1.0f/3.0f);\n   else\n      return  (float) STBTT_pow( x,1.0f/3.0f);\n}\n\n// x^3 + c*x^2 + b*x + a = 0\nstatic int stbtt__solve_cubic(float a, float b, float c, float* r)\n{\n\tfloat s = -a / 3;\n\tfloat p = b - a*a / 3;\n\tfloat q = a * (2*a*a - 9*b) / 27 + c;\n   float p3 = p*p*p;\n\tfloat d = q*q + 4*p3 / 27;\n\tif (d >= 0) {\n\t\tfloat z = (float) STBTT_sqrt(d);\n\t\tfloat u = (-q + z) / 2;\n\t\tfloat v = (-q - z) / 2;\n\t\tu = stbtt__cuberoot(u);\n\t\tv = stbtt__cuberoot(v);\n\t\tr[0] = s + u + v;\n\t\treturn 1;\n\t} else {\n\t   float u = (float) STBTT_sqrt(-p/3);\n\t   float v = (float) STBTT_acos(-STBTT_sqrt(-27/p3) * q / 2) / 3; // p3 must be negative, since d is negative\n\t   float m = (float) STBTT_cos(v);\n      float n = (float) STBTT_cos(v-3.141592/2)*1.732050808f;\n\t   r[0] = s + u * 2 * m;\n\t   r[1] = s - u * (m + n);\n\t   r[2] = s - u * (m - n);\n\n      //STBTT_assert( STBTT_fabs(((r[0]+a)*r[0]+b)*r[0]+c) < 0.05f);  // these asserts may not be safe at all scales, though they're in bezier t parameter units so maybe?\n      //STBTT_assert( STBTT_fabs(((r[1]+a)*r[1]+b)*r[1]+c) < 0.05f);\n      //STBTT_assert( STBTT_fabs(((r[2]+a)*r[2]+b)*r[2]+c) < 0.05f);\n   \treturn 3;\n   }\n}\n\nSTBTT_DEF unsigned char * stbtt_GetGlyphSDF(const stbtt_fontinfo *info, float scale, int glyph, int padding, unsigned char onedge_value, float pixel_dist_scale, int *width, int *height, int *xoff, int *yoff)\n{\n   float scale_x = scale, scale_y = scale;\n   int ix0,iy0,ix1,iy1;\n   int w,h;\n   unsigned char *data;\n\n   // if one scale is 0, use same scale for both\n   if (scale_x == 0) scale_x = scale_y;\n   if (scale_y == 0) {\n      if (scale_x == 0) return NULL;  // if both scales are 0, return NULL\n      scale_y = scale_x;\n   }\n\n   stbtt_GetGlyphBitmapBoxSubpixel(info, glyph, scale, scale, 0.0f,0.0f, &ix0,&iy0,&ix1,&iy1);\n\n   // if empty, return NULL\n   if (ix0 == ix1 || iy0 == iy1)\n      return NULL;\n\n   ix0 -= padding;\n   iy0 -= padding;\n   ix1 += padding;\n   iy1 += padding;\n\n   w = (ix1 - ix0);\n   h = (iy1 - iy0);\n\n   if (width ) *width  = w;\n   if (height) *height = h;\n   if (xoff  ) *xoff   = ix0;\n   if (yoff  ) *yoff   = iy0;\n\n   // invert for y-downwards bitmaps\n   scale_y = -scale_y;\n\n   {\n      int x,y,i,j;\n      float *precompute;\n      stbtt_vertex *verts;\n      int num_verts = stbtt_GetGlyphShape(info, glyph, &verts);\n      data = (unsigned char *) STBTT_malloc(w * h, info->userdata);\n      precompute = (float *) STBTT_malloc(num_verts * sizeof(float), info->userdata);\n\n      for (i=0,j=num_verts-1; i < num_verts; j=i++) {\n         if (verts[i].type == STBTT_vline) {\n            float x0 = verts[i].x*scale_x, y0 = verts[i].y*scale_y;\n            float x1 = verts[j].x*scale_x, y1 = verts[j].y*scale_y;\n            float dist = (float) STBTT_sqrt((x1-x0)*(x1-x0) + (y1-y0)*(y1-y0));\n            precompute[i] = (dist == 0) ? 0.0f : 1.0f / dist;\n         } else if (verts[i].type == STBTT_vcurve) {\n            float x2 = verts[j].x *scale_x, y2 = verts[j].y *scale_y;\n            float x1 = verts[i].cx*scale_x, y1 = verts[i].cy*scale_y;\n            float x0 = verts[i].x *scale_x, y0 = verts[i].y *scale_y;\n            float bx = x0 - 2*x1 + x2, by = y0 - 2*y1 + y2;\n            float len2 = bx*bx + by*by;\n            if (len2 != 0.0f)\n               precompute[i] = 1.0f / (bx*bx + by*by);\n            else\n               precompute[i] = 0.0f;\n         } else\n            precompute[i] = 0.0f;\n      }\n\n      for (y=iy0; y < iy1; ++y) {\n         for (x=ix0; x < ix1; ++x) {\n            float val;\n            float min_dist = 999999.0f;\n            float sx = (float) x + 0.5f;\n            float sy = (float) y + 0.5f;\n            float x_gspace = (sx / scale_x);\n            float y_gspace = (sy / scale_y);\n\n            int winding = stbtt__compute_crossings_x(x_gspace, y_gspace, num_verts, verts); // @OPTIMIZE: this could just be a rasterization, but needs to be line vs. non-tesselated curves so a new path\n\n            for (i=0; i < num_verts; ++i) {\n               float x0 = verts[i].x*scale_x, y0 = verts[i].y*scale_y;\n\n               // check against every point here rather than inside line/curve primitives -- @TODO: wrong if multiple 'moves' in a row produce a garbage point, and given culling, probably more efficient to do within line/curve\n               float dist2 = (x0-sx)*(x0-sx) + (y0-sy)*(y0-sy);\n               if (dist2 < min_dist*min_dist)\n                  min_dist = (float) STBTT_sqrt(dist2);\n\n               if (verts[i].type == STBTT_vline) {\n                  float x1 = verts[i-1].x*scale_x, y1 = verts[i-1].y*scale_y;\n\n                  // coarse culling against bbox\n                  //if (sx > STBTT_min(x0,x1)-min_dist && sx < STBTT_max(x0,x1)+min_dist &&\n                  //    sy > STBTT_min(y0,y1)-min_dist && sy < STBTT_max(y0,y1)+min_dist)\n                  float dist = (float) STBTT_fabs((x1-x0)*(y0-sy) - (y1-y0)*(x0-sx)) * precompute[i];\n                  STBTT_assert(i != 0);\n                  if (dist < min_dist) {\n                     // check position along line\n                     // x' = x0 + t*(x1-x0), y' = y0 + t*(y1-y0)\n                     // minimize (x'-sx)*(x'-sx)+(y'-sy)*(y'-sy)\n                     float dx = x1-x0, dy = y1-y0;\n                     float px = x0-sx, py = y0-sy;\n                     // minimize (px+t*dx)^2 + (py+t*dy)^2 = px*px + 2*px*dx*t + t^2*dx*dx + py*py + 2*py*dy*t + t^2*dy*dy\n                     // derivative: 2*px*dx + 2*py*dy + (2*dx*dx+2*dy*dy)*t, set to 0 and solve\n                     float t = -(px*dx + py*dy) / (dx*dx + dy*dy);\n                     if (t >= 0.0f && t <= 1.0f)\n                        min_dist = dist;\n                  }\n               } else if (verts[i].type == STBTT_vcurve) {\n                  float x2 = verts[i-1].x *scale_x, y2 = verts[i-1].y *scale_y;\n                  float x1 = verts[i  ].cx*scale_x, y1 = verts[i  ].cy*scale_y;\n                  float box_x0 = STBTT_min(STBTT_min(x0,x1),x2);\n                  float box_y0 = STBTT_min(STBTT_min(y0,y1),y2);\n                  float box_x1 = STBTT_max(STBTT_max(x0,x1),x2);\n                  float box_y1 = STBTT_max(STBTT_max(y0,y1),y2);\n                  // coarse culling against bbox to avoid computing cubic unnecessarily\n                  if (sx > box_x0-min_dist && sx < box_x1+min_dist && sy > box_y0-min_dist && sy < box_y1+min_dist) {\n                     int num=0;\n                     float ax = x1-x0, ay = y1-y0;\n                     float bx = x0 - 2*x1 + x2, by = y0 - 2*y1 + y2;\n                     float mx = x0 - sx, my = y0 - sy;\n                     float res[3],px,py,t,it;\n                     float a_inv = precompute[i];\n                     if (a_inv == 0.0) { // if a_inv is 0, it's 2nd degree so use quadratic formula\n                        float a = 3*(ax*bx + ay*by);\n                        float b = 2*(ax*ax + ay*ay) + (mx*bx+my*by);\n                        float c = mx*ax+my*ay;\n                        if (a == 0.0) { // if a is 0, it's linear\n                           if (b != 0.0) {\n                              res[num++] = -c/b;\n                           }\n                        } else {\n                           float discriminant = b*b - 4*a*c;\n                           if (discriminant < 0)\n                              num = 0;\n                           else {\n                              float root = (float) STBTT_sqrt(discriminant);\n                              res[0] = (-b - root)/(2*a);\n                              res[1] = (-b + root)/(2*a);\n                              num = 2; // don't bother distinguishing 1-solution case, as code below will still work\n                           }\n                        }\n                     } else {\n                        float b = 3*(ax*bx + ay*by) * a_inv; // could precompute this as it doesn't depend on sample point\n                        float c = (2*(ax*ax + ay*ay) + (mx*bx+my*by)) * a_inv;\n                        float d = (mx*ax+my*ay) * a_inv;\n                        num = stbtt__solve_cubic(b, c, d, res);\n                     }\n                     if (num >= 1 && res[0] >= 0.0f && res[0] <= 1.0f) {\n                        t = res[0], it = 1.0f - t;\n                        px = it*it*x0 + 2*t*it*x1 + t*t*x2;\n                        py = it*it*y0 + 2*t*it*y1 + t*t*y2;\n                        dist2 = (px-sx)*(px-sx) + (py-sy)*(py-sy);\n                        if (dist2 < min_dist * min_dist)\n                           min_dist = (float) STBTT_sqrt(dist2);\n                     }\n                     if (num >= 2 && res[1] >= 0.0f && res[1] <= 1.0f) {\n                        t = res[1], it = 1.0f - t;\n                        px = it*it*x0 + 2*t*it*x1 + t*t*x2;\n                        py = it*it*y0 + 2*t*it*y1 + t*t*y2;\n                        dist2 = (px-sx)*(px-sx) + (py-sy)*(py-sy);\n                        if (dist2 < min_dist * min_dist)\n                           min_dist = (float) STBTT_sqrt(dist2);\n                     }\n                     if (num >= 3 && res[2] >= 0.0f && res[2] <= 1.0f) {\n                        t = res[2], it = 1.0f - t;\n                        px = it*it*x0 + 2*t*it*x1 + t*t*x2;\n                        py = it*it*y0 + 2*t*it*y1 + t*t*y2;\n                        dist2 = (px-sx)*(px-sx) + (py-sy)*(py-sy);\n                        if (dist2 < min_dist * min_dist)\n                           min_dist = (float) STBTT_sqrt(dist2);\n                     }\n                  }\n               }\n            }\n            if (winding == 0)\n               min_dist = -min_dist;  // if outside the shape, value is negative\n            val = onedge_value + pixel_dist_scale * min_dist;\n            if (val < 0)\n               val = 0;\n            else if (val > 255)\n               val = 255;\n            data[(y-iy0)*w+(x-ix0)] = (unsigned char) val;\n         }\n      }\n      STBTT_free(precompute, info->userdata);\n      STBTT_free(verts, info->userdata);\n   }\n   return data;\n}\n\nSTBTT_DEF unsigned char * stbtt_GetCodepointSDF(const stbtt_fontinfo *info, float scale, int codepoint, int padding, unsigned char onedge_value, float pixel_dist_scale, int *width, int *height, int *xoff, int *yoff)\n{\n   return stbtt_GetGlyphSDF(info, scale, stbtt_FindGlyphIndex(info, codepoint), padding, onedge_value, pixel_dist_scale, width, height, xoff, yoff);\n}\n\nSTBTT_DEF void stbtt_FreeSDF(unsigned char *bitmap, void *userdata)\n{\n   STBTT_free(bitmap, userdata);\n}\n\n//////////////////////////////////////////////////////////////////////////////\n//\n// font name matching -- recommended not to use this\n//\n\n// check if a utf8 string contains a prefix which is the utf16 string; if so return length of matching utf8 string\nstatic stbtt_int32 stbtt__CompareUTF8toUTF16_bigendian_prefix(stbtt_uint8 *s1, stbtt_int32 len1, stbtt_uint8 *s2, stbtt_int32 len2)\n{\n   stbtt_int32 i=0;\n\n   // convert utf16 to utf8 and compare the results while converting\n   while (len2) {\n      stbtt_uint16 ch = s2[0]*256 + s2[1];\n      if (ch < 0x80) {\n         if (i >= len1) return -1;\n         if (s1[i++] != ch) return -1;\n      } else if (ch < 0x800) {\n         if (i+1 >= len1) return -1;\n         if (s1[i++] != 0xc0 + (ch >> 6)) return -1;\n         if (s1[i++] != 0x80 + (ch & 0x3f)) return -1;\n      } else if (ch >= 0xd800 && ch < 0xdc00) {\n         stbtt_uint32 c;\n         stbtt_uint16 ch2 = s2[2]*256 + s2[3];\n         if (i+3 >= len1) return -1;\n         c = ((ch - 0xd800) << 10) + (ch2 - 0xdc00) + 0x10000;\n         if (s1[i++] != 0xf0 + (c >> 18)) return -1;\n         if (s1[i++] != 0x80 + ((c >> 12) & 0x3f)) return -1;\n         if (s1[i++] != 0x80 + ((c >>  6) & 0x3f)) return -1;\n         if (s1[i++] != 0x80 + ((c      ) & 0x3f)) return -1;\n         s2 += 2; // plus another 2 below\n         len2 -= 2;\n      } else if (ch >= 0xdc00 && ch < 0xe000) {\n         return -1;\n      } else {\n         if (i+2 >= len1) return -1;\n         if (s1[i++] != 0xe0 + (ch >> 12)) return -1;\n         if (s1[i++] != 0x80 + ((ch >> 6) & 0x3f)) return -1;\n         if (s1[i++] != 0x80 + ((ch     ) & 0x3f)) return -1;\n      }\n      s2 += 2;\n      len2 -= 2;\n   }\n   return i;\n}\n\nstatic int stbtt_CompareUTF8toUTF16_bigendian_internal(char *s1, int len1, char *s2, int len2)\n{\n   return len1 == stbtt__CompareUTF8toUTF16_bigendian_prefix((stbtt_uint8*) s1, len1, (stbtt_uint8*) s2, len2);\n}\n\n// returns results in whatever encoding you request... but note that 2-byte encodings\n// will be BIG-ENDIAN... use stbtt_CompareUTF8toUTF16_bigendian() to compare\nSTBTT_DEF const char *stbtt_GetFontNameString(const stbtt_fontinfo *font, int *length, int platformID, int encodingID, int languageID, int nameID)\n{\n   stbtt_int32 i,count,stringOffset;\n   stbtt_uint8 *fc = font->data;\n   stbtt_uint32 offset = font->fontstart;\n   stbtt_uint32 nm = stbtt__find_table(fc, offset, \"name\");\n   if (!nm) return NULL;\n\n   count = ttUSHORT(fc+nm+2);\n   stringOffset = nm + ttUSHORT(fc+nm+4);\n   for (i=0; i < count; ++i) {\n      stbtt_uint32 loc = nm + 6 + 12 * i;\n      if (platformID == ttUSHORT(fc+loc+0) && encodingID == ttUSHORT(fc+loc+2)\n          && languageID == ttUSHORT(fc+loc+4) && nameID == ttUSHORT(fc+loc+6)) {\n         *length = ttUSHORT(fc+loc+8);\n         return (const char *) (fc+stringOffset+ttUSHORT(fc+loc+10));\n      }\n   }\n   return NULL;\n}\n\nstatic int stbtt__matchpair(stbtt_uint8 *fc, stbtt_uint32 nm, stbtt_uint8 *name, stbtt_int32 nlen, stbtt_int32 target_id, stbtt_int32 next_id)\n{\n   stbtt_int32 i;\n   stbtt_int32 count = ttUSHORT(fc+nm+2);\n   stbtt_int32 stringOffset = nm + ttUSHORT(fc+nm+4);\n\n   for (i=0; i < count; ++i) {\n      stbtt_uint32 loc = nm + 6 + 12 * i;\n      stbtt_int32 id = ttUSHORT(fc+loc+6);\n      if (id == target_id) {\n         // find the encoding\n         stbtt_int32 platform = ttUSHORT(fc+loc+0), encoding = ttUSHORT(fc+loc+2), language = ttUSHORT(fc+loc+4);\n\n         // is this a Unicode encoding?\n         if (platform == 0 || (platform == 3 && encoding == 1) || (platform == 3 && encoding == 10)) {\n            stbtt_int32 slen = ttUSHORT(fc+loc+8);\n            stbtt_int32 off = ttUSHORT(fc+loc+10);\n\n            // check if there's a prefix match\n            stbtt_int32 matchlen = stbtt__CompareUTF8toUTF16_bigendian_prefix(name, nlen, fc+stringOffset+off,slen);\n            if (matchlen >= 0) {\n               // check for target_id+1 immediately following, with same encoding & language\n               if (i+1 < count && ttUSHORT(fc+loc+12+6) == next_id && ttUSHORT(fc+loc+12) == platform && ttUSHORT(fc+loc+12+2) == encoding && ttUSHORT(fc+loc+12+4) == language) {\n                  slen = ttUSHORT(fc+loc+12+8);\n                  off = ttUSHORT(fc+loc+12+10);\n                  if (slen == 0) {\n                     if (matchlen == nlen)\n                        return 1;\n                  } else if (matchlen < nlen && name[matchlen] == ' ') {\n                     ++matchlen;\n                     if (stbtt_CompareUTF8toUTF16_bigendian_internal((char*) (name+matchlen), nlen-matchlen, (char*)(fc+stringOffset+off),slen))\n                        return 1;\n                  }\n               } else {\n                  // if nothing immediately following\n                  if (matchlen == nlen)\n                     return 1;\n               }\n            }\n         }\n\n         // @TODO handle other encodings\n      }\n   }\n   return 0;\n}\n\nstatic int stbtt__matches(stbtt_uint8 *fc, stbtt_uint32 offset, stbtt_uint8 *name, stbtt_int32 flags)\n{\n   stbtt_int32 nlen = (stbtt_int32) STBTT_strlen((char *) name);\n   stbtt_uint32 nm,hd;\n   if (!stbtt__isfont(fc+offset)) return 0;\n\n   // check italics/bold/underline flags in macStyle...\n   if (flags) {\n      hd = stbtt__find_table(fc, offset, \"head\");\n      if ((ttUSHORT(fc+hd+44) & 7) != (flags & 7)) return 0;\n   }\n\n   nm = stbtt__find_table(fc, offset, \"name\");\n   if (!nm) return 0;\n\n   if (flags) {\n      // if we checked the macStyle flags, then just check the family and ignore the subfamily\n      if (stbtt__matchpair(fc, nm, name, nlen, 16, -1))  return 1;\n      if (stbtt__matchpair(fc, nm, name, nlen,  1, -1))  return 1;\n      if (stbtt__matchpair(fc, nm, name, nlen,  3, -1))  return 1;\n   } else {\n      if (stbtt__matchpair(fc, nm, name, nlen, 16, 17))  return 1;\n      if (stbtt__matchpair(fc, nm, name, nlen,  1,  2))  return 1;\n      if (stbtt__matchpair(fc, nm, name, nlen,  3, -1))  return 1;\n   }\n\n   return 0;\n}\n\nstatic int stbtt_FindMatchingFont_internal(unsigned char *font_collection, char *name_utf8, stbtt_int32 flags)\n{\n   stbtt_int32 i;\n   for (i=0;;++i) {\n      stbtt_int32 off = stbtt_GetFontOffsetForIndex(font_collection, i);\n      if (off < 0) return off;\n      if (stbtt__matches((stbtt_uint8 *) font_collection, off, (stbtt_uint8*) name_utf8, flags))\n         return off;\n   }\n}\n\n#if defined(__GNUC__) || defined(__clang__)\n#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored \"-Wcast-qual\"\n#endif\n\nSTBTT_DEF int stbtt_BakeFontBitmap(const unsigned char *data, int offset,\n                                float pixel_height, unsigned char *pixels, int pw, int ph,\n                                int first_char, int num_chars, stbtt_bakedchar *chardata)\n{\n   return stbtt_BakeFontBitmap_internal((unsigned char *) data, offset, pixel_height, pixels, pw, ph, first_char, num_chars, chardata);\n}\n\nSTBTT_DEF int stbtt_GetFontOffsetForIndex(const unsigned char *data, int index)\n{\n   return stbtt_GetFontOffsetForIndex_internal((unsigned char *) data, index);\n}\n\nSTBTT_DEF int stbtt_GetNumberOfFonts(const unsigned char *data)\n{\n   return stbtt_GetNumberOfFonts_internal((unsigned char *) data);\n}\n\nSTBTT_DEF int stbtt_InitFont(stbtt_fontinfo *info, const unsigned char *data, int offset)\n{\n   return stbtt_InitFont_internal(info, (unsigned char *) data, offset);\n}\n\nSTBTT_DEF int stbtt_FindMatchingFont(const unsigned char *fontdata, const char *name, int flags)\n{\n   return stbtt_FindMatchingFont_internal((unsigned char *) fontdata, (char *) name, flags);\n}\n\nSTBTT_DEF int stbtt_CompareUTF8toUTF16_bigendian(const char *s1, int len1, const char *s2, int len2)\n{\n   return stbtt_CompareUTF8toUTF16_bigendian_internal((char *) s1, len1, (char *) s2, len2);\n}\n\n#if defined(__GNUC__) || defined(__clang__)\n#pragma GCC diagnostic pop\n#endif\n\n#endif // STB_TRUETYPE_IMPLEMENTATION\n\n\n// FULL VERSION HISTORY\n//\n//   1.19 (2018-02-11) OpenType GPOS kerning (horizontal only), STBTT_fmod\n//   1.18 (2018-01-29) add missing function\n//   1.17 (2017-07-23) make more arguments const; doc fix\n//   1.16 (2017-07-12) SDF support\n//   1.15 (2017-03-03) make more arguments const\n//   1.14 (2017-01-16) num-fonts-in-TTC function\n//   1.13 (2017-01-02) support OpenType fonts, certain Apple fonts\n//   1.12 (2016-10-25) suppress warnings about casting away const with -Wcast-qual\n//   1.11 (2016-04-02) fix unused-variable warning\n//   1.10 (2016-04-02) allow user-defined fabs() replacement\n//                     fix memory leak if fontsize=0.0\n//                     fix warning from duplicate typedef\n//   1.09 (2016-01-16) warning fix; avoid crash on outofmem; use alloc userdata for PackFontRanges\n//   1.08 (2015-09-13) document stbtt_Rasterize(); fixes for vertical & horizontal edges\n//   1.07 (2015-08-01) allow PackFontRanges to accept arrays of sparse codepoints;\n//                     allow PackFontRanges to pack and render in separate phases;\n//                     fix stbtt_GetFontOFfsetForIndex (never worked for non-0 input?);\n//                     fixed an assert() bug in the new rasterizer\n//                     replace assert() with STBTT_assert() in new rasterizer\n//   1.06 (2015-07-14) performance improvements (~35% faster on x86 and x64 on test machine)\n//                     also more precise AA rasterizer, except if shapes overlap\n//                     remove need for STBTT_sort\n//   1.05 (2015-04-15) fix misplaced definitions for STBTT_STATIC\n//   1.04 (2015-04-15) typo in example\n//   1.03 (2015-04-12) STBTT_STATIC, fix memory leak in new packing, various fixes\n//   1.02 (2014-12-10) fix various warnings & compile issues w/ stb_rect_pack, C++\n//   1.01 (2014-12-08) fix subpixel position when oversampling to exactly match\n//                        non-oversampled; STBTT_POINT_SIZE for packed case only\n//   1.00 (2014-12-06) add new PackBegin etc. API, w/ support for oversampling\n//   0.99 (2014-09-18) fix multiple bugs with subpixel rendering (ryg)\n//   0.9  (2014-08-07) support certain mac/iOS fonts without an MS platformID\n//   0.8b (2014-07-07) fix a warning\n//   0.8  (2014-05-25) fix a few more warnings\n//   0.7  (2013-09-25) bugfix: subpixel glyph bug fixed in 0.5 had come back\n//   0.6c (2012-07-24) improve documentation\n//   0.6b (2012-07-20) fix a few more warnings\n//   0.6  (2012-07-17) fix warnings; added stbtt_ScaleForMappingEmToPixels,\n//                        stbtt_GetFontBoundingBox, stbtt_IsGlyphEmpty\n//   0.5  (2011-12-09) bugfixes:\n//                        subpixel glyph renderer computed wrong bounding box\n//                        first vertex of shape can be off-curve (FreeSans)\n//   0.4b (2011-12-03) fixed an error in the font baking example\n//   0.4  (2011-12-01) kerning, subpixel rendering (tor)\n//                    bugfixes for:\n//                        codepoint-to-glyph conversion using table fmt=12\n//                        codepoint-to-glyph conversion using table fmt=4\n//                        stbtt_GetBakedQuad with non-square texture (Zer)\n//                    updated Hello World! sample to use kerning and subpixel\n//                    fixed some warnings\n//   0.3  (2009-06-24) cmap fmt=12, compound shapes (MM)\n//                    userdata, malloc-from-userdata, non-zero fill (stb)\n//   0.2  (2009-03-11) Fix unsigned/signed char warnings\n//   0.1  (2009-03-09) First public release\n//\n\n/*\n------------------------------------------------------------------------------\nThis software is available under 2 licenses -- choose whichever you prefer.\n------------------------------------------------------------------------------\nALTERNATIVE A - MIT License\nCopyright (c) 2017 Sean Barrett\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n------------------------------------------------------------------------------\nALTERNATIVE B - Public Domain (www.unlicense.org)\nThis is free and unencumbered software released into the public domain.\nAnyone is free to copy, modify, publish, use, compile, sell, or distribute this\nsoftware, either in source code form or as a compiled binary, for any purpose,\ncommercial or non-commercial, and by any means.\nIn jurisdictions that recognize copyright laws, the author or authors of this\nsoftware dedicate any and all copyright interest in the software to the public\ndomain. We make this dedication for the benefit of the public at large and to\nthe detriment of our heirs and successors. We intend this dedication to be an\novert act of relinquishment in perpetuity of all present and future rights to\nthis software under copyright law.\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\nACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n------------------------------------------------------------------------------\n*/\n"
  },
  {
    "path": "R3nzSkin/json/json.hpp",
    "content": "/*\n    __ _____ _____ _____\n __|  |   __|     |   | |  JSON for Modern C++\n|  |  |__   |  |  | | | |  version 3.9.1\n|_____|_____|_____|_|___|  https://github.com/nlohmann/json\n\nLicensed under the MIT License <http://opensource.org/licenses/MIT>.\nSPDX-License-Identifier: MIT\nCopyright (c) 2013-2019 Niels Lohmann <http://nlohmann.me>.\n\nPermission is hereby  granted, free of charge, to any  person obtaining a copy\nof this software and associated  documentation files (the \"Software\"), to deal\nin the Software  without restriction, including without  limitation the rights\nto  use, copy,  modify, merge,  publish, distribute,  sublicense, and/or  sell\ncopies  of  the Software,  and  to  permit persons  to  whom  the Software  is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE  IS PROVIDED \"AS  IS\", WITHOUT WARRANTY  OF ANY KIND,  EXPRESS OR\nIMPLIED,  INCLUDING BUT  NOT  LIMITED TO  THE  WARRANTIES OF  MERCHANTABILITY,\nFITNESS FOR  A PARTICULAR PURPOSE AND  NONINFRINGEMENT. IN NO EVENT  SHALL THE\nAUTHORS  OR COPYRIGHT  HOLDERS  BE  LIABLE FOR  ANY  CLAIM,  DAMAGES OR  OTHER\nLIABILITY, WHETHER IN AN ACTION OF  CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE  OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\n\n#ifndef INCLUDE_NLOHMANN_JSON_HPP_\n#define INCLUDE_NLOHMANN_JSON_HPP_\n\n#define NLOHMANN_JSON_VERSION_MAJOR 3\n#define NLOHMANN_JSON_VERSION_MINOR 9\n#define NLOHMANN_JSON_VERSION_PATCH 1\n\n#include <algorithm> // all_of, find, for_each\n#include <cstddef> // nullptr_t, ptrdiff_t, size_t\n#include <functional> // hash, less\n#include <initializer_list> // initializer_list\n#include <iosfwd> // istream, ostream\n#include <iterator> // random_access_iterator_tag\n#include <memory> // unique_ptr\n#include <numeric> // accumulate\n#include <string> // string, stoi, to_string\n#include <utility> // declval, forward, move, pair, swap\n#include <vector> // vector\n\n// #include <nlohmann/adl_serializer.hpp>\n\n\n#include <utility>\n\n// #include <nlohmann/detail/conversions/from_json.hpp>\n\n\n#include <algorithm> // transform\n#include <array> // array\n#include <forward_list> // forward_list\n#include <iterator> // inserter, front_inserter, end\n#include <map> // map\n#include <string> // string\n#include <tuple> // tuple, make_tuple\n#include <type_traits> // is_arithmetic, is_same, is_enum, underlying_type, is_convertible\n#include <unordered_map> // unordered_map\n#include <utility> // pair, declval\n#include <valarray> // valarray\n\n// #include <nlohmann/detail/exceptions.hpp>\n\n\n#include <exception> // exception\n#include <stdexcept> // runtime_error\n#include <string> // to_string\n\n// #include <nlohmann/detail/input/position_t.hpp>\n\n\n#include <cstddef> // size_t\n\nnamespace nlohmann\n{\nnamespace detail\n{\n/// struct to capture the start position of the current token\nstruct position_t\n{\n    /// the total number of characters read\n    std::size_t chars_read_total = 0;\n    /// the number of characters read in the current line\n    std::size_t chars_read_current_line = 0;\n    /// the number of lines read\n    std::size_t lines_read = 0;\n\n    /// conversion to size_t to preserve SAX interface\n    constexpr operator size_t() const\n    {\n        return chars_read_total;\n    }\n};\n\n} // namespace detail\n} // namespace nlohmann\n\n// #include <nlohmann/detail/macro_scope.hpp>\n\n\n#include <utility> // pair\n// #include <nlohmann/thirdparty/hedley/hedley.hpp>\n/* Hedley - https://nemequ.github.io/hedley\n * Created by Evan Nemerson <evan@nemerson.com>\n *\n * To the extent possible under law, the author(s) have dedicated all\n * copyright and related and neighboring rights to this software to\n * the public domain worldwide. This software is distributed without\n * any warranty.\n *\n * For details, see <http://creativecommons.org/publicdomain/zero/1.0/>.\n * SPDX-License-Identifier: CC0-1.0\n */\n\n#if !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < 14)\n#if defined(JSON_HEDLEY_VERSION)\n    #undef JSON_HEDLEY_VERSION\n#endif\n#define JSON_HEDLEY_VERSION 14\n\n#if defined(JSON_HEDLEY_STRINGIFY_EX)\n    #undef JSON_HEDLEY_STRINGIFY_EX\n#endif\n#define JSON_HEDLEY_STRINGIFY_EX(x) #x\n\n#if defined(JSON_HEDLEY_STRINGIFY)\n    #undef JSON_HEDLEY_STRINGIFY\n#endif\n#define JSON_HEDLEY_STRINGIFY(x) JSON_HEDLEY_STRINGIFY_EX(x)\n\n#if defined(JSON_HEDLEY_CONCAT_EX)\n    #undef JSON_HEDLEY_CONCAT_EX\n#endif\n#define JSON_HEDLEY_CONCAT_EX(a,b) a##b\n\n#if defined(JSON_HEDLEY_CONCAT)\n    #undef JSON_HEDLEY_CONCAT\n#endif\n#define JSON_HEDLEY_CONCAT(a,b) JSON_HEDLEY_CONCAT_EX(a,b)\n\n#if defined(JSON_HEDLEY_CONCAT3_EX)\n    #undef JSON_HEDLEY_CONCAT3_EX\n#endif\n#define JSON_HEDLEY_CONCAT3_EX(a,b,c) a##b##c\n\n#if defined(JSON_HEDLEY_CONCAT3)\n    #undef JSON_HEDLEY_CONCAT3\n#endif\n#define JSON_HEDLEY_CONCAT3(a,b,c) JSON_HEDLEY_CONCAT3_EX(a,b,c)\n\n#if defined(JSON_HEDLEY_VERSION_ENCODE)\n    #undef JSON_HEDLEY_VERSION_ENCODE\n#endif\n#define JSON_HEDLEY_VERSION_ENCODE(major,minor,revision) (((major) * 1000000) + ((minor) * 1000) + (revision))\n\n#if defined(JSON_HEDLEY_VERSION_DECODE_MAJOR)\n    #undef JSON_HEDLEY_VERSION_DECODE_MAJOR\n#endif\n#define JSON_HEDLEY_VERSION_DECODE_MAJOR(version) ((version) / 1000000)\n\n#if defined(JSON_HEDLEY_VERSION_DECODE_MINOR)\n    #undef JSON_HEDLEY_VERSION_DECODE_MINOR\n#endif\n#define JSON_HEDLEY_VERSION_DECODE_MINOR(version) (((version) % 1000000) / 1000)\n\n#if defined(JSON_HEDLEY_VERSION_DECODE_REVISION)\n    #undef JSON_HEDLEY_VERSION_DECODE_REVISION\n#endif\n#define JSON_HEDLEY_VERSION_DECODE_REVISION(version) ((version) % 1000)\n\n#if defined(JSON_HEDLEY_GNUC_VERSION)\n    #undef JSON_HEDLEY_GNUC_VERSION\n#endif\n#if defined(__GNUC__) && defined(__GNUC_PATCHLEVEL__)\n    #define JSON_HEDLEY_GNUC_VERSION JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)\n#elif defined(__GNUC__)\n    #define JSON_HEDLEY_GNUC_VERSION JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, 0)\n#endif\n\n#if defined(JSON_HEDLEY_GNUC_VERSION_CHECK)\n    #undef JSON_HEDLEY_GNUC_VERSION_CHECK\n#endif\n#if defined(JSON_HEDLEY_GNUC_VERSION)\n    #define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GNUC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))\n#else\n    #define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (0)\n#endif\n\n#if defined(JSON_HEDLEY_MSVC_VERSION)\n    #undef JSON_HEDLEY_MSVC_VERSION\n#endif\n#if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 140000000) && !defined(__ICL)\n    #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 10000000, (_MSC_FULL_VER % 10000000) / 100000, (_MSC_FULL_VER % 100000) / 100)\n#elif defined(_MSC_FULL_VER) && !defined(__ICL)\n    #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 1000000, (_MSC_FULL_VER % 1000000) / 10000, (_MSC_FULL_VER % 10000) / 10)\n#elif defined(_MSC_VER) && !defined(__ICL)\n    #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_VER / 100, _MSC_VER % 100, 0)\n#endif\n\n#if defined(JSON_HEDLEY_MSVC_VERSION_CHECK)\n    #undef JSON_HEDLEY_MSVC_VERSION_CHECK\n#endif\n#if !defined(JSON_HEDLEY_MSVC_VERSION)\n    #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (0)\n#elif defined(_MSC_VER) && (_MSC_VER >= 1400)\n    #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 10000000) + (minor * 100000) + (patch)))\n#elif defined(_MSC_VER) && (_MSC_VER >= 1200)\n    #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 1000000) + (minor * 10000) + (patch)))\n#else\n    #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_VER >= ((major * 100) + (minor)))\n#endif\n\n#if defined(JSON_HEDLEY_INTEL_VERSION)\n    #undef JSON_HEDLEY_INTEL_VERSION\n#endif\n#if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && !defined(__ICL)\n    #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, __INTEL_COMPILER_UPDATE)\n#elif defined(__INTEL_COMPILER) && !defined(__ICL)\n    #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, 0)\n#endif\n\n#if defined(JSON_HEDLEY_INTEL_VERSION_CHECK)\n    #undef JSON_HEDLEY_INTEL_VERSION_CHECK\n#endif\n#if defined(JSON_HEDLEY_INTEL_VERSION)\n    #define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_INTEL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))\n#else\n    #define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (0)\n#endif\n\n#if defined(JSON_HEDLEY_INTEL_CL_VERSION)\n    #undef JSON_HEDLEY_INTEL_CL_VERSION\n#endif\n#if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && defined(__ICL)\n    #define JSON_HEDLEY_INTEL_CL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER, __INTEL_COMPILER_UPDATE, 0)\n#endif\n\n#if defined(JSON_HEDLEY_INTEL_CL_VERSION_CHECK)\n    #undef JSON_HEDLEY_INTEL_CL_VERSION_CHECK\n#endif\n#if defined(JSON_HEDLEY_INTEL_CL_VERSION)\n    #define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_INTEL_CL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))\n#else\n    #define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (0)\n#endif\n\n#if defined(JSON_HEDLEY_PGI_VERSION)\n    #undef JSON_HEDLEY_PGI_VERSION\n#endif\n#if defined(__PGI) && defined(__PGIC__) && defined(__PGIC_MINOR__) && defined(__PGIC_PATCHLEVEL__)\n    #define JSON_HEDLEY_PGI_VERSION JSON_HEDLEY_VERSION_ENCODE(__PGIC__, __PGIC_MINOR__, __PGIC_PATCHLEVEL__)\n#endif\n\n#if defined(JSON_HEDLEY_PGI_VERSION_CHECK)\n    #undef JSON_HEDLEY_PGI_VERSION_CHECK\n#endif\n#if defined(JSON_HEDLEY_PGI_VERSION)\n    #define JSON_HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_PGI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))\n#else\n    #define JSON_HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (0)\n#endif\n\n#if defined(JSON_HEDLEY_SUNPRO_VERSION)\n    #undef JSON_HEDLEY_SUNPRO_VERSION\n#endif\n#if defined(__SUNPRO_C) && (__SUNPRO_C > 0x1000)\n    #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((((__SUNPRO_C >> 16) & 0xf) * 10) + ((__SUNPRO_C >> 12) & 0xf), (((__SUNPRO_C >> 8) & 0xf) * 10) + ((__SUNPRO_C >> 4) & 0xf), (__SUNPRO_C & 0xf) * 10)\n#elif defined(__SUNPRO_C)\n    #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_C >> 8) & 0xf, (__SUNPRO_C >> 4) & 0xf, (__SUNPRO_C) & 0xf)\n#elif defined(__SUNPRO_CC) && (__SUNPRO_CC > 0x1000)\n    #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((((__SUNPRO_CC >> 16) & 0xf) * 10) + ((__SUNPRO_CC >> 12) & 0xf), (((__SUNPRO_CC >> 8) & 0xf) * 10) + ((__SUNPRO_CC >> 4) & 0xf), (__SUNPRO_CC & 0xf) * 10)\n#elif defined(__SUNPRO_CC)\n    #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_CC >> 8) & 0xf, (__SUNPRO_CC >> 4) & 0xf, (__SUNPRO_CC) & 0xf)\n#endif\n\n#if defined(JSON_HEDLEY_SUNPRO_VERSION_CHECK)\n    #undef JSON_HEDLEY_SUNPRO_VERSION_CHECK\n#endif\n#if defined(JSON_HEDLEY_SUNPRO_VERSION)\n    #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_SUNPRO_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))\n#else\n    #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (0)\n#endif\n\n#if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION)\n    #undef JSON_HEDLEY_EMSCRIPTEN_VERSION\n#endif\n#if defined(__EMSCRIPTEN__)\n    #define JSON_HEDLEY_EMSCRIPTEN_VERSION JSON_HEDLEY_VERSION_ENCODE(__EMSCRIPTEN_major__, __EMSCRIPTEN_minor__, __EMSCRIPTEN_tiny__)\n#endif\n\n#if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK)\n    #undef JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK\n#endif\n#if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION)\n    #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_EMSCRIPTEN_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))\n#else\n    #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (0)\n#endif\n\n#if defined(JSON_HEDLEY_ARM_VERSION)\n    #undef JSON_HEDLEY_ARM_VERSION\n#endif\n#if defined(__CC_ARM) && defined(__ARMCOMPILER_VERSION)\n    #define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCOMPILER_VERSION / 1000000, (__ARMCOMPILER_VERSION % 1000000) / 10000, (__ARMCOMPILER_VERSION % 10000) / 100)\n#elif defined(__CC_ARM) && defined(__ARMCC_VERSION)\n    #define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCC_VERSION / 1000000, (__ARMCC_VERSION % 1000000) / 10000, (__ARMCC_VERSION % 10000) / 100)\n#endif\n\n#if defined(JSON_HEDLEY_ARM_VERSION_CHECK)\n    #undef JSON_HEDLEY_ARM_VERSION_CHECK\n#endif\n#if defined(JSON_HEDLEY_ARM_VERSION)\n    #define JSON_HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_ARM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))\n#else\n    #define JSON_HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (0)\n#endif\n\n#if defined(JSON_HEDLEY_IBM_VERSION)\n    #undef JSON_HEDLEY_IBM_VERSION\n#endif\n#if defined(__ibmxl__)\n    #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ibmxl_version__, __ibmxl_release__, __ibmxl_modification__)\n#elif defined(__xlC__) && defined(__xlC_ver__)\n    #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, (__xlC_ver__ >> 8) & 0xff)\n#elif defined(__xlC__)\n    #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, 0)\n#endif\n\n#if defined(JSON_HEDLEY_IBM_VERSION_CHECK)\n    #undef JSON_HEDLEY_IBM_VERSION_CHECK\n#endif\n#if defined(JSON_HEDLEY_IBM_VERSION)\n    #define JSON_HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_IBM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))\n#else\n    #define JSON_HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (0)\n#endif\n\n#if defined(JSON_HEDLEY_TI_VERSION)\n    #undef JSON_HEDLEY_TI_VERSION\n#endif\n#if \\\n    defined(__TI_COMPILER_VERSION__) && \\\n    ( \\\n      defined(__TMS470__) || defined(__TI_ARM__) || \\\n      defined(__MSP430__) || \\\n      defined(__TMS320C2000__) \\\n    )\n#if (__TI_COMPILER_VERSION__ >= 16000000)\n    #define JSON_HEDLEY_TI_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000))\n#endif\n#endif\n\n#if defined(JSON_HEDLEY_TI_VERSION_CHECK)\n    #undef JSON_HEDLEY_TI_VERSION_CHECK\n#endif\n#if defined(JSON_HEDLEY_TI_VERSION)\n    #define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))\n#else\n    #define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (0)\n#endif\n\n#if defined(JSON_HEDLEY_TI_CL2000_VERSION)\n    #undef JSON_HEDLEY_TI_CL2000_VERSION\n#endif\n#if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C2000__)\n    #define JSON_HEDLEY_TI_CL2000_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000))\n#endif\n\n#if defined(JSON_HEDLEY_TI_CL2000_VERSION_CHECK)\n    #undef JSON_HEDLEY_TI_CL2000_VERSION_CHECK\n#endif\n#if defined(JSON_HEDLEY_TI_CL2000_VERSION)\n    #define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL2000_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))\n#else\n    #define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (0)\n#endif\n\n#if defined(JSON_HEDLEY_TI_CL430_VERSION)\n    #undef JSON_HEDLEY_TI_CL430_VERSION\n#endif\n#if defined(__TI_COMPILER_VERSION__) && defined(__MSP430__)\n    #define JSON_HEDLEY_TI_CL430_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000))\n#endif\n\n#if defined(JSON_HEDLEY_TI_CL430_VERSION_CHECK)\n    #undef JSON_HEDLEY_TI_CL430_VERSION_CHECK\n#endif\n#if defined(JSON_HEDLEY_TI_CL430_VERSION)\n    #define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL430_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))\n#else\n    #define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (0)\n#endif\n\n#if defined(JSON_HEDLEY_TI_ARMCL_VERSION)\n    #undef JSON_HEDLEY_TI_ARMCL_VERSION\n#endif\n#if defined(__TI_COMPILER_VERSION__) && (defined(__TMS470__) || defined(__TI_ARM__))\n    #define JSON_HEDLEY_TI_ARMCL_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000))\n#endif\n\n#if defined(JSON_HEDLEY_TI_ARMCL_VERSION_CHECK)\n    #undef JSON_HEDLEY_TI_ARMCL_VERSION_CHECK\n#endif\n#if defined(JSON_HEDLEY_TI_ARMCL_VERSION)\n    #define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_ARMCL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))\n#else\n    #define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (0)\n#endif\n\n#if defined(JSON_HEDLEY_TI_CL6X_VERSION)\n    #undef JSON_HEDLEY_TI_CL6X_VERSION\n#endif\n#if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C6X__)\n    #define JSON_HEDLEY_TI_CL6X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000))\n#endif\n\n#if defined(JSON_HEDLEY_TI_CL6X_VERSION_CHECK)\n    #undef JSON_HEDLEY_TI_CL6X_VERSION_CHECK\n#endif\n#if defined(JSON_HEDLEY_TI_CL6X_VERSION)\n    #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL6X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))\n#else\n    #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (0)\n#endif\n\n#if defined(JSON_HEDLEY_TI_CL7X_VERSION)\n    #undef JSON_HEDLEY_TI_CL7X_VERSION\n#endif\n#if defined(__TI_COMPILER_VERSION__) && defined(__C7000__)\n    #define JSON_HEDLEY_TI_CL7X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000))\n#endif\n\n#if defined(JSON_HEDLEY_TI_CL7X_VERSION_CHECK)\n    #undef JSON_HEDLEY_TI_CL7X_VERSION_CHECK\n#endif\n#if defined(JSON_HEDLEY_TI_CL7X_VERSION)\n    #define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL7X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))\n#else\n    #define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (0)\n#endif\n\n#if defined(JSON_HEDLEY_TI_CLPRU_VERSION)\n    #undef JSON_HEDLEY_TI_CLPRU_VERSION\n#endif\n#if defined(__TI_COMPILER_VERSION__) && defined(__PRU__)\n    #define JSON_HEDLEY_TI_CLPRU_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000))\n#endif\n\n#if defined(JSON_HEDLEY_TI_CLPRU_VERSION_CHECK)\n    #undef JSON_HEDLEY_TI_CLPRU_VERSION_CHECK\n#endif\n#if defined(JSON_HEDLEY_TI_CLPRU_VERSION)\n    #define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CLPRU_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))\n#else\n    #define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (0)\n#endif\n\n#if defined(JSON_HEDLEY_CRAY_VERSION)\n    #undef JSON_HEDLEY_CRAY_VERSION\n#endif\n#if defined(_CRAYC)\n    #if defined(_RELEASE_PATCHLEVEL)\n        #define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, _RELEASE_PATCHLEVEL)\n    #else\n        #define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, 0)\n    #endif\n#endif\n\n#if defined(JSON_HEDLEY_CRAY_VERSION_CHECK)\n    #undef JSON_HEDLEY_CRAY_VERSION_CHECK\n#endif\n#if defined(JSON_HEDLEY_CRAY_VERSION)\n    #define JSON_HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_CRAY_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))\n#else\n    #define JSON_HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (0)\n#endif\n\n#if defined(JSON_HEDLEY_IAR_VERSION)\n    #undef JSON_HEDLEY_IAR_VERSION\n#endif\n#if defined(__IAR_SYSTEMS_ICC__)\n    #if __VER__ > 1000\n        #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE((__VER__ / 1000000), ((__VER__ / 1000) % 1000), (__VER__ % 1000))\n    #else\n        #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE(VER / 100, __VER__ % 100, 0)\n    #endif\n#endif\n\n#if defined(JSON_HEDLEY_IAR_VERSION_CHECK)\n    #undef JSON_HEDLEY_IAR_VERSION_CHECK\n#endif\n#if defined(JSON_HEDLEY_IAR_VERSION)\n    #define JSON_HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_IAR_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))\n#else\n    #define JSON_HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (0)\n#endif\n\n#if defined(JSON_HEDLEY_TINYC_VERSION)\n    #undef JSON_HEDLEY_TINYC_VERSION\n#endif\n#if defined(__TINYC__)\n    #define JSON_HEDLEY_TINYC_VERSION JSON_HEDLEY_VERSION_ENCODE(__TINYC__ / 1000, (__TINYC__ / 100) % 10, __TINYC__ % 100)\n#endif\n\n#if defined(JSON_HEDLEY_TINYC_VERSION_CHECK)\n    #undef JSON_HEDLEY_TINYC_VERSION_CHECK\n#endif\n#if defined(JSON_HEDLEY_TINYC_VERSION)\n    #define JSON_HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TINYC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))\n#else\n    #define JSON_HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (0)\n#endif\n\n#if defined(JSON_HEDLEY_DMC_VERSION)\n    #undef JSON_HEDLEY_DMC_VERSION\n#endif\n#if defined(__DMC__)\n    #define JSON_HEDLEY_DMC_VERSION JSON_HEDLEY_VERSION_ENCODE(__DMC__ >> 8, (__DMC__ >> 4) & 0xf, __DMC__ & 0xf)\n#endif\n\n#if defined(JSON_HEDLEY_DMC_VERSION_CHECK)\n    #undef JSON_HEDLEY_DMC_VERSION_CHECK\n#endif\n#if defined(JSON_HEDLEY_DMC_VERSION)\n    #define JSON_HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_DMC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))\n#else\n    #define JSON_HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (0)\n#endif\n\n#if defined(JSON_HEDLEY_COMPCERT_VERSION)\n    #undef JSON_HEDLEY_COMPCERT_VERSION\n#endif\n#if defined(__COMPCERT_VERSION__)\n    #define JSON_HEDLEY_COMPCERT_VERSION JSON_HEDLEY_VERSION_ENCODE(__COMPCERT_VERSION__ / 10000, (__COMPCERT_VERSION__ / 100) % 100, __COMPCERT_VERSION__ % 100)\n#endif\n\n#if defined(JSON_HEDLEY_COMPCERT_VERSION_CHECK)\n    #undef JSON_HEDLEY_COMPCERT_VERSION_CHECK\n#endif\n#if defined(JSON_HEDLEY_COMPCERT_VERSION)\n    #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_COMPCERT_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))\n#else\n    #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (0)\n#endif\n\n#if defined(JSON_HEDLEY_PELLES_VERSION)\n    #undef JSON_HEDLEY_PELLES_VERSION\n#endif\n#if defined(__POCC__)\n    #define JSON_HEDLEY_PELLES_VERSION JSON_HEDLEY_VERSION_ENCODE(__POCC__ / 100, __POCC__ % 100, 0)\n#endif\n\n#if defined(JSON_HEDLEY_PELLES_VERSION_CHECK)\n    #undef JSON_HEDLEY_PELLES_VERSION_CHECK\n#endif\n#if defined(JSON_HEDLEY_PELLES_VERSION)\n    #define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_PELLES_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))\n#else\n    #define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (0)\n#endif\n\n#if defined(JSON_HEDLEY_GCC_VERSION)\n    #undef JSON_HEDLEY_GCC_VERSION\n#endif\n#if \\\n    defined(JSON_HEDLEY_GNUC_VERSION) && \\\n    !defined(__clang__) && \\\n    !defined(JSON_HEDLEY_INTEL_VERSION) && \\\n    !defined(JSON_HEDLEY_PGI_VERSION) && \\\n    !defined(JSON_HEDLEY_ARM_VERSION) && \\\n    !defined(JSON_HEDLEY_TI_VERSION) && \\\n    !defined(JSON_HEDLEY_TI_ARMCL_VERSION) && \\\n    !defined(JSON_HEDLEY_TI_CL430_VERSION) && \\\n    !defined(JSON_HEDLEY_TI_CL2000_VERSION) && \\\n    !defined(JSON_HEDLEY_TI_CL6X_VERSION) && \\\n    !defined(JSON_HEDLEY_TI_CL7X_VERSION) && \\\n    !defined(JSON_HEDLEY_TI_CLPRU_VERSION) && \\\n    !defined(__COMPCERT__)\n    #define JSON_HEDLEY_GCC_VERSION JSON_HEDLEY_GNUC_VERSION\n#endif\n\n#if defined(JSON_HEDLEY_GCC_VERSION_CHECK)\n    #undef JSON_HEDLEY_GCC_VERSION_CHECK\n#endif\n#if defined(JSON_HEDLEY_GCC_VERSION)\n    #define JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GCC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))\n#else\n    #define JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (0)\n#endif\n\n#if defined(JSON_HEDLEY_HAS_ATTRIBUTE)\n    #undef JSON_HEDLEY_HAS_ATTRIBUTE\n#endif\n#if defined(__has_attribute)\n    #define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) __has_attribute(attribute)\n#else\n    #define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) (0)\n#endif\n\n#if defined(JSON_HEDLEY_GNUC_HAS_ATTRIBUTE)\n    #undef JSON_HEDLEY_GNUC_HAS_ATTRIBUTE\n#endif\n#if defined(__has_attribute)\n    #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) __has_attribute(attribute)\n#else\n    #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch)\n#endif\n\n#if defined(JSON_HEDLEY_GCC_HAS_ATTRIBUTE)\n    #undef JSON_HEDLEY_GCC_HAS_ATTRIBUTE\n#endif\n#if defined(__has_attribute)\n    #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) __has_attribute(attribute)\n#else\n    #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)\n#endif\n\n#if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE)\n    #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE\n#endif\n#if \\\n    defined(__has_cpp_attribute) && \\\n    defined(__cplusplus) && \\\n    (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0))\n    #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) __has_cpp_attribute(attribute)\n#else\n    #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) (0)\n#endif\n\n#if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS)\n    #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS\n#endif\n#if !defined(__cplusplus) || !defined(__has_cpp_attribute)\n    #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0)\n#elif \\\n    !defined(JSON_HEDLEY_PGI_VERSION) && \\\n    !defined(JSON_HEDLEY_IAR_VERSION) && \\\n    (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0)) && \\\n    (!defined(JSON_HEDLEY_MSVC_VERSION) || JSON_HEDLEY_MSVC_VERSION_CHECK(19,20,0))\n    #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(ns::attribute)\n#else\n    #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0)\n#endif\n\n#if defined(JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE)\n    #undef JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE\n#endif\n#if defined(__has_cpp_attribute) && defined(__cplusplus)\n    #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute)\n#else\n    #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch)\n#endif\n\n#if defined(JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE)\n    #undef JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE\n#endif\n#if defined(__has_cpp_attribute) && defined(__cplusplus)\n    #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute)\n#else\n    #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)\n#endif\n\n#if defined(JSON_HEDLEY_HAS_BUILTIN)\n    #undef JSON_HEDLEY_HAS_BUILTIN\n#endif\n#if defined(__has_builtin)\n    #define JSON_HEDLEY_HAS_BUILTIN(builtin) __has_builtin(builtin)\n#else\n    #define JSON_HEDLEY_HAS_BUILTIN(builtin) (0)\n#endif\n\n#if defined(JSON_HEDLEY_GNUC_HAS_BUILTIN)\n    #undef JSON_HEDLEY_GNUC_HAS_BUILTIN\n#endif\n#if defined(__has_builtin)\n    #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin)\n#else\n    #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch)\n#endif\n\n#if defined(JSON_HEDLEY_GCC_HAS_BUILTIN)\n    #undef JSON_HEDLEY_GCC_HAS_BUILTIN\n#endif\n#if defined(__has_builtin)\n    #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin)\n#else\n    #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)\n#endif\n\n#if defined(JSON_HEDLEY_HAS_FEATURE)\n    #undef JSON_HEDLEY_HAS_FEATURE\n#endif\n#if defined(__has_feature)\n    #define JSON_HEDLEY_HAS_FEATURE(feature) __has_feature(feature)\n#else\n    #define JSON_HEDLEY_HAS_FEATURE(feature) (0)\n#endif\n\n#if defined(JSON_HEDLEY_GNUC_HAS_FEATURE)\n    #undef JSON_HEDLEY_GNUC_HAS_FEATURE\n#endif\n#if defined(__has_feature)\n    #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature)\n#else\n    #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch)\n#endif\n\n#if defined(JSON_HEDLEY_GCC_HAS_FEATURE)\n    #undef JSON_HEDLEY_GCC_HAS_FEATURE\n#endif\n#if defined(__has_feature)\n    #define JSON_HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature)\n#else\n    #define JSON_HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)\n#endif\n\n#if defined(JSON_HEDLEY_HAS_EXTENSION)\n    #undef JSON_HEDLEY_HAS_EXTENSION\n#endif\n#if defined(__has_extension)\n    #define JSON_HEDLEY_HAS_EXTENSION(extension) __has_extension(extension)\n#else\n    #define JSON_HEDLEY_HAS_EXTENSION(extension) (0)\n#endif\n\n#if defined(JSON_HEDLEY_GNUC_HAS_EXTENSION)\n    #undef JSON_HEDLEY_GNUC_HAS_EXTENSION\n#endif\n#if defined(__has_extension)\n    #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension)\n#else\n    #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch)\n#endif\n\n#if defined(JSON_HEDLEY_GCC_HAS_EXTENSION)\n    #undef JSON_HEDLEY_GCC_HAS_EXTENSION\n#endif\n#if defined(__has_extension)\n    #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension)\n#else\n    #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)\n#endif\n\n#if defined(JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE)\n    #undef JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE\n#endif\n#if defined(__has_declspec_attribute)\n    #define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) __has_declspec_attribute(attribute)\n#else\n    #define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) (0)\n#endif\n\n#if defined(JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE)\n    #undef JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE\n#endif\n#if defined(__has_declspec_attribute)\n    #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute)\n#else\n    #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch)\n#endif\n\n#if defined(JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE)\n    #undef JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE\n#endif\n#if defined(__has_declspec_attribute)\n    #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute)\n#else\n    #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)\n#endif\n\n#if defined(JSON_HEDLEY_HAS_WARNING)\n    #undef JSON_HEDLEY_HAS_WARNING\n#endif\n#if defined(__has_warning)\n    #define JSON_HEDLEY_HAS_WARNING(warning) __has_warning(warning)\n#else\n    #define JSON_HEDLEY_HAS_WARNING(warning) (0)\n#endif\n\n#if defined(JSON_HEDLEY_GNUC_HAS_WARNING)\n    #undef JSON_HEDLEY_GNUC_HAS_WARNING\n#endif\n#if defined(__has_warning)\n    #define JSON_HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning)\n#else\n    #define JSON_HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch)\n#endif\n\n#if defined(JSON_HEDLEY_GCC_HAS_WARNING)\n    #undef JSON_HEDLEY_GCC_HAS_WARNING\n#endif\n#if defined(__has_warning)\n    #define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning)\n#else\n    #define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)\n#endif\n\n#if \\\n    (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \\\n    defined(__clang__) || \\\n    JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \\\n    JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \\\n    JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \\\n    JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \\\n    JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \\\n    JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \\\n    JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \\\n    JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \\\n    JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \\\n    JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,0,0) || \\\n    JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \\\n    JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \\\n    JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0) || \\\n    JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,17) || \\\n    JSON_HEDLEY_SUNPRO_VERSION_CHECK(8,0,0) || \\\n    (JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) && defined(__C99_PRAGMA_OPERATOR))\n    #define JSON_HEDLEY_PRAGMA(value) _Pragma(#value)\n#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0)\n    #define JSON_HEDLEY_PRAGMA(value) __pragma(value)\n#else\n    #define JSON_HEDLEY_PRAGMA(value)\n#endif\n\n#if defined(JSON_HEDLEY_DIAGNOSTIC_PUSH)\n    #undef JSON_HEDLEY_DIAGNOSTIC_PUSH\n#endif\n#if defined(JSON_HEDLEY_DIAGNOSTIC_POP)\n    #undef JSON_HEDLEY_DIAGNOSTIC_POP\n#endif\n#if defined(__clang__)\n    #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma(\"clang diagnostic push\")\n    #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma(\"clang diagnostic pop\")\n#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)\n    #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma(\"warning(push)\")\n    #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma(\"warning(pop)\")\n#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0)\n    #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma(\"GCC diagnostic push\")\n    #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma(\"GCC diagnostic pop\")\n#elif \\\n    JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \\\n    JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)\n    #define JSON_HEDLEY_DIAGNOSTIC_PUSH __pragma(warning(push))\n    #define JSON_HEDLEY_DIAGNOSTIC_POP __pragma(warning(pop))\n#elif JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0)\n    #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma(\"push\")\n    #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma(\"pop\")\n#elif \\\n    JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \\\n    JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \\\n    JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,4,0) || \\\n    JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \\\n    JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \\\n    JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0)\n    #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma(\"diag_push\")\n    #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma(\"diag_pop\")\n#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0)\n    #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma(\"warning(push)\")\n    #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma(\"warning(pop)\")\n#else\n    #define JSON_HEDLEY_DIAGNOSTIC_PUSH\n    #define JSON_HEDLEY_DIAGNOSTIC_POP\n#endif\n\n/* JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ is for\n   HEDLEY INTERNAL USE ONLY.  API subject to change without notice. */\n#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_)\n    #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_\n#endif\n#if defined(__cplusplus)\n#  if JSON_HEDLEY_HAS_WARNING(\"-Wc++98-compat\")\n#    if JSON_HEDLEY_HAS_WARNING(\"-Wc++17-extensions\")\n#      if JSON_HEDLEY_HAS_WARNING(\"-Wc++1z-extensions\")\n#        define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \\\n    JSON_HEDLEY_DIAGNOSTIC_PUSH \\\n    _Pragma(\"clang diagnostic ignored \\\"-Wc++98-compat\\\"\") \\\n    _Pragma(\"clang diagnostic ignored \\\"-Wc++17-extensions\\\"\") \\\n    _Pragma(\"clang diagnostic ignored \\\"-Wc++1z-extensions\\\"\") \\\n    xpr \\\n    JSON_HEDLEY_DIAGNOSTIC_POP\n#      else\n#        define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \\\n    JSON_HEDLEY_DIAGNOSTIC_PUSH \\\n    _Pragma(\"clang diagnostic ignored \\\"-Wc++98-compat\\\"\") \\\n    _Pragma(\"clang diagnostic ignored \\\"-Wc++17-extensions\\\"\") \\\n    xpr \\\n    JSON_HEDLEY_DIAGNOSTIC_POP\n#      endif\n#    else\n#      define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \\\n    JSON_HEDLEY_DIAGNOSTIC_PUSH \\\n    _Pragma(\"clang diagnostic ignored \\\"-Wc++98-compat\\\"\") \\\n    xpr \\\n    JSON_HEDLEY_DIAGNOSTIC_POP\n#    endif\n#  endif\n#endif\n#if !defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(x) x\n#endif\n\n#if defined(JSON_HEDLEY_CONST_CAST)\n    #undef JSON_HEDLEY_CONST_CAST\n#endif\n#if defined(__cplusplus)\n#  define JSON_HEDLEY_CONST_CAST(T, expr) (const_cast<T>(expr))\n#elif \\\n  JSON_HEDLEY_HAS_WARNING(\"-Wcast-qual\") || \\\n  JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) || \\\n  JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)\n#  define JSON_HEDLEY_CONST_CAST(T, expr) (__extension__ ({ \\\n        JSON_HEDLEY_DIAGNOSTIC_PUSH \\\n        JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL \\\n        ((T) (expr)); \\\n        JSON_HEDLEY_DIAGNOSTIC_POP \\\n    }))\n#else\n#  define JSON_HEDLEY_CONST_CAST(T, expr) ((T) (expr))\n#endif\n\n#if defined(JSON_HEDLEY_REINTERPRET_CAST)\n    #undef JSON_HEDLEY_REINTERPRET_CAST\n#endif\n#if defined(__cplusplus)\n    #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) (reinterpret_cast<T>(expr))\n#else\n    #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) ((T) (expr))\n#endif\n\n#if defined(JSON_HEDLEY_STATIC_CAST)\n    #undef JSON_HEDLEY_STATIC_CAST\n#endif\n#if defined(__cplusplus)\n    #define JSON_HEDLEY_STATIC_CAST(T, expr) (static_cast<T>(expr))\n#else\n    #define JSON_HEDLEY_STATIC_CAST(T, expr) ((T) (expr))\n#endif\n\n#if defined(JSON_HEDLEY_CPP_CAST)\n    #undef JSON_HEDLEY_CPP_CAST\n#endif\n#if defined(__cplusplus)\n#  if JSON_HEDLEY_HAS_WARNING(\"-Wold-style-cast\")\n#    define JSON_HEDLEY_CPP_CAST(T, expr) \\\n    JSON_HEDLEY_DIAGNOSTIC_PUSH \\\n    _Pragma(\"clang diagnostic ignored \\\"-Wold-style-cast\\\"\") \\\n    ((T) (expr)) \\\n    JSON_HEDLEY_DIAGNOSTIC_POP\n#  elif JSON_HEDLEY_IAR_VERSION_CHECK(8,3,0)\n#    define JSON_HEDLEY_CPP_CAST(T, expr) \\\n    JSON_HEDLEY_DIAGNOSTIC_PUSH \\\n    _Pragma(\"diag_suppress=Pe137\") \\\n    JSON_HEDLEY_DIAGNOSTIC_POP\n#  else\n#    define JSON_HEDLEY_CPP_CAST(T, expr) ((T) (expr))\n#  endif\n#else\n#  define JSON_HEDLEY_CPP_CAST(T, expr) (expr)\n#endif\n\n#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED)\n    #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED\n#endif\n#if JSON_HEDLEY_HAS_WARNING(\"-Wdeprecated-declarations\")\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma(\"clang diagnostic ignored \\\"-Wdeprecated-declarations\\\"\")\n#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma(\"warning(disable:1478 1786)\")\n#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:1478 1786))\n#elif JSON_HEDLEY_PGI_VERSION_CHECK(20,7,0)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma(\"diag_suppress 1215,1216,1444,1445\")\n#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma(\"diag_suppress 1215,1444\")\n#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma(\"GCC diagnostic ignored \\\"-Wdeprecated-declarations\\\"\")\n#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:4996))\n#elif \\\n    JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \\\n    (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n    JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \\\n    (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n    JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \\\n    (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n    JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \\\n    (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n    JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \\\n    JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \\\n    JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma(\"diag_suppress 1291,1718\")\n#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && !defined(__cplusplus)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma(\"error_messages(off,E_DEPRECATED_ATT,E_DEPRECATED_ATT_MESS)\")\n#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && defined(__cplusplus)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma(\"error_messages(off,symdeprecated,symdeprecated2)\")\n#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma(\"diag_suppress=Pe1444,Pe1215\")\n#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma(\"warn(disable:2241)\")\n#else\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED\n#endif\n\n#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS)\n    #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS\n#endif\n#if JSON_HEDLEY_HAS_WARNING(\"-Wunknown-pragmas\")\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma(\"clang diagnostic ignored \\\"-Wunknown-pragmas\\\"\")\n#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma(\"warning(disable:161)\")\n#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:161))\n#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma(\"diag_suppress 1675\")\n#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma(\"GCC diagnostic ignored \\\"-Wunknown-pragmas\\\"\")\n#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:4068))\n#elif \\\n    JSON_HEDLEY_TI_VERSION_CHECK(16,9,0) || \\\n    JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \\\n    JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \\\n    JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma(\"diag_suppress 163\")\n#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma(\"diag_suppress 163\")\n#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma(\"diag_suppress=Pe161\")\n#else\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS\n#endif\n\n#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES)\n    #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES\n#endif\n#if JSON_HEDLEY_HAS_WARNING(\"-Wunknown-attributes\")\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma(\"clang diagnostic ignored \\\"-Wunknown-attributes\\\"\")\n#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma(\"GCC diagnostic ignored \\\"-Wdeprecated-declarations\\\"\")\n#elif JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma(\"warning(disable:1292)\")\n#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:1292))\n#elif JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,0)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:5030))\n#elif JSON_HEDLEY_PGI_VERSION_CHECK(20,7,0)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma(\"diag_suppress 1097,1098\")\n#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma(\"diag_suppress 1097\")\n#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma(\"error_messages(off,attrskipunsup)\")\n#elif \\\n    JSON_HEDLEY_TI_VERSION_CHECK(18,1,0) || \\\n    JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \\\n    JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma(\"diag_suppress 1173\")\n#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma(\"diag_suppress=Pe1097\")\n#else\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES\n#endif\n\n#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL)\n    #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL\n#endif\n#if JSON_HEDLEY_HAS_WARNING(\"-Wcast-qual\")\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma(\"clang diagnostic ignored \\\"-Wcast-qual\\\"\")\n#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma(\"warning(disable:2203 2331)\")\n#elif JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma(\"GCC diagnostic ignored \\\"-Wcast-qual\\\"\")\n#else\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL\n#endif\n\n#if defined(JSON_HEDLEY_DEPRECATED)\n    #undef JSON_HEDLEY_DEPRECATED\n#endif\n#if defined(JSON_HEDLEY_DEPRECATED_FOR)\n    #undef JSON_HEDLEY_DEPRECATED_FOR\n#endif\n#if \\\n    JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \\\n    JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)\n    #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated(\"Since \" # since))\n    #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated(\"Since \" #since \"; use \" #replacement))\n#elif \\\n    JSON_HEDLEY_HAS_EXTENSION(attribute_deprecated_with_message) || \\\n    JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \\\n    JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \\\n    JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \\\n    JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) || \\\n    JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \\\n    JSON_HEDLEY_TI_VERSION_CHECK(18,1,0) || \\\n    JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(18,1,0) || \\\n    JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \\\n    JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \\\n    JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0)\n    #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__(\"Since \" #since)))\n    #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__(\"Since \" #since \"; use \" #replacement)))\n#elif defined(__cplusplus) && (__cplusplus >= 201402L)\n    #define JSON_HEDLEY_DEPRECATED(since) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated(\"Since \" #since)]])\n    #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated(\"Since \" #since \"; use \" #replacement)]])\n#elif \\\n    JSON_HEDLEY_HAS_ATTRIBUTE(deprecated) || \\\n    JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \\\n    JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \\\n    JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \\\n    (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n    JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \\\n    (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n    JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \\\n    (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n    JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \\\n    (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n    JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \\\n    JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \\\n    JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0)\n    #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__))\n    #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__))\n#elif \\\n    JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \\\n    JSON_HEDLEY_PELLES_VERSION_CHECK(6,50,0) || \\\n    JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)\n    #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated)\n    #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated)\n#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)\n    #define JSON_HEDLEY_DEPRECATED(since) _Pragma(\"deprecated\")\n    #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) _Pragma(\"deprecated\")\n#else\n    #define JSON_HEDLEY_DEPRECATED(since)\n    #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement)\n#endif\n\n#if defined(JSON_HEDLEY_UNAVAILABLE)\n    #undef JSON_HEDLEY_UNAVAILABLE\n#endif\n#if \\\n    JSON_HEDLEY_HAS_ATTRIBUTE(warning) || \\\n    JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) || \\\n    JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)\n    #define JSON_HEDLEY_UNAVAILABLE(available_since) __attribute__((__warning__(\"Not available until \" #available_since)))\n#else\n    #define JSON_HEDLEY_UNAVAILABLE(available_since)\n#endif\n\n#if defined(JSON_HEDLEY_WARN_UNUSED_RESULT)\n    #undef JSON_HEDLEY_WARN_UNUSED_RESULT\n#endif\n#if defined(JSON_HEDLEY_WARN_UNUSED_RESULT_MSG)\n    #undef JSON_HEDLEY_WARN_UNUSED_RESULT_MSG\n#endif\n#if \\\n    JSON_HEDLEY_HAS_ATTRIBUTE(warn_unused_result) || \\\n    JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \\\n    JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \\\n    JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \\\n    (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n    JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \\\n    (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n    JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \\\n    (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n    JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \\\n    (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n    JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \\\n    JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \\\n    JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \\\n    (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \\\n    JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0)\n    #define JSON_HEDLEY_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__))\n    #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) __attribute__((__warn_unused_result__))\n#elif (JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) >= 201907L)\n    #define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]])\n    #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard(msg)]])\n#elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard)\n    #define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]])\n    #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]])\n#elif defined(_Check_return_) /* SAL */\n    #define JSON_HEDLEY_WARN_UNUSED_RESULT _Check_return_\n    #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) _Check_return_\n#else\n    #define JSON_HEDLEY_WARN_UNUSED_RESULT\n    #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg)\n#endif\n\n#if defined(JSON_HEDLEY_SENTINEL)\n    #undef JSON_HEDLEY_SENTINEL\n#endif\n#if \\\n    JSON_HEDLEY_HAS_ATTRIBUTE(sentinel) || \\\n    JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \\\n    JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \\\n    JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0)\n    #define JSON_HEDLEY_SENTINEL(position) __attribute__((__sentinel__(position)))\n#else\n    #define JSON_HEDLEY_SENTINEL(position)\n#endif\n\n#if defined(JSON_HEDLEY_NO_RETURN)\n    #undef JSON_HEDLEY_NO_RETURN\n#endif\n#if JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)\n    #define JSON_HEDLEY_NO_RETURN __noreturn\n#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)\n    #define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__))\n#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L\n    #define JSON_HEDLEY_NO_RETURN _Noreturn\n#elif defined(__cplusplus) && (__cplusplus >= 201103L)\n    #define JSON_HEDLEY_NO_RETURN JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[noreturn]])\n#elif \\\n    JSON_HEDLEY_HAS_ATTRIBUTE(noreturn) || \\\n    JSON_HEDLEY_GCC_VERSION_CHECK(3,2,0) || \\\n    JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \\\n    JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \\\n    JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \\\n    JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \\\n    (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n    JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \\\n    (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n    JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \\\n    (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n    JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \\\n    (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n    JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \\\n    JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \\\n    JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0)\n    #define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__))\n#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0)\n    #define JSON_HEDLEY_NO_RETURN _Pragma(\"does_not_return\")\n#elif \\\n    JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \\\n    JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)\n    #define JSON_HEDLEY_NO_RETURN __declspec(noreturn)\n#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus)\n    #define JSON_HEDLEY_NO_RETURN _Pragma(\"FUNC_NEVER_RETURNS;\")\n#elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0)\n    #define JSON_HEDLEY_NO_RETURN __attribute((noreturn))\n#elif JSON_HEDLEY_PELLES_VERSION_CHECK(9,0,0)\n    #define JSON_HEDLEY_NO_RETURN __declspec(noreturn)\n#else\n    #define JSON_HEDLEY_NO_RETURN\n#endif\n\n#if defined(JSON_HEDLEY_NO_ESCAPE)\n    #undef JSON_HEDLEY_NO_ESCAPE\n#endif\n#if JSON_HEDLEY_HAS_ATTRIBUTE(noescape)\n    #define JSON_HEDLEY_NO_ESCAPE __attribute__((__noescape__))\n#else\n    #define JSON_HEDLEY_NO_ESCAPE\n#endif\n\n#if defined(JSON_HEDLEY_UNREACHABLE)\n    #undef JSON_HEDLEY_UNREACHABLE\n#endif\n#if defined(JSON_HEDLEY_UNREACHABLE_RETURN)\n    #undef JSON_HEDLEY_UNREACHABLE_RETURN\n#endif\n#if defined(JSON_HEDLEY_ASSUME)\n    #undef JSON_HEDLEY_ASSUME\n#endif\n#if \\\n    JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \\\n    JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \\\n    JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)\n    #define JSON_HEDLEY_ASSUME(expr) __assume(expr)\n#elif JSON_HEDLEY_HAS_BUILTIN(__builtin_assume)\n    #define JSON_HEDLEY_ASSUME(expr) __builtin_assume(expr)\n#elif \\\n    JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \\\n    JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0)\n    #if defined(__cplusplus)\n        #define JSON_HEDLEY_ASSUME(expr) std::_nassert(expr)\n    #else\n        #define JSON_HEDLEY_ASSUME(expr) _nassert(expr)\n    #endif\n#endif\n#if \\\n    (JSON_HEDLEY_HAS_BUILTIN(__builtin_unreachable) && (!defined(JSON_HEDLEY_ARM_VERSION))) || \\\n    JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \\\n    JSON_HEDLEY_PGI_VERSION_CHECK(18,10,0) || \\\n    JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \\\n    JSON_HEDLEY_IBM_VERSION_CHECK(13,1,5)\n    #define JSON_HEDLEY_UNREACHABLE() __builtin_unreachable()\n#elif defined(JSON_HEDLEY_ASSUME)\n    #define JSON_HEDLEY_UNREACHABLE() JSON_HEDLEY_ASSUME(0)\n#endif\n#if !defined(JSON_HEDLEY_ASSUME)\n    #if defined(JSON_HEDLEY_UNREACHABLE)\n        #define JSON_HEDLEY_ASSUME(expr) JSON_HEDLEY_STATIC_CAST(void, ((expr) ? 1 : (JSON_HEDLEY_UNREACHABLE(), 1)))\n    #else\n        #define JSON_HEDLEY_ASSUME(expr) JSON_HEDLEY_STATIC_CAST(void, expr)\n    #endif\n#endif\n#if defined(JSON_HEDLEY_UNREACHABLE)\n    #if  \\\n        JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \\\n        JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0)\n        #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (JSON_HEDLEY_STATIC_CAST(void, JSON_HEDLEY_ASSUME(0)), (value))\n    #else\n        #define JSON_HEDLEY_UNREACHABLE_RETURN(value) JSON_HEDLEY_UNREACHABLE()\n    #endif\n#else\n    #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (value)\n#endif\n#if !defined(JSON_HEDLEY_UNREACHABLE)\n    #define JSON_HEDLEY_UNREACHABLE() JSON_HEDLEY_ASSUME(0)\n#endif\n\nJSON_HEDLEY_DIAGNOSTIC_PUSH\n#if JSON_HEDLEY_HAS_WARNING(\"-Wpedantic\")\n    #pragma clang diagnostic ignored \"-Wpedantic\"\n#endif\n#if JSON_HEDLEY_HAS_WARNING(\"-Wc++98-compat-pedantic\") && defined(__cplusplus)\n    #pragma clang diagnostic ignored \"-Wc++98-compat-pedantic\"\n#endif\n#if JSON_HEDLEY_GCC_HAS_WARNING(\"-Wvariadic-macros\",4,0,0)\n    #if defined(__clang__)\n        #pragma clang diagnostic ignored \"-Wvariadic-macros\"\n    #elif defined(JSON_HEDLEY_GCC_VERSION)\n        #pragma GCC diagnostic ignored \"-Wvariadic-macros\"\n    #endif\n#endif\n#if defined(JSON_HEDLEY_NON_NULL)\n    #undef JSON_HEDLEY_NON_NULL\n#endif\n#if \\\n    JSON_HEDLEY_HAS_ATTRIBUTE(nonnull) || \\\n    JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \\\n    JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \\\n    JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0)\n    #define JSON_HEDLEY_NON_NULL(...) __attribute__((__nonnull__(__VA_ARGS__)))\n#else\n    #define JSON_HEDLEY_NON_NULL(...)\n#endif\nJSON_HEDLEY_DIAGNOSTIC_POP\n\n#if defined(JSON_HEDLEY_PRINTF_FORMAT)\n    #undef JSON_HEDLEY_PRINTF_FORMAT\n#endif\n#if defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && !defined(__USE_MINGW_ANSI_STDIO)\n    #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(ms_printf, string_idx, first_to_check)))\n#elif defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && defined(__USE_MINGW_ANSI_STDIO)\n    #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(gnu_printf, string_idx, first_to_check)))\n#elif \\\n    JSON_HEDLEY_HAS_ATTRIBUTE(format) || \\\n    JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \\\n    JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \\\n    JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \\\n    JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \\\n    JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \\\n    (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n    JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \\\n    (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n    JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \\\n    (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n    JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \\\n    (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n    JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \\\n    JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \\\n    JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0)\n    #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(__printf__, string_idx, first_to_check)))\n#elif JSON_HEDLEY_PELLES_VERSION_CHECK(6,0,0)\n    #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __declspec(vaformat(printf,string_idx,first_to_check))\n#else\n    #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check)\n#endif\n\n#if defined(JSON_HEDLEY_CONSTEXPR)\n    #undef JSON_HEDLEY_CONSTEXPR\n#endif\n#if defined(__cplusplus)\n    #if __cplusplus >= 201103L\n        #define JSON_HEDLEY_CONSTEXPR JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(constexpr)\n    #endif\n#endif\n#if !defined(JSON_HEDLEY_CONSTEXPR)\n    #define JSON_HEDLEY_CONSTEXPR\n#endif\n\n#if defined(JSON_HEDLEY_PREDICT)\n    #undef JSON_HEDLEY_PREDICT\n#endif\n#if defined(JSON_HEDLEY_LIKELY)\n    #undef JSON_HEDLEY_LIKELY\n#endif\n#if defined(JSON_HEDLEY_UNLIKELY)\n    #undef JSON_HEDLEY_UNLIKELY\n#endif\n#if defined(JSON_HEDLEY_UNPREDICTABLE)\n    #undef JSON_HEDLEY_UNPREDICTABLE\n#endif\n#if JSON_HEDLEY_HAS_BUILTIN(__builtin_unpredictable)\n    #define JSON_HEDLEY_UNPREDICTABLE(expr) __builtin_unpredictable((expr))\n#endif\n#if \\\n  (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect_with_probability) && !defined(JSON_HEDLEY_PGI_VERSION)) || \\\n  JSON_HEDLEY_GCC_VERSION_CHECK(9,0,0)\n#  define JSON_HEDLEY_PREDICT(expr, value, probability) __builtin_expect_with_probability(  (expr), (value), (probability))\n#  define JSON_HEDLEY_PREDICT_TRUE(expr, probability)   __builtin_expect_with_probability(!!(expr),    1   , (probability))\n#  define JSON_HEDLEY_PREDICT_FALSE(expr, probability)  __builtin_expect_with_probability(!!(expr),    0   , (probability))\n#  define JSON_HEDLEY_LIKELY(expr)                      __builtin_expect                 (!!(expr),    1                  )\n#  define JSON_HEDLEY_UNLIKELY(expr)                    __builtin_expect                 (!!(expr),    0                  )\n#elif \\\n  (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \\\n  JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \\\n  JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \\\n  (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \\\n  JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \\\n  JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \\\n  JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \\\n  JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \\\n  JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \\\n  JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \\\n  JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \\\n  JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \\\n  JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \\\n  JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,27) || \\\n  JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0)\n#  define JSON_HEDLEY_PREDICT(expr, expected, probability) \\\n    (((probability) >= 0.9) ? __builtin_expect((expr), (expected)) : (JSON_HEDLEY_STATIC_CAST(void, expected), (expr)))\n#  define JSON_HEDLEY_PREDICT_TRUE(expr, probability) \\\n    (__extension__ ({ \\\n        double hedley_probability_ = (probability); \\\n        ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 1) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 0) : !!(expr))); \\\n    }))\n#  define JSON_HEDLEY_PREDICT_FALSE(expr, probability) \\\n    (__extension__ ({ \\\n        double hedley_probability_ = (probability); \\\n        ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 0) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 1) : !!(expr))); \\\n    }))\n#  define JSON_HEDLEY_LIKELY(expr)   __builtin_expect(!!(expr), 1)\n#  define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect(!!(expr), 0)\n#else\n#  define JSON_HEDLEY_PREDICT(expr, expected, probability) (JSON_HEDLEY_STATIC_CAST(void, expected), (expr))\n#  define JSON_HEDLEY_PREDICT_TRUE(expr, probability) (!!(expr))\n#  define JSON_HEDLEY_PREDICT_FALSE(expr, probability) (!!(expr))\n#  define JSON_HEDLEY_LIKELY(expr) (!!(expr))\n#  define JSON_HEDLEY_UNLIKELY(expr) (!!(expr))\n#endif\n#if !defined(JSON_HEDLEY_UNPREDICTABLE)\n    #define JSON_HEDLEY_UNPREDICTABLE(expr) JSON_HEDLEY_PREDICT(expr, 1, 0.5)\n#endif\n\n#if defined(JSON_HEDLEY_MALLOC)\n    #undef JSON_HEDLEY_MALLOC\n#endif\n#if \\\n    JSON_HEDLEY_HAS_ATTRIBUTE(malloc) || \\\n    JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \\\n    JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \\\n    JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \\\n    JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \\\n    JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \\\n    JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \\\n    (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n    JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \\\n    (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n    JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \\\n    (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n    JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \\\n    (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n    JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \\\n    JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \\\n    JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0)\n    #define JSON_HEDLEY_MALLOC __attribute__((__malloc__))\n#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0)\n    #define JSON_HEDLEY_MALLOC _Pragma(\"returns_new_memory\")\n#elif \\\n    JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \\\n    JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)\n    #define JSON_HEDLEY_MALLOC __declspec(restrict)\n#else\n    #define JSON_HEDLEY_MALLOC\n#endif\n\n#if defined(JSON_HEDLEY_PURE)\n    #undef JSON_HEDLEY_PURE\n#endif\n#if \\\n  JSON_HEDLEY_HAS_ATTRIBUTE(pure) || \\\n  JSON_HEDLEY_GCC_VERSION_CHECK(2,96,0) || \\\n  JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \\\n  JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \\\n  JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \\\n  JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \\\n  JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \\\n  (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n  JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \\\n  (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n  JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \\\n  (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n  JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \\\n  (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n  JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \\\n  JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \\\n  JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \\\n  JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0)\n#  define JSON_HEDLEY_PURE __attribute__((__pure__))\n#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0)\n#  define JSON_HEDLEY_PURE _Pragma(\"does_not_write_global_data\")\n#elif defined(__cplusplus) && \\\n    ( \\\n      JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \\\n      JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) || \\\n      JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) \\\n    )\n#  define JSON_HEDLEY_PURE _Pragma(\"FUNC_IS_PURE;\")\n#else\n#  define JSON_HEDLEY_PURE\n#endif\n\n#if defined(JSON_HEDLEY_CONST)\n    #undef JSON_HEDLEY_CONST\n#endif\n#if \\\n    JSON_HEDLEY_HAS_ATTRIBUTE(const) || \\\n    JSON_HEDLEY_GCC_VERSION_CHECK(2,5,0) || \\\n    JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \\\n    JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \\\n    JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \\\n    JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \\\n    JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \\\n    (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n    JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \\\n    (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n    JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \\\n    (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n    JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \\\n    (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n    JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \\\n    JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \\\n    JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \\\n    JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0)\n    #define JSON_HEDLEY_CONST __attribute__((__const__))\n#elif \\\n    JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0)\n    #define JSON_HEDLEY_CONST _Pragma(\"no_side_effect\")\n#else\n    #define JSON_HEDLEY_CONST JSON_HEDLEY_PURE\n#endif\n\n#if defined(JSON_HEDLEY_RESTRICT)\n    #undef JSON_HEDLEY_RESTRICT\n#endif\n#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && !defined(__cplusplus)\n    #define JSON_HEDLEY_RESTRICT restrict\n#elif \\\n    JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \\\n    JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \\\n    JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \\\n    JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \\\n    JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \\\n    JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \\\n    JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \\\n    JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \\\n    JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,4) || \\\n    JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \\\n    JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \\\n    (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus)) || \\\n    JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \\\n    defined(__clang__)\n    #define JSON_HEDLEY_RESTRICT __restrict\n#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,3,0) && !defined(__cplusplus)\n    #define JSON_HEDLEY_RESTRICT _Restrict\n#else\n    #define JSON_HEDLEY_RESTRICT\n#endif\n\n#if defined(JSON_HEDLEY_INLINE)\n    #undef JSON_HEDLEY_INLINE\n#endif\n#if \\\n    (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \\\n    (defined(__cplusplus) && (__cplusplus >= 199711L))\n    #define JSON_HEDLEY_INLINE inline\n#elif \\\n    defined(JSON_HEDLEY_GCC_VERSION) || \\\n    JSON_HEDLEY_ARM_VERSION_CHECK(6,2,0)\n    #define JSON_HEDLEY_INLINE __inline__\n#elif \\\n    JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \\\n    JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \\\n    JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \\\n    JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,1,0) || \\\n    JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \\\n    JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \\\n    JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \\\n    JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \\\n    JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0)\n    #define JSON_HEDLEY_INLINE __inline\n#else\n    #define JSON_HEDLEY_INLINE\n#endif\n\n#if defined(JSON_HEDLEY_ALWAYS_INLINE)\n    #undef JSON_HEDLEY_ALWAYS_INLINE\n#endif\n#if \\\n  JSON_HEDLEY_HAS_ATTRIBUTE(always_inline) || \\\n  JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \\\n  JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \\\n  JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \\\n  JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \\\n  JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \\\n  JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \\\n  (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n  JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \\\n  (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n  JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \\\n  (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n  JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \\\n  (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n  JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \\\n  JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \\\n  JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0)\n#  define JSON_HEDLEY_ALWAYS_INLINE __attribute__((__always_inline__)) JSON_HEDLEY_INLINE\n#elif \\\n  JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \\\n  JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)\n#  define JSON_HEDLEY_ALWAYS_INLINE __forceinline\n#elif defined(__cplusplus) && \\\n    ( \\\n      JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \\\n      JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \\\n      JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \\\n      JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \\\n      JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \\\n      JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) \\\n    )\n#  define JSON_HEDLEY_ALWAYS_INLINE _Pragma(\"FUNC_ALWAYS_INLINE;\")\n#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)\n#  define JSON_HEDLEY_ALWAYS_INLINE _Pragma(\"inline=forced\")\n#else\n#  define JSON_HEDLEY_ALWAYS_INLINE JSON_HEDLEY_INLINE\n#endif\n\n#if defined(JSON_HEDLEY_NEVER_INLINE)\n    #undef JSON_HEDLEY_NEVER_INLINE\n#endif\n#if \\\n    JSON_HEDLEY_HAS_ATTRIBUTE(noinline) || \\\n    JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \\\n    JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \\\n    JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \\\n    JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \\\n    JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \\\n    JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \\\n    (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n    JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \\\n    (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n    JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \\\n    (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n    JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \\\n    (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n    JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \\\n    JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \\\n    JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0)\n    #define JSON_HEDLEY_NEVER_INLINE __attribute__((__noinline__))\n#elif \\\n    JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \\\n    JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)\n    #define JSON_HEDLEY_NEVER_INLINE __declspec(noinline)\n#elif JSON_HEDLEY_PGI_VERSION_CHECK(10,2,0)\n    #define JSON_HEDLEY_NEVER_INLINE _Pragma(\"noinline\")\n#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus)\n    #define JSON_HEDLEY_NEVER_INLINE _Pragma(\"FUNC_CANNOT_INLINE;\")\n#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)\n    #define JSON_HEDLEY_NEVER_INLINE _Pragma(\"inline=never\")\n#elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0)\n    #define JSON_HEDLEY_NEVER_INLINE __attribute((noinline))\n#elif JSON_HEDLEY_PELLES_VERSION_CHECK(9,0,0)\n    #define JSON_HEDLEY_NEVER_INLINE __declspec(noinline)\n#else\n    #define JSON_HEDLEY_NEVER_INLINE\n#endif\n\n#if defined(JSON_HEDLEY_PRIVATE)\n    #undef JSON_HEDLEY_PRIVATE\n#endif\n#if defined(JSON_HEDLEY_PUBLIC)\n    #undef JSON_HEDLEY_PUBLIC\n#endif\n#if defined(JSON_HEDLEY_IMPORT)\n    #undef JSON_HEDLEY_IMPORT\n#endif\n#if defined(_WIN32) || defined(__CYGWIN__)\n#  define JSON_HEDLEY_PRIVATE\n#  define JSON_HEDLEY_PUBLIC   __declspec(dllexport)\n#  define JSON_HEDLEY_IMPORT   __declspec(dllimport)\n#else\n#  if \\\n    JSON_HEDLEY_HAS_ATTRIBUTE(visibility) || \\\n    JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \\\n    JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \\\n    JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \\\n    JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \\\n    JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \\\n    ( \\\n      defined(__TI_EABI__) && \\\n      ( \\\n        (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \\\n        JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) \\\n      ) \\\n    )\n#    define JSON_HEDLEY_PRIVATE __attribute__((__visibility__(\"hidden\")))\n#    define JSON_HEDLEY_PUBLIC  __attribute__((__visibility__(\"default\")))\n#  else\n#    define JSON_HEDLEY_PRIVATE\n#    define JSON_HEDLEY_PUBLIC\n#  endif\n#  define JSON_HEDLEY_IMPORT    extern\n#endif\n\n#if defined(JSON_HEDLEY_NO_THROW)\n    #undef JSON_HEDLEY_NO_THROW\n#endif\n#if \\\n    JSON_HEDLEY_HAS_ATTRIBUTE(nothrow) || \\\n    JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \\\n    JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)\n    #define JSON_HEDLEY_NO_THROW __attribute__((__nothrow__))\n#elif \\\n    JSON_HEDLEY_MSVC_VERSION_CHECK(13,1,0) || \\\n    JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \\\n    JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0)\n    #define JSON_HEDLEY_NO_THROW __declspec(nothrow)\n#else\n    #define JSON_HEDLEY_NO_THROW\n#endif\n\n#if defined(JSON_HEDLEY_FALL_THROUGH)\n    #undef JSON_HEDLEY_FALL_THROUGH\n#endif\n#if \\\n    JSON_HEDLEY_HAS_ATTRIBUTE(fallthrough) || \\\n    JSON_HEDLEY_GCC_VERSION_CHECK(7,0,0)\n    #define JSON_HEDLEY_FALL_THROUGH __attribute__((__fallthrough__))\n#elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(clang,fallthrough)\n    #define JSON_HEDLEY_FALL_THROUGH JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[clang::fallthrough]])\n#elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(fallthrough)\n    #define JSON_HEDLEY_FALL_THROUGH JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[fallthrough]])\n#elif defined(__fallthrough) /* SAL */\n    #define JSON_HEDLEY_FALL_THROUGH __fallthrough\n#else\n    #define JSON_HEDLEY_FALL_THROUGH\n#endif\n\n#if defined(JSON_HEDLEY_RETURNS_NON_NULL)\n    #undef JSON_HEDLEY_RETURNS_NON_NULL\n#endif\n#if \\\n    JSON_HEDLEY_HAS_ATTRIBUTE(returns_nonnull) || \\\n    JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0)\n    #define JSON_HEDLEY_RETURNS_NON_NULL __attribute__((__returns_nonnull__))\n#elif defined(_Ret_notnull_) /* SAL */\n    #define JSON_HEDLEY_RETURNS_NON_NULL _Ret_notnull_\n#else\n    #define JSON_HEDLEY_RETURNS_NON_NULL\n#endif\n\n#if defined(JSON_HEDLEY_ARRAY_PARAM)\n    #undef JSON_HEDLEY_ARRAY_PARAM\n#endif\n#if \\\n    defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \\\n    !defined(__STDC_NO_VLA__) && \\\n    !defined(__cplusplus) && \\\n    !defined(JSON_HEDLEY_PGI_VERSION) && \\\n    !defined(JSON_HEDLEY_TINYC_VERSION)\n    #define JSON_HEDLEY_ARRAY_PARAM(name) (name)\n#else\n    #define JSON_HEDLEY_ARRAY_PARAM(name)\n#endif\n\n#if defined(JSON_HEDLEY_IS_CONSTANT)\n    #undef JSON_HEDLEY_IS_CONSTANT\n#endif\n#if defined(JSON_HEDLEY_REQUIRE_CONSTEXPR)\n    #undef JSON_HEDLEY_REQUIRE_CONSTEXPR\n#endif\n/* JSON_HEDLEY_IS_CONSTEXPR_ is for\n   HEDLEY INTERNAL USE ONLY.  API subject to change without notice. */\n#if defined(JSON_HEDLEY_IS_CONSTEXPR_)\n    #undef JSON_HEDLEY_IS_CONSTEXPR_\n#endif\n#if \\\n    JSON_HEDLEY_HAS_BUILTIN(__builtin_constant_p) || \\\n    JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \\\n    JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \\\n    JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,19) || \\\n    JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \\\n    JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \\\n    JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \\\n    (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) && !defined(__cplusplus)) || \\\n    JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0)\n    #define JSON_HEDLEY_IS_CONSTANT(expr) __builtin_constant_p(expr)\n#endif\n#if !defined(__cplusplus)\n#  if \\\n       JSON_HEDLEY_HAS_BUILTIN(__builtin_types_compatible_p) || \\\n       JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \\\n       JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \\\n       JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \\\n       JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \\\n       JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0) || \\\n       JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,24)\n#if defined(__INTPTR_TYPE__)\n    #define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0)), int*)\n#else\n    #include <stdint.h>\n    #define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((intptr_t) ((expr) * 0)) : (int*) 0)), int*)\n#endif\n#  elif \\\n       ( \\\n          defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) && \\\n          !defined(JSON_HEDLEY_SUNPRO_VERSION) && \\\n          !defined(JSON_HEDLEY_PGI_VERSION) && \\\n          !defined(JSON_HEDLEY_IAR_VERSION)) || \\\n       JSON_HEDLEY_HAS_EXTENSION(c_generic_selections) || \\\n       JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) || \\\n       JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0) || \\\n       JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \\\n       JSON_HEDLEY_ARM_VERSION_CHECK(5,3,0)\n#if defined(__INTPTR_TYPE__)\n    #define JSON_HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0), int*: 1, void*: 0)\n#else\n    #include <stdint.h>\n    #define JSON_HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((intptr_t) * 0) : (int*) 0), int*: 1, void*: 0)\n#endif\n#  elif \\\n       defined(JSON_HEDLEY_GCC_VERSION) || \\\n       defined(JSON_HEDLEY_INTEL_VERSION) || \\\n       defined(JSON_HEDLEY_TINYC_VERSION) || \\\n       defined(JSON_HEDLEY_TI_ARMCL_VERSION) || \\\n       JSON_HEDLEY_TI_CL430_VERSION_CHECK(18,12,0) || \\\n       defined(JSON_HEDLEY_TI_CL2000_VERSION) || \\\n       defined(JSON_HEDLEY_TI_CL6X_VERSION) || \\\n       defined(JSON_HEDLEY_TI_CL7X_VERSION) || \\\n       defined(JSON_HEDLEY_TI_CLPRU_VERSION) || \\\n       defined(__clang__)\n#    define JSON_HEDLEY_IS_CONSTEXPR_(expr) ( \\\n        sizeof(void) != \\\n        sizeof(*( \\\n                  1 ? \\\n                  ((void*) ((expr) * 0L) ) : \\\n((struct { char v[sizeof(void) * 2]; } *) 1) \\\n                ) \\\n              ) \\\n                                            )\n#  endif\n#endif\n#if defined(JSON_HEDLEY_IS_CONSTEXPR_)\n    #if !defined(JSON_HEDLEY_IS_CONSTANT)\n        #define JSON_HEDLEY_IS_CONSTANT(expr) JSON_HEDLEY_IS_CONSTEXPR_(expr)\n    #endif\n    #define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) (JSON_HEDLEY_IS_CONSTEXPR_(expr) ? (expr) : (-1))\n#else\n    #if !defined(JSON_HEDLEY_IS_CONSTANT)\n        #define JSON_HEDLEY_IS_CONSTANT(expr) (0)\n    #endif\n    #define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) (expr)\n#endif\n\n#if defined(JSON_HEDLEY_BEGIN_C_DECLS)\n    #undef JSON_HEDLEY_BEGIN_C_DECLS\n#endif\n#if defined(JSON_HEDLEY_END_C_DECLS)\n    #undef JSON_HEDLEY_END_C_DECLS\n#endif\n#if defined(JSON_HEDLEY_C_DECL)\n    #undef JSON_HEDLEY_C_DECL\n#endif\n#if defined(__cplusplus)\n    #define JSON_HEDLEY_BEGIN_C_DECLS extern \"C\" {\n    #define JSON_HEDLEY_END_C_DECLS }\n    #define JSON_HEDLEY_C_DECL extern \"C\"\n#else\n    #define JSON_HEDLEY_BEGIN_C_DECLS\n    #define JSON_HEDLEY_END_C_DECLS\n    #define JSON_HEDLEY_C_DECL\n#endif\n\n#if defined(JSON_HEDLEY_STATIC_ASSERT)\n    #undef JSON_HEDLEY_STATIC_ASSERT\n#endif\n#if \\\n  !defined(__cplusplus) && ( \\\n      (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || \\\n      (JSON_HEDLEY_HAS_FEATURE(c_static_assert) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \\\n      JSON_HEDLEY_GCC_VERSION_CHECK(6,0,0) || \\\n      JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \\\n      defined(_Static_assert) \\\n    )\n#  define JSON_HEDLEY_STATIC_ASSERT(expr, message) _Static_assert(expr, message)\n#elif \\\n  (defined(__cplusplus) && (__cplusplus >= 201103L)) || \\\n  JSON_HEDLEY_MSVC_VERSION_CHECK(16,0,0) || \\\n  JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)\n#  define JSON_HEDLEY_STATIC_ASSERT(expr, message) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(static_assert(expr, message))\n#else\n#  define JSON_HEDLEY_STATIC_ASSERT(expr, message)\n#endif\n\n#if defined(JSON_HEDLEY_NULL)\n    #undef JSON_HEDLEY_NULL\n#endif\n#if defined(__cplusplus)\n    #if __cplusplus >= 201103L\n        #define JSON_HEDLEY_NULL JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(nullptr)\n    #elif defined(NULL)\n        #define JSON_HEDLEY_NULL NULL\n    #else\n        #define JSON_HEDLEY_NULL JSON_HEDLEY_STATIC_CAST(void*, 0)\n    #endif\n#elif defined(NULL)\n    #define JSON_HEDLEY_NULL NULL\n#else\n    #define JSON_HEDLEY_NULL ((void*) 0)\n#endif\n\n#if defined(JSON_HEDLEY_MESSAGE)\n    #undef JSON_HEDLEY_MESSAGE\n#endif\n#if JSON_HEDLEY_HAS_WARNING(\"-Wunknown-pragmas\")\n#  define JSON_HEDLEY_MESSAGE(msg) \\\n    JSON_HEDLEY_DIAGNOSTIC_PUSH \\\n    JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \\\n    JSON_HEDLEY_PRAGMA(message msg) \\\n    JSON_HEDLEY_DIAGNOSTIC_POP\n#elif \\\n  JSON_HEDLEY_GCC_VERSION_CHECK(4,4,0) || \\\n  JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)\n#  define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message msg)\n#elif JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0)\n#  define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(_CRI message msg)\n#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)\n#  define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message(msg))\n#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,0,0)\n#  define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message(msg))\n#else\n#  define JSON_HEDLEY_MESSAGE(msg)\n#endif\n\n#if defined(JSON_HEDLEY_WARNING)\n    #undef JSON_HEDLEY_WARNING\n#endif\n#if JSON_HEDLEY_HAS_WARNING(\"-Wunknown-pragmas\")\n#  define JSON_HEDLEY_WARNING(msg) \\\n    JSON_HEDLEY_DIAGNOSTIC_PUSH \\\n    JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \\\n    JSON_HEDLEY_PRAGMA(clang warning msg) \\\n    JSON_HEDLEY_DIAGNOSTIC_POP\n#elif \\\n  JSON_HEDLEY_GCC_VERSION_CHECK(4,8,0) || \\\n  JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \\\n  JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)\n#  define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(GCC warning msg)\n#elif \\\n  JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \\\n  JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)\n#  define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(message(msg))\n#else\n#  define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_MESSAGE(msg)\n#endif\n\n#if defined(JSON_HEDLEY_REQUIRE)\n    #undef JSON_HEDLEY_REQUIRE\n#endif\n#if defined(JSON_HEDLEY_REQUIRE_MSG)\n    #undef JSON_HEDLEY_REQUIRE_MSG\n#endif\n#if JSON_HEDLEY_HAS_ATTRIBUTE(diagnose_if)\n#  if JSON_HEDLEY_HAS_WARNING(\"-Wgcc-compat\")\n#    define JSON_HEDLEY_REQUIRE(expr) \\\n    JSON_HEDLEY_DIAGNOSTIC_PUSH \\\n    _Pragma(\"clang diagnostic ignored \\\"-Wgcc-compat\\\"\") \\\n    __attribute__((diagnose_if(!(expr), #expr, \"error\"))) \\\n    JSON_HEDLEY_DIAGNOSTIC_POP\n#    define JSON_HEDLEY_REQUIRE_MSG(expr,msg) \\\n    JSON_HEDLEY_DIAGNOSTIC_PUSH \\\n    _Pragma(\"clang diagnostic ignored \\\"-Wgcc-compat\\\"\") \\\n    __attribute__((diagnose_if(!(expr), msg, \"error\"))) \\\n    JSON_HEDLEY_DIAGNOSTIC_POP\n#  else\n#    define JSON_HEDLEY_REQUIRE(expr) __attribute__((diagnose_if(!(expr), #expr, \"error\")))\n#    define JSON_HEDLEY_REQUIRE_MSG(expr,msg) __attribute__((diagnose_if(!(expr), msg, \"error\")))\n#  endif\n#else\n#  define JSON_HEDLEY_REQUIRE(expr)\n#  define JSON_HEDLEY_REQUIRE_MSG(expr,msg)\n#endif\n\n#if defined(JSON_HEDLEY_FLAGS)\n    #undef JSON_HEDLEY_FLAGS\n#endif\n#if JSON_HEDLEY_HAS_ATTRIBUTE(flag_enum)\n    #define JSON_HEDLEY_FLAGS __attribute__((__flag_enum__))\n#else\n    #define JSON_HEDLEY_FLAGS\n#endif\n\n#if defined(JSON_HEDLEY_FLAGS_CAST)\n    #undef JSON_HEDLEY_FLAGS_CAST\n#endif\n#if JSON_HEDLEY_INTEL_VERSION_CHECK(19,0,0)\n#  define JSON_HEDLEY_FLAGS_CAST(T, expr) (__extension__ ({ \\\n        JSON_HEDLEY_DIAGNOSTIC_PUSH \\\n        _Pragma(\"warning(disable:188)\") \\\n        ((T) (expr)); \\\n        JSON_HEDLEY_DIAGNOSTIC_POP \\\n    }))\n#else\n#  define JSON_HEDLEY_FLAGS_CAST(T, expr) JSON_HEDLEY_STATIC_CAST(T, expr)\n#endif\n\n#if defined(JSON_HEDLEY_EMPTY_BASES)\n    #undef JSON_HEDLEY_EMPTY_BASES\n#endif\n#if \\\n    (JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,23918) && !JSON_HEDLEY_MSVC_VERSION_CHECK(20,0,0)) || \\\n    JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)\n    #define JSON_HEDLEY_EMPTY_BASES __declspec(empty_bases)\n#else\n    #define JSON_HEDLEY_EMPTY_BASES\n#endif\n\n/* Remaining macros are deprecated. */\n\n#if defined(JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK)\n    #undef JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK\n#endif\n#if defined(__clang__)\n    #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) (0)\n#else\n    #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)\n#endif\n\n#if defined(JSON_HEDLEY_CLANG_HAS_ATTRIBUTE)\n    #undef JSON_HEDLEY_CLANG_HAS_ATTRIBUTE\n#endif\n#define JSON_HEDLEY_CLANG_HAS_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_ATTRIBUTE(attribute)\n\n#if defined(JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE)\n    #undef JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE\n#endif\n#define JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute)\n\n#if defined(JSON_HEDLEY_CLANG_HAS_BUILTIN)\n    #undef JSON_HEDLEY_CLANG_HAS_BUILTIN\n#endif\n#define JSON_HEDLEY_CLANG_HAS_BUILTIN(builtin) JSON_HEDLEY_HAS_BUILTIN(builtin)\n\n#if defined(JSON_HEDLEY_CLANG_HAS_FEATURE)\n    #undef JSON_HEDLEY_CLANG_HAS_FEATURE\n#endif\n#define JSON_HEDLEY_CLANG_HAS_FEATURE(feature) JSON_HEDLEY_HAS_FEATURE(feature)\n\n#if defined(JSON_HEDLEY_CLANG_HAS_EXTENSION)\n    #undef JSON_HEDLEY_CLANG_HAS_EXTENSION\n#endif\n#define JSON_HEDLEY_CLANG_HAS_EXTENSION(extension) JSON_HEDLEY_HAS_EXTENSION(extension)\n\n#if defined(JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE)\n    #undef JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE\n#endif\n#define JSON_HEDLEY_CLANG_HAS_DECLSPEC_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute)\n\n#if defined(JSON_HEDLEY_CLANG_HAS_WARNING)\n    #undef JSON_HEDLEY_CLANG_HAS_WARNING\n#endif\n#define JSON_HEDLEY_CLANG_HAS_WARNING(warning) JSON_HEDLEY_HAS_WARNING(warning)\n\n#endif /* !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < X) */\n\n\n// This file contains all internal macro definitions\n// You MUST include macro_unscope.hpp at the end of json.hpp to undef all of them\n\n// exclude unsupported compilers\n#if !defined(JSON_SKIP_UNSUPPORTED_COMPILER_CHECK)\n    #if defined(__clang__)\n        #if (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) < 30400\n            #error \"unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers\"\n        #endif\n    #elif defined(__GNUC__) && !(defined(__ICC) || defined(__INTEL_COMPILER))\n        #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40800\n            #error \"unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers\"\n        #endif\n    #endif\n#endif\n\n// C++ language standard detection\n#if (defined(__cplusplus) && __cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L)\n    #define JSON_HAS_CPP_20\n    #define JSON_HAS_CPP_17\n    #define JSON_HAS_CPP_14\n#elif (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464\n    #define JSON_HAS_CPP_17\n    #define JSON_HAS_CPP_14\n#elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1)\n    #define JSON_HAS_CPP_14\n#endif\n\n// disable float-equal warnings on GCC/clang\n#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)\n    #pragma GCC diagnostic push\n    #pragma GCC diagnostic ignored \"-Wfloat-equal\"\n#endif\n\n// disable documentation warnings on clang\n#if defined(__clang__)\n    #pragma GCC diagnostic push\n    #pragma GCC diagnostic ignored \"-Wdocumentation\"\n#endif\n\n// allow to disable exceptions\n#if (defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)) && !defined(JSON_NOEXCEPTION)\n    #define JSON_THROW(exception) throw exception\n    #define JSON_TRY try\n    #define JSON_CATCH(exception) catch(exception)\n    #define JSON_INTERNAL_CATCH(exception) catch(exception)\n#else\n    #include <cstdlib>\n    #define JSON_THROW(exception) std::abort()\n    #define JSON_TRY if(true)\n    #define JSON_CATCH(exception) if(false)\n    #define JSON_INTERNAL_CATCH(exception) if(false)\n#endif\n\n// override exception macros\n#if defined(JSON_THROW_USER)\n    #undef JSON_THROW\n    #define JSON_THROW JSON_THROW_USER\n#endif\n#if defined(JSON_TRY_USER)\n    #undef JSON_TRY\n    #define JSON_TRY JSON_TRY_USER\n#endif\n#if defined(JSON_CATCH_USER)\n    #undef JSON_CATCH\n    #define JSON_CATCH JSON_CATCH_USER\n    #undef JSON_INTERNAL_CATCH\n    #define JSON_INTERNAL_CATCH JSON_CATCH_USER\n#endif\n#if defined(JSON_INTERNAL_CATCH_USER)\n    #undef JSON_INTERNAL_CATCH\n    #define JSON_INTERNAL_CATCH JSON_INTERNAL_CATCH_USER\n#endif\n\n// allow to override assert\n#if !defined(JSON_ASSERT)\n    #include <cassert> // assert\n    #define JSON_ASSERT(x) assert(x)\n#endif\n\n// allow to access some private functions (needed by the test suite)\n#if defined(JSON_TESTS_PRIVATE)\n    #define JSON_PRIVATE_UNLESS_TESTED public\n#else\n    #define JSON_PRIVATE_UNLESS_TESTED private\n#endif\n\n/*!\n@brief macro to briefly define a mapping between an enum and JSON\n@def NLOHMANN_JSON_SERIALIZE_ENUM\n@since version 3.4.0\n*/\n#define NLOHMANN_JSON_SERIALIZE_ENUM(ENUM_TYPE, ...)                                            \\\n    template<typename BasicJsonType>                                                            \\\n    inline void to_json(BasicJsonType& j, const ENUM_TYPE& e)                                   \\\n    {                                                                                           \\\n        static_assert(std::is_enum<ENUM_TYPE>::value, #ENUM_TYPE \" must be an enum!\");          \\\n        static const std::pair<ENUM_TYPE, BasicJsonType> m[] = __VA_ARGS__;                     \\\n        auto it = std::find_if(std::begin(m), std::end(m),                                      \\\n                               [e](const std::pair<ENUM_TYPE, BasicJsonType>& ej_pair) -> bool  \\\n        {                                                                                       \\\n            return ej_pair.first == e;                                                          \\\n        });                                                                                     \\\n        j = ((it != std::end(m)) ? it : std::begin(m))->second;                                 \\\n    }                                                                                           \\\n    template<typename BasicJsonType>                                                            \\\n    inline void from_json(const BasicJsonType& j, ENUM_TYPE& e)                                 \\\n    {                                                                                           \\\n        static_assert(std::is_enum<ENUM_TYPE>::value, #ENUM_TYPE \" must be an enum!\");          \\\n        static const std::pair<ENUM_TYPE, BasicJsonType> m[] = __VA_ARGS__;                     \\\n        auto it = std::find_if(std::begin(m), std::end(m),                                      \\\n                               [&j](const std::pair<ENUM_TYPE, BasicJsonType>& ej_pair) -> bool \\\n        {                                                                                       \\\n            return ej_pair.second == j;                                                         \\\n        });                                                                                     \\\n        e = ((it != std::end(m)) ? it : std::begin(m))->first;                                  \\\n    }\n\n// Ugly macros to avoid uglier copy-paste when specializing basic_json. They\n// may be removed in the future once the class is split.\n\n#define NLOHMANN_BASIC_JSON_TPL_DECLARATION                                \\\n    template<template<typename, typename, typename...> class ObjectType,   \\\n             template<typename, typename...> class ArrayType,              \\\n             class StringType, class BooleanType, class NumberIntegerType, \\\n             class NumberUnsignedType, class NumberFloatType,              \\\n             template<typename> class AllocatorType,                       \\\n             template<typename, typename = void> class JSONSerializer,     \\\n             class BinaryType>\n\n#define NLOHMANN_BASIC_JSON_TPL                                            \\\n    basic_json<ObjectType, ArrayType, StringType, BooleanType,             \\\n    NumberIntegerType, NumberUnsignedType, NumberFloatType,                \\\n    AllocatorType, JSONSerializer, BinaryType>\n\n// Macros to simplify conversion from/to types\n\n#define NLOHMANN_JSON_EXPAND( x ) x\n#define NLOHMANN_JSON_GET_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, NAME,...) NAME\n#define NLOHMANN_JSON_PASTE(...) NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_GET_MACRO(__VA_ARGS__, \\\n        NLOHMANN_JSON_PASTE64, \\\n        NLOHMANN_JSON_PASTE63, \\\n        NLOHMANN_JSON_PASTE62, \\\n        NLOHMANN_JSON_PASTE61, \\\n        NLOHMANN_JSON_PASTE60, \\\n        NLOHMANN_JSON_PASTE59, \\\n        NLOHMANN_JSON_PASTE58, \\\n        NLOHMANN_JSON_PASTE57, \\\n        NLOHMANN_JSON_PASTE56, \\\n        NLOHMANN_JSON_PASTE55, \\\n        NLOHMANN_JSON_PASTE54, \\\n        NLOHMANN_JSON_PASTE53, \\\n        NLOHMANN_JSON_PASTE52, \\\n        NLOHMANN_JSON_PASTE51, \\\n        NLOHMANN_JSON_PASTE50, \\\n        NLOHMANN_JSON_PASTE49, \\\n        NLOHMANN_JSON_PASTE48, \\\n        NLOHMANN_JSON_PASTE47, \\\n        NLOHMANN_JSON_PASTE46, \\\n        NLOHMANN_JSON_PASTE45, \\\n        NLOHMANN_JSON_PASTE44, \\\n        NLOHMANN_JSON_PASTE43, \\\n        NLOHMANN_JSON_PASTE42, \\\n        NLOHMANN_JSON_PASTE41, \\\n        NLOHMANN_JSON_PASTE40, \\\n        NLOHMANN_JSON_PASTE39, \\\n        NLOHMANN_JSON_PASTE38, \\\n        NLOHMANN_JSON_PASTE37, \\\n        NLOHMANN_JSON_PASTE36, \\\n        NLOHMANN_JSON_PASTE35, \\\n        NLOHMANN_JSON_PASTE34, \\\n        NLOHMANN_JSON_PASTE33, \\\n        NLOHMANN_JSON_PASTE32, \\\n        NLOHMANN_JSON_PASTE31, \\\n        NLOHMANN_JSON_PASTE30, \\\n        NLOHMANN_JSON_PASTE29, \\\n        NLOHMANN_JSON_PASTE28, \\\n        NLOHMANN_JSON_PASTE27, \\\n        NLOHMANN_JSON_PASTE26, \\\n        NLOHMANN_JSON_PASTE25, \\\n        NLOHMANN_JSON_PASTE24, \\\n        NLOHMANN_JSON_PASTE23, \\\n        NLOHMANN_JSON_PASTE22, \\\n        NLOHMANN_JSON_PASTE21, \\\n        NLOHMANN_JSON_PASTE20, \\\n        NLOHMANN_JSON_PASTE19, \\\n        NLOHMANN_JSON_PASTE18, \\\n        NLOHMANN_JSON_PASTE17, \\\n        NLOHMANN_JSON_PASTE16, \\\n        NLOHMANN_JSON_PASTE15, \\\n        NLOHMANN_JSON_PASTE14, \\\n        NLOHMANN_JSON_PASTE13, \\\n        NLOHMANN_JSON_PASTE12, \\\n        NLOHMANN_JSON_PASTE11, \\\n        NLOHMANN_JSON_PASTE10, \\\n        NLOHMANN_JSON_PASTE9, \\\n        NLOHMANN_JSON_PASTE8, \\\n        NLOHMANN_JSON_PASTE7, \\\n        NLOHMANN_JSON_PASTE6, \\\n        NLOHMANN_JSON_PASTE5, \\\n        NLOHMANN_JSON_PASTE4, \\\n        NLOHMANN_JSON_PASTE3, \\\n        NLOHMANN_JSON_PASTE2, \\\n        NLOHMANN_JSON_PASTE1)(__VA_ARGS__))\n#define NLOHMANN_JSON_PASTE2(func, v1) func(v1)\n#define NLOHMANN_JSON_PASTE3(func, v1, v2) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE2(func, v2)\n#define NLOHMANN_JSON_PASTE4(func, v1, v2, v3) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE3(func, v2, v3)\n#define NLOHMANN_JSON_PASTE5(func, v1, v2, v3, v4) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE4(func, v2, v3, v4)\n#define NLOHMANN_JSON_PASTE6(func, v1, v2, v3, v4, v5) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE5(func, v2, v3, v4, v5)\n#define NLOHMANN_JSON_PASTE7(func, v1, v2, v3, v4, v5, v6) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE6(func, v2, v3, v4, v5, v6)\n#define NLOHMANN_JSON_PASTE8(func, v1, v2, v3, v4, v5, v6, v7) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE7(func, v2, v3, v4, v5, v6, v7)\n#define NLOHMANN_JSON_PASTE9(func, v1, v2, v3, v4, v5, v6, v7, v8) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE8(func, v2, v3, v4, v5, v6, v7, v8)\n#define NLOHMANN_JSON_PASTE10(func, v1, v2, v3, v4, v5, v6, v7, v8, v9) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE9(func, v2, v3, v4, v5, v6, v7, v8, v9)\n#define NLOHMANN_JSON_PASTE11(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE10(func, v2, v3, v4, v5, v6, v7, v8, v9, v10)\n#define NLOHMANN_JSON_PASTE12(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE11(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11)\n#define NLOHMANN_JSON_PASTE13(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE12(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12)\n#define NLOHMANN_JSON_PASTE14(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE13(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13)\n#define NLOHMANN_JSON_PASTE15(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE14(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14)\n#define NLOHMANN_JSON_PASTE16(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE15(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15)\n#define NLOHMANN_JSON_PASTE17(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE16(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16)\n#define NLOHMANN_JSON_PASTE18(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE17(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17)\n#define NLOHMANN_JSON_PASTE19(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE18(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18)\n#define NLOHMANN_JSON_PASTE20(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE19(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19)\n#define NLOHMANN_JSON_PASTE21(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE20(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20)\n#define NLOHMANN_JSON_PASTE22(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE21(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21)\n#define NLOHMANN_JSON_PASTE23(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE22(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22)\n#define NLOHMANN_JSON_PASTE24(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE23(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23)\n#define NLOHMANN_JSON_PASTE25(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE24(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24)\n#define NLOHMANN_JSON_PASTE26(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE25(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25)\n#define NLOHMANN_JSON_PASTE27(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE26(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26)\n#define NLOHMANN_JSON_PASTE28(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE27(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27)\n#define NLOHMANN_JSON_PASTE29(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE28(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28)\n#define NLOHMANN_JSON_PASTE30(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE29(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29)\n#define NLOHMANN_JSON_PASTE31(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE30(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30)\n#define NLOHMANN_JSON_PASTE32(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE31(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31)\n#define NLOHMANN_JSON_PASTE33(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE32(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32)\n#define NLOHMANN_JSON_PASTE34(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE33(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33)\n#define NLOHMANN_JSON_PASTE35(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE34(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34)\n#define NLOHMANN_JSON_PASTE36(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE35(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35)\n#define NLOHMANN_JSON_PASTE37(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE36(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36)\n#define NLOHMANN_JSON_PASTE38(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE37(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37)\n#define NLOHMANN_JSON_PASTE39(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE38(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38)\n#define NLOHMANN_JSON_PASTE40(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE39(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39)\n#define NLOHMANN_JSON_PASTE41(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE40(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40)\n#define NLOHMANN_JSON_PASTE42(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE41(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41)\n#define NLOHMANN_JSON_PASTE43(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE42(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42)\n#define NLOHMANN_JSON_PASTE44(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE43(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43)\n#define NLOHMANN_JSON_PASTE45(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE44(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44)\n#define NLOHMANN_JSON_PASTE46(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE45(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45)\n#define NLOHMANN_JSON_PASTE47(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE46(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46)\n#define NLOHMANN_JSON_PASTE48(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE47(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47)\n#define NLOHMANN_JSON_PASTE49(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE48(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48)\n#define NLOHMANN_JSON_PASTE50(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE49(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49)\n#define NLOHMANN_JSON_PASTE51(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE50(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50)\n#define NLOHMANN_JSON_PASTE52(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE51(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51)\n#define NLOHMANN_JSON_PASTE53(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE52(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52)\n#define NLOHMANN_JSON_PASTE54(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE53(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53)\n#define NLOHMANN_JSON_PASTE55(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE54(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54)\n#define NLOHMANN_JSON_PASTE56(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE55(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55)\n#define NLOHMANN_JSON_PASTE57(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE56(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56)\n#define NLOHMANN_JSON_PASTE58(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE57(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57)\n#define NLOHMANN_JSON_PASTE59(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE58(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58)\n#define NLOHMANN_JSON_PASTE60(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE59(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59)\n#define NLOHMANN_JSON_PASTE61(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE60(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60)\n#define NLOHMANN_JSON_PASTE62(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE61(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61)\n#define NLOHMANN_JSON_PASTE63(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE62(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62)\n#define NLOHMANN_JSON_PASTE64(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE63(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63)\n\n#define NLOHMANN_JSON_TO(v1) nlohmann_json_j[#v1] = nlohmann_json_t.v1;\n#define NLOHMANN_JSON_FROM(v1) nlohmann_json_j.at(#v1).get_to(nlohmann_json_t.v1);\n\n/*!\n@brief macro\n@def NLOHMANN_DEFINE_TYPE_INTRUSIVE\n@since version 3.9.0\n*/\n#define NLOHMANN_DEFINE_TYPE_INTRUSIVE(Type, ...)  \\\n    friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \\\n    friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) }\n\n/*!\n@brief macro\n@def NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE\n@since version 3.9.0\n*/\n#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Type, ...)  \\\n    inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \\\n    inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) }\n\n#ifndef JSON_USE_IMPLICIT_CONVERSIONS\n    #define JSON_USE_IMPLICIT_CONVERSIONS 1\n#endif\n\n#if JSON_USE_IMPLICIT_CONVERSIONS\n    #define JSON_EXPLICIT\n#else\n    #define JSON_EXPLICIT explicit\n#endif\n\n\nnamespace nlohmann\n{\nnamespace detail\n{\n////////////////\n// exceptions //\n////////////////\n\n/*!\n@brief general exception of the @ref basic_json class\n\nThis class is an extension of `std::exception` objects with a member @a id for\nexception ids. It is used as the base class for all exceptions thrown by the\n@ref basic_json class. This class can hence be used as \"wildcard\" to catch\nexceptions.\n\nSubclasses:\n- @ref parse_error for exceptions indicating a parse error\n- @ref invalid_iterator for exceptions indicating errors with iterators\n- @ref type_error for exceptions indicating executing a member function with\n                  a wrong type\n- @ref out_of_range for exceptions indicating access out of the defined range\n- @ref other_error for exceptions indicating other library errors\n\n@internal\n@note To have nothrow-copy-constructible exceptions, we internally use\n      `std::runtime_error` which can cope with arbitrary-length error messages.\n      Intermediate strings are built with static functions and then passed to\n      the actual constructor.\n@endinternal\n\n@liveexample{The following code shows how arbitrary library exceptions can be\ncaught.,exception}\n\n@since version 3.0.0\n*/\nclass exception : public std::exception\n{\n  public:\n    /// returns the explanatory string\n    JSON_HEDLEY_RETURNS_NON_NULL\n    const char* what() const noexcept override\n    {\n        return m.what();\n    }\n\n    /// the id of the exception\n    const int id;\n\n  protected:\n    JSON_HEDLEY_NON_NULL(3)\n    exception(int id_, const char* what_arg) : id(id_), m(what_arg) {}\n\n    static std::string name(const std::string& ename, int id_)\n    {\n        return \"[json.exception.\" + ename + \".\" + std::to_string(id_) + \"] \";\n    }\n\n  private:\n    /// an exception object as storage for error messages\n    std::runtime_error m;\n};\n\n/*!\n@brief exception indicating a parse error\n\nThis exception is thrown by the library when a parse error occurs. Parse errors\ncan occur during the deserialization of JSON text, CBOR, MessagePack, as well\nas when using JSON Patch.\n\nMember @a byte holds the byte index of the last read character in the input\nfile.\n\nExceptions have ids 1xx.\n\nname / id                      | example message | description\n------------------------------ | --------------- | -------------------------\njson.exception.parse_error.101 | parse error at 2: unexpected end of input; expected string literal | This error indicates a syntax error while deserializing a JSON text. The error message describes that an unexpected token (character) was encountered, and the member @a byte indicates the error position.\njson.exception.parse_error.102 | parse error at 14: missing or wrong low surrogate | JSON uses the `\\uxxxx` format to describe Unicode characters. Code points above above 0xFFFF are split into two `\\uxxxx` entries (\"surrogate pairs\"). This error indicates that the surrogate pair is incomplete or contains an invalid code point.\njson.exception.parse_error.103 | parse error: code points above 0x10FFFF are invalid | Unicode supports code points up to 0x10FFFF. Code points above 0x10FFFF are invalid.\njson.exception.parse_error.104 | parse error: JSON patch must be an array of objects | [RFC 6902](https://tools.ietf.org/html/rfc6902) requires a JSON Patch document to be a JSON document that represents an array of objects.\njson.exception.parse_error.105 | parse error: operation must have string member 'op' | An operation of a JSON Patch document must contain exactly one \"op\" member, whose value indicates the operation to perform. Its value must be one of \"add\", \"remove\", \"replace\", \"move\", \"copy\", or \"test\"; other values are errors.\njson.exception.parse_error.106 | parse error: array index '01' must not begin with '0' | An array index in a JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) may be `0` or any number without a leading `0`.\njson.exception.parse_error.107 | parse error: JSON pointer must be empty or begin with '/' - was: 'foo' | A JSON Pointer must be a Unicode string containing a sequence of zero or more reference tokens, each prefixed by a `/` character.\njson.exception.parse_error.108 | parse error: escape character '~' must be followed with '0' or '1' | In a JSON Pointer, only `~0` and `~1` are valid escape sequences.\njson.exception.parse_error.109 | parse error: array index 'one' is not a number | A JSON Pointer array index must be a number.\njson.exception.parse_error.110 | parse error at 1: cannot read 2 bytes from vector | When parsing CBOR or MessagePack, the byte vector ends before the complete value has been read.\njson.exception.parse_error.112 | parse error at 1: error reading CBOR; last byte: 0xF8 | Not all types of CBOR or MessagePack are supported. This exception occurs if an unsupported byte was read.\njson.exception.parse_error.113 | parse error at 2: expected a CBOR string; last byte: 0x98 | While parsing a map key, a value that is not a string has been read.\njson.exception.parse_error.114 | parse error: Unsupported BSON record type 0x0F | The parsing of the corresponding BSON record type is not implemented (yet).\njson.exception.parse_error.115 | parse error at byte 5: syntax error while parsing UBJSON high-precision number: invalid number text: 1A | A UBJSON high-precision number could not be parsed.\n\n@note For an input with n bytes, 1 is the index of the first character and n+1\n      is the index of the terminating null byte or the end of file. This also\n      holds true when reading a byte vector (CBOR or MessagePack).\n\n@liveexample{The following code shows how a `parse_error` exception can be\ncaught.,parse_error}\n\n@sa - @ref exception for the base class of the library exceptions\n@sa - @ref invalid_iterator for exceptions indicating errors with iterators\n@sa - @ref type_error for exceptions indicating executing a member function with\n                    a wrong type\n@sa - @ref out_of_range for exceptions indicating access out of the defined range\n@sa - @ref other_error for exceptions indicating other library errors\n\n@since version 3.0.0\n*/\nclass parse_error : public exception\n{\n  public:\n    /*!\n    @brief create a parse error exception\n    @param[in] id_       the id of the exception\n    @param[in] pos       the position where the error occurred (or with\n                         chars_read_total=0 if the position cannot be\n                         determined)\n    @param[in] what_arg  the explanatory string\n    @return parse_error object\n    */\n    static parse_error create(int id_, const position_t& pos, const std::string& what_arg)\n    {\n        std::string w = exception::name(\"parse_error\", id_) + \"parse error\" +\n                        position_string(pos) + \": \" + what_arg;\n        return parse_error(id_, pos.chars_read_total, w.c_str());\n    }\n\n    static parse_error create(int id_, std::size_t byte_, const std::string& what_arg)\n    {\n        std::string w = exception::name(\"parse_error\", id_) + \"parse error\" +\n                        (byte_ != 0 ? (\" at byte \" + std::to_string(byte_)) : \"\") +\n                        \": \" + what_arg;\n        return parse_error(id_, byte_, w.c_str());\n    }\n\n    /*!\n    @brief byte index of the parse error\n\n    The byte index of the last read character in the input file.\n\n    @note For an input with n bytes, 1 is the index of the first character and\n          n+1 is the index of the terminating null byte or the end of file.\n          This also holds true when reading a byte vector (CBOR or MessagePack).\n    */\n    const std::size_t byte;\n\n  private:\n    parse_error(int id_, std::size_t byte_, const char* what_arg)\n        : exception(id_, what_arg), byte(byte_) {}\n\n    static std::string position_string(const position_t& pos)\n    {\n        return \" at line \" + std::to_string(pos.lines_read + 1) +\n               \", column \" + std::to_string(pos.chars_read_current_line);\n    }\n};\n\n/*!\n@brief exception indicating errors with iterators\n\nThis exception is thrown if iterators passed to a library function do not match\nthe expected semantics.\n\nExceptions have ids 2xx.\n\nname / id                           | example message | description\n----------------------------------- | --------------- | -------------------------\njson.exception.invalid_iterator.201 | iterators are not compatible | The iterators passed to constructor @ref basic_json(InputIT first, InputIT last) are not compatible, meaning they do not belong to the same container. Therefore, the range (@a first, @a last) is invalid.\njson.exception.invalid_iterator.202 | iterator does not fit current value | In an erase or insert function, the passed iterator @a pos does not belong to the JSON value for which the function was called. It hence does not define a valid position for the deletion/insertion.\njson.exception.invalid_iterator.203 | iterators do not fit current value | Either iterator passed to function @ref erase(IteratorType first, IteratorType last) does not belong to the JSON value from which values shall be erased. It hence does not define a valid range to delete values from.\njson.exception.invalid_iterator.204 | iterators out of range | When an iterator range for a primitive type (number, boolean, or string) is passed to a constructor or an erase function, this range has to be exactly (@ref begin(), @ref end()), because this is the only way the single stored value is expressed. All other ranges are invalid.\njson.exception.invalid_iterator.205 | iterator out of range | When an iterator for a primitive type (number, boolean, or string) is passed to an erase function, the iterator has to be the @ref begin() iterator, because it is the only way to address the stored value. All other iterators are invalid.\njson.exception.invalid_iterator.206 | cannot construct with iterators from null | The iterators passed to constructor @ref basic_json(InputIT first, InputIT last) belong to a JSON null value and hence to not define a valid range.\njson.exception.invalid_iterator.207 | cannot use key() for non-object iterators | The key() member function can only be used on iterators belonging to a JSON object, because other types do not have a concept of a key.\njson.exception.invalid_iterator.208 | cannot use operator[] for object iterators | The operator[] to specify a concrete offset cannot be used on iterators belonging to a JSON object, because JSON objects are unordered.\njson.exception.invalid_iterator.209 | cannot use offsets with object iterators | The offset operators (+, -, +=, -=) cannot be used on iterators belonging to a JSON object, because JSON objects are unordered.\njson.exception.invalid_iterator.210 | iterators do not fit | The iterator range passed to the insert function are not compatible, meaning they do not belong to the same container. Therefore, the range (@a first, @a last) is invalid.\njson.exception.invalid_iterator.211 | passed iterators may not belong to container | The iterator range passed to the insert function must not be a subrange of the container to insert to.\njson.exception.invalid_iterator.212 | cannot compare iterators of different containers | When two iterators are compared, they must belong to the same container.\njson.exception.invalid_iterator.213 | cannot compare order of object iterators | The order of object iterators cannot be compared, because JSON objects are unordered.\njson.exception.invalid_iterator.214 | cannot get value | Cannot get value for iterator: Either the iterator belongs to a null value or it is an iterator to a primitive type (number, boolean, or string), but the iterator is different to @ref begin().\n\n@liveexample{The following code shows how an `invalid_iterator` exception can be\ncaught.,invalid_iterator}\n\n@sa - @ref exception for the base class of the library exceptions\n@sa - @ref parse_error for exceptions indicating a parse error\n@sa - @ref type_error for exceptions indicating executing a member function with\n                    a wrong type\n@sa - @ref out_of_range for exceptions indicating access out of the defined range\n@sa - @ref other_error for exceptions indicating other library errors\n\n@since version 3.0.0\n*/\nclass invalid_iterator : public exception\n{\n  public:\n    static invalid_iterator create(int id_, const std::string& what_arg)\n    {\n        std::string w = exception::name(\"invalid_iterator\", id_) + what_arg;\n        return invalid_iterator(id_, w.c_str());\n    }\n\n  private:\n    JSON_HEDLEY_NON_NULL(3)\n    invalid_iterator(int id_, const char* what_arg)\n        : exception(id_, what_arg) {}\n};\n\n/*!\n@brief exception indicating executing a member function with a wrong type\n\nThis exception is thrown in case of a type error; that is, a library function is\nexecuted on a JSON value whose type does not match the expected semantics.\n\nExceptions have ids 3xx.\n\nname / id                     | example message | description\n----------------------------- | --------------- | -------------------------\njson.exception.type_error.301 | cannot create object from initializer list | To create an object from an initializer list, the initializer list must consist only of a list of pairs whose first element is a string. When this constraint is violated, an array is created instead.\njson.exception.type_error.302 | type must be object, but is array | During implicit or explicit value conversion, the JSON type must be compatible to the target type. For instance, a JSON string can only be converted into string types, but not into numbers or boolean types.\njson.exception.type_error.303 | incompatible ReferenceType for get_ref, actual type is object | To retrieve a reference to a value stored in a @ref basic_json object with @ref get_ref, the type of the reference must match the value type. For instance, for a JSON array, the @a ReferenceType must be @ref array_t &.\njson.exception.type_error.304 | cannot use at() with string | The @ref at() member functions can only be executed for certain JSON types.\njson.exception.type_error.305 | cannot use operator[] with string | The @ref operator[] member functions can only be executed for certain JSON types.\njson.exception.type_error.306 | cannot use value() with string | The @ref value() member functions can only be executed for certain JSON types.\njson.exception.type_error.307 | cannot use erase() with string | The @ref erase() member functions can only be executed for certain JSON types.\njson.exception.type_error.308 | cannot use push_back() with string | The @ref push_back() and @ref operator+= member functions can only be executed for certain JSON types.\njson.exception.type_error.309 | cannot use insert() with | The @ref insert() member functions can only be executed for certain JSON types.\njson.exception.type_error.310 | cannot use swap() with number | The @ref swap() member functions can only be executed for certain JSON types.\njson.exception.type_error.311 | cannot use emplace_back() with string | The @ref emplace_back() member function can only be executed for certain JSON types.\njson.exception.type_error.312 | cannot use update() with string | The @ref update() member functions can only be executed for certain JSON types.\njson.exception.type_error.313 | invalid value to unflatten | The @ref unflatten function converts an object whose keys are JSON Pointers back into an arbitrary nested JSON value. The JSON Pointers must not overlap, because then the resulting value would not be well defined.\njson.exception.type_error.314 | only objects can be unflattened | The @ref unflatten function only works for an object whose keys are JSON Pointers.\njson.exception.type_error.315 | values in object must be primitive | The @ref unflatten function only works for an object whose keys are JSON Pointers and whose values are primitive.\njson.exception.type_error.316 | invalid UTF-8 byte at index 10: 0x7E | The @ref dump function only works with UTF-8 encoded strings; that is, if you assign a `std::string` to a JSON value, make sure it is UTF-8 encoded. |\njson.exception.type_error.317 | JSON value cannot be serialized to requested format | The dynamic type of the object cannot be represented in the requested serialization format (e.g. a raw `true` or `null` JSON object cannot be serialized to BSON) |\n\n@liveexample{The following code shows how a `type_error` exception can be\ncaught.,type_error}\n\n@sa - @ref exception for the base class of the library exceptions\n@sa - @ref parse_error for exceptions indicating a parse error\n@sa - @ref invalid_iterator for exceptions indicating errors with iterators\n@sa - @ref out_of_range for exceptions indicating access out of the defined range\n@sa - @ref other_error for exceptions indicating other library errors\n\n@since version 3.0.0\n*/\nclass type_error : public exception\n{\n  public:\n    static type_error create(int id_, const std::string& what_arg)\n    {\n        std::string w = exception::name(\"type_error\", id_) + what_arg;\n        return type_error(id_, w.c_str());\n    }\n\n  private:\n    JSON_HEDLEY_NON_NULL(3)\n    type_error(int id_, const char* what_arg) : exception(id_, what_arg) {}\n};\n\n/*!\n@brief exception indicating access out of the defined range\n\nThis exception is thrown in case a library function is called on an input\nparameter that exceeds the expected range, for instance in case of array\nindices or nonexisting object keys.\n\nExceptions have ids 4xx.\n\nname / id                       | example message | description\n------------------------------- | --------------- | -------------------------\njson.exception.out_of_range.401 | array index 3 is out of range | The provided array index @a i is larger than @a size-1.\njson.exception.out_of_range.402 | array index '-' (3) is out of range | The special array index `-` in a JSON Pointer never describes a valid element of the array, but the index past the end. That is, it can only be used to add elements at this position, but not to read it.\njson.exception.out_of_range.403 | key 'foo' not found | The provided key was not found in the JSON object.\njson.exception.out_of_range.404 | unresolved reference token 'foo' | A reference token in a JSON Pointer could not be resolved.\njson.exception.out_of_range.405 | JSON pointer has no parent | The JSON Patch operations 'remove' and 'add' can not be applied to the root element of the JSON value.\njson.exception.out_of_range.406 | number overflow parsing '10E1000' | A parsed number could not be stored as without changing it to NaN or INF.\njson.exception.out_of_range.407 | number overflow serializing '9223372036854775808' | UBJSON and BSON only support integer numbers up to 9223372036854775807. (until version 3.8.0) |\njson.exception.out_of_range.408 | excessive array size: 8658170730974374167 | The size (following `#`) of an UBJSON array or object exceeds the maximal capacity. |\njson.exception.out_of_range.409 | BSON key cannot contain code point U+0000 (at byte 2) | Key identifiers to be serialized to BSON cannot contain code point U+0000, since the key is stored as zero-terminated c-string |\n\n@liveexample{The following code shows how an `out_of_range` exception can be\ncaught.,out_of_range}\n\n@sa - @ref exception for the base class of the library exceptions\n@sa - @ref parse_error for exceptions indicating a parse error\n@sa - @ref invalid_iterator for exceptions indicating errors with iterators\n@sa - @ref type_error for exceptions indicating executing a member function with\n                    a wrong type\n@sa - @ref other_error for exceptions indicating other library errors\n\n@since version 3.0.0\n*/\nclass out_of_range : public exception\n{\n  public:\n    static out_of_range create(int id_, const std::string& what_arg)\n    {\n        std::string w = exception::name(\"out_of_range\", id_) + what_arg;\n        return out_of_range(id_, w.c_str());\n    }\n\n  private:\n    JSON_HEDLEY_NON_NULL(3)\n    out_of_range(int id_, const char* what_arg) : exception(id_, what_arg) {}\n};\n\n/*!\n@brief exception indicating other library errors\n\nThis exception is thrown in case of errors that cannot be classified with the\nother exception types.\n\nExceptions have ids 5xx.\n\nname / id                      | example message | description\n------------------------------ | --------------- | -------------------------\njson.exception.other_error.501 | unsuccessful: {\"op\":\"test\",\"path\":\"/baz\", \"value\":\"bar\"} | A JSON Patch operation 'test' failed. The unsuccessful operation is also printed.\n\n@sa - @ref exception for the base class of the library exceptions\n@sa - @ref parse_error for exceptions indicating a parse error\n@sa - @ref invalid_iterator for exceptions indicating errors with iterators\n@sa - @ref type_error for exceptions indicating executing a member function with\n                    a wrong type\n@sa - @ref out_of_range for exceptions indicating access out of the defined range\n\n@liveexample{The following code shows how an `other_error` exception can be\ncaught.,other_error}\n\n@since version 3.0.0\n*/\nclass other_error : public exception\n{\n  public:\n    static other_error create(int id_, const std::string& what_arg)\n    {\n        std::string w = exception::name(\"other_error\", id_) + what_arg;\n        return other_error(id_, w.c_str());\n    }\n\n  private:\n    JSON_HEDLEY_NON_NULL(3)\n    other_error(int id_, const char* what_arg) : exception(id_, what_arg) {}\n};\n}  // namespace detail\n}  // namespace nlohmann\n\n// #include <nlohmann/detail/macro_scope.hpp>\n\n// #include <nlohmann/detail/meta/cpp_future.hpp>\n\n\n#include <cstddef> // size_t\n#include <type_traits> // conditional, enable_if, false_type, integral_constant, is_constructible, is_integral, is_same, remove_cv, remove_reference, true_type\n\nnamespace nlohmann\n{\nnamespace detail\n{\n// alias templates to reduce boilerplate\ntemplate<bool B, typename T = void>\nusing enable_if_t = typename std::enable_if<B, T>::type;\n\ntemplate<typename T>\nusing uncvref_t = typename std::remove_cv<typename std::remove_reference<T>::type>::type;\n\n// implementation of C++14 index_sequence and affiliates\n// source: https://stackoverflow.com/a/32223343\ntemplate<std::size_t... Ints>\nstruct index_sequence\n{\n    using type = index_sequence;\n    using value_type = std::size_t;\n    static constexpr std::size_t size() noexcept\n    {\n        return sizeof...(Ints);\n    }\n};\n\ntemplate<class Sequence1, class Sequence2>\nstruct merge_and_renumber;\n\ntemplate<std::size_t... I1, std::size_t... I2>\nstruct merge_and_renumber<index_sequence<I1...>, index_sequence<I2...>>\n        : index_sequence < I1..., (sizeof...(I1) + I2)... > {};\n\ntemplate<std::size_t N>\nstruct make_index_sequence\n    : merge_and_renumber < typename make_index_sequence < N / 2 >::type,\n      typename make_index_sequence < N - N / 2 >::type > {};\n\ntemplate<> struct make_index_sequence<0> : index_sequence<> {};\ntemplate<> struct make_index_sequence<1> : index_sequence<0> {};\n\ntemplate<typename... Ts>\nusing index_sequence_for = make_index_sequence<sizeof...(Ts)>;\n\n// dispatch utility (taken from ranges-v3)\ntemplate<unsigned N> struct priority_tag : priority_tag < N - 1 > {};\ntemplate<> struct priority_tag<0> {};\n\n// taken from ranges-v3\ntemplate<typename T>\nstruct static_const\n{\n    static constexpr T value{};\n};\n\ntemplate<typename T>\nconstexpr T static_const<T>::value;\n}  // namespace detail\n}  // namespace nlohmann\n\n// #include <nlohmann/detail/meta/type_traits.hpp>\n\n\n#include <limits> // numeric_limits\n#include <type_traits> // false_type, is_constructible, is_integral, is_same, true_type\n#include <utility> // declval\n\n// #include <nlohmann/detail/iterators/iterator_traits.hpp>\n\n\n#include <iterator> // random_access_iterator_tag\n\n// #include <nlohmann/detail/meta/void_t.hpp>\n\n\nnamespace nlohmann\n{\nnamespace detail\n{\ntemplate<typename ...Ts> struct make_void\n{\n    using type = void;\n};\ntemplate<typename ...Ts> using void_t = typename make_void<Ts...>::type;\n} // namespace detail\n}  // namespace nlohmann\n\n// #include <nlohmann/detail/meta/cpp_future.hpp>\n\n\nnamespace nlohmann\n{\nnamespace detail\n{\ntemplate<typename It, typename = void>\nstruct iterator_types {};\n\ntemplate<typename It>\nstruct iterator_types <\n    It,\n    void_t<typename It::difference_type, typename It::value_type, typename It::pointer,\n    typename It::reference, typename It::iterator_category >>\n{\n    using difference_type = typename It::difference_type;\n    using value_type = typename It::value_type;\n    using pointer = typename It::pointer;\n    using reference = typename It::reference;\n    using iterator_category = typename It::iterator_category;\n};\n\n// This is required as some compilers implement std::iterator_traits in a way that\n// doesn't work with SFINAE. See https://github.com/nlohmann/json/issues/1341.\ntemplate<typename T, typename = void>\nstruct iterator_traits\n{\n};\n\ntemplate<typename T>\nstruct iterator_traits < T, enable_if_t < !std::is_pointer<T>::value >>\n            : iterator_types<T>\n{\n};\n\ntemplate<typename T>\nstruct iterator_traits<T*, enable_if_t<std::is_object<T>::value>>\n{\n    using iterator_category = std::random_access_iterator_tag;\n    using value_type = T;\n    using difference_type = ptrdiff_t;\n    using pointer = T*;\n    using reference = T&;\n};\n} // namespace detail\n} // namespace nlohmann\n\n// #include <nlohmann/detail/macro_scope.hpp>\n\n// #include <nlohmann/detail/meta/cpp_future.hpp>\n\n// #include <nlohmann/detail/meta/detected.hpp>\n\n\n#include <type_traits>\n\n// #include <nlohmann/detail/meta/void_t.hpp>\n\n\n// https://en.cppreference.com/w/cpp/experimental/is_detected\nnamespace nlohmann\n{\nnamespace detail\n{\nstruct nonesuch\n{\n    nonesuch() = delete;\n    ~nonesuch() = delete;\n    nonesuch(nonesuch const&) = delete;\n    nonesuch(nonesuch const&&) = delete;\n    void operator=(nonesuch const&) = delete;\n    void operator=(nonesuch&&) = delete;\n};\n\ntemplate<class Default,\n         class AlwaysVoid,\n         template<class...> class Op,\n         class... Args>\nstruct detector\n{\n    using value_t = std::false_type;\n    using type = Default;\n};\n\ntemplate<class Default, template<class...> class Op, class... Args>\nstruct detector<Default, void_t<Op<Args...>>, Op, Args...>\n{\n    using value_t = std::true_type;\n    using type = Op<Args...>;\n};\n\ntemplate<template<class...> class Op, class... Args>\nusing is_detected = typename detector<nonesuch, void, Op, Args...>::value_t;\n\ntemplate<template<class...> class Op, class... Args>\nusing detected_t = typename detector<nonesuch, void, Op, Args...>::type;\n\ntemplate<class Default, template<class...> class Op, class... Args>\nusing detected_or = detector<Default, void, Op, Args...>;\n\ntemplate<class Default, template<class...> class Op, class... Args>\nusing detected_or_t = typename detected_or<Default, Op, Args...>::type;\n\ntemplate<class Expected, template<class...> class Op, class... Args>\nusing is_detected_exact = std::is_same<Expected, detected_t<Op, Args...>>;\n\ntemplate<class To, template<class...> class Op, class... Args>\nusing is_detected_convertible =\n    std::is_convertible<detected_t<Op, Args...>, To>;\n}  // namespace detail\n}  // namespace nlohmann\n\n// #include <nlohmann/json_fwd.hpp>\n#ifndef INCLUDE_NLOHMANN_JSON_FWD_HPP_\n#define INCLUDE_NLOHMANN_JSON_FWD_HPP_\n\n#include <cstdint> // int64_t, uint64_t\n#include <map> // map\n#include <memory> // allocator\n#include <string> // string\n#include <vector> // vector\n\n/*!\n@brief namespace for Niels Lohmann\n@see https://github.com/nlohmann\n@since version 1.0.0\n*/\nnamespace nlohmann\n{\n/*!\n@brief default JSONSerializer template argument\n\nThis serializer ignores the template arguments and uses ADL\n([argument-dependent lookup](https://en.cppreference.com/w/cpp/language/adl))\nfor serialization.\n*/\ntemplate<typename T = void, typename SFINAE = void>\nstruct adl_serializer;\n\ntemplate<template<typename U, typename V, typename... Args> class ObjectType =\n         std::map,\n         template<typename U, typename... Args> class ArrayType = std::vector,\n         class StringType = std::string, class BooleanType = bool,\n         class NumberIntegerType = std::int64_t,\n         class NumberUnsignedType = std::uint64_t,\n         class NumberFloatType = double,\n         template<typename U> class AllocatorType = std::allocator,\n         template<typename T, typename SFINAE = void> class JSONSerializer =\n         adl_serializer,\n         class BinaryType = std::vector<std::uint8_t>>\nclass basic_json;\n\n/*!\n@brief JSON Pointer\n\nA JSON pointer defines a string syntax for identifying a specific value\nwithin a JSON document. It can be used with functions `at` and\n`operator[]`. Furthermore, JSON pointers are the base for JSON patches.\n\n@sa [RFC 6901](https://tools.ietf.org/html/rfc6901)\n\n@since version 2.0.0\n*/\ntemplate<typename BasicJsonType>\nclass json_pointer;\n\n/*!\n@brief default JSON class\n\nThis type is the default specialization of the @ref basic_json class which\nuses the standard template types.\n\n@since version 1.0.0\n*/\nusing json = basic_json<>;\n\ntemplate<class Key, class T, class IgnoredLess, class Allocator>\nstruct ordered_map;\n\n/*!\n@brief ordered JSON class\n\nThis type preserves the insertion order of object keys.\n\n@since version 3.9.0\n*/\nusing ordered_json = basic_json<nlohmann::ordered_map>;\n\n}  // namespace nlohmann\n\n#endif  // INCLUDE_NLOHMANN_JSON_FWD_HPP_\n\n\nnamespace nlohmann\n{\n/*!\n@brief detail namespace with internal helper functions\n\nThis namespace collects functions that should not be exposed,\nimplementations of some @ref basic_json methods, and meta-programming helpers.\n\n@since version 2.1.0\n*/\nnamespace detail\n{\n/////////////\n// helpers //\n/////////////\n\n// Note to maintainers:\n//\n// Every trait in this file expects a non CV-qualified type.\n// The only exceptions are in the 'aliases for detected' section\n// (i.e. those of the form: decltype(T::member_function(std::declval<T>())))\n//\n// In this case, T has to be properly CV-qualified to constraint the function arguments\n// (e.g. to_json(BasicJsonType&, const T&))\n\ntemplate<typename> struct is_basic_json : std::false_type {};\n\nNLOHMANN_BASIC_JSON_TPL_DECLARATION\nstruct is_basic_json<NLOHMANN_BASIC_JSON_TPL> : std::true_type {};\n\n//////////////////////\n// json_ref helpers //\n//////////////////////\n\ntemplate<typename>\nclass json_ref;\n\ntemplate<typename>\nstruct is_json_ref : std::false_type {};\n\ntemplate<typename T>\nstruct is_json_ref<json_ref<T>> : std::true_type {};\n\n//////////////////////////\n// aliases for detected //\n//////////////////////////\n\ntemplate<typename T>\nusing mapped_type_t = typename T::mapped_type;\n\ntemplate<typename T>\nusing key_type_t = typename T::key_type;\n\ntemplate<typename T>\nusing value_type_t = typename T::value_type;\n\ntemplate<typename T>\nusing difference_type_t = typename T::difference_type;\n\ntemplate<typename T>\nusing pointer_t = typename T::pointer;\n\ntemplate<typename T>\nusing reference_t = typename T::reference;\n\ntemplate<typename T>\nusing iterator_category_t = typename T::iterator_category;\n\ntemplate<typename T>\nusing iterator_t = typename T::iterator;\n\ntemplate<typename T, typename... Args>\nusing to_json_function = decltype(T::to_json(std::declval<Args>()...));\n\ntemplate<typename T, typename... Args>\nusing from_json_function = decltype(T::from_json(std::declval<Args>()...));\n\ntemplate<typename T, typename U>\nusing get_template_function = decltype(std::declval<T>().template get<U>());\n\n// trait checking if JSONSerializer<T>::from_json(json const&, udt&) exists\ntemplate<typename BasicJsonType, typename T, typename = void>\nstruct has_from_json : std::false_type {};\n\n// trait checking if j.get<T> is valid\n// use this trait instead of std::is_constructible or std::is_convertible,\n// both rely on, or make use of implicit conversions, and thus fail when T\n// has several constructors/operator= (see https://github.com/nlohmann/json/issues/958)\ntemplate <typename BasicJsonType, typename T>\nstruct is_getable\n{\n    static constexpr bool value = is_detected<get_template_function, const BasicJsonType&, T>::value;\n};\n\ntemplate<typename BasicJsonType, typename T>\nstruct has_from_json < BasicJsonType, T,\n           enable_if_t < !is_basic_json<T>::value >>\n{\n    using serializer = typename BasicJsonType::template json_serializer<T, void>;\n\n    static constexpr bool value =\n        is_detected_exact<void, from_json_function, serializer,\n        const BasicJsonType&, T&>::value;\n};\n\n// This trait checks if JSONSerializer<T>::from_json(json const&) exists\n// this overload is used for non-default-constructible user-defined-types\ntemplate<typename BasicJsonType, typename T, typename = void>\nstruct has_non_default_from_json : std::false_type {};\n\ntemplate<typename BasicJsonType, typename T>\nstruct has_non_default_from_json < BasicJsonType, T, enable_if_t < !is_basic_json<T>::value >>\n{\n    using serializer = typename BasicJsonType::template json_serializer<T, void>;\n\n    static constexpr bool value =\n        is_detected_exact<T, from_json_function, serializer,\n        const BasicJsonType&>::value;\n};\n\n// This trait checks if BasicJsonType::json_serializer<T>::to_json exists\n// Do not evaluate the trait when T is a basic_json type, to avoid template instantiation infinite recursion.\ntemplate<typename BasicJsonType, typename T, typename = void>\nstruct has_to_json : std::false_type {};\n\ntemplate<typename BasicJsonType, typename T>\nstruct has_to_json < BasicJsonType, T, enable_if_t < !is_basic_json<T>::value >>\n{\n    using serializer = typename BasicJsonType::template json_serializer<T, void>;\n\n    static constexpr bool value =\n        is_detected_exact<void, to_json_function, serializer, BasicJsonType&,\n        T>::value;\n};\n\n\n///////////////////\n// is_ functions //\n///////////////////\n\ntemplate<typename T, typename = void>\nstruct is_iterator_traits : std::false_type {};\n\ntemplate<typename T>\nstruct is_iterator_traits<iterator_traits<T>>\n{\n  private:\n    using traits = iterator_traits<T>;\n\n  public:\n    static constexpr auto value =\n        is_detected<value_type_t, traits>::value &&\n        is_detected<difference_type_t, traits>::value &&\n        is_detected<pointer_t, traits>::value &&\n        is_detected<iterator_category_t, traits>::value &&\n        is_detected<reference_t, traits>::value;\n};\n\n// source: https://stackoverflow.com/a/37193089/4116453\n\ntemplate<typename T, typename = void>\nstruct is_complete_type : std::false_type {};\n\ntemplate<typename T>\nstruct is_complete_type<T, decltype(void(sizeof(T)))> : std::true_type {};\n\ntemplate<typename BasicJsonType, typename CompatibleObjectType,\n         typename = void>\nstruct is_compatible_object_type_impl : std::false_type {};\n\ntemplate<typename BasicJsonType, typename CompatibleObjectType>\nstruct is_compatible_object_type_impl <\n    BasicJsonType, CompatibleObjectType,\n    enable_if_t < is_detected<mapped_type_t, CompatibleObjectType>::value&&\n    is_detected<key_type_t, CompatibleObjectType>::value >>\n{\n\n    using object_t = typename BasicJsonType::object_t;\n\n    // macOS's is_constructible does not play well with nonesuch...\n    static constexpr bool value =\n        std::is_constructible<typename object_t::key_type,\n        typename CompatibleObjectType::key_type>::value &&\n        std::is_constructible<typename object_t::mapped_type,\n        typename CompatibleObjectType::mapped_type>::value;\n};\n\ntemplate<typename BasicJsonType, typename CompatibleObjectType>\nstruct is_compatible_object_type\n    : is_compatible_object_type_impl<BasicJsonType, CompatibleObjectType> {};\n\ntemplate<typename BasicJsonType, typename ConstructibleObjectType,\n         typename = void>\nstruct is_constructible_object_type_impl : std::false_type {};\n\ntemplate<typename BasicJsonType, typename ConstructibleObjectType>\nstruct is_constructible_object_type_impl <\n    BasicJsonType, ConstructibleObjectType,\n    enable_if_t < is_detected<mapped_type_t, ConstructibleObjectType>::value&&\n    is_detected<key_type_t, ConstructibleObjectType>::value >>\n{\n    using object_t = typename BasicJsonType::object_t;\n\n    static constexpr bool value =\n        (std::is_default_constructible<ConstructibleObjectType>::value &&\n         (std::is_move_assignable<ConstructibleObjectType>::value ||\n          std::is_copy_assignable<ConstructibleObjectType>::value) &&\n         (std::is_constructible<typename ConstructibleObjectType::key_type,\n          typename object_t::key_type>::value &&\n          std::is_same <\n          typename object_t::mapped_type,\n          typename ConstructibleObjectType::mapped_type >::value)) ||\n        (has_from_json<BasicJsonType,\n         typename ConstructibleObjectType::mapped_type>::value ||\n         has_non_default_from_json <\n         BasicJsonType,\n         typename ConstructibleObjectType::mapped_type >::value);\n};\n\ntemplate<typename BasicJsonType, typename ConstructibleObjectType>\nstruct is_constructible_object_type\n    : is_constructible_object_type_impl<BasicJsonType,\n      ConstructibleObjectType> {};\n\ntemplate<typename BasicJsonType, typename CompatibleStringType,\n         typename = void>\nstruct is_compatible_string_type_impl : std::false_type {};\n\ntemplate<typename BasicJsonType, typename CompatibleStringType>\nstruct is_compatible_string_type_impl <\n    BasicJsonType, CompatibleStringType,\n    enable_if_t<is_detected_exact<typename BasicJsonType::string_t::value_type,\n    value_type_t, CompatibleStringType>::value >>\n{\n    static constexpr auto value =\n        std::is_constructible<typename BasicJsonType::string_t, CompatibleStringType>::value;\n};\n\ntemplate<typename BasicJsonType, typename ConstructibleStringType>\nstruct is_compatible_string_type\n    : is_compatible_string_type_impl<BasicJsonType, ConstructibleStringType> {};\n\ntemplate<typename BasicJsonType, typename ConstructibleStringType,\n         typename = void>\nstruct is_constructible_string_type_impl : std::false_type {};\n\ntemplate<typename BasicJsonType, typename ConstructibleStringType>\nstruct is_constructible_string_type_impl <\n    BasicJsonType, ConstructibleStringType,\n    enable_if_t<is_detected_exact<typename BasicJsonType::string_t::value_type,\n    value_type_t, ConstructibleStringType>::value >>\n{\n    static constexpr auto value =\n        std::is_constructible<ConstructibleStringType,\n        typename BasicJsonType::string_t>::value;\n};\n\ntemplate<typename BasicJsonType, typename ConstructibleStringType>\nstruct is_constructible_string_type\n    : is_constructible_string_type_impl<BasicJsonType, ConstructibleStringType> {};\n\ntemplate<typename BasicJsonType, typename CompatibleArrayType, typename = void>\nstruct is_compatible_array_type_impl : std::false_type {};\n\ntemplate<typename BasicJsonType, typename CompatibleArrayType>\nstruct is_compatible_array_type_impl <\n    BasicJsonType, CompatibleArrayType,\n    enable_if_t < is_detected<value_type_t, CompatibleArrayType>::value&&\n    is_detected<iterator_t, CompatibleArrayType>::value&&\n// This is needed because json_reverse_iterator has a ::iterator type...\n// Therefore it is detected as a CompatibleArrayType.\n// The real fix would be to have an Iterable concept.\n    !is_iterator_traits <\n    iterator_traits<CompatibleArrayType >>::value >>\n{\n    static constexpr bool value =\n        std::is_constructible<BasicJsonType,\n        typename CompatibleArrayType::value_type>::value;\n};\n\ntemplate<typename BasicJsonType, typename CompatibleArrayType>\nstruct is_compatible_array_type\n    : is_compatible_array_type_impl<BasicJsonType, CompatibleArrayType> {};\n\ntemplate<typename BasicJsonType, typename ConstructibleArrayType, typename = void>\nstruct is_constructible_array_type_impl : std::false_type {};\n\ntemplate<typename BasicJsonType, typename ConstructibleArrayType>\nstruct is_constructible_array_type_impl <\n    BasicJsonType, ConstructibleArrayType,\n    enable_if_t<std::is_same<ConstructibleArrayType,\n    typename BasicJsonType::value_type>::value >>\n            : std::true_type {};\n\ntemplate<typename BasicJsonType, typename ConstructibleArrayType>\nstruct is_constructible_array_type_impl <\n    BasicJsonType, ConstructibleArrayType,\n    enable_if_t < !std::is_same<ConstructibleArrayType,\n    typename BasicJsonType::value_type>::value&&\n    std::is_default_constructible<ConstructibleArrayType>::value&&\n(std::is_move_assignable<ConstructibleArrayType>::value ||\n std::is_copy_assignable<ConstructibleArrayType>::value)&&\nis_detected<value_type_t, ConstructibleArrayType>::value&&\nis_detected<iterator_t, ConstructibleArrayType>::value&&\nis_complete_type <\ndetected_t<value_type_t, ConstructibleArrayType >>::value >>\n{\n    static constexpr bool value =\n        // This is needed because json_reverse_iterator has a ::iterator type,\n        // furthermore, std::back_insert_iterator (and other iterators) have a\n        // base class `iterator`... Therefore it is detected as a\n        // ConstructibleArrayType. The real fix would be to have an Iterable\n        // concept.\n        !is_iterator_traits<iterator_traits<ConstructibleArrayType>>::value &&\n\n        (std::is_same<typename ConstructibleArrayType::value_type,\n         typename BasicJsonType::array_t::value_type>::value ||\n         has_from_json<BasicJsonType,\n         typename ConstructibleArrayType::value_type>::value ||\n         has_non_default_from_json <\n         BasicJsonType, typename ConstructibleArrayType::value_type >::value);\n};\n\ntemplate<typename BasicJsonType, typename ConstructibleArrayType>\nstruct is_constructible_array_type\n    : is_constructible_array_type_impl<BasicJsonType, ConstructibleArrayType> {};\n\ntemplate<typename RealIntegerType, typename CompatibleNumberIntegerType,\n         typename = void>\nstruct is_compatible_integer_type_impl : std::false_type {};\n\ntemplate<typename RealIntegerType, typename CompatibleNumberIntegerType>\nstruct is_compatible_integer_type_impl <\n    RealIntegerType, CompatibleNumberIntegerType,\n    enable_if_t < std::is_integral<RealIntegerType>::value&&\n    std::is_integral<CompatibleNumberIntegerType>::value&&\n    !std::is_same<bool, CompatibleNumberIntegerType>::value >>\n{\n    // is there an assert somewhere on overflows?\n    using RealLimits = std::numeric_limits<RealIntegerType>;\n    using CompatibleLimits = std::numeric_limits<CompatibleNumberIntegerType>;\n\n    static constexpr auto value =\n        std::is_constructible<RealIntegerType,\n        CompatibleNumberIntegerType>::value &&\n        CompatibleLimits::is_integer &&\n        RealLimits::is_signed == CompatibleLimits::is_signed;\n};\n\ntemplate<typename RealIntegerType, typename CompatibleNumberIntegerType>\nstruct is_compatible_integer_type\n    : is_compatible_integer_type_impl<RealIntegerType,\n      CompatibleNumberIntegerType> {};\n\ntemplate<typename BasicJsonType, typename CompatibleType, typename = void>\nstruct is_compatible_type_impl: std::false_type {};\n\ntemplate<typename BasicJsonType, typename CompatibleType>\nstruct is_compatible_type_impl <\n    BasicJsonType, CompatibleType,\n    enable_if_t<is_complete_type<CompatibleType>::value >>\n{\n    static constexpr bool value =\n        has_to_json<BasicJsonType, CompatibleType>::value;\n};\n\ntemplate<typename BasicJsonType, typename CompatibleType>\nstruct is_compatible_type\n    : is_compatible_type_impl<BasicJsonType, CompatibleType> {};\n\n// https://en.cppreference.com/w/cpp/types/conjunction\ntemplate<class...> struct conjunction : std::true_type { };\ntemplate<class B1> struct conjunction<B1> : B1 { };\ntemplate<class B1, class... Bn>\nstruct conjunction<B1, Bn...>\n: std::conditional<bool(B1::value), conjunction<Bn...>, B1>::type {};\n\ntemplate<typename T1, typename T2>\nstruct is_constructible_tuple : std::false_type {};\n\ntemplate<typename T1, typename... Args>\nstruct is_constructible_tuple<T1, std::tuple<Args...>> : conjunction<std::is_constructible<T1, Args>...> {};\n}  // namespace detail\n}  // namespace nlohmann\n\n// #include <nlohmann/detail/value_t.hpp>\n\n\n#include <array> // array\n#include <cstddef> // size_t\n#include <cstdint> // uint8_t\n#include <string> // string\n\nnamespace nlohmann\n{\nnamespace detail\n{\n///////////////////////////\n// JSON type enumeration //\n///////////////////////////\n\n/*!\n@brief the JSON type enumeration\n\nThis enumeration collects the different JSON types. It is internally used to\ndistinguish the stored values, and the functions @ref basic_json::is_null(),\n@ref basic_json::is_object(), @ref basic_json::is_array(),\n@ref basic_json::is_string(), @ref basic_json::is_boolean(),\n@ref basic_json::is_number() (with @ref basic_json::is_number_integer(),\n@ref basic_json::is_number_unsigned(), and @ref basic_json::is_number_float()),\n@ref basic_json::is_discarded(), @ref basic_json::is_primitive(), and\n@ref basic_json::is_structured() rely on it.\n\n@note There are three enumeration entries (number_integer, number_unsigned, and\nnumber_float), because the library distinguishes these three types for numbers:\n@ref basic_json::number_unsigned_t is used for unsigned integers,\n@ref basic_json::number_integer_t is used for signed integers, and\n@ref basic_json::number_float_t is used for floating-point numbers or to\napproximate integers which do not fit in the limits of their respective type.\n\n@sa @ref basic_json::basic_json(const value_t value_type) -- create a JSON\nvalue with the default value for a given type\n\n@since version 1.0.0\n*/\nenum class value_t : std::uint8_t\n{\n    null,             ///< null value\n    object,           ///< object (unordered set of name/value pairs)\n    array,            ///< array (ordered collection of values)\n    string,           ///< string value\n    boolean,          ///< boolean value\n    number_integer,   ///< number value (signed integer)\n    number_unsigned,  ///< number value (unsigned integer)\n    number_float,     ///< number value (floating-point)\n    binary,           ///< binary array (ordered collection of bytes)\n    discarded         ///< discarded by the parser callback function\n};\n\n/*!\n@brief comparison operator for JSON types\n\nReturns an ordering that is similar to Python:\n- order: null < boolean < number < object < array < string < binary\n- furthermore, each type is not smaller than itself\n- discarded values are not comparable\n- binary is represented as a b\"\" string in python and directly comparable to a\n  string; however, making a binary array directly comparable with a string would\n  be surprising behavior in a JSON file.\n\n@since version 1.0.0\n*/\ninline bool operator<(const value_t lhs, const value_t rhs) noexcept\n{\n    static constexpr std::array<std::uint8_t, 9> order = {{\n            0 /* null */, 3 /* object */, 4 /* array */, 5 /* string */,\n            1 /* boolean */, 2 /* integer */, 2 /* unsigned */, 2 /* float */,\n            6 /* binary */\n        }\n    };\n\n    const auto l_index = static_cast<std::size_t>(lhs);\n    const auto r_index = static_cast<std::size_t>(rhs);\n    return l_index < order.size() && r_index < order.size() && order[l_index] < order[r_index];\n}\n}  // namespace detail\n}  // namespace nlohmann\n\n\nnamespace nlohmann\n{\nnamespace detail\n{\ntemplate<typename BasicJsonType>\nvoid from_json(const BasicJsonType& j, typename std::nullptr_t& n)\n{\n    if (JSON_HEDLEY_UNLIKELY(!j.is_null()))\n    {\n        JSON_THROW(type_error::create(302, \"type must be null, but is \" + std::string(j.type_name())));\n    }\n    n = nullptr;\n}\n\n// overloads for basic_json template parameters\ntemplate < typename BasicJsonType, typename ArithmeticType,\n           enable_if_t < std::is_arithmetic<ArithmeticType>::value&&\n                         !std::is_same<ArithmeticType, typename BasicJsonType::boolean_t>::value,\n                         int > = 0 >\nvoid get_arithmetic_value(const BasicJsonType& j, ArithmeticType& val)\n{\n    switch (static_cast<value_t>(j))\n    {\n        case value_t::number_unsigned:\n        {\n            val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::number_unsigned_t*>());\n            break;\n        }\n        case value_t::number_integer:\n        {\n            val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::number_integer_t*>());\n            break;\n        }\n        case value_t::number_float:\n        {\n            val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::number_float_t*>());\n            break;\n        }\n\n        default:\n            JSON_THROW(type_error::create(302, \"type must be number, but is \" + std::string(j.type_name())));\n    }\n}\n\ntemplate<typename BasicJsonType>\nvoid from_json(const BasicJsonType& j, typename BasicJsonType::boolean_t& b)\n{\n    if (JSON_HEDLEY_UNLIKELY(!j.is_boolean()))\n    {\n        JSON_THROW(type_error::create(302, \"type must be boolean, but is \" + std::string(j.type_name())));\n    }\n    b = *j.template get_ptr<const typename BasicJsonType::boolean_t*>();\n}\n\ntemplate<typename BasicJsonType>\nvoid from_json(const BasicJsonType& j, typename BasicJsonType::string_t& s)\n{\n    if (JSON_HEDLEY_UNLIKELY(!j.is_string()))\n    {\n        JSON_THROW(type_error::create(302, \"type must be string, but is \" + std::string(j.type_name())));\n    }\n    s = *j.template get_ptr<const typename BasicJsonType::string_t*>();\n}\n\ntemplate <\n    typename BasicJsonType, typename ConstructibleStringType,\n    enable_if_t <\n        is_constructible_string_type<BasicJsonType, ConstructibleStringType>::value&&\n        !std::is_same<typename BasicJsonType::string_t,\n                      ConstructibleStringType>::value,\n        int > = 0 >\nvoid from_json(const BasicJsonType& j, ConstructibleStringType& s)\n{\n    if (JSON_HEDLEY_UNLIKELY(!j.is_string()))\n    {\n        JSON_THROW(type_error::create(302, \"type must be string, but is \" + std::string(j.type_name())));\n    }\n\n    s = *j.template get_ptr<const typename BasicJsonType::string_t*>();\n}\n\ntemplate<typename BasicJsonType>\nvoid from_json(const BasicJsonType& j, typename BasicJsonType::number_float_t& val)\n{\n    get_arithmetic_value(j, val);\n}\n\ntemplate<typename BasicJsonType>\nvoid from_json(const BasicJsonType& j, typename BasicJsonType::number_unsigned_t& val)\n{\n    get_arithmetic_value(j, val);\n}\n\ntemplate<typename BasicJsonType>\nvoid from_json(const BasicJsonType& j, typename BasicJsonType::number_integer_t& val)\n{\n    get_arithmetic_value(j, val);\n}\n\ntemplate<typename BasicJsonType, typename EnumType,\n         enable_if_t<std::is_enum<EnumType>::value, int> = 0>\nvoid from_json(const BasicJsonType& j, EnumType& e)\n{\n    typename std::underlying_type<EnumType>::type val;\n    get_arithmetic_value(j, val);\n    e = static_cast<EnumType>(val);\n}\n\n// forward_list doesn't have an insert method\ntemplate<typename BasicJsonType, typename T, typename Allocator,\n         enable_if_t<is_getable<BasicJsonType, T>::value, int> = 0>\nvoid from_json(const BasicJsonType& j, std::forward_list<T, Allocator>& l)\n{\n    if (JSON_HEDLEY_UNLIKELY(!j.is_array()))\n    {\n        JSON_THROW(type_error::create(302, \"type must be array, but is \" + std::string(j.type_name())));\n    }\n    l.clear();\n    std::transform(j.rbegin(), j.rend(),\n                   std::front_inserter(l), [](const BasicJsonType & i)\n    {\n        return i.template get<T>();\n    });\n}\n\n// valarray doesn't have an insert method\ntemplate<typename BasicJsonType, typename T,\n         enable_if_t<is_getable<BasicJsonType, T>::value, int> = 0>\nvoid from_json(const BasicJsonType& j, std::valarray<T>& l)\n{\n    if (JSON_HEDLEY_UNLIKELY(!j.is_array()))\n    {\n        JSON_THROW(type_error::create(302, \"type must be array, but is \" + std::string(j.type_name())));\n    }\n    l.resize(j.size());\n    std::transform(j.begin(), j.end(), std::begin(l),\n                   [](const BasicJsonType & elem)\n    {\n        return elem.template get<T>();\n    });\n}\n\ntemplate<typename BasicJsonType, typename T, std::size_t N>\nauto from_json(const BasicJsonType& j, T (&arr)[N])\n-> decltype(j.template get<T>(), void())\n{\n    for (std::size_t i = 0; i < N; ++i)\n    {\n        arr[i] = j.at(i).template get<T>();\n    }\n}\n\ntemplate<typename BasicJsonType>\nvoid from_json_array_impl(const BasicJsonType& j, typename BasicJsonType::array_t& arr, priority_tag<3> /*unused*/)\n{\n    arr = *j.template get_ptr<const typename BasicJsonType::array_t*>();\n}\n\ntemplate<typename BasicJsonType, typename T, std::size_t N>\nauto from_json_array_impl(const BasicJsonType& j, std::array<T, N>& arr,\n                          priority_tag<2> /*unused*/)\n-> decltype(j.template get<T>(), void())\n{\n    for (std::size_t i = 0; i < N; ++i)\n    {\n        arr[i] = j.at(i).template get<T>();\n    }\n}\n\ntemplate<typename BasicJsonType, typename ConstructibleArrayType>\nauto from_json_array_impl(const BasicJsonType& j, ConstructibleArrayType& arr, priority_tag<1> /*unused*/)\n-> decltype(\n    arr.reserve(std::declval<typename ConstructibleArrayType::size_type>()),\n    j.template get<typename ConstructibleArrayType::value_type>(),\n    void())\n{\n    using std::end;\n\n    ConstructibleArrayType ret;\n    ret.reserve(j.size());\n    std::transform(j.begin(), j.end(),\n                   std::inserter(ret, end(ret)), [](const BasicJsonType & i)\n    {\n        // get<BasicJsonType>() returns *this, this won't call a from_json\n        // method when value_type is BasicJsonType\n        return i.template get<typename ConstructibleArrayType::value_type>();\n    });\n    arr = std::move(ret);\n}\n\ntemplate<typename BasicJsonType, typename ConstructibleArrayType>\nvoid from_json_array_impl(const BasicJsonType& j, ConstructibleArrayType& arr,\n                          priority_tag<0> /*unused*/)\n{\n    using std::end;\n\n    ConstructibleArrayType ret;\n    std::transform(\n        j.begin(), j.end(), std::inserter(ret, end(ret)),\n        [](const BasicJsonType & i)\n    {\n        // get<BasicJsonType>() returns *this, this won't call a from_json\n        // method when value_type is BasicJsonType\n        return i.template get<typename ConstructibleArrayType::value_type>();\n    });\n    arr = std::move(ret);\n}\n\ntemplate < typename BasicJsonType, typename ConstructibleArrayType,\n           enable_if_t <\n               is_constructible_array_type<BasicJsonType, ConstructibleArrayType>::value&&\n               !is_constructible_object_type<BasicJsonType, ConstructibleArrayType>::value&&\n               !is_constructible_string_type<BasicJsonType, ConstructibleArrayType>::value&&\n               !std::is_same<ConstructibleArrayType, typename BasicJsonType::binary_t>::value&&\n               !is_basic_json<ConstructibleArrayType>::value,\n               int > = 0 >\nauto from_json(const BasicJsonType& j, ConstructibleArrayType& arr)\n-> decltype(from_json_array_impl(j, arr, priority_tag<3> {}),\nj.template get<typename ConstructibleArrayType::value_type>(),\nvoid())\n{\n    if (JSON_HEDLEY_UNLIKELY(!j.is_array()))\n    {\n        JSON_THROW(type_error::create(302, \"type must be array, but is \" +\n                                      std::string(j.type_name())));\n    }\n\n    from_json_array_impl(j, arr, priority_tag<3> {});\n}\n\ntemplate<typename BasicJsonType>\nvoid from_json(const BasicJsonType& j, typename BasicJsonType::binary_t& bin)\n{\n    if (JSON_HEDLEY_UNLIKELY(!j.is_binary()))\n    {\n        JSON_THROW(type_error::create(302, \"type must be binary, but is \" + std::string(j.type_name())));\n    }\n\n    bin = *j.template get_ptr<const typename BasicJsonType::binary_t*>();\n}\n\ntemplate<typename BasicJsonType, typename ConstructibleObjectType,\n         enable_if_t<is_constructible_object_type<BasicJsonType, ConstructibleObjectType>::value, int> = 0>\nvoid from_json(const BasicJsonType& j, ConstructibleObjectType& obj)\n{\n    if (JSON_HEDLEY_UNLIKELY(!j.is_object()))\n    {\n        JSON_THROW(type_error::create(302, \"type must be object, but is \" + std::string(j.type_name())));\n    }\n\n    ConstructibleObjectType ret;\n    auto inner_object = j.template get_ptr<const typename BasicJsonType::object_t*>();\n    using value_type = typename ConstructibleObjectType::value_type;\n    std::transform(\n        inner_object->begin(), inner_object->end(),\n        std::inserter(ret, ret.begin()),\n        [](typename BasicJsonType::object_t::value_type const & p)\n    {\n        return value_type(p.first, p.second.template get<typename ConstructibleObjectType::mapped_type>());\n    });\n    obj = std::move(ret);\n}\n\n// overload for arithmetic types, not chosen for basic_json template arguments\n// (BooleanType, etc..); note: Is it really necessary to provide explicit\n// overloads for boolean_t etc. in case of a custom BooleanType which is not\n// an arithmetic type?\ntemplate < typename BasicJsonType, typename ArithmeticType,\n           enable_if_t <\n               std::is_arithmetic<ArithmeticType>::value&&\n               !std::is_same<ArithmeticType, typename BasicJsonType::number_unsigned_t>::value&&\n               !std::is_same<ArithmeticType, typename BasicJsonType::number_integer_t>::value&&\n               !std::is_same<ArithmeticType, typename BasicJsonType::number_float_t>::value&&\n               !std::is_same<ArithmeticType, typename BasicJsonType::boolean_t>::value,\n               int > = 0 >\nvoid from_json(const BasicJsonType& j, ArithmeticType& val)\n{\n    switch (static_cast<value_t>(j))\n    {\n        case value_t::number_unsigned:\n        {\n            val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::number_unsigned_t*>());\n            break;\n        }\n        case value_t::number_integer:\n        {\n            val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::number_integer_t*>());\n            break;\n        }\n        case value_t::number_float:\n        {\n            val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::number_float_t*>());\n            break;\n        }\n        case value_t::boolean:\n        {\n            val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::boolean_t*>());\n            break;\n        }\n\n        default:\n            JSON_THROW(type_error::create(302, \"type must be number, but is \" + std::string(j.type_name())));\n    }\n}\n\ntemplate<typename BasicJsonType, typename A1, typename A2>\nvoid from_json(const BasicJsonType& j, std::pair<A1, A2>& p)\n{\n    p = {j.at(0).template get<A1>(), j.at(1).template get<A2>()};\n}\n\ntemplate<typename BasicJsonType, typename Tuple, std::size_t... Idx>\nvoid from_json_tuple_impl(const BasicJsonType& j, Tuple& t, index_sequence<Idx...> /*unused*/)\n{\n    t = std::make_tuple(j.at(Idx).template get<typename std::tuple_element<Idx, Tuple>::type>()...);\n}\n\ntemplate<typename BasicJsonType, typename... Args>\nvoid from_json(const BasicJsonType& j, std::tuple<Args...>& t)\n{\n    from_json_tuple_impl(j, t, index_sequence_for<Args...> {});\n}\n\ntemplate < typename BasicJsonType, typename Key, typename Value, typename Compare, typename Allocator,\n           typename = enable_if_t < !std::is_constructible <\n                                        typename BasicJsonType::string_t, Key >::value >>\nvoid from_json(const BasicJsonType& j, std::map<Key, Value, Compare, Allocator>& m)\n{\n    if (JSON_HEDLEY_UNLIKELY(!j.is_array()))\n    {\n        JSON_THROW(type_error::create(302, \"type must be array, but is \" + std::string(j.type_name())));\n    }\n    m.clear();\n    for (const auto& p : j)\n    {\n        if (JSON_HEDLEY_UNLIKELY(!p.is_array()))\n        {\n            JSON_THROW(type_error::create(302, \"type must be array, but is \" + std::string(p.type_name())));\n        }\n        m.emplace(p.at(0).template get<Key>(), p.at(1).template get<Value>());\n    }\n}\n\ntemplate < typename BasicJsonType, typename Key, typename Value, typename Hash, typename KeyEqual, typename Allocator,\n           typename = enable_if_t < !std::is_constructible <\n                                        typename BasicJsonType::string_t, Key >::value >>\nvoid from_json(const BasicJsonType& j, std::unordered_map<Key, Value, Hash, KeyEqual, Allocator>& m)\n{\n    if (JSON_HEDLEY_UNLIKELY(!j.is_array()))\n    {\n        JSON_THROW(type_error::create(302, \"type must be array, but is \" + std::string(j.type_name())));\n    }\n    m.clear();\n    for (const auto& p : j)\n    {\n        if (JSON_HEDLEY_UNLIKELY(!p.is_array()))\n        {\n            JSON_THROW(type_error::create(302, \"type must be array, but is \" + std::string(p.type_name())));\n        }\n        m.emplace(p.at(0).template get<Key>(), p.at(1).template get<Value>());\n    }\n}\n\nstruct from_json_fn\n{\n    template<typename BasicJsonType, typename T>\n    auto operator()(const BasicJsonType& j, T& val) const\n    noexcept(noexcept(from_json(j, val)))\n    -> decltype(from_json(j, val), void())\n    {\n        return from_json(j, val);\n    }\n};\n}  // namespace detail\n\n/// namespace to hold default `from_json` function\n/// to see why this is required:\n/// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4381.html\nnamespace\n{\nconstexpr const auto& from_json = detail::static_const<detail::from_json_fn>::value;\n} // namespace\n} // namespace nlohmann\n\n// #include <nlohmann/detail/conversions/to_json.hpp>\n\n\n#include <algorithm> // copy\n#include <iterator> // begin, end\n#include <string> // string\n#include <tuple> // tuple, get\n#include <type_traits> // is_same, is_constructible, is_floating_point, is_enum, underlying_type\n#include <utility> // move, forward, declval, pair\n#include <valarray> // valarray\n#include <vector> // vector\n\n// #include <nlohmann/detail/iterators/iteration_proxy.hpp>\n\n\n#include <cstddef> // size_t\n#include <iterator> // input_iterator_tag\n#include <string> // string, to_string\n#include <tuple> // tuple_size, get, tuple_element\n\n// #include <nlohmann/detail/meta/type_traits.hpp>\n\n// #include <nlohmann/detail/value_t.hpp>\n\n\nnamespace nlohmann\n{\nnamespace detail\n{\ntemplate<typename string_type>\nvoid int_to_string( string_type& target, std::size_t value )\n{\n    // For ADL\n    using std::to_string;\n    target = to_string(value);\n}\ntemplate<typename IteratorType> class iteration_proxy_value\n{\n  public:\n    using difference_type = std::ptrdiff_t;\n    using value_type = iteration_proxy_value;\n    using pointer = value_type * ;\n    using reference = value_type & ;\n    using iterator_category = std::input_iterator_tag;\n    using string_type = typename std::remove_cv< typename std::remove_reference<decltype( std::declval<IteratorType>().key() ) >::type >::type;\n\n  private:\n    /// the iterator\n    IteratorType anchor;\n    /// an index for arrays (used to create key names)\n    std::size_t array_index = 0;\n    /// last stringified array index\n    mutable std::size_t array_index_last = 0;\n    /// a string representation of the array index\n    mutable string_type array_index_str = \"0\";\n    /// an empty string (to return a reference for primitive values)\n    const string_type empty_str = \"\";\n\n  public:\n    explicit iteration_proxy_value(IteratorType it) noexcept : anchor(it) {}\n\n    /// dereference operator (needed for range-based for)\n    iteration_proxy_value& operator*()\n    {\n        return *this;\n    }\n\n    /// increment operator (needed for range-based for)\n    iteration_proxy_value& operator++()\n    {\n        ++anchor;\n        ++array_index;\n\n        return *this;\n    }\n\n    /// equality operator (needed for InputIterator)\n    bool operator==(const iteration_proxy_value& o) const\n    {\n        return anchor == o.anchor;\n    }\n\n    /// inequality operator (needed for range-based for)\n    bool operator!=(const iteration_proxy_value& o) const\n    {\n        return anchor != o.anchor;\n    }\n\n    /// return key of the iterator\n    const string_type& key() const\n    {\n        JSON_ASSERT(anchor.m_object != nullptr);\n\n        switch (anchor.m_object->type())\n        {\n            // use integer array index as key\n            case value_t::array:\n            {\n                if (array_index != array_index_last)\n                {\n                    int_to_string( array_index_str, array_index );\n                    array_index_last = array_index;\n                }\n                return array_index_str;\n            }\n\n            // use key from the object\n            case value_t::object:\n                return anchor.key();\n\n            // use an empty key for all primitive types\n            default:\n                return empty_str;\n        }\n    }\n\n    /// return value of the iterator\n    typename IteratorType::reference value() const\n    {\n        return anchor.value();\n    }\n};\n\n/// proxy class for the items() function\ntemplate<typename IteratorType> class iteration_proxy\n{\n  private:\n    /// the container to iterate\n    typename IteratorType::reference container;\n\n  public:\n    /// construct iteration proxy from a container\n    explicit iteration_proxy(typename IteratorType::reference cont) noexcept\n        : container(cont) {}\n\n    /// return iterator begin (needed for range-based for)\n    iteration_proxy_value<IteratorType> begin() noexcept\n    {\n        return iteration_proxy_value<IteratorType>(container.begin());\n    }\n\n    /// return iterator end (needed for range-based for)\n    iteration_proxy_value<IteratorType> end() noexcept\n    {\n        return iteration_proxy_value<IteratorType>(container.end());\n    }\n};\n// Structured Bindings Support\n// For further reference see https://blog.tartanllama.xyz/structured-bindings/\n// And see https://github.com/nlohmann/json/pull/1391\ntemplate<std::size_t N, typename IteratorType, enable_if_t<N == 0, int> = 0>\nauto get(const nlohmann::detail::iteration_proxy_value<IteratorType>& i) -> decltype(i.key())\n{\n    return i.key();\n}\n// Structured Bindings Support\n// For further reference see https://blog.tartanllama.xyz/structured-bindings/\n// And see https://github.com/nlohmann/json/pull/1391\ntemplate<std::size_t N, typename IteratorType, enable_if_t<N == 1, int> = 0>\nauto get(const nlohmann::detail::iteration_proxy_value<IteratorType>& i) -> decltype(i.value())\n{\n    return i.value();\n}\n}  // namespace detail\n}  // namespace nlohmann\n\n// The Addition to the STD Namespace is required to add\n// Structured Bindings Support to the iteration_proxy_value class\n// For further reference see https://blog.tartanllama.xyz/structured-bindings/\n// And see https://github.com/nlohmann/json/pull/1391\nnamespace std\n{\n#if defined(__clang__)\n    // Fix: https://github.com/nlohmann/json/issues/1401\n    #pragma clang diagnostic push\n    #pragma clang diagnostic ignored \"-Wmismatched-tags\"\n#endif\ntemplate<typename IteratorType>\nclass tuple_size<::nlohmann::detail::iteration_proxy_value<IteratorType>>\n            : public std::integral_constant<std::size_t, 2> {};\n\ntemplate<std::size_t N, typename IteratorType>\nclass tuple_element<N, ::nlohmann::detail::iteration_proxy_value<IteratorType >>\n{\n  public:\n    using type = decltype(\n                     get<N>(std::declval <\n                            ::nlohmann::detail::iteration_proxy_value<IteratorType >> ()));\n};\n#if defined(__clang__)\n    #pragma clang diagnostic pop\n#endif\n} // namespace std\n\n// #include <nlohmann/detail/meta/cpp_future.hpp>\n\n// #include <nlohmann/detail/meta/type_traits.hpp>\n\n// #include <nlohmann/detail/value_t.hpp>\n\n\nnamespace nlohmann\n{\nnamespace detail\n{\n//////////////////\n// constructors //\n//////////////////\n\ntemplate<value_t> struct external_constructor;\n\ntemplate<>\nstruct external_constructor<value_t::boolean>\n{\n    template<typename BasicJsonType>\n    static void construct(BasicJsonType& j, typename BasicJsonType::boolean_t b) noexcept\n    {\n        j.m_type = value_t::boolean;\n        j.m_value = b;\n        j.assert_invariant();\n    }\n};\n\ntemplate<>\nstruct external_constructor<value_t::string>\n{\n    template<typename BasicJsonType>\n    static void construct(BasicJsonType& j, const typename BasicJsonType::string_t& s)\n    {\n        j.m_type = value_t::string;\n        j.m_value = s;\n        j.assert_invariant();\n    }\n\n    template<typename BasicJsonType>\n    static void construct(BasicJsonType& j, typename BasicJsonType::string_t&& s)\n    {\n        j.m_type = value_t::string;\n        j.m_value = std::move(s);\n        j.assert_invariant();\n    }\n\n    template < typename BasicJsonType, typename CompatibleStringType,\n               enable_if_t < !std::is_same<CompatibleStringType, typename BasicJsonType::string_t>::value,\n                             int > = 0 >\n    static void construct(BasicJsonType& j, const CompatibleStringType& str)\n    {\n        j.m_type = value_t::string;\n        j.m_value.string = j.template create<typename BasicJsonType::string_t>(str);\n        j.assert_invariant();\n    }\n};\n\ntemplate<>\nstruct external_constructor<value_t::binary>\n{\n    template<typename BasicJsonType>\n    static void construct(BasicJsonType& j, const typename BasicJsonType::binary_t& b)\n    {\n        j.m_type = value_t::binary;\n        typename BasicJsonType::binary_t value{b};\n        j.m_value = value;\n        j.assert_invariant();\n    }\n\n    template<typename BasicJsonType>\n    static void construct(BasicJsonType& j, typename BasicJsonType::binary_t&& b)\n    {\n        j.m_type = value_t::binary;\n        typename BasicJsonType::binary_t value{std::move(b)};\n        j.m_value = value;\n        j.assert_invariant();\n    }\n};\n\ntemplate<>\nstruct external_constructor<value_t::number_float>\n{\n    template<typename BasicJsonType>\n    static void construct(BasicJsonType& j, typename BasicJsonType::number_float_t val) noexcept\n    {\n        j.m_type = value_t::number_float;\n        j.m_value = val;\n        j.assert_invariant();\n    }\n};\n\ntemplate<>\nstruct external_constructor<value_t::number_unsigned>\n{\n    template<typename BasicJsonType>\n    static void construct(BasicJsonType& j, typename BasicJsonType::number_unsigned_t val) noexcept\n    {\n        j.m_type = value_t::number_unsigned;\n        j.m_value = val;\n        j.assert_invariant();\n    }\n};\n\ntemplate<>\nstruct external_constructor<value_t::number_integer>\n{\n    template<typename BasicJsonType>\n    static void construct(BasicJsonType& j, typename BasicJsonType::number_integer_t val) noexcept\n    {\n        j.m_type = value_t::number_integer;\n        j.m_value = val;\n        j.assert_invariant();\n    }\n};\n\ntemplate<>\nstruct external_constructor<value_t::array>\n{\n    template<typename BasicJsonType>\n    static void construct(BasicJsonType& j, const typename BasicJsonType::array_t& arr)\n    {\n        j.m_type = value_t::array;\n        j.m_value = arr;\n        j.assert_invariant();\n    }\n\n    template<typename BasicJsonType>\n    static void construct(BasicJsonType& j, typename BasicJsonType::array_t&& arr)\n    {\n        j.m_type = value_t::array;\n        j.m_value = std::move(arr);\n        j.assert_invariant();\n    }\n\n    template < typename BasicJsonType, typename CompatibleArrayType,\n               enable_if_t < !std::is_same<CompatibleArrayType, typename BasicJsonType::array_t>::value,\n                             int > = 0 >\n    static void construct(BasicJsonType& j, const CompatibleArrayType& arr)\n    {\n        using std::begin;\n        using std::end;\n        j.m_type = value_t::array;\n        j.m_value.array = j.template create<typename BasicJsonType::array_t>(begin(arr), end(arr));\n        j.assert_invariant();\n    }\n\n    template<typename BasicJsonType>\n    static void construct(BasicJsonType& j, const std::vector<bool>& arr)\n    {\n        j.m_type = value_t::array;\n        j.m_value = value_t::array;\n        j.m_value.array->reserve(arr.size());\n        for (const bool x : arr)\n        {\n            j.m_value.array->push_back(x);\n        }\n        j.assert_invariant();\n    }\n\n    template<typename BasicJsonType, typename T,\n             enable_if_t<std::is_convertible<T, BasicJsonType>::value, int> = 0>\n    static void construct(BasicJsonType& j, const std::valarray<T>& arr)\n    {\n        j.m_type = value_t::array;\n        j.m_value = value_t::array;\n        j.m_value.array->resize(arr.size());\n        if (arr.size() > 0)\n        {\n            std::copy(std::begin(arr), std::end(arr), j.m_value.array->begin());\n        }\n        j.assert_invariant();\n    }\n};\n\ntemplate<>\nstruct external_constructor<value_t::object>\n{\n    template<typename BasicJsonType>\n    static void construct(BasicJsonType& j, const typename BasicJsonType::object_t& obj)\n    {\n        j.m_type = value_t::object;\n        j.m_value = obj;\n        j.assert_invariant();\n    }\n\n    template<typename BasicJsonType>\n    static void construct(BasicJsonType& j, typename BasicJsonType::object_t&& obj)\n    {\n        j.m_type = value_t::object;\n        j.m_value = std::move(obj);\n        j.assert_invariant();\n    }\n\n    template < typename BasicJsonType, typename CompatibleObjectType,\n               enable_if_t < !std::is_same<CompatibleObjectType, typename BasicJsonType::object_t>::value, int > = 0 >\n    static void construct(BasicJsonType& j, const CompatibleObjectType& obj)\n    {\n        using std::begin;\n        using std::end;\n\n        j.m_type = value_t::object;\n        j.m_value.object = j.template create<typename BasicJsonType::object_t>(begin(obj), end(obj));\n        j.assert_invariant();\n    }\n};\n\n/////////////\n// to_json //\n/////////////\n\ntemplate<typename BasicJsonType, typename T,\n         enable_if_t<std::is_same<T, typename BasicJsonType::boolean_t>::value, int> = 0>\nvoid to_json(BasicJsonType& j, T b) noexcept\n{\n    external_constructor<value_t::boolean>::construct(j, b);\n}\n\ntemplate<typename BasicJsonType, typename CompatibleString,\n         enable_if_t<std::is_constructible<typename BasicJsonType::string_t, CompatibleString>::value, int> = 0>\nvoid to_json(BasicJsonType& j, const CompatibleString& s)\n{\n    external_constructor<value_t::string>::construct(j, s);\n}\n\ntemplate<typename BasicJsonType>\nvoid to_json(BasicJsonType& j, typename BasicJsonType::string_t&& s)\n{\n    external_constructor<value_t::string>::construct(j, std::move(s));\n}\n\ntemplate<typename BasicJsonType, typename FloatType,\n         enable_if_t<std::is_floating_point<FloatType>::value, int> = 0>\nvoid to_json(BasicJsonType& j, FloatType val) noexcept\n{\n    external_constructor<value_t::number_float>::construct(j, static_cast<typename BasicJsonType::number_float_t>(val));\n}\n\ntemplate<typename BasicJsonType, typename CompatibleNumberUnsignedType,\n         enable_if_t<is_compatible_integer_type<typename BasicJsonType::number_unsigned_t, CompatibleNumberUnsignedType>::value, int> = 0>\nvoid to_json(BasicJsonType& j, CompatibleNumberUnsignedType val) noexcept\n{\n    external_constructor<value_t::number_unsigned>::construct(j, static_cast<typename BasicJsonType::number_unsigned_t>(val));\n}\n\ntemplate<typename BasicJsonType, typename CompatibleNumberIntegerType,\n         enable_if_t<is_compatible_integer_type<typename BasicJsonType::number_integer_t, CompatibleNumberIntegerType>::value, int> = 0>\nvoid to_json(BasicJsonType& j, CompatibleNumberIntegerType val) noexcept\n{\n    external_constructor<value_t::number_integer>::construct(j, static_cast<typename BasicJsonType::number_integer_t>(val));\n}\n\ntemplate<typename BasicJsonType, typename EnumType,\n         enable_if_t<std::is_enum<EnumType>::value, int> = 0>\nvoid to_json(BasicJsonType& j, EnumType e) noexcept\n{\n    using underlying_type = typename std::underlying_type<EnumType>::type;\n    external_constructor<value_t::number_integer>::construct(j, static_cast<underlying_type>(e));\n}\n\ntemplate<typename BasicJsonType>\nvoid to_json(BasicJsonType& j, const std::vector<bool>& e)\n{\n    external_constructor<value_t::array>::construct(j, e);\n}\n\ntemplate < typename BasicJsonType, typename CompatibleArrayType,\n           enable_if_t < is_compatible_array_type<BasicJsonType,\n                         CompatibleArrayType>::value&&\n                         !is_compatible_object_type<BasicJsonType, CompatibleArrayType>::value&&\n                         !is_compatible_string_type<BasicJsonType, CompatibleArrayType>::value&&\n                         !std::is_same<typename BasicJsonType::binary_t, CompatibleArrayType>::value&&\n                         !is_basic_json<CompatibleArrayType>::value,\n                         int > = 0 >\nvoid to_json(BasicJsonType& j, const CompatibleArrayType& arr)\n{\n    external_constructor<value_t::array>::construct(j, arr);\n}\n\ntemplate<typename BasicJsonType>\nvoid to_json(BasicJsonType& j, const typename BasicJsonType::binary_t& bin)\n{\n    external_constructor<value_t::binary>::construct(j, bin);\n}\n\ntemplate<typename BasicJsonType, typename T,\n         enable_if_t<std::is_convertible<T, BasicJsonType>::value, int> = 0>\nvoid to_json(BasicJsonType& j, const std::valarray<T>& arr)\n{\n    external_constructor<value_t::array>::construct(j, std::move(arr));\n}\n\ntemplate<typename BasicJsonType>\nvoid to_json(BasicJsonType& j, typename BasicJsonType::array_t&& arr)\n{\n    external_constructor<value_t::array>::construct(j, std::move(arr));\n}\n\ntemplate < typename BasicJsonType, typename CompatibleObjectType,\n           enable_if_t < is_compatible_object_type<BasicJsonType, CompatibleObjectType>::value&& !is_basic_json<CompatibleObjectType>::value, int > = 0 >\nvoid to_json(BasicJsonType& j, const CompatibleObjectType& obj)\n{\n    external_constructor<value_t::object>::construct(j, obj);\n}\n\ntemplate<typename BasicJsonType>\nvoid to_json(BasicJsonType& j, typename BasicJsonType::object_t&& obj)\n{\n    external_constructor<value_t::object>::construct(j, std::move(obj));\n}\n\ntemplate <\n    typename BasicJsonType, typename T, std::size_t N,\n    enable_if_t < !std::is_constructible<typename BasicJsonType::string_t,\n                  const T(&)[N]>::value,\n                  int > = 0 >\nvoid to_json(BasicJsonType& j, const T(&arr)[N])\n{\n    external_constructor<value_t::array>::construct(j, arr);\n}\n\ntemplate < typename BasicJsonType, typename T1, typename T2, enable_if_t < std::is_constructible<BasicJsonType, T1>::value&& std::is_constructible<BasicJsonType, T2>::value, int > = 0 >\nvoid to_json(BasicJsonType& j, const std::pair<T1, T2>& p)\n{\n    j = { p.first, p.second };\n}\n\n// for https://github.com/nlohmann/json/pull/1134\ntemplate<typename BasicJsonType, typename T,\n         enable_if_t<std::is_same<T, iteration_proxy_value<typename BasicJsonType::iterator>>::value, int> = 0>\nvoid to_json(BasicJsonType& j, const T& b)\n{\n    j = { {b.key(), b.value()} };\n}\n\ntemplate<typename BasicJsonType, typename Tuple, std::size_t... Idx>\nvoid to_json_tuple_impl(BasicJsonType& j, const Tuple& t, index_sequence<Idx...> /*unused*/)\n{\n    j = { std::get<Idx>(t)... };\n}\n\ntemplate<typename BasicJsonType, typename T, enable_if_t<is_constructible_tuple<BasicJsonType, T>::value, int > = 0>\nvoid to_json(BasicJsonType& j, const T& t)\n{\n    to_json_tuple_impl(j, t, make_index_sequence<std::tuple_size<T>::value> {});\n}\n\nstruct to_json_fn\n{\n    template<typename BasicJsonType, typename T>\n    auto operator()(BasicJsonType& j, T&& val) const noexcept(noexcept(to_json(j, std::forward<T>(val))))\n    -> decltype(to_json(j, std::forward<T>(val)), void())\n    {\n        return to_json(j, std::forward<T>(val));\n    }\n};\n}  // namespace detail\n\n/// namespace to hold default `to_json` function\nnamespace\n{\nconstexpr const auto& to_json = detail::static_const<detail::to_json_fn>::value;\n} // namespace\n} // namespace nlohmann\n\n\nnamespace nlohmann\n{\n\ntemplate<typename, typename>\nstruct adl_serializer\n{\n    /*!\n    @brief convert a JSON value to any value type\n\n    This function is usually called by the `get()` function of the\n    @ref basic_json class (either explicit or via conversion operators).\n\n    @param[in] j        JSON value to read from\n    @param[in,out] val  value to write to\n    */\n    template<typename BasicJsonType, typename ValueType>\n    static auto from_json(BasicJsonType&& j, ValueType& val) noexcept(\n        noexcept(::nlohmann::from_json(std::forward<BasicJsonType>(j), val)))\n    -> decltype(::nlohmann::from_json(std::forward<BasicJsonType>(j), val), void())\n    {\n        ::nlohmann::from_json(std::forward<BasicJsonType>(j), val);\n    }\n\n    /*!\n    @brief convert any value type to a JSON value\n\n    This function is usually called by the constructors of the @ref basic_json\n    class.\n\n    @param[in,out] j  JSON value to write to\n    @param[in] val    value to read from\n    */\n    template<typename BasicJsonType, typename ValueType>\n    static auto to_json(BasicJsonType& j, ValueType&& val) noexcept(\n        noexcept(::nlohmann::to_json(j, std::forward<ValueType>(val))))\n    -> decltype(::nlohmann::to_json(j, std::forward<ValueType>(val)), void())\n    {\n        ::nlohmann::to_json(j, std::forward<ValueType>(val));\n    }\n};\n\n}  // namespace nlohmann\n\n// #include <nlohmann/byte_container_with_subtype.hpp>\n\n\n#include <cstdint> // uint8_t\n#include <tuple> // tie\n#include <utility> // move\n\nnamespace nlohmann\n{\n\n/*!\n@brief an internal type for a backed binary type\n\nThis type extends the template parameter @a BinaryType provided to `basic_json`\nwith a subtype used by BSON and MessagePack. This type exists so that the user\ndoes not have to specify a type themselves with a specific naming scheme in\norder to override the binary type.\n\n@tparam BinaryType container to store bytes (`std::vector<std::uint8_t>` by\n                   default)\n\n@since version 3.8.0\n*/\ntemplate<typename BinaryType>\nclass byte_container_with_subtype : public BinaryType\n{\n  public:\n    /// the type of the underlying container\n    using container_type = BinaryType;\n\n    byte_container_with_subtype() noexcept(noexcept(container_type()))\n        : container_type()\n    {}\n\n    byte_container_with_subtype(const container_type& b) noexcept(noexcept(container_type(b)))\n        : container_type(b)\n    {}\n\n    byte_container_with_subtype(container_type&& b) noexcept(noexcept(container_type(std::move(b))))\n        : container_type(std::move(b))\n    {}\n\n    byte_container_with_subtype(const container_type& b, std::uint8_t subtype) noexcept(noexcept(container_type(b)))\n        : container_type(b)\n        , m_subtype(subtype)\n        , m_has_subtype(true)\n    {}\n\n    byte_container_with_subtype(container_type&& b, std::uint8_t subtype) noexcept(noexcept(container_type(std::move(b))))\n        : container_type(std::move(b))\n        , m_subtype(subtype)\n        , m_has_subtype(true)\n    {}\n\n    bool operator==(const byte_container_with_subtype& rhs) const\n    {\n        return std::tie(static_cast<const BinaryType&>(*this), m_subtype, m_has_subtype) ==\n               std::tie(static_cast<const BinaryType&>(rhs), rhs.m_subtype, rhs.m_has_subtype);\n    }\n\n    bool operator!=(const byte_container_with_subtype& rhs) const\n    {\n        return !(rhs == *this);\n    }\n\n    /*!\n    @brief sets the binary subtype\n\n    Sets the binary subtype of the value, also flags a binary JSON value as\n    having a subtype, which has implications for serialization.\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this member function never throws\n    exceptions.\n\n    @sa @ref subtype() -- return the binary subtype\n    @sa @ref clear_subtype() -- clears the binary subtype\n    @sa @ref has_subtype() -- returns whether or not the binary value has a\n    subtype\n\n    @since version 3.8.0\n    */\n    void set_subtype(std::uint8_t subtype) noexcept\n    {\n        m_subtype = subtype;\n        m_has_subtype = true;\n    }\n\n    /*!\n    @brief return the binary subtype\n\n    Returns the numerical subtype of the value if it has a subtype. If it does\n    not have a subtype, this function will return size_t(-1) as a sentinel\n    value.\n\n    @return the numerical subtype of the binary value\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this member function never throws\n    exceptions.\n\n    @sa @ref set_subtype() -- sets the binary subtype\n    @sa @ref clear_subtype() -- clears the binary subtype\n    @sa @ref has_subtype() -- returns whether or not the binary value has a\n    subtype\n\n    @since version 3.8.0\n    */\n    constexpr std::uint8_t subtype() const noexcept\n    {\n        return m_subtype;\n    }\n\n    /*!\n    @brief return whether the value has a subtype\n\n    @return whether the value has a subtype\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this member function never throws\n    exceptions.\n\n    @sa @ref subtype() -- return the binary subtype\n    @sa @ref set_subtype() -- sets the binary subtype\n    @sa @ref clear_subtype() -- clears the binary subtype\n\n    @since version 3.8.0\n    */\n    constexpr bool has_subtype() const noexcept\n    {\n        return m_has_subtype;\n    }\n\n    /*!\n    @brief clears the binary subtype\n\n    Clears the binary subtype and flags the value as not having a subtype, which\n    has implications for serialization; for instance MessagePack will prefer the\n    bin family over the ext family.\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this member function never throws\n    exceptions.\n\n    @sa @ref subtype() -- return the binary subtype\n    @sa @ref set_subtype() -- sets the binary subtype\n    @sa @ref has_subtype() -- returns whether or not the binary value has a\n    subtype\n\n    @since version 3.8.0\n    */\n    void clear_subtype() noexcept\n    {\n        m_subtype = 0;\n        m_has_subtype = false;\n    }\n\n  private:\n    std::uint8_t m_subtype = 0;\n    bool m_has_subtype = false;\n};\n\n}  // namespace nlohmann\n\n// #include <nlohmann/detail/conversions/from_json.hpp>\n\n// #include <nlohmann/detail/conversions/to_json.hpp>\n\n// #include <nlohmann/detail/exceptions.hpp>\n\n// #include <nlohmann/detail/hash.hpp>\n\n\n#include <cstddef> // size_t, uint8_t\n#include <functional> // hash\n\nnamespace nlohmann\n{\nnamespace detail\n{\n\n// boost::hash_combine\ninline std::size_t combine(std::size_t seed, std::size_t h) noexcept\n{\n    seed ^= h + 0x9e3779b9 + (seed << 6U) + (seed >> 2U);\n    return seed;\n}\n\n/*!\n@brief hash a JSON value\n\nThe hash function tries to rely on std::hash where possible. Furthermore, the\ntype of the JSON value is taken into account to have different hash values for\nnull, 0, 0U, and false, etc.\n\n@tparam BasicJsonType basic_json specialization\n@param j JSON value to hash\n@return hash value of j\n*/\ntemplate<typename BasicJsonType>\nstd::size_t hash(const BasicJsonType& j)\n{\n    using string_t = typename BasicJsonType::string_t;\n    using number_integer_t = typename BasicJsonType::number_integer_t;\n    using number_unsigned_t = typename BasicJsonType::number_unsigned_t;\n    using number_float_t = typename BasicJsonType::number_float_t;\n\n    const auto type = static_cast<std::size_t>(j.type());\n    switch (j.type())\n    {\n        case BasicJsonType::value_t::null:\n        case BasicJsonType::value_t::discarded:\n        {\n            return combine(type, 0);\n        }\n\n        case BasicJsonType::value_t::object:\n        {\n            auto seed = combine(type, j.size());\n            for (const auto& element : j.items())\n            {\n                const auto h = std::hash<string_t> {}(element.key());\n                seed = combine(seed, h);\n                seed = combine(seed, hash(element.value()));\n            }\n            return seed;\n        }\n\n        case BasicJsonType::value_t::array:\n        {\n            auto seed = combine(type, j.size());\n            for (const auto& element : j)\n            {\n                seed = combine(seed, hash(element));\n            }\n            return seed;\n        }\n\n        case BasicJsonType::value_t::string:\n        {\n            const auto h = std::hash<string_t> {}(j.template get_ref<const string_t&>());\n            return combine(type, h);\n        }\n\n        case BasicJsonType::value_t::boolean:\n        {\n            const auto h = std::hash<bool> {}(j.template get<bool>());\n            return combine(type, h);\n        }\n\n        case BasicJsonType::value_t::number_integer:\n        {\n            const auto h = std::hash<number_integer_t> {}(j.template get<number_integer_t>());\n            return combine(type, h);\n        }\n\n        case BasicJsonType::value_t::number_unsigned:\n        {\n            const auto h = std::hash<number_unsigned_t> {}(j.template get<number_unsigned_t>());\n            return combine(type, h);\n        }\n\n        case BasicJsonType::value_t::number_float:\n        {\n            const auto h = std::hash<number_float_t> {}(j.template get<number_float_t>());\n            return combine(type, h);\n        }\n\n        case BasicJsonType::value_t::binary:\n        {\n            auto seed = combine(type, j.get_binary().size());\n            const auto h = std::hash<bool> {}(j.get_binary().has_subtype());\n            seed = combine(seed, h);\n            seed = combine(seed, j.get_binary().subtype());\n            for (const auto byte : j.get_binary())\n            {\n                seed = combine(seed, std::hash<std::uint8_t> {}(byte));\n            }\n            return seed;\n        }\n\n        default:                   // LCOV_EXCL_LINE\n            JSON_ASSERT(false);    // LCOV_EXCL_LINE\n            return 0;              // LCOV_EXCL_LINE\n    }\n}\n\n}  // namespace detail\n}  // namespace nlohmann\n\n// #include <nlohmann/detail/input/binary_reader.hpp>\n\n\n#include <algorithm> // generate_n\n#include <array> // array\n#include <cmath> // ldexp\n#include <cstddef> // size_t\n#include <cstdint> // uint8_t, uint16_t, uint32_t, uint64_t\n#include <cstdio> // snprintf\n#include <cstring> // memcpy\n#include <iterator> // back_inserter\n#include <limits> // numeric_limits\n#include <string> // char_traits, string\n#include <utility> // make_pair, move\n\n// #include <nlohmann/detail/exceptions.hpp>\n\n// #include <nlohmann/detail/input/input_adapters.hpp>\n\n\n#include <array> // array\n#include <cstddef> // size_t\n#include <cstdio> //FILE *\n#include <cstring> // strlen\n#include <istream> // istream\n#include <iterator> // begin, end, iterator_traits, random_access_iterator_tag, distance, next\n#include <memory> // shared_ptr, make_shared, addressof\n#include <numeric> // accumulate\n#include <string> // string, char_traits\n#include <type_traits> // enable_if, is_base_of, is_pointer, is_integral, remove_pointer\n#include <utility> // pair, declval\n\n// #include <nlohmann/detail/iterators/iterator_traits.hpp>\n\n// #include <nlohmann/detail/macro_scope.hpp>\n\n\nnamespace nlohmann\n{\nnamespace detail\n{\n/// the supported input formats\nenum class input_format_t { json, cbor, msgpack, ubjson, bson };\n\n////////////////////\n// input adapters //\n////////////////////\n\n/*!\nInput adapter for stdio file access. This adapter read only 1 byte and do not use any\n buffer. This adapter is a very low level adapter.\n*/\nclass file_input_adapter\n{\n  public:\n    using char_type = char;\n\n    JSON_HEDLEY_NON_NULL(2)\n    explicit file_input_adapter(std::FILE* f) noexcept\n        : m_file(f)\n    {}\n\n    // make class move-only\n    file_input_adapter(const file_input_adapter&) = delete;\n    file_input_adapter(file_input_adapter&&) = default;\n    file_input_adapter& operator=(const file_input_adapter&) = delete;\n    file_input_adapter& operator=(file_input_adapter&&) = delete;\n\n    std::char_traits<char>::int_type get_character() noexcept\n    {\n        return std::fgetc(m_file);\n    }\n\n  private:\n    /// the file pointer to read from\n    std::FILE* m_file;\n};\n\n\n/*!\nInput adapter for a (caching) istream. Ignores a UFT Byte Order Mark at\nbeginning of input. Does not support changing the underlying std::streambuf\nin mid-input. Maintains underlying std::istream and std::streambuf to support\nsubsequent use of standard std::istream operations to process any input\ncharacters following those used in parsing the JSON input.  Clears the\nstd::istream flags; any input errors (e.g., EOF) will be detected by the first\nsubsequent call for input from the std::istream.\n*/\nclass input_stream_adapter\n{\n  public:\n    using char_type = char;\n\n    ~input_stream_adapter()\n    {\n        // clear stream flags; we use underlying streambuf I/O, do not\n        // maintain ifstream flags, except eof\n        if (is != nullptr)\n        {\n            is->clear(is->rdstate() & std::ios::eofbit);\n        }\n    }\n\n    explicit input_stream_adapter(std::istream& i)\n        : is(&i), sb(i.rdbuf())\n    {}\n\n    // delete because of pointer members\n    input_stream_adapter(const input_stream_adapter&) = delete;\n    input_stream_adapter& operator=(input_stream_adapter&) = delete;\n    input_stream_adapter& operator=(input_stream_adapter&& rhs) = delete;\n\n    input_stream_adapter(input_stream_adapter&& rhs) noexcept : is(rhs.is), sb(rhs.sb)\n    {\n        rhs.is = nullptr;\n        rhs.sb = nullptr;\n    }\n\n    // std::istream/std::streambuf use std::char_traits<char>::to_int_type, to\n    // ensure that std::char_traits<char>::eof() and the character 0xFF do not\n    // end up as the same value, eg. 0xFFFFFFFF.\n    std::char_traits<char>::int_type get_character()\n    {\n        auto res = sb->sbumpc();\n        // set eof manually, as we don't use the istream interface.\n        if (JSON_HEDLEY_UNLIKELY(res == EOF))\n        {\n            is->clear(is->rdstate() | std::ios::eofbit);\n        }\n        return res;\n    }\n\n  private:\n    /// the associated input stream\n    std::istream* is = nullptr;\n    std::streambuf* sb = nullptr;\n};\n\n// General-purpose iterator-based adapter. It might not be as fast as\n// theoretically possible for some containers, but it is extremely versatile.\ntemplate<typename IteratorType>\nclass iterator_input_adapter\n{\n  public:\n    using char_type = typename std::iterator_traits<IteratorType>::value_type;\n\n    iterator_input_adapter(IteratorType first, IteratorType last)\n        : current(std::move(first)), end(std::move(last)) {}\n\n    typename std::char_traits<char_type>::int_type get_character()\n    {\n        if (JSON_HEDLEY_LIKELY(current != end))\n        {\n            auto result = std::char_traits<char_type>::to_int_type(*current);\n            std::advance(current, 1);\n            return result;\n        }\n        else\n        {\n            return std::char_traits<char_type>::eof();\n        }\n    }\n\n  private:\n    IteratorType current;\n    IteratorType end;\n\n    template<typename BaseInputAdapter, size_t T>\n    friend struct wide_string_input_helper;\n\n    bool empty() const\n    {\n        return current == end;\n    }\n\n};\n\n\ntemplate<typename BaseInputAdapter, size_t T>\nstruct wide_string_input_helper;\n\ntemplate<typename BaseInputAdapter>\nstruct wide_string_input_helper<BaseInputAdapter, 4>\n{\n    // UTF-32\n    static void fill_buffer(BaseInputAdapter& input,\n                            std::array<std::char_traits<char>::int_type, 4>& utf8_bytes,\n                            size_t& utf8_bytes_index,\n                            size_t& utf8_bytes_filled)\n    {\n        utf8_bytes_index = 0;\n\n        if (JSON_HEDLEY_UNLIKELY(input.empty()))\n        {\n            utf8_bytes[0] = std::char_traits<char>::eof();\n            utf8_bytes_filled = 1;\n        }\n        else\n        {\n            // get the current character\n            const auto wc = input.get_character();\n\n            // UTF-32 to UTF-8 encoding\n            if (wc < 0x80)\n            {\n                utf8_bytes[0] = static_cast<std::char_traits<char>::int_type>(wc);\n                utf8_bytes_filled = 1;\n            }\n            else if (wc <= 0x7FF)\n            {\n                utf8_bytes[0] = static_cast<std::char_traits<char>::int_type>(0xC0u | ((static_cast<unsigned int>(wc) >> 6u) & 0x1Fu));\n                utf8_bytes[1] = static_cast<std::char_traits<char>::int_type>(0x80u | (static_cast<unsigned int>(wc) & 0x3Fu));\n                utf8_bytes_filled = 2;\n            }\n            else if (wc <= 0xFFFF)\n            {\n                utf8_bytes[0] = static_cast<std::char_traits<char>::int_type>(0xE0u | ((static_cast<unsigned int>(wc) >> 12u) & 0x0Fu));\n                utf8_bytes[1] = static_cast<std::char_traits<char>::int_type>(0x80u | ((static_cast<unsigned int>(wc) >> 6u) & 0x3Fu));\n                utf8_bytes[2] = static_cast<std::char_traits<char>::int_type>(0x80u | (static_cast<unsigned int>(wc) & 0x3Fu));\n                utf8_bytes_filled = 3;\n            }\n            else if (wc <= 0x10FFFF)\n            {\n                utf8_bytes[0] = static_cast<std::char_traits<char>::int_type>(0xF0u | ((static_cast<unsigned int>(wc) >> 18u) & 0x07u));\n                utf8_bytes[1] = static_cast<std::char_traits<char>::int_type>(0x80u | ((static_cast<unsigned int>(wc) >> 12u) & 0x3Fu));\n                utf8_bytes[2] = static_cast<std::char_traits<char>::int_type>(0x80u | ((static_cast<unsigned int>(wc) >> 6u) & 0x3Fu));\n                utf8_bytes[3] = static_cast<std::char_traits<char>::int_type>(0x80u | (static_cast<unsigned int>(wc) & 0x3Fu));\n                utf8_bytes_filled = 4;\n            }\n            else\n            {\n                // unknown character\n                utf8_bytes[0] = static_cast<std::char_traits<char>::int_type>(wc);\n                utf8_bytes_filled = 1;\n            }\n        }\n    }\n};\n\ntemplate<typename BaseInputAdapter>\nstruct wide_string_input_helper<BaseInputAdapter, 2>\n{\n    // UTF-16\n    static void fill_buffer(BaseInputAdapter& input,\n                            std::array<std::char_traits<char>::int_type, 4>& utf8_bytes,\n                            size_t& utf8_bytes_index,\n                            size_t& utf8_bytes_filled)\n    {\n        utf8_bytes_index = 0;\n\n        if (JSON_HEDLEY_UNLIKELY(input.empty()))\n        {\n            utf8_bytes[0] = std::char_traits<char>::eof();\n            utf8_bytes_filled = 1;\n        }\n        else\n        {\n            // get the current character\n            const auto wc = input.get_character();\n\n            // UTF-16 to UTF-8 encoding\n            if (wc < 0x80)\n            {\n                utf8_bytes[0] = static_cast<std::char_traits<char>::int_type>(wc);\n                utf8_bytes_filled = 1;\n            }\n            else if (wc <= 0x7FF)\n            {\n                utf8_bytes[0] = static_cast<std::char_traits<char>::int_type>(0xC0u | ((static_cast<unsigned int>(wc) >> 6u)));\n                utf8_bytes[1] = static_cast<std::char_traits<char>::int_type>(0x80u | (static_cast<unsigned int>(wc) & 0x3Fu));\n                utf8_bytes_filled = 2;\n            }\n            else if (0xD800 > wc || wc >= 0xE000)\n            {\n                utf8_bytes[0] = static_cast<std::char_traits<char>::int_type>(0xE0u | ((static_cast<unsigned int>(wc) >> 12u)));\n                utf8_bytes[1] = static_cast<std::char_traits<char>::int_type>(0x80u | ((static_cast<unsigned int>(wc) >> 6u) & 0x3Fu));\n                utf8_bytes[2] = static_cast<std::char_traits<char>::int_type>(0x80u | (static_cast<unsigned int>(wc) & 0x3Fu));\n                utf8_bytes_filled = 3;\n            }\n            else\n            {\n                if (JSON_HEDLEY_UNLIKELY(!input.empty()))\n                {\n                    const auto wc2 = static_cast<unsigned int>(input.get_character());\n                    const auto charcode = 0x10000u + (((static_cast<unsigned int>(wc) & 0x3FFu) << 10u) | (wc2 & 0x3FFu));\n                    utf8_bytes[0] = static_cast<std::char_traits<char>::int_type>(0xF0u | (charcode >> 18u));\n                    utf8_bytes[1] = static_cast<std::char_traits<char>::int_type>(0x80u | ((charcode >> 12u) & 0x3Fu));\n                    utf8_bytes[2] = static_cast<std::char_traits<char>::int_type>(0x80u | ((charcode >> 6u) & 0x3Fu));\n                    utf8_bytes[3] = static_cast<std::char_traits<char>::int_type>(0x80u | (charcode & 0x3Fu));\n                    utf8_bytes_filled = 4;\n                }\n                else\n                {\n                    utf8_bytes[0] = static_cast<std::char_traits<char>::int_type>(wc);\n                    utf8_bytes_filled = 1;\n                }\n            }\n        }\n    }\n};\n\n// Wraps another input apdater to convert wide character types into individual bytes.\ntemplate<typename BaseInputAdapter, typename WideCharType>\nclass wide_string_input_adapter\n{\n  public:\n    using char_type = char;\n\n    wide_string_input_adapter(BaseInputAdapter base)\n        : base_adapter(base) {}\n\n    typename std::char_traits<char>::int_type get_character() noexcept\n    {\n        // check if buffer needs to be filled\n        if (utf8_bytes_index == utf8_bytes_filled)\n        {\n            fill_buffer<sizeof(WideCharType)>();\n\n            JSON_ASSERT(utf8_bytes_filled > 0);\n            JSON_ASSERT(utf8_bytes_index == 0);\n        }\n\n        // use buffer\n        JSON_ASSERT(utf8_bytes_filled > 0);\n        JSON_ASSERT(utf8_bytes_index < utf8_bytes_filled);\n        return utf8_bytes[utf8_bytes_index++];\n    }\n\n  private:\n    BaseInputAdapter base_adapter;\n\n    template<size_t T>\n    void fill_buffer()\n    {\n        wide_string_input_helper<BaseInputAdapter, T>::fill_buffer(base_adapter, utf8_bytes, utf8_bytes_index, utf8_bytes_filled);\n    }\n\n    /// a buffer for UTF-8 bytes\n    std::array<std::char_traits<char>::int_type, 4> utf8_bytes = {{0, 0, 0, 0}};\n\n    /// index to the utf8_codes array for the next valid byte\n    std::size_t utf8_bytes_index = 0;\n    /// number of valid bytes in the utf8_codes array\n    std::size_t utf8_bytes_filled = 0;\n};\n\n\ntemplate<typename IteratorType, typename Enable = void>\nstruct iterator_input_adapter_factory\n{\n    using iterator_type = IteratorType;\n    using char_type = typename std::iterator_traits<iterator_type>::value_type;\n    using adapter_type = iterator_input_adapter<iterator_type>;\n\n    static adapter_type create(IteratorType first, IteratorType last)\n    {\n        return adapter_type(std::move(first), std::move(last));\n    }\n};\n\ntemplate<typename T>\nstruct is_iterator_of_multibyte\n{\n    using value_type = typename std::iterator_traits<T>::value_type;\n    enum\n    {\n        value = sizeof(value_type) > 1\n    };\n};\n\ntemplate<typename IteratorType>\nstruct iterator_input_adapter_factory<IteratorType, enable_if_t<is_iterator_of_multibyte<IteratorType>::value>>\n{\n    using iterator_type = IteratorType;\n    using char_type = typename std::iterator_traits<iterator_type>::value_type;\n    using base_adapter_type = iterator_input_adapter<iterator_type>;\n    using adapter_type = wide_string_input_adapter<base_adapter_type, char_type>;\n\n    static adapter_type create(IteratorType first, IteratorType last)\n    {\n        return adapter_type(base_adapter_type(std::move(first), std::move(last)));\n    }\n};\n\n// General purpose iterator-based input\ntemplate<typename IteratorType>\ntypename iterator_input_adapter_factory<IteratorType>::adapter_type input_adapter(IteratorType first, IteratorType last)\n{\n    using factory_type = iterator_input_adapter_factory<IteratorType>;\n    return factory_type::create(first, last);\n}\n\n// Convenience shorthand from container to iterator\ntemplate<typename ContainerType>\nauto input_adapter(const ContainerType& container) -> decltype(input_adapter(begin(container), end(container)))\n{\n    // Enable ADL\n    using std::begin;\n    using std::end;\n\n    return input_adapter(begin(container), end(container));\n}\n\n// Special cases with fast paths\ninline file_input_adapter input_adapter(std::FILE* file)\n{\n    return file_input_adapter(file);\n}\n\ninline input_stream_adapter input_adapter(std::istream& stream)\n{\n    return input_stream_adapter(stream);\n}\n\ninline input_stream_adapter input_adapter(std::istream&& stream)\n{\n    return input_stream_adapter(stream);\n}\n\nusing contiguous_bytes_input_adapter = decltype(input_adapter(std::declval<const char*>(), std::declval<const char*>()));\n\n// Null-delimited strings, and the like.\ntemplate < typename CharT,\n           typename std::enable_if <\n               std::is_pointer<CharT>::value&&\n               !std::is_array<CharT>::value&&\n               std::is_integral<typename std::remove_pointer<CharT>::type>::value&&\n               sizeof(typename std::remove_pointer<CharT>::type) == 1,\n               int >::type = 0 >\ncontiguous_bytes_input_adapter input_adapter(CharT b)\n{\n    auto length = std::strlen(reinterpret_cast<const char*>(b));\n    const auto* ptr = reinterpret_cast<const char*>(b);\n    return input_adapter(ptr, ptr + length);\n}\n\ntemplate<typename T, std::size_t N>\nauto input_adapter(T (&array)[N]) -> decltype(input_adapter(array, array + N))\n{\n    return input_adapter(array, array + N);\n}\n\n// This class only handles inputs of input_buffer_adapter type.\n// It's required so that expressions like {ptr, len} can be implicitely casted\n// to the correct adapter.\nclass span_input_adapter\n{\n  public:\n    template < typename CharT,\n               typename std::enable_if <\n                   std::is_pointer<CharT>::value&&\n                   std::is_integral<typename std::remove_pointer<CharT>::type>::value&&\n                   sizeof(typename std::remove_pointer<CharT>::type) == 1,\n                   int >::type = 0 >\n    span_input_adapter(CharT b, std::size_t l)\n        : ia(reinterpret_cast<const char*>(b), reinterpret_cast<const char*>(b) + l) {}\n\n    template<class IteratorType,\n             typename std::enable_if<\n                 std::is_same<typename iterator_traits<IteratorType>::iterator_category, std::random_access_iterator_tag>::value,\n                 int>::type = 0>\n    span_input_adapter(IteratorType first, IteratorType last)\n        : ia(input_adapter(first, last)) {}\n\n    contiguous_bytes_input_adapter&& get()\n    {\n        return std::move(ia);\n    }\n\n  private:\n    contiguous_bytes_input_adapter ia;\n};\n}  // namespace detail\n}  // namespace nlohmann\n\n// #include <nlohmann/detail/input/json_sax.hpp>\n\n\n#include <cstddef>\n#include <string> // string\n#include <utility> // move\n#include <vector> // vector\n\n// #include <nlohmann/detail/exceptions.hpp>\n\n// #include <nlohmann/detail/macro_scope.hpp>\n\n\nnamespace nlohmann\n{\n\n/*!\n@brief SAX interface\n\nThis class describes the SAX interface used by @ref nlohmann::json::sax_parse.\nEach function is called in different situations while the input is parsed. The\nboolean return value informs the parser whether to continue processing the\ninput.\n*/\ntemplate<typename BasicJsonType>\nstruct json_sax\n{\n    using number_integer_t = typename BasicJsonType::number_integer_t;\n    using number_unsigned_t = typename BasicJsonType::number_unsigned_t;\n    using number_float_t = typename BasicJsonType::number_float_t;\n    using string_t = typename BasicJsonType::string_t;\n    using binary_t = typename BasicJsonType::binary_t;\n\n    /*!\n    @brief a null value was read\n    @return whether parsing should proceed\n    */\n    virtual bool null() = 0;\n\n    /*!\n    @brief a boolean value was read\n    @param[in] val  boolean value\n    @return whether parsing should proceed\n    */\n    virtual bool boolean(bool val) = 0;\n\n    /*!\n    @brief an integer number was read\n    @param[in] val  integer value\n    @return whether parsing should proceed\n    */\n    virtual bool number_integer(number_integer_t val) = 0;\n\n    /*!\n    @brief an unsigned integer number was read\n    @param[in] val  unsigned integer value\n    @return whether parsing should proceed\n    */\n    virtual bool number_unsigned(number_unsigned_t val) = 0;\n\n    /*!\n    @brief an floating-point number was read\n    @param[in] val  floating-point value\n    @param[in] s    raw token value\n    @return whether parsing should proceed\n    */\n    virtual bool number_float(number_float_t val, const string_t& s) = 0;\n\n    /*!\n    @brief a string was read\n    @param[in] val  string value\n    @return whether parsing should proceed\n    @note It is safe to move the passed string.\n    */\n    virtual bool string(string_t& val) = 0;\n\n    /*!\n    @brief a binary string was read\n    @param[in] val  binary value\n    @return whether parsing should proceed\n    @note It is safe to move the passed binary.\n    */\n    virtual bool binary(binary_t& val) = 0;\n\n    /*!\n    @brief the beginning of an object was read\n    @param[in] elements  number of object elements or -1 if unknown\n    @return whether parsing should proceed\n    @note binary formats may report the number of elements\n    */\n    virtual bool start_object(std::size_t elements) = 0;\n\n    /*!\n    @brief an object key was read\n    @param[in] val  object key\n    @return whether parsing should proceed\n    @note It is safe to move the passed string.\n    */\n    virtual bool key(string_t& val) = 0;\n\n    /*!\n    @brief the end of an object was read\n    @return whether parsing should proceed\n    */\n    virtual bool end_object() = 0;\n\n    /*!\n    @brief the beginning of an array was read\n    @param[in] elements  number of array elements or -1 if unknown\n    @return whether parsing should proceed\n    @note binary formats may report the number of elements\n    */\n    virtual bool start_array(std::size_t elements) = 0;\n\n    /*!\n    @brief the end of an array was read\n    @return whether parsing should proceed\n    */\n    virtual bool end_array() = 0;\n\n    /*!\n    @brief a parse error occurred\n    @param[in] position    the position in the input where the error occurs\n    @param[in] last_token  the last read token\n    @param[in] ex          an exception object describing the error\n    @return whether parsing should proceed (must return false)\n    */\n    virtual bool parse_error(std::size_t position,\n                             const std::string& last_token,\n                             const detail::exception& ex) = 0;\n\n    virtual ~json_sax() = default;\n};\n\n\nnamespace detail\n{\n/*!\n@brief SAX implementation to create a JSON value from SAX events\n\nThis class implements the @ref json_sax interface and processes the SAX events\nto create a JSON value which makes it basically a DOM parser. The structure or\nhierarchy of the JSON value is managed by the stack `ref_stack` which contains\na pointer to the respective array or object for each recursion depth.\n\nAfter successful parsing, the value that is passed by reference to the\nconstructor contains the parsed value.\n\n@tparam BasicJsonType  the JSON type\n*/\ntemplate<typename BasicJsonType>\nclass json_sax_dom_parser\n{\n  public:\n    using number_integer_t = typename BasicJsonType::number_integer_t;\n    using number_unsigned_t = typename BasicJsonType::number_unsigned_t;\n    using number_float_t = typename BasicJsonType::number_float_t;\n    using string_t = typename BasicJsonType::string_t;\n    using binary_t = typename BasicJsonType::binary_t;\n\n    /*!\n    @param[in, out] r  reference to a JSON value that is manipulated while\n                       parsing\n    @param[in] allow_exceptions_  whether parse errors yield exceptions\n    */\n    explicit json_sax_dom_parser(BasicJsonType& r, const bool allow_exceptions_ = true)\n        : root(r), allow_exceptions(allow_exceptions_)\n    {}\n\n    // make class move-only\n    json_sax_dom_parser(const json_sax_dom_parser&) = delete;\n    json_sax_dom_parser(json_sax_dom_parser&&) = default;\n    json_sax_dom_parser& operator=(const json_sax_dom_parser&) = delete;\n    json_sax_dom_parser& operator=(json_sax_dom_parser&&) = default;\n    ~json_sax_dom_parser() = default;\n\n    bool null()\n    {\n        handle_value(nullptr);\n        return true;\n    }\n\n    bool boolean(bool val)\n    {\n        handle_value(val);\n        return true;\n    }\n\n    bool number_integer(number_integer_t val)\n    {\n        handle_value(val);\n        return true;\n    }\n\n    bool number_unsigned(number_unsigned_t val)\n    {\n        handle_value(val);\n        return true;\n    }\n\n    bool number_float(number_float_t val, const string_t& /*unused*/)\n    {\n        handle_value(val);\n        return true;\n    }\n\n    bool string(string_t& val)\n    {\n        handle_value(val);\n        return true;\n    }\n\n    bool binary(binary_t& val)\n    {\n        handle_value(std::move(val));\n        return true;\n    }\n\n    bool start_object(std::size_t len)\n    {\n        ref_stack.push_back(handle_value(BasicJsonType::value_t::object));\n\n        if (JSON_HEDLEY_UNLIKELY(len != std::size_t(-1) && len > ref_stack.back()->max_size()))\n        {\n            JSON_THROW(out_of_range::create(408,\n                                            \"excessive object size: \" + std::to_string(len)));\n        }\n\n        return true;\n    }\n\n    bool key(string_t& val)\n    {\n        // add null at given key and store the reference for later\n        object_element = &(ref_stack.back()->m_value.object->operator[](val));\n        return true;\n    }\n\n    bool end_object()\n    {\n        ref_stack.pop_back();\n        return true;\n    }\n\n    bool start_array(std::size_t len)\n    {\n        ref_stack.push_back(handle_value(BasicJsonType::value_t::array));\n\n        if (JSON_HEDLEY_UNLIKELY(len != std::size_t(-1) && len > ref_stack.back()->max_size()))\n        {\n            JSON_THROW(out_of_range::create(408,\n                                            \"excessive array size: \" + std::to_string(len)));\n        }\n\n        return true;\n    }\n\n    bool end_array()\n    {\n        ref_stack.pop_back();\n        return true;\n    }\n\n    template<class Exception>\n    bool parse_error(std::size_t /*unused*/, const std::string& /*unused*/,\n                     const Exception& ex)\n    {\n        errored = true;\n        static_cast<void>(ex);\n        if (allow_exceptions)\n        {\n            JSON_THROW(ex);\n        }\n        return false;\n    }\n\n    constexpr bool is_errored() const\n    {\n        return errored;\n    }\n\n  private:\n    /*!\n    @invariant If the ref stack is empty, then the passed value will be the new\n               root.\n    @invariant If the ref stack contains a value, then it is an array or an\n               object to which we can add elements\n    */\n    template<typename Value>\n    JSON_HEDLEY_RETURNS_NON_NULL\n    BasicJsonType* handle_value(Value&& v)\n    {\n        if (ref_stack.empty())\n        {\n            root = BasicJsonType(std::forward<Value>(v));\n            return &root;\n        }\n\n        JSON_ASSERT(ref_stack.back()->is_array() || ref_stack.back()->is_object());\n\n        if (ref_stack.back()->is_array())\n        {\n            ref_stack.back()->m_value.array->emplace_back(std::forward<Value>(v));\n            return &(ref_stack.back()->m_value.array->back());\n        }\n\n        JSON_ASSERT(ref_stack.back()->is_object());\n        JSON_ASSERT(object_element);\n        *object_element = BasicJsonType(std::forward<Value>(v));\n        return object_element;\n    }\n\n    /// the parsed JSON value\n    BasicJsonType& root;\n    /// stack to model hierarchy of values\n    std::vector<BasicJsonType*> ref_stack {};\n    /// helper to hold the reference for the next object element\n    BasicJsonType* object_element = nullptr;\n    /// whether a syntax error occurred\n    bool errored = false;\n    /// whether to throw exceptions in case of errors\n    const bool allow_exceptions = true;\n};\n\ntemplate<typename BasicJsonType>\nclass json_sax_dom_callback_parser\n{\n  public:\n    using number_integer_t = typename BasicJsonType::number_integer_t;\n    using number_unsigned_t = typename BasicJsonType::number_unsigned_t;\n    using number_float_t = typename BasicJsonType::number_float_t;\n    using string_t = typename BasicJsonType::string_t;\n    using binary_t = typename BasicJsonType::binary_t;\n    using parser_callback_t = typename BasicJsonType::parser_callback_t;\n    using parse_event_t = typename BasicJsonType::parse_event_t;\n\n    json_sax_dom_callback_parser(BasicJsonType& r,\n                                 const parser_callback_t cb,\n                                 const bool allow_exceptions_ = true)\n        : root(r), callback(cb), allow_exceptions(allow_exceptions_)\n    {\n        keep_stack.push_back(true);\n    }\n\n    // make class move-only\n    json_sax_dom_callback_parser(const json_sax_dom_callback_parser&) = delete;\n    json_sax_dom_callback_parser(json_sax_dom_callback_parser&&) = default;\n    json_sax_dom_callback_parser& operator=(const json_sax_dom_callback_parser&) = delete;\n    json_sax_dom_callback_parser& operator=(json_sax_dom_callback_parser&&) = default;\n    ~json_sax_dom_callback_parser() = default;\n\n    bool null()\n    {\n        handle_value(nullptr);\n        return true;\n    }\n\n    bool boolean(bool val)\n    {\n        handle_value(val);\n        return true;\n    }\n\n    bool number_integer(number_integer_t val)\n    {\n        handle_value(val);\n        return true;\n    }\n\n    bool number_unsigned(number_unsigned_t val)\n    {\n        handle_value(val);\n        return true;\n    }\n\n    bool number_float(number_float_t val, const string_t& /*unused*/)\n    {\n        handle_value(val);\n        return true;\n    }\n\n    bool string(string_t& val)\n    {\n        handle_value(val);\n        return true;\n    }\n\n    bool binary(binary_t& val)\n    {\n        handle_value(std::move(val));\n        return true;\n    }\n\n    bool start_object(std::size_t len)\n    {\n        // check callback for object start\n        const bool keep = callback(static_cast<int>(ref_stack.size()), parse_event_t::object_start, discarded);\n        keep_stack.push_back(keep);\n\n        auto val = handle_value(BasicJsonType::value_t::object, true);\n        ref_stack.push_back(val.second);\n\n        // check object limit\n        if (ref_stack.back() && JSON_HEDLEY_UNLIKELY(len != std::size_t(-1) && len > ref_stack.back()->max_size()))\n        {\n            JSON_THROW(out_of_range::create(408, \"excessive object size: \" + std::to_string(len)));\n        }\n\n        return true;\n    }\n\n    bool key(string_t& val)\n    {\n        BasicJsonType k = BasicJsonType(val);\n\n        // check callback for key\n        const bool keep = callback(static_cast<int>(ref_stack.size()), parse_event_t::key, k);\n        key_keep_stack.push_back(keep);\n\n        // add discarded value at given key and store the reference for later\n        if (keep && ref_stack.back())\n        {\n            object_element = &(ref_stack.back()->m_value.object->operator[](val) = discarded);\n        }\n\n        return true;\n    }\n\n    bool end_object()\n    {\n        if (ref_stack.back() && !callback(static_cast<int>(ref_stack.size()) - 1, parse_event_t::object_end, *ref_stack.back()))\n        {\n            // discard object\n            *ref_stack.back() = discarded;\n        }\n\n        JSON_ASSERT(!ref_stack.empty());\n        JSON_ASSERT(!keep_stack.empty());\n        ref_stack.pop_back();\n        keep_stack.pop_back();\n\n        if (!ref_stack.empty() && ref_stack.back() && ref_stack.back()->is_structured())\n        {\n            // remove discarded value\n            for (auto it = ref_stack.back()->begin(); it != ref_stack.back()->end(); ++it)\n            {\n                if (it->is_discarded())\n                {\n                    ref_stack.back()->erase(it);\n                    break;\n                }\n            }\n        }\n\n        return true;\n    }\n\n    bool start_array(std::size_t len)\n    {\n        const bool keep = callback(static_cast<int>(ref_stack.size()), parse_event_t::array_start, discarded);\n        keep_stack.push_back(keep);\n\n        auto val = handle_value(BasicJsonType::value_t::array, true);\n        ref_stack.push_back(val.second);\n\n        // check array limit\n        if (ref_stack.back() && JSON_HEDLEY_UNLIKELY(len != std::size_t(-1) && len > ref_stack.back()->max_size()))\n        {\n            JSON_THROW(out_of_range::create(408, \"excessive array size: \" + std::to_string(len)));\n        }\n\n        return true;\n    }\n\n    bool end_array()\n    {\n        bool keep = true;\n\n        if (ref_stack.back())\n        {\n            keep = callback(static_cast<int>(ref_stack.size()) - 1, parse_event_t::array_end, *ref_stack.back());\n            if (!keep)\n            {\n                // discard array\n                *ref_stack.back() = discarded;\n            }\n        }\n\n        JSON_ASSERT(!ref_stack.empty());\n        JSON_ASSERT(!keep_stack.empty());\n        ref_stack.pop_back();\n        keep_stack.pop_back();\n\n        // remove discarded value\n        if (!keep && !ref_stack.empty() && ref_stack.back()->is_array())\n        {\n            ref_stack.back()->m_value.array->pop_back();\n        }\n\n        return true;\n    }\n\n    template<class Exception>\n    bool parse_error(std::size_t /*unused*/, const std::string& /*unused*/,\n                     const Exception& ex)\n    {\n        errored = true;\n        static_cast<void>(ex);\n        if (allow_exceptions)\n        {\n            JSON_THROW(ex);\n        }\n        return false;\n    }\n\n    constexpr bool is_errored() const\n    {\n        return errored;\n    }\n\n  private:\n    /*!\n    @param[in] v  value to add to the JSON value we build during parsing\n    @param[in] skip_callback  whether we should skip calling the callback\n               function; this is required after start_array() and\n               start_object() SAX events, because otherwise we would call the\n               callback function with an empty array or object, respectively.\n\n    @invariant If the ref stack is empty, then the passed value will be the new\n               root.\n    @invariant If the ref stack contains a value, then it is an array or an\n               object to which we can add elements\n\n    @return pair of boolean (whether value should be kept) and pointer (to the\n            passed value in the ref_stack hierarchy; nullptr if not kept)\n    */\n    template<typename Value>\n    std::pair<bool, BasicJsonType*> handle_value(Value&& v, const bool skip_callback = false)\n    {\n        JSON_ASSERT(!keep_stack.empty());\n\n        // do not handle this value if we know it would be added to a discarded\n        // container\n        if (!keep_stack.back())\n        {\n            return {false, nullptr};\n        }\n\n        // create value\n        auto value = BasicJsonType(std::forward<Value>(v));\n\n        // check callback\n        const bool keep = skip_callback || callback(static_cast<int>(ref_stack.size()), parse_event_t::value, value);\n\n        // do not handle this value if we just learnt it shall be discarded\n        if (!keep)\n        {\n            return {false, nullptr};\n        }\n\n        if (ref_stack.empty())\n        {\n            root = std::move(value);\n            return {true, &root};\n        }\n\n        // skip this value if we already decided to skip the parent\n        // (https://github.com/nlohmann/json/issues/971#issuecomment-413678360)\n        if (!ref_stack.back())\n        {\n            return {false, nullptr};\n        }\n\n        // we now only expect arrays and objects\n        JSON_ASSERT(ref_stack.back()->is_array() || ref_stack.back()->is_object());\n\n        // array\n        if (ref_stack.back()->is_array())\n        {\n            ref_stack.back()->m_value.array->push_back(std::move(value));\n            return {true, &(ref_stack.back()->m_value.array->back())};\n        }\n\n        // object\n        JSON_ASSERT(ref_stack.back()->is_object());\n        // check if we should store an element for the current key\n        JSON_ASSERT(!key_keep_stack.empty());\n        const bool store_element = key_keep_stack.back();\n        key_keep_stack.pop_back();\n\n        if (!store_element)\n        {\n            return {false, nullptr};\n        }\n\n        JSON_ASSERT(object_element);\n        *object_element = std::move(value);\n        return {true, object_element};\n    }\n\n    /// the parsed JSON value\n    BasicJsonType& root;\n    /// stack to model hierarchy of values\n    std::vector<BasicJsonType*> ref_stack {};\n    /// stack to manage which values to keep\n    std::vector<bool> keep_stack {};\n    /// stack to manage which object keys to keep\n    std::vector<bool> key_keep_stack {};\n    /// helper to hold the reference for the next object element\n    BasicJsonType* object_element = nullptr;\n    /// whether a syntax error occurred\n    bool errored = false;\n    /// callback function\n    const parser_callback_t callback = nullptr;\n    /// whether to throw exceptions in case of errors\n    const bool allow_exceptions = true;\n    /// a discarded value for the callback\n    BasicJsonType discarded = BasicJsonType::value_t::discarded;\n};\n\ntemplate<typename BasicJsonType>\nclass json_sax_acceptor\n{\n  public:\n    using number_integer_t = typename BasicJsonType::number_integer_t;\n    using number_unsigned_t = typename BasicJsonType::number_unsigned_t;\n    using number_float_t = typename BasicJsonType::number_float_t;\n    using string_t = typename BasicJsonType::string_t;\n    using binary_t = typename BasicJsonType::binary_t;\n\n    bool null()\n    {\n        return true;\n    }\n\n    bool boolean(bool /*unused*/)\n    {\n        return true;\n    }\n\n    bool number_integer(number_integer_t /*unused*/)\n    {\n        return true;\n    }\n\n    bool number_unsigned(number_unsigned_t /*unused*/)\n    {\n        return true;\n    }\n\n    bool number_float(number_float_t /*unused*/, const string_t& /*unused*/)\n    {\n        return true;\n    }\n\n    bool string(string_t& /*unused*/)\n    {\n        return true;\n    }\n\n    bool binary(binary_t& /*unused*/)\n    {\n        return true;\n    }\n\n    bool start_object(std::size_t /*unused*/ = std::size_t(-1))\n    {\n        return true;\n    }\n\n    bool key(string_t& /*unused*/)\n    {\n        return true;\n    }\n\n    bool end_object()\n    {\n        return true;\n    }\n\n    bool start_array(std::size_t /*unused*/ = std::size_t(-1))\n    {\n        return true;\n    }\n\n    bool end_array()\n    {\n        return true;\n    }\n\n    bool parse_error(std::size_t /*unused*/, const std::string& /*unused*/, const detail::exception& /*unused*/)\n    {\n        return false;\n    }\n};\n}  // namespace detail\n\n}  // namespace nlohmann\n\n// #include <nlohmann/detail/input/lexer.hpp>\n\n\n#include <array> // array\n#include <clocale> // localeconv\n#include <cstddef> // size_t\n#include <cstdio> // snprintf\n#include <cstdlib> // strtof, strtod, strtold, strtoll, strtoull\n#include <initializer_list> // initializer_list\n#include <string> // char_traits, string\n#include <utility> // move\n#include <vector> // vector\n\n// #include <nlohmann/detail/input/input_adapters.hpp>\n\n// #include <nlohmann/detail/input/position_t.hpp>\n\n// #include <nlohmann/detail/macro_scope.hpp>\n\n\nnamespace nlohmann\n{\nnamespace detail\n{\n///////////\n// lexer //\n///////////\n\ntemplate<typename BasicJsonType>\nclass lexer_base\n{\n  public:\n    /// token types for the parser\n    enum class token_type\n    {\n        uninitialized,    ///< indicating the scanner is uninitialized\n        literal_true,     ///< the `true` literal\n        literal_false,    ///< the `false` literal\n        literal_null,     ///< the `null` literal\n        value_string,     ///< a string -- use get_string() for actual value\n        value_unsigned,   ///< an unsigned integer -- use get_number_unsigned() for actual value\n        value_integer,    ///< a signed integer -- use get_number_integer() for actual value\n        value_float,      ///< an floating point number -- use get_number_float() for actual value\n        begin_array,      ///< the character for array begin `[`\n        begin_object,     ///< the character for object begin `{`\n        end_array,        ///< the character for array end `]`\n        end_object,       ///< the character for object end `}`\n        name_separator,   ///< the name separator `:`\n        value_separator,  ///< the value separator `,`\n        parse_error,      ///< indicating a parse error\n        end_of_input,     ///< indicating the end of the input buffer\n        literal_or_value  ///< a literal or the begin of a value (only for diagnostics)\n    };\n\n    /// return name of values of type token_type (only used for errors)\n    JSON_HEDLEY_RETURNS_NON_NULL\n    JSON_HEDLEY_CONST\n    static const char* token_type_name(const token_type t) noexcept\n    {\n        switch (t)\n        {\n            case token_type::uninitialized:\n                return \"<uninitialized>\";\n            case token_type::literal_true:\n                return \"true literal\";\n            case token_type::literal_false:\n                return \"false literal\";\n            case token_type::literal_null:\n                return \"null literal\";\n            case token_type::value_string:\n                return \"string literal\";\n            case token_type::value_unsigned:\n            case token_type::value_integer:\n            case token_type::value_float:\n                return \"number literal\";\n            case token_type::begin_array:\n                return \"'['\";\n            case token_type::begin_object:\n                return \"'{'\";\n            case token_type::end_array:\n                return \"']'\";\n            case token_type::end_object:\n                return \"'}'\";\n            case token_type::name_separator:\n                return \"':'\";\n            case token_type::value_separator:\n                return \"','\";\n            case token_type::parse_error:\n                return \"<parse error>\";\n            case token_type::end_of_input:\n                return \"end of input\";\n            case token_type::literal_or_value:\n                return \"'[', '{', or a literal\";\n            // LCOV_EXCL_START\n            default: // catch non-enum values\n                return \"unknown token\";\n                // LCOV_EXCL_STOP\n        }\n    }\n};\n/*!\n@brief lexical analysis\n\nThis class organizes the lexical analysis during JSON deserialization.\n*/\ntemplate<typename BasicJsonType, typename InputAdapterType>\nclass lexer : public lexer_base<BasicJsonType>\n{\n    using number_integer_t = typename BasicJsonType::number_integer_t;\n    using number_unsigned_t = typename BasicJsonType::number_unsigned_t;\n    using number_float_t = typename BasicJsonType::number_float_t;\n    using string_t = typename BasicJsonType::string_t;\n    using char_type = typename InputAdapterType::char_type;\n    using char_int_type = typename std::char_traits<char_type>::int_type;\n\n  public:\n    using token_type = typename lexer_base<BasicJsonType>::token_type;\n\n    explicit lexer(InputAdapterType&& adapter, bool ignore_comments_ = false)\n        : ia(std::move(adapter))\n        , ignore_comments(ignore_comments_)\n        , decimal_point_char(static_cast<char_int_type>(get_decimal_point()))\n    {}\n\n    // delete because of pointer members\n    lexer(const lexer&) = delete;\n    lexer(lexer&&) = default;\n    lexer& operator=(lexer&) = delete;\n    lexer& operator=(lexer&&) = default;\n    ~lexer() = default;\n\n  private:\n    /////////////////////\n    // locales\n    /////////////////////\n\n    /// return the locale-dependent decimal point\n    JSON_HEDLEY_PURE\n    static char get_decimal_point() noexcept\n    {\n        const auto* loc = localeconv();\n        JSON_ASSERT(loc != nullptr);\n        return (loc->decimal_point == nullptr) ? '.' : *(loc->decimal_point);\n    }\n\n    /////////////////////\n    // scan functions\n    /////////////////////\n\n    /*!\n    @brief get codepoint from 4 hex characters following `\\u`\n\n    For input \"\\u c1 c2 c3 c4\" the codepoint is:\n      (c1 * 0x1000) + (c2 * 0x0100) + (c3 * 0x0010) + c4\n    = (c1 << 12) + (c2 << 8) + (c3 << 4) + (c4 << 0)\n\n    Furthermore, the possible characters '0'..'9', 'A'..'F', and 'a'..'f'\n    must be converted to the integers 0x0..0x9, 0xA..0xF, 0xA..0xF, resp. The\n    conversion is done by subtracting the offset (0x30, 0x37, and 0x57)\n    between the ASCII value of the character and the desired integer value.\n\n    @return codepoint (0x0000..0xFFFF) or -1 in case of an error (e.g. EOF or\n            non-hex character)\n    */\n    int get_codepoint()\n    {\n        // this function only makes sense after reading `\\u`\n        JSON_ASSERT(current == 'u');\n        int codepoint = 0;\n\n        const auto factors = { 12u, 8u, 4u, 0u };\n        for (const auto factor : factors)\n        {\n            get();\n\n            if (current >= '0' && current <= '9')\n            {\n                codepoint += static_cast<int>((static_cast<unsigned int>(current) - 0x30u) << factor);\n            }\n            else if (current >= 'A' && current <= 'F')\n            {\n                codepoint += static_cast<int>((static_cast<unsigned int>(current) - 0x37u) << factor);\n            }\n            else if (current >= 'a' && current <= 'f')\n            {\n                codepoint += static_cast<int>((static_cast<unsigned int>(current) - 0x57u) << factor);\n            }\n            else\n            {\n                return -1;\n            }\n        }\n\n        JSON_ASSERT(0x0000 <= codepoint && codepoint <= 0xFFFF);\n        return codepoint;\n    }\n\n    /*!\n    @brief check if the next byte(s) are inside a given range\n\n    Adds the current byte and, for each passed range, reads a new byte and\n    checks if it is inside the range. If a violation was detected, set up an\n    error message and return false. Otherwise, return true.\n\n    @param[in] ranges  list of integers; interpreted as list of pairs of\n                       inclusive lower and upper bound, respectively\n\n    @pre The passed list @a ranges must have 2, 4, or 6 elements; that is,\n         1, 2, or 3 pairs. This precondition is enforced by an assertion.\n\n    @return true if and only if no range violation was detected\n    */\n    bool next_byte_in_range(std::initializer_list<char_int_type> ranges)\n    {\n        JSON_ASSERT(ranges.size() == 2 || ranges.size() == 4 || ranges.size() == 6);\n        add(current);\n\n        for (auto range = ranges.begin(); range != ranges.end(); ++range)\n        {\n            get();\n            if (JSON_HEDLEY_LIKELY(*range <= current && current <= *(++range)))\n            {\n                add(current);\n            }\n            else\n            {\n                error_message = \"invalid string: ill-formed UTF-8 byte\";\n                return false;\n            }\n        }\n\n        return true;\n    }\n\n    /*!\n    @brief scan a string literal\n\n    This function scans a string according to Sect. 7 of RFC 7159. While\n    scanning, bytes are escaped and copied into buffer token_buffer. Then the\n    function returns successfully, token_buffer is *not* null-terminated (as it\n    may contain \\0 bytes), and token_buffer.size() is the number of bytes in the\n    string.\n\n    @return token_type::value_string if string could be successfully scanned,\n            token_type::parse_error otherwise\n\n    @note In case of errors, variable error_message contains a textual\n          description.\n    */\n    token_type scan_string()\n    {\n        // reset token_buffer (ignore opening quote)\n        reset();\n\n        // we entered the function by reading an open quote\n        JSON_ASSERT(current == '\\\"');\n\n        while (true)\n        {\n            // get next character\n            switch (get())\n            {\n                // end of file while parsing string\n                case std::char_traits<char_type>::eof():\n                {\n                    error_message = \"invalid string: missing closing quote\";\n                    return token_type::parse_error;\n                }\n\n                // closing quote\n                case '\\\"':\n                {\n                    return token_type::value_string;\n                }\n\n                // escapes\n                case '\\\\':\n                {\n                    switch (get())\n                    {\n                        // quotation mark\n                        case '\\\"':\n                            add('\\\"');\n                            break;\n                        // reverse solidus\n                        case '\\\\':\n                            add('\\\\');\n                            break;\n                        // solidus\n                        case '/':\n                            add('/');\n                            break;\n                        // backspace\n                        case 'b':\n                            add('\\b');\n                            break;\n                        // form feed\n                        case 'f':\n                            add('\\f');\n                            break;\n                        // line feed\n                        case 'n':\n                            add('\\n');\n                            break;\n                        // carriage return\n                        case 'r':\n                            add('\\r');\n                            break;\n                        // tab\n                        case 't':\n                            add('\\t');\n                            break;\n\n                        // unicode escapes\n                        case 'u':\n                        {\n                            const int codepoint1 = get_codepoint();\n                            int codepoint = codepoint1; // start with codepoint1\n\n                            if (JSON_HEDLEY_UNLIKELY(codepoint1 == -1))\n                            {\n                                error_message = \"invalid string: '\\\\u' must be followed by 4 hex digits\";\n                                return token_type::parse_error;\n                            }\n\n                            // check if code point is a high surrogate\n                            if (0xD800 <= codepoint1 && codepoint1 <= 0xDBFF)\n                            {\n                                // expect next \\uxxxx entry\n                                if (JSON_HEDLEY_LIKELY(get() == '\\\\' && get() == 'u'))\n                                {\n                                    const int codepoint2 = get_codepoint();\n\n                                    if (JSON_HEDLEY_UNLIKELY(codepoint2 == -1))\n                                    {\n                                        error_message = \"invalid string: '\\\\u' must be followed by 4 hex digits\";\n                                        return token_type::parse_error;\n                                    }\n\n                                    // check if codepoint2 is a low surrogate\n                                    if (JSON_HEDLEY_LIKELY(0xDC00 <= codepoint2 && codepoint2 <= 0xDFFF))\n                                    {\n                                        // overwrite codepoint\n                                        codepoint = static_cast<int>(\n                                                        // high surrogate occupies the most significant 22 bits\n                                                        (static_cast<unsigned int>(codepoint1) << 10u)\n                                                        // low surrogate occupies the least significant 15 bits\n                                                        + static_cast<unsigned int>(codepoint2)\n                                                        // there is still the 0xD800, 0xDC00 and 0x10000 noise\n                                                        // in the result so we have to subtract with:\n                                                        // (0xD800 << 10) + DC00 - 0x10000 = 0x35FDC00\n                                                        - 0x35FDC00u);\n                                    }\n                                    else\n                                    {\n                                        error_message = \"invalid string: surrogate U+D800..U+DBFF must be followed by U+DC00..U+DFFF\";\n                                        return token_type::parse_error;\n                                    }\n                                }\n                                else\n                                {\n                                    error_message = \"invalid string: surrogate U+D800..U+DBFF must be followed by U+DC00..U+DFFF\";\n                                    return token_type::parse_error;\n                                }\n                            }\n                            else\n                            {\n                                if (JSON_HEDLEY_UNLIKELY(0xDC00 <= codepoint1 && codepoint1 <= 0xDFFF))\n                                {\n                                    error_message = \"invalid string: surrogate U+DC00..U+DFFF must follow U+D800..U+DBFF\";\n                                    return token_type::parse_error;\n                                }\n                            }\n\n                            // result of the above calculation yields a proper codepoint\n                            JSON_ASSERT(0x00 <= codepoint && codepoint <= 0x10FFFF);\n\n                            // translate codepoint into bytes\n                            if (codepoint < 0x80)\n                            {\n                                // 1-byte characters: 0xxxxxxx (ASCII)\n                                add(static_cast<char_int_type>(codepoint));\n                            }\n                            else if (codepoint <= 0x7FF)\n                            {\n                                // 2-byte characters: 110xxxxx 10xxxxxx\n                                add(static_cast<char_int_type>(0xC0u | (static_cast<unsigned int>(codepoint) >> 6u)));\n                                add(static_cast<char_int_type>(0x80u | (static_cast<unsigned int>(codepoint) & 0x3Fu)));\n                            }\n                            else if (codepoint <= 0xFFFF)\n                            {\n                                // 3-byte characters: 1110xxxx 10xxxxxx 10xxxxxx\n                                add(static_cast<char_int_type>(0xE0u | (static_cast<unsigned int>(codepoint) >> 12u)));\n                                add(static_cast<char_int_type>(0x80u | ((static_cast<unsigned int>(codepoint) >> 6u) & 0x3Fu)));\n                                add(static_cast<char_int_type>(0x80u | (static_cast<unsigned int>(codepoint) & 0x3Fu)));\n                            }\n                            else\n                            {\n                                // 4-byte characters: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx\n                                add(static_cast<char_int_type>(0xF0u | (static_cast<unsigned int>(codepoint) >> 18u)));\n                                add(static_cast<char_int_type>(0x80u | ((static_cast<unsigned int>(codepoint) >> 12u) & 0x3Fu)));\n                                add(static_cast<char_int_type>(0x80u | ((static_cast<unsigned int>(codepoint) >> 6u) & 0x3Fu)));\n                                add(static_cast<char_int_type>(0x80u | (static_cast<unsigned int>(codepoint) & 0x3Fu)));\n                            }\n\n                            break;\n                        }\n\n                        // other characters after escape\n                        default:\n                            error_message = \"invalid string: forbidden character after backslash\";\n                            return token_type::parse_error;\n                    }\n\n                    break;\n                }\n\n                // invalid control characters\n                case 0x00:\n                {\n                    error_message = \"invalid string: control character U+0000 (NUL) must be escaped to \\\\u0000\";\n                    return token_type::parse_error;\n                }\n\n                case 0x01:\n                {\n                    error_message = \"invalid string: control character U+0001 (SOH) must be escaped to \\\\u0001\";\n                    return token_type::parse_error;\n                }\n\n                case 0x02:\n                {\n                    error_message = \"invalid string: control character U+0002 (STX) must be escaped to \\\\u0002\";\n                    return token_type::parse_error;\n                }\n\n                case 0x03:\n                {\n                    error_message = \"invalid string: control character U+0003 (ETX) must be escaped to \\\\u0003\";\n                    return token_type::parse_error;\n                }\n\n                case 0x04:\n                {\n                    error_message = \"invalid string: control character U+0004 (EOT) must be escaped to \\\\u0004\";\n                    return token_type::parse_error;\n                }\n\n                case 0x05:\n                {\n                    error_message = \"invalid string: control character U+0005 (ENQ) must be escaped to \\\\u0005\";\n                    return token_type::parse_error;\n                }\n\n                case 0x06:\n                {\n                    error_message = \"invalid string: control character U+0006 (ACK) must be escaped to \\\\u0006\";\n                    return token_type::parse_error;\n                }\n\n                case 0x07:\n                {\n                    error_message = \"invalid string: control character U+0007 (BEL) must be escaped to \\\\u0007\";\n                    return token_type::parse_error;\n                }\n\n                case 0x08:\n                {\n                    error_message = \"invalid string: control character U+0008 (BS) must be escaped to \\\\u0008 or \\\\b\";\n                    return token_type::parse_error;\n                }\n\n                case 0x09:\n                {\n                    error_message = \"invalid string: control character U+0009 (HT) must be escaped to \\\\u0009 or \\\\t\";\n                    return token_type::parse_error;\n                }\n\n                case 0x0A:\n                {\n                    error_message = \"invalid string: control character U+000A (LF) must be escaped to \\\\u000A or \\\\n\";\n                    return token_type::parse_error;\n                }\n\n                case 0x0B:\n                {\n                    error_message = \"invalid string: control character U+000B (VT) must be escaped to \\\\u000B\";\n                    return token_type::parse_error;\n                }\n\n                case 0x0C:\n                {\n                    error_message = \"invalid string: control character U+000C (FF) must be escaped to \\\\u000C or \\\\f\";\n                    return token_type::parse_error;\n                }\n\n                case 0x0D:\n                {\n                    error_message = \"invalid string: control character U+000D (CR) must be escaped to \\\\u000D or \\\\r\";\n                    return token_type::parse_error;\n                }\n\n                case 0x0E:\n                {\n                    error_message = \"invalid string: control character U+000E (SO) must be escaped to \\\\u000E\";\n                    return token_type::parse_error;\n                }\n\n                case 0x0F:\n                {\n                    error_message = \"invalid string: control character U+000F (SI) must be escaped to \\\\u000F\";\n                    return token_type::parse_error;\n                }\n\n                case 0x10:\n                {\n                    error_message = \"invalid string: control character U+0010 (DLE) must be escaped to \\\\u0010\";\n                    return token_type::parse_error;\n                }\n\n                case 0x11:\n                {\n                    error_message = \"invalid string: control character U+0011 (DC1) must be escaped to \\\\u0011\";\n                    return token_type::parse_error;\n                }\n\n                case 0x12:\n                {\n                    error_message = \"invalid string: control character U+0012 (DC2) must be escaped to \\\\u0012\";\n                    return token_type::parse_error;\n                }\n\n                case 0x13:\n                {\n                    error_message = \"invalid string: control character U+0013 (DC3) must be escaped to \\\\u0013\";\n                    return token_type::parse_error;\n                }\n\n                case 0x14:\n                {\n                    error_message = \"invalid string: control character U+0014 (DC4) must be escaped to \\\\u0014\";\n                    return token_type::parse_error;\n                }\n\n                case 0x15:\n                {\n                    error_message = \"invalid string: control character U+0015 (NAK) must be escaped to \\\\u0015\";\n                    return token_type::parse_error;\n                }\n\n                case 0x16:\n                {\n                    error_message = \"invalid string: control character U+0016 (SYN) must be escaped to \\\\u0016\";\n                    return token_type::parse_error;\n                }\n\n                case 0x17:\n                {\n                    error_message = \"invalid string: control character U+0017 (ETB) must be escaped to \\\\u0017\";\n                    return token_type::parse_error;\n                }\n\n                case 0x18:\n                {\n                    error_message = \"invalid string: control character U+0018 (CAN) must be escaped to \\\\u0018\";\n                    return token_type::parse_error;\n                }\n\n                case 0x19:\n                {\n                    error_message = \"invalid string: control character U+0019 (EM) must be escaped to \\\\u0019\";\n                    return token_type::parse_error;\n                }\n\n                case 0x1A:\n                {\n                    error_message = \"invalid string: control character U+001A (SUB) must be escaped to \\\\u001A\";\n                    return token_type::parse_error;\n                }\n\n                case 0x1B:\n                {\n                    error_message = \"invalid string: control character U+001B (ESC) must be escaped to \\\\u001B\";\n                    return token_type::parse_error;\n                }\n\n                case 0x1C:\n                {\n                    error_message = \"invalid string: control character U+001C (FS) must be escaped to \\\\u001C\";\n                    return token_type::parse_error;\n                }\n\n                case 0x1D:\n                {\n                    error_message = \"invalid string: control character U+001D (GS) must be escaped to \\\\u001D\";\n                    return token_type::parse_error;\n                }\n\n                case 0x1E:\n                {\n                    error_message = \"invalid string: control character U+001E (RS) must be escaped to \\\\u001E\";\n                    return token_type::parse_error;\n                }\n\n                case 0x1F:\n                {\n                    error_message = \"invalid string: control character U+001F (US) must be escaped to \\\\u001F\";\n                    return token_type::parse_error;\n                }\n\n                // U+0020..U+007F (except U+0022 (quote) and U+005C (backspace))\n                case 0x20:\n                case 0x21:\n                case 0x23:\n                case 0x24:\n                case 0x25:\n                case 0x26:\n                case 0x27:\n                case 0x28:\n                case 0x29:\n                case 0x2A:\n                case 0x2B:\n                case 0x2C:\n                case 0x2D:\n                case 0x2E:\n                case 0x2F:\n                case 0x30:\n                case 0x31:\n                case 0x32:\n                case 0x33:\n                case 0x34:\n                case 0x35:\n                case 0x36:\n                case 0x37:\n                case 0x38:\n                case 0x39:\n                case 0x3A:\n                case 0x3B:\n                case 0x3C:\n                case 0x3D:\n                case 0x3E:\n                case 0x3F:\n                case 0x40:\n                case 0x41:\n                case 0x42:\n                case 0x43:\n                case 0x44:\n                case 0x45:\n                case 0x46:\n                case 0x47:\n                case 0x48:\n                case 0x49:\n                case 0x4A:\n                case 0x4B:\n                case 0x4C:\n                case 0x4D:\n                case 0x4E:\n                case 0x4F:\n                case 0x50:\n                case 0x51:\n                case 0x52:\n                case 0x53:\n                case 0x54:\n                case 0x55:\n                case 0x56:\n                case 0x57:\n                case 0x58:\n                case 0x59:\n                case 0x5A:\n                case 0x5B:\n                case 0x5D:\n                case 0x5E:\n                case 0x5F:\n                case 0x60:\n                case 0x61:\n                case 0x62:\n                case 0x63:\n                case 0x64:\n                case 0x65:\n                case 0x66:\n                case 0x67:\n                case 0x68:\n                case 0x69:\n                case 0x6A:\n                case 0x6B:\n                case 0x6C:\n                case 0x6D:\n                case 0x6E:\n                case 0x6F:\n                case 0x70:\n                case 0x71:\n                case 0x72:\n                case 0x73:\n                case 0x74:\n                case 0x75:\n                case 0x76:\n                case 0x77:\n                case 0x78:\n                case 0x79:\n                case 0x7A:\n                case 0x7B:\n                case 0x7C:\n                case 0x7D:\n                case 0x7E:\n                case 0x7F:\n                {\n                    add(current);\n                    break;\n                }\n\n                // U+0080..U+07FF: bytes C2..DF 80..BF\n                case 0xC2:\n                case 0xC3:\n                case 0xC4:\n                case 0xC5:\n                case 0xC6:\n                case 0xC7:\n                case 0xC8:\n                case 0xC9:\n                case 0xCA:\n                case 0xCB:\n                case 0xCC:\n                case 0xCD:\n                case 0xCE:\n                case 0xCF:\n                case 0xD0:\n                case 0xD1:\n                case 0xD2:\n                case 0xD3:\n                case 0xD4:\n                case 0xD5:\n                case 0xD6:\n                case 0xD7:\n                case 0xD8:\n                case 0xD9:\n                case 0xDA:\n                case 0xDB:\n                case 0xDC:\n                case 0xDD:\n                case 0xDE:\n                case 0xDF:\n                {\n                    if (JSON_HEDLEY_UNLIKELY(!next_byte_in_range({0x80, 0xBF})))\n                    {\n                        return token_type::parse_error;\n                    }\n                    break;\n                }\n\n                // U+0800..U+0FFF: bytes E0 A0..BF 80..BF\n                case 0xE0:\n                {\n                    if (JSON_HEDLEY_UNLIKELY(!(next_byte_in_range({0xA0, 0xBF, 0x80, 0xBF}))))\n                    {\n                        return token_type::parse_error;\n                    }\n                    break;\n                }\n\n                // U+1000..U+CFFF: bytes E1..EC 80..BF 80..BF\n                // U+E000..U+FFFF: bytes EE..EF 80..BF 80..BF\n                case 0xE1:\n                case 0xE2:\n                case 0xE3:\n                case 0xE4:\n                case 0xE5:\n                case 0xE6:\n                case 0xE7:\n                case 0xE8:\n                case 0xE9:\n                case 0xEA:\n                case 0xEB:\n                case 0xEC:\n                case 0xEE:\n                case 0xEF:\n                {\n                    if (JSON_HEDLEY_UNLIKELY(!(next_byte_in_range({0x80, 0xBF, 0x80, 0xBF}))))\n                    {\n                        return token_type::parse_error;\n                    }\n                    break;\n                }\n\n                // U+D000..U+D7FF: bytes ED 80..9F 80..BF\n                case 0xED:\n                {\n                    if (JSON_HEDLEY_UNLIKELY(!(next_byte_in_range({0x80, 0x9F, 0x80, 0xBF}))))\n                    {\n                        return token_type::parse_error;\n                    }\n                    break;\n                }\n\n                // U+10000..U+3FFFF F0 90..BF 80..BF 80..BF\n                case 0xF0:\n                {\n                    if (JSON_HEDLEY_UNLIKELY(!(next_byte_in_range({0x90, 0xBF, 0x80, 0xBF, 0x80, 0xBF}))))\n                    {\n                        return token_type::parse_error;\n                    }\n                    break;\n                }\n\n                // U+40000..U+FFFFF F1..F3 80..BF 80..BF 80..BF\n                case 0xF1:\n                case 0xF2:\n                case 0xF3:\n                {\n                    if (JSON_HEDLEY_UNLIKELY(!(next_byte_in_range({0x80, 0xBF, 0x80, 0xBF, 0x80, 0xBF}))))\n                    {\n                        return token_type::parse_error;\n                    }\n                    break;\n                }\n\n                // U+100000..U+10FFFF F4 80..8F 80..BF 80..BF\n                case 0xF4:\n                {\n                    if (JSON_HEDLEY_UNLIKELY(!(next_byte_in_range({0x80, 0x8F, 0x80, 0xBF, 0x80, 0xBF}))))\n                    {\n                        return token_type::parse_error;\n                    }\n                    break;\n                }\n\n                // remaining bytes (80..C1 and F5..FF) are ill-formed\n                default:\n                {\n                    error_message = \"invalid string: ill-formed UTF-8 byte\";\n                    return token_type::parse_error;\n                }\n            }\n        }\n    }\n\n    /*!\n     * @brief scan a comment\n     * @return whether comment could be scanned successfully\n     */\n    bool scan_comment()\n    {\n        switch (get())\n        {\n            // single-line comments skip input until a newline or EOF is read\n            case '/':\n            {\n                while (true)\n                {\n                    switch (get())\n                    {\n                        case '\\n':\n                        case '\\r':\n                        case std::char_traits<char_type>::eof():\n                        case '\\0':\n                            return true;\n\n                        default:\n                            break;\n                    }\n                }\n            }\n\n            // multi-line comments skip input until */ is read\n            case '*':\n            {\n                while (true)\n                {\n                    switch (get())\n                    {\n                        case std::char_traits<char_type>::eof():\n                        case '\\0':\n                        {\n                            error_message = \"invalid comment; missing closing '*/'\";\n                            return false;\n                        }\n\n                        case '*':\n                        {\n                            switch (get())\n                            {\n                                case '/':\n                                    return true;\n\n                                default:\n                                {\n                                    unget();\n                                    continue;\n                                }\n                            }\n                        }\n\n                        default:\n                            continue;\n                    }\n                }\n            }\n\n            // unexpected character after reading '/'\n            default:\n            {\n                error_message = \"invalid comment; expecting '/' or '*' after '/'\";\n                return false;\n            }\n        }\n    }\n\n    JSON_HEDLEY_NON_NULL(2)\n    static void strtof(float& f, const char* str, char** endptr) noexcept\n    {\n        f = std::strtof(str, endptr);\n    }\n\n    JSON_HEDLEY_NON_NULL(2)\n    static void strtof(double& f, const char* str, char** endptr) noexcept\n    {\n        f = std::strtod(str, endptr);\n    }\n\n    JSON_HEDLEY_NON_NULL(2)\n    static void strtof(long double& f, const char* str, char** endptr) noexcept\n    {\n        f = std::strtold(str, endptr);\n    }\n\n    /*!\n    @brief scan a number literal\n\n    This function scans a string according to Sect. 6 of RFC 7159.\n\n    The function is realized with a deterministic finite state machine derived\n    from the grammar described in RFC 7159. Starting in state \"init\", the\n    input is read and used to determined the next state. Only state \"done\"\n    accepts the number. State \"error\" is a trap state to model errors. In the\n    table below, \"anything\" means any character but the ones listed before.\n\n    state    | 0        | 1-9      | e E      | +       | -       | .        | anything\n    ---------|----------|----------|----------|---------|---------|----------|-----------\n    init     | zero     | any1     | [error]  | [error] | minus   | [error]  | [error]\n    minus    | zero     | any1     | [error]  | [error] | [error] | [error]  | [error]\n    zero     | done     | done     | exponent | done    | done    | decimal1 | done\n    any1     | any1     | any1     | exponent | done    | done    | decimal1 | done\n    decimal1 | decimal2 | decimal2 | [error]  | [error] | [error] | [error]  | [error]\n    decimal2 | decimal2 | decimal2 | exponent | done    | done    | done     | done\n    exponent | any2     | any2     | [error]  | sign    | sign    | [error]  | [error]\n    sign     | any2     | any2     | [error]  | [error] | [error] | [error]  | [error]\n    any2     | any2     | any2     | done     | done    | done    | done     | done\n\n    The state machine is realized with one label per state (prefixed with\n    \"scan_number_\") and `goto` statements between them. The state machine\n    contains cycles, but any cycle can be left when EOF is read. Therefore,\n    the function is guaranteed to terminate.\n\n    During scanning, the read bytes are stored in token_buffer. This string is\n    then converted to a signed integer, an unsigned integer, or a\n    floating-point number.\n\n    @return token_type::value_unsigned, token_type::value_integer, or\n            token_type::value_float if number could be successfully scanned,\n            token_type::parse_error otherwise\n\n    @note The scanner is independent of the current locale. Internally, the\n          locale's decimal point is used instead of `.` to work with the\n          locale-dependent converters.\n    */\n    token_type scan_number()  // lgtm [cpp/use-of-goto]\n    {\n        // reset token_buffer to store the number's bytes\n        reset();\n\n        // the type of the parsed number; initially set to unsigned; will be\n        // changed if minus sign, decimal point or exponent is read\n        token_type number_type = token_type::value_unsigned;\n\n        // state (init): we just found out we need to scan a number\n        switch (current)\n        {\n            case '-':\n            {\n                add(current);\n                goto scan_number_minus;\n            }\n\n            case '0':\n            {\n                add(current);\n                goto scan_number_zero;\n            }\n\n            case '1':\n            case '2':\n            case '3':\n            case '4':\n            case '5':\n            case '6':\n            case '7':\n            case '8':\n            case '9':\n            {\n                add(current);\n                goto scan_number_any1;\n            }\n\n            // all other characters are rejected outside scan_number()\n            default:            // LCOV_EXCL_LINE\n                JSON_ASSERT(false);  // LCOV_EXCL_LINE\n        }\n\nscan_number_minus:\n        // state: we just parsed a leading minus sign\n        number_type = token_type::value_integer;\n        switch (get())\n        {\n            case '0':\n            {\n                add(current);\n                goto scan_number_zero;\n            }\n\n            case '1':\n            case '2':\n            case '3':\n            case '4':\n            case '5':\n            case '6':\n            case '7':\n            case '8':\n            case '9':\n            {\n                add(current);\n                goto scan_number_any1;\n            }\n\n            default:\n            {\n                error_message = \"invalid number; expected digit after '-'\";\n                return token_type::parse_error;\n            }\n        }\n\nscan_number_zero:\n        // state: we just parse a zero (maybe with a leading minus sign)\n        switch (get())\n        {\n            case '.':\n            {\n                add(decimal_point_char);\n                goto scan_number_decimal1;\n            }\n\n            case 'e':\n            case 'E':\n            {\n                add(current);\n                goto scan_number_exponent;\n            }\n\n            default:\n                goto scan_number_done;\n        }\n\nscan_number_any1:\n        // state: we just parsed a number 0-9 (maybe with a leading minus sign)\n        switch (get())\n        {\n            case '0':\n            case '1':\n            case '2':\n            case '3':\n            case '4':\n            case '5':\n            case '6':\n            case '7':\n            case '8':\n            case '9':\n            {\n                add(current);\n                goto scan_number_any1;\n            }\n\n            case '.':\n            {\n                add(decimal_point_char);\n                goto scan_number_decimal1;\n            }\n\n            case 'e':\n            case 'E':\n            {\n                add(current);\n                goto scan_number_exponent;\n            }\n\n            default:\n                goto scan_number_done;\n        }\n\nscan_number_decimal1:\n        // state: we just parsed a decimal point\n        number_type = token_type::value_float;\n        switch (get())\n        {\n            case '0':\n            case '1':\n            case '2':\n            case '3':\n            case '4':\n            case '5':\n            case '6':\n            case '7':\n            case '8':\n            case '9':\n            {\n                add(current);\n                goto scan_number_decimal2;\n            }\n\n            default:\n            {\n                error_message = \"invalid number; expected digit after '.'\";\n                return token_type::parse_error;\n            }\n        }\n\nscan_number_decimal2:\n        // we just parsed at least one number after a decimal point\n        switch (get())\n        {\n            case '0':\n            case '1':\n            case '2':\n            case '3':\n            case '4':\n            case '5':\n            case '6':\n            case '7':\n            case '8':\n            case '9':\n            {\n                add(current);\n                goto scan_number_decimal2;\n            }\n\n            case 'e':\n            case 'E':\n            {\n                add(current);\n                goto scan_number_exponent;\n            }\n\n            default:\n                goto scan_number_done;\n        }\n\nscan_number_exponent:\n        // we just parsed an exponent\n        number_type = token_type::value_float;\n        switch (get())\n        {\n            case '+':\n            case '-':\n            {\n                add(current);\n                goto scan_number_sign;\n            }\n\n            case '0':\n            case '1':\n            case '2':\n            case '3':\n            case '4':\n            case '5':\n            case '6':\n            case '7':\n            case '8':\n            case '9':\n            {\n                add(current);\n                goto scan_number_any2;\n            }\n\n            default:\n            {\n                error_message =\n                    \"invalid number; expected '+', '-', or digit after exponent\";\n                return token_type::parse_error;\n            }\n        }\n\nscan_number_sign:\n        // we just parsed an exponent sign\n        switch (get())\n        {\n            case '0':\n            case '1':\n            case '2':\n            case '3':\n            case '4':\n            case '5':\n            case '6':\n            case '7':\n            case '8':\n            case '9':\n            {\n                add(current);\n                goto scan_number_any2;\n            }\n\n            default:\n            {\n                error_message = \"invalid number; expected digit after exponent sign\";\n                return token_type::parse_error;\n            }\n        }\n\nscan_number_any2:\n        // we just parsed a number after the exponent or exponent sign\n        switch (get())\n        {\n            case '0':\n            case '1':\n            case '2':\n            case '3':\n            case '4':\n            case '5':\n            case '6':\n            case '7':\n            case '8':\n            case '9':\n            {\n                add(current);\n                goto scan_number_any2;\n            }\n\n            default:\n                goto scan_number_done;\n        }\n\nscan_number_done:\n        // unget the character after the number (we only read it to know that\n        // we are done scanning a number)\n        unget();\n\n        char* endptr = nullptr;\n        errno = 0;\n\n        // try to parse integers first and fall back to floats\n        if (number_type == token_type::value_unsigned)\n        {\n            const auto x = std::strtoull(token_buffer.data(), &endptr, 10);\n\n            // we checked the number format before\n            JSON_ASSERT(endptr == token_buffer.data() + token_buffer.size());\n\n            if (errno == 0)\n            {\n                value_unsigned = static_cast<number_unsigned_t>(x);\n                if (value_unsigned == x)\n                {\n                    return token_type::value_unsigned;\n                }\n            }\n        }\n        else if (number_type == token_type::value_integer)\n        {\n            const auto x = std::strtoll(token_buffer.data(), &endptr, 10);\n\n            // we checked the number format before\n            JSON_ASSERT(endptr == token_buffer.data() + token_buffer.size());\n\n            if (errno == 0)\n            {\n                value_integer = static_cast<number_integer_t>(x);\n                if (value_integer == x)\n                {\n                    return token_type::value_integer;\n                }\n            }\n        }\n\n        // this code is reached if we parse a floating-point number or if an\n        // integer conversion above failed\n        strtof(value_float, token_buffer.data(), &endptr);\n\n        // we checked the number format before\n        JSON_ASSERT(endptr == token_buffer.data() + token_buffer.size());\n\n        return token_type::value_float;\n    }\n\n    /*!\n    @param[in] literal_text  the literal text to expect\n    @param[in] length        the length of the passed literal text\n    @param[in] return_type   the token type to return on success\n    */\n    JSON_HEDLEY_NON_NULL(2)\n    token_type scan_literal(const char_type* literal_text, const std::size_t length,\n                            token_type return_type)\n    {\n        JSON_ASSERT(std::char_traits<char_type>::to_char_type(current) == literal_text[0]);\n        for (std::size_t i = 1; i < length; ++i)\n        {\n            if (JSON_HEDLEY_UNLIKELY(std::char_traits<char_type>::to_char_type(get()) != literal_text[i]))\n            {\n                error_message = \"invalid literal\";\n                return token_type::parse_error;\n            }\n        }\n        return return_type;\n    }\n\n    /////////////////////\n    // input management\n    /////////////////////\n\n    /// reset token_buffer; current character is beginning of token\n    void reset() noexcept\n    {\n        token_buffer.clear();\n        token_string.clear();\n        token_string.push_back(std::char_traits<char_type>::to_char_type(current));\n    }\n\n    /*\n    @brief get next character from the input\n\n    This function provides the interface to the used input adapter. It does\n    not throw in case the input reached EOF, but returns a\n    `std::char_traits<char>::eof()` in that case.  Stores the scanned characters\n    for use in error messages.\n\n    @return character read from the input\n    */\n    char_int_type get()\n    {\n        ++position.chars_read_total;\n        ++position.chars_read_current_line;\n\n        if (next_unget)\n        {\n            // just reset the next_unget variable and work with current\n            next_unget = false;\n        }\n        else\n        {\n            current = ia.get_character();\n        }\n\n        if (JSON_HEDLEY_LIKELY(current != std::char_traits<char_type>::eof()))\n        {\n            token_string.push_back(std::char_traits<char_type>::to_char_type(current));\n        }\n\n        if (current == '\\n')\n        {\n            ++position.lines_read;\n            position.chars_read_current_line = 0;\n        }\n\n        return current;\n    }\n\n    /*!\n    @brief unget current character (read it again on next get)\n\n    We implement unget by setting variable next_unget to true. The input is not\n    changed - we just simulate ungetting by modifying chars_read_total,\n    chars_read_current_line, and token_string. The next call to get() will\n    behave as if the unget character is read again.\n    */\n    void unget()\n    {\n        next_unget = true;\n\n        --position.chars_read_total;\n\n        // in case we \"unget\" a newline, we have to also decrement the lines_read\n        if (position.chars_read_current_line == 0)\n        {\n            if (position.lines_read > 0)\n            {\n                --position.lines_read;\n            }\n        }\n        else\n        {\n            --position.chars_read_current_line;\n        }\n\n        if (JSON_HEDLEY_LIKELY(current != std::char_traits<char_type>::eof()))\n        {\n            JSON_ASSERT(!token_string.empty());\n            token_string.pop_back();\n        }\n    }\n\n    /// add a character to token_buffer\n    void add(char_int_type c)\n    {\n        token_buffer.push_back(static_cast<typename string_t::value_type>(c));\n    }\n\n  public:\n    /////////////////////\n    // value getters\n    /////////////////////\n\n    /// return integer value\n    constexpr number_integer_t get_number_integer() const noexcept\n    {\n        return value_integer;\n    }\n\n    /// return unsigned integer value\n    constexpr number_unsigned_t get_number_unsigned() const noexcept\n    {\n        return value_unsigned;\n    }\n\n    /// return floating-point value\n    constexpr number_float_t get_number_float() const noexcept\n    {\n        return value_float;\n    }\n\n    /// return current string value (implicitly resets the token; useful only once)\n    string_t& get_string()\n    {\n        return token_buffer;\n    }\n\n    /////////////////////\n    // diagnostics\n    /////////////////////\n\n    /// return position of last read token\n    constexpr position_t get_position() const noexcept\n    {\n        return position;\n    }\n\n    /// return the last read token (for errors only).  Will never contain EOF\n    /// (an arbitrary value that is not a valid char value, often -1), because\n    /// 255 may legitimately occur.  May contain NUL, which should be escaped.\n    std::string get_token_string() const\n    {\n        // escape control characters\n        std::string result;\n        for (const auto c : token_string)\n        {\n            if (static_cast<unsigned char>(c) <= '\\x1F')\n            {\n                // escape control characters\n                std::array<char, 9> cs{{}};\n                (std::snprintf)(cs.data(), cs.size(), \"<U+%.4X>\", static_cast<unsigned char>(c));\n                result += cs.data();\n            }\n            else\n            {\n                // add character as is\n                result.push_back(static_cast<std::string::value_type>(c));\n            }\n        }\n\n        return result;\n    }\n\n    /// return syntax error message\n    JSON_HEDLEY_RETURNS_NON_NULL\n    constexpr const char* get_error_message() const noexcept\n    {\n        return error_message;\n    }\n\n    /////////////////////\n    // actual scanner\n    /////////////////////\n\n    /*!\n    @brief skip the UTF-8 byte order mark\n    @return true iff there is no BOM or the correct BOM has been skipped\n    */\n    bool skip_bom()\n    {\n        if (get() == 0xEF)\n        {\n            // check if we completely parse the BOM\n            return get() == 0xBB && get() == 0xBF;\n        }\n\n        // the first character is not the beginning of the BOM; unget it to\n        // process is later\n        unget();\n        return true;\n    }\n\n    void skip_whitespace()\n    {\n        do\n        {\n            get();\n        }\n        while (current == ' ' || current == '\\t' || current == '\\n' || current == '\\r');\n    }\n\n    token_type scan()\n    {\n        // initially, skip the BOM\n        if (position.chars_read_total == 0 && !skip_bom())\n        {\n            error_message = \"invalid BOM; must be 0xEF 0xBB 0xBF if given\";\n            return token_type::parse_error;\n        }\n\n        // read next character and ignore whitespace\n        skip_whitespace();\n\n        // ignore comments\n        while (ignore_comments && current == '/')\n        {\n            if (!scan_comment())\n            {\n                return token_type::parse_error;\n            }\n\n            // skip following whitespace\n            skip_whitespace();\n        }\n\n        switch (current)\n        {\n            // structural characters\n            case '[':\n                return token_type::begin_array;\n            case ']':\n                return token_type::end_array;\n            case '{':\n                return token_type::begin_object;\n            case '}':\n                return token_type::end_object;\n            case ':':\n                return token_type::name_separator;\n            case ',':\n                return token_type::value_separator;\n\n            // literals\n            case 't':\n            {\n                std::array<char_type, 4> true_literal = {{'t', 'r', 'u', 'e'}};\n                return scan_literal(true_literal.data(), true_literal.size(), token_type::literal_true);\n            }\n            case 'f':\n            {\n                std::array<char_type, 5> false_literal = {{'f', 'a', 'l', 's', 'e'}};\n                return scan_literal(false_literal.data(), false_literal.size(), token_type::literal_false);\n            }\n            case 'n':\n            {\n                std::array<char_type, 4> null_literal = {{'n', 'u', 'l', 'l'}};\n                return scan_literal(null_literal.data(), null_literal.size(), token_type::literal_null);\n            }\n\n            // string\n            case '\\\"':\n                return scan_string();\n\n            // number\n            case '-':\n            case '0':\n            case '1':\n            case '2':\n            case '3':\n            case '4':\n            case '5':\n            case '6':\n            case '7':\n            case '8':\n            case '9':\n                return scan_number();\n\n            // end of input (the null byte is needed when parsing from\n            // string literals)\n            case '\\0':\n            case std::char_traits<char_type>::eof():\n                return token_type::end_of_input;\n\n            // error\n            default:\n                error_message = \"invalid literal\";\n                return token_type::parse_error;\n        }\n    }\n\n  private:\n    /// input adapter\n    InputAdapterType ia;\n\n    /// whether comments should be ignored (true) or signaled as errors (false)\n    const bool ignore_comments = false;\n\n    /// the current character\n    char_int_type current = std::char_traits<char_type>::eof();\n\n    /// whether the next get() call should just return current\n    bool next_unget = false;\n\n    /// the start position of the current token\n    position_t position {};\n\n    /// raw input token string (for error messages)\n    std::vector<char_type> token_string {};\n\n    /// buffer for variable-length tokens (numbers, strings)\n    string_t token_buffer {};\n\n    /// a description of occurred lexer errors\n    const char* error_message = \"\";\n\n    // number values\n    number_integer_t value_integer = 0;\n    number_unsigned_t value_unsigned = 0;\n    number_float_t value_float = 0;\n\n    /// the decimal point\n    const char_int_type decimal_point_char = '.';\n};\n}  // namespace detail\n}  // namespace nlohmann\n\n// #include <nlohmann/detail/macro_scope.hpp>\n\n// #include <nlohmann/detail/meta/is_sax.hpp>\n\n\n#include <cstdint> // size_t\n#include <utility> // declval\n#include <string> // string\n\n// #include <nlohmann/detail/meta/detected.hpp>\n\n// #include <nlohmann/detail/meta/type_traits.hpp>\n\n\nnamespace nlohmann\n{\nnamespace detail\n{\ntemplate<typename T>\nusing null_function_t = decltype(std::declval<T&>().null());\n\ntemplate<typename T>\nusing boolean_function_t =\n    decltype(std::declval<T&>().boolean(std::declval<bool>()));\n\ntemplate<typename T, typename Integer>\nusing number_integer_function_t =\n    decltype(std::declval<T&>().number_integer(std::declval<Integer>()));\n\ntemplate<typename T, typename Unsigned>\nusing number_unsigned_function_t =\n    decltype(std::declval<T&>().number_unsigned(std::declval<Unsigned>()));\n\ntemplate<typename T, typename Float, typename String>\nusing number_float_function_t = decltype(std::declval<T&>().number_float(\n                                    std::declval<Float>(), std::declval<const String&>()));\n\ntemplate<typename T, typename String>\nusing string_function_t =\n    decltype(std::declval<T&>().string(std::declval<String&>()));\n\ntemplate<typename T, typename Binary>\nusing binary_function_t =\n    decltype(std::declval<T&>().binary(std::declval<Binary&>()));\n\ntemplate<typename T>\nusing start_object_function_t =\n    decltype(std::declval<T&>().start_object(std::declval<std::size_t>()));\n\ntemplate<typename T, typename String>\nusing key_function_t =\n    decltype(std::declval<T&>().key(std::declval<String&>()));\n\ntemplate<typename T>\nusing end_object_function_t = decltype(std::declval<T&>().end_object());\n\ntemplate<typename T>\nusing start_array_function_t =\n    decltype(std::declval<T&>().start_array(std::declval<std::size_t>()));\n\ntemplate<typename T>\nusing end_array_function_t = decltype(std::declval<T&>().end_array());\n\ntemplate<typename T, typename Exception>\nusing parse_error_function_t = decltype(std::declval<T&>().parse_error(\n        std::declval<std::size_t>(), std::declval<const std::string&>(),\n        std::declval<const Exception&>()));\n\ntemplate<typename SAX, typename BasicJsonType>\nstruct is_sax\n{\n  private:\n    static_assert(is_basic_json<BasicJsonType>::value,\n                  \"BasicJsonType must be of type basic_json<...>\");\n\n    using number_integer_t = typename BasicJsonType::number_integer_t;\n    using number_unsigned_t = typename BasicJsonType::number_unsigned_t;\n    using number_float_t = typename BasicJsonType::number_float_t;\n    using string_t = typename BasicJsonType::string_t;\n    using binary_t = typename BasicJsonType::binary_t;\n    using exception_t = typename BasicJsonType::exception;\n\n  public:\n    static constexpr bool value =\n        is_detected_exact<bool, null_function_t, SAX>::value &&\n        is_detected_exact<bool, boolean_function_t, SAX>::value &&\n        is_detected_exact<bool, number_integer_function_t, SAX, number_integer_t>::value &&\n        is_detected_exact<bool, number_unsigned_function_t, SAX, number_unsigned_t>::value &&\n        is_detected_exact<bool, number_float_function_t, SAX, number_float_t, string_t>::value &&\n        is_detected_exact<bool, string_function_t, SAX, string_t>::value &&\n        is_detected_exact<bool, binary_function_t, SAX, binary_t>::value &&\n        is_detected_exact<bool, start_object_function_t, SAX>::value &&\n        is_detected_exact<bool, key_function_t, SAX, string_t>::value &&\n        is_detected_exact<bool, end_object_function_t, SAX>::value &&\n        is_detected_exact<bool, start_array_function_t, SAX>::value &&\n        is_detected_exact<bool, end_array_function_t, SAX>::value &&\n        is_detected_exact<bool, parse_error_function_t, SAX, exception_t>::value;\n};\n\ntemplate<typename SAX, typename BasicJsonType>\nstruct is_sax_static_asserts\n{\n  private:\n    static_assert(is_basic_json<BasicJsonType>::value,\n                  \"BasicJsonType must be of type basic_json<...>\");\n\n    using number_integer_t = typename BasicJsonType::number_integer_t;\n    using number_unsigned_t = typename BasicJsonType::number_unsigned_t;\n    using number_float_t = typename BasicJsonType::number_float_t;\n    using string_t = typename BasicJsonType::string_t;\n    using binary_t = typename BasicJsonType::binary_t;\n    using exception_t = typename BasicJsonType::exception;\n\n  public:\n    static_assert(is_detected_exact<bool, null_function_t, SAX>::value,\n                  \"Missing/invalid function: bool null()\");\n    static_assert(is_detected_exact<bool, boolean_function_t, SAX>::value,\n                  \"Missing/invalid function: bool boolean(bool)\");\n    static_assert(is_detected_exact<bool, boolean_function_t, SAX>::value,\n                  \"Missing/invalid function: bool boolean(bool)\");\n    static_assert(\n        is_detected_exact<bool, number_integer_function_t, SAX,\n        number_integer_t>::value,\n        \"Missing/invalid function: bool number_integer(number_integer_t)\");\n    static_assert(\n        is_detected_exact<bool, number_unsigned_function_t, SAX,\n        number_unsigned_t>::value,\n        \"Missing/invalid function: bool number_unsigned(number_unsigned_t)\");\n    static_assert(is_detected_exact<bool, number_float_function_t, SAX,\n                  number_float_t, string_t>::value,\n                  \"Missing/invalid function: bool number_float(number_float_t, const string_t&)\");\n    static_assert(\n        is_detected_exact<bool, string_function_t, SAX, string_t>::value,\n        \"Missing/invalid function: bool string(string_t&)\");\n    static_assert(\n        is_detected_exact<bool, binary_function_t, SAX, binary_t>::value,\n        \"Missing/invalid function: bool binary(binary_t&)\");\n    static_assert(is_detected_exact<bool, start_object_function_t, SAX>::value,\n                  \"Missing/invalid function: bool start_object(std::size_t)\");\n    static_assert(is_detected_exact<bool, key_function_t, SAX, string_t>::value,\n                  \"Missing/invalid function: bool key(string_t&)\");\n    static_assert(is_detected_exact<bool, end_object_function_t, SAX>::value,\n                  \"Missing/invalid function: bool end_object()\");\n    static_assert(is_detected_exact<bool, start_array_function_t, SAX>::value,\n                  \"Missing/invalid function: bool start_array(std::size_t)\");\n    static_assert(is_detected_exact<bool, end_array_function_t, SAX>::value,\n                  \"Missing/invalid function: bool end_array()\");\n    static_assert(\n        is_detected_exact<bool, parse_error_function_t, SAX, exception_t>::value,\n        \"Missing/invalid function: bool parse_error(std::size_t, const \"\n        \"std::string&, const exception&)\");\n};\n}  // namespace detail\n}  // namespace nlohmann\n\n// #include <nlohmann/detail/value_t.hpp>\n\n\nnamespace nlohmann\n{\nnamespace detail\n{\n\n/// how to treat CBOR tags\nenum class cbor_tag_handler_t\n{\n    error,  ///< throw a parse_error exception in case of a tag\n    ignore   ///< ignore tags\n};\n\n/*!\n@brief determine system byte order\n\n@return true if and only if system's byte order is little endian\n\n@note from https://stackoverflow.com/a/1001328/266378\n*/\nstatic inline bool little_endianess(int num = 1) noexcept\n{\n    return *reinterpret_cast<char*>(&num) == 1;\n}\n\n\n///////////////////\n// binary reader //\n///////////////////\n\n/*!\n@brief deserialization of CBOR, MessagePack, and UBJSON values\n*/\ntemplate<typename BasicJsonType, typename InputAdapterType, typename SAX = json_sax_dom_parser<BasicJsonType>>\nclass binary_reader\n{\n    using number_integer_t = typename BasicJsonType::number_integer_t;\n    using number_unsigned_t = typename BasicJsonType::number_unsigned_t;\n    using number_float_t = typename BasicJsonType::number_float_t;\n    using string_t = typename BasicJsonType::string_t;\n    using binary_t = typename BasicJsonType::binary_t;\n    using json_sax_t = SAX;\n    using char_type = typename InputAdapterType::char_type;\n    using char_int_type = typename std::char_traits<char_type>::int_type;\n\n  public:\n    /*!\n    @brief create a binary reader\n\n    @param[in] adapter  input adapter to read from\n    */\n    explicit binary_reader(InputAdapterType&& adapter) : ia(std::move(adapter))\n    {\n        (void)detail::is_sax_static_asserts<SAX, BasicJsonType> {};\n    }\n\n    // make class move-only\n    binary_reader(const binary_reader&) = delete;\n    binary_reader(binary_reader&&) = default;\n    binary_reader& operator=(const binary_reader&) = delete;\n    binary_reader& operator=(binary_reader&&) = default;\n    ~binary_reader() = default;\n\n    /*!\n    @param[in] format  the binary format to parse\n    @param[in] sax_    a SAX event processor\n    @param[in] strict  whether to expect the input to be consumed completed\n    @param[in] tag_handler  how to treat CBOR tags\n\n    @return\n    */\n    JSON_HEDLEY_NON_NULL(3)\n    bool sax_parse(const input_format_t format,\n                   json_sax_t* sax_,\n                   const bool strict = true,\n                   const cbor_tag_handler_t tag_handler = cbor_tag_handler_t::error)\n    {\n        sax = sax_;\n        bool result = false;\n\n        switch (format)\n        {\n            case input_format_t::bson:\n                result = parse_bson_internal();\n                break;\n\n            case input_format_t::cbor:\n                result = parse_cbor_internal(true, tag_handler);\n                break;\n\n            case input_format_t::msgpack:\n                result = parse_msgpack_internal();\n                break;\n\n            case input_format_t::ubjson:\n                result = parse_ubjson_internal();\n                break;\n\n            default:            // LCOV_EXCL_LINE\n                JSON_ASSERT(false);  // LCOV_EXCL_LINE\n        }\n\n        // strict mode: next byte must be EOF\n        if (result && strict)\n        {\n            if (format == input_format_t::ubjson)\n            {\n                get_ignore_noop();\n            }\n            else\n            {\n                get();\n            }\n\n            if (JSON_HEDLEY_UNLIKELY(current != std::char_traits<char_type>::eof()))\n            {\n                return sax->parse_error(chars_read, get_token_string(),\n                                        parse_error::create(110, chars_read, exception_message(format, \"expected end of input; last byte: 0x\" + get_token_string(), \"value\")));\n            }\n        }\n\n        return result;\n    }\n\n  private:\n    //////////\n    // BSON //\n    //////////\n\n    /*!\n    @brief Reads in a BSON-object and passes it to the SAX-parser.\n    @return whether a valid BSON-value was passed to the SAX parser\n    */\n    bool parse_bson_internal()\n    {\n        std::int32_t document_size{};\n        get_number<std::int32_t, true>(input_format_t::bson, document_size);\n\n        if (JSON_HEDLEY_UNLIKELY(!sax->start_object(std::size_t(-1))))\n        {\n            return false;\n        }\n\n        if (JSON_HEDLEY_UNLIKELY(!parse_bson_element_list(/*is_array*/false)))\n        {\n            return false;\n        }\n\n        return sax->end_object();\n    }\n\n    /*!\n    @brief Parses a C-style string from the BSON input.\n    @param[in, out] result  A reference to the string variable where the read\n                            string is to be stored.\n    @return `true` if the \\x00-byte indicating the end of the string was\n             encountered before the EOF; false` indicates an unexpected EOF.\n    */\n    bool get_bson_cstr(string_t& result)\n    {\n        auto out = std::back_inserter(result);\n        while (true)\n        {\n            get();\n            if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::bson, \"cstring\")))\n            {\n                return false;\n            }\n            if (current == 0x00)\n            {\n                return true;\n            }\n            *out++ = static_cast<typename string_t::value_type>(current);\n        }\n    }\n\n    /*!\n    @brief Parses a zero-terminated string of length @a len from the BSON\n           input.\n    @param[in] len  The length (including the zero-byte at the end) of the\n                    string to be read.\n    @param[in, out] result  A reference to the string variable where the read\n                            string is to be stored.\n    @tparam NumberType The type of the length @a len\n    @pre len >= 1\n    @return `true` if the string was successfully parsed\n    */\n    template<typename NumberType>\n    bool get_bson_string(const NumberType len, string_t& result)\n    {\n        if (JSON_HEDLEY_UNLIKELY(len < 1))\n        {\n            auto last_token = get_token_string();\n            return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format_t::bson, \"string length must be at least 1, is \" + std::to_string(len), \"string\")));\n        }\n\n        return get_string(input_format_t::bson, len - static_cast<NumberType>(1), result) && get() != std::char_traits<char_type>::eof();\n    }\n\n    /*!\n    @brief Parses a byte array input of length @a len from the BSON input.\n    @param[in] len  The length of the byte array to be read.\n    @param[in, out] result  A reference to the binary variable where the read\n                            array is to be stored.\n    @tparam NumberType The type of the length @a len\n    @pre len >= 0\n    @return `true` if the byte array was successfully parsed\n    */\n    template<typename NumberType>\n    bool get_bson_binary(const NumberType len, binary_t& result)\n    {\n        if (JSON_HEDLEY_UNLIKELY(len < 0))\n        {\n            auto last_token = get_token_string();\n            return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format_t::bson, \"byte array length cannot be negative, is \" + std::to_string(len), \"binary\")));\n        }\n\n        // All BSON binary values have a subtype\n        std::uint8_t subtype{};\n        get_number<std::uint8_t>(input_format_t::bson, subtype);\n        result.set_subtype(subtype);\n\n        return get_binary(input_format_t::bson, len, result);\n    }\n\n    /*!\n    @brief Read a BSON document element of the given @a element_type.\n    @param[in] element_type The BSON element type, c.f. http://bsonspec.org/spec.html\n    @param[in] element_type_parse_position The position in the input stream,\n               where the `element_type` was read.\n    @warning Not all BSON element types are supported yet. An unsupported\n             @a element_type will give rise to a parse_error.114:\n             Unsupported BSON record type 0x...\n    @return whether a valid BSON-object/array was passed to the SAX parser\n    */\n    bool parse_bson_element_internal(const char_int_type element_type,\n                                     const std::size_t element_type_parse_position)\n    {\n        switch (element_type)\n        {\n            case 0x01: // double\n            {\n                double number{};\n                return get_number<double, true>(input_format_t::bson, number) && sax->number_float(static_cast<number_float_t>(number), \"\");\n            }\n\n            case 0x02: // string\n            {\n                std::int32_t len{};\n                string_t value;\n                return get_number<std::int32_t, true>(input_format_t::bson, len) && get_bson_string(len, value) && sax->string(value);\n            }\n\n            case 0x03: // object\n            {\n                return parse_bson_internal();\n            }\n\n            case 0x04: // array\n            {\n                return parse_bson_array();\n            }\n\n            case 0x05: // binary\n            {\n                std::int32_t len{};\n                binary_t value;\n                return get_number<std::int32_t, true>(input_format_t::bson, len) && get_bson_binary(len, value) && sax->binary(value);\n            }\n\n            case 0x08: // boolean\n            {\n                return sax->boolean(get() != 0);\n            }\n\n            case 0x0A: // null\n            {\n                return sax->null();\n            }\n\n            case 0x10: // int32\n            {\n                std::int32_t value{};\n                return get_number<std::int32_t, true>(input_format_t::bson, value) && sax->number_integer(value);\n            }\n\n            case 0x12: // int64\n            {\n                std::int64_t value{};\n                return get_number<std::int64_t, true>(input_format_t::bson, value) && sax->number_integer(value);\n            }\n\n            default: // anything else not supported (yet)\n            {\n                std::array<char, 3> cr{{}};\n                (std::snprintf)(cr.data(), cr.size(), \"%.2hhX\", static_cast<unsigned char>(element_type));\n                return sax->parse_error(element_type_parse_position, std::string(cr.data()), parse_error::create(114, element_type_parse_position, \"Unsupported BSON record type 0x\" + std::string(cr.data())));\n            }\n        }\n    }\n\n    /*!\n    @brief Read a BSON element list (as specified in the BSON-spec)\n\n    The same binary layout is used for objects and arrays, hence it must be\n    indicated with the argument @a is_array which one is expected\n    (true --> array, false --> object).\n\n    @param[in] is_array Determines if the element list being read is to be\n                        treated as an object (@a is_array == false), or as an\n                        array (@a is_array == true).\n    @return whether a valid BSON-object/array was passed to the SAX parser\n    */\n    bool parse_bson_element_list(const bool is_array)\n    {\n        string_t key;\n\n        while (auto element_type = get())\n        {\n            if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::bson, \"element list\")))\n            {\n                return false;\n            }\n\n            const std::size_t element_type_parse_position = chars_read;\n            if (JSON_HEDLEY_UNLIKELY(!get_bson_cstr(key)))\n            {\n                return false;\n            }\n\n            if (!is_array && !sax->key(key))\n            {\n                return false;\n            }\n\n            if (JSON_HEDLEY_UNLIKELY(!parse_bson_element_internal(element_type, element_type_parse_position)))\n            {\n                return false;\n            }\n\n            // get_bson_cstr only appends\n            key.clear();\n        }\n\n        return true;\n    }\n\n    /*!\n    @brief Reads an array from the BSON input and passes it to the SAX-parser.\n    @return whether a valid BSON-array was passed to the SAX parser\n    */\n    bool parse_bson_array()\n    {\n        std::int32_t document_size{};\n        get_number<std::int32_t, true>(input_format_t::bson, document_size);\n\n        if (JSON_HEDLEY_UNLIKELY(!sax->start_array(std::size_t(-1))))\n        {\n            return false;\n        }\n\n        if (JSON_HEDLEY_UNLIKELY(!parse_bson_element_list(/*is_array*/true)))\n        {\n            return false;\n        }\n\n        return sax->end_array();\n    }\n\n    //////////\n    // CBOR //\n    //////////\n\n    /*!\n    @param[in] get_char  whether a new character should be retrieved from the\n                         input (true) or whether the last read character should\n                         be considered instead (false)\n    @param[in] tag_handler how CBOR tags should be treated\n\n    @return whether a valid CBOR value was passed to the SAX parser\n    */\n    bool parse_cbor_internal(const bool get_char,\n                             const cbor_tag_handler_t tag_handler)\n    {\n        switch (get_char ? get() : current)\n        {\n            // EOF\n            case std::char_traits<char_type>::eof():\n                return unexpect_eof(input_format_t::cbor, \"value\");\n\n            // Integer 0x00..0x17 (0..23)\n            case 0x00:\n            case 0x01:\n            case 0x02:\n            case 0x03:\n            case 0x04:\n            case 0x05:\n            case 0x06:\n            case 0x07:\n            case 0x08:\n            case 0x09:\n            case 0x0A:\n            case 0x0B:\n            case 0x0C:\n            case 0x0D:\n            case 0x0E:\n            case 0x0F:\n            case 0x10:\n            case 0x11:\n            case 0x12:\n            case 0x13:\n            case 0x14:\n            case 0x15:\n            case 0x16:\n            case 0x17:\n                return sax->number_unsigned(static_cast<number_unsigned_t>(current));\n\n            case 0x18: // Unsigned integer (one-byte uint8_t follows)\n            {\n                std::uint8_t number{};\n                return get_number(input_format_t::cbor, number) && sax->number_unsigned(number);\n            }\n\n            case 0x19: // Unsigned integer (two-byte uint16_t follows)\n            {\n                std::uint16_t number{};\n                return get_number(input_format_t::cbor, number) && sax->number_unsigned(number);\n            }\n\n            case 0x1A: // Unsigned integer (four-byte uint32_t follows)\n            {\n                std::uint32_t number{};\n                return get_number(input_format_t::cbor, number) && sax->number_unsigned(number);\n            }\n\n            case 0x1B: // Unsigned integer (eight-byte uint64_t follows)\n            {\n                std::uint64_t number{};\n                return get_number(input_format_t::cbor, number) && sax->number_unsigned(number);\n            }\n\n            // Negative integer -1-0x00..-1-0x17 (-1..-24)\n            case 0x20:\n            case 0x21:\n            case 0x22:\n            case 0x23:\n            case 0x24:\n            case 0x25:\n            case 0x26:\n            case 0x27:\n            case 0x28:\n            case 0x29:\n            case 0x2A:\n            case 0x2B:\n            case 0x2C:\n            case 0x2D:\n            case 0x2E:\n            case 0x2F:\n            case 0x30:\n            case 0x31:\n            case 0x32:\n            case 0x33:\n            case 0x34:\n            case 0x35:\n            case 0x36:\n            case 0x37:\n                return sax->number_integer(static_cast<std::int8_t>(0x20 - 1 - current));\n\n            case 0x38: // Negative integer (one-byte uint8_t follows)\n            {\n                std::uint8_t number{};\n                return get_number(input_format_t::cbor, number) && sax->number_integer(static_cast<number_integer_t>(-1) - number);\n            }\n\n            case 0x39: // Negative integer -1-n (two-byte uint16_t follows)\n            {\n                std::uint16_t number{};\n                return get_number(input_format_t::cbor, number) && sax->number_integer(static_cast<number_integer_t>(-1) - number);\n            }\n\n            case 0x3A: // Negative integer -1-n (four-byte uint32_t follows)\n            {\n                std::uint32_t number{};\n                return get_number(input_format_t::cbor, number) && sax->number_integer(static_cast<number_integer_t>(-1) - number);\n            }\n\n            case 0x3B: // Negative integer -1-n (eight-byte uint64_t follows)\n            {\n                std::uint64_t number{};\n                return get_number(input_format_t::cbor, number) && sax->number_integer(static_cast<number_integer_t>(-1)\n                        - static_cast<number_integer_t>(number));\n            }\n\n            // Binary data (0x00..0x17 bytes follow)\n            case 0x40:\n            case 0x41:\n            case 0x42:\n            case 0x43:\n            case 0x44:\n            case 0x45:\n            case 0x46:\n            case 0x47:\n            case 0x48:\n            case 0x49:\n            case 0x4A:\n            case 0x4B:\n            case 0x4C:\n            case 0x4D:\n            case 0x4E:\n            case 0x4F:\n            case 0x50:\n            case 0x51:\n            case 0x52:\n            case 0x53:\n            case 0x54:\n            case 0x55:\n            case 0x56:\n            case 0x57:\n            case 0x58: // Binary data (one-byte uint8_t for n follows)\n            case 0x59: // Binary data (two-byte uint16_t for n follow)\n            case 0x5A: // Binary data (four-byte uint32_t for n follow)\n            case 0x5B: // Binary data (eight-byte uint64_t for n follow)\n            case 0x5F: // Binary data (indefinite length)\n            {\n                binary_t b;\n                return get_cbor_binary(b) && sax->binary(b);\n            }\n\n            // UTF-8 string (0x00..0x17 bytes follow)\n            case 0x60:\n            case 0x61:\n            case 0x62:\n            case 0x63:\n            case 0x64:\n            case 0x65:\n            case 0x66:\n            case 0x67:\n            case 0x68:\n            case 0x69:\n            case 0x6A:\n            case 0x6B:\n            case 0x6C:\n            case 0x6D:\n            case 0x6E:\n            case 0x6F:\n            case 0x70:\n            case 0x71:\n            case 0x72:\n            case 0x73:\n            case 0x74:\n            case 0x75:\n            case 0x76:\n            case 0x77:\n            case 0x78: // UTF-8 string (one-byte uint8_t for n follows)\n            case 0x79: // UTF-8 string (two-byte uint16_t for n follow)\n            case 0x7A: // UTF-8 string (four-byte uint32_t for n follow)\n            case 0x7B: // UTF-8 string (eight-byte uint64_t for n follow)\n            case 0x7F: // UTF-8 string (indefinite length)\n            {\n                string_t s;\n                return get_cbor_string(s) && sax->string(s);\n            }\n\n            // array (0x00..0x17 data items follow)\n            case 0x80:\n            case 0x81:\n            case 0x82:\n            case 0x83:\n            case 0x84:\n            case 0x85:\n            case 0x86:\n            case 0x87:\n            case 0x88:\n            case 0x89:\n            case 0x8A:\n            case 0x8B:\n            case 0x8C:\n            case 0x8D:\n            case 0x8E:\n            case 0x8F:\n            case 0x90:\n            case 0x91:\n            case 0x92:\n            case 0x93:\n            case 0x94:\n            case 0x95:\n            case 0x96:\n            case 0x97:\n                return get_cbor_array(static_cast<std::size_t>(static_cast<unsigned int>(current) & 0x1Fu), tag_handler);\n\n            case 0x98: // array (one-byte uint8_t for n follows)\n            {\n                std::uint8_t len{};\n                return get_number(input_format_t::cbor, len) && get_cbor_array(static_cast<std::size_t>(len), tag_handler);\n            }\n\n            case 0x99: // array (two-byte uint16_t for n follow)\n            {\n                std::uint16_t len{};\n                return get_number(input_format_t::cbor, len) && get_cbor_array(static_cast<std::size_t>(len), tag_handler);\n            }\n\n            case 0x9A: // array (four-byte uint32_t for n follow)\n            {\n                std::uint32_t len{};\n                return get_number(input_format_t::cbor, len) && get_cbor_array(static_cast<std::size_t>(len), tag_handler);\n            }\n\n            case 0x9B: // array (eight-byte uint64_t for n follow)\n            {\n                std::uint64_t len{};\n                return get_number(input_format_t::cbor, len) && get_cbor_array(static_cast<std::size_t>(len), tag_handler);\n            }\n\n            case 0x9F: // array (indefinite length)\n                return get_cbor_array(std::size_t(-1), tag_handler);\n\n            // map (0x00..0x17 pairs of data items follow)\n            case 0xA0:\n            case 0xA1:\n            case 0xA2:\n            case 0xA3:\n            case 0xA4:\n            case 0xA5:\n            case 0xA6:\n            case 0xA7:\n            case 0xA8:\n            case 0xA9:\n            case 0xAA:\n            case 0xAB:\n            case 0xAC:\n            case 0xAD:\n            case 0xAE:\n            case 0xAF:\n            case 0xB0:\n            case 0xB1:\n            case 0xB2:\n            case 0xB3:\n            case 0xB4:\n            case 0xB5:\n            case 0xB6:\n            case 0xB7:\n                return get_cbor_object(static_cast<std::size_t>(static_cast<unsigned int>(current) & 0x1Fu), tag_handler);\n\n            case 0xB8: // map (one-byte uint8_t for n follows)\n            {\n                std::uint8_t len{};\n                return get_number(input_format_t::cbor, len) && get_cbor_object(static_cast<std::size_t>(len), tag_handler);\n            }\n\n            case 0xB9: // map (two-byte uint16_t for n follow)\n            {\n                std::uint16_t len{};\n                return get_number(input_format_t::cbor, len) && get_cbor_object(static_cast<std::size_t>(len), tag_handler);\n            }\n\n            case 0xBA: // map (four-byte uint32_t for n follow)\n            {\n                std::uint32_t len{};\n                return get_number(input_format_t::cbor, len) && get_cbor_object(static_cast<std::size_t>(len), tag_handler);\n            }\n\n            case 0xBB: // map (eight-byte uint64_t for n follow)\n            {\n                std::uint64_t len{};\n                return get_number(input_format_t::cbor, len) && get_cbor_object(static_cast<std::size_t>(len), tag_handler);\n            }\n\n            case 0xBF: // map (indefinite length)\n                return get_cbor_object(std::size_t(-1), tag_handler);\n\n            case 0xC6: // tagged item\n            case 0xC7:\n            case 0xC8:\n            case 0xC9:\n            case 0xCA:\n            case 0xCB:\n            case 0xCC:\n            case 0xCD:\n            case 0xCE:\n            case 0xCF:\n            case 0xD0:\n            case 0xD1:\n            case 0xD2:\n            case 0xD3:\n            case 0xD4:\n            case 0xD8: // tagged item (1 bytes follow)\n            case 0xD9: // tagged item (2 bytes follow)\n            case 0xDA: // tagged item (4 bytes follow)\n            case 0xDB: // tagged item (8 bytes follow)\n            {\n                switch (tag_handler)\n                {\n                    case cbor_tag_handler_t::error:\n                    {\n                        auto last_token = get_token_string();\n                        return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format_t::cbor, \"invalid byte: 0x\" + last_token, \"value\")));\n                    }\n\n                    case cbor_tag_handler_t::ignore:\n                    {\n                        switch (current)\n                        {\n                            case 0xD8:\n                            {\n                                std::uint8_t len{};\n                                get_number(input_format_t::cbor, len);\n                                break;\n                            }\n                            case 0xD9:\n                            {\n                                std::uint16_t len{};\n                                get_number(input_format_t::cbor, len);\n                                break;\n                            }\n                            case 0xDA:\n                            {\n                                std::uint32_t len{};\n                                get_number(input_format_t::cbor, len);\n                                break;\n                            }\n                            case 0xDB:\n                            {\n                                std::uint64_t len{};\n                                get_number(input_format_t::cbor, len);\n                                break;\n                            }\n                            default:\n                                break;\n                        }\n                        return parse_cbor_internal(true, tag_handler);\n                    }\n\n                    default:                 // LCOV_EXCL_LINE\n                        JSON_ASSERT(false);  // LCOV_EXCL_LINE\n                        return false;        // LCOV_EXCL_LINE\n                }\n            }\n\n            case 0xF4: // false\n                return sax->boolean(false);\n\n            case 0xF5: // true\n                return sax->boolean(true);\n\n            case 0xF6: // null\n                return sax->null();\n\n            case 0xF9: // Half-Precision Float (two-byte IEEE 754)\n            {\n                const auto byte1_raw = get();\n                if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::cbor, \"number\")))\n                {\n                    return false;\n                }\n                const auto byte2_raw = get();\n                if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::cbor, \"number\")))\n                {\n                    return false;\n                }\n\n                const auto byte1 = static_cast<unsigned char>(byte1_raw);\n                const auto byte2 = static_cast<unsigned char>(byte2_raw);\n\n                // code from RFC 7049, Appendix D, Figure 3:\n                // As half-precision floating-point numbers were only added\n                // to IEEE 754 in 2008, today's programming platforms often\n                // still only have limited support for them. It is very\n                // easy to include at least decoding support for them even\n                // without such support. An example of a small decoder for\n                // half-precision floating-point numbers in the C language\n                // is shown in Fig. 3.\n                const auto half = static_cast<unsigned int>((byte1 << 8u) + byte2);\n                const double val = [&half]\n                {\n                    const int exp = (half >> 10u) & 0x1Fu;\n                    const unsigned int mant = half & 0x3FFu;\n                    JSON_ASSERT(0 <= exp&& exp <= 32);\n                    JSON_ASSERT(mant <= 1024);\n                    switch (exp)\n                    {\n                        case 0:\n                            return std::ldexp(mant, -24);\n                        case 31:\n                            return (mant == 0)\n                            ? std::numeric_limits<double>::infinity()\n                            : std::numeric_limits<double>::quiet_NaN();\n                        default:\n                            return std::ldexp(mant + 1024, exp - 25);\n                    }\n                }();\n                return sax->number_float((half & 0x8000u) != 0\n                                         ? static_cast<number_float_t>(-val)\n                                         : static_cast<number_float_t>(val), \"\");\n            }\n\n            case 0xFA: // Single-Precision Float (four-byte IEEE 754)\n            {\n                float number{};\n                return get_number(input_format_t::cbor, number) && sax->number_float(static_cast<number_float_t>(number), \"\");\n            }\n\n            case 0xFB: // Double-Precision Float (eight-byte IEEE 754)\n            {\n                double number{};\n                return get_number(input_format_t::cbor, number) && sax->number_float(static_cast<number_float_t>(number), \"\");\n            }\n\n            default: // anything else (0xFF is handled inside the other types)\n            {\n                auto last_token = get_token_string();\n                return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format_t::cbor, \"invalid byte: 0x\" + last_token, \"value\")));\n            }\n        }\n    }\n\n    /*!\n    @brief reads a CBOR string\n\n    This function first reads starting bytes to determine the expected\n    string length and then copies this number of bytes into a string.\n    Additionally, CBOR's strings with indefinite lengths are supported.\n\n    @param[out] result  created string\n\n    @return whether string creation completed\n    */\n    bool get_cbor_string(string_t& result)\n    {\n        if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::cbor, \"string\")))\n        {\n            return false;\n        }\n\n        switch (current)\n        {\n            // UTF-8 string (0x00..0x17 bytes follow)\n            case 0x60:\n            case 0x61:\n            case 0x62:\n            case 0x63:\n            case 0x64:\n            case 0x65:\n            case 0x66:\n            case 0x67:\n            case 0x68:\n            case 0x69:\n            case 0x6A:\n            case 0x6B:\n            case 0x6C:\n            case 0x6D:\n            case 0x6E:\n            case 0x6F:\n            case 0x70:\n            case 0x71:\n            case 0x72:\n            case 0x73:\n            case 0x74:\n            case 0x75:\n            case 0x76:\n            case 0x77:\n            {\n                return get_string(input_format_t::cbor, static_cast<unsigned int>(current) & 0x1Fu, result);\n            }\n\n            case 0x78: // UTF-8 string (one-byte uint8_t for n follows)\n            {\n                std::uint8_t len{};\n                return get_number(input_format_t::cbor, len) && get_string(input_format_t::cbor, len, result);\n            }\n\n            case 0x79: // UTF-8 string (two-byte uint16_t for n follow)\n            {\n                std::uint16_t len{};\n                return get_number(input_format_t::cbor, len) && get_string(input_format_t::cbor, len, result);\n            }\n\n            case 0x7A: // UTF-8 string (four-byte uint32_t for n follow)\n            {\n                std::uint32_t len{};\n                return get_number(input_format_t::cbor, len) && get_string(input_format_t::cbor, len, result);\n            }\n\n            case 0x7B: // UTF-8 string (eight-byte uint64_t for n follow)\n            {\n                std::uint64_t len{};\n                return get_number(input_format_t::cbor, len) && get_string(input_format_t::cbor, len, result);\n            }\n\n            case 0x7F: // UTF-8 string (indefinite length)\n            {\n                while (get() != 0xFF)\n                {\n                    string_t chunk;\n                    if (!get_cbor_string(chunk))\n                    {\n                        return false;\n                    }\n                    result.append(chunk);\n                }\n                return true;\n            }\n\n            default:\n            {\n                auto last_token = get_token_string();\n                return sax->parse_error(chars_read, last_token, parse_error::create(113, chars_read, exception_message(input_format_t::cbor, \"expected length specification (0x60-0x7B) or indefinite string type (0x7F); last byte: 0x\" + last_token, \"string\")));\n            }\n        }\n    }\n\n    /*!\n    @brief reads a CBOR byte array\n\n    This function first reads starting bytes to determine the expected\n    byte array length and then copies this number of bytes into the byte array.\n    Additionally, CBOR's byte arrays with indefinite lengths are supported.\n\n    @param[out] result  created byte array\n\n    @return whether byte array creation completed\n    */\n    bool get_cbor_binary(binary_t& result)\n    {\n        if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::cbor, \"binary\")))\n        {\n            return false;\n        }\n\n        switch (current)\n        {\n            // Binary data (0x00..0x17 bytes follow)\n            case 0x40:\n            case 0x41:\n            case 0x42:\n            case 0x43:\n            case 0x44:\n            case 0x45:\n            case 0x46:\n            case 0x47:\n            case 0x48:\n            case 0x49:\n            case 0x4A:\n            case 0x4B:\n            case 0x4C:\n            case 0x4D:\n            case 0x4E:\n            case 0x4F:\n            case 0x50:\n            case 0x51:\n            case 0x52:\n            case 0x53:\n            case 0x54:\n            case 0x55:\n            case 0x56:\n            case 0x57:\n            {\n                return get_binary(input_format_t::cbor, static_cast<unsigned int>(current) & 0x1Fu, result);\n            }\n\n            case 0x58: // Binary data (one-byte uint8_t for n follows)\n            {\n                std::uint8_t len{};\n                return get_number(input_format_t::cbor, len) &&\n                       get_binary(input_format_t::cbor, len, result);\n            }\n\n            case 0x59: // Binary data (two-byte uint16_t for n follow)\n            {\n                std::uint16_t len{};\n                return get_number(input_format_t::cbor, len) &&\n                       get_binary(input_format_t::cbor, len, result);\n            }\n\n            case 0x5A: // Binary data (four-byte uint32_t for n follow)\n            {\n                std::uint32_t len{};\n                return get_number(input_format_t::cbor, len) &&\n                       get_binary(input_format_t::cbor, len, result);\n            }\n\n            case 0x5B: // Binary data (eight-byte uint64_t for n follow)\n            {\n                std::uint64_t len{};\n                return get_number(input_format_t::cbor, len) &&\n                       get_binary(input_format_t::cbor, len, result);\n            }\n\n            case 0x5F: // Binary data (indefinite length)\n            {\n                while (get() != 0xFF)\n                {\n                    binary_t chunk;\n                    if (!get_cbor_binary(chunk))\n                    {\n                        return false;\n                    }\n                    result.insert(result.end(), chunk.begin(), chunk.end());\n                }\n                return true;\n            }\n\n            default:\n            {\n                auto last_token = get_token_string();\n                return sax->parse_error(chars_read, last_token, parse_error::create(113, chars_read, exception_message(input_format_t::cbor, \"expected length specification (0x40-0x5B) or indefinite binary array type (0x5F); last byte: 0x\" + last_token, \"binary\")));\n            }\n        }\n    }\n\n    /*!\n    @param[in] len  the length of the array or std::size_t(-1) for an\n                    array of indefinite size\n    @param[in] tag_handler how CBOR tags should be treated\n    @return whether array creation completed\n    */\n    bool get_cbor_array(const std::size_t len,\n                        const cbor_tag_handler_t tag_handler)\n    {\n        if (JSON_HEDLEY_UNLIKELY(!sax->start_array(len)))\n        {\n            return false;\n        }\n\n        if (len != std::size_t(-1))\n        {\n            for (std::size_t i = 0; i < len; ++i)\n            {\n                if (JSON_HEDLEY_UNLIKELY(!parse_cbor_internal(true, tag_handler)))\n                {\n                    return false;\n                }\n            }\n        }\n        else\n        {\n            while (get() != 0xFF)\n            {\n                if (JSON_HEDLEY_UNLIKELY(!parse_cbor_internal(false, tag_handler)))\n                {\n                    return false;\n                }\n            }\n        }\n\n        return sax->end_array();\n    }\n\n    /*!\n    @param[in] len  the length of the object or std::size_t(-1) for an\n                    object of indefinite size\n    @param[in] tag_handler how CBOR tags should be treated\n    @return whether object creation completed\n    */\n    bool get_cbor_object(const std::size_t len,\n                         const cbor_tag_handler_t tag_handler)\n    {\n        if (JSON_HEDLEY_UNLIKELY(!sax->start_object(len)))\n        {\n            return false;\n        }\n\n        string_t key;\n        if (len != std::size_t(-1))\n        {\n            for (std::size_t i = 0; i < len; ++i)\n            {\n                get();\n                if (JSON_HEDLEY_UNLIKELY(!get_cbor_string(key) || !sax->key(key)))\n                {\n                    return false;\n                }\n\n                if (JSON_HEDLEY_UNLIKELY(!parse_cbor_internal(true, tag_handler)))\n                {\n                    return false;\n                }\n                key.clear();\n            }\n        }\n        else\n        {\n            while (get() != 0xFF)\n            {\n                if (JSON_HEDLEY_UNLIKELY(!get_cbor_string(key) || !sax->key(key)))\n                {\n                    return false;\n                }\n\n                if (JSON_HEDLEY_UNLIKELY(!parse_cbor_internal(true, tag_handler)))\n                {\n                    return false;\n                }\n                key.clear();\n            }\n        }\n\n        return sax->end_object();\n    }\n\n    /////////////\n    // MsgPack //\n    /////////////\n\n    /*!\n    @return whether a valid MessagePack value was passed to the SAX parser\n    */\n    bool parse_msgpack_internal()\n    {\n        switch (get())\n        {\n            // EOF\n            case std::char_traits<char_type>::eof():\n                return unexpect_eof(input_format_t::msgpack, \"value\");\n\n            // positive fixint\n            case 0x00:\n            case 0x01:\n            case 0x02:\n            case 0x03:\n            case 0x04:\n            case 0x05:\n            case 0x06:\n            case 0x07:\n            case 0x08:\n            case 0x09:\n            case 0x0A:\n            case 0x0B:\n            case 0x0C:\n            case 0x0D:\n            case 0x0E:\n            case 0x0F:\n            case 0x10:\n            case 0x11:\n            case 0x12:\n            case 0x13:\n            case 0x14:\n            case 0x15:\n            case 0x16:\n            case 0x17:\n            case 0x18:\n            case 0x19:\n            case 0x1A:\n            case 0x1B:\n            case 0x1C:\n            case 0x1D:\n            case 0x1E:\n            case 0x1F:\n            case 0x20:\n            case 0x21:\n            case 0x22:\n            case 0x23:\n            case 0x24:\n            case 0x25:\n            case 0x26:\n            case 0x27:\n            case 0x28:\n            case 0x29:\n            case 0x2A:\n            case 0x2B:\n            case 0x2C:\n            case 0x2D:\n            case 0x2E:\n            case 0x2F:\n            case 0x30:\n            case 0x31:\n            case 0x32:\n            case 0x33:\n            case 0x34:\n            case 0x35:\n            case 0x36:\n            case 0x37:\n            case 0x38:\n            case 0x39:\n            case 0x3A:\n            case 0x3B:\n            case 0x3C:\n            case 0x3D:\n            case 0x3E:\n            case 0x3F:\n            case 0x40:\n            case 0x41:\n            case 0x42:\n            case 0x43:\n            case 0x44:\n            case 0x45:\n            case 0x46:\n            case 0x47:\n            case 0x48:\n            case 0x49:\n            case 0x4A:\n            case 0x4B:\n            case 0x4C:\n            case 0x4D:\n            case 0x4E:\n            case 0x4F:\n            case 0x50:\n            case 0x51:\n            case 0x52:\n            case 0x53:\n            case 0x54:\n            case 0x55:\n            case 0x56:\n            case 0x57:\n            case 0x58:\n            case 0x59:\n            case 0x5A:\n            case 0x5B:\n            case 0x5C:\n            case 0x5D:\n            case 0x5E:\n            case 0x5F:\n            case 0x60:\n            case 0x61:\n            case 0x62:\n            case 0x63:\n            case 0x64:\n            case 0x65:\n            case 0x66:\n            case 0x67:\n            case 0x68:\n            case 0x69:\n            case 0x6A:\n            case 0x6B:\n            case 0x6C:\n            case 0x6D:\n            case 0x6E:\n            case 0x6F:\n            case 0x70:\n            case 0x71:\n            case 0x72:\n            case 0x73:\n            case 0x74:\n            case 0x75:\n            case 0x76:\n            case 0x77:\n            case 0x78:\n            case 0x79:\n            case 0x7A:\n            case 0x7B:\n            case 0x7C:\n            case 0x7D:\n            case 0x7E:\n            case 0x7F:\n                return sax->number_unsigned(static_cast<number_unsigned_t>(current));\n\n            // fixmap\n            case 0x80:\n            case 0x81:\n            case 0x82:\n            case 0x83:\n            case 0x84:\n            case 0x85:\n            case 0x86:\n            case 0x87:\n            case 0x88:\n            case 0x89:\n            case 0x8A:\n            case 0x8B:\n            case 0x8C:\n            case 0x8D:\n            case 0x8E:\n            case 0x8F:\n                return get_msgpack_object(static_cast<std::size_t>(static_cast<unsigned int>(current) & 0x0Fu));\n\n            // fixarray\n            case 0x90:\n            case 0x91:\n            case 0x92:\n            case 0x93:\n            case 0x94:\n            case 0x95:\n            case 0x96:\n            case 0x97:\n            case 0x98:\n            case 0x99:\n            case 0x9A:\n            case 0x9B:\n            case 0x9C:\n            case 0x9D:\n            case 0x9E:\n            case 0x9F:\n                return get_msgpack_array(static_cast<std::size_t>(static_cast<unsigned int>(current) & 0x0Fu));\n\n            // fixstr\n            case 0xA0:\n            case 0xA1:\n            case 0xA2:\n            case 0xA3:\n            case 0xA4:\n            case 0xA5:\n            case 0xA6:\n            case 0xA7:\n            case 0xA8:\n            case 0xA9:\n            case 0xAA:\n            case 0xAB:\n            case 0xAC:\n            case 0xAD:\n            case 0xAE:\n            case 0xAF:\n            case 0xB0:\n            case 0xB1:\n            case 0xB2:\n            case 0xB3:\n            case 0xB4:\n            case 0xB5:\n            case 0xB6:\n            case 0xB7:\n            case 0xB8:\n            case 0xB9:\n            case 0xBA:\n            case 0xBB:\n            case 0xBC:\n            case 0xBD:\n            case 0xBE:\n            case 0xBF:\n            case 0xD9: // str 8\n            case 0xDA: // str 16\n            case 0xDB: // str 32\n            {\n                string_t s;\n                return get_msgpack_string(s) && sax->string(s);\n            }\n\n            case 0xC0: // nil\n                return sax->null();\n\n            case 0xC2: // false\n                return sax->boolean(false);\n\n            case 0xC3: // true\n                return sax->boolean(true);\n\n            case 0xC4: // bin 8\n            case 0xC5: // bin 16\n            case 0xC6: // bin 32\n            case 0xC7: // ext 8\n            case 0xC8: // ext 16\n            case 0xC9: // ext 32\n            case 0xD4: // fixext 1\n            case 0xD5: // fixext 2\n            case 0xD6: // fixext 4\n            case 0xD7: // fixext 8\n            case 0xD8: // fixext 16\n            {\n                binary_t b;\n                return get_msgpack_binary(b) && sax->binary(b);\n            }\n\n            case 0xCA: // float 32\n            {\n                float number{};\n                return get_number(input_format_t::msgpack, number) && sax->number_float(static_cast<number_float_t>(number), \"\");\n            }\n\n            case 0xCB: // float 64\n            {\n                double number{};\n                return get_number(input_format_t::msgpack, number) && sax->number_float(static_cast<number_float_t>(number), \"\");\n            }\n\n            case 0xCC: // uint 8\n            {\n                std::uint8_t number{};\n                return get_number(input_format_t::msgpack, number) && sax->number_unsigned(number);\n            }\n\n            case 0xCD: // uint 16\n            {\n                std::uint16_t number{};\n                return get_number(input_format_t::msgpack, number) && sax->number_unsigned(number);\n            }\n\n            case 0xCE: // uint 32\n            {\n                std::uint32_t number{};\n                return get_number(input_format_t::msgpack, number) && sax->number_unsigned(number);\n            }\n\n            case 0xCF: // uint 64\n            {\n                std::uint64_t number{};\n                return get_number(input_format_t::msgpack, number) && sax->number_unsigned(number);\n            }\n\n            case 0xD0: // int 8\n            {\n                std::int8_t number{};\n                return get_number(input_format_t::msgpack, number) && sax->number_integer(number);\n            }\n\n            case 0xD1: // int 16\n            {\n                std::int16_t number{};\n                return get_number(input_format_t::msgpack, number) && sax->number_integer(number);\n            }\n\n            case 0xD2: // int 32\n            {\n                std::int32_t number{};\n                return get_number(input_format_t::msgpack, number) && sax->number_integer(number);\n            }\n\n            case 0xD3: // int 64\n            {\n                std::int64_t number{};\n                return get_number(input_format_t::msgpack, number) && sax->number_integer(number);\n            }\n\n            case 0xDC: // array 16\n            {\n                std::uint16_t len{};\n                return get_number(input_format_t::msgpack, len) && get_msgpack_array(static_cast<std::size_t>(len));\n            }\n\n            case 0xDD: // array 32\n            {\n                std::uint32_t len{};\n                return get_number(input_format_t::msgpack, len) && get_msgpack_array(static_cast<std::size_t>(len));\n            }\n\n            case 0xDE: // map 16\n            {\n                std::uint16_t len{};\n                return get_number(input_format_t::msgpack, len) && get_msgpack_object(static_cast<std::size_t>(len));\n            }\n\n            case 0xDF: // map 32\n            {\n                std::uint32_t len{};\n                return get_number(input_format_t::msgpack, len) && get_msgpack_object(static_cast<std::size_t>(len));\n            }\n\n            // negative fixint\n            case 0xE0:\n            case 0xE1:\n            case 0xE2:\n            case 0xE3:\n            case 0xE4:\n            case 0xE5:\n            case 0xE6:\n            case 0xE7:\n            case 0xE8:\n            case 0xE9:\n            case 0xEA:\n            case 0xEB:\n            case 0xEC:\n            case 0xED:\n            case 0xEE:\n            case 0xEF:\n            case 0xF0:\n            case 0xF1:\n            case 0xF2:\n            case 0xF3:\n            case 0xF4:\n            case 0xF5:\n            case 0xF6:\n            case 0xF7:\n            case 0xF8:\n            case 0xF9:\n            case 0xFA:\n            case 0xFB:\n            case 0xFC:\n            case 0xFD:\n            case 0xFE:\n            case 0xFF:\n                return sax->number_integer(static_cast<std::int8_t>(current));\n\n            default: // anything else\n            {\n                auto last_token = get_token_string();\n                return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format_t::msgpack, \"invalid byte: 0x\" + last_token, \"value\")));\n            }\n        }\n    }\n\n    /*!\n    @brief reads a MessagePack string\n\n    This function first reads starting bytes to determine the expected\n    string length and then copies this number of bytes into a string.\n\n    @param[out] result  created string\n\n    @return whether string creation completed\n    */\n    bool get_msgpack_string(string_t& result)\n    {\n        if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::msgpack, \"string\")))\n        {\n            return false;\n        }\n\n        switch (current)\n        {\n            // fixstr\n            case 0xA0:\n            case 0xA1:\n            case 0xA2:\n            case 0xA3:\n            case 0xA4:\n            case 0xA5:\n            case 0xA6:\n            case 0xA7:\n            case 0xA8:\n            case 0xA9:\n            case 0xAA:\n            case 0xAB:\n            case 0xAC:\n            case 0xAD:\n            case 0xAE:\n            case 0xAF:\n            case 0xB0:\n            case 0xB1:\n            case 0xB2:\n            case 0xB3:\n            case 0xB4:\n            case 0xB5:\n            case 0xB6:\n            case 0xB7:\n            case 0xB8:\n            case 0xB9:\n            case 0xBA:\n            case 0xBB:\n            case 0xBC:\n            case 0xBD:\n            case 0xBE:\n            case 0xBF:\n            {\n                return get_string(input_format_t::msgpack, static_cast<unsigned int>(current) & 0x1Fu, result);\n            }\n\n            case 0xD9: // str 8\n            {\n                std::uint8_t len{};\n                return get_number(input_format_t::msgpack, len) && get_string(input_format_t::msgpack, len, result);\n            }\n\n            case 0xDA: // str 16\n            {\n                std::uint16_t len{};\n                return get_number(input_format_t::msgpack, len) && get_string(input_format_t::msgpack, len, result);\n            }\n\n            case 0xDB: // str 32\n            {\n                std::uint32_t len{};\n                return get_number(input_format_t::msgpack, len) && get_string(input_format_t::msgpack, len, result);\n            }\n\n            default:\n            {\n                auto last_token = get_token_string();\n                return sax->parse_error(chars_read, last_token, parse_error::create(113, chars_read, exception_message(input_format_t::msgpack, \"expected length specification (0xA0-0xBF, 0xD9-0xDB); last byte: 0x\" + last_token, \"string\")));\n            }\n        }\n    }\n\n    /*!\n    @brief reads a MessagePack byte array\n\n    This function first reads starting bytes to determine the expected\n    byte array length and then copies this number of bytes into a byte array.\n\n    @param[out] result  created byte array\n\n    @return whether byte array creation completed\n    */\n    bool get_msgpack_binary(binary_t& result)\n    {\n        // helper function to set the subtype\n        auto assign_and_return_true = [&result](std::int8_t subtype)\n        {\n            result.set_subtype(static_cast<std::uint8_t>(subtype));\n            return true;\n        };\n\n        switch (current)\n        {\n            case 0xC4: // bin 8\n            {\n                std::uint8_t len{};\n                return get_number(input_format_t::msgpack, len) &&\n                       get_binary(input_format_t::msgpack, len, result);\n            }\n\n            case 0xC5: // bin 16\n            {\n                std::uint16_t len{};\n                return get_number(input_format_t::msgpack, len) &&\n                       get_binary(input_format_t::msgpack, len, result);\n            }\n\n            case 0xC6: // bin 32\n            {\n                std::uint32_t len{};\n                return get_number(input_format_t::msgpack, len) &&\n                       get_binary(input_format_t::msgpack, len, result);\n            }\n\n            case 0xC7: // ext 8\n            {\n                std::uint8_t len{};\n                std::int8_t subtype{};\n                return get_number(input_format_t::msgpack, len) &&\n                       get_number(input_format_t::msgpack, subtype) &&\n                       get_binary(input_format_t::msgpack, len, result) &&\n                       assign_and_return_true(subtype);\n            }\n\n            case 0xC8: // ext 16\n            {\n                std::uint16_t len{};\n                std::int8_t subtype{};\n                return get_number(input_format_t::msgpack, len) &&\n                       get_number(input_format_t::msgpack, subtype) &&\n                       get_binary(input_format_t::msgpack, len, result) &&\n                       assign_and_return_true(subtype);\n            }\n\n            case 0xC9: // ext 32\n            {\n                std::uint32_t len{};\n                std::int8_t subtype{};\n                return get_number(input_format_t::msgpack, len) &&\n                       get_number(input_format_t::msgpack, subtype) &&\n                       get_binary(input_format_t::msgpack, len, result) &&\n                       assign_and_return_true(subtype);\n            }\n\n            case 0xD4: // fixext 1\n            {\n                std::int8_t subtype{};\n                return get_number(input_format_t::msgpack, subtype) &&\n                       get_binary(input_format_t::msgpack, 1, result) &&\n                       assign_and_return_true(subtype);\n            }\n\n            case 0xD5: // fixext 2\n            {\n                std::int8_t subtype{};\n                return get_number(input_format_t::msgpack, subtype) &&\n                       get_binary(input_format_t::msgpack, 2, result) &&\n                       assign_and_return_true(subtype);\n            }\n\n            case 0xD6: // fixext 4\n            {\n                std::int8_t subtype{};\n                return get_number(input_format_t::msgpack, subtype) &&\n                       get_binary(input_format_t::msgpack, 4, result) &&\n                       assign_and_return_true(subtype);\n            }\n\n            case 0xD7: // fixext 8\n            {\n                std::int8_t subtype{};\n                return get_number(input_format_t::msgpack, subtype) &&\n                       get_binary(input_format_t::msgpack, 8, result) &&\n                       assign_and_return_true(subtype);\n            }\n\n            case 0xD8: // fixext 16\n            {\n                std::int8_t subtype{};\n                return get_number(input_format_t::msgpack, subtype) &&\n                       get_binary(input_format_t::msgpack, 16, result) &&\n                       assign_and_return_true(subtype);\n            }\n\n            default:           // LCOV_EXCL_LINE\n                return false;  // LCOV_EXCL_LINE\n        }\n    }\n\n    /*!\n    @param[in] len  the length of the array\n    @return whether array creation completed\n    */\n    bool get_msgpack_array(const std::size_t len)\n    {\n        if (JSON_HEDLEY_UNLIKELY(!sax->start_array(len)))\n        {\n            return false;\n        }\n\n        for (std::size_t i = 0; i < len; ++i)\n        {\n            if (JSON_HEDLEY_UNLIKELY(!parse_msgpack_internal()))\n            {\n                return false;\n            }\n        }\n\n        return sax->end_array();\n    }\n\n    /*!\n    @param[in] len  the length of the object\n    @return whether object creation completed\n    */\n    bool get_msgpack_object(const std::size_t len)\n    {\n        if (JSON_HEDLEY_UNLIKELY(!sax->start_object(len)))\n        {\n            return false;\n        }\n\n        string_t key;\n        for (std::size_t i = 0; i < len; ++i)\n        {\n            get();\n            if (JSON_HEDLEY_UNLIKELY(!get_msgpack_string(key) || !sax->key(key)))\n            {\n                return false;\n            }\n\n            if (JSON_HEDLEY_UNLIKELY(!parse_msgpack_internal()))\n            {\n                return false;\n            }\n            key.clear();\n        }\n\n        return sax->end_object();\n    }\n\n    ////////////\n    // UBJSON //\n    ////////////\n\n    /*!\n    @param[in] get_char  whether a new character should be retrieved from the\n                         input (true, default) or whether the last read\n                         character should be considered instead\n\n    @return whether a valid UBJSON value was passed to the SAX parser\n    */\n    bool parse_ubjson_internal(const bool get_char = true)\n    {\n        return get_ubjson_value(get_char ? get_ignore_noop() : current);\n    }\n\n    /*!\n    @brief reads a UBJSON string\n\n    This function is either called after reading the 'S' byte explicitly\n    indicating a string, or in case of an object key where the 'S' byte can be\n    left out.\n\n    @param[out] result   created string\n    @param[in] get_char  whether a new character should be retrieved from the\n                         input (true, default) or whether the last read\n                         character should be considered instead\n\n    @return whether string creation completed\n    */\n    bool get_ubjson_string(string_t& result, const bool get_char = true)\n    {\n        if (get_char)\n        {\n            get();  // TODO(niels): may we ignore N here?\n        }\n\n        if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::ubjson, \"value\")))\n        {\n            return false;\n        }\n\n        switch (current)\n        {\n            case 'U':\n            {\n                std::uint8_t len{};\n                return get_number(input_format_t::ubjson, len) && get_string(input_format_t::ubjson, len, result);\n            }\n\n            case 'i':\n            {\n                std::int8_t len{};\n                return get_number(input_format_t::ubjson, len) && get_string(input_format_t::ubjson, len, result);\n            }\n\n            case 'I':\n            {\n                std::int16_t len{};\n                return get_number(input_format_t::ubjson, len) && get_string(input_format_t::ubjson, len, result);\n            }\n\n            case 'l':\n            {\n                std::int32_t len{};\n                return get_number(input_format_t::ubjson, len) && get_string(input_format_t::ubjson, len, result);\n            }\n\n            case 'L':\n            {\n                std::int64_t len{};\n                return get_number(input_format_t::ubjson, len) && get_string(input_format_t::ubjson, len, result);\n            }\n\n            default:\n                auto last_token = get_token_string();\n                return sax->parse_error(chars_read, last_token, parse_error::create(113, chars_read, exception_message(input_format_t::ubjson, \"expected length type specification (U, i, I, l, L); last byte: 0x\" + last_token, \"string\")));\n        }\n    }\n\n    /*!\n    @param[out] result  determined size\n    @return whether size determination completed\n    */\n    bool get_ubjson_size_value(std::size_t& result)\n    {\n        switch (get_ignore_noop())\n        {\n            case 'U':\n            {\n                std::uint8_t number{};\n                if (JSON_HEDLEY_UNLIKELY(!get_number(input_format_t::ubjson, number)))\n                {\n                    return false;\n                }\n                result = static_cast<std::size_t>(number);\n                return true;\n            }\n\n            case 'i':\n            {\n                std::int8_t number{};\n                if (JSON_HEDLEY_UNLIKELY(!get_number(input_format_t::ubjson, number)))\n                {\n                    return false;\n                }\n                result = static_cast<std::size_t>(number);\n                return true;\n            }\n\n            case 'I':\n            {\n                std::int16_t number{};\n                if (JSON_HEDLEY_UNLIKELY(!get_number(input_format_t::ubjson, number)))\n                {\n                    return false;\n                }\n                result = static_cast<std::size_t>(number);\n                return true;\n            }\n\n            case 'l':\n            {\n                std::int32_t number{};\n                if (JSON_HEDLEY_UNLIKELY(!get_number(input_format_t::ubjson, number)))\n                {\n                    return false;\n                }\n                result = static_cast<std::size_t>(number);\n                return true;\n            }\n\n            case 'L':\n            {\n                std::int64_t number{};\n                if (JSON_HEDLEY_UNLIKELY(!get_number(input_format_t::ubjson, number)))\n                {\n                    return false;\n                }\n                result = static_cast<std::size_t>(number);\n                return true;\n            }\n\n            default:\n            {\n                auto last_token = get_token_string();\n                return sax->parse_error(chars_read, last_token, parse_error::create(113, chars_read, exception_message(input_format_t::ubjson, \"expected length type specification (U, i, I, l, L) after '#'; last byte: 0x\" + last_token, \"size\")));\n            }\n        }\n    }\n\n    /*!\n    @brief determine the type and size for a container\n\n    In the optimized UBJSON format, a type and a size can be provided to allow\n    for a more compact representation.\n\n    @param[out] result  pair of the size and the type\n\n    @return whether pair creation completed\n    */\n    bool get_ubjson_size_type(std::pair<std::size_t, char_int_type>& result)\n    {\n        result.first = string_t::npos; // size\n        result.second = 0; // type\n\n        get_ignore_noop();\n\n        if (current == '$')\n        {\n            result.second = get();  // must not ignore 'N', because 'N' maybe the type\n            if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::ubjson, \"type\")))\n            {\n                return false;\n            }\n\n            get_ignore_noop();\n            if (JSON_HEDLEY_UNLIKELY(current != '#'))\n            {\n                if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::ubjson, \"value\")))\n                {\n                    return false;\n                }\n                auto last_token = get_token_string();\n                return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format_t::ubjson, \"expected '#' after type information; last byte: 0x\" + last_token, \"size\")));\n            }\n\n            return get_ubjson_size_value(result.first);\n        }\n\n        if (current == '#')\n        {\n            return get_ubjson_size_value(result.first);\n        }\n\n        return true;\n    }\n\n    /*!\n    @param prefix  the previously read or set type prefix\n    @return whether value creation completed\n    */\n    bool get_ubjson_value(const char_int_type prefix)\n    {\n        switch (prefix)\n        {\n            case std::char_traits<char_type>::eof():  // EOF\n                return unexpect_eof(input_format_t::ubjson, \"value\");\n\n            case 'T':  // true\n                return sax->boolean(true);\n            case 'F':  // false\n                return sax->boolean(false);\n\n            case 'Z':  // null\n                return sax->null();\n\n            case 'U':\n            {\n                std::uint8_t number{};\n                return get_number(input_format_t::ubjson, number) && sax->number_unsigned(number);\n            }\n\n            case 'i':\n            {\n                std::int8_t number{};\n                return get_number(input_format_t::ubjson, number) && sax->number_integer(number);\n            }\n\n            case 'I':\n            {\n                std::int16_t number{};\n                return get_number(input_format_t::ubjson, number) && sax->number_integer(number);\n            }\n\n            case 'l':\n            {\n                std::int32_t number{};\n                return get_number(input_format_t::ubjson, number) && sax->number_integer(number);\n            }\n\n            case 'L':\n            {\n                std::int64_t number{};\n                return get_number(input_format_t::ubjson, number) && sax->number_integer(number);\n            }\n\n            case 'd':\n            {\n                float number{};\n                return get_number(input_format_t::ubjson, number) && sax->number_float(static_cast<number_float_t>(number), \"\");\n            }\n\n            case 'D':\n            {\n                double number{};\n                return get_number(input_format_t::ubjson, number) && sax->number_float(static_cast<number_float_t>(number), \"\");\n            }\n\n            case 'H':\n            {\n                return get_ubjson_high_precision_number();\n            }\n\n            case 'C':  // char\n            {\n                get();\n                if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::ubjson, \"char\")))\n                {\n                    return false;\n                }\n                if (JSON_HEDLEY_UNLIKELY(current > 127))\n                {\n                    auto last_token = get_token_string();\n                    return sax->parse_error(chars_read, last_token, parse_error::create(113, chars_read, exception_message(input_format_t::ubjson, \"byte after 'C' must be in range 0x00..0x7F; last byte: 0x\" + last_token, \"char\")));\n                }\n                string_t s(1, static_cast<typename string_t::value_type>(current));\n                return sax->string(s);\n            }\n\n            case 'S':  // string\n            {\n                string_t s;\n                return get_ubjson_string(s) && sax->string(s);\n            }\n\n            case '[':  // array\n                return get_ubjson_array();\n\n            case '{':  // object\n                return get_ubjson_object();\n\n            default: // anything else\n            {\n                auto last_token = get_token_string();\n                return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format_t::ubjson, \"invalid byte: 0x\" + last_token, \"value\")));\n            }\n        }\n    }\n\n    /*!\n    @return whether array creation completed\n    */\n    bool get_ubjson_array()\n    {\n        std::pair<std::size_t, char_int_type> size_and_type;\n        if (JSON_HEDLEY_UNLIKELY(!get_ubjson_size_type(size_and_type)))\n        {\n            return false;\n        }\n\n        if (size_and_type.first != string_t::npos)\n        {\n            if (JSON_HEDLEY_UNLIKELY(!sax->start_array(size_and_type.first)))\n            {\n                return false;\n            }\n\n            if (size_and_type.second != 0)\n            {\n                if (size_and_type.second != 'N')\n                {\n                    for (std::size_t i = 0; i < size_and_type.first; ++i)\n                    {\n                        if (JSON_HEDLEY_UNLIKELY(!get_ubjson_value(size_and_type.second)))\n                        {\n                            return false;\n                        }\n                    }\n                }\n            }\n            else\n            {\n                for (std::size_t i = 0; i < size_and_type.first; ++i)\n                {\n                    if (JSON_HEDLEY_UNLIKELY(!parse_ubjson_internal()))\n                    {\n                        return false;\n                    }\n                }\n            }\n        }\n        else\n        {\n            if (JSON_HEDLEY_UNLIKELY(!sax->start_array(std::size_t(-1))))\n            {\n                return false;\n            }\n\n            while (current != ']')\n            {\n                if (JSON_HEDLEY_UNLIKELY(!parse_ubjson_internal(false)))\n                {\n                    return false;\n                }\n                get_ignore_noop();\n            }\n        }\n\n        return sax->end_array();\n    }\n\n    /*!\n    @return whether object creation completed\n    */\n    bool get_ubjson_object()\n    {\n        std::pair<std::size_t, char_int_type> size_and_type;\n        if (JSON_HEDLEY_UNLIKELY(!get_ubjson_size_type(size_and_type)))\n        {\n            return false;\n        }\n\n        string_t key;\n        if (size_and_type.first != string_t::npos)\n        {\n            if (JSON_HEDLEY_UNLIKELY(!sax->start_object(size_and_type.first)))\n            {\n                return false;\n            }\n\n            if (size_and_type.second != 0)\n            {\n                for (std::size_t i = 0; i < size_and_type.first; ++i)\n                {\n                    if (JSON_HEDLEY_UNLIKELY(!get_ubjson_string(key) || !sax->key(key)))\n                    {\n                        return false;\n                    }\n                    if (JSON_HEDLEY_UNLIKELY(!get_ubjson_value(size_and_type.second)))\n                    {\n                        return false;\n                    }\n                    key.clear();\n                }\n            }\n            else\n            {\n                for (std::size_t i = 0; i < size_and_type.first; ++i)\n                {\n                    if (JSON_HEDLEY_UNLIKELY(!get_ubjson_string(key) || !sax->key(key)))\n                    {\n                        return false;\n                    }\n                    if (JSON_HEDLEY_UNLIKELY(!parse_ubjson_internal()))\n                    {\n                        return false;\n                    }\n                    key.clear();\n                }\n            }\n        }\n        else\n        {\n            if (JSON_HEDLEY_UNLIKELY(!sax->start_object(std::size_t(-1))))\n            {\n                return false;\n            }\n\n            while (current != '}')\n            {\n                if (JSON_HEDLEY_UNLIKELY(!get_ubjson_string(key, false) || !sax->key(key)))\n                {\n                    return false;\n                }\n                if (JSON_HEDLEY_UNLIKELY(!parse_ubjson_internal()))\n                {\n                    return false;\n                }\n                get_ignore_noop();\n                key.clear();\n            }\n        }\n\n        return sax->end_object();\n    }\n\n    // Note, no reader for UBJSON binary types is implemented because they do\n    // not exist\n\n    bool get_ubjson_high_precision_number()\n    {\n        // get size of following number string\n        std::size_t size{};\n        auto res = get_ubjson_size_value(size);\n        if (JSON_HEDLEY_UNLIKELY(!res))\n        {\n            return res;\n        }\n\n        // get number string\n        std::vector<char> number_vector;\n        for (std::size_t i = 0; i < size; ++i)\n        {\n            get();\n            if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::ubjson, \"number\")))\n            {\n                return false;\n            }\n            number_vector.push_back(static_cast<char>(current));\n        }\n\n        // parse number string\n        auto number_ia = detail::input_adapter(std::forward<decltype(number_vector)>(number_vector));\n        auto number_lexer = detail::lexer<BasicJsonType, decltype(number_ia)>(std::move(number_ia), false);\n        const auto result_number = number_lexer.scan();\n        const auto number_string = number_lexer.get_token_string();\n        const auto result_remainder = number_lexer.scan();\n\n        using token_type = typename detail::lexer_base<BasicJsonType>::token_type;\n\n        if (JSON_HEDLEY_UNLIKELY(result_remainder != token_type::end_of_input))\n        {\n            return sax->parse_error(chars_read, number_string, parse_error::create(115, chars_read, exception_message(input_format_t::ubjson, \"invalid number text: \" + number_lexer.get_token_string(), \"high-precision number\")));\n        }\n\n        switch (result_number)\n        {\n            case token_type::value_integer:\n                return sax->number_integer(number_lexer.get_number_integer());\n            case token_type::value_unsigned:\n                return sax->number_unsigned(number_lexer.get_number_unsigned());\n            case token_type::value_float:\n                return sax->number_float(number_lexer.get_number_float(), std::move(number_string));\n            default:\n                return sax->parse_error(chars_read, number_string, parse_error::create(115, chars_read, exception_message(input_format_t::ubjson, \"invalid number text: \" + number_lexer.get_token_string(), \"high-precision number\")));\n        }\n    }\n\n    ///////////////////////\n    // Utility functions //\n    ///////////////////////\n\n    /*!\n    @brief get next character from the input\n\n    This function provides the interface to the used input adapter. It does\n    not throw in case the input reached EOF, but returns a -'ve valued\n    `std::char_traits<char_type>::eof()` in that case.\n\n    @return character read from the input\n    */\n    char_int_type get()\n    {\n        ++chars_read;\n        return current = ia.get_character();\n    }\n\n    /*!\n    @return character read from the input after ignoring all 'N' entries\n    */\n    char_int_type get_ignore_noop()\n    {\n        do\n        {\n            get();\n        }\n        while (current == 'N');\n\n        return current;\n    }\n\n    /*\n    @brief read a number from the input\n\n    @tparam NumberType the type of the number\n    @param[in] format   the current format (for diagnostics)\n    @param[out] result  number of type @a NumberType\n\n    @return whether conversion completed\n\n    @note This function needs to respect the system's endianess, because\n          bytes in CBOR, MessagePack, and UBJSON are stored in network order\n          (big endian) and therefore need reordering on little endian systems.\n    */\n    template<typename NumberType, bool InputIsLittleEndian = false>\n    bool get_number(const input_format_t format, NumberType& result)\n    {\n        // step 1: read input into array with system's byte order\n        std::array<std::uint8_t, sizeof(NumberType)> vec;\n        for (std::size_t i = 0; i < sizeof(NumberType); ++i)\n        {\n            get();\n            if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(format, \"number\")))\n            {\n                return false;\n            }\n\n            // reverse byte order prior to conversion if necessary\n            if (is_little_endian != InputIsLittleEndian)\n            {\n                vec[sizeof(NumberType) - i - 1] = static_cast<std::uint8_t>(current);\n            }\n            else\n            {\n                vec[i] = static_cast<std::uint8_t>(current); // LCOV_EXCL_LINE\n            }\n        }\n\n        // step 2: convert array into number of type T and return\n        std::memcpy(&result, vec.data(), sizeof(NumberType));\n        return true;\n    }\n\n    /*!\n    @brief create a string by reading characters from the input\n\n    @tparam NumberType the type of the number\n    @param[in] format the current format (for diagnostics)\n    @param[in] len number of characters to read\n    @param[out] result string created by reading @a len bytes\n\n    @return whether string creation completed\n\n    @note We can not reserve @a len bytes for the result, because @a len\n          may be too large. Usually, @ref unexpect_eof() detects the end of\n          the input before we run out of string memory.\n    */\n    template<typename NumberType>\n    bool get_string(const input_format_t format,\n                    const NumberType len,\n                    string_t& result)\n    {\n        bool success = true;\n        for (NumberType i = 0; i < len; i++)\n        {\n            get();\n            if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(format, \"string\")))\n            {\n                success = false;\n                break;\n            }\n            result.push_back(static_cast<typename string_t::value_type>(current));\n        };\n        return success;\n    }\n\n    /*!\n    @brief create a byte array by reading bytes from the input\n\n    @tparam NumberType the type of the number\n    @param[in] format the current format (for diagnostics)\n    @param[in] len number of bytes to read\n    @param[out] result byte array created by reading @a len bytes\n\n    @return whether byte array creation completed\n\n    @note We can not reserve @a len bytes for the result, because @a len\n          may be too large. Usually, @ref unexpect_eof() detects the end of\n          the input before we run out of memory.\n    */\n    template<typename NumberType>\n    bool get_binary(const input_format_t format,\n                    const NumberType len,\n                    binary_t& result)\n    {\n        bool success = true;\n        for (NumberType i = 0; i < len; i++)\n        {\n            get();\n            if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(format, \"binary\")))\n            {\n                success = false;\n                break;\n            }\n            result.push_back(static_cast<std::uint8_t>(current));\n        }\n        return success;\n    }\n\n    /*!\n    @param[in] format   the current format (for diagnostics)\n    @param[in] context  further context information (for diagnostics)\n    @return whether the last read character is not EOF\n    */\n    JSON_HEDLEY_NON_NULL(3)\n    bool unexpect_eof(const input_format_t format, const char* context) const\n    {\n        if (JSON_HEDLEY_UNLIKELY(current == std::char_traits<char_type>::eof()))\n        {\n            return sax->parse_error(chars_read, \"<end of file>\",\n                                    parse_error::create(110, chars_read, exception_message(format, \"unexpected end of input\", context)));\n        }\n        return true;\n    }\n\n    /*!\n    @return a string representation of the last read byte\n    */\n    std::string get_token_string() const\n    {\n        std::array<char, 3> cr{{}};\n        (std::snprintf)(cr.data(), cr.size(), \"%.2hhX\", static_cast<unsigned char>(current));\n        return std::string{cr.data()};\n    }\n\n    /*!\n    @param[in] format   the current format\n    @param[in] detail   a detailed error message\n    @param[in] context  further context information\n    @return a message string to use in the parse_error exceptions\n    */\n    std::string exception_message(const input_format_t format,\n                                  const std::string& detail,\n                                  const std::string& context) const\n    {\n        std::string error_msg = \"syntax error while parsing \";\n\n        switch (format)\n        {\n            case input_format_t::cbor:\n                error_msg += \"CBOR\";\n                break;\n\n            case input_format_t::msgpack:\n                error_msg += \"MessagePack\";\n                break;\n\n            case input_format_t::ubjson:\n                error_msg += \"UBJSON\";\n                break;\n\n            case input_format_t::bson:\n                error_msg += \"BSON\";\n                break;\n\n            default:            // LCOV_EXCL_LINE\n                JSON_ASSERT(false);  // LCOV_EXCL_LINE\n        }\n\n        return error_msg + \" \" + context + \": \" + detail;\n    }\n\n  private:\n    /// input adapter\n    InputAdapterType ia;\n\n    /// the current character\n    char_int_type current = std::char_traits<char_type>::eof();\n\n    /// the number of characters read\n    std::size_t chars_read = 0;\n\n    /// whether we can assume little endianess\n    const bool is_little_endian = little_endianess();\n\n    /// the SAX parser\n    json_sax_t* sax = nullptr;\n};\n}  // namespace detail\n}  // namespace nlohmann\n\n// #include <nlohmann/detail/input/input_adapters.hpp>\n\n// #include <nlohmann/detail/input/lexer.hpp>\n\n// #include <nlohmann/detail/input/parser.hpp>\n\n\n#include <cmath> // isfinite\n#include <cstdint> // uint8_t\n#include <functional> // function\n#include <string> // string\n#include <utility> // move\n#include <vector> // vector\n\n// #include <nlohmann/detail/exceptions.hpp>\n\n// #include <nlohmann/detail/input/input_adapters.hpp>\n\n// #include <nlohmann/detail/input/json_sax.hpp>\n\n// #include <nlohmann/detail/input/lexer.hpp>\n\n// #include <nlohmann/detail/macro_scope.hpp>\n\n// #include <nlohmann/detail/meta/is_sax.hpp>\n\n// #include <nlohmann/detail/value_t.hpp>\n\n\nnamespace nlohmann\n{\nnamespace detail\n{\n////////////\n// parser //\n////////////\n\nenum class parse_event_t : uint8_t\n{\n    /// the parser read `{` and started to process a JSON object\n    object_start,\n    /// the parser read `}` and finished processing a JSON object\n    object_end,\n    /// the parser read `[` and started to process a JSON array\n    array_start,\n    /// the parser read `]` and finished processing a JSON array\n    array_end,\n    /// the parser read a key of a value in an object\n    key,\n    /// the parser finished reading a JSON value\n    value\n};\n\ntemplate<typename BasicJsonType>\nusing parser_callback_t =\n    std::function<bool(int depth, parse_event_t event, BasicJsonType& parsed)>;\n\n/*!\n@brief syntax analysis\n\nThis class implements a recursive descent parser.\n*/\ntemplate<typename BasicJsonType, typename InputAdapterType>\nclass parser\n{\n    using number_integer_t = typename BasicJsonType::number_integer_t;\n    using number_unsigned_t = typename BasicJsonType::number_unsigned_t;\n    using number_float_t = typename BasicJsonType::number_float_t;\n    using string_t = typename BasicJsonType::string_t;\n    using lexer_t = lexer<BasicJsonType, InputAdapterType>;\n    using token_type = typename lexer_t::token_type;\n\n  public:\n    /// a parser reading from an input adapter\n    explicit parser(InputAdapterType&& adapter,\n                    const parser_callback_t<BasicJsonType> cb = nullptr,\n                    const bool allow_exceptions_ = true,\n                    const bool skip_comments = false)\n        : callback(cb)\n        , m_lexer(std::move(adapter), skip_comments)\n        , allow_exceptions(allow_exceptions_)\n    {\n        // read first token\n        get_token();\n    }\n\n    /*!\n    @brief public parser interface\n\n    @param[in] strict      whether to expect the last token to be EOF\n    @param[in,out] result  parsed JSON value\n\n    @throw parse_error.101 in case of an unexpected token\n    @throw parse_error.102 if to_unicode fails or surrogate error\n    @throw parse_error.103 if to_unicode fails\n    */\n    void parse(const bool strict, BasicJsonType& result)\n    {\n        if (callback)\n        {\n            json_sax_dom_callback_parser<BasicJsonType> sdp(result, callback, allow_exceptions);\n            sax_parse_internal(&sdp);\n            result.assert_invariant();\n\n            // in strict mode, input must be completely read\n            if (strict && (get_token() != token_type::end_of_input))\n            {\n                sdp.parse_error(m_lexer.get_position(),\n                                m_lexer.get_token_string(),\n                                parse_error::create(101, m_lexer.get_position(),\n                                                    exception_message(token_type::end_of_input, \"value\")));\n            }\n\n            // in case of an error, return discarded value\n            if (sdp.is_errored())\n            {\n                result = value_t::discarded;\n                return;\n            }\n\n            // set top-level value to null if it was discarded by the callback\n            // function\n            if (result.is_discarded())\n            {\n                result = nullptr;\n            }\n        }\n        else\n        {\n            json_sax_dom_parser<BasicJsonType> sdp(result, allow_exceptions);\n            sax_parse_internal(&sdp);\n            result.assert_invariant();\n\n            // in strict mode, input must be completely read\n            if (strict && (get_token() != token_type::end_of_input))\n            {\n                sdp.parse_error(m_lexer.get_position(),\n                                m_lexer.get_token_string(),\n                                parse_error::create(101, m_lexer.get_position(),\n                                                    exception_message(token_type::end_of_input, \"value\")));\n            }\n\n            // in case of an error, return discarded value\n            if (sdp.is_errored())\n            {\n                result = value_t::discarded;\n                return;\n            }\n        }\n    }\n\n    /*!\n    @brief public accept interface\n\n    @param[in] strict  whether to expect the last token to be EOF\n    @return whether the input is a proper JSON text\n    */\n    bool accept(const bool strict = true)\n    {\n        json_sax_acceptor<BasicJsonType> sax_acceptor;\n        return sax_parse(&sax_acceptor, strict);\n    }\n\n    template<typename SAX>\n    JSON_HEDLEY_NON_NULL(2)\n    bool sax_parse(SAX* sax, const bool strict = true)\n    {\n        (void)detail::is_sax_static_asserts<SAX, BasicJsonType> {};\n        const bool result = sax_parse_internal(sax);\n\n        // strict mode: next byte must be EOF\n        if (result && strict && (get_token() != token_type::end_of_input))\n        {\n            return sax->parse_error(m_lexer.get_position(),\n                                    m_lexer.get_token_string(),\n                                    parse_error::create(101, m_lexer.get_position(),\n                                            exception_message(token_type::end_of_input, \"value\")));\n        }\n\n        return result;\n    }\n\n  private:\n    template<typename SAX>\n    JSON_HEDLEY_NON_NULL(2)\n    bool sax_parse_internal(SAX* sax)\n    {\n        // stack to remember the hierarchy of structured values we are parsing\n        // true = array; false = object\n        std::vector<bool> states;\n        // value to avoid a goto (see comment where set to true)\n        bool skip_to_state_evaluation = false;\n\n        while (true)\n        {\n            if (!skip_to_state_evaluation)\n            {\n                // invariant: get_token() was called before each iteration\n                switch (last_token)\n                {\n                    case token_type::begin_object:\n                    {\n                        if (JSON_HEDLEY_UNLIKELY(!sax->start_object(std::size_t(-1))))\n                        {\n                            return false;\n                        }\n\n                        // closing } -> we are done\n                        if (get_token() == token_type::end_object)\n                        {\n                            if (JSON_HEDLEY_UNLIKELY(!sax->end_object()))\n                            {\n                                return false;\n                            }\n                            break;\n                        }\n\n                        // parse key\n                        if (JSON_HEDLEY_UNLIKELY(last_token != token_type::value_string))\n                        {\n                            return sax->parse_error(m_lexer.get_position(),\n                                                    m_lexer.get_token_string(),\n                                                    parse_error::create(101, m_lexer.get_position(),\n                                                            exception_message(token_type::value_string, \"object key\")));\n                        }\n                        if (JSON_HEDLEY_UNLIKELY(!sax->key(m_lexer.get_string())))\n                        {\n                            return false;\n                        }\n\n                        // parse separator (:)\n                        if (JSON_HEDLEY_UNLIKELY(get_token() != token_type::name_separator))\n                        {\n                            return sax->parse_error(m_lexer.get_position(),\n                                                    m_lexer.get_token_string(),\n                                                    parse_error::create(101, m_lexer.get_position(),\n                                                            exception_message(token_type::name_separator, \"object separator\")));\n                        }\n\n                        // remember we are now inside an object\n                        states.push_back(false);\n\n                        // parse values\n                        get_token();\n                        continue;\n                    }\n\n                    case token_type::begin_array:\n                    {\n                        if (JSON_HEDLEY_UNLIKELY(!sax->start_array(std::size_t(-1))))\n                        {\n                            return false;\n                        }\n\n                        // closing ] -> we are done\n                        if (get_token() == token_type::end_array)\n                        {\n                            if (JSON_HEDLEY_UNLIKELY(!sax->end_array()))\n                            {\n                                return false;\n                            }\n                            break;\n                        }\n\n                        // remember we are now inside an array\n                        states.push_back(true);\n\n                        // parse values (no need to call get_token)\n                        continue;\n                    }\n\n                    case token_type::value_float:\n                    {\n                        const auto res = m_lexer.get_number_float();\n\n                        if (JSON_HEDLEY_UNLIKELY(!std::isfinite(res)))\n                        {\n                            return sax->parse_error(m_lexer.get_position(),\n                                                    m_lexer.get_token_string(),\n                                                    out_of_range::create(406, \"number overflow parsing '\" + m_lexer.get_token_string() + \"'\"));\n                        }\n\n                        if (JSON_HEDLEY_UNLIKELY(!sax->number_float(res, m_lexer.get_string())))\n                        {\n                            return false;\n                        }\n\n                        break;\n                    }\n\n                    case token_type::literal_false:\n                    {\n                        if (JSON_HEDLEY_UNLIKELY(!sax->boolean(false)))\n                        {\n                            return false;\n                        }\n                        break;\n                    }\n\n                    case token_type::literal_null:\n                    {\n                        if (JSON_HEDLEY_UNLIKELY(!sax->null()))\n                        {\n                            return false;\n                        }\n                        break;\n                    }\n\n                    case token_type::literal_true:\n                    {\n                        if (JSON_HEDLEY_UNLIKELY(!sax->boolean(true)))\n                        {\n                            return false;\n                        }\n                        break;\n                    }\n\n                    case token_type::value_integer:\n                    {\n                        if (JSON_HEDLEY_UNLIKELY(!sax->number_integer(m_lexer.get_number_integer())))\n                        {\n                            return false;\n                        }\n                        break;\n                    }\n\n                    case token_type::value_string:\n                    {\n                        if (JSON_HEDLEY_UNLIKELY(!sax->string(m_lexer.get_string())))\n                        {\n                            return false;\n                        }\n                        break;\n                    }\n\n                    case token_type::value_unsigned:\n                    {\n                        if (JSON_HEDLEY_UNLIKELY(!sax->number_unsigned(m_lexer.get_number_unsigned())))\n                        {\n                            return false;\n                        }\n                        break;\n                    }\n\n                    case token_type::parse_error:\n                    {\n                        // using \"uninitialized\" to avoid \"expected\" message\n                        return sax->parse_error(m_lexer.get_position(),\n                                                m_lexer.get_token_string(),\n                                                parse_error::create(101, m_lexer.get_position(),\n                                                        exception_message(token_type::uninitialized, \"value\")));\n                    }\n\n                    default: // the last token was unexpected\n                    {\n                        return sax->parse_error(m_lexer.get_position(),\n                                                m_lexer.get_token_string(),\n                                                parse_error::create(101, m_lexer.get_position(),\n                                                        exception_message(token_type::literal_or_value, \"value\")));\n                    }\n                }\n            }\n            else\n            {\n                skip_to_state_evaluation = false;\n            }\n\n            // we reached this line after we successfully parsed a value\n            if (states.empty())\n            {\n                // empty stack: we reached the end of the hierarchy: done\n                return true;\n            }\n\n            if (states.back())  // array\n            {\n                // comma -> next value\n                if (get_token() == token_type::value_separator)\n                {\n                    // parse a new value\n                    get_token();\n                    continue;\n                }\n\n                // closing ]\n                if (JSON_HEDLEY_LIKELY(last_token == token_type::end_array))\n                {\n                    if (JSON_HEDLEY_UNLIKELY(!sax->end_array()))\n                    {\n                        return false;\n                    }\n\n                    // We are done with this array. Before we can parse a\n                    // new value, we need to evaluate the new state first.\n                    // By setting skip_to_state_evaluation to false, we\n                    // are effectively jumping to the beginning of this if.\n                    JSON_ASSERT(!states.empty());\n                    states.pop_back();\n                    skip_to_state_evaluation = true;\n                    continue;\n                }\n\n                return sax->parse_error(m_lexer.get_position(),\n                                        m_lexer.get_token_string(),\n                                        parse_error::create(101, m_lexer.get_position(),\n                                                exception_message(token_type::end_array, \"array\")));\n            }\n            else  // object\n            {\n                // comma -> next value\n                if (get_token() == token_type::value_separator)\n                {\n                    // parse key\n                    if (JSON_HEDLEY_UNLIKELY(get_token() != token_type::value_string))\n                    {\n                        return sax->parse_error(m_lexer.get_position(),\n                                                m_lexer.get_token_string(),\n                                                parse_error::create(101, m_lexer.get_position(),\n                                                        exception_message(token_type::value_string, \"object key\")));\n                    }\n\n                    if (JSON_HEDLEY_UNLIKELY(!sax->key(m_lexer.get_string())))\n                    {\n                        return false;\n                    }\n\n                    // parse separator (:)\n                    if (JSON_HEDLEY_UNLIKELY(get_token() != token_type::name_separator))\n                    {\n                        return sax->parse_error(m_lexer.get_position(),\n                                                m_lexer.get_token_string(),\n                                                parse_error::create(101, m_lexer.get_position(),\n                                                        exception_message(token_type::name_separator, \"object separator\")));\n                    }\n\n                    // parse values\n                    get_token();\n                    continue;\n                }\n\n                // closing }\n                if (JSON_HEDLEY_LIKELY(last_token == token_type::end_object))\n                {\n                    if (JSON_HEDLEY_UNLIKELY(!sax->end_object()))\n                    {\n                        return false;\n                    }\n\n                    // We are done with this object. Before we can parse a\n                    // new value, we need to evaluate the new state first.\n                    // By setting skip_to_state_evaluation to false, we\n                    // are effectively jumping to the beginning of this if.\n                    JSON_ASSERT(!states.empty());\n                    states.pop_back();\n                    skip_to_state_evaluation = true;\n                    continue;\n                }\n\n                return sax->parse_error(m_lexer.get_position(),\n                                        m_lexer.get_token_string(),\n                                        parse_error::create(101, m_lexer.get_position(),\n                                                exception_message(token_type::end_object, \"object\")));\n            }\n        }\n    }\n\n    /// get next token from lexer\n    token_type get_token()\n    {\n        return last_token = m_lexer.scan();\n    }\n\n    std::string exception_message(const token_type expected, const std::string& context)\n    {\n        std::string error_msg = \"syntax error \";\n\n        if (!context.empty())\n        {\n            error_msg += \"while parsing \" + context + \" \";\n        }\n\n        error_msg += \"- \";\n\n        if (last_token == token_type::parse_error)\n        {\n            error_msg += std::string(m_lexer.get_error_message()) + \"; last read: '\" +\n                         m_lexer.get_token_string() + \"'\";\n        }\n        else\n        {\n            error_msg += \"unexpected \" + std::string(lexer_t::token_type_name(last_token));\n        }\n\n        if (expected != token_type::uninitialized)\n        {\n            error_msg += \"; expected \" + std::string(lexer_t::token_type_name(expected));\n        }\n\n        return error_msg;\n    }\n\n  private:\n    /// callback function\n    const parser_callback_t<BasicJsonType> callback = nullptr;\n    /// the type of the last read token\n    token_type last_token = token_type::uninitialized;\n    /// the lexer\n    lexer_t m_lexer;\n    /// whether to throw exceptions in case of errors\n    const bool allow_exceptions = true;\n};\n}  // namespace detail\n}  // namespace nlohmann\n\n// #include <nlohmann/detail/iterators/internal_iterator.hpp>\n\n\n// #include <nlohmann/detail/iterators/primitive_iterator.hpp>\n\n\n#include <cstddef> // ptrdiff_t\n#include <limits>  // numeric_limits\n\nnamespace nlohmann\n{\nnamespace detail\n{\n/*\n@brief an iterator for primitive JSON types\n\nThis class models an iterator for primitive JSON types (boolean, number,\nstring). It's only purpose is to allow the iterator/const_iterator classes\nto \"iterate\" over primitive values. Internally, the iterator is modeled by\na `difference_type` variable. Value begin_value (`0`) models the begin,\nend_value (`1`) models past the end.\n*/\nclass primitive_iterator_t\n{\n  private:\n    using difference_type = std::ptrdiff_t;\n    static constexpr difference_type begin_value = 0;\n    static constexpr difference_type end_value = begin_value + 1;\n\n  JSON_PRIVATE_UNLESS_TESTED:\n    /// iterator as signed integer type\n    difference_type m_it = (std::numeric_limits<std::ptrdiff_t>::min)();\n\n  public:\n    constexpr difference_type get_value() const noexcept\n    {\n        return m_it;\n    }\n\n    /// set iterator to a defined beginning\n    void set_begin() noexcept\n    {\n        m_it = begin_value;\n    }\n\n    /// set iterator to a defined past the end\n    void set_end() noexcept\n    {\n        m_it = end_value;\n    }\n\n    /// return whether the iterator can be dereferenced\n    constexpr bool is_begin() const noexcept\n    {\n        return m_it == begin_value;\n    }\n\n    /// return whether the iterator is at end\n    constexpr bool is_end() const noexcept\n    {\n        return m_it == end_value;\n    }\n\n    friend constexpr bool operator==(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept\n    {\n        return lhs.m_it == rhs.m_it;\n    }\n\n    friend constexpr bool operator<(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept\n    {\n        return lhs.m_it < rhs.m_it;\n    }\n\n    primitive_iterator_t operator+(difference_type n) noexcept\n    {\n        auto result = *this;\n        result += n;\n        return result;\n    }\n\n    friend constexpr difference_type operator-(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept\n    {\n        return lhs.m_it - rhs.m_it;\n    }\n\n    primitive_iterator_t& operator++() noexcept\n    {\n        ++m_it;\n        return *this;\n    }\n\n    primitive_iterator_t const operator++(int) noexcept\n    {\n        auto result = *this;\n        ++m_it;\n        return result;\n    }\n\n    primitive_iterator_t& operator--() noexcept\n    {\n        --m_it;\n        return *this;\n    }\n\n    primitive_iterator_t const operator--(int) noexcept\n    {\n        auto result = *this;\n        --m_it;\n        return result;\n    }\n\n    primitive_iterator_t& operator+=(difference_type n) noexcept\n    {\n        m_it += n;\n        return *this;\n    }\n\n    primitive_iterator_t& operator-=(difference_type n) noexcept\n    {\n        m_it -= n;\n        return *this;\n    }\n};\n}  // namespace detail\n}  // namespace nlohmann\n\n\nnamespace nlohmann\n{\nnamespace detail\n{\n/*!\n@brief an iterator value\n\n@note This structure could easily be a union, but MSVC currently does not allow\nunions members with complex constructors, see https://github.com/nlohmann/json/pull/105.\n*/\ntemplate<typename BasicJsonType> struct internal_iterator\n{\n    /// iterator for JSON objects\n    typename BasicJsonType::object_t::iterator object_iterator {};\n    /// iterator for JSON arrays\n    typename BasicJsonType::array_t::iterator array_iterator {};\n    /// generic iterator for all other types\n    primitive_iterator_t primitive_iterator {};\n};\n}  // namespace detail\n}  // namespace nlohmann\n\n// #include <nlohmann/detail/iterators/iter_impl.hpp>\n\n\n#include <iterator> // iterator, random_access_iterator_tag, bidirectional_iterator_tag, advance, next\n#include <type_traits> // conditional, is_const, remove_const\n\n// #include <nlohmann/detail/exceptions.hpp>\n\n// #include <nlohmann/detail/iterators/internal_iterator.hpp>\n\n// #include <nlohmann/detail/iterators/primitive_iterator.hpp>\n\n// #include <nlohmann/detail/macro_scope.hpp>\n\n// #include <nlohmann/detail/meta/cpp_future.hpp>\n\n// #include <nlohmann/detail/meta/type_traits.hpp>\n\n// #include <nlohmann/detail/value_t.hpp>\n\n\nnamespace nlohmann\n{\nnamespace detail\n{\n// forward declare, to be able to friend it later on\ntemplate<typename IteratorType> class iteration_proxy;\ntemplate<typename IteratorType> class iteration_proxy_value;\n\n/*!\n@brief a template for a bidirectional iterator for the @ref basic_json class\nThis class implements a both iterators (iterator and const_iterator) for the\n@ref basic_json class.\n@note An iterator is called *initialized* when a pointer to a JSON value has\n      been set (e.g., by a constructor or a copy assignment). If the iterator is\n      default-constructed, it is *uninitialized* and most methods are undefined.\n      **The library uses assertions to detect calls on uninitialized iterators.**\n@requirement The class satisfies the following concept requirements:\n-\n[BidirectionalIterator](https://en.cppreference.com/w/cpp/named_req/BidirectionalIterator):\n  The iterator that can be moved can be moved in both directions (i.e.\n  incremented and decremented).\n@since version 1.0.0, simplified in version 2.0.9, change to bidirectional\n       iterators in version 3.0.0 (see https://github.com/nlohmann/json/issues/593)\n*/\ntemplate<typename BasicJsonType>\nclass iter_impl\n{\n    /// allow basic_json to access private members\n    friend iter_impl<typename std::conditional<std::is_const<BasicJsonType>::value, typename std::remove_const<BasicJsonType>::type, const BasicJsonType>::type>;\n    friend BasicJsonType;\n    friend iteration_proxy<iter_impl>;\n    friend iteration_proxy_value<iter_impl>;\n\n    using object_t = typename BasicJsonType::object_t;\n    using array_t = typename BasicJsonType::array_t;\n    // make sure BasicJsonType is basic_json or const basic_json\n    static_assert(is_basic_json<typename std::remove_const<BasicJsonType>::type>::value,\n                  \"iter_impl only accepts (const) basic_json\");\n\n  public:\n\n    /// The std::iterator class template (used as a base class to provide typedefs) is deprecated in C++17.\n    /// The C++ Standard has never required user-defined iterators to derive from std::iterator.\n    /// A user-defined iterator should provide publicly accessible typedefs named\n    /// iterator_category, value_type, difference_type, pointer, and reference.\n    /// Note that value_type is required to be non-const, even for constant iterators.\n    using iterator_category = std::bidirectional_iterator_tag;\n\n    /// the type of the values when the iterator is dereferenced\n    using value_type = typename BasicJsonType::value_type;\n    /// a type to represent differences between iterators\n    using difference_type = typename BasicJsonType::difference_type;\n    /// defines a pointer to the type iterated over (value_type)\n    using pointer = typename std::conditional<std::is_const<BasicJsonType>::value,\n          typename BasicJsonType::const_pointer,\n          typename BasicJsonType::pointer>::type;\n    /// defines a reference to the type iterated over (value_type)\n    using reference =\n        typename std::conditional<std::is_const<BasicJsonType>::value,\n        typename BasicJsonType::const_reference,\n        typename BasicJsonType::reference>::type;\n\n    /// default constructor\n    iter_impl() = default;\n\n    /*!\n    @brief constructor for a given JSON instance\n    @param[in] object  pointer to a JSON object for this iterator\n    @pre object != nullptr\n    @post The iterator is initialized; i.e. `m_object != nullptr`.\n    */\n    explicit iter_impl(pointer object) noexcept : m_object(object)\n    {\n        JSON_ASSERT(m_object != nullptr);\n\n        switch (m_object->m_type)\n        {\n            case value_t::object:\n            {\n                m_it.object_iterator = typename object_t::iterator();\n                break;\n            }\n\n            case value_t::array:\n            {\n                m_it.array_iterator = typename array_t::iterator();\n                break;\n            }\n\n            default:\n            {\n                m_it.primitive_iterator = primitive_iterator_t();\n                break;\n            }\n        }\n    }\n\n    /*!\n    @note The conventional copy constructor and copy assignment are implicitly\n          defined. Combined with the following converting constructor and\n          assignment, they support: (1) copy from iterator to iterator, (2)\n          copy from const iterator to const iterator, and (3) conversion from\n          iterator to const iterator. However conversion from const iterator\n          to iterator is not defined.\n    */\n\n    /*!\n    @brief const copy constructor\n    @param[in] other const iterator to copy from\n    @note This copy constructor had to be defined explicitly to circumvent a bug\n          occurring on msvc v19.0 compiler (VS 2015) debug build. For more\n          information refer to: https://github.com/nlohmann/json/issues/1608\n    */\n    iter_impl(const iter_impl<const BasicJsonType>& other) noexcept\n        : m_object(other.m_object), m_it(other.m_it)\n    {}\n\n    /*!\n    @brief converting assignment\n    @param[in] other const iterator to copy from\n    @return const/non-const iterator\n    @note It is not checked whether @a other is initialized.\n    */\n    iter_impl& operator=(const iter_impl<const BasicJsonType>& other) noexcept\n    {\n        m_object = other.m_object;\n        m_it = other.m_it;\n        return *this;\n    }\n\n    /*!\n    @brief converting constructor\n    @param[in] other  non-const iterator to copy from\n    @note It is not checked whether @a other is initialized.\n    */\n    iter_impl(const iter_impl<typename std::remove_const<BasicJsonType>::type>& other) noexcept\n        : m_object(other.m_object), m_it(other.m_it)\n    {}\n\n    /*!\n    @brief converting assignment\n    @param[in] other  non-const iterator to copy from\n    @return const/non-const iterator\n    @note It is not checked whether @a other is initialized.\n    */\n    iter_impl& operator=(const iter_impl<typename std::remove_const<BasicJsonType>::type>& other) noexcept\n    {\n        m_object = other.m_object;\n        m_it = other.m_it;\n        return *this;\n    }\n\n  JSON_PRIVATE_UNLESS_TESTED:\n    /*!\n    @brief set the iterator to the first value\n    @pre The iterator is initialized; i.e. `m_object != nullptr`.\n    */\n    void set_begin() noexcept\n    {\n        JSON_ASSERT(m_object != nullptr);\n\n        switch (m_object->m_type)\n        {\n            case value_t::object:\n            {\n                m_it.object_iterator = m_object->m_value.object->begin();\n                break;\n            }\n\n            case value_t::array:\n            {\n                m_it.array_iterator = m_object->m_value.array->begin();\n                break;\n            }\n\n            case value_t::null:\n            {\n                // set to end so begin()==end() is true: null is empty\n                m_it.primitive_iterator.set_end();\n                break;\n            }\n\n            default:\n            {\n                m_it.primitive_iterator.set_begin();\n                break;\n            }\n        }\n    }\n\n    /*!\n    @brief set the iterator past the last value\n    @pre The iterator is initialized; i.e. `m_object != nullptr`.\n    */\n    void set_end() noexcept\n    {\n        JSON_ASSERT(m_object != nullptr);\n\n        switch (m_object->m_type)\n        {\n            case value_t::object:\n            {\n                m_it.object_iterator = m_object->m_value.object->end();\n                break;\n            }\n\n            case value_t::array:\n            {\n                m_it.array_iterator = m_object->m_value.array->end();\n                break;\n            }\n\n            default:\n            {\n                m_it.primitive_iterator.set_end();\n                break;\n            }\n        }\n    }\n\n  public:\n    /*!\n    @brief return a reference to the value pointed to by the iterator\n    @pre The iterator is initialized; i.e. `m_object != nullptr`.\n    */\n    reference operator*() const\n    {\n        JSON_ASSERT(m_object != nullptr);\n\n        switch (m_object->m_type)\n        {\n            case value_t::object:\n            {\n                JSON_ASSERT(m_it.object_iterator != m_object->m_value.object->end());\n                return m_it.object_iterator->second;\n            }\n\n            case value_t::array:\n            {\n                JSON_ASSERT(m_it.array_iterator != m_object->m_value.array->end());\n                return *m_it.array_iterator;\n            }\n\n            case value_t::null:\n                JSON_THROW(invalid_iterator::create(214, \"cannot get value\"));\n\n            default:\n            {\n                if (JSON_HEDLEY_LIKELY(m_it.primitive_iterator.is_begin()))\n                {\n                    return *m_object;\n                }\n\n                JSON_THROW(invalid_iterator::create(214, \"cannot get value\"));\n            }\n        }\n    }\n\n    /*!\n    @brief dereference the iterator\n    @pre The iterator is initialized; i.e. `m_object != nullptr`.\n    */\n    pointer operator->() const\n    {\n        JSON_ASSERT(m_object != nullptr);\n\n        switch (m_object->m_type)\n        {\n            case value_t::object:\n            {\n                JSON_ASSERT(m_it.object_iterator != m_object->m_value.object->end());\n                return &(m_it.object_iterator->second);\n            }\n\n            case value_t::array:\n            {\n                JSON_ASSERT(m_it.array_iterator != m_object->m_value.array->end());\n                return &*m_it.array_iterator;\n            }\n\n            default:\n            {\n                if (JSON_HEDLEY_LIKELY(m_it.primitive_iterator.is_begin()))\n                {\n                    return m_object;\n                }\n\n                JSON_THROW(invalid_iterator::create(214, \"cannot get value\"));\n            }\n        }\n    }\n\n    /*!\n    @brief post-increment (it++)\n    @pre The iterator is initialized; i.e. `m_object != nullptr`.\n    */\n    iter_impl const operator++(int)\n    {\n        auto result = *this;\n        ++(*this);\n        return result;\n    }\n\n    /*!\n    @brief pre-increment (++it)\n    @pre The iterator is initialized; i.e. `m_object != nullptr`.\n    */\n    iter_impl& operator++()\n    {\n        JSON_ASSERT(m_object != nullptr);\n\n        switch (m_object->m_type)\n        {\n            case value_t::object:\n            {\n                std::advance(m_it.object_iterator, 1);\n                break;\n            }\n\n            case value_t::array:\n            {\n                std::advance(m_it.array_iterator, 1);\n                break;\n            }\n\n            default:\n            {\n                ++m_it.primitive_iterator;\n                break;\n            }\n        }\n\n        return *this;\n    }\n\n    /*!\n    @brief post-decrement (it--)\n    @pre The iterator is initialized; i.e. `m_object != nullptr`.\n    */\n    iter_impl const operator--(int)\n    {\n        auto result = *this;\n        --(*this);\n        return result;\n    }\n\n    /*!\n    @brief pre-decrement (--it)\n    @pre The iterator is initialized; i.e. `m_object != nullptr`.\n    */\n    iter_impl& operator--()\n    {\n        JSON_ASSERT(m_object != nullptr);\n\n        switch (m_object->m_type)\n        {\n            case value_t::object:\n            {\n                std::advance(m_it.object_iterator, -1);\n                break;\n            }\n\n            case value_t::array:\n            {\n                std::advance(m_it.array_iterator, -1);\n                break;\n            }\n\n            default:\n            {\n                --m_it.primitive_iterator;\n                break;\n            }\n        }\n\n        return *this;\n    }\n\n    /*!\n    @brief  comparison: equal\n    @pre The iterator is initialized; i.e. `m_object != nullptr`.\n    */\n    bool operator==(const iter_impl& other) const\n    {\n        // if objects are not the same, the comparison is undefined\n        if (JSON_HEDLEY_UNLIKELY(m_object != other.m_object))\n        {\n            JSON_THROW(invalid_iterator::create(212, \"cannot compare iterators of different containers\"));\n        }\n\n        JSON_ASSERT(m_object != nullptr);\n\n        switch (m_object->m_type)\n        {\n            case value_t::object:\n                return (m_it.object_iterator == other.m_it.object_iterator);\n\n            case value_t::array:\n                return (m_it.array_iterator == other.m_it.array_iterator);\n\n            default:\n                return (m_it.primitive_iterator == other.m_it.primitive_iterator);\n        }\n    }\n\n    /*!\n    @brief  comparison: not equal\n    @pre The iterator is initialized; i.e. `m_object != nullptr`.\n    */\n    bool operator!=(const iter_impl& other) const\n    {\n        return !operator==(other);\n    }\n\n    /*!\n    @brief  comparison: smaller\n    @pre The iterator is initialized; i.e. `m_object != nullptr`.\n    */\n    bool operator<(const iter_impl& other) const\n    {\n        // if objects are not the same, the comparison is undefined\n        if (JSON_HEDLEY_UNLIKELY(m_object != other.m_object))\n        {\n            JSON_THROW(invalid_iterator::create(212, \"cannot compare iterators of different containers\"));\n        }\n\n        JSON_ASSERT(m_object != nullptr);\n\n        switch (m_object->m_type)\n        {\n            case value_t::object:\n                JSON_THROW(invalid_iterator::create(213, \"cannot compare order of object iterators\"));\n\n            case value_t::array:\n                return (m_it.array_iterator < other.m_it.array_iterator);\n\n            default:\n                return (m_it.primitive_iterator < other.m_it.primitive_iterator);\n        }\n    }\n\n    /*!\n    @brief  comparison: less than or equal\n    @pre The iterator is initialized; i.e. `m_object != nullptr`.\n    */\n    bool operator<=(const iter_impl& other) const\n    {\n        return !other.operator < (*this);\n    }\n\n    /*!\n    @brief  comparison: greater than\n    @pre The iterator is initialized; i.e. `m_object != nullptr`.\n    */\n    bool operator>(const iter_impl& other) const\n    {\n        return !operator<=(other);\n    }\n\n    /*!\n    @brief  comparison: greater than or equal\n    @pre The iterator is initialized; i.e. `m_object != nullptr`.\n    */\n    bool operator>=(const iter_impl& other) const\n    {\n        return !operator<(other);\n    }\n\n    /*!\n    @brief  add to iterator\n    @pre The iterator is initialized; i.e. `m_object != nullptr`.\n    */\n    iter_impl& operator+=(difference_type i)\n    {\n        JSON_ASSERT(m_object != nullptr);\n\n        switch (m_object->m_type)\n        {\n            case value_t::object:\n                JSON_THROW(invalid_iterator::create(209, \"cannot use offsets with object iterators\"));\n\n            case value_t::array:\n            {\n                std::advance(m_it.array_iterator, i);\n                break;\n            }\n\n            default:\n            {\n                m_it.primitive_iterator += i;\n                break;\n            }\n        }\n\n        return *this;\n    }\n\n    /*!\n    @brief  subtract from iterator\n    @pre The iterator is initialized; i.e. `m_object != nullptr`.\n    */\n    iter_impl& operator-=(difference_type i)\n    {\n        return operator+=(-i);\n    }\n\n    /*!\n    @brief  add to iterator\n    @pre The iterator is initialized; i.e. `m_object != nullptr`.\n    */\n    iter_impl operator+(difference_type i) const\n    {\n        auto result = *this;\n        result += i;\n        return result;\n    }\n\n    /*!\n    @brief  addition of distance and iterator\n    @pre The iterator is initialized; i.e. `m_object != nullptr`.\n    */\n    friend iter_impl operator+(difference_type i, const iter_impl& it)\n    {\n        auto result = it;\n        result += i;\n        return result;\n    }\n\n    /*!\n    @brief  subtract from iterator\n    @pre The iterator is initialized; i.e. `m_object != nullptr`.\n    */\n    iter_impl operator-(difference_type i) const\n    {\n        auto result = *this;\n        result -= i;\n        return result;\n    }\n\n    /*!\n    @brief  return difference\n    @pre The iterator is initialized; i.e. `m_object != nullptr`.\n    */\n    difference_type operator-(const iter_impl& other) const\n    {\n        JSON_ASSERT(m_object != nullptr);\n\n        switch (m_object->m_type)\n        {\n            case value_t::object:\n                JSON_THROW(invalid_iterator::create(209, \"cannot use offsets with object iterators\"));\n\n            case value_t::array:\n                return m_it.array_iterator - other.m_it.array_iterator;\n\n            default:\n                return m_it.primitive_iterator - other.m_it.primitive_iterator;\n        }\n    }\n\n    /*!\n    @brief  access to successor\n    @pre The iterator is initialized; i.e. `m_object != nullptr`.\n    */\n    reference operator[](difference_type n) const\n    {\n        JSON_ASSERT(m_object != nullptr);\n\n        switch (m_object->m_type)\n        {\n            case value_t::object:\n                JSON_THROW(invalid_iterator::create(208, \"cannot use operator[] for object iterators\"));\n\n            case value_t::array:\n                return *std::next(m_it.array_iterator, n);\n\n            case value_t::null:\n                JSON_THROW(invalid_iterator::create(214, \"cannot get value\"));\n\n            default:\n            {\n                if (JSON_HEDLEY_LIKELY(m_it.primitive_iterator.get_value() == -n))\n                {\n                    return *m_object;\n                }\n\n                JSON_THROW(invalid_iterator::create(214, \"cannot get value\"));\n            }\n        }\n    }\n\n    /*!\n    @brief  return the key of an object iterator\n    @pre The iterator is initialized; i.e. `m_object != nullptr`.\n    */\n    const typename object_t::key_type& key() const\n    {\n        JSON_ASSERT(m_object != nullptr);\n\n        if (JSON_HEDLEY_LIKELY(m_object->is_object()))\n        {\n            return m_it.object_iterator->first;\n        }\n\n        JSON_THROW(invalid_iterator::create(207, \"cannot use key() for non-object iterators\"));\n    }\n\n    /*!\n    @brief  return the value of an iterator\n    @pre The iterator is initialized; i.e. `m_object != nullptr`.\n    */\n    reference value() const\n    {\n        return operator*();\n    }\n\n  JSON_PRIVATE_UNLESS_TESTED:\n    /// associated JSON instance\n    pointer m_object = nullptr;\n    /// the actual iterator of the associated instance\n    internal_iterator<typename std::remove_const<BasicJsonType>::type> m_it {};\n};\n} // namespace detail\n} // namespace nlohmann\n\n// #include <nlohmann/detail/iterators/iteration_proxy.hpp>\n\n// #include <nlohmann/detail/iterators/json_reverse_iterator.hpp>\n\n\n#include <cstddef> // ptrdiff_t\n#include <iterator> // reverse_iterator\n#include <utility> // declval\n\nnamespace nlohmann\n{\nnamespace detail\n{\n//////////////////////\n// reverse_iterator //\n//////////////////////\n\n/*!\n@brief a template for a reverse iterator class\n\n@tparam Base the base iterator type to reverse. Valid types are @ref\niterator (to create @ref reverse_iterator) and @ref const_iterator (to\ncreate @ref const_reverse_iterator).\n\n@requirement The class satisfies the following concept requirements:\n-\n[BidirectionalIterator](https://en.cppreference.com/w/cpp/named_req/BidirectionalIterator):\n  The iterator that can be moved can be moved in both directions (i.e.\n  incremented and decremented).\n- [OutputIterator](https://en.cppreference.com/w/cpp/named_req/OutputIterator):\n  It is possible to write to the pointed-to element (only if @a Base is\n  @ref iterator).\n\n@since version 1.0.0\n*/\ntemplate<typename Base>\nclass json_reverse_iterator : public std::reverse_iterator<Base>\n{\n  public:\n    using difference_type = std::ptrdiff_t;\n    /// shortcut to the reverse iterator adapter\n    using base_iterator = std::reverse_iterator<Base>;\n    /// the reference type for the pointed-to element\n    using reference = typename Base::reference;\n\n    /// create reverse iterator from iterator\n    explicit json_reverse_iterator(const typename base_iterator::iterator_type& it) noexcept\n        : base_iterator(it) {}\n\n    /// create reverse iterator from base class\n    explicit json_reverse_iterator(const base_iterator& it) noexcept : base_iterator(it) {}\n\n    /// post-increment (it++)\n    json_reverse_iterator const operator++(int)\n    {\n        return static_cast<json_reverse_iterator>(base_iterator::operator++(1));\n    }\n\n    /// pre-increment (++it)\n    json_reverse_iterator& operator++()\n    {\n        return static_cast<json_reverse_iterator&>(base_iterator::operator++());\n    }\n\n    /// post-decrement (it--)\n    json_reverse_iterator const operator--(int)\n    {\n        return static_cast<json_reverse_iterator>(base_iterator::operator--(1));\n    }\n\n    /// pre-decrement (--it)\n    json_reverse_iterator& operator--()\n    {\n        return static_cast<json_reverse_iterator&>(base_iterator::operator--());\n    }\n\n    /// add to iterator\n    json_reverse_iterator& operator+=(difference_type i)\n    {\n        return static_cast<json_reverse_iterator&>(base_iterator::operator+=(i));\n    }\n\n    /// add to iterator\n    json_reverse_iterator operator+(difference_type i) const\n    {\n        return static_cast<json_reverse_iterator>(base_iterator::operator+(i));\n    }\n\n    /// subtract from iterator\n    json_reverse_iterator operator-(difference_type i) const\n    {\n        return static_cast<json_reverse_iterator>(base_iterator::operator-(i));\n    }\n\n    /// return difference\n    difference_type operator-(const json_reverse_iterator& other) const\n    {\n        return base_iterator(*this) - base_iterator(other);\n    }\n\n    /// access to successor\n    reference operator[](difference_type n) const\n    {\n        return *(this->operator+(n));\n    }\n\n    /// return the key of an object iterator\n    auto key() const -> decltype(std::declval<Base>().key())\n    {\n        auto it = --this->base();\n        return it.key();\n    }\n\n    /// return the value of an iterator\n    reference value() const\n    {\n        auto it = --this->base();\n        return it.operator * ();\n    }\n};\n}  // namespace detail\n}  // namespace nlohmann\n\n// #include <nlohmann/detail/iterators/primitive_iterator.hpp>\n\n// #include <nlohmann/detail/json_pointer.hpp>\n\n\n#include <algorithm> // all_of\n#include <cctype> // isdigit\n#include <limits> // max\n#include <numeric> // accumulate\n#include <string> // string\n#include <utility> // move\n#include <vector> // vector\n\n// #include <nlohmann/detail/exceptions.hpp>\n\n// #include <nlohmann/detail/macro_scope.hpp>\n\n// #include <nlohmann/detail/value_t.hpp>\n\n\nnamespace nlohmann\n{\ntemplate<typename BasicJsonType>\nclass json_pointer\n{\n    // allow basic_json to access private members\n    NLOHMANN_BASIC_JSON_TPL_DECLARATION\n    friend class basic_json;\n\n  public:\n    /*!\n    @brief create JSON pointer\n\n    Create a JSON pointer according to the syntax described in\n    [Section 3 of RFC6901](https://tools.ietf.org/html/rfc6901#section-3).\n\n    @param[in] s  string representing the JSON pointer; if omitted, the empty\n                  string is assumed which references the whole JSON value\n\n    @throw parse_error.107 if the given JSON pointer @a s is nonempty and does\n                           not begin with a slash (`/`); see example below\n\n    @throw parse_error.108 if a tilde (`~`) in the given JSON pointer @a s is\n    not followed by `0` (representing `~`) or `1` (representing `/`); see\n    example below\n\n    @liveexample{The example shows the construction several valid JSON pointers\n    as well as the exceptional behavior.,json_pointer}\n\n    @since version 2.0.0\n    */\n    explicit json_pointer(const std::string& s = \"\")\n        : reference_tokens(split(s))\n    {}\n\n    /*!\n    @brief return a string representation of the JSON pointer\n\n    @invariant For each JSON pointer `ptr`, it holds:\n    @code {.cpp}\n    ptr == json_pointer(ptr.to_string());\n    @endcode\n\n    @return a string representation of the JSON pointer\n\n    @liveexample{The example shows the result of `to_string`.,json_pointer__to_string}\n\n    @since version 2.0.0\n    */\n    std::string to_string() const\n    {\n        return std::accumulate(reference_tokens.begin(), reference_tokens.end(),\n                               std::string{},\n                               [](const std::string & a, const std::string & b)\n        {\n            return a + \"/\" + escape(b);\n        });\n    }\n\n    /// @copydoc to_string()\n    operator std::string() const\n    {\n        return to_string();\n    }\n\n    /*!\n    @brief append another JSON pointer at the end of this JSON pointer\n\n    @param[in] ptr  JSON pointer to append\n    @return JSON pointer with @a ptr appended\n\n    @liveexample{The example shows the usage of `operator/=`.,json_pointer__operator_add}\n\n    @complexity Linear in the length of @a ptr.\n\n    @sa @ref operator/=(std::string) to append a reference token\n    @sa @ref operator/=(std::size_t) to append an array index\n    @sa @ref operator/(const json_pointer&, const json_pointer&) for a binary operator\n\n    @since version 3.6.0\n    */\n    json_pointer& operator/=(const json_pointer& ptr)\n    {\n        reference_tokens.insert(reference_tokens.end(),\n                                ptr.reference_tokens.begin(),\n                                ptr.reference_tokens.end());\n        return *this;\n    }\n\n    /*!\n    @brief append an unescaped reference token at the end of this JSON pointer\n\n    @param[in] token  reference token to append\n    @return JSON pointer with @a token appended without escaping @a token\n\n    @liveexample{The example shows the usage of `operator/=`.,json_pointer__operator_add}\n\n    @complexity Amortized constant.\n\n    @sa @ref operator/=(const json_pointer&) to append a JSON pointer\n    @sa @ref operator/=(std::size_t) to append an array index\n    @sa @ref operator/(const json_pointer&, std::size_t) for a binary operator\n\n    @since version 3.6.0\n    */\n    json_pointer& operator/=(std::string token)\n    {\n        push_back(std::move(token));\n        return *this;\n    }\n\n    /*!\n    @brief append an array index at the end of this JSON pointer\n\n    @param[in] array_idx  array index to append\n    @return JSON pointer with @a array_idx appended\n\n    @liveexample{The example shows the usage of `operator/=`.,json_pointer__operator_add}\n\n    @complexity Amortized constant.\n\n    @sa @ref operator/=(const json_pointer&) to append a JSON pointer\n    @sa @ref operator/=(std::string) to append a reference token\n    @sa @ref operator/(const json_pointer&, std::string) for a binary operator\n\n    @since version 3.6.0\n    */\n    json_pointer& operator/=(std::size_t array_idx)\n    {\n        return *this /= std::to_string(array_idx);\n    }\n\n    /*!\n    @brief create a new JSON pointer by appending the right JSON pointer at the end of the left JSON pointer\n\n    @param[in] lhs  JSON pointer\n    @param[in] rhs  JSON pointer\n    @return a new JSON pointer with @a rhs appended to @a lhs\n\n    @liveexample{The example shows the usage of `operator/`.,json_pointer__operator_add_binary}\n\n    @complexity Linear in the length of @a lhs and @a rhs.\n\n    @sa @ref operator/=(const json_pointer&) to append a JSON pointer\n\n    @since version 3.6.0\n    */\n    friend json_pointer operator/(const json_pointer& lhs,\n                                  const json_pointer& rhs)\n    {\n        return json_pointer(lhs) /= rhs;\n    }\n\n    /*!\n    @brief create a new JSON pointer by appending the unescaped token at the end of the JSON pointer\n\n    @param[in] ptr  JSON pointer\n    @param[in] token  reference token\n    @return a new JSON pointer with unescaped @a token appended to @a ptr\n\n    @liveexample{The example shows the usage of `operator/`.,json_pointer__operator_add_binary}\n\n    @complexity Linear in the length of @a ptr.\n\n    @sa @ref operator/=(std::string) to append a reference token\n\n    @since version 3.6.0\n    */\n    friend json_pointer operator/(const json_pointer& ptr, std::string token)\n    {\n        return json_pointer(ptr) /= std::move(token);\n    }\n\n    /*!\n    @brief create a new JSON pointer by appending the array-index-token at the end of the JSON pointer\n\n    @param[in] ptr  JSON pointer\n    @param[in] array_idx  array index\n    @return a new JSON pointer with @a array_idx appended to @a ptr\n\n    @liveexample{The example shows the usage of `operator/`.,json_pointer__operator_add_binary}\n\n    @complexity Linear in the length of @a ptr.\n\n    @sa @ref operator/=(std::size_t) to append an array index\n\n    @since version 3.6.0\n    */\n    friend json_pointer operator/(const json_pointer& ptr, std::size_t array_idx)\n    {\n        return json_pointer(ptr) /= array_idx;\n    }\n\n    /*!\n    @brief returns the parent of this JSON pointer\n\n    @return parent of this JSON pointer; in case this JSON pointer is the root,\n            the root itself is returned\n\n    @complexity Linear in the length of the JSON pointer.\n\n    @liveexample{The example shows the result of `parent_pointer` for different\n    JSON Pointers.,json_pointer__parent_pointer}\n\n    @since version 3.6.0\n    */\n    json_pointer parent_pointer() const\n    {\n        if (empty())\n        {\n            return *this;\n        }\n\n        json_pointer res = *this;\n        res.pop_back();\n        return res;\n    }\n\n    /*!\n    @brief remove last reference token\n\n    @pre not `empty()`\n\n    @liveexample{The example shows the usage of `pop_back`.,json_pointer__pop_back}\n\n    @complexity Constant.\n\n    @throw out_of_range.405 if JSON pointer has no parent\n\n    @since version 3.6.0\n    */\n    void pop_back()\n    {\n        if (JSON_HEDLEY_UNLIKELY(empty()))\n        {\n            JSON_THROW(detail::out_of_range::create(405, \"JSON pointer has no parent\"));\n        }\n\n        reference_tokens.pop_back();\n    }\n\n    /*!\n    @brief return last reference token\n\n    @pre not `empty()`\n    @return last reference token\n\n    @liveexample{The example shows the usage of `back`.,json_pointer__back}\n\n    @complexity Constant.\n\n    @throw out_of_range.405 if JSON pointer has no parent\n\n    @since version 3.6.0\n    */\n    const std::string& back() const\n    {\n        if (JSON_HEDLEY_UNLIKELY(empty()))\n        {\n            JSON_THROW(detail::out_of_range::create(405, \"JSON pointer has no parent\"));\n        }\n\n        return reference_tokens.back();\n    }\n\n    /*!\n    @brief append an unescaped token at the end of the reference pointer\n\n    @param[in] token  token to add\n\n    @complexity Amortized constant.\n\n    @liveexample{The example shows the result of `push_back` for different\n    JSON Pointers.,json_pointer__push_back}\n\n    @since version 3.6.0\n    */\n    void push_back(const std::string& token)\n    {\n        reference_tokens.push_back(token);\n    }\n\n    /// @copydoc push_back(const std::string&)\n    void push_back(std::string&& token)\n    {\n        reference_tokens.push_back(std::move(token));\n    }\n\n    /*!\n    @brief return whether pointer points to the root document\n\n    @return true iff the JSON pointer points to the root document\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this function never throws exceptions.\n\n    @liveexample{The example shows the result of `empty` for different JSON\n    Pointers.,json_pointer__empty}\n\n    @since version 3.6.0\n    */\n    bool empty() const noexcept\n    {\n        return reference_tokens.empty();\n    }\n\n  private:\n    /*!\n    @param[in] s  reference token to be converted into an array index\n\n    @return integer representation of @a s\n\n    @throw parse_error.106  if an array index begins with '0'\n    @throw parse_error.109  if an array index begins not with a digit\n    @throw out_of_range.404 if string @a s could not be converted to an integer\n    @throw out_of_range.410 if an array index exceeds size_type\n    */\n    static typename BasicJsonType::size_type array_index(const std::string& s)\n    {\n        using size_type = typename BasicJsonType::size_type;\n\n        // error condition (cf. RFC 6901, Sect. 4)\n        if (JSON_HEDLEY_UNLIKELY(s.size() > 1 && s[0] == '0'))\n        {\n            JSON_THROW(detail::parse_error::create(106, 0,\n                                                   \"array index '\" + s +\n                                                   \"' must not begin with '0'\"));\n        }\n\n        // error condition (cf. RFC 6901, Sect. 4)\n        if (JSON_HEDLEY_UNLIKELY(s.size() > 1 && !(s[0] >= '1' && s[0] <= '9')))\n        {\n            JSON_THROW(detail::parse_error::create(109, 0, \"array index '\" + s + \"' is not a number\"));\n        }\n\n        std::size_t processed_chars = 0;\n        unsigned long long res = 0;\n        JSON_TRY\n        {\n            res = std::stoull(s, &processed_chars);\n        }\n        JSON_CATCH(std::out_of_range&)\n        {\n            JSON_THROW(detail::out_of_range::create(404, \"unresolved reference token '\" + s + \"'\"));\n        }\n\n        // check if the string was completely read\n        if (JSON_HEDLEY_UNLIKELY(processed_chars != s.size()))\n        {\n            JSON_THROW(detail::out_of_range::create(404, \"unresolved reference token '\" + s + \"'\"));\n        }\n\n        // only triggered on special platforms (like 32bit), see also\n        // https://github.com/nlohmann/json/pull/2203\n        if (res >= static_cast<unsigned long long>((std::numeric_limits<size_type>::max)()))\n        {\n            JSON_THROW(detail::out_of_range::create(410, \"array index \" + s + \" exceeds size_type\")); // LCOV_EXCL_LINE\n        }\n\n        return static_cast<size_type>(res);\n    }\n\n  JSON_PRIVATE_UNLESS_TESTED:\n    json_pointer top() const\n    {\n        if (JSON_HEDLEY_UNLIKELY(empty()))\n        {\n            JSON_THROW(detail::out_of_range::create(405, \"JSON pointer has no parent\"));\n        }\n\n        json_pointer result = *this;\n        result.reference_tokens = {reference_tokens[0]};\n        return result;\n    }\n\n  private:\n    /*!\n    @brief create and return a reference to the pointed to value\n\n    @complexity Linear in the number of reference tokens.\n\n    @throw parse_error.109 if array index is not a number\n    @throw type_error.313 if value cannot be unflattened\n    */\n    BasicJsonType& get_and_create(BasicJsonType& j) const\n    {\n        auto result = &j;\n\n        // in case no reference tokens exist, return a reference to the JSON value\n        // j which will be overwritten by a primitive value\n        for (const auto& reference_token : reference_tokens)\n        {\n            switch (result->type())\n            {\n                case detail::value_t::null:\n                {\n                    if (reference_token == \"0\")\n                    {\n                        // start a new array if reference token is 0\n                        result = &result->operator[](0);\n                    }\n                    else\n                    {\n                        // start a new object otherwise\n                        result = &result->operator[](reference_token);\n                    }\n                    break;\n                }\n\n                case detail::value_t::object:\n                {\n                    // create an entry in the object\n                    result = &result->operator[](reference_token);\n                    break;\n                }\n\n                case detail::value_t::array:\n                {\n                    // create an entry in the array\n                    result = &result->operator[](array_index(reference_token));\n                    break;\n                }\n\n                /*\n                The following code is only reached if there exists a reference\n                token _and_ the current value is primitive. In this case, we have\n                an error situation, because primitive values may only occur as\n                single value; that is, with an empty list of reference tokens.\n                */\n                default:\n                    JSON_THROW(detail::type_error::create(313, \"invalid value to unflatten\"));\n            }\n        }\n\n        return *result;\n    }\n\n    /*!\n    @brief return a reference to the pointed to value\n\n    @note This version does not throw if a value is not present, but tries to\n          create nested values instead. For instance, calling this function\n          with pointer `\"/this/that\"` on a null value is equivalent to calling\n          `operator[](\"this\").operator[](\"that\")` on that value, effectively\n          changing the null value to an object.\n\n    @param[in] ptr  a JSON value\n\n    @return reference to the JSON value pointed to by the JSON pointer\n\n    @complexity Linear in the length of the JSON pointer.\n\n    @throw parse_error.106   if an array index begins with '0'\n    @throw parse_error.109   if an array index was not a number\n    @throw out_of_range.404  if the JSON pointer can not be resolved\n    */\n    BasicJsonType& get_unchecked(BasicJsonType* ptr) const\n    {\n        for (const auto& reference_token : reference_tokens)\n        {\n            // convert null values to arrays or objects before continuing\n            if (ptr->is_null())\n            {\n                // check if reference token is a number\n                const bool nums =\n                    std::all_of(reference_token.begin(), reference_token.end(),\n                                [](const unsigned char x)\n                {\n                    return std::isdigit(x);\n                });\n\n                // change value to array for numbers or \"-\" or to object otherwise\n                *ptr = (nums || reference_token == \"-\")\n                       ? detail::value_t::array\n                       : detail::value_t::object;\n            }\n\n            switch (ptr->type())\n            {\n                case detail::value_t::object:\n                {\n                    // use unchecked object access\n                    ptr = &ptr->operator[](reference_token);\n                    break;\n                }\n\n                case detail::value_t::array:\n                {\n                    if (reference_token == \"-\")\n                    {\n                        // explicitly treat \"-\" as index beyond the end\n                        ptr = &ptr->operator[](ptr->m_value.array->size());\n                    }\n                    else\n                    {\n                        // convert array index to number; unchecked access\n                        ptr = &ptr->operator[](array_index(reference_token));\n                    }\n                    break;\n                }\n\n                default:\n                    JSON_THROW(detail::out_of_range::create(404, \"unresolved reference token '\" + reference_token + \"'\"));\n            }\n        }\n\n        return *ptr;\n    }\n\n    /*!\n    @throw parse_error.106   if an array index begins with '0'\n    @throw parse_error.109   if an array index was not a number\n    @throw out_of_range.402  if the array index '-' is used\n    @throw out_of_range.404  if the JSON pointer can not be resolved\n    */\n    BasicJsonType& get_checked(BasicJsonType* ptr) const\n    {\n        for (const auto& reference_token : reference_tokens)\n        {\n            switch (ptr->type())\n            {\n                case detail::value_t::object:\n                {\n                    // note: at performs range check\n                    ptr = &ptr->at(reference_token);\n                    break;\n                }\n\n                case detail::value_t::array:\n                {\n                    if (JSON_HEDLEY_UNLIKELY(reference_token == \"-\"))\n                    {\n                        // \"-\" always fails the range check\n                        JSON_THROW(detail::out_of_range::create(402,\n                                                                \"array index '-' (\" + std::to_string(ptr->m_value.array->size()) +\n                                                                \") is out of range\"));\n                    }\n\n                    // note: at performs range check\n                    ptr = &ptr->at(array_index(reference_token));\n                    break;\n                }\n\n                default:\n                    JSON_THROW(detail::out_of_range::create(404, \"unresolved reference token '\" + reference_token + \"'\"));\n            }\n        }\n\n        return *ptr;\n    }\n\n    /*!\n    @brief return a const reference to the pointed to value\n\n    @param[in] ptr  a JSON value\n\n    @return const reference to the JSON value pointed to by the JSON\n    pointer\n\n    @throw parse_error.106   if an array index begins with '0'\n    @throw parse_error.109   if an array index was not a number\n    @throw out_of_range.402  if the array index '-' is used\n    @throw out_of_range.404  if the JSON pointer can not be resolved\n    */\n    const BasicJsonType& get_unchecked(const BasicJsonType* ptr) const\n    {\n        for (const auto& reference_token : reference_tokens)\n        {\n            switch (ptr->type())\n            {\n                case detail::value_t::object:\n                {\n                    // use unchecked object access\n                    ptr = &ptr->operator[](reference_token);\n                    break;\n                }\n\n                case detail::value_t::array:\n                {\n                    if (JSON_HEDLEY_UNLIKELY(reference_token == \"-\"))\n                    {\n                        // \"-\" cannot be used for const access\n                        JSON_THROW(detail::out_of_range::create(402,\n                                                                \"array index '-' (\" + std::to_string(ptr->m_value.array->size()) +\n                                                                \") is out of range\"));\n                    }\n\n                    // use unchecked array access\n                    ptr = &ptr->operator[](array_index(reference_token));\n                    break;\n                }\n\n                default:\n                    JSON_THROW(detail::out_of_range::create(404, \"unresolved reference token '\" + reference_token + \"'\"));\n            }\n        }\n\n        return *ptr;\n    }\n\n    /*!\n    @throw parse_error.106   if an array index begins with '0'\n    @throw parse_error.109   if an array index was not a number\n    @throw out_of_range.402  if the array index '-' is used\n    @throw out_of_range.404  if the JSON pointer can not be resolved\n    */\n    const BasicJsonType& get_checked(const BasicJsonType* ptr) const\n    {\n        for (const auto& reference_token : reference_tokens)\n        {\n            switch (ptr->type())\n            {\n                case detail::value_t::object:\n                {\n                    // note: at performs range check\n                    ptr = &ptr->at(reference_token);\n                    break;\n                }\n\n                case detail::value_t::array:\n                {\n                    if (JSON_HEDLEY_UNLIKELY(reference_token == \"-\"))\n                    {\n                        // \"-\" always fails the range check\n                        JSON_THROW(detail::out_of_range::create(402,\n                                                                \"array index '-' (\" + std::to_string(ptr->m_value.array->size()) +\n                                                                \") is out of range\"));\n                    }\n\n                    // note: at performs range check\n                    ptr = &ptr->at(array_index(reference_token));\n                    break;\n                }\n\n                default:\n                    JSON_THROW(detail::out_of_range::create(404, \"unresolved reference token '\" + reference_token + \"'\"));\n            }\n        }\n\n        return *ptr;\n    }\n\n    /*!\n    @throw parse_error.106   if an array index begins with '0'\n    @throw parse_error.109   if an array index was not a number\n    */\n    bool contains(const BasicJsonType* ptr) const\n    {\n        for (const auto& reference_token : reference_tokens)\n        {\n            switch (ptr->type())\n            {\n                case detail::value_t::object:\n                {\n                    if (!ptr->contains(reference_token))\n                    {\n                        // we did not find the key in the object\n                        return false;\n                    }\n\n                    ptr = &ptr->operator[](reference_token);\n                    break;\n                }\n\n                case detail::value_t::array:\n                {\n                    if (JSON_HEDLEY_UNLIKELY(reference_token == \"-\"))\n                    {\n                        // \"-\" always fails the range check\n                        return false;\n                    }\n                    if (JSON_HEDLEY_UNLIKELY(reference_token.size() == 1 && !(\"0\" <= reference_token && reference_token <= \"9\")))\n                    {\n                        // invalid char\n                        return false;\n                    }\n                    if (JSON_HEDLEY_UNLIKELY(reference_token.size() > 1))\n                    {\n                        if (JSON_HEDLEY_UNLIKELY(!('1' <= reference_token[0] && reference_token[0] <= '9')))\n                        {\n                            // first char should be between '1' and '9'\n                            return false;\n                        }\n                        for (std::size_t i = 1; i < reference_token.size(); i++)\n                        {\n                            if (JSON_HEDLEY_UNLIKELY(!('0' <= reference_token[i] && reference_token[i] <= '9')))\n                            {\n                                // other char should be between '0' and '9'\n                                return false;\n                            }\n                        }\n                    }\n\n                    const auto idx = array_index(reference_token);\n                    if (idx >= ptr->size())\n                    {\n                        // index out of range\n                        return false;\n                    }\n\n                    ptr = &ptr->operator[](idx);\n                    break;\n                }\n\n                default:\n                {\n                    // we do not expect primitive values if there is still a\n                    // reference token to process\n                    return false;\n                }\n            }\n        }\n\n        // no reference token left means we found a primitive value\n        return true;\n    }\n\n    /*!\n    @brief split the string input to reference tokens\n\n    @note This function is only called by the json_pointer constructor.\n          All exceptions below are documented there.\n\n    @throw parse_error.107  if the pointer is not empty or begins with '/'\n    @throw parse_error.108  if character '~' is not followed by '0' or '1'\n    */\n    static std::vector<std::string> split(const std::string& reference_string)\n    {\n        std::vector<std::string> result;\n\n        // special case: empty reference string -> no reference tokens\n        if (reference_string.empty())\n        {\n            return result;\n        }\n\n        // check if nonempty reference string begins with slash\n        if (JSON_HEDLEY_UNLIKELY(reference_string[0] != '/'))\n        {\n            JSON_THROW(detail::parse_error::create(107, 1,\n                                                   \"JSON pointer must be empty or begin with '/' - was: '\" +\n                                                   reference_string + \"'\"));\n        }\n\n        // extract the reference tokens:\n        // - slash: position of the last read slash (or end of string)\n        // - start: position after the previous slash\n        for (\n            // search for the first slash after the first character\n            std::size_t slash = reference_string.find_first_of('/', 1),\n            // set the beginning of the first reference token\n            start = 1;\n            // we can stop if start == 0 (if slash == std::string::npos)\n            start != 0;\n            // set the beginning of the next reference token\n            // (will eventually be 0 if slash == std::string::npos)\n            start = (slash == std::string::npos) ? 0 : slash + 1,\n            // find next slash\n            slash = reference_string.find_first_of('/', start))\n        {\n            // use the text between the beginning of the reference token\n            // (start) and the last slash (slash).\n            auto reference_token = reference_string.substr(start, slash - start);\n\n            // check reference tokens are properly escaped\n            for (std::size_t pos = reference_token.find_first_of('~');\n                    pos != std::string::npos;\n                    pos = reference_token.find_first_of('~', pos + 1))\n            {\n                JSON_ASSERT(reference_token[pos] == '~');\n\n                // ~ must be followed by 0 or 1\n                if (JSON_HEDLEY_UNLIKELY(pos == reference_token.size() - 1 ||\n                                         (reference_token[pos + 1] != '0' &&\n                                          reference_token[pos + 1] != '1')))\n                {\n                    JSON_THROW(detail::parse_error::create(108, 0, \"escape character '~' must be followed with '0' or '1'\"));\n                }\n            }\n\n            // finally, store the reference token\n            unescape(reference_token);\n            result.push_back(reference_token);\n        }\n\n        return result;\n    }\n\n    /*!\n    @brief replace all occurrences of a substring by another string\n\n    @param[in,out] s  the string to manipulate; changed so that all\n                   occurrences of @a f are replaced with @a t\n    @param[in]     f  the substring to replace with @a t\n    @param[in]     t  the string to replace @a f\n\n    @pre The search string @a f must not be empty. **This precondition is\n    enforced with an assertion.**\n\n    @since version 2.0.0\n    */\n    static void replace_substring(std::string& s, const std::string& f,\n                                  const std::string& t)\n    {\n        JSON_ASSERT(!f.empty());\n        for (auto pos = s.find(f);                // find first occurrence of f\n                pos != std::string::npos;         // make sure f was found\n                s.replace(pos, f.size(), t),      // replace with t, and\n                pos = s.find(f, pos + t.size()))  // find next occurrence of f\n        {}\n    }\n\n  JSON_PRIVATE_UNLESS_TESTED:\n    /// escape \"~\" to \"~0\" and \"/\" to \"~1\"\n    static std::string escape(std::string s)\n    {\n        replace_substring(s, \"~\", \"~0\");\n        replace_substring(s, \"/\", \"~1\");\n        return s;\n    }\n\n    /// unescape \"~1\" to tilde and \"~0\" to slash (order is important!)\n    static void unescape(std::string& s)\n    {\n        replace_substring(s, \"~1\", \"/\");\n        replace_substring(s, \"~0\", \"~\");\n    }\n\n  private:\n    /*!\n    @param[in] reference_string  the reference string to the current value\n    @param[in] value             the value to consider\n    @param[in,out] result        the result object to insert values to\n\n    @note Empty objects or arrays are flattened to `null`.\n    */\n    static void flatten(const std::string& reference_string,\n                        const BasicJsonType& value,\n                        BasicJsonType& result)\n    {\n        switch (value.type())\n        {\n            case detail::value_t::array:\n            {\n                if (value.m_value.array->empty())\n                {\n                    // flatten empty array as null\n                    result[reference_string] = nullptr;\n                }\n                else\n                {\n                    // iterate array and use index as reference string\n                    for (std::size_t i = 0; i < value.m_value.array->size(); ++i)\n                    {\n                        flatten(reference_string + \"/\" + std::to_string(i),\n                                value.m_value.array->operator[](i), result);\n                    }\n                }\n                break;\n            }\n\n            case detail::value_t::object:\n            {\n                if (value.m_value.object->empty())\n                {\n                    // flatten empty object as null\n                    result[reference_string] = nullptr;\n                }\n                else\n                {\n                    // iterate object and use keys as reference string\n                    for (const auto& element : *value.m_value.object)\n                    {\n                        flatten(reference_string + \"/\" + escape(element.first), element.second, result);\n                    }\n                }\n                break;\n            }\n\n            default:\n            {\n                // add primitive value with its reference string\n                result[reference_string] = value;\n                break;\n            }\n        }\n    }\n\n    /*!\n    @param[in] value  flattened JSON\n\n    @return unflattened JSON\n\n    @throw parse_error.109 if array index is not a number\n    @throw type_error.314  if value is not an object\n    @throw type_error.315  if object values are not primitive\n    @throw type_error.313  if value cannot be unflattened\n    */\n    static BasicJsonType\n    unflatten(const BasicJsonType& value)\n    {\n        if (JSON_HEDLEY_UNLIKELY(!value.is_object()))\n        {\n            JSON_THROW(detail::type_error::create(314, \"only objects can be unflattened\"));\n        }\n\n        BasicJsonType result;\n\n        // iterate the JSON object values\n        for (const auto& element : *value.m_value.object)\n        {\n            if (JSON_HEDLEY_UNLIKELY(!element.second.is_primitive()))\n            {\n                JSON_THROW(detail::type_error::create(315, \"values in object must be primitive\"));\n            }\n\n            // assign value to reference pointed to by JSON pointer; Note that if\n            // the JSON pointer is \"\" (i.e., points to the whole value), function\n            // get_and_create returns a reference to result itself. An assignment\n            // will then create a primitive value.\n            json_pointer(element.first).get_and_create(result) = element.second;\n        }\n\n        return result;\n    }\n\n    /*!\n    @brief compares two JSON pointers for equality\n\n    @param[in] lhs  JSON pointer to compare\n    @param[in] rhs  JSON pointer to compare\n    @return whether @a lhs is equal to @a rhs\n\n    @complexity Linear in the length of the JSON pointer\n\n    @exceptionsafety No-throw guarantee: this function never throws exceptions.\n    */\n    friend bool operator==(json_pointer const& lhs,\n                           json_pointer const& rhs) noexcept\n    {\n        return lhs.reference_tokens == rhs.reference_tokens;\n    }\n\n    /*!\n    @brief compares two JSON pointers for inequality\n\n    @param[in] lhs  JSON pointer to compare\n    @param[in] rhs  JSON pointer to compare\n    @return whether @a lhs is not equal @a rhs\n\n    @complexity Linear in the length of the JSON pointer\n\n    @exceptionsafety No-throw guarantee: this function never throws exceptions.\n    */\n    friend bool operator!=(json_pointer const& lhs,\n                           json_pointer const& rhs) noexcept\n    {\n        return !(lhs == rhs);\n    }\n\n    /// the reference tokens\n    std::vector<std::string> reference_tokens;\n};\n}  // namespace nlohmann\n\n// #include <nlohmann/detail/json_ref.hpp>\n\n\n#include <initializer_list>\n#include <utility>\n\n// #include <nlohmann/detail/meta/type_traits.hpp>\n\n\nnamespace nlohmann\n{\nnamespace detail\n{\ntemplate<typename BasicJsonType>\nclass json_ref\n{\n  public:\n    using value_type = BasicJsonType;\n\n    json_ref(value_type&& value)\n        : owned_value(std::move(value))\n        , value_ref(&owned_value)\n        , is_rvalue(true)\n    {}\n\n    json_ref(const value_type& value)\n        : value_ref(const_cast<value_type*>(&value))\n        , is_rvalue(false)\n    {}\n\n    json_ref(std::initializer_list<json_ref> init)\n        : owned_value(init)\n        , value_ref(&owned_value)\n        , is_rvalue(true)\n    {}\n\n    template <\n        class... Args,\n        enable_if_t<std::is_constructible<value_type, Args...>::value, int> = 0 >\n    json_ref(Args && ... args)\n        : owned_value(std::forward<Args>(args)...)\n        , value_ref(&owned_value)\n        , is_rvalue(true)\n    {}\n\n    // class should be movable only\n    json_ref(json_ref&&) = default;\n    json_ref(const json_ref&) = delete;\n    json_ref& operator=(const json_ref&) = delete;\n    json_ref& operator=(json_ref&&) = delete;\n    ~json_ref() = default;\n\n    value_type moved_or_copied() const\n    {\n        if (is_rvalue)\n        {\n            return std::move(*value_ref);\n        }\n        return *value_ref;\n    }\n\n    value_type const& operator*() const\n    {\n        return *static_cast<value_type const*>(value_ref);\n    }\n\n    value_type const* operator->() const\n    {\n        return static_cast<value_type const*>(value_ref);\n    }\n\n  private:\n    mutable value_type owned_value = nullptr;\n    value_type* value_ref = nullptr;\n    const bool is_rvalue = true;\n};\n}  // namespace detail\n}  // namespace nlohmann\n\n// #include <nlohmann/detail/macro_scope.hpp>\n\n// #include <nlohmann/detail/meta/cpp_future.hpp>\n\n// #include <nlohmann/detail/meta/type_traits.hpp>\n\n// #include <nlohmann/detail/output/binary_writer.hpp>\n\n\n#include <algorithm> // reverse\n#include <array> // array\n#include <cstdint> // uint8_t, uint16_t, uint32_t, uint64_t\n#include <cstring> // memcpy\n#include <limits> // numeric_limits\n#include <string> // string\n#include <cmath> // isnan, isinf\n\n// #include <nlohmann/detail/input/binary_reader.hpp>\n\n// #include <nlohmann/detail/macro_scope.hpp>\n\n// #include <nlohmann/detail/output/output_adapters.hpp>\n\n\n#include <algorithm> // copy\n#include <cstddef> // size_t\n#include <ios> // streamsize\n#include <iterator> // back_inserter\n#include <memory> // shared_ptr, make_shared\n#include <ostream> // basic_ostream\n#include <string> // basic_string\n#include <vector> // vector\n// #include <nlohmann/detail/macro_scope.hpp>\n\n\nnamespace nlohmann\n{\nnamespace detail\n{\n/// abstract output adapter interface\ntemplate<typename CharType> struct output_adapter_protocol\n{\n    virtual void write_character(CharType c) = 0;\n    virtual void write_characters(const CharType* s, std::size_t length) = 0;\n    virtual ~output_adapter_protocol() = default;\n};\n\n/// a type to simplify interfaces\ntemplate<typename CharType>\nusing output_adapter_t = std::shared_ptr<output_adapter_protocol<CharType>>;\n\n/// output adapter for byte vectors\ntemplate<typename CharType>\nclass output_vector_adapter : public output_adapter_protocol<CharType>\n{\n  public:\n    explicit output_vector_adapter(std::vector<CharType>& vec) noexcept\n        : v(vec)\n    {}\n\n    void write_character(CharType c) override\n    {\n        v.push_back(c);\n    }\n\n    JSON_HEDLEY_NON_NULL(2)\n    void write_characters(const CharType* s, std::size_t length) override\n    {\n        std::copy(s, s + length, std::back_inserter(v));\n    }\n\n  private:\n    std::vector<CharType>& v;\n};\n\n/// output adapter for output streams\ntemplate<typename CharType>\nclass output_stream_adapter : public output_adapter_protocol<CharType>\n{\n  public:\n    explicit output_stream_adapter(std::basic_ostream<CharType>& s) noexcept\n        : stream(s)\n    {}\n\n    void write_character(CharType c) override\n    {\n        stream.put(c);\n    }\n\n    JSON_HEDLEY_NON_NULL(2)\n    void write_characters(const CharType* s, std::size_t length) override\n    {\n        stream.write(s, static_cast<std::streamsize>(length));\n    }\n\n  private:\n    std::basic_ostream<CharType>& stream;\n};\n\n/// output adapter for basic_string\ntemplate<typename CharType, typename StringType = std::basic_string<CharType>>\nclass output_string_adapter : public output_adapter_protocol<CharType>\n{\n  public:\n    explicit output_string_adapter(StringType& s) noexcept\n        : str(s)\n    {}\n\n    void write_character(CharType c) override\n    {\n        str.push_back(c);\n    }\n\n    JSON_HEDLEY_NON_NULL(2)\n    void write_characters(const CharType* s, std::size_t length) override\n    {\n        str.append(s, length);\n    }\n\n  private:\n    StringType& str;\n};\n\ntemplate<typename CharType, typename StringType = std::basic_string<CharType>>\nclass output_adapter\n{\n  public:\n    output_adapter(std::vector<CharType>& vec)\n        : oa(std::make_shared<output_vector_adapter<CharType>>(vec)) {}\n\n    output_adapter(std::basic_ostream<CharType>& s)\n        : oa(std::make_shared<output_stream_adapter<CharType>>(s)) {}\n\n    output_adapter(StringType& s)\n        : oa(std::make_shared<output_string_adapter<CharType, StringType>>(s)) {}\n\n    operator output_adapter_t<CharType>()\n    {\n        return oa;\n    }\n\n  private:\n    output_adapter_t<CharType> oa = nullptr;\n};\n}  // namespace detail\n}  // namespace nlohmann\n\n\nnamespace nlohmann\n{\nnamespace detail\n{\n///////////////////\n// binary writer //\n///////////////////\n\n/*!\n@brief serialization to CBOR and MessagePack values\n*/\ntemplate<typename BasicJsonType, typename CharType>\nclass binary_writer\n{\n    using string_t = typename BasicJsonType::string_t;\n    using binary_t = typename BasicJsonType::binary_t;\n    using number_float_t = typename BasicJsonType::number_float_t;\n\n  public:\n    /*!\n    @brief create a binary writer\n\n    @param[in] adapter  output adapter to write to\n    */\n    explicit binary_writer(output_adapter_t<CharType> adapter) : oa(adapter)\n    {\n        JSON_ASSERT(oa);\n    }\n\n    /*!\n    @param[in] j  JSON value to serialize\n    @pre       j.type() == value_t::object\n    */\n    void write_bson(const BasicJsonType& j)\n    {\n        switch (j.type())\n        {\n            case value_t::object:\n            {\n                write_bson_object(*j.m_value.object);\n                break;\n            }\n\n            default:\n            {\n                JSON_THROW(type_error::create(317, \"to serialize to BSON, top-level type must be object, but is \" + std::string(j.type_name())));\n            }\n        }\n    }\n\n    /*!\n    @param[in] j  JSON value to serialize\n    */\n    void write_cbor(const BasicJsonType& j)\n    {\n        switch (j.type())\n        {\n            case value_t::null:\n            {\n                oa->write_character(to_char_type(0xF6));\n                break;\n            }\n\n            case value_t::boolean:\n            {\n                oa->write_character(j.m_value.boolean\n                                    ? to_char_type(0xF5)\n                                    : to_char_type(0xF4));\n                break;\n            }\n\n            case value_t::number_integer:\n            {\n                if (j.m_value.number_integer >= 0)\n                {\n                    // CBOR does not differentiate between positive signed\n                    // integers and unsigned integers. Therefore, we used the\n                    // code from the value_t::number_unsigned case here.\n                    if (j.m_value.number_integer <= 0x17)\n                    {\n                        write_number(static_cast<std::uint8_t>(j.m_value.number_integer));\n                    }\n                    else if (j.m_value.number_integer <= (std::numeric_limits<std::uint8_t>::max)())\n                    {\n                        oa->write_character(to_char_type(0x18));\n                        write_number(static_cast<std::uint8_t>(j.m_value.number_integer));\n                    }\n                    else if (j.m_value.number_integer <= (std::numeric_limits<std::uint16_t>::max)())\n                    {\n                        oa->write_character(to_char_type(0x19));\n                        write_number(static_cast<std::uint16_t>(j.m_value.number_integer));\n                    }\n                    else if (j.m_value.number_integer <= (std::numeric_limits<std::uint32_t>::max)())\n                    {\n                        oa->write_character(to_char_type(0x1A));\n                        write_number(static_cast<std::uint32_t>(j.m_value.number_integer));\n                    }\n                    else\n                    {\n                        oa->write_character(to_char_type(0x1B));\n                        write_number(static_cast<std::uint64_t>(j.m_value.number_integer));\n                    }\n                }\n                else\n                {\n                    // The conversions below encode the sign in the first\n                    // byte, and the value is converted to a positive number.\n                    const auto positive_number = -1 - j.m_value.number_integer;\n                    if (j.m_value.number_integer >= -24)\n                    {\n                        write_number(static_cast<std::uint8_t>(0x20 + positive_number));\n                    }\n                    else if (positive_number <= (std::numeric_limits<std::uint8_t>::max)())\n                    {\n                        oa->write_character(to_char_type(0x38));\n                        write_number(static_cast<std::uint8_t>(positive_number));\n                    }\n                    else if (positive_number <= (std::numeric_limits<std::uint16_t>::max)())\n                    {\n                        oa->write_character(to_char_type(0x39));\n                        write_number(static_cast<std::uint16_t>(positive_number));\n                    }\n                    else if (positive_number <= (std::numeric_limits<std::uint32_t>::max)())\n                    {\n                        oa->write_character(to_char_type(0x3A));\n                        write_number(static_cast<std::uint32_t>(positive_number));\n                    }\n                    else\n                    {\n                        oa->write_character(to_char_type(0x3B));\n                        write_number(static_cast<std::uint64_t>(positive_number));\n                    }\n                }\n                break;\n            }\n\n            case value_t::number_unsigned:\n            {\n                if (j.m_value.number_unsigned <= 0x17)\n                {\n                    write_number(static_cast<std::uint8_t>(j.m_value.number_unsigned));\n                }\n                else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint8_t>::max)())\n                {\n                    oa->write_character(to_char_type(0x18));\n                    write_number(static_cast<std::uint8_t>(j.m_value.number_unsigned));\n                }\n                else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint16_t>::max)())\n                {\n                    oa->write_character(to_char_type(0x19));\n                    write_number(static_cast<std::uint16_t>(j.m_value.number_unsigned));\n                }\n                else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint32_t>::max)())\n                {\n                    oa->write_character(to_char_type(0x1A));\n                    write_number(static_cast<std::uint32_t>(j.m_value.number_unsigned));\n                }\n                else\n                {\n                    oa->write_character(to_char_type(0x1B));\n                    write_number(static_cast<std::uint64_t>(j.m_value.number_unsigned));\n                }\n                break;\n            }\n\n            case value_t::number_float:\n            {\n                if (std::isnan(j.m_value.number_float))\n                {\n                    // NaN is 0xf97e00 in CBOR\n                    oa->write_character(to_char_type(0xF9));\n                    oa->write_character(to_char_type(0x7E));\n                    oa->write_character(to_char_type(0x00));\n                }\n                else if (std::isinf(j.m_value.number_float))\n                {\n                    // Infinity is 0xf97c00, -Infinity is 0xf9fc00\n                    oa->write_character(to_char_type(0xf9));\n                    oa->write_character(j.m_value.number_float > 0 ? to_char_type(0x7C) : to_char_type(0xFC));\n                    oa->write_character(to_char_type(0x00));\n                }\n                else\n                {\n                    write_compact_float(j.m_value.number_float, detail::input_format_t::cbor);\n                }\n                break;\n            }\n\n            case value_t::string:\n            {\n                // step 1: write control byte and the string length\n                const auto N = j.m_value.string->size();\n                if (N <= 0x17)\n                {\n                    write_number(static_cast<std::uint8_t>(0x60 + N));\n                }\n                else if (N <= (std::numeric_limits<std::uint8_t>::max)())\n                {\n                    oa->write_character(to_char_type(0x78));\n                    write_number(static_cast<std::uint8_t>(N));\n                }\n                else if (N <= (std::numeric_limits<std::uint16_t>::max)())\n                {\n                    oa->write_character(to_char_type(0x79));\n                    write_number(static_cast<std::uint16_t>(N));\n                }\n                else if (N <= (std::numeric_limits<std::uint32_t>::max)())\n                {\n                    oa->write_character(to_char_type(0x7A));\n                    write_number(static_cast<std::uint32_t>(N));\n                }\n                // LCOV_EXCL_START\n                else if (N <= (std::numeric_limits<std::uint64_t>::max)())\n                {\n                    oa->write_character(to_char_type(0x7B));\n                    write_number(static_cast<std::uint64_t>(N));\n                }\n                // LCOV_EXCL_STOP\n\n                // step 2: write the string\n                oa->write_characters(\n                    reinterpret_cast<const CharType*>(j.m_value.string->c_str()),\n                    j.m_value.string->size());\n                break;\n            }\n\n            case value_t::array:\n            {\n                // step 1: write control byte and the array size\n                const auto N = j.m_value.array->size();\n                if (N <= 0x17)\n                {\n                    write_number(static_cast<std::uint8_t>(0x80 + N));\n                }\n                else if (N <= (std::numeric_limits<std::uint8_t>::max)())\n                {\n                    oa->write_character(to_char_type(0x98));\n                    write_number(static_cast<std::uint8_t>(N));\n                }\n                else if (N <= (std::numeric_limits<std::uint16_t>::max)())\n                {\n                    oa->write_character(to_char_type(0x99));\n                    write_number(static_cast<std::uint16_t>(N));\n                }\n                else if (N <= (std::numeric_limits<std::uint32_t>::max)())\n                {\n                    oa->write_character(to_char_type(0x9A));\n                    write_number(static_cast<std::uint32_t>(N));\n                }\n                // LCOV_EXCL_START\n                else if (N <= (std::numeric_limits<std::uint64_t>::max)())\n                {\n                    oa->write_character(to_char_type(0x9B));\n                    write_number(static_cast<std::uint64_t>(N));\n                }\n                // LCOV_EXCL_STOP\n\n                // step 2: write each element\n                for (const auto& el : *j.m_value.array)\n                {\n                    write_cbor(el);\n                }\n                break;\n            }\n\n            case value_t::binary:\n            {\n                if (j.m_value.binary->has_subtype())\n                {\n                    write_number(static_cast<std::uint8_t>(0xd8));\n                    write_number(j.m_value.binary->subtype());\n                }\n\n                // step 1: write control byte and the binary array size\n                const auto N = j.m_value.binary->size();\n                if (N <= 0x17)\n                {\n                    write_number(static_cast<std::uint8_t>(0x40 + N));\n                }\n                else if (N <= (std::numeric_limits<std::uint8_t>::max)())\n                {\n                    oa->write_character(to_char_type(0x58));\n                    write_number(static_cast<std::uint8_t>(N));\n                }\n                else if (N <= (std::numeric_limits<std::uint16_t>::max)())\n                {\n                    oa->write_character(to_char_type(0x59));\n                    write_number(static_cast<std::uint16_t>(N));\n                }\n                else if (N <= (std::numeric_limits<std::uint32_t>::max)())\n                {\n                    oa->write_character(to_char_type(0x5A));\n                    write_number(static_cast<std::uint32_t>(N));\n                }\n                // LCOV_EXCL_START\n                else if (N <= (std::numeric_limits<std::uint64_t>::max)())\n                {\n                    oa->write_character(to_char_type(0x5B));\n                    write_number(static_cast<std::uint64_t>(N));\n                }\n                // LCOV_EXCL_STOP\n\n                // step 2: write each element\n                oa->write_characters(\n                    reinterpret_cast<const CharType*>(j.m_value.binary->data()),\n                    N);\n\n                break;\n            }\n\n            case value_t::object:\n            {\n                // step 1: write control byte and the object size\n                const auto N = j.m_value.object->size();\n                if (N <= 0x17)\n                {\n                    write_number(static_cast<std::uint8_t>(0xA0 + N));\n                }\n                else if (N <= (std::numeric_limits<std::uint8_t>::max)())\n                {\n                    oa->write_character(to_char_type(0xB8));\n                    write_number(static_cast<std::uint8_t>(N));\n                }\n                else if (N <= (std::numeric_limits<std::uint16_t>::max)())\n                {\n                    oa->write_character(to_char_type(0xB9));\n                    write_number(static_cast<std::uint16_t>(N));\n                }\n                else if (N <= (std::numeric_limits<std::uint32_t>::max)())\n                {\n                    oa->write_character(to_char_type(0xBA));\n                    write_number(static_cast<std::uint32_t>(N));\n                }\n                // LCOV_EXCL_START\n                else if (N <= (std::numeric_limits<std::uint64_t>::max)())\n                {\n                    oa->write_character(to_char_type(0xBB));\n                    write_number(static_cast<std::uint64_t>(N));\n                }\n                // LCOV_EXCL_STOP\n\n                // step 2: write each element\n                for (const auto& el : *j.m_value.object)\n                {\n                    write_cbor(el.first);\n                    write_cbor(el.second);\n                }\n                break;\n            }\n\n            default:\n                break;\n        }\n    }\n\n    /*!\n    @param[in] j  JSON value to serialize\n    */\n    void write_msgpack(const BasicJsonType& j)\n    {\n        switch (j.type())\n        {\n            case value_t::null: // nil\n            {\n                oa->write_character(to_char_type(0xC0));\n                break;\n            }\n\n            case value_t::boolean: // true and false\n            {\n                oa->write_character(j.m_value.boolean\n                                    ? to_char_type(0xC3)\n                                    : to_char_type(0xC2));\n                break;\n            }\n\n            case value_t::number_integer:\n            {\n                if (j.m_value.number_integer >= 0)\n                {\n                    // MessagePack does not differentiate between positive\n                    // signed integers and unsigned integers. Therefore, we used\n                    // the code from the value_t::number_unsigned case here.\n                    if (j.m_value.number_unsigned < 128)\n                    {\n                        // positive fixnum\n                        write_number(static_cast<std::uint8_t>(j.m_value.number_integer));\n                    }\n                    else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint8_t>::max)())\n                    {\n                        // uint 8\n                        oa->write_character(to_char_type(0xCC));\n                        write_number(static_cast<std::uint8_t>(j.m_value.number_integer));\n                    }\n                    else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint16_t>::max)())\n                    {\n                        // uint 16\n                        oa->write_character(to_char_type(0xCD));\n                        write_number(static_cast<std::uint16_t>(j.m_value.number_integer));\n                    }\n                    else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint32_t>::max)())\n                    {\n                        // uint 32\n                        oa->write_character(to_char_type(0xCE));\n                        write_number(static_cast<std::uint32_t>(j.m_value.number_integer));\n                    }\n                    else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint64_t>::max)())\n                    {\n                        // uint 64\n                        oa->write_character(to_char_type(0xCF));\n                        write_number(static_cast<std::uint64_t>(j.m_value.number_integer));\n                    }\n                }\n                else\n                {\n                    if (j.m_value.number_integer >= -32)\n                    {\n                        // negative fixnum\n                        write_number(static_cast<std::int8_t>(j.m_value.number_integer));\n                    }\n                    else if (j.m_value.number_integer >= (std::numeric_limits<std::int8_t>::min)() &&\n                             j.m_value.number_integer <= (std::numeric_limits<std::int8_t>::max)())\n                    {\n                        // int 8\n                        oa->write_character(to_char_type(0xD0));\n                        write_number(static_cast<std::int8_t>(j.m_value.number_integer));\n                    }\n                    else if (j.m_value.number_integer >= (std::numeric_limits<std::int16_t>::min)() &&\n                             j.m_value.number_integer <= (std::numeric_limits<std::int16_t>::max)())\n                    {\n                        // int 16\n                        oa->write_character(to_char_type(0xD1));\n                        write_number(static_cast<std::int16_t>(j.m_value.number_integer));\n                    }\n                    else if (j.m_value.number_integer >= (std::numeric_limits<std::int32_t>::min)() &&\n                             j.m_value.number_integer <= (std::numeric_limits<std::int32_t>::max)())\n                    {\n                        // int 32\n                        oa->write_character(to_char_type(0xD2));\n                        write_number(static_cast<std::int32_t>(j.m_value.number_integer));\n                    }\n                    else if (j.m_value.number_integer >= (std::numeric_limits<std::int64_t>::min)() &&\n                             j.m_value.number_integer <= (std::numeric_limits<std::int64_t>::max)())\n                    {\n                        // int 64\n                        oa->write_character(to_char_type(0xD3));\n                        write_number(static_cast<std::int64_t>(j.m_value.number_integer));\n                    }\n                }\n                break;\n            }\n\n            case value_t::number_unsigned:\n            {\n                if (j.m_value.number_unsigned < 128)\n                {\n                    // positive fixnum\n                    write_number(static_cast<std::uint8_t>(j.m_value.number_integer));\n                }\n                else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint8_t>::max)())\n                {\n                    // uint 8\n                    oa->write_character(to_char_type(0xCC));\n                    write_number(static_cast<std::uint8_t>(j.m_value.number_integer));\n                }\n                else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint16_t>::max)())\n                {\n                    // uint 16\n                    oa->write_character(to_char_type(0xCD));\n                    write_number(static_cast<std::uint16_t>(j.m_value.number_integer));\n                }\n                else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint32_t>::max)())\n                {\n                    // uint 32\n                    oa->write_character(to_char_type(0xCE));\n                    write_number(static_cast<std::uint32_t>(j.m_value.number_integer));\n                }\n                else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint64_t>::max)())\n                {\n                    // uint 64\n                    oa->write_character(to_char_type(0xCF));\n                    write_number(static_cast<std::uint64_t>(j.m_value.number_integer));\n                }\n                break;\n            }\n\n            case value_t::number_float:\n            {\n                write_compact_float(j.m_value.number_float, detail::input_format_t::msgpack);\n                break;\n            }\n\n            case value_t::string:\n            {\n                // step 1: write control byte and the string length\n                const auto N = j.m_value.string->size();\n                if (N <= 31)\n                {\n                    // fixstr\n                    write_number(static_cast<std::uint8_t>(0xA0 | N));\n                }\n                else if (N <= (std::numeric_limits<std::uint8_t>::max)())\n                {\n                    // str 8\n                    oa->write_character(to_char_type(0xD9));\n                    write_number(static_cast<std::uint8_t>(N));\n                }\n                else if (N <= (std::numeric_limits<std::uint16_t>::max)())\n                {\n                    // str 16\n                    oa->write_character(to_char_type(0xDA));\n                    write_number(static_cast<std::uint16_t>(N));\n                }\n                else if (N <= (std::numeric_limits<std::uint32_t>::max)())\n                {\n                    // str 32\n                    oa->write_character(to_char_type(0xDB));\n                    write_number(static_cast<std::uint32_t>(N));\n                }\n\n                // step 2: write the string\n                oa->write_characters(\n                    reinterpret_cast<const CharType*>(j.m_value.string->c_str()),\n                    j.m_value.string->size());\n                break;\n            }\n\n            case value_t::array:\n            {\n                // step 1: write control byte and the array size\n                const auto N = j.m_value.array->size();\n                if (N <= 15)\n                {\n                    // fixarray\n                    write_number(static_cast<std::uint8_t>(0x90 | N));\n                }\n                else if (N <= (std::numeric_limits<std::uint16_t>::max)())\n                {\n                    // array 16\n                    oa->write_character(to_char_type(0xDC));\n                    write_number(static_cast<std::uint16_t>(N));\n                }\n                else if (N <= (std::numeric_limits<std::uint32_t>::max)())\n                {\n                    // array 32\n                    oa->write_character(to_char_type(0xDD));\n                    write_number(static_cast<std::uint32_t>(N));\n                }\n\n                // step 2: write each element\n                for (const auto& el : *j.m_value.array)\n                {\n                    write_msgpack(el);\n                }\n                break;\n            }\n\n            case value_t::binary:\n            {\n                // step 0: determine if the binary type has a set subtype to\n                // determine whether or not to use the ext or fixext types\n                const bool use_ext = j.m_value.binary->has_subtype();\n\n                // step 1: write control byte and the byte string length\n                const auto N = j.m_value.binary->size();\n                if (N <= (std::numeric_limits<std::uint8_t>::max)())\n                {\n                    std::uint8_t output_type{};\n                    bool fixed = true;\n                    if (use_ext)\n                    {\n                        switch (N)\n                        {\n                            case 1:\n                                output_type = 0xD4; // fixext 1\n                                break;\n                            case 2:\n                                output_type = 0xD5; // fixext 2\n                                break;\n                            case 4:\n                                output_type = 0xD6; // fixext 4\n                                break;\n                            case 8:\n                                output_type = 0xD7; // fixext 8\n                                break;\n                            case 16:\n                                output_type = 0xD8; // fixext 16\n                                break;\n                            default:\n                                output_type = 0xC7; // ext 8\n                                fixed = false;\n                                break;\n                        }\n\n                    }\n                    else\n                    {\n                        output_type = 0xC4; // bin 8\n                        fixed = false;\n                    }\n\n                    oa->write_character(to_char_type(output_type));\n                    if (!fixed)\n                    {\n                        write_number(static_cast<std::uint8_t>(N));\n                    }\n                }\n                else if (N <= (std::numeric_limits<std::uint16_t>::max)())\n                {\n                    std::uint8_t output_type = use_ext\n                                               ? 0xC8 // ext 16\n                                               : 0xC5; // bin 16\n\n                    oa->write_character(to_char_type(output_type));\n                    write_number(static_cast<std::uint16_t>(N));\n                }\n                else if (N <= (std::numeric_limits<std::uint32_t>::max)())\n                {\n                    std::uint8_t output_type = use_ext\n                                               ? 0xC9 // ext 32\n                                               : 0xC6; // bin 32\n\n                    oa->write_character(to_char_type(output_type));\n                    write_number(static_cast<std::uint32_t>(N));\n                }\n\n                // step 1.5: if this is an ext type, write the subtype\n                if (use_ext)\n                {\n                    write_number(static_cast<std::int8_t>(j.m_value.binary->subtype()));\n                }\n\n                // step 2: write the byte string\n                oa->write_characters(\n                    reinterpret_cast<const CharType*>(j.m_value.binary->data()),\n                    N);\n\n                break;\n            }\n\n            case value_t::object:\n            {\n                // step 1: write control byte and the object size\n                const auto N = j.m_value.object->size();\n                if (N <= 15)\n                {\n                    // fixmap\n                    write_number(static_cast<std::uint8_t>(0x80 | (N & 0xF)));\n                }\n                else if (N <= (std::numeric_limits<std::uint16_t>::max)())\n                {\n                    // map 16\n                    oa->write_character(to_char_type(0xDE));\n                    write_number(static_cast<std::uint16_t>(N));\n                }\n                else if (N <= (std::numeric_limits<std::uint32_t>::max)())\n                {\n                    // map 32\n                    oa->write_character(to_char_type(0xDF));\n                    write_number(static_cast<std::uint32_t>(N));\n                }\n\n                // step 2: write each element\n                for (const auto& el : *j.m_value.object)\n                {\n                    write_msgpack(el.first);\n                    write_msgpack(el.second);\n                }\n                break;\n            }\n\n            default:\n                break;\n        }\n    }\n\n    /*!\n    @param[in] j  JSON value to serialize\n    @param[in] use_count   whether to use '#' prefixes (optimized format)\n    @param[in] use_type    whether to use '$' prefixes (optimized format)\n    @param[in] add_prefix  whether prefixes need to be used for this value\n    */\n    void write_ubjson(const BasicJsonType& j, const bool use_count,\n                      const bool use_type, const bool add_prefix = true)\n    {\n        switch (j.type())\n        {\n            case value_t::null:\n            {\n                if (add_prefix)\n                {\n                    oa->write_character(to_char_type('Z'));\n                }\n                break;\n            }\n\n            case value_t::boolean:\n            {\n                if (add_prefix)\n                {\n                    oa->write_character(j.m_value.boolean\n                                        ? to_char_type('T')\n                                        : to_char_type('F'));\n                }\n                break;\n            }\n\n            case value_t::number_integer:\n            {\n                write_number_with_ubjson_prefix(j.m_value.number_integer, add_prefix);\n                break;\n            }\n\n            case value_t::number_unsigned:\n            {\n                write_number_with_ubjson_prefix(j.m_value.number_unsigned, add_prefix);\n                break;\n            }\n\n            case value_t::number_float:\n            {\n                write_number_with_ubjson_prefix(j.m_value.number_float, add_prefix);\n                break;\n            }\n\n            case value_t::string:\n            {\n                if (add_prefix)\n                {\n                    oa->write_character(to_char_type('S'));\n                }\n                write_number_with_ubjson_prefix(j.m_value.string->size(), true);\n                oa->write_characters(\n                    reinterpret_cast<const CharType*>(j.m_value.string->c_str()),\n                    j.m_value.string->size());\n                break;\n            }\n\n            case value_t::array:\n            {\n                if (add_prefix)\n                {\n                    oa->write_character(to_char_type('['));\n                }\n\n                bool prefix_required = true;\n                if (use_type && !j.m_value.array->empty())\n                {\n                    JSON_ASSERT(use_count);\n                    const CharType first_prefix = ubjson_prefix(j.front());\n                    const bool same_prefix = std::all_of(j.begin() + 1, j.end(),\n                                                         [this, first_prefix](const BasicJsonType & v)\n                    {\n                        return ubjson_prefix(v) == first_prefix;\n                    });\n\n                    if (same_prefix)\n                    {\n                        prefix_required = false;\n                        oa->write_character(to_char_type('$'));\n                        oa->write_character(first_prefix);\n                    }\n                }\n\n                if (use_count)\n                {\n                    oa->write_character(to_char_type('#'));\n                    write_number_with_ubjson_prefix(j.m_value.array->size(), true);\n                }\n\n                for (const auto& el : *j.m_value.array)\n                {\n                    write_ubjson(el, use_count, use_type, prefix_required);\n                }\n\n                if (!use_count)\n                {\n                    oa->write_character(to_char_type(']'));\n                }\n\n                break;\n            }\n\n            case value_t::binary:\n            {\n                if (add_prefix)\n                {\n                    oa->write_character(to_char_type('['));\n                }\n\n                if (use_type && !j.m_value.binary->empty())\n                {\n                    JSON_ASSERT(use_count);\n                    oa->write_character(to_char_type('$'));\n                    oa->write_character('U');\n                }\n\n                if (use_count)\n                {\n                    oa->write_character(to_char_type('#'));\n                    write_number_with_ubjson_prefix(j.m_value.binary->size(), true);\n                }\n\n                if (use_type)\n                {\n                    oa->write_characters(\n                        reinterpret_cast<const CharType*>(j.m_value.binary->data()),\n                        j.m_value.binary->size());\n                }\n                else\n                {\n                    for (size_t i = 0; i < j.m_value.binary->size(); ++i)\n                    {\n                        oa->write_character(to_char_type('U'));\n                        oa->write_character(j.m_value.binary->data()[i]);\n                    }\n                }\n\n                if (!use_count)\n                {\n                    oa->write_character(to_char_type(']'));\n                }\n\n                break;\n            }\n\n            case value_t::object:\n            {\n                if (add_prefix)\n                {\n                    oa->write_character(to_char_type('{'));\n                }\n\n                bool prefix_required = true;\n                if (use_type && !j.m_value.object->empty())\n                {\n                    JSON_ASSERT(use_count);\n                    const CharType first_prefix = ubjson_prefix(j.front());\n                    const bool same_prefix = std::all_of(j.begin(), j.end(),\n                                                         [this, first_prefix](const BasicJsonType & v)\n                    {\n                        return ubjson_prefix(v) == first_prefix;\n                    });\n\n                    if (same_prefix)\n                    {\n                        prefix_required = false;\n                        oa->write_character(to_char_type('$'));\n                        oa->write_character(first_prefix);\n                    }\n                }\n\n                if (use_count)\n                {\n                    oa->write_character(to_char_type('#'));\n                    write_number_with_ubjson_prefix(j.m_value.object->size(), true);\n                }\n\n                for (const auto& el : *j.m_value.object)\n                {\n                    write_number_with_ubjson_prefix(el.first.size(), true);\n                    oa->write_characters(\n                        reinterpret_cast<const CharType*>(el.first.c_str()),\n                        el.first.size());\n                    write_ubjson(el.second, use_count, use_type, prefix_required);\n                }\n\n                if (!use_count)\n                {\n                    oa->write_character(to_char_type('}'));\n                }\n\n                break;\n            }\n\n            default:\n                break;\n        }\n    }\n\n  private:\n    //////////\n    // BSON //\n    //////////\n\n    /*!\n    @return The size of a BSON document entry header, including the id marker\n            and the entry name size (and its null-terminator).\n    */\n    static std::size_t calc_bson_entry_header_size(const string_t& name)\n    {\n        const auto it = name.find(static_cast<typename string_t::value_type>(0));\n        if (JSON_HEDLEY_UNLIKELY(it != BasicJsonType::string_t::npos))\n        {\n            JSON_THROW(out_of_range::create(409,\n                                            \"BSON key cannot contain code point U+0000 (at byte \" + std::to_string(it) + \")\"));\n        }\n\n        return /*id*/ 1ul + name.size() + /*zero-terminator*/1u;\n    }\n\n    /*!\n    @brief Writes the given @a element_type and @a name to the output adapter\n    */\n    void write_bson_entry_header(const string_t& name,\n                                 const std::uint8_t element_type)\n    {\n        oa->write_character(to_char_type(element_type)); // boolean\n        oa->write_characters(\n            reinterpret_cast<const CharType*>(name.c_str()),\n            name.size() + 1u);\n    }\n\n    /*!\n    @brief Writes a BSON element with key @a name and boolean value @a value\n    */\n    void write_bson_boolean(const string_t& name,\n                            const bool value)\n    {\n        write_bson_entry_header(name, 0x08);\n        oa->write_character(value ? to_char_type(0x01) : to_char_type(0x00));\n    }\n\n    /*!\n    @brief Writes a BSON element with key @a name and double value @a value\n    */\n    void write_bson_double(const string_t& name,\n                           const double value)\n    {\n        write_bson_entry_header(name, 0x01);\n        write_number<double, true>(value);\n    }\n\n    /*!\n    @return The size of the BSON-encoded string in @a value\n    */\n    static std::size_t calc_bson_string_size(const string_t& value)\n    {\n        return sizeof(std::int32_t) + value.size() + 1ul;\n    }\n\n    /*!\n    @brief Writes a BSON element with key @a name and string value @a value\n    */\n    void write_bson_string(const string_t& name,\n                           const string_t& value)\n    {\n        write_bson_entry_header(name, 0x02);\n\n        write_number<std::int32_t, true>(static_cast<std::int32_t>(value.size() + 1ul));\n        oa->write_characters(\n            reinterpret_cast<const CharType*>(value.c_str()),\n            value.size() + 1);\n    }\n\n    /*!\n    @brief Writes a BSON element with key @a name and null value\n    */\n    void write_bson_null(const string_t& name)\n    {\n        write_bson_entry_header(name, 0x0A);\n    }\n\n    /*!\n    @return The size of the BSON-encoded integer @a value\n    */\n    static std::size_t calc_bson_integer_size(const std::int64_t value)\n    {\n        return (std::numeric_limits<std::int32_t>::min)() <= value && value <= (std::numeric_limits<std::int32_t>::max)()\n               ? sizeof(std::int32_t)\n               : sizeof(std::int64_t);\n    }\n\n    /*!\n    @brief Writes a BSON element with key @a name and integer @a value\n    */\n    void write_bson_integer(const string_t& name,\n                            const std::int64_t value)\n    {\n        if ((std::numeric_limits<std::int32_t>::min)() <= value && value <= (std::numeric_limits<std::int32_t>::max)())\n        {\n            write_bson_entry_header(name, 0x10); // int32\n            write_number<std::int32_t, true>(static_cast<std::int32_t>(value));\n        }\n        else\n        {\n            write_bson_entry_header(name, 0x12); // int64\n            write_number<std::int64_t, true>(static_cast<std::int64_t>(value));\n        }\n    }\n\n    /*!\n    @return The size of the BSON-encoded unsigned integer in @a j\n    */\n    static constexpr std::size_t calc_bson_unsigned_size(const std::uint64_t value) noexcept\n    {\n        return (value <= static_cast<std::uint64_t>((std::numeric_limits<std::int32_t>::max)()))\n               ? sizeof(std::int32_t)\n               : sizeof(std::int64_t);\n    }\n\n    /*!\n    @brief Writes a BSON element with key @a name and unsigned @a value\n    */\n    void write_bson_unsigned(const string_t& name,\n                             const std::uint64_t value)\n    {\n        if (value <= static_cast<std::uint64_t>((std::numeric_limits<std::int32_t>::max)()))\n        {\n            write_bson_entry_header(name, 0x10 /* int32 */);\n            write_number<std::int32_t, true>(static_cast<std::int32_t>(value));\n        }\n        else if (value <= static_cast<std::uint64_t>((std::numeric_limits<std::int64_t>::max)()))\n        {\n            write_bson_entry_header(name, 0x12 /* int64 */);\n            write_number<std::int64_t, true>(static_cast<std::int64_t>(value));\n        }\n        else\n        {\n            JSON_THROW(out_of_range::create(407, \"integer number \" + std::to_string(value) + \" cannot be represented by BSON as it does not fit int64\"));\n        }\n    }\n\n    /*!\n    @brief Writes a BSON element with key @a name and object @a value\n    */\n    void write_bson_object_entry(const string_t& name,\n                                 const typename BasicJsonType::object_t& value)\n    {\n        write_bson_entry_header(name, 0x03); // object\n        write_bson_object(value);\n    }\n\n    /*!\n    @return The size of the BSON-encoded array @a value\n    */\n    static std::size_t calc_bson_array_size(const typename BasicJsonType::array_t& value)\n    {\n        std::size_t array_index = 0ul;\n\n        const std::size_t embedded_document_size = std::accumulate(std::begin(value), std::end(value), std::size_t(0), [&array_index](std::size_t result, const typename BasicJsonType::array_t::value_type & el)\n        {\n            return result + calc_bson_element_size(std::to_string(array_index++), el);\n        });\n\n        return sizeof(std::int32_t) + embedded_document_size + 1ul;\n    }\n\n    /*!\n    @return The size of the BSON-encoded binary array @a value\n    */\n    static std::size_t calc_bson_binary_size(const typename BasicJsonType::binary_t& value)\n    {\n        return sizeof(std::int32_t) + value.size() + 1ul;\n    }\n\n    /*!\n    @brief Writes a BSON element with key @a name and array @a value\n    */\n    void write_bson_array(const string_t& name,\n                          const typename BasicJsonType::array_t& value)\n    {\n        write_bson_entry_header(name, 0x04); // array\n        write_number<std::int32_t, true>(static_cast<std::int32_t>(calc_bson_array_size(value)));\n\n        std::size_t array_index = 0ul;\n\n        for (const auto& el : value)\n        {\n            write_bson_element(std::to_string(array_index++), el);\n        }\n\n        oa->write_character(to_char_type(0x00));\n    }\n\n    /*!\n    @brief Writes a BSON element with key @a name and binary value @a value\n    */\n    void write_bson_binary(const string_t& name,\n                           const binary_t& value)\n    {\n        write_bson_entry_header(name, 0x05);\n\n        write_number<std::int32_t, true>(static_cast<std::int32_t>(value.size()));\n        write_number(value.has_subtype() ? value.subtype() : std::uint8_t(0x00));\n\n        oa->write_characters(reinterpret_cast<const CharType*>(value.data()), value.size());\n    }\n\n    /*!\n    @brief Calculates the size necessary to serialize the JSON value @a j with its @a name\n    @return The calculated size for the BSON document entry for @a j with the given @a name.\n    */\n    static std::size_t calc_bson_element_size(const string_t& name,\n            const BasicJsonType& j)\n    {\n        const auto header_size = calc_bson_entry_header_size(name);\n        switch (j.type())\n        {\n            case value_t::object:\n                return header_size + calc_bson_object_size(*j.m_value.object);\n\n            case value_t::array:\n                return header_size + calc_bson_array_size(*j.m_value.array);\n\n            case value_t::binary:\n                return header_size + calc_bson_binary_size(*j.m_value.binary);\n\n            case value_t::boolean:\n                return header_size + 1ul;\n\n            case value_t::number_float:\n                return header_size + 8ul;\n\n            case value_t::number_integer:\n                return header_size + calc_bson_integer_size(j.m_value.number_integer);\n\n            case value_t::number_unsigned:\n                return header_size + calc_bson_unsigned_size(j.m_value.number_unsigned);\n\n            case value_t::string:\n                return header_size + calc_bson_string_size(*j.m_value.string);\n\n            case value_t::null:\n                return header_size + 0ul;\n\n            // LCOV_EXCL_START\n            default:\n                JSON_ASSERT(false);\n                return 0ul;\n                // LCOV_EXCL_STOP\n        }\n    }\n\n    /*!\n    @brief Serializes the JSON value @a j to BSON and associates it with the\n           key @a name.\n    @param name The name to associate with the JSON entity @a j within the\n                current BSON document\n    @return The size of the BSON entry\n    */\n    void write_bson_element(const string_t& name,\n                            const BasicJsonType& j)\n    {\n        switch (j.type())\n        {\n            case value_t::object:\n                return write_bson_object_entry(name, *j.m_value.object);\n\n            case value_t::array:\n                return write_bson_array(name, *j.m_value.array);\n\n            case value_t::binary:\n                return write_bson_binary(name, *j.m_value.binary);\n\n            case value_t::boolean:\n                return write_bson_boolean(name, j.m_value.boolean);\n\n            case value_t::number_float:\n                return write_bson_double(name, j.m_value.number_float);\n\n            case value_t::number_integer:\n                return write_bson_integer(name, j.m_value.number_integer);\n\n            case value_t::number_unsigned:\n                return write_bson_unsigned(name, j.m_value.number_unsigned);\n\n            case value_t::string:\n                return write_bson_string(name, *j.m_value.string);\n\n            case value_t::null:\n                return write_bson_null(name);\n\n            // LCOV_EXCL_START\n            default:\n                JSON_ASSERT(false);\n                return;\n                // LCOV_EXCL_STOP\n        }\n    }\n\n    /*!\n    @brief Calculates the size of the BSON serialization of the given\n           JSON-object @a j.\n    @param[in] j  JSON value to serialize\n    @pre       j.type() == value_t::object\n    */\n    static std::size_t calc_bson_object_size(const typename BasicJsonType::object_t& value)\n    {\n        std::size_t document_size = std::accumulate(value.begin(), value.end(), std::size_t(0),\n                                    [](size_t result, const typename BasicJsonType::object_t::value_type & el)\n        {\n            return result += calc_bson_element_size(el.first, el.second);\n        });\n\n        return sizeof(std::int32_t) + document_size + 1ul;\n    }\n\n    /*!\n    @param[in] j  JSON value to serialize\n    @pre       j.type() == value_t::object\n    */\n    void write_bson_object(const typename BasicJsonType::object_t& value)\n    {\n        write_number<std::int32_t, true>(static_cast<std::int32_t>(calc_bson_object_size(value)));\n\n        for (const auto& el : value)\n        {\n            write_bson_element(el.first, el.second);\n        }\n\n        oa->write_character(to_char_type(0x00));\n    }\n\n    //////////\n    // CBOR //\n    //////////\n\n    static constexpr CharType get_cbor_float_prefix(float /*unused*/)\n    {\n        return to_char_type(0xFA);  // Single-Precision Float\n    }\n\n    static constexpr CharType get_cbor_float_prefix(double /*unused*/)\n    {\n        return to_char_type(0xFB);  // Double-Precision Float\n    }\n\n    /////////////\n    // MsgPack //\n    /////////////\n\n    static constexpr CharType get_msgpack_float_prefix(float /*unused*/)\n    {\n        return to_char_type(0xCA);  // float 32\n    }\n\n    static constexpr CharType get_msgpack_float_prefix(double /*unused*/)\n    {\n        return to_char_type(0xCB);  // float 64\n    }\n\n    ////////////\n    // UBJSON //\n    ////////////\n\n    // UBJSON: write number (floating point)\n    template<typename NumberType, typename std::enable_if<\n                 std::is_floating_point<NumberType>::value, int>::type = 0>\n    void write_number_with_ubjson_prefix(const NumberType n,\n                                         const bool add_prefix)\n    {\n        if (add_prefix)\n        {\n            oa->write_character(get_ubjson_float_prefix(n));\n        }\n        write_number(n);\n    }\n\n    // UBJSON: write number (unsigned integer)\n    template<typename NumberType, typename std::enable_if<\n                 std::is_unsigned<NumberType>::value, int>::type = 0>\n    void write_number_with_ubjson_prefix(const NumberType n,\n                                         const bool add_prefix)\n    {\n        if (n <= static_cast<std::uint64_t>((std::numeric_limits<std::int8_t>::max)()))\n        {\n            if (add_prefix)\n            {\n                oa->write_character(to_char_type('i'));  // int8\n            }\n            write_number(static_cast<std::uint8_t>(n));\n        }\n        else if (n <= (std::numeric_limits<std::uint8_t>::max)())\n        {\n            if (add_prefix)\n            {\n                oa->write_character(to_char_type('U'));  // uint8\n            }\n            write_number(static_cast<std::uint8_t>(n));\n        }\n        else if (n <= static_cast<std::uint64_t>((std::numeric_limits<std::int16_t>::max)()))\n        {\n            if (add_prefix)\n            {\n                oa->write_character(to_char_type('I'));  // int16\n            }\n            write_number(static_cast<std::int16_t>(n));\n        }\n        else if (n <= static_cast<std::uint64_t>((std::numeric_limits<std::int32_t>::max)()))\n        {\n            if (add_prefix)\n            {\n                oa->write_character(to_char_type('l'));  // int32\n            }\n            write_number(static_cast<std::int32_t>(n));\n        }\n        else if (n <= static_cast<std::uint64_t>((std::numeric_limits<std::int64_t>::max)()))\n        {\n            if (add_prefix)\n            {\n                oa->write_character(to_char_type('L'));  // int64\n            }\n            write_number(static_cast<std::int64_t>(n));\n        }\n        else\n        {\n            if (add_prefix)\n            {\n                oa->write_character(to_char_type('H'));  // high-precision number\n            }\n\n            const auto number = BasicJsonType(n).dump();\n            write_number_with_ubjson_prefix(number.size(), true);\n            for (std::size_t i = 0; i < number.size(); ++i)\n            {\n                oa->write_character(to_char_type(static_cast<std::uint8_t>(number[i])));\n            }\n        }\n    }\n\n    // UBJSON: write number (signed integer)\n    template < typename NumberType, typename std::enable_if <\n                   std::is_signed<NumberType>::value&&\n                   !std::is_floating_point<NumberType>::value, int >::type = 0 >\n    void write_number_with_ubjson_prefix(const NumberType n,\n                                         const bool add_prefix)\n    {\n        if ((std::numeric_limits<std::int8_t>::min)() <= n && n <= (std::numeric_limits<std::int8_t>::max)())\n        {\n            if (add_prefix)\n            {\n                oa->write_character(to_char_type('i'));  // int8\n            }\n            write_number(static_cast<std::int8_t>(n));\n        }\n        else if (static_cast<std::int64_t>((std::numeric_limits<std::uint8_t>::min)()) <= n && n <= static_cast<std::int64_t>((std::numeric_limits<std::uint8_t>::max)()))\n        {\n            if (add_prefix)\n            {\n                oa->write_character(to_char_type('U'));  // uint8\n            }\n            write_number(static_cast<std::uint8_t>(n));\n        }\n        else if ((std::numeric_limits<std::int16_t>::min)() <= n && n <= (std::numeric_limits<std::int16_t>::max)())\n        {\n            if (add_prefix)\n            {\n                oa->write_character(to_char_type('I'));  // int16\n            }\n            write_number(static_cast<std::int16_t>(n));\n        }\n        else if ((std::numeric_limits<std::int32_t>::min)() <= n && n <= (std::numeric_limits<std::int32_t>::max)())\n        {\n            if (add_prefix)\n            {\n                oa->write_character(to_char_type('l'));  // int32\n            }\n            write_number(static_cast<std::int32_t>(n));\n        }\n        else if ((std::numeric_limits<std::int64_t>::min)() <= n && n <= (std::numeric_limits<std::int64_t>::max)())\n        {\n            if (add_prefix)\n            {\n                oa->write_character(to_char_type('L'));  // int64\n            }\n            write_number(static_cast<std::int64_t>(n));\n        }\n        // LCOV_EXCL_START\n        else\n        {\n            if (add_prefix)\n            {\n                oa->write_character(to_char_type('H'));  // high-precision number\n            }\n\n            const auto number = BasicJsonType(n).dump();\n            write_number_with_ubjson_prefix(number.size(), true);\n            for (std::size_t i = 0; i < number.size(); ++i)\n            {\n                oa->write_character(to_char_type(static_cast<std::uint8_t>(number[i])));\n            }\n        }\n        // LCOV_EXCL_STOP\n    }\n\n    /*!\n    @brief determine the type prefix of container values\n    */\n    CharType ubjson_prefix(const BasicJsonType& j) const noexcept\n    {\n        switch (j.type())\n        {\n            case value_t::null:\n                return 'Z';\n\n            case value_t::boolean:\n                return j.m_value.boolean ? 'T' : 'F';\n\n            case value_t::number_integer:\n            {\n                if ((std::numeric_limits<std::int8_t>::min)() <= j.m_value.number_integer && j.m_value.number_integer <= (std::numeric_limits<std::int8_t>::max)())\n                {\n                    return 'i';\n                }\n                if ((std::numeric_limits<std::uint8_t>::min)() <= j.m_value.number_integer && j.m_value.number_integer <= (std::numeric_limits<std::uint8_t>::max)())\n                {\n                    return 'U';\n                }\n                if ((std::numeric_limits<std::int16_t>::min)() <= j.m_value.number_integer && j.m_value.number_integer <= (std::numeric_limits<std::int16_t>::max)())\n                {\n                    return 'I';\n                }\n                if ((std::numeric_limits<std::int32_t>::min)() <= j.m_value.number_integer && j.m_value.number_integer <= (std::numeric_limits<std::int32_t>::max)())\n                {\n                    return 'l';\n                }\n                if ((std::numeric_limits<std::int64_t>::min)() <= j.m_value.number_integer && j.m_value.number_integer <= (std::numeric_limits<std::int64_t>::max)())\n                {\n                    return 'L';\n                }\n                // anything else is treated as high-precision number\n                return 'H'; // LCOV_EXCL_LINE\n            }\n\n            case value_t::number_unsigned:\n            {\n                if (j.m_value.number_unsigned <= static_cast<std::uint64_t>((std::numeric_limits<std::int8_t>::max)()))\n                {\n                    return 'i';\n                }\n                if (j.m_value.number_unsigned <= static_cast<std::uint64_t>((std::numeric_limits<std::uint8_t>::max)()))\n                {\n                    return 'U';\n                }\n                if (j.m_value.number_unsigned <= static_cast<std::uint64_t>((std::numeric_limits<std::int16_t>::max)()))\n                {\n                    return 'I';\n                }\n                if (j.m_value.number_unsigned <= static_cast<std::uint64_t>((std::numeric_limits<std::int32_t>::max)()))\n                {\n                    return 'l';\n                }\n                if (j.m_value.number_unsigned <= static_cast<std::uint64_t>((std::numeric_limits<std::int64_t>::max)()))\n                {\n                    return 'L';\n                }\n                // anything else is treated as high-precision number\n                return 'H'; // LCOV_EXCL_LINE\n            }\n\n            case value_t::number_float:\n                return get_ubjson_float_prefix(j.m_value.number_float);\n\n            case value_t::string:\n                return 'S';\n\n            case value_t::array: // fallthrough\n            case value_t::binary:\n                return '[';\n\n            case value_t::object:\n                return '{';\n\n            default:  // discarded values\n                return 'N';\n        }\n    }\n\n    static constexpr CharType get_ubjson_float_prefix(float /*unused*/)\n    {\n        return 'd';  // float 32\n    }\n\n    static constexpr CharType get_ubjson_float_prefix(double /*unused*/)\n    {\n        return 'D';  // float 64\n    }\n\n    ///////////////////////\n    // Utility functions //\n    ///////////////////////\n\n    /*\n    @brief write a number to output input\n    @param[in] n number of type @a NumberType\n    @tparam NumberType the type of the number\n    @tparam OutputIsLittleEndian Set to true if output data is\n                                 required to be little endian\n\n    @note This function needs to respect the system's endianess, because bytes\n          in CBOR, MessagePack, and UBJSON are stored in network order (big\n          endian) and therefore need reordering on little endian systems.\n    */\n    template<typename NumberType, bool OutputIsLittleEndian = false>\n    void write_number(const NumberType n)\n    {\n        // step 1: write number to array of length NumberType\n        std::array<CharType, sizeof(NumberType)> vec;\n        std::memcpy(vec.data(), &n, sizeof(NumberType));\n\n        // step 2: write array to output (with possible reordering)\n        if (is_little_endian != OutputIsLittleEndian)\n        {\n            // reverse byte order prior to conversion if necessary\n            std::reverse(vec.begin(), vec.end());\n        }\n\n        oa->write_characters(vec.data(), sizeof(NumberType));\n    }\n\n    void write_compact_float(const number_float_t n, detail::input_format_t format)\n    {\n        if (static_cast<double>(n) >= static_cast<double>(std::numeric_limits<float>::lowest()) &&\n                static_cast<double>(n) <= static_cast<double>((std::numeric_limits<float>::max)()) &&\n                static_cast<double>(static_cast<float>(n)) == static_cast<double>(n))\n        {\n            oa->write_character(format == detail::input_format_t::cbor\n                                ? get_cbor_float_prefix(static_cast<float>(n))\n                                : get_msgpack_float_prefix(static_cast<float>(n)));\n            write_number(static_cast<float>(n));\n        }\n        else\n        {\n            oa->write_character(format == detail::input_format_t::cbor\n                                ? get_cbor_float_prefix(n)\n                                : get_msgpack_float_prefix(n));\n            write_number(n);\n        }\n    }\n\n  public:\n    // The following to_char_type functions are implement the conversion\n    // between uint8_t and CharType. In case CharType is not unsigned,\n    // such a conversion is required to allow values greater than 128.\n    // See <https://github.com/nlohmann/json/issues/1286> for a discussion.\n    template < typename C = CharType,\n               enable_if_t < std::is_signed<C>::value && std::is_signed<char>::value > * = nullptr >\n    static constexpr CharType to_char_type(std::uint8_t x) noexcept\n    {\n        return *reinterpret_cast<char*>(&x);\n    }\n\n    template < typename C = CharType,\n               enable_if_t < std::is_signed<C>::value && std::is_unsigned<char>::value > * = nullptr >\n    static CharType to_char_type(std::uint8_t x) noexcept\n    {\n        static_assert(sizeof(std::uint8_t) == sizeof(CharType), \"size of CharType must be equal to std::uint8_t\");\n        static_assert(std::is_trivial<CharType>::value, \"CharType must be trivial\");\n        CharType result;\n        std::memcpy(&result, &x, sizeof(x));\n        return result;\n    }\n\n    template<typename C = CharType,\n             enable_if_t<std::is_unsigned<C>::value>* = nullptr>\n    static constexpr CharType to_char_type(std::uint8_t x) noexcept\n    {\n        return x;\n    }\n\n    template < typename InputCharType, typename C = CharType,\n               enable_if_t <\n                   std::is_signed<C>::value &&\n                   std::is_signed<char>::value &&\n                   std::is_same<char, typename std::remove_cv<InputCharType>::type>::value\n                   > * = nullptr >\n    static constexpr CharType to_char_type(InputCharType x) noexcept\n    {\n        return x;\n    }\n\n  private:\n    /// whether we can assume little endianess\n    const bool is_little_endian = little_endianess();\n\n    /// the output\n    output_adapter_t<CharType> oa = nullptr;\n};\n}  // namespace detail\n}  // namespace nlohmann\n\n// #include <nlohmann/detail/output/output_adapters.hpp>\n\n// #include <nlohmann/detail/output/serializer.hpp>\n\n\n#include <algorithm> // reverse, remove, fill, find, none_of\n#include <array> // array\n#include <clocale> // localeconv, lconv\n#include <cmath> // labs, isfinite, isnan, signbit\n#include <cstddef> // size_t, ptrdiff_t\n#include <cstdint> // uint8_t\n#include <cstdio> // snprintf\n#include <limits> // numeric_limits\n#include <string> // string, char_traits\n#include <type_traits> // is_same\n#include <utility> // move\n\n// #include <nlohmann/detail/conversions/to_chars.hpp>\n\n\n#include <array> // array\n#include <cmath>   // signbit, isfinite\n#include <cstdint> // intN_t, uintN_t\n#include <cstring> // memcpy, memmove\n#include <limits> // numeric_limits\n#include <type_traits> // conditional\n\n// #include <nlohmann/detail/macro_scope.hpp>\n\n\nnamespace nlohmann\n{\nnamespace detail\n{\n\n/*!\n@brief implements the Grisu2 algorithm for binary to decimal floating-point\nconversion.\n\nThis implementation is a slightly modified version of the reference\nimplementation which may be obtained from\nhttp://florian.loitsch.com/publications (bench.tar.gz).\n\nThe code is distributed under the MIT license, Copyright (c) 2009 Florian Loitsch.\n\nFor a detailed description of the algorithm see:\n\n[1] Loitsch, \"Printing Floating-Point Numbers Quickly and Accurately with\n    Integers\", Proceedings of the ACM SIGPLAN 2010 Conference on Programming\n    Language Design and Implementation, PLDI 2010\n[2] Burger, Dybvig, \"Printing Floating-Point Numbers Quickly and Accurately\",\n    Proceedings of the ACM SIGPLAN 1996 Conference on Programming Language\n    Design and Implementation, PLDI 1996\n*/\nnamespace dtoa_impl\n{\n\ntemplate<typename Target, typename Source>\nTarget reinterpret_bits(const Source source)\n{\n    static_assert(sizeof(Target) == sizeof(Source), \"size mismatch\");\n\n    Target target;\n    std::memcpy(&target, &source, sizeof(Source));\n    return target;\n}\n\nstruct diyfp // f * 2^e\n{\n    static constexpr int kPrecision = 64; // = q\n\n    std::uint64_t f = 0;\n    int e = 0;\n\n    constexpr diyfp(std::uint64_t f_, int e_) noexcept : f(f_), e(e_) {}\n\n    /*!\n    @brief returns x - y\n    @pre x.e == y.e and x.f >= y.f\n    */\n    static diyfp sub(const diyfp& x, const diyfp& y) noexcept\n    {\n        JSON_ASSERT(x.e == y.e);\n        JSON_ASSERT(x.f >= y.f);\n\n        return {x.f - y.f, x.e};\n    }\n\n    /*!\n    @brief returns x * y\n    @note The result is rounded. (Only the upper q bits are returned.)\n    */\n    static diyfp mul(const diyfp& x, const diyfp& y) noexcept\n    {\n        static_assert(kPrecision == 64, \"internal error\");\n\n        // Computes:\n        //  f = round((x.f * y.f) / 2^q)\n        //  e = x.e + y.e + q\n\n        // Emulate the 64-bit * 64-bit multiplication:\n        //\n        // p = u * v\n        //   = (u_lo + 2^32 u_hi) (v_lo + 2^32 v_hi)\n        //   = (u_lo v_lo         ) + 2^32 ((u_lo v_hi         ) + (u_hi v_lo         )) + 2^64 (u_hi v_hi         )\n        //   = (p0                ) + 2^32 ((p1                ) + (p2                )) + 2^64 (p3                )\n        //   = (p0_lo + 2^32 p0_hi) + 2^32 ((p1_lo + 2^32 p1_hi) + (p2_lo + 2^32 p2_hi)) + 2^64 (p3                )\n        //   = (p0_lo             ) + 2^32 (p0_hi + p1_lo + p2_lo                      ) + 2^64 (p1_hi + p2_hi + p3)\n        //   = (p0_lo             ) + 2^32 (Q                                          ) + 2^64 (H                 )\n        //   = (p0_lo             ) + 2^32 (Q_lo + 2^32 Q_hi                           ) + 2^64 (H                 )\n        //\n        // (Since Q might be larger than 2^32 - 1)\n        //\n        //   = (p0_lo + 2^32 Q_lo) + 2^64 (Q_hi + H)\n        //\n        // (Q_hi + H does not overflow a 64-bit int)\n        //\n        //   = p_lo + 2^64 p_hi\n\n        const std::uint64_t u_lo = x.f & 0xFFFFFFFFu;\n        const std::uint64_t u_hi = x.f >> 32u;\n        const std::uint64_t v_lo = y.f & 0xFFFFFFFFu;\n        const std::uint64_t v_hi = y.f >> 32u;\n\n        const std::uint64_t p0 = u_lo * v_lo;\n        const std::uint64_t p1 = u_lo * v_hi;\n        const std::uint64_t p2 = u_hi * v_lo;\n        const std::uint64_t p3 = u_hi * v_hi;\n\n        const std::uint64_t p0_hi = p0 >> 32u;\n        const std::uint64_t p1_lo = p1 & 0xFFFFFFFFu;\n        const std::uint64_t p1_hi = p1 >> 32u;\n        const std::uint64_t p2_lo = p2 & 0xFFFFFFFFu;\n        const std::uint64_t p2_hi = p2 >> 32u;\n\n        std::uint64_t Q = p0_hi + p1_lo + p2_lo;\n\n        // The full product might now be computed as\n        //\n        // p_hi = p3 + p2_hi + p1_hi + (Q >> 32)\n        // p_lo = p0_lo + (Q << 32)\n        //\n        // But in this particular case here, the full p_lo is not required.\n        // Effectively we only need to add the highest bit in p_lo to p_hi (and\n        // Q_hi + 1 does not overflow).\n\n        Q += std::uint64_t{1} << (64u - 32u - 1u); // round, ties up\n\n        const std::uint64_t h = p3 + p2_hi + p1_hi + (Q >> 32u);\n\n        return {h, x.e + y.e + 64};\n    }\n\n    /*!\n    @brief normalize x such that the significand is >= 2^(q-1)\n    @pre x.f != 0\n    */\n    static diyfp normalize(diyfp x) noexcept\n    {\n        JSON_ASSERT(x.f != 0);\n\n        while ((x.f >> 63u) == 0)\n        {\n            x.f <<= 1u;\n            x.e--;\n        }\n\n        return x;\n    }\n\n    /*!\n    @brief normalize x such that the result has the exponent E\n    @pre e >= x.e and the upper e - x.e bits of x.f must be zero.\n    */\n    static diyfp normalize_to(const diyfp& x, const int target_exponent) noexcept\n    {\n        const int delta = x.e - target_exponent;\n\n        JSON_ASSERT(delta >= 0);\n        JSON_ASSERT(((x.f << delta) >> delta) == x.f);\n\n        return {x.f << delta, target_exponent};\n    }\n};\n\nstruct boundaries\n{\n    diyfp w;\n    diyfp minus;\n    diyfp plus;\n};\n\n/*!\nCompute the (normalized) diyfp representing the input number 'value' and its\nboundaries.\n\n@pre value must be finite and positive\n*/\ntemplate<typename FloatType>\nboundaries compute_boundaries(FloatType value)\n{\n    JSON_ASSERT(std::isfinite(value));\n    JSON_ASSERT(value > 0);\n\n    // Convert the IEEE representation into a diyfp.\n    //\n    // If v is denormal:\n    //      value = 0.F * 2^(1 - bias) = (          F) * 2^(1 - bias - (p-1))\n    // If v is normalized:\n    //      value = 1.F * 2^(E - bias) = (2^(p-1) + F) * 2^(E - bias - (p-1))\n\n    static_assert(std::numeric_limits<FloatType>::is_iec559,\n                  \"internal error: dtoa_short requires an IEEE-754 floating-point implementation\");\n\n    constexpr int      kPrecision = std::numeric_limits<FloatType>::digits; // = p (includes the hidden bit)\n    constexpr int      kBias      = std::numeric_limits<FloatType>::max_exponent - 1 + (kPrecision - 1);\n    constexpr int      kMinExp    = 1 - kBias;\n    constexpr std::uint64_t kHiddenBit = std::uint64_t{1} << (kPrecision - 1); // = 2^(p-1)\n\n    using bits_type = typename std::conditional<kPrecision == 24, std::uint32_t, std::uint64_t >::type;\n\n    const std::uint64_t bits = reinterpret_bits<bits_type>(value);\n    const std::uint64_t E = bits >> (kPrecision - 1);\n    const std::uint64_t F = bits & (kHiddenBit - 1);\n\n    const bool is_denormal = E == 0;\n    const diyfp v = is_denormal\n                    ? diyfp(F, kMinExp)\n                    : diyfp(F + kHiddenBit, static_cast<int>(E) - kBias);\n\n    // Compute the boundaries m- and m+ of the floating-point value\n    // v = f * 2^e.\n    //\n    // Determine v- and v+, the floating-point predecessor and successor if v,\n    // respectively.\n    //\n    //      v- = v - 2^e        if f != 2^(p-1) or e == e_min                (A)\n    //         = v - 2^(e-1)    if f == 2^(p-1) and e > e_min                (B)\n    //\n    //      v+ = v + 2^e\n    //\n    // Let m- = (v- + v) / 2 and m+ = (v + v+) / 2. All real numbers _strictly_\n    // between m- and m+ round to v, regardless of how the input rounding\n    // algorithm breaks ties.\n    //\n    //      ---+-------------+-------------+-------------+-------------+---  (A)\n    //         v-            m-            v             m+            v+\n    //\n    //      -----------------+------+------+-------------+-------------+---  (B)\n    //                       v-     m-     v             m+            v+\n\n    const bool lower_boundary_is_closer = F == 0 && E > 1;\n    const diyfp m_plus = diyfp(2 * v.f + 1, v.e - 1);\n    const diyfp m_minus = lower_boundary_is_closer\n                          ? diyfp(4 * v.f - 1, v.e - 2)  // (B)\n                          : diyfp(2 * v.f - 1, v.e - 1); // (A)\n\n    // Determine the normalized w+ = m+.\n    const diyfp w_plus = diyfp::normalize(m_plus);\n\n    // Determine w- = m- such that e_(w-) = e_(w+).\n    const diyfp w_minus = diyfp::normalize_to(m_minus, w_plus.e);\n\n    return {diyfp::normalize(v), w_minus, w_plus};\n}\n\n// Given normalized diyfp w, Grisu needs to find a (normalized) cached\n// power-of-ten c, such that the exponent of the product c * w = f * 2^e lies\n// within a certain range [alpha, gamma] (Definition 3.2 from [1])\n//\n//      alpha <= e = e_c + e_w + q <= gamma\n//\n// or\n//\n//      f_c * f_w * 2^alpha <= f_c 2^(e_c) * f_w 2^(e_w) * 2^q\n//                          <= f_c * f_w * 2^gamma\n//\n// Since c and w are normalized, i.e. 2^(q-1) <= f < 2^q, this implies\n//\n//      2^(q-1) * 2^(q-1) * 2^alpha <= c * w * 2^q < 2^q * 2^q * 2^gamma\n//\n// or\n//\n//      2^(q - 2 + alpha) <= c * w < 2^(q + gamma)\n//\n// The choice of (alpha,gamma) determines the size of the table and the form of\n// the digit generation procedure. Using (alpha,gamma)=(-60,-32) works out well\n// in practice:\n//\n// The idea is to cut the number c * w = f * 2^e into two parts, which can be\n// processed independently: An integral part p1, and a fractional part p2:\n//\n//      f * 2^e = ( (f div 2^-e) * 2^-e + (f mod 2^-e) ) * 2^e\n//              = (f div 2^-e) + (f mod 2^-e) * 2^e\n//              = p1 + p2 * 2^e\n//\n// The conversion of p1 into decimal form requires a series of divisions and\n// modulos by (a power of) 10. These operations are faster for 32-bit than for\n// 64-bit integers, so p1 should ideally fit into a 32-bit integer. This can be\n// achieved by choosing\n//\n//      -e >= 32   or   e <= -32 := gamma\n//\n// In order to convert the fractional part\n//\n//      p2 * 2^e = p2 / 2^-e = d[-1] / 10^1 + d[-2] / 10^2 + ...\n//\n// into decimal form, the fraction is repeatedly multiplied by 10 and the digits\n// d[-i] are extracted in order:\n//\n//      (10 * p2) div 2^-e = d[-1]\n//      (10 * p2) mod 2^-e = d[-2] / 10^1 + ...\n//\n// The multiplication by 10 must not overflow. It is sufficient to choose\n//\n//      10 * p2 < 16 * p2 = 2^4 * p2 <= 2^64.\n//\n// Since p2 = f mod 2^-e < 2^-e,\n//\n//      -e <= 60   or   e >= -60 := alpha\n\nconstexpr int kAlpha = -60;\nconstexpr int kGamma = -32;\n\nstruct cached_power // c = f * 2^e ~= 10^k\n{\n    std::uint64_t f;\n    int e;\n    int k;\n};\n\n/*!\nFor a normalized diyfp w = f * 2^e, this function returns a (normalized) cached\npower-of-ten c = f_c * 2^e_c, such that the exponent of the product w * c\nsatisfies (Definition 3.2 from [1])\n\n     alpha <= e_c + e + q <= gamma.\n*/\ninline cached_power get_cached_power_for_binary_exponent(int e)\n{\n    // Now\n    //\n    //      alpha <= e_c + e + q <= gamma                                    (1)\n    //      ==> f_c * 2^alpha <= c * 2^e * 2^q\n    //\n    // and since the c's are normalized, 2^(q-1) <= f_c,\n    //\n    //      ==> 2^(q - 1 + alpha) <= c * 2^(e + q)\n    //      ==> 2^(alpha - e - 1) <= c\n    //\n    // If c were an exact power of ten, i.e. c = 10^k, one may determine k as\n    //\n    //      k = ceil( log_10( 2^(alpha - e - 1) ) )\n    //        = ceil( (alpha - e - 1) * log_10(2) )\n    //\n    // From the paper:\n    // \"In theory the result of the procedure could be wrong since c is rounded,\n    //  and the computation itself is approximated [...]. In practice, however,\n    //  this simple function is sufficient.\"\n    //\n    // For IEEE double precision floating-point numbers converted into\n    // normalized diyfp's w = f * 2^e, with q = 64,\n    //\n    //      e >= -1022      (min IEEE exponent)\n    //           -52        (p - 1)\n    //           -52        (p - 1, possibly normalize denormal IEEE numbers)\n    //           -11        (normalize the diyfp)\n    //         = -1137\n    //\n    // and\n    //\n    //      e <= +1023      (max IEEE exponent)\n    //           -52        (p - 1)\n    //           -11        (normalize the diyfp)\n    //         = 960\n    //\n    // This binary exponent range [-1137,960] results in a decimal exponent\n    // range [-307,324]. One does not need to store a cached power for each\n    // k in this range. For each such k it suffices to find a cached power\n    // such that the exponent of the product lies in [alpha,gamma].\n    // This implies that the difference of the decimal exponents of adjacent\n    // table entries must be less than or equal to\n    //\n    //      floor( (gamma - alpha) * log_10(2) ) = 8.\n    //\n    // (A smaller distance gamma-alpha would require a larger table.)\n\n    // NB:\n    // Actually this function returns c, such that -60 <= e_c + e + 64 <= -34.\n\n    constexpr int kCachedPowersMinDecExp = -300;\n    constexpr int kCachedPowersDecStep = 8;\n\n    static constexpr std::array<cached_power, 79> kCachedPowers =\n    {\n        {\n            { 0xAB70FE17C79AC6CA, -1060, -300 },\n            { 0xFF77B1FCBEBCDC4F, -1034, -292 },\n            { 0xBE5691EF416BD60C, -1007, -284 },\n            { 0x8DD01FAD907FFC3C,  -980, -276 },\n            { 0xD3515C2831559A83,  -954, -268 },\n            { 0x9D71AC8FADA6C9B5,  -927, -260 },\n            { 0xEA9C227723EE8BCB,  -901, -252 },\n            { 0xAECC49914078536D,  -874, -244 },\n            { 0x823C12795DB6CE57,  -847, -236 },\n            { 0xC21094364DFB5637,  -821, -228 },\n            { 0x9096EA6F3848984F,  -794, -220 },\n            { 0xD77485CB25823AC7,  -768, -212 },\n            { 0xA086CFCD97BF97F4,  -741, -204 },\n            { 0xEF340A98172AACE5,  -715, -196 },\n            { 0xB23867FB2A35B28E,  -688, -188 },\n            { 0x84C8D4DFD2C63F3B,  -661, -180 },\n            { 0xC5DD44271AD3CDBA,  -635, -172 },\n            { 0x936B9FCEBB25C996,  -608, -164 },\n            { 0xDBAC6C247D62A584,  -582, -156 },\n            { 0xA3AB66580D5FDAF6,  -555, -148 },\n            { 0xF3E2F893DEC3F126,  -529, -140 },\n            { 0xB5B5ADA8AAFF80B8,  -502, -132 },\n            { 0x87625F056C7C4A8B,  -475, -124 },\n            { 0xC9BCFF6034C13053,  -449, -116 },\n            { 0x964E858C91BA2655,  -422, -108 },\n            { 0xDFF9772470297EBD,  -396, -100 },\n            { 0xA6DFBD9FB8E5B88F,  -369,  -92 },\n            { 0xF8A95FCF88747D94,  -343,  -84 },\n            { 0xB94470938FA89BCF,  -316,  -76 },\n            { 0x8A08F0F8BF0F156B,  -289,  -68 },\n            { 0xCDB02555653131B6,  -263,  -60 },\n            { 0x993FE2C6D07B7FAC,  -236,  -52 },\n            { 0xE45C10C42A2B3B06,  -210,  -44 },\n            { 0xAA242499697392D3,  -183,  -36 },\n            { 0xFD87B5F28300CA0E,  -157,  -28 },\n            { 0xBCE5086492111AEB,  -130,  -20 },\n            { 0x8CBCCC096F5088CC,  -103,  -12 },\n            { 0xD1B71758E219652C,   -77,   -4 },\n            { 0x9C40000000000000,   -50,    4 },\n            { 0xE8D4A51000000000,   -24,   12 },\n            { 0xAD78EBC5AC620000,     3,   20 },\n            { 0x813F3978F8940984,    30,   28 },\n            { 0xC097CE7BC90715B3,    56,   36 },\n            { 0x8F7E32CE7BEA5C70,    83,   44 },\n            { 0xD5D238A4ABE98068,   109,   52 },\n            { 0x9F4F2726179A2245,   136,   60 },\n            { 0xED63A231D4C4FB27,   162,   68 },\n            { 0xB0DE65388CC8ADA8,   189,   76 },\n            { 0x83C7088E1AAB65DB,   216,   84 },\n            { 0xC45D1DF942711D9A,   242,   92 },\n            { 0x924D692CA61BE758,   269,  100 },\n            { 0xDA01EE641A708DEA,   295,  108 },\n            { 0xA26DA3999AEF774A,   322,  116 },\n            { 0xF209787BB47D6B85,   348,  124 },\n            { 0xB454E4A179DD1877,   375,  132 },\n            { 0x865B86925B9BC5C2,   402,  140 },\n            { 0xC83553C5C8965D3D,   428,  148 },\n            { 0x952AB45CFA97A0B3,   455,  156 },\n            { 0xDE469FBD99A05FE3,   481,  164 },\n            { 0xA59BC234DB398C25,   508,  172 },\n            { 0xF6C69A72A3989F5C,   534,  180 },\n            { 0xB7DCBF5354E9BECE,   561,  188 },\n            { 0x88FCF317F22241E2,   588,  196 },\n            { 0xCC20CE9BD35C78A5,   614,  204 },\n            { 0x98165AF37B2153DF,   641,  212 },\n            { 0xE2A0B5DC971F303A,   667,  220 },\n            { 0xA8D9D1535CE3B396,   694,  228 },\n            { 0xFB9B7CD9A4A7443C,   720,  236 },\n            { 0xBB764C4CA7A44410,   747,  244 },\n            { 0x8BAB8EEFB6409C1A,   774,  252 },\n            { 0xD01FEF10A657842C,   800,  260 },\n            { 0x9B10A4E5E9913129,   827,  268 },\n            { 0xE7109BFBA19C0C9D,   853,  276 },\n            { 0xAC2820D9623BF429,   880,  284 },\n            { 0x80444B5E7AA7CF85,   907,  292 },\n            { 0xBF21E44003ACDD2D,   933,  300 },\n            { 0x8E679C2F5E44FF8F,   960,  308 },\n            { 0xD433179D9C8CB841,   986,  316 },\n            { 0x9E19DB92B4E31BA9,  1013,  324 },\n        }\n    };\n\n    // This computation gives exactly the same results for k as\n    //      k = ceil((kAlpha - e - 1) * 0.30102999566398114)\n    // for |e| <= 1500, but doesn't require floating-point operations.\n    // NB: log_10(2) ~= 78913 / 2^18\n    JSON_ASSERT(e >= -1500);\n    JSON_ASSERT(e <=  1500);\n    const int f = kAlpha - e - 1;\n    const int k = (f * 78913) / (1 << 18) + static_cast<int>(f > 0);\n\n    const int index = (-kCachedPowersMinDecExp + k + (kCachedPowersDecStep - 1)) / kCachedPowersDecStep;\n    JSON_ASSERT(index >= 0);\n    JSON_ASSERT(static_cast<std::size_t>(index) < kCachedPowers.size());\n\n    const cached_power cached = kCachedPowers[static_cast<std::size_t>(index)];\n    JSON_ASSERT(kAlpha <= cached.e + e + 64);\n    JSON_ASSERT(kGamma >= cached.e + e + 64);\n\n    return cached;\n}\n\n/*!\nFor n != 0, returns k, such that pow10 := 10^(k-1) <= n < 10^k.\nFor n == 0, returns 1 and sets pow10 := 1.\n*/\ninline int find_largest_pow10(const std::uint32_t n, std::uint32_t& pow10)\n{\n    // LCOV_EXCL_START\n    if (n >= 1000000000)\n    {\n        pow10 = 1000000000;\n        return 10;\n    }\n    // LCOV_EXCL_STOP\n    else if (n >= 100000000)\n    {\n        pow10 = 100000000;\n        return  9;\n    }\n    else if (n >= 10000000)\n    {\n        pow10 = 10000000;\n        return  8;\n    }\n    else if (n >= 1000000)\n    {\n        pow10 = 1000000;\n        return  7;\n    }\n    else if (n >= 100000)\n    {\n        pow10 = 100000;\n        return  6;\n    }\n    else if (n >= 10000)\n    {\n        pow10 = 10000;\n        return  5;\n    }\n    else if (n >= 1000)\n    {\n        pow10 = 1000;\n        return  4;\n    }\n    else if (n >= 100)\n    {\n        pow10 = 100;\n        return  3;\n    }\n    else if (n >= 10)\n    {\n        pow10 = 10;\n        return  2;\n    }\n    else\n    {\n        pow10 = 1;\n        return 1;\n    }\n}\n\ninline void grisu2_round(char* buf, int len, std::uint64_t dist, std::uint64_t delta,\n                         std::uint64_t rest, std::uint64_t ten_k)\n{\n    JSON_ASSERT(len >= 1);\n    JSON_ASSERT(dist <= delta);\n    JSON_ASSERT(rest <= delta);\n    JSON_ASSERT(ten_k > 0);\n\n    //               <--------------------------- delta ---->\n    //                                  <---- dist --------->\n    // --------------[------------------+-------------------]--------------\n    //               M-                 w                   M+\n    //\n    //                                  ten_k\n    //                                <------>\n    //                                       <---- rest ---->\n    // --------------[------------------+----+--------------]--------------\n    //                                  w    V\n    //                                       = buf * 10^k\n    //\n    // ten_k represents a unit-in-the-last-place in the decimal representation\n    // stored in buf.\n    // Decrement buf by ten_k while this takes buf closer to w.\n\n    // The tests are written in this order to avoid overflow in unsigned\n    // integer arithmetic.\n\n    while (rest < dist\n            && delta - rest >= ten_k\n            && (rest + ten_k < dist || dist - rest > rest + ten_k - dist))\n    {\n        JSON_ASSERT(buf[len - 1] != '0');\n        buf[len - 1]--;\n        rest += ten_k;\n    }\n}\n\n/*!\nGenerates V = buffer * 10^decimal_exponent, such that M- <= V <= M+.\nM- and M+ must be normalized and share the same exponent -60 <= e <= -32.\n*/\ninline void grisu2_digit_gen(char* buffer, int& length, int& decimal_exponent,\n                             diyfp M_minus, diyfp w, diyfp M_plus)\n{\n    static_assert(kAlpha >= -60, \"internal error\");\n    static_assert(kGamma <= -32, \"internal error\");\n\n    // Generates the digits (and the exponent) of a decimal floating-point\n    // number V = buffer * 10^decimal_exponent in the range [M-, M+]. The diyfp's\n    // w, M- and M+ share the same exponent e, which satisfies alpha <= e <= gamma.\n    //\n    //               <--------------------------- delta ---->\n    //                                  <---- dist --------->\n    // --------------[------------------+-------------------]--------------\n    //               M-                 w                   M+\n    //\n    // Grisu2 generates the digits of M+ from left to right and stops as soon as\n    // V is in [M-,M+].\n\n    JSON_ASSERT(M_plus.e >= kAlpha);\n    JSON_ASSERT(M_plus.e <= kGamma);\n\n    std::uint64_t delta = diyfp::sub(M_plus, M_minus).f; // (significand of (M+ - M-), implicit exponent is e)\n    std::uint64_t dist  = diyfp::sub(M_plus, w      ).f; // (significand of (M+ - w ), implicit exponent is e)\n\n    // Split M+ = f * 2^e into two parts p1 and p2 (note: e < 0):\n    //\n    //      M+ = f * 2^e\n    //         = ((f div 2^-e) * 2^-e + (f mod 2^-e)) * 2^e\n    //         = ((p1        ) * 2^-e + (p2        )) * 2^e\n    //         = p1 + p2 * 2^e\n\n    const diyfp one(std::uint64_t{1} << -M_plus.e, M_plus.e);\n\n    auto p1 = static_cast<std::uint32_t>(M_plus.f >> -one.e); // p1 = f div 2^-e (Since -e >= 32, p1 fits into a 32-bit int.)\n    std::uint64_t p2 = M_plus.f & (one.f - 1);                    // p2 = f mod 2^-e\n\n    // 1)\n    //\n    // Generate the digits of the integral part p1 = d[n-1]...d[1]d[0]\n\n    JSON_ASSERT(p1 > 0);\n\n    std::uint32_t pow10;\n    const int k = find_largest_pow10(p1, pow10);\n\n    //      10^(k-1) <= p1 < 10^k, pow10 = 10^(k-1)\n    //\n    //      p1 = (p1 div 10^(k-1)) * 10^(k-1) + (p1 mod 10^(k-1))\n    //         = (d[k-1]         ) * 10^(k-1) + (p1 mod 10^(k-1))\n    //\n    //      M+ = p1                                             + p2 * 2^e\n    //         = d[k-1] * 10^(k-1) + (p1 mod 10^(k-1))          + p2 * 2^e\n    //         = d[k-1] * 10^(k-1) + ((p1 mod 10^(k-1)) * 2^-e + p2) * 2^e\n    //         = d[k-1] * 10^(k-1) + (                         rest) * 2^e\n    //\n    // Now generate the digits d[n] of p1 from left to right (n = k-1,...,0)\n    //\n    //      p1 = d[k-1]...d[n] * 10^n + d[n-1]...d[0]\n    //\n    // but stop as soon as\n    //\n    //      rest * 2^e = (d[n-1]...d[0] * 2^-e + p2) * 2^e <= delta * 2^e\n\n    int n = k;\n    while (n > 0)\n    {\n        // Invariants:\n        //      M+ = buffer * 10^n + (p1 + p2 * 2^e)    (buffer = 0 for n = k)\n        //      pow10 = 10^(n-1) <= p1 < 10^n\n        //\n        const std::uint32_t d = p1 / pow10;  // d = p1 div 10^(n-1)\n        const std::uint32_t r = p1 % pow10;  // r = p1 mod 10^(n-1)\n        //\n        //      M+ = buffer * 10^n + (d * 10^(n-1) + r) + p2 * 2^e\n        //         = (buffer * 10 + d) * 10^(n-1) + (r + p2 * 2^e)\n        //\n        JSON_ASSERT(d <= 9);\n        buffer[length++] = static_cast<char>('0' + d); // buffer := buffer * 10 + d\n        //\n        //      M+ = buffer * 10^(n-1) + (r + p2 * 2^e)\n        //\n        p1 = r;\n        n--;\n        //\n        //      M+ = buffer * 10^n + (p1 + p2 * 2^e)\n        //      pow10 = 10^n\n        //\n\n        // Now check if enough digits have been generated.\n        // Compute\n        //\n        //      p1 + p2 * 2^e = (p1 * 2^-e + p2) * 2^e = rest * 2^e\n        //\n        // Note:\n        // Since rest and delta share the same exponent e, it suffices to\n        // compare the significands.\n        const std::uint64_t rest = (std::uint64_t{p1} << -one.e) + p2;\n        if (rest <= delta)\n        {\n            // V = buffer * 10^n, with M- <= V <= M+.\n\n            decimal_exponent += n;\n\n            // We may now just stop. But instead look if the buffer could be\n            // decremented to bring V closer to w.\n            //\n            // pow10 = 10^n is now 1 ulp in the decimal representation V.\n            // The rounding procedure works with diyfp's with an implicit\n            // exponent of e.\n            //\n            //      10^n = (10^n * 2^-e) * 2^e = ulp * 2^e\n            //\n            const std::uint64_t ten_n = std::uint64_t{pow10} << -one.e;\n            grisu2_round(buffer, length, dist, delta, rest, ten_n);\n\n            return;\n        }\n\n        pow10 /= 10;\n        //\n        //      pow10 = 10^(n-1) <= p1 < 10^n\n        // Invariants restored.\n    }\n\n    // 2)\n    //\n    // The digits of the integral part have been generated:\n    //\n    //      M+ = d[k-1]...d[1]d[0] + p2 * 2^e\n    //         = buffer            + p2 * 2^e\n    //\n    // Now generate the digits of the fractional part p2 * 2^e.\n    //\n    // Note:\n    // No decimal point is generated: the exponent is adjusted instead.\n    //\n    // p2 actually represents the fraction\n    //\n    //      p2 * 2^e\n    //          = p2 / 2^-e\n    //          = d[-1] / 10^1 + d[-2] / 10^2 + ...\n    //\n    // Now generate the digits d[-m] of p1 from left to right (m = 1,2,...)\n    //\n    //      p2 * 2^e = d[-1]d[-2]...d[-m] * 10^-m\n    //                      + 10^-m * (d[-m-1] / 10^1 + d[-m-2] / 10^2 + ...)\n    //\n    // using\n    //\n    //      10^m * p2 = ((10^m * p2) div 2^-e) * 2^-e + ((10^m * p2) mod 2^-e)\n    //                = (                   d) * 2^-e + (                   r)\n    //\n    // or\n    //      10^m * p2 * 2^e = d + r * 2^e\n    //\n    // i.e.\n    //\n    //      M+ = buffer + p2 * 2^e\n    //         = buffer + 10^-m * (d + r * 2^e)\n    //         = (buffer * 10^m + d) * 10^-m + 10^-m * r * 2^e\n    //\n    // and stop as soon as 10^-m * r * 2^e <= delta * 2^e\n\n    JSON_ASSERT(p2 > delta);\n\n    int m = 0;\n    for (;;)\n    {\n        // Invariant:\n        //      M+ = buffer * 10^-m + 10^-m * (d[-m-1] / 10 + d[-m-2] / 10^2 + ...) * 2^e\n        //         = buffer * 10^-m + 10^-m * (p2                                 ) * 2^e\n        //         = buffer * 10^-m + 10^-m * (1/10 * (10 * p2)                   ) * 2^e\n        //         = buffer * 10^-m + 10^-m * (1/10 * ((10*p2 div 2^-e) * 2^-e + (10*p2 mod 2^-e)) * 2^e\n        //\n        JSON_ASSERT(p2 <= (std::numeric_limits<std::uint64_t>::max)() / 10);\n        p2 *= 10;\n        const std::uint64_t d = p2 >> -one.e;     // d = (10 * p2) div 2^-e\n        const std::uint64_t r = p2 & (one.f - 1); // r = (10 * p2) mod 2^-e\n        //\n        //      M+ = buffer * 10^-m + 10^-m * (1/10 * (d * 2^-e + r) * 2^e\n        //         = buffer * 10^-m + 10^-m * (1/10 * (d + r * 2^e))\n        //         = (buffer * 10 + d) * 10^(-m-1) + 10^(-m-1) * r * 2^e\n        //\n        JSON_ASSERT(d <= 9);\n        buffer[length++] = static_cast<char>('0' + d); // buffer := buffer * 10 + d\n        //\n        //      M+ = buffer * 10^(-m-1) + 10^(-m-1) * r * 2^e\n        //\n        p2 = r;\n        m++;\n        //\n        //      M+ = buffer * 10^-m + 10^-m * p2 * 2^e\n        // Invariant restored.\n\n        // Check if enough digits have been generated.\n        //\n        //      10^-m * p2 * 2^e <= delta * 2^e\n        //              p2 * 2^e <= 10^m * delta * 2^e\n        //                    p2 <= 10^m * delta\n        delta *= 10;\n        dist  *= 10;\n        if (p2 <= delta)\n        {\n            break;\n        }\n    }\n\n    // V = buffer * 10^-m, with M- <= V <= M+.\n\n    decimal_exponent -= m;\n\n    // 1 ulp in the decimal representation is now 10^-m.\n    // Since delta and dist are now scaled by 10^m, we need to do the\n    // same with ulp in order to keep the units in sync.\n    //\n    //      10^m * 10^-m = 1 = 2^-e * 2^e = ten_m * 2^e\n    //\n    const std::uint64_t ten_m = one.f;\n    grisu2_round(buffer, length, dist, delta, p2, ten_m);\n\n    // By construction this algorithm generates the shortest possible decimal\n    // number (Loitsch, Theorem 6.2) which rounds back to w.\n    // For an input number of precision p, at least\n    //\n    //      N = 1 + ceil(p * log_10(2))\n    //\n    // decimal digits are sufficient to identify all binary floating-point\n    // numbers (Matula, \"In-and-Out conversions\").\n    // This implies that the algorithm does not produce more than N decimal\n    // digits.\n    //\n    //      N = 17 for p = 53 (IEEE double precision)\n    //      N = 9  for p = 24 (IEEE single precision)\n}\n\n/*!\nv = buf * 10^decimal_exponent\nlen is the length of the buffer (number of decimal digits)\nThe buffer must be large enough, i.e. >= max_digits10.\n*/\nJSON_HEDLEY_NON_NULL(1)\ninline void grisu2(char* buf, int& len, int& decimal_exponent,\n                   diyfp m_minus, diyfp v, diyfp m_plus)\n{\n    JSON_ASSERT(m_plus.e == m_minus.e);\n    JSON_ASSERT(m_plus.e == v.e);\n\n    //  --------(-----------------------+-----------------------)--------    (A)\n    //          m-                      v                       m+\n    //\n    //  --------------------(-----------+-----------------------)--------    (B)\n    //                      m-          v                       m+\n    //\n    // First scale v (and m- and m+) such that the exponent is in the range\n    // [alpha, gamma].\n\n    const cached_power cached = get_cached_power_for_binary_exponent(m_plus.e);\n\n    const diyfp c_minus_k(cached.f, cached.e); // = c ~= 10^-k\n\n    // The exponent of the products is = v.e + c_minus_k.e + q and is in the range [alpha,gamma]\n    const diyfp w       = diyfp::mul(v,       c_minus_k);\n    const diyfp w_minus = diyfp::mul(m_minus, c_minus_k);\n    const diyfp w_plus  = diyfp::mul(m_plus,  c_minus_k);\n\n    //  ----(---+---)---------------(---+---)---------------(---+---)----\n    //          w-                      w                       w+\n    //          = c*m-                  = c*v                   = c*m+\n    //\n    // diyfp::mul rounds its result and c_minus_k is approximated too. w, w- and\n    // w+ are now off by a small amount.\n    // In fact:\n    //\n    //      w - v * 10^k < 1 ulp\n    //\n    // To account for this inaccuracy, add resp. subtract 1 ulp.\n    //\n    //  --------+---[---------------(---+---)---------------]---+--------\n    //          w-  M-                  w                   M+  w+\n    //\n    // Now any number in [M-, M+] (bounds included) will round to w when input,\n    // regardless of how the input rounding algorithm breaks ties.\n    //\n    // And digit_gen generates the shortest possible such number in [M-, M+].\n    // Note that this does not mean that Grisu2 always generates the shortest\n    // possible number in the interval (m-, m+).\n    const diyfp M_minus(w_minus.f + 1, w_minus.e);\n    const diyfp M_plus (w_plus.f  - 1, w_plus.e );\n\n    decimal_exponent = -cached.k; // = -(-k) = k\n\n    grisu2_digit_gen(buf, len, decimal_exponent, M_minus, w, M_plus);\n}\n\n/*!\nv = buf * 10^decimal_exponent\nlen is the length of the buffer (number of decimal digits)\nThe buffer must be large enough, i.e. >= max_digits10.\n*/\ntemplate<typename FloatType>\nJSON_HEDLEY_NON_NULL(1)\nvoid grisu2(char* buf, int& len, int& decimal_exponent, FloatType value)\n{\n    static_assert(diyfp::kPrecision >= std::numeric_limits<FloatType>::digits + 3,\n                  \"internal error: not enough precision\");\n\n    JSON_ASSERT(std::isfinite(value));\n    JSON_ASSERT(value > 0);\n\n    // If the neighbors (and boundaries) of 'value' are always computed for double-precision\n    // numbers, all float's can be recovered using strtod (and strtof). However, the resulting\n    // decimal representations are not exactly \"short\".\n    //\n    // The documentation for 'std::to_chars' (https://en.cppreference.com/w/cpp/utility/to_chars)\n    // says \"value is converted to a string as if by std::sprintf in the default (\"C\") locale\"\n    // and since sprintf promotes float's to double's, I think this is exactly what 'std::to_chars'\n    // does.\n    // On the other hand, the documentation for 'std::to_chars' requires that \"parsing the\n    // representation using the corresponding std::from_chars function recovers value exactly\". That\n    // indicates that single precision floating-point numbers should be recovered using\n    // 'std::strtof'.\n    //\n    // NB: If the neighbors are computed for single-precision numbers, there is a single float\n    //     (7.0385307e-26f) which can't be recovered using strtod. The resulting double precision\n    //     value is off by 1 ulp.\n#if 0\n    const boundaries w = compute_boundaries(static_cast<double>(value));\n#else\n    const boundaries w = compute_boundaries(value);\n#endif\n\n    grisu2(buf, len, decimal_exponent, w.minus, w.w, w.plus);\n}\n\n/*!\n@brief appends a decimal representation of e to buf\n@return a pointer to the element following the exponent.\n@pre -1000 < e < 1000\n*/\nJSON_HEDLEY_NON_NULL(1)\nJSON_HEDLEY_RETURNS_NON_NULL\ninline char* append_exponent(char* buf, int e)\n{\n    JSON_ASSERT(e > -1000);\n    JSON_ASSERT(e <  1000);\n\n    if (e < 0)\n    {\n        e = -e;\n        *buf++ = '-';\n    }\n    else\n    {\n        *buf++ = '+';\n    }\n\n    auto k = static_cast<std::uint32_t>(e);\n    if (k < 10)\n    {\n        // Always print at least two digits in the exponent.\n        // This is for compatibility with printf(\"%g\").\n        *buf++ = '0';\n        *buf++ = static_cast<char>('0' + k);\n    }\n    else if (k < 100)\n    {\n        *buf++ = static_cast<char>('0' + k / 10);\n        k %= 10;\n        *buf++ = static_cast<char>('0' + k);\n    }\n    else\n    {\n        *buf++ = static_cast<char>('0' + k / 100);\n        k %= 100;\n        *buf++ = static_cast<char>('0' + k / 10);\n        k %= 10;\n        *buf++ = static_cast<char>('0' + k);\n    }\n\n    return buf;\n}\n\n/*!\n@brief prettify v = buf * 10^decimal_exponent\n\nIf v is in the range [10^min_exp, 10^max_exp) it will be printed in fixed-point\nnotation. Otherwise it will be printed in exponential notation.\n\n@pre min_exp < 0\n@pre max_exp > 0\n*/\nJSON_HEDLEY_NON_NULL(1)\nJSON_HEDLEY_RETURNS_NON_NULL\ninline char* format_buffer(char* buf, int len, int decimal_exponent,\n                           int min_exp, int max_exp)\n{\n    JSON_ASSERT(min_exp < 0);\n    JSON_ASSERT(max_exp > 0);\n\n    const int k = len;\n    const int n = len + decimal_exponent;\n\n    // v = buf * 10^(n-k)\n    // k is the length of the buffer (number of decimal digits)\n    // n is the position of the decimal point relative to the start of the buffer.\n\n    if (k <= n && n <= max_exp)\n    {\n        // digits[000]\n        // len <= max_exp + 2\n\n        std::memset(buf + k, '0', static_cast<size_t>(n) - static_cast<size_t>(k));\n        // Make it look like a floating-point number (#362, #378)\n        buf[n + 0] = '.';\n        buf[n + 1] = '0';\n        return buf + (static_cast<size_t>(n) + 2);\n    }\n\n    if (0 < n && n <= max_exp)\n    {\n        // dig.its\n        // len <= max_digits10 + 1\n\n        JSON_ASSERT(k > n);\n\n        std::memmove(buf + (static_cast<size_t>(n) + 1), buf + n, static_cast<size_t>(k) - static_cast<size_t>(n));\n        buf[n] = '.';\n        return buf + (static_cast<size_t>(k) + 1U);\n    }\n\n    if (min_exp < n && n <= 0)\n    {\n        // 0.[000]digits\n        // len <= 2 + (-min_exp - 1) + max_digits10\n\n        std::memmove(buf + (2 + static_cast<size_t>(-n)), buf, static_cast<size_t>(k));\n        buf[0] = '0';\n        buf[1] = '.';\n        std::memset(buf + 2, '0', static_cast<size_t>(-n));\n        return buf + (2U + static_cast<size_t>(-n) + static_cast<size_t>(k));\n    }\n\n    if (k == 1)\n    {\n        // dE+123\n        // len <= 1 + 5\n\n        buf += 1;\n    }\n    else\n    {\n        // d.igitsE+123\n        // len <= max_digits10 + 1 + 5\n\n        std::memmove(buf + 2, buf + 1, static_cast<size_t>(k) - 1);\n        buf[1] = '.';\n        buf += 1 + static_cast<size_t>(k);\n    }\n\n    *buf++ = 'e';\n    return append_exponent(buf, n - 1);\n}\n\n} // namespace dtoa_impl\n\n/*!\n@brief generates a decimal representation of the floating-point number value in [first, last).\n\nThe format of the resulting decimal representation is similar to printf's %g\nformat. Returns an iterator pointing past-the-end of the decimal representation.\n\n@note The input number must be finite, i.e. NaN's and Inf's are not supported.\n@note The buffer must be large enough.\n@note The result is NOT null-terminated.\n*/\ntemplate<typename FloatType>\nJSON_HEDLEY_NON_NULL(1, 2)\nJSON_HEDLEY_RETURNS_NON_NULL\nchar* to_chars(char* first, const char* last, FloatType value)\n{\n    static_cast<void>(last); // maybe unused - fix warning\n    JSON_ASSERT(std::isfinite(value));\n\n    // Use signbit(value) instead of (value < 0) since signbit works for -0.\n    if (std::signbit(value))\n    {\n        value = -value;\n        *first++ = '-';\n    }\n\n    if (value == 0) // +-0\n    {\n        *first++ = '0';\n        // Make it look like a floating-point number (#362, #378)\n        *first++ = '.';\n        *first++ = '0';\n        return first;\n    }\n\n    JSON_ASSERT(last - first >= std::numeric_limits<FloatType>::max_digits10);\n\n    // Compute v = buffer * 10^decimal_exponent.\n    // The decimal digits are stored in the buffer, which needs to be interpreted\n    // as an unsigned decimal integer.\n    // len is the length of the buffer, i.e. the number of decimal digits.\n    int len = 0;\n    int decimal_exponent = 0;\n    dtoa_impl::grisu2(first, len, decimal_exponent, value);\n\n    JSON_ASSERT(len <= std::numeric_limits<FloatType>::max_digits10);\n\n    // Format the buffer like printf(\"%.*g\", prec, value)\n    constexpr int kMinExp = -4;\n    // Use digits10 here to increase compatibility with version 2.\n    constexpr int kMaxExp = std::numeric_limits<FloatType>::digits10;\n\n    JSON_ASSERT(last - first >= kMaxExp + 2);\n    JSON_ASSERT(last - first >= 2 + (-kMinExp - 1) + std::numeric_limits<FloatType>::max_digits10);\n    JSON_ASSERT(last - first >= std::numeric_limits<FloatType>::max_digits10 + 6);\n\n    return dtoa_impl::format_buffer(first, len, decimal_exponent, kMinExp, kMaxExp);\n}\n\n} // namespace detail\n} // namespace nlohmann\n\n// #include <nlohmann/detail/exceptions.hpp>\n\n// #include <nlohmann/detail/macro_scope.hpp>\n\n// #include <nlohmann/detail/meta/cpp_future.hpp>\n\n// #include <nlohmann/detail/output/binary_writer.hpp>\n\n// #include <nlohmann/detail/output/output_adapters.hpp>\n\n// #include <nlohmann/detail/value_t.hpp>\n\n\nnamespace nlohmann\n{\nnamespace detail\n{\n///////////////////\n// serialization //\n///////////////////\n\n/// how to treat decoding errors\nenum class error_handler_t\n{\n    strict,  ///< throw a type_error exception in case of invalid UTF-8\n    replace, ///< replace invalid UTF-8 sequences with U+FFFD\n    ignore   ///< ignore invalid UTF-8 sequences\n};\n\ntemplate<typename BasicJsonType>\nclass serializer\n{\n    using string_t = typename BasicJsonType::string_t;\n    using number_float_t = typename BasicJsonType::number_float_t;\n    using number_integer_t = typename BasicJsonType::number_integer_t;\n    using number_unsigned_t = typename BasicJsonType::number_unsigned_t;\n    using binary_char_t = typename BasicJsonType::binary_t::value_type;\n    static constexpr std::uint8_t UTF8_ACCEPT = 0;\n    static constexpr std::uint8_t UTF8_REJECT = 1;\n\n  public:\n    /*!\n    @param[in] s  output stream to serialize to\n    @param[in] ichar  indentation character to use\n    @param[in] error_handler_  how to react on decoding errors\n    */\n    serializer(output_adapter_t<char> s, const char ichar,\n               error_handler_t error_handler_ = error_handler_t::strict)\n        : o(std::move(s))\n        , loc(std::localeconv())\n        , thousands_sep(loc->thousands_sep == nullptr ? '\\0' : std::char_traits<char>::to_char_type(* (loc->thousands_sep)))\n        , decimal_point(loc->decimal_point == nullptr ? '\\0' : std::char_traits<char>::to_char_type(* (loc->decimal_point)))\n        , indent_char(ichar)\n        , indent_string(512, indent_char)\n        , error_handler(error_handler_)\n    {}\n\n    // delete because of pointer members\n    serializer(const serializer&) = delete;\n    serializer& operator=(const serializer&) = delete;\n    serializer(serializer&&) = delete;\n    serializer& operator=(serializer&&) = delete;\n    ~serializer() = default;\n\n    /*!\n    @brief internal implementation of the serialization function\n\n    This function is called by the public member function dump and organizes\n    the serialization internally. The indentation level is propagated as\n    additional parameter. In case of arrays and objects, the function is\n    called recursively.\n\n    - strings and object keys are escaped using `escape_string()`\n    - integer numbers are converted implicitly via `operator<<`\n    - floating-point numbers are converted to a string using `\"%g\"` format\n    - binary values are serialized as objects containing the subtype and the\n      byte array\n\n    @param[in] val               value to serialize\n    @param[in] pretty_print      whether the output shall be pretty-printed\n    @param[in] ensure_ascii If @a ensure_ascii is true, all non-ASCII characters\n    in the output are escaped with `\\uXXXX` sequences, and the result consists\n    of ASCII characters only.\n    @param[in] indent_step       the indent level\n    @param[in] current_indent    the current indent level (only used internally)\n    */\n    void dump(const BasicJsonType& val,\n              const bool pretty_print,\n              const bool ensure_ascii,\n              const unsigned int indent_step,\n              const unsigned int current_indent = 0)\n    {\n        switch (val.m_type)\n        {\n            case value_t::object:\n            {\n                if (val.m_value.object->empty())\n                {\n                    o->write_characters(\"{}\", 2);\n                    return;\n                }\n\n                if (pretty_print)\n                {\n                    o->write_characters(\"{\\n\", 2);\n\n                    // variable to hold indentation for recursive calls\n                    const auto new_indent = current_indent + indent_step;\n                    if (JSON_HEDLEY_UNLIKELY(indent_string.size() < new_indent))\n                    {\n                        indent_string.resize(indent_string.size() * 2, ' ');\n                    }\n\n                    // first n-1 elements\n                    auto i = val.m_value.object->cbegin();\n                    for (std::size_t cnt = 0; cnt < val.m_value.object->size() - 1; ++cnt, ++i)\n                    {\n                        o->write_characters(indent_string.c_str(), new_indent);\n                        o->write_character('\\\"');\n                        dump_escaped(i->first, ensure_ascii);\n                        o->write_characters(\"\\\": \", 3);\n                        dump(i->second, true, ensure_ascii, indent_step, new_indent);\n                        o->write_characters(\",\\n\", 2);\n                    }\n\n                    // last element\n                    JSON_ASSERT(i != val.m_value.object->cend());\n                    JSON_ASSERT(std::next(i) == val.m_value.object->cend());\n                    o->write_characters(indent_string.c_str(), new_indent);\n                    o->write_character('\\\"');\n                    dump_escaped(i->first, ensure_ascii);\n                    o->write_characters(\"\\\": \", 3);\n                    dump(i->second, true, ensure_ascii, indent_step, new_indent);\n\n                    o->write_character('\\n');\n                    o->write_characters(indent_string.c_str(), current_indent);\n                    o->write_character('}');\n                }\n                else\n                {\n                    o->write_character('{');\n\n                    // first n-1 elements\n                    auto i = val.m_value.object->cbegin();\n                    for (std::size_t cnt = 0; cnt < val.m_value.object->size() - 1; ++cnt, ++i)\n                    {\n                        o->write_character('\\\"');\n                        dump_escaped(i->first, ensure_ascii);\n                        o->write_characters(\"\\\":\", 2);\n                        dump(i->second, false, ensure_ascii, indent_step, current_indent);\n                        o->write_character(',');\n                    }\n\n                    // last element\n                    JSON_ASSERT(i != val.m_value.object->cend());\n                    JSON_ASSERT(std::next(i) == val.m_value.object->cend());\n                    o->write_character('\\\"');\n                    dump_escaped(i->first, ensure_ascii);\n                    o->write_characters(\"\\\":\", 2);\n                    dump(i->second, false, ensure_ascii, indent_step, current_indent);\n\n                    o->write_character('}');\n                }\n\n                return;\n            }\n\n            case value_t::array:\n            {\n                if (val.m_value.array->empty())\n                {\n                    o->write_characters(\"[]\", 2);\n                    return;\n                }\n\n                if (pretty_print)\n                {\n                    o->write_characters(\"[\\n\", 2);\n\n                    // variable to hold indentation for recursive calls\n                    const auto new_indent = current_indent + indent_step;\n                    if (JSON_HEDLEY_UNLIKELY(indent_string.size() < new_indent))\n                    {\n                        indent_string.resize(indent_string.size() * 2, ' ');\n                    }\n\n                    // first n-1 elements\n                    for (auto i = val.m_value.array->cbegin();\n                            i != val.m_value.array->cend() - 1; ++i)\n                    {\n                        o->write_characters(indent_string.c_str(), new_indent);\n                        dump(*i, true, ensure_ascii, indent_step, new_indent);\n                        o->write_characters(\",\\n\", 2);\n                    }\n\n                    // last element\n                    JSON_ASSERT(!val.m_value.array->empty());\n                    o->write_characters(indent_string.c_str(), new_indent);\n                    dump(val.m_value.array->back(), true, ensure_ascii, indent_step, new_indent);\n\n                    o->write_character('\\n');\n                    o->write_characters(indent_string.c_str(), current_indent);\n                    o->write_character(']');\n                }\n                else\n                {\n                    o->write_character('[');\n\n                    // first n-1 elements\n                    for (auto i = val.m_value.array->cbegin();\n                            i != val.m_value.array->cend() - 1; ++i)\n                    {\n                        dump(*i, false, ensure_ascii, indent_step, current_indent);\n                        o->write_character(',');\n                    }\n\n                    // last element\n                    JSON_ASSERT(!val.m_value.array->empty());\n                    dump(val.m_value.array->back(), false, ensure_ascii, indent_step, current_indent);\n\n                    o->write_character(']');\n                }\n\n                return;\n            }\n\n            case value_t::string:\n            {\n                o->write_character('\\\"');\n                dump_escaped(*val.m_value.string, ensure_ascii);\n                o->write_character('\\\"');\n                return;\n            }\n\n            case value_t::binary:\n            {\n                if (pretty_print)\n                {\n                    o->write_characters(\"{\\n\", 2);\n\n                    // variable to hold indentation for recursive calls\n                    const auto new_indent = current_indent + indent_step;\n                    if (JSON_HEDLEY_UNLIKELY(indent_string.size() < new_indent))\n                    {\n                        indent_string.resize(indent_string.size() * 2, ' ');\n                    }\n\n                    o->write_characters(indent_string.c_str(), new_indent);\n\n                    o->write_characters(\"\\\"bytes\\\": [\", 10);\n\n                    if (!val.m_value.binary->empty())\n                    {\n                        for (auto i = val.m_value.binary->cbegin();\n                                i != val.m_value.binary->cend() - 1; ++i)\n                        {\n                            dump_integer(*i);\n                            o->write_characters(\", \", 2);\n                        }\n                        dump_integer(val.m_value.binary->back());\n                    }\n\n                    o->write_characters(\"],\\n\", 3);\n                    o->write_characters(indent_string.c_str(), new_indent);\n\n                    o->write_characters(\"\\\"subtype\\\": \", 11);\n                    if (val.m_value.binary->has_subtype())\n                    {\n                        dump_integer(val.m_value.binary->subtype());\n                    }\n                    else\n                    {\n                        o->write_characters(\"null\", 4);\n                    }\n                    o->write_character('\\n');\n                    o->write_characters(indent_string.c_str(), current_indent);\n                    o->write_character('}');\n                }\n                else\n                {\n                    o->write_characters(\"{\\\"bytes\\\":[\", 10);\n\n                    if (!val.m_value.binary->empty())\n                    {\n                        for (auto i = val.m_value.binary->cbegin();\n                                i != val.m_value.binary->cend() - 1; ++i)\n                        {\n                            dump_integer(*i);\n                            o->write_character(',');\n                        }\n                        dump_integer(val.m_value.binary->back());\n                    }\n\n                    o->write_characters(\"],\\\"subtype\\\":\", 12);\n                    if (val.m_value.binary->has_subtype())\n                    {\n                        dump_integer(val.m_value.binary->subtype());\n                        o->write_character('}');\n                    }\n                    else\n                    {\n                        o->write_characters(\"null}\", 5);\n                    }\n                }\n                return;\n            }\n\n            case value_t::boolean:\n            {\n                if (val.m_value.boolean)\n                {\n                    o->write_characters(\"true\", 4);\n                }\n                else\n                {\n                    o->write_characters(\"false\", 5);\n                }\n                return;\n            }\n\n            case value_t::number_integer:\n            {\n                dump_integer(val.m_value.number_integer);\n                return;\n            }\n\n            case value_t::number_unsigned:\n            {\n                dump_integer(val.m_value.number_unsigned);\n                return;\n            }\n\n            case value_t::number_float:\n            {\n                dump_float(val.m_value.number_float);\n                return;\n            }\n\n            case value_t::discarded:\n            {\n                o->write_characters(\"<discarded>\", 11);\n                return;\n            }\n\n            case value_t::null:\n            {\n                o->write_characters(\"null\", 4);\n                return;\n            }\n\n            default:            // LCOV_EXCL_LINE\n                JSON_ASSERT(false);  // LCOV_EXCL_LINE\n        }\n    }\n\n  JSON_PRIVATE_UNLESS_TESTED:\n    /*!\n    @brief dump escaped string\n\n    Escape a string by replacing certain special characters by a sequence of an\n    escape character (backslash) and another character and other control\n    characters by a sequence of \"\\u\" followed by a four-digit hex\n    representation. The escaped string is written to output stream @a o.\n\n    @param[in] s  the string to escape\n    @param[in] ensure_ascii  whether to escape non-ASCII characters with\n                             \\uXXXX sequences\n\n    @complexity Linear in the length of string @a s.\n    */\n    void dump_escaped(const string_t& s, const bool ensure_ascii)\n    {\n        std::uint32_t codepoint;\n        std::uint8_t state = UTF8_ACCEPT;\n        std::size_t bytes = 0;  // number of bytes written to string_buffer\n\n        // number of bytes written at the point of the last valid byte\n        std::size_t bytes_after_last_accept = 0;\n        std::size_t undumped_chars = 0;\n\n        for (std::size_t i = 0; i < s.size(); ++i)\n        {\n            const auto byte = static_cast<uint8_t>(s[i]);\n\n            switch (decode(state, codepoint, byte))\n            {\n                case UTF8_ACCEPT:  // decode found a new code point\n                {\n                    switch (codepoint)\n                    {\n                        case 0x08: // backspace\n                        {\n                            string_buffer[bytes++] = '\\\\';\n                            string_buffer[bytes++] = 'b';\n                            break;\n                        }\n\n                        case 0x09: // horizontal tab\n                        {\n                            string_buffer[bytes++] = '\\\\';\n                            string_buffer[bytes++] = 't';\n                            break;\n                        }\n\n                        case 0x0A: // newline\n                        {\n                            string_buffer[bytes++] = '\\\\';\n                            string_buffer[bytes++] = 'n';\n                            break;\n                        }\n\n                        case 0x0C: // formfeed\n                        {\n                            string_buffer[bytes++] = '\\\\';\n                            string_buffer[bytes++] = 'f';\n                            break;\n                        }\n\n                        case 0x0D: // carriage return\n                        {\n                            string_buffer[bytes++] = '\\\\';\n                            string_buffer[bytes++] = 'r';\n                            break;\n                        }\n\n                        case 0x22: // quotation mark\n                        {\n                            string_buffer[bytes++] = '\\\\';\n                            string_buffer[bytes++] = '\\\"';\n                            break;\n                        }\n\n                        case 0x5C: // reverse solidus\n                        {\n                            string_buffer[bytes++] = '\\\\';\n                            string_buffer[bytes++] = '\\\\';\n                            break;\n                        }\n\n                        default:\n                        {\n                            // escape control characters (0x00..0x1F) or, if\n                            // ensure_ascii parameter is used, non-ASCII characters\n                            if ((codepoint <= 0x1F) || (ensure_ascii && (codepoint >= 0x7F)))\n                            {\n                                if (codepoint <= 0xFFFF)\n                                {\n                                    (std::snprintf)(string_buffer.data() + bytes, 7, \"\\\\u%04x\",\n                                                    static_cast<std::uint16_t>(codepoint));\n                                    bytes += 6;\n                                }\n                                else\n                                {\n                                    (std::snprintf)(string_buffer.data() + bytes, 13, \"\\\\u%04x\\\\u%04x\",\n                                                    static_cast<std::uint16_t>(0xD7C0u + (codepoint >> 10u)),\n                                                    static_cast<std::uint16_t>(0xDC00u + (codepoint & 0x3FFu)));\n                                    bytes += 12;\n                                }\n                            }\n                            else\n                            {\n                                // copy byte to buffer (all previous bytes\n                                // been copied have in default case above)\n                                string_buffer[bytes++] = s[i];\n                            }\n                            break;\n                        }\n                    }\n\n                    // write buffer and reset index; there must be 13 bytes\n                    // left, as this is the maximal number of bytes to be\n                    // written (\"\\uxxxx\\uxxxx\\0\") for one code point\n                    if (string_buffer.size() - bytes < 13)\n                    {\n                        o->write_characters(string_buffer.data(), bytes);\n                        bytes = 0;\n                    }\n\n                    // remember the byte position of this accept\n                    bytes_after_last_accept = bytes;\n                    undumped_chars = 0;\n                    break;\n                }\n\n                case UTF8_REJECT:  // decode found invalid UTF-8 byte\n                {\n                    switch (error_handler)\n                    {\n                        case error_handler_t::strict:\n                        {\n                            std::string sn(3, '\\0');\n                            (std::snprintf)(&sn[0], sn.size(), \"%.2X\", byte);\n                            JSON_THROW(type_error::create(316, \"invalid UTF-8 byte at index \" + std::to_string(i) + \": 0x\" + sn));\n                        }\n\n                        case error_handler_t::ignore:\n                        case error_handler_t::replace:\n                        {\n                            // in case we saw this character the first time, we\n                            // would like to read it again, because the byte\n                            // may be OK for itself, but just not OK for the\n                            // previous sequence\n                            if (undumped_chars > 0)\n                            {\n                                --i;\n                            }\n\n                            // reset length buffer to the last accepted index;\n                            // thus removing/ignoring the invalid characters\n                            bytes = bytes_after_last_accept;\n\n                            if (error_handler == error_handler_t::replace)\n                            {\n                                // add a replacement character\n                                if (ensure_ascii)\n                                {\n                                    string_buffer[bytes++] = '\\\\';\n                                    string_buffer[bytes++] = 'u';\n                                    string_buffer[bytes++] = 'f';\n                                    string_buffer[bytes++] = 'f';\n                                    string_buffer[bytes++] = 'f';\n                                    string_buffer[bytes++] = 'd';\n                                }\n                                else\n                                {\n                                    string_buffer[bytes++] = detail::binary_writer<BasicJsonType, char>::to_char_type('\\xEF');\n                                    string_buffer[bytes++] = detail::binary_writer<BasicJsonType, char>::to_char_type('\\xBF');\n                                    string_buffer[bytes++] = detail::binary_writer<BasicJsonType, char>::to_char_type('\\xBD');\n                                }\n\n                                // write buffer and reset index; there must be 13 bytes\n                                // left, as this is the maximal number of bytes to be\n                                // written (\"\\uxxxx\\uxxxx\\0\") for one code point\n                                if (string_buffer.size() - bytes < 13)\n                                {\n                                    o->write_characters(string_buffer.data(), bytes);\n                                    bytes = 0;\n                                }\n\n                                bytes_after_last_accept = bytes;\n                            }\n\n                            undumped_chars = 0;\n\n                            // continue processing the string\n                            state = UTF8_ACCEPT;\n                            break;\n                        }\n\n                        default:            // LCOV_EXCL_LINE\n                            JSON_ASSERT(false);  // LCOV_EXCL_LINE\n                    }\n                    break;\n                }\n\n                default:  // decode found yet incomplete multi-byte code point\n                {\n                    if (!ensure_ascii)\n                    {\n                        // code point will not be escaped - copy byte to buffer\n                        string_buffer[bytes++] = s[i];\n                    }\n                    ++undumped_chars;\n                    break;\n                }\n            }\n        }\n\n        // we finished processing the string\n        if (JSON_HEDLEY_LIKELY(state == UTF8_ACCEPT))\n        {\n            // write buffer\n            if (bytes > 0)\n            {\n                o->write_characters(string_buffer.data(), bytes);\n            }\n        }\n        else\n        {\n            // we finish reading, but do not accept: string was incomplete\n            switch (error_handler)\n            {\n                case error_handler_t::strict:\n                {\n                    std::string sn(3, '\\0');\n                    (std::snprintf)(&sn[0], sn.size(), \"%.2X\", static_cast<std::uint8_t>(s.back()));\n                    JSON_THROW(type_error::create(316, \"incomplete UTF-8 string; last byte: 0x\" + sn));\n                }\n\n                case error_handler_t::ignore:\n                {\n                    // write all accepted bytes\n                    o->write_characters(string_buffer.data(), bytes_after_last_accept);\n                    break;\n                }\n\n                case error_handler_t::replace:\n                {\n                    // write all accepted bytes\n                    o->write_characters(string_buffer.data(), bytes_after_last_accept);\n                    // add a replacement character\n                    if (ensure_ascii)\n                    {\n                        o->write_characters(\"\\\\ufffd\", 6);\n                    }\n                    else\n                    {\n                        o->write_characters(\"\\xEF\\xBF\\xBD\", 3);\n                    }\n                    break;\n                }\n\n                default:            // LCOV_EXCL_LINE\n                    JSON_ASSERT(false);  // LCOV_EXCL_LINE\n            }\n        }\n    }\n\n  private:\n    /*!\n    @brief count digits\n\n    Count the number of decimal (base 10) digits for an input unsigned integer.\n\n    @param[in] x  unsigned integer number to count its digits\n    @return    number of decimal digits\n    */\n    inline unsigned int count_digits(number_unsigned_t x) noexcept\n    {\n        unsigned int n_digits = 1;\n        for (;;)\n        {\n            if (x < 10)\n            {\n                return n_digits;\n            }\n            if (x < 100)\n            {\n                return n_digits + 1;\n            }\n            if (x < 1000)\n            {\n                return n_digits + 2;\n            }\n            if (x < 10000)\n            {\n                return n_digits + 3;\n            }\n            x = x / 10000u;\n            n_digits += 4;\n        }\n    }\n\n    /*!\n    @brief dump an integer\n\n    Dump a given integer to output stream @a o. Works internally with\n    @a number_buffer.\n\n    @param[in] x  integer number (signed or unsigned) to dump\n    @tparam NumberType either @a number_integer_t or @a number_unsigned_t\n    */\n    template < typename NumberType, detail::enable_if_t <\n                   std::is_same<NumberType, number_unsigned_t>::value ||\n                   std::is_same<NumberType, number_integer_t>::value ||\n                   std::is_same<NumberType, binary_char_t>::value,\n                   int > = 0 >\n    void dump_integer(NumberType x)\n    {\n        static constexpr std::array<std::array<char, 2>, 100> digits_to_99\n        {\n            {\n                {{'0', '0'}}, {{'0', '1'}}, {{'0', '2'}}, {{'0', '3'}}, {{'0', '4'}}, {{'0', '5'}}, {{'0', '6'}}, {{'0', '7'}}, {{'0', '8'}}, {{'0', '9'}},\n                {{'1', '0'}}, {{'1', '1'}}, {{'1', '2'}}, {{'1', '3'}}, {{'1', '4'}}, {{'1', '5'}}, {{'1', '6'}}, {{'1', '7'}}, {{'1', '8'}}, {{'1', '9'}},\n                {{'2', '0'}}, {{'2', '1'}}, {{'2', '2'}}, {{'2', '3'}}, {{'2', '4'}}, {{'2', '5'}}, {{'2', '6'}}, {{'2', '7'}}, {{'2', '8'}}, {{'2', '9'}},\n                {{'3', '0'}}, {{'3', '1'}}, {{'3', '2'}}, {{'3', '3'}}, {{'3', '4'}}, {{'3', '5'}}, {{'3', '6'}}, {{'3', '7'}}, {{'3', '8'}}, {{'3', '9'}},\n                {{'4', '0'}}, {{'4', '1'}}, {{'4', '2'}}, {{'4', '3'}}, {{'4', '4'}}, {{'4', '5'}}, {{'4', '6'}}, {{'4', '7'}}, {{'4', '8'}}, {{'4', '9'}},\n                {{'5', '0'}}, {{'5', '1'}}, {{'5', '2'}}, {{'5', '3'}}, {{'5', '4'}}, {{'5', '5'}}, {{'5', '6'}}, {{'5', '7'}}, {{'5', '8'}}, {{'5', '9'}},\n                {{'6', '0'}}, {{'6', '1'}}, {{'6', '2'}}, {{'6', '3'}}, {{'6', '4'}}, {{'6', '5'}}, {{'6', '6'}}, {{'6', '7'}}, {{'6', '8'}}, {{'6', '9'}},\n                {{'7', '0'}}, {{'7', '1'}}, {{'7', '2'}}, {{'7', '3'}}, {{'7', '4'}}, {{'7', '5'}}, {{'7', '6'}}, {{'7', '7'}}, {{'7', '8'}}, {{'7', '9'}},\n                {{'8', '0'}}, {{'8', '1'}}, {{'8', '2'}}, {{'8', '3'}}, {{'8', '4'}}, {{'8', '5'}}, {{'8', '6'}}, {{'8', '7'}}, {{'8', '8'}}, {{'8', '9'}},\n                {{'9', '0'}}, {{'9', '1'}}, {{'9', '2'}}, {{'9', '3'}}, {{'9', '4'}}, {{'9', '5'}}, {{'9', '6'}}, {{'9', '7'}}, {{'9', '8'}}, {{'9', '9'}},\n            }\n        };\n\n        // special case for \"0\"\n        if (x == 0)\n        {\n            o->write_character('0');\n            return;\n        }\n\n        // use a pointer to fill the buffer\n        auto buffer_ptr = number_buffer.begin();\n\n        const bool is_negative = std::is_same<NumberType, number_integer_t>::value && !(x >= 0); // see issue #755\n        number_unsigned_t abs_value;\n\n        unsigned int n_chars;\n\n        if (is_negative)\n        {\n            *buffer_ptr = '-';\n            abs_value = remove_sign(static_cast<number_integer_t>(x));\n\n            // account one more byte for the minus sign\n            n_chars = 1 + count_digits(abs_value);\n        }\n        else\n        {\n            abs_value = static_cast<number_unsigned_t>(x);\n            n_chars = count_digits(abs_value);\n        }\n\n        // spare 1 byte for '\\0'\n        JSON_ASSERT(n_chars < number_buffer.size() - 1);\n\n        // jump to the end to generate the string from backward\n        // so we later avoid reversing the result\n        buffer_ptr += n_chars;\n\n        // Fast int2ascii implementation inspired by \"Fastware\" talk by Andrei Alexandrescu\n        // See: https://www.youtube.com/watch?v=o4-CwDo2zpg\n        while (abs_value >= 100)\n        {\n            const auto digits_index = static_cast<unsigned>((abs_value % 100));\n            abs_value /= 100;\n            *(--buffer_ptr) = digits_to_99[digits_index][1];\n            *(--buffer_ptr) = digits_to_99[digits_index][0];\n        }\n\n        if (abs_value >= 10)\n        {\n            const auto digits_index = static_cast<unsigned>(abs_value);\n            *(--buffer_ptr) = digits_to_99[digits_index][1];\n            *(--buffer_ptr) = digits_to_99[digits_index][0];\n        }\n        else\n        {\n            *(--buffer_ptr) = static_cast<char>('0' + abs_value);\n        }\n\n        o->write_characters(number_buffer.data(), n_chars);\n    }\n\n    /*!\n    @brief dump a floating-point number\n\n    Dump a given floating-point number to output stream @a o. Works internally\n    with @a number_buffer.\n\n    @param[in] x  floating-point number to dump\n    */\n    void dump_float(number_float_t x)\n    {\n        // NaN / inf\n        if (!std::isfinite(x))\n        {\n            o->write_characters(\"null\", 4);\n            return;\n        }\n\n        // If number_float_t is an IEEE-754 single or double precision number,\n        // use the Grisu2 algorithm to produce short numbers which are\n        // guaranteed to round-trip, using strtof and strtod, resp.\n        //\n        // NB: The test below works if <long double> == <double>.\n        static constexpr bool is_ieee_single_or_double\n            = (std::numeric_limits<number_float_t>::is_iec559 && std::numeric_limits<number_float_t>::digits == 24 && std::numeric_limits<number_float_t>::max_exponent == 128) ||\n              (std::numeric_limits<number_float_t>::is_iec559 && std::numeric_limits<number_float_t>::digits == 53 && std::numeric_limits<number_float_t>::max_exponent == 1024);\n\n        dump_float(x, std::integral_constant<bool, is_ieee_single_or_double>());\n    }\n\n    void dump_float(number_float_t x, std::true_type /*is_ieee_single_or_double*/)\n    {\n        char* begin = number_buffer.data();\n        char* end = ::nlohmann::detail::to_chars(begin, begin + number_buffer.size(), x);\n\n        o->write_characters(begin, static_cast<size_t>(end - begin));\n    }\n\n    void dump_float(number_float_t x, std::false_type /*is_ieee_single_or_double*/)\n    {\n        // get number of digits for a float -> text -> float round-trip\n        static constexpr auto d = std::numeric_limits<number_float_t>::max_digits10;\n\n        // the actual conversion\n        std::ptrdiff_t len = (std::snprintf)(number_buffer.data(), number_buffer.size(), \"%.*g\", d, x);\n\n        // negative value indicates an error\n        JSON_ASSERT(len > 0);\n        // check if buffer was large enough\n        JSON_ASSERT(static_cast<std::size_t>(len) < number_buffer.size());\n\n        // erase thousands separator\n        if (thousands_sep != '\\0')\n        {\n            const auto end = std::remove(number_buffer.begin(),\n                                         number_buffer.begin() + len, thousands_sep);\n            std::fill(end, number_buffer.end(), '\\0');\n            JSON_ASSERT((end - number_buffer.begin()) <= len);\n            len = (end - number_buffer.begin());\n        }\n\n        // convert decimal point to '.'\n        if (decimal_point != '\\0' && decimal_point != '.')\n        {\n            const auto dec_pos = std::find(number_buffer.begin(), number_buffer.end(), decimal_point);\n            if (dec_pos != number_buffer.end())\n            {\n                *dec_pos = '.';\n            }\n        }\n\n        o->write_characters(number_buffer.data(), static_cast<std::size_t>(len));\n\n        // determine if need to append \".0\"\n        const bool value_is_int_like =\n            std::none_of(number_buffer.begin(), number_buffer.begin() + len + 1,\n                         [](char c)\n        {\n            return c == '.' || c == 'e';\n        });\n\n        if (value_is_int_like)\n        {\n            o->write_characters(\".0\", 2);\n        }\n    }\n\n    /*!\n    @brief check whether a string is UTF-8 encoded\n\n    The function checks each byte of a string whether it is UTF-8 encoded. The\n    result of the check is stored in the @a state parameter. The function must\n    be called initially with state 0 (accept). State 1 means the string must\n    be rejected, because the current byte is not allowed. If the string is\n    completely processed, but the state is non-zero, the string ended\n    prematurely; that is, the last byte indicated more bytes should have\n    followed.\n\n    @param[in,out] state  the state of the decoding\n    @param[in,out] codep  codepoint (valid only if resulting state is UTF8_ACCEPT)\n    @param[in] byte       next byte to decode\n    @return               new state\n\n    @note The function has been edited: a std::array is used.\n\n    @copyright Copyright (c) 2008-2009 Bjoern Hoehrmann <bjoern@hoehrmann.de>\n    @sa http://bjoern.hoehrmann.de/utf-8/decoder/dfa/\n    */\n    static std::uint8_t decode(std::uint8_t& state, std::uint32_t& codep, const std::uint8_t byte) noexcept\n    {\n        static const std::array<std::uint8_t, 400> utf8d =\n        {\n            {\n                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 00..1F\n                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 20..3F\n                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 40..5F\n                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 60..7F\n                1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, // 80..9F\n                7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // A0..BF\n                8, 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // C0..DF\n                0xA, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x4, 0x3, 0x3, // E0..EF\n                0xB, 0x6, 0x6, 0x6, 0x5, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, // F0..FF\n                0x0, 0x1, 0x2, 0x3, 0x5, 0x8, 0x7, 0x1, 0x1, 0x1, 0x4, 0x6, 0x1, 0x1, 0x1, 0x1, // s0..s0\n                1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, // s1..s2\n                1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, // s3..s4\n                1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, // s5..s6\n                1, 3, 1, 1, 1, 1, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // s7..s8\n            }\n        };\n\n        const std::uint8_t type = utf8d[byte];\n\n        codep = (state != UTF8_ACCEPT)\n                ? (byte & 0x3fu) | (codep << 6u)\n                : (0xFFu >> type) & (byte);\n\n        std::size_t index = 256u + static_cast<size_t>(state) * 16u + static_cast<size_t>(type);\n        JSON_ASSERT(index < 400);\n        state = utf8d[index];\n        return state;\n    }\n\n    /*\n     * Overload to make the compiler happy while it is instantiating\n     * dump_integer for number_unsigned_t.\n     * Must never be called.\n     */\n    number_unsigned_t remove_sign(number_unsigned_t x)\n    {\n        JSON_ASSERT(false); // LCOV_EXCL_LINE\n        return x; // LCOV_EXCL_LINE\n    }\n\n    /*\n     * Helper function for dump_integer\n     *\n     * This function takes a negative signed integer and returns its absolute\n     * value as unsigned integer. The plus/minus shuffling is necessary as we can\n     * not directly remove the sign of an arbitrary signed integer as the\n     * absolute values of INT_MIN and INT_MAX are usually not the same. See\n     * #1708 for details.\n     */\n    inline number_unsigned_t remove_sign(number_integer_t x) noexcept\n    {\n        JSON_ASSERT(x < 0 && x < (std::numeric_limits<number_integer_t>::max)());\n        return static_cast<number_unsigned_t>(-(x + 1)) + 1;\n    }\n\n  private:\n    /// the output of the serializer\n    output_adapter_t<char> o = nullptr;\n\n    /// a (hopefully) large enough character buffer\n    std::array<char, 64> number_buffer{{}};\n\n    /// the locale\n    const std::lconv* loc = nullptr;\n    /// the locale's thousand separator character\n    const char thousands_sep = '\\0';\n    /// the locale's decimal point character\n    const char decimal_point = '\\0';\n\n    /// string buffer\n    std::array<char, 512> string_buffer{{}};\n\n    /// the indentation character\n    const char indent_char;\n    /// the indentation string\n    string_t indent_string;\n\n    /// error_handler how to react on decoding errors\n    const error_handler_t error_handler;\n};\n}  // namespace detail\n}  // namespace nlohmann\n\n// #include <nlohmann/detail/value_t.hpp>\n\n// #include <nlohmann/json_fwd.hpp>\n\n// #include <nlohmann/ordered_map.hpp>\n\n\n#include <functional> // less\n#include <memory> // allocator\n#include <utility> // pair\n#include <vector> // vector\n\n// #include <nlohmann/detail/macro_scope.hpp>\n\n\nnamespace nlohmann\n{\n\n/// ordered_map: a minimal map-like container that preserves insertion order\n/// for use within nlohmann::basic_json<ordered_map>\ntemplate <class Key, class T, class IgnoredLess = std::less<Key>,\n          class Allocator = std::allocator<std::pair<const Key, T>>>\n                  struct ordered_map : std::vector<std::pair<const Key, T>, Allocator>\n{\n    using key_type = Key;\n    using mapped_type = T;\n    using Container = std::vector<std::pair<const Key, T>, Allocator>;\n    using typename Container::iterator;\n    using typename Container::const_iterator;\n    using typename Container::size_type;\n    using typename Container::value_type;\n\n    // Explicit constructors instead of `using Container::Container`\n    // otherwise older compilers choke on it (GCC <= 5.5, xcode <= 9.4)\n    ordered_map(const Allocator& alloc = Allocator()) : Container{alloc} {}\n    template <class It>\n    ordered_map(It first, It last, const Allocator& alloc = Allocator())\n        : Container{first, last, alloc} {}\n    ordered_map(std::initializer_list<T> init, const Allocator& alloc = Allocator() )\n        : Container{init, alloc} {}\n\n    std::pair<iterator, bool> emplace(const key_type& key, T&& t)\n    {\n        for (auto it = this->begin(); it != this->end(); ++it)\n        {\n            if (it->first == key)\n            {\n                return {it, false};\n            }\n        }\n        Container::emplace_back(key, t);\n        return {--this->end(), true};\n    }\n\n    T& operator[](const Key& key)\n    {\n        return emplace(key, T{}).first->second;\n    }\n\n    const T& operator[](const Key& key) const\n    {\n        return at(key);\n    }\n\n    T& at(const Key& key)\n    {\n        for (auto it = this->begin(); it != this->end(); ++it)\n        {\n            if (it->first == key)\n            {\n                return it->second;\n            }\n        }\n\n        JSON_THROW(std::out_of_range(\"key not found\"));\n    }\n\n    const T& at(const Key& key) const\n    {\n        for (auto it = this->begin(); it != this->end(); ++it)\n        {\n            if (it->first == key)\n            {\n                return it->second;\n            }\n        }\n\n        JSON_THROW(std::out_of_range(\"key not found\"));\n    }\n\n    size_type erase(const Key& key)\n    {\n        for (auto it = this->begin(); it != this->end(); ++it)\n        {\n            if (it->first == key)\n            {\n                // Since we cannot move const Keys, re-construct them in place\n                for (auto next = it; ++next != this->end(); ++it)\n                {\n                    it->~value_type(); // Destroy but keep allocation\n                    new (&*it) value_type{std::move(*next)};\n                }\n                Container::pop_back();\n                return 1;\n            }\n        }\n        return 0;\n    }\n\n    iterator erase(iterator pos)\n    {\n        auto it = pos;\n\n        // Since we cannot move const Keys, re-construct them in place\n        for (auto next = it; ++next != this->end(); ++it)\n        {\n            it->~value_type(); // Destroy but keep allocation\n            new (&*it) value_type{std::move(*next)};\n        }\n        Container::pop_back();\n        return pos;\n    }\n\n    size_type count(const Key& key) const\n    {\n        for (auto it = this->begin(); it != this->end(); ++it)\n        {\n            if (it->first == key)\n            {\n                return 1;\n            }\n        }\n        return 0;\n    }\n\n    iterator find(const Key& key)\n    {\n        for (auto it = this->begin(); it != this->end(); ++it)\n        {\n            if (it->first == key)\n            {\n                return it;\n            }\n        }\n        return Container::end();\n    }\n\n    const_iterator find(const Key& key) const\n    {\n        for (auto it = this->begin(); it != this->end(); ++it)\n        {\n            if (it->first == key)\n            {\n                return it;\n            }\n        }\n        return Container::end();\n    }\n\n    std::pair<iterator, bool> insert( value_type&& value )\n    {\n        return emplace(value.first, std::move(value.second));\n    }\n\n    std::pair<iterator, bool> insert( const value_type& value )\n    {\n        for (auto it = this->begin(); it != this->end(); ++it)\n        {\n            if (it->first == value.first)\n            {\n                return {it, false};\n            }\n        }\n        Container::push_back(value);\n        return {--this->end(), true};\n    }\n};\n\n}  // namespace nlohmann\n\n\n/*!\n@brief namespace for Niels Lohmann\n@see https://github.com/nlohmann\n@since version 1.0.0\n*/\nnamespace nlohmann\n{\n\n/*!\n@brief a class to store JSON values\n\n@tparam ObjectType type for JSON objects (`std::map` by default; will be used\nin @ref object_t)\n@tparam ArrayType type for JSON arrays (`std::vector` by default; will be used\nin @ref array_t)\n@tparam StringType type for JSON strings and object keys (`std::string` by\ndefault; will be used in @ref string_t)\n@tparam BooleanType type for JSON booleans (`bool` by default; will be used\nin @ref boolean_t)\n@tparam NumberIntegerType type for JSON integer numbers (`int64_t` by\ndefault; will be used in @ref number_integer_t)\n@tparam NumberUnsignedType type for JSON unsigned integer numbers (@c\n`uint64_t` by default; will be used in @ref number_unsigned_t)\n@tparam NumberFloatType type for JSON floating-point numbers (`double` by\ndefault; will be used in @ref number_float_t)\n@tparam BinaryType type for packed binary data for compatibility with binary\nserialization formats (`std::vector<std::uint8_t>` by default; will be used in\n@ref binary_t)\n@tparam AllocatorType type of the allocator to use (`std::allocator` by\ndefault)\n@tparam JSONSerializer the serializer to resolve internal calls to `to_json()`\nand `from_json()` (@ref adl_serializer by default)\n\n@requirement The class satisfies the following concept requirements:\n- Basic\n - [DefaultConstructible](https://en.cppreference.com/w/cpp/named_req/DefaultConstructible):\n   JSON values can be default constructed. The result will be a JSON null\n   value.\n - [MoveConstructible](https://en.cppreference.com/w/cpp/named_req/MoveConstructible):\n   A JSON value can be constructed from an rvalue argument.\n - [CopyConstructible](https://en.cppreference.com/w/cpp/named_req/CopyConstructible):\n   A JSON value can be copy-constructed from an lvalue expression.\n - [MoveAssignable](https://en.cppreference.com/w/cpp/named_req/MoveAssignable):\n   A JSON value van be assigned from an rvalue argument.\n - [CopyAssignable](https://en.cppreference.com/w/cpp/named_req/CopyAssignable):\n   A JSON value can be copy-assigned from an lvalue expression.\n - [Destructible](https://en.cppreference.com/w/cpp/named_req/Destructible):\n   JSON values can be destructed.\n- Layout\n - [StandardLayoutType](https://en.cppreference.com/w/cpp/named_req/StandardLayoutType):\n   JSON values have\n   [standard layout](https://en.cppreference.com/w/cpp/language/data_members#Standard_layout):\n   All non-static data members are private and standard layout types, the\n   class has no virtual functions or (virtual) base classes.\n- Library-wide\n - [EqualityComparable](https://en.cppreference.com/w/cpp/named_req/EqualityComparable):\n   JSON values can be compared with `==`, see @ref\n   operator==(const_reference,const_reference).\n - [LessThanComparable](https://en.cppreference.com/w/cpp/named_req/LessThanComparable):\n   JSON values can be compared with `<`, see @ref\n   operator<(const_reference,const_reference).\n - [Swappable](https://en.cppreference.com/w/cpp/named_req/Swappable):\n   Any JSON lvalue or rvalue of can be swapped with any lvalue or rvalue of\n   other compatible types, using unqualified function call @ref swap().\n - [NullablePointer](https://en.cppreference.com/w/cpp/named_req/NullablePointer):\n   JSON values can be compared against `std::nullptr_t` objects which are used\n   to model the `null` value.\n- Container\n - [Container](https://en.cppreference.com/w/cpp/named_req/Container):\n   JSON values can be used like STL containers and provide iterator access.\n - [ReversibleContainer](https://en.cppreference.com/w/cpp/named_req/ReversibleContainer);\n   JSON values can be used like STL containers and provide reverse iterator\n   access.\n\n@invariant The member variables @a m_value and @a m_type have the following\nrelationship:\n- If `m_type == value_t::object`, then `m_value.object != nullptr`.\n- If `m_type == value_t::array`, then `m_value.array != nullptr`.\n- If `m_type == value_t::string`, then `m_value.string != nullptr`.\nThe invariants are checked by member function assert_invariant().\n\n@internal\n@note ObjectType trick from https://stackoverflow.com/a/9860911\n@endinternal\n\n@see [RFC 7159: The JavaScript Object Notation (JSON) Data Interchange\nFormat](http://rfc7159.net/rfc7159)\n\n@since version 1.0.0\n\n@nosubgrouping\n*/\nNLOHMANN_BASIC_JSON_TPL_DECLARATION\nclass basic_json\n{\n  private:\n    template<detail::value_t> friend struct detail::external_constructor;\n    friend ::nlohmann::json_pointer<basic_json>;\n\n    template<typename BasicJsonType, typename InputType>\n    friend class ::nlohmann::detail::parser;\n    friend ::nlohmann::detail::serializer<basic_json>;\n    template<typename BasicJsonType>\n    friend class ::nlohmann::detail::iter_impl;\n    template<typename BasicJsonType, typename CharType>\n    friend class ::nlohmann::detail::binary_writer;\n    template<typename BasicJsonType, typename InputType, typename SAX>\n    friend class ::nlohmann::detail::binary_reader;\n    template<typename BasicJsonType>\n    friend class ::nlohmann::detail::json_sax_dom_parser;\n    template<typename BasicJsonType>\n    friend class ::nlohmann::detail::json_sax_dom_callback_parser;\n\n    /// workaround type for MSVC\n    using basic_json_t = NLOHMANN_BASIC_JSON_TPL;\n\n  JSON_PRIVATE_UNLESS_TESTED:\n    // convenience aliases for types residing in namespace detail;\n    using lexer = ::nlohmann::detail::lexer_base<basic_json>;\n\n    template<typename InputAdapterType>\n    static ::nlohmann::detail::parser<basic_json, InputAdapterType> parser(\n        InputAdapterType adapter,\n        detail::parser_callback_t<basic_json>cb = nullptr,\n        const bool allow_exceptions = true,\n        const bool ignore_comments = false\n                                 )\n    {\n        return ::nlohmann::detail::parser<basic_json, InputAdapterType>(std::move(adapter),\n                std::move(cb), allow_exceptions, ignore_comments);\n    }\n\n  private:\n    using primitive_iterator_t = ::nlohmann::detail::primitive_iterator_t;\n    template<typename BasicJsonType>\n    using internal_iterator = ::nlohmann::detail::internal_iterator<BasicJsonType>;\n    template<typename BasicJsonType>\n    using iter_impl = ::nlohmann::detail::iter_impl<BasicJsonType>;\n    template<typename Iterator>\n    using iteration_proxy = ::nlohmann::detail::iteration_proxy<Iterator>;\n    template<typename Base> using json_reverse_iterator = ::nlohmann::detail::json_reverse_iterator<Base>;\n\n    template<typename CharType>\n    using output_adapter_t = ::nlohmann::detail::output_adapter_t<CharType>;\n\n    template<typename InputType>\n    using binary_reader = ::nlohmann::detail::binary_reader<basic_json, InputType>;\n    template<typename CharType> using binary_writer = ::nlohmann::detail::binary_writer<basic_json, CharType>;\n\n  JSON_PRIVATE_UNLESS_TESTED:\n    using serializer = ::nlohmann::detail::serializer<basic_json>;\n\n  public:\n    using value_t = detail::value_t;\n    /// JSON Pointer, see @ref nlohmann::json_pointer\n    using json_pointer = ::nlohmann::json_pointer<basic_json>;\n    template<typename T, typename SFINAE>\n    using json_serializer = JSONSerializer<T, SFINAE>;\n    /// how to treat decoding errors\n    using error_handler_t = detail::error_handler_t;\n    /// how to treat CBOR tags\n    using cbor_tag_handler_t = detail::cbor_tag_handler_t;\n    /// helper type for initializer lists of basic_json values\n    using initializer_list_t = std::initializer_list<detail::json_ref<basic_json>>;\n\n    using input_format_t = detail::input_format_t;\n    /// SAX interface type, see @ref nlohmann::json_sax\n    using json_sax_t = json_sax<basic_json>;\n\n    ////////////////\n    // exceptions //\n    ////////////////\n\n    /// @name exceptions\n    /// Classes to implement user-defined exceptions.\n    /// @{\n\n    /// @copydoc detail::exception\n    using exception = detail::exception;\n    /// @copydoc detail::parse_error\n    using parse_error = detail::parse_error;\n    /// @copydoc detail::invalid_iterator\n    using invalid_iterator = detail::invalid_iterator;\n    /// @copydoc detail::type_error\n    using type_error = detail::type_error;\n    /// @copydoc detail::out_of_range\n    using out_of_range = detail::out_of_range;\n    /// @copydoc detail::other_error\n    using other_error = detail::other_error;\n\n    /// @}\n\n\n    /////////////////////\n    // container types //\n    /////////////////////\n\n    /// @name container types\n    /// The canonic container types to use @ref basic_json like any other STL\n    /// container.\n    /// @{\n\n    /// the type of elements in a basic_json container\n    using value_type = basic_json;\n\n    /// the type of an element reference\n    using reference = value_type&;\n    /// the type of an element const reference\n    using const_reference = const value_type&;\n\n    /// a type to represent differences between iterators\n    using difference_type = std::ptrdiff_t;\n    /// a type to represent container sizes\n    using size_type = std::size_t;\n\n    /// the allocator type\n    using allocator_type = AllocatorType<basic_json>;\n\n    /// the type of an element pointer\n    using pointer = typename std::allocator_traits<allocator_type>::pointer;\n    /// the type of an element const pointer\n    using const_pointer = typename std::allocator_traits<allocator_type>::const_pointer;\n\n    /// an iterator for a basic_json container\n    using iterator = iter_impl<basic_json>;\n    /// a const iterator for a basic_json container\n    using const_iterator = iter_impl<const basic_json>;\n    /// a reverse iterator for a basic_json container\n    using reverse_iterator = json_reverse_iterator<typename basic_json::iterator>;\n    /// a const reverse iterator for a basic_json container\n    using const_reverse_iterator = json_reverse_iterator<typename basic_json::const_iterator>;\n\n    /// @}\n\n\n    /*!\n    @brief returns the allocator associated with the container\n    */\n    static allocator_type get_allocator()\n    {\n        return allocator_type();\n    }\n\n    /*!\n    @brief returns version information on the library\n\n    This function returns a JSON object with information about the library,\n    including the version number and information on the platform and compiler.\n\n    @return JSON object holding version information\n    key         | description\n    ----------- | ---------------\n    `compiler`  | Information on the used compiler. It is an object with the following keys: `c++` (the used C++ standard), `family` (the compiler family; possible values are `clang`, `icc`, `gcc`, `ilecpp`, `msvc`, `pgcpp`, `sunpro`, and `unknown`), and `version` (the compiler version).\n    `copyright` | The copyright line for the library as string.\n    `name`      | The name of the library as string.\n    `platform`  | The used platform as string. Possible values are `win32`, `linux`, `apple`, `unix`, and `unknown`.\n    `url`       | The URL of the project as string.\n    `version`   | The version of the library. It is an object with the following keys: `major`, `minor`, and `patch` as defined by [Semantic Versioning](http://semver.org), and `string` (the version string).\n\n    @liveexample{The following code shows an example output of the `meta()`\n    function.,meta}\n\n    @exceptionsafety Strong guarantee: if an exception is thrown, there are no\n    changes to any JSON value.\n\n    @complexity Constant.\n\n    @since 2.1.0\n    */\n    JSON_HEDLEY_WARN_UNUSED_RESULT\n    static basic_json meta()\n    {\n        basic_json result;\n\n        result[\"copyright\"] = \"(C) 2013-2020 Niels Lohmann\";\n        result[\"name\"] = \"JSON for Modern C++\";\n        result[\"url\"] = \"https://github.com/nlohmann/json\";\n        result[\"version\"][\"string\"] =\n            std::to_string(NLOHMANN_JSON_VERSION_MAJOR) + \".\" +\n            std::to_string(NLOHMANN_JSON_VERSION_MINOR) + \".\" +\n            std::to_string(NLOHMANN_JSON_VERSION_PATCH);\n        result[\"version\"][\"major\"] = NLOHMANN_JSON_VERSION_MAJOR;\n        result[\"version\"][\"minor\"] = NLOHMANN_JSON_VERSION_MINOR;\n        result[\"version\"][\"patch\"] = NLOHMANN_JSON_VERSION_PATCH;\n\n#ifdef _WIN32\n        result[\"platform\"] = \"win32\";\n#elif defined __linux__\n        result[\"platform\"] = \"linux\";\n#elif defined __APPLE__\n        result[\"platform\"] = \"apple\";\n#elif defined __unix__\n        result[\"platform\"] = \"unix\";\n#else\n        result[\"platform\"] = \"unknown\";\n#endif\n\n#if defined(__ICC) || defined(__INTEL_COMPILER)\n        result[\"compiler\"] = {{\"family\", \"icc\"}, {\"version\", __INTEL_COMPILER}};\n#elif defined(__clang__)\n        result[\"compiler\"] = {{\"family\", \"clang\"}, {\"version\", __clang_version__}};\n#elif defined(__GNUC__) || defined(__GNUG__)\n        result[\"compiler\"] = {{\"family\", \"gcc\"}, {\"version\", std::to_string(__GNUC__) + \".\" + std::to_string(__GNUC_MINOR__) + \".\" + std::to_string(__GNUC_PATCHLEVEL__)}};\n#elif defined(__HP_cc) || defined(__HP_aCC)\n        result[\"compiler\"] = \"hp\"\n#elif defined(__IBMCPP__)\n        result[\"compiler\"] = {{\"family\", \"ilecpp\"}, {\"version\", __IBMCPP__}};\n#elif defined(_MSC_VER)\n        result[\"compiler\"] = {{\"family\", \"msvc\"}, {\"version\", _MSC_VER}};\n#elif defined(__PGI)\n        result[\"compiler\"] = {{\"family\", \"pgcpp\"}, {\"version\", __PGI}};\n#elif defined(__SUNPRO_CC)\n        result[\"compiler\"] = {{\"family\", \"sunpro\"}, {\"version\", __SUNPRO_CC}};\n#else\n        result[\"compiler\"] = {{\"family\", \"unknown\"}, {\"version\", \"unknown\"}};\n#endif\n\n#ifdef __cplusplus\n        result[\"compiler\"][\"c++\"] = std::to_string(__cplusplus);\n#else\n        result[\"compiler\"][\"c++\"] = \"unknown\";\n#endif\n        return result;\n    }\n\n\n    ///////////////////////////\n    // JSON value data types //\n    ///////////////////////////\n\n    /// @name JSON value data types\n    /// The data types to store a JSON value. These types are derived from\n    /// the template arguments passed to class @ref basic_json.\n    /// @{\n\n#if defined(JSON_HAS_CPP_14)\n    // Use transparent comparator if possible, combined with perfect forwarding\n    // on find() and count() calls prevents unnecessary string construction.\n    using object_comparator_t = std::less<>;\n#else\n    using object_comparator_t = std::less<StringType>;\n#endif\n\n    /*!\n    @brief a type for an object\n\n    [RFC 7159](http://rfc7159.net/rfc7159) describes JSON objects as follows:\n    > An object is an unordered collection of zero or more name/value pairs,\n    > where a name is a string and a value is a string, number, boolean, null,\n    > object, or array.\n\n    To store objects in C++, a type is defined by the template parameters\n    described below.\n\n    @tparam ObjectType  the container to store objects (e.g., `std::map` or\n    `std::unordered_map`)\n    @tparam StringType the type of the keys or names (e.g., `std::string`).\n    The comparison function `std::less<StringType>` is used to order elements\n    inside the container.\n    @tparam AllocatorType the allocator to use for objects (e.g.,\n    `std::allocator`)\n\n    #### Default type\n\n    With the default values for @a ObjectType (`std::map`), @a StringType\n    (`std::string`), and @a AllocatorType (`std::allocator`), the default\n    value for @a object_t is:\n\n    @code {.cpp}\n    std::map<\n      std::string, // key_type\n      basic_json, // value_type\n      std::less<std::string>, // key_compare\n      std::allocator<std::pair<const std::string, basic_json>> // allocator_type\n    >\n    @endcode\n\n    #### Behavior\n\n    The choice of @a object_t influences the behavior of the JSON class. With\n    the default type, objects have the following behavior:\n\n    - When all names are unique, objects will be interoperable in the sense\n      that all software implementations receiving that object will agree on\n      the name-value mappings.\n    - When the names within an object are not unique, it is unspecified which\n      one of the values for a given key will be chosen. For instance,\n      `{\"key\": 2, \"key\": 1}` could be equal to either `{\"key\": 1}` or\n      `{\"key\": 2}`.\n    - Internally, name/value pairs are stored in lexicographical order of the\n      names. Objects will also be serialized (see @ref dump) in this order.\n      For instance, `{\"b\": 1, \"a\": 2}` and `{\"a\": 2, \"b\": 1}` will be stored\n      and serialized as `{\"a\": 2, \"b\": 1}`.\n    - When comparing objects, the order of the name/value pairs is irrelevant.\n      This makes objects interoperable in the sense that they will not be\n      affected by these differences. For instance, `{\"b\": 1, \"a\": 2}` and\n      `{\"a\": 2, \"b\": 1}` will be treated as equal.\n\n    #### Limits\n\n    [RFC 7159](http://rfc7159.net/rfc7159) specifies:\n    > An implementation may set limits on the maximum depth of nesting.\n\n    In this class, the object's limit of nesting is not explicitly constrained.\n    However, a maximum depth of nesting may be introduced by the compiler or\n    runtime environment. A theoretical limit can be queried by calling the\n    @ref max_size function of a JSON object.\n\n    #### Storage\n\n    Objects are stored as pointers in a @ref basic_json type. That is, for any\n    access to object values, a pointer of type `object_t*` must be\n    dereferenced.\n\n    @sa @ref array_t -- type for an array value\n\n    @since version 1.0.0\n\n    @note The order name/value pairs are added to the object is *not*\n    preserved by the library. Therefore, iterating an object may return\n    name/value pairs in a different order than they were originally stored. In\n    fact, keys will be traversed in alphabetical order as `std::map` with\n    `std::less` is used by default. Please note this behavior conforms to [RFC\n    7159](http://rfc7159.net/rfc7159), because any order implements the\n    specified \"unordered\" nature of JSON objects.\n    */\n    using object_t = ObjectType<StringType,\n          basic_json,\n          object_comparator_t,\n          AllocatorType<std::pair<const StringType,\n          basic_json>>>;\n\n    /*!\n    @brief a type for an array\n\n    [RFC 7159](http://rfc7159.net/rfc7159) describes JSON arrays as follows:\n    > An array is an ordered sequence of zero or more values.\n\n    To store objects in C++, a type is defined by the template parameters\n    explained below.\n\n    @tparam ArrayType  container type to store arrays (e.g., `std::vector` or\n    `std::list`)\n    @tparam AllocatorType allocator to use for arrays (e.g., `std::allocator`)\n\n    #### Default type\n\n    With the default values for @a ArrayType (`std::vector`) and @a\n    AllocatorType (`std::allocator`), the default value for @a array_t is:\n\n    @code {.cpp}\n    std::vector<\n      basic_json, // value_type\n      std::allocator<basic_json> // allocator_type\n    >\n    @endcode\n\n    #### Limits\n\n    [RFC 7159](http://rfc7159.net/rfc7159) specifies:\n    > An implementation may set limits on the maximum depth of nesting.\n\n    In this class, the array's limit of nesting is not explicitly constrained.\n    However, a maximum depth of nesting may be introduced by the compiler or\n    runtime environment. A theoretical limit can be queried by calling the\n    @ref max_size function of a JSON array.\n\n    #### Storage\n\n    Arrays are stored as pointers in a @ref basic_json type. That is, for any\n    access to array values, a pointer of type `array_t*` must be dereferenced.\n\n    @sa @ref object_t -- type for an object value\n\n    @since version 1.0.0\n    */\n    using array_t = ArrayType<basic_json, AllocatorType<basic_json>>;\n\n    /*!\n    @brief a type for a string\n\n    [RFC 7159](http://rfc7159.net/rfc7159) describes JSON strings as follows:\n    > A string is a sequence of zero or more Unicode characters.\n\n    To store objects in C++, a type is defined by the template parameter\n    described below. Unicode values are split by the JSON class into\n    byte-sized characters during deserialization.\n\n    @tparam StringType  the container to store strings (e.g., `std::string`).\n    Note this container is used for keys/names in objects, see @ref object_t.\n\n    #### Default type\n\n    With the default values for @a StringType (`std::string`), the default\n    value for @a string_t is:\n\n    @code {.cpp}\n    std::string\n    @endcode\n\n    #### Encoding\n\n    Strings are stored in UTF-8 encoding. Therefore, functions like\n    `std::string::size()` or `std::string::length()` return the number of\n    bytes in the string rather than the number of characters or glyphs.\n\n    #### String comparison\n\n    [RFC 7159](http://rfc7159.net/rfc7159) states:\n    > Software implementations are typically required to test names of object\n    > members for equality. Implementations that transform the textual\n    > representation into sequences of Unicode code units and then perform the\n    > comparison numerically, code unit by code unit, are interoperable in the\n    > sense that implementations will agree in all cases on equality or\n    > inequality of two strings. For example, implementations that compare\n    > strings with escaped characters unconverted may incorrectly find that\n    > `\"a\\\\b\"` and `\"a\\u005Cb\"` are not equal.\n\n    This implementation is interoperable as it does compare strings code unit\n    by code unit.\n\n    #### Storage\n\n    String values are stored as pointers in a @ref basic_json type. That is,\n    for any access to string values, a pointer of type `string_t*` must be\n    dereferenced.\n\n    @since version 1.0.0\n    */\n    using string_t = StringType;\n\n    /*!\n    @brief a type for a boolean\n\n    [RFC 7159](http://rfc7159.net/rfc7159) implicitly describes a boolean as a\n    type which differentiates the two literals `true` and `false`.\n\n    To store objects in C++, a type is defined by the template parameter @a\n    BooleanType which chooses the type to use.\n\n    #### Default type\n\n    With the default values for @a BooleanType (`bool`), the default value for\n    @a boolean_t is:\n\n    @code {.cpp}\n    bool\n    @endcode\n\n    #### Storage\n\n    Boolean values are stored directly inside a @ref basic_json type.\n\n    @since version 1.0.0\n    */\n    using boolean_t = BooleanType;\n\n    /*!\n    @brief a type for a number (integer)\n\n    [RFC 7159](http://rfc7159.net/rfc7159) describes numbers as follows:\n    > The representation of numbers is similar to that used in most\n    > programming languages. A number is represented in base 10 using decimal\n    > digits. It contains an integer component that may be prefixed with an\n    > optional minus sign, which may be followed by a fraction part and/or an\n    > exponent part. Leading zeros are not allowed. (...) Numeric values that\n    > cannot be represented in the grammar below (such as Infinity and NaN)\n    > are not permitted.\n\n    This description includes both integer and floating-point numbers.\n    However, C++ allows more precise storage if it is known whether the number\n    is a signed integer, an unsigned integer or a floating-point number.\n    Therefore, three different types, @ref number_integer_t, @ref\n    number_unsigned_t and @ref number_float_t are used.\n\n    To store integer numbers in C++, a type is defined by the template\n    parameter @a NumberIntegerType which chooses the type to use.\n\n    #### Default type\n\n    With the default values for @a NumberIntegerType (`int64_t`), the default\n    value for @a number_integer_t is:\n\n    @code {.cpp}\n    int64_t\n    @endcode\n\n    #### Default behavior\n\n    - The restrictions about leading zeros is not enforced in C++. Instead,\n      leading zeros in integer literals lead to an interpretation as octal\n      number. Internally, the value will be stored as decimal number. For\n      instance, the C++ integer literal `010` will be serialized to `8`.\n      During deserialization, leading zeros yield an error.\n    - Not-a-number (NaN) values will be serialized to `null`.\n\n    #### Limits\n\n    [RFC 7159](http://rfc7159.net/rfc7159) specifies:\n    > An implementation may set limits on the range and precision of numbers.\n\n    When the default type is used, the maximal integer number that can be\n    stored is `9223372036854775807` (INT64_MAX) and the minimal integer number\n    that can be stored is `-9223372036854775808` (INT64_MIN). Integer numbers\n    that are out of range will yield over/underflow when used in a\n    constructor. During deserialization, too large or small integer numbers\n    will be automatically be stored as @ref number_unsigned_t or @ref\n    number_float_t.\n\n    [RFC 7159](http://rfc7159.net/rfc7159) further states:\n    > Note that when such software is used, numbers that are integers and are\n    > in the range \\f$[-2^{53}+1, 2^{53}-1]\\f$ are interoperable in the sense\n    > that implementations will agree exactly on their numeric values.\n\n    As this range is a subrange of the exactly supported range [INT64_MIN,\n    INT64_MAX], this class's integer type is interoperable.\n\n    #### Storage\n\n    Integer number values are stored directly inside a @ref basic_json type.\n\n    @sa @ref number_float_t -- type for number values (floating-point)\n\n    @sa @ref number_unsigned_t -- type for number values (unsigned integer)\n\n    @since version 1.0.0\n    */\n    using number_integer_t = NumberIntegerType;\n\n    /*!\n    @brief a type for a number (unsigned)\n\n    [RFC 7159](http://rfc7159.net/rfc7159) describes numbers as follows:\n    > The representation of numbers is similar to that used in most\n    > programming languages. A number is represented in base 10 using decimal\n    > digits. It contains an integer component that may be prefixed with an\n    > optional minus sign, which may be followed by a fraction part and/or an\n    > exponent part. Leading zeros are not allowed. (...) Numeric values that\n    > cannot be represented in the grammar below (such as Infinity and NaN)\n    > are not permitted.\n\n    This description includes both integer and floating-point numbers.\n    However, C++ allows more precise storage if it is known whether the number\n    is a signed integer, an unsigned integer or a floating-point number.\n    Therefore, three different types, @ref number_integer_t, @ref\n    number_unsigned_t and @ref number_float_t are used.\n\n    To store unsigned integer numbers in C++, a type is defined by the\n    template parameter @a NumberUnsignedType which chooses the type to use.\n\n    #### Default type\n\n    With the default values for @a NumberUnsignedType (`uint64_t`), the\n    default value for @a number_unsigned_t is:\n\n    @code {.cpp}\n    uint64_t\n    @endcode\n\n    #### Default behavior\n\n    - The restrictions about leading zeros is not enforced in C++. Instead,\n      leading zeros in integer literals lead to an interpretation as octal\n      number. Internally, the value will be stored as decimal number. For\n      instance, the C++ integer literal `010` will be serialized to `8`.\n      During deserialization, leading zeros yield an error.\n    - Not-a-number (NaN) values will be serialized to `null`.\n\n    #### Limits\n\n    [RFC 7159](http://rfc7159.net/rfc7159) specifies:\n    > An implementation may set limits on the range and precision of numbers.\n\n    When the default type is used, the maximal integer number that can be\n    stored is `18446744073709551615` (UINT64_MAX) and the minimal integer\n    number that can be stored is `0`. Integer numbers that are out of range\n    will yield over/underflow when used in a constructor. During\n    deserialization, too large or small integer numbers will be automatically\n    be stored as @ref number_integer_t or @ref number_float_t.\n\n    [RFC 7159](http://rfc7159.net/rfc7159) further states:\n    > Note that when such software is used, numbers that are integers and are\n    > in the range \\f$[-2^{53}+1, 2^{53}-1]\\f$ are interoperable in the sense\n    > that implementations will agree exactly on their numeric values.\n\n    As this range is a subrange (when considered in conjunction with the\n    number_integer_t type) of the exactly supported range [0, UINT64_MAX],\n    this class's integer type is interoperable.\n\n    #### Storage\n\n    Integer number values are stored directly inside a @ref basic_json type.\n\n    @sa @ref number_float_t -- type for number values (floating-point)\n    @sa @ref number_integer_t -- type for number values (integer)\n\n    @since version 2.0.0\n    */\n    using number_unsigned_t = NumberUnsignedType;\n\n    /*!\n    @brief a type for a number (floating-point)\n\n    [RFC 7159](http://rfc7159.net/rfc7159) describes numbers as follows:\n    > The representation of numbers is similar to that used in most\n    > programming languages. A number is represented in base 10 using decimal\n    > digits. It contains an integer component that may be prefixed with an\n    > optional minus sign, which may be followed by a fraction part and/or an\n    > exponent part. Leading zeros are not allowed. (...) Numeric values that\n    > cannot be represented in the grammar below (such as Infinity and NaN)\n    > are not permitted.\n\n    This description includes both integer and floating-point numbers.\n    However, C++ allows more precise storage if it is known whether the number\n    is a signed integer, an unsigned integer or a floating-point number.\n    Therefore, three different types, @ref number_integer_t, @ref\n    number_unsigned_t and @ref number_float_t are used.\n\n    To store floating-point numbers in C++, a type is defined by the template\n    parameter @a NumberFloatType which chooses the type to use.\n\n    #### Default type\n\n    With the default values for @a NumberFloatType (`double`), the default\n    value for @a number_float_t is:\n\n    @code {.cpp}\n    double\n    @endcode\n\n    #### Default behavior\n\n    - The restrictions about leading zeros is not enforced in C++. Instead,\n      leading zeros in floating-point literals will be ignored. Internally,\n      the value will be stored as decimal number. For instance, the C++\n      floating-point literal `01.2` will be serialized to `1.2`. During\n      deserialization, leading zeros yield an error.\n    - Not-a-number (NaN) values will be serialized to `null`.\n\n    #### Limits\n\n    [RFC 7159](http://rfc7159.net/rfc7159) states:\n    > This specification allows implementations to set limits on the range and\n    > precision of numbers accepted. Since software that implements IEEE\n    > 754-2008 binary64 (double precision) numbers is generally available and\n    > widely used, good interoperability can be achieved by implementations\n    > that expect no more precision or range than these provide, in the sense\n    > that implementations will approximate JSON numbers within the expected\n    > precision.\n\n    This implementation does exactly follow this approach, as it uses double\n    precision floating-point numbers. Note values smaller than\n    `-1.79769313486232e+308` and values greater than `1.79769313486232e+308`\n    will be stored as NaN internally and be serialized to `null`.\n\n    #### Storage\n\n    Floating-point number values are stored directly inside a @ref basic_json\n    type.\n\n    @sa @ref number_integer_t -- type for number values (integer)\n\n    @sa @ref number_unsigned_t -- type for number values (unsigned integer)\n\n    @since version 1.0.0\n    */\n    using number_float_t = NumberFloatType;\n\n    /*!\n    @brief a type for a packed binary type\n\n    This type is a type designed to carry binary data that appears in various\n    serialized formats, such as CBOR's Major Type 2, MessagePack's bin, and\n    BSON's generic binary subtype. This type is NOT a part of standard JSON and\n    exists solely for compatibility with these binary types. As such, it is\n    simply defined as an ordered sequence of zero or more byte values.\n\n    Additionally, as an implementation detail, the subtype of the binary data is\n    carried around as a `std::uint8_t`, which is compatible with both of the\n    binary data formats that use binary subtyping, (though the specific\n    numbering is incompatible with each other, and it is up to the user to\n    translate between them).\n\n    [CBOR's RFC 7049](https://tools.ietf.org/html/rfc7049) describes this type\n    as:\n    > Major type 2: a byte string. The string's length in bytes is represented\n    > following the rules for positive integers (major type 0).\n\n    [MessagePack's documentation on the bin type\n    family](https://github.com/msgpack/msgpack/blob/master/spec.md#bin-format-family)\n    describes this type as:\n    > Bin format family stores an byte array in 2, 3, or 5 bytes of extra bytes\n    > in addition to the size of the byte array.\n\n    [BSON's specifications](http://bsonspec.org/spec.html) describe several\n    binary types; however, this type is intended to represent the generic binary\n    type which has the description:\n    > Generic binary subtype - This is the most commonly used binary subtype and\n    > should be the 'default' for drivers and tools.\n\n    None of these impose any limitations on the internal representation other\n    than the basic unit of storage be some type of array whose parts are\n    decomposable into bytes.\n\n    The default representation of this binary format is a\n    `std::vector<std::uint8_t>`, which is a very common way to represent a byte\n    array in modern C++.\n\n    #### Default type\n\n    The default values for @a BinaryType is `std::vector<std::uint8_t>`\n\n    #### Storage\n\n    Binary Arrays are stored as pointers in a @ref basic_json type. That is,\n    for any access to array values, a pointer of the type `binary_t*` must be\n    dereferenced.\n\n    #### Notes on subtypes\n\n    - CBOR\n       - Binary values are represented as byte strings. No subtypes are\n         supported and will be ignored when CBOR is written.\n    - MessagePack\n       - If a subtype is given and the binary array contains exactly 1, 2, 4, 8,\n         or 16 elements, the fixext family (fixext1, fixext2, fixext4, fixext8)\n         is used. For other sizes, the ext family (ext8, ext16, ext32) is used.\n         The subtype is then added as singed 8-bit integer.\n       - If no subtype is given, the bin family (bin8, bin16, bin32) is used.\n    - BSON\n       - If a subtype is given, it is used and added as unsigned 8-bit integer.\n       - If no subtype is given, the generic binary subtype 0x00 is used.\n\n    @sa @ref binary -- create a binary array\n\n    @since version 3.8.0\n    */\n    using binary_t = nlohmann::byte_container_with_subtype<BinaryType>;\n    /// @}\n\n  private:\n\n    /// helper for exception-safe object creation\n    template<typename T, typename... Args>\n    JSON_HEDLEY_RETURNS_NON_NULL\n    static T* create(Args&& ... args)\n    {\n        AllocatorType<T> alloc;\n        using AllocatorTraits = std::allocator_traits<AllocatorType<T>>;\n\n        auto deleter = [&](T * object)\n        {\n            AllocatorTraits::deallocate(alloc, object, 1);\n        };\n        std::unique_ptr<T, decltype(deleter)> object(AllocatorTraits::allocate(alloc, 1), deleter);\n        AllocatorTraits::construct(alloc, object.get(), std::forward<Args>(args)...);\n        JSON_ASSERT(object != nullptr);\n        return object.release();\n    }\n\n    ////////////////////////\n    // JSON value storage //\n    ////////////////////////\n\n  JSON_PRIVATE_UNLESS_TESTED:\n    /*!\n    @brief a JSON value\n\n    The actual storage for a JSON value of the @ref basic_json class. This\n    union combines the different storage types for the JSON value types\n    defined in @ref value_t.\n\n    JSON type | value_t type    | used type\n    --------- | --------------- | ------------------------\n    object    | object          | pointer to @ref object_t\n    array     | array           | pointer to @ref array_t\n    string    | string          | pointer to @ref string_t\n    boolean   | boolean         | @ref boolean_t\n    number    | number_integer  | @ref number_integer_t\n    number    | number_unsigned | @ref number_unsigned_t\n    number    | number_float    | @ref number_float_t\n    binary    | binary          | pointer to @ref binary_t\n    null      | null            | *no value is stored*\n\n    @note Variable-length types (objects, arrays, and strings) are stored as\n    pointers. The size of the union should not exceed 64 bits if the default\n    value types are used.\n\n    @since version 1.0.0\n    */\n    union json_value\n    {\n        /// object (stored with pointer to save storage)\n        object_t* object;\n        /// array (stored with pointer to save storage)\n        array_t* array;\n        /// string (stored with pointer to save storage)\n        string_t* string;\n        /// binary (stored with pointer to save storage)\n        binary_t* binary;\n        /// boolean\n        boolean_t boolean;\n        /// number (integer)\n        number_integer_t number_integer;\n        /// number (unsigned integer)\n        number_unsigned_t number_unsigned;\n        /// number (floating-point)\n        number_float_t number_float;\n\n        /// default constructor (for null values)\n        json_value() = default;\n        /// constructor for booleans\n        json_value(boolean_t v) noexcept : boolean(v) {}\n        /// constructor for numbers (integer)\n        json_value(number_integer_t v) noexcept : number_integer(v) {}\n        /// constructor for numbers (unsigned)\n        json_value(number_unsigned_t v) noexcept : number_unsigned(v) {}\n        /// constructor for numbers (floating-point)\n        json_value(number_float_t v) noexcept : number_float(v) {}\n        /// constructor for empty values of a given type\n        json_value(value_t t)\n        {\n            switch (t)\n            {\n                case value_t::object:\n                {\n                    object = create<object_t>();\n                    break;\n                }\n\n                case value_t::array:\n                {\n                    array = create<array_t>();\n                    break;\n                }\n\n                case value_t::string:\n                {\n                    string = create<string_t>(\"\");\n                    break;\n                }\n\n                case value_t::binary:\n                {\n                    binary = create<binary_t>();\n                    break;\n                }\n\n                case value_t::boolean:\n                {\n                    boolean = boolean_t(false);\n                    break;\n                }\n\n                case value_t::number_integer:\n                {\n                    number_integer = number_integer_t(0);\n                    break;\n                }\n\n                case value_t::number_unsigned:\n                {\n                    number_unsigned = number_unsigned_t(0);\n                    break;\n                }\n\n                case value_t::number_float:\n                {\n                    number_float = number_float_t(0.0);\n                    break;\n                }\n\n                case value_t::null:\n                {\n                    object = nullptr;  // silence warning, see #821\n                    break;\n                }\n\n                default:\n                {\n                    object = nullptr;  // silence warning, see #821\n                    if (JSON_HEDLEY_UNLIKELY(t == value_t::null))\n                    {\n                        JSON_THROW(other_error::create(500, \"961c151d2e87f2686a955a9be24d316f1362bf21 3.9.1\")); // LCOV_EXCL_LINE\n                    }\n                    break;\n                }\n            }\n        }\n\n        /// constructor for strings\n        json_value(const string_t& value)\n        {\n            string = create<string_t>(value);\n        }\n\n        /// constructor for rvalue strings\n        json_value(string_t&& value)\n        {\n            string = create<string_t>(std::move(value));\n        }\n\n        /// constructor for objects\n        json_value(const object_t& value)\n        {\n            object = create<object_t>(value);\n        }\n\n        /// constructor for rvalue objects\n        json_value(object_t&& value)\n        {\n            object = create<object_t>(std::move(value));\n        }\n\n        /// constructor for arrays\n        json_value(const array_t& value)\n        {\n            array = create<array_t>(value);\n        }\n\n        /// constructor for rvalue arrays\n        json_value(array_t&& value)\n        {\n            array = create<array_t>(std::move(value));\n        }\n\n        /// constructor for binary arrays\n        json_value(const typename binary_t::container_type& value)\n        {\n            binary = create<binary_t>(value);\n        }\n\n        /// constructor for rvalue binary arrays\n        json_value(typename binary_t::container_type&& value)\n        {\n            binary = create<binary_t>(std::move(value));\n        }\n\n        /// constructor for binary arrays (internal type)\n        json_value(const binary_t& value)\n        {\n            binary = create<binary_t>(value);\n        }\n\n        /// constructor for rvalue binary arrays (internal type)\n        json_value(binary_t&& value)\n        {\n            binary = create<binary_t>(std::move(value));\n        }\n\n        void destroy(value_t t) noexcept\n        {\n            // flatten the current json_value to a heap-allocated stack\n            std::vector<basic_json> stack;\n\n            // move the top-level items to stack\n            if (t == value_t::array)\n            {\n                stack.reserve(array->size());\n                std::move(array->begin(), array->end(), std::back_inserter(stack));\n            }\n            else if (t == value_t::object)\n            {\n                stack.reserve(object->size());\n                for (auto&& it : *object)\n                {\n                    stack.push_back(std::move(it.second));\n                }\n            }\n\n            while (!stack.empty())\n            {\n                // move the last item to local variable to be processed\n                basic_json current_item(std::move(stack.back()));\n                stack.pop_back();\n\n                // if current_item is array/object, move\n                // its children to the stack to be processed later\n                if (current_item.is_array())\n                {\n                    std::move(current_item.m_value.array->begin(), current_item.m_value.array->end(),\n                              std::back_inserter(stack));\n\n                    current_item.m_value.array->clear();\n                }\n                else if (current_item.is_object())\n                {\n                    for (auto&& it : *current_item.m_value.object)\n                    {\n                        stack.push_back(std::move(it.second));\n                    }\n\n                    current_item.m_value.object->clear();\n                }\n\n                // it's now safe that current_item get destructed\n                // since it doesn't have any children\n            }\n\n            switch (t)\n            {\n                case value_t::object:\n                {\n                    AllocatorType<object_t> alloc;\n                    std::allocator_traits<decltype(alloc)>::destroy(alloc, object);\n                    std::allocator_traits<decltype(alloc)>::deallocate(alloc, object, 1);\n                    break;\n                }\n\n                case value_t::array:\n                {\n                    AllocatorType<array_t> alloc;\n                    std::allocator_traits<decltype(alloc)>::destroy(alloc, array);\n                    std::allocator_traits<decltype(alloc)>::deallocate(alloc, array, 1);\n                    break;\n                }\n\n                case value_t::string:\n                {\n                    AllocatorType<string_t> alloc;\n                    std::allocator_traits<decltype(alloc)>::destroy(alloc, string);\n                    std::allocator_traits<decltype(alloc)>::deallocate(alloc, string, 1);\n                    break;\n                }\n\n                case value_t::binary:\n                {\n                    AllocatorType<binary_t> alloc;\n                    std::allocator_traits<decltype(alloc)>::destroy(alloc, binary);\n                    std::allocator_traits<decltype(alloc)>::deallocate(alloc, binary, 1);\n                    break;\n                }\n\n                default:\n                {\n                    break;\n                }\n            }\n        }\n    };\n\n  private:\n    /*!\n    @brief checks the class invariants\n\n    This function asserts the class invariants. It needs to be called at the\n    end of every constructor to make sure that created objects respect the\n    invariant. Furthermore, it has to be called each time the type of a JSON\n    value is changed, because the invariant expresses a relationship between\n    @a m_type and @a m_value.\n    */\n    void assert_invariant() const noexcept\n    {\n        JSON_ASSERT(m_type != value_t::object || m_value.object != nullptr);\n        JSON_ASSERT(m_type != value_t::array || m_value.array != nullptr);\n        JSON_ASSERT(m_type != value_t::string || m_value.string != nullptr);\n        JSON_ASSERT(m_type != value_t::binary || m_value.binary != nullptr);\n    }\n\n  public:\n    //////////////////////////\n    // JSON parser callback //\n    //////////////////////////\n\n    /*!\n    @brief parser event types\n\n    The parser callback distinguishes the following events:\n    - `object_start`: the parser read `{` and started to process a JSON object\n    - `key`: the parser read a key of a value in an object\n    - `object_end`: the parser read `}` and finished processing a JSON object\n    - `array_start`: the parser read `[` and started to process a JSON array\n    - `array_end`: the parser read `]` and finished processing a JSON array\n    - `value`: the parser finished reading a JSON value\n\n    @image html callback_events.png \"Example when certain parse events are triggered\"\n\n    @sa @ref parser_callback_t for more information and examples\n    */\n    using parse_event_t = detail::parse_event_t;\n\n    /*!\n    @brief per-element parser callback type\n\n    With a parser callback function, the result of parsing a JSON text can be\n    influenced. When passed to @ref parse, it is called on certain events\n    (passed as @ref parse_event_t via parameter @a event) with a set recursion\n    depth @a depth and context JSON value @a parsed. The return value of the\n    callback function is a boolean indicating whether the element that emitted\n    the callback shall be kept or not.\n\n    We distinguish six scenarios (determined by the event type) in which the\n    callback function can be called. The following table describes the values\n    of the parameters @a depth, @a event, and @a parsed.\n\n    parameter @a event | description | parameter @a depth | parameter @a parsed\n    ------------------ | ----------- | ------------------ | -------------------\n    parse_event_t::object_start | the parser read `{` and started to process a JSON object | depth of the parent of the JSON object | a JSON value with type discarded\n    parse_event_t::key | the parser read a key of a value in an object | depth of the currently parsed JSON object | a JSON string containing the key\n    parse_event_t::object_end | the parser read `}` and finished processing a JSON object | depth of the parent of the JSON object | the parsed JSON object\n    parse_event_t::array_start | the parser read `[` and started to process a JSON array | depth of the parent of the JSON array | a JSON value with type discarded\n    parse_event_t::array_end | the parser read `]` and finished processing a JSON array | depth of the parent of the JSON array | the parsed JSON array\n    parse_event_t::value | the parser finished reading a JSON value | depth of the value | the parsed JSON value\n\n    @image html callback_events.png \"Example when certain parse events are triggered\"\n\n    Discarding a value (i.e., returning `false`) has different effects\n    depending on the context in which function was called:\n\n    - Discarded values in structured types are skipped. That is, the parser\n      will behave as if the discarded value was never read.\n    - In case a value outside a structured type is skipped, it is replaced\n      with `null`. This case happens if the top-level element is skipped.\n\n    @param[in] depth  the depth of the recursion during parsing\n\n    @param[in] event  an event of type parse_event_t indicating the context in\n    the callback function has been called\n\n    @param[in,out] parsed  the current intermediate parse result; note that\n    writing to this value has no effect for parse_event_t::key events\n\n    @return Whether the JSON value which called the function during parsing\n    should be kept (`true`) or not (`false`). In the latter case, it is either\n    skipped completely or replaced by an empty discarded object.\n\n    @sa @ref parse for examples\n\n    @since version 1.0.0\n    */\n    using parser_callback_t = detail::parser_callback_t<basic_json>;\n\n    //////////////////\n    // constructors //\n    //////////////////\n\n    /// @name constructors and destructors\n    /// Constructors of class @ref basic_json, copy/move constructor, copy\n    /// assignment, static functions creating objects, and the destructor.\n    /// @{\n\n    /*!\n    @brief create an empty value with a given type\n\n    Create an empty JSON value with a given type. The value will be default\n    initialized with an empty value which depends on the type:\n\n    Value type  | initial value\n    ----------- | -------------\n    null        | `null`\n    boolean     | `false`\n    string      | `\"\"`\n    number      | `0`\n    object      | `{}`\n    array       | `[]`\n    binary      | empty array\n\n    @param[in] v  the type of the value to create\n\n    @complexity Constant.\n\n    @exceptionsafety Strong guarantee: if an exception is thrown, there are no\n    changes to any JSON value.\n\n    @liveexample{The following code shows the constructor for different @ref\n    value_t values,basic_json__value_t}\n\n    @sa @ref clear() -- restores the postcondition of this constructor\n\n    @since version 1.0.0\n    */\n    basic_json(const value_t v)\n        : m_type(v), m_value(v)\n    {\n        assert_invariant();\n    }\n\n    /*!\n    @brief create a null object\n\n    Create a `null` JSON value. It either takes a null pointer as parameter\n    (explicitly creating `null`) or no parameter (implicitly creating `null`).\n    The passed null pointer itself is not read -- it is only used to choose\n    the right constructor.\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this constructor never throws\n    exceptions.\n\n    @liveexample{The following code shows the constructor with and without a\n    null pointer parameter.,basic_json__nullptr_t}\n\n    @since version 1.0.0\n    */\n    basic_json(std::nullptr_t = nullptr) noexcept\n        : basic_json(value_t::null)\n    {\n        assert_invariant();\n    }\n\n    /*!\n    @brief create a JSON value\n\n    This is a \"catch all\" constructor for all compatible JSON types; that is,\n    types for which a `to_json()` method exists. The constructor forwards the\n    parameter @a val to that method (to `json_serializer<U>::to_json` method\n    with `U = uncvref_t<CompatibleType>`, to be exact).\n\n    Template type @a CompatibleType includes, but is not limited to, the\n    following types:\n    - **arrays**: @ref array_t and all kinds of compatible containers such as\n      `std::vector`, `std::deque`, `std::list`, `std::forward_list`,\n      `std::array`, `std::valarray`, `std::set`, `std::unordered_set`,\n      `std::multiset`, and `std::unordered_multiset` with a `value_type` from\n      which a @ref basic_json value can be constructed.\n    - **objects**: @ref object_t and all kinds of compatible associative\n      containers such as `std::map`, `std::unordered_map`, `std::multimap`,\n      and `std::unordered_multimap` with a `key_type` compatible to\n      @ref string_t and a `value_type` from which a @ref basic_json value can\n      be constructed.\n    - **strings**: @ref string_t, string literals, and all compatible string\n      containers can be used.\n    - **numbers**: @ref number_integer_t, @ref number_unsigned_t,\n      @ref number_float_t, and all convertible number types such as `int`,\n      `size_t`, `int64_t`, `float` or `double` can be used.\n    - **boolean**: @ref boolean_t / `bool` can be used.\n    - **binary**: @ref binary_t / `std::vector<uint8_t>` may be used,\n      unfortunately because string literals cannot be distinguished from binary\n      character arrays by the C++ type system, all types compatible with `const\n      char*` will be directed to the string constructor instead.  This is both\n      for backwards compatibility, and due to the fact that a binary type is not\n      a standard JSON type.\n\n    See the examples below.\n\n    @tparam CompatibleType a type such that:\n    - @a CompatibleType is not derived from `std::istream`,\n    - @a CompatibleType is not @ref basic_json (to avoid hijacking copy/move\n         constructors),\n    - @a CompatibleType is not a different @ref basic_json type (i.e. with different template arguments)\n    - @a CompatibleType is not a @ref basic_json nested type (e.g.,\n         @ref json_pointer, @ref iterator, etc ...)\n    - @ref @ref json_serializer<U> has a\n         `to_json(basic_json_t&, CompatibleType&&)` method\n\n    @tparam U = `uncvref_t<CompatibleType>`\n\n    @param[in] val the value to be forwarded to the respective constructor\n\n    @complexity Usually linear in the size of the passed @a val, also\n                depending on the implementation of the called `to_json()`\n                method.\n\n    @exceptionsafety Depends on the called constructor. For types directly\n    supported by the library (i.e., all types for which no `to_json()` function\n    was provided), strong guarantee holds: if an exception is thrown, there are\n    no changes to any JSON value.\n\n    @liveexample{The following code shows the constructor with several\n    compatible types.,basic_json__CompatibleType}\n\n    @since version 2.1.0\n    */\n    template < typename CompatibleType,\n               typename U = detail::uncvref_t<CompatibleType>,\n               detail::enable_if_t <\n                   !detail::is_basic_json<U>::value && detail::is_compatible_type<basic_json_t, U>::value, int > = 0 >\n    basic_json(CompatibleType && val) noexcept(noexcept(\n                JSONSerializer<U>::to_json(std::declval<basic_json_t&>(),\n                                           std::forward<CompatibleType>(val))))\n    {\n        JSONSerializer<U>::to_json(*this, std::forward<CompatibleType>(val));\n        assert_invariant();\n    }\n\n    /*!\n    @brief create a JSON value from an existing one\n\n    This is a constructor for existing @ref basic_json types.\n    It does not hijack copy/move constructors, since the parameter has different\n    template arguments than the current ones.\n\n    The constructor tries to convert the internal @ref m_value of the parameter.\n\n    @tparam BasicJsonType a type such that:\n    - @a BasicJsonType is a @ref basic_json type.\n    - @a BasicJsonType has different template arguments than @ref basic_json_t.\n\n    @param[in] val the @ref basic_json value to be converted.\n\n    @complexity Usually linear in the size of the passed @a val, also\n                depending on the implementation of the called `to_json()`\n                method.\n\n    @exceptionsafety Depends on the called constructor. For types directly\n    supported by the library (i.e., all types for which no `to_json()` function\n    was provided), strong guarantee holds: if an exception is thrown, there are\n    no changes to any JSON value.\n\n    @since version 3.2.0\n    */\n    template < typename BasicJsonType,\n               detail::enable_if_t <\n                   detail::is_basic_json<BasicJsonType>::value&& !std::is_same<basic_json, BasicJsonType>::value, int > = 0 >\n    basic_json(const BasicJsonType& val)\n    {\n        using other_boolean_t = typename BasicJsonType::boolean_t;\n        using other_number_float_t = typename BasicJsonType::number_float_t;\n        using other_number_integer_t = typename BasicJsonType::number_integer_t;\n        using other_number_unsigned_t = typename BasicJsonType::number_unsigned_t;\n        using other_string_t = typename BasicJsonType::string_t;\n        using other_object_t = typename BasicJsonType::object_t;\n        using other_array_t = typename BasicJsonType::array_t;\n        using other_binary_t = typename BasicJsonType::binary_t;\n\n        switch (val.type())\n        {\n            case value_t::boolean:\n                JSONSerializer<other_boolean_t>::to_json(*this, val.template get<other_boolean_t>());\n                break;\n            case value_t::number_float:\n                JSONSerializer<other_number_float_t>::to_json(*this, val.template get<other_number_float_t>());\n                break;\n            case value_t::number_integer:\n                JSONSerializer<other_number_integer_t>::to_json(*this, val.template get<other_number_integer_t>());\n                break;\n            case value_t::number_unsigned:\n                JSONSerializer<other_number_unsigned_t>::to_json(*this, val.template get<other_number_unsigned_t>());\n                break;\n            case value_t::string:\n                JSONSerializer<other_string_t>::to_json(*this, val.template get_ref<const other_string_t&>());\n                break;\n            case value_t::object:\n                JSONSerializer<other_object_t>::to_json(*this, val.template get_ref<const other_object_t&>());\n                break;\n            case value_t::array:\n                JSONSerializer<other_array_t>::to_json(*this, val.template get_ref<const other_array_t&>());\n                break;\n            case value_t::binary:\n                JSONSerializer<other_binary_t>::to_json(*this, val.template get_ref<const other_binary_t&>());\n                break;\n            case value_t::null:\n                *this = nullptr;\n                break;\n            case value_t::discarded:\n                m_type = value_t::discarded;\n                break;\n            default:            // LCOV_EXCL_LINE\n                JSON_ASSERT(false);  // LCOV_EXCL_LINE\n        }\n        assert_invariant();\n    }\n\n    /*!\n    @brief create a container (array or object) from an initializer list\n\n    Creates a JSON value of type array or object from the passed initializer\n    list @a init. In case @a type_deduction is `true` (default), the type of\n    the JSON value to be created is deducted from the initializer list @a init\n    according to the following rules:\n\n    1. If the list is empty, an empty JSON object value `{}` is created.\n    2. If the list consists of pairs whose first element is a string, a JSON\n       object value is created where the first elements of the pairs are\n       treated as keys and the second elements are as values.\n    3. In all other cases, an array is created.\n\n    The rules aim to create the best fit between a C++ initializer list and\n    JSON values. The rationale is as follows:\n\n    1. The empty initializer list is written as `{}` which is exactly an empty\n       JSON object.\n    2. C++ has no way of describing mapped types other than to list a list of\n       pairs. As JSON requires that keys must be of type string, rule 2 is the\n       weakest constraint one can pose on initializer lists to interpret them\n       as an object.\n    3. In all other cases, the initializer list could not be interpreted as\n       JSON object type, so interpreting it as JSON array type is safe.\n\n    With the rules described above, the following JSON values cannot be\n    expressed by an initializer list:\n\n    - the empty array (`[]`): use @ref array(initializer_list_t)\n      with an empty initializer list in this case\n    - arrays whose elements satisfy rule 2: use @ref\n      array(initializer_list_t) with the same initializer list\n      in this case\n\n    @note When used without parentheses around an empty initializer list, @ref\n    basic_json() is called instead of this function, yielding the JSON null\n    value.\n\n    @param[in] init  initializer list with JSON values\n\n    @param[in] type_deduction internal parameter; when set to `true`, the type\n    of the JSON value is deducted from the initializer list @a init; when set\n    to `false`, the type provided via @a manual_type is forced. This mode is\n    used by the functions @ref array(initializer_list_t) and\n    @ref object(initializer_list_t).\n\n    @param[in] manual_type internal parameter; when @a type_deduction is set\n    to `false`, the created JSON value will use the provided type (only @ref\n    value_t::array and @ref value_t::object are valid); when @a type_deduction\n    is set to `true`, this parameter has no effect\n\n    @throw type_error.301 if @a type_deduction is `false`, @a manual_type is\n    `value_t::object`, but @a init contains an element which is not a pair\n    whose first element is a string. In this case, the constructor could not\n    create an object. If @a type_deduction would have be `true`, an array\n    would have been created. See @ref object(initializer_list_t)\n    for an example.\n\n    @complexity Linear in the size of the initializer list @a init.\n\n    @exceptionsafety Strong guarantee: if an exception is thrown, there are no\n    changes to any JSON value.\n\n    @liveexample{The example below shows how JSON values are created from\n    initializer lists.,basic_json__list_init_t}\n\n    @sa @ref array(initializer_list_t) -- create a JSON array\n    value from an initializer list\n    @sa @ref object(initializer_list_t) -- create a JSON object\n    value from an initializer list\n\n    @since version 1.0.0\n    */\n    basic_json(initializer_list_t init,\n               bool type_deduction = true,\n               value_t manual_type = value_t::array)\n    {\n        // check if each element is an array with two elements whose first\n        // element is a string\n        bool is_an_object = std::all_of(init.begin(), init.end(),\n                                        [](const detail::json_ref<basic_json>& element_ref)\n        {\n            return element_ref->is_array() && element_ref->size() == 2 && (*element_ref)[0].is_string();\n        });\n\n        // adjust type if type deduction is not wanted\n        if (!type_deduction)\n        {\n            // if array is wanted, do not create an object though possible\n            if (manual_type == value_t::array)\n            {\n                is_an_object = false;\n            }\n\n            // if object is wanted but impossible, throw an exception\n            if (JSON_HEDLEY_UNLIKELY(manual_type == value_t::object && !is_an_object))\n            {\n                JSON_THROW(type_error::create(301, \"cannot create object from initializer list\"));\n            }\n        }\n\n        if (is_an_object)\n        {\n            // the initializer list is a list of pairs -> create object\n            m_type = value_t::object;\n            m_value = value_t::object;\n\n            std::for_each(init.begin(), init.end(), [this](const detail::json_ref<basic_json>& element_ref)\n            {\n                auto element = element_ref.moved_or_copied();\n                m_value.object->emplace(\n                    std::move(*((*element.m_value.array)[0].m_value.string)),\n                    std::move((*element.m_value.array)[1]));\n            });\n        }\n        else\n        {\n            // the initializer list describes an array -> create array\n            m_type = value_t::array;\n            m_value.array = create<array_t>(init.begin(), init.end());\n        }\n\n        assert_invariant();\n    }\n\n    /*!\n    @brief explicitly create a binary array (without subtype)\n\n    Creates a JSON binary array value from a given binary container. Binary\n    values are part of various binary formats, such as CBOR, MessagePack, and\n    BSON. This constructor is used to create a value for serialization to those\n    formats.\n\n    @note Note, this function exists because of the difficulty in correctly\n    specifying the correct template overload in the standard value ctor, as both\n    JSON arrays and JSON binary arrays are backed with some form of a\n    `std::vector`. Because JSON binary arrays are a non-standard extension it\n    was decided that it would be best to prevent automatic initialization of a\n    binary array type, for backwards compatibility and so it does not happen on\n    accident.\n\n    @param[in] init container containing bytes to use as binary type\n\n    @return JSON binary array value\n\n    @complexity Linear in the size of @a init.\n\n    @exceptionsafety Strong guarantee: if an exception is thrown, there are no\n    changes to any JSON value.\n\n    @since version 3.8.0\n    */\n    JSON_HEDLEY_WARN_UNUSED_RESULT\n    static basic_json binary(const typename binary_t::container_type& init)\n    {\n        auto res = basic_json();\n        res.m_type = value_t::binary;\n        res.m_value = init;\n        return res;\n    }\n\n    /*!\n    @brief explicitly create a binary array (with subtype)\n\n    Creates a JSON binary array value from a given binary container. Binary\n    values are part of various binary formats, such as CBOR, MessagePack, and\n    BSON. This constructor is used to create a value for serialization to those\n    formats.\n\n    @note Note, this function exists because of the difficulty in correctly\n    specifying the correct template overload in the standard value ctor, as both\n    JSON arrays and JSON binary arrays are backed with some form of a\n    `std::vector`. Because JSON binary arrays are a non-standard extension it\n    was decided that it would be best to prevent automatic initialization of a\n    binary array type, for backwards compatibility and so it does not happen on\n    accident.\n\n    @param[in] init container containing bytes to use as binary type\n    @param[in] subtype subtype to use in MessagePack and BSON\n\n    @return JSON binary array value\n\n    @complexity Linear in the size of @a init.\n\n    @exceptionsafety Strong guarantee: if an exception is thrown, there are no\n    changes to any JSON value.\n\n    @since version 3.8.0\n    */\n    JSON_HEDLEY_WARN_UNUSED_RESULT\n    static basic_json binary(const typename binary_t::container_type& init, std::uint8_t subtype)\n    {\n        auto res = basic_json();\n        res.m_type = value_t::binary;\n        res.m_value = binary_t(init, subtype);\n        return res;\n    }\n\n    /// @copydoc binary(const typename binary_t::container_type&)\n    JSON_HEDLEY_WARN_UNUSED_RESULT\n    static basic_json binary(typename binary_t::container_type&& init)\n    {\n        auto res = basic_json();\n        res.m_type = value_t::binary;\n        res.m_value = std::move(init);\n        return res;\n    }\n\n    /// @copydoc binary(const typename binary_t::container_type&, std::uint8_t)\n    JSON_HEDLEY_WARN_UNUSED_RESULT\n    static basic_json binary(typename binary_t::container_type&& init, std::uint8_t subtype)\n    {\n        auto res = basic_json();\n        res.m_type = value_t::binary;\n        res.m_value = binary_t(std::move(init), subtype);\n        return res;\n    }\n\n    /*!\n    @brief explicitly create an array from an initializer list\n\n    Creates a JSON array value from a given initializer list. That is, given a\n    list of values `a, b, c`, creates the JSON value `[a, b, c]`. If the\n    initializer list is empty, the empty array `[]` is created.\n\n    @note This function is only needed to express two edge cases that cannot\n    be realized with the initializer list constructor (@ref\n    basic_json(initializer_list_t, bool, value_t)). These cases\n    are:\n    1. creating an array whose elements are all pairs whose first element is a\n    string -- in this case, the initializer list constructor would create an\n    object, taking the first elements as keys\n    2. creating an empty array -- passing the empty initializer list to the\n    initializer list constructor yields an empty object\n\n    @param[in] init  initializer list with JSON values to create an array from\n    (optional)\n\n    @return JSON array value\n\n    @complexity Linear in the size of @a init.\n\n    @exceptionsafety Strong guarantee: if an exception is thrown, there are no\n    changes to any JSON value.\n\n    @liveexample{The following code shows an example for the `array`\n    function.,array}\n\n    @sa @ref basic_json(initializer_list_t, bool, value_t) --\n    create a JSON value from an initializer list\n    @sa @ref object(initializer_list_t) -- create a JSON object\n    value from an initializer list\n\n    @since version 1.0.0\n    */\n    JSON_HEDLEY_WARN_UNUSED_RESULT\n    static basic_json array(initializer_list_t init = {})\n    {\n        return basic_json(init, false, value_t::array);\n    }\n\n    /*!\n    @brief explicitly create an object from an initializer list\n\n    Creates a JSON object value from a given initializer list. The initializer\n    lists elements must be pairs, and their first elements must be strings. If\n    the initializer list is empty, the empty object `{}` is created.\n\n    @note This function is only added for symmetry reasons. In contrast to the\n    related function @ref array(initializer_list_t), there are\n    no cases which can only be expressed by this function. That is, any\n    initializer list @a init can also be passed to the initializer list\n    constructor @ref basic_json(initializer_list_t, bool, value_t).\n\n    @param[in] init  initializer list to create an object from (optional)\n\n    @return JSON object value\n\n    @throw type_error.301 if @a init is not a list of pairs whose first\n    elements are strings. In this case, no object can be created. When such a\n    value is passed to @ref basic_json(initializer_list_t, bool, value_t),\n    an array would have been created from the passed initializer list @a init.\n    See example below.\n\n    @complexity Linear in the size of @a init.\n\n    @exceptionsafety Strong guarantee: if an exception is thrown, there are no\n    changes to any JSON value.\n\n    @liveexample{The following code shows an example for the `object`\n    function.,object}\n\n    @sa @ref basic_json(initializer_list_t, bool, value_t) --\n    create a JSON value from an initializer list\n    @sa @ref array(initializer_list_t) -- create a JSON array\n    value from an initializer list\n\n    @since version 1.0.0\n    */\n    JSON_HEDLEY_WARN_UNUSED_RESULT\n    static basic_json object(initializer_list_t init = {})\n    {\n        return basic_json(init, false, value_t::object);\n    }\n\n    /*!\n    @brief construct an array with count copies of given value\n\n    Constructs a JSON array value by creating @a cnt copies of a passed value.\n    In case @a cnt is `0`, an empty array is created.\n\n    @param[in] cnt  the number of JSON copies of @a val to create\n    @param[in] val  the JSON value to copy\n\n    @post `std::distance(begin(),end()) == cnt` holds.\n\n    @complexity Linear in @a cnt.\n\n    @exceptionsafety Strong guarantee: if an exception is thrown, there are no\n    changes to any JSON value.\n\n    @liveexample{The following code shows examples for the @ref\n    basic_json(size_type\\, const basic_json&)\n    constructor.,basic_json__size_type_basic_json}\n\n    @since version 1.0.0\n    */\n    basic_json(size_type cnt, const basic_json& val)\n        : m_type(value_t::array)\n    {\n        m_value.array = create<array_t>(cnt, val);\n        assert_invariant();\n    }\n\n    /*!\n    @brief construct a JSON container given an iterator range\n\n    Constructs the JSON value with the contents of the range `[first, last)`.\n    The semantics depends on the different types a JSON value can have:\n    - In case of a null type, invalid_iterator.206 is thrown.\n    - In case of other primitive types (number, boolean, or string), @a first\n      must be `begin()` and @a last must be `end()`. In this case, the value is\n      copied. Otherwise, invalid_iterator.204 is thrown.\n    - In case of structured types (array, object), the constructor behaves as\n      similar versions for `std::vector` or `std::map`; that is, a JSON array\n      or object is constructed from the values in the range.\n\n    @tparam InputIT an input iterator type (@ref iterator or @ref\n    const_iterator)\n\n    @param[in] first begin of the range to copy from (included)\n    @param[in] last end of the range to copy from (excluded)\n\n    @pre Iterators @a first and @a last must be initialized. **This\n         precondition is enforced with an assertion (see warning).** If\n         assertions are switched off, a violation of this precondition yields\n         undefined behavior.\n\n    @pre Range `[first, last)` is valid. Usually, this precondition cannot be\n         checked efficiently. Only certain edge cases are detected; see the\n         description of the exceptions below. A violation of this precondition\n         yields undefined behavior.\n\n    @warning A precondition is enforced with a runtime assertion that will\n             result in calling `std::abort` if this precondition is not met.\n             Assertions can be disabled by defining `NDEBUG` at compile time.\n             See https://en.cppreference.com/w/cpp/error/assert for more\n             information.\n\n    @throw invalid_iterator.201 if iterators @a first and @a last are not\n    compatible (i.e., do not belong to the same JSON value). In this case,\n    the range `[first, last)` is undefined.\n    @throw invalid_iterator.204 if iterators @a first and @a last belong to a\n    primitive type (number, boolean, or string), but @a first does not point\n    to the first element any more. In this case, the range `[first, last)` is\n    undefined. See example code below.\n    @throw invalid_iterator.206 if iterators @a first and @a last belong to a\n    null value. In this case, the range `[first, last)` is undefined.\n\n    @complexity Linear in distance between @a first and @a last.\n\n    @exceptionsafety Strong guarantee: if an exception is thrown, there are no\n    changes to any JSON value.\n\n    @liveexample{The example below shows several ways to create JSON values by\n    specifying a subrange with iterators.,basic_json__InputIt_InputIt}\n\n    @since version 1.0.0\n    */\n    template < class InputIT, typename std::enable_if <\n                   std::is_same<InputIT, typename basic_json_t::iterator>::value ||\n                   std::is_same<InputIT, typename basic_json_t::const_iterator>::value, int >::type = 0 >\n    basic_json(InputIT first, InputIT last)\n    {\n        JSON_ASSERT(first.m_object != nullptr);\n        JSON_ASSERT(last.m_object != nullptr);\n\n        // make sure iterator fits the current value\n        if (JSON_HEDLEY_UNLIKELY(first.m_object != last.m_object))\n        {\n            JSON_THROW(invalid_iterator::create(201, \"iterators are not compatible\"));\n        }\n\n        // copy type from first iterator\n        m_type = first.m_object->m_type;\n\n        // check if iterator range is complete for primitive values\n        switch (m_type)\n        {\n            case value_t::boolean:\n            case value_t::number_float:\n            case value_t::number_integer:\n            case value_t::number_unsigned:\n            case value_t::string:\n            {\n                if (JSON_HEDLEY_UNLIKELY(!first.m_it.primitive_iterator.is_begin()\n                                         || !last.m_it.primitive_iterator.is_end()))\n                {\n                    JSON_THROW(invalid_iterator::create(204, \"iterators out of range\"));\n                }\n                break;\n            }\n\n            default:\n                break;\n        }\n\n        switch (m_type)\n        {\n            case value_t::number_integer:\n            {\n                m_value.number_integer = first.m_object->m_value.number_integer;\n                break;\n            }\n\n            case value_t::number_unsigned:\n            {\n                m_value.number_unsigned = first.m_object->m_value.number_unsigned;\n                break;\n            }\n\n            case value_t::number_float:\n            {\n                m_value.number_float = first.m_object->m_value.number_float;\n                break;\n            }\n\n            case value_t::boolean:\n            {\n                m_value.boolean = first.m_object->m_value.boolean;\n                break;\n            }\n\n            case value_t::string:\n            {\n                m_value = *first.m_object->m_value.string;\n                break;\n            }\n\n            case value_t::object:\n            {\n                m_value.object = create<object_t>(first.m_it.object_iterator,\n                                                  last.m_it.object_iterator);\n                break;\n            }\n\n            case value_t::array:\n            {\n                m_value.array = create<array_t>(first.m_it.array_iterator,\n                                                last.m_it.array_iterator);\n                break;\n            }\n\n            case value_t::binary:\n            {\n                m_value = *first.m_object->m_value.binary;\n                break;\n            }\n\n            default:\n                JSON_THROW(invalid_iterator::create(206, \"cannot construct with iterators from \" +\n                                                    std::string(first.m_object->type_name())));\n        }\n\n        assert_invariant();\n    }\n\n\n    ///////////////////////////////////////\n    // other constructors and destructor //\n    ///////////////////////////////////////\n\n    template<typename JsonRef,\n             detail::enable_if_t<detail::conjunction<detail::is_json_ref<JsonRef>,\n                                 std::is_same<typename JsonRef::value_type, basic_json>>::value, int> = 0 >\n    basic_json(const JsonRef& ref) : basic_json(ref.moved_or_copied()) {}\n\n    /*!\n    @brief copy constructor\n\n    Creates a copy of a given JSON value.\n\n    @param[in] other  the JSON value to copy\n\n    @post `*this == other`\n\n    @complexity Linear in the size of @a other.\n\n    @exceptionsafety Strong guarantee: if an exception is thrown, there are no\n    changes to any JSON value.\n\n    @requirement This function helps `basic_json` satisfying the\n    [Container](https://en.cppreference.com/w/cpp/named_req/Container)\n    requirements:\n    - The complexity is linear.\n    - As postcondition, it holds: `other == basic_json(other)`.\n\n    @liveexample{The following code shows an example for the copy\n    constructor.,basic_json__basic_json}\n\n    @since version 1.0.0\n    */\n    basic_json(const basic_json& other)\n        : m_type(other.m_type)\n    {\n        // check of passed value is valid\n        other.assert_invariant();\n\n        switch (m_type)\n        {\n            case value_t::object:\n            {\n                m_value = *other.m_value.object;\n                break;\n            }\n\n            case value_t::array:\n            {\n                m_value = *other.m_value.array;\n                break;\n            }\n\n            case value_t::string:\n            {\n                m_value = *other.m_value.string;\n                break;\n            }\n\n            case value_t::boolean:\n            {\n                m_value = other.m_value.boolean;\n                break;\n            }\n\n            case value_t::number_integer:\n            {\n                m_value = other.m_value.number_integer;\n                break;\n            }\n\n            case value_t::number_unsigned:\n            {\n                m_value = other.m_value.number_unsigned;\n                break;\n            }\n\n            case value_t::number_float:\n            {\n                m_value = other.m_value.number_float;\n                break;\n            }\n\n            case value_t::binary:\n            {\n                m_value = *other.m_value.binary;\n                break;\n            }\n\n            default:\n                break;\n        }\n\n        assert_invariant();\n    }\n\n    /*!\n    @brief move constructor\n\n    Move constructor. Constructs a JSON value with the contents of the given\n    value @a other using move semantics. It \"steals\" the resources from @a\n    other and leaves it as JSON null value.\n\n    @param[in,out] other  value to move to this object\n\n    @post `*this` has the same value as @a other before the call.\n    @post @a other is a JSON null value.\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this constructor never throws\n    exceptions.\n\n    @requirement This function helps `basic_json` satisfying the\n    [MoveConstructible](https://en.cppreference.com/w/cpp/named_req/MoveConstructible)\n    requirements.\n\n    @liveexample{The code below shows the move constructor explicitly called\n    via std::move.,basic_json__moveconstructor}\n\n    @since version 1.0.0\n    */\n    basic_json(basic_json&& other) noexcept\n        : m_type(std::move(other.m_type)),\n          m_value(std::move(other.m_value))\n    {\n        // check that passed value is valid\n        other.assert_invariant();\n\n        // invalidate payload\n        other.m_type = value_t::null;\n        other.m_value = {};\n\n        assert_invariant();\n    }\n\n    /*!\n    @brief copy assignment\n\n    Copy assignment operator. Copies a JSON value via the \"copy and swap\"\n    strategy: It is expressed in terms of the copy constructor, destructor,\n    and the `swap()` member function.\n\n    @param[in] other  value to copy from\n\n    @complexity Linear.\n\n    @requirement This function helps `basic_json` satisfying the\n    [Container](https://en.cppreference.com/w/cpp/named_req/Container)\n    requirements:\n    - The complexity is linear.\n\n    @liveexample{The code below shows and example for the copy assignment. It\n    creates a copy of value `a` which is then swapped with `b`. Finally\\, the\n    copy of `a` (which is the null value after the swap) is\n    destroyed.,basic_json__copyassignment}\n\n    @since version 1.0.0\n    */\n    basic_json& operator=(basic_json other) noexcept (\n        std::is_nothrow_move_constructible<value_t>::value&&\n        std::is_nothrow_move_assignable<value_t>::value&&\n        std::is_nothrow_move_constructible<json_value>::value&&\n        std::is_nothrow_move_assignable<json_value>::value\n    )\n    {\n        // check that passed value is valid\n        other.assert_invariant();\n\n        using std::swap;\n        swap(m_type, other.m_type);\n        swap(m_value, other.m_value);\n\n        assert_invariant();\n        return *this;\n    }\n\n    /*!\n    @brief destructor\n\n    Destroys the JSON value and frees all allocated memory.\n\n    @complexity Linear.\n\n    @requirement This function helps `basic_json` satisfying the\n    [Container](https://en.cppreference.com/w/cpp/named_req/Container)\n    requirements:\n    - The complexity is linear.\n    - All stored elements are destroyed and all memory is freed.\n\n    @since version 1.0.0\n    */\n    ~basic_json() noexcept\n    {\n        assert_invariant();\n        m_value.destroy(m_type);\n    }\n\n    /// @}\n\n  public:\n    ///////////////////////\n    // object inspection //\n    ///////////////////////\n\n    /// @name object inspection\n    /// Functions to inspect the type of a JSON value.\n    /// @{\n\n    /*!\n    @brief serialization\n\n    Serialization function for JSON values. The function tries to mimic\n    Python's `json.dumps()` function, and currently supports its @a indent\n    and @a ensure_ascii parameters.\n\n    @param[in] indent If indent is nonnegative, then array elements and object\n    members will be pretty-printed with that indent level. An indent level of\n    `0` will only insert newlines. `-1` (the default) selects the most compact\n    representation.\n    @param[in] indent_char The character to use for indentation if @a indent is\n    greater than `0`. The default is ` ` (space).\n    @param[in] ensure_ascii If @a ensure_ascii is true, all non-ASCII characters\n    in the output are escaped with `\\uXXXX` sequences, and the result consists\n    of ASCII characters only.\n    @param[in] error_handler  how to react on decoding errors; there are three\n    possible values: `strict` (throws and exception in case a decoding error\n    occurs; default), `replace` (replace invalid UTF-8 sequences with U+FFFD),\n    and `ignore` (ignore invalid UTF-8 sequences during serialization; all\n    bytes are copied to the output unchanged).\n\n    @return string containing the serialization of the JSON value\n\n    @throw type_error.316 if a string stored inside the JSON value is not\n                          UTF-8 encoded and @a error_handler is set to strict\n\n    @note Binary values are serialized as object containing two keys:\n      - \"bytes\": an array of bytes as integers\n      - \"subtype\": the subtype as integer or \"null\" if the binary has no subtype\n\n    @complexity Linear.\n\n    @exceptionsafety Strong guarantee: if an exception is thrown, there are no\n    changes in the JSON value.\n\n    @liveexample{The following example shows the effect of different @a indent\\,\n    @a indent_char\\, and @a ensure_ascii parameters to the result of the\n    serialization.,dump}\n\n    @see https://docs.python.org/2/library/json.html#json.dump\n\n    @since version 1.0.0; indentation character @a indent_char, option\n           @a ensure_ascii and exceptions added in version 3.0.0; error\n           handlers added in version 3.4.0; serialization of binary values added\n           in version 3.8.0.\n    */\n    string_t dump(const int indent = -1,\n                  const char indent_char = ' ',\n                  const bool ensure_ascii = false,\n                  const error_handler_t error_handler = error_handler_t::strict) const\n    {\n        string_t result;\n        serializer s(detail::output_adapter<char, string_t>(result), indent_char, error_handler);\n\n        if (indent >= 0)\n        {\n            s.dump(*this, true, ensure_ascii, static_cast<unsigned int>(indent));\n        }\n        else\n        {\n            s.dump(*this, false, ensure_ascii, 0);\n        }\n\n        return result;\n    }\n\n    /*!\n    @brief return the type of the JSON value (explicit)\n\n    Return the type of the JSON value as a value from the @ref value_t\n    enumeration.\n\n    @return the type of the JSON value\n            Value type                | return value\n            ------------------------- | -------------------------\n            null                      | value_t::null\n            boolean                   | value_t::boolean\n            string                    | value_t::string\n            number (integer)          | value_t::number_integer\n            number (unsigned integer) | value_t::number_unsigned\n            number (floating-point)   | value_t::number_float\n            object                    | value_t::object\n            array                     | value_t::array\n            binary                    | value_t::binary\n            discarded                 | value_t::discarded\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this member function never throws\n    exceptions.\n\n    @liveexample{The following code exemplifies `type()` for all JSON\n    types.,type}\n\n    @sa @ref operator value_t() -- return the type of the JSON value (implicit)\n    @sa @ref type_name() -- return the type as string\n\n    @since version 1.0.0\n    */\n    constexpr value_t type() const noexcept\n    {\n        return m_type;\n    }\n\n    /*!\n    @brief return whether type is primitive\n\n    This function returns true if and only if the JSON type is primitive\n    (string, number, boolean, or null).\n\n    @return `true` if type is primitive (string, number, boolean, or null),\n    `false` otherwise.\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this member function never throws\n    exceptions.\n\n    @liveexample{The following code exemplifies `is_primitive()` for all JSON\n    types.,is_primitive}\n\n    @sa @ref is_structured() -- returns whether JSON value is structured\n    @sa @ref is_null() -- returns whether JSON value is `null`\n    @sa @ref is_string() -- returns whether JSON value is a string\n    @sa @ref is_boolean() -- returns whether JSON value is a boolean\n    @sa @ref is_number() -- returns whether JSON value is a number\n    @sa @ref is_binary() -- returns whether JSON value is a binary array\n\n    @since version 1.0.0\n    */\n    constexpr bool is_primitive() const noexcept\n    {\n        return is_null() || is_string() || is_boolean() || is_number() || is_binary();\n    }\n\n    /*!\n    @brief return whether type is structured\n\n    This function returns true if and only if the JSON type is structured\n    (array or object).\n\n    @return `true` if type is structured (array or object), `false` otherwise.\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this member function never throws\n    exceptions.\n\n    @liveexample{The following code exemplifies `is_structured()` for all JSON\n    types.,is_structured}\n\n    @sa @ref is_primitive() -- returns whether value is primitive\n    @sa @ref is_array() -- returns whether value is an array\n    @sa @ref is_object() -- returns whether value is an object\n\n    @since version 1.0.0\n    */\n    constexpr bool is_structured() const noexcept\n    {\n        return is_array() || is_object();\n    }\n\n    /*!\n    @brief return whether value is null\n\n    This function returns true if and only if the JSON value is null.\n\n    @return `true` if type is null, `false` otherwise.\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this member function never throws\n    exceptions.\n\n    @liveexample{The following code exemplifies `is_null()` for all JSON\n    types.,is_null}\n\n    @since version 1.0.0\n    */\n    constexpr bool is_null() const noexcept\n    {\n        return m_type == value_t::null;\n    }\n\n    /*!\n    @brief return whether value is a boolean\n\n    This function returns true if and only if the JSON value is a boolean.\n\n    @return `true` if type is boolean, `false` otherwise.\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this member function never throws\n    exceptions.\n\n    @liveexample{The following code exemplifies `is_boolean()` for all JSON\n    types.,is_boolean}\n\n    @since version 1.0.0\n    */\n    constexpr bool is_boolean() const noexcept\n    {\n        return m_type == value_t::boolean;\n    }\n\n    /*!\n    @brief return whether value is a number\n\n    This function returns true if and only if the JSON value is a number. This\n    includes both integer (signed and unsigned) and floating-point values.\n\n    @return `true` if type is number (regardless whether integer, unsigned\n    integer or floating-type), `false` otherwise.\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this member function never throws\n    exceptions.\n\n    @liveexample{The following code exemplifies `is_number()` for all JSON\n    types.,is_number}\n\n    @sa @ref is_number_integer() -- check if value is an integer or unsigned\n    integer number\n    @sa @ref is_number_unsigned() -- check if value is an unsigned integer\n    number\n    @sa @ref is_number_float() -- check if value is a floating-point number\n\n    @since version 1.0.0\n    */\n    constexpr bool is_number() const noexcept\n    {\n        return is_number_integer() || is_number_float();\n    }\n\n    /*!\n    @brief return whether value is an integer number\n\n    This function returns true if and only if the JSON value is a signed or\n    unsigned integer number. This excludes floating-point values.\n\n    @return `true` if type is an integer or unsigned integer number, `false`\n    otherwise.\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this member function never throws\n    exceptions.\n\n    @liveexample{The following code exemplifies `is_number_integer()` for all\n    JSON types.,is_number_integer}\n\n    @sa @ref is_number() -- check if value is a number\n    @sa @ref is_number_unsigned() -- check if value is an unsigned integer\n    number\n    @sa @ref is_number_float() -- check if value is a floating-point number\n\n    @since version 1.0.0\n    */\n    constexpr bool is_number_integer() const noexcept\n    {\n        return m_type == value_t::number_integer || m_type == value_t::number_unsigned;\n    }\n\n    /*!\n    @brief return whether value is an unsigned integer number\n\n    This function returns true if and only if the JSON value is an unsigned\n    integer number. This excludes floating-point and signed integer values.\n\n    @return `true` if type is an unsigned integer number, `false` otherwise.\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this member function never throws\n    exceptions.\n\n    @liveexample{The following code exemplifies `is_number_unsigned()` for all\n    JSON types.,is_number_unsigned}\n\n    @sa @ref is_number() -- check if value is a number\n    @sa @ref is_number_integer() -- check if value is an integer or unsigned\n    integer number\n    @sa @ref is_number_float() -- check if value is a floating-point number\n\n    @since version 2.0.0\n    */\n    constexpr bool is_number_unsigned() const noexcept\n    {\n        return m_type == value_t::number_unsigned;\n    }\n\n    /*!\n    @brief return whether value is a floating-point number\n\n    This function returns true if and only if the JSON value is a\n    floating-point number. This excludes signed and unsigned integer values.\n\n    @return `true` if type is a floating-point number, `false` otherwise.\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this member function never throws\n    exceptions.\n\n    @liveexample{The following code exemplifies `is_number_float()` for all\n    JSON types.,is_number_float}\n\n    @sa @ref is_number() -- check if value is number\n    @sa @ref is_number_integer() -- check if value is an integer number\n    @sa @ref is_number_unsigned() -- check if value is an unsigned integer\n    number\n\n    @since version 1.0.0\n    */\n    constexpr bool is_number_float() const noexcept\n    {\n        return m_type == value_t::number_float;\n    }\n\n    /*!\n    @brief return whether value is an object\n\n    This function returns true if and only if the JSON value is an object.\n\n    @return `true` if type is object, `false` otherwise.\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this member function never throws\n    exceptions.\n\n    @liveexample{The following code exemplifies `is_object()` for all JSON\n    types.,is_object}\n\n    @since version 1.0.0\n    */\n    constexpr bool is_object() const noexcept\n    {\n        return m_type == value_t::object;\n    }\n\n    /*!\n    @brief return whether value is an array\n\n    This function returns true if and only if the JSON value is an array.\n\n    @return `true` if type is array, `false` otherwise.\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this member function never throws\n    exceptions.\n\n    @liveexample{The following code exemplifies `is_array()` for all JSON\n    types.,is_array}\n\n    @since version 1.0.0\n    */\n    constexpr bool is_array() const noexcept\n    {\n        return m_type == value_t::array;\n    }\n\n    /*!\n    @brief return whether value is a string\n\n    This function returns true if and only if the JSON value is a string.\n\n    @return `true` if type is string, `false` otherwise.\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this member function never throws\n    exceptions.\n\n    @liveexample{The following code exemplifies `is_string()` for all JSON\n    types.,is_string}\n\n    @since version 1.0.0\n    */\n    constexpr bool is_string() const noexcept\n    {\n        return m_type == value_t::string;\n    }\n\n    /*!\n    @brief return whether value is a binary array\n\n    This function returns true if and only if the JSON value is a binary array.\n\n    @return `true` if type is binary array, `false` otherwise.\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this member function never throws\n    exceptions.\n\n    @liveexample{The following code exemplifies `is_binary()` for all JSON\n    types.,is_binary}\n\n    @since version 3.8.0\n    */\n    constexpr bool is_binary() const noexcept\n    {\n        return m_type == value_t::binary;\n    }\n\n    /*!\n    @brief return whether value is discarded\n\n    This function returns true if and only if the JSON value was discarded\n    during parsing with a callback function (see @ref parser_callback_t).\n\n    @note This function will always be `false` for JSON values after parsing.\n    That is, discarded values can only occur during parsing, but will be\n    removed when inside a structured value or replaced by null in other cases.\n\n    @return `true` if type is discarded, `false` otherwise.\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this member function never throws\n    exceptions.\n\n    @liveexample{The following code exemplifies `is_discarded()` for all JSON\n    types.,is_discarded}\n\n    @since version 1.0.0\n    */\n    constexpr bool is_discarded() const noexcept\n    {\n        return m_type == value_t::discarded;\n    }\n\n    /*!\n    @brief return the type of the JSON value (implicit)\n\n    Implicitly return the type of the JSON value as a value from the @ref\n    value_t enumeration.\n\n    @return the type of the JSON value\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this member function never throws\n    exceptions.\n\n    @liveexample{The following code exemplifies the @ref value_t operator for\n    all JSON types.,operator__value_t}\n\n    @sa @ref type() -- return the type of the JSON value (explicit)\n    @sa @ref type_name() -- return the type as string\n\n    @since version 1.0.0\n    */\n    constexpr operator value_t() const noexcept\n    {\n        return m_type;\n    }\n\n    /// @}\n\n  private:\n    //////////////////\n    // value access //\n    //////////////////\n\n    /// get a boolean (explicit)\n    boolean_t get_impl(boolean_t* /*unused*/) const\n    {\n        if (JSON_HEDLEY_LIKELY(is_boolean()))\n        {\n            return m_value.boolean;\n        }\n\n        JSON_THROW(type_error::create(302, \"type must be boolean, but is \" + std::string(type_name())));\n    }\n\n    /// get a pointer to the value (object)\n    object_t* get_impl_ptr(object_t* /*unused*/) noexcept\n    {\n        return is_object() ? m_value.object : nullptr;\n    }\n\n    /// get a pointer to the value (object)\n    constexpr const object_t* get_impl_ptr(const object_t* /*unused*/) const noexcept\n    {\n        return is_object() ? m_value.object : nullptr;\n    }\n\n    /// get a pointer to the value (array)\n    array_t* get_impl_ptr(array_t* /*unused*/) noexcept\n    {\n        return is_array() ? m_value.array : nullptr;\n    }\n\n    /// get a pointer to the value (array)\n    constexpr const array_t* get_impl_ptr(const array_t* /*unused*/) const noexcept\n    {\n        return is_array() ? m_value.array : nullptr;\n    }\n\n    /// get a pointer to the value (string)\n    string_t* get_impl_ptr(string_t* /*unused*/) noexcept\n    {\n        return is_string() ? m_value.string : nullptr;\n    }\n\n    /// get a pointer to the value (string)\n    constexpr const string_t* get_impl_ptr(const string_t* /*unused*/) const noexcept\n    {\n        return is_string() ? m_value.string : nullptr;\n    }\n\n    /// get a pointer to the value (boolean)\n    boolean_t* get_impl_ptr(boolean_t* /*unused*/) noexcept\n    {\n        return is_boolean() ? &m_value.boolean : nullptr;\n    }\n\n    /// get a pointer to the value (boolean)\n    constexpr const boolean_t* get_impl_ptr(const boolean_t* /*unused*/) const noexcept\n    {\n        return is_boolean() ? &m_value.boolean : nullptr;\n    }\n\n    /// get a pointer to the value (integer number)\n    number_integer_t* get_impl_ptr(number_integer_t* /*unused*/) noexcept\n    {\n        return is_number_integer() ? &m_value.number_integer : nullptr;\n    }\n\n    /// get a pointer to the value (integer number)\n    constexpr const number_integer_t* get_impl_ptr(const number_integer_t* /*unused*/) const noexcept\n    {\n        return is_number_integer() ? &m_value.number_integer : nullptr;\n    }\n\n    /// get a pointer to the value (unsigned number)\n    number_unsigned_t* get_impl_ptr(number_unsigned_t* /*unused*/) noexcept\n    {\n        return is_number_unsigned() ? &m_value.number_unsigned : nullptr;\n    }\n\n    /// get a pointer to the value (unsigned number)\n    constexpr const number_unsigned_t* get_impl_ptr(const number_unsigned_t* /*unused*/) const noexcept\n    {\n        return is_number_unsigned() ? &m_value.number_unsigned : nullptr;\n    }\n\n    /// get a pointer to the value (floating-point number)\n    number_float_t* get_impl_ptr(number_float_t* /*unused*/) noexcept\n    {\n        return is_number_float() ? &m_value.number_float : nullptr;\n    }\n\n    /// get a pointer to the value (floating-point number)\n    constexpr const number_float_t* get_impl_ptr(const number_float_t* /*unused*/) const noexcept\n    {\n        return is_number_float() ? &m_value.number_float : nullptr;\n    }\n\n    /// get a pointer to the value (binary)\n    binary_t* get_impl_ptr(binary_t* /*unused*/) noexcept\n    {\n        return is_binary() ? m_value.binary : nullptr;\n    }\n\n    /// get a pointer to the value (binary)\n    constexpr const binary_t* get_impl_ptr(const binary_t* /*unused*/) const noexcept\n    {\n        return is_binary() ? m_value.binary : nullptr;\n    }\n\n    /*!\n    @brief helper function to implement get_ref()\n\n    This function helps to implement get_ref() without code duplication for\n    const and non-const overloads\n\n    @tparam ThisType will be deduced as `basic_json` or `const basic_json`\n\n    @throw type_error.303 if ReferenceType does not match underlying value\n    type of the current JSON\n    */\n    template<typename ReferenceType, typename ThisType>\n    static ReferenceType get_ref_impl(ThisType& obj)\n    {\n        // delegate the call to get_ptr<>()\n        auto ptr = obj.template get_ptr<typename std::add_pointer<ReferenceType>::type>();\n\n        if (JSON_HEDLEY_LIKELY(ptr != nullptr))\n        {\n            return *ptr;\n        }\n\n        JSON_THROW(type_error::create(303, \"incompatible ReferenceType for get_ref, actual type is \" + std::string(obj.type_name())));\n    }\n\n  public:\n    /// @name value access\n    /// Direct access to the stored value of a JSON value.\n    /// @{\n\n    /*!\n    @brief get special-case overload\n\n    This overloads avoids a lot of template boilerplate, it can be seen as the\n    identity method\n\n    @tparam BasicJsonType == @ref basic_json\n\n    @return a copy of *this\n\n    @complexity Constant.\n\n    @since version 2.1.0\n    */\n    template<typename BasicJsonType, detail::enable_if_t<\n                 std::is_same<typename std::remove_const<BasicJsonType>::type, basic_json_t>::value,\n                 int> = 0>\n    basic_json get() const\n    {\n        return *this;\n    }\n\n    /*!\n    @brief get special-case overload\n\n    This overloads converts the current @ref basic_json in a different\n    @ref basic_json type\n\n    @tparam BasicJsonType == @ref basic_json\n\n    @return a copy of *this, converted into @tparam BasicJsonType\n\n    @complexity Depending on the implementation of the called `from_json()`\n                method.\n\n    @since version 3.2.0\n    */\n    template < typename BasicJsonType, detail::enable_if_t <\n                   !std::is_same<BasicJsonType, basic_json>::value&&\n                   detail::is_basic_json<BasicJsonType>::value, int > = 0 >\n    BasicJsonType get() const\n    {\n        return *this;\n    }\n\n    /*!\n    @brief get a value (explicit)\n\n    Explicit type conversion between the JSON value and a compatible value\n    which is [CopyConstructible](https://en.cppreference.com/w/cpp/named_req/CopyConstructible)\n    and [DefaultConstructible](https://en.cppreference.com/w/cpp/named_req/DefaultConstructible).\n    The value is converted by calling the @ref json_serializer<ValueType>\n    `from_json()` method.\n\n    The function is equivalent to executing\n    @code {.cpp}\n    ValueType ret;\n    JSONSerializer<ValueType>::from_json(*this, ret);\n    return ret;\n    @endcode\n\n    This overloads is chosen if:\n    - @a ValueType is not @ref basic_json,\n    - @ref json_serializer<ValueType> has a `from_json()` method of the form\n      `void from_json(const basic_json&, ValueType&)`, and\n    - @ref json_serializer<ValueType> does not have a `from_json()` method of\n      the form `ValueType from_json(const basic_json&)`\n\n    @tparam ValueTypeCV the provided value type\n    @tparam ValueType the returned value type\n\n    @return copy of the JSON value, converted to @a ValueType\n\n    @throw what @ref json_serializer<ValueType> `from_json()` method throws\n\n    @liveexample{The example below shows several conversions from JSON values\n    to other types. There a few things to note: (1) Floating-point numbers can\n    be converted to integers\\, (2) A JSON array can be converted to a standard\n    `std::vector<short>`\\, (3) A JSON object can be converted to C++\n    associative containers such as `std::unordered_map<std::string\\,\n    json>`.,get__ValueType_const}\n\n    @since version 2.1.0\n    */\n    template < typename ValueTypeCV, typename ValueType = detail::uncvref_t<ValueTypeCV>,\n               detail::enable_if_t <\n                   !detail::is_basic_json<ValueType>::value &&\n                   detail::has_from_json<basic_json_t, ValueType>::value &&\n                   !detail::has_non_default_from_json<basic_json_t, ValueType>::value,\n                   int > = 0 >\n    ValueType get() const noexcept(noexcept(\n                                       JSONSerializer<ValueType>::from_json(std::declval<const basic_json_t&>(), std::declval<ValueType&>())))\n    {\n        // we cannot static_assert on ValueTypeCV being non-const, because\n        // there is support for get<const basic_json_t>(), which is why we\n        // still need the uncvref\n        static_assert(!std::is_reference<ValueTypeCV>::value,\n                      \"get() cannot be used with reference types, you might want to use get_ref()\");\n        static_assert(std::is_default_constructible<ValueType>::value,\n                      \"types must be DefaultConstructible when used with get()\");\n\n        ValueType ret;\n        JSONSerializer<ValueType>::from_json(*this, ret);\n        return ret;\n    }\n\n    /*!\n    @brief get a value (explicit); special case\n\n    Explicit type conversion between the JSON value and a compatible value\n    which is **not** [CopyConstructible](https://en.cppreference.com/w/cpp/named_req/CopyConstructible)\n    and **not** [DefaultConstructible](https://en.cppreference.com/w/cpp/named_req/DefaultConstructible).\n    The value is converted by calling the @ref json_serializer<ValueType>\n    `from_json()` method.\n\n    The function is equivalent to executing\n    @code {.cpp}\n    return JSONSerializer<ValueTypeCV>::from_json(*this);\n    @endcode\n\n    This overloads is chosen if:\n    - @a ValueType is not @ref basic_json and\n    - @ref json_serializer<ValueType> has a `from_json()` method of the form\n      `ValueType from_json(const basic_json&)`\n\n    @note If @ref json_serializer<ValueType> has both overloads of\n    `from_json()`, this one is chosen.\n\n    @tparam ValueTypeCV the provided value type\n    @tparam ValueType the returned value type\n\n    @return copy of the JSON value, converted to @a ValueType\n\n    @throw what @ref json_serializer<ValueType> `from_json()` method throws\n\n    @since version 2.1.0\n    */\n    template < typename ValueTypeCV, typename ValueType = detail::uncvref_t<ValueTypeCV>,\n               detail::enable_if_t < !std::is_same<basic_json_t, ValueType>::value &&\n                                     detail::has_non_default_from_json<basic_json_t, ValueType>::value,\n                                     int > = 0 >\n    ValueType get() const noexcept(noexcept(\n                                       JSONSerializer<ValueType>::from_json(std::declval<const basic_json_t&>())))\n    {\n        static_assert(!std::is_reference<ValueTypeCV>::value,\n                      \"get() cannot be used with reference types, you might want to use get_ref()\");\n        return JSONSerializer<ValueType>::from_json(*this);\n    }\n\n    /*!\n    @brief get a value (explicit)\n\n    Explicit type conversion between the JSON value and a compatible value.\n    The value is filled into the input parameter by calling the @ref json_serializer<ValueType>\n    `from_json()` method.\n\n    The function is equivalent to executing\n    @code {.cpp}\n    ValueType v;\n    JSONSerializer<ValueType>::from_json(*this, v);\n    @endcode\n\n    This overloads is chosen if:\n    - @a ValueType is not @ref basic_json,\n    - @ref json_serializer<ValueType> has a `from_json()` method of the form\n      `void from_json(const basic_json&, ValueType&)`, and\n\n    @tparam ValueType the input parameter type.\n\n    @return the input parameter, allowing chaining calls.\n\n    @throw what @ref json_serializer<ValueType> `from_json()` method throws\n\n    @liveexample{The example below shows several conversions from JSON values\n    to other types. There a few things to note: (1) Floating-point numbers can\n    be converted to integers\\, (2) A JSON array can be converted to a standard\n    `std::vector<short>`\\, (3) A JSON object can be converted to C++\n    associative containers such as `std::unordered_map<std::string\\,\n    json>`.,get_to}\n\n    @since version 3.3.0\n    */\n    template < typename ValueType,\n               detail::enable_if_t <\n                   !detail::is_basic_json<ValueType>::value&&\n                   detail::has_from_json<basic_json_t, ValueType>::value,\n                   int > = 0 >\n    ValueType & get_to(ValueType& v) const noexcept(noexcept(\n                JSONSerializer<ValueType>::from_json(std::declval<const basic_json_t&>(), v)))\n    {\n        JSONSerializer<ValueType>::from_json(*this, v);\n        return v;\n    }\n\n    // specialization to allow to call get_to with a basic_json value\n    // see https://github.com/nlohmann/json/issues/2175\n    template<typename ValueType,\n             detail::enable_if_t <\n                 detail::is_basic_json<ValueType>::value,\n                 int> = 0>\n    ValueType & get_to(ValueType& v) const\n    {\n        v = *this;\n        return v;\n    }\n\n    template <\n        typename T, std::size_t N,\n        typename Array = T (&)[N],\n        detail::enable_if_t <\n            detail::has_from_json<basic_json_t, Array>::value, int > = 0 >\n    Array get_to(T (&v)[N]) const\n    noexcept(noexcept(JSONSerializer<Array>::from_json(\n                          std::declval<const basic_json_t&>(), v)))\n    {\n        JSONSerializer<Array>::from_json(*this, v);\n        return v;\n    }\n\n\n    /*!\n    @brief get a pointer value (implicit)\n\n    Implicit pointer access to the internally stored JSON value. No copies are\n    made.\n\n    @warning Writing data to the pointee of the result yields an undefined\n    state.\n\n    @tparam PointerType pointer type; must be a pointer to @ref array_t, @ref\n    object_t, @ref string_t, @ref boolean_t, @ref number_integer_t,\n    @ref number_unsigned_t, or @ref number_float_t. Enforced by a static\n    assertion.\n\n    @return pointer to the internally stored JSON value if the requested\n    pointer type @a PointerType fits to the JSON value; `nullptr` otherwise\n\n    @complexity Constant.\n\n    @liveexample{The example below shows how pointers to internal values of a\n    JSON value can be requested. Note that no type conversions are made and a\n    `nullptr` is returned if the value and the requested pointer type does not\n    match.,get_ptr}\n\n    @since version 1.0.0\n    */\n    template<typename PointerType, typename std::enable_if<\n                 std::is_pointer<PointerType>::value, int>::type = 0>\n    auto get_ptr() noexcept -> decltype(std::declval<basic_json_t&>().get_impl_ptr(std::declval<PointerType>()))\n    {\n        // delegate the call to get_impl_ptr<>()\n        return get_impl_ptr(static_cast<PointerType>(nullptr));\n    }\n\n    /*!\n    @brief get a pointer value (implicit)\n    @copydoc get_ptr()\n    */\n    template < typename PointerType, typename std::enable_if <\n                   std::is_pointer<PointerType>::value&&\n                   std::is_const<typename std::remove_pointer<PointerType>::type>::value, int >::type = 0 >\n    constexpr auto get_ptr() const noexcept -> decltype(std::declval<const basic_json_t&>().get_impl_ptr(std::declval<PointerType>()))\n    {\n        // delegate the call to get_impl_ptr<>() const\n        return get_impl_ptr(static_cast<PointerType>(nullptr));\n    }\n\n    /*!\n    @brief get a pointer value (explicit)\n\n    Explicit pointer access to the internally stored JSON value. No copies are\n    made.\n\n    @warning The pointer becomes invalid if the underlying JSON object\n    changes.\n\n    @tparam PointerType pointer type; must be a pointer to @ref array_t, @ref\n    object_t, @ref string_t, @ref boolean_t, @ref number_integer_t,\n    @ref number_unsigned_t, or @ref number_float_t.\n\n    @return pointer to the internally stored JSON value if the requested\n    pointer type @a PointerType fits to the JSON value; `nullptr` otherwise\n\n    @complexity Constant.\n\n    @liveexample{The example below shows how pointers to internal values of a\n    JSON value can be requested. Note that no type conversions are made and a\n    `nullptr` is returned if the value and the requested pointer type does not\n    match.,get__PointerType}\n\n    @sa @ref get_ptr() for explicit pointer-member access\n\n    @since version 1.0.0\n    */\n    template<typename PointerType, typename std::enable_if<\n                 std::is_pointer<PointerType>::value, int>::type = 0>\n    auto get() noexcept -> decltype(std::declval<basic_json_t&>().template get_ptr<PointerType>())\n    {\n        // delegate the call to get_ptr\n        return get_ptr<PointerType>();\n    }\n\n    /*!\n    @brief get a pointer value (explicit)\n    @copydoc get()\n    */\n    template<typename PointerType, typename std::enable_if<\n                 std::is_pointer<PointerType>::value, int>::type = 0>\n    constexpr auto get() const noexcept -> decltype(std::declval<const basic_json_t&>().template get_ptr<PointerType>())\n    {\n        // delegate the call to get_ptr\n        return get_ptr<PointerType>();\n    }\n\n    /*!\n    @brief get a reference value (implicit)\n\n    Implicit reference access to the internally stored JSON value. No copies\n    are made.\n\n    @warning Writing data to the referee of the result yields an undefined\n    state.\n\n    @tparam ReferenceType reference type; must be a reference to @ref array_t,\n    @ref object_t, @ref string_t, @ref boolean_t, @ref number_integer_t, or\n    @ref number_float_t. Enforced by static assertion.\n\n    @return reference to the internally stored JSON value if the requested\n    reference type @a ReferenceType fits to the JSON value; throws\n    type_error.303 otherwise\n\n    @throw type_error.303 in case passed type @a ReferenceType is incompatible\n    with the stored JSON value; see example below\n\n    @complexity Constant.\n\n    @liveexample{The example shows several calls to `get_ref()`.,get_ref}\n\n    @since version 1.1.0\n    */\n    template<typename ReferenceType, typename std::enable_if<\n                 std::is_reference<ReferenceType>::value, int>::type = 0>\n    ReferenceType get_ref()\n    {\n        // delegate call to get_ref_impl\n        return get_ref_impl<ReferenceType>(*this);\n    }\n\n    /*!\n    @brief get a reference value (implicit)\n    @copydoc get_ref()\n    */\n    template < typename ReferenceType, typename std::enable_if <\n                   std::is_reference<ReferenceType>::value&&\n                   std::is_const<typename std::remove_reference<ReferenceType>::type>::value, int >::type = 0 >\n    ReferenceType get_ref() const\n    {\n        // delegate call to get_ref_impl\n        return get_ref_impl<ReferenceType>(*this);\n    }\n\n    /*!\n    @brief get a value (implicit)\n\n    Implicit type conversion between the JSON value and a compatible value.\n    The call is realized by calling @ref get() const.\n\n    @tparam ValueType non-pointer type compatible to the JSON value, for\n    instance `int` for JSON integer numbers, `bool` for JSON booleans, or\n    `std::vector` types for JSON arrays. The character type of @ref string_t\n    as well as an initializer list of this type is excluded to avoid\n    ambiguities as these types implicitly convert to `std::string`.\n\n    @return copy of the JSON value, converted to type @a ValueType\n\n    @throw type_error.302 in case passed type @a ValueType is incompatible\n    to the JSON value type (e.g., the JSON value is of type boolean, but a\n    string is requested); see example below\n\n    @complexity Linear in the size of the JSON value.\n\n    @liveexample{The example below shows several conversions from JSON values\n    to other types. There a few things to note: (1) Floating-point numbers can\n    be converted to integers\\, (2) A JSON array can be converted to a standard\n    `std::vector<short>`\\, (3) A JSON object can be converted to C++\n    associative containers such as `std::unordered_map<std::string\\,\n    json>`.,operator__ValueType}\n\n    @since version 1.0.0\n    */\n    template < typename ValueType, typename std::enable_if <\n                   !std::is_pointer<ValueType>::value&&\n                   !std::is_same<ValueType, detail::json_ref<basic_json>>::value&&\n                   !std::is_same<ValueType, typename string_t::value_type>::value&&\n                   !detail::is_basic_json<ValueType>::value\n                   && !std::is_same<ValueType, std::initializer_list<typename string_t::value_type>>::value\n#if defined(JSON_HAS_CPP_17) && (defined(__GNUC__) || (defined(_MSC_VER) && _MSC_VER >= 1910 && _MSC_VER <= 1914))\n                   && !std::is_same<ValueType, typename std::string_view>::value\n#endif\n                   && detail::is_detected<detail::get_template_function, const basic_json_t&, ValueType>::value\n                   , int >::type = 0 >\n    JSON_EXPLICIT operator ValueType() const\n    {\n        // delegate the call to get<>() const\n        return get<ValueType>();\n    }\n\n    /*!\n    @return reference to the binary value\n\n    @throw type_error.302 if the value is not binary\n\n    @sa @ref is_binary() to check if the value is binary\n\n    @since version 3.8.0\n    */\n    binary_t& get_binary()\n    {\n        if (!is_binary())\n        {\n            JSON_THROW(type_error::create(302, \"type must be binary, but is \" + std::string(type_name())));\n        }\n\n        return *get_ptr<binary_t*>();\n    }\n\n    /// @copydoc get_binary()\n    const binary_t& get_binary() const\n    {\n        if (!is_binary())\n        {\n            JSON_THROW(type_error::create(302, \"type must be binary, but is \" + std::string(type_name())));\n        }\n\n        return *get_ptr<const binary_t*>();\n    }\n\n    /// @}\n\n\n    ////////////////////\n    // element access //\n    ////////////////////\n\n    /// @name element access\n    /// Access to the JSON value.\n    /// @{\n\n    /*!\n    @brief access specified array element with bounds checking\n\n    Returns a reference to the element at specified location @a idx, with\n    bounds checking.\n\n    @param[in] idx  index of the element to access\n\n    @return reference to the element at index @a idx\n\n    @throw type_error.304 if the JSON value is not an array; in this case,\n    calling `at` with an index makes no sense. See example below.\n    @throw out_of_range.401 if the index @a idx is out of range of the array;\n    that is, `idx >= size()`. See example below.\n\n    @exceptionsafety Strong guarantee: if an exception is thrown, there are no\n    changes in the JSON value.\n\n    @complexity Constant.\n\n    @since version 1.0.0\n\n    @liveexample{The example below shows how array elements can be read and\n    written using `at()`. It also demonstrates the different exceptions that\n    can be thrown.,at__size_type}\n    */\n    reference at(size_type idx)\n    {\n        // at only works for arrays\n        if (JSON_HEDLEY_LIKELY(is_array()))\n        {\n            JSON_TRY\n            {\n                return m_value.array->at(idx);\n            }\n            JSON_CATCH (std::out_of_range&)\n            {\n                // create better exception explanation\n                JSON_THROW(out_of_range::create(401, \"array index \" + std::to_string(idx) + \" is out of range\"));\n            }\n        }\n        else\n        {\n            JSON_THROW(type_error::create(304, \"cannot use at() with \" + std::string(type_name())));\n        }\n    }\n\n    /*!\n    @brief access specified array element with bounds checking\n\n    Returns a const reference to the element at specified location @a idx,\n    with bounds checking.\n\n    @param[in] idx  index of the element to access\n\n    @return const reference to the element at index @a idx\n\n    @throw type_error.304 if the JSON value is not an array; in this case,\n    calling `at` with an index makes no sense. See example below.\n    @throw out_of_range.401 if the index @a idx is out of range of the array;\n    that is, `idx >= size()`. See example below.\n\n    @exceptionsafety Strong guarantee: if an exception is thrown, there are no\n    changes in the JSON value.\n\n    @complexity Constant.\n\n    @since version 1.0.0\n\n    @liveexample{The example below shows how array elements can be read using\n    `at()`. It also demonstrates the different exceptions that can be thrown.,\n    at__size_type_const}\n    */\n    const_reference at(size_type idx) const\n    {\n        // at only works for arrays\n        if (JSON_HEDLEY_LIKELY(is_array()))\n        {\n            JSON_TRY\n            {\n                return m_value.array->at(idx);\n            }\n            JSON_CATCH (std::out_of_range&)\n            {\n                // create better exception explanation\n                JSON_THROW(out_of_range::create(401, \"array index \" + std::to_string(idx) + \" is out of range\"));\n            }\n        }\n        else\n        {\n            JSON_THROW(type_error::create(304, \"cannot use at() with \" + std::string(type_name())));\n        }\n    }\n\n    /*!\n    @brief access specified object element with bounds checking\n\n    Returns a reference to the element at with specified key @a key, with\n    bounds checking.\n\n    @param[in] key  key of the element to access\n\n    @return reference to the element at key @a key\n\n    @throw type_error.304 if the JSON value is not an object; in this case,\n    calling `at` with a key makes no sense. See example below.\n    @throw out_of_range.403 if the key @a key is is not stored in the object;\n    that is, `find(key) == end()`. See example below.\n\n    @exceptionsafety Strong guarantee: if an exception is thrown, there are no\n    changes in the JSON value.\n\n    @complexity Logarithmic in the size of the container.\n\n    @sa @ref operator[](const typename object_t::key_type&) for unchecked\n    access by reference\n    @sa @ref value() for access by value with a default value\n\n    @since version 1.0.0\n\n    @liveexample{The example below shows how object elements can be read and\n    written using `at()`. It also demonstrates the different exceptions that\n    can be thrown.,at__object_t_key_type}\n    */\n    reference at(const typename object_t::key_type& key)\n    {\n        // at only works for objects\n        if (JSON_HEDLEY_LIKELY(is_object()))\n        {\n            JSON_TRY\n            {\n                return m_value.object->at(key);\n            }\n            JSON_CATCH (std::out_of_range&)\n            {\n                // create better exception explanation\n                JSON_THROW(out_of_range::create(403, \"key '\" + key + \"' not found\"));\n            }\n        }\n        else\n        {\n            JSON_THROW(type_error::create(304, \"cannot use at() with \" + std::string(type_name())));\n        }\n    }\n\n    /*!\n    @brief access specified object element with bounds checking\n\n    Returns a const reference to the element at with specified key @a key,\n    with bounds checking.\n\n    @param[in] key  key of the element to access\n\n    @return const reference to the element at key @a key\n\n    @throw type_error.304 if the JSON value is not an object; in this case,\n    calling `at` with a key makes no sense. See example below.\n    @throw out_of_range.403 if the key @a key is is not stored in the object;\n    that is, `find(key) == end()`. See example below.\n\n    @exceptionsafety Strong guarantee: if an exception is thrown, there are no\n    changes in the JSON value.\n\n    @complexity Logarithmic in the size of the container.\n\n    @sa @ref operator[](const typename object_t::key_type&) for unchecked\n    access by reference\n    @sa @ref value() for access by value with a default value\n\n    @since version 1.0.0\n\n    @liveexample{The example below shows how object elements can be read using\n    `at()`. It also demonstrates the different exceptions that can be thrown.,\n    at__object_t_key_type_const}\n    */\n    const_reference at(const typename object_t::key_type& key) const\n    {\n        // at only works for objects\n        if (JSON_HEDLEY_LIKELY(is_object()))\n        {\n            JSON_TRY\n            {\n                return m_value.object->at(key);\n            }\n            JSON_CATCH (std::out_of_range&)\n            {\n                // create better exception explanation\n                JSON_THROW(out_of_range::create(403, \"key '\" + key + \"' not found\"));\n            }\n        }\n        else\n        {\n            JSON_THROW(type_error::create(304, \"cannot use at() with \" + std::string(type_name())));\n        }\n    }\n\n    /*!\n    @brief access specified array element\n\n    Returns a reference to the element at specified location @a idx.\n\n    @note If @a idx is beyond the range of the array (i.e., `idx >= size()`),\n    then the array is silently filled up with `null` values to make `idx` a\n    valid reference to the last stored element.\n\n    @param[in] idx  index of the element to access\n\n    @return reference to the element at index @a idx\n\n    @throw type_error.305 if the JSON value is not an array or null; in that\n    cases, using the [] operator with an index makes no sense.\n\n    @complexity Constant if @a idx is in the range of the array. Otherwise\n    linear in `idx - size()`.\n\n    @liveexample{The example below shows how array elements can be read and\n    written using `[]` operator. Note the addition of `null`\n    values.,operatorarray__size_type}\n\n    @since version 1.0.0\n    */\n    reference operator[](size_type idx)\n    {\n        // implicitly convert null value to an empty array\n        if (is_null())\n        {\n            m_type = value_t::array;\n            m_value.array = create<array_t>();\n            assert_invariant();\n        }\n\n        // operator[] only works for arrays\n        if (JSON_HEDLEY_LIKELY(is_array()))\n        {\n            // fill up array with null values if given idx is outside range\n            if (idx >= m_value.array->size())\n            {\n                m_value.array->insert(m_value.array->end(),\n                                      idx - m_value.array->size() + 1,\n                                      basic_json());\n            }\n\n            return m_value.array->operator[](idx);\n        }\n\n        JSON_THROW(type_error::create(305, \"cannot use operator[] with a numeric argument with \" + std::string(type_name())));\n    }\n\n    /*!\n    @brief access specified array element\n\n    Returns a const reference to the element at specified location @a idx.\n\n    @param[in] idx  index of the element to access\n\n    @return const reference to the element at index @a idx\n\n    @throw type_error.305 if the JSON value is not an array; in that case,\n    using the [] operator with an index makes no sense.\n\n    @complexity Constant.\n\n    @liveexample{The example below shows how array elements can be read using\n    the `[]` operator.,operatorarray__size_type_const}\n\n    @since version 1.0.0\n    */\n    const_reference operator[](size_type idx) const\n    {\n        // const operator[] only works for arrays\n        if (JSON_HEDLEY_LIKELY(is_array()))\n        {\n            return m_value.array->operator[](idx);\n        }\n\n        JSON_THROW(type_error::create(305, \"cannot use operator[] with a numeric argument with \" + std::string(type_name())));\n    }\n\n    /*!\n    @brief access specified object element\n\n    Returns a reference to the element at with specified key @a key.\n\n    @note If @a key is not found in the object, then it is silently added to\n    the object and filled with a `null` value to make `key` a valid reference.\n    In case the value was `null` before, it is converted to an object.\n\n    @param[in] key  key of the element to access\n\n    @return reference to the element at key @a key\n\n    @throw type_error.305 if the JSON value is not an object or null; in that\n    cases, using the [] operator with a key makes no sense.\n\n    @complexity Logarithmic in the size of the container.\n\n    @liveexample{The example below shows how object elements can be read and\n    written using the `[]` operator.,operatorarray__key_type}\n\n    @sa @ref at(const typename object_t::key_type&) for access by reference\n    with range checking\n    @sa @ref value() for access by value with a default value\n\n    @since version 1.0.0\n    */\n    reference operator[](const typename object_t::key_type& key)\n    {\n        // implicitly convert null value to an empty object\n        if (is_null())\n        {\n            m_type = value_t::object;\n            m_value.object = create<object_t>();\n            assert_invariant();\n        }\n\n        // operator[] only works for objects\n        if (JSON_HEDLEY_LIKELY(is_object()))\n        {\n            return m_value.object->operator[](key);\n        }\n\n        JSON_THROW(type_error::create(305, \"cannot use operator[] with a string argument with \" + std::string(type_name())));\n    }\n\n    /*!\n    @brief read-only access specified object element\n\n    Returns a const reference to the element at with specified key @a key. No\n    bounds checking is performed.\n\n    @warning If the element with key @a key does not exist, the behavior is\n    undefined.\n\n    @param[in] key  key of the element to access\n\n    @return const reference to the element at key @a key\n\n    @pre The element with key @a key must exist. **This precondition is\n         enforced with an assertion.**\n\n    @throw type_error.305 if the JSON value is not an object; in that case,\n    using the [] operator with a key makes no sense.\n\n    @complexity Logarithmic in the size of the container.\n\n    @liveexample{The example below shows how object elements can be read using\n    the `[]` operator.,operatorarray__key_type_const}\n\n    @sa @ref at(const typename object_t::key_type&) for access by reference\n    with range checking\n    @sa @ref value() for access by value with a default value\n\n    @since version 1.0.0\n    */\n    const_reference operator[](const typename object_t::key_type& key) const\n    {\n        // const operator[] only works for objects\n        if (JSON_HEDLEY_LIKELY(is_object()))\n        {\n            JSON_ASSERT(m_value.object->find(key) != m_value.object->end());\n            return m_value.object->find(key)->second;\n        }\n\n        JSON_THROW(type_error::create(305, \"cannot use operator[] with a string argument with \" + std::string(type_name())));\n    }\n\n    /*!\n    @brief access specified object element\n\n    Returns a reference to the element at with specified key @a key.\n\n    @note If @a key is not found in the object, then it is silently added to\n    the object and filled with a `null` value to make `key` a valid reference.\n    In case the value was `null` before, it is converted to an object.\n\n    @param[in] key  key of the element to access\n\n    @return reference to the element at key @a key\n\n    @throw type_error.305 if the JSON value is not an object or null; in that\n    cases, using the [] operator with a key makes no sense.\n\n    @complexity Logarithmic in the size of the container.\n\n    @liveexample{The example below shows how object elements can be read and\n    written using the `[]` operator.,operatorarray__key_type}\n\n    @sa @ref at(const typename object_t::key_type&) for access by reference\n    with range checking\n    @sa @ref value() for access by value with a default value\n\n    @since version 1.1.0\n    */\n    template<typename T>\n    JSON_HEDLEY_NON_NULL(2)\n    reference operator[](T* key)\n    {\n        // implicitly convert null to object\n        if (is_null())\n        {\n            m_type = value_t::object;\n            m_value = value_t::object;\n            assert_invariant();\n        }\n\n        // at only works for objects\n        if (JSON_HEDLEY_LIKELY(is_object()))\n        {\n            return m_value.object->operator[](key);\n        }\n\n        JSON_THROW(type_error::create(305, \"cannot use operator[] with a string argument with \" + std::string(type_name())));\n    }\n\n    /*!\n    @brief read-only access specified object element\n\n    Returns a const reference to the element at with specified key @a key. No\n    bounds checking is performed.\n\n    @warning If the element with key @a key does not exist, the behavior is\n    undefined.\n\n    @param[in] key  key of the element to access\n\n    @return const reference to the element at key @a key\n\n    @pre The element with key @a key must exist. **This precondition is\n         enforced with an assertion.**\n\n    @throw type_error.305 if the JSON value is not an object; in that case,\n    using the [] operator with a key makes no sense.\n\n    @complexity Logarithmic in the size of the container.\n\n    @liveexample{The example below shows how object elements can be read using\n    the `[]` operator.,operatorarray__key_type_const}\n\n    @sa @ref at(const typename object_t::key_type&) for access by reference\n    with range checking\n    @sa @ref value() for access by value with a default value\n\n    @since version 1.1.0\n    */\n    template<typename T>\n    JSON_HEDLEY_NON_NULL(2)\n    const_reference operator[](T* key) const\n    {\n        // at only works for objects\n        if (JSON_HEDLEY_LIKELY(is_object()))\n        {\n            JSON_ASSERT(m_value.object->find(key) != m_value.object->end());\n            return m_value.object->find(key)->second;\n        }\n\n        JSON_THROW(type_error::create(305, \"cannot use operator[] with a string argument with \" + std::string(type_name())));\n    }\n\n    /*!\n    @brief access specified object element with default value\n\n    Returns either a copy of an object's element at the specified key @a key\n    or a given default value if no element with key @a key exists.\n\n    The function is basically equivalent to executing\n    @code {.cpp}\n    try {\n        return at(key);\n    } catch(out_of_range) {\n        return default_value;\n    }\n    @endcode\n\n    @note Unlike @ref at(const typename object_t::key_type&), this function\n    does not throw if the given key @a key was not found.\n\n    @note Unlike @ref operator[](const typename object_t::key_type& key), this\n    function does not implicitly add an element to the position defined by @a\n    key. This function is furthermore also applicable to const objects.\n\n    @param[in] key  key of the element to access\n    @param[in] default_value  the value to return if @a key is not found\n\n    @tparam ValueType type compatible to JSON values, for instance `int` for\n    JSON integer numbers, `bool` for JSON booleans, or `std::vector` types for\n    JSON arrays. Note the type of the expected value at @a key and the default\n    value @a default_value must be compatible.\n\n    @return copy of the element at key @a key or @a default_value if @a key\n    is not found\n\n    @throw type_error.302 if @a default_value does not match the type of the\n    value at @a key\n    @throw type_error.306 if the JSON value is not an object; in that case,\n    using `value()` with a key makes no sense.\n\n    @complexity Logarithmic in the size of the container.\n\n    @liveexample{The example below shows how object elements can be queried\n    with a default value.,basic_json__value}\n\n    @sa @ref at(const typename object_t::key_type&) for access by reference\n    with range checking\n    @sa @ref operator[](const typename object_t::key_type&) for unchecked\n    access by reference\n\n    @since version 1.0.0\n    */\n    // using std::is_convertible in a std::enable_if will fail when using explicit conversions\n    template < class ValueType, typename std::enable_if <\n                   detail::is_getable<basic_json_t, ValueType>::value\n                   && !std::is_same<value_t, ValueType>::value, int >::type = 0 >\n    ValueType value(const typename object_t::key_type& key, const ValueType& default_value) const\n    {\n        // at only works for objects\n        if (JSON_HEDLEY_LIKELY(is_object()))\n        {\n            // if key is found, return value and given default value otherwise\n            const auto it = find(key);\n            if (it != end())\n            {\n                return it->template get<ValueType>();\n            }\n\n            return default_value;\n        }\n\n        JSON_THROW(type_error::create(306, \"cannot use value() with \" + std::string(type_name())));\n    }\n\n    /*!\n    @brief overload for a default value of type const char*\n    @copydoc basic_json::value(const typename object_t::key_type&, const ValueType&) const\n    */\n    string_t value(const typename object_t::key_type& key, const char* default_value) const\n    {\n        return value(key, string_t(default_value));\n    }\n\n    /*!\n    @brief access specified object element via JSON Pointer with default value\n\n    Returns either a copy of an object's element at the specified key @a key\n    or a given default value if no element with key @a key exists.\n\n    The function is basically equivalent to executing\n    @code {.cpp}\n    try {\n        return at(ptr);\n    } catch(out_of_range) {\n        return default_value;\n    }\n    @endcode\n\n    @note Unlike @ref at(const json_pointer&), this function does not throw\n    if the given key @a key was not found.\n\n    @param[in] ptr  a JSON pointer to the element to access\n    @param[in] default_value  the value to return if @a ptr found no value\n\n    @tparam ValueType type compatible to JSON values, for instance `int` for\n    JSON integer numbers, `bool` for JSON booleans, or `std::vector` types for\n    JSON arrays. Note the type of the expected value at @a key and the default\n    value @a default_value must be compatible.\n\n    @return copy of the element at key @a key or @a default_value if @a key\n    is not found\n\n    @throw type_error.302 if @a default_value does not match the type of the\n    value at @a ptr\n    @throw type_error.306 if the JSON value is not an object; in that case,\n    using `value()` with a key makes no sense.\n\n    @complexity Logarithmic in the size of the container.\n\n    @liveexample{The example below shows how object elements can be queried\n    with a default value.,basic_json__value_ptr}\n\n    @sa @ref operator[](const json_pointer&) for unchecked access by reference\n\n    @since version 2.0.2\n    */\n    template<class ValueType, typename std::enable_if<\n                 detail::is_getable<basic_json_t, ValueType>::value, int>::type = 0>\n    ValueType value(const json_pointer& ptr, const ValueType& default_value) const\n    {\n        // at only works for objects\n        if (JSON_HEDLEY_LIKELY(is_object()))\n        {\n            // if pointer resolves a value, return it or use default value\n            JSON_TRY\n            {\n                return ptr.get_checked(this).template get<ValueType>();\n            }\n            JSON_INTERNAL_CATCH (out_of_range&)\n            {\n                return default_value;\n            }\n        }\n\n        JSON_THROW(type_error::create(306, \"cannot use value() with \" + std::string(type_name())));\n    }\n\n    /*!\n    @brief overload for a default value of type const char*\n    @copydoc basic_json::value(const json_pointer&, ValueType) const\n    */\n    JSON_HEDLEY_NON_NULL(3)\n    string_t value(const json_pointer& ptr, const char* default_value) const\n    {\n        return value(ptr, string_t(default_value));\n    }\n\n    /*!\n    @brief access the first element\n\n    Returns a reference to the first element in the container. For a JSON\n    container `c`, the expression `c.front()` is equivalent to `*c.begin()`.\n\n    @return In case of a structured type (array or object), a reference to the\n    first element is returned. In case of number, string, boolean, or binary\n    values, a reference to the value is returned.\n\n    @complexity Constant.\n\n    @pre The JSON value must not be `null` (would throw `std::out_of_range`)\n    or an empty array or object (undefined behavior, **guarded by\n    assertions**).\n    @post The JSON value remains unchanged.\n\n    @throw invalid_iterator.214 when called on `null` value\n\n    @liveexample{The following code shows an example for `front()`.,front}\n\n    @sa @ref back() -- access the last element\n\n    @since version 1.0.0\n    */\n    reference front()\n    {\n        return *begin();\n    }\n\n    /*!\n    @copydoc basic_json::front()\n    */\n    const_reference front() const\n    {\n        return *cbegin();\n    }\n\n    /*!\n    @brief access the last element\n\n    Returns a reference to the last element in the container. For a JSON\n    container `c`, the expression `c.back()` is equivalent to\n    @code {.cpp}\n    auto tmp = c.end();\n    --tmp;\n    return *tmp;\n    @endcode\n\n    @return In case of a structured type (array or object), a reference to the\n    last element is returned. In case of number, string, boolean, or binary\n    values, a reference to the value is returned.\n\n    @complexity Constant.\n\n    @pre The JSON value must not be `null` (would throw `std::out_of_range`)\n    or an empty array or object (undefined behavior, **guarded by\n    assertions**).\n    @post The JSON value remains unchanged.\n\n    @throw invalid_iterator.214 when called on a `null` value. See example\n    below.\n\n    @liveexample{The following code shows an example for `back()`.,back}\n\n    @sa @ref front() -- access the first element\n\n    @since version 1.0.0\n    */\n    reference back()\n    {\n        auto tmp = end();\n        --tmp;\n        return *tmp;\n    }\n\n    /*!\n    @copydoc basic_json::back()\n    */\n    const_reference back() const\n    {\n        auto tmp = cend();\n        --tmp;\n        return *tmp;\n    }\n\n    /*!\n    @brief remove element given an iterator\n\n    Removes the element specified by iterator @a pos. The iterator @a pos must\n    be valid and dereferenceable. Thus the `end()` iterator (which is valid,\n    but is not dereferenceable) cannot be used as a value for @a pos.\n\n    If called on a primitive type other than `null`, the resulting JSON value\n    will be `null`.\n\n    @param[in] pos iterator to the element to remove\n    @return Iterator following the last removed element. If the iterator @a\n    pos refers to the last element, the `end()` iterator is returned.\n\n    @tparam IteratorType an @ref iterator or @ref const_iterator\n\n    @post Invalidates iterators and references at or after the point of the\n    erase, including the `end()` iterator.\n\n    @throw type_error.307 if called on a `null` value; example: `\"cannot use\n    erase() with null\"`\n    @throw invalid_iterator.202 if called on an iterator which does not belong\n    to the current JSON value; example: `\"iterator does not fit current\n    value\"`\n    @throw invalid_iterator.205 if called on a primitive type with invalid\n    iterator (i.e., any iterator which is not `begin()`); example: `\"iterator\n    out of range\"`\n\n    @complexity The complexity depends on the type:\n    - objects: amortized constant\n    - arrays: linear in distance between @a pos and the end of the container\n    - strings and binary: linear in the length of the member\n    - other types: constant\n\n    @liveexample{The example shows the result of `erase()` for different JSON\n    types.,erase__IteratorType}\n\n    @sa @ref erase(IteratorType, IteratorType) -- removes the elements in\n    the given range\n    @sa @ref erase(const typename object_t::key_type&) -- removes the element\n    from an object at the given key\n    @sa @ref erase(const size_type) -- removes the element from an array at\n    the given index\n\n    @since version 1.0.0\n    */\n    template < class IteratorType, typename std::enable_if <\n                   std::is_same<IteratorType, typename basic_json_t::iterator>::value ||\n                   std::is_same<IteratorType, typename basic_json_t::const_iterator>::value, int >::type\n               = 0 >\n    IteratorType erase(IteratorType pos)\n    {\n        // make sure iterator fits the current value\n        if (JSON_HEDLEY_UNLIKELY(this != pos.m_object))\n        {\n            JSON_THROW(invalid_iterator::create(202, \"iterator does not fit current value\"));\n        }\n\n        IteratorType result = end();\n\n        switch (m_type)\n        {\n            case value_t::boolean:\n            case value_t::number_float:\n            case value_t::number_integer:\n            case value_t::number_unsigned:\n            case value_t::string:\n            case value_t::binary:\n            {\n                if (JSON_HEDLEY_UNLIKELY(!pos.m_it.primitive_iterator.is_begin()))\n                {\n                    JSON_THROW(invalid_iterator::create(205, \"iterator out of range\"));\n                }\n\n                if (is_string())\n                {\n                    AllocatorType<string_t> alloc;\n                    std::allocator_traits<decltype(alloc)>::destroy(alloc, m_value.string);\n                    std::allocator_traits<decltype(alloc)>::deallocate(alloc, m_value.string, 1);\n                    m_value.string = nullptr;\n                }\n                else if (is_binary())\n                {\n                    AllocatorType<binary_t> alloc;\n                    std::allocator_traits<decltype(alloc)>::destroy(alloc, m_value.binary);\n                    std::allocator_traits<decltype(alloc)>::deallocate(alloc, m_value.binary, 1);\n                    m_value.binary = nullptr;\n                }\n\n                m_type = value_t::null;\n                assert_invariant();\n                break;\n            }\n\n            case value_t::object:\n            {\n                result.m_it.object_iterator = m_value.object->erase(pos.m_it.object_iterator);\n                break;\n            }\n\n            case value_t::array:\n            {\n                result.m_it.array_iterator = m_value.array->erase(pos.m_it.array_iterator);\n                break;\n            }\n\n            default:\n                JSON_THROW(type_error::create(307, \"cannot use erase() with \" + std::string(type_name())));\n        }\n\n        return result;\n    }\n\n    /*!\n    @brief remove elements given an iterator range\n\n    Removes the element specified by the range `[first; last)`. The iterator\n    @a first does not need to be dereferenceable if `first == last`: erasing\n    an empty range is a no-op.\n\n    If called on a primitive type other than `null`, the resulting JSON value\n    will be `null`.\n\n    @param[in] first iterator to the beginning of the range to remove\n    @param[in] last iterator past the end of the range to remove\n    @return Iterator following the last removed element. If the iterator @a\n    second refers to the last element, the `end()` iterator is returned.\n\n    @tparam IteratorType an @ref iterator or @ref const_iterator\n\n    @post Invalidates iterators and references at or after the point of the\n    erase, including the `end()` iterator.\n\n    @throw type_error.307 if called on a `null` value; example: `\"cannot use\n    erase() with null\"`\n    @throw invalid_iterator.203 if called on iterators which does not belong\n    to the current JSON value; example: `\"iterators do not fit current value\"`\n    @throw invalid_iterator.204 if called on a primitive type with invalid\n    iterators (i.e., if `first != begin()` and `last != end()`); example:\n    `\"iterators out of range\"`\n\n    @complexity The complexity depends on the type:\n    - objects: `log(size()) + std::distance(first, last)`\n    - arrays: linear in the distance between @a first and @a last, plus linear\n      in the distance between @a last and end of the container\n    - strings and binary: linear in the length of the member\n    - other types: constant\n\n    @liveexample{The example shows the result of `erase()` for different JSON\n    types.,erase__IteratorType_IteratorType}\n\n    @sa @ref erase(IteratorType) -- removes the element at a given position\n    @sa @ref erase(const typename object_t::key_type&) -- removes the element\n    from an object at the given key\n    @sa @ref erase(const size_type) -- removes the element from an array at\n    the given index\n\n    @since version 1.0.0\n    */\n    template < class IteratorType, typename std::enable_if <\n                   std::is_same<IteratorType, typename basic_json_t::iterator>::value ||\n                   std::is_same<IteratorType, typename basic_json_t::const_iterator>::value, int >::type\n               = 0 >\n    IteratorType erase(IteratorType first, IteratorType last)\n    {\n        // make sure iterator fits the current value\n        if (JSON_HEDLEY_UNLIKELY(this != first.m_object || this != last.m_object))\n        {\n            JSON_THROW(invalid_iterator::create(203, \"iterators do not fit current value\"));\n        }\n\n        IteratorType result = end();\n\n        switch (m_type)\n        {\n            case value_t::boolean:\n            case value_t::number_float:\n            case value_t::number_integer:\n            case value_t::number_unsigned:\n            case value_t::string:\n            case value_t::binary:\n            {\n                if (JSON_HEDLEY_LIKELY(!first.m_it.primitive_iterator.is_begin()\n                                       || !last.m_it.primitive_iterator.is_end()))\n                {\n                    JSON_THROW(invalid_iterator::create(204, \"iterators out of range\"));\n                }\n\n                if (is_string())\n                {\n                    AllocatorType<string_t> alloc;\n                    std::allocator_traits<decltype(alloc)>::destroy(alloc, m_value.string);\n                    std::allocator_traits<decltype(alloc)>::deallocate(alloc, m_value.string, 1);\n                    m_value.string = nullptr;\n                }\n                else if (is_binary())\n                {\n                    AllocatorType<binary_t> alloc;\n                    std::allocator_traits<decltype(alloc)>::destroy(alloc, m_value.binary);\n                    std::allocator_traits<decltype(alloc)>::deallocate(alloc, m_value.binary, 1);\n                    m_value.binary = nullptr;\n                }\n\n                m_type = value_t::null;\n                assert_invariant();\n                break;\n            }\n\n            case value_t::object:\n            {\n                result.m_it.object_iterator = m_value.object->erase(first.m_it.object_iterator,\n                                              last.m_it.object_iterator);\n                break;\n            }\n\n            case value_t::array:\n            {\n                result.m_it.array_iterator = m_value.array->erase(first.m_it.array_iterator,\n                                             last.m_it.array_iterator);\n                break;\n            }\n\n            default:\n                JSON_THROW(type_error::create(307, \"cannot use erase() with \" + std::string(type_name())));\n        }\n\n        return result;\n    }\n\n    /*!\n    @brief remove element from a JSON object given a key\n\n    Removes elements from a JSON object with the key value @a key.\n\n    @param[in] key value of the elements to remove\n\n    @return Number of elements removed. If @a ObjectType is the default\n    `std::map` type, the return value will always be `0` (@a key was not\n    found) or `1` (@a key was found).\n\n    @post References and iterators to the erased elements are invalidated.\n    Other references and iterators are not affected.\n\n    @throw type_error.307 when called on a type other than JSON object;\n    example: `\"cannot use erase() with null\"`\n\n    @complexity `log(size()) + count(key)`\n\n    @liveexample{The example shows the effect of `erase()`.,erase__key_type}\n\n    @sa @ref erase(IteratorType) -- removes the element at a given position\n    @sa @ref erase(IteratorType, IteratorType) -- removes the elements in\n    the given range\n    @sa @ref erase(const size_type) -- removes the element from an array at\n    the given index\n\n    @since version 1.0.0\n    */\n    size_type erase(const typename object_t::key_type& key)\n    {\n        // this erase only works for objects\n        if (JSON_HEDLEY_LIKELY(is_object()))\n        {\n            return m_value.object->erase(key);\n        }\n\n        JSON_THROW(type_error::create(307, \"cannot use erase() with \" + std::string(type_name())));\n    }\n\n    /*!\n    @brief remove element from a JSON array given an index\n\n    Removes element from a JSON array at the index @a idx.\n\n    @param[in] idx index of the element to remove\n\n    @throw type_error.307 when called on a type other than JSON object;\n    example: `\"cannot use erase() with null\"`\n    @throw out_of_range.401 when `idx >= size()`; example: `\"array index 17\n    is out of range\"`\n\n    @complexity Linear in distance between @a idx and the end of the container.\n\n    @liveexample{The example shows the effect of `erase()`.,erase__size_type}\n\n    @sa @ref erase(IteratorType) -- removes the element at a given position\n    @sa @ref erase(IteratorType, IteratorType) -- removes the elements in\n    the given range\n    @sa @ref erase(const typename object_t::key_type&) -- removes the element\n    from an object at the given key\n\n    @since version 1.0.0\n    */\n    void erase(const size_type idx)\n    {\n        // this erase only works for arrays\n        if (JSON_HEDLEY_LIKELY(is_array()))\n        {\n            if (JSON_HEDLEY_UNLIKELY(idx >= size()))\n            {\n                JSON_THROW(out_of_range::create(401, \"array index \" + std::to_string(idx) + \" is out of range\"));\n            }\n\n            m_value.array->erase(m_value.array->begin() + static_cast<difference_type>(idx));\n        }\n        else\n        {\n            JSON_THROW(type_error::create(307, \"cannot use erase() with \" + std::string(type_name())));\n        }\n    }\n\n    /// @}\n\n\n    ////////////\n    // lookup //\n    ////////////\n\n    /// @name lookup\n    /// @{\n\n    /*!\n    @brief find an element in a JSON object\n\n    Finds an element in a JSON object with key equivalent to @a key. If the\n    element is not found or the JSON value is not an object, end() is\n    returned.\n\n    @note This method always returns @ref end() when executed on a JSON type\n          that is not an object.\n\n    @param[in] key key value of the element to search for.\n\n    @return Iterator to an element with key equivalent to @a key. If no such\n    element is found or the JSON value is not an object, past-the-end (see\n    @ref end()) iterator is returned.\n\n    @complexity Logarithmic in the size of the JSON object.\n\n    @liveexample{The example shows how `find()` is used.,find__key_type}\n\n    @sa @ref contains(KeyT&&) const -- checks whether a key exists\n\n    @since version 1.0.0\n    */\n    template<typename KeyT>\n    iterator find(KeyT&& key)\n    {\n        auto result = end();\n\n        if (is_object())\n        {\n            result.m_it.object_iterator = m_value.object->find(std::forward<KeyT>(key));\n        }\n\n        return result;\n    }\n\n    /*!\n    @brief find an element in a JSON object\n    @copydoc find(KeyT&&)\n    */\n    template<typename KeyT>\n    const_iterator find(KeyT&& key) const\n    {\n        auto result = cend();\n\n        if (is_object())\n        {\n            result.m_it.object_iterator = m_value.object->find(std::forward<KeyT>(key));\n        }\n\n        return result;\n    }\n\n    /*!\n    @brief returns the number of occurrences of a key in a JSON object\n\n    Returns the number of elements with key @a key. If ObjectType is the\n    default `std::map` type, the return value will always be `0` (@a key was\n    not found) or `1` (@a key was found).\n\n    @note This method always returns `0` when executed on a JSON type that is\n          not an object.\n\n    @param[in] key key value of the element to count\n\n    @return Number of elements with key @a key. If the JSON value is not an\n    object, the return value will be `0`.\n\n    @complexity Logarithmic in the size of the JSON object.\n\n    @liveexample{The example shows how `count()` is used.,count}\n\n    @since version 1.0.0\n    */\n    template<typename KeyT>\n    size_type count(KeyT&& key) const\n    {\n        // return 0 for all nonobject types\n        return is_object() ? m_value.object->count(std::forward<KeyT>(key)) : 0;\n    }\n\n    /*!\n    @brief check the existence of an element in a JSON object\n\n    Check whether an element exists in a JSON object with key equivalent to\n    @a key. If the element is not found or the JSON value is not an object,\n    false is returned.\n\n    @note This method always returns false when executed on a JSON type\n          that is not an object.\n\n    @param[in] key key value to check its existence.\n\n    @return true if an element with specified @a key exists. If no such\n    element with such key is found or the JSON value is not an object,\n    false is returned.\n\n    @complexity Logarithmic in the size of the JSON object.\n\n    @liveexample{The following code shows an example for `contains()`.,contains}\n\n    @sa @ref find(KeyT&&) -- returns an iterator to an object element\n    @sa @ref contains(const json_pointer&) const -- checks the existence for a JSON pointer\n\n    @since version 3.6.0\n    */\n    template < typename KeyT, typename std::enable_if <\n                   !std::is_same<typename std::decay<KeyT>::type, json_pointer>::value, int >::type = 0 >\n    bool contains(KeyT && key) const\n    {\n        return is_object() && m_value.object->find(std::forward<KeyT>(key)) != m_value.object->end();\n    }\n\n    /*!\n    @brief check the existence of an element in a JSON object given a JSON pointer\n\n    Check whether the given JSON pointer @a ptr can be resolved in the current\n    JSON value.\n\n    @note This method can be executed on any JSON value type.\n\n    @param[in] ptr JSON pointer to check its existence.\n\n    @return true if the JSON pointer can be resolved to a stored value, false\n    otherwise.\n\n    @post If `j.contains(ptr)` returns true, it is safe to call `j[ptr]`.\n\n    @throw parse_error.106   if an array index begins with '0'\n    @throw parse_error.109   if an array index was not a number\n\n    @complexity Logarithmic in the size of the JSON object.\n\n    @liveexample{The following code shows an example for `contains()`.,contains_json_pointer}\n\n    @sa @ref contains(KeyT &&) const -- checks the existence of a key\n\n    @since version 3.7.0\n    */\n    bool contains(const json_pointer& ptr) const\n    {\n        return ptr.contains(this);\n    }\n\n    /// @}\n\n\n    ///////////////\n    // iterators //\n    ///////////////\n\n    /// @name iterators\n    /// @{\n\n    /*!\n    @brief returns an iterator to the first element\n\n    Returns an iterator to the first element.\n\n    @image html range-begin-end.svg \"Illustration from cppreference.com\"\n\n    @return iterator to the first element\n\n    @complexity Constant.\n\n    @requirement This function helps `basic_json` satisfying the\n    [Container](https://en.cppreference.com/w/cpp/named_req/Container)\n    requirements:\n    - The complexity is constant.\n\n    @liveexample{The following code shows an example for `begin()`.,begin}\n\n    @sa @ref cbegin() -- returns a const iterator to the beginning\n    @sa @ref end() -- returns an iterator to the end\n    @sa @ref cend() -- returns a const iterator to the end\n\n    @since version 1.0.0\n    */\n    iterator begin() noexcept\n    {\n        iterator result(this);\n        result.set_begin();\n        return result;\n    }\n\n    /*!\n    @copydoc basic_json::cbegin()\n    */\n    const_iterator begin() const noexcept\n    {\n        return cbegin();\n    }\n\n    /*!\n    @brief returns a const iterator to the first element\n\n    Returns a const iterator to the first element.\n\n    @image html range-begin-end.svg \"Illustration from cppreference.com\"\n\n    @return const iterator to the first element\n\n    @complexity Constant.\n\n    @requirement This function helps `basic_json` satisfying the\n    [Container](https://en.cppreference.com/w/cpp/named_req/Container)\n    requirements:\n    - The complexity is constant.\n    - Has the semantics of `const_cast<const basic_json&>(*this).begin()`.\n\n    @liveexample{The following code shows an example for `cbegin()`.,cbegin}\n\n    @sa @ref begin() -- returns an iterator to the beginning\n    @sa @ref end() -- returns an iterator to the end\n    @sa @ref cend() -- returns a const iterator to the end\n\n    @since version 1.0.0\n    */\n    const_iterator cbegin() const noexcept\n    {\n        const_iterator result(this);\n        result.set_begin();\n        return result;\n    }\n\n    /*!\n    @brief returns an iterator to one past the last element\n\n    Returns an iterator to one past the last element.\n\n    @image html range-begin-end.svg \"Illustration from cppreference.com\"\n\n    @return iterator one past the last element\n\n    @complexity Constant.\n\n    @requirement This function helps `basic_json` satisfying the\n    [Container](https://en.cppreference.com/w/cpp/named_req/Container)\n    requirements:\n    - The complexity is constant.\n\n    @liveexample{The following code shows an example for `end()`.,end}\n\n    @sa @ref cend() -- returns a const iterator to the end\n    @sa @ref begin() -- returns an iterator to the beginning\n    @sa @ref cbegin() -- returns a const iterator to the beginning\n\n    @since version 1.0.0\n    */\n    iterator end() noexcept\n    {\n        iterator result(this);\n        result.set_end();\n        return result;\n    }\n\n    /*!\n    @copydoc basic_json::cend()\n    */\n    const_iterator end() const noexcept\n    {\n        return cend();\n    }\n\n    /*!\n    @brief returns a const iterator to one past the last element\n\n    Returns a const iterator to one past the last element.\n\n    @image html range-begin-end.svg \"Illustration from cppreference.com\"\n\n    @return const iterator one past the last element\n\n    @complexity Constant.\n\n    @requirement This function helps `basic_json` satisfying the\n    [Container](https://en.cppreference.com/w/cpp/named_req/Container)\n    requirements:\n    - The complexity is constant.\n    - Has the semantics of `const_cast<const basic_json&>(*this).end()`.\n\n    @liveexample{The following code shows an example for `cend()`.,cend}\n\n    @sa @ref end() -- returns an iterator to the end\n    @sa @ref begin() -- returns an iterator to the beginning\n    @sa @ref cbegin() -- returns a const iterator to the beginning\n\n    @since version 1.0.0\n    */\n    const_iterator cend() const noexcept\n    {\n        const_iterator result(this);\n        result.set_end();\n        return result;\n    }\n\n    /*!\n    @brief returns an iterator to the reverse-beginning\n\n    Returns an iterator to the reverse-beginning; that is, the last element.\n\n    @image html range-rbegin-rend.svg \"Illustration from cppreference.com\"\n\n    @complexity Constant.\n\n    @requirement This function helps `basic_json` satisfying the\n    [ReversibleContainer](https://en.cppreference.com/w/cpp/named_req/ReversibleContainer)\n    requirements:\n    - The complexity is constant.\n    - Has the semantics of `reverse_iterator(end())`.\n\n    @liveexample{The following code shows an example for `rbegin()`.,rbegin}\n\n    @sa @ref crbegin() -- returns a const reverse iterator to the beginning\n    @sa @ref rend() -- returns a reverse iterator to the end\n    @sa @ref crend() -- returns a const reverse iterator to the end\n\n    @since version 1.0.0\n    */\n    reverse_iterator rbegin() noexcept\n    {\n        return reverse_iterator(end());\n    }\n\n    /*!\n    @copydoc basic_json::crbegin()\n    */\n    const_reverse_iterator rbegin() const noexcept\n    {\n        return crbegin();\n    }\n\n    /*!\n    @brief returns an iterator to the reverse-end\n\n    Returns an iterator to the reverse-end; that is, one before the first\n    element.\n\n    @image html range-rbegin-rend.svg \"Illustration from cppreference.com\"\n\n    @complexity Constant.\n\n    @requirement This function helps `basic_json` satisfying the\n    [ReversibleContainer](https://en.cppreference.com/w/cpp/named_req/ReversibleContainer)\n    requirements:\n    - The complexity is constant.\n    - Has the semantics of `reverse_iterator(begin())`.\n\n    @liveexample{The following code shows an example for `rend()`.,rend}\n\n    @sa @ref crend() -- returns a const reverse iterator to the end\n    @sa @ref rbegin() -- returns a reverse iterator to the beginning\n    @sa @ref crbegin() -- returns a const reverse iterator to the beginning\n\n    @since version 1.0.0\n    */\n    reverse_iterator rend() noexcept\n    {\n        return reverse_iterator(begin());\n    }\n\n    /*!\n    @copydoc basic_json::crend()\n    */\n    const_reverse_iterator rend() const noexcept\n    {\n        return crend();\n    }\n\n    /*!\n    @brief returns a const reverse iterator to the last element\n\n    Returns a const iterator to the reverse-beginning; that is, the last\n    element.\n\n    @image html range-rbegin-rend.svg \"Illustration from cppreference.com\"\n\n    @complexity Constant.\n\n    @requirement This function helps `basic_json` satisfying the\n    [ReversibleContainer](https://en.cppreference.com/w/cpp/named_req/ReversibleContainer)\n    requirements:\n    - The complexity is constant.\n    - Has the semantics of `const_cast<const basic_json&>(*this).rbegin()`.\n\n    @liveexample{The following code shows an example for `crbegin()`.,crbegin}\n\n    @sa @ref rbegin() -- returns a reverse iterator to the beginning\n    @sa @ref rend() -- returns a reverse iterator to the end\n    @sa @ref crend() -- returns a const reverse iterator to the end\n\n    @since version 1.0.0\n    */\n    const_reverse_iterator crbegin() const noexcept\n    {\n        return const_reverse_iterator(cend());\n    }\n\n    /*!\n    @brief returns a const reverse iterator to one before the first\n\n    Returns a const reverse iterator to the reverse-end; that is, one before\n    the first element.\n\n    @image html range-rbegin-rend.svg \"Illustration from cppreference.com\"\n\n    @complexity Constant.\n\n    @requirement This function helps `basic_json` satisfying the\n    [ReversibleContainer](https://en.cppreference.com/w/cpp/named_req/ReversibleContainer)\n    requirements:\n    - The complexity is constant.\n    - Has the semantics of `const_cast<const basic_json&>(*this).rend()`.\n\n    @liveexample{The following code shows an example for `crend()`.,crend}\n\n    @sa @ref rend() -- returns a reverse iterator to the end\n    @sa @ref rbegin() -- returns a reverse iterator to the beginning\n    @sa @ref crbegin() -- returns a const reverse iterator to the beginning\n\n    @since version 1.0.0\n    */\n    const_reverse_iterator crend() const noexcept\n    {\n        return const_reverse_iterator(cbegin());\n    }\n\n  public:\n    /*!\n    @brief wrapper to access iterator member functions in range-based for\n\n    This function allows to access @ref iterator::key() and @ref\n    iterator::value() during range-based for loops. In these loops, a\n    reference to the JSON values is returned, so there is no access to the\n    underlying iterator.\n\n    For loop without iterator_wrapper:\n\n    @code{cpp}\n    for (auto it = j_object.begin(); it != j_object.end(); ++it)\n    {\n        std::cout << \"key: \" << it.key() << \", value:\" << it.value() << '\\n';\n    }\n    @endcode\n\n    Range-based for loop without iterator proxy:\n\n    @code{cpp}\n    for (auto it : j_object)\n    {\n        // \"it\" is of type json::reference and has no key() member\n        std::cout << \"value: \" << it << '\\n';\n    }\n    @endcode\n\n    Range-based for loop with iterator proxy:\n\n    @code{cpp}\n    for (auto it : json::iterator_wrapper(j_object))\n    {\n        std::cout << \"key: \" << it.key() << \", value:\" << it.value() << '\\n';\n    }\n    @endcode\n\n    @note When iterating over an array, `key()` will return the index of the\n          element as string (see example).\n\n    @param[in] ref  reference to a JSON value\n    @return iteration proxy object wrapping @a ref with an interface to use in\n            range-based for loops\n\n    @liveexample{The following code shows how the wrapper is used,iterator_wrapper}\n\n    @exceptionsafety Strong guarantee: if an exception is thrown, there are no\n    changes in the JSON value.\n\n    @complexity Constant.\n\n    @note The name of this function is not yet final and may change in the\n    future.\n\n    @deprecated This stream operator is deprecated and will be removed in\n                future 4.0.0 of the library. Please use @ref items() instead;\n                that is, replace `json::iterator_wrapper(j)` with `j.items()`.\n    */\n    JSON_HEDLEY_DEPRECATED_FOR(3.1.0, items())\n    static iteration_proxy<iterator> iterator_wrapper(reference ref) noexcept\n    {\n        return ref.items();\n    }\n\n    /*!\n    @copydoc iterator_wrapper(reference)\n    */\n    JSON_HEDLEY_DEPRECATED_FOR(3.1.0, items())\n    static iteration_proxy<const_iterator> iterator_wrapper(const_reference ref) noexcept\n    {\n        return ref.items();\n    }\n\n    /*!\n    @brief helper to access iterator member functions in range-based for\n\n    This function allows to access @ref iterator::key() and @ref\n    iterator::value() during range-based for loops. In these loops, a\n    reference to the JSON values is returned, so there is no access to the\n    underlying iterator.\n\n    For loop without `items()` function:\n\n    @code{cpp}\n    for (auto it = j_object.begin(); it != j_object.end(); ++it)\n    {\n        std::cout << \"key: \" << it.key() << \", value:\" << it.value() << '\\n';\n    }\n    @endcode\n\n    Range-based for loop without `items()` function:\n\n    @code{cpp}\n    for (auto it : j_object)\n    {\n        // \"it\" is of type json::reference and has no key() member\n        std::cout << \"value: \" << it << '\\n';\n    }\n    @endcode\n\n    Range-based for loop with `items()` function:\n\n    @code{cpp}\n    for (auto& el : j_object.items())\n    {\n        std::cout << \"key: \" << el.key() << \", value:\" << el.value() << '\\n';\n    }\n    @endcode\n\n    The `items()` function also allows to use\n    [structured bindings](https://en.cppreference.com/w/cpp/language/structured_binding)\n    (C++17):\n\n    @code{cpp}\n    for (auto& [key, val] : j_object.items())\n    {\n        std::cout << \"key: \" << key << \", value:\" << val << '\\n';\n    }\n    @endcode\n\n    @note When iterating over an array, `key()` will return the index of the\n          element as string (see example). For primitive types (e.g., numbers),\n          `key()` returns an empty string.\n\n    @warning Using `items()` on temporary objects is dangerous. Make sure the\n             object's lifetime exeeds the iteration. See\n             <https://github.com/nlohmann/json/issues/2040> for more\n             information.\n\n    @return iteration proxy object wrapping @a ref with an interface to use in\n            range-based for loops\n\n    @liveexample{The following code shows how the function is used.,items}\n\n    @exceptionsafety Strong guarantee: if an exception is thrown, there are no\n    changes in the JSON value.\n\n    @complexity Constant.\n\n    @since version 3.1.0, structured bindings support since 3.5.0.\n    */\n    iteration_proxy<iterator> items() noexcept\n    {\n        return iteration_proxy<iterator>(*this);\n    }\n\n    /*!\n    @copydoc items()\n    */\n    iteration_proxy<const_iterator> items() const noexcept\n    {\n        return iteration_proxy<const_iterator>(*this);\n    }\n\n    /// @}\n\n\n    //////////////\n    // capacity //\n    //////////////\n\n    /// @name capacity\n    /// @{\n\n    /*!\n    @brief checks whether the container is empty.\n\n    Checks if a JSON value has no elements (i.e. whether its @ref size is `0`).\n\n    @return The return value depends on the different types and is\n            defined as follows:\n            Value type  | return value\n            ----------- | -------------\n            null        | `true`\n            boolean     | `false`\n            string      | `false`\n            number      | `false`\n            binary      | `false`\n            object      | result of function `object_t::empty()`\n            array       | result of function `array_t::empty()`\n\n    @liveexample{The following code uses `empty()` to check if a JSON\n    object contains any elements.,empty}\n\n    @complexity Constant, as long as @ref array_t and @ref object_t satisfy\n    the Container concept; that is, their `empty()` functions have constant\n    complexity.\n\n    @iterators No changes.\n\n    @exceptionsafety No-throw guarantee: this function never throws exceptions.\n\n    @note This function does not return whether a string stored as JSON value\n    is empty - it returns whether the JSON container itself is empty which is\n    false in the case of a string.\n\n    @requirement This function helps `basic_json` satisfying the\n    [Container](https://en.cppreference.com/w/cpp/named_req/Container)\n    requirements:\n    - The complexity is constant.\n    - Has the semantics of `begin() == end()`.\n\n    @sa @ref size() -- returns the number of elements\n\n    @since version 1.0.0\n    */\n    bool empty() const noexcept\n    {\n        switch (m_type)\n        {\n            case value_t::null:\n            {\n                // null values are empty\n                return true;\n            }\n\n            case value_t::array:\n            {\n                // delegate call to array_t::empty()\n                return m_value.array->empty();\n            }\n\n            case value_t::object:\n            {\n                // delegate call to object_t::empty()\n                return m_value.object->empty();\n            }\n\n            default:\n            {\n                // all other types are nonempty\n                return false;\n            }\n        }\n    }\n\n    /*!\n    @brief returns the number of elements\n\n    Returns the number of elements in a JSON value.\n\n    @return The return value depends on the different types and is\n            defined as follows:\n            Value type  | return value\n            ----------- | -------------\n            null        | `0`\n            boolean     | `1`\n            string      | `1`\n            number      | `1`\n            binary      | `1`\n            object      | result of function object_t::size()\n            array       | result of function array_t::size()\n\n    @liveexample{The following code calls `size()` on the different value\n    types.,size}\n\n    @complexity Constant, as long as @ref array_t and @ref object_t satisfy\n    the Container concept; that is, their size() functions have constant\n    complexity.\n\n    @iterators No changes.\n\n    @exceptionsafety No-throw guarantee: this function never throws exceptions.\n\n    @note This function does not return the length of a string stored as JSON\n    value - it returns the number of elements in the JSON value which is 1 in\n    the case of a string.\n\n    @requirement This function helps `basic_json` satisfying the\n    [Container](https://en.cppreference.com/w/cpp/named_req/Container)\n    requirements:\n    - The complexity is constant.\n    - Has the semantics of `std::distance(begin(), end())`.\n\n    @sa @ref empty() -- checks whether the container is empty\n    @sa @ref max_size() -- returns the maximal number of elements\n\n    @since version 1.0.0\n    */\n    size_type size() const noexcept\n    {\n        switch (m_type)\n        {\n            case value_t::null:\n            {\n                // null values are empty\n                return 0;\n            }\n\n            case value_t::array:\n            {\n                // delegate call to array_t::size()\n                return m_value.array->size();\n            }\n\n            case value_t::object:\n            {\n                // delegate call to object_t::size()\n                return m_value.object->size();\n            }\n\n            default:\n            {\n                // all other types have size 1\n                return 1;\n            }\n        }\n    }\n\n    /*!\n    @brief returns the maximum possible number of elements\n\n    Returns the maximum number of elements a JSON value is able to hold due to\n    system or library implementation limitations, i.e. `std::distance(begin(),\n    end())` for the JSON value.\n\n    @return The return value depends on the different types and is\n            defined as follows:\n            Value type  | return value\n            ----------- | -------------\n            null        | `0` (same as `size()`)\n            boolean     | `1` (same as `size()`)\n            string      | `1` (same as `size()`)\n            number      | `1` (same as `size()`)\n            binary      | `1` (same as `size()`)\n            object      | result of function `object_t::max_size()`\n            array       | result of function `array_t::max_size()`\n\n    @liveexample{The following code calls `max_size()` on the different value\n    types. Note the output is implementation specific.,max_size}\n\n    @complexity Constant, as long as @ref array_t and @ref object_t satisfy\n    the Container concept; that is, their `max_size()` functions have constant\n    complexity.\n\n    @iterators No changes.\n\n    @exceptionsafety No-throw guarantee: this function never throws exceptions.\n\n    @requirement This function helps `basic_json` satisfying the\n    [Container](https://en.cppreference.com/w/cpp/named_req/Container)\n    requirements:\n    - The complexity is constant.\n    - Has the semantics of returning `b.size()` where `b` is the largest\n      possible JSON value.\n\n    @sa @ref size() -- returns the number of elements\n\n    @since version 1.0.0\n    */\n    size_type max_size() const noexcept\n    {\n        switch (m_type)\n        {\n            case value_t::array:\n            {\n                // delegate call to array_t::max_size()\n                return m_value.array->max_size();\n            }\n\n            case value_t::object:\n            {\n                // delegate call to object_t::max_size()\n                return m_value.object->max_size();\n            }\n\n            default:\n            {\n                // all other types have max_size() == size()\n                return size();\n            }\n        }\n    }\n\n    /// @}\n\n\n    ///////////////\n    // modifiers //\n    ///////////////\n\n    /// @name modifiers\n    /// @{\n\n    /*!\n    @brief clears the contents\n\n    Clears the content of a JSON value and resets it to the default value as\n    if @ref basic_json(value_t) would have been called with the current value\n    type from @ref type():\n\n    Value type  | initial value\n    ----------- | -------------\n    null        | `null`\n    boolean     | `false`\n    string      | `\"\"`\n    number      | `0`\n    binary      | An empty byte vector\n    object      | `{}`\n    array       | `[]`\n\n    @post Has the same effect as calling\n    @code {.cpp}\n    *this = basic_json(type());\n    @endcode\n\n    @liveexample{The example below shows the effect of `clear()` to different\n    JSON types.,clear}\n\n    @complexity Linear in the size of the JSON value.\n\n    @iterators All iterators, pointers and references related to this container\n               are invalidated.\n\n    @exceptionsafety No-throw guarantee: this function never throws exceptions.\n\n    @sa @ref basic_json(value_t) -- constructor that creates an object with the\n        same value than calling `clear()`\n\n    @since version 1.0.0\n    */\n    void clear() noexcept\n    {\n        switch (m_type)\n        {\n            case value_t::number_integer:\n            {\n                m_value.number_integer = 0;\n                break;\n            }\n\n            case value_t::number_unsigned:\n            {\n                m_value.number_unsigned = 0;\n                break;\n            }\n\n            case value_t::number_float:\n            {\n                m_value.number_float = 0.0;\n                break;\n            }\n\n            case value_t::boolean:\n            {\n                m_value.boolean = false;\n                break;\n            }\n\n            case value_t::string:\n            {\n                m_value.string->clear();\n                break;\n            }\n\n            case value_t::binary:\n            {\n                m_value.binary->clear();\n                break;\n            }\n\n            case value_t::array:\n            {\n                m_value.array->clear();\n                break;\n            }\n\n            case value_t::object:\n            {\n                m_value.object->clear();\n                break;\n            }\n\n            default:\n                break;\n        }\n    }\n\n    /*!\n    @brief add an object to an array\n\n    Appends the given element @a val to the end of the JSON value. If the\n    function is called on a JSON null value, an empty array is created before\n    appending @a val.\n\n    @param[in] val the value to add to the JSON array\n\n    @throw type_error.308 when called on a type other than JSON array or\n    null; example: `\"cannot use push_back() with number\"`\n\n    @complexity Amortized constant.\n\n    @liveexample{The example shows how `push_back()` and `+=` can be used to\n    add elements to a JSON array. Note how the `null` value was silently\n    converted to a JSON array.,push_back}\n\n    @since version 1.0.0\n    */\n    void push_back(basic_json&& val)\n    {\n        // push_back only works for null objects or arrays\n        if (JSON_HEDLEY_UNLIKELY(!(is_null() || is_array())))\n        {\n            JSON_THROW(type_error::create(308, \"cannot use push_back() with \" + std::string(type_name())));\n        }\n\n        // transform null object into an array\n        if (is_null())\n        {\n            m_type = value_t::array;\n            m_value = value_t::array;\n            assert_invariant();\n        }\n\n        // add element to array (move semantics)\n        m_value.array->push_back(std::move(val));\n        // if val is moved from, basic_json move constructor marks it null so we do not call the destructor\n    }\n\n    /*!\n    @brief add an object to an array\n    @copydoc push_back(basic_json&&)\n    */\n    reference operator+=(basic_json&& val)\n    {\n        push_back(std::move(val));\n        return *this;\n    }\n\n    /*!\n    @brief add an object to an array\n    @copydoc push_back(basic_json&&)\n    */\n    void push_back(const basic_json& val)\n    {\n        // push_back only works for null objects or arrays\n        if (JSON_HEDLEY_UNLIKELY(!(is_null() || is_array())))\n        {\n            JSON_THROW(type_error::create(308, \"cannot use push_back() with \" + std::string(type_name())));\n        }\n\n        // transform null object into an array\n        if (is_null())\n        {\n            m_type = value_t::array;\n            m_value = value_t::array;\n            assert_invariant();\n        }\n\n        // add element to array\n        m_value.array->push_back(val);\n    }\n\n    /*!\n    @brief add an object to an array\n    @copydoc push_back(basic_json&&)\n    */\n    reference operator+=(const basic_json& val)\n    {\n        push_back(val);\n        return *this;\n    }\n\n    /*!\n    @brief add an object to an object\n\n    Inserts the given element @a val to the JSON object. If the function is\n    called on a JSON null value, an empty object is created before inserting\n    @a val.\n\n    @param[in] val the value to add to the JSON object\n\n    @throw type_error.308 when called on a type other than JSON object or\n    null; example: `\"cannot use push_back() with number\"`\n\n    @complexity Logarithmic in the size of the container, O(log(`size()`)).\n\n    @liveexample{The example shows how `push_back()` and `+=` can be used to\n    add elements to a JSON object. Note how the `null` value was silently\n    converted to a JSON object.,push_back__object_t__value}\n\n    @since version 1.0.0\n    */\n    void push_back(const typename object_t::value_type& val)\n    {\n        // push_back only works for null objects or objects\n        if (JSON_HEDLEY_UNLIKELY(!(is_null() || is_object())))\n        {\n            JSON_THROW(type_error::create(308, \"cannot use push_back() with \" + std::string(type_name())));\n        }\n\n        // transform null object into an object\n        if (is_null())\n        {\n            m_type = value_t::object;\n            m_value = value_t::object;\n            assert_invariant();\n        }\n\n        // add element to array\n        m_value.object->insert(val);\n    }\n\n    /*!\n    @brief add an object to an object\n    @copydoc push_back(const typename object_t::value_type&)\n    */\n    reference operator+=(const typename object_t::value_type& val)\n    {\n        push_back(val);\n        return *this;\n    }\n\n    /*!\n    @brief add an object to an object\n\n    This function allows to use `push_back` with an initializer list. In case\n\n    1. the current value is an object,\n    2. the initializer list @a init contains only two elements, and\n    3. the first element of @a init is a string,\n\n    @a init is converted into an object element and added using\n    @ref push_back(const typename object_t::value_type&). Otherwise, @a init\n    is converted to a JSON value and added using @ref push_back(basic_json&&).\n\n    @param[in] init  an initializer list\n\n    @complexity Linear in the size of the initializer list @a init.\n\n    @note This function is required to resolve an ambiguous overload error,\n          because pairs like `{\"key\", \"value\"}` can be both interpreted as\n          `object_t::value_type` or `std::initializer_list<basic_json>`, see\n          https://github.com/nlohmann/json/issues/235 for more information.\n\n    @liveexample{The example shows how initializer lists are treated as\n    objects when possible.,push_back__initializer_list}\n    */\n    void push_back(initializer_list_t init)\n    {\n        if (is_object() && init.size() == 2 && (*init.begin())->is_string())\n        {\n            basic_json&& key = init.begin()->moved_or_copied();\n            push_back(typename object_t::value_type(\n                          std::move(key.get_ref<string_t&>()), (init.begin() + 1)->moved_or_copied()));\n        }\n        else\n        {\n            push_back(basic_json(init));\n        }\n    }\n\n    /*!\n    @brief add an object to an object\n    @copydoc push_back(initializer_list_t)\n    */\n    reference operator+=(initializer_list_t init)\n    {\n        push_back(init);\n        return *this;\n    }\n\n    /*!\n    @brief add an object to an array\n\n    Creates a JSON value from the passed parameters @a args to the end of the\n    JSON value. If the function is called on a JSON null value, an empty array\n    is created before appending the value created from @a args.\n\n    @param[in] args arguments to forward to a constructor of @ref basic_json\n    @tparam Args compatible types to create a @ref basic_json object\n\n    @return reference to the inserted element\n\n    @throw type_error.311 when called on a type other than JSON array or\n    null; example: `\"cannot use emplace_back() with number\"`\n\n    @complexity Amortized constant.\n\n    @liveexample{The example shows how `push_back()` can be used to add\n    elements to a JSON array. Note how the `null` value was silently converted\n    to a JSON array.,emplace_back}\n\n    @since version 2.0.8, returns reference since 3.7.0\n    */\n    template<class... Args>\n    reference emplace_back(Args&& ... args)\n    {\n        // emplace_back only works for null objects or arrays\n        if (JSON_HEDLEY_UNLIKELY(!(is_null() || is_array())))\n        {\n            JSON_THROW(type_error::create(311, \"cannot use emplace_back() with \" + std::string(type_name())));\n        }\n\n        // transform null object into an array\n        if (is_null())\n        {\n            m_type = value_t::array;\n            m_value = value_t::array;\n            assert_invariant();\n        }\n\n        // add element to array (perfect forwarding)\n#ifdef JSON_HAS_CPP_17\n        return m_value.array->emplace_back(std::forward<Args>(args)...);\n#else\n        m_value.array->emplace_back(std::forward<Args>(args)...);\n        return m_value.array->back();\n#endif\n    }\n\n    /*!\n    @brief add an object to an object if key does not exist\n\n    Inserts a new element into a JSON object constructed in-place with the\n    given @a args if there is no element with the key in the container. If the\n    function is called on a JSON null value, an empty object is created before\n    appending the value created from @a args.\n\n    @param[in] args arguments to forward to a constructor of @ref basic_json\n    @tparam Args compatible types to create a @ref basic_json object\n\n    @return a pair consisting of an iterator to the inserted element, or the\n            already-existing element if no insertion happened, and a bool\n            denoting whether the insertion took place.\n\n    @throw type_error.311 when called on a type other than JSON object or\n    null; example: `\"cannot use emplace() with number\"`\n\n    @complexity Logarithmic in the size of the container, O(log(`size()`)).\n\n    @liveexample{The example shows how `emplace()` can be used to add elements\n    to a JSON object. Note how the `null` value was silently converted to a\n    JSON object. Further note how no value is added if there was already one\n    value stored with the same key.,emplace}\n\n    @since version 2.0.8\n    */\n    template<class... Args>\n    std::pair<iterator, bool> emplace(Args&& ... args)\n    {\n        // emplace only works for null objects or arrays\n        if (JSON_HEDLEY_UNLIKELY(!(is_null() || is_object())))\n        {\n            JSON_THROW(type_error::create(311, \"cannot use emplace() with \" + std::string(type_name())));\n        }\n\n        // transform null object into an object\n        if (is_null())\n        {\n            m_type = value_t::object;\n            m_value = value_t::object;\n            assert_invariant();\n        }\n\n        // add element to array (perfect forwarding)\n        auto res = m_value.object->emplace(std::forward<Args>(args)...);\n        // create result iterator and set iterator to the result of emplace\n        auto it = begin();\n        it.m_it.object_iterator = res.first;\n\n        // return pair of iterator and boolean\n        return {it, res.second};\n    }\n\n    /// Helper for insertion of an iterator\n    /// @note: This uses std::distance to support GCC 4.8,\n    ///        see https://github.com/nlohmann/json/pull/1257\n    template<typename... Args>\n    iterator insert_iterator(const_iterator pos, Args&& ... args)\n    {\n        iterator result(this);\n        JSON_ASSERT(m_value.array != nullptr);\n\n        auto insert_pos = std::distance(m_value.array->begin(), pos.m_it.array_iterator);\n        m_value.array->insert(pos.m_it.array_iterator, std::forward<Args>(args)...);\n        result.m_it.array_iterator = m_value.array->begin() + insert_pos;\n\n        // This could have been written as:\n        // result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, cnt, val);\n        // but the return value of insert is missing in GCC 4.8, so it is written this way instead.\n\n        return result;\n    }\n\n    /*!\n    @brief inserts element\n\n    Inserts element @a val before iterator @a pos.\n\n    @param[in] pos iterator before which the content will be inserted; may be\n    the end() iterator\n    @param[in] val element to insert\n    @return iterator pointing to the inserted @a val.\n\n    @throw type_error.309 if called on JSON values other than arrays;\n    example: `\"cannot use insert() with string\"`\n    @throw invalid_iterator.202 if @a pos is not an iterator of *this;\n    example: `\"iterator does not fit current value\"`\n\n    @complexity Constant plus linear in the distance between @a pos and end of\n    the container.\n\n    @liveexample{The example shows how `insert()` is used.,insert}\n\n    @since version 1.0.0\n    */\n    iterator insert(const_iterator pos, const basic_json& val)\n    {\n        // insert only works for arrays\n        if (JSON_HEDLEY_LIKELY(is_array()))\n        {\n            // check if iterator pos fits to this JSON value\n            if (JSON_HEDLEY_UNLIKELY(pos.m_object != this))\n            {\n                JSON_THROW(invalid_iterator::create(202, \"iterator does not fit current value\"));\n            }\n\n            // insert to array and return iterator\n            return insert_iterator(pos, val);\n        }\n\n        JSON_THROW(type_error::create(309, \"cannot use insert() with \" + std::string(type_name())));\n    }\n\n    /*!\n    @brief inserts element\n    @copydoc insert(const_iterator, const basic_json&)\n    */\n    iterator insert(const_iterator pos, basic_json&& val)\n    {\n        return insert(pos, val);\n    }\n\n    /*!\n    @brief inserts elements\n\n    Inserts @a cnt copies of @a val before iterator @a pos.\n\n    @param[in] pos iterator before which the content will be inserted; may be\n    the end() iterator\n    @param[in] cnt number of copies of @a val to insert\n    @param[in] val element to insert\n    @return iterator pointing to the first element inserted, or @a pos if\n    `cnt==0`\n\n    @throw type_error.309 if called on JSON values other than arrays; example:\n    `\"cannot use insert() with string\"`\n    @throw invalid_iterator.202 if @a pos is not an iterator of *this;\n    example: `\"iterator does not fit current value\"`\n\n    @complexity Linear in @a cnt plus linear in the distance between @a pos\n    and end of the container.\n\n    @liveexample{The example shows how `insert()` is used.,insert__count}\n\n    @since version 1.0.0\n    */\n    iterator insert(const_iterator pos, size_type cnt, const basic_json& val)\n    {\n        // insert only works for arrays\n        if (JSON_HEDLEY_LIKELY(is_array()))\n        {\n            // check if iterator pos fits to this JSON value\n            if (JSON_HEDLEY_UNLIKELY(pos.m_object != this))\n            {\n                JSON_THROW(invalid_iterator::create(202, \"iterator does not fit current value\"));\n            }\n\n            // insert to array and return iterator\n            return insert_iterator(pos, cnt, val);\n        }\n\n        JSON_THROW(type_error::create(309, \"cannot use insert() with \" + std::string(type_name())));\n    }\n\n    /*!\n    @brief inserts elements\n\n    Inserts elements from range `[first, last)` before iterator @a pos.\n\n    @param[in] pos iterator before which the content will be inserted; may be\n    the end() iterator\n    @param[in] first begin of the range of elements to insert\n    @param[in] last end of the range of elements to insert\n\n    @throw type_error.309 if called on JSON values other than arrays; example:\n    `\"cannot use insert() with string\"`\n    @throw invalid_iterator.202 if @a pos is not an iterator of *this;\n    example: `\"iterator does not fit current value\"`\n    @throw invalid_iterator.210 if @a first and @a last do not belong to the\n    same JSON value; example: `\"iterators do not fit\"`\n    @throw invalid_iterator.211 if @a first or @a last are iterators into\n    container for which insert is called; example: `\"passed iterators may not\n    belong to container\"`\n\n    @return iterator pointing to the first element inserted, or @a pos if\n    `first==last`\n\n    @complexity Linear in `std::distance(first, last)` plus linear in the\n    distance between @a pos and end of the container.\n\n    @liveexample{The example shows how `insert()` is used.,insert__range}\n\n    @since version 1.0.0\n    */\n    iterator insert(const_iterator pos, const_iterator first, const_iterator last)\n    {\n        // insert only works for arrays\n        if (JSON_HEDLEY_UNLIKELY(!is_array()))\n        {\n            JSON_THROW(type_error::create(309, \"cannot use insert() with \" + std::string(type_name())));\n        }\n\n        // check if iterator pos fits to this JSON value\n        if (JSON_HEDLEY_UNLIKELY(pos.m_object != this))\n        {\n            JSON_THROW(invalid_iterator::create(202, \"iterator does not fit current value\"));\n        }\n\n        // check if range iterators belong to the same JSON object\n        if (JSON_HEDLEY_UNLIKELY(first.m_object != last.m_object))\n        {\n            JSON_THROW(invalid_iterator::create(210, \"iterators do not fit\"));\n        }\n\n        if (JSON_HEDLEY_UNLIKELY(first.m_object == this))\n        {\n            JSON_THROW(invalid_iterator::create(211, \"passed iterators may not belong to container\"));\n        }\n\n        // insert to array and return iterator\n        return insert_iterator(pos, first.m_it.array_iterator, last.m_it.array_iterator);\n    }\n\n    /*!\n    @brief inserts elements\n\n    Inserts elements from initializer list @a ilist before iterator @a pos.\n\n    @param[in] pos iterator before which the content will be inserted; may be\n    the end() iterator\n    @param[in] ilist initializer list to insert the values from\n\n    @throw type_error.309 if called on JSON values other than arrays; example:\n    `\"cannot use insert() with string\"`\n    @throw invalid_iterator.202 if @a pos is not an iterator of *this;\n    example: `\"iterator does not fit current value\"`\n\n    @return iterator pointing to the first element inserted, or @a pos if\n    `ilist` is empty\n\n    @complexity Linear in `ilist.size()` plus linear in the distance between\n    @a pos and end of the container.\n\n    @liveexample{The example shows how `insert()` is used.,insert__ilist}\n\n    @since version 1.0.0\n    */\n    iterator insert(const_iterator pos, initializer_list_t ilist)\n    {\n        // insert only works for arrays\n        if (JSON_HEDLEY_UNLIKELY(!is_array()))\n        {\n            JSON_THROW(type_error::create(309, \"cannot use insert() with \" + std::string(type_name())));\n        }\n\n        // check if iterator pos fits to this JSON value\n        if (JSON_HEDLEY_UNLIKELY(pos.m_object != this))\n        {\n            JSON_THROW(invalid_iterator::create(202, \"iterator does not fit current value\"));\n        }\n\n        // insert to array and return iterator\n        return insert_iterator(pos, ilist.begin(), ilist.end());\n    }\n\n    /*!\n    @brief inserts elements\n\n    Inserts elements from range `[first, last)`.\n\n    @param[in] first begin of the range of elements to insert\n    @param[in] last end of the range of elements to insert\n\n    @throw type_error.309 if called on JSON values other than objects; example:\n    `\"cannot use insert() with string\"`\n    @throw invalid_iterator.202 if iterator @a first or @a last does does not\n    point to an object; example: `\"iterators first and last must point to\n    objects\"`\n    @throw invalid_iterator.210 if @a first and @a last do not belong to the\n    same JSON value; example: `\"iterators do not fit\"`\n\n    @complexity Logarithmic: `O(N*log(size() + N))`, where `N` is the number\n    of elements to insert.\n\n    @liveexample{The example shows how `insert()` is used.,insert__range_object}\n\n    @since version 3.0.0\n    */\n    void insert(const_iterator first, const_iterator last)\n    {\n        // insert only works for objects\n        if (JSON_HEDLEY_UNLIKELY(!is_object()))\n        {\n            JSON_THROW(type_error::create(309, \"cannot use insert() with \" + std::string(type_name())));\n        }\n\n        // check if range iterators belong to the same JSON object\n        if (JSON_HEDLEY_UNLIKELY(first.m_object != last.m_object))\n        {\n            JSON_THROW(invalid_iterator::create(210, \"iterators do not fit\"));\n        }\n\n        // passed iterators must belong to objects\n        if (JSON_HEDLEY_UNLIKELY(!first.m_object->is_object()))\n        {\n            JSON_THROW(invalid_iterator::create(202, \"iterators first and last must point to objects\"));\n        }\n\n        m_value.object->insert(first.m_it.object_iterator, last.m_it.object_iterator);\n    }\n\n    /*!\n    @brief updates a JSON object from another object, overwriting existing keys\n\n    Inserts all values from JSON object @a j and overwrites existing keys.\n\n    @param[in] j  JSON object to read values from\n\n    @throw type_error.312 if called on JSON values other than objects; example:\n    `\"cannot use update() with string\"`\n\n    @complexity O(N*log(size() + N)), where N is the number of elements to\n                insert.\n\n    @liveexample{The example shows how `update()` is used.,update}\n\n    @sa https://docs.python.org/3.6/library/stdtypes.html#dict.update\n\n    @since version 3.0.0\n    */\n    void update(const_reference j)\n    {\n        // implicitly convert null value to an empty object\n        if (is_null())\n        {\n            m_type = value_t::object;\n            m_value.object = create<object_t>();\n            assert_invariant();\n        }\n\n        if (JSON_HEDLEY_UNLIKELY(!is_object()))\n        {\n            JSON_THROW(type_error::create(312, \"cannot use update() with \" + std::string(type_name())));\n        }\n        if (JSON_HEDLEY_UNLIKELY(!j.is_object()))\n        {\n            JSON_THROW(type_error::create(312, \"cannot use update() with \" + std::string(j.type_name())));\n        }\n\n        for (auto it = j.cbegin(); it != j.cend(); ++it)\n        {\n            m_value.object->operator[](it.key()) = it.value();\n        }\n    }\n\n    /*!\n    @brief updates a JSON object from another object, overwriting existing keys\n\n    Inserts all values from from range `[first, last)` and overwrites existing\n    keys.\n\n    @param[in] first begin of the range of elements to insert\n    @param[in] last end of the range of elements to insert\n\n    @throw type_error.312 if called on JSON values other than objects; example:\n    `\"cannot use update() with string\"`\n    @throw invalid_iterator.202 if iterator @a first or @a last does does not\n    point to an object; example: `\"iterators first and last must point to\n    objects\"`\n    @throw invalid_iterator.210 if @a first and @a last do not belong to the\n    same JSON value; example: `\"iterators do not fit\"`\n\n    @complexity O(N*log(size() + N)), where N is the number of elements to\n                insert.\n\n    @liveexample{The example shows how `update()` is used__range.,update}\n\n    @sa https://docs.python.org/3.6/library/stdtypes.html#dict.update\n\n    @since version 3.0.0\n    */\n    void update(const_iterator first, const_iterator last)\n    {\n        // implicitly convert null value to an empty object\n        if (is_null())\n        {\n            m_type = value_t::object;\n            m_value.object = create<object_t>();\n            assert_invariant();\n        }\n\n        if (JSON_HEDLEY_UNLIKELY(!is_object()))\n        {\n            JSON_THROW(type_error::create(312, \"cannot use update() with \" + std::string(type_name())));\n        }\n\n        // check if range iterators belong to the same JSON object\n        if (JSON_HEDLEY_UNLIKELY(first.m_object != last.m_object))\n        {\n            JSON_THROW(invalid_iterator::create(210, \"iterators do not fit\"));\n        }\n\n        // passed iterators must belong to objects\n        if (JSON_HEDLEY_UNLIKELY(!first.m_object->is_object()\n                                 || !last.m_object->is_object()))\n        {\n            JSON_THROW(invalid_iterator::create(202, \"iterators first and last must point to objects\"));\n        }\n\n        for (auto it = first; it != last; ++it)\n        {\n            m_value.object->operator[](it.key()) = it.value();\n        }\n    }\n\n    /*!\n    @brief exchanges the values\n\n    Exchanges the contents of the JSON value with those of @a other. Does not\n    invoke any move, copy, or swap operations on individual elements. All\n    iterators and references remain valid. The past-the-end iterator is\n    invalidated.\n\n    @param[in,out] other JSON value to exchange the contents with\n\n    @complexity Constant.\n\n    @liveexample{The example below shows how JSON values can be swapped with\n    `swap()`.,swap__reference}\n\n    @since version 1.0.0\n    */\n    void swap(reference other) noexcept (\n        std::is_nothrow_move_constructible<value_t>::value&&\n        std::is_nothrow_move_assignable<value_t>::value&&\n        std::is_nothrow_move_constructible<json_value>::value&&\n        std::is_nothrow_move_assignable<json_value>::value\n    )\n    {\n        std::swap(m_type, other.m_type);\n        std::swap(m_value, other.m_value);\n        assert_invariant();\n    }\n\n    /*!\n    @brief exchanges the values\n\n    Exchanges the contents of the JSON value from @a left with those of @a right. Does not\n    invoke any move, copy, or swap operations on individual elements. All\n    iterators and references remain valid. The past-the-end iterator is\n    invalidated. implemented as a friend function callable via ADL.\n\n    @param[in,out] left JSON value to exchange the contents with\n    @param[in,out] right JSON value to exchange the contents with\n\n    @complexity Constant.\n\n    @liveexample{The example below shows how JSON values can be swapped with\n    `swap()`.,swap__reference}\n\n    @since version 1.0.0\n    */\n    friend void swap(reference left, reference right) noexcept (\n        std::is_nothrow_move_constructible<value_t>::value&&\n        std::is_nothrow_move_assignable<value_t>::value&&\n        std::is_nothrow_move_constructible<json_value>::value&&\n        std::is_nothrow_move_assignable<json_value>::value\n    )\n    {\n        left.swap(right);\n    }\n\n    /*!\n    @brief exchanges the values\n\n    Exchanges the contents of a JSON array with those of @a other. Does not\n    invoke any move, copy, or swap operations on individual elements. All\n    iterators and references remain valid. The past-the-end iterator is\n    invalidated.\n\n    @param[in,out] other array to exchange the contents with\n\n    @throw type_error.310 when JSON value is not an array; example: `\"cannot\n    use swap() with string\"`\n\n    @complexity Constant.\n\n    @liveexample{The example below shows how arrays can be swapped with\n    `swap()`.,swap__array_t}\n\n    @since version 1.0.0\n    */\n    void swap(array_t& other)\n    {\n        // swap only works for arrays\n        if (JSON_HEDLEY_LIKELY(is_array()))\n        {\n            std::swap(*(m_value.array), other);\n        }\n        else\n        {\n            JSON_THROW(type_error::create(310, \"cannot use swap() with \" + std::string(type_name())));\n        }\n    }\n\n    /*!\n    @brief exchanges the values\n\n    Exchanges the contents of a JSON object with those of @a other. Does not\n    invoke any move, copy, or swap operations on individual elements. All\n    iterators and references remain valid. The past-the-end iterator is\n    invalidated.\n\n    @param[in,out] other object to exchange the contents with\n\n    @throw type_error.310 when JSON value is not an object; example:\n    `\"cannot use swap() with string\"`\n\n    @complexity Constant.\n\n    @liveexample{The example below shows how objects can be swapped with\n    `swap()`.,swap__object_t}\n\n    @since version 1.0.0\n    */\n    void swap(object_t& other)\n    {\n        // swap only works for objects\n        if (JSON_HEDLEY_LIKELY(is_object()))\n        {\n            std::swap(*(m_value.object), other);\n        }\n        else\n        {\n            JSON_THROW(type_error::create(310, \"cannot use swap() with \" + std::string(type_name())));\n        }\n    }\n\n    /*!\n    @brief exchanges the values\n\n    Exchanges the contents of a JSON string with those of @a other. Does not\n    invoke any move, copy, or swap operations on individual elements. All\n    iterators and references remain valid. The past-the-end iterator is\n    invalidated.\n\n    @param[in,out] other string to exchange the contents with\n\n    @throw type_error.310 when JSON value is not a string; example: `\"cannot\n    use swap() with boolean\"`\n\n    @complexity Constant.\n\n    @liveexample{The example below shows how strings can be swapped with\n    `swap()`.,swap__string_t}\n\n    @since version 1.0.0\n    */\n    void swap(string_t& other)\n    {\n        // swap only works for strings\n        if (JSON_HEDLEY_LIKELY(is_string()))\n        {\n            std::swap(*(m_value.string), other);\n        }\n        else\n        {\n            JSON_THROW(type_error::create(310, \"cannot use swap() with \" + std::string(type_name())));\n        }\n    }\n\n    /*!\n    @brief exchanges the values\n\n    Exchanges the contents of a JSON string with those of @a other. Does not\n    invoke any move, copy, or swap operations on individual elements. All\n    iterators and references remain valid. The past-the-end iterator is\n    invalidated.\n\n    @param[in,out] other binary to exchange the contents with\n\n    @throw type_error.310 when JSON value is not a string; example: `\"cannot\n    use swap() with boolean\"`\n\n    @complexity Constant.\n\n    @liveexample{The example below shows how strings can be swapped with\n    `swap()`.,swap__binary_t}\n\n    @since version 3.8.0\n    */\n    void swap(binary_t& other)\n    {\n        // swap only works for strings\n        if (JSON_HEDLEY_LIKELY(is_binary()))\n        {\n            std::swap(*(m_value.binary), other);\n        }\n        else\n        {\n            JSON_THROW(type_error::create(310, \"cannot use swap() with \" + std::string(type_name())));\n        }\n    }\n\n    /// @copydoc swap(binary_t)\n    void swap(typename binary_t::container_type& other)\n    {\n        // swap only works for strings\n        if (JSON_HEDLEY_LIKELY(is_binary()))\n        {\n            std::swap(*(m_value.binary), other);\n        }\n        else\n        {\n            JSON_THROW(type_error::create(310, \"cannot use swap() with \" + std::string(type_name())));\n        }\n    }\n\n    /// @}\n\n  public:\n    //////////////////////////////////////////\n    // lexicographical comparison operators //\n    //////////////////////////////////////////\n\n    /// @name lexicographical comparison operators\n    /// @{\n\n    /*!\n    @brief comparison: equal\n\n    Compares two JSON values for equality according to the following rules:\n    - Two JSON values are equal if (1) they are from the same type and (2)\n      their stored values are the same according to their respective\n      `operator==`.\n    - Integer and floating-point numbers are automatically converted before\n      comparison. Note that two NaN values are always treated as unequal.\n    - Two JSON null values are equal.\n\n    @note Floating-point inside JSON values numbers are compared with\n    `json::number_float_t::operator==` which is `double::operator==` by\n    default. To compare floating-point while respecting an epsilon, an alternative\n    [comparison function](https://github.com/mariokonrad/marnav/blob/master/include/marnav/math/floatingpoint.hpp#L34-#L39)\n    could be used, for instance\n    @code {.cpp}\n    template<typename T, typename = typename std::enable_if<std::is_floating_point<T>::value, T>::type>\n    inline bool is_same(T a, T b, T epsilon = std::numeric_limits<T>::epsilon()) noexcept\n    {\n        return std::abs(a - b) <= epsilon;\n    }\n    @endcode\n    Or you can self-defined operator equal function like this:\n    @code {.cpp}\n    bool my_equal(const_reference lhs, const_reference rhs) {\n    const auto lhs_type lhs.type();\n    const auto rhs_type rhs.type();\n    if (lhs_type == rhs_type) {\n        switch(lhs_type)\n            // self_defined case\n            case value_t::number_float:\n                return std::abs(lhs - rhs) <= std::numeric_limits<float>::epsilon();\n            // other cases remain the same with the original\n            ...\n    }\n    ...\n    }\n    @endcode\n\n    @note NaN values never compare equal to themselves or to other NaN values.\n\n    @param[in] lhs  first JSON value to consider\n    @param[in] rhs  second JSON value to consider\n    @return whether the values @a lhs and @a rhs are equal\n\n    @exceptionsafety No-throw guarantee: this function never throws exceptions.\n\n    @complexity Linear.\n\n    @liveexample{The example demonstrates comparing several JSON\n    types.,operator__equal}\n\n    @since version 1.0.0\n    */\n    friend bool operator==(const_reference lhs, const_reference rhs) noexcept\n    {\n        const auto lhs_type = lhs.type();\n        const auto rhs_type = rhs.type();\n\n        if (lhs_type == rhs_type)\n        {\n            switch (lhs_type)\n            {\n                case value_t::array:\n                    return *lhs.m_value.array == *rhs.m_value.array;\n\n                case value_t::object:\n                    return *lhs.m_value.object == *rhs.m_value.object;\n\n                case value_t::null:\n                    return true;\n\n                case value_t::string:\n                    return *lhs.m_value.string == *rhs.m_value.string;\n\n                case value_t::boolean:\n                    return lhs.m_value.boolean == rhs.m_value.boolean;\n\n                case value_t::number_integer:\n                    return lhs.m_value.number_integer == rhs.m_value.number_integer;\n\n                case value_t::number_unsigned:\n                    return lhs.m_value.number_unsigned == rhs.m_value.number_unsigned;\n\n                case value_t::number_float:\n                    return lhs.m_value.number_float == rhs.m_value.number_float;\n\n                case value_t::binary:\n                    return *lhs.m_value.binary == *rhs.m_value.binary;\n\n                default:\n                    return false;\n            }\n        }\n        else if (lhs_type == value_t::number_integer && rhs_type == value_t::number_float)\n        {\n            return static_cast<number_float_t>(lhs.m_value.number_integer) == rhs.m_value.number_float;\n        }\n        else if (lhs_type == value_t::number_float && rhs_type == value_t::number_integer)\n        {\n            return lhs.m_value.number_float == static_cast<number_float_t>(rhs.m_value.number_integer);\n        }\n        else if (lhs_type == value_t::number_unsigned && rhs_type == value_t::number_float)\n        {\n            return static_cast<number_float_t>(lhs.m_value.number_unsigned) == rhs.m_value.number_float;\n        }\n        else if (lhs_type == value_t::number_float && rhs_type == value_t::number_unsigned)\n        {\n            return lhs.m_value.number_float == static_cast<number_float_t>(rhs.m_value.number_unsigned);\n        }\n        else if (lhs_type == value_t::number_unsigned && rhs_type == value_t::number_integer)\n        {\n            return static_cast<number_integer_t>(lhs.m_value.number_unsigned) == rhs.m_value.number_integer;\n        }\n        else if (lhs_type == value_t::number_integer && rhs_type == value_t::number_unsigned)\n        {\n            return lhs.m_value.number_integer == static_cast<number_integer_t>(rhs.m_value.number_unsigned);\n        }\n\n        return false;\n    }\n\n    /*!\n    @brief comparison: equal\n    @copydoc operator==(const_reference, const_reference)\n    */\n    template<typename ScalarType, typename std::enable_if<\n                 std::is_scalar<ScalarType>::value, int>::type = 0>\n    friend bool operator==(const_reference lhs, const ScalarType rhs) noexcept\n    {\n        return lhs == basic_json(rhs);\n    }\n\n    /*!\n    @brief comparison: equal\n    @copydoc operator==(const_reference, const_reference)\n    */\n    template<typename ScalarType, typename std::enable_if<\n                 std::is_scalar<ScalarType>::value, int>::type = 0>\n    friend bool operator==(const ScalarType lhs, const_reference rhs) noexcept\n    {\n        return basic_json(lhs) == rhs;\n    }\n\n    /*!\n    @brief comparison: not equal\n\n    Compares two JSON values for inequality by calculating `not (lhs == rhs)`.\n\n    @param[in] lhs  first JSON value to consider\n    @param[in] rhs  second JSON value to consider\n    @return whether the values @a lhs and @a rhs are not equal\n\n    @complexity Linear.\n\n    @exceptionsafety No-throw guarantee: this function never throws exceptions.\n\n    @liveexample{The example demonstrates comparing several JSON\n    types.,operator__notequal}\n\n    @since version 1.0.0\n    */\n    friend bool operator!=(const_reference lhs, const_reference rhs) noexcept\n    {\n        return !(lhs == rhs);\n    }\n\n    /*!\n    @brief comparison: not equal\n    @copydoc operator!=(const_reference, const_reference)\n    */\n    template<typename ScalarType, typename std::enable_if<\n                 std::is_scalar<ScalarType>::value, int>::type = 0>\n    friend bool operator!=(const_reference lhs, const ScalarType rhs) noexcept\n    {\n        return lhs != basic_json(rhs);\n    }\n\n    /*!\n    @brief comparison: not equal\n    @copydoc operator!=(const_reference, const_reference)\n    */\n    template<typename ScalarType, typename std::enable_if<\n                 std::is_scalar<ScalarType>::value, int>::type = 0>\n    friend bool operator!=(const ScalarType lhs, const_reference rhs) noexcept\n    {\n        return basic_json(lhs) != rhs;\n    }\n\n    /*!\n    @brief comparison: less than\n\n    Compares whether one JSON value @a lhs is less than another JSON value @a\n    rhs according to the following rules:\n    - If @a lhs and @a rhs have the same type, the values are compared using\n      the default `<` operator.\n    - Integer and floating-point numbers are automatically converted before\n      comparison\n    - In case @a lhs and @a rhs have different types, the values are ignored\n      and the order of the types is considered, see\n      @ref operator<(const value_t, const value_t).\n\n    @param[in] lhs  first JSON value to consider\n    @param[in] rhs  second JSON value to consider\n    @return whether @a lhs is less than @a rhs\n\n    @complexity Linear.\n\n    @exceptionsafety No-throw guarantee: this function never throws exceptions.\n\n    @liveexample{The example demonstrates comparing several JSON\n    types.,operator__less}\n\n    @since version 1.0.0\n    */\n    friend bool operator<(const_reference lhs, const_reference rhs) noexcept\n    {\n        const auto lhs_type = lhs.type();\n        const auto rhs_type = rhs.type();\n\n        if (lhs_type == rhs_type)\n        {\n            switch (lhs_type)\n            {\n                case value_t::array:\n                    // note parentheses are necessary, see\n                    // https://github.com/nlohmann/json/issues/1530\n                    return (*lhs.m_value.array) < (*rhs.m_value.array);\n\n                case value_t::object:\n                    return (*lhs.m_value.object) < (*rhs.m_value.object);\n\n                case value_t::null:\n                    return false;\n\n                case value_t::string:\n                    return (*lhs.m_value.string) < (*rhs.m_value.string);\n\n                case value_t::boolean:\n                    return (lhs.m_value.boolean) < (rhs.m_value.boolean);\n\n                case value_t::number_integer:\n                    return (lhs.m_value.number_integer) < (rhs.m_value.number_integer);\n\n                case value_t::number_unsigned:\n                    return (lhs.m_value.number_unsigned) < (rhs.m_value.number_unsigned);\n\n                case value_t::number_float:\n                    return (lhs.m_value.number_float) < (rhs.m_value.number_float);\n\n                case value_t::binary:\n                    return (*lhs.m_value.binary) < (*rhs.m_value.binary);\n\n                default:\n                    return false;\n            }\n        }\n        else if (lhs_type == value_t::number_integer && rhs_type == value_t::number_float)\n        {\n            return static_cast<number_float_t>(lhs.m_value.number_integer) < rhs.m_value.number_float;\n        }\n        else if (lhs_type == value_t::number_float && rhs_type == value_t::number_integer)\n        {\n            return lhs.m_value.number_float < static_cast<number_float_t>(rhs.m_value.number_integer);\n        }\n        else if (lhs_type == value_t::number_unsigned && rhs_type == value_t::number_float)\n        {\n            return static_cast<number_float_t>(lhs.m_value.number_unsigned) < rhs.m_value.number_float;\n        }\n        else if (lhs_type == value_t::number_float && rhs_type == value_t::number_unsigned)\n        {\n            return lhs.m_value.number_float < static_cast<number_float_t>(rhs.m_value.number_unsigned);\n        }\n        else if (lhs_type == value_t::number_integer && rhs_type == value_t::number_unsigned)\n        {\n            return lhs.m_value.number_integer < static_cast<number_integer_t>(rhs.m_value.number_unsigned);\n        }\n        else if (lhs_type == value_t::number_unsigned && rhs_type == value_t::number_integer)\n        {\n            return static_cast<number_integer_t>(lhs.m_value.number_unsigned) < rhs.m_value.number_integer;\n        }\n\n        // We only reach this line if we cannot compare values. In that case,\n        // we compare types. Note we have to call the operator explicitly,\n        // because MSVC has problems otherwise.\n        return operator<(lhs_type, rhs_type);\n    }\n\n    /*!\n    @brief comparison: less than\n    @copydoc operator<(const_reference, const_reference)\n    */\n    template<typename ScalarType, typename std::enable_if<\n                 std::is_scalar<ScalarType>::value, int>::type = 0>\n    friend bool operator<(const_reference lhs, const ScalarType rhs) noexcept\n    {\n        return lhs < basic_json(rhs);\n    }\n\n    /*!\n    @brief comparison: less than\n    @copydoc operator<(const_reference, const_reference)\n    */\n    template<typename ScalarType, typename std::enable_if<\n                 std::is_scalar<ScalarType>::value, int>::type = 0>\n    friend bool operator<(const ScalarType lhs, const_reference rhs) noexcept\n    {\n        return basic_json(lhs) < rhs;\n    }\n\n    /*!\n    @brief comparison: less than or equal\n\n    Compares whether one JSON value @a lhs is less than or equal to another\n    JSON value by calculating `not (rhs < lhs)`.\n\n    @param[in] lhs  first JSON value to consider\n    @param[in] rhs  second JSON value to consider\n    @return whether @a lhs is less than or equal to @a rhs\n\n    @complexity Linear.\n\n    @exceptionsafety No-throw guarantee: this function never throws exceptions.\n\n    @liveexample{The example demonstrates comparing several JSON\n    types.,operator__greater}\n\n    @since version 1.0.0\n    */\n    friend bool operator<=(const_reference lhs, const_reference rhs) noexcept\n    {\n        return !(rhs < lhs);\n    }\n\n    /*!\n    @brief comparison: less than or equal\n    @copydoc operator<=(const_reference, const_reference)\n    */\n    template<typename ScalarType, typename std::enable_if<\n                 std::is_scalar<ScalarType>::value, int>::type = 0>\n    friend bool operator<=(const_reference lhs, const ScalarType rhs) noexcept\n    {\n        return lhs <= basic_json(rhs);\n    }\n\n    /*!\n    @brief comparison: less than or equal\n    @copydoc operator<=(const_reference, const_reference)\n    */\n    template<typename ScalarType, typename std::enable_if<\n                 std::is_scalar<ScalarType>::value, int>::type = 0>\n    friend bool operator<=(const ScalarType lhs, const_reference rhs) noexcept\n    {\n        return basic_json(lhs) <= rhs;\n    }\n\n    /*!\n    @brief comparison: greater than\n\n    Compares whether one JSON value @a lhs is greater than another\n    JSON value by calculating `not (lhs <= rhs)`.\n\n    @param[in] lhs  first JSON value to consider\n    @param[in] rhs  second JSON value to consider\n    @return whether @a lhs is greater than to @a rhs\n\n    @complexity Linear.\n\n    @exceptionsafety No-throw guarantee: this function never throws exceptions.\n\n    @liveexample{The example demonstrates comparing several JSON\n    types.,operator__lessequal}\n\n    @since version 1.0.0\n    */\n    friend bool operator>(const_reference lhs, const_reference rhs) noexcept\n    {\n        return !(lhs <= rhs);\n    }\n\n    /*!\n    @brief comparison: greater than\n    @copydoc operator>(const_reference, const_reference)\n    */\n    template<typename ScalarType, typename std::enable_if<\n                 std::is_scalar<ScalarType>::value, int>::type = 0>\n    friend bool operator>(const_reference lhs, const ScalarType rhs) noexcept\n    {\n        return lhs > basic_json(rhs);\n    }\n\n    /*!\n    @brief comparison: greater than\n    @copydoc operator>(const_reference, const_reference)\n    */\n    template<typename ScalarType, typename std::enable_if<\n                 std::is_scalar<ScalarType>::value, int>::type = 0>\n    friend bool operator>(const ScalarType lhs, const_reference rhs) noexcept\n    {\n        return basic_json(lhs) > rhs;\n    }\n\n    /*!\n    @brief comparison: greater than or equal\n\n    Compares whether one JSON value @a lhs is greater than or equal to another\n    JSON value by calculating `not (lhs < rhs)`.\n\n    @param[in] lhs  first JSON value to consider\n    @param[in] rhs  second JSON value to consider\n    @return whether @a lhs is greater than or equal to @a rhs\n\n    @complexity Linear.\n\n    @exceptionsafety No-throw guarantee: this function never throws exceptions.\n\n    @liveexample{The example demonstrates comparing several JSON\n    types.,operator__greaterequal}\n\n    @since version 1.0.0\n    */\n    friend bool operator>=(const_reference lhs, const_reference rhs) noexcept\n    {\n        return !(lhs < rhs);\n    }\n\n    /*!\n    @brief comparison: greater than or equal\n    @copydoc operator>=(const_reference, const_reference)\n    */\n    template<typename ScalarType, typename std::enable_if<\n                 std::is_scalar<ScalarType>::value, int>::type = 0>\n    friend bool operator>=(const_reference lhs, const ScalarType rhs) noexcept\n    {\n        return lhs >= basic_json(rhs);\n    }\n\n    /*!\n    @brief comparison: greater than or equal\n    @copydoc operator>=(const_reference, const_reference)\n    */\n    template<typename ScalarType, typename std::enable_if<\n                 std::is_scalar<ScalarType>::value, int>::type = 0>\n    friend bool operator>=(const ScalarType lhs, const_reference rhs) noexcept\n    {\n        return basic_json(lhs) >= rhs;\n    }\n\n    /// @}\n\n    ///////////////////\n    // serialization //\n    ///////////////////\n\n    /// @name serialization\n    /// @{\n\n    /*!\n    @brief serialize to stream\n\n    Serialize the given JSON value @a j to the output stream @a o. The JSON\n    value will be serialized using the @ref dump member function.\n\n    - The indentation of the output can be controlled with the member variable\n      `width` of the output stream @a o. For instance, using the manipulator\n      `std::setw(4)` on @a o sets the indentation level to `4` and the\n      serialization result is the same as calling `dump(4)`.\n\n    - The indentation character can be controlled with the member variable\n      `fill` of the output stream @a o. For instance, the manipulator\n      `std::setfill('\\\\t')` sets indentation to use a tab character rather than\n      the default space character.\n\n    @param[in,out] o  stream to serialize to\n    @param[in] j  JSON value to serialize\n\n    @return the stream @a o\n\n    @throw type_error.316 if a string stored inside the JSON value is not\n                          UTF-8 encoded\n\n    @complexity Linear.\n\n    @liveexample{The example below shows the serialization with different\n    parameters to `width` to adjust the indentation level.,operator_serialize}\n\n    @since version 1.0.0; indentation character added in version 3.0.0\n    */\n    friend std::ostream& operator<<(std::ostream& o, const basic_json& j)\n    {\n        // read width member and use it as indentation parameter if nonzero\n        const bool pretty_print = o.width() > 0;\n        const auto indentation = pretty_print ? o.width() : 0;\n\n        // reset width to 0 for subsequent calls to this stream\n        o.width(0);\n\n        // do the actual serialization\n        serializer s(detail::output_adapter<char>(o), o.fill());\n        s.dump(j, pretty_print, false, static_cast<unsigned int>(indentation));\n        return o;\n    }\n\n    /*!\n    @brief serialize to stream\n    @deprecated This stream operator is deprecated and will be removed in\n                future 4.0.0 of the library. Please use\n                @ref operator<<(std::ostream&, const basic_json&)\n                instead; that is, replace calls like `j >> o;` with `o << j;`.\n    @since version 1.0.0; deprecated since version 3.0.0\n    */\n    JSON_HEDLEY_DEPRECATED_FOR(3.0.0, operator<<(std::ostream&, const basic_json&))\n    friend std::ostream& operator>>(const basic_json& j, std::ostream& o)\n    {\n        return o << j;\n    }\n\n    /// @}\n\n\n    /////////////////////\n    // deserialization //\n    /////////////////////\n\n    /// @name deserialization\n    /// @{\n\n    /*!\n    @brief deserialize from a compatible input\n\n    @tparam InputType A compatible input, for instance\n    - an std::istream object\n    - a FILE pointer\n    - a C-style array of characters\n    - a pointer to a null-terminated string of single byte characters\n    - an object obj for which begin(obj) and end(obj) produces a valid pair of\n      iterators.\n\n    @param[in] i  input to read from\n    @param[in] cb  a parser callback function of type @ref parser_callback_t\n    which is used to control the deserialization by filtering unwanted values\n    (optional)\n    @param[in] allow_exceptions  whether to throw exceptions in case of a\n    parse error (optional, true by default)\n    @param[in] ignore_comments  whether comments should be ignored and treated\n    like whitespace (true) or yield a parse error (true); (optional, false by\n    default)\n\n    @return deserialized JSON value; in case of a parse error and\n            @a allow_exceptions set to `false`, the return value will be\n            value_t::discarded.\n\n    @throw parse_error.101 if a parse error occurs; example: `\"\"unexpected end\n    of input; expected string literal\"\"`\n    @throw parse_error.102 if to_unicode fails or surrogate error\n    @throw parse_error.103 if to_unicode fails\n\n    @complexity Linear in the length of the input. The parser is a predictive\n    LL(1) parser. The complexity can be higher if the parser callback function\n    @a cb or reading from the input @a i has a super-linear complexity.\n\n    @note A UTF-8 byte order mark is silently ignored.\n\n    @liveexample{The example below demonstrates the `parse()` function reading\n    from an array.,parse__array__parser_callback_t}\n\n    @liveexample{The example below demonstrates the `parse()` function with\n    and without callback function.,parse__string__parser_callback_t}\n\n    @liveexample{The example below demonstrates the `parse()` function with\n    and without callback function.,parse__istream__parser_callback_t}\n\n    @liveexample{The example below demonstrates the `parse()` function reading\n    from a contiguous container.,parse__contiguouscontainer__parser_callback_t}\n\n    @since version 2.0.3 (contiguous containers); version 3.9.0 allowed to\n    ignore comments.\n    */\n    template<typename InputType>\n    JSON_HEDLEY_WARN_UNUSED_RESULT\n    static basic_json parse(InputType&& i,\n                            const parser_callback_t cb = nullptr,\n                            const bool allow_exceptions = true,\n                            const bool ignore_comments = false)\n    {\n        basic_json result;\n        parser(detail::input_adapter(std::forward<InputType>(i)), cb, allow_exceptions, ignore_comments).parse(true, result);\n        return result;\n    }\n\n    /*!\n    @brief deserialize from a pair of character iterators\n\n    The value_type of the iterator must be a integral type with size of 1, 2 or\n    4 bytes, which will be interpreted respectively as UTF-8, UTF-16 and UTF-32.\n\n    @param[in] first iterator to start of character range\n    @param[in] last  iterator to end of character range\n    @param[in] cb  a parser callback function of type @ref parser_callback_t\n    which is used to control the deserialization by filtering unwanted values\n    (optional)\n    @param[in] allow_exceptions  whether to throw exceptions in case of a\n    parse error (optional, true by default)\n    @param[in] ignore_comments  whether comments should be ignored and treated\n    like whitespace (true) or yield a parse error (true); (optional, false by\n    default)\n\n    @return deserialized JSON value; in case of a parse error and\n            @a allow_exceptions set to `false`, the return value will be\n            value_t::discarded.\n\n    @throw parse_error.101 if a parse error occurs; example: `\"\"unexpected end\n    of input; expected string literal\"\"`\n    @throw parse_error.102 if to_unicode fails or surrogate error\n    @throw parse_error.103 if to_unicode fails\n    */\n    template<typename IteratorType>\n    JSON_HEDLEY_WARN_UNUSED_RESULT\n    static basic_json parse(IteratorType first,\n                            IteratorType last,\n                            const parser_callback_t cb = nullptr,\n                            const bool allow_exceptions = true,\n                            const bool ignore_comments = false)\n    {\n        basic_json result;\n        parser(detail::input_adapter(std::move(first), std::move(last)), cb, allow_exceptions, ignore_comments).parse(true, result);\n        return result;\n    }\n\n    JSON_HEDLEY_WARN_UNUSED_RESULT\n    JSON_HEDLEY_DEPRECATED_FOR(3.8.0, parse(ptr, ptr + len))\n    static basic_json parse(detail::span_input_adapter&& i,\n                            const parser_callback_t cb = nullptr,\n                            const bool allow_exceptions = true,\n                            const bool ignore_comments = false)\n    {\n        basic_json result;\n        parser(i.get(), cb, allow_exceptions, ignore_comments).parse(true, result);\n        return result;\n    }\n\n    /*!\n    @brief check if the input is valid JSON\n\n    Unlike the @ref parse(InputType&&, const parser_callback_t,const bool)\n    function, this function neither throws an exception in case of invalid JSON\n    input (i.e., a parse error) nor creates diagnostic information.\n\n    @tparam InputType A compatible input, for instance\n    - an std::istream object\n    - a FILE pointer\n    - a C-style array of characters\n    - a pointer to a null-terminated string of single byte characters\n    - an object obj for which begin(obj) and end(obj) produces a valid pair of\n      iterators.\n\n    @param[in] i input to read from\n    @param[in] ignore_comments  whether comments should be ignored and treated\n    like whitespace (true) or yield a parse error (true); (optional, false by\n    default)\n\n    @return Whether the input read from @a i is valid JSON.\n\n    @complexity Linear in the length of the input. The parser is a predictive\n    LL(1) parser.\n\n    @note A UTF-8 byte order mark is silently ignored.\n\n    @liveexample{The example below demonstrates the `accept()` function reading\n    from a string.,accept__string}\n    */\n    template<typename InputType>\n    static bool accept(InputType&& i,\n                       const bool ignore_comments = false)\n    {\n        return parser(detail::input_adapter(std::forward<InputType>(i)), nullptr, false, ignore_comments).accept(true);\n    }\n\n    template<typename IteratorType>\n    static bool accept(IteratorType first, IteratorType last,\n                       const bool ignore_comments = false)\n    {\n        return parser(detail::input_adapter(std::move(first), std::move(last)), nullptr, false, ignore_comments).accept(true);\n    }\n\n    JSON_HEDLEY_WARN_UNUSED_RESULT\n    JSON_HEDLEY_DEPRECATED_FOR(3.8.0, accept(ptr, ptr + len))\n    static bool accept(detail::span_input_adapter&& i,\n                       const bool ignore_comments = false)\n    {\n        return parser(i.get(), nullptr, false, ignore_comments).accept(true);\n    }\n\n    /*!\n    @brief generate SAX events\n\n    The SAX event lister must follow the interface of @ref json_sax.\n\n    This function reads from a compatible input. Examples are:\n    - an std::istream object\n    - a FILE pointer\n    - a C-style array of characters\n    - a pointer to a null-terminated string of single byte characters\n    - an object obj for which begin(obj) and end(obj) produces a valid pair of\n      iterators.\n\n    @param[in] i  input to read from\n    @param[in,out] sax  SAX event listener\n    @param[in] format  the format to parse (JSON, CBOR, MessagePack, or UBJSON)\n    @param[in] strict  whether the input has to be consumed completely\n    @param[in] ignore_comments  whether comments should be ignored and treated\n    like whitespace (true) or yield a parse error (true); (optional, false by\n    default); only applies to the JSON file format.\n\n    @return return value of the last processed SAX event\n\n    @throw parse_error.101 if a parse error occurs; example: `\"\"unexpected end\n    of input; expected string literal\"\"`\n    @throw parse_error.102 if to_unicode fails or surrogate error\n    @throw parse_error.103 if to_unicode fails\n\n    @complexity Linear in the length of the input. The parser is a predictive\n    LL(1) parser. The complexity can be higher if the SAX consumer @a sax has\n    a super-linear complexity.\n\n    @note A UTF-8 byte order mark is silently ignored.\n\n    @liveexample{The example below demonstrates the `sax_parse()` function\n    reading from string and processing the events with a user-defined SAX\n    event consumer.,sax_parse}\n\n    @since version 3.2.0\n    */\n    template <typename InputType, typename SAX>\n    JSON_HEDLEY_NON_NULL(2)\n    static bool sax_parse(InputType&& i, SAX* sax,\n                          input_format_t format = input_format_t::json,\n                          const bool strict = true,\n                          const bool ignore_comments = false)\n    {\n        auto ia = detail::input_adapter(std::forward<InputType>(i));\n        return format == input_format_t::json\n               ? parser(std::move(ia), nullptr, true, ignore_comments).sax_parse(sax, strict)\n               : detail::binary_reader<basic_json, decltype(ia), SAX>(std::move(ia)).sax_parse(format, sax, strict);\n    }\n\n    template<class IteratorType, class SAX>\n    JSON_HEDLEY_NON_NULL(3)\n    static bool sax_parse(IteratorType first, IteratorType last, SAX* sax,\n                          input_format_t format = input_format_t::json,\n                          const bool strict = true,\n                          const bool ignore_comments = false)\n    {\n        auto ia = detail::input_adapter(std::move(first), std::move(last));\n        return format == input_format_t::json\n               ? parser(std::move(ia), nullptr, true, ignore_comments).sax_parse(sax, strict)\n               : detail::binary_reader<basic_json, decltype(ia), SAX>(std::move(ia)).sax_parse(format, sax, strict);\n    }\n\n    template <typename SAX>\n    JSON_HEDLEY_DEPRECATED_FOR(3.8.0, sax_parse(ptr, ptr + len, ...))\n    JSON_HEDLEY_NON_NULL(2)\n    static bool sax_parse(detail::span_input_adapter&& i, SAX* sax,\n                          input_format_t format = input_format_t::json,\n                          const bool strict = true,\n                          const bool ignore_comments = false)\n    {\n        auto ia = i.get();\n        return format == input_format_t::json\n               ? parser(std::move(ia), nullptr, true, ignore_comments).sax_parse(sax, strict)\n               : detail::binary_reader<basic_json, decltype(ia), SAX>(std::move(ia)).sax_parse(format, sax, strict);\n    }\n\n    /*!\n    @brief deserialize from stream\n    @deprecated This stream operator is deprecated and will be removed in\n                version 4.0.0 of the library. Please use\n                @ref operator>>(std::istream&, basic_json&)\n                instead; that is, replace calls like `j << i;` with `i >> j;`.\n    @since version 1.0.0; deprecated since version 3.0.0\n    */\n    JSON_HEDLEY_DEPRECATED_FOR(3.0.0, operator>>(std::istream&, basic_json&))\n    friend std::istream& operator<<(basic_json& j, std::istream& i)\n    {\n        return operator>>(i, j);\n    }\n\n    /*!\n    @brief deserialize from stream\n\n    Deserializes an input stream to a JSON value.\n\n    @param[in,out] i  input stream to read a serialized JSON value from\n    @param[in,out] j  JSON value to write the deserialized input to\n\n    @throw parse_error.101 in case of an unexpected token\n    @throw parse_error.102 if to_unicode fails or surrogate error\n    @throw parse_error.103 if to_unicode fails\n\n    @complexity Linear in the length of the input. The parser is a predictive\n    LL(1) parser.\n\n    @note A UTF-8 byte order mark is silently ignored.\n\n    @liveexample{The example below shows how a JSON value is constructed by\n    reading a serialization from a stream.,operator_deserialize}\n\n    @sa parse(std::istream&, const parser_callback_t) for a variant with a\n    parser callback function to filter values while parsing\n\n    @since version 1.0.0\n    */\n    friend std::istream& operator>>(std::istream& i, basic_json& j)\n    {\n        parser(detail::input_adapter(i)).parse(false, j);\n        return i;\n    }\n\n    /// @}\n\n    ///////////////////////////\n    // convenience functions //\n    ///////////////////////////\n\n    /*!\n    @brief return the type as string\n\n    Returns the type name as string to be used in error messages - usually to\n    indicate that a function was called on a wrong JSON type.\n\n    @return a string representation of a the @a m_type member:\n            Value type  | return value\n            ----------- | -------------\n            null        | `\"null\"`\n            boolean     | `\"boolean\"`\n            string      | `\"string\"`\n            number      | `\"number\"` (for all number types)\n            object      | `\"object\"`\n            array       | `\"array\"`\n            binary      | `\"binary\"`\n            discarded   | `\"discarded\"`\n\n    @exceptionsafety No-throw guarantee: this function never throws exceptions.\n\n    @complexity Constant.\n\n    @liveexample{The following code exemplifies `type_name()` for all JSON\n    types.,type_name}\n\n    @sa @ref type() -- return the type of the JSON value\n    @sa @ref operator value_t() -- return the type of the JSON value (implicit)\n\n    @since version 1.0.0, public since 2.1.0, `const char*` and `noexcept`\n    since 3.0.0\n    */\n    JSON_HEDLEY_RETURNS_NON_NULL\n    const char* type_name() const noexcept\n    {\n        {\n            switch (m_type)\n            {\n                case value_t::null:\n                    return \"null\";\n                case value_t::object:\n                    return \"object\";\n                case value_t::array:\n                    return \"array\";\n                case value_t::string:\n                    return \"string\";\n                case value_t::boolean:\n                    return \"boolean\";\n                case value_t::binary:\n                    return \"binary\";\n                case value_t::discarded:\n                    return \"discarded\";\n                default:\n                    return \"number\";\n            }\n        }\n    }\n\n\n  JSON_PRIVATE_UNLESS_TESTED:\n    //////////////////////\n    // member variables //\n    //////////////////////\n\n    /// the type of the current element\n    value_t m_type = value_t::null;\n\n    /// the value of the current element\n    json_value m_value = {};\n\n    //////////////////////////////////////////\n    // binary serialization/deserialization //\n    //////////////////////////////////////////\n\n    /// @name binary serialization/deserialization support\n    /// @{\n\n  public:\n    /*!\n    @brief create a CBOR serialization of a given JSON value\n\n    Serializes a given JSON value @a j to a byte vector using the CBOR (Concise\n    Binary Object Representation) serialization format. CBOR is a binary\n    serialization format which aims to be more compact than JSON itself, yet\n    more efficient to parse.\n\n    The library uses the following mapping from JSON values types to\n    CBOR types according to the CBOR specification (RFC 7049):\n\n    JSON value type | value/range                                | CBOR type                          | first byte\n    --------------- | ------------------------------------------ | ---------------------------------- | ---------------\n    null            | `null`                                     | Null                               | 0xF6\n    boolean         | `true`                                     | True                               | 0xF5\n    boolean         | `false`                                    | False                              | 0xF4\n    number_integer  | -9223372036854775808..-2147483649          | Negative integer (8 bytes follow)  | 0x3B\n    number_integer  | -2147483648..-32769                        | Negative integer (4 bytes follow)  | 0x3A\n    number_integer  | -32768..-129                               | Negative integer (2 bytes follow)  | 0x39\n    number_integer  | -128..-25                                  | Negative integer (1 byte follow)   | 0x38\n    number_integer  | -24..-1                                    | Negative integer                   | 0x20..0x37\n    number_integer  | 0..23                                      | Integer                            | 0x00..0x17\n    number_integer  | 24..255                                    | Unsigned integer (1 byte follow)   | 0x18\n    number_integer  | 256..65535                                 | Unsigned integer (2 bytes follow)  | 0x19\n    number_integer  | 65536..4294967295                          | Unsigned integer (4 bytes follow)  | 0x1A\n    number_integer  | 4294967296..18446744073709551615           | Unsigned integer (8 bytes follow)  | 0x1B\n    number_unsigned | 0..23                                      | Integer                            | 0x00..0x17\n    number_unsigned | 24..255                                    | Unsigned integer (1 byte follow)   | 0x18\n    number_unsigned | 256..65535                                 | Unsigned integer (2 bytes follow)  | 0x19\n    number_unsigned | 65536..4294967295                          | Unsigned integer (4 bytes follow)  | 0x1A\n    number_unsigned | 4294967296..18446744073709551615           | Unsigned integer (8 bytes follow)  | 0x1B\n    number_float    | *any value representable by a float*       | Single-Precision Float             | 0xFA\n    number_float    | *any value NOT representable by a float*   | Double-Precision Float             | 0xFB\n    string          | *length*: 0..23                            | UTF-8 string                       | 0x60..0x77\n    string          | *length*: 23..255                          | UTF-8 string (1 byte follow)       | 0x78\n    string          | *length*: 256..65535                       | UTF-8 string (2 bytes follow)      | 0x79\n    string          | *length*: 65536..4294967295                | UTF-8 string (4 bytes follow)      | 0x7A\n    string          | *length*: 4294967296..18446744073709551615 | UTF-8 string (8 bytes follow)      | 0x7B\n    array           | *size*: 0..23                              | array                              | 0x80..0x97\n    array           | *size*: 23..255                            | array (1 byte follow)              | 0x98\n    array           | *size*: 256..65535                         | array (2 bytes follow)             | 0x99\n    array           | *size*: 65536..4294967295                  | array (4 bytes follow)             | 0x9A\n    array           | *size*: 4294967296..18446744073709551615   | array (8 bytes follow)             | 0x9B\n    object          | *size*: 0..23                              | map                                | 0xA0..0xB7\n    object          | *size*: 23..255                            | map (1 byte follow)                | 0xB8\n    object          | *size*: 256..65535                         | map (2 bytes follow)               | 0xB9\n    object          | *size*: 65536..4294967295                  | map (4 bytes follow)               | 0xBA\n    object          | *size*: 4294967296..18446744073709551615   | map (8 bytes follow)               | 0xBB\n    binary          | *size*: 0..23                              | byte string                        | 0x40..0x57\n    binary          | *size*: 23..255                            | byte string (1 byte follow)        | 0x58\n    binary          | *size*: 256..65535                         | byte string (2 bytes follow)       | 0x59\n    binary          | *size*: 65536..4294967295                  | byte string (4 bytes follow)       | 0x5A\n    binary          | *size*: 4294967296..18446744073709551615   | byte string (8 bytes follow)       | 0x5B\n\n    @note The mapping is **complete** in the sense that any JSON value type\n          can be converted to a CBOR value.\n\n    @note If NaN or Infinity are stored inside a JSON number, they are\n          serialized properly. This behavior differs from the @ref dump()\n          function which serializes NaN or Infinity to `null`.\n\n    @note The following CBOR types are not used in the conversion:\n          - UTF-8 strings terminated by \"break\" (0x7F)\n          - arrays terminated by \"break\" (0x9F)\n          - maps terminated by \"break\" (0xBF)\n          - byte strings terminated by \"break\" (0x5F)\n          - date/time (0xC0..0xC1)\n          - bignum (0xC2..0xC3)\n          - decimal fraction (0xC4)\n          - bigfloat (0xC5)\n          - expected conversions (0xD5..0xD7)\n          - simple values (0xE0..0xF3, 0xF8)\n          - undefined (0xF7)\n          - half-precision floats (0xF9)\n          - break (0xFF)\n\n    @param[in] j  JSON value to serialize\n    @return CBOR serialization as byte vector\n\n    @complexity Linear in the size of the JSON value @a j.\n\n    @liveexample{The example shows the serialization of a JSON value to a byte\n    vector in CBOR format.,to_cbor}\n\n    @sa http://cbor.io\n    @sa @ref from_cbor(detail::input_adapter&&, const bool, const bool, const cbor_tag_handler_t) for the\n        analogous deserialization\n    @sa @ref to_msgpack(const basic_json&) for the related MessagePack format\n    @sa @ref to_ubjson(const basic_json&, const bool, const bool) for the\n             related UBJSON format\n\n    @since version 2.0.9; compact representation of floating-point numbers\n           since version 3.8.0\n    */\n    static std::vector<uint8_t> to_cbor(const basic_json& j)\n    {\n        std::vector<uint8_t> result;\n        to_cbor(j, result);\n        return result;\n    }\n\n    static void to_cbor(const basic_json& j, detail::output_adapter<uint8_t> o)\n    {\n        binary_writer<uint8_t>(o).write_cbor(j);\n    }\n\n    static void to_cbor(const basic_json& j, detail::output_adapter<char> o)\n    {\n        binary_writer<char>(o).write_cbor(j);\n    }\n\n    /*!\n    @brief create a MessagePack serialization of a given JSON value\n\n    Serializes a given JSON value @a j to a byte vector using the MessagePack\n    serialization format. MessagePack is a binary serialization format which\n    aims to be more compact than JSON itself, yet more efficient to parse.\n\n    The library uses the following mapping from JSON values types to\n    MessagePack types according to the MessagePack specification:\n\n    JSON value type | value/range                       | MessagePack type | first byte\n    --------------- | --------------------------------- | ---------------- | ----------\n    null            | `null`                            | nil              | 0xC0\n    boolean         | `true`                            | true             | 0xC3\n    boolean         | `false`                           | false            | 0xC2\n    number_integer  | -9223372036854775808..-2147483649 | int64            | 0xD3\n    number_integer  | -2147483648..-32769               | int32            | 0xD2\n    number_integer  | -32768..-129                      | int16            | 0xD1\n    number_integer  | -128..-33                         | int8             | 0xD0\n    number_integer  | -32..-1                           | negative fixint  | 0xE0..0xFF\n    number_integer  | 0..127                            | positive fixint  | 0x00..0x7F\n    number_integer  | 128..255                          | uint 8           | 0xCC\n    number_integer  | 256..65535                        | uint 16          | 0xCD\n    number_integer  | 65536..4294967295                 | uint 32          | 0xCE\n    number_integer  | 4294967296..18446744073709551615  | uint 64          | 0xCF\n    number_unsigned | 0..127                            | positive fixint  | 0x00..0x7F\n    number_unsigned | 128..255                          | uint 8           | 0xCC\n    number_unsigned | 256..65535                        | uint 16          | 0xCD\n    number_unsigned | 65536..4294967295                 | uint 32          | 0xCE\n    number_unsigned | 4294967296..18446744073709551615  | uint 64          | 0xCF\n    number_float    | *any value representable by a float*     | float 32 | 0xCA\n    number_float    | *any value NOT representable by a float* | float 64 | 0xCB\n    string          | *length*: 0..31                   | fixstr           | 0xA0..0xBF\n    string          | *length*: 32..255                 | str 8            | 0xD9\n    string          | *length*: 256..65535              | str 16           | 0xDA\n    string          | *length*: 65536..4294967295       | str 32           | 0xDB\n    array           | *size*: 0..15                     | fixarray         | 0x90..0x9F\n    array           | *size*: 16..65535                 | array 16         | 0xDC\n    array           | *size*: 65536..4294967295         | array 32         | 0xDD\n    object          | *size*: 0..15                     | fix map          | 0x80..0x8F\n    object          | *size*: 16..65535                 | map 16           | 0xDE\n    object          | *size*: 65536..4294967295         | map 32           | 0xDF\n    binary          | *size*: 0..255                    | bin 8            | 0xC4\n    binary          | *size*: 256..65535                | bin 16           | 0xC5\n    binary          | *size*: 65536..4294967295         | bin 32           | 0xC6\n\n    @note The mapping is **complete** in the sense that any JSON value type\n          can be converted to a MessagePack value.\n\n    @note The following values can **not** be converted to a MessagePack value:\n          - strings with more than 4294967295 bytes\n          - byte strings with more than 4294967295 bytes\n          - arrays with more than 4294967295 elements\n          - objects with more than 4294967295 elements\n\n    @note Any MessagePack output created @ref to_msgpack can be successfully\n          parsed by @ref from_msgpack.\n\n    @note If NaN or Infinity are stored inside a JSON number, they are\n          serialized properly. This behavior differs from the @ref dump()\n          function which serializes NaN or Infinity to `null`.\n\n    @param[in] j  JSON value to serialize\n    @return MessagePack serialization as byte vector\n\n    @complexity Linear in the size of the JSON value @a j.\n\n    @liveexample{The example shows the serialization of a JSON value to a byte\n    vector in MessagePack format.,to_msgpack}\n\n    @sa http://msgpack.org\n    @sa @ref from_msgpack for the analogous deserialization\n    @sa @ref to_cbor(const basic_json& for the related CBOR format\n    @sa @ref to_ubjson(const basic_json&, const bool, const bool) for the\n             related UBJSON format\n\n    @since version 2.0.9\n    */\n    static std::vector<uint8_t> to_msgpack(const basic_json& j)\n    {\n        std::vector<uint8_t> result;\n        to_msgpack(j, result);\n        return result;\n    }\n\n    static void to_msgpack(const basic_json& j, detail::output_adapter<uint8_t> o)\n    {\n        binary_writer<uint8_t>(o).write_msgpack(j);\n    }\n\n    static void to_msgpack(const basic_json& j, detail::output_adapter<char> o)\n    {\n        binary_writer<char>(o).write_msgpack(j);\n    }\n\n    /*!\n    @brief create a UBJSON serialization of a given JSON value\n\n    Serializes a given JSON value @a j to a byte vector using the UBJSON\n    (Universal Binary JSON) serialization format. UBJSON aims to be more compact\n    than JSON itself, yet more efficient to parse.\n\n    The library uses the following mapping from JSON values types to\n    UBJSON types according to the UBJSON specification:\n\n    JSON value type | value/range                       | UBJSON type | marker\n    --------------- | --------------------------------- | ----------- | ------\n    null            | `null`                            | null        | `Z`\n    boolean         | `true`                            | true        | `T`\n    boolean         | `false`                           | false       | `F`\n    number_integer  | -9223372036854775808..-2147483649 | int64       | `L`\n    number_integer  | -2147483648..-32769               | int32       | `l`\n    number_integer  | -32768..-129                      | int16       | `I`\n    number_integer  | -128..127                         | int8        | `i`\n    number_integer  | 128..255                          | uint8       | `U`\n    number_integer  | 256..32767                        | int16       | `I`\n    number_integer  | 32768..2147483647                 | int32       | `l`\n    number_integer  | 2147483648..9223372036854775807   | int64       | `L`\n    number_unsigned | 0..127                            | int8        | `i`\n    number_unsigned | 128..255                          | uint8       | `U`\n    number_unsigned | 256..32767                        | int16       | `I`\n    number_unsigned | 32768..2147483647                 | int32       | `l`\n    number_unsigned | 2147483648..9223372036854775807   | int64       | `L`\n    number_unsigned | 2147483649..18446744073709551615  | high-precision | `H`\n    number_float    | *any value*                       | float64     | `D`\n    string          | *with shortest length indicator*  | string      | `S`\n    array           | *see notes on optimized format*   | array       | `[`\n    object          | *see notes on optimized format*   | map         | `{`\n\n    @note The mapping is **complete** in the sense that any JSON value type\n          can be converted to a UBJSON value.\n\n    @note The following values can **not** be converted to a UBJSON value:\n          - strings with more than 9223372036854775807 bytes (theoretical)\n\n    @note The following markers are not used in the conversion:\n          - `Z`: no-op values are not created.\n          - `C`: single-byte strings are serialized with `S` markers.\n\n    @note Any UBJSON output created @ref to_ubjson can be successfully parsed\n          by @ref from_ubjson.\n\n    @note If NaN or Infinity are stored inside a JSON number, they are\n          serialized properly. This behavior differs from the @ref dump()\n          function which serializes NaN or Infinity to `null`.\n\n    @note The optimized formats for containers are supported: Parameter\n          @a use_size adds size information to the beginning of a container and\n          removes the closing marker. Parameter @a use_type further checks\n          whether all elements of a container have the same type and adds the\n          type marker to the beginning of the container. The @a use_type\n          parameter must only be used together with @a use_size = true. Note\n          that @a use_size = true alone may result in larger representations -\n          the benefit of this parameter is that the receiving side is\n          immediately informed on the number of elements of the container.\n\n    @note If the JSON data contains the binary type, the value stored is a list\n          of integers, as suggested by the UBJSON documentation.  In particular,\n          this means that serialization and the deserialization of a JSON\n          containing binary values into UBJSON and back will result in a\n          different JSON object.\n\n    @param[in] j  JSON value to serialize\n    @param[in] use_size  whether to add size annotations to container types\n    @param[in] use_type  whether to add type annotations to container types\n                         (must be combined with @a use_size = true)\n    @return UBJSON serialization as byte vector\n\n    @complexity Linear in the size of the JSON value @a j.\n\n    @liveexample{The example shows the serialization of a JSON value to a byte\n    vector in UBJSON format.,to_ubjson}\n\n    @sa http://ubjson.org\n    @sa @ref from_ubjson(detail::input_adapter&&, const bool, const bool) for the\n        analogous deserialization\n    @sa @ref to_cbor(const basic_json& for the related CBOR format\n    @sa @ref to_msgpack(const basic_json&) for the related MessagePack format\n\n    @since version 3.1.0\n    */\n    static std::vector<uint8_t> to_ubjson(const basic_json& j,\n                                          const bool use_size = false,\n                                          const bool use_type = false)\n    {\n        std::vector<uint8_t> result;\n        to_ubjson(j, result, use_size, use_type);\n        return result;\n    }\n\n    static void to_ubjson(const basic_json& j, detail::output_adapter<uint8_t> o,\n                          const bool use_size = false, const bool use_type = false)\n    {\n        binary_writer<uint8_t>(o).write_ubjson(j, use_size, use_type);\n    }\n\n    static void to_ubjson(const basic_json& j, detail::output_adapter<char> o,\n                          const bool use_size = false, const bool use_type = false)\n    {\n        binary_writer<char>(o).write_ubjson(j, use_size, use_type);\n    }\n\n\n    /*!\n    @brief Serializes the given JSON object `j` to BSON and returns a vector\n           containing the corresponding BSON-representation.\n\n    BSON (Binary JSON) is a binary format in which zero or more ordered key/value pairs are\n    stored as a single entity (a so-called document).\n\n    The library uses the following mapping from JSON values types to BSON types:\n\n    JSON value type | value/range                       | BSON type   | marker\n    --------------- | --------------------------------- | ----------- | ------\n    null            | `null`                            | null        | 0x0A\n    boolean         | `true`, `false`                   | boolean     | 0x08\n    number_integer  | -9223372036854775808..-2147483649 | int64       | 0x12\n    number_integer  | -2147483648..2147483647           | int32       | 0x10\n    number_integer  | 2147483648..9223372036854775807   | int64       | 0x12\n    number_unsigned | 0..2147483647                     | int32       | 0x10\n    number_unsigned | 2147483648..9223372036854775807   | int64       | 0x12\n    number_unsigned | 9223372036854775808..18446744073709551615| --   | --\n    number_float    | *any value*                       | double      | 0x01\n    string          | *any value*                       | string      | 0x02\n    array           | *any value*                       | document    | 0x04\n    object          | *any value*                       | document    | 0x03\n    binary          | *any value*                       | binary      | 0x05\n\n    @warning The mapping is **incomplete**, since only JSON-objects (and things\n    contained therein) can be serialized to BSON.\n    Also, integers larger than 9223372036854775807 cannot be serialized to BSON,\n    and the keys may not contain U+0000, since they are serialized a\n    zero-terminated c-strings.\n\n    @throw out_of_range.407  if `j.is_number_unsigned() && j.get<std::uint64_t>() > 9223372036854775807`\n    @throw out_of_range.409  if a key in `j` contains a NULL (U+0000)\n    @throw type_error.317    if `!j.is_object()`\n\n    @pre The input `j` is required to be an object: `j.is_object() == true`.\n\n    @note Any BSON output created via @ref to_bson can be successfully parsed\n          by @ref from_bson.\n\n    @param[in] j  JSON value to serialize\n    @return BSON serialization as byte vector\n\n    @complexity Linear in the size of the JSON value @a j.\n\n    @liveexample{The example shows the serialization of a JSON value to a byte\n    vector in BSON format.,to_bson}\n\n    @sa http://bsonspec.org/spec.html\n    @sa @ref from_bson(detail::input_adapter&&, const bool strict) for the\n        analogous deserialization\n    @sa @ref to_ubjson(const basic_json&, const bool, const bool) for the\n             related UBJSON format\n    @sa @ref to_cbor(const basic_json&) for the related CBOR format\n    @sa @ref to_msgpack(const basic_json&) for the related MessagePack format\n    */\n    static std::vector<uint8_t> to_bson(const basic_json& j)\n    {\n        std::vector<uint8_t> result;\n        to_bson(j, result);\n        return result;\n    }\n\n    /*!\n    @brief Serializes the given JSON object `j` to BSON and forwards the\n           corresponding BSON-representation to the given output_adapter `o`.\n    @param j The JSON object to convert to BSON.\n    @param o The output adapter that receives the binary BSON representation.\n    @pre The input `j` shall be an object: `j.is_object() == true`\n    @sa @ref to_bson(const basic_json&)\n    */\n    static void to_bson(const basic_json& j, detail::output_adapter<uint8_t> o)\n    {\n        binary_writer<uint8_t>(o).write_bson(j);\n    }\n\n    /*!\n    @copydoc to_bson(const basic_json&, detail::output_adapter<uint8_t>)\n    */\n    static void to_bson(const basic_json& j, detail::output_adapter<char> o)\n    {\n        binary_writer<char>(o).write_bson(j);\n    }\n\n\n    /*!\n    @brief create a JSON value from an input in CBOR format\n\n    Deserializes a given input @a i to a JSON value using the CBOR (Concise\n    Binary Object Representation) serialization format.\n\n    The library maps CBOR types to JSON value types as follows:\n\n    CBOR type              | JSON value type | first byte\n    ---------------------- | --------------- | ----------\n    Integer                | number_unsigned | 0x00..0x17\n    Unsigned integer       | number_unsigned | 0x18\n    Unsigned integer       | number_unsigned | 0x19\n    Unsigned integer       | number_unsigned | 0x1A\n    Unsigned integer       | number_unsigned | 0x1B\n    Negative integer       | number_integer  | 0x20..0x37\n    Negative integer       | number_integer  | 0x38\n    Negative integer       | number_integer  | 0x39\n    Negative integer       | number_integer  | 0x3A\n    Negative integer       | number_integer  | 0x3B\n    Byte string            | binary          | 0x40..0x57\n    Byte string            | binary          | 0x58\n    Byte string            | binary          | 0x59\n    Byte string            | binary          | 0x5A\n    Byte string            | binary          | 0x5B\n    UTF-8 string           | string          | 0x60..0x77\n    UTF-8 string           | string          | 0x78\n    UTF-8 string           | string          | 0x79\n    UTF-8 string           | string          | 0x7A\n    UTF-8 string           | string          | 0x7B\n    UTF-8 string           | string          | 0x7F\n    array                  | array           | 0x80..0x97\n    array                  | array           | 0x98\n    array                  | array           | 0x99\n    array                  | array           | 0x9A\n    array                  | array           | 0x9B\n    array                  | array           | 0x9F\n    map                    | object          | 0xA0..0xB7\n    map                    | object          | 0xB8\n    map                    | object          | 0xB9\n    map                    | object          | 0xBA\n    map                    | object          | 0xBB\n    map                    | object          | 0xBF\n    False                  | `false`         | 0xF4\n    True                   | `true`          | 0xF5\n    Null                   | `null`          | 0xF6\n    Half-Precision Float   | number_float    | 0xF9\n    Single-Precision Float | number_float    | 0xFA\n    Double-Precision Float | number_float    | 0xFB\n\n    @warning The mapping is **incomplete** in the sense that not all CBOR\n             types can be converted to a JSON value. The following CBOR types\n             are not supported and will yield parse errors (parse_error.112):\n             - date/time (0xC0..0xC1)\n             - bignum (0xC2..0xC3)\n             - decimal fraction (0xC4)\n             - bigfloat (0xC5)\n             - expected conversions (0xD5..0xD7)\n             - simple values (0xE0..0xF3, 0xF8)\n             - undefined (0xF7)\n\n    @warning CBOR allows map keys of any type, whereas JSON only allows\n             strings as keys in object values. Therefore, CBOR maps with keys\n             other than UTF-8 strings are rejected (parse_error.113).\n\n    @note Any CBOR output created @ref to_cbor can be successfully parsed by\n          @ref from_cbor.\n\n    @param[in] i  an input in CBOR format convertible to an input adapter\n    @param[in] strict  whether to expect the input to be consumed until EOF\n                       (true by default)\n    @param[in] allow_exceptions  whether to throw exceptions in case of a\n    parse error (optional, true by default)\n    @param[in] tag_handler how to treat CBOR tags (optional, error by default)\n\n    @return deserialized JSON value; in case of a parse error and\n            @a allow_exceptions set to `false`, the return value will be\n            value_t::discarded.\n\n    @throw parse_error.110 if the given input ends prematurely or the end of\n    file was not reached when @a strict was set to true\n    @throw parse_error.112 if unsupported features from CBOR were\n    used in the given input @a v or if the input is not valid CBOR\n    @throw parse_error.113 if a string was expected as map key, but not found\n\n    @complexity Linear in the size of the input @a i.\n\n    @liveexample{The example shows the deserialization of a byte vector in CBOR\n    format to a JSON value.,from_cbor}\n\n    @sa http://cbor.io\n    @sa @ref to_cbor(const basic_json&) for the analogous serialization\n    @sa @ref from_msgpack(detail::input_adapter&&, const bool, const bool) for the\n        related MessagePack format\n    @sa @ref from_ubjson(detail::input_adapter&&, const bool, const bool) for the\n        related UBJSON format\n\n    @since version 2.0.9; parameter @a start_index since 2.1.1; changed to\n           consume input adapters, removed start_index parameter, and added\n           @a strict parameter since 3.0.0; added @a allow_exceptions parameter\n           since 3.2.0; added @a tag_handler parameter since 3.9.0.\n    */\n    template<typename InputType>\n    JSON_HEDLEY_WARN_UNUSED_RESULT\n    static basic_json from_cbor(InputType&& i,\n                                const bool strict = true,\n                                const bool allow_exceptions = true,\n                                const cbor_tag_handler_t tag_handler = cbor_tag_handler_t::error)\n    {\n        basic_json result;\n        detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);\n        auto ia = detail::input_adapter(std::forward<InputType>(i));\n        const bool res = binary_reader<decltype(ia)>(std::move(ia)).sax_parse(input_format_t::cbor, &sdp, strict, tag_handler);\n        return res ? result : basic_json(value_t::discarded);\n    }\n\n    /*!\n    @copydoc from_cbor(detail::input_adapter&&, const bool, const bool, const cbor_tag_handler_t)\n    */\n    template<typename IteratorType>\n    JSON_HEDLEY_WARN_UNUSED_RESULT\n    static basic_json from_cbor(IteratorType first, IteratorType last,\n                                const bool strict = true,\n                                const bool allow_exceptions = true,\n                                const cbor_tag_handler_t tag_handler = cbor_tag_handler_t::error)\n    {\n        basic_json result;\n        detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);\n        auto ia = detail::input_adapter(std::move(first), std::move(last));\n        const bool res = binary_reader<decltype(ia)>(std::move(ia)).sax_parse(input_format_t::cbor, &sdp, strict, tag_handler);\n        return res ? result : basic_json(value_t::discarded);\n    }\n\n    template<typename T>\n    JSON_HEDLEY_WARN_UNUSED_RESULT\n    JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_cbor(ptr, ptr + len))\n    static basic_json from_cbor(const T* ptr, std::size_t len,\n                                const bool strict = true,\n                                const bool allow_exceptions = true,\n                                const cbor_tag_handler_t tag_handler = cbor_tag_handler_t::error)\n    {\n        return from_cbor(ptr, ptr + len, strict, allow_exceptions, tag_handler);\n    }\n\n\n    JSON_HEDLEY_WARN_UNUSED_RESULT\n    JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_cbor(ptr, ptr + len))\n    static basic_json from_cbor(detail::span_input_adapter&& i,\n                                const bool strict = true,\n                                const bool allow_exceptions = true,\n                                const cbor_tag_handler_t tag_handler = cbor_tag_handler_t::error)\n    {\n        basic_json result;\n        detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);\n        auto ia = i.get();\n        const bool res = binary_reader<decltype(ia)>(std::move(ia)).sax_parse(input_format_t::cbor, &sdp, strict, tag_handler);\n        return res ? result : basic_json(value_t::discarded);\n    }\n\n    /*!\n    @brief create a JSON value from an input in MessagePack format\n\n    Deserializes a given input @a i to a JSON value using the MessagePack\n    serialization format.\n\n    The library maps MessagePack types to JSON value types as follows:\n\n    MessagePack type | JSON value type | first byte\n    ---------------- | --------------- | ----------\n    positive fixint  | number_unsigned | 0x00..0x7F\n    fixmap           | object          | 0x80..0x8F\n    fixarray         | array           | 0x90..0x9F\n    fixstr           | string          | 0xA0..0xBF\n    nil              | `null`          | 0xC0\n    false            | `false`         | 0xC2\n    true             | `true`          | 0xC3\n    float 32         | number_float    | 0xCA\n    float 64         | number_float    | 0xCB\n    uint 8           | number_unsigned | 0xCC\n    uint 16          | number_unsigned | 0xCD\n    uint 32          | number_unsigned | 0xCE\n    uint 64          | number_unsigned | 0xCF\n    int 8            | number_integer  | 0xD0\n    int 16           | number_integer  | 0xD1\n    int 32           | number_integer  | 0xD2\n    int 64           | number_integer  | 0xD3\n    str 8            | string          | 0xD9\n    str 16           | string          | 0xDA\n    str 32           | string          | 0xDB\n    array 16         | array           | 0xDC\n    array 32         | array           | 0xDD\n    map 16           | object          | 0xDE\n    map 32           | object          | 0xDF\n    bin 8            | binary          | 0xC4\n    bin 16           | binary          | 0xC5\n    bin 32           | binary          | 0xC6\n    ext 8            | binary          | 0xC7\n    ext 16           | binary          | 0xC8\n    ext 32           | binary          | 0xC9\n    fixext 1         | binary          | 0xD4\n    fixext 2         | binary          | 0xD5\n    fixext 4         | binary          | 0xD6\n    fixext 8         | binary          | 0xD7\n    fixext 16        | binary          | 0xD8\n    negative fixint  | number_integer  | 0xE0-0xFF\n\n    @note Any MessagePack output created @ref to_msgpack can be successfully\n          parsed by @ref from_msgpack.\n\n    @param[in] i  an input in MessagePack format convertible to an input\n                  adapter\n    @param[in] strict  whether to expect the input to be consumed until EOF\n                       (true by default)\n    @param[in] allow_exceptions  whether to throw exceptions in case of a\n    parse error (optional, true by default)\n\n    @return deserialized JSON value; in case of a parse error and\n            @a allow_exceptions set to `false`, the return value will be\n            value_t::discarded.\n\n    @throw parse_error.110 if the given input ends prematurely or the end of\n    file was not reached when @a strict was set to true\n    @throw parse_error.112 if unsupported features from MessagePack were\n    used in the given input @a i or if the input is not valid MessagePack\n    @throw parse_error.113 if a string was expected as map key, but not found\n\n    @complexity Linear in the size of the input @a i.\n\n    @liveexample{The example shows the deserialization of a byte vector in\n    MessagePack format to a JSON value.,from_msgpack}\n\n    @sa http://msgpack.org\n    @sa @ref to_msgpack(const basic_json&) for the analogous serialization\n    @sa @ref from_cbor(detail::input_adapter&&, const bool, const bool, const cbor_tag_handler_t) for the\n        related CBOR format\n    @sa @ref from_ubjson(detail::input_adapter&&, const bool, const bool) for\n        the related UBJSON format\n    @sa @ref from_bson(detail::input_adapter&&, const bool, const bool) for\n        the related BSON format\n\n    @since version 2.0.9; parameter @a start_index since 2.1.1; changed to\n           consume input adapters, removed start_index parameter, and added\n           @a strict parameter since 3.0.0; added @a allow_exceptions parameter\n           since 3.2.0\n    */\n    template<typename InputType>\n    JSON_HEDLEY_WARN_UNUSED_RESULT\n    static basic_json from_msgpack(InputType&& i,\n                                   const bool strict = true,\n                                   const bool allow_exceptions = true)\n    {\n        basic_json result;\n        detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);\n        auto ia = detail::input_adapter(std::forward<InputType>(i));\n        const bool res = binary_reader<decltype(ia)>(std::move(ia)).sax_parse(input_format_t::msgpack, &sdp, strict);\n        return res ? result : basic_json(value_t::discarded);\n    }\n\n    /*!\n    @copydoc from_msgpack(detail::input_adapter&&, const bool, const bool)\n    */\n    template<typename IteratorType>\n    JSON_HEDLEY_WARN_UNUSED_RESULT\n    static basic_json from_msgpack(IteratorType first, IteratorType last,\n                                   const bool strict = true,\n                                   const bool allow_exceptions = true)\n    {\n        basic_json result;\n        detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);\n        auto ia = detail::input_adapter(std::move(first), std::move(last));\n        const bool res = binary_reader<decltype(ia)>(std::move(ia)).sax_parse(input_format_t::msgpack, &sdp, strict);\n        return res ? result : basic_json(value_t::discarded);\n    }\n\n\n    template<typename T>\n    JSON_HEDLEY_WARN_UNUSED_RESULT\n    JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_msgpack(ptr, ptr + len))\n    static basic_json from_msgpack(const T* ptr, std::size_t len,\n                                   const bool strict = true,\n                                   const bool allow_exceptions = true)\n    {\n        return from_msgpack(ptr, ptr + len, strict, allow_exceptions);\n    }\n\n    JSON_HEDLEY_WARN_UNUSED_RESULT\n    JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_msgpack(ptr, ptr + len))\n    static basic_json from_msgpack(detail::span_input_adapter&& i,\n                                   const bool strict = true,\n                                   const bool allow_exceptions = true)\n    {\n        basic_json result;\n        detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);\n        auto ia = i.get();\n        const bool res = binary_reader<decltype(ia)>(std::move(ia)).sax_parse(input_format_t::msgpack, &sdp, strict);\n        return res ? result : basic_json(value_t::discarded);\n    }\n\n\n    /*!\n    @brief create a JSON value from an input in UBJSON format\n\n    Deserializes a given input @a i to a JSON value using the UBJSON (Universal\n    Binary JSON) serialization format.\n\n    The library maps UBJSON types to JSON value types as follows:\n\n    UBJSON type | JSON value type                         | marker\n    ----------- | --------------------------------------- | ------\n    no-op       | *no value, next value is read*          | `N`\n    null        | `null`                                  | `Z`\n    false       | `false`                                 | `F`\n    true        | `true`                                  | `T`\n    float32     | number_float                            | `d`\n    float64     | number_float                            | `D`\n    uint8       | number_unsigned                         | `U`\n    int8        | number_integer                          | `i`\n    int16       | number_integer                          | `I`\n    int32       | number_integer                          | `l`\n    int64       | number_integer                          | `L`\n    high-precision number | number_integer, number_unsigned, or number_float - depends on number string | 'H'\n    string      | string                                  | `S`\n    char        | string                                  | `C`\n    array       | array (optimized values are supported)  | `[`\n    object      | object (optimized values are supported) | `{`\n\n    @note The mapping is **complete** in the sense that any UBJSON value can\n          be converted to a JSON value.\n\n    @param[in] i  an input in UBJSON format convertible to an input adapter\n    @param[in] strict  whether to expect the input to be consumed until EOF\n                       (true by default)\n    @param[in] allow_exceptions  whether to throw exceptions in case of a\n    parse error (optional, true by default)\n\n    @return deserialized JSON value; in case of a parse error and\n            @a allow_exceptions set to `false`, the return value will be\n            value_t::discarded.\n\n    @throw parse_error.110 if the given input ends prematurely or the end of\n    file was not reached when @a strict was set to true\n    @throw parse_error.112 if a parse error occurs\n    @throw parse_error.113 if a string could not be parsed successfully\n\n    @complexity Linear in the size of the input @a i.\n\n    @liveexample{The example shows the deserialization of a byte vector in\n    UBJSON format to a JSON value.,from_ubjson}\n\n    @sa http://ubjson.org\n    @sa @ref to_ubjson(const basic_json&, const bool, const bool) for the\n             analogous serialization\n    @sa @ref from_cbor(detail::input_adapter&&, const bool, const bool, const cbor_tag_handler_t) for the\n        related CBOR format\n    @sa @ref from_msgpack(detail::input_adapter&&, const bool, const bool) for\n        the related MessagePack format\n    @sa @ref from_bson(detail::input_adapter&&, const bool, const bool) for\n        the related BSON format\n\n    @since version 3.1.0; added @a allow_exceptions parameter since 3.2.0\n    */\n    template<typename InputType>\n    JSON_HEDLEY_WARN_UNUSED_RESULT\n    static basic_json from_ubjson(InputType&& i,\n                                  const bool strict = true,\n                                  const bool allow_exceptions = true)\n    {\n        basic_json result;\n        detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);\n        auto ia = detail::input_adapter(std::forward<InputType>(i));\n        const bool res = binary_reader<decltype(ia)>(std::move(ia)).sax_parse(input_format_t::ubjson, &sdp, strict);\n        return res ? result : basic_json(value_t::discarded);\n    }\n\n    /*!\n    @copydoc from_ubjson(detail::input_adapter&&, const bool, const bool)\n    */\n    template<typename IteratorType>\n    JSON_HEDLEY_WARN_UNUSED_RESULT\n    static basic_json from_ubjson(IteratorType first, IteratorType last,\n                                  const bool strict = true,\n                                  const bool allow_exceptions = true)\n    {\n        basic_json result;\n        detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);\n        auto ia = detail::input_adapter(std::move(first), std::move(last));\n        const bool res = binary_reader<decltype(ia)>(std::move(ia)).sax_parse(input_format_t::ubjson, &sdp, strict);\n        return res ? result : basic_json(value_t::discarded);\n    }\n\n    template<typename T>\n    JSON_HEDLEY_WARN_UNUSED_RESULT\n    JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_ubjson(ptr, ptr + len))\n    static basic_json from_ubjson(const T* ptr, std::size_t len,\n                                  const bool strict = true,\n                                  const bool allow_exceptions = true)\n    {\n        return from_ubjson(ptr, ptr + len, strict, allow_exceptions);\n    }\n\n    JSON_HEDLEY_WARN_UNUSED_RESULT\n    JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_ubjson(ptr, ptr + len))\n    static basic_json from_ubjson(detail::span_input_adapter&& i,\n                                  const bool strict = true,\n                                  const bool allow_exceptions = true)\n    {\n        basic_json result;\n        detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);\n        auto ia = i.get();\n        const bool res = binary_reader<decltype(ia)>(std::move(ia)).sax_parse(input_format_t::ubjson, &sdp, strict);\n        return res ? result : basic_json(value_t::discarded);\n    }\n\n\n    /*!\n    @brief Create a JSON value from an input in BSON format\n\n    Deserializes a given input @a i to a JSON value using the BSON (Binary JSON)\n    serialization format.\n\n    The library maps BSON record types to JSON value types as follows:\n\n    BSON type       | BSON marker byte | JSON value type\n    --------------- | ---------------- | ---------------------------\n    double          | 0x01             | number_float\n    string          | 0x02             | string\n    document        | 0x03             | object\n    array           | 0x04             | array\n    binary          | 0x05             | binary\n    undefined       | 0x06             | still unsupported\n    ObjectId        | 0x07             | still unsupported\n    boolean         | 0x08             | boolean\n    UTC Date-Time   | 0x09             | still unsupported\n    null            | 0x0A             | null\n    Regular Expr.   | 0x0B             | still unsupported\n    DB Pointer      | 0x0C             | still unsupported\n    JavaScript Code | 0x0D             | still unsupported\n    Symbol          | 0x0E             | still unsupported\n    JavaScript Code | 0x0F             | still unsupported\n    int32           | 0x10             | number_integer\n    Timestamp       | 0x11             | still unsupported\n    128-bit decimal float | 0x13       | still unsupported\n    Max Key         | 0x7F             | still unsupported\n    Min Key         | 0xFF             | still unsupported\n\n    @warning The mapping is **incomplete**. The unsupported mappings\n             are indicated in the table above.\n\n    @param[in] i  an input in BSON format convertible to an input adapter\n    @param[in] strict  whether to expect the input to be consumed until EOF\n                       (true by default)\n    @param[in] allow_exceptions  whether to throw exceptions in case of a\n    parse error (optional, true by default)\n\n    @return deserialized JSON value; in case of a parse error and\n            @a allow_exceptions set to `false`, the return value will be\n            value_t::discarded.\n\n    @throw parse_error.114 if an unsupported BSON record type is encountered\n\n    @complexity Linear in the size of the input @a i.\n\n    @liveexample{The example shows the deserialization of a byte vector in\n    BSON format to a JSON value.,from_bson}\n\n    @sa http://bsonspec.org/spec.html\n    @sa @ref to_bson(const basic_json&) for the analogous serialization\n    @sa @ref from_cbor(detail::input_adapter&&, const bool, const bool, const cbor_tag_handler_t) for the\n        related CBOR format\n    @sa @ref from_msgpack(detail::input_adapter&&, const bool, const bool) for\n        the related MessagePack format\n    @sa @ref from_ubjson(detail::input_adapter&&, const bool, const bool) for the\n        related UBJSON format\n    */\n    template<typename InputType>\n    JSON_HEDLEY_WARN_UNUSED_RESULT\n    static basic_json from_bson(InputType&& i,\n                                const bool strict = true,\n                                const bool allow_exceptions = true)\n    {\n        basic_json result;\n        detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);\n        auto ia = detail::input_adapter(std::forward<InputType>(i));\n        const bool res = binary_reader<decltype(ia)>(std::move(ia)).sax_parse(input_format_t::bson, &sdp, strict);\n        return res ? result : basic_json(value_t::discarded);\n    }\n\n    /*!\n    @copydoc from_bson(detail::input_adapter&&, const bool, const bool)\n    */\n    template<typename IteratorType>\n    JSON_HEDLEY_WARN_UNUSED_RESULT\n    static basic_json from_bson(IteratorType first, IteratorType last,\n                                const bool strict = true,\n                                const bool allow_exceptions = true)\n    {\n        basic_json result;\n        detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);\n        auto ia = detail::input_adapter(std::move(first), std::move(last));\n        const bool res = binary_reader<decltype(ia)>(std::move(ia)).sax_parse(input_format_t::bson, &sdp, strict);\n        return res ? result : basic_json(value_t::discarded);\n    }\n\n    template<typename T>\n    JSON_HEDLEY_WARN_UNUSED_RESULT\n    JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_bson(ptr, ptr + len))\n    static basic_json from_bson(const T* ptr, std::size_t len,\n                                const bool strict = true,\n                                const bool allow_exceptions = true)\n    {\n        return from_bson(ptr, ptr + len, strict, allow_exceptions);\n    }\n\n    JSON_HEDLEY_WARN_UNUSED_RESULT\n    JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_bson(ptr, ptr + len))\n    static basic_json from_bson(detail::span_input_adapter&& i,\n                                const bool strict = true,\n                                const bool allow_exceptions = true)\n    {\n        basic_json result;\n        detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);\n        auto ia = i.get();\n        const bool res = binary_reader<decltype(ia)>(std::move(ia)).sax_parse(input_format_t::bson, &sdp, strict);\n        return res ? result : basic_json(value_t::discarded);\n    }\n    /// @}\n\n    //////////////////////////\n    // JSON Pointer support //\n    //////////////////////////\n\n    /// @name JSON Pointer functions\n    /// @{\n\n    /*!\n    @brief access specified element via JSON Pointer\n\n    Uses a JSON pointer to retrieve a reference to the respective JSON value.\n    No bound checking is performed. Similar to @ref operator[](const typename\n    object_t::key_type&), `null` values are created in arrays and objects if\n    necessary.\n\n    In particular:\n    - If the JSON pointer points to an object key that does not exist, it\n      is created an filled with a `null` value before a reference to it\n      is returned.\n    - If the JSON pointer points to an array index that does not exist, it\n      is created an filled with a `null` value before a reference to it\n      is returned. All indices between the current maximum and the given\n      index are also filled with `null`.\n    - The special value `-` is treated as a synonym for the index past the\n      end.\n\n    @param[in] ptr  a JSON pointer\n\n    @return reference to the element pointed to by @a ptr\n\n    @complexity Constant.\n\n    @throw parse_error.106   if an array index begins with '0'\n    @throw parse_error.109   if an array index was not a number\n    @throw out_of_range.404  if the JSON pointer can not be resolved\n\n    @liveexample{The behavior is shown in the example.,operatorjson_pointer}\n\n    @since version 2.0.0\n    */\n    reference operator[](const json_pointer& ptr)\n    {\n        return ptr.get_unchecked(this);\n    }\n\n    /*!\n    @brief access specified element via JSON Pointer\n\n    Uses a JSON pointer to retrieve a reference to the respective JSON value.\n    No bound checking is performed. The function does not change the JSON\n    value; no `null` values are created. In particular, the special value\n    `-` yields an exception.\n\n    @param[in] ptr  JSON pointer to the desired element\n\n    @return const reference to the element pointed to by @a ptr\n\n    @complexity Constant.\n\n    @throw parse_error.106   if an array index begins with '0'\n    @throw parse_error.109   if an array index was not a number\n    @throw out_of_range.402  if the array index '-' is used\n    @throw out_of_range.404  if the JSON pointer can not be resolved\n\n    @liveexample{The behavior is shown in the example.,operatorjson_pointer_const}\n\n    @since version 2.0.0\n    */\n    const_reference operator[](const json_pointer& ptr) const\n    {\n        return ptr.get_unchecked(this);\n    }\n\n    /*!\n    @brief access specified element via JSON Pointer\n\n    Returns a reference to the element at with specified JSON pointer @a ptr,\n    with bounds checking.\n\n    @param[in] ptr  JSON pointer to the desired element\n\n    @return reference to the element pointed to by @a ptr\n\n    @throw parse_error.106 if an array index in the passed JSON pointer @a ptr\n    begins with '0'. See example below.\n\n    @throw parse_error.109 if an array index in the passed JSON pointer @a ptr\n    is not a number. See example below.\n\n    @throw out_of_range.401 if an array index in the passed JSON pointer @a ptr\n    is out of range. See example below.\n\n    @throw out_of_range.402 if the array index '-' is used in the passed JSON\n    pointer @a ptr. As `at` provides checked access (and no elements are\n    implicitly inserted), the index '-' is always invalid. See example below.\n\n    @throw out_of_range.403 if the JSON pointer describes a key of an object\n    which cannot be found. See example below.\n\n    @throw out_of_range.404 if the JSON pointer @a ptr can not be resolved.\n    See example below.\n\n    @exceptionsafety Strong guarantee: if an exception is thrown, there are no\n    changes in the JSON value.\n\n    @complexity Constant.\n\n    @since version 2.0.0\n\n    @liveexample{The behavior is shown in the example.,at_json_pointer}\n    */\n    reference at(const json_pointer& ptr)\n    {\n        return ptr.get_checked(this);\n    }\n\n    /*!\n    @brief access specified element via JSON Pointer\n\n    Returns a const reference to the element at with specified JSON pointer @a\n    ptr, with bounds checking.\n\n    @param[in] ptr  JSON pointer to the desired element\n\n    @return reference to the element pointed to by @a ptr\n\n    @throw parse_error.106 if an array index in the passed JSON pointer @a ptr\n    begins with '0'. See example below.\n\n    @throw parse_error.109 if an array index in the passed JSON pointer @a ptr\n    is not a number. See example below.\n\n    @throw out_of_range.401 if an array index in the passed JSON pointer @a ptr\n    is out of range. See example below.\n\n    @throw out_of_range.402 if the array index '-' is used in the passed JSON\n    pointer @a ptr. As `at` provides checked access (and no elements are\n    implicitly inserted), the index '-' is always invalid. See example below.\n\n    @throw out_of_range.403 if the JSON pointer describes a key of an object\n    which cannot be found. See example below.\n\n    @throw out_of_range.404 if the JSON pointer @a ptr can not be resolved.\n    See example below.\n\n    @exceptionsafety Strong guarantee: if an exception is thrown, there are no\n    changes in the JSON value.\n\n    @complexity Constant.\n\n    @since version 2.0.0\n\n    @liveexample{The behavior is shown in the example.,at_json_pointer_const}\n    */\n    const_reference at(const json_pointer& ptr) const\n    {\n        return ptr.get_checked(this);\n    }\n\n    /*!\n    @brief return flattened JSON value\n\n    The function creates a JSON object whose keys are JSON pointers (see [RFC\n    6901](https://tools.ietf.org/html/rfc6901)) and whose values are all\n    primitive. The original JSON value can be restored using the @ref\n    unflatten() function.\n\n    @return an object that maps JSON pointers to primitive values\n\n    @note Empty objects and arrays are flattened to `null` and will not be\n          reconstructed correctly by the @ref unflatten() function.\n\n    @complexity Linear in the size the JSON value.\n\n    @liveexample{The following code shows how a JSON object is flattened to an\n    object whose keys consist of JSON pointers.,flatten}\n\n    @sa @ref unflatten() for the reverse function\n\n    @since version 2.0.0\n    */\n    basic_json flatten() const\n    {\n        basic_json result(value_t::object);\n        json_pointer::flatten(\"\", *this, result);\n        return result;\n    }\n\n    /*!\n    @brief unflatten a previously flattened JSON value\n\n    The function restores the arbitrary nesting of a JSON value that has been\n    flattened before using the @ref flatten() function. The JSON value must\n    meet certain constraints:\n    1. The value must be an object.\n    2. The keys must be JSON pointers (see\n       [RFC 6901](https://tools.ietf.org/html/rfc6901))\n    3. The mapped values must be primitive JSON types.\n\n    @return the original JSON from a flattened version\n\n    @note Empty objects and arrays are flattened by @ref flatten() to `null`\n          values and can not unflattened to their original type. Apart from\n          this example, for a JSON value `j`, the following is always true:\n          `j == j.flatten().unflatten()`.\n\n    @complexity Linear in the size the JSON value.\n\n    @throw type_error.314  if value is not an object\n    @throw type_error.315  if object values are not primitive\n\n    @liveexample{The following code shows how a flattened JSON object is\n    unflattened into the original nested JSON object.,unflatten}\n\n    @sa @ref flatten() for the reverse function\n\n    @since version 2.0.0\n    */\n    basic_json unflatten() const\n    {\n        return json_pointer::unflatten(*this);\n    }\n\n    /// @}\n\n    //////////////////////////\n    // JSON Patch functions //\n    //////////////////////////\n\n    /// @name JSON Patch functions\n    /// @{\n\n    /*!\n    @brief applies a JSON patch\n\n    [JSON Patch](http://jsonpatch.com) defines a JSON document structure for\n    expressing a sequence of operations to apply to a JSON) document. With\n    this function, a JSON Patch is applied to the current JSON value by\n    executing all operations from the patch.\n\n    @param[in] json_patch  JSON patch document\n    @return patched document\n\n    @note The application of a patch is atomic: Either all operations succeed\n          and the patched document is returned or an exception is thrown. In\n          any case, the original value is not changed: the patch is applied\n          to a copy of the value.\n\n    @throw parse_error.104 if the JSON patch does not consist of an array of\n    objects\n\n    @throw parse_error.105 if the JSON patch is malformed (e.g., mandatory\n    attributes are missing); example: `\"operation add must have member path\"`\n\n    @throw out_of_range.401 if an array index is out of range.\n\n    @throw out_of_range.403 if a JSON pointer inside the patch could not be\n    resolved successfully in the current JSON value; example: `\"key baz not\n    found\"`\n\n    @throw out_of_range.405 if JSON pointer has no parent (\"add\", \"remove\",\n    \"move\")\n\n    @throw other_error.501 if \"test\" operation was unsuccessful\n\n    @complexity Linear in the size of the JSON value and the length of the\n    JSON patch. As usually only a fraction of the JSON value is affected by\n    the patch, the complexity can usually be neglected.\n\n    @liveexample{The following code shows how a JSON patch is applied to a\n    value.,patch}\n\n    @sa @ref diff -- create a JSON patch by comparing two JSON values\n\n    @sa [RFC 6902 (JSON Patch)](https://tools.ietf.org/html/rfc6902)\n    @sa [RFC 6901 (JSON Pointer)](https://tools.ietf.org/html/rfc6901)\n\n    @since version 2.0.0\n    */\n    basic_json patch(const basic_json& json_patch) const\n    {\n        // make a working copy to apply the patch to\n        basic_json result = *this;\n\n        // the valid JSON Patch operations\n        enum class patch_operations {add, remove, replace, move, copy, test, invalid};\n\n        const auto get_op = [](const std::string & op)\n        {\n            if (op == \"add\")\n            {\n                return patch_operations::add;\n            }\n            if (op == \"remove\")\n            {\n                return patch_operations::remove;\n            }\n            if (op == \"replace\")\n            {\n                return patch_operations::replace;\n            }\n            if (op == \"move\")\n            {\n                return patch_operations::move;\n            }\n            if (op == \"copy\")\n            {\n                return patch_operations::copy;\n            }\n            if (op == \"test\")\n            {\n                return patch_operations::test;\n            }\n\n            return patch_operations::invalid;\n        };\n\n        // wrapper for \"add\" operation; add value at ptr\n        const auto operation_add = [&result](json_pointer & ptr, basic_json val)\n        {\n            // adding to the root of the target document means replacing it\n            if (ptr.empty())\n            {\n                result = val;\n                return;\n            }\n\n            // make sure the top element of the pointer exists\n            json_pointer top_pointer = ptr.top();\n            if (top_pointer != ptr)\n            {\n                result.at(top_pointer);\n            }\n\n            // get reference to parent of JSON pointer ptr\n            const auto last_path = ptr.back();\n            ptr.pop_back();\n            basic_json& parent = result[ptr];\n\n            switch (parent.m_type)\n            {\n                case value_t::null:\n                case value_t::object:\n                {\n                    // use operator[] to add value\n                    parent[last_path] = val;\n                    break;\n                }\n\n                case value_t::array:\n                {\n                    if (last_path == \"-\")\n                    {\n                        // special case: append to back\n                        parent.push_back(val);\n                    }\n                    else\n                    {\n                        const auto idx = json_pointer::array_index(last_path);\n                        if (JSON_HEDLEY_UNLIKELY(idx > parent.size()))\n                        {\n                            // avoid undefined behavior\n                            JSON_THROW(out_of_range::create(401, \"array index \" + std::to_string(idx) + \" is out of range\"));\n                        }\n\n                        // default case: insert add offset\n                        parent.insert(parent.begin() + static_cast<difference_type>(idx), val);\n                    }\n                    break;\n                }\n\n                // if there exists a parent it cannot be primitive\n                default:            // LCOV_EXCL_LINE\n                    JSON_ASSERT(false);  // LCOV_EXCL_LINE\n            }\n        };\n\n        // wrapper for \"remove\" operation; remove value at ptr\n        const auto operation_remove = [&result](json_pointer & ptr)\n        {\n            // get reference to parent of JSON pointer ptr\n            const auto last_path = ptr.back();\n            ptr.pop_back();\n            basic_json& parent = result.at(ptr);\n\n            // remove child\n            if (parent.is_object())\n            {\n                // perform range check\n                auto it = parent.find(last_path);\n                if (JSON_HEDLEY_LIKELY(it != parent.end()))\n                {\n                    parent.erase(it);\n                }\n                else\n                {\n                    JSON_THROW(out_of_range::create(403, \"key '\" + last_path + \"' not found\"));\n                }\n            }\n            else if (parent.is_array())\n            {\n                // note erase performs range check\n                parent.erase(json_pointer::array_index(last_path));\n            }\n        };\n\n        // type check: top level value must be an array\n        if (JSON_HEDLEY_UNLIKELY(!json_patch.is_array()))\n        {\n            JSON_THROW(parse_error::create(104, 0, \"JSON patch must be an array of objects\"));\n        }\n\n        // iterate and apply the operations\n        for (const auto& val : json_patch)\n        {\n            // wrapper to get a value for an operation\n            const auto get_value = [&val](const std::string & op,\n                                          const std::string & member,\n                                          bool string_type) -> basic_json &\n            {\n                // find value\n                auto it = val.m_value.object->find(member);\n\n                // context-sensitive error message\n                const auto error_msg = (op == \"op\") ? \"operation\" : \"operation '\" + op + \"'\";\n\n                // check if desired value is present\n                if (JSON_HEDLEY_UNLIKELY(it == val.m_value.object->end()))\n                {\n                    JSON_THROW(parse_error::create(105, 0, error_msg + \" must have member '\" + member + \"'\"));\n                }\n\n                // check if result is of type string\n                if (JSON_HEDLEY_UNLIKELY(string_type && !it->second.is_string()))\n                {\n                    JSON_THROW(parse_error::create(105, 0, error_msg + \" must have string member '\" + member + \"'\"));\n                }\n\n                // no error: return value\n                return it->second;\n            };\n\n            // type check: every element of the array must be an object\n            if (JSON_HEDLEY_UNLIKELY(!val.is_object()))\n            {\n                JSON_THROW(parse_error::create(104, 0, \"JSON patch must be an array of objects\"));\n            }\n\n            // collect mandatory members\n            const auto op = get_value(\"op\", \"op\", true).template get<std::string>();\n            const auto path = get_value(op, \"path\", true).template get<std::string>();\n            json_pointer ptr(path);\n\n            switch (get_op(op))\n            {\n                case patch_operations::add:\n                {\n                    operation_add(ptr, get_value(\"add\", \"value\", false));\n                    break;\n                }\n\n                case patch_operations::remove:\n                {\n                    operation_remove(ptr);\n                    break;\n                }\n\n                case patch_operations::replace:\n                {\n                    // the \"path\" location must exist - use at()\n                    result.at(ptr) = get_value(\"replace\", \"value\", false);\n                    break;\n                }\n\n                case patch_operations::move:\n                {\n                    const auto from_path = get_value(\"move\", \"from\", true).template get<std::string>();\n                    json_pointer from_ptr(from_path);\n\n                    // the \"from\" location must exist - use at()\n                    basic_json v = result.at(from_ptr);\n\n                    // The move operation is functionally identical to a\n                    // \"remove\" operation on the \"from\" location, followed\n                    // immediately by an \"add\" operation at the target\n                    // location with the value that was just removed.\n                    operation_remove(from_ptr);\n                    operation_add(ptr, v);\n                    break;\n                }\n\n                case patch_operations::copy:\n                {\n                    const auto from_path = get_value(\"copy\", \"from\", true).template get<std::string>();\n                    const json_pointer from_ptr(from_path);\n\n                    // the \"from\" location must exist - use at()\n                    basic_json v = result.at(from_ptr);\n\n                    // The copy is functionally identical to an \"add\"\n                    // operation at the target location using the value\n                    // specified in the \"from\" member.\n                    operation_add(ptr, v);\n                    break;\n                }\n\n                case patch_operations::test:\n                {\n                    bool success = false;\n                    JSON_TRY\n                    {\n                        // check if \"value\" matches the one at \"path\"\n                        // the \"path\" location must exist - use at()\n                        success = (result.at(ptr) == get_value(\"test\", \"value\", false));\n                    }\n                    JSON_INTERNAL_CATCH (out_of_range&)\n                    {\n                        // ignore out of range errors: success remains false\n                    }\n\n                    // throw an exception if test fails\n                    if (JSON_HEDLEY_UNLIKELY(!success))\n                    {\n                        JSON_THROW(other_error::create(501, \"unsuccessful: \" + val.dump()));\n                    }\n\n                    break;\n                }\n\n                default:\n                {\n                    // op must be \"add\", \"remove\", \"replace\", \"move\", \"copy\", or\n                    // \"test\"\n                    JSON_THROW(parse_error::create(105, 0, \"operation value '\" + op + \"' is invalid\"));\n                }\n            }\n        }\n\n        return result;\n    }\n\n    /*!\n    @brief creates a diff as a JSON patch\n\n    Creates a [JSON Patch](http://jsonpatch.com) so that value @a source can\n    be changed into the value @a target by calling @ref patch function.\n\n    @invariant For two JSON values @a source and @a target, the following code\n    yields always `true`:\n    @code {.cpp}\n    source.patch(diff(source, target)) == target;\n    @endcode\n\n    @note Currently, only `remove`, `add`, and `replace` operations are\n          generated.\n\n    @param[in] source  JSON value to compare from\n    @param[in] target  JSON value to compare against\n    @param[in] path    helper value to create JSON pointers\n\n    @return a JSON patch to convert the @a source to @a target\n\n    @complexity Linear in the lengths of @a source and @a target.\n\n    @liveexample{The following code shows how a JSON patch is created as a\n    diff for two JSON values.,diff}\n\n    @sa @ref patch -- apply a JSON patch\n    @sa @ref merge_patch -- apply a JSON Merge Patch\n\n    @sa [RFC 6902 (JSON Patch)](https://tools.ietf.org/html/rfc6902)\n\n    @since version 2.0.0\n    */\n    JSON_HEDLEY_WARN_UNUSED_RESULT\n    static basic_json diff(const basic_json& source, const basic_json& target,\n                           const std::string& path = \"\")\n    {\n        // the patch\n        basic_json result(value_t::array);\n\n        // if the values are the same, return empty patch\n        if (source == target)\n        {\n            return result;\n        }\n\n        if (source.type() != target.type())\n        {\n            // different types: replace value\n            result.push_back(\n            {\n                {\"op\", \"replace\"}, {\"path\", path}, {\"value\", target}\n            });\n            return result;\n        }\n\n        switch (source.type())\n        {\n            case value_t::array:\n            {\n                // first pass: traverse common elements\n                std::size_t i = 0;\n                while (i < source.size() && i < target.size())\n                {\n                    // recursive call to compare array values at index i\n                    auto temp_diff = diff(source[i], target[i], path + \"/\" + std::to_string(i));\n                    result.insert(result.end(), temp_diff.begin(), temp_diff.end());\n                    ++i;\n                }\n\n                // i now reached the end of at least one array\n                // in a second pass, traverse the remaining elements\n\n                // remove my remaining elements\n                const auto end_index = static_cast<difference_type>(result.size());\n                while (i < source.size())\n                {\n                    // add operations in reverse order to avoid invalid\n                    // indices\n                    result.insert(result.begin() + end_index, object(\n                    {\n                        {\"op\", \"remove\"},\n                        {\"path\", path + \"/\" + std::to_string(i)}\n                    }));\n                    ++i;\n                }\n\n                // add other remaining elements\n                while (i < target.size())\n                {\n                    result.push_back(\n                    {\n                        {\"op\", \"add\"},\n                        {\"path\", path + \"/-\"},\n                        {\"value\", target[i]}\n                    });\n                    ++i;\n                }\n\n                break;\n            }\n\n            case value_t::object:\n            {\n                // first pass: traverse this object's elements\n                for (auto it = source.cbegin(); it != source.cend(); ++it)\n                {\n                    // escape the key name to be used in a JSON patch\n                    const auto key = json_pointer::escape(it.key());\n\n                    if (target.find(it.key()) != target.end())\n                    {\n                        // recursive call to compare object values at key it\n                        auto temp_diff = diff(it.value(), target[it.key()], path + \"/\" + key);\n                        result.insert(result.end(), temp_diff.begin(), temp_diff.end());\n                    }\n                    else\n                    {\n                        // found a key that is not in o -> remove it\n                        result.push_back(object(\n                        {\n                            {\"op\", \"remove\"}, {\"path\", path + \"/\" + key}\n                        }));\n                    }\n                }\n\n                // second pass: traverse other object's elements\n                for (auto it = target.cbegin(); it != target.cend(); ++it)\n                {\n                    if (source.find(it.key()) == source.end())\n                    {\n                        // found a key that is not in this -> add it\n                        const auto key = json_pointer::escape(it.key());\n                        result.push_back(\n                        {\n                            {\"op\", \"add\"}, {\"path\", path + \"/\" + key},\n                            {\"value\", it.value()}\n                        });\n                    }\n                }\n\n                break;\n            }\n\n            default:\n            {\n                // both primitive type: replace value\n                result.push_back(\n                {\n                    {\"op\", \"replace\"}, {\"path\", path}, {\"value\", target}\n                });\n                break;\n            }\n        }\n\n        return result;\n    }\n\n    /// @}\n\n    ////////////////////////////////\n    // JSON Merge Patch functions //\n    ////////////////////////////////\n\n    /// @name JSON Merge Patch functions\n    /// @{\n\n    /*!\n    @brief applies a JSON Merge Patch\n\n    The merge patch format is primarily intended for use with the HTTP PATCH\n    method as a means of describing a set of modifications to a target\n    resource's content. This function applies a merge patch to the current\n    JSON value.\n\n    The function implements the following algorithm from Section 2 of\n    [RFC 7396 (JSON Merge Patch)](https://tools.ietf.org/html/rfc7396):\n\n    ```\n    define MergePatch(Target, Patch):\n      if Patch is an Object:\n        if Target is not an Object:\n          Target = {} // Ignore the contents and set it to an empty Object\n        for each Name/Value pair in Patch:\n          if Value is null:\n            if Name exists in Target:\n              remove the Name/Value pair from Target\n          else:\n            Target[Name] = MergePatch(Target[Name], Value)\n        return Target\n      else:\n        return Patch\n    ```\n\n    Thereby, `Target` is the current object; that is, the patch is applied to\n    the current value.\n\n    @param[in] apply_patch  the patch to apply\n\n    @complexity Linear in the lengths of @a patch.\n\n    @liveexample{The following code shows how a JSON Merge Patch is applied to\n    a JSON document.,merge_patch}\n\n    @sa @ref patch -- apply a JSON patch\n    @sa [RFC 7396 (JSON Merge Patch)](https://tools.ietf.org/html/rfc7396)\n\n    @since version 3.0.0\n    */\n    void merge_patch(const basic_json& apply_patch)\n    {\n        if (apply_patch.is_object())\n        {\n            if (!is_object())\n            {\n                *this = object();\n            }\n            for (auto it = apply_patch.begin(); it != apply_patch.end(); ++it)\n            {\n                if (it.value().is_null())\n                {\n                    erase(it.key());\n                }\n                else\n                {\n                    operator[](it.key()).merge_patch(it.value());\n                }\n            }\n        }\n        else\n        {\n            *this = apply_patch;\n        }\n    }\n\n    /// @}\n};\n\n/*!\n@brief user-defined to_string function for JSON values\n\nThis function implements a user-defined to_string  for JSON objects.\n\n@param[in] j  a JSON object\n@return a std::string object\n*/\n\nNLOHMANN_BASIC_JSON_TPL_DECLARATION\nstd::string to_string(const NLOHMANN_BASIC_JSON_TPL& j)\n{\n    return j.dump();\n}\n} // namespace nlohmann\n\n///////////////////////\n// nonmember support //\n///////////////////////\n\n// specialization of std::swap, and std::hash\nnamespace std\n{\n\n/// hash value for JSON objects\ntemplate<>\nstruct hash<nlohmann::json>\n{\n    /*!\n    @brief return a hash value for a JSON object\n\n    @since version 1.0.0\n    */\n    std::size_t operator()(const nlohmann::json& j) const\n    {\n        return nlohmann::detail::hash(j);\n    }\n};\n\n/// specialization for std::less<value_t>\n/// @note: do not remove the space after '<',\n///        see https://github.com/nlohmann/json/pull/679\ntemplate<>\nstruct less<::nlohmann::detail::value_t>\n{\n    /*!\n    @brief compare two value_t enum values\n    @since version 3.0.0\n    */\n    bool operator()(nlohmann::detail::value_t lhs,\n                    nlohmann::detail::value_t rhs) const noexcept\n    {\n        return nlohmann::detail::operator<(lhs, rhs);\n    }\n};\n\n// C++20 prohibit function specialization in the std namespace.\n#ifndef JSON_HAS_CPP_20\n\n/*!\n@brief exchanges the values of two JSON objects\n\n@since version 1.0.0\n*/\ntemplate<>\ninline void swap<nlohmann::json>(nlohmann::json& j1, nlohmann::json& j2) noexcept(\n    is_nothrow_move_constructible<nlohmann::json>::value&&\n    is_nothrow_move_assignable<nlohmann::json>::value\n                              )\n{\n    j1.swap(j2);\n}\n\n#endif\n\n} // namespace std\n\n/*!\n@brief user-defined string literal for JSON values\n\nThis operator implements a user-defined string literal for JSON objects. It\ncan be used by adding `\"_json\"` to a string literal and returns a JSON object\nif no parse error occurred.\n\n@param[in] s  a string representation of a JSON object\n@param[in] n  the length of string @a s\n@return a JSON object\n\n@since version 1.0.0\n*/\nJSON_HEDLEY_NON_NULL(1)\ninline nlohmann::json operator \"\" _json(const char* s, std::size_t n)\n{\n    return nlohmann::json::parse(s, s + n);\n}\n\n/*!\n@brief user-defined string literal for JSON pointer\n\nThis operator implements a user-defined string literal for JSON Pointers. It\ncan be used by adding `\"_json_pointer\"` to a string literal and returns a JSON pointer\nobject if no parse error occurred.\n\n@param[in] s  a string representation of a JSON Pointer\n@param[in] n  the length of string @a s\n@return a JSON pointer object\n\n@since version 2.0.0\n*/\nJSON_HEDLEY_NON_NULL(1)\ninline nlohmann::json::json_pointer operator \"\" _json_pointer(const char* s, std::size_t n)\n{\n    return nlohmann::json::json_pointer(std::string(s, n));\n}\n\n// #include <nlohmann/detail/macro_unscope.hpp>\n\n\n// restore GCC/clang diagnostic settings\n#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)\n    #pragma GCC diagnostic pop\n#endif\n#if defined(__clang__)\n    #pragma GCC diagnostic pop\n#endif\n\n// clean up\n#undef JSON_ASSERT\n#undef JSON_INTERNAL_CATCH\n#undef JSON_CATCH\n#undef JSON_THROW\n#undef JSON_TRY\n#undef JSON_PRIVATE_UNLESS_TESTED\n#undef JSON_HAS_CPP_14\n#undef JSON_HAS_CPP_17\n#undef NLOHMANN_BASIC_JSON_TPL_DECLARATION\n#undef NLOHMANN_BASIC_JSON_TPL\n#undef JSON_EXPLICIT\n\n// #include <nlohmann/thirdparty/hedley/hedley_undef.hpp>\n#undef JSON_HEDLEY_ALWAYS_INLINE\n#undef JSON_HEDLEY_ARM_VERSION\n#undef JSON_HEDLEY_ARM_VERSION_CHECK\n#undef JSON_HEDLEY_ARRAY_PARAM\n#undef JSON_HEDLEY_ASSUME\n#undef JSON_HEDLEY_BEGIN_C_DECLS\n#undef JSON_HEDLEY_CLANG_HAS_ATTRIBUTE\n#undef JSON_HEDLEY_CLANG_HAS_BUILTIN\n#undef JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE\n#undef JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE\n#undef JSON_HEDLEY_CLANG_HAS_EXTENSION\n#undef JSON_HEDLEY_CLANG_HAS_FEATURE\n#undef JSON_HEDLEY_CLANG_HAS_WARNING\n#undef JSON_HEDLEY_COMPCERT_VERSION\n#undef JSON_HEDLEY_COMPCERT_VERSION_CHECK\n#undef JSON_HEDLEY_CONCAT\n#undef JSON_HEDLEY_CONCAT3\n#undef JSON_HEDLEY_CONCAT3_EX\n#undef JSON_HEDLEY_CONCAT_EX\n#undef JSON_HEDLEY_CONST\n#undef JSON_HEDLEY_CONSTEXPR\n#undef JSON_HEDLEY_CONST_CAST\n#undef JSON_HEDLEY_CPP_CAST\n#undef JSON_HEDLEY_CRAY_VERSION\n#undef JSON_HEDLEY_CRAY_VERSION_CHECK\n#undef JSON_HEDLEY_C_DECL\n#undef JSON_HEDLEY_DEPRECATED\n#undef JSON_HEDLEY_DEPRECATED_FOR\n#undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL\n#undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_\n#undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED\n#undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES\n#undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS\n#undef JSON_HEDLEY_DIAGNOSTIC_POP\n#undef JSON_HEDLEY_DIAGNOSTIC_PUSH\n#undef JSON_HEDLEY_DMC_VERSION\n#undef JSON_HEDLEY_DMC_VERSION_CHECK\n#undef JSON_HEDLEY_EMPTY_BASES\n#undef JSON_HEDLEY_EMSCRIPTEN_VERSION\n#undef JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK\n#undef JSON_HEDLEY_END_C_DECLS\n#undef JSON_HEDLEY_FLAGS\n#undef JSON_HEDLEY_FLAGS_CAST\n#undef JSON_HEDLEY_GCC_HAS_ATTRIBUTE\n#undef JSON_HEDLEY_GCC_HAS_BUILTIN\n#undef JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE\n#undef JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE\n#undef JSON_HEDLEY_GCC_HAS_EXTENSION\n#undef JSON_HEDLEY_GCC_HAS_FEATURE\n#undef JSON_HEDLEY_GCC_HAS_WARNING\n#undef JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK\n#undef JSON_HEDLEY_GCC_VERSION\n#undef JSON_HEDLEY_GCC_VERSION_CHECK\n#undef JSON_HEDLEY_GNUC_HAS_ATTRIBUTE\n#undef JSON_HEDLEY_GNUC_HAS_BUILTIN\n#undef JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE\n#undef JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE\n#undef JSON_HEDLEY_GNUC_HAS_EXTENSION\n#undef JSON_HEDLEY_GNUC_HAS_FEATURE\n#undef JSON_HEDLEY_GNUC_HAS_WARNING\n#undef JSON_HEDLEY_GNUC_VERSION\n#undef JSON_HEDLEY_GNUC_VERSION_CHECK\n#undef JSON_HEDLEY_HAS_ATTRIBUTE\n#undef JSON_HEDLEY_HAS_BUILTIN\n#undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE\n#undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS\n#undef JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE\n#undef JSON_HEDLEY_HAS_EXTENSION\n#undef JSON_HEDLEY_HAS_FEATURE\n#undef JSON_HEDLEY_HAS_WARNING\n#undef JSON_HEDLEY_IAR_VERSION\n#undef JSON_HEDLEY_IAR_VERSION_CHECK\n#undef JSON_HEDLEY_IBM_VERSION\n#undef JSON_HEDLEY_IBM_VERSION_CHECK\n#undef JSON_HEDLEY_IMPORT\n#undef JSON_HEDLEY_INLINE\n#undef JSON_HEDLEY_INTEL_CL_VERSION\n#undef JSON_HEDLEY_INTEL_CL_VERSION_CHECK\n#undef JSON_HEDLEY_INTEL_VERSION\n#undef JSON_HEDLEY_INTEL_VERSION_CHECK\n#undef JSON_HEDLEY_IS_CONSTANT\n#undef JSON_HEDLEY_IS_CONSTEXPR_\n#undef JSON_HEDLEY_LIKELY\n#undef JSON_HEDLEY_MALLOC\n#undef JSON_HEDLEY_MESSAGE\n#undef JSON_HEDLEY_MSVC_VERSION\n#undef JSON_HEDLEY_MSVC_VERSION_CHECK\n#undef JSON_HEDLEY_NEVER_INLINE\n#undef JSON_HEDLEY_NON_NULL\n#undef JSON_HEDLEY_NO_ESCAPE\n#undef JSON_HEDLEY_NO_RETURN\n#undef JSON_HEDLEY_NO_THROW\n#undef JSON_HEDLEY_NULL\n#undef JSON_HEDLEY_PELLES_VERSION\n#undef JSON_HEDLEY_PELLES_VERSION_CHECK\n#undef JSON_HEDLEY_PGI_VERSION\n#undef JSON_HEDLEY_PGI_VERSION_CHECK\n#undef JSON_HEDLEY_PREDICT\n#undef JSON_HEDLEY_PRINTF_FORMAT\n#undef JSON_HEDLEY_PRIVATE\n#undef JSON_HEDLEY_PUBLIC\n#undef JSON_HEDLEY_PURE\n#undef JSON_HEDLEY_REINTERPRET_CAST\n#undef JSON_HEDLEY_REQUIRE\n#undef JSON_HEDLEY_REQUIRE_CONSTEXPR\n#undef JSON_HEDLEY_REQUIRE_MSG\n#undef JSON_HEDLEY_RESTRICT\n#undef JSON_HEDLEY_RETURNS_NON_NULL\n#undef JSON_HEDLEY_SENTINEL\n#undef JSON_HEDLEY_STATIC_ASSERT\n#undef JSON_HEDLEY_STATIC_CAST\n#undef JSON_HEDLEY_STRINGIFY\n#undef JSON_HEDLEY_STRINGIFY_EX\n#undef JSON_HEDLEY_SUNPRO_VERSION\n#undef JSON_HEDLEY_SUNPRO_VERSION_CHECK\n#undef JSON_HEDLEY_TINYC_VERSION\n#undef JSON_HEDLEY_TINYC_VERSION_CHECK\n#undef JSON_HEDLEY_TI_ARMCL_VERSION\n#undef JSON_HEDLEY_TI_ARMCL_VERSION_CHECK\n#undef JSON_HEDLEY_TI_CL2000_VERSION\n#undef JSON_HEDLEY_TI_CL2000_VERSION_CHECK\n#undef JSON_HEDLEY_TI_CL430_VERSION\n#undef JSON_HEDLEY_TI_CL430_VERSION_CHECK\n#undef JSON_HEDLEY_TI_CL6X_VERSION\n#undef JSON_HEDLEY_TI_CL6X_VERSION_CHECK\n#undef JSON_HEDLEY_TI_CL7X_VERSION\n#undef JSON_HEDLEY_TI_CL7X_VERSION_CHECK\n#undef JSON_HEDLEY_TI_CLPRU_VERSION\n#undef JSON_HEDLEY_TI_CLPRU_VERSION_CHECK\n#undef JSON_HEDLEY_TI_VERSION\n#undef JSON_HEDLEY_TI_VERSION_CHECK\n#undef JSON_HEDLEY_UNAVAILABLE\n#undef JSON_HEDLEY_UNLIKELY\n#undef JSON_HEDLEY_UNPREDICTABLE\n#undef JSON_HEDLEY_UNREACHABLE\n#undef JSON_HEDLEY_UNREACHABLE_RETURN\n#undef JSON_HEDLEY_VERSION\n#undef JSON_HEDLEY_VERSION_DECODE_MAJOR\n#undef JSON_HEDLEY_VERSION_DECODE_MINOR\n#undef JSON_HEDLEY_VERSION_DECODE_REVISION\n#undef JSON_HEDLEY_VERSION_ENCODE\n#undef JSON_HEDLEY_WARNING\n#undef JSON_HEDLEY_WARN_UNUSED_RESULT\n#undef JSON_HEDLEY_WARN_UNUSED_RESULT_MSG\n#undef JSON_HEDLEY_FALL_THROUGH\n\n\n\n#endif  // INCLUDE_NLOHMANN_JSON_HPP_\n"
  },
  {
    "path": "R3nzSkin/memory.cpp",
    "content": "#pragma warning(disable: 28182 6011)\n\n#include <Windows.h>\n#include <chrono>\n#include <cstdint>\n#include <string>\n#include <thread>\n#include <vector>\n\n#include \"CheatManager.hpp\"\n#include \"Memory.hpp\"\n#include \"Offsets.hpp\"\n\n[[nodiscard]] static std::uint8_t* find_signature(const wchar_t* szModule, const char* szSignature) noexcept\n{\n\tconst auto module{ ::GetModuleHandleW(szModule) };\n\n\tusing bytes_t = std::vector<std::int32_t>;\n\n\tstatic const auto pattern_to_byte = [](const char* pattern) noexcept -> bytes_t\n\t{\n\t\tbytes_t bytes{};\n\t\tconst auto start{ const_cast<char*>(pattern) };\n\t\tconst auto end{ const_cast<char*>(pattern) + strlen(pattern) };\n\n\t\tfor (auto current{ start }; current < end; ++current) {\n\t\t\tif (*current == '?') {\n\t\t\t\t++current;\n\t\t\t\tif (*current == '?')\n\t\t\t\t\t++current;\n\t\t\t\tbytes.push_back(-1);\n\t\t\t} else {\n\t\t\t\tbytes.push_back(strtoul(current, &current, 16));\n\t\t\t}\n\t\t}\n\n\t\treturn bytes;\n\t};\n\n\tconst auto dosHeader{ reinterpret_cast<PIMAGE_DOS_HEADER>(module) };\n\tconst auto ntHeaders{ reinterpret_cast<PIMAGE_NT_HEADERS>(reinterpret_cast<std::uint8_t*>(module) + dosHeader->e_lfanew) };\n\tconst auto textSection{ IMAGE_FIRST_SECTION(ntHeaders) };\n\n\tconst auto sizeOfImage{ textSection->SizeOfRawData };\n\tconst auto patternBytes{ pattern_to_byte(szSignature) };\n\tconst auto scanBytes{ reinterpret_cast<std::uint8_t*>(module) + textSection->VirtualAddress };\n\n\tconst auto s{ patternBytes.size() };\n\tconst auto d{ patternBytes.data() };\n\n\tMEMORY_BASIC_INFORMATION mbi{ nullptr };\n\tconst std::uint8_t* next_check_address{ nullptr };\n\n\tfor (auto i{ 0ul }; i < sizeOfImage - s; ++i) {\n\t\tbool found{ true };\n\t\tfor (auto j{ 0ul }; j < s; ++j) {\n\t\t\tconst auto current_address{ scanBytes + i + j };\n\t\t\tif (current_address >= next_check_address) {\n\t\t\t\tif (!::VirtualQuery(current_address, &mbi, sizeof(mbi)))\n\t\t\t\t\tbreak;\n\n\t\t\t\tif (mbi.Protect == PAGE_NOACCESS) {\n\t\t\t\t\ti += reinterpret_cast<std::uintptr_t>(mbi.BaseAddress) + mbi.RegionSize - (reinterpret_cast<std::uintptr_t>(scanBytes) + i);\n\t\t\t\t\ti--;\n\t\t\t\t\tfound = false;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tnext_check_address = static_cast<std::uint8_t*>(mbi.BaseAddress) + mbi.RegionSize;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (scanBytes[i + j] != d[j] && d[j] != -1) {\n\t\t\t\tfound = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (found)\n\t\t\treturn &scanBytes[i];\n\t}\n\n\treturn nullptr;\n\n}\n\nvoid Memory::update(bool gameClient) noexcept\n{\n\tif (gameClient) {\n\t\tthis->client = *reinterpret_cast<GameClient**>(this->base + offsets::global::GameClient);\n\t} else {\n\t\tthis->localPlayer = *reinterpret_cast<AIBaseCommon**>(this->base + offsets::global::Player);\n\t\tthis->heroList = *reinterpret_cast<ManagerTemplate<AIHero>**>(this->base + offsets::global::ManagerTemplate_AIHero_);\n\t\tthis->minionList = *reinterpret_cast<ManagerTemplate<AIMinionClient>**>(this->base + offsets::global::ManagerTemplate_AIMinionClient_);\n\t\tthis->turretList = *reinterpret_cast<ManagerTemplate<AITurret>**>(this->base + offsets::global::ManagerTemplate_AITurret_);\n\t\tthis->championManager = *reinterpret_cast<ChampionManager**>(this->base + offsets::global::ChampionManager);\n\t\tthis->materialRegistry = reinterpret_cast<std::uintptr_t(__fastcall*)()>(this->base + offsets::functions::Riot__Renderer__MaterialRegistry__GetSingletonPtr)();\n\t\tthis->swapChain = *reinterpret_cast<IDXGISwapChain**>(this->materialRegistry + offsets::MaterialRegistry::SwapChain);\n\t\tthis->window = *reinterpret_cast<HWND*>(this->base + offsets::global::Riot__g_window);\n\t\tthis->translateString = reinterpret_cast<translateString_t>(this->base + offsets::functions::translateString_UNSAFE_DONOTUSE);\n\t}\n}\n\nvoid Memory::Search(bool gameClient)\n{\n\tusing namespace std::chrono_literals;\n\n\ttry {\n\t\tthis->base = reinterpret_cast<std::uintptr_t>(::GetModuleHandle(nullptr));\n\t\tconst auto& signatureToSearch{ (gameClient ? this->gameClientSig : this->sigs) };\n\n\t\tfor (const auto& sig : signatureToSearch)\n\t\t\t*sig.offset = 0;\n\n\t\twhile (true) {\n\t\t\tbool missing_offset{ false };\n\t\t\tfor (auto& sig : signatureToSearch) {\n\n\t\t\t\tif (*sig.offset != 0)\n\t\t\t\t\tcontinue;\n\n\t\t\t\tfor (auto& pattern : sig.pattern) {\n\t\t\t\t\tauto address{ find_signature(nullptr, pattern.c_str()) };\n\n\t\t\t\t\tif (!address) {\n\t\t\t\t\t\t::MessageBoxA(nullptr, (\"Failed to find pattern: \" + pattern).c_str(), \"R3nzSkin\", MB_OK | MB_ICONWARNING);\n\t\t\t\t\t\t// cheatManager.logger->addLog(\"Not found: %s\\n\", pattern.c_str());\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (sig.read)\n\t\t\t\t\t\taddress = *reinterpret_cast<std::uint8_t**>(address + (pattern.find_first_of('?') / 3));\n\t\t\t\t\telse if (sig.relative)\n\t\t\t\t\t\taddress = address + *reinterpret_cast<std::uint32_t*>(address + 3) + 7;\n\t\t\t\t\telse if (address[0] == 0xE8)\n\t\t\t\t\t\taddress = address + *reinterpret_cast<std::uint32_t*>(address + 1) + 5;\n\n\t\t\t\t\tif (sig.sub_base)\n\t\t\t\t\t\taddress -= this->base;\n\n\t\t\t\t\taddress += sig.additional;\n\n\t\t\t\t\t*sig.offset = reinterpret_cast<std::uint32_t>(address);\n\t\t\t\t\t// cheatManager.logger->addLog(\"Found: %s\\n\\tAddress: 0x%X\\n\", pattern.c_str(), *sig.offset);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif (!*sig.offset) {\n\t\t\t\t\tmissing_offset = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!missing_offset)\n\t\t\t\tbreak;\n\n\t\t\tstd::this_thread::sleep_for(2s);\n\t\t}\n\t\tthis->update(gameClient);\n\t} catch (const std::exception& e) {\n\t\t::MessageBoxA(nullptr, e.what(), \"R3nzSkin\", MB_OK | MB_ICONWARNING);\n\t}\n}\n"
  },
  {
    "path": "R3nzSkin/memory.hpp",
    "content": "#pragma once\n\n#include <Windows.h>\n#include <cstdint>\n#include <d3d11.h>\n\n#include \"Offsets.hpp\"\n\n#include \"SDK/AIBaseCommon.hpp\"\n#include \"SDK/AIHero.hpp\"\n#include \"SDK/AITurret.hpp\"\n#include \"SDK/AIMinionClient.hpp\"\n#include \"SDK/ChampionManager.hpp\"\n#include \"SDK/GameClient.hpp\"\n#include \"SDK/ManagerTemplate.hpp\"\n\nclass offset_signature {\npublic:\n\tstd::vector<std::string> pattern;\n\tbool sub_base;\n\tbool read;\n\tbool relative;\n\tstd::int32_t additional;\n\tstd::uint64_t* offset;\n};\n\nclass Memory {\npublic:\n\tvoid Search(bool gameClient = true);\n\n\tstd::uintptr_t base;\n\tHWND window;\n\n\tGameClient* client;\n\tAIBaseCommon* localPlayer;\n\tManagerTemplate<AIHero>* heroList;\n\tManagerTemplate<AIMinionClient>* minionList;\n\tManagerTemplate<AITurret>* turretList;\n\tChampionManager* championManager;\n\t\n\tstd::uintptr_t materialRegistry;\n\tIDXGISwapChain* swapChain;\n\n\tusing translateString_t = const char* (__fastcall*)(const char*);\n\n\ttranslateString_t translateString;\nprivate:\n\tvoid update(bool gameClient = true) noexcept;\n\n\tstd::vector<offset_signature> gameClientSig\n\t{\n\t\t{\n\t\t\t{\n\t\t\t\t\"48 8B 05 ? ? ? ? 4C 8B FA 83 78 0C 02\"\n\t\t\t}, true, false, true, 0, &offsets::global::GameClient\n\t\t}\n\t};\n\n\tstd::vector<offset_signature> sigs\n\t{\n\t\t{\n\t\t\t{\n\t\t\t\t\"48 8B 1D ? ? ? ? 48 85 DB 74 15 48 81 C3\"\n\t\t\t}, true, false, true, 0, &offsets::global::Player\n\t\t},\n\t\t{\n\t\t\t{\n\t\t\t\t\"48 8B 05 ? ? ? ? 48 8B 58 08 8B 40 10 48 8D 34 C3 48 3B DE\"\n\t\t\t}, true, false, true, 0, &offsets::global::ManagerTemplate_AIHero_\n\t\t},\n\t\t{\n\t\t\t{\n\t\t\t\t\"48 8B 0D ? ? ? ? 48 69 D0 ? ? 00 00 48 8B 05\"\n\t\t\t}, true, false, true, 0, &offsets::global::ChampionManager\n\t\t},\n\t\t{\n\t\t\t{\n\t\t\t\t\"48 8B 0D ? ? ? ? E8 ? ? ? ? 48 8B 0D ? ? ? ? E8 ? ? ? ? E8 ? ? ? ? E8 ? ? ? ? 48 8B C8\"\n\t\t\t}, true, false, true, 0, &offsets::global::ManagerTemplate_AIMinionClient_\n\t\t},\n\t\t{\n\t\t\t{\n\t\t\t\t\"48 8B 1D ? ? ? ? 48 8B 5B 28 48 85 DB\"\n\t\t\t}, true, false, true, 0, &offsets::global::ManagerTemplate_AITurret_\n\t\t},\n\t\t{\n\t\t\t{\n\t\t\t\t\"48 8B 0D ? ? ? ? FF 15 ? ? ? ? 48 8B 05 ? ? ? ?\"\n\t\t\t}, true, false, true, 0, &offsets::global::Riot__g_window\n\t\t},\n\t\t{\n\t\t\t{\n\t\t\t\t\"48 8D 8D ? ? 00 00 44 8B 8C 24 ? ? 00 00\"\n\t\t\t}, false, true, false, 0, &offsets::AIBaseCommon::CharacterDataStack\n\t\t},\n\t\t{\n\t\t\t{\n\t\t\t\t\"88 87 ? ? 00 00 48 89 44 24 38 0F B6 44 24 39 88 87 ?\"\n\t\t\t}, false, true, false, 0, &offsets::AIBaseCommon::SkinId\n\t\t},\n\t\t{\n\t\t\t{\n\t\t\t\t\"48 8D BB ? ? ? ? C6 83 ? ? ? ? ? 0F 84\"\n\t\t\t}, false, true, false, 0, &offsets::MaterialRegistry::SwapChain\n\t\t},\n\t\t{\n\t\t\t{\n\t\t\t\t\"E8 ? ? ? ? 48 8D 8D ? ? 00 00 E8 ? ? ? ? 48 85 C0 74 ? 48 85 ED\"\n\t\t\t}, true, false, false, 0, &offsets::functions::CharacterDataStack__Push\n\t\t},\n\t\t{\n\t\t\t{\n\t\t\t\t\"88 54 24 10 53 55 56 57 41 54 41 55 41 56\"\n\t\t\t}, true, false, false, 0, &offsets::functions::CharacterDataStack__Update\n\t\t},\n\t\t{\n\t\t\t{\n\t\t\t\t\"E8 ? ? ? ? 8B 57 34\"\n\t\t\t}, true, false, false, 0, &offsets::functions::Riot__Renderer__MaterialRegistry__GetSingletonPtr\n\t\t},\n\t\t{\n\t\t\t{\n\t\t\t\t\"E8 ? ? ? ? 0F 57 DB 4C 8B C0 F3 0F 5A DE\"\n\t\t\t}, true, false, false, 0, &offsets::functions::translateString_UNSAFE_DONOTUSE\n\t\t},\n\t\t{\n\t\t\t{\n\t\t\t\t\"E8 ? ? ? ? 4C 3B ? 0F 94 C0\"\n\t\t\t}, true, false, false, 0, &offsets::functions::GetGoldRedirectTarget\n\t\t}\n\t};\n};\n"
  },
  {
    "path": "R3nzSkin/offsets.hpp",
    "content": "#pragma once\n\n#include <cstdint>\n\nnamespace offsets {\n\tnamespace GameObject {\n\t\tnamespace VTable {\n\t\t\tenum {\n\t\t\t\tIsLaneMinion = 0xEB, // E8 ? ? ? ? 84 C0 0F 84 ? ? ? ? 39 1F\n\t\t\t\tIsEliteMinion = IsLaneMinion + 0x1,\n\t\t\t\tIsEpicMinion = IsEliteMinion + 0x1,\n\t\t\t\tIsMinion = IsEpicMinion + 0x4,\n\t\t\t\tIsJungle = IsMinion + 0x1\n\t\t\t};\n\t\t};\n\t\tenum {\n\t\t\tTeam = 0x3C,\n\t\t\tName = 0x58\n\t\t};\n\t};\n\n\tnamespace global {\n\t\tinline std::uint64_t Player{ 0 };\n\t\tinline std::uint64_t ChampionManager{ 0 };\n\t\tinline std::uint64_t Riot__g_window{ 0 };\n\t\tinline std::uint64_t ManagerTemplate_AIMinionClient_{ 0 };\n\t\tinline std::uint64_t ManagerTemplate_AIHero_{ 0 };\n\t\tinline std::uint64_t ManagerTemplate_AITurret_{ 0 };\n\t\tinline std::uint64_t GameClient{ 0 };\n\t};\n\n\tnamespace AIBaseCommon {\n\t\tinline std::uint64_t CharacterDataStack{ 0 };\n\t\tinline std::uint64_t SkinId{ 0 };\n\t};\n\n\tnamespace MaterialRegistry {\n\t\tinline std::uint64_t SwapChain{ 0 };\n\t};\n\n\tnamespace functions {\n\t\tinline std::uint64_t Riot__Renderer__MaterialRegistry__GetSingletonPtr{ 0 };\n\t\tinline std::uint64_t translateString_UNSAFE_DONOTUSE{ 0 };\n\t\tinline std::uint64_t CharacterDataStack__Push{ 0 };\n\t\tinline std::uint64_t CharacterDataStack__Update{ 0 };\n\t\tinline std::uint64_t GetGoldRedirectTarget{ 0 };\n\t};\n};\n"
  },
  {
    "path": "R3nzSkin/resource.h",
    "content": "//{{NO_DEPENDENCIES}}\n// Microsoft Visual C++ generated include file.\n// Used by R3nzSkin.rc\n\n// Yeni nesneler iin sonraki varsaylan deerler\n// \n#ifdef APSTUDIO_INVOKED\n#ifndef APSTUDIO_READONLY_SYMBOLS\n#define _APS_NEXT_RESOURCE_VALUE        101\n#define _APS_NEXT_COMMAND_VALUE         40001\n#define _APS_NEXT_CONTROL_VALUE         1001\n#define _APS_NEXT_SYMED_VALUE           101\n#endif\n#endif\n"
  },
  {
    "path": "R3nzSkin/vmt_smart_hook.hpp",
    "content": "#pragma once\n\n#include <Windows.h>\n#include <cassert>\n#include <cstddef>\n#include <cstdint>\n#include <cstring>\n\nauto is_code_ptr(void* ptr) -> bool {\n\tconstexpr const DWORD protect_flags{ PAGE_EXECUTE | PAGE_EXECUTE_READ | PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_WRITECOPY };\n\n\tMEMORY_BASIC_INFORMATION out;\n\t::VirtualQuery(ptr, &out, sizeof(out));\n\n\treturn out.Type && !(out.Protect & (PAGE_GUARD | PAGE_NOACCESS)) && out.Protect & protect_flags;\n}\n\nclass table_hook {\npublic:\n\tconstexpr table_hook(): m_new_vmt{ nullptr } , m_old_vmt{ nullptr } {}\n\n\t~table_hook() {\n\t\tif (m_new_vmt)\n\t\t\tdelete[](m_new_vmt - 1);\n\t}\n\nprotected:\n\tauto initialize(void** original_table) -> void {\n\t\tm_old_vmt = original_table;\n\n\t\tstd::size_t size{ 0 };\n\t\twhile (m_old_vmt[size] && is_code_ptr(m_old_vmt[size]))\n\t\t\t++size;\n\n\t\tm_new_vmt = (new void* [size + 1]) + 1;\n\t\t::memcpy(m_new_vmt - 1, m_old_vmt - 1, sizeof(void*) * (size + 1));\n\t}\n\n\tconstexpr auto leak_table() -> void { m_new_vmt = nullptr; }\n\n\tauto hook_instance(void* inst) const -> void {\n\t\tauto& vtbl{ *reinterpret_cast<void***>(inst) };\n\t\tassert(vtbl == m_old_vmt || vtbl == m_new_vmt);\n\t\tvtbl = m_new_vmt;\n\t}\n\n\tauto unhook_instance(void* inst) const -> void {\n\t\tauto& vtbl{ *reinterpret_cast<void***>(inst) };\n\t\tassert(vtbl == m_old_vmt || vtbl == m_new_vmt);\n\t\tvtbl = m_old_vmt;\n\t}\n\n\tauto initialize_and_hook_instance(void* inst) -> bool {\n\t\tauto& vtbl{ *reinterpret_cast<void***>(inst) };\n\t\tbool initialized{ false };\n\t\tif (!m_old_vmt) {\n\t\t\tinitialized = true;\n\t\t\tinitialize(vtbl);\n\t\t}\n\t\thook_instance(inst);\n\t\treturn initialized;\n\t}\n\n\ttemplate <typename Fn>\n\tauto hook_function(Fn hooked_fn, const std::size_t index) -> Fn {\n\t\tm_new_vmt[index] = (void*)(hooked_fn);\n\t\treturn (Fn)(m_old_vmt[index]);\n\t}\n\n\ttemplate<typename T>\n\tauto apply_hook(std::size_t idx) -> void { T::m_original = hook_function(&T::hooked, idx); }\n\n\ttemplate <typename Fn = std::uintptr_t>\n\tauto get_original_function(const int index) -> Fn { return (Fn)(m_old_vmt[index]); }\n\nprivate:\n\tvoid** m_new_vmt{ nullptr };\n\tvoid** m_old_vmt{ nullptr };\n};\n\nclass vmt_smart_hook : table_hook {\npublic:\n\tvmt_smart_hook(void* class_base) : m_class{ class_base } { initialize_and_hook_instance(class_base); }\n\t~vmt_smart_hook() { unhook_instance(m_class); }\n\n\tauto rehook() const -> void { hook_instance(m_class); }\n\tauto unhook() const -> void { unhook_instance(m_class); }\n\n\tusing table_hook::apply_hook;\n\tusing table_hook::get_original_function;\n\tusing table_hook::hook_function;\n\nprivate:\n\tvoid* m_class{ nullptr };\n};\n\nclass vmt_multi_hook : table_hook {\npublic:\n\tconstexpr vmt_multi_hook() { }\n\n\t~vmt_multi_hook() { leak_table(); }\n\n\tusing table_hook::apply_hook;\n\tusing table_hook::get_original_function;\n\tusing table_hook::hook_function;\n\tusing table_hook::hook_instance;\n\tusing table_hook::unhook_instance;\n\tusing table_hook::initialize;\n\tusing table_hook::initialize_and_hook_instance;\n};\n"
  },
  {
    "path": "R3nzSkin.sln",
    "content": "﻿\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 17\nVisualStudioVersion = 17.3.32922.545\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"R3nzSkin\", \"R3nzSkin\\R3nzSkin.vcxproj\", \"{17B6E7A6-AA76-4C09-B2AA-E2055EF748D2}\"\nEndProject\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"R3nzSkin_Injector\", \"R3nzSkin_Injector\\R3nzSkin_Injector.vcxproj\", \"{40F6875E-C1E5-4C10-A129-6E84CE034801}\"\nEndProject\nProject(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"Solution Items\", \"Solution Items\", \"{D1C9DAFE-154E-443E-9E7E-DAC46C839AAB}\"\n\tProjectSection(SolutionItems) = preProject\n\t\t.gitattributes = .gitattributes\n\t\t.gitignore = .gitignore\n\t\tLICENSE = LICENSE\n\t\tREADME.md = README.md\n\tEndProjectSection\nEndProject\nProject(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"PythonScripts\", \"PythonScripts\", \"{D80EC08B-EC70-4DA6-8DE2-36EA4AC99769}\"\n\tProjectSection(SolutionItems) = preProject\n\t\tPythonScripts\\lolskin_to_skin.py = PythonScripts\\lolskin_to_skin.py\n\tEndProjectSection\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tChinaServer|x64 = ChinaServer|x64\n\t\tChinaServer|x86 = ChinaServer|x86\n\t\tRiotGamesServers|x64 = RiotGamesServers|x64\n\t\tRiotGamesServers|x86 = RiotGamesServers|x86\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{17B6E7A6-AA76-4C09-B2AA-E2055EF748D2}.ChinaServer|x64.ActiveCfg = ChinaServer|x64\n\t\t{17B6E7A6-AA76-4C09-B2AA-E2055EF748D2}.ChinaServer|x64.Build.0 = ChinaServer|x64\n\t\t{17B6E7A6-AA76-4C09-B2AA-E2055EF748D2}.ChinaServer|x86.ActiveCfg = ChinaServer|Win32\n\t\t{17B6E7A6-AA76-4C09-B2AA-E2055EF748D2}.ChinaServer|x86.Build.0 = ChinaServer|Win32\n\t\t{17B6E7A6-AA76-4C09-B2AA-E2055EF748D2}.RiotGamesServers|x64.ActiveCfg = RiotGamesServers|x64\n\t\t{17B6E7A6-AA76-4C09-B2AA-E2055EF748D2}.RiotGamesServers|x64.Build.0 = RiotGamesServers|x64\n\t\t{17B6E7A6-AA76-4C09-B2AA-E2055EF748D2}.RiotGamesServers|x86.ActiveCfg = RiotGamesServers|Win32\n\t\t{17B6E7A6-AA76-4C09-B2AA-E2055EF748D2}.RiotGamesServers|x86.Build.0 = RiotGamesServers|Win32\n\t\t{40F6875E-C1E5-4C10-A129-6E84CE034801}.ChinaServer|x64.ActiveCfg = ChinaServer|x64\n\t\t{40F6875E-C1E5-4C10-A129-6E84CE034801}.ChinaServer|x64.Build.0 = ChinaServer|x64\n\t\t{40F6875E-C1E5-4C10-A129-6E84CE034801}.ChinaServer|x86.ActiveCfg = ChinaServer|Win32\n\t\t{40F6875E-C1E5-4C10-A129-6E84CE034801}.ChinaServer|x86.Build.0 = ChinaServer|Win32\n\t\t{40F6875E-C1E5-4C10-A129-6E84CE034801}.RiotGamesServers|x64.ActiveCfg = RiotGamesServers|x64\n\t\t{40F6875E-C1E5-4C10-A129-6E84CE034801}.RiotGamesServers|x64.Build.0 = RiotGamesServers|x64\n\t\t{40F6875E-C1E5-4C10-A129-6E84CE034801}.RiotGamesServers|x86.ActiveCfg = RiotGamesServers|Win32\n\t\t{40F6875E-C1E5-4C10-A129-6E84CE034801}.RiotGamesServers|x86.Build.0 = RiotGamesServers|Win32\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {E95A1774-0E1C-43AD-B120-3B91B5D5302F}\n\tEndGlobalSection\nEndGlobal\n"
  },
  {
    "path": "R3nzSkin_Injector/Injector.cpp",
    "content": "#include <Windows.h>\n#include <cstdlib>\n#include <fstream>\n#include <psapi.h>\n#include <string>\n#include <thread>\n#include <tlhelp32.h>\n#include <regex>\n#include <msclr/marshal_cppstd.h>\n\n#include \"Injector.hpp\"\n#include \"R3nzUI.hpp\"\n#include \"xorstr.hpp\"\n#include \"lazy_importer.hpp\"\n\nusing namespace System;\nusing namespace System::Windows::Forms;\nusing namespace System::Threading;\nusing namespace System::Globalization;\nusing namespace System::Net;\n\n#define xor_clrstr_w(x) msclr::interop::marshal_as<String^>(static_cast<std::wstring>(_XorStrW(x)))\n\nproclist_t WINAPI Injector::findProcesses(const std::wstring& name) noexcept\n{\n\tauto process_snap{ LI_FN(CreateToolhelp32Snapshot)(TH32CS_SNAPPROCESS, 0) };\n\tproclist_t list;\n\n\tif (process_snap == INVALID_HANDLE_VALUE)\n\t\treturn list;\n\n\tPROCESSENTRY32W pe32{};\n\tpe32.dwSize = sizeof(PROCESSENTRY32W);\n\n\tif (LI_FN(Process32FirstW).get()(process_snap, &pe32)) {\n\t\tif (pe32.szExeFile == name)\n\t\t\tlist.push_back(pe32.th32ProcessID);\n\n\t\twhile (LI_FN(Process32NextW).get()(process_snap, &pe32)) {\n\t\t\tif (pe32.szExeFile == name)\n\t\t\t\tlist.push_back(pe32.th32ProcessID);\n\t\t}\n\t}\n\n\tLI_FN(CloseHandle)(process_snap);\n\treturn list;\n}\n\nbool WINAPI Injector::isInjected(const std::uint32_t pid) noexcept\n{\n\tauto hProcess{ LI_FN(OpenProcess)(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid) };\n\n\tif (nullptr == hProcess)\n\t\treturn false;\n\n\tHMODULE hMods[1024];\n\tDWORD cbNeeded{};\n\n\tif (LI_FN(K32EnumProcessModules)(hProcess, hMods, sizeof(hMods), &cbNeeded)) {\n\t\tfor (auto i{ 0u }; i < (cbNeeded / sizeof(HMODULE)); ++i) {\n\t\t\tTCHAR szModName[MAX_PATH];\n\t\t\tif (LI_FN(K32GetModuleBaseNameW)(hProcess, hMods[i], szModName, sizeof(szModName) / sizeof(TCHAR))) {\n\t\t\t\tif (std::wcscmp(szModName, _XorStrW(L\"R3nzSkin.dll\")) == 0) {\n\t\t\t\t\tLI_FN(CloseHandle)(hProcess);\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tLI_FN(CloseHandle)(hProcess);\n\treturn false;\n}\n\nbool WINAPI Injector::inject(const std::uint32_t pid) noexcept\n{\n\tTCHAR current_dir[MAX_PATH];\n\tLI_FN(GetCurrentDirectoryW)(MAX_PATH, current_dir);\n\tconst auto handle{ LI_FN(OpenProcess)(PROCESS_ALL_ACCESS, false, pid) };\n\n\tif (!handle || handle == INVALID_HANDLE_VALUE)\n\t\treturn false;\n\n\tFILETIME ft{};\n\tSYSTEMTIME st{};\n\tLI_FN(GetSystemTime)(&st);\n\tLI_FN(SystemTimeToFileTime)(&st, &ft);\n\tFILETIME create{}, exit{}, kernel{}, user{};\n\tLI_FN(GetProcessTimes)(handle, &create, &exit, &kernel, &user);\n\n\tconst auto delta{ 10 - static_cast<std::int32_t>((*reinterpret_cast<std::uint64_t*>(&ft) - *reinterpret_cast<std::uint64_t*>(&create.dwLowDateTime)) / 10000000U) };\n\n\tif (delta > 0)\n\t\tstd::this_thread::sleep_for(std::chrono::seconds(delta));\n\n\tconst auto dll_path{ std::wstring(current_dir) + _XorStrW(L\"\\\\R3nzSkin.dll\") };\n\n\tif (const auto f{ std::ifstream(dll_path) }; !f.is_open()) {\n\t\tLI_FN(MessageBoxW)(nullptr, _XorStrW(L\"R3nzSkin.dll file could not be found.\\nTry reinstalling the cheat.\"), _XorStrW(L\"R3nzSkin\"), MB_ICONERROR | MB_OK);\n\t\tLI_FN(CloseHandle)(handle);\n\t\treturn false;\n\t}\n\n\tconst auto dll_path_remote{ LI_FN(VirtualAllocEx).get()(handle, nullptr, (dll_path.size() + 1) * sizeof(wchar_t), MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE) };\n\n\tif (!dll_path_remote) {\n\t\tLI_FN(CloseHandle)(handle);\n\t\treturn false;\n\t}\n\n\tif (!LI_FN(WriteProcessMemory).get()(handle, dll_path_remote, dll_path.data(), (dll_path.size() + 1) * sizeof(wchar_t), nullptr)) {\n\t\tLI_FN(VirtualFreeEx).get()(handle, dll_path_remote, 0u, MEM_RELEASE);\n\t\tLI_FN(CloseHandle)(handle);\n\t\treturn false;\n\t}\n\n\tHANDLE thread{};\n\tLI_FN(NtCreateThreadEx).nt_cached()(&thread, GENERIC_ALL, nullptr, handle, reinterpret_cast<LPTHREAD_START_ROUTINE>(LI_FN(GetProcAddress).get()(LI_FN(GetModuleHandleW).get()(_XorStrW(L\"kernel32.dll\")), _XorStr(\"LoadLibraryW\"))), dll_path_remote, FALSE, NULL, NULL, NULL, nullptr);\n\n\tif (!thread || thread == INVALID_HANDLE_VALUE) {\n\t\tLI_FN(VirtualFreeEx).get()(handle, dll_path_remote, 0u, MEM_RELEASE);\n\t\tLI_FN(CloseHandle)(handle);\n\t\treturn false;\n\t}\n\n\tLI_FN(WaitForSingleObject)(thread, INFINITE);\n\tLI_FN(CloseHandle)(thread);\n\tLI_FN(VirtualFreeEx).get()(handle, dll_path_remote, 0u, MEM_RELEASE);\n\tLI_FN(CloseHandle)(handle);\n\treturn true;\n}\n\nvoid WINAPI Injector::enableDebugPrivilege() noexcept\n{\n\tHANDLE token{};\n\tif (OpenProcessToken(LI_FN(GetCurrentProcess).get()(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &token)) {\n\t\tLUID value;\n\t\tif (LookupPrivilegeValueW(nullptr, _XorStrW(SE_DEBUG_NAME), &value)) {\n\t\t\tTOKEN_PRIVILEGES tp{};\n\t\t\ttp.PrivilegeCount = 1;\n\t\t\ttp.Privileges[0].Luid = value;\n\t\t\ttp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;\n\t\t\tif (AdjustTokenPrivileges(token, FALSE, &tp, sizeof(tp), nullptr, nullptr))\n\t\t\t\tLI_FN(CloseHandle)(token);\n\t\t}\n\t}\n}\n\nvoid Injector::autoUpdate()\n{\n\t/* do not even bother if we are from Chinese regions and Brazil */\n\tauto whitelisted_regions = gcnew array<String^> {\n\t\txor_clrstr_w(L\"zh-CN\"),\n\t\txor_clrstr_w(L\"zh-TW\"),\n\t\txor_clrstr_w(L\"zh-HK\"),\n\t\txor_clrstr_w(L\"zh-MO\"),\n\t\txor_clrstr_w(L\"zh-SG\"),\n\t\txor_clrstr_w(L\"pt-BR\")\n\t};\n\tauto current_culture = CultureInfo::CurrentCulture;\n\tauto region = current_culture->Name;\n\tfor each (auto whitelisted_region in whitelisted_regions)\n\t{\n\t\tif (region->Equals(whitelisted_region, StringComparison::OrdinalIgnoreCase))\n\t\t{\n\t\t\treturn;\n\t\t}\n\t}\n\t\n\tauto client = gcnew WebClient();\n\tServicePointManager::Expect100Continue = true;\n\tServicePointManager::SecurityProtocol = SecurityProtocolType::Tls12;\n\tclient->Headers->Add(xor_clrstr_w(L\"User-Agent\"), xor_clrstr_w(L\"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0\"));\n\n\ttry\n\t{\n\t\tauto json = msclr::interop::marshal_as<std::string>(client->DownloadString(xor_clrstr_w(L\"https://api.github.com/repos/R3nzTheCodeGOD/R3nzSkin/releases/latest\")));\n\t\tstd::regex tagnameRegex(_XorStr(\"\\\"tag_name\\\"\\\\s*:\\\\s*\\\"([^\\\"]+)\"));\n\t\tstd::regex urlRegex(_XorStr(\"\\\"browser_download_url\\\"\\\\s*:\\\\s*\\\"([^\\\"]+)\"));\n\t\tstd::regex dateRegex(_XorStr(\"\\\"created_at\\\"\\\\s*:\\\\s*\\\"([^\\\"]+)\"));\n\n\t\tif (std::smatch tagnameMatch; std::regex_search(json, tagnameMatch, tagnameRegex))\n\t\t{\n\t\t\tauto version = gcnew String(tagnameMatch[1].str().c_str());\n\t\t\tif (std::smatch dateMatch; std::regex_search(json, dateMatch, dateRegex))\n\t\t\t{\n\t\t\t\tif (!System::IO::File::Exists(xor_clrstr_w(L\"R3nzSkin.dll\")))\n\t\t\t\t{\n\t\t\t\t\tthrow gcnew Exception(xor_clrstr_w(L\"Failed to find R3nzSkin.dll in the current directory\"));\n\t\t\t\t}\n\t\t\t\tconst auto date_of_github_release = DateTime::ParseExact(gcnew String(dateMatch[1].str().c_str()), xor_clrstr_w(L\"yyyy-MM-ddTHH:mm:ssZ\"), CultureInfo::InvariantCulture).ToString(xor_clrstr_w(L\"dd.MM.yyyy HH:00\"));\n\t\t\t\tconst auto date_of_current_release = System::IO::File::GetLastWriteTime(xor_clrstr_w(L\"R3nzSkin.dll\")).ToString(xor_clrstr_w(L\"dd.MM.yyyy HH:00\"));\n\t\t\t\tif (date_of_current_release != date_of_github_release)\n\t\t\t\t{\n\t\t\t\t\tconst auto date_of_github_release_class = DateTime::ParseExact(date_of_github_release, xor_clrstr_w(L\"dd.MM.yyyy HH:00\"), CultureInfo::InvariantCulture);\n\t\t\t\t\tconst auto date_of_current_release_class = DateTime::ParseExact(date_of_current_release, xor_clrstr_w(L\"dd.MM.yyyy HH:00\"), CultureInfo::InvariantCulture);\n\t\t\t\t\tif (date_of_current_release_class > date_of_github_release_class)\n\t\t\t\t\t{\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst auto result = MessageBox::Show(xor_clrstr_w(L\"New version is available on GitHub\\nWould you like to download it now?\"), xor_clrstr_w(L\"R3nzSkin\"), MessageBoxButtons::YesNo, MessageBoxIcon::Information);\n\t\t\t\t\tif (result == DialogResult::Yes)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (std::smatch urlMatch; std::regex_search(json, urlMatch, urlRegex))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tauto url = gcnew String(urlMatch[1].str().c_str());\n\t\t\t\t\t\t\tauto file = String::Format(xor_clrstr_w(L\"R3nzSkin_{0}.zip\"), version);\n\t\t\t\t\t\t\tclient->DownloadFile(url, file);\n\n\t\t\t\t\t\t\tSystem::IO::Compression::ZipFile::ExtractToDirectory(file, xor_clrstr_w(L\"R3nzSkin\"));\n\t\t\t\t\t\t\tSystem::IO::File::Delete(file);\n\t\t\t\t\t\t\tSystem::IO::File::Delete(xor_clrstr_w(L\"R3nzSkin.dll\"));\n\t\t\t\t\t\t\tSystem::IO::File::Move(xor_clrstr_w(L\"R3nzSkin\\\\R3nzSkin_Injector.exe\"), String::Format(xor_clrstr_w(L\"R3nzSkin_Injector_{0}.exe\"), version));\n\t\t\t\t\t\t\tSystem::IO::File::Move(xor_clrstr_w(L\"R3nzSkin\\\\R3nzSkin.dll\"), xor_clrstr_w(L\"R3nzSkin.dll\"));\n\t\t\t\t\t\t\tSystem::IO::Directory::Delete(xor_clrstr_w(L\"R3nzSkin\"));\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tauto process_info = gcnew System::Diagnostics::ProcessStartInfo();\n\t\t\t\t\t\t\tprocess_info->Arguments = xor_clrstr_w(L\"/C choice /C Y /N /D Y /T 1 & del \\\"\") + System::Diagnostics::Process::GetCurrentProcess()->MainModule->FileName + xor_clrstr_w(L\"\\\"\");\n\t\t\t\t\t\t\tprocess_info->CreateNoWindow = true;\n\t\t\t\t\t\t\tprocess_info->FileName = xor_clrstr_w(L\"cmd.exe\");\n\t\t\t\t\t\t\tprocess_info->WindowStyle = System::Diagnostics::ProcessWindowStyle::Hidden;\n\t\t\t\t\t\t\tSystem::Diagnostics::Process::Start(process_info);\n\t\t\t\t\t\t\tSystem::Diagnostics::Process::Start(String::Format(xor_clrstr_w(L\"R3nzSkin_Injector_{0}.exe\"), version));\n\t\t\t\n\t\t\t\t\t\t\tEnvironment::Exit(0);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tcatch (Exception^ e)\n\t{\n\t\tMessageBox::Show(String::Format(xor_clrstr_w(L\"{0} - {1}\"), e->Message, e->StackTrace->Substring(5)), xor_clrstr_w(L\"R3nzSkin\"), MessageBoxButtons::OK, MessageBoxIcon::Error);\n\t\tEnvironment::Exit(0);\n\t}\n}\n\nvoid Injector::run() noexcept\n{\n\tenableDebugPrivilege();\n\twhile (true) {\n\t\tconst auto& league_client_processes{ Injector::findProcesses(_XorStrW(L\"LeagueClient.exe\")) };\n\t\tconst auto& league_processes{ Injector::findProcesses(_XorStrW(L\"League of Legends.exe\")) };\n\n\t\tR3nzSkinInjector::gameState = (league_processes.size() > 0) ? true : false;\n\t\tR3nzSkinInjector::clientState = (league_client_processes.size() > 0) ? true : false;\n\t\t\n\t\t// antiviruses don't like endless loops, show them that this loop is a breaking point. (technically still an infinite loop :D)\n\t\tif (league_processes.size() > 0xff)\n\t\t\tbreak;\n\n\t\tfor (auto& pid : league_processes) {\n\t\t\tif (!Injector::isInjected(pid)) {\n\t\t\t\tR3nzSkinInjector::cheatState = false;\n\t\t\t\tif (R3nzSkinInjector::btnState) {\n\t\t\t\t\tstd::this_thread::sleep_for(1.5s);\n\t\t\t\t\tif (Injector::inject(pid))\n\t\t\t\t\t\tR3nzSkinInjector::cheatState = true;\n\t\t\t\t\telse\n\t\t\t\t\t\tR3nzSkinInjector::cheatState = false;\n\t\t\t\t}\n\t\t\t\tstd::this_thread::sleep_for(1s);\n\t\t\t} else {\n\t\t\t\tR3nzSkinInjector::cheatState = true;\n\t\t\t}\n\t\t}\n\t\tstd::this_thread::sleep_for(1s);\n\t}\n}\n"
  },
  {
    "path": "R3nzSkin_Injector/Injector.hpp",
    "content": "#pragma once\n\n#include <Windows.h>\n#include <chrono>\n#include <cinttypes>\n#include <string>\n#include <vector>\n\nusing namespace std::chrono_literals;\nusing proclist_t = std::vector<std::uint32_t>;\n\nNTSTATUS NTAPI NtCreateThreadEx(PHANDLE, ACCESS_MASK, LPVOID, HANDLE, LPTHREAD_START_ROUTINE, LPVOID, BOOL, SIZE_T, SIZE_T, SIZE_T, LPVOID);\n\nclass Injector {\npublic:\n\tstatic proclist_t WINAPI findProcesses(const std::wstring& name) noexcept;\n\tstatic bool WINAPI isInjected(const std::uint32_t pid) noexcept;\n\tstatic bool WINAPI inject(const std::uint32_t pid) noexcept;\n\tstatic void WINAPI enableDebugPrivilege() noexcept;\n\tstatic void autoUpdate();\n\tstatic void run() noexcept;\n};\n"
  },
  {
    "path": "R3nzSkin_Injector/R3nzSkin_Injector.rc",
    "content": "// Microsoft Visual C++ generated resource script.\n//\n#include \"resource.h\"\n\n#define APSTUDIO_READONLY_SYMBOLS\n/////////////////////////////////////////////////////////////////////////////\n//\n// Generated from the TEXTINCLUDE 2 resource.\n//\n#include \"winres.h\"\n\n/////////////////////////////////////////////////////////////////////////////\n#undef APSTUDIO_READONLY_SYMBOLS\n\n/////////////////////////////////////////////////////////////////////////////\n// Turkish (Turkey) resources\n\n#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_TRK)\nLANGUAGE LANG_TURKISH, SUBLANG_DEFAULT\n#pragma code_page(1254)\n\n#ifdef APSTUDIO_INVOKED\n/////////////////////////////////////////////////////////////////////////////\n//\n// TEXTINCLUDE\n//\n\n1 TEXTINCLUDE \nBEGIN\n    \"resource.h\\0\"\nEND\n\n2 TEXTINCLUDE \nBEGIN\n    \"#include \"\"winres.h\"\"\\r\\n\"\n    \"\\0\"\nEND\n\n3 TEXTINCLUDE \nBEGIN\n    \"\\r\\n\"\n    \"\\0\"\nEND\n\n#endif    // APSTUDIO_INVOKED\n\n\n/////////////////////////////////////////////////////////////////////////////\n//\n// Version\n//\n\nVS_VERSION_INFO VERSIONINFO\n FILEVERSION 1,0,0,0\n PRODUCTVERSION 1,0,0,0\n FILEFLAGSMASK 0x3fL\n#ifdef _DEBUG\n FILEFLAGS 0x1L\n#else\n FILEFLAGS 0x0L\n#endif\n FILEOS 0x40004L\n FILETYPE 0x1L\n FILESUBTYPE 0x0L\nBEGIN\n    BLOCK \"StringFileInfo\"\n    BEGIN\n        BLOCK \"041f04b0\"\n        BEGIN\n            VALUE \"CompanyName\", \"R3nzSoftware Inc.\"\n            VALUE \"FileDescription\", \"R3nSkin DLL Injector\"\n            VALUE \"FileVersion\", \"1.0.0.0\"\n            VALUE \"InternalName\", \"R3nzSkin.exe\"\n            VALUE \"LegalCopyright\", \"Copyright (c) 2021-2023 Erdem Ylmaz\"\n            VALUE \"OriginalFilename\", \"R3nzSkin.exe\"\n            VALUE \"ProductName\", \"R3nSkin DLL Injector\"\n            VALUE \"ProductVersion\", \"1.0.0.0\"\n        END\n    END\n    BLOCK \"VarFileInfo\"\n    BEGIN\n        VALUE \"Translation\", 0x41f, 1200\n    END\nEND\n\n\n/////////////////////////////////////////////////////////////////////////////\n//\n// Icon\n//\n\n// Icon with lowest ID value placed first to ensure application icon\n// remains consistent on all systems.\nIDI_ICON1               ICON                    \"icon.ico\"\n\n#endif    // Turkish (Turkey) resources\n/////////////////////////////////////////////////////////////////////////////\n\n\n\n#ifndef APSTUDIO_INVOKED\n/////////////////////////////////////////////////////////////////////////////\n//\n// Generated from the TEXTINCLUDE 3 resource.\n//\n\n\n/////////////////////////////////////////////////////////////////////////////\n#endif    // not APSTUDIO_INVOKED\n\n"
  },
  {
    "path": "R3nzSkin_Injector/R3nzSkin_Injector.vcxproj",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup Label=\"ProjectConfigurations\">\n    <ProjectConfiguration Include=\"ChinaServer|x64\">\n      <Configuration>ChinaServer</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"RiotGamesServers|Win32\">\n      <Configuration>RiotGamesServers</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"ChinaServer|Win32\">\n      <Configuration>ChinaServer</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"RiotGamesServers|x64\">\n      <Configuration>RiotGamesServers</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n  </ItemGroup>\n  <PropertyGroup Label=\"Globals\">\n    <VCProjectVersion>16.0</VCProjectVersion>\n    <Keyword>Win32Proj</Keyword>\n    <ProjectGuid>{40f6875e-c1e5-4c10-a129-6e84ce034801}</ProjectGuid>\n    <RootNamespace>R3nzSkinInjector</RootNamespace>\n    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>\n    <ProjectName>R3nzSkin_Injector</ProjectName>\n    <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='RiotGamesServers|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>Application</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v143</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n    <CLRSupport>true</CLRSupport>\n    <PreferredToolArchitecture>x86</PreferredToolArchitecture>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='RiotGamesServers|x64'\" Label=\"Configuration\">\n    <ConfigurationType>Application</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v143</PlatformToolset>\n    <WholeProgramOptimization>false</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n    <CLRSupport>true</CLRSupport>\n    <PreferredToolArchitecture>x64</PreferredToolArchitecture>\n  </PropertyGroup>\n  <PropertyGroup Label=\"Configuration\" Condition=\"'$(Configuration)|$(Platform)'=='ChinaServer|Win32'\">\n    <PlatformToolset>v143</PlatformToolset>\n    <CharacterSet>Unicode</CharacterSet>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CLRSupport>true</CLRSupport>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='ChinaServer|x64'\" Label=\"Configuration\">\n    <PlatformToolset>v143</PlatformToolset>\n    <CharacterSet>Unicode</CharacterSet>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CLRSupport>true</CLRSupport>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n  <ImportGroup Label=\"ExtensionSettings\">\n  </ImportGroup>\n  <ImportGroup Label=\"Shared\">\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='RiotGamesServers|Win32'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='RiotGamesServers|x64'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <PropertyGroup Label=\"UserMacros\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='RiotGamesServers|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <EnableManagedIncrementalBuild>false</EnableManagedIncrementalBuild>\n    <OutDir>$(SolutionDir)Release\\$(Configuration)\\</OutDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='RiotGamesServers|x64'\">\n    <LinkIncremental>false</LinkIncremental>\n    <EnableManagedIncrementalBuild>false</EnableManagedIncrementalBuild>\n    <OutDir>$(SolutionDir)Release\\$(Configuration)\\</OutDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='ChinaServer|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <EnableManagedIncrementalBuild>false</EnableManagedIncrementalBuild>\n    <OutDir>$(SolutionDir)Release\\$(Configuration)\\</OutDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='ChinaServer|x64'\">\n    <LinkIncremental>false</LinkIncremental>\n    <EnableManagedIncrementalBuild>false</EnableManagedIncrementalBuild>\n    <OutDir>$(SolutionDir)Release\\$(Configuration)\\</OutDir>\n  </PropertyGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='RiotGamesServers|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <SDLCheck>true</SDLCheck>\n      <PreprocessorDefinitions>WIN32;_RIOT;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <LanguageStandard>stdcpp17</LanguageStandard>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n      <PrecompiledHeaderFile />\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <ExceptionHandling>false</ExceptionHandling>\n      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <ControlFlowGuard>false</ControlFlowGuard>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <FloatingPointExceptions>false</FloatingPointExceptions>\n      <CreateHotpatchableImage>false</CreateHotpatchableImage>\n      <StringPooling>true</StringPooling>\n      <RuntimeTypeInfo>true</RuntimeTypeInfo>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <UACExecutionLevel>RequireAdministrator</UACExecutionLevel>\n      <EntryPointSymbol>main</EntryPointSymbol>\n      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='RiotGamesServers|x64'\">\n    <ClCompile>\n      <WarningLevel>Level2</WarningLevel>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <SDLCheck>false</SDLCheck>\n      <PreprocessorDefinitions>WIN32;_RIOT;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <LanguageStandard>stdcpp17</LanguageStandard>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n      <PrecompiledHeaderFile>\n      </PrecompiledHeaderFile>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <ExceptionHandling>false</ExceptionHandling>\n      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <ControlFlowGuard>false</ControlFlowGuard>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <FloatingPointExceptions>false</FloatingPointExceptions>\n      <CreateHotpatchableImage>false</CreateHotpatchableImage>\n      <StringPooling>true</StringPooling>\n      <RuntimeTypeInfo>true</RuntimeTypeInfo>\n      <EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>\n      <MultiProcessorCompilation>true</MultiProcessorCompilation>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <UACExecutionLevel>RequireAdministrator</UACExecutionLevel>\n      <EntryPointSymbol>main</EntryPointSymbol>\n      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>\n      <SetChecksum>true</SetChecksum>\n      <CLRThreadAttribute>STAThreadingAttribute</CLRThreadAttribute>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='ChinaServer|Win32'\">\n    <ClCompile>\n      <LanguageStandard>stdcpp17</LanguageStandard>\n      <WarningLevel>Level3</WarningLevel>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <ConformanceMode>Default</ConformanceMode>\n      <SDLCheck>true</SDLCheck>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PrecompiledHeaderFile />\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n    </ClCompile>\n    <Link>\n      <UACExecutionLevel>RequireAdministrator</UACExecutionLevel>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <SubSystem>Windows</SubSystem>\n      <OptimizeReferences>true</OptimizeReferences>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <EntryPointSymbol>main</EntryPointSymbol>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='ChinaServer|x64'\">\n    <ClCompile>\n      <LanguageStandard>stdcpp17</LanguageStandard>\n      <WarningLevel>Level3</WarningLevel>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <ConformanceMode>Default</ConformanceMode>\n      <SDLCheck>true</SDLCheck>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PrecompiledHeaderFile>\n      </PrecompiledHeaderFile>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n    </ClCompile>\n    <Link>\n      <UACExecutionLevel>RequireAdministrator</UACExecutionLevel>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <SubSystem>Windows</SubSystem>\n      <OptimizeReferences>true</OptimizeReferences>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <EntryPointSymbol>main</EntryPointSymbol>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemGroup>\n    <ClCompile Include=\"Injector.cpp\" />\n    <ClCompile Include=\"main.cpp\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"Injector.hpp\" />\n    <ClInclude Include=\"lazy_importer.hpp\" />\n    <ClInclude Include=\"R3nzUI.hpp\">\n      <FileType>CppForm</FileType>\n    </ClInclude>\n    <ClInclude Include=\"resource.h\" />\n    <ClInclude Include=\"xorstr.hpp\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ResourceCompile Include=\"R3nzSkin_Injector.rc\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Image Include=\"icon.ico\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Reference Include=\"System\" />\n    <Reference Include=\"System.Data\" />\n    <Reference Include=\"System.Drawing\" />\n    <Reference Include=\"System.IO.Compression.FileSystem\" />\n    <Reference Include=\"System.Windows.Forms\" />\n    <Reference Include=\"System.Xml\" />\n  </ItemGroup>\n  <ItemGroup>\n    <EmbeddedResource Include=\"R3nzUI.resx\">\n      <DependentUpon>R3nzUI.hpp</DependentUpon>\n    </EmbeddedResource>\n  </ItemGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n  <ImportGroup Label=\"ExtensionTargets\">\n  </ImportGroup>\n</Project>"
  },
  {
    "path": "R3nzSkin_Injector/R3nzSkin_Injector.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup>\n    <Filter Include=\"Source Files\">\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\n      <Extensions>cpp;c;cc;cxx;c++;def;odl;idl;hpj;bat;asm;asmx</Extensions>\n    </Filter>\n    <Filter Include=\"Resource\">\n      <UniqueIdentifier>{cce4a7dd-5d8f-4859-9bee-14137797694a}</UniqueIdentifier>\n    </Filter>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"main.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"Injector.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <ResourceCompile Include=\"R3nzSkin_Injector.rc\">\n      <Filter>Resource</Filter>\n    </ResourceCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"resource.h\">\n      <Filter>Resource</Filter>\n    </ClInclude>\n    <ClInclude Include=\"R3nzUI.hpp\">\n      <Filter>Source Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"Injector.hpp\">\n      <Filter>Source Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"lazy_importer.hpp\">\n      <Filter>Source Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"xorstr.hpp\">\n      <Filter>Source Files</Filter>\n    </ClInclude>\n  </ItemGroup>\n  <ItemGroup>\n    <Image Include=\"icon.ico\">\n      <Filter>Resource</Filter>\n    </Image>\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "R3nzSkin_Injector/R3nzUI.hpp",
    "content": "#pragma once\n\n#include \"xorstr.hpp\"\n\nnamespace R3nzSkinInjector {\n\n\tusing namespace System;\n\tusing namespace System::ComponentModel;\n\tusing namespace System::Collections;\n\tusing namespace System::Windows::Forms;\n\tusing namespace System::Data;\n\tusing namespace System::Drawing;\n\tusing namespace System::Threading;\n\tusing namespace System::IO;\n\n\tstatic auto btnState{ false };\n\tstatic auto gameState{ false };\n\tstatic auto cheatState{ false };\n\tstatic auto clientState{ false };\n\n\tdelegate String^ MyDelegate();\n\tref class LambdaWrapper sealed\n\t{\n\tpublic:\n\t\tString^ InvokeLambda()\n\t\t{\n\t\t\treturn lambdaFunction();\n\t\t}\n\tprivate:\n\t\tMyDelegate^ lambdaFunction;\n\tpublic:\n\t\tLambdaWrapper()\n\t\t{\n\t\t\tlambdaFunction = gcnew MyDelegate(this, &LambdaWrapper::LambdaMethod);\n\t\t}\n\t\tString^ LambdaMethod()\n\t\t{\n\t\t\tauto characters = gcnew String(\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\");\n\t\t\tauto random = gcnew Random(static_cast<int>(DateTime::Now.Ticks));\n\n\t\t\tauto buffer = gcnew array<Char>(8);\n\t\t\tfor (int i = 0; i < 8; i++)\n\t\t\t{\n\t\t\t\tbuffer[i] = characters[random->Next(characters->Length)];\n\t\t\t}\n\n\t\t\treturn gcnew String(buffer);\n\t\t}\n\t};\n\n\tpublic ref class R3nzUI sealed : public Form\n\t{\n\tpublic:\n\t\tR3nzUI()\n\t\t{\n\t\t\tInitializeComponent(); loadSettings(); renameProgram();\n\t\t}\n\n\t\tvoid updateScreen()\n\t\t{\n\t\t\twhile (true) {\n\t\t\t\tif (clientState) {\n\t\t\t\t\tthis->clientStatusLabel->Text = L\"Found\";\n\t\t\t\t\tthis->clientStatusLabel->ForeColor = Color::FromArgb(255, 252, 220, 107);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthis->clientStatusLabel->Text = L\"Not Found\";\n\t\t\t\t\tthis->clientStatusLabel->ForeColor = Color::FromArgb(255, 245, 8, 83);\n\t\t\t\t}\n\n\t\t\t\tif (gameState) {\n\t\t\t\t\tthis->gameStatusLabel->Text = L\"Found\";\n\t\t\t\t\tthis->gameStatusLabel->ForeColor = Color::FromArgb(255, 252, 220, 107);\n\t\t\t\t\tif (cheatState) {\n\t\t\t\t\t\tthis->dllStatusLabel->Text = L\"Injected\";\n\t\t\t\t\t\tthis->dllStatusLabel->ForeColor = Color::FromArgb(255, 252, 220, 107);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthis->dllStatusLabel->Text = L\"Not Injected\";\n\t\t\t\t\t\tthis->dllStatusLabel->ForeColor = Color::FromArgb(255, 245, 8, 83);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthis->gameStatusLabel->Text = L\"Not Found\";\n\t\t\t\t\tthis->gameStatusLabel->ForeColor = Color::FromArgb(255, 245, 8, 83);\n\t\t\t\t\tthis->dllStatusLabel->Text = L\"Not Injected\";\n\t\t\t\t\tthis->dllStatusLabel->ForeColor = Color::FromArgb(255, 245, 8, 83);\n\t\t\t\t}\n\t\t\t\tThread::Sleep(1000);\n\t\t\t}\n\t\t}\n\n\t\tvoid saveSettings()\n\t\t{\n\t\t\tauto appDataPath = Environment::GetFolderPath(Environment::SpecialFolder::MyDocuments);\n\t\t\tauto settingsFolder = Path::Combine(appDataPath, L\"R3nzSkin\");\n\t\t\tauto settingsFilePath = Path::Combine(settingsFolder, L\"R3nzSkinInjector\");\n\n\t\t\tif (!Directory::Exists(settingsFolder)) {\n\t\t\t\tDirectory::CreateDirectory(settingsFolder);\n\t\t\t}\n\t\t\t\n\t\t\tFile::WriteAllText(settingsFilePath, Convert::ToString(this->toolstripmenuItem2->Checked));\n\t\t}\n\n\t\tvoid loadSettings()\n\t\t{\n\t\t\tauto appDataPath = Environment::GetFolderPath(Environment::SpecialFolder::MyDocuments);\n\t\t\tauto settingsFolder = Path::Combine(appDataPath, L\"R3nzSkin\");\n\t\t\tauto settingsFilePath = Path::Combine(settingsFolder, L\"R3nzSkinInjector\");\n\n\t\t\tif (!Directory::Exists(settingsFolder)) {\n\t\t\t\tDirectory::CreateDirectory(settingsFolder);\n\t\t\t}\n\n\t\t\tif (File::Exists(settingsFilePath)) {\n\t\t\t\tthis->toolstripmenuItem2->Checked = Boolean::Parse(File::ReadAllText(settingsFilePath));\n\t\t\t}\n\t\t}\n\n\t\tvoid renameProgram()\n\t\t{\n\t\t\tauto wrapper = gcnew LambdaWrapper();\n\n\t\t\t// Executable\n\t\t\tFile::Move(Application::ExecutablePath, String::Format(\"{0}\\\\{1}.exe\", Application::StartupPath, wrapper->InvokeLambda()));\n\n\t\t\t// Title\n\t\t\tthis->Text = wrapper->InvokeLambda();\n\t\t}\n\tprotected:\n\t\t~R3nzUI() { if (components) delete components; }\n\tprivate:\n\t\tButton^ startButton;\n\t\tLabel^ injectorStatusLabel;\n\t\tLabel^ dllStatusLabel;\n\t\tLabel^ gameStatusLabel;\n\t\tLabel^ clientStatusLabel;\n\t\tGroupBox^ injectorStatusGroupBox;\n\t\tGroupBox^ leagueClientStatusGroupBox;\n\t\tGroupBox^ leagueGameStatusGroupBox;\n\t\tGroupBox^ dllStatusGroupBox;\n\t\tLinkLabel^ copyrightLabel;\n\t\tSystem::ComponentModel::Container^ components;\n\t\tNotifyIcon^ notifyIcon;\n\t\tWindows::Forms::ContextMenu^ contextMenu;\n\t\tMenuItem^ menuItem;\n\t\tMenuItem^ menuItem2;\n\t\tMenuStrip^ menuStrip;\n\t\tToolStripMenuItem^ toolstripmenuItem;\n\t\tToolStripMenuItem^ toolstripmenuItem2;\n#pragma region Windows Form Designer generated code\n\t\t   void InitializeComponent()\n\t\t   {\n\t\t\t   auto resources = gcnew ComponentResourceManager(R3nzUI::typeid);\n\t\t\t   this->startButton = gcnew Button();\n\t\t\t   this->injectorStatusLabel = gcnew Label();\n\t\t\t   this->dllStatusLabel = gcnew Label();\n\t\t\t   this->gameStatusLabel = gcnew Label();\n\t\t\t   this->injectorStatusGroupBox = gcnew GroupBox();\n\t\t\t   this->leagueClientStatusGroupBox = gcnew GroupBox();\n\t\t\t   this->clientStatusLabel = gcnew Label();\n\t\t\t   this->leagueGameStatusGroupBox = gcnew GroupBox();\n\t\t\t   this->dllStatusGroupBox = gcnew GroupBox();\n\t\t\t   this->copyrightLabel = gcnew LinkLabel();\n\t\t\t   this->notifyIcon = gcnew NotifyIcon();\n\t\t\t   this->contextMenu = gcnew Windows::Forms::ContextMenu();\n\t\t\t   this->menuItem = gcnew MenuItem();\n\t\t\t   this->menuItem2 = gcnew MenuItem();\n\t\t\t   this->menuStrip = gcnew MenuStrip();\n\t\t\t   this->toolstripmenuItem = gcnew ToolStripMenuItem();\n\t\t\t   this->toolstripmenuItem2 = gcnew ToolStripMenuItem();\n\t\t\t   this->injectorStatusGroupBox->SuspendLayout();\n\t\t\t   this->leagueClientStatusGroupBox->SuspendLayout();\n\t\t\t   this->leagueGameStatusGroupBox->SuspendLayout();\n\t\t\t   this->dllStatusGroupBox->SuspendLayout();\n\t\t\t   this->SuspendLayout();\n\t\t\t   // \n\t\t\t   // startButton\n\t\t\t   // \n\t\t\t   this->startButton->BackColor = Color::FromArgb(245, 8, 83);\n\t\t\t   this->startButton->Cursor = Cursors::Hand;\n\t\t\t   this->startButton->FlatStyle = FlatStyle::Flat;\n\t\t\t   this->startButton->Font = gcnew Drawing::Font(L\"Arial\", 12, FontStyle::Bold, GraphicsUnit::Point, static_cast<Byte>(162));\n\t\t\t   this->startButton->Location = Point(12, 28);\n\t\t\t   this->startButton->Name = L\"startButton\";\n\t\t\t   this->startButton->Size = Drawing::Size(250, 50);\n\t\t\t   this->startButton->TabIndex = 0;\n\t\t\t   this->startButton->Text = L\"Start\";\n\t\t\t   this->startButton->UseVisualStyleBackColor = false;\n\t\t\t   this->startButton->Click += gcnew EventHandler(this, &R3nzUI::startButton_Click);\n\t\t\t   // \n\t\t\t   // injectorStatusLabel\n\t\t\t   // \n\t\t\t   this->injectorStatusLabel->AutoSize = true;\n\t\t\t   this->injectorStatusLabel->FlatStyle = FlatStyle::Flat;\n\t\t\t   this->injectorStatusLabel->Font = gcnew Drawing::Font(L\"Arial\", 11.25F, FontStyle::Bold, GraphicsUnit::Point, static_cast<Byte>(162));\n\t\t\t   this->injectorStatusLabel->ForeColor = Color::FromArgb(245, 8, 83);\n\t\t\t   this->injectorStatusLabel->Location = Point(6, 16);\n\t\t\t   this->injectorStatusLabel->Name = L\"injectorStatusLabel\";\n\t\t\t   this->injectorStatusLabel->Size = Drawing::Size(68, 18);\n\t\t\t   this->injectorStatusLabel->TabIndex = 1;\n\t\t\t   this->injectorStatusLabel->Text = L\"Stopped\";\n\t\t\t   // \n\t\t\t   // dllStatusLabel\n\t\t\t   // \n\t\t\t   this->dllStatusLabel->AutoSize = true;\n\t\t\t   this->dllStatusLabel->FlatStyle = FlatStyle::Flat;\n\t\t\t   this->dllStatusLabel->Font = gcnew Drawing::Font(L\"Arial\", 11.25F, FontStyle::Bold, GraphicsUnit::Point, static_cast<Byte>(162));\n\t\t\t   this->dllStatusLabel->ForeColor = Color::FromArgb(245, 8, 83);\n\t\t\t   this->dllStatusLabel->Location = Point(6, 16);\n\t\t\t   this->dllStatusLabel->Name = L\"dllStatusLabel\";\n\t\t\t   this->dllStatusLabel->Size = Drawing::Size(94, 18);\n\t\t\t   this->dllStatusLabel->TabIndex = 2;\n\t\t\t   this->dllStatusLabel->Text = L\"Not Injected\";\n\t\t\t   // \n\t\t\t   // gameStatusLabel\n\t\t\t   // \n\t\t\t   this->gameStatusLabel->AutoSize = true;\n\t\t\t   this->gameStatusLabel->FlatStyle = FlatStyle::Flat;\n\t\t\t   this->gameStatusLabel->Font = gcnew Drawing::Font(L\"Arial\", 11.25F, FontStyle::Bold, GraphicsUnit::Point, static_cast<Byte>(162));\n\t\t\t   this->gameStatusLabel->ForeColor = Color::FromArgb(245, 8, 83);\n\t\t\t   this->gameStatusLabel->Location = Point(6, 16);\n\t\t\t   this->gameStatusLabel->Name = L\"gameStatusLabel\";\n\t\t\t   this->gameStatusLabel->Size = Drawing::Size(82, 18);\n\t\t\t   this->gameStatusLabel->TabIndex = 3;\n\t\t\t   this->gameStatusLabel->Text = L\"Not Found\";\n\t\t\t   // \n\t\t\t   // gameStatusLabel\n\t\t\t   // \n\t\t\t   this->injectorStatusGroupBox->Controls->Add(this->injectorStatusLabel);\n\t\t\t   this->injectorStatusGroupBox->FlatStyle = FlatStyle::Flat;\n\t\t\t   this->injectorStatusGroupBox->Font = gcnew Drawing::Font(L\"Arial\", 6.75F, FontStyle::Bold, GraphicsUnit::Point, static_cast<Byte>(162));\n\t\t\t   this->injectorStatusGroupBox->ForeColor = Color::White;\n\t\t\t   this->injectorStatusGroupBox->Location = Point(12, 79);\n\t\t\t   this->injectorStatusGroupBox->Name = L\"gameStatusLabel\";\n\t\t\t   this->injectorStatusGroupBox->Size = Drawing::Size(250, 45);\n\t\t\t   this->injectorStatusGroupBox->TabIndex = 5;\n\t\t\t   this->injectorStatusGroupBox->TabStop = false;\n\t\t\t   this->injectorStatusGroupBox->Text = L\"Injector Status\";\n\t\t\t   // \n\t\t\t   // leagueClientStatusGroupBox\n\t\t\t   // \n\t\t\t   this->leagueClientStatusGroupBox->Controls->Add(this->clientStatusLabel);\n\t\t\t   this->leagueClientStatusGroupBox->FlatStyle = FlatStyle::Flat;\n\t\t\t   this->leagueClientStatusGroupBox->Font = gcnew Drawing::Font(L\"Arial\", 6.75F, FontStyle::Bold, GraphicsUnit::Point, static_cast<Byte>(162));\n\t\t\t   this->leagueClientStatusGroupBox->ForeColor = Color::White;\n\t\t\t   this->leagueClientStatusGroupBox->Location = Point(12, 130);\n\t\t\t   this->leagueClientStatusGroupBox->Name = L\"leagueClientStatusGroupBox\";\n\t\t\t   this->leagueClientStatusGroupBox->Size = Drawing::Size(250, 45);\n\t\t\t   this->leagueClientStatusGroupBox->TabIndex = 7;\n\t\t\t   this->leagueClientStatusGroupBox->TabStop = false;\n\t\t\t   this->leagueClientStatusGroupBox->Text = L\"LeagueClient Status\";\n\t\t\t   // \n\t\t   \t   // leagueGameStatusGroupBox\n\t\t   \t   // \n\t\t\t   this->leagueGameStatusGroupBox->Controls->Add(this->gameStatusLabel);\n\t\t\t   this->leagueGameStatusGroupBox->FlatStyle = FlatStyle::Flat;\n\t\t\t   this->leagueGameStatusGroupBox->Font = gcnew Drawing::Font(L\"Arial\", 6.75F, FontStyle::Bold, GraphicsUnit::Point, static_cast<Byte>(162));\n\t\t\t   this->leagueGameStatusGroupBox->ForeColor = Color::White;\n\t\t\t   this->leagueGameStatusGroupBox->Location = Point(12, 181);\n\t\t\t   this->leagueGameStatusGroupBox->Name = L\"leagueGameStatusGroupBox\";\n\t\t\t   this->leagueGameStatusGroupBox->Size = Drawing::Size(250, 45);\n\t\t\t   this->leagueGameStatusGroupBox->TabIndex = 8;\n\t\t\t   this->leagueGameStatusGroupBox->TabStop = false;\n\t\t\t   this->leagueGameStatusGroupBox->Text = L\"LeagueGame Status\";\n\t\t\t   // \n\t\t   \t   // dllStatusGroupBox\n\t\t   \t   // \n\t\t\t   this->dllStatusGroupBox->Controls->Add(this->dllStatusLabel);\n\t\t\t   this->dllStatusGroupBox->FlatStyle = FlatStyle::Flat;\n\t\t\t   this->dllStatusGroupBox->Font = gcnew Drawing::Font(L\"Arial\", 6.75F, FontStyle::Bold, GraphicsUnit::Point, static_cast<Byte>(162));\n\t\t\t   this->dllStatusGroupBox->ForeColor = Color::White;\n\t\t\t   this->dllStatusGroupBox->Location = Point(12, 232);\n\t\t\t   this->dllStatusGroupBox->Name = L\"dllStatusGroupBox\";\n\t\t\t   this->dllStatusGroupBox->Size = Drawing::Size(250, 45);\n\t\t\t   this->dllStatusGroupBox->TabIndex = 9;\n\t\t\t   this->dllStatusGroupBox->TabStop = false;\n\t\t\t   this->dllStatusGroupBox->Text = L\"R3nzSkin Status\";\n\t\t\t   // \n\t\t\t   // clientStatusLabel\n\t\t\t   // \n\t\t\t   this->clientStatusLabel->AutoSize = true;\n\t\t\t   this->clientStatusLabel->FlatStyle = FlatStyle::Flat;\n\t\t\t   this->clientStatusLabel->Font = gcnew Drawing::Font(L\"Arial\", 11.25F, FontStyle::Bold, GraphicsUnit::Point, static_cast<Byte>(162));\n\t\t\t   this->clientStatusLabel->ForeColor = Color::FromArgb(245, 8, 83);\n\t\t\t   this->clientStatusLabel->Location = Point(6, 16);\n\t\t\t   this->clientStatusLabel->Name = L\"clientStatusLabel\";\n\t\t\t   this->clientStatusLabel->Size = Drawing::Size(82, 18);\n\t\t\t   this->clientStatusLabel->TabIndex = 0;\n\t\t\t   this->clientStatusLabel->Text = L\"Not Found\";\n\t\t\t   // \n\t\t\t   // copyrightLabel\n\t\t\t   // \n\t\t\t   this->copyrightLabel->AutoSize = true;\n\t\t\t   this->copyrightLabel->Cursor = Cursors::Hand;\n\t\t\t   this->copyrightLabel->LinkBehavior = LinkBehavior::NeverUnderline;\n\t\t\t   this->copyrightLabel->LinkColor = Color::Silver;\n\t\t\t   this->copyrightLabel->Location = Point(20, 284);\n\t\t\t   this->copyrightLabel->Name = L\"copyrightLabel\";\n\t\t\t   this->copyrightLabel->Size = Drawing::Size(207, 14);\n\t\t\t   this->copyrightLabel->TabIndex = 11;\n\t\t\t   this->copyrightLabel->TabStop = true;\n\t\t\t   this->copyrightLabel->Text = L\"Copyright (c) 2021-2024 R3nzTheCodeGOD\";\n\t\t\t   this->copyrightLabel->TextAlign = ContentAlignment::MiddleCenter;\n\t\t\t   this->copyrightLabel->LinkClicked += gcnew LinkLabelLinkClickedEventHandler(this, &R3nzUI::copyrightLabel_LinkClicked);\n\t\t\t   //\n\t\t\t   // contextMenu\n\t\t\t   //\n\t\t\t   this->contextMenu->MenuItems->AddRange(gcnew array<MenuItem^> { this->menuItem, this->menuItem2 });\n\t\t\t   //\n\t\t\t   // menuItem\n\t\t\t   //\n\t\t\t   this->menuItem2->Index = 0;\n\t\t\t   this->menuItem2->Text = L\"Start\";\n\t\t\t   this->menuItem2->Click += gcnew EventHandler(this, &R3nzUI::menuItem2_OnClick);\n\t\t\t   this->menuItem->Index = 1;\n\t\t\t   this->menuItem->Text = L\"Exit\";\n\t\t\t   this->menuItem->Click += gcnew EventHandler(this, &R3nzUI::menuItem_OnClick);\n\t\t\t   //\n\t\t\t   // notifyIcon\n\t\t\t   //\n\t\t\t   this->notifyIcon->Text = L\"R3nzSkin\";\n\t\t\t   this->notifyIcon->Icon = cli::safe_cast<Drawing::Icon^>(resources->GetObject(L\"$this.Icon\"));\n\t\t\t   this->notifyIcon->Visible = false;\n\t\t\t   this->notifyIcon->ContextMenu = this->contextMenu;\n\t\t\t   this->notifyIcon->MouseDoubleClick += gcnew MouseEventHandler(this, &R3nzUI::notifyIcon_MouseDoubleClick);\n\t\t\t   //\n\t\t\t   // menuStrip\n\t\t\t   //\n\t\t\t   this->toolstripmenuItem->Text = L\"Preferences\";\n\t\t\t   this->toolstripmenuItem2->Text = L\"Hide to tray\";\n\t\t\t   this->toolstripmenuItem2->Click += gcnew EventHandler(this, &R3nzUI::toolstripmenuItem2_OnClick);\n\t\t\t   this->toolstripmenuItem->DropDownItems->Add(this->toolstripmenuItem2);\n\t\t\t   this->menuStrip->Items->Add(this->toolstripmenuItem);\n\t\t\t   // \n\t\t\t   // R3nzUI\n\t\t\t   // \n\t\t\t   this->AutoScaleDimensions = SizeF(7, 14);\n\t\t\t   this->AutoScaleMode = Windows::Forms::AutoScaleMode::Font;\n\t\t\t   this->BackColor = Color::FromArgb(32, 30, 30);\n\t\t\t   this->ClientSize = Drawing::Size(273, 307);\n\t\t\t   this->Controls->Add(this->menuStrip);\n\t\t   \t   this->Controls->Add(this->copyrightLabel);\n\t\t\t   this->Controls->Add(this->dllStatusGroupBox);\n\t\t\t   this->Controls->Add(this->leagueGameStatusGroupBox);\n\t\t\t   this->Controls->Add(this->leagueClientStatusGroupBox);\n\t\t\t   this->Controls->Add(this->injectorStatusGroupBox);\n\t\t\t   this->Controls->Add(this->startButton);\n\t\t\t   this->Cursor = Cursors::Arrow;\n\t\t\t   this->Font = gcnew Drawing::Font(L\"Arial\", 8.25F, FontStyle::Bold, GraphicsUnit::Point, static_cast<Byte>(162));\n\t\t\t   this->FormBorderStyle = Windows::Forms::FormBorderStyle::Fixed3D;\n\t\t\t   this->Icon = cli::safe_cast<Drawing::Icon^>(resources->GetObject(L\"$this.Icon\"));\n\t\t\t   this->MaximizeBox = false;\n\t\t\t   this->Name = L\"R3nzUI\";\n\t\t\t   this->RightToLeft = Windows::Forms::RightToLeft::No;\n\t\t\t   this->Text = L\"\";\n\t\t\t   this->Load += gcnew EventHandler(this, &R3nzUI::R3nzUI_Load);\n\t\t\t   this->Resize += gcnew EventHandler(this, &R3nzUI::R3nzUI_Resize);\n\t\t\t   this->injectorStatusGroupBox->ResumeLayout(false);\n\t\t\t   this->injectorStatusGroupBox->PerformLayout();\n\t\t\t   this->leagueClientStatusGroupBox->ResumeLayout(false);\n\t\t\t   this->leagueClientStatusGroupBox->PerformLayout();\n\t\t\t   this->leagueGameStatusGroupBox->ResumeLayout(false);\n\t\t\t   this->leagueGameStatusGroupBox->PerformLayout();\n\t\t\t   this->dllStatusGroupBox->ResumeLayout(false);\n\t\t\t   this->dllStatusGroupBox->PerformLayout();\n\t\t\t   this->menuStrip->ResumeLayout(false);\n\t\t\t   this->menuStrip->PerformLayout();\n\t\t\t   this->ResumeLayout(false);\n\t\t\t   this->PerformLayout();\n\t\t   }\n#pragma endregion\n\tprivate:\n\t\tVoid R3nzUI_Load(Object^ sender, EventArgs^ e) \n\t\t{\n\t\t\tAppDomain::CurrentDomain->UnhandledException += gcnew UnhandledExceptionEventHandler(this, &R3nzUI::R3nzUI_ExceptionHandler);\n\t\t}\n\tprivate:\n\t\tVoid R3nzUI_ExceptionHandler(Object^ sender, UnhandledExceptionEventArgs^ e)\n\t\t{\n\t\t\tconst auto exception = dynamic_cast<Exception^>(e->ExceptionObject)->Message;\n\t\t\tMessageBox::Show(exception);\n\t\t}\n\tprivate:\n\t\tVoid startButton_Click(Object^ sender, EventArgs^ e)\n\t\t{\n\t\t\tbtnState = !btnState;\n\t\t\tif (btnState) \n\t\t\t{\n\t\t\t\tthis->startButton->BackColor = Color::FromArgb(255, 252, 220, 107);\n\t\t\t\tthis->injectorStatusLabel->ForeColor = Color::FromArgb(255, 252, 220, 107);\n\t\t\t\tthis->startButton->Text = L\"Stop\";\n\t\t\t\tthis->injectorStatusLabel->Text = L\"Working\";\n\t\t\t\tthis->menuItem2->Text = L\"Stop\";\n\t\t\t}\n\t\t\telse \n\t\t\t{\n\t\t\t\tthis->startButton->BackColor = Color::FromArgb(255, 245, 8, 83);\n\t\t\t\tthis->injectorStatusLabel->ForeColor = Color::FromArgb(255, 245, 8, 83);\n\t\t\t\tthis->startButton->Text = L\"Start\";\n\t\t\t\tthis->injectorStatusLabel->Text = L\"Stopped\";\n\t\t\t\tthis->menuItem2->Text = L\"Start\";\n\t\t\t}\n\t\t}\n\tprivate:\n\t\tVoid copyrightLabel_LinkClicked(Object^ sender, LinkLabelLinkClickedEventArgs^ e)\n\t\t{\n\t\t\tDiagnostics::Process::Start(L\"https://github.com/R3nzTheCodeGOD/R3nzSkin\");\n\t\t}\n\tprivate:\n\t\tVoid R3nzUI_Resize(Object^ sender, EventArgs^ e)\n\t\t{\n\t\t\tif (this->WindowState == FormWindowState::Minimized) \n\t\t\t{\n\t\t\t\tif (this->toolstripmenuItem2->Checked) \n\t\t\t\t{\n\t\t\t\t\tthis->Hide();\n\t\t\t\t\tthis->notifyIcon->Visible = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tprivate:\n\t\tVoid notifyIcon_MouseDoubleClick(Object^ sender, MouseEventArgs^ e)\n\t\t{\n\t\t\tif (this->toolstripmenuItem2->Checked)\n\t\t\t{\n\t\t\t\tthis->Show();\n\t\t\t\tthis->WindowState = FormWindowState::Normal;\n\t\t\t\tthis->notifyIcon->Visible = false;\n\t\t\t}\n\t\t}\n\tprivate:\n\t\tVoid menuItem_OnClick(Object^ sender, EventArgs^ e)\n\t\t{\n\t\t\tthis->Close();\n\t\t}\n\tprivate:\n\t\tVoid menuItem2_OnClick(Object^ sender, EventArgs^ e)\n\t\t{\n\t\t\tthis->startButton_Click(nullptr, nullptr);\n\t\t}\n\tprivate:\n\t\tVoid toolstripmenuItem2_OnClick(Object^ sender, EventArgs^ e)\n\t\t{\n\t\t\tthis->toolstripmenuItem2->Checked = !this->toolstripmenuItem2->Checked;\n\t\t\tthis->saveSettings();\n\t\t}\n\t};\n}\n"
  },
  {
    "path": "R3nzSkin_Injector/R3nzUI.resx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<root>\n  <!-- \n    Microsoft ResX Schema \n    \n    Version 2.0\n    \n    The primary goals of this format is to allow a simple XML format \n    that is mostly human readable. The generation and parsing of the \n    various data types are done through the TypeConverter classes \n    associated with the data types.\n    \n    Example:\n    \n    ... ado.net/XML headers & schema ...\n    <resheader name=\"resmimetype\">text/microsoft-resx</resheader>\n    <resheader name=\"version\">2.0</resheader>\n    <resheader name=\"reader\">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>\n    <resheader name=\"writer\">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>\n    <data name=\"Name1\"><value>this is my long string</value><comment>this is a comment</comment></data>\n    <data name=\"Color1\" type=\"System.Drawing.Color, System.Drawing\">Blue</data>\n    <data name=\"Bitmap1\" mimetype=\"application/x-microsoft.net.object.binary.base64\">\n        <value>[base64 mime encoded serialized .NET Framework object]</value>\n    </data>\n    <data name=\"Icon1\" type=\"System.Drawing.Icon, System.Drawing\" mimetype=\"application/x-microsoft.net.object.bytearray.base64\">\n        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>\n        <comment>This is a comment</comment>\n    </data>\n                \n    There are any number of \"resheader\" rows that contain simple \n    name/value pairs.\n    \n    Each data row contains a name, and value. The row also contains a \n    type or mimetype. Type corresponds to a .NET class that support \n    text/value conversion through the TypeConverter architecture. \n    Classes that don't support this are serialized and stored with the \n    mimetype set.\n    \n    The mimetype is used for serialized objects, and tells the \n    ResXResourceReader how to depersist the object. This is currently not \n    extensible. For a given mimetype the value must be set accordingly:\n    \n    Note - application/x-microsoft.net.object.binary.base64 is the format \n    that the ResXResourceWriter will generate, however the reader can \n    read any of the formats listed below.\n    \n    mimetype: application/x-microsoft.net.object.binary.base64\n    value   : The object must be serialized with \n            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter\n            : and then encoded with base64 encoding.\n    \n    mimetype: application/x-microsoft.net.object.soap.base64\n    value   : The object must be serialized with \n            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter\n            : and then encoded with base64 encoding.\n\n    mimetype: application/x-microsoft.net.object.bytearray.base64\n    value   : The object must be serialized into a byte array \n            : using a System.ComponentModel.TypeConverter\n            : and then encoded with base64 encoding.\n    -->\n  <xsd:schema id=\"root\" xmlns=\"\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\">\n    <xsd:import namespace=\"http://www.w3.org/XML/1998/namespace\" />\n    <xsd:element name=\"root\" msdata:IsDataSet=\"true\">\n      <xsd:complexType>\n        <xsd:choice maxOccurs=\"unbounded\">\n          <xsd:element name=\"metadata\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" use=\"required\" type=\"xsd:string\" />\n              <xsd:attribute name=\"type\" type=\"xsd:string\" />\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" />\n              <xsd:attribute ref=\"xml:space\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"assembly\">\n            <xsd:complexType>\n              <xsd:attribute name=\"alias\" type=\"xsd:string\" />\n              <xsd:attribute name=\"name\" type=\"xsd:string\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"data\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\n                <xsd:element name=\"comment\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"2\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\" msdata:Ordinal=\"1\" />\n              <xsd:attribute name=\"type\" type=\"xsd:string\" msdata:Ordinal=\"3\" />\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" msdata:Ordinal=\"4\" />\n              <xsd:attribute ref=\"xml:space\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"resheader\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\" />\n            </xsd:complexType>\n          </xsd:element>\n        </xsd:choice>\n      </xsd:complexType>\n    </xsd:element>\n  </xsd:schema>\n  <resheader name=\"resmimetype\">\n    <value>text/microsoft-resx</value>\n  </resheader>\n  <resheader name=\"version\">\n    <value>2.0</value>\n  </resheader>\n  <resheader name=\"reader\">\n    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\n  </resheader>\n  <resheader name=\"writer\">\n    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\n  </resheader>\n  <assembly alias=\"System.Drawing\" name=\"System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" />\n  <data name=\"$this.Icon\" type=\"System.Drawing.Icon, System.Drawing\" mimetype=\"application/x-microsoft.net.object.bytearray.base64\">\n    <value>\n        AAABAAEADQ0AAAAAAA19VwAAFgAAAIlQTkcNChoKAAAADUlIRFIAAAEAAAABAAgGAAAAXHKoZgAAV0RJ\n        REFUeNrtnXd4VUX6x78zp91ekpveG5DQawAVFAXEgiIWLGtbLD8La1ndVVfXXd3mrt3V3XXtq4i9oygW\n        EKnSAwkpkIT0dpPb7ynz++MmAawoJLk3OZ/nySPCzblzZub9zjsz77xDoBO13Hn9ZIgiEAoxGCQevzhr\n        BDLznUDiAyCE0IsXDBeuvXgsHT/KJaxcs99WW+/JjncarKfOyknlOZIKgHZ5wo42dzAjGFIdjDHucL+b\n        56nfahaaXHHGOoGnCmPo2lHWtm/91kavwybVnzg9o85uFZVHn9um/P0/m5Wm1oDK2MOsdfMOvPROGVra\n        AuA4CgD4w8Mb9MaMUoheBdHBzOJUnHpiDmrrPTjnlHwcd1Iu4LwFbVvuoC+8WRavalrSeacNi0twGlLL\n        93WmyoqaJApcanKCyeG0SSmyqplDIdUGAsFkECyEwHhIQ//UlmYAO/Rv1FBY7QzLqiwKnE8UOS9jrLOm\n        ztMUCCpN/qDSlJVmrRcFruGV98vrOjpD3vwsx/5zrl0eYuxBtHy9Ey+9swevvV+BE6an455HN+qNrgvA\n        0GXGlDQQAkwek4jF5xVh+KhE+NoCmH/le9Lvl0zJHJ7jyGluD0wsyHYUK4qWEQgpTqtJtAsCjfvexuxu\n        Tcb6sMOQH36+qrJglzfcTCkJmIx8XVVN5zZNw+Ykl3H3ky/vqr797/Na0dGFtn1uPPvabjQ0+5CaZMY7\n        n+zFF+vr9Y6hC8Dg5IHfHYsdpW343fWToaoafAEF4045DSfPvN32l1un2WVZG5meYplks4gTFUUbaTGL\n        WQATCSGRRiJ9a9hHWyR6hIgxBoAwRdHa/UFltyjQHV/vaN7ktEvrn3u9tPGBp7Z21Hx1qdbaHkBOug1f\n        bmrA6YvfQ1GBE7vKO/SOowtAbLJwXh5eX16JD545DUX58dhV0Y55l76DXR9f6Khv8qUZDfyY0SNco9o7\n        AmOcdkO2ycjnADBRSgiJIWP/qcKgaYCmMVlWtMbmNn9FnN2wx+MP79y8s2Xr2EJX1eMv7Gi99aoJ4dUb\n        6zFpdCJ+/ecvMTzXiT8+ok8ZdAGIEe5cMhlt7iD+74JRGH3yUlK75lJT+T53UW6m/US7TZprMvAjVE2z\n        CzxnpHRwGvvhCgJjgKoyRdVYF8+RlnZ3cFVHV+jd/Q3ejTxP244/JV9+4pEN+L/fXQpCLtM7ly4A0cfZ\n        8/Lh9clIiDfg6gtHY/pZI3DvLZ8YpoxNHD0i13l6coJ5jqJqWQJPkynVq/zHkGXNQynZ3+UNb/P4wstW\n        b6zfePFNH9cFy67B3Q+txxfr6pCeYsFryyv1ytIFYOC4a8lkcBzBFeeNQkrxfJw4/TrrbddMSklNMk1L\n        S7KcQyjGmwxCKtFr+WejKFogLGt7mtr8H3R0ht5+7rXd+/75wo62rh1XKSXl7Zh21qu4a8lkfYqgC0D/\n        cPa8PJRWduDuG4qRnmzB1LNeJevePKcwJ922iFJSTCnJtZiFbI4SfrDO5Qeik2oMCIWVlk5PuMJiEqra\n        3MGlG7c1rz733KKubZvq8eLbZZg8JgnnXvehXmG6ABxdpo5PwtrNjbj/jmNht0pY/NuzcdeSZ4wnHpM+\n        YliO80KbRTxDErl8Gol70Y2+Lztst6hqGnP7Asqqplb/sur9XZ/MuXhZ87v/PQdWi4g5F7+NBXNy8cr7\n        5XqF/QicXgU/zMziNKzZ1IAJaZtw2S1LUbPrfZvoa58zaXTSHcOyHbdbLcJcgadxupvf30JADJLIDbdb\n        pVMTXaZZ9WVvmT3ecNu/Xizp3PHhIra3tgvXXzwGL7+ri8AP1qNeBd/Nwnl5aGj24bOXzoI0/HEse+zk\n        nFHD4k5PT7YsMBr48ZQSu15L0YOqMlXVtCp3V/ijLm/41Y3bmtZddNWE8JZP98Fo5FF40ot6JekC8MMU\n        5Tuxq6ID552Wj1uvmogJp72MnR9dODYh3nipycDPliSukKOE6jUV3ciy1gZgTXW9Z9nu8vY3Zh2THvzw\n        8xrceM8qjBuZgA8+q9YrqRu9M3ez/q1zcNKxmejcfiWWvVfBB0Nq1t7VlyzJy7K/6XIabjCb+JG68ccG\n        gkDjBYHOz06z/mfW9PR/uzvD0/ft77LVNdXg4gUjAERCsXWG+BpAUb4TdesuB0cBu1XCDX9cjQVzcqfe\n        ef3k29JTrLcnxBku4Dkar3eT2IRSIooCN9ZsFM4YnuuY2lK1XNq4vbnqw2VnhRobvPhkTRkKXZuGdDzB\n        kJ4C/ObqCUhNNGPJH1bh/adPT8/Lsl+Q5DJdabOIebr5DLKOTgBFYf52d/CDNnfw8Q8+37t69PAEZd6l\n        72BmceqQPYg0JD0AFrodw11G3PirKXjy+e2mwoR1lxbmxT2S5DItMki8PuIPUiglgtkkFDls0mnD85yp\n        5Xvd5a+8X95+bP42PLmsBNMnpqC6zqMLwGBlZnEqJoxy4YzidHy1udFmomT2qbNy/pCaaL5WkrgMQvQ5\n        /hARApNB4ovTki0nlG9damlo9jU+tezzDn/9Srz/2T58/uGTQ0YIhkSHXzgv4tFff+lYvPFhFTbtaCqY\n        f1LOo8NznS8nxhsXUkosulkMORGA3SqOLsxz/m3SmKTXd350w6LtpW0mtfI6pCSY8cx9Jw6Jehj0HsDC\n        k/Pg7gqhas2l2FvdZULHB5cNz3M+4LBJsyklom4KQxtCCJFEmmy1iHOLxyVnl+3t2PWrP5zcvml1Fd5Z\n        thAsKA/q9YFBKwAzi1Oxb//TsKsNuOfRjdxJ09Injx/puis5wXSjwNN0PXJP52B4jkoWszDeZOCL68ua\n        QnVNvtqRmbbgQ09vgyRyaG4LDM73Howv9cn/zsTHq2sAlEMUucSWrxdfYTLyV0sil653dZ0fwmGTpljM\n        wpOnO3I+27Ct6S/vrty76uVH5oIQgkVLPhp07zuoPICifCda2oOYNiEZ1186BqtX7Jk8ttD1hNMuXcZz\n        1KF3b53DgVLCGyQu3xVnOKm54nXPv5bu3HXyzEylrsmHqy4chRWrawfPuw6WF5lZnIpdFR1g7D/48Itq\n        i9evLJo2Ifkph006EfqhJ52fgdHAZyTGmx6+56apD/oDSt4Hn1UTu0UEa7oRM4tTB8U7xrxhzCxORXWd\n        B2lJJtTU349Vr3w05fzTh93nijPcKApcht6NdY4ESolgNQsTnXbDjHNPLVCefHnnzgSrpOVlOTA8x4E1\n        XzfE9PvF/FLYh8/Nh8BTzLrgTXz97nnH5mc5HrZahAn6mXydo42iah2t7cEHlr1X/uglC0d0uib8t/cA\n        WawSs1OAGVMiLhjPEaz5usG+9YPzbx2e63zBYtaNX6dv4DnqTIw33rXo9IIn12xqGM3Ya7jjuslY+eKZ\n        ugD0J3dePxkjh8WB7b0OAMn+5blFDxUVxP3JaOCz9W6q06cGQ4mQGG8654Rp6S9WfP72eV9tbuBEgQNj\n        j6Eo36kLQF9SlB+HrR+chzZ3EI+/sAPrtzQdN2FUwgsJccZLOUoG5ZamTvRBCGA28aNTk8z/uvtXxXes\n        3dxg3/HhGuyq6MCtV02IqXeJmUXAmcWpeOjO47B9dxt+d/86rH3jnNNGjYh/wmoSxhE9qkdnAOA5ajBI\n        /IzhuU7h+Td2r/387XPDc85/E5efW4gtJa0x8Q4x4wF8vu6fEASKLm/YXvH5xdePLIh7zCTx+fp0X2cg\n        IQRcnNNw7TW/GPPPvXvaJzDG0NYejJnpQEwMnYztwOpXfo+PVtXEX33hqD8lJ5h/ScjgjGLUiV1kRSst\n        2dP2q4mnn7rizDl3w90VivpzBFE9BTjjpFwku0yYmFGDL9bVJ1x2btE/khPMlxOiB/boRKExUeJyxRkn\n        VO8s3XXNnZ/tg3s57lwyBWVVnaiu64rKMkftFODD585AS3sQn6+/HLsrOnIWzS+4P8ll+kXPZbk6OtEI\n        z9GRacmWf5WsuOjMsr1u0euT8eCdx0ZteaNyJF354gLsKG3Ff5c9gKpVq44pyo97It5pOI3oq306MQBH\n        ictmleZMGp3Ib9/durGqplOhFCirckddWaPOoIrynaiu82Db8vPBc7QgOdG0TODoeH2xTyeWIADCiubZ\n        WtKyZOpZrz77/tOnIzPVijHzlkZVOaPKAyjMdyIj2YLdlR3YvenFcekplr8ZDfxMvTvpxCIcJVK80zil\n        fMvSAICdDc0+pSDbgS82RM/CYNQIwMr/nYn7/7sVFWsuRcPuV4vTUyxPWUziDN3p14lleJ5a7TZplqJo\n        7NizX18zZ0amduL0dHz61f6oKF9ULAI+evcM/PrPq1G3/nJs3dY8zm6THreYhbG68esMBkSeGlOTzDft\n        XHHB//3vrVLOYZOw8sUzMbN44PPTDLgAXHZ2Ia6/exU2l/wTza3+/IxUy/2iQPUDPTqDBgbAZOTt2em2\n        3z9z3+zFW3e3SFlpNnz+/qIBL9uATwGuuWgUnvrbiWiqKJ2aEGd63GmXZuir/TqDEZ6jJqddmjF9YirP\n        cXRdsCukbNjWOKApyAdUABhbizTDXlTv9+QMy3X812QUpkG/sFRnECPwVDIa+EmNLb6yrOLUkrWf1yAn\n        w4bdA5RTYECmADOLU8Hafo3N7z2EF98sS0hNMt9GCZ2idw+doQClxJKbZb9t1+fVx/9n6U4YJA5LH5k7\n        IGXp99G2MN+J++84BhaziLJKt/O0WdkPuuKMvyBEv6lYZ2ghy1p5bYPnyoIJKZ/Dfh/+dPM0/O6Bdf1a\n        hn43utf+eQrcXWHsKG21nnVy3h2uOOOFuvHrDEUEgRZkZ9geaCpvmwj8G2u+bsTZ8/L7tQz96gHctWQK\n        CIC7H16P/Wsvuy45wXQ/IUd2Ow8hACEEqsqgqgwMDIQQcDRy/ROlBGCAqunbCjrRibsr9PZHq2ouGpbj\n        8E6aPxmE3NJv391vR2pnTElFc1sAT/xvO7Ytv2BWfpZtydEwfn9AxZrNLfhyUwuqarwIhlRYTAIyUk1I\n        TzYiK9WM3EwLMlPNMEiRNU+mMehyoBMtWC3iydMnpvzu1ffL70tLNreztptA4h/ol+/uVw+A1SzBpi2N\n        04vy456RJG7YkTyLEoKOrjAeeqYUr39YC69fAWORPVcCgFB0ewIEqYlGjMiz4aRjkjF5dBxSk4wwSFzk\n        84xBjznQ+ZZhdHuWvX23j/uJpjHm7go9uHVX8+2SyIceeXY7Xv+wMvYFYGZxGn6xYBjSU6zgOZo5YVTC\n        83aLOPNI6pIQoNMj4x9P7sbS96qhaZG/+4HKBWOAJFKkJZswZoQDE0Y6ceykRKQlGWE0cGAaoOlKMKSh\n        hIBQQFEY3J4wWttDaO0IITFOgtMhwWkTwXEEWh9NJxmDr77Ze2Pm9Ief5DknrvnFGDz63LbYFgDGGN57\n        6jS8vrzS+qdbpv0jIc54JaVH9rWEAC+8tQ/3PLoTisZ+0kuw7vUASaRIdhkwbbwLU8e7MLLAjvRkE4wG\n        DpT2XSPrRJnRd7d1IKiivjmAPXu7sKOsE5t2tGNfnReyrEEQKNKTTDhhWhLmHpeC/CwLjrQPfx8+v1y2\n        o6xt0bhC11bzyKk4fuodfZpVqE8FYGZxGhpb/CitbEft2stuTnKZ7uUoMRzpcwMhFYt/ux5fbW4Fx/38\n        V2As4h0YDRziHRLysy2YMiYeM6ckIj/bCqPEQdOnCIOOHvc+GFKxu6ILX21pwfqtbaiq8aKjKwyvX4lM\n        I78xBaCUICPFhHPmZeKys3NhNBz9ODrGgGBI+WjVhvpfpidb6sbMGw9Cbo09Aei5MYWxe7D61a1TJo9J\n        XCbwNPtIn0spQWllJ664fQNqG/xHRYl71wIAcJQgJcGIcUUOzJ2RgmnjXUhwGnprSvcMYpOefsIYQ5s7\n        jPVbW/Hep/XYXNKO5vYQtG5PkhDyg9NJVWVw2AQ89LuJmDU9Cap69PuDxhhraPI/cPO9X95+/aVjwgXZ\n        dqROfaZP6qXPQoFb2oNg7Hmse3P1uNHD4x80SNzYo9WQO8o68eaK/ZAVhqNxaqBnRKDdD+vyytizz4PP\n        1jZjw7Y2lO3twv5GP3iewmkTIfB62EIsQEhE0DUNqKn34bO1TXhteS2eeqUSL79XjZI9nfAFFdDutv8x\n        4+/pf8GQitaOEKZPcMFi5vug3ISYjcKYsYXxHf/475YtALS3P97bN3XUFw+9a8lkjBwWj7LKDtMV5498\n        NjHOeM7R0kmOI1i1oRnX3f01urwy+vrYkKoxUELAcwQJ8RJmTEnEzMmJmDrehTiH2DuN0IkSowdAKOld\n        KP56ZztWb2zGF+ubUdvohywzaFrEnT+SvsNxBHdeOxKXLMztEy8AAIIhtbqi2n2q3SqVtLsDmHj6K0f9\n        O466BzCzOBXPv1GGV989D8kCPTklwXwDpcR01BqYEITCKj7+shHurjD6+uAg7R4VGAM8PgU7ytxYtaEF\n        W3d3oL45AE1jiHdIkEQOhBB9vWCAjJ7rDvry+BVs3d2Bd1fW4elXq/DMa1VYu6UVHV1hMBbxCo7U+AFA\n        VhjinRJOmJrUZwuCHEccmsasm3Y2f6YxBINBFQlxpqOaYfio+y+fr/s30PYZVry4s2jS6MTf8zx1Hc3n\n        axpDerIJaUlG7Nvv69+ORgCOEHj9ClZtiIwqrjgJU8bGY+5xKRiWY0VmqhlmIwdKiL6A2If0CLOqMXT5\n        ZFRWe1Fe7cHHXzZi6+4OtLaHwLo/1xcGSghQ1xhAp1dGvEMC64OGJoQg0WVaNGlUUknhif/7xx9umqIW\n        j0/GjHOPXjaho1ozD915HDieoKMzlHzl+SOfTXAa5/ZF/ycE+N9b+3DPYzuP2jrAz4WxSPyAJFIkxhlQ\n        kG1F8bh4TJ/gQn6WFWYjrwvBUWz3Ho+vsSWAbaVubC5px5aSDuzb70ObOwRFZb3i0JeoKsOc45Lx4B0T\n        YDbxfR0k1NnY4l+cMT37tWWPf4lF134SfQJw9rw8qBrDGx9WouLzi29KT7HcJ/C0TxYZCYks1P3t37vx\n        ygc1UNWBFYGDGqp3JyEx3oAxIxw4a04GpoyNg9MuAdCF4OcafU+bV1Z7sWZzCz5e3YjdVV0Ih7XuOT3Q\n        n3lkNI3h6gvy8durR/bLGlCnJ7zu5ffKF3CUNI4vikfxgteOynOPmoHuqujA0ofn4suPnxo1bmTC/QaJ\n        i+/LCjEaeIwvckKWNVTX++APKgDIgArBwTsJXr+Cin0efLauCZtL2qFqDEnxBpiM+o1mhwMlBCCA16eg\n        tsGPT79qwr9eqsATL1bg83VNaGgOfGNO338NzxgQ75Rw9QUFyEw194uo8xxJtFnE+nmXvrP+hWcehKJo\n        RyWT0FGptRnFqThzdi7WbWmU/nrr9AczUi3/1x8NQggQDGnYsqsdL79XjdUbW9DRGY50IBo9iYU0jcEg\n        cSgeF49brijEqGEOfefge+A4AlnWsG+/D6s2NuPLTS0orfKgvTOEYFA9rK26/uDyc3Lx68WFkATabwfL\n        ZFmrKqvqWDR2ZtZGmP96VETvqHgAyYkmPLVsKQrj983PSLXczvPU2F8NIXAEmalmHDc5EcVj42GQOIRl\n        DZ1eGYrCukeJge0xhBAoKsO+/T7s2+/DpNHxcNpE/UTiQVBK4A+oWL+tDc+9sRePPr8HH3xWj4oaL3x+\n        pXc7dqCNX1UZxhY6cdPlI5DkMvTrlI5S4hR46vrkw8qPKre9HKxr8h6xF3DE1bn5vfMAAPv2e7JnTEl9\n        3WmXBiSjLyERt1FRGeqbA9iyqx1frG/Guq1taOjerusxxoFeNLxyUR5+fUUhuCjyUgYKQgBFZVi9sQWv\n        fFCNtZvb4PaEQRAdXtzBUaICT1E8Nh63XlmIMSMcA7KewxhTqus8t+bNfP7BcUUubNvddkTPO2IPIDnB\n        hLc/rjJesrDwroQ44xkYwKSePXNCh03EiFwbZhYn4piJCRgz3IEklwGSxMHrkxGWtYHrUGBobQ9hZnEi\n        4p3SkF4UJARod4fx1KtV+PuTu7C9rBNhWev3Of339SWNMVjNAobl2HDcpARcdGY2rj6/AHlZ1gFrN0II\n        NRr4gi1fPb/qd9dNbqSU4ov1dT/7eT97RaqoIA5nzM7F766bjLVbGqfHO6Soubm3J9LLIHEYNdyBvEwL\n        pk9MwKYdbXjixXKU7/MOmBdAQNDaEUJNvR/5WdYhbfz+gIqHninD0neroWosKjyiHk/RbhUxYaQTZ8/L\n        QPE4F6xmHqJAD/nMQCEKXK7TJl1kGPHEVpNRwNKH5+D8X63oXwF48i/HY9WGBpxy2XviU3+bdYEk8Y6B\n        qpCeyC5VZZAVDaGQhpoGH6pqvaip92NPVRd2VXahpS0IX0Ad8HlkJLJwaK8AEEKwY48b739eD1XTBnTE\n        17RIGjlJpCjItmL6BBeOm5yAsSOcvbH+kalAtNQdkJZsOWvPp794SWNs839eLvnZz/rZAqAx4LfXTcGC\n        Oa3zXXGGs0g/vjwlBKy74cLhyDZg+T4PqusiRl9R7UVzWxDurnCvwUd2laJjBVkHUBQN739ah3Z3aEDn\n        +oQARfl2zJySiHFFTowZ4UBKorHb6KM3bkMSuZw4h3TnS+/s+WV6krn9zusn455HN/aPAKxatgACT7Fl\n        e2P8sBznTaLAOfq6kQiJJPd0e8KoawpgR5kb1XU+lJR3orrOh7qmABQlMrfvTQvWfYgn2uAogd0qDHEB\n        YCip6BpQA2MALEYew3OtKOpOCBNJFce6F4sPHCGONggAg8TPmTQ68eRpZ4186YbL3/pZz/nJAlBU4MSq\n        jfW44+/Xo27dJ+eIAp3UVy9JKQFjDO3uMCprvPhsXRO27e5AVa0PLe1BaFqP+3ZQBuAoR9MYhufYkJNu\n        GdLTgB4PbqCNyBdQ8M7KOryzsh4Om4C8TAvys6wYM8KBUcPsSE4wIs4eSQWG7pyT0eAZMAAGiTMVFcRd\n        ++FzW1aedXJeU7zDgLseXN+3AnDX9cXIy7ZhzWtvjB413PV/lJI+Gco0jWHb7g6s/KoJG3e0obSyCx6f\n        AlU9cJSTEBxRRqB+N37GkBgv4ZKFOb1HiYcqhCAq8iocaIPIQNPa3oYN29rw2nIKi4lHQbYVhfl2pKeY\n        kBAnITvNjJREI5w2EaJIBzyXpNHAT0lPsVw6eu5Lfz//9IKfvL31kwVgc0kzFi35kG9Yf/mVFpMwpq+M\n        //WPavHo83uwv9EPxroX+hBbBv9N4zcZeCy5dDjmHpcy5M8E8BzBsBwrNm5vi5oyHTygKCpDR5eM9dva\n        sHZrG0SBQhQojAYOLqeE6RNcGDPcgcJ8GzJTzTBKHChPIoLQj54NzxE+Pcl80ZevLvxfnMNQt/Td8r4T\n        gKJ8J045IRsnHZORxHFkZs85+aMJpQQbtrfh0ef2oLbRH9kaitGFu569ZDAgziHikrNysHBuBjhOzxvA\n        8xTHTkrAmyv2IxAc+J2Z7xME0n1tVU/i0EBQRVtHCKWVXTBIHFxxEnIzzJg+IQHZ6WYU5tmQlWYGIf2T\n        WJYxwGIW8zNTrdMyhsW/xtgWEDL+sH//JwUCtbQH8cyrjyLYVLIwLdlyCSGEP9oV7guo+MsTu7ClpCPm\n        RvuD7xlgAGxmAbkZFhxfnIhfX1GIM2dnQBKpfiKwG4dNxI6yTuzb74uJ9Zve3aTuHAOqxtDlkVFd78ea\n        r1vw0aoGrNncirCsITXRCKtZ6Jdwb0LAczx1fbxy7wete9f6K/Z1HnaI8GHX+sziNPzjjmPQ1OIvmD4x\n        5XWbRRx9tF+E4wi27urA4tvWo7UjHPVbdhFDZ2BapOx2q4C0JBNGFthRmGdDXpYFeZkWJMYbwPNUPwD0\n        HQa1u6ILf/vPLqza0NL7d7GMpjEIAsXYEQ786tLhOGZiQj/1RabUN/vvzJz+zF9/SkzFYX0yPdmM/Y2+\n        SEbVLVf83mYV76Z90FIcR/D2x/tx472bo/KgzMEjvCBQmAwc4hwSRg+3Y1yhE8NzrRiWY4PDKkAUOBB6\n        4FISne+GUoK9+734x5O7sWpDCzw+GeiO9YhlFJVhXKED/7pnMlISjf3SB/wBZfeWkubTg2G18s2PqvCv\n        F3f+6O8clgtf23AbXnlsNV557OSMU07IPpOjfTOH1VSGuqYANDbwI4GmMWgssmfP8wQcRxBnF5GaaESS\n        y4AxI5wYkWdFfqYVTrsIs4kHuuf8vXN/VTfww6nn7DQz/vzrcVi3pRUfrW7A9lI36psDkBUNisK6TwJG\n        1xHvH4OjBNV1PpTt9SAtyQS1HxTAaOBG5Gbap6dPG1657L3DWww8LAG4/uJlePT5h1Gy4r9zJJEb1Wfv\n        MkDte3BmX0oJRIEiPdmI7HQz8jKtyEw1ISPFhLRkE2wWARYTfyANVPc0oK8yww4FGANsFh4nz0jBjCmJ\n        aGkPYn+DH/vqfNhb60VNgx/VdT5U1/kQDEUyAPV4CdHqKBACdHpl7CrvxKypSf30nYSIAnfafbe9s2zK\n        mKRwZXXnj94q9KMCcPa8fCS4jLjjuluM11405lRKSZ+ltKGUID3FBEr7Lu468txD3XKnXUR6sgl2q4Cx\n        hU5MGh2HzFQzUhMNMBr4Xm3q/lXd4PuoXVTGYJAoMlPNyEo1Y/rEBIABsqqhoTmAvbVefF3SgR1lbjS2\n        BFHfHEBnV/hgAwCiaNOIacCefR74Akrk/sl+6DIWs3D8MRNTJznt0ldX3fHZj56x+FFjXrG6Fs8/cBJ2\n        lLZNdDqk6X1bY0B2mhkup4SmtuBRmQcefJ6bADAZeZiMHBxWEYX5NowvcqIwz47huVZYzQI4jvRu0zGN\n        6Qt3AyAE34yQ5Ggk6UtWWiTxi6oytLlDqKj2Yld5Jzbv6kBZVRc8Phker4JgSO0VggHN/9Cd0kxR+q8P\n        SSKXmJVuvfR3/1i38bTyefKPff5HBeDPt0xF8YJXhbf+feoFosD1qS+jaQx5mRYcX5yEV5fXHNFzNAaI\n        AoXNIiA92Yj0ZBMKcqzIy7AgJTHy/067CIP47cU6fXSPPg4WYo4jSHIZkJJoxDETXd039YTR0BxAdX0k\n        61JVrRf1TRGvwR9UEZY1cHQgskOxfl/QdjmN825ePH4EIWTHwpPzfvCa8R8UgLuWTMGxk1MwaUxibnKC\n        aW7fV1VkhL76gnxUVHuwaWd7bwTgD/1Oj/HyHIHRwCEn3YxhOTaMyLVh2gQXkhMMMEoczCa++3zBgdV8\n        fbEuNmHsgFBLIof0ZCMyUkwoHhcPTWXwBRQEgipKq7qwq6ILJeVulOzpRF1TALKsQe7OJN2n6wgMsFkE\n        CEL/io7A0/SURPNC14Qnd3j/nPWDn/1BAfAHFYydtxStm6+YLwpcVn8UvmdV+O5fjca/XirHyq+aEAyp\n        3YcwIp+JpIuKqLnZyCMv04K0JCOG5VgxcVQc8jKtcMVJvUE3PS7lwZ1GZ/AJwsFTB3P3Qu1x8YmYMSUR\n        gaCKptYgqmq92F7qRllVF+qaAqiu86HLKx8YDHD0REEQKCaMjIPZwEPtx6kkAcBz5PTlz85/6u+3HVNb\n        W+/Fror27/3sd1JU4MRb/z4V5fvcmcdMTH3LahbG96fpUErQ5ZWxemMztuzqQE29vzfjr83CIyvNgtyM\n        yCp9ToYZCXEGcN2HhKLhpJlOdNF7v0C3WKga691t2Ls/kk+ipsGH6jo/6pr86PLIh1jJT12PUlWG0cMd\n        ePT3E5E9ACc/NY2pe2u7bh42a+TDhNz2g2Lxnbz00Bwsmj8MZVUd1+Zm2h/i+nD1/8caTVVZ97z+QGJP\n        jkYW6wjBgJ/I0olVUSC9O06qGulfbR0h7Nnrwe7KLlTWeFC+14O6pgA6usIIh7XeWIQf0gONRY58/+FX\n        ozFlbPzAvBuA9s7Qp3994uuFTrvk/t39636aACyYm4ttu1sMG946b5nDJs3Xu4vO0BCFiPepaQxhWUMg\n        qGLffh92VXTi653t2LSjHW3ucCRVuXpoKjOGSJr6KePicesVhRhX5BzA5KGAuytUvaO0bR6lZPeM8974\n        aQKw9OE5UBQtc+7MrHfjnYYx+gCrM1QFoWcr0R+InATcs8+DzSXtaGkPoaMzDLk7yzSlBKOH23HOvEyk\n        JhkHPARcYyzU2h64MCXR8vrvH1yHPz6y8fAEYEZxKr54bxHKtjWdlpNhf43jiKR3BR1dDCJ5JdF9KlBV\n        GfxBtXdhmdJIijEQEjXZnvwB5b1Hn9t2bkt7ILClpA1frN//4wLQDW3bsvgJu1W6Um96HZ3vF4WDiSZP\n        mQDwh5SGssqO+TxHNo09ZS4IufyQz3xrYe/1J+bB4wtD4LlcjqPH90XSDx2dwUI02wYDYJT4lMR408kZ\n        05/ZtPzZby/lfSspW0dnCJfc/DiOmZQy12Tk83Xj19GJbeIchtNfeWxeSltH8McF4BcLhqNr5/1Skst0\n        KiVk4LM26ujo/GwIATRNyzcauRGSxOGuJZO/XwDuWjIZK7/aj+27W5MIQYFefTo6sQ1jgMHAx00anTT5\n        nGve+FZA0yECUNvgwbxLxqIg23EyISRHrz4dndiHEgKrWThrz6dXxi9eNPL7BeDE6Rn41eXvGEJh9Tie\n        Em5I1ZKOziCG52leWVVHbpv70HWAQ4z8sT/MxPBcZ2pWmu0uSolTr7b+oyfjbM/V2N/1Q7uz0VJKQDl6\n        4M8H/3THrVNCDtmz/q6fyOd/4HkHfea7yqMTO6iKRt2e8DqOkm1JLhNWbYhkCjpkG7Cx1Y/GFn9RQY4j\n        fkjW0hFAyYFUNL220b2H2pNyrGdHhbFInjumHbhqyh9Q4fXL8PiUyB2H32Ff4bAGX0BFIKDAH1ShqN+8\n        CCYSwhqS1UgmHYVBUbVvPYp1l1cUKQgieRM4jnb/ywEMEgebRYDV/I0jrQzgOAqHVYDTLkZu+CGRxB09\n        sfIcR0B6Htl7pZZ+K/JAIQicYViOY3zipKdeuOai0b2N0CsAdy2ZBJfTCJfTOIpSYhnKlfXNiK+DO35P\n        zv+D04qFZQ3t7hACIRVMA7x+BZ2ecLcBMrS7Q2hsCSIYjhimL6B0p7OSe7MVhcMagmH1QM6770BRNIRk\n        DWFZQzj8/Z/7yTmx2Pd1GgqjxMEgcd+4oyFyPZvRwMFsjORYMEoc0pKMcDpESAKHtGQjXE4JosAhziH2\n        fjbeIYLn6ffW8cG5GnSOHpQCGmPFrz5+cqLVLDY9/r8dhwpAKMyQecyzfNuWK4p4jg7K7b+DO9132kp3\n        eKe7K4xQWEMwpKLLK0PtHpDdnjD21voQllW4u2TUNvgRCKmQZQ3t7jACIaVXANweufe24t6O3WNp7EB+\n        wYO/m/yIAfemRumnexE1jcHrV+D1y9/WCHbgvQ6uX3zjGnaBp4cIQJxDhChwyE43I8EpId4pIivNAo6L\n        3OTssAkwGXg4bCJ4nuCgKjv063WR+EkwBsQ7jSPmzshymYx8U8/f9wrA5DGJePq+E+OCIWW4wxa7F1eS\n        XgMhvX8GAWRZg9+nwheI5Ixrc4fg7pLh7grD7ZHR5ZXR7g4jGFLQ0ByEP6DA41PQ2BrsdaM1LXKOnLFI\n        yjFNjfwZ3YdFDnj+304o0Ss+P2Dg0SqaB5X8e5Tz+5EVDY0tgV7PqSeTMsdFjuJSGjnaDQCSSJGaaITd\n        JvberJPkkmAy8khyGeC0iUiMN0ASaSThh5GHKNFvTDPYAYHVOQRNY6byve6RE8Ynl9y1ZDL++MjGAwJw\n        1tw87NnbkZ4QZxweS8bfk9YJFFBkhkBYRTCoor45gLaOELx+BbUNfjS1RpI/1Db60doRiuSbVzUoamQ+\n        rqoRdx0MIPSAkHxfIogDF5Xqi2E/3kbfnWGn5xx+z2GasKxhd2VXxJC1AzcIUxr5L8cTCByFzSogK9WE\n        9BQTkl1GpKdEMjrbLULkok4DF7nMU6S936MniAE4SqTCfOcJSLv0FU1bA6DbA1g4Lw+EJ+joDE1gDLZo\n        NPJDRnQAisIgKxraOkKoawqgtsGPvfu9KN/nQVWNF11eGaGwBlnR4PMrvZeNHDIS49D5Jx+jNw8PJnov\n        /+iehGqMQVMBWVWB7h2s9s4w9tZ60X09AMwmHqJAIfAUdquA3EwLMpJNyM+2IivVBFechNQkEwwi7fY8\n        ur/jIK9hKEwnCAG8Pnn0H6/5ZYLZKLT0mtOc4zKwYnUt6dxx5b/NRuGKgS5kz6irdSt3pycMd5cMX0CB\n        1yejpSOEnWWdKCnvRHNbEO6uMNrcYagaO2Qe3WPo+o7V4OZg4+3N/4hIP3LaBFjMAlxOCfnZFgzLtiEn\n        wwy7VYRRorBaBNitkZ2OyFbrgWcOxixTYVlrbHcHTzFI3BbXhP9GPIBZ09MxbUJKcjCojrWYhH5Tw56R\n        vVeJALg9Mlrag6ip96Ok3I1d5V1oaQ/C3SXD61fg8ckIBNXIPFxDt5t+IE2YztDjYIH/ZnxCR5eM9s4w\n        qut82FzS3psGzGYRYDREtjntVhEJcRKG50TudsxKM8NpFxFnFyEefJtzz2WwMawLAk+TGpp9kyfNX7gF\n        6BaASxcWggEpVouQ2x8vx3GRPH9dXhlenwK3J4yS8k6UVXlQWRNx41vbQ1BUDbLCui94OPTmF0IIOD1W\n        UecwxOGbosAY4O6S0dEVRn1ToNegl3MEHE9htwjISDEhK82Ewnw7ctLNyEm3wGTkYTHzsJojW58xOoUg\n        acmWsYSch7uunxIZeBm7D6Urt12Qn+V4gRD02RYgIZEtspVrGlFa5UFZVRcqqj3w+iM53AOhyD45pdF7\n        55vO4KcnFqHnchmDSCGJHOxWAXlZFhRkW5GRYoLLaUBivITkBAOsZiGyDiHQ3niRaJ1CyIq25ulXdp9S\n        W+/p4mcWp4KQW9Gw4fIpAPp0/58QgraOEP7yr11oaAkeMt8n3ZFkOjoDTY/XQBFZg/IFVPgCKto7Q6is\n        9WLF6kZIIoVB4iLxDSYe+VlW5GVaMDzXhoyUyCWyaUlGSCIXVYNZJLehkm63itnGXMd2XlUZ/vfgbCHe\n        aRjVHwVl3SGqnD7K68SQIHT/CT0bRYrK4PEp6PLJQCtQVeMFAyDyFE6HCKPEIcllwIhcG+Ydn4qp41xR\n        EQbNGGA1C6lnzM7J1jS2nZ8+MRl7a7vSPF45JZYDgHR0BkIYvhlZqmoMzW1BgAH79vuwfmsbjAYO0ye4\n        oEbJFXSUEoHjiMWSYgFNT7YiMd5k1xgz602qo3MUDKz7hGXPxTXRSFmlOxVx/wB/2TmF4ChJ4nka3x+j\n        v+5h6OhEAQRJhBCOWvLjoKgssb9OAAZCih6WqTN07IyQqIwwFQWads2Fo3gK6c+o2OdO668vVvTbeXWG\n        EJQCBgMfdaeTMlOtyXcumcJTQggnCFyS3lQ6On1DNK4DGA28S1GZRC87u5AHoAuAjk6fGD+JZEyKpjIB\n        CAQV+ydranPphWcMp644Q9SdANTRGQxQSmAyRlnMOgE0xkw2i5DIn3hcBq+pWpq+Oq+jc3RhADgKmAzR\n        JQCMASYDb587IyuP7qnskDSNCXpz6ej0DdGYQZkQIhgNXBz9anNjbiCk2vuriJIQXbHROjpDldaOYCL1\n        B2SHqmhSf2W2kkSq55TXGVJEY3cnBGhpCxTQ4nFJRlHkeH0NQEfnKMMAnqNw2sRoTVIq8OOLEjIZYNVb\n        S0enDyxMoEhyGaKuXIwBuRm2OMoAJ4B+XQTUj/3rDBUoBUxGPirLJopcDkU/57UWhEgiRh2doYAkcgey\n        EEcfVhoMqWJ/fRtjDAaRg8sp6XfE6Qx6GGNISzLCZOCitr/TTk8osT+/kOcJzCZev7lFZ/ALACLZhwUh\n        em/ao/6AEtevXxilxyN1dPpCAZJcBhhEGrV3ldFQWLX21z4lY4DRyCElwagnBtEZ/PbfLQCSxEWtx0v7\n        OwxYFCninaJ+e6POoEcUKRw2MarL2P+TEwbEOyVI0qC8gVxHJ9LNWSTqNd6hC8C3BCAlwQijgdOnATqD\n        GoPEId4hRXU/73cBYAAS4w0wSBz0eYDOYIWBgeeiMBfANwWAEGj9WjGMITXJCIuR1z0AncGsAJAkDvFR\n        HvNCRYHz9vdALPIUCfGS3kl0BjVpiUbYojzqlRokvrO/9YlyBFazHg6sM3hhAIoK7DCI0b3WRe02salf\n        K4YBAkeQECfpKwA6gxZRoBg93AFRjO7dLmo2Cr7+/tLeI5K6AugMQjSNweWUkJdpifp1LkpI/5shxxFk\n        ppijOkZaR+fnwhiQkWJCVpo52m/BkimAAPp5LGYMGJ5rRVK8Qb8mTGfQQSkweUwcLKbozAPQg6KyahoM\n        qbWMMU9/frGmMWSnW5CeYtJnATqDDqOBx+Qx8eCi/NDb/gZPI31rRWW7L6AE+ztxoUHiMGqYHfq5QJ3B\n        hKYxJCcYkJFiiur5PyGAP6DI1B9QggDU/i4AzxEUj42HyajnBtAZPDAAeZkWJLuMUR0AxBhgs4q1NDvd\n        ttcgcV39XVYGIDfTgiSXAUxfB9AZJAg8xTETEyJJb6K8W6ckmvfRk47NcPMcDfT3lzPGkOSKfldJR+fw\n        +zTgsAqYNDouFqa2jOeIj3p9YVVRtdaBqCyrWcCMyQngeX0lQCf20RhDXpYVyQlGaFE+qoXCqnvrrtZy\n        +vd/b1ar93vaBqIQBMC0CQmRqEDdC9CJcSghGD3cjji7GPULgLKiBTZua2qjL76zR5UVbUAEQGMMWakm\n        jCxw6PEAOjENA2CQKEYPc4CL8osvGAOMEt9ZWBBXSatqupRgSG0cqIJYzQKmjouHqEcF6sSyAGgMeZlW\n        jCtyxoQ3y3HEPWNqWidl7BGWmmSuH7CKAzBhZByMRj1DkE7sQgjBrGlJyEgxRf38HwAamn11S98sU2i4\n        vBTxTkMrY1AGSgFSk4zdmYJ1BdCJPTQWCf6ZfWxyNN8CdAhd3nDrP57cotKPvqjGyjW1+71+uWkgrjHW\n        GEO8U8KMyQkxU3k6Ot/k2EkJKMi2xsxaViis1m0uaZHp+q1N2FLS4lMULTBQhREFijNnpyMlBrZPdHQO\n        hjEgzi7hjJPSu/Ncxga5mfZqpt4B6gsosFnEOotZaBko29M0hvxsK46Z6ALToquidHR+sO8yhux0M0YW\n        2GJqCmszi0G5qgN05LA4HD811auqWvlAFsggcph/UjriHNG9h6qjczCEANPGu2C3xk6/DYXVlvLqzrrK\n        6i7QF94oxai557DyfZ0b2ABKmKoxTBjpxISRcfo04DBhADQwqGBQun8YAB4EEqOH/SOwyNpLzzNUMGhg\n        0J2xH6l/FklxP2taUsysXxEAmsZq3/t0b8ULb5aCX7WhHtj3GfKz7DsAEgBgGqjCmYw8Tjk+BV9uaoGs\n        6N2P9f5EDJuCgAPAgUBgBC5NgFPjYWYcUjUJHACrxiNFE2HWDjeugiBIVDRxMtxEgUIY2oiMDqrAT1TU\n        c2GEoEElgNotDqS7IxGQIX6cm2HOMckYPTx2Atk0AIqqlZoMXOtNjz0LHgBefrccsqzWnHx8VmW8wzB6\n        IAfgSaPjkZlqQvk+z5DaFegZzUm3oRMAFsYhXhNgYxxsGo90VUSGakCaJiJVlWBlHEyMg8QI7IwHPcgc\n        f0oTkkPKweAjGnxEhQyGTqrATRRU8UHU0RCquSDcVEEHVdBFFHRStdtjiPwuAcFQCOliDLBbRZw5Jx2S\n        QKHGSiQrY9hT5d5y9R3/1WYWz4wIwNrNDfhoVc3+s+fl72YMowdMnTSG9GQT5p+UjgefLh0SRt9jNHaN\n        Q6ImIl81YqJsQboqwcw4xGkCrN0CIPWOuJH/sl6TjfxZPUqZFUyMwswiZpyuRe5vmC7bur8D8JCIAHiI\n        ii6qoIXK2MJ7Ucb70cCF0Urlbk+B9HoLg5F5M1MwapgjpqasmgZvcoJ5I/Y/ilUb6iMC4LBJ2PrB+cre\n        ms6v87IdZ3OUDJiIcxzBaSek4s0Vtaiq8Q4qL+Bgl14EhVPjka8YMUm2YrxsQY5qgEsTwIOAA/nWFIAd\n        ZPT9UU58x3dRAA7Gw6kKvcatAZgPFwJERSUXxE7Bh02CB7t4HxppGAGigWLwTBkYA5JdBlwwPxtGiYuZ\n        0Z8QwO0JVX20unov/1XExHkA+OMjG/GHW6bD41c2AfADsAycQjGkJRkxa1oS9u33RUXFHSkqGDgQmBhF\n        iiZirGzBaNmM0YoF2aoEI+PAg0A7yNCVKM6T1CNK3xQGM+MwTrFgnGLGwqALbUTBerELlVwA2wQvyvgA\n        AkSDDK13mhOLEAKcekIqRuTaYsf17xYuo4Eve+bV0objJqccEAAAWLWmFqGwWubuDFW64gxjB9KrEUUO\n        F5yejXVbWrFzT2dMegFatwtsZhxGKiZMkK0YJ5tRoJjg0gQYQA8Z2dVBkhhN634PiVGkMRFnBxOggaGd\n        KtjD+bGL92O74MXXghdt3VOFWBID1h25evLMFIixNPcHoKpMqaruXL3mtYXy3Q9tAAD0hi4luYxY+s4e\n        7YzZuTOtFrFooJUqziFBURm+2twKVWMx00E0MPCgyFeMOC0Uj6v8Kbg4kIwTwg5kq0bYGAcOpHvRbPDT\n        844mRpGhGTBRseL4sAMTZSsy1MiqRgeVESRaTEwRNAbMPiYZi07Ljvqsv9+EUuLXGO612aT6Wee/CeAg\n        D+DLjQ34cvUlPv8+9y5Nw0Iy0O/GgOMmJSDJZUBNvQ8kir2AnhVwCRRFshlnBl04LmxHmhbp4Kx3T33o\n        xjccPG2QGMVE2YqJsgWLiIKNggevG1uxRfCggyhRu8WoaQwpCUZcujAXZhMfczksQmG1XuBJS3PLgal1\n        rweQk2HDlDwnauo9rsR40ykcR8SB7jBWswCvX8aWXW6oKsOAi9J3GD4BkKcYcEbQhQsCibg8kIJpsg02\n        xn9jMU3n24IAGECRp5pwfNiB8bIFGaoEmTC4qQq52yuIFkSBw1Xn5+O0WWkxF61KCNDlld+dfvZrS4Mh\n        Vf1ifSQDwIE1gA31kEQO/qBSwnGkC4B5oAvN8wS/ODMHm0s6sGpDM0iUKABDRDkzVAnzg/E4NRSPDFWC\n        AKpH0P0sIWAwMYpjZDumyjZcEEzCKtGN1w2t2MZ7ESbaITEOA4GqMUwpcuK8UzNBCGJOAGRFU7z+8OZV\n        y84Kd3nD+OMjGw8VgIhKECTGm+r8AWWX1SykDHjnYEC8U8IV5+WhtLILze1B0AEUgR43PlWVsDDowtxQ\n        HPJUI2j3vw2WhbwBM7Lu+ovTeCwIJmB62I4VUjvek9qwU/BB6V4wHAhEgeKM2WmId0oxmb5OU5lv886W\n        3enJFlx2y8revz/k/KLHF8aVt30aaip/PdViFk6KhhGXMSA92YT9TQHsKHUPiBfQ464maQJOC8XjJl8G\n        TgnFIYGJupvfh3VuYRzGKlbMDDvgYDwaORmdVOndYek342EM08e7cPUFBTAbo/u+v+9D1VDNGHsgOcHc\n        ddvf1363AFx81gh46t6GL6AEkhNMp/EctUZD4TmOIifdjI072tHcGuxXEVDB4NQEnBdMwA2+dCwMJiC1\n        OzpON/z+E4LxshXHhu3IUg1oojLaaSRSoq97gsYi0al/uGEMCrKtMZu1qssXfq74zFfenDAqgS17r6L3\n        779Vf/vXXgZKYI5zGj7lOTolWl6AEOC5N/biT4+XQFH7fluwZ4GvWLbiMn8ypoftkEB1N38Aod0B0Pu4\n        EB4z1eEjQztC0MD1UW9gDBB4gt9cVYTLzs6N2XqTFc1X1+i7yGjg3kotvgCEzD6oTr9BaWUHUqc+42/v\n        CK2Ithc5fVYaZk1N6hfnL1c14Ap/Cv7kycEJYSd4EN34B5ieBdZsVcId3kzc7s3EVNkGgZE+aRlKgdNP\n        TMPCkzOibgfqp6AoWv3azQ0lyz+vxsyplxz6jt/88EkXvYW2LVcwj09+T5a1xmh5iUhwkIjfXl2EcYV9\n        c/ySARAYwenBeDzSmY8bfOlIUyXd8KNOCCLnEc4PJOHBrnws8aXDwrij2k6RkHQTFp+bB4cttpPUdHrC\n        K97+eG9VZqoVq9YfmgD8W0nMzp6Xj/VbG1FZ09kxeWzisZLIDYuml4lzSEhJNOLLTS3wBZSjth6ggsGl\n        CbjKn4pr/Gm983yd6IUBMDOKkYoZ6aqEJiqjiZOP2ENkDJAkDtdcVICTpifHdB3JiuZrcwf+evXicWX3\n        P7EZm7Y3H/Lv3/IAXltegeQEE/7w8Gn+5rbA24z1/9XhP4SmMRw7KQGnn5h2VFaCe4R9jGLBHzw5uCyQ\n        DCvjemPadaIbDYAAgvkhFx7w5GFOyHnQUemfz4LZ6Vh0WhZojCc3CASUbS+8Wbb2xts/g8tp+Na/f2ca\n        08/X1eHsaSnw+eWAzSKeJomcM5peihCgIMuK/U1+VFZ7f/b8jAEwMorzA4m41ZuB8YoFg/f0+uCGAXAw\n        AZNkK+I1AeV8AF6i/eTWZAw4cVoSbvu/kYh3xPydlVprR+DvZ1550hfjUnnMv+L9wxMAAOjyhPH2ir3K\n        /Nk5c8xGISfa3sxhE1GQbcW6ra1o6wj95KmABsDCKK72p+LKQCpcTNAj+AaBCJgZh7FKJLfCHj6ANqoc\n        tgj0ZKe+96YxyMmwxPR9lQSAP6C0NLf5/+JvaGm86MYVqK7zfOtz3+vgdHnD+HhNrVvTsFWLQstQVYZh\n        2VZce9Gwn3y7sAaGRE3Azb4MXBxIgpFR3fgHkQgQALPCTvzem4UCxXhYi4OMAQaJw4Xzs1GQY4v9y2oJ\n        EAgqNR+tqmn64LNqfLH+u2//+14PYMyIeEzL2YLKms7mhDjjqQJP7dH4nsNybLBbRazd0gpZ/vEDQxoY\n        0lUJv/FlYkHQBR5En+0PUiFI1ySMUsxo5RTUcsHe2I7vM/7Lz8nFpWflQBJjP6shY0AwpLw0+xdvv6kx\n        horqzp8mALsqOiCKFIt/+2nrdRePyTGbhCnRODumFMjLtMDtkbFzTyc0Dd8rAgzABNmKO7xZOD7s0A1/\n        CIhAiiZhsmyFl6io4ANQyLdFQBAIFp+bh+svHgaTkR8U91KEZbW+orrzjruun1z/2dr92FXR8dMEAACu\n        uWgU7rlpqtbmDnUlxhtPp5QM+AnB70IQKMaOcGB/ox979nq+UwA0MIxRLLjXk4OxikV3+YeQCFgYh4my\n        FY2cjFLeD+CACKgqw+xjk/Gbq4pgNQmD5lKajs7QqxfdsOIpEGgPPb3tez/3gwLQ2h7CvJlZaG71dyQn\n        mCeLIjciWl/YZOQxqsCOvbU+7KvzHSICDMBIxYzfeDMxWjHrxj8EMYCiSDGjjcrYxwcje9sMmDQ6Djcv\n        LkR2umXQXEijqqyjvtn3+0WnD6vQVIal75b/PAGorvOgzR3Cb+87OVxX2gyLWTyFUiJE40szBjjtIooK\n        bNi+243GlgAIiSTazFeN+KMnGxMUq+72D2FsjMMU2YZOoqCE82N0oQN/vWUcRhXEVmrvHyMUVj+vb/I9\n        ZDLy4d/+7avvXP0/LAEAgLNOzkPV9ga0dgTrs1KtsySRy4jWF2cMcDkNyMuyYOvuDjR3hJCvGXGHNwuT\n        Zd34dQATKEaGzEABj8W3DMPoYfZBdRelpjF/a3vgT4WzZ3/9+9+/hVfer/jBz/+oAKzaUI85x2bgsltX\n        Bqp3vZIU5zCcGM0VwACkJRsxPN8Ob3UIiysTMVN26G6/TqR/aIAhnse0X6Uic5pt0J3pbu8MffXZ2v1/\n        3rRqayAUVr93+6+Hw17Y3/7h+QiF1AmF+c53jBKfFu31RjgCb2kQ5NYucGXqYUidzuC3fkDL50CXWCCd\n        YByUQZ97a7tuzj/+5gd+d+1i/OnxTT9uJ4fz0LPn5aLTK4MAwksPz33KYZN+ERO1QQDtqzDkezqBfboI\n        DGk0QEukoPfaIB1nwGB0CcOy2lrX6Jsv8HRt1rHPHlZ07GFFPLy2vAoTRibg3f+eLtc1+f4TlrWGmKgR\n        BtDpIrg7bVBGcvoawBA2fqRz4G6wQJo+OI2fMcAfUN687b6vNt3+j7UoKog/rN877DFxzaYGKCrDRTes\n        qL1p8Xi7QeJmIEacKJrJg0wSodYooDWaft5nKKECaj4H/i4bxJMGp9tPAPgCculXXzfeuPDkvKb6Jh9e\n        X155WL/7kzIcigLF9uXns9LKjmVFBc5LbGYxMyZGVQYIeQK42+xQ/twFbU040g90IRjUMAZoozlwt9gg\n        TJYGbRJHjTGt0xt+/tTL39ldVBCP3RXth/27P2lW/MX6OozIj8PKNbX+4nHJkwf6CrGfKgIkjgLjBYRb\n        FdBqFUTVRWDQogEsjwN/tx3SxMFr/ACgaqxOlrXf+hvebXv/s+of3Pc/IgEAgLVf1+PLTdfJ7urWLpNJ\n        mE0pscRMTTGAOij4qRJUjoHtlkHCuggMKhjAOEA9QYTwKyvE8YPb+AGgvTP00u/+se4VX0BWHnt++0/6\n        3Z8sAKefmAO11YNrf79q3zmn5ieZjML0WOsgxEBAx4qAkwI7FMDPdBEYJMav8QBOM8Bwuw38MGHQG7/P\n        L++rrvP8ZvrElFqeo3jhzbK+FYBdFR14bekCHD82kXV6w/VOu2EeR0lUZQw6HAhPwBWJ0BIItDIZxM0O\n        c09EJyrRIiM/Fhog/toGLo4blKv9B8MY02oavI+NOXnpstQkM7v81pU/+Rk/q8sT5z/wxkd7Me6Ul0vc\n        naGnNcaU2Ks9AAQQ55vA/ckONl0AOxrJ5HQGpC1ZKgW53gxpiQ2cgw564wcAX0DZvG1Xy9PLnz1d/d39\n        C37WM36248sYQ8vmK7C1pCV+2oTkpUYDPztma5ICarMK+UUf8GYQpFXfKowZNEDL48D9xgrxWEOvIAx2\n        QmHVU1bVccX4U5csMxtnwh/8eWPwz46N27nhf5g2PgXFZxYGdn9dL7icxtMIIbHpRDOAmim4iSK0OAq2\n        SwbxdPciXQiits0YAEwWwN1qhTjVMKS8N59fefd/b5X+dc0nHytF+U6s29L0s55zxN27/LOLsG+/xzW2\n        0PWc0244JZZvUAEBmAooW0NQ3woAH4dAuvS1gahDA1gKBTnDAOEsM2jG4J/vH4wsa127K9rPHz8++YNX\n        3izFedd/9LOfdcTR8Y88ew7iofrL9rrrE+ON8ziOxs624HdpAAG4NB7csRK0VAqtRI6IAIHuDQw03Vcx\n        a8k04vJfaAG10SE18jMGdHnDL7z2QeU/29sD6sL/W35EzzvisY2QO7G9tAUr11Svrmv0PaqoWuwtCH4T\n        DSACgXSqCcK9drDjRDABQ2qUicY2YSKgzhLB32eHMNsIMsTuZicE8PrCJV/vbH5w/uycULLLdMTPPCrn\n        4y5aMBzZGXZWWtlRmpthHyuKXP7gqPHIOQI6QwKLp9AaVJB2fW2gX+kZ9dMouMVmiEus4HOFIVn9sqJ1\n        trYHb540v/CLJx5bj/8sLflJUX99JgDPv1GG1AQrrr90jL+lI9hqNgqnUEqMg6UDEgMBN0YEGS9Gcsw3\n        qCABXQT6o+6ZlYDMNoC/1RoZ9Q1kSG7VMgbm7go99dCzWx8NNnpUnqd45NntR/zco9aFX37kZLR2BBAK\n        a9Li8wqfMJuEywZdK1CAyQzKuhDUJ7wg2xRAjfy9LgZHEa3b+LMiyTuEWQYQIxmyUzBCgEBQrVmzqf50\n        WdG2m00CTjj/zaPz7KNZ0IrPL0FWmhmbd7aMLcyPe8lk5GPnsNBPrDG1RoHydgDs8xDIPhUI6LsFR0z3\n        yM6SKNhEAdyFZohjRWCIB2gpqqY0NPvvzjnuub9ceMZw7cW3y47as4+qAMwsTsUX6+vBWm9GXXn7aQlx\n        xqc4jiQOylahiAShtKhQvgxBfdEHUqGCyNCF4OcYPgOYjQBzDeDPMYIOE0CloTvqH0x9k+/Fd1fuvW54\n        rtPd7g7h3OuWH7VnH9UkWdV1Hqx88Qy8+mYZTrns3cprLx4No4GfQQjhMdjoWQu0UHCFAsgxErQ0GvEE\n        WjQQBfq04HDqUAPgpCBzJdCrLBAXmcFl8JF0VnpYNnx++euS8vYlo4bF1e2t7ULJnjas2lB/1J7fJ130\n        jzcWY8rYJIRlLWnK2MQ3E+KN0wZT6uXvq0mGiEcgfxwEey8AUqqABLs7up6P8AA96yZWAkwSQRcawU+V\n        QEyk1xvQATSNddU1+c7PPvbUDwg5t0++o0+65Wfr6mAzC7jx3tW+/aWvuo0G/hiBp7bB3mAE3SHFo0Vw\n        MyVgvAjmIIBIwNwMJHTQB4dcb44YtmYEyDgBOM0AbrEFwvkmcCMEEF4f8Q+pLsa0plb/0+9/uu/JvTt2\n        yC3tgSPe8vu+Ptsn3HX9ZLjiDLj+7lWoX3/5pQlxxsei9W7BPqFnHYABWqcG7esw5Hf8INsVoEmLBLH0\n        tMBgFIRvjuQpFGy6CH62AXSMCOqk3/05HQBAuzu4YsuulkuL8uMa0qflgJDf98n39GnXW/nimdiz143G\n        Fp/pykWj/u2KN17E0SE4/JGIILAAg1qhQFkfAvsiBNqggXVqgJdFBCHWxaBnMQ8ALATERqClc6BTRfAz\n        DaD5PEjPwp5u9N+LLyDvLa3ouHREnnOVfcx/+rxr9imJ8Qb84/bjYDULmcdPS3/BahZmDOnWpZHbaeBn\n        UNtUsEoFrEKB+lUIqFRAurqnCiRGBKFnz14CYKFgwzhwxRJIPg+Sw4NLpICZgnTvmuj8MKGw2rajrO2q\n        qQtefWNkQRxLSbTgkzU1sSsAK188E7MumA40N2LzhrpZhXnO50SRSx/yLU0OCAK0yDRBbVChbg6DbQyD\n        NmpQaxRwHgYmd398oAOOulftGQAiAqqJgMvgIqP8JBF0tAA+kwdx0Eg5tYN+T+fHq5cBTa3+R0++5O1f\n        z5qeHk5JMOO2v6/tl27YpxTmO3HPTdNw9jUfoGrVxVenJ1vuo5RY9Sb/Rkt0/2g+Bng0qM0qtG0ytF0y\n        yD4VWrUC2skOHIJh3zCwn+s1fN+zDn4mBbR4CmRwQDoHTBAgFAmg8Rxgo6Dmg1bwdYP/Wcbf0Rn8bM2m\n        hovHFrr2f/BFNa6764t+6Xb9wsoXFyDJZYSmqaIrznSNwyb9XhQ4h970PywGPQaltqlgdSq0JhVo1MAa\n        VHA+BtmjgbRq0Do1UB8DCzFobg28enhNq4GBWQl4CweVZ6BOCs1EwKXwIALA4ikQT0GSOZAUDkih4B3c\n        t8qnG/0RGD+geX3y8vK9Hb8xGYWSkXP+BUL6Z9OsXx1Kxu5E25YG3Hzvl+LdNxQ/nJ5ivprEdAaRfhYF\n        2mu1BxbSGMA0hnCbCt7NoPk1qI0qBDlSr8F2BbJbBQkzEBnQJICYKIwJPHgDhQoGLZ5CcHJQRIBL4cBJ\n        9MB30e/4bt3YjyphWd2+b79nAc+TqmEn/K/fu1W/UZTvRHWtB7XrLkPJnvbhw3Id/4lzGGboGnCUWrL3\n        50DwPFMBprIDo3S3MROeHLg8krEDRq0v1PWz8Wtd1XVdNxae9OLT//3rLEwek4Sxpyztt+/v1/i0lvYg\n        brtmIuadko+mRm9bbYN3i80iTjIa+FRdBI4CPUauHfiJ6AEBoQf9EBJZR/iGJ6GP7P1LKKx66xq9f9y0\n        vfnJC84YrnKU4KRfvN2vZej3ANUvNtRjxrhk/OLGFXj42d80lWzYtslo4McbDXya3iV0hgqyonXWNfr+\n        8uiz2x8aNSw+7LBJOH3x+/1ejgEbd4vynbCaRbz5n1NRU+eZNXpE/MuSyCXoXUNnsKNpjDU0+/78wFNf\n        3z3n2GzF45OxaMlHA1KWATui0tIeRF2TD/NnZ2Plupra3HS7bDIK4zluCIUL6ww5GIPq88sfbNrR/IeT\n        jsl0B8MK5l/x/oCVZ8BPrisqw8SiJOXJpbseqWv0XqIoWpXeTXQGpfEDSiisPPrpV/sXO2ym/S+/W4oT\n        L3x7QMs04AJw4gVvwSDxyM6wKvnHL/xwW2nr7cGQ2q4vCuoMMrTW9sCrz79e+mdJ4prK9jbj+KkZA16o\n        qDGzSxaOQEayBff+cxO3+5MLr8lIsd5tkLg4vd/oDAbcXaG33lpRdd1lZxfWUTOP4898HV+s3z/g5Yqa\n        5FXPvV4KSgnuualYLTzpxcd37mm7Jiyr+/SuoxPjyJ2e8IvLv6heMn1iSh3NewzHn/lqVBg/EIVnze5a\n        MhmhsIq/PvE1dn50wfy8TPtTosi59H6kE2swBi0sq4/sKm+/c9KkFC9SH0K0Rb5GXaKqL9bXIyXBhIY9\n        r2HLzpaq7AwbNRn58RylRn1dQCdW0DSmeX3yh8u/qL49zm5oTZ2UhuOnXtQnWX2OhKg1qY+emw9Z1lCx\n        r1OcOiF55ugR8X+WRG6S3rV0ohkCICRrvqZW/6Pbdrc8ylFa3+kN48mlu6LG7T+YqE1gPfeSd2Ay8hg/\n        MiEc7zR83NIWuNrrk7fpXoBONBt/MKx69zd4/vL2iqrf52Xa67ftbkFKgikqjb+nzFHPCVPT8Ona/Wje\n        tHiS1SI8xvO0mOpKoBNlhMJqoLbB+6eH/rvlvvmzc2VJ4nDihW9FdZljIlm1ycDjtZcewfFTM+r31nat\n        k2XNZjYKuRxHRb3b6Qw0jAGdntC2mjrPn0orO/41siAu5PHJAxrhd7jExB02uyo6cP2l4zByznmYNjFl\n        56PPbr+yscX/IGMI6d1PZ6CNv8sb/qx8X+f5o09+6V+axgImkzBgsf0/lZi5ruKV98vB2itw1/3r8MCd\n        xykff1mzMT/b4SHABJ6nplh5D53BZfxNrf4V1XVdN5mMfMl///V3EEJwzjUfxsw7xNQtdn98dCM6ukLI\n        mD4Nhflx3uvu+vyBxlb/Yl9A2Trobx7SiSpCYbWtrSPw2Eerai5LTbTsuGjJCpx+Ui6uvuPzmHqPmLvG\n        cldFBwi5CqGwinnHZ6k5xy16q7LavUhRtDc0jcl619TpSwgAn1+u3FLScu28S9+5OSvNWp8+7RZs39OG\n        sfOWxtz7xOw9tide+Bb+/M9NIOQUlFa2l731ceXl7Z3BO1WNtendVKcv0DSGVnfwk5Ly9guOOfu1ZVPG\n        JYdLqzpASFHMvlNMX2S9q6IDSsV1eOX9cowvSui85s6Vf6/Y577V55d3MMb07HY6R41AUOmoqff8Z2dZ\n        2y8L85wbCCGQZbVfUnfrAvAD8PmPoc0dxvATZ+D6SyZoI+e89Oze/V1ntrQH/6NpzK+HC+gcKf6Asq2m\n        3vPLex/Z+KvEeGONY+x/cNIxmXj61d0x/24xLwAAsGp9PQi5CsGQipuvGK8ZDXzVitW1N+1v8P7a55fr\n        B8M76vQvhACKqin1Tb7/7dzTtqho9uw3i8cnB4sK4kAI6dPrunQB+JnMu/Qd3P/kFmgakBBnCOTOfP7f\n        pZXuX3h98seyrAV1Z0DncGAMCATV2oZm/93vrNx7XWK8sTQt+TrUN/vA5f1zUL3roLWJkQVO5GU5cPu1\n        E/HRqtq4s+bmLkhPsd5oMQkj9WmBzvchK1qnuzP06o6ytsfnXPz21pUvnsma2wI4P0YCe34qg8oDOJiS\n        8g786rJxmLrgNRCgfdTcWU+t3lh3TltH4EXG4Ne7us7BMACKopXV1Hmu/dPjm64zGvgtp5+Uw9o6QthV\n        3j5o33tIjIWf/O9MbN7ZjFvumoHXn91mnT4x5ex4h/RbSukw3RvQCcuqz+dXXqmp99w/8fRlu154cDa7\n        6IZ5mFn8D6zaMLiXkGImFPhIeP6NUoRlFZddsxyLF40Mj503a2t1SeXKLm+4zSDxKTxH43UzGHowwOv1\n        ye+U73Xf+dGqmseKxyXXW8wiOrtCOP7kp6MueUdfMOTGv5nFqdhS0oK2LVdAKHgcpZ9cOMpmlW61W8UF\n        kshZdLMY/Ggagz+gbO70hv5eWtnx9pw5uYH3369AvNOA3/7tK3yxfuhsHA0JD+Bgqus8CIU1EEKws6wD\n        V10wsvmld8o/sVqE7U6bZOc4mkEpeN1MBh/dYbzVNfWex9dtabxj2lm/XbVz/aeKgRIUL3gVTy3bNSRG\n        /SEtAD18sb4Oz9w3C+u2NkEUaHjhRaN3l5e0Ltc01hgKqzaepw6OEkk3m9g3eo0x5g+ole6u0Ov7m7y/\n        GT136Uu/PLeorWD8r5GSaMKiJSuGdP0Mee5aMgWV1Z34zdUTMGbeUrLssbmuzFTb1Ox06xUOmzRHFKgE\n        pl+eG1MdmwCaBvgDcmmbO7S0tt7zyk33fln11N9mhd/+uAp3PXgWCPntkK+nIesBHMwX6+uwo6wNWelW\n        5GXZMXV8sn/6hOQ99z+59YP8bHszISRJ1Zhd4Kmg11b0ozHGfH6lzuuTX1+1sf7GaWe9+lqo+b1WBqb6\n        /ApuuGc1/vCHT/SKgu4BfC+MPYBX/7kC51w7FQ/d9UlK8bjkaVlp1jMcNmmOJHLJeg1FH6rKZHdXaF1z\n        m//t6jrPp29+VFly+7WTw/OveB/xDgNWbajTK+kbDNpAoCOFkJvwzxe2Ay1d8PnlhmlnDHvjnkc3XrGl\n        pGVBa0fwobCs7VVVpuo1NfAoquYOBJXljS2+//vgs31nj5r7wv0GidsiSXz4udd3o2RPm27839fP9Sr4\n        cS47pxCdnhBmTEnD1HHJuO/fm7kbfjluRGqi6ZSEOOO5RgM/juMID0TiyHX6uMN2z+9VVWvxB5X3a+q9\n        y9xdobUzzzu28z9/fhe1jV78+8USzCxOxWvLK/RK0wXg6MGql+CDlXuRnmzBmHm/xub37kt2OQ3zDRJ/\n        DgNynDYxleMitxjpYnCU656BBYJKiy8g1xGCz1raAi9/vbNl2wnT0sOBgIJ/vrAdTruEPz6yUa8sXQD6\n        lsvOKURLWwB/++10FM0ehXNPfdp+7qn5SWMKXUUJccaLBJ5OMxr4VCCyIq2Lwc9H1VgwGFS2tLmDb/r8\n        8qcffFbd9Ju/fVVfv/5yrbSyA8cXp+GEC94YUgE8ugBECUX5cdhV0Y5rLx6NE6elY8FpBZj3i7ekP95Q\n        PDLJZTrJYhYXCALNM0qci0TbzZBRjKxoPlnWGjs9oY8oJR9/ubHhy3Ovu7y1es37eHtFFVasroHRwOO1\n        5ZV6ZekCED3MLE5Fc1sAT993IqYueBUvPTw30WYRh00akzjVYhJO53laqGnMLAqciVLdMwAiHpKsaIqq\n        Mh8hpNHjDX/i8ckrP1u7f/fbH1dVvPvqQuXp/27F5beeg+On/lEf6XUBiH6+fvc8lFV1QFUZJJHDOdcu\n        x66PL3TurujItVvFYeNHJkxQVTY13mko1DRmppQYhsJUoecdVZWpHEcCobBa7/XL6/1+eeOmHc2lORn2\n        0n++sKPxL7dMk19bXgGjgceu8naYjDzueVSf2+sCEIPctWQyGAOuPH8kWtoDkGUNxQtexbLHTk4446Qc\n        V/k+d2F+tuMkf0AuNBmEETxPk4DIVfKxLgoEkQhKxgBNY353V6jSaOTLKqs71yTEGb8UeNIy77J3Gz9+\n        /ozQnn1upCVZsKWkFWdc+R7uvH6ybvS6AAw+7rx+Mppa/VgwNw+zj80AJ/FAejx+c/VbzpsXj89qbPWP\n        TYgzTnbapTGBoJJuMQlplBLxextwgETix8QpFFZbVY3VGkRub2lVxwabRdzw8Ze1e59atqtu7RtnyyAE\n        zS0+/POFHfjDwxtwzikF+radLgBDUxBkWYPFLGDxopFImjQRhFyDP98y1ZyRYs05c25utsBTa1mVO0XT\n        WIoo0LTMVGuy0cC7AkHFrjFmMhl4OyFE6DFM4OiKwjeNPRRWO8KyFjIaOLfA0c76Zn9dpyfUFgqrtZlp\n        1po4u8Ffvs/d8P5n+/acMy+vNWP6rzXU/RfPvlyC3eXtMEg8/vjIBr3xdQHQ+S6uWFQEX0DBrGnpOPfU\n        AlhdRiD5QRBCuGsuHMX/bskUHoxJK76szbGahaS5M7LyjAYurq0jmNjcFijQGBNSEsx2p13KA2D7mcWQ\n        FZVV72/wNPoDimy1iHWpSeYqniOBbbtby9dtaewYnussn3VcZseyt/Yo/3xhu7p6Y73C2L1MqahH+b5O\n        vPh2Ge599H7MLD5/0GfXiUX+H38yWn/OdwL0AAAAAElFTkSuQmCC\n</value>\n  </data>\n</root>"
  },
  {
    "path": "R3nzSkin_Injector/lazy_importer.hpp",
    "content": "/*\n * Copyright 2018-2022 Justas Masiulis\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// === FAQ === documentation is available at https://github.com/JustasMasiulis/lazy_importer\n// * Code doesn't compile with errors about pointer conversion:\n//  - Try using `nullptr` instead of `NULL` or call `get()` instead of using the overloaded operator()\n// * Lazy importer can't find the function I want:\n//   - Double check that the module in which it's located in is actually loaded\n//   - Try #define LAZY_IMPORTER_CASE_INSENSITIVE\n//     This will start using case insensitive comparison globally\n//   - Try #define LAZY_IMPORTER_RESOLVE_FORWARDED_EXPORTS\n//     This will enable forwarded export resolution globally instead of needing explicit `forwarded()` calls\n\n#ifndef LAZY_IMPORTER_HPP\n#define LAZY_IMPORTER_HPP\n\n\n#define LI_FN(name) ::li::detail::lazy_function<LAZY_IMPORTER_KHASH(#name), decltype(&name)>()\n\n#define LI_FN_DEF(name) ::li::detail::lazy_function<LAZY_IMPORTER_KHASH(#name), name>()\n\n#define LI_MODULE(name) ::li::detail::lazy_module<LAZY_IMPORTER_KHASH(name)>()\n\n#ifndef LAZY_IMPORTER_CPP_FORWARD\n#ifdef LAZY_IMPORTER_NO_CPP_FORWARD\n#define LAZY_IMPORTER_CPP_FORWARD(t, v) v\n#else\n#include <utility>\n#define LAZY_IMPORTER_CPP_FORWARD(t, v) std::forward<t>( v )\n#endif\n#endif\n\n#include <intrin.h>\n\n#ifndef LAZY_IMPORTER_NO_FORCEINLINE\n#if defined(_MSC_VER)\n#define LAZY_IMPORTER_FORCEINLINE __forceinline\n#elif defined(__GNUC__) && __GNUC__ > 3\n#define LAZY_IMPORTER_FORCEINLINE inline __attribute__((__always_inline__))\n#else\n#define LAZY_IMPORTER_FORCEINLINE inline\n#endif\n#else\n#define LAZY_IMPORTER_FORCEINLINE inline\n#endif\n\n\n#ifdef LAZY_IMPORTER_CASE_INSENSITIVE\n#define LAZY_IMPORTER_CASE_SENSITIVITY false\n#else\n#define LAZY_IMPORTER_CASE_SENSITIVITY true\n#endif\n\n#define LAZY_IMPORTER_STRINGIZE(x) #x\n#define LAZY_IMPORTER_STRINGIZE_EXPAND(x) LAZY_IMPORTER_STRINGIZE(x)\n\n#define LAZY_IMPORTER_KHASH(str) ::li::detail::khash(str, \\\n    ::li::detail::khash_impl( __TIME__ __DATE__ LAZY_IMPORTER_STRINGIZE_EXPAND(__LINE__) LAZY_IMPORTER_STRINGIZE_EXPAND(__COUNTER__), 2166136261 ))\n\nnamespace li { namespace detail {\n\n    namespace win {\n\n        struct LIST_ENTRY_T {\n            const char* Flink;\n            const char* Blink;\n        };\n\n        struct UNICODE_STRING_T {\n            unsigned short Length;\n            unsigned short MaximumLength;\n            wchar_t*       Buffer;\n        };\n\n        struct PEB_LDR_DATA_T {\n            unsigned long Length;\n            unsigned long Initialized;\n            const char*   SsHandle;\n            LIST_ENTRY_T  InLoadOrderModuleList;\n        };\n\n        struct PEB_T {\n            unsigned char   Reserved1[2];\n            unsigned char   BeingDebugged;\n            unsigned char   Reserved2[1];\n            const char*     Reserved3[2];\n            PEB_LDR_DATA_T* Ldr;\n        };\n\n        struct LDR_DATA_TABLE_ENTRY_T {\n            LIST_ENTRY_T InLoadOrderLinks;\n            LIST_ENTRY_T InMemoryOrderLinks;\n            LIST_ENTRY_T InInitializationOrderLinks;\n            const char*  DllBase;\n            const char*  EntryPoint;\n            union {\n                unsigned long SizeOfImage;\n                const char*   _dummy;\n            };\n            UNICODE_STRING_T FullDllName;\n            UNICODE_STRING_T BaseDllName;\n\n            LAZY_IMPORTER_FORCEINLINE const LDR_DATA_TABLE_ENTRY_T*\n                                            load_order_next() const noexcept\n            {\n                return reinterpret_cast<const LDR_DATA_TABLE_ENTRY_T*>(\n                    InLoadOrderLinks.Flink);\n            }\n        };\n\n        struct IMAGE_DOS_HEADER { // DOS .EXE header\n            unsigned short e_magic; // Magic number\n            unsigned short e_cblp; // Bytes on last page of file\n            unsigned short e_cp; // Pages in file\n            unsigned short e_crlc; // Relocations\n            unsigned short e_cparhdr; // Size of header in paragraphs\n            unsigned short e_minalloc; // Minimum extra paragraphs needed\n            unsigned short e_maxalloc; // Maximum extra paragraphs needed\n            unsigned short e_ss; // Initial (relative) SS value\n            unsigned short e_sp; // Initial SP value\n            unsigned short e_csum; // Checksum\n            unsigned short e_ip; // Initial IP value\n            unsigned short e_cs; // Initial (relative) CS value\n            unsigned short e_lfarlc; // File address of relocation table\n            unsigned short e_ovno; // Overlay number\n            unsigned short e_res[4]; // Reserved words\n            unsigned short e_oemid; // OEM identifier (for e_oeminfo)\n            unsigned short e_oeminfo; // OEM information; e_oemid specific\n            unsigned short e_res2[10]; // Reserved words\n            long           e_lfanew; // File address of new exe header\n        };\n\n        struct IMAGE_FILE_HEADER {\n            unsigned short Machine;\n            unsigned short NumberOfSections;\n            unsigned long  TimeDateStamp;\n            unsigned long  PointerToSymbolTable;\n            unsigned long  NumberOfSymbols;\n            unsigned short SizeOfOptionalHeader;\n            unsigned short Characteristics;\n        };\n\n        struct IMAGE_EXPORT_DIRECTORY {\n            unsigned long  Characteristics;\n            unsigned long  TimeDateStamp;\n            unsigned short MajorVersion;\n            unsigned short MinorVersion;\n            unsigned long  Name;\n            unsigned long  Base;\n            unsigned long  NumberOfFunctions;\n            unsigned long  NumberOfNames;\n            unsigned long  AddressOfFunctions; // RVA from base of image\n            unsigned long  AddressOfNames; // RVA from base of image\n            unsigned long  AddressOfNameOrdinals; // RVA from base of image\n        };\n\n        struct IMAGE_DATA_DIRECTORY {\n            unsigned long VirtualAddress;\n            unsigned long Size;\n        };\n\n        struct IMAGE_OPTIONAL_HEADER64 {\n            unsigned short       Magic;\n            unsigned char        MajorLinkerVersion;\n            unsigned char        MinorLinkerVersion;\n            unsigned long        SizeOfCode;\n            unsigned long        SizeOfInitializedData;\n            unsigned long        SizeOfUninitializedData;\n            unsigned long        AddressOfEntryPoint;\n            unsigned long        BaseOfCode;\n            unsigned long long   ImageBase;\n            unsigned long        SectionAlignment;\n            unsigned long        FileAlignment;\n            unsigned short       MajorOperatingSystemVersion;\n            unsigned short       MinorOperatingSystemVersion;\n            unsigned short       MajorImageVersion;\n            unsigned short       MinorImageVersion;\n            unsigned short       MajorSubsystemVersion;\n            unsigned short       MinorSubsystemVersion;\n            unsigned long        Win32VersionValue;\n            unsigned long        SizeOfImage;\n            unsigned long        SizeOfHeaders;\n            unsigned long        CheckSum;\n            unsigned short       Subsystem;\n            unsigned short       DllCharacteristics;\n            unsigned long long   SizeOfStackReserve;\n            unsigned long long   SizeOfStackCommit;\n            unsigned long long   SizeOfHeapReserve;\n            unsigned long long   SizeOfHeapCommit;\n            unsigned long        LoaderFlags;\n            unsigned long        NumberOfRvaAndSizes;\n            IMAGE_DATA_DIRECTORY DataDirectory[16];\n        };\n\n        struct IMAGE_OPTIONAL_HEADER32 {\n            unsigned short       Magic;\n            unsigned char        MajorLinkerVersion;\n            unsigned char        MinorLinkerVersion;\n            unsigned long        SizeOfCode;\n            unsigned long        SizeOfInitializedData;\n            unsigned long        SizeOfUninitializedData;\n            unsigned long        AddressOfEntryPoint;\n            unsigned long        BaseOfCode;\n            unsigned long        BaseOfData;\n            unsigned long        ImageBase;\n            unsigned long        SectionAlignment;\n            unsigned long        FileAlignment;\n            unsigned short       MajorOperatingSystemVersion;\n            unsigned short       MinorOperatingSystemVersion;\n            unsigned short       MajorImageVersion;\n            unsigned short       MinorImageVersion;\n            unsigned short       MajorSubsystemVersion;\n            unsigned short       MinorSubsystemVersion;\n            unsigned long        Win32VersionValue;\n            unsigned long        SizeOfImage;\n            unsigned long        SizeOfHeaders;\n            unsigned long        CheckSum;\n            unsigned short       Subsystem;\n            unsigned short       DllCharacteristics;\n            unsigned long        SizeOfStackReserve;\n            unsigned long        SizeOfStackCommit;\n            unsigned long        SizeOfHeapReserve;\n            unsigned long        SizeOfHeapCommit;\n            unsigned long        LoaderFlags;\n            unsigned long        NumberOfRvaAndSizes;\n            IMAGE_DATA_DIRECTORY DataDirectory[16];\n        };\n\n        struct IMAGE_NT_HEADERS {\n            unsigned long     Signature;\n            IMAGE_FILE_HEADER FileHeader;\n#ifdef _WIN64\n            IMAGE_OPTIONAL_HEADER64 OptionalHeader;\n#else\n            IMAGE_OPTIONAL_HEADER32 OptionalHeader;\n#endif\n        };\n\n    } // namespace win\n\n    struct forwarded_hashes {\n       unsigned module_hash;\n       unsigned function_hash;\n    };\n\n    // 64 bit integer where 32 bits are used for the hash offset\n    // and remaining 32 bits are used for the hash computed using it\n    using offset_hash_pair = unsigned long long;\n\n    LAZY_IMPORTER_FORCEINLINE constexpr unsigned get_hash(offset_hash_pair pair) noexcept { return ( pair & 0xFFFFFFFF ); }\n\n    LAZY_IMPORTER_FORCEINLINE constexpr unsigned get_offset(offset_hash_pair pair) noexcept { return ( pair >> 32 ); }\n\n    template<bool CaseSensitive = LAZY_IMPORTER_CASE_SENSITIVITY>\n    LAZY_IMPORTER_FORCEINLINE constexpr unsigned hash_single(unsigned value, char c) noexcept\n    {\n        return static_cast<unsigned int>(\n            (value ^ ((!CaseSensitive && c >= 'A' && c <= 'Z') ? (c | (1 << 5)) : c)) *\n            static_cast<unsigned long long>(16777619));\n    }\n\n    LAZY_IMPORTER_FORCEINLINE constexpr unsigned\n        khash_impl(const char* str, unsigned value) noexcept\n    {\n        return (*str ? khash_impl(str + 1, hash_single(value, *str)) : value);\n    }\n\n    LAZY_IMPORTER_FORCEINLINE constexpr offset_hash_pair khash(\n        const char* str, unsigned offset) noexcept\n    {\n        return ((offset_hash_pair{ offset } << 32) | khash_impl(str, offset));\n    }\n\n    template<class CharT = char>\n    LAZY_IMPORTER_FORCEINLINE unsigned hash(const CharT* str, unsigned offset) noexcept\n    {\n        unsigned value = offset;\n\n        for(;;) {\n            char c = *str++;\n            if(!c)\n                return value;\n            value = hash_single(value, c);\n        }\n    }\n\n    LAZY_IMPORTER_FORCEINLINE unsigned hash(\n       const win::UNICODE_STRING_T& str, unsigned offset) noexcept\n    {\n        auto       first = str.Buffer;\n        const auto last  = first + (str.Length / sizeof(wchar_t));\n        auto       value = offset;\n        for(; first != last; ++first)\n            value = hash_single(value, static_cast<char>(*first));\n\n        return value;\n    }\n\n    LAZY_IMPORTER_FORCEINLINE forwarded_hashes hash_forwarded(\n        const char* str, unsigned offset) noexcept\n    {\n        forwarded_hashes res{ offset, offset };\n\n        for(; *str != '.'; ++str)\n            res.module_hash = hash_single<true>(res.module_hash, *str);\n\n        ++str;\n\n        for(; *str; ++str)\n            res.function_hash = hash_single(res.function_hash, *str);\n\n        return res;\n    }\n\n    // some helper functions\n    LAZY_IMPORTER_FORCEINLINE const win::PEB_T* peb() noexcept\n    {\n#if defined(_M_X64) || defined(__amd64__)\n        return reinterpret_cast<const win::PEB_T*>(__readgsqword(0x60));\n#elif defined(_M_IX86) || defined(__i386__)\n        return reinterpret_cast<const win::PEB_T*>(__readfsdword(0x30));\n#elif defined(_M_ARM) || defined(__arm__)\n        return *reinterpret_cast<const win::PEB_T**>(_MoveFromCoprocessor(15, 0, 13, 0, 2) + 0x30);\n#elif defined(_M_ARM64) || defined(__aarch64__)\n        return *reinterpret_cast<const win::PEB_T**>(__getReg(18) + 0x60);\n#elif defined(_M_IA64) || defined(__ia64__)\n        return *reinterpret_cast<const win::PEB_T**>(static_cast<char*>(_rdteb()) + 0x60);\n#else\n#error Unsupported platform. Open an issue and I'll probably add support.\n#endif\n    }\n\n    LAZY_IMPORTER_FORCEINLINE const win::PEB_LDR_DATA_T* ldr()\n    {\n        return reinterpret_cast<const win::PEB_LDR_DATA_T*>(peb()->Ldr);\n    }\n\n    LAZY_IMPORTER_FORCEINLINE const win::IMAGE_NT_HEADERS* nt_headers(\n        const char* base) noexcept\n    {\n        return reinterpret_cast<const win::IMAGE_NT_HEADERS*>(\n            base + reinterpret_cast<const win::IMAGE_DOS_HEADER*>(base)->e_lfanew);\n    }\n\n    LAZY_IMPORTER_FORCEINLINE const win::IMAGE_EXPORT_DIRECTORY* image_export_dir(\n        const char* base) noexcept\n    {\n        return reinterpret_cast<const win::IMAGE_EXPORT_DIRECTORY*>(\n            base + nt_headers(base)->OptionalHeader.DataDirectory->VirtualAddress);\n    }\n\n    LAZY_IMPORTER_FORCEINLINE const win::LDR_DATA_TABLE_ENTRY_T* ldr_data_entry() noexcept\n    {\n        return reinterpret_cast<const win::LDR_DATA_TABLE_ENTRY_T*>(\n            ldr()->InLoadOrderModuleList.Flink);\n    }\n\n    struct exports_directory {\n        const char*                        _base;\n        const win::IMAGE_EXPORT_DIRECTORY* _ied;\n        unsigned long                      _ied_size;\n\n    public:\n        using size_type = unsigned long;\n\n        LAZY_IMPORTER_FORCEINLINE\n        exports_directory(const char* base) noexcept : _base(base)\n        {\n            const auto ied_data_dir = nt_headers(base)->OptionalHeader.DataDirectory[0];\n            _ied = reinterpret_cast<const win::IMAGE_EXPORT_DIRECTORY*>(\n                base + ied_data_dir.VirtualAddress);\n            _ied_size = ied_data_dir.Size;\n        }\n\n        LAZY_IMPORTER_FORCEINLINE explicit operator bool() const noexcept\n        {\n            return reinterpret_cast<const char*>(_ied) != _base;\n        }\n\n        LAZY_IMPORTER_FORCEINLINE size_type size() const noexcept\n        {\n            return _ied->NumberOfNames;\n        }\n\n        LAZY_IMPORTER_FORCEINLINE const char* base() const noexcept { return _base; }\n        LAZY_IMPORTER_FORCEINLINE const win::IMAGE_EXPORT_DIRECTORY* ied() const noexcept\n        {\n            return _ied;\n        }\n\n        LAZY_IMPORTER_FORCEINLINE const char* name(size_type index) const noexcept\n        {\n            return reinterpret_cast<const char*>(\n                _base + reinterpret_cast<const unsigned long*>(\n                            _base + _ied->AddressOfNames)[index]);\n        }\n\n        LAZY_IMPORTER_FORCEINLINE const char* address(size_type index) const noexcept\n        {\n            const auto* const rva_table =\n                reinterpret_cast<const unsigned long*>(_base + _ied->AddressOfFunctions);\n\n            const auto* const ord_table = reinterpret_cast<const unsigned short*>(\n                _base + _ied->AddressOfNameOrdinals);\n\n            return _base + rva_table[ord_table[index]];\n        }\n\n        LAZY_IMPORTER_FORCEINLINE bool is_forwarded(\n            const char* export_address) const noexcept\n        {\n            const auto ui_ied = reinterpret_cast<const char*>(_ied);\n            return (export_address > ui_ied && export_address < ui_ied + _ied_size);\n        }\n    };\n\n    struct safe_module_enumerator {\n        using value_type = const detail::win::LDR_DATA_TABLE_ENTRY_T;\n        value_type* value;\n        value_type* head;\n\n        LAZY_IMPORTER_FORCEINLINE safe_module_enumerator() noexcept\n            : safe_module_enumerator(ldr_data_entry())\n        {}\n\n        LAZY_IMPORTER_FORCEINLINE\n        safe_module_enumerator(const detail::win::LDR_DATA_TABLE_ENTRY_T* ldr) noexcept\n            : value(ldr->load_order_next()), head(value)\n        {}\n\n        LAZY_IMPORTER_FORCEINLINE void reset() noexcept\n        {\n            value = head->load_order_next();\n        }\n\n        LAZY_IMPORTER_FORCEINLINE bool next() noexcept\n        {\n            value = value->load_order_next();\n\n            return value != head && value->DllBase;\n        }\n    };\n\n    struct unsafe_module_enumerator {\n        using value_type = const detail::win::LDR_DATA_TABLE_ENTRY_T*;\n        value_type value;\n\n        LAZY_IMPORTER_FORCEINLINE unsafe_module_enumerator() noexcept\n            : value(ldr_data_entry())\n        {}\n\n        LAZY_IMPORTER_FORCEINLINE void reset() noexcept { value = ldr_data_entry(); }\n\n        LAZY_IMPORTER_FORCEINLINE bool next() noexcept\n        {\n            value = value->load_order_next();\n            return true;\n        }\n    };\n\n    // provides the cached functions which use Derive classes methods\n    template<class Derived, class DefaultType = void*>\n    class lazy_base {\n    protected:\n        // This function is needed because every templated function\n        // with different args has its own static buffer\n        LAZY_IMPORTER_FORCEINLINE static void*& _cache() noexcept\n        {\n            static void* value = nullptr;\n            return value;\n        }\n\n    public:\n        template<class T = DefaultType>\n        LAZY_IMPORTER_FORCEINLINE static T safe() noexcept\n        {\n            return Derived::template get<T, safe_module_enumerator>();\n        }\n\n        template<class T = DefaultType, class Enum = unsafe_module_enumerator>\n        LAZY_IMPORTER_FORCEINLINE static T cached() noexcept\n        {\n            auto& cached = _cache();\n            if(!cached)\n                cached = Derived::template get<void*, Enum>();\n\n            return (T)(cached);\n        }\n\n        template<class T = DefaultType>\n        LAZY_IMPORTER_FORCEINLINE static T safe_cached() noexcept\n        {\n            return cached<T, safe_module_enumerator>();\n        }\n    };\n\n    template<offset_hash_pair OHP>\n    struct lazy_module : lazy_base<lazy_module<OHP>> {\n        template<class T = void*, class Enum = unsafe_module_enumerator>\n        LAZY_IMPORTER_FORCEINLINE static T get() noexcept\n        {\n            Enum e;\n            do {\n                if(hash(e.value->BaseDllName, get_offset(OHP)) == get_hash(OHP))\n                    return (T)(e.value->DllBase);\n            } while(e.next());\n            return {};\n        }\n\n        template<class T = void*, class Ldr>\n        LAZY_IMPORTER_FORCEINLINE static T in(Ldr ldr) noexcept\n        {\n            safe_module_enumerator e((const detail::win::LDR_DATA_TABLE_ENTRY_T*)(ldr));\n            do {\n                if(hash(e.value->BaseDllName, get_offset(OHP)) == get_hash(OHP))\n                    return (T)(e.value->DllBase);\n            } while(e.next());\n            return {};\n        }\n\n        template<class T = void*, class Ldr>\n        LAZY_IMPORTER_FORCEINLINE static T in_cached(Ldr ldr) noexcept\n        {\n            auto& cached = lazy_base<lazy_module<OHP>>::_cache();\n            if(!cached)\n                cached = in(ldr);\n\n            return (T)(cached);\n        }\n    };\n\n    template<offset_hash_pair OHP, class T>\n    struct lazy_function : lazy_base<lazy_function<OHP, T>, T> {\n        using base_type = lazy_base<lazy_function<OHP, T>, T>;\n\n        template<class... Args>\n        LAZY_IMPORTER_FORCEINLINE decltype(auto) operator()(Args&&... args) const\n        {\n#ifndef LAZY_IMPORTER_CACHE_OPERATOR_PARENS\n            return get()(LAZY_IMPORTER_CPP_FORWARD(Args, args)...);\n#else\n            return this->cached()(LAZY_IMPORTER_CPP_FORWARD(Args, args)...);\n#endif\n        }\n\n        template<class F = T, class Enum = unsafe_module_enumerator>\n        LAZY_IMPORTER_FORCEINLINE static F get() noexcept\n        {\n            // for backwards compatability.\n            // Before 2.0 it was only possible to resolve forwarded exports when\n            // this macro was enabled\n#ifdef LAZY_IMPORTER_RESOLVE_FORWARDED_EXPORTS\n            return forwarded<F, Enum>();\n#else\n\n            Enum e;\n\n            do {\n#ifdef LAZY_IMPORTER_HARDENED_MODULE_CHECKS\n                if(!e.value->DllBase || !e.value->FullDllName.Length)\n                    continue;\n#endif\n\n                const exports_directory exports(e.value->DllBase);\n\n                if(exports) {\n                    auto export_index = exports.size();\n                    while(export_index--)\n                        if(hash(exports.name(export_index), get_offset(OHP)) == get_hash(OHP))\n                            return (F)(exports.address(export_index));\n                }\n            } while(e.next());\n            return {};\n#endif\n        }\n\n        template<class F = T, class Enum = unsafe_module_enumerator>\n        LAZY_IMPORTER_FORCEINLINE static F forwarded() noexcept\n        {\n            detail::win::UNICODE_STRING_T name;\n            forwarded_hashes              hashes{ 0, get_hash(OHP) };\n\n            Enum e;\n            do {\n                name = e.value->BaseDllName;\n                name.Length -= 8; // get rid of .dll extension\n\n                if(!hashes.module_hash || hash(name, get_offset(OHP)) == hashes.module_hash) {\n                    const exports_directory exports(e.value->DllBase);\n\n                    if(exports) {\n                        auto export_index = exports.size();\n                        while(export_index--)\n                            if(hash(exports.name(export_index), get_offset(OHP)) == hashes.function_hash) {\n                                const auto addr = exports.address(export_index);\n\n                                if(exports.is_forwarded(addr)) {\n                                    hashes = hash_forwarded(\n                                        reinterpret_cast<const char*>(addr),\n                                        get_offset(OHP));\n\n                                    e.reset();\n                                    break;\n                                }\n                                return (F)(addr);\n                            }\n                    }\n                }\n            } while(e.next());\n            return {};\n        }\n\n        template<class F = T>\n        LAZY_IMPORTER_FORCEINLINE static F forwarded_safe() noexcept\n        {\n            return forwarded<F, safe_module_enumerator>();\n        }\n\n        template<class F = T, class Enum = unsafe_module_enumerator>\n        LAZY_IMPORTER_FORCEINLINE static F forwarded_cached() noexcept\n        {\n            auto& value = base_type::_cache();\n            if(!value)\n                value = forwarded<void*, Enum>();\n            return (F)(value);\n        }\n\n        template<class F = T>\n        LAZY_IMPORTER_FORCEINLINE static F forwarded_safe_cached() noexcept\n        {\n            return forwarded_cached<F, safe_module_enumerator>();\n        }\n\n        template<class F = T, bool IsSafe = false, class Module>\n        LAZY_IMPORTER_FORCEINLINE static F in(Module m) noexcept\n        {\n            if(IsSafe && !m)\n                return {};\n\n            const exports_directory exports((const char*)(m));\n            if(IsSafe && !exports)\n                return {};\n\n            for(unsigned long i{};; ++i) {\n                if(IsSafe && i == exports.size())\n                    break;\n\n                if(hash(exports.name(i), get_offset(OHP)) == get_hash(OHP))\n                    return (F)(exports.address(i));\n            }\n            return {};\n        }\n\n        template<class F = T, class Module>\n        LAZY_IMPORTER_FORCEINLINE static F in_safe(Module m) noexcept\n        {\n            return in<F, true>(m);\n        }\n\n        template<class F = T, bool IsSafe = false, class Module>\n        LAZY_IMPORTER_FORCEINLINE static F in_cached(Module m) noexcept\n        {\n            auto& value = base_type::_cache();\n            if(!value)\n                value = in<void*, IsSafe>(m);\n            return (F)(value);\n        }\n\n        template<class F = T, class Module>\n        LAZY_IMPORTER_FORCEINLINE static F in_safe_cached(Module m) noexcept\n        {\n            return in_cached<F, true>(m);\n        }\n\n        template<class F = T>\n        LAZY_IMPORTER_FORCEINLINE static F nt() noexcept\n        {\n            return in<F>(ldr_data_entry()->load_order_next()->DllBase);\n        }\n\n        template<class F = T>\n        LAZY_IMPORTER_FORCEINLINE static F nt_safe() noexcept\n        {\n            return in_safe<F>(ldr_data_entry()->load_order_next()->DllBase);\n        }\n\n        template<class F = T>\n        LAZY_IMPORTER_FORCEINLINE static F nt_cached() noexcept\n        {\n            return in_cached<F>(ldr_data_entry()->load_order_next()->DllBase);\n        }\n\n        template<class F = T>\n        LAZY_IMPORTER_FORCEINLINE static F nt_safe_cached() noexcept\n        {\n            return in_safe_cached<F>(ldr_data_entry()->load_order_next()->DllBase);\n        }\n    };\n\n}} // namespace li::detail\n\n#endif // include guard\n"
  },
  {
    "path": "R3nzSkin_Injector/main.cpp",
    "content": "#include <Windows.h>\n#include <ctime>\n#include <cstdlib>\n#include <thread>\n#include <regex>\n#include <msclr/marshal_cppstd.h>\n\n#include \"R3nzUI.hpp\"\n#include \"Injector.hpp\"\n\nusing namespace System;\nusing namespace System::Windows::Forms;\nusing namespace System::Threading;\nusing namespace System::Globalization;\nusing namespace System::Net;\n\nint main([[maybe_unused]] array<String^>^ args)\n{\n\tstd::srand(static_cast<unsigned int>(std::time(nullptr)));\n\tInjector::autoUpdate();\n\t\n\tApplication::EnableVisualStyles();\n\tApplication::SetCompatibleTextRenderingDefault(false);\n\tR3nzSkinInjector::R3nzUI form;\n\n\tauto thread{ std::thread(Injector::run) };\n\tauto screenThread{ gcnew Thread(gcnew ThreadStart(%form, &R3nzSkinInjector::R3nzUI::updateScreen)) };\n\tscreenThread->Start();\n\n\tApplication::Run(%form);\n\n\tthread.detach();\n\tscreenThread->Abort();\n\n\treturn EXIT_SUCCESS;\n}\n"
  },
  {
    "path": "R3nzSkin_Injector/resource.h",
    "content": "//{{NO_DEPENDENCIES}}\n// Microsoft Visual C++ ierme dosyas oluturdu.\n// R3nzSkin_Injector.rc tarafndan kullanlm\n//\n#define IDI_ICON1                       101\n\n// Next default values for new objects\n// \n#ifdef APSTUDIO_INVOKED\n#ifndef APSTUDIO_READONLY_SYMBOLS\n#define _APS_NEXT_RESOURCE_VALUE        102\n#define _APS_NEXT_COMMAND_VALUE         40001\n#define _APS_NEXT_CONTROL_VALUE         1001\n#define _APS_NEXT_SYMED_VALUE           101\n#endif\n#endif\n"
  },
  {
    "path": "R3nzSkin_Injector/xorstr.hpp",
    "content": "#pragma once\n#include <array>\n\nnamespace XorCompileTime\n{\n    constexpr auto time = __TIME__;\n    constexpr auto seed = static_cast<int>(time[7]) + static_cast<int>(time[6]) * 10 + static_cast<int>(time[4]) * 60 + static_cast<int>(time[3]) * 600 + static_cast<int>(time[1]) * 3600 + static_cast<int>(time[0]) * 36000;\n\n    template<int N>\n    struct RandomGenerator\n    {\n    private:\n        static constexpr unsigned a = 0x41a7; // 7^5\n        static constexpr unsigned m = 0x7fffffff; // 2^31 - 1\n\n        static constexpr unsigned s = RandomGenerator< N - 1 >::value;\n        static constexpr unsigned lo = a * (s & 0xFFFF); // Multiply lower 16 bits by 16807\n        static constexpr unsigned hi = a * (s >> 16); // Multiply higher 16 bits by 16807\n        static constexpr unsigned lo2 = lo + ((hi & 0x7FFF) << 16); // Combine lower 15 bits of hi with lo's upper bits\n        static constexpr unsigned hi2 = hi >> 15; // Discard lower 15 bits of hi\n        static constexpr unsigned lo3 = lo2 + hi;\n\n    public:\n        static constexpr unsigned max = m;\n        static constexpr unsigned value = lo3 > m ? lo3 - m : lo3;\n    };\n\n    template<>\n    struct RandomGenerator<0>\n    {\n        static constexpr unsigned value = seed;\n    };\n\n    template<int N, int M>\n    struct RandomInt\n    {\n        static constexpr auto value = RandomGenerator<N + 1>::value % M;\n    };\n\n    template<int N>\n    struct RandomChar\n    {\n        static const char value = static_cast<char>(1 + RandomInt<N, 0x7F - 1>::value);\n    };\n\n    template<size_t N, int K, typename Char>\n    struct XorString\n    {\n    private:\n        const char _key;\n        std::array<Char, N + 1> _encrypted;\n\n        constexpr Char enc(Char c) const\n        {\n            return c ^ _key;\n        }\n\n        Char dec(Char c) const\n        {\n            return c ^ _key;\n        }\n\n    public:\n        template<size_t... Is>\n        constexpr __forceinline XorString(const Char* str, std::index_sequence< Is... >) : _key(RandomChar<K>::value), _encrypted{ enc(str[Is])... } {}\n\n        __forceinline decltype(auto) decrypt()\n        {\n            for (size_t i = 0; i < N; ++i) {\n                _encrypted[i] = dec(_encrypted[i]);\n            }\n            _encrypted[N] = '\\0';\n            return _encrypted.data();\n        }\n    };\n\t#define _XorStr(s) []{ constexpr XorCompileTime::XorString<sizeof(s)/sizeof(char) - 1, __COUNTER__, char> expr(s, std::make_index_sequence<sizeof(s)/sizeof(char) - 1>()); return expr; }().decrypt()\n\t#define _XorStrW(s) []{ constexpr XorCompileTime::XorString<sizeof(s)/sizeof(wchar_t) - 1, __COUNTER__, wchar_t> expr(s, std::make_index_sequence<sizeof(s)/sizeof(wchar_t) - 1>()); return expr; }().decrypt()\n}"
  },
  {
    "path": "README.md",
    "content": "﻿# R3nzSkin - League of Legends Skin Changer\n\n<div align=\"center\">\n\n[![Build Status](https://img.shields.io/badge/build-passing-brightgreen)](https://github.com/SFHJavaer/R3Archive)\n[![License](https://img.shields.io/badge/license-MIT-blue)](LICENSE)\n[![Platform](https://img.shields.io/badge/platform-Windows-blue)](https://www.microsoft.com/windows)\n[![C++](https://img.shields.io/badge/C%2B%2B-17-blue)](https://isocpp.org/)\n\n*A powerful skin modification tool for League of Legends*\n\n[English](README.md) | [中文](README_zh.md)\n\n</div>\n\n---\n\n## 📖 Project Overview\n\nR3nzSkin is a powerful skin modification tool specifically designed for League of Legends. Through memory injection and hooking techniques, it enables real-time skin switching and customization within the game. The project includes a complete injector, configuration management system, and user-friendly graphical interface.\n\n### 🎯 Key Features\n\n- **🔄 Real-time Skin Switching** - Instantly change skins for champions, minions, monsters, etc. during gameplay\n- **🎨 Custom Skin Index** - Support manual skin ID input to unlock hidden skins\n- **🖥️ Modern GUI** - Intuitive graphical interface based on ImGui\n- **⚙️ Hotkey Support** - Customizable keyboard shortcuts\n- **💾 Configuration Persistence** - Automatic save and load of user settings\n- **🔧 Memory Safety** - Intelligent memory scanning and automatic offset detection\n- **🌐 Multi-region Support** - Cross-region compatibility optimization\n- **🐍 Tool Integration** - Python scripts for configuration conversion with other skin tools\n\n---\n\n## 🏗️ Project Structure\n\n```\nR3Archive/\n├── R3nzSkin/                    # Core DLL Module\n│   ├── R3nzSkin.cpp           # DLL Entry and Main Loop\n│   ├── CheatManager.hpp       # Cheat Manager\n│   ├── Config.cpp/hpp         # Configuration Management\n│   ├── GUI.cpp/hpp            # Graphical Interface\n│   ├── Hooks.cpp/hpp          # Hooking System\n│   ├── Memory.cpp/hpp         # Memory Operations\n│   ├── SkinDatabase.cpp/hpp   # Skin Database\n│   ├── SDK/                   # Game SDK\n│   │   ├── GameObject.hpp     # Game Objects\n│   │   ├── Champion.hpp       # Champion Class\n│   │   ├── AITurret.hpp       # Turrets\n│   │   └── ...\n│   └── imgui/                 # ImGui Graphics Library\n├── R3nzSkin_Injector/         # Injector Tool\n│   ├── main.cpp               # Injector Entry\n│   ├── Injector.hpp          # Injection Logic\n│   ├── R3nzUI.hpp            # GUI Interface\n│   └── resource.h            # Resource Files\n├── PythonScripts/             # Python Utility Scripts\n│   └── lolskin_to_skin.py    # Configuration Converter\n└── README.md                 # Project Documentation\n```\n\n---\n\n## 🚀 Quick Start\n\n### System Requirements\n\n- **OS**: Windows 10/11 (64-bit)\n- **Development Environment**: Visual Studio 2019/2022\n- **Runtime**: .NET Framework 4.8+\n- **Target Game**: League of Legends\n\n### Build Instructions\n\n1. **Clone the Repository**\n   ```bash\n   git clone --recursive https://github.com/SFHJavaer/R3Archive.git\n   cd R3Archive\n   ```\n\n2. **Open Solution**\n   - Open `R3nzSkin.sln` with Visual Studio\n   - Select `x64` platform configuration\n\n3. **Build Projects**\n   - Build `R3nzSkin` project to generate the core DLL\n   - Build `R3nzSkin_Injector` project to generate the injector\n\n### Usage Instructions\n\n1. **Launch Injector**\n   - Run `R3nzSkin_Injector.exe`\n   - Wait for game process detection\n\n2. **Inject DLL**\n   - Select League of Legends process\n   - Click inject button\n\n3. **In-Game Controls**\n   - Press `Insert` to toggle menu\n   - Use `Page Up`/`Page Down` to switch skins\n   - Or manually input skin ID in the menu\n\n---\n\n## ⚙️ Configuration\n\n### Hotkey Settings\n\n- **Menu Toggle**: `Insert` (default)\n- **Next Skin**: `Page Up` (default)\n- **Previous Skin**: `Page Down` (default)\n\n### Supported Skin Types\n\n- **Champion Skins** - Local player and other players\n- **Minion Skins** - Minions, siege engines\n- **Monster Skins** - Various jungle monsters\n- **Turret Skins** - Defense turrets\n- **Ward Skins** - Wards\n\n### Configuration Files\n\nConfiguration files are automatically saved in the game directory, including:\n- Skin index settings\n- UI configuration\n- Hotkey bindings\n\n---\n\n## 🔧 Python Tools\n\n### lolskin_to_skin.py\n\nConvert configurations from other skin tools to R3nzSkin format:\n\n```bash\npython PythonScripts/lolskin_to_skin.py\n```\n\n**Features**:\n- Automatic detection of LOLSkin configuration files\n- Skin index format conversion\n- Generate R3nzSkin-compatible JSON configuration\n- Support batch conversion\n\n**Usage Example**:\n```python\n# Convert LOLSkin configuration\nhero_skin = skin_to_dictionary(\"path/to/Config.ini\")\nr3nz_config = forward_data(hero_skin)\n\n# Save as JSON\nwith open('data.json', 'w') as f:\n    json.dump(r3nz_config, f)\n```\n\n---\n\n## 🛠️ Technical Details\n\n### Core Technologies\n\n- **Memory Injection**: DLL injection techniques\n- **Hooking System**: DirectX hooks and game function hooks\n- **Memory Scanning**: Signature scanning and offset detection\n- **Configuration Management**: JSON format configuration persistence\n- **Graphics Interface**: ImGui + DirectX11\n\n### Security Features\n\n- **Thread Hiding**: Prevent injection thread detection\n- **Memory Protection**: Safe memory read/write operations\n- **Error Handling**: Comprehensive exception handling mechanisms\n- **Logging System**: Detailed runtime logging\n\n### Architecture Benefits\n\n- **Modular Design**: High cohesion, low coupling module structure\n- **Type Safety**: Strong typed C++ implementation\n- **Performance Optimization**: Efficient memory operations and rendering\n- **Extensibility**: Easy to add new skin types and features\n\n---\n\n## 📋 Development Guide\n\n### Environment Setup\n\n1. Install Visual Studio 2019/2022\n2. Install Windows SDK\n3. Clone the project and its submodules\n\n### Code Standards\n\n- Use C++17 standard\n- Follow modern C++ best practices\n- Use smart pointers for memory management\n- Exception-safe design patterns\n\n### Debugging Tips\n\n- Use Visual Studio debugger\n- Check injection log output\n- Monitor memory usage\n- Verify hook function calls\n\n---\n\n## ⚠️ Important Notices\n\n### Academic Research Declaration\n\nThis project serves as a **computer graphics research experiment for academic exchange and technical validation only**. Strictly prohibited for commercial use or unlawful activities.\n\n**Prohibited Activities**:\n- Commercial use\n- Unlawful gaming activities\n- Violation of game user agreements\n\n### Legal Disclaimer\n\nPursuant to 17 USC §512 (DMCA):\n- No technical support provided by this project\n- Reverse engineering prohibited\n- Right to halt regional distributions reserved\n\n**User Responsibility**: Users assume all legal risks and consequences.\n\n---\n\n## 🤝 Contributing\n\nIssues and Pull Requests are welcome to improve the project:\n\n1. Fork the repository\n2. Create feature branch (`git checkout -b feature/AmazingFeature`)\n3. Commit changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to branch (`git push origin feature/AmazingFeature`)\n5. Open Pull Request\n\n### Contribution Requirements\n\n- Code must be tested\n- Follow existing code style\n- Update relevant documentation\n- Add necessary comments\n\n---\n\n## 📄 License\n\nThis project is licensed under MIT - see [LICENSE](LICENSE) file for details.\n\n---\n\n## 🙏 Acknowledgments\n\n- [R3nzTheCodeGOD](https://github.com/R3nzTheCodeGOD) - Original R3nzSkin project\n- [ocornut/imgui](https://github.com/ocornut/imgui) - Graphics interface library\n- [nlohmann/json](https://github.com/nlohmann/json) - JSON processing library\n\n---\n\n## 📞 Contact\n\n- Project Homepage: [https://github.com/SFHJavaer/R3Archive](https://github.com/SFHJavaer/R3Archive)\n- Issue Reports: [Create Issue](https://github.com/SFHJavaer/R3Archive/issues)\n\n---\n\n<div align=\"center\">\n\n**⭐ If this project helps you, please give it a star!**\n\n</div>\n"
  },
  {
    "path": "README_zh.md",
    "content": "# R3nzSkin - 英雄联盟皮肤修改工具\n\n<div align=\"center\">\n\n[![Build Status](https://img.shields.io/badge/build-passing-brightgreen)](https://github.com/SFHJavaer/R3Archive)\n[![License](https://img.shields.io/badge/license-MIT-blue)](LICENSE)\n[![Platform](https://img.shields.io/badge/platform-Windows-blue)](https://www.microsoft.com/windows)\n[![C++](https://img.shields.io/badge/C%2B%2B-17-blue)](https://isocpp.org/)\n\n*一个功能强大的英雄联盟游戏皮肤修改工具*\n\n[English](README.md) | [中文](README_zh.md)\n\n</div>\n\n---\n\n## 📖 项目简介\n\nR3nzSkin 是一个专为英雄联盟游戏设计的皮肤修改工具。通过内存注入和钩子技术，实现游戏内皮肤的实时切换和自定义。该项目包含完整的注入器、配置管理系统和用户友好的图形界面。\n\n### 🎯 主要特性\n\n- **🔄 实时皮肤切换** - 游戏运行时即时更换英雄、兵线、野怪等皮肤\n- **🎨 自定义皮肤索引** - 支持手动输入皮肤ID，解锁隐藏皮肤\n- **🖥️ 现代化GUI** - 基于ImGui的直观图形界面\n- **⚙️ 热键支持** - 自定义键盘快捷键控制\n- **💾 配置持久化** - 自动保存和加载用户设置\n- **🔧 内存安全** - 智能内存扫描和偏移量自动查找\n- **🌐 多区域支持** - 跨地区兼容性优化\n- **🐍 工具集成** - Python脚本支持与其他皮肤工具的配置转换\n\n---\n\n## 🏗️ 项目架构\n\n```\nR3Archive/\n├── R3nzSkin/                    # 核心DLL模块\n│   ├── R3nzSkin.cpp           # DLL入口和主循环\n│   ├── CheatManager.hpp       # 作弊管理器\n│   ├── Config.cpp/hpp         # 配置管理\n│   ├── GUI.cpp/hpp            # 图形界面\n│   ├── Hooks.cpp/hpp          # 钩子系统\n│   ├── Memory.cpp/hpp         # 内存操作\n│   ├── SkinDatabase.cpp/hpp   # 皮肤数据库\n│   ├── SDK/                   # 游戏SDK\n│   │   ├── GameObject.hpp     # 游戏对象\n│   │   ├── Champion.hpp       # 英雄类\n│   │   ├── AITurret.hpp       # 防御塔\n│   │   └── ...\n│   └── imgui/                 # ImGui图形库\n├── R3nzSkin_Injector/         # 注入器工具\n│   ├── main.cpp               # 注入器入口\n│   ├── Injector.hpp          # 注入逻辑\n│   ├── R3nzUI.hpp            # 图形界面\n│   └── resource.h            # 资源文件\n├── PythonScripts/             # Python工具脚本\n│   └── lolskin_to_skin.py    # 配置转换工具\n└── README.md                 # 项目文档\n```\n\n---\n\n## 🚀 快速开始\n\n### 系统要求\n\n- **操作系统**: Windows 10/11 (64位)\n- **开发环境**: Visual Studio 2019/2022\n- **运行时**: .NET Framework 4.8+\n- **目标游戏**: 英雄联盟\n\n### 构建步骤\n\n1. **克隆项目**\n   ```bash\n   git clone --recursive https://github.com/SFHJavaer/R3Archive.git\n   cd R3Archive\n   ```\n\n2. **打开解决方案**\n   - 使用 Visual Studio 打开 `R3nzSkin.sln`\n   - 选择 `x64` 平台配置\n\n3. **构建项目**\n   - 构建 `R3nzSkin` 项目生成核心DLL\n   - 构建 `R3nzSkin_Injector` 项目生成注入器\n\n### 使用方法\n\n1. **启动注入器**\n   - 运行 `R3nzSkin_Injector.exe`\n   - 等待游戏进程检测\n\n2. **注入DLL**\n   - 选择英雄联盟进程\n   - 点击注入按钮\n\n3. **游戏内操作**\n   - 按 `Insert` 键打开/关闭菜单\n   - 使用 `Page Up`/`Page Down` 切换皮肤\n   - 或在菜单中手动输入皮肤ID\n\n---\n\n## ⚙️ 配置说明\n\n### 热键设置\n\n- **菜单切换**: `Insert` (默认)\n- **下一个皮肤**: `Page Up` (默认)\n- **上一个皮肤**: `Page Down` (默认)\n\n### 皮肤类型支持\n\n- **英雄皮肤** - 本地玩家和其他玩家\n- **兵线皮肤** - 小兵、炮车\n- **野怪皮肤** - 各类野怪\n- **守卫塔皮肤** - 防御塔\n- **眼位皮肤** - 守卫\n\n### 配置文件\n\n配置文件自动保存在游戏目录下，包含：\n- 皮肤索引设置\n- 界面配置\n- 热键绑定\n\n---\n\n## 🔧 Python工具\n\n### lolskin_to_skin.py\n\n将其他皮肤工具的配置转换为R3nzSkin格式：\n\n```bash\npython PythonScripts/lolskin_to_skin.py\n```\n\n**功能特性**:\n- 自动检测LOLSkin配置文件\n- 转换皮肤索引格式\n- 生成R3nzSkin兼容的JSON配置\n- 支持批量转换\n\n**使用示例**:\n```python\n# 转换LOLSkin配置\nhero_skin = skin_to_dictionary(\"path/to/Config.ini\")\nr3nz_config = forward_data(hero_skin)\n\n# 保存为JSON\nwith open('data.json', 'w') as f:\n    json.dump(r3nz_config, f)\n```\n\n---\n\n## 🛠️ 技术细节\n\n### 核心技术\n\n- **内存注入**: DLL注入技术\n- **钩子系统**: DirectX钩子和游戏函数钩子\n- **内存扫描**: 特征码扫描和偏移量查找\n- **配置管理**: JSON格式配置持久化\n- **图形界面**: ImGui + DirectX11\n\n### 安全特性\n\n- **线程隐藏**: 防止注入线程被检测\n- **内存保护**: 安全的内存读写操作\n- **错误处理**: 完善的异常处理机制\n- **日志系统**: 详细的运行日志记录\n\n### 架构优势\n\n- **模块化设计**: 高内聚、低耦合的模块结构\n- **类型安全**: 强类型C++实现\n- **性能优化**: 高效的内存操作和渲染\n- **可扩展性**: 易于添加新的皮肤类型和功能\n\n---\n\n## 📋 开发指南\n\n### 环境搭建\n\n1. 安装 Visual Studio 2019/2022\n2. 安装 Windows SDK\n3. 克隆项目及其子模块\n\n### 代码规范\n\n- 使用C++17标准\n- 遵循现代C++最佳实践\n- 使用智能指针管理内存\n- 异常安全的设计模式\n\n### 调试技巧\n\n- 使用Visual Studio调试器\n- 查看注入日志输出\n- 监控内存使用情况\n- 检查钩子函数调用\n\n---\n\n## ⚠️ 重要声明\n\n### 学术研究声明\n\n本项目仅用于**计算机图形学研究和学术交流**。严禁用于任何商业用途或非法活动。\n\n**禁止行为**:\n- 商业化使用\n- 非法游戏活动\n- 违反游戏用户协议\n\n### 法律免责\n\n根据 DMCA 第512条规定：\n- 本项目不提供技术支持\n- 禁止逆向工程\n- 保留停止分发的权利\n\n**用户责任**: 使用者自行承担所有法律风险和后果。\n\n---\n\n## 🤝 贡献指南\n\n欢迎提交Issue和Pull Request来改进项目：\n\n1. Fork本仓库\n2. 创建特性分支 (`git checkout -b feature/AmazingFeature`)\n3. 提交更改 (`git commit -m 'Add some AmazingFeature'`)\n4. 推送到分支 (`git push origin feature/AmazingFeature`)\n5. 打开Pull Request\n\n### 贡献要求\n\n- 代码需经过测试\n- 遵循现有代码风格\n- 更新相关文档\n- 添加必要的注释\n\n---\n\n## 📄 许可证\n\n本项目采用MIT许可证 - 查看[LICENSE](LICENSE)文件了解详情。\n\n---\n\n## 🙏 致谢\n\n- [R3nzTheCodeGOD](https://github.com/R3nzTheCodeGOD) - 原始R3nzSkin项目\n- [ocornut/imgui](https://github.com/ocornut/imgui) - 图形界面库\n- [nlohmann/json](https://github.com/nlohmann/json) - JSON处理库\n\n---\n\n## 📞 联系方式\n\n- 项目主页: [https://github.com/SFHJavaer/R3Archive](https://github.com/SFHJavaer/R3Archive)\n- 问题反馈: [创建Issue](https://github.com/SFHJavaer/R3Archive/issues)\n\n---\n\n<div align=\"center\">\n\n**⭐ 如果这个项目对你有帮助，请给它一个星标！**\n\n</div>\n"
  }
]