[
  {
    "path": ".gitignore",
    "content": "env/\n\n# build intermediates\n.vscode/\nbuild/\n__pycache__/\n*.egg-info/\n*.cpython-312-x86_64-linux-gnu.so\n\n# profiling tools\n*.sqlite\n*.nsys-rep\n*.ncu-rep\nperf.data*\n*.gputrace/\n\n**/.DS_Store"
  },
  {
    "path": "LICENSE.md",
    "content": "MIT License\n\nCopyright (c) 2025 Andrew Chan\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\nK-quants adapted from llama.cpp\n\nMIT License\n\nCopyright (c) 2023-2024 The ggml authors\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\nnlohmann/json\n\nMIT License \n\nCopyright (c) 2013-2025 Niels Lohmann\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\nfmt\n\nCopyright (c) 2012 - present, Victor Zverovich and {fmt} contributors\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF 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--- Optional exception to the license ---\n\nAs an exception, if, as a result of your compiling your source code, portions\nof this Software are embedded into a machine-executable object form of such\nsource code, you may redistribute such embedded portions in such object form\nwithout including the above copyright and permission notices.\n"
  },
  {
    "path": "Makefile",
    "content": "MAKEFLAGS+=-r -j\n\nUNAME=$(shell uname)\n\nBUILD=build\nASM_DIR=$(BUILD)/asm\n\n# compile .c, .cpp, .cu files\nSOURCES=$(filter-out src/test.cpp,$(wildcard src/*.c))\nSOURCES+=$(filter-out src/test.cpp,$(wildcard src/*.cc))\nSOURCES+=$(filter-out src/test.cpp,$(wildcard src/*.cpp))\nSOURCES+=$(filter-out src/test.cpp,$(wildcard src/*.cu))\nSOURCES+=$(wildcard vendor/*.c)\nSOURCES+=$(wildcard vendor/*.cc)\nSOURCES+=$(wildcard vendor/*.cpp)\nSOURCES+=$(wildcard vendor/*.cu)\n\n# Define test sources separately\nTEST_SOURCES=src/test.cpp\nTEST_SOURCES+=$(filter-out src/main.cpp,$(SOURCES))\n\nOBJECTS=$(SOURCES:%=$(BUILD)/%.o)\nTEST_OBJECTS=$(TEST_SOURCES:%=$(BUILD)/%.o)\nASM_FILES=$(patsubst %.cpp,$(ASM_DIR)/%.s,$(filter %.cpp,$(SOURCES)))\nTEST_ASM_FILES=$(patsubst %.cpp,$(ASM_DIR)/%.s,$(filter %.cpp,$(TEST_SOURCES)))\n\nBINARY=$(BUILD)/main\nTEST_BINARY=$(BUILD)/test\nPROFILE_BINARY=$(BUILD)/main_profile\n\nBASE_CFLAGS=-g -Wall -Wpointer-arith -Werror -O3 -ffast-math -Ivendor -std=c++20\nBASE_LDFLAGS=-lm\n\nBASE_CFLAGS+=-fopenmp -mf16c -mavx2 -mfma\nBASE_LDFLAGS+=-fopenmp\n\nPROFILE_CFLAGS=$(BASE_CFLAGS) -pg -fno-omit-frame-pointer\nPROFILE_LDFLAGS=$(BASE_LDFLAGS) -pg\n\nCFLAGS=$(BASE_CFLAGS)\nLDFLAGS=$(BASE_LDFLAGS)\n\nall: $(BINARY) asm\n\nprofile: CFLAGS=$(PROFILE_CFLAGS)\nprofile: LDFLAGS=$(PROFILE_LDFLAGS)\nprofile: $(PROFILE_BINARY)\n\ntest: $(TEST_BINARY) test-asm\n\n# Target to build just assembly files\nasm: $(ASM_FILES)\n\ntest-asm: $(TEST_ASM_FILES)\n\nformat:\n\tclang-format -i src/*\n\n$(BINARY): $(OBJECTS)\n\t$(CXX) $^ $(LDFLAGS) -o $@\n\n$(TEST_BINARY): $(TEST_OBJECTS)\n\t$(CXX) $^ $(LDFLAGS) -o $@\n\n$(PROFILE_BINARY): $(OBJECTS)\n\t$(CXX) $^ $(PROFILE_LDFLAGS) -o $@\n\n# Rule to generate assembly for cpp files\n$(ASM_DIR)/%.s: %.cpp\n\t@mkdir -p $(dir $@)\n\t$(CXX) $< $(CFLAGS) -S -masm=intel -o $@\n\n$(BUILD)/%.c.o: %.c\n\t@mkdir -p $(dir $@)\n\t$(CXX) $< $(CFLAGS) -c -MMD -MP -o $@\n\n$(BUILD)/%.cpp.o: %.cpp\n\t@mkdir -p $(dir $@)\n\t$(CXX) $< $(CFLAGS) -c -MMD -MP -o $@\n\n$(BUILD)/%.cc.o: %.cc\n\t@mkdir -p $(dir $@)\n\t$(CXX) $< $(CFLAGS) -c -MMD -MP -o $@\n\n-include $(OBJECTS:.o=.d)\n-include $(TEST_OBJECTS:.o=.d)\n\nclean:\n\trm -rf $(BUILD)\n\n.PHONY: all clean format test asm test-asm profile"
  },
  {
    "path": "README.md",
    "content": "This is an CPU-only inference implementation for the DeepSeek family of large language models written in C++, based on [Yet Another Language Model](https://github.com/andrewkchan/yalm). \n\n## Why?\n\nFor fun and learning!\n\nI was initially adding DeepSeek support to `yalm` but realized that the changes were large and complex enough that it might ruin the simplicity of that project. Maybe at some point I'll upstream the changes, but for now I've decided to fork them into a separate, smaller, leaner codebase. \n\nSince this program only supports DeepSeek, it's tiny compared to other inference engines (<2k LOC not including `fmt` and `json`, vs. >250k for llama.cpp and vllm) and is extra hackable. I'm currently using it as a testbed to study single-batch DeepSeek decoding performance on CPU.\n\n## Model and hardware support\n\nQuantizations other than FP32 require AVX2 and F16C support.\n\n| Model      | Q2_K | Q3_K | Q4_K | F8E5M2 | F8E4M3 | FP16 | BF16 | FP32 |\n| -----      | ---- | ---- | ------ | ------ | ---- | ---- | ---- | ---- |\n| DeepSeek-V2-Lite | ✅ | ✅ | WIP | ✅ | WIP | ✅ | WIP | ✅ |\n| DeepSeek-V2 | ✅ | ✅ | WIP | ✅ | WIP | ✅ | WIP | ✅ |\n| DeepSeek-V2.5 | ✅ | ✅ | WIP | ✅ | WIP | ✅ | WIP | ✅ |\n| DeepSeek-V3 | ✅ | ✅ | WIP | ✅ | WIP | - | - | - |\n| DeepSeek-V3.1 (Terminus) | ✅ | ✅ | WIP | ✅ | WIP | - | - | - |\n| DeepSeek-R1 | ✅ | ✅ | WIP | ✅ | WIP | - | - | - |\n\ndeepseek.cpp is missing important optimizations for production use (see notes below), but gets pretty close to llama.cpp in single-batch decode speed. Benchmarking DeepSeek-V3-Base with Q2_K quantization on an AWS r6a.12xlarge instance (AMD EPYC 7R13, 2x24 cores, 384GB DDR4 RAM):\n- llama.cpp ([DeepSeek-V3-Q2_K_XS](https://huggingface.co/unsloth/DeepSeek-V3-GGUF/tree/main/DeepSeek-V3-Q2_K_XS) 207GB, tg128, best of 16/24/32/48 threads): 4.57 tok/s\n- deepseek.cpp (Q2_K 207GB, MHA, `-n 128 -L` completion with 16 threads): 4.02 tok/s\n\nA big part of this is that deepseek.cpp uses the llama.cpp vec_dot kernels for Q2_K, so I can't claim to have matched its performance purely through my own ingenuity. But it is surprising given the inference code is much simpler, opting for OpenMP over a [global threadpool with spinlock kernel barriers](https://justine.lol/matmul/#threads). I'm hoping that in addition to serving as a testbed for myself, this gives a good base for others to hack on.\n\n# Instructions\n\ndeepseek.cpp requires a computer with a C++20-compatible compiler. You'll also need a directory containing LLM safetensor weights and configuration files in huggingface format, which you'll need to convert by providing a directory into which `.dseek` files containing the converted weights will go. Follow the below to download DeepSeek-V2-Lite, build `deepseek.cpp`, and run it:\n\n```\n# install git LFS and build tools\ncurl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash\nsudo apt-get -y install git-lfs python3-dev build-essential\n# download DeepSeek-V2-Lite\ngit clone https://huggingface.co/deepseek-ai/DeepSeek-V2-Lite\n# clone this repository\ngit clone https://github.com/andrewkchan/deepseek.cpp.git\n\ncd deepseek.cpp\npip install .\npython convert.py --quant fp16 v2-lite-f16 ../DeepSeek-V2-Lite/\n./build/main v2-lite-f16 -i \"What is a large language model?\" -m c -t 1.0\n```\n\n## Usage\n\nSee the CLI help documentation below for `./build/main`:\n\n```\nUsage:   main <checkpoint_dir> [options]\nExample: main model_weights_dir/ -i \"Q: What is the meaning of life?\"\nOptions:\n  -h Display this help message\n  -L Locks model weights to RAM, disabling swap. Requires sudo.\n  -m [completion,passkey,perplexity,interactive] which mode to run in (default - completion)\n  -T <int> sliding window context length (0 - max)\n\nPerplexity mode options:\n  Choose one:\n    -i <string> input prompt\n    -f <filepath> input file with prompt\n    -w use wikitext as input\nCompletion mode options:\n  -n <int>    number of steps to run for in completion mode, default 256. 0 = max_seq_len, -1 = infinite\n  Choose one:\n    -i <string> input prompt\n    -t <float> temperature (default - 1.0)\n    -p <float> p for top-p sampling (default - 0.95)\n    -f <filepath> input file with prompt\nPasskey mode options:\n  -n <int>    number of junk lines to insert (default - 250)\n  -l <int>    passkey position (-1 - random)\n```\n\nYou will likely need to tune the number of OpenMP threads to achieve good performance. For example: \n```\nOMP_NUM_THREADS=32 ./build/main <...args>\n```\n\nThe default OpenMP thread count can result in severely degraded throughput, likely due to thread contention. I have found a good heuristic to be half the number of cores.\n\n## Notes\n\n- `--quant=f8e5m2` specifies model weight quantization using 128x128 blocks. MoE gates and layer norms are left in full precision. This should provide better accuracy than per-tensor quantization or the naive truncating quantization done by `yalm` (which results in nonsensical output for the DeepSeek family of models).\n- `--quant=q2_k` and `--quant=q3_k` specify model weight quantization using the 2-bit and 3-bit llama.cpp [K-quantization schemes](https://github.com/ggml-org/llama.cpp/pull/1684), which use a two-level hierarchy of blocks and super-blocks to store scales/biases for ranges of weights.\n- The models have a tendency to repeat themselves and get into infinite loops at lower temperatures. In my testing, a temperature of ~1.0 avoids this failure mode but also keeps the models reasonably grounded.\n- Some new, optional architectural features (e.g. the `noaux_tc` method of expert selection) of DeepSeek V3 have not yet been implemented, so the model accuracy may be lower than the reference model.\n- You will need ~650GB of memory to run DeepSeek V3 in F8E5M2, or 206GB for 2-bit Q2_K. For best performance, you should ensure there is enough physical RAM available and run as `sudo` with `-L` to force weights to stay in RAM, but otherwise, most operating systems will also automatically supplement this with swap space (storing some memory on disk and some in RAM) at the cost of severely degraded token throughput. More aggressive quantization methods such as [1.58-bit](https://unsloth.ai/blog/deepseekr1-dynamic) are planned.\n- Model quality is not stable because I've been using this repository as an experiment testbed. See (https://github.com/andrewkchan/deepseek.cpp/pull/14) for the latest perplexity measurements on DeepSeek-V2-Lite as well as instructions on how to run standard measurements yourself. Known issues impacting generation quality include the tokenizer (which is not a true BPE tokenizer) and the use of attention sinks rather than yarn (https://github.com/andrewkchan/deepseek.cpp/pull/15).\n- Only decoding (e.g. incremental, iterative generation or reading of one token at a time) has been implemented. Prefills (reading a batch of prompt tokens in a single pass) have not been implemented, nor prefill-based optimizations for the decoding phase such as speculative decoding or multi-token prediction. Finally, the current multi-latent attention implementation is still slower than multi-latent attention in surprising scenarios (https://github.com/andrewkchan/deepseek.cpp/pull/8) and appears to be under-utilizing memory bandwidth. I have limited time to implement these optimizations as this is a side project for me, but PRs are welcome!"
  },
  {
    "path": "convert.py",
    "content": "# Converts a model consisting of a huggingface config.json, tokenizer.json, and .safetensors weights into a .yalm file,\n# which:\n# - Normalizes the config to a common format in the header\n# - Combines any safetensors shards\n# - Reads the token vocabulary into a simpler format\n# - Performs quantization if specified\n\nimport argparse\nimport os\nimport json\nimport safetensors\nfrom safetensors.torch import save_file\nimport torch\n\nfrom quantizer import k_quantize\n\nfrom typing import Tuple, List, Literal, Union\nimport dataclasses\n\nSUPPORTED_ARCHITECTURES = [\n  \"DeepseekV2ForCausalLM\",\n  \"DeepseekV3ForCausalLM\",\n]\n\n@dataclasses.dataclass\nclass BlockQuant:\n  name: Literal[\"fp32\", \"fp16\", \"f8e5m2\"]\n  block_size: Union[Tuple[int, int], None]\n  dtype: torch.dtype\n\n@dataclasses.dataclass\nclass KQuant:\n  name: Literal[\"q2_k\", \"q3_k\"]\n  dtype: torch.dtype\n\nQuant = Union[BlockQuant, KQuant]\n\nSUPPORTED_QUANTS = {\n  \"fp32\": BlockQuant(name=\"fp32\", block_size=None, dtype=torch.float32),\n  \"fp16\": BlockQuant(name=\"fp16\", block_size=None, dtype=torch.float16),\n  \"f8e5m2\": BlockQuant(name=\"f8e5m2\", block_size=(128, 128), dtype=torch.float8_e5m2),\n  \"q2_k\": KQuant(name=\"q2_k\", dtype=torch.uint8),\n  \"q3_k\": KQuant(name=\"q3_k\", dtype=torch.uint8),\n}\n\nclass Metadata:\n  def __init__(self, config, tokenizer_config, quant, n_layers, use_mla, bsize):\n    arch = config[\"architectures\"][0]\n    if arch not in SUPPORTED_ARCHITECTURES:\n      raise Exception(f\"Architecture {arch} is not supported, must be one of {SUPPORTED_ARCHITECTURES}\")\n    self.arch = arch\n    self.use_mla = bool(use_mla)\n    if quant not in SUPPORTED_QUANTS:\n      raise Exception(f\"Quantization {quant} is not supported, must be one of {SUPPORTED_QUANTS}\")\n    self.quant: Quant = SUPPORTED_QUANTS[quant]\n    if isinstance(self.quant, BlockQuant):\n      is_bsize_configurable = self.quant.block_size is not None\n      if is_bsize_configurable and bsize is not None:\n        self.quant.block_size = (bsize, bsize)\n    if arch in [\"DeepseekV2ForCausalLM\", \"DeepseekV3ForCausalLM\"]:\n      self.dim = config[\"hidden_size\"]\n      self.hidden_dim = config[\"intermediate_size\"]\n      self.n_layers = config[\"num_hidden_layers\"]\n      if n_layers is not None and self.n_layers > n_layers:\n        self.n_layers = n_layers\n      self.n_heads = config[\"num_attention_heads\"]\n      self.vocab_size = config[\"vocab_size\"]\n      self.max_seq_len = tokenizer_config[\"model_max_length\"]\n      self.bos_token_id = config[\"bos_token_id\"]\n      self.eos_token_id = config[\"eos_token_id\"]\n      self.rope_theta = config.get(\"rope_theta\", 10000.0)\n      self.norm_eps = config[\"rms_norm_eps\"]\n      self.norm_type = \"rmsnorm\"\n      \n      # quantization\n      self.original_quantization_config = config.get(\"quantization_config\", None)\n      if self.original_quantization_config is not None:\n        dequant_block_sizes = self.original_quantization_config[\"weight_block_size\"]\n        assert type(dequant_block_sizes) == list and len(dequant_block_sizes) == 2\n        assert self.original_quantization_config[\"quant_method\"] == \"fp8\"\n\n      assert config.get(\"attention_bias\", False) == False\n      assert config.get(\"mlp_bias\", False) == False\n\n      assert config[\"hidden_act\"] in [\"gelu\", \"silu\"]\n      self.act_type = config[\"hidden_act\"]\n      self.first_k_dense_replace = config[\"first_k_dense_replace\"]\n\n      # multi-latent attention\n      self.kv_lora_rank = config[\"kv_lora_rank\"]\n      self.q_lora_rank = config[\"q_lora_rank\"] or 0\n      if self.use_mla:\n        # TODO: support MLA with q_lora_rank == 0 (DeepSeek V2 Lite)\n        assert self.q_lora_rank > 0 and self.kv_lora_rank > 0\n      self.qk_nope_head_dim = config[\"qk_nope_head_dim\"]\n      self.qk_rope_head_dim = config[\"qk_rope_head_dim\"]\n      self.v_head_dim = config[\"v_head_dim\"]\n\n      # mixture of experts\n      self.n_shared_experts = config[\"n_shared_experts\"]\n      self.n_routed_experts = config[\"n_routed_experts\"]\n      self.n_active_routed = config[\"num_experts_per_tok\"]\n      self.moe_intermediate_size = config[\"moe_intermediate_size\"]\n      self.routed_scaling_factor = config[\"routed_scaling_factor\"]\n      self.n_group = config[\"n_group\"]\n      self.norm_topk_prob = config[\"norm_topk_prob\"]\n      self.scoring_func = config[\"scoring_func\"]\n      self.topk_group = config[\"topk_group\"]\n      self.topk_method = config[\"topk_method\"]\n      if self.topk_method == \"noaux_tc\":\n        self.topk_method = \"group_limited_greedy\" # TODO: support for Deepseek v3\n      \n      # rope\n      rope_scaling = config[\"rope_scaling\"]\n      assert rope_scaling[\"type\"] == \"yarn\"\n      self.rope_scaling_beta_fast = rope_scaling[\"beta_fast\"]\n      self.rope_scaling_beta_slow = rope_scaling[\"beta_slow\"]\n      self.rope_scaling_factor = rope_scaling[\"factor\"]\n      self.rope_scaling_mscale = rope_scaling[\"mscale\"]\n      self.rope_scaling_mscale_all_dim = rope_scaling[\"mscale_all_dim\"]\n      self.rope_scaling_original_max_position_embeddings = rope_scaling[\"original_max_position_embeddings\"]\n  \n  def to_dict(self):\n    result = {}\n    result[\"arch\"] = self.arch\n    result[\"use_mla\"] = str(int(self.use_mla))\n    result[\"quant\"] = self.quant.name\n    if self.arch in [\"DeepseekV2ForCausalLM\", \"DeepseekV3ForCausalLM\"]:\n      result[\"dim\"] = str(self.dim)\n      result[\"hidden_dim\"] = str(self.hidden_dim)\n      result[\"n_layers\"] = str(self.n_layers)\n      result[\"n_heads\"] = str(self.n_heads)\n      result[\"vocab_size\"] = str(self.vocab_size)\n      result[\"max_seq_len\"] = str(self.max_seq_len)\n      result[\"bos_token_id\"] = str(self.bos_token_id)\n      result[\"eos_token_id\"] = str(self.eos_token_id)\n      result[\"rope_theta\"] = str(self.rope_theta)\n      result[\"norm_eps\"] = str(self.norm_eps)\n      result[\"norm_type\"] = str(self.norm_type)\n      result[\"act_type\"] = str(self.act_type)\n      result[\"first_k_dense_replace\"] = str(self.first_k_dense_replace)\n      # quantization\n      if isinstance(self.quant, BlockQuant) and self.quant.block_size is not None:\n        result[\"quantization_block_size_0\"] = str(self.quant.block_size[0])\n        result[\"quantization_block_size_1\"] = str(self.quant.block_size[1])\n      # multi-latent attention\n      result[\"kv_lora_rank\"] = str(self.kv_lora_rank)\n      result[\"q_lora_rank\"] = str(self.q_lora_rank)\n      result[\"qk_nope_head_dim\"] = str(self.qk_nope_head_dim)\n      result[\"qk_rope_head_dim\"] = str(self.qk_rope_head_dim)\n      result[\"v_head_dim\"] = str(self.v_head_dim)\n      # mixture of experts\n      result[\"n_shared_experts\"] = str(self.n_shared_experts)\n      result[\"n_routed_experts\"] = str(self.n_routed_experts)\n      result[\"n_active_routed\"] = str(self.n_active_routed)\n      result[\"moe_intermediate_size\"] = str(self.moe_intermediate_size)\n      result[\"routed_scaling_factor\"] = str(self.routed_scaling_factor)\n      result[\"n_group\"] = str(self.n_group)\n      result[\"norm_topk_prob\"] = str(self.norm_topk_prob)\n      result[\"scoring_func\"] = str(self.scoring_func)\n      result[\"topk_group\"] = str(self.topk_group)\n      result[\"topk_method\"] = str(self.topk_method)\n      # rope scaling\n      result[\"rope_scaling_beta_fast\"] = str(self.rope_scaling_beta_fast)\n      result[\"rope_scaling_beta_slow\"] = str(self.rope_scaling_beta_slow)\n      result[\"rope_scaling_factor\"] = str(self.rope_scaling_factor)\n      result[\"rope_scaling_mscale\"] = str(self.rope_scaling_mscale)\n      result[\"rope_scaling_mscale_all_dim\"] = str(self.rope_scaling_mscale_all_dim)\n      result[\"rope_scaling_original_max_position_embeddings\"] = str(self.rope_scaling_original_max_position_embeddings)\n    return result\n\n# this is a horrible gpt-2 unicode byte encoder hack from https://github.com/openai/gpt-2/blob/master/src/encoder.py#L9\n# this has poisoned all HF tokenizer configs that use ByteLevel decoder/preprocessor\n# as a result we get crazy UTF-8-as-bytes-as-UTF8 in the tokenizer data that we need to convert back\ndef gpt2_bytes_to_unicode():\n  bs = list(range(ord(\"!\"), ord(\"~\")+1))+list(range(ord(\"¡\"), ord(\"¬\")+1))+list(range(ord(\"®\"), ord(\"ÿ\")+1))\n  cs = bs[:]\n  n = 0\n  for b in range(2**8):\n    if b not in bs:\n      bs.append(b)\n      cs.append(2**8+n)\n      n += 1\n  cs = [chr(n) for n in cs]\n  return dict(zip(bs, cs))\n\ndef load_tokens(tokenizer_path, vocab_size):\n  tokens = [\"\"] * vocab_size\n  with open(tokenizer_path, \"r\") as f:\n    tokenizer = json.load(f)\n  use_gpt2_byte_preprocessing = not tokenizer[\"model\"].get(\"byte_fallback\", False)\n  \n  vocab = tokenizer[\"model\"][\"vocab\"]\n  assert len(vocab) <= vocab_size\n\n  for t, i in vocab.items():\n    tokens[i] = t\n  \n  for added in tokenizer[\"added_tokens\"]:\n    tokens[added[\"id\"]] = added[\"content\"]\n  \n  gpt2_decode = {v: k for k, v in gpt2_bytes_to_unicode().items()}\n  # Preprocess tokens into UTF-8 encoding\n  for i, t in enumerate(tokens):\n    if use_gpt2_byte_preprocessing:\n      b = bytes([gpt2_decode.get(c, 0) for c in t])\n    else:\n      t = t.replace('\\u2581', ' ') # sentencepiece uses this character as whitespace\n      b = t.encode('utf-8')\n    b = b.replace(b\"\\0\", b\"\\7\") # replace null bytes with bell characters\n    assert b.count(0) == 0 # no null bytes allowed\n    tokens[i] = b\n  \n  return tokens\n\ndef per_tensor_quantize(tensor: torch.Tensor, dtype: torch.dtype) -> Tuple[torch.Tensor, torch.Tensor]:\n  \"\"\"Quantize a tensor using per-tensor static scaling factor.\n  Args:\n      tensor: The input tensor.\n      dtype: The data type to quantize to.\n  \"\"\"\n  finfo = torch.finfo(dtype)\n  # Calculate the scale as dtype max divided by absmax.\n  # Since .abs() creates a new tensor, we use aminmax to get\n  # the min and max first and then calculate the absmax.\n  if tensor.numel() == 0:\n    # Deal with empty tensors (triggered by empty MoE experts)\n    min_val, max_val = (\n      torch.tensor(-16.0, dtype=tensor.dtype),\n      torch.tensor(16.0, dtype=tensor.dtype),\n    )\n  else:\n    min_val, max_val = tensor.aminmax()\n  amax = torch.maximum(min_val.abs(), max_val.abs())\n  scale = finfo.max / amax.clamp(min=1e-12)\n  # scale and clamp the tensor to bring it to\n  # the representative range of float8 data type\n  # (as default cast is unsaturated)\n  qweight = (tensor * scale).clamp(min=finfo.min, max=finfo.max)\n  # Return both float8 data and the inverse scale (as float),\n  # as both required as inputs to torch._scaled_mm\n  qweight = qweight.to(dtype)\n  scale = scale.float().reciprocal()\n  return qweight, scale\n\ndef per_tensor_dequantize(qweight: torch.Tensor, scale: torch.Tensor) -> torch.Tensor:\n  assert scale.numel() == 1\n  return qweight.to(torch.float32) * scale\n\ndef blockwise_dequantize(qweight: torch.Tensor, scale: torch.Tensor, block_size: torch.Tensor) -> torch.Tensor:\n  assert qweight.ndim == scale.ndim and scale.ndim == block_size.numel() and scale.ndim == 2\n  assert torch.all((torch.tensor(list(qweight.shape)) / block_size).ceil() == torch.tensor(list(scale.shape)))\n  out = torch.empty_like(qweight, dtype=torch.float32)\n  for i in range(scale.shape[0]):\n    for j in range(scale.shape[1]):\n      block_size_i = block_size[0]\n      block_size_j = block_size[1]\n      qw_block = qweight[i*block_size_i:(i+1)*block_size_i, j*block_size_j:(j+1)*block_size_j]\n      out[i*block_size_i:(i+1)*block_size_i, j*block_size_j:(j+1)*block_size_j] = per_tensor_dequantize(qw_block, scale[i, j])\n  return out\n\ndef blockwise_quantize(weight: torch.Tensor, block_size: torch.Tensor, dtype: torch.dtype) -> Tuple[torch.Tensor, torch.Tensor]:\n  assert weight.ndim == block_size.numel() and weight.ndim == 2\n  scale_shape = torch.Size((torch.tensor(list(weight.shape)) / block_size).ceil().long())\n  scale = torch.empty(scale_shape, dtype=torch.float32)\n  out = torch.empty_like(weight, dtype=dtype)\n  for i in range(scale.shape[0]):\n    for j in range(scale.shape[1]):\n      block_size_i = block_size[0]\n      block_size_j = block_size[1]\n      w_block = weight[i*block_size_i:(i+1)*block_size_i, j*block_size_j:(j+1)*block_size_j]\n      qw_block, scale_block = per_tensor_quantize(w_block, dtype)\n      out[i*block_size_i:(i+1)*block_size_i, j*block_size_j:(j+1)*block_size_j] = qw_block\n      scale[i, j] = scale_block\n  return out, scale\n\ndef per_expert_blockwise_quantize(expert_weights: torch.Tensor, block_size: torch.Tensor, dtype: torch.dtype) -> Tuple[torch.Tensor, torch.Tensor]:\n  assert expert_weights.ndim == 3\n  num_experts = expert_weights.shape[0]\n  output_weights = []\n  scales = []\n  for e in range(num_experts):\n    weight, scale = blockwise_quantize(expert_weights[e], block_size, dtype)\n    output_weights.append(weight)\n    scales.append(scale)\n  return torch.stack(output_weights), torch.stack(scales)\n\ndef per_expert_k_quantize(expert_weights: torch.Tensor, method: Literal[\"q2_k\", \"q3_k\"]) -> torch.Tensor:\n  assert expert_weights.ndim == 3\n  num_experts = expert_weights.shape[0]\n  output_weights = []\n  for e in range(num_experts):\n    output_weights.append(k_quantize(expert_weights[e], method))\n  return torch.stack(output_weights)\n\ndef load_weights(model_files: List[str], metadata: Metadata, tie_word_embeddings: bool, n_layers: int):\n  \"\"\"\n  Generator that yields shards of weights loaded from the model files in huggingface format.\n  Each shard contains a dictionary of tensors, with weights normalized and cast to the specified dtype\n  (except layer norm weights which are converted to float32).\n  \"\"\"\n  weights = {}\n  for model_path in model_files:\n    ext = os.path.splitext(model_path)[1]\n    if ext == \".safetensors\":\n      with safetensors.safe_open(model_path, framework=\"pt\") as f:\n        for k in f.keys():\n          assert(k not in weights)\n          weights[k] = f.get_tensor(k)\n  dtype = metadata.quant.dtype\n\n  # convert weights\n  progress = 0\n  dequant_block_size = None\n  if metadata.original_quantization_config is not None:\n    dequant_block_size = torch.tensor(metadata.original_quantization_config[\"weight_block_size\"])\n  tensors = {}\n\n  def load_and_dequantize(weight_name: str, scale_name: str) -> torch.Tensor:\n    t = weights[weight_name]\n    if scale_name in weights:\n      scale = weights[scale_name]\n      t = blockwise_dequantize(t, scale, dequant_block_size)\n    return t\n  \n  def quantize(t: torch.Tensor) -> Tuple[torch.Tensor, torch.Tensor]:\n    if dtype not in [torch.float32, torch.float16]:\n      if isinstance(metadata.quant, KQuant):\n        t = k_quantize(t.to(torch.float32), metadata.quant.name)\n      elif metadata.quant.block_size is None:\n        return per_tensor_quantize(t, dtype)\n      else:\n        quant_block_size = torch.tensor(metadata.quant.block_size)\n        return blockwise_quantize(t, quant_block_size, dtype)\n    return t.to(dtype), None\n\n  def conv(weight_name: str, scale_name: str) -> Tuple[torch.Tensor, torch.Tensor]:\n    nonlocal progress\n    progress += 1\n    t = load_and_dequantize(weight_name, scale_name)\n    print(f\"\\rConverting tensor {progress}: {t.shape}\", end=\"\", flush=True)\n    return quantize(t)\n  \n  def conv_experts(weight_and_scale_names: List[Tuple[str, str]]) -> Tuple[torch.Tensor, torch.Tensor]:\n    nonlocal progress\n    progress += 1\n    expert_weights = [weights[weight_name] for weight_name, _ in weight_and_scale_names]\n    if weight_and_scale_names[0][1] in weights:\n      for i in range(len(weight_and_scale_names)):\n        scale = weights[weight_and_scale_names[i][1]]\n        expert_weights[i] = blockwise_dequantize(expert_weights[i], scale, dequant_block_size)\n    t = torch.stack(expert_weights)\n    print(f\"\\rConverting tensor {progress}: {t.shape}\", end=\"\", flush=True)\n    if dtype not in [torch.float32, torch.float16]:\n      if isinstance(metadata.quant, KQuant):\n        t = per_expert_k_quantize(t.to(torch.float32), metadata.quant.name)\n      elif metadata.quant.block_size is None:\n        return per_tensor_quantize(t, dtype)\n      else:\n        quant_block_size = torch.tensor(metadata.quant.block_size)\n        return per_expert_blockwise_quantize(t, quant_block_size, dtype)\n    return t.to(dtype), None\n  \n  def save_weight_and_scale(weight_name: str, scale_name: str, weight_and_scale: Tuple[torch.Tensor, torch.Tensor]):\n    tensors[weight_name] = weight_and_scale[0]\n    if weight_and_scale[1] is not None:\n      tensors[scale_name] = weight_and_scale[1]\n\n  save_weight_and_scale(\n    \"model.embed.weight\", \"model.embed.scale\", \n    conv(\"model.embed_tokens.weight\", \"model.embed_tokens.weight_scale_inv\")\n  )\n\n  for l in range(config[\"num_hidden_layers\"]):\n    if l % 8 == 0 and l > 0:\n      yield tensors\n      tensors = {}\n    if n_layers is not None and l >= n_layers:\n      break\n\n    tensors[f\"model.layers.{l}.attn.norm.weight\"] = weights[f\"model.layers.{l}.input_layernorm.weight\"].float()\n    tensors[f\"model.layers.{l}.attn.kv_a_norm.weight\"] = weights[f\"model.layers.{l}.self_attn.kv_a_layernorm.weight\"].float()\n\n    if metadata.use_mla:\n      assert metadata.q_lora_rank > 0\n      head_dim = metadata.qk_nope_head_dim + metadata.qk_rope_head_dim\n      save_weight_and_scale(\n        f\"model.layers.{l}.attn.wkv_a.weight\", f\"model.layers.{l}.attn.wkv_a.scale\", \n        conv(f\"model.layers.{l}.self_attn.kv_a_proj_with_mqa.weight\", f\"model.layers.{l}.self_attn.kv_a_proj_with_mqa.weight_scale_inv\")\n      )\n      save_weight_and_scale(\n        f\"model.layers.{l}.attn.wq_a.weight\", f\"model.layers.{l}.attn.wq_a.scale\", \n        conv(f\"model.layers.{l}.self_attn.q_a_proj.weight\", f\"model.layers.{l}.self_attn.q_a_proj.weight_scale_inv\")\n      )\n      tensors[f\"model.layers.{l}.attn.q_a_norm.weight\"] = weights[f\"model.layers.{l}.self_attn.q_a_layernorm.weight\"].float()\n      # (n_heads, head_dim-qk_rope_head_dim+v_head_dim, kv_lora_rank)\n      kv_b_proj = load_and_dequantize(\n        f\"model.layers.{l}.self_attn.kv_b_proj.weight\", f\"model.layers.{l}.self_attn.kv_b_proj.weight_scale_inv\"\n      ).reshape(\n        metadata.n_heads, -1, metadata.kv_lora_rank\n      )\n      # (n_heads, head_dim, q_lora_rank)\n      q_b_proj = load_and_dequantize(\n        f\"model.layers.{l}.self_attn.q_b_proj.weight\", f\"model.layers.{l}.self_attn.q_b_proj.weight_scale_inv\"\n      ).reshape(\n        metadata.n_heads, -1, metadata.q_lora_rank\n      )\n      # (n_heads, head_dim-qk_rope_head_dim, kv_lora_rank)\n      k_nope_b_proj = kv_b_proj[:, :head_dim-metadata.qk_rope_head_dim]\n      # (n_heads * v_head_dim, kv_lora_rank)\n      v_b_proj = kv_b_proj[:, head_dim-metadata.qk_rope_head_dim:].reshape(\n        metadata.n_heads * metadata.v_head_dim, metadata.kv_lora_rank\n      )\n      # (n_heads, head_dim-qk_rope_head_dim, q_lora_rank)\n      q_nope_b_proj = q_b_proj[:, :head_dim-metadata.qk_rope_head_dim]\n      # (n_heads, qk_rope_head_dim, q_lora_rank)\n      q_rope_b_proj = q_b_proj[:, head_dim-metadata.qk_rope_head_dim:]\n      # (n_heads, kv_lora_rank, q_lora_rank)\n      c_proj = torch.bmm(k_nope_b_proj.transpose(1, 2), q_nope_b_proj)\n      \n      # NOTE: k_rope gets split from kv_a, so there is no k_rope_b_proj\n      save_weight_and_scale(\n        f\"model.layers.{l}.attn.wq_rope_b.weight\", f\"model.layers.{l}.attn.wq_rope_b.scale\", \n        quantize(q_rope_b_proj.reshape(-1, q_rope_b_proj.shape[-1]))\n      )\n      save_weight_and_scale(\n        f\"model.layers.{l}.attn.wc.weight\", f\"model.layers.{l}.attn.wc.scale\", \n        quantize(c_proj.reshape(-1, c_proj.shape[-1]))\n      )\n      \n      save_weight_and_scale(\n        f\"model.layers.{l}.attn.wv_b.weight\", f\"model.layers.{l}.attn.wv_b.scale\",\n        quantize(v_b_proj)\n      )\n      save_weight_and_scale(\n        f\"model.layers.{l}.attn.wo.weight\", f\"model.layers.{l}.attn.wo.scale\", \n        conv(f\"model.layers.{l}.self_attn.o_proj.weight\", f\"model.layers.{l}.self_attn.o_proj.weight_scale_inv\")\n      )\n    else:\n      save_weight_and_scale(\n        f\"model.layers.{l}.attn.wkv_a.weight\", f\"model.layers.{l}.attn.wkv_a.scale\", \n        conv(f\"model.layers.{l}.self_attn.kv_a_proj_with_mqa.weight\", f\"model.layers.{l}.self_attn.kv_a_proj_with_mqa.weight_scale_inv\")\n      )\n      save_weight_and_scale(\n        f\"model.layers.{l}.attn.wkv_b.weight\", f\"model.layers.{l}.attn.wkv_b.scale\", \n        conv(f\"model.layers.{l}.self_attn.kv_b_proj.weight\", f\"model.layers.{l}.self_attn.kv_b_proj.weight_scale_inv\")\n      )\n      save_weight_and_scale(\n        f\"model.layers.{l}.attn.wo.weight\", f\"model.layers.{l}.attn.wo.scale\", \n        conv(f\"model.layers.{l}.self_attn.o_proj.weight\", f\"model.layers.{l}.self_attn.o_proj.weight_scale_inv\")\n      )\n      if metadata.q_lora_rank > 0:\n        save_weight_and_scale(\n          f\"model.layers.{l}.attn.wq_a.weight\", f\"model.layers.{l}.attn.wq_a.scale\", \n          conv(f\"model.layers.{l}.self_attn.q_a_proj.weight\", f\"model.layers.{l}.self_attn.q_a_proj.weight_scale_inv\")\n        )\n        save_weight_and_scale(\n          f\"model.layers.{l}.attn.wq_b.weight\", f\"model.layers.{l}.attn.wq_b.scale\", \n          conv(f\"model.layers.{l}.self_attn.q_b_proj.weight\", f\"model.layers.{l}.self_attn.q_b_proj.weight_scale_inv\")\n        )\n        tensors[f\"model.layers.{l}.attn.q_a_norm.weight\"] = weights[f\"model.layers.{l}.self_attn.q_a_layernorm.weight\"].float()\n      else:\n        save_weight_and_scale(\n          f\"model.layers.{l}.attn.wq.weight\", f\"model.layers.{l}.attn.wq.scale\", \n          conv(f\"model.layers.{l}.self_attn.q_proj.weight\", f\"model.layers.{l}.self_attn.q_proj.weight_scale_inv\")\n        )\n\n    tensors[f\"model.layers.{l}.mlp.norm.weight\"] = weights[f\"model.layers.{l}.post_attention_layernorm.weight\"].float()\n\n    if l < metadata.first_k_dense_replace:\n      save_weight_and_scale(\n        f\"model.layers.{l}.mlp.w1.weight\", f\"model.layers.{l}.mlp.w1.scale\", \n        conv(f\"model.layers.{l}.mlp.gate_proj.weight\", f\"model.layers.{l}.mlp.gate_proj.weight_scale_inv\")\n      )\n      save_weight_and_scale(\n        f\"model.layers.{l}.mlp.w2.weight\", f\"model.layers.{l}.mlp.w2.scale\", \n        conv(f\"model.layers.{l}.mlp.down_proj.weight\", f\"model.layers.{l}.mlp.down_proj.weight_scale_inv\")\n      )\n      save_weight_and_scale(\n        f\"model.layers.{l}.mlp.w3.weight\", f\"model.layers.{l}.mlp.w3.scale\", \n        conv(f\"model.layers.{l}.mlp.up_proj.weight\", f\"model.layers.{l}.mlp.up_proj.weight_scale_inv\")\n      )\n    else:\n      tensors[f\"model.layers.{l}.moegate.weight\"] = weights[f\"model.layers.{l}.mlp.gate.weight\"].float()\n      if metadata.arch == \"DeepseekV3ForCausalLM\":\n        tensors[f\"model.layers.{l}.moegate.bias\"] = weights[f\"model.layers.{l}.mlp.gate.e_score_correction_bias\"].float()\n      \n      save_weight_and_scale(\n        f\"model.layers.{l}.mlp.w1.weight\", f\"model.layers.{l}.mlp.w1.scale\", \n        conv_experts([\n          (f\"model.layers.{l}.mlp.experts.{e}.gate_proj.weight\", f\"model.layers.{l}.mlp.experts.{e}.gate_proj.weight_scale_inv\") \n          for e in range(metadata.n_routed_experts)\n        ])\n      )\n      save_weight_and_scale(\n        f\"model.layers.{l}.mlp.w2.weight\", f\"model.layers.{l}.mlp.w2.scale\", \n        conv_experts([\n          (f\"model.layers.{l}.mlp.experts.{e}.down_proj.weight\", f\"model.layers.{l}.mlp.experts.{e}.down_proj.weight_scale_inv\") \n          for e in range(metadata.n_routed_experts)\n        ])\n      )\n      save_weight_and_scale(\n        f\"model.layers.{l}.mlp.w3.weight\", f\"model.layers.{l}.mlp.w3.scale\", \n        conv_experts([\n          (f\"model.layers.{l}.mlp.experts.{e}.up_proj.weight\", f\"model.layers.{l}.mlp.experts.{e}.up_proj.weight_scale_inv\") \n          for e in range(metadata.n_routed_experts)\n        ])\n      )\n      save_weight_and_scale(\n        f\"model.layers.{l}.shared_mlp.w1.weight\", f\"model.layers.{l}.shared_mlp.w1.scale\", \n        conv(f\"model.layers.{l}.mlp.shared_experts.gate_proj.weight\", f\"model.layers.{l}.mlp.shared_experts.gate_proj.weight_scale_inv\")\n      )\n      save_weight_and_scale(\n        f\"model.layers.{l}.shared_mlp.w2.weight\", f\"model.layers.{l}.shared_mlp.w2.scale\", \n        conv(f\"model.layers.{l}.mlp.shared_experts.down_proj.weight\", f\"model.layers.{l}.mlp.shared_experts.down_proj.weight_scale_inv\")\n      )\n      save_weight_and_scale(\n        f\"model.layers.{l}.shared_mlp.w3.weight\", f\"model.layers.{l}.shared_mlp.w3.scale\", \n        conv(f\"model.layers.{l}.mlp.shared_experts.up_proj.weight\", f\"model.layers.{l}.mlp.shared_experts.up_proj.weight_scale_inv\")\n      )\n\n  tensors[\"model.norm.weight\"] = weights[\"model.norm.weight\"].float()\n  if tie_word_embeddings == False:\n    save_weight_and_scale(\n      \"model.output.weight\", \"model.output.scale\", \n      conv(\"lm_head.weight\", \"lm_head.weight_scale_inv\")\n    )\n  else:\n    # Model output classifier just uses the word embeddings matrix\n    pass\n\n  print()  # newline\n  yield tensors\n\nif __name__ == \"__main__\":\n  argp = argparse.ArgumentParser()\n  argp.add_argument(\"output_dir\", type=str)\n  argp.add_argument(\"input\", type=str, nargs=\"?\")\n  argp.add_argument(\"--mla\", action=\"store_true\")\n  argp.add_argument(\"--quant\", type=str, default=\"fp16\", choices=SUPPORTED_QUANTS)\n  argp.add_argument(\"--bsize\", type=int, default=None, help=\"block size for blockwise quantization\")\n  argp.add_argument(\"--n-layers\", type=int, default=None, help=\"number of layers to convert (if None, convert all)\")\n  args = argp.parse_args()\n\n  if os.path.exists(args.output_dir) and not os.path.isdir(args.output_dir):\n    argp.error(f\"output directory {args.output_dir} already exists and is not a directory\")\n  os.makedirs(args.output_dir, exist_ok=True)\n\n  if args.input is not None:\n    # Input is a directory with HuggingFace layout, e.g. files:\n    #   config.json\n    #   tokenizer.json\n    #   *.safetensors\n    args.config = os.path.join(args.input, \"config.json\")\n    if not os.path.exists(args.config):\n      argp.error(f\"config.json not found in {args.input}\")\n    \n    args.tokenizer = os.path.join(args.input, \"tokenizer.json\")\n    if not os.path.exists(args.tokenizer):\n      argp.error(f\"tokenizer.json not found in {args.input}\")\n    \n    args.tokenizer_config = os.path.join(args.input, \"tokenizer_config.json\")\n    if not os.path.exists(args.tokenizer_config):\n      argp.error(f\"tokenizer_config.json not found in {args.input}\")\n    \n    files = os.listdir(args.input)\n    args.models = [os.path.join(args.input, fname) for fname in files if os.path.splitext(fname)[1] == \".safetensors\"]\n    if len(args.models) == 0:\n      argp.error(f\"no .safetensors files found in {args.input}\")\n  else:\n    argp.error(\"argument input is required\")\n\n  with open(args.tokenizer_config, \"r\") as f:\n    tokenizer_config = json.load(f)\n  with open(args.config, \"r\") as f:\n    config = json.load(f)\n  metadata = Metadata(config, tokenizer_config,args.quant, args.n_layers, args.mla, args.bsize)\n\n  tokens = load_tokens(args.tokenizer, metadata.vocab_size)\n  \n  # Process and save weight shards\n  for shard_idx, shard in enumerate(load_weights(args.models, metadata, config.get(\"tie_word_embeddings\", None), args.n_layers)):\n    if shard_idx == 0:\n      shard[\"tokenizer.tokens\"] = torch.cat([torch.tensor([x for x in b] + [0], dtype=torch.uint8) for b in tokens])\n      save_file(shard, os.path.join(args.output_dir, f\"shard_{shard_idx:03d}.dseek\"), metadata.to_dict())\n    else:\n      save_file(shard, os.path.join(args.output_dir, f\"shard_{shard_idx:03d}.dseek\"), {})\n    print(f\"\\nSaved shard {shard_idx}\", flush=True)"
  },
  {
    "path": "pyproject.toml",
    "content": "[build-system]\nrequires = [\"setuptools>=42\", \"wheel\", \"torch>=2.0.0\", \"ninja\", \"numpy\"]\nbuild-backend = \"setuptools.build_meta\" \n[project]\nname = \"deepseek-cpp\"\nversion = \"0.1.0\"\nrequires-python = \">=3.8\"\ndependencies = [\n    \"safetensors\",\n    \"torch>=2.0.0\",\n    \"ninja\",\n    \"numpy\"\n]"
  },
  {
    "path": "quantizer.cpp",
    "content": "#include <torch/extension.h>\n#include \"quant.h\"\n\ntorch::Tensor quantize_q2_k(torch::Tensor& input) {\n  // Row-major quantization (equivalent to block size [1, 256]) \n  // of input tensor using Q2_K scheme.\n  TORCH_CHECK(input.ndimension() == 2, \"input must be 2D\");\n  TORCH_CHECK(input.size(1) % QK_K == 0, \"ncols must be divisible by QK_K\");\n  TORCH_CHECK(input.dtype() == torch::kFloat32, \"input must be float32\");\n  if (!input.is_contiguous()) {\n    input = input.contiguous();\n  }\n  const int64_t nrows = input.size(0);\n  const int64_t ncols = input.size(1);\n  const int64_t blocks_per_row = ncols / QK_K;\n  const int64_t block_size = sizeof(block_q2_K);\n  \n  auto options = torch::TensorOptions().dtype(torch::kUInt8).device(torch::kCPU);\n  auto output = torch::empty({nrows, blocks_per_row * block_size}, options);\n  \n  const float* input_ptr = input.data_ptr<float>();\n  uint8_t* output_ptr = output.data_ptr<uint8_t>();\n\n  // Parallelize over rows\n  #pragma omp parallel for\n  for (int64_t row = 0; row < nrows; row++) {\n    const float* row_input = input_ptr + row * ncols;\n    block_q2_K* row_output = reinterpret_cast<block_q2_K*>(output_ptr + row * blocks_per_row * block_size);\n\n    quantize_row_q2_K_ref(row_input, row_output, ncols);\n  }\n  \n  return output;\n}\n\ntorch::Tensor quantize_q3_k(torch::Tensor& input) {\n  // Row-major quantization (equivalent to block size [1, 256]) \n  // of input tensor using Q3_K scheme.\n  TORCH_CHECK(input.ndimension() == 2, \"input must be 2D\");\n  TORCH_CHECK(input.size(1) % QK_K == 0, \"ncols must be divisible by QK_K\");\n  TORCH_CHECK(input.dtype() == torch::kFloat32, \"input must be float32\");\n  if (!input.is_contiguous()) {\n    input = input.contiguous();\n  }\n  const int64_t nrows = input.size(0);\n  const int64_t ncols = input.size(1);\n  const int64_t blocks_per_row = ncols / QK_K;\n  const int64_t block_size = sizeof(block_q3_K);\n  \n  auto options = torch::TensorOptions().dtype(torch::kUInt8).device(torch::kCPU);\n  auto output = torch::empty({nrows, blocks_per_row * block_size}, options);\n  \n  const float* input_ptr = input.data_ptr<float>();\n  uint8_t* output_ptr = output.data_ptr<uint8_t>();\n\n  // Parallelize over rows\n  #pragma omp parallel for\n  for (int64_t row = 0; row < nrows; row++) {\n    const float* row_input = input_ptr + row * ncols;\n    block_q3_K* row_output = reinterpret_cast<block_q3_K*>(output_ptr + row * blocks_per_row * block_size);\n\n    quantize_row_q3_K_ref(row_input, row_output, ncols);\n  }\n  \n  return output;\n}\n\nPYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {\n  m.def(\"quantize_q2_k\", &quantize_q2_k, \"Quantize a tensor to Q2_K format\");\n  m.def(\"quantize_q3_k\", &quantize_q3_k, \"Quantize a tensor to Q3_K format\");\n} "
  },
  {
    "path": "quantizer.py",
    "content": "import torch\nimport quantizer_cpp\nfrom typing import Literal\n\ndef k_quantize(tensor: torch.Tensor, method: Literal[\"q2_k\", \"q3_k\"]) -> torch.Tensor:\n  \"\"\"\n  Quantize a 2D float32 tensor to Q2_K or Q3_K format.\n  \n  Args:\n    tensor: Input tensor of shape (M, N) where N must be a multiple of 256\n  \n  Returns:\n    Quantized tensor of type uint8 and shape (M, sizeof(block_q2_K) * N/256) containing the block_q2_K data\n  \"\"\" \n  if method == \"q2_k\":\n    return quantizer_cpp.quantize_q2_k(tensor) \n  elif method == \"q3_k\":\n    return quantizer_cpp.quantize_q3_k(tensor) \n  else:\n    raise ValueError(f\"Invalid method: {method}\")\n"
  },
  {
    "path": "setup.py",
    "content": "from setuptools import setup\nfrom torch.utils.cpp_extension import BuildExtension, CppExtension\nfrom setuptools.dist import Distribution\nimport os\n\nclass BinaryDistribution(Distribution):\n    def has_ext_modules(self):\n        return True\n\nsetup(\n  name=\"quantizer_cpp\",\n  ext_modules=[\n    CppExtension(\n      name=\"quantizer_cpp\",\n      sources=[\"quantizer.cpp\", \"src/quant.cpp\"],\n      include_dirs=[\n        os.path.join(os.path.dirname(__file__), \"src\"), \n        os.path.join(os.path.dirname(__file__), \"vendor\")\n      ],\n      extra_compile_args=[\"-O3\", \"-march=native\", \"-std=c++20\", \"-fopenmp\"],\n      extra_link_args=[\"-fopenmp\"],\n    ),\n  ],\n  cmdclass={\n    'build_ext': BuildExtension\n  },\n  python_requires='>=3.8',\n  install_requires=[\n    'torch>=2.0.0',\n  ],\n  setup_requires=[\n    'torch>=2.0.0',\n    'ninja',\n    'numpy',\n  ],\n  distclass=BinaryDistribution,\n)"
  },
  {
    "path": "src/codec.cpp",
    "content": "#include \"codec.h\"\n\n#include \"quant.h\"\n\n#include \"fmt/format.h\"\n\n#include <fcntl.h>\n#include <iostream>\n#include <sys/mman.h>\n#include <sys/stat.h>\n#include <unistd.h>\n\nstd::string quant_to_string(Quant quant) {\n  switch (quant) {\n    case Quant::F32: return \"F32\";\n    case Quant::F16: return \"F16\";\n    case Quant::F8E5M2: return \"F8_E5M2\";\n    case Quant::Q2_K: return \"Q2_K\";\n    case Quant::Q3_K: return \"Q3_K\";\n  }\n  __builtin_unreachable();\n}\n\nstd::optional<Quant> string_to_quant(const std::string& quant_str) {\n  if (quant_str == \"F32\") {\n    return Quant::F32;\n  } else if (quant_str == \"F16\") {\n    return Quant::F16;\n  } else if (quant_str == \"F8_E5M2\") {\n    return Quant::F8E5M2;\n  } else if (quant_str == \"Q2_K\") {\n    return Quant::Q2_K;\n  } else if (quant_str == \"Q3_K\") {\n    return Quant::Q3_K;\n  } else {\n    return std::nullopt;\n  }\n}\n\ndouble bits_per_weight(Quant quant, size_t blockwise_quant_size) {\n  if (blockwise_quant_size > 0 && quant != Quant::F8E5M2) {\n    std::cerr << \"blockwise quantization should only be used with F8E5M2\" << std::endl;\n    assert(false);\n  }\n  switch (quant) {\n    case Quant::F32: return 32;\n    case Quant::F16: return 16;\n    case Quant::F8E5M2: return (8 + blockwise_quant_size) / blockwise_quant_size;\n    case Quant::Q2_K: return 2.5625;\n    case Quant::Q3_K: return 3.4375;\n  }\n  __builtin_unreachable();\n}\n\nCodecDType quant_to_codec_dtype(Quant quant) {\n  switch (quant) {\n    case Quant::F32: return CodecDType::F32;\n    case Quant::F16: return CodecDType::F16;\n    case Quant::F8E5M2: return CodecDType::F8E5M2;\n    case Quant::Q2_K: return CodecDType::U8;\n    case Quant::Q3_K: return CodecDType::U8;\n  }\n  __builtin_unreachable();\n}\n\nbool is_k_quant(Quant quant) {\n  return quant == Quant::Q2_K || quant == Quant::Q3_K;\n}\n\nstd::string codec_dtype_to_string(CodecDType dtype) {\n  switch (dtype) {\n    case CodecDType::F32: return \"F32\";\n    case CodecDType::F16: return \"F16\";\n    case CodecDType::BF16: return \"BF16\";\n    case CodecDType::F8E5M2: return \"F8_E5M2\";\n    case CodecDType::F8E4M3: return \"F8_E4M3\";\n    case CodecDType::I32: return \"I32\";\n    case CodecDType::I16: return \"I16\";\n    case CodecDType::I8: return \"I8\";\n    case CodecDType::U8: return \"U8\";\n  }\n  return \"UNKNOWN\";\n}\n\nstd::optional<CodecDType> string_to_codec_dtype(const std::string& dtype_str) {\n  if (dtype_str == \"F32\") {\n    return CodecDType::F32;\n  } else if (dtype_str == \"F16\") {\n    return CodecDType::F16;\n  } else if (dtype_str == \"BF16\") {\n    return CodecDType::BF16;\n  } else if (dtype_str == \"F8_E5M2\") {\n    return CodecDType::F8E5M2;\n  } else if (dtype_str == \"F8_E4M3\") {\n    return CodecDType::F8E4M3;\n  } else if (dtype_str == \"I32\") {\n    return CodecDType::I32;\n  } else if (dtype_str == \"I16\") {\n    return CodecDType::I16;\n  } else if (dtype_str == \"I8\") {\n    return CodecDType::I8;\n  } else if (dtype_str == \"U8\") {\n    return CodecDType::U8;\n  } else {\n    return std::nullopt;\n  }\n}\n\nsize_t codec_dtype_size(CodecDType dtype) {\n  switch (dtype) {\n    case CodecDType::F32: return 4;\n    case CodecDType::F16: return 2;\n    case CodecDType::BF16: return 2;\n    case CodecDType::F8E5M2: return 1;\n    case CodecDType::F8E4M3: return 1;\n    case CodecDType::I32: return 4;\n    case CodecDType::I16: return 2;\n    case CodecDType::I8: return 1;\n    case CodecDType::U8: return 1;\n  }\n  return 0;\n}\n\nint Tensor::from_json(const std::string& name, const json& val, void* bytes_ptr, size_t bytes_size) {\n  this->name = name;\n  std::string dtype_str = val.value(\"dtype\", \"\"); \n  if (auto dtype = string_to_codec_dtype(dtype_str)) {\n    this->dtype = *dtype;\n  } else {\n    std::cerr << \"bad dtype\" << std::endl;\n    return -1;\n  }\n  size_t dsize = codec_dtype_size(this->dtype);\n\n  size_t numel = 1;\n  if (val.at(\"shape\").size() > 4) {\n    std::cerr << \"shape exceeds 4 dimensions\" << std::endl;\n  }\n  for (size_t i = 0; i < val.at(\"shape\").size() && i < 4; i++) {\n    if (val.at(\"shape\")[i].get<int>() != val.at(\"shape\")[i]) {\n      std::cerr << \"bad shape\" << std::endl;\n      return -1;\n    }\n    shape[i] = val.at(\"shape\")[i].get<int>();\n    numel *= shape[i];\n  }\n  if (val.at(\"data_offsets\").size() != 2) {\n    return -1;\n  }\n  size_t offset_start = static_cast<size_t>(val.at(\"data_offsets\")[0]);\n  size_t offset_end = static_cast<size_t>(val.at(\"data_offsets\")[1]);\n  if (offset_start < 0 || offset_end <= offset_start || offset_end > bytes_size) {\n    std::cerr << \"bad offsets\" << std::endl;\n    return -1;\n  }\n  this->data = (char*)bytes_ptr + offset_start;\n  this->size = offset_end - offset_start;\n  // validate the shape matches the size\n  if (numel * dsize != this->size) {\n    std::cerr << \"bad size\" << std::endl;\n    return -1;\n  }\n  return 0;\n}\n\nQTensor QTensor::from_codec_tensor(const Tensor& tensor, Quant weight_quant, std::array<int, 4> shape, const int debug_line) {\n  QTensor qtensor;\n  CodecDType expected_dtype = quant_to_codec_dtype(weight_quant);\n  std::array<int, 4> expected_shape = shape;\n  if (is_k_quant(weight_quant)) {\n    size_t numel = 1;\n    for (int i = 0; i < 4; i++) {\n      if (shape[i] > 0) {\n        numel *= shape[i];\n      }\n    }\n    size_t block_size = sizeof(block_q2_K);\n    switch (weight_quant) {\n      case Quant::Q2_K: {\n        block_size = sizeof(block_q2_K);\n        break;\n      }\n      case Quant::Q3_K: {\n        block_size = sizeof(block_q3_K);\n        break;\n      }\n      default: {}\n    }\n    size_t total_blocks = numel / QK_K;\n    size_t total_bytes = total_blocks * block_size;\n    if (tensor.dtype != expected_dtype || tensor.size != total_bytes) {\n      std::cerr << \"FATAL: tensor mismatch for \" << tensor.name << std::endl;\n      std::cerr \n        << fmt::format(\n          \"expected: dtype={}, size={}\", \n          codec_dtype_to_string(expected_dtype), \n          total_bytes\n        ) \n        << std::endl;\n      std::cerr \n        << fmt::format(\n          \"got: dtype={}, size={}\", \n          codec_dtype_to_string(tensor.dtype), \n          tensor.size\n        ) << std::endl;\n      assert(false);\n    }\n  } else if (tensor.dtype != expected_dtype || tensor.shape != expected_shape) {\n    std::cerr << \"FATAL: tensor mismatch for \" << tensor.name << std::endl;\n    std::cerr \n      << fmt::format(\n        \"expected: dtype={}, shape=[{},{},{},{}]\", \n        codec_dtype_to_string(expected_dtype), \n        expected_shape[0], \n        expected_shape[1], \n        expected_shape[2], \n        expected_shape[3]\n      ) \n      << std::endl;\n    std::cerr \n      << fmt::format(\n        \"got: dtype={}, shape=[{},{},{},{}]\", \n        codec_dtype_to_string(tensor.dtype), \n        tensor.shape[0], tensor.shape[1], tensor.shape[2], tensor.shape[3]\n      ) \n      << std::endl;\n    assert(false);\n  }\n  qtensor.quant = weight_quant;\n  qtensor.shape = shape;\n  qtensor.size = tensor.size;\n  qtensor.data = tensor.data;\n  return qtensor;\n}\n\nsize_t QTensor::ndim() const {\n  for (size_t i = 0; i < shape.size(); i++) {\n    if (shape[i] == 0) {\n      return i;\n    }\n  }\n  return shape.size();\n}\n\nsize_t QTensor::n_elements() const {\n  size_t numel = 1;\n  for (size_t i = 0; i < shape.size(); i++) {\n    if (shape[i] > 0) {\n      numel *= shape[i];\n    }\n  }\n  return numel;\n}\n\nYALMData::YALMData(const std::string& dirname, bool lock_model_weights) {\n  if (from_directory(dirname, lock_model_weights) != 0) {\n    std::cerr << \"failed to load YALMData from directory\" << std::endl;\n    assert(false);\n  }\n}\n\nint YALMData::update_from_file(const std::string& filename, bool read_metadata, bool lock_model_weights) {\n  std::cout << \"loading data from file: \" << filename << std::endl;\n  int fd = open(filename.c_str(), O_RDONLY);\n  if (fd == -1) {\n    return -1;\n  }\n\n  struct stat st;\n  if (fstat(fd, &st) != 0) {\n    close(fd);\n    return -1;\n  }\n  \n  size_t size = st.st_size;\n  int mmap_flags = MAP_PRIVATE;\n  if (lock_model_weights) {\n    // Eagerly load memory-mapped file into memory.\n    // This ensures the mlock call later is locking memory already in RAM.\n    mmap_flags |= MAP_POPULATE;\n  }\n  void* data = mmap(NULL, size, PROT_READ | PROT_WRITE, mmap_flags, fd, 0);\n  if (data == MAP_FAILED) {\n    close(fd);\n    return -1;\n  }\n  if (lock_model_weights && mlock(data, size) != 0) {\n    std::cerr << \"Warning: mlock failed for model data. Performance may be suboptimal. Are you running as sudo?\" << std::endl;\n  }\n\n#ifdef __linux__\n  // increases readahead buffer size, resulting in faster cold loads\n  posix_fadvise(fd, 0, size, POSIX_FADV_SEQUENTIAL);\n#endif\n\n  close(fd);\n\n  // Parse the metadata JSON and the tensors\n  if (size < sizeof(uint64_t)) {\n    munmap(data, size);\n    return -1;\n  }\n\n  uint64_t json_size = *(uint64_t*)data;\n  if (json_size == 0 || json_size > size - sizeof(uint64_t)) {\n    munmap(data, size);\n    return -1;\n  }\n\n  char* json_ptr = (char*)data + sizeof(uint64_t);\n  void* bytes_ptr = (char*)data + sizeof(uint64_t) + json_size;\n  size_t bytes_size = size - sizeof(uint64_t) - json_size;\n\n  std::string json_str(json_ptr, json_size);\n  json header = json::parse(json_str);\n\n  for (auto& [key, val] : header.items()) {\n    if (key == \"__metadata__\" && read_metadata) {\n      metadata = val;\n    } else if (key != \"__metadata__\") {\n      Tensor& tensor = tensors[key];\n      if (tensor.from_json(key, val, bytes_ptr, bytes_size) != 0) {\n        std::cerr << \"failed to parse tensor \" << key << std::endl;\n        munmap(data, size);\n        return -1;\n      }\n    }\n  }\n\n  return 0;\n}\n\nint YALMData::from_directory(const std::string& dirname, bool lock_model_weights) {\n  std::vector<std::string> files;\n  DIR* dir = opendir(dirname.c_str());\n  if (dir == nullptr) {\n    std::cout << \"failed to open directory\" << std::endl;\n    return -1;\n  }\n\n  // Collect all files\n  struct dirent* entry;\n  while ((entry = readdir(dir)) != nullptr) {\n    std::string filename = entry->d_name;\n    // Skip . and .. directory entries\n    if (filename != \".\" && filename != \"..\") {\n      files.push_back(dirname + \"/\" + filename);\n    }\n  }\n  closedir(dir);\n\n  if (files.empty()) {\n    std::cout << \"no files found\" << std::endl;\n    return -1;\n  }\n\n  // Sort files to ensure consistent ordering\n  std::sort(files.begin(), files.end());\n\n  // Read first file with metadata\n  if (update_from_file(files[0], true, lock_model_weights) != 0) {\n    std::cout << \"failed to read metadata\" << std::endl;\n    return -1;\n  }\n\n  std::cout << \"read metadata \" << metadata << std::endl;\n\n  // Read remaining files without metadata\n  for (size_t i = 1; i < files.size(); i++) {\n    if (update_from_file(files[i], false, lock_model_weights) != 0) {\n      std::cout << \"failed to read file \" << files[i] << std::endl;\n      return -1;\n    }\n  }\n\n  return 0;\n}"
  },
  {
    "path": "src/codec.h",
    "content": "#pragma once\n\n#include \"json.hpp\"\n\n#include <array>\n#include <cstdint>\n#include <string>\n#include <unordered_map>\n#include <dirent.h>\n#include <algorithm>\n#include <vector>\n#include <optional>\n\n#include \"immintrin.h\"\n#include \"f16cintrin.h\"\n\nusing json = nlohmann::json;\n\ntypedef uint16_t f16_t;\ntypedef uint8_t f8e5m2_t;\n\n#if defined(__AVX2__) && defined(__F16C__)\ninline float half_to_float(f16_t x) {\n  return _cvtsh_ss(x);\n}\ninline f16_t float_to_half(float x) {\n  return _cvtss_sh(x, 0);\n}\n#else\ninline float half_to_float(f16_t x) {\n  assert(false && \"float16 not supported on this platform\");\n  return 0.0f;\n}\ninline f16_t float_to_half(float x) {\n  assert(false && \"float16 not supported on this platform\");\n  return 0;\n}\n#endif\n\ninline float float8e5m2_to_float(f8e5m2_t x) {\n  f16_t val = 0;\n#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__\n  memcpy(&val, &x, sizeof(f8e5m2_t));\n#else\n  memcpy((char*)&val + sizeof(f8e5m2_t), &x, sizeof(f8e5m2_t));\n#endif\n  return half_to_float(val);\n}\n[[maybe_unused]] inline f8e5m2_t float_to_float8e5m2(float x) {\n  f16_t val = float_to_half(x);\n  f8e5m2_t out;\n#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__\n  memcpy(&out, (char*)&val, sizeof(f8e5m2_t)); // TODO: round instead of truncate?\n#else\n  memcpy(&out, (char*)&val + sizeof(f8e5m2_t), sizeof(f8e5m2_t)); // TODO: round instead of truncate?\n#endif\n  return out;\n}\n\n// Quant of tensors saved in the file.\n// This corresponds to PyTorch tensor dtypes.\nenum class CodecDType {\n  F32,\n  F16,\n  BF16,\n  F8E5M2,\n  F8E4M3,\n  I32,\n  I16,\n  I8,\n  U8,\n};\nstd::string codec_dtype_to_string(CodecDType dtype);\nstd::optional<CodecDType> string_to_codec_dtype(const std::string& dtype_str);\nsize_t codec_dtype_size(CodecDType dtype);\n\n// Internal Quant.\n// This corresponds to the in-memory representation of tensors in the model.\nenum class Quant {\n  F32,\n  F16,\n  F8E5M2,\n  Q2_K, // 2-bit llama.cpp K-quants\n  Q3_K, // 3-bit llama.cpp K-quants\n};\n\nstd::string quant_to_string(Quant quant);\nstd::optional<Quant> string_to_quant(const std::string& quant_str);\ndouble bits_per_weight(Quant quant, size_t blockwise_quant_size);\nCodecDType quant_to_codec_dtype(Quant quant);\nbool is_k_quant(Quant quant);\n\n// Tensor data as read from the file, which serializes tensors\n// in PyTorch format.\nstruct Tensor {\n  std::string name;\n  CodecDType dtype;\n  std::array<int, 4> shape = {0, 0, 0, 0};\n  void* data = nullptr; // not managed by Tensor\n  size_t size; // size in bytes (number of elements * element size)\n\n  // Returns 0 if successful, other if failed\n  int from_json(const std::string& name, const json& j, void* bytes_ptr, size_t bytes_size);\n};\n\n// Tensor with quantization metadata.\nstruct QTensor {\n  Quant quant = Quant::F32;\n  std::array<int, 4> shape = {0, 0, 0, 0};\n  void* data = nullptr; // not managed by QTensor\n  size_t size = 0; // size in bytes\n\n  QTensor() = default;\n  QTensor(Quant quant, std::array<int, 4> shape, void* data, size_t size) : quant(quant), shape(shape), data(data), size(size) {}\n  QTensor(const QTensor& other) = default;\n  static QTensor from_codec_tensor(const Tensor& tensor, Quant weight_quant, std::array<int, 4> shape, const int debug_line);\n\n  size_t ndim() const;\n  size_t n_elements() const;\n};\n\nstruct YALMData {\n  json metadata;\n  std::unordered_map<std::string, Tensor> tensors;\n\n  YALMData(const std::string& dirname, bool lock_model_weights);\n\nprivate:\n  // Update YALMData with tensors from a file\n  // If read_metadata is true, also update metadata from this file\n  // Returns 0 if successful, other if failed\n  int update_from_file(const std::string& filename, bool read_metadata, bool lock_model_weights);\n\n  // Initialize YALMData from all files in a directory\n  // Metadata is read from the first file (in sorted order)\n  // Returns 0 if successful, other if failed\n  int from_directory(const std::string& dirname, bool lock_model_weights);\n};"
  },
  {
    "path": "src/debug.cpp",
    "content": "#include \"debug.h\"\n#include \"model.h\"\n\ntemplate <typename T>\nbool BinaryDumper::save(const std::string& filename, const T* data, size_t count) {\n  std::ofstream file(filename, std::ios::binary);\n  if (!file) return false;\n  \n  // Write count first\n  file.write(reinterpret_cast<const char*>(&count), sizeof(count));\n  // Write T data\n  file.write(reinterpret_cast<const char*>(data), count * sizeof(T));\n  \n  return file.good();\n}\n\ntemplate bool BinaryDumper::save<float>(const std::string&, const float*, size_t);\ntemplate bool BinaryDumper::save<f16_t>(const std::string&, const f16_t*, size_t);\n\ntemplate <typename T>\nstd::vector<T> BinaryDumper::load(const std::string& filename) {\n  std::ifstream file(filename, std::ios::binary);\n  if (!file) return {};\n  \n  // Read count\n  size_t count;\n  file.read(reinterpret_cast<char*>(&count), sizeof(count));\n  \n  // Read T data\n  std::vector<T> data(count);\n  file.read(reinterpret_cast<char*>(data.data()), count * sizeof(T));\n  \n  if (!file.good()) return {};\n  return data;\n}\n\ntemplate std::vector<float> BinaryDumper::load(const std::string&);\ntemplate std::vector<f16_t> BinaryDumper::load(const std::string&);"
  },
  {
    "path": "src/debug.h",
    "content": "#include <fstream>\n#include <vector>\n#include <cstdint>\n#include <iostream>\n\nstruct BinaryDumper {\n  // Save T array to binary file\n  template <typename T>\n  static bool save(const std::string& filename, const T* data, size_t count);\n  \n  // Load T array from binary file\n  template <typename T>\n  static std::vector<T> load(const std::string& filename);\n};"
  },
  {
    "path": "src/infer.cpp",
    "content": "#include \"model.h\"\n\n#include <assert.h>\n#include <cfloat>\n#include <math.h>\n\n#include \"quant.h\"\n#include \"profile.h\"\n\n#if DEBUG_MODEL\n#include \"json.hpp\"\n#include <fstream>\n#include \"fmt/format.h\"\nstatic std::map<std::string, DebugTensor> _debug_map;\nstd::map<std::string, DebugTensor>& debug_map_cpu() {\n  return _debug_map;\n}\ntemplate <typename T>\nstatic std::vector<T> copy_debug_tensor(T* x, size_t size) {\n  std::vector<T> out(size);\n  for (size_t i = 0; i < size; i++) {\n    out[i] = x[i];\n  }\n  return out;\n}\ntemplate <typename T>\nstatic void save_debug_tensor(const std::string& name, T* x, size_t size) {\n  _debug_map[name] = DebugTensor(copy_debug_tensor<T>(x, size));\n}\nvoid dump_debug_map(const std::string& filename) {\n  std::ofstream out(filename);\n  if (!out.is_open()) {\n    fprintf(stderr, \"Failed to open %s for writing\\n\", filename.c_str());\n    return;\n  }\n\n  // Write Python imports\n  out << \"import torch\\n\\n\";\n  out << \"debug_tensors = {\\n\";\n\n  // Iterate through debug map and write each tensor\n  bool first = true;\n  for (const auto& pair : _debug_map) {\n    if (!first) {\n      out << \",\\n\";\n    }\n    first = false;\n\n    const std::string& name = pair.first;\n    const DebugTensor& tensor = pair.second;\n\n    out << \"    '\" << name << \"': torch.tensor([\";\n\n    // Write tensor values\n    bool first_val = true;\n    assert(tensor.data_type == DebugTensor::DataType::F32);\n    for (const auto& val : tensor.data_f32) {\n      if (!first_val) {\n        out << \", \";\n      }\n      first_val = false;\n      \n      // Use scientific notation with high precision\n      out << std::scientific << std::setprecision(8) << val;\n    }\n    \n    out << \"])\";\n  }\n  \n  out << \"\\n}\\n\";\n  out.close();\n}\nvoid dump_debug_map_as_safetensors(const std::string& filename) {\n  std::ofstream out(filename, std::ios::binary);\n  if (!out.is_open()) {\n    fprintf(stderr, \"Failed to open %s for writing\\n\", filename.c_str());\n    return;\n  }\n\n  json header;\n  size_t offset = 0;\n  for (auto& [key, val] : _debug_map) {\n    size_t offset_end = offset;\n    CodecDType dtype = val.data_type == DebugTensor::DataType::F32 ? CodecDType::F32 : CodecDType::F16;\n    if (dtype == CodecDType::F32) {\n      offset_end += val.data_f32.size() * sizeof(float);\n      header[key] = {\n        {\"dtype\", codec_dtype_to_string(dtype)},\n        {\"shape\", {val.data_f32.size()}},\n        {\"data_offsets\", {offset, offset_end}}\n      };\n    } else {\n      offset_end += val.data_f16.size() * sizeof(f16_t);\n      header[key] = {\n        {\"dtype\", codec_dtype_to_string(dtype)},\n        {\"shape\", {val.data_f16.size()}},\n        {\"data_offsets\", {offset, offset_end}}\n      };\n    }\n    offset = offset_end;\n  }\n  header[\"__metadata__\"] = {{\"debug\", \"\"}};\n  std::string header_str = header.dump();\n  // 1. write uint64 (size of json header)\n  uint64_t header_len = static_cast<uint64_t>(header_str.size());\n  out.write(reinterpret_cast<const char*>(&header_len), sizeof(header_len));\n  // 2. write json header\n  out.write(header_str.c_str(), header_len);\n  // 3. write tensor data\n  for (auto& [key, val] : _debug_map) {\n    if (val.data_type == DebugTensor::DataType::F32) {\n      out.write(reinterpret_cast<const char*>(val.data_f32.data()), val.data_f32.size() * sizeof(float));\n    } else {\n      out.write(reinterpret_cast<const char*>(val.data_f16.data()), val.data_f16.size() * sizeof(f16_t));\n    }\n  }\n  out.close();\n}\n#endif\n\nstatic void _matmul(\n  float* xout, float* x, float* w, int n, int d, \n  const int* block_size, float* scale,\n  void* unused_aqb\n) {\n  // W (d,n) @ x (n,) -> xout (d,)\n  (void)unused_aqb;\n  static float one = 1.0f;\n  int dummy_block_size[2] = {d, n};\n  if (scale == nullptr) {\n    scale = &one;\n    block_size = dummy_block_size;\n  }\n  int scale_num_cols = (n + block_size[1] - 1) / block_size[1];\n  for (int scale_i = 0; scale_i < cdiv(d, block_size[0]); scale_i++) {\n    int ii;\n#pragma omp parallel for private(ii)\n    for (ii = 0; ii < block_size[0]; ii++) {\n      int i = scale_i * block_size[0] + ii;\n      if (i >= d) {\n        continue;\n      }\n      float val = 0.0f;\n      for (int scale_j = 0; scale_j < cdiv(n, block_size[1]); scale_j++) {\n        float scale_val = scale[scale_i * scale_num_cols + scale_j];\n        for (int jj = 0; jj < block_size[1]; jj++) {\n          int j = scale_j * block_size[1] + jj;\n          if (j >= n) {\n            break;\n          }\n          val += (w[i * n + j] * x[j]) * scale_val;\n        }\n      }\n      xout[i] = val;\n    }\n  }\n}\n\n// matmul supporting float16 weights via the F16C extension, which allows\n// conversion into float32 values before calculations.\nstatic void _matmul(\n  float* xout, float* x, f16_t* w, int n, int d, \n  const int* block_size, float* scale,\n  void* unused_aqb\n) {\n  (void)unused_aqb;\n#if defined(__AVX2__) && defined(__F16C__)\n  // W (d,n) @ x (n,) -> xout (d,)\n  assert(n % 16 == 0);\n  assert(scale == nullptr || block_size[1] % 16 == 0);\n  static float one = 1.0f;\n  int dummy_block_size[2] = {d, n};\n  if (scale == nullptr) {\n    scale = &one;\n    block_size = dummy_block_size;\n  }\n  int scale_num_cols = (n + block_size[1] - 1) / block_size[1];\n  for (int scale_i = 0; scale_i < cdiv(d, block_size[0]); scale_i++) {\n    int ii;\n#pragma omp parallel for private(ii)\n    for (ii = 0; ii < block_size[0]; ii++) {\n      int i = scale_i * block_size[0] + ii;\n      if (i >= d) {\n        continue;\n      }\n      // Vectorized dot product of w[i][:] and x[:] where w is a packed float16 array.\n      __m256 sumlo = _mm256_setzero_ps();\n      __m256 sumhi = _mm256_setzero_ps();\n      for (int scale_j = 0; scale_j < cdiv(n, block_size[1]); scale_j++) {\n        // Broadcast scale_val to all elements of a vector\n        float scale_val = scale[scale_i * scale_num_cols + scale_j];\n        __m256 scale_vec = _mm256_set1_ps(scale_val);\n        for (int jj = 0; jj < block_size[1]; jj+=16) {\n          int j = scale_j * block_size[1] + jj;\n          if (j >= n) {\n            break;\n          }\n          \n          // Extract the next set of 16 float16 weights from `w` and store them\n          // to two separate float32 vectors of width 8 (`wveclo_ps`, `wvechi_ps`)\n          __m256i wvec = _mm256_loadu_si256((__m256i*)&w[i * n + j]);\n          __m128i wveclo = _mm256_extractf128_si256(wvec, 0);\n          __m128i wvechi = _mm256_extractf128_si256(wvec, 1);\n          __m256 wveclo_ps = _mm256_cvtph_ps(wveclo);\n          __m256 wvechi_ps = _mm256_cvtph_ps(wvechi);\n          \n          // Scale the weight vectors\n          wveclo_ps = _mm256_mul_ps(wveclo_ps, scale_vec);\n          wvechi_ps = _mm256_mul_ps(wvechi_ps, scale_vec);\n          \n          // Extract the next two float32 vectors of width 8 `xveclo`, `xvechi` from `x`\n          __m256 xveclo = _mm256_loadu_ps(&x[j]);\n          __m256 xvechi = _mm256_loadu_ps(&x[j + 8]);\n          \n          // Compute vectorized FMAs: sumlo += wveclo * xveclo, sumhi += wvechi * xvechi\n          sumlo = _mm256_fmadd_ps(wveclo_ps, xveclo, sumlo);\n          sumhi = _mm256_fmadd_ps(wvechi_ps, xvechi, sumhi);\n        }\n      }\n      // Horizontally reduce width-8 float32 vectors sumlo, sumhi to a scalar.\n      __m256 sum8 = _mm256_add_ps(sumlo, sumhi);              // sum8[0:8] = sumlo[0:8] + sumhi[0:8]\n      __m128 sum4 = _mm_add_ps(                               // sum4[0:4] = sum8[0:4] + sum8[4:8]\n        _mm256_extractf128_ps(sum8, 0), \n        _mm256_extractf128_ps(sum8, 1)\n      );\n      __m128 sum1 = _mm_dp_ps(sum4, _mm_set1_ps(1.0f), 0xf1); // sum1[0] = dot(sum4, [1,1,1,1])\n      xout[i] = _mm_cvtss_f32(sum1);\n    }\n  }\n#else\n  assert(false && \"float16 not supported on this platform\");\n#endif\n}\n\n// matmul supporting float8e5m2 weights via AVX2 and F16C extensions, which (1) \n// allows vectorized conversion from f8e5m2 to float16 and (2) conversion from \n// float16 to float32 values before calculations.\nstatic void _matmul(\n  float* xout, float* x, f8e5m2_t* w, int n, int d, \n  const int* block_size, float* scale,\n  void* unused_aqb\n) {\n  (void)unused_aqb;\n#if defined(__AVX2__) && defined(__F16C__)\n  // W (d,n) @ x (n,) -> xout (d,)\n  assert(n % 16 == 0);\n  assert(scale == nullptr || block_size[1] % 16 == 0);\n  static float one = 1.0f;\n  int dummy_block_size[2] = {d, n};\n  if (scale == nullptr) {\n    scale = &one;\n    block_size = dummy_block_size;\n  }\n  int scale_num_cols = (n + block_size[1] - 1) / block_size[1];\n  for (int scale_i = 0; scale_i < cdiv(d, block_size[0]); scale_i++) {\n    int ii;\n#pragma omp parallel for private(ii)\n    for (ii = 0; ii < block_size[0]; ii++) {\n      int i = scale_i * block_size[0] + ii;\n      if (i >= d) {\n        continue;\n      }\n      // Vectorized dot product of w[i][:] and x[:] where w is a packed float8e5m2 array.\n      __m256 sumlo = _mm256_setzero_ps();\n      __m256 sumhi = _mm256_setzero_ps();\n      for (int scale_j = 0; scale_j < cdiv(n, block_size[1]); scale_j++) {\n        // Broadcast scale_val to all elements of a vector\n        float scale_val = scale[scale_i * scale_num_cols + scale_j];\n        __m256 scale_vec = _mm256_set1_ps(scale_val);\n        for (int jj = 0; jj < block_size[1]; jj+=16) {\n          int j = scale_j * block_size[1] + jj;\n          if (j >= n) {\n            break;\n          }\n\n          // Extract the next set of 16 float8e5m2 weights from `w` and store them\n          // to two separate float32 vectors of width 8 (`wveclo_ps`, `wvechi_ps`)\n          __m128i wvec = _mm_loadu_si128((__m128i*)&w[i * n + j]);\n          // Take each half of `wvec` which consists of 8 float8e5m2 weights and\n          // pad each 8-bit float8e5m2 value with 8 zeros in the mantissa (least significant bits),\n          // converting to 8 float16 values.\n          __m128i wveclo = _mm_unpacklo_epi8(_mm_setzero_si128(), wvec);\n          __m128i wvechi = _mm_unpackhi_epi8(_mm_setzero_si128(), wvec);\n          // Widen each 8xf16 vector to 8xf32.\n          __m256 wveclo_ps = _mm256_cvtph_ps(wveclo);\n          __m256 wvechi_ps = _mm256_cvtph_ps(wvechi);\n          \n          // Scale the weight vectors\n          wveclo_ps = _mm256_mul_ps(wveclo_ps, scale_vec);\n          wvechi_ps = _mm256_mul_ps(wvechi_ps, scale_vec);\n          \n          // Extract the next two float32 vectors of width 8 `xveclo`, `xvechi` from `x`\n          __m256 xveclo = _mm256_loadu_ps(&x[j]);\n          __m256 xvechi = _mm256_loadu_ps(&x[j + 8]);\n          // Compute vectorized FMAs: sumlo += wveclo * xveclo, sumhi += wvechi * xvechi\n          sumlo = _mm256_fmadd_ps(wveclo_ps, xveclo, sumlo);\n          sumhi = _mm256_fmadd_ps(wvechi_ps, xvechi, sumhi);\n        }\n      }\n      // Horizontally reduce width-8 float32 vectors sumlo, sumhi to a scalar.\n      __m256 sum8 = _mm256_add_ps(sumlo, sumhi);              // sum8[0:8] = sumlo[0:8] + sumhi[0:8]\n      __m128 sum4 = _mm_add_ps(                               // sum4[0:4] = sum8[0:4] + sum8[4:8]\n        _mm256_extractf128_ps(sum8, 0), \n        _mm256_extractf128_ps(sum8, 1)\n      );\n      __m128 sum1 = _mm_dp_ps(sum4, _mm_set1_ps(1.0f), 0xf1); // sum1[0] = dot(sum4, [1,1,1,1])\n      xout[i] = _mm_cvtss_f32(sum1);\n    }\n  }\n#else\n  assert(false && \"float8e5m2 not supported on this platform\");\n#endif\n}\n\nstatic void _matmul(\n  float* xout, float* x, block_q2_K* w, int n, int d, \n  const int* unused_block_size, float* unused_scale,\n  void* aqb\n) {\n  // W (d,n) @ x (n,) -> xout (d,)\n  (void)unused_block_size;\n  (void)unused_scale;\n  size_t blocks_per_row = n / QK_K;\n  block_q8_K* aqb_q8 = (block_q8_K*)aqb;\n  int chunk_size = QK_K * 2;\n  int num_chunks = cdiv(n, chunk_size);\n  {\n    PROFILE_BLOCK(\"quantize_acts\");\n    #pragma omp parallel for\n      for (int i = 0; i < num_chunks; i++) {\n        int start = i * chunk_size;\n        int k = (i == num_chunks - 1) ? (n - start) : chunk_size;\n        if (k > 0) {\n          quantize_row_q8_K_ref(x + start, aqb_q8 + (start/QK_K), k);\n        }\n      }\n  }\n  {\n    PROFILE_BLOCK(\"matmul_w2a8\");\n    int i;\n  #pragma omp parallel for private(i)\n    for (i = 0; i < d; i++) {\n      ggml_vec_dot_q2_K_q8_K(n, xout + i, w + i * blocks_per_row, aqb_q8);\n    }\n  }\n}\n\nstatic void _matmul(\n  float* xout, float* x, block_q3_K* w, int n, int d, \n  const int* unused_block_size, float* unused_scale,\n  void* aqb\n) {\n  // W (d,n) @ x (n,) -> xout (d,)\n  (void)unused_block_size;\n  (void)unused_scale;\n  size_t blocks_per_row = n / QK_K;\n  block_q8_K* aqb_q8 = (block_q8_K*)aqb;\n  int chunk_size = QK_K * 2;\n  int num_chunks = cdiv(n, chunk_size);\n  {\n    PROFILE_BLOCK(\"quantize_acts\");\n    #pragma omp parallel for\n      for (int i = 0; i < num_chunks; i++) {\n        int start = i * chunk_size;\n        int k = (i == num_chunks - 1) ? (n - start) : chunk_size;\n        if (k > 0) {\n          quantize_row_q8_K_ref(x + start, aqb_q8 + (start/QK_K), k);\n        }\n      }\n  }\n  {\n    PROFILE_BLOCK(\"matmul_w3a8\");\n    int i;\n  #pragma omp parallel for private(i)\n    for (i = 0; i < d; i++) {\n      ggml_vec_dot_q3_K_q8_K(n, xout + i, w + i * blocks_per_row, aqb_q8);\n    }\n  }\n}\n\nstatic void matmul(\n  float* xout, float* x, const QTensor& w,\n  const int* block_size, std::optional<QTensor> scale,\n  void* aqb\n) {\n  // W (d,n) @ x (n,) -> xout (d,)\n  int n = w.shape[1];\n  int d = w.shape[0];\n  float* scale_data = nullptr;\n  if (scale) {\n    assert(scale->quant == Quant::F32);\n    scale_data = static_cast<float*>(scale->data);\n  }\n  switch (w.quant) {\n    case Quant::F32: {\n      _matmul(xout, x, static_cast<float*>(w.data), n, d, block_size, scale_data, aqb);\n      break;\n    }\n    case Quant::F16: {\n      _matmul(xout, x, static_cast<f16_t*>(w.data), n, d, block_size, scale_data, aqb);\n      break;\n    }\n    case Quant::F8E5M2: {\n      _matmul(xout, x, static_cast<f8e5m2_t*>(w.data), n, d, block_size, scale_data, aqb);  \n      break;\n    }\n    case Quant::Q2_K: {\n      _matmul(xout, x, static_cast<block_q2_K*>(w.data), n, d, block_size, scale_data, aqb);\n      break;\n    }\n    case Quant::Q3_K: {\n      _matmul(xout, x, static_cast<block_q3_K*>(w.data), n, d, block_size, scale_data, aqb);\n      break;\n    }\n    default: assert(false);\n  }\n}\n\nvoid matmul_unscaled(float* xout, float* x, const QTensor& w) {\n  matmul(xout, x, w, nullptr, std::nullopt, nullptr);\n}\n\nstatic void matmul_expert(\n  float* xout, float* x, \n  const QTensor& w_experts, int expert_index,\n  const int* block_size, std::optional<QTensor> scale_experts,\n  void* aqb\n) {\n  // W_experts (n_experts,d,n)\n  // W (d,n) @ x (n,) -> xout (d,)\n  int n = w_experts.shape[2];\n  int d = w_experts.shape[1];\n  size_t expert_size = n * d;\n  float* scale_data = nullptr;\n  if (scale_experts) {\n    assert(scale_experts->quant == Quant::F32);\n    int expert_scale_size = cdiv(d, block_size[0]) * cdiv(n, block_size[1]);\n    size_t scale_offset = expert_index * expert_scale_size;\n    scale_data = static_cast<float*>(scale_experts->data) + scale_offset;\n  }\n  size_t weight_offset = expert_index * expert_size;\n  if (is_k_quant(w_experts.quant)) {\n    // In K-quants, each element of the weight tensor is a block of QK_K elements\n    weight_offset = weight_offset / QK_K;\n  }\n  switch (w_experts.quant) {\n    case Quant::F32: {\n      _matmul(xout, x, static_cast<float*>(w_experts.data) + weight_offset, n, d, block_size, scale_data, aqb);\n      break;\n    }\n    case Quant::F16: {\n      _matmul(xout, x, static_cast<f16_t*>(w_experts.data) + weight_offset, n, d, block_size, scale_data, aqb);\n      break;\n    }\n    case Quant::F8E5M2: {\n      _matmul(xout, x, static_cast<f8e5m2_t*>(w_experts.data) + weight_offset, n, d, block_size, scale_data, aqb);\n      break;\n    }\n    case Quant::Q2_K: {\n      _matmul(xout, x, static_cast<block_q2_K*>(w_experts.data) + weight_offset, n, d, block_size, scale_data, aqb);\n      break;\n    }\n    case Quant::Q3_K: {\n      _matmul(xout, x, static_cast<block_q3_K*>(w_experts.data) + weight_offset, n, d, block_size, scale_data, aqb);\n      break;\n    }\n    default: assert(false);\n  }\n}\n\n// Compute the softmax of an input vector `x` of length `size` and store it in `o`.\nstatic void softmax(float* o, float* x, int size) {\n  float score_max = -FLT_MAX;\n  for (int i = 0; i < size; ++i) {\n    if (x[i] > score_max) {\n      score_max = x[i];\n    }\n  }\n  float score_sum = 0.0f;\n  for (int i = 0; i < size; ++i) {\n    o[i] = expf(x[i] - score_max);\n    score_sum += o[i];\n  }\n  for (int i = 0; i < size; ++i) {\n    o[i] /= score_sum;\n  }\n}\n\ninline float sigmoid(float x) {\n  return 1.0f / (1.0f + expf(-x));\n}\n\nstatic void moe_gate(\n  float* moe_weights,\n  std::optional<QTensor> moegate_bias,\n  int* active_experts,\n  float* x,\n  int n_routed_experts,\n  int n_active_routed,\n  bool norm_topk_prob,\n  float routed_scaling_factor,\n  ScoringFunc scoring_func,\n  TopKMethod topk_method,\n  int n_group,\n  int topk_group\n) {\n  // Set moe_weights[:n_active_routed] to the weights of the top K experts.\n  // Set active_experts[:n_active_routed] to the indices of the top K experts.\n  if (scoring_func == ScoringFunc::SOFTMAX) {\n    softmax(x, x, n_routed_experts);\n  } else if (scoring_func == ScoringFunc::SIGMOID) {\n    for (int i = 0; i < n_routed_experts; i++) {\n      x[i] = sigmoid(x[i]);\n    }\n  }\n\n  if (moegate_bias) {\n    float* bias_data = static_cast<float*>(moegate_bias->data);\n    for (int i = 0; i < n_routed_experts; ++i) {\n      x[i] += bias_data[i];\n    }\n  }\n\n  // top k\n  float wsum = 0.0f;\n  if (topk_method == TopKMethod::GREEDY) {\n    assert(n_routed_experts <= 256);\n    std::array<uint8_t, 32> mask{};\n    for (int k = 0; k < n_active_routed; ++k) {\n      int best = -1;\n      for (int j = 0; j < n_routed_experts; ++j) {\n        int mask_i = j / 8;\n        int mask_r = j % 8;\n        if ((mask[mask_i] & (1ull << mask_r)) == 0 && (best == -1 || x[j] > x[best])) {\n          best = j;\n        }\n      }\n\n      active_experts[k] = best;\n      wsum += x[active_experts[k]];\n      int best_mask_i = best / 8;\n      int best_mask_r = best % 8;\n      mask[best_mask_i] |= 1ull << best_mask_r;\n    }\n  } else if (topk_method == TopKMethod::GROUP_LIMITED_GREEDY) {\n    int group_size = n_routed_experts / n_group;\n    \n    // First pass: select topk_group within each group\n    std::array<uint8_t, 32> mask{};\n    \n    for (int g = 0; g < n_group; g++) {\n      // Select topk_group items from this group\n      for (int k = 0; k < topk_group; k++) {\n        int best = -1;\n        for (int j = g*group_size; j < (g+1)*group_size; j++) {\n          int mask_i = j / 8;\n          int mask_r = j % 8;\n          if ((mask[mask_i] & (1u << mask_r)) == 0 && x[j] > x[best]) {\n            best = j;\n          }\n        }\n        int best_mask_i = best / 8;\n        int best_mask_r = best % 8;\n        mask[best_mask_i] |= 1u << best_mask_r;\n      }\n    }\n    // Flip mask so that now we only look at the topk_group items in each group\n    for (int i = 0; i < 32; i++) {\n      mask[i] = ~mask[i];\n    }\n    \n    // Second pass: select top n_active_routed overall\n    for (int k = 0; k < n_active_routed; ++k) {\n      int best = -1;\n      for (int j = 0; j < n_routed_experts; ++j) {\n        int mask_i = j / 8;\n        int mask_r = j % 8;\n        if ((mask[mask_i] & (1ull << mask_r)) == 0 && (best == -1 || x[j] > x[best])) {\n          best = j;\n        }\n      }\n\n      active_experts[k] = best;\n      wsum += x[active_experts[k]];\n      int best_mask_i = best / 8;\n      int best_mask_r = best % 8;\n      mask[best_mask_i] |= 1ull << best_mask_r;\n    }\n  } else if (topk_method == TopKMethod::NOAUX_TC) {\n    assert(false && \"TODO: implement noaux_tc\");\n  }\n\n  if (!norm_topk_prob) {\n    wsum = 1.0;\n  }\n  for (int k = 0; k < n_active_routed; ++k) {\n    moe_weights[k] = x[active_experts[k]] / wsum * routed_scaling_factor;\n  }\n}\n\nstatic void rmsnorm(float* o, float* x, float* weight, int size, float eps) {\n  float rms = 0.0f;\n  for (int i = 0; i < size; ++i) {\n    rms += x[i] * x[i];\n  }\n  rms = sqrtf(rms / size + eps);\n  float scale = 1.0f / rms;\n  for (int i = 0; i < size; ++i) {\n    o[i] = x[i] * scale * weight[i];\n  }\n}\n\n[[maybe_unused]] static void layernorm(float* o, float* x, float* weight, float* bias, int size, float eps) {\n  float mean = 0.0f;\n  for (int i = 0; i < size; ++i) {\n    mean += x[i];\n  }\n  mean /= size;\n  float var = 0.0f;\n  for (int i = 0; i < size; ++i) {\n    var += (x[i] - mean) * (x[i] - mean);\n  }\n  var /= size;\n  float scale = 1.0f / sqrtf(var + eps);\n  if (bias) {\n    for (int i = 0; i < size; ++i) {\n      o[i] = (x[i] - mean) * scale * weight[i] + bias[i];\n    }\n  } else {\n    for (int i = 0; i < size; ++i) {\n      o[i] = (x[i] - mean) * scale * weight[i];\n    }\n  }\n}\n\ninline float gelu(float x) {\n  return 0.5f * x * (1.0f + tanhf(0.797885f * (x + 0.044715f * x * x * x)));\n}\n\ninline float silu(float x) {\n  return x / (1.0f + expf(-x));\n}\n\ninline float clip(float x, float v) {\n  return x < -v ? -v : (x > v ? v : x);\n}\n\nstatic void rope(float* buf, float* vec, int d, int head_dim, int pos, float theta) {\n  // For some reason, DeepSeek-V2 was trained using rope output \n  // layout transposed compared to the input. This means we need a buffer\n  // to hold intermediate results.\n  assert(d % 2 == 0);\n  for (int i = 0; i < d; i += 2) {\n    int j_head = i % head_dim;\n    float freq = 1.0f / powf(theta, (float)j_head / (float)head_dim);\n    float val = pos * freq;\n    float fcr = cosf(val);\n    float fci = sinf(val);\n\n    float v0 = vec[i];\n    float v1 = vec[i + 1];\n    buf[i/2] = v0 * fcr - v1 * fci;\n    buf[i/2 + d/2] = v0 * fci + v1 * fcr;\n  }\n  for (int i = 0; i < d; i++) {\n    vec[i] = buf[i];\n  }\n}\n\nstatic void rope_v3(float* vec, int d, int head_dim, int pos, float theta) {\n  int rotary_dim = head_dim;\n\n  for (int i = 0; i < d; i += 2) {\n    int j_head = i % head_dim;\n    float freq = j_head >= rotary_dim ? 0.f : 1.0f / powf(theta, (float)j_head / (float)rotary_dim);\n    float val = pos * freq;\n    float fcr = cosf(val);\n    float fci = sinf(val);\n\n    float v0 = vec[i];\n    float v1 = vec[i + 1];\n    vec[i] = v0 * fcr - v1 * fci;\n    vec[i + 1] = v0 * fci + v1 * fcr;\n  }\n}\n\nstatic void rope(float* buf, f16_t* vec, int d, int head_dim, int pos, float theta) {\n  // For some reason, DeepSeek-V2 was trained using rope output\n  // layout transposed compared to the input. This means we need a buffer\n  // to hold intermediate results.\n  assert(d % 2 == 0);\n  for (int i = 0; i < d; i += 2) {\n    int j_head = i % head_dim;\n    float freq = 1.0f / powf(theta, (float)j_head / (float)head_dim);\n    float val = pos * freq;\n    float fcr = cosf(val);\n    float fci = sinf(val);\n\n    float v0 = half_to_float(vec[i]);\n    float v1 = half_to_float(vec[i + 1]);\n    buf[i/2] = v0 * fcr - v1 * fci;\n    buf[i/2 + d/2] = v0 * fci + v1 * fcr;\n  }\n  for (int i = 0; i < d; i++) {\n    vec[i] = float_to_half(buf[i]);\n  }\n}\n\nstatic void rope_v3(f16_t* vec, int d, int head_dim, int pos, float theta) {\n  int rotary_dim = head_dim;\n\n  for (int i = 0; i < d; i += 2) {\n    int j_head = i % head_dim;\n    float freq = j_head >= rotary_dim ? 0.f : 1.0f / powf(theta, (float)j_head / (float)rotary_dim);\n    float val = pos * freq;\n    float fcr = cosf(val);\n    float fci = sinf(val);\n\n    float v0 = half_to_float(vec[i]);\n    float v1 = half_to_float(vec[i + 1]);\n    vec[i] = float_to_half(v0 * fcr - v1 * fci);\n    vec[i + 1] = float_to_half(v0 * fci + v1 * fcr);\n  }\n}\n\n\n// Compute next value in a sequence for a single causal self-attention head.\nvoid attn(\n  float* xout,    // (n_heads * v_head_dim,) - output vector\n  float* atth,    // (kv_len,) - scratch space to hold attention scores of the sequence\n  const float* qh,      // (head_dim,) - query vector for this head\n  const f16_t* kh,      // (kv_len, n_heads, head_dim) - buffer containing key vectors of the sequence for all KV heads\n  const f16_t* vh,      // (kv_len, n_heads, v_head_dim) - buffer containing value vectors of the sequence for all KV heads\n  int head_dim,   // size of the \"key-space\"\n  int v_head_dim, // size of the \"value-space\"\n  int n_heads, // number of attention heads\n  int kv_len      // number of tokens of the sequence we will attend over\n) {\n  int k_stride = n_heads * head_dim; // stride per token in this k head\n  // calculate attention scores as dot products of q and k\n  for (int t = 0; t < kv_len; ++t) {\n    float score = 0.0f;\n    for (int i = 0; i < head_dim; ++i) {\n      score += qh[i] * half_to_float(kh[t * k_stride + i]);\n    }\n    score /= sqrtf(head_dim);\n    atth[t] = score;\n  }\n\n  // softmax the scores to get attention weights over [0..kv_len)\n  softmax(atth, atth, kv_len);\n\n  int v_stride = n_heads * v_head_dim; // stride per token in this v head\n  // mix values with attention weights\n  for (int i = 0; i < v_head_dim; ++i) {\n    float vi = 0.0f;\n    for (int t = 0; t < kv_len; ++t) {\n      vi += atth[t] * half_to_float(vh[t * v_stride + i]);\n    }\n    xout[i] = vi;\n  }\n}\n\n// Compute next value in a sequence for a single causal self-attention head.\n// MLA variant: uses combined latent-KV cache and PE-KV cache.\nvoid attn_mla(\n  float* xout,    // (n_heads * kv_lora_rank,) - output vector\n  float* atth,    // (kv_len,) - scratch space to hold attention scores of the sequence\n  const float* qh_c,    // (kv_lora_rank,) - transformed latent query vector for this head\n  const float* qh_rope, // (qk_rope_head_dim,) - PE-query vector for this head\n  const f16_t* compressed_kv,      // (kv_len, kv_lora_rank) - buffer containing latent vectors of the sequence\n  const f16_t* k_rope,  // (kv_len, qk_rope_head_dim) - buffer containing PE key-vectors of the sequence\n  int head_dim, // used for softmax scale factor\n  int kv_lora_rank, // size of the \"latent-space\"\n  int qk_rope_head_dim, // size of the \"PE-space\"\n  int kv_len   // number of tokens of the sequence we will attend over\n) {\n  int kv_stride = kv_lora_rank; // stride per token in the latent buffer\n  int k_rope_stride = qk_rope_head_dim; // stride per token in the PE buffer\n  // calculate attention scores as dot products of q and k\n  for (int t = 0; t < kv_len; ++t) {\n    float score = 0.0f;\n    for (int i = 0; i < kv_lora_rank; ++i) {\n      score += qh_c[i] * half_to_float(compressed_kv[t * kv_stride + i]);\n    }\n    for (int i = 0; i < qk_rope_head_dim; ++i) {\n      score += qh_rope[i] * half_to_float(k_rope[t * k_rope_stride + i]);\n    }\n    score /= sqrtf(head_dim);\n    atth[t] = score;\n  }\n\n  // softmax the scores to get attention weights over [0..kv_len)\n  softmax(atth, atth, kv_len);\n\n  // mix latents with attention weights\n  for (int i = 0; i < kv_lora_rank; ++i) {\n    float vi = 0.0f;\n    for (int t = 0; t < kv_len; ++t) {\n      vi += atth[t] * half_to_float(compressed_kv[t * kv_stride + i]);\n    }\n    xout[i] = vi;\n  }\n}\n\n// Compute forward pass for a single block and update the inference state accordingly.\n// PRECONDITIONS: \n// - `s.x()` contains the input to the block. Output will also go here.\n// - Block KV cache is hydrated.\ntemplate <typename T>\nvoid Block::_block_cpu(\n  InferenceState& s,  // inference state\n  int pos,            // index of the current token in the sequence\n  int kv_sink,        // number of sink tokens currently in the KV cache\n  int kv_pos,         // index of the current token in the kv cache, must be in [0..kv_len) since kv cache is a ring buffer\n  int kv_len          // number of tokens in the kv cache that we will attend over\n) const {\n  const Config& c = *_config;\n\n  // Attention pre-norm\n  switch (c.norm_type) {\n    case LayerNormType::RMSNorm: {\n      rmsnorm(s.xb(), s.x(), rms_att_weight(), c.dim, c.norm_eps);\n      break;\n    }\n  }\n\n  // Attention output into `hb`\n  attention_impl(s, pos, kv_sink, kv_pos, kv_len);\n\n  // Residual back into `x`\n  for (int i = 0; i < c.dim; ++i) {\n    s.x()[i] += s.hb()[i];\n  }\n\n  // FFN pre-norm\n  switch (c.norm_type) {\n    case LayerNormType::RMSNorm: {\n      rmsnorm(s.xb(), s.x(), rms_ffn_weight(), c.dim, c.norm_eps);\n      break;\n    }\n  }\n\n  if (c.n_routed_experts > 0 && moegate() != std::nullopt) {\n    PROFILE_BLOCK(ffn_moe);\n    // Block is a sparse MoE FFN layer\n    PROFILE(matmul_unscaled(s.moe_weights(), s.xb(), *moegate()));\n    moe_gate(\n      s.active_experts_weights(), moegate_bias(), s.active_experts(), s.moe_weights(),\n      c.n_routed_experts, c.n_active_routed, c.norm_topk_prob, c.routed_scaling_factor,\n      c.scoring_func, c.topk_method, c.n_group, c.topk_group\n    );\n    for (int k = 0; k < c.n_active_routed; ++k) {\n      int expert_index = s.active_experts()[k];\n      // mix self.w2(F.silu(self.w1(x)) * self.w3(x))\n      // Note this is a feedforward with a GLU, not a simple MLP.\n      PROFILE(matmul_expert(s.hb(), s.xb(), *w1(), expert_index, c.block_size.data(), _s1, s.aqb()));\n      PROFILE(matmul_expert(s.hb2(), s.xb(), *w3(), expert_index, c.block_size.data(), _s3, s.aqb()));\n      switch (c.act) {\n        case ActivationType::GELU: {\n          for (int i = 0; i < c.moe_intermediate_size; ++i) {\n            s.hb()[i] = gelu(s.hb()[i]) * s.hb2()[i];\n          }\n          break;\n        }\n        case ActivationType::SILU: {\n          for (int i = 0; i < c.moe_intermediate_size; ++i) {\n            s.hb()[i] = silu(s.hb()[i]) * s.hb2()[i];\n          }\n          break;\n        }\n      }\n      PROFILE(matmul_expert(s.xb2(), s.hb(), *w2(), expert_index, c.block_size.data(), _s2, s.aqb()));\n      float expert_weight = s.active_experts_weights()[k];\n      for (int i = 0; i < c.dim; ++i) {\n        s.x()[i] += s.xb2()[i] * expert_weight;\n      }\n    }\n    if (c.n_shared_experts > 0) {\n      // mix self.w2(F.silu(self.w1(x)) * self.w3(x))\n      // Note this is a feedforward with a GLU, not a simple MLP.\n      PROFILE(matmul(s.hb(), s.xb(), *shared_w1(), c.block_size.data(), _shared_s1, s.aqb()));\n      PROFILE(matmul(s.hb2(), s.xb(), *shared_w3(), c.block_size.data(), _shared_s3, s.aqb()));\n      switch (c.act) {\n        case ActivationType::GELU: {\n          for (int i = 0; i < c.n_shared_experts * c.moe_intermediate_size; ++i) {\n            s.hb()[i] = gelu(s.hb()[i]) * s.hb2()[i];\n          }\n          break;\n        }\n        case ActivationType::SILU: {\n          for (int i = 0; i < c.n_shared_experts * c.moe_intermediate_size; ++i) {\n            s.hb()[i] = silu(s.hb()[i]) * s.hb2()[i];\n          }\n          break;\n        }\n      }\n\n      PROFILE(matmul(s.xb2(), s.hb(), *shared_w2(), c.block_size.data(), _shared_s2, s.aqb()));\n      // residual connection back into x\n      for (int i = 0; i < c.dim; ++i) {\n        s.x()[i] += s.xb2()[i];\n      }\n    }\n  } else {\n    PROFILE_BLOCK(ffn_dense);\n    // Block is a dense FFN layer\n    // mix self.w2(F.silu(self.w1(x)) * self.w3(x))\n    // Note this is a feedforward with a GLU, not a simple MLP.\n    PROFILE(matmul(s.hb(), s.xb(), *w1(), c.block_size.data(), _s1, s.aqb()));\n    PROFILE(matmul(s.hb2(), s.xb(), *w3(), c.block_size.data(), _s3, s.aqb()));\n    switch (c.act) {\n      case ActivationType::GELU: {\n        for (int i = 0; i < c.hidden_dim; ++i) {\n          s.hb()[i] = gelu(s.hb()[i]) * s.hb2()[i];\n        }\n        break;\n      }\n      case ActivationType::SILU: {\n        for (int i = 0; i < c.hidden_dim; ++i) {\n          s.hb()[i] = silu(s.hb()[i]) * s.hb2()[i];\n        }\n        break;\n      }\n    }\n    PROFILE(matmul(s.xb2(), s.hb(), *w2(), c.block_size.data(), _s2, s.aqb()));\n    // residual connection back into x\n    for (int i = 0; i < c.dim; ++i) {\n      s.x()[i] += s.xb2()[i];\n    }\n  }\n}\n\ntemplate<typename T>\nvoid BlockMHA::_attention_impl(\n  InferenceState& s, int pos, int kv_sink, int kv_pos, int kv_len\n) const {\n  PROFILE_BLOCK(attn_mha);\n  const Config& c = *_config;\n\n  // qkv matmuls for this position\n  if (c.q_lora_rank > 0) {\n    PROFILE(matmul(s.q_a(), s.xb(), *wq_a(), c.block_size.data(), _sq_a, s.aqb()));\n    switch (c.norm_type) {\n      case LayerNormType::RMSNorm: {\n        rmsnorm(s.q_a(), s.q_a(), this->rms_q_a_weight(), c.q_lora_rank, c.norm_eps);\n        break;\n      }\n    }\n    PROFILE(matmul(s.q(), s.q_a(), *wq_b(), c.block_size.data(), _sq_b, s.aqb()));\n  } else {\n    PROFILE(matmul(s.q(), s.xb(), *wq(), c.block_size.data(), _sq, s.aqb()));\n  }\n  PROFILE(matmul(s.kv_a(), s.xb(), *wkv_a(), c.block_size.data(), _skv_a, s.aqb()));\n\n  // Apply RoPE positional encoding\n  int q_pe_offset = c.head_dim - c.qk_rope_head_dim;\n  bool is_v3 = c.has_moegate_bias;\n  for (int h = 0; h < c.n_heads; h++) {\n    if (is_v3) {\n      rope_v3(s.q(h) + q_pe_offset, c.qk_rope_head_dim, c.qk_rope_head_dim, pos, c.rope_theta);\n    } else {\n      rope(s.ropebuf(), s.q(h) + q_pe_offset, c.qk_rope_head_dim, c.qk_rope_head_dim, pos, c.rope_theta);\n    }\n  }\n  int kv_pe_offset = c.kv_lora_rank;\n  float* k_rope = s.kv_a() + kv_pe_offset;\n  if (is_v3) {\n    rope_v3(k_rope, c.qk_rope_head_dim, c.qk_rope_head_dim, pos, c.rope_theta);\n  } else {\n    rope(s.ropebuf(), k_rope, c.qk_rope_head_dim, c.qk_rope_head_dim, pos, c.rope_theta);\n  }\n  // rms norm to non-pe chunk of kv_a\n  rmsnorm(s.kv_a(), s.kv_a(), this->rms_kv_a_weight(), c.kv_lora_rank, c.norm_eps);\n  // un-compress the latent kv via multiplication with wkv_b\n  int qk_nope_head_dim = c.head_dim - c.qk_rope_head_dim;\n  PROFILE(matmul(s.kv_b(), s.kv_a(), *wkv_b(), c.block_size.data(), _skv_b, s.aqb()));\n  // concatenate kv_b and k_rope in each head to build key heads\n  for (int h = 0; h < c.n_heads; h++) {\n    for (int i = 0; i < qk_nope_head_dim; i++) {\n      s.k(h)[i] = s.kv_b(h)[i];\n    }\n    for (int i = 0; i < c.qk_rope_head_dim; i++) {\n      s.k(h)[qk_nope_head_dim + i] = k_rope[i];\n    }\n  }\n  // transfer value heads from kv_b\n  for (int h = 0; h < c.n_heads; h++) {\n    for (int i = 0; i < c.v_head_dim; i++) {\n      s.v(h)[i] = s.kv_b(h)[qk_nope_head_dim + i];\n    }\n  }\n\n  // update kv cache\n  int key_dim = c.n_heads * c.head_dim;\n  for (int i = 0; i < key_dim; ++i) {\n    this->key_cache(kv_pos)[i] = float_to_half(s.k()[i]);\n  }\n  int value_dim = c.n_heads * c.v_head_dim;\n  for (int i = 0; i < value_dim; ++i) {\n    this->value_cache(kv_pos)[i] = float_to_half(s.v()[i]);\n  }\n\n  // Sink tokens remain untouched while the rest of the KV cache is incrementally \n  // replaced in ring order, but sink i must always be positioned (max_seq_len - i)\n  // away from current timestep. Hence, each forward pass, rotate sink tokens \n  // forward by 1. See https://arxiv.org/abs/2309.17453 for more.\n  for (int r = 0; r < kv_sink; r++) {\n    f16_t* key = key_cache(r);\n    // in-place update PE-chunk of each key head\n    int q_pe_offset = c.head_dim - c.qk_rope_head_dim;\n    for (int h = 0; h < c.n_heads; h++) {\n      f16_t* kh = key + h * c.head_dim;\n      if (is_v3) {\n        rope_v3(kh + q_pe_offset, c.qk_rope_head_dim, c.qk_rope_head_dim, 1, c.rope_theta);\n      } else {\n        rope(s.ropebuf(), kh + q_pe_offset, c.qk_rope_head_dim, c.qk_rope_head_dim, 1, c.rope_theta);\n      }\n    }\n  }\n\n  {\n    PROFILE_BLOCK(self_attn_mha_inner);\n    f16_t* kb = this->key_cache();\n    f16_t* vb = this->value_cache();\n    int h;\n  #pragma omp parallel for private(h)\n    for (h = 0; h < c.n_heads; h++) {\n      int k_head_offset = h * c.head_dim;\n      int v_head_offset = h * c.v_head_dim;\n      f16_t* kh = kb + k_head_offset; // Use pointer arithmetic for base address\n      f16_t* vh = vb + v_head_offset; // Use pointer arithmetic for base address\n      attn(\n        s.xb2(h, c.v_head_dim), // Output per Q head\n        s.att(h),              // Attention scores per Q head\n        s.q(h),                // Query vector for this head\n        kh,                    // Pointer to start of relevant K cache base\n        vh,                    // Pointer to start of relevant V cache base\n        c.head_dim,            // Dimension of K space\n        c.v_head_dim,          // Dimension of V space\n        c.n_heads,          // Total number of KV heads (passed to inner attn func for stride calculation)\n        kv_len                 // Sequence length to attend over\n      );\n    }\n  }\n\n  // final matmul to get output of the attention, place result in s.hb() for residual connection\n  PROFILE(matmul(s.hb(), s.xb2(), *wo(), c.block_size.data(), _so, s.aqb()));\n}\n\ntemplate<typename T>\nvoid BlockMLA::_attention_impl(\n  InferenceState& s, int pos, int kv_sink, int kv_pos, int kv_len\n) const {\n  PROFILE_BLOCK(attn_mla);\n  const Config& c = *_config;\n  assert(c.q_lora_rank > 0); // MLA requires q_lora_rank > 0\n\n  // qkv down projections\n  PROFILE(matmul(s.q_a(), s.xb(), *wq_a(), c.block_size.data(), _sq_a, s.aqb()));\n  switch (c.norm_type) {\n    case LayerNormType::RMSNorm: {\n      rmsnorm(s.q_a(), s.q_a(), this->rms_q_a_weight(), c.q_lora_rank, c.norm_eps);\n      break;\n    }\n  }\n  PROFILE(matmul(s.kv_a(), s.xb(), *wkv_a(), c.block_size.data(), _skv_a, s.aqb()));\n  // query transformations\n  PROFILE(matmul(s.q_rope(), s.q_a(), *wq_rope_b(), c.block_size.data(), _sq_rope_b, s.aqb()));\n  PROFILE(matmul(s.q_c(), s.q_a(), *wc(), c.block_size.data(), _sc, s.aqb()));\n\n  // Apply RoPE positional encoding\n  bool is_v3 = c.has_moegate_bias;\n  for (int h = 0; h < c.n_heads; h++) {\n    if (is_v3) {\n      rope_v3(s.q_rope(h), c.qk_rope_head_dim, c.qk_rope_head_dim, pos, c.rope_theta);\n    } else {\n      rope(s.ropebuf(), s.q_rope(h), c.qk_rope_head_dim, c.qk_rope_head_dim, pos, c.rope_theta);\n    }\n  }\n  int kv_pe_offset = c.kv_lora_rank;\n  float* k_rope = s.kv_a() + kv_pe_offset;\n  if (is_v3) {\n    rope_v3(k_rope, c.qk_rope_head_dim, c.qk_rope_head_dim, pos, c.rope_theta);\n  } else {\n    rope(s.ropebuf(), k_rope, c.qk_rope_head_dim, c.qk_rope_head_dim, pos, c.rope_theta);\n  }\n  // rms norm to non-pe chunk of kv_a (compressed latent kv)\n  rmsnorm(s.kv_a(), s.kv_a(), this->rms_kv_a_weight(), c.kv_lora_rank, c.norm_eps);\n\n  // update kv cache\n  for (int i = 0; i < c.kv_lora_rank; ++i) {\n    this->kv_nope_cache(kv_pos)[i] = float_to_half(s.kv_a()[i]);\n  }\n  for (int i = 0; i < c.qk_rope_head_dim; ++i) {\n    this->kv_rope_cache(kv_pos)[i] = float_to_half(k_rope[i]);\n  }\n\n  // Sink tokens remain untouched while the rest of the KV cache is incrementally \n  // replaced in ring order, but sink i must always be positioned (max_seq_len - i)\n  // away from current timestep. Hence, each forward pass, rotate sink tokens \n  // forward by 1. See https://arxiv.org/abs/2309.17453 for more.\n  for (int r = 0; r < kv_sink; r++) {\n    f16_t* kv = this->kv_rope_cache(r);\n    if (is_v3) {\n      rope_v3(kv, c.qk_rope_head_dim, c.qk_rope_head_dim, 1, c.rope_theta);\n    } else {\n      rope(s.ropebuf(), kv, c.qk_rope_head_dim, c.qk_rope_head_dim, 1, c.rope_theta);\n    }\n  }\n\n  {\n    PROFILE_BLOCK(self_attn_mla_inner);\n    int h;\n  #pragma omp parallel for private(h)\n    for (h = 0; h < c.n_heads; h++) {\n      attn_mla(\n        s.xb2(h, c.kv_lora_rank), // Output is per-head latent vector\n        s.att(h),\n        s.q_c(h),\n        s.q_rope(h),\n        this->kv_nope_cache(),\n        this->kv_rope_cache(),\n        c.head_dim,\n        c.kv_lora_rank,\n        c.qk_rope_head_dim,\n        kv_len\n      );\n    }\n  }\n\n  // Uncompress latent kvs output by each attention head, storing result in `kv_b`.\n  // We reuse kv_b buffer here for the uncompressed value outputs.\n  for (int h = 0; h < c.n_heads; h++) {\n    float* v_b_head = s.kv_b() + h * c.v_head_dim;\n    PROFILE(matmul_expert(v_b_head, s.xb2(h, c.kv_lora_rank), *wv_b(), h, c.block_size.data(), _sv_b, s.aqb()));\n  }\n\n  // final matmul to get output of the attention, place result in s.hb() for residual connection\n  PROFILE(matmul(s.hb(), s.kv_b(), *wo(), c.block_size.data(), _so, s.aqb()));\n}\n\nvoid mha_cpu(\n  float* xout,  // (n_heads, head_dim)\n  float* att,   // (n_heads, max_seq_len)\n  f16_t* kb,    // (max_seq_len, n_heads, head_dim)\n  f16_t* vb,    // (max_seq_len, n_heads, head_dim)\n  float* q,     // (n_heads, head_dim)\n  int head_dim, int v_head_dim, int kv_len, int max_seq_len, int n_heads\n) {\n  // Multihead attention. Iterate over all heads.\n  int h;\n#pragma omp parallel for private(h)\n  for (h = 0; h < n_heads; h++) {\n    int k_head_offset = h * head_dim;\n    int v_head_offset = h * v_head_dim;\n    f16_t* kh = kb + k_head_offset;\n    f16_t* vh = vb + v_head_offset;\n    attn(\n      xout + head_dim * h, att + max_seq_len * h, q + head_dim * h, \n      kh, vh, head_dim, v_head_dim, n_heads, kv_len\n    );\n  }\n}\n\nvoid ffn_cpu(\n  float* xout, float* x, \n  float* w1, float* w2, float* w3, \n  int hidden_dim, int dim,\n  ActivationType act\n) {\n  float* hb = new float[hidden_dim];\n  float* hb2 = new float[hidden_dim];\n  // mix self.w2(F.silu(self.w1(x)) * self.w3(x))\n  // Note this is a feedforward with a GLU, not a simple MLP.\n  matmul_unscaled(hb, x, QTensor(Quant::F32, {dim, hidden_dim}, w1, dim*hidden_dim*sizeof(float)));\n  matmul_unscaled(hb2, x, QTensor(Quant::F32, {dim, hidden_dim}, w3, dim*hidden_dim*sizeof(float)));\n  switch (act) {\n    case ActivationType::GELU: {\n      for (int i = 0; i < hidden_dim; ++i) {\n        hb[i] = gelu(hb[i]) * hb2[i];\n      }\n      break;\n    }\n    case ActivationType::SILU: {\n      for (int i = 0; i < hidden_dim; ++i) {\n        hb[i] = silu(hb[i]) * hb2[i];\n      }\n      break;\n    }\n  }\n\n  matmul_unscaled(xout, hb, QTensor(Quant::F32, {hidden_dim, dim}, w2, hidden_dim*dim*sizeof(float)));\n  \n  delete[] hb;\n  delete[] hb2;\n}\n\ntemplate void Block::_block_cpu<float>(InferenceState&, int, int, int, int) const;\ntemplate void Block::_block_cpu<f16_t>(InferenceState&, int, int, int, int) const;\ntemplate void Block::_block_cpu<f8e5m2_t>(InferenceState&, int, int, int, int) const;\ntemplate void Block::_block_cpu<block_q2_K>(InferenceState&, int, int, int, int) const;\ntemplate void Block::_block_cpu<block_q3_K>(InferenceState&, int, int, int, int) const;\n\ntemplate void BlockMHA::_attention_impl<float>(InferenceState&, int, int, int, int) const;\ntemplate void BlockMHA::_attention_impl<f16_t>(InferenceState&, int, int, int, int) const;\ntemplate void BlockMHA::_attention_impl<f8e5m2_t>(InferenceState&, int, int, int, int) const;\ntemplate void BlockMHA::_attention_impl<block_q2_K>(InferenceState&, int, int, int, int) const;\ntemplate void BlockMHA::_attention_impl<block_q3_K>(InferenceState&, int, int, int, int) const;\n\ntemplate void BlockMLA::_attention_impl<float>(InferenceState&, int, int, int, int) const;\ntemplate void BlockMLA::_attention_impl<f16_t>(InferenceState&, int, int, int, int) const;\ntemplate void BlockMLA::_attention_impl<f8e5m2_t>(InferenceState&, int, int, int, int) const;\ntemplate void BlockMLA::_attention_impl<block_q2_K>(InferenceState&, int, int, int, int) const;\ntemplate void BlockMLA::_attention_impl<block_q3_K>(InferenceState&, int, int, int, int) const;\n\nvoid Model::_copy_embedding(InferenceState& s, int token) {\n  const Config& c = *config;\n  switch (c.weight_quant) {\n    case Quant::F32: {\n      float* emb = static_cast<float*>(token_embedding_table->data);\n      for (int i = 0; i < c.dim; ++i) {\n        s.x()[i] = emb[token * c.dim + i];\n      }\n      break;\n    }\n    case Quant::F16: {\n      f16_t* emb = static_cast<f16_t*>(token_embedding_table->data);\n      for (int i = 0; i < c.dim; i+=1) {\n        s.x()[i] = half_to_float(emb[token * c.dim + i]);\n      }\n      break;\n    }\n    case Quant::F8E5M2: {\n      f8e5m2_t* emb = static_cast<f8e5m2_t*>(token_embedding_table->data);\n      float* emb_scale = static_cast<float*>(token_embedding_scale->data);\n      int* block_size = config->block_size.data();\n      int scale_num_cols = (c.dim + block_size[1] - 1) / block_size[1];\n      for (int i = 0; i < c.dim; i+=1) {\n        int scale_i = token / block_size[0];\n        int scale_j = i / block_size[1];\n        float scale = emb_scale[scale_i * scale_num_cols + scale_j];\n        s.x()[i] = float8e5m2_to_float(emb[token * c.dim + i]) * scale;\n      }\n      break;\n    }\n    case Quant::Q2_K: {\n      block_q2_K* emb = static_cast<block_q2_K*>(token_embedding_table->data);\n      int blocks_per_row = c.dim / QK_K;\n      dequantize_row_q2_K(emb + token * blocks_per_row, s.x(), c.dim);\n      break;\n    }\n    case Quant::Q3_K: {\n      block_q3_K* emb = static_cast<block_q3_K*>(token_embedding_table->data);\n      int blocks_per_row = c.dim / QK_K;\n      dequantize_row_q3_K(emb + token * blocks_per_row, s.x(), c.dim);\n      break;\n    }\n    default: {\n      assert(false && \"unsupported weight quantization\");\n    }\n  }\n}\n\nvoid Model::_forward_cpu(InferenceState& s, int token, int pos, InferenceMode mode) {\n  const Config& c = *config;\n\n  // copy the token embedding into `x`\n  PROFILE(_copy_embedding(s, token));\n\n  // When decoding past the context length, keep the first few tokens in the KV cache\n  // untouched as \"attention sinks\" while replacing the rest in ring order.\n  // See StreamingLLM (https://arxiv.org/pdf/2309.17453) for more.\n  int original_max_position = c.rs_original_max_position_embeddings;\n  int kv_sink = pos >= original_max_position ? KV_SINKS : 0;\n  int kv_pos = kv_sink + (pos - kv_sink) % (original_max_position - kv_sink);\n  int kv_len = pos >= original_max_position ? original_max_position : pos + 1;\n\n  // forward all layers in order\n  for (auto b : blocks) {\n    b->block(s, pos, kv_sink, kv_pos, kv_len);\n  }\n\n  if (mode == InferenceMode::HYDRATE_KV_CACHE) {\n    // only hydrate the KV cache and don't compute output logits\n    return;\n  }\n\n  // final layer norm\n  switch (c.norm_type) {\n    case LayerNormType::RMSNorm: {\n      rmsnorm(s.x(), s.x(), static_cast<float*>(rms_final_weight->data), c.dim, c.norm_eps);\n      break;\n    }\n  }\n\n  // classifier into logits\n  {\n    PROFILE_BLOCK(lm_head);\n    switch (c.weight_quant) {\n      case Quant::F32:\n      case Quant::F16: {\n        matmul_unscaled(s.logits(), s.x(), *wcls);\n        break;\n      }\n      case Quant::F8E5M2:\n      case Quant::Q2_K:\n      case Quant::Q3_K: {\n        matmul(s.logits(), s.x(), *wcls, c.block_size.data(), scls, s.aqb());\n        break;\n      }\n      default: {\n        assert(false && \"unsupported weight quantization\");\n      }\n    }\n  }\n}"
  },
  {
    "path": "src/main.cpp",
    "content": "#include <cmath>\n#include <cstdint>\n#include <cstdlib>\n#include <fstream>\n#include <iostream>\n#include <sstream>\n#include <stdio.h>\n\n#include \"fmt/format.h\"\n\n#include \"codec.h\"\n#include \"model.h\"\n#include \"profile.h\"\n#include \"sampler.h\"\n#include \"time_utils.h\"\n#include \"tokenizer.h\"\n\nvoid error_usage() {\n  fprintf(stderr, \"Usage:   main <checkpoint_dir> [options]\\n\");\n  fprintf(stderr, \"Example: main model_weights_dir/ -i \\\"Q: What is the meaning of life?\\\"\\n\");\n  fprintf(stderr, \"Options:\\n\");\n  fprintf(stderr, \"  -h Display this help message\\n\");\n  fprintf(stderr, \"  -L Locks model weights to RAM, disabling swap. Requires sudo.\\n\");\n  fprintf(stderr, \"  -m [completion,passkey,perplexity,interactive] which mode to run in (default - completion)\\n\");\n  fprintf(stderr, \"  -T <int> sliding window context length (0 - max)\\n\");\n  fprintf(stderr, \"\\n\");\n  fprintf(stderr, \"Perplexity mode options:\\n\");\n  fprintf(stderr, \"  Choose one:\\n\");\n  fprintf(stderr, \"    -i <string> input prompt\\n\");\n  fprintf(stderr, \"    -f <filepath> input file with prompt\\n\");\n  fprintf(stderr, \"    -w use wikitext as input\\n\");\n  fprintf(stderr, \"Completion mode options:\\n\");\n  fprintf(stderr, \"  -n <int>    number of steps to run for in completion mode, default 256. 0 = max_seq_len, -1 = infinite\\n\");\n  fprintf(stderr, \"  Choose one:\\n\");\n  fprintf(stderr, \"    -i <string> input prompt\\n\");\n  fprintf(stderr, \"    -t <float> temperature (default - 1.0)\\n\");\n  fprintf(stderr, \"    -p <float> p for top-p sampling (default - 0.95)\\n\");\n  fprintf(stderr, \"    -f <filepath> input file with prompt\\n\");\n  fprintf(stderr, \"Passkey mode options:\\n\");\n  fprintf(stderr, \"  -n <int>    number of junk lines to insert (default - 250)\\n\");\n  fprintf(stderr, \"  -l <int>    passkey position (-1 - random)\\n\");\n  exit(1);\n}\n\nvoid help_usage_interactive() {\n  fprintf(stderr, \"Usage:   <mode> [options]\\n\");\n  fprintf(stderr, \"Example: c -i \\\"Q: What is the meaning of life?\\\"\\n\");\n  fprintf(stderr, \"Modes:\\n\");\n  fprintf(stderr, \"  h Display this help message\\n\");\n  fprintf(stderr, \"  c Completion - complete a single prompt \\n\");\n  fprintf(stderr, \"  p Perplexity - compute perplexity of a single prompt \\n\");\n  fprintf(stderr, \"  k Passkey - test passkey extraction \\n\");\n  fprintf(stderr, \"\\n\");\n  fprintf(stderr, \"Perplexity mode options:\\n\");\n  fprintf(stderr, \"  Choose one:\\n\");\n  fprintf(stderr, \"    -i <string> input prompt\\n\");\n  fprintf(stderr, \"    -f <filepath> input file with prompt\\n\");\n  fprintf(stderr, \"    -w use wikitext as input\\n\");\n  fprintf(stderr, \"Completion mode options:\\n\");\n  fprintf(stderr, \"  -n <int>    number of steps to run for in completion mode, default 256. 0 = max_seq_len, -1 = infinite\\n\");\n  fprintf(stderr, \"  Choose one:\\n\");\n  fprintf(stderr, \"    -i <string> input prompt\\n\");\n  fprintf(stderr, \"    -t <float> temperature (default - 1.0)\\n\");\n  fprintf(stderr, \"    -p <float> p for top-p sampling (default - 0.95)\\n\");\n  fprintf(stderr, \"    -f <filepath> input file with prompt\\n\");\n  fprintf(stderr, \"Passkey mode options:\\n\");\n  fprintf(stderr, \"  -n <int>    number of junk lines to insert (default - 250)\\n\");\n  fprintf(stderr, \"  -l <int>    passkey position (-1 - random)\\n\");\n}\n\nstruct Session {\n  Session(const std::string& checkpoint_dir, bool lock_model_weights, int context, uint64_t sampler_seed):\n    model_data(checkpoint_dir, lock_model_weights),\n    model(model_data, context),\n    state(model.config),\n    sampler(model.config, sampler_seed),\n    tokenizer(model_data) {}\n  YALMData model_data;\n  Model model;\n  InferenceState state;\n  Sampler sampler;\n  Tokenizer tokenizer;\n};\n\nstruct CompletionArgs {\n  std::string prompt;\n  int num_steps;\n  float temperature = 1.0;\n  float top_p = 0.95;\n  // Returns true if args are valid, false otherwise\n  bool parse_args(const std::vector<const char*>& args) {\n    std::string prompt_path = \"\";\n    for (size_t i = 0; i < args.size();) {\n      // do some basic validation\n      if (args[i][0] != '-') {\n        return false;\n      } // must start with dash\n      if (strlen(args[i]) != 2) {\n        return false;\n      } // must be -x (one dash, one letter)\n\n      // read in the args\n      if (args[i][1] == 'h') {\n        return false;\n      } else if (args[i][1] == 'i') {\n        if (i + 1 >= args.size()) {\n          return false;\n        }\n        prompt = args[i + 1];\n        i += 2;\n      } else if (args[i][1] == 't') {\n        if (i + 1 >= args.size()) {\n          return false;\n        }\n        temperature = std::stof(args[i + 1]);\n        i += 2;\n      } else if (args[i][1] == 'p') {\n        if (i + 1 >= args.size()) {\n          return false;\n        }\n        top_p = std::stof(args[i + 1]);\n        i += 2;\n      } else if (args[i][1] == 'f') {\n        if (i + 1 >= args.size()) {\n          return false;\n        }\n        prompt_path = args[i + 1];\n        i += 2;\n      } else if (args[i][1] == 'n') {\n        if (i + 1 >= args.size()) {\n          return false;\n        }\n        num_steps = std::stoi(args[i + 1]);\n        i += 2;\n      } else {\n        return false;\n      }\n    }\n    int has_prompt = prompt.size() > 0 ? 1 : 0;\n    int has_prompt_path = prompt_path.size() > 0 ? 1 : 0;\n    if ((has_prompt + has_prompt_path) != 1) {\n      return false;\n    } else if (has_prompt_path) {\n      std::ifstream file(prompt_path);\n      if (!file.is_open()) {\n        std::cerr << \"Error: could not open file \" << prompt_path << std::endl;\n        return false;\n      }\n\n      std::stringstream buffer;\n      buffer << file.rdbuf();\n      prompt = buffer.str();\n    }\n    return true;\n  }\n};\n\nstruct PasskeyArgs {\n  int n_junk;\n  int passkey_pos;\n  // Returns true if args are valid, false otherwise\n  bool parse_args(const std::vector<const char*>& args) {\n    for (size_t i = 2; i < args.size();) {\n      // do some basic validation\n      if (args[i][0] != '-') {\n        return false;\n      } // must start with dash\n      if (strlen(args[i]) != 2) {\n        return false;\n      } // must be -x (one dash, one letter)\n\n      // read in the args\n      if (args[i][1] == 'h') {\n        return false;\n      } else if (args[i][1] == 'l') {\n        if (i + 1 >= args.size()) {\n          return false;\n        }\n        passkey_pos = std::stoi(args[i + 1]);\n        i += 2;\n      } else if (args[i][1] == 'n') {\n        if (i + 1 >= args.size()) {\n          return false;\n        }\n        n_junk = std::stoi(args[i + 1]);\n        i += 2;\n      } else {\n        return false;\n      }\n    }\n    if (passkey_pos != -1 && (passkey_pos >= n_junk || passkey_pos < 0)) {\n      std::cerr << \"Error: passkey position must be between 0 and \" << n_junk - 1 << std::endl;\n      return false;\n    }\n    return true;\n  }\n};\n\nstruct PerplexityArgs {\n  std::string prompt;\n  bool use_wikitext = false;\n  // Returns true if args are valid, false otherwise\n  bool parse_args(const std::vector<const char*>& args) {\n    std::string prompt_path = \"\";\n    for (size_t i = 0; i < args.size();) {\n      // do some basic validation\n      if (args[i][0] != '-') {\n        return false;\n      } // must start with dash\n      if (strlen(args[i]) != 2) {\n        return false;\n      } // must be -x (one dash, one letter)\n\n      // read in the args\n      if (args[i][1] == 'h') {\n        return false;\n      } else if (args[i][1] == 'i') {\n        if (i + 1 >= args.size()) {\n          return false;\n        }\n        prompt = args[i + 1];\n        i += 2;\n      } else if (args[i][1] == 'f') {\n        if (i + 1 >= args.size()) {\n          return false;\n        }\n        prompt_path = args[i + 1];\n        i += 2;\n      } else if (args[i][1] == 'w') {\n        use_wikitext = true;\n        i += 1;\n      } else {\n        return false;\n      }\n    }\n    int has_prompt = prompt.size() > 0 ? 1 : 0;\n    int has_prompt_path = prompt_path.size() > 0 ? 1 : 0;\n    int has_wikitext = use_wikitext ? 1 : 0;\n    if ((has_prompt + has_prompt_path + has_wikitext) != 1) {\n      std::cerr << \"Error: must provide exactly one nonempty -i <input prompt> or -f <input filepath> or -w\" << std::endl;\n      return false;\n    } else if (has_prompt_path) {\n      std::ifstream file(prompt_path);\n      if (!file.is_open()) {\n        std::cerr << \"Error: could not open file \" << prompt_path << std::endl;\n        return false;\n      }\n\n      std::stringstream buffer;\n      buffer << file.rdbuf();\n      prompt = buffer.str();\n    }\n    return true;\n  }\n};\n\nstd::vector<int> encode_prompt(const std::string& prompt, Tokenizer& tokenizer) {\n  std::vector<int> encoding;\n  {\n    uint64_t encode_start_ms = get_timestamp_ms();\n    encoding = tokenizer.encode(prompt, true);\n    uint64_t encode_end_ms = get_timestamp_ms();\n\n    std::cout << tokenizer.encoding_to_debug_string(encoding) << std::endl;\n    uint64_t encoding_ms = encode_end_ms - encode_start_ms;\n    std::cout << fmt::format(\n      \"Encoding stats: ({} tokens, throughput: {:.5}tok/s, latency: {:.5}s/tok, total: {:.5}s)\\n\",\n      encoding.size(),\n      encoding.size() / (encoding_ms / 1000.0),\n      (encoding_ms / 1000.0) / encoding.size(),\n      encoding_ms / 1000.0\n    ) << std::endl;\n  }\n  return encoding;\n}\n\nvoid run_completion(\n  Session& session,\n  const std::string& prompt,\n  int num_steps,\n  float temperature,\n  float top_p\n) {\n  Model& model = session.model;\n  InferenceState& state = session.state;\n  Sampler& sampler = session.sampler;\n  Tokenizer& tokenizer = session.tokenizer;\n\n  std::cout << \"Model active bytes with full context window: \" << model.active_bytes(model.config->max_seq_len) << std::endl;\n  std::cout << \"Model active bytes with no context: \" << model.active_bytes(0) << std::endl;\n\n  if (num_steps == 0) {\n    // `-n 0` means use the full context length\n    num_steps = model.config->max_seq_len;\n  }\n\n  {\n    ProfileDisabledScope profile_disabled;\n    std::cout << \"Running warmup...\" << std::endl;\n    // Do one inference as warmup.\n    // On CPU, this ensures all tensors are loaded into memory via mmap.\n    model.forward(state, 0, 0);\n    std::cout << \"Warmup complete\" << std::endl;\n  }\n\n  std::vector<int> encoding = encode_prompt(prompt, tokenizer);\n\n  uint64_t start_ms = get_timestamp_ms();\n  size_t read_bytes = 0;\n  // Hydrate KV cache by forwarding model on all prompt tokens and discarding output.\n  // This also generates output logits for the last token.\n  for (size_t pos = 0; pos < encoding.size(); pos++) {\n    ProfileScope scope(fmt::format(\"fwd_pos_{:03d}_hydrate\", pos));\n    int token_id = encoding[pos];\n    InferenceMode inferMode = pos + 1 == encoding.size() ? \n      InferenceMode::OUTPUT_LOGITS : InferenceMode::HYDRATE_KV_CACHE;\n    model.forward(state, token_id, pos, inferMode);\n    read_bytes += model.active_bytes(pos);\n  }\n  uint64_t end_hydrate_ms = get_timestamp_ms();\n  // For N steps:\n  // - Sample + decode output logits\n  // - Forward the model\n  for (int i = 0; i < num_steps || num_steps == -1; i++) {\n    int token_id = sampler.sample(state, temperature, top_p);\n    std::string token_str = tokenizer.decode_one(encoding.back(), token_id);\n    std::cout << token_str << std::flush;\n    encoding.push_back(token_id);\n    if (token_id == tokenizer.eos_id || token_id == tokenizer.eot_id) {\n      break;\n    }\n    ProfileScope scope(fmt::format(\"fwd_pos_{:03d}_decode\", encoding.size() - 1));\n    model.forward(state, token_id, encoding.size() - 1);\n    read_bytes += model.active_bytes(encoding.size() - 1);\n  }\n  std::cout << \"\\n\" << std::endl;\n  uint64_t end_ms = get_timestamp_ms();\n  double elapsed_s = (end_ms - start_ms) / 1000.0;\n  std::cout << fmt::format(\n    \"Generation stats:\\n\"\n    \"  {} tokens\\n\"\n    \"  throughput: {:.5}tok/s\\n\"\n    \"  latency: {:.5}s/tok\\n\"\n    \"  hydrate: {:.5}s\\n\"\n    \"  bandwidth: {:.5}GB/s\\n\"\n    \"  total: {:.5}s\\n\",\n    encoding.size(),\n    encoding.size() / elapsed_s,\n    elapsed_s / encoding.size(),\n    (end_hydrate_ms - start_ms) / 1000.0,\n    ((double)read_bytes / 1e9) / elapsed_s,\n    elapsed_s\n  ) << std::endl;\n\n#if PROFILE_ENABLED\n  std::cout << \"Profile total times (sec): \" << std::endl;\n  for (const auto& [key, value] : profile_times()) {\n    std::cout << key << \": \" << value << std::endl;\n  }\n#endif\n}\n\nstd::vector<int> V2_ENCODED_WIKITEXT = {\n  #include \"wikitest.cat.1chunk.v2-encoded.txt\"\n};\n\nstd::vector<int> V3_ENCODED_WIKITEXT = {\n  #include \"wikitest.cat.1chunk.v3-encoded.txt\"\n};\n\nvoid run_perplexity(\n  Session& session,\n  const std::vector<int>& encoding\n) {\n  Model& model = session.model;\n  InferenceState& state = session.state;\n  Sampler& sampler = session.sampler;\n\n  std::cout << \"Model active bytes with full context window: \" << model.active_bytes(model.config->max_seq_len) << std::endl;\n\n  {\n    ProfileDisabledScope profile_disabled;\n    std::cout << \"Running warmup...\" << std::endl;\n    // Do one inference as warmup.\n    // On CPU, this ensures all tensors are loaded into memory via mmap.\n    model.forward(state, 0, 0);\n    std::cout << \"Warmup complete\" << std::endl;\n  }\n\n  double sum_logprob = 0.0;\n  double ss_logprob = 0.0;\n  // Generates output logits for all tokens in the prompt and sum log probs to\n  // compute perplexity.\n  uint64_t start_ms = get_timestamp_ms();\n  size_t read_bytes = 0;\n  size_t N = encoding.size() - 1;\n  for (size_t pos = 0; pos + 1 < encoding.size(); pos++) {\n    std::cout << \"\\r Computing perplexity...\" << pos + 1 << \"/\" << N << std::flush;\n    \n    int token_id = encoding[pos];\n    model.forward(state, token_id, pos);\n    read_bytes += model.active_bytes(pos);\n\n    double logprob = std::log(sampler.sample_prob(encoding[pos + 1], state));\n    sum_logprob += logprob;\n    ss_logprob += logprob * logprob;\n  }\n  std::cout << std::endl;\n  uint64_t end_ms = get_timestamp_ms();\n  double elapsed_s = (end_ms - start_ms)/1000.0;\n  double perplexity = std::exp(-sum_logprob / N);\n  double perplexity_error = perplexity * std::sqrt(\n    (ss_logprob - sum_logprob * sum_logprob / N) / N / N\n  );\n  std::cout << fmt::format(\n    \"Stats:\\n\"\n    \"  {} tokens\\n\"\n    \"  perplexity: {:.5} ± {:.5}\\n\"\n    \"  throughput: {:.5}tok/s\\n\"\n    \"  latency: {:.5}s/tok\\n\"\n    \"  bandwidth: {:.5}GB/s\\n\"\n    \"  total: {:.5}s\\n\",\n    N,\n    perplexity,\n    perplexity_error,\n    N / elapsed_s,\n    elapsed_s / N,\n    ((double)read_bytes / 1e9) / elapsed_s,\n    elapsed_s\n  ) << std::endl;\n}\n\nvoid run_passkey(\n  Session& session,\n  const int n_junk,\n  const int passkey_pos\n) {\n  Model& model = session.model;\n  InferenceState& state = session.state;\n  Sampler& sampler = session.sampler;\n  Tokenizer& tokenizer = session.tokenizer;\n\n  std::cout << \"Model active bytes with full context window: \" << model.active_bytes(model.config->max_seq_len) << std::endl;\n\n  const std::string PROMPT_PREFIX = \n    \"There is an important info hidden inside a lot of irrelevant text. \"\n    \"Find it and memorize them. I will quiz you about the important information there.\";\n  const std::string PROMPT_SUFFIX = \" What is the pass key? The pass key is\";\n\n  const int passkey = std::rand() % 50000 + 1;\n  const int pos = passkey_pos == -1 ? std::rand() % n_junk : passkey_pos;\n\n  std::string prompt = PROMPT_PREFIX;\n  for (int i = 0; i < n_junk; i++) {\n    if (i % n_junk == pos) {\n      prompt += \" The pass key is \" + std::to_string(passkey) + \". Remember it. \" + std::to_string(passkey) + \" is the pass key.\";\n    }\n    prompt += \" The grass is green. The sky is blue. The sun is yellow. Here we go. There and back again.\";\n  }\n  prompt += PROMPT_SUFFIX;\n\n  std::vector<int> encoding;\n  {\n    uint64_t encode_start_ms = get_timestamp_ms();\n    encoding = tokenizer.encode(prompt, true);\n    uint64_t encode_end_ms = get_timestamp_ms();\n\n    uint64_t encoding_ms = encode_end_ms - encode_start_ms;\n    std::cout << fmt::format(\n      \"Encoding stats: ({} tokens, throughput: {:.5}tok/s, latency: {:.5}s/tok, total: {:.5}s)\\n\",\n      encoding.size(),\n      encoding.size() / (encoding_ms / 1000.0),\n      (encoding_ms / 1000.0) / encoding.size(),\n      encoding_ms / 1000.0\n    ) << std::endl;\n  }\n\n  // Allow max 16 steps to generate passkey\n  const size_t MAX_GENERATION_STEPS = 16;\n\n  std::cout << fmt::format(\n    \"Passkey test:\\n\"\n    \"  prompt: {} tokens\\n\"\n    \"  passkey: {}\\n\"\n    \"  passkey token index: ~{}\\n\",\n    encoding.size(),\n    passkey,\n    (int)(((float)pos) / n_junk * encoding.size())\n  ) << std::endl;\n\n  size_t N = encoding.size();\n  for (size_t pos = 0; pos < N; pos++) {\n    std::cout << \"\\r Running passkey test...\" << pos + 1 << \"/\" << N << std::flush;\n    int token_id = encoding[pos];\n    InferenceMode inferMode = pos + 1 == N ? \n      InferenceMode::OUTPUT_LOGITS : InferenceMode::HYDRATE_KV_CACHE;\n    model.forward(state, token_id, pos, inferMode);\n  }\n  std::cout << std::endl;\n  std::cout << PROMPT_SUFFIX << std::flush;\n  for (size_t pos = N; pos < N + MAX_GENERATION_STEPS; pos++) {\n    int token_id = sampler.sample(state);\n    std::string token_str = tokenizer.decode_one(encoding.back(), token_id);\n    std::cout << token_str << std::flush;\n    encoding.push_back(token_id);\n    if (token_id == tokenizer.eos_id || token_id == tokenizer.eot_id) {\n      break;\n    }\n    model.forward(state, token_id, pos);\n  }\n  std::cout << std::endl;\n}\n\nvoid run_interactive(Session& session) {\n  std::string input = \"\";\n  while (true) {\n    std::cout << \"> \" << std::flush;\n    std::getline(std::cin, input);\n    if (input == \"exit\") {\n      break;\n    }\n    // Split string by space\n    std::vector<std::string> arg_strs;\n    std::stringstream ss(input);\n    std::string arg;\n    while (ss >> arg) {\n      if (arg_strs.size() > 0 && arg_strs[arg_strs.size() - 1].starts_with(\"\\\"\") && !arg_strs[arg_strs.size() - 1].ends_with(\"\\\"\")) {\n        // Double quotes enclose strings that can contain spaces\n        arg_strs[arg_strs.size() - 1] += \" \" + arg;\n        if (arg.ends_with(\"\\\"\")) {\n          // Remove the double quotes\n          arg_strs[arg_strs.size() - 1] = arg_strs[arg_strs.size() - 1].substr(1, arg_strs[arg_strs.size() - 1].size() - 2);\n        }\n      } else {\n        arg_strs.push_back(arg);\n      }\n    }\n    if (arg_strs.size() == 0) {\n      help_usage_interactive();\n      continue;\n    }\n    std::string mode = arg_strs[0];\n    if (std::string(\"completion\").starts_with(mode)) {\n      mode = \"completion\";\n    } else if (std::string(\"passkey\").starts_with(mode) && mode != \"p\") {\n      mode = \"passkey\";\n    } else if (std::string(\"perplexity\").starts_with(mode) && mode != \"p\") {\n      mode = \"perplexity\";\n    } else if (std::string(\"interactive\").starts_with(mode)) {\n      mode = \"interactive\";\n    } else {\n      help_usage_interactive();\n      continue;\n    }\n    std::vector<const char*> args;\n    for (size_t i = 1; i < arg_strs.size(); i++) {\n      args.push_back(arg_strs[i].c_str());\n    }\n    if (mode == \"completion\") {\n      CompletionArgs completion_args;\n      if (!completion_args.parse_args(args)) {\n        help_usage_interactive();\n        continue;\n      }\n      run_completion(session, completion_args.prompt, completion_args.num_steps, completion_args.temperature, completion_args.top_p);\n    } else if (mode == \"passkey\") {\n      PasskeyArgs passkey_args;\n      if (!passkey_args.parse_args(args)) {\n        help_usage_interactive();\n        continue;\n      }\n      run_passkey(session, passkey_args.n_junk, passkey_args.passkey_pos);\n    } else if (mode == \"perplexity\") {\n      PerplexityArgs perplexity_args;\n      if (!perplexity_args.parse_args(args)) {\n        help_usage_interactive();\n        continue;\n      }\n      std::vector<int> encoding;\n      if (perplexity_args.use_wikitext) {\n        if (session.model_data.metadata.at(\"arch\").get<std::string>() == \"DeepseekV3ForCausalLM\") {\n          encoding = V3_ENCODED_WIKITEXT;\n        } else {\n          encoding = V2_ENCODED_WIKITEXT;\n        }\n      } else {\n        encoding = encode_prompt(perplexity_args.prompt, session.tokenizer);\n      }\n      run_perplexity(session, encoding);\n    }\n  }\n}\n\nint main(int argc, char* argv[]) {\n  std::vector<const char*> args(argv, argv + argc);\n  std::vector<const char*> next_args;\n\n  std::string checkpoint_dir = \"\";    // e.g. out/model.bin\n  // Options\n  std::string mode = \"completion\";     // completion, passkey, perplexity, or interactive\n  int context = 0;\n  bool lock_model_weights = false;\n\n  if (args.size() >= 2) {\n    checkpoint_dir = args[1];\n  } else {\n    error_usage();\n  }\n\n  // read in session args first, put everything else in next_args\n  for (size_t i = 2; i < args.size();) {\n    if (args[i][0] == '-' && strlen(args[i]) == 2) {\n      if (args[i][1] == 'h') {\n        error_usage();\n      } else if (args[i][1] == 'L') {\n        lock_model_weights = true;\n        i += 1;\n      } else if (args[i][1] == 'm') {\n        if (i + 1 >= args.size()) {\n          error_usage();\n        }\n        mode = args[i + 1];\n        if (std::string(\"completion\").starts_with(mode)) {\n          mode = \"completion\";\n        } else if (std::string(\"passkey\").starts_with(mode) && mode != \"p\") {\n          mode = \"passkey\";\n        } else if (std::string(\"perplexity\").starts_with(mode) && mode != \"p\") {\n          mode = \"perplexity\";\n        } else if (std::string(\"interactive\").starts_with(mode)) {\n          mode = \"interactive\";\n        } else {\n          error_usage();\n        }\n        i += 2;\n      } else if (args[i][1] == 'T') {\n        if (i + 1 >= args.size()) {\n          error_usage();\n        }\n        context = std::stoi(args[i + 1]);\n        i += 2;\n      } else {\n        next_args.push_back(args[i]);\n        i += 1;\n      }\n    } else {\n      next_args.push_back(args[i]);\n      i += 1;\n    }\n  }\n\n  if (mode == \"completion\") {\n    CompletionArgs completion_args;\n    if (!completion_args.parse_args(next_args)) {\n      error_usage();\n    }\n    Session session(checkpoint_dir, lock_model_weights, context, get_timestamp_ms());\n    run_completion(session, completion_args.prompt, completion_args.num_steps, completion_args.temperature, completion_args.top_p);\n  } else if (mode == \"passkey\") {\n    PasskeyArgs passkey_args;\n    if (!passkey_args.parse_args(next_args)) {\n      error_usage();\n    }\n    Session session(checkpoint_dir, lock_model_weights, context, get_timestamp_ms());\n    run_passkey(session, passkey_args.n_junk, passkey_args.passkey_pos);\n  } else if (mode == \"perplexity\") {\n    PerplexityArgs perplexity_args;\n    if (!perplexity_args.parse_args(next_args)) {\n      error_usage();\n    }\n    Session session(checkpoint_dir, lock_model_weights, context, get_timestamp_ms());\n    std::vector<int> encoding;\n    if (perplexity_args.use_wikitext) {\n      if (session.model_data.metadata.at(\"arch\").get<std::string>() == \"DeepseekV3ForCausalLM\") {\n        encoding = V3_ENCODED_WIKITEXT;\n      } else {\n        encoding = V2_ENCODED_WIKITEXT;\n      }\n    } else {\n      encoding = encode_prompt(perplexity_args.prompt, session.tokenizer);\n    }\n    run_perplexity(session, encoding);\n  } else if (mode == \"interactive\") {\n    if (next_args.size() != 0) {\n      error_usage();\n    }\n    Session session(checkpoint_dir, lock_model_weights, context, get_timestamp_ms());\n    run_interactive(session);\n  }\n\n  return 0;\n}"
  },
  {
    "path": "src/model.cpp",
    "content": "#include \"model.h\"\n\n#include \"json.hpp\"\n#include <algorithm>\n#include <array>\n#include <cfloat>\n#include \"fmt/format.h\"\n#include <iostream>\n#include <limits.h>\n#include <string>\n\n#include \"immintrin.h\"\n\n#include \"quant.h\"\n\nusing json = nlohmann::json;\n\nint cdiv(int a, int b) {\n  return (a + b - 1) / b;\n}\n\nvoid Config::from_yalm(YALMData& yalm, int context) {\n  dim = std::stoi(yalm.metadata.at(\"dim\").get<std::string>());\n  hidden_dim = std::stoi(yalm.metadata.at(\"hidden_dim\").get<std::string>());\n  n_layers = std::stoi(yalm.metadata.at(\"n_layers\").get<std::string>());\n  n_heads = std::stoi(yalm.metadata.at(\"n_heads\").get<std::string>());\n  vocab_size = std::stoi(yalm.metadata.at(\"vocab_size\").get<std::string>());\n  // mixture of experts\n  n_shared_experts = yalm.metadata.contains(\"n_shared_experts\") ? std::stoi(yalm.metadata.at(\"n_shared_experts\").get<std::string>()) : 0;\n  n_routed_experts = yalm.metadata.contains(\"n_routed_experts\") ? std::stoi(yalm.metadata.at(\"n_routed_experts\").get<std::string>()) : 0;\n  n_active_routed = yalm.metadata.contains(\"n_active_routed\") ? std::stoi(yalm.metadata.at(\"n_active_routed\").get<std::string>()) : 0;\n  moe_intermediate_size = yalm.metadata.contains(\"moe_intermediate_size\") ? std::stoi(yalm.metadata.at(\"moe_intermediate_size\").get<std::string>()) : 0;\n  routed_scaling_factor = yalm.metadata.contains(\"routed_scaling_factor\") ? std::stof(yalm.metadata.at(\"routed_scaling_factor\").get<std::string>()) : 1.0;\n  n_group = yalm.metadata.contains(\"n_group\") ? std::stoi(yalm.metadata.at(\"n_group\").get<std::string>()) : 1;\n  norm_topk_prob = yalm.metadata.contains(\"norm_topk_prob\") ? yalm.metadata.at(\"norm_topk_prob\").get<std::string>() == \"True\" : false;\n  std::string scoring_func_str = yalm.metadata.value(\"scoring_func\", \"softmax\");\n  if (scoring_func_str == \"softmax\") {\n    scoring_func = ScoringFunc::SOFTMAX;\n  } else if (scoring_func_str == \"sigmoid\") {\n    scoring_func = ScoringFunc::SIGMOID;\n  } else {\n    std::cerr << \"unsupported scoring_func '\" << scoring_func_str << \"', defaulting to softmax\" << std::endl;\n    scoring_func = ScoringFunc::SOFTMAX;\n  }\n  topk_group = yalm.metadata.contains(\"topk_group\") ? std::stoi(yalm.metadata.at(\"topk_group\").get<std::string>()) : 0;\n  std::string topk_method_str = yalm.metadata.value(\"topk_method\", \"\");\n  if (topk_method_str == \"greedy\") {\n    topk_method = TopKMethod::GREEDY;\n  } else if (topk_method_str == \"group_limited_greedy\") {\n    topk_method = TopKMethod::GROUP_LIMITED_GREEDY;\n  } else if (topk_method_str == \"noaux_tc\") {\n    topk_method = TopKMethod::NOAUX_TC;\n    assert(false && \"TODO: support for Deepseek v3\");\n  } else {\n    std::cerr << \"unsupported topk_method '\" << topk_method_str << \"', defaulting to greedy\" << std::endl;\n    topk_method = TopKMethod::GREEDY;\n  }\n  has_moegate_bias = yalm.metadata.at(\"arch\").get<std::string>() == \"DeepseekV3ForCausalLM\";\n  // multi-latent attention\n  use_mla = yalm.metadata.contains(\"use_mla\") ? \n    static_cast<bool>(std::stoi(yalm.metadata.at(\"use_mla\").get<std::string>())) : false;\n  kv_lora_rank = yalm.metadata.contains(\"kv_lora_rank\") ? std::stoi(yalm.metadata.at(\"kv_lora_rank\").get<std::string>()) : 0;\n  q_lora_rank = yalm.metadata.contains(\"q_lora_rank\") ? std::stoi(yalm.metadata.at(\"q_lora_rank\").get<std::string>()) : 0;\n  qk_nope_head_dim = yalm.metadata.contains(\"qk_nope_head_dim\") ? std::stoi(yalm.metadata.at(\"qk_nope_head_dim\").get<std::string>()) : 0;\n  qk_rope_head_dim = yalm.metadata.contains(\"qk_rope_head_dim\") ? std::stoi(yalm.metadata.at(\"qk_rope_head_dim\").get<std::string>()) : 0;\n  v_head_dim = yalm.metadata.contains(\"v_head_dim\") ? std::stoi(yalm.metadata.at(\"v_head_dim\").get<std::string>()) : 0;\n  head_dim = qk_nope_head_dim + qk_rope_head_dim;\n\n  max_seq_len = std::stoi(yalm.metadata.at(\"max_seq_len\").get<std::string>());\n  if (context) {\n    max_seq_len = std::min(max_seq_len, context);\n  }\n\n  rope_theta = std::stof(yalm.metadata.at(\"rope_theta\").get<std::string>());\n  norm_eps = std::stof(yalm.metadata.value(\"norm_eps\", \"1e-5\"));\n\n  std::string act_str = yalm.metadata.value(\"act_type\", \"gelu\");\n  if (act_str == \"gelu\") {\n    act = ActivationType::GELU;\n  } else if (act_str == \"silu\") {\n    act = ActivationType::SILU;\n  } else {\n    std::cerr << \"unsupported act_type, defaulting to gelu\" << std::endl;\n    act = ActivationType::GELU;\n  }\n\n  std::string norm_type_str = yalm.metadata.value(\"norm_type\", \"rmsnorm\");\n  if (norm_type_str == \"rmsnorm\") {\n    norm_type = LayerNormType::RMSNorm;\n  } else {\n    std::cerr << \"unsupported norm_type, defaulting to rmsnorm\" << std::endl;\n    norm_type = LayerNormType::RMSNorm;\n  }\n\n  first_k_dense_replace = yalm.metadata.contains(\"first_k_dense_replace\") ? \n    std::stoi(yalm.metadata.at(\"first_k_dense_replace\").get<std::string>()) : 0;\n\n  std::string quant = yalm.metadata.at(\"quant\").get<std::string>();\n  if (quant == \"fp32\") {\n    weight_quant = Quant::F32;\n  } else if (quant == \"fp16\") {\n    weight_quant = Quant::F16;\n  } else if (quant == \"f8e5m2\") {\n    weight_quant = Quant::F8E5M2;\n  } else if (quant == \"q2_k\") {\n    weight_quant = Quant::Q2_K;\n  } else if (quant == \"q3_k\") {\n    weight_quant = Quant::Q3_K;\n  } else {\n    std::cerr << \"FATAL: unsupported quant: \" << quant << std::endl;\n    assert(false);\n  }\n\n  // quantization\n  if (yalm.metadata.contains(\"quantization_block_size_0\")) {\n    block_size[0] = std::stoi(yalm.metadata.at(\"quantization_block_size_0\").get<std::string>());\n    block_size[1] = std::stoi(yalm.metadata.at(\"quantization_block_size_1\").get<std::string>());\n  }\n\n  // RoPE scaling\n  rs_beta_fast = std::stoi(yalm.metadata.at(\"rope_scaling_beta_fast\").get<std::string>());\n  rs_beta_slow = std::stoi(yalm.metadata.at(\"rope_scaling_beta_slow\").get<std::string>());\n  rs_factor = std::stof(yalm.metadata.at(\"rope_scaling_factor\").get<std::string>());\n  rs_mscale = std::stof(yalm.metadata.at(\"rope_scaling_mscale\").get<std::string>());\n  rs_mscale_all_dim = std::stof(yalm.metadata.at(\"rope_scaling_mscale_all_dim\").get<std::string>());\n  rs_original_max_position_embeddings = std::stoi(yalm.metadata.at(\"rope_scaling_original_max_position_embeddings\").get<std::string>());\n}\n\nstd::optional<QTensor> check_tensor(const Tensor* tensor, Quant weight_quant, std::array<int, 4> shape, const int debug_line) {\n  if (tensor == nullptr) {\n    std::cerr << \"FATAL: missing tensor at line \" << debug_line << std::endl;\n    assert(false);\n    return std::nullopt;\n  }\n  return QTensor::from_codec_tensor(*tensor, weight_quant, shape, debug_line);\n};\n\nconst Tensor* get_tensor(const YALMData& yalm, const std::string& key) {\n  auto it = yalm.tensors.find(key);\n  if (it == yalm.tensors.end()) {\n    std::cerr << \"FATAL: missing tensor: \" << key << std::endl;\n    assert(false);\n    return nullptr;\n  }\n  const Tensor& tensor = it->second;\n  return &tensor;\n};\n\nBlock::Block(\n  int layer_i,\n  const std::shared_ptr<Config> config,\n  const Tensor* rms_att_weight,\n  const Tensor* rms_ffn_weight,\n  const Tensor* w1,\n  const Tensor* s1,\n  const Tensor* w2,\n  const Tensor* s2,\n  const Tensor* w3,\n  const Tensor* s3,\n  const Tensor* shared_w1,\n  const Tensor* shared_s1,\n  const Tensor* shared_w2,\n  const Tensor* shared_s2,\n  const Tensor* shared_w3,\n  const Tensor* shared_s3,\n  const Tensor* moegate,\n  const Tensor* moegate_bias\n) : _layer_i(layer_i), _config(config) {\n  switch (config->weight_quant) {\n    case Quant::F32:\n    case Quant::F16:\n    case Quant::F8E5M2:\n    case Quant::Q2_K:\n    case Quant::Q3_K: {\n      break;\n    }\n    default: {\n      std::cerr << \"FATAL: unsupported weight quantization: \" << quant_to_string(config->weight_quant) << std::endl;\n      assert(false);\n      break;\n    }\n  }\n\n  _rms_att_weight = check_tensor(\n    rms_att_weight, Quant::F32, {config->dim, 0, 0, 0}, __LINE__\n  );\n  _rms_ffn_weight = check_tensor(\n    rms_ffn_weight, Quant::F32, {config->dim, 0, 0, 0}, __LINE__\n  );\n\n  bool need_block_scales = _config->weight_quant == Quant::F8E5M2;\n  int b0 = config->block_size[0];\n  int b1 = config->block_size[1];\n\n  if (config->n_routed_experts > 0 && layer_i >= config->first_k_dense_replace) {\n    _moegate = check_tensor(\n      moegate, Quant::F32, {config->n_routed_experts, config->dim, 0, 0}, __LINE__\n    );\n    if (moegate_bias != nullptr) {\n      _moegate_bias = check_tensor(\n        moegate_bias, Quant::F32, {config->n_routed_experts, 0, 0, 0}, __LINE__\n      );\n    }\n    _w1 = check_tensor(\n      w1, config->weight_quant, {config->n_routed_experts, config->moe_intermediate_size, config->dim, 0}, __LINE__\n    );\n    _w2 = check_tensor(\n      w2, config->weight_quant, {config->n_routed_experts, config->dim, config->moe_intermediate_size, 0}, __LINE__\n    );\n    _w3 = check_tensor(\n      w3, config->weight_quant, {config->n_routed_experts, config->moe_intermediate_size, config->dim, 0}, __LINE__\n    );\n    if (need_block_scales) {\n      _s1 = check_tensor(\n        s1, Quant::F32,\n        {config->n_routed_experts, cdiv(config->moe_intermediate_size, b0), cdiv(config->dim, b1), 0},\n        __LINE__\n      );\n      _s2 = check_tensor(\n        s2, Quant::F32,\n        {config->n_routed_experts, cdiv(config->dim, b0), cdiv(config->moe_intermediate_size, b1), 0},\n        __LINE__\n      );\n      _s3 = check_tensor(\n        s3, Quant::F32,\n        {config->n_routed_experts, cdiv(config->moe_intermediate_size, b0), cdiv(config->dim, b1), 0},\n        __LINE__\n      );\n    }\n    if (config->n_shared_experts > 0) {\n      _shared_w1 = check_tensor(\n        shared_w1, config->weight_quant, {config->n_shared_experts * config->moe_intermediate_size, config->dim, 0}, __LINE__\n      );\n      _shared_w2 = check_tensor(\n        shared_w2, config->weight_quant, {config->dim, config->n_shared_experts * config->moe_intermediate_size, 0}, __LINE__\n      );\n      _shared_w3 = check_tensor(\n        shared_w3, config->weight_quant, {config->n_shared_experts * config->moe_intermediate_size, config->dim, 0}, __LINE__\n      );\n      if (need_block_scales) {\n        _shared_s1 = check_tensor(\n          shared_s1, Quant::F32,\n          {cdiv(config->n_shared_experts * config->moe_intermediate_size, b0), cdiv(config->dim, b1), 0},\n          __LINE__\n        );\n        _shared_s2 = check_tensor(\n          shared_s2, Quant::F32,\n          {cdiv(config->dim, b0), cdiv(config->n_shared_experts * config->moe_intermediate_size, b1), 0},\n          __LINE__\n        );\n        _shared_s3 = check_tensor(\n          shared_s3, Quant::F32,\n          {cdiv(config->n_shared_experts * config->moe_intermediate_size, b0), cdiv(config->dim, b1), 0},\n          __LINE__\n        );\n      }\n    }\n  } else {\n    _w1 = check_tensor(\n      w1, config->weight_quant, {config->hidden_dim, config->dim, 0, 0}, __LINE__\n    );\n    _w2 = check_tensor(\n      w2, config->weight_quant, {config->dim, config->hidden_dim, 0, 0}, __LINE__\n    );\n    _w3 = check_tensor(\n      w3, config->weight_quant, {config->hidden_dim, config->dim, 0, 0}, __LINE__\n    );\n    if (need_block_scales) {\n      _s1 = check_tensor(\n        s1, Quant::F32,\n        {cdiv(config->hidden_dim, b0), cdiv(config->dim, b1), 0, 0},\n        __LINE__\n      );\n      _s2 = check_tensor(\n        s2, Quant::F32,\n        {cdiv(config->dim, b0), cdiv(config->hidden_dim, b1), 0, 0},\n        __LINE__\n      );\n      _s3 = check_tensor(\n        s3, Quant::F32,\n        {cdiv(config->hidden_dim, b0), cdiv(config->dim, b1), 0, 0},\n        __LINE__\n      );\n    }\n  }\n}\n\nBlock::~Block() {}\n\nvoid Block::block(\n  InferenceState& s,\n  int pos,\n  int kv_sink,\n  int kv_pos,\n  int kv_len\n) const {\n  if (_device == Device::CPU) {\n    switch (_config->weight_quant) {\n      case Quant::F32:\n        _block_cpu<float>(s, pos, kv_sink, kv_pos, kv_len);\n        break;\n      case Quant::F16:\n#if defined(__AVX2__) && defined(__F16C__)\n        _block_cpu<f16_t>(s, pos, kv_sink, kv_pos, kv_len);\n#else\n        assert(false && \"float16 not supported on this platform\");\n#endif\n        break;\n      case Quant::F8E5M2:\n        _block_cpu<f8e5m2_t>(s, pos, kv_sink, kv_pos, kv_len);\n        break;\n      case Quant::Q2_K:\n        _block_cpu<block_q2_K>(s, pos, kv_sink, kv_pos, kv_len);\n        break;\n      case Quant::Q3_K:\n        _block_cpu<block_q3_K>(s, pos, kv_sink, kv_pos, kv_len);\n        break;\n      default:\n        assert(false && \"unsupported weight quantization for cpu\");\n    }\n  }\n}\n\ndouble Block::active_bytes(size_t pos) const {\n  double bytes_per_weight = bits_per_weight(_config->weight_quant, _config->block_size[0] * _config->block_size[1]) / 8.0;\n\n  double bytes = 0;\n  bytes += _rms_att_weight->size;\n  bytes += _rms_ffn_weight->size;\n  if (_config->n_routed_experts > 0 && _w1->ndim() == 3) {\n    bytes += _moegate->size;\n    if (_moegate_bias) bytes += _moegate_bias->size;\n    // bytes_per_weight accounts for scales and other quantization schemes\n    bytes += _config->n_active_routed * 3 * _config->dim * _config->moe_intermediate_size * bytes_per_weight; // w1, w2, w3\n  } else {\n    bytes += _w1->size + _w2->size + _w3->size; // w1, w2, w3\n    if (_s1) {\n      bytes += _s1->size;\n      bytes += _s2->size;\n      bytes += _s3->size;\n    }\n  }\n  if (_config->n_shared_experts > 0) {\n    if (_shared_w1) bytes += _shared_w1->size;\n    if (_shared_s1) bytes += _shared_s1->size;\n    if (_shared_w2) bytes += _shared_w2->size;\n    if (_shared_s2) bytes += _shared_s2->size;\n    if (_shared_w3) bytes += _shared_w3->size;\n    if (_shared_s3) bytes += _shared_s3->size;\n  }\n  return bytes;\n}\n\nBlockMHA::BlockMHA(\n  int layer_i,\n  const std::shared_ptr<Config> config,\n  const Tensor* rms_att_weight,\n  const Tensor* rms_q_a_weight,\n  const Tensor* rms_kv_a_weight,\n  const Tensor* rms_ffn_weight,\n  const Tensor* wq,\n  const Tensor* sq,\n  const Tensor* wq_a,\n  const Tensor* sq_a,\n  const Tensor* wkv_a,\n  const Tensor* skv_a,\n  const Tensor* wq_b,\n  const Tensor* sq_b,\n  const Tensor* wkv_b,\n  const Tensor* skv_b,\n  const Tensor* wo,\n  const Tensor* so,\n  const Tensor* w1,\n  const Tensor* s1,\n  const Tensor* w2,\n  const Tensor* s2,\n  const Tensor* w3,\n  const Tensor* s3,\n  const Tensor* shared_w1,\n  const Tensor* shared_s1,\n  const Tensor* shared_w2,\n  const Tensor* shared_s2,\n  const Tensor* shared_w3,\n  const Tensor* shared_s3,\n  const Tensor* moegate,\n  const Tensor* moegate_bias\n) : Block(layer_i, config, rms_att_weight, rms_ffn_weight, w1, s1, w2, s2, w3, s3, shared_w1, shared_s1, shared_w2, shared_s2, shared_w3, shared_s3, moegate, moegate_bias) {\n\n  bool need_block_scales = _config->weight_quant == Quant::F8E5M2;\n  int b0 = config->block_size[0];\n  int b1 = config->block_size[1];\n\n  if (config->q_lora_rank > 0) {\n    _rms_q_a_weight = check_tensor(\n      rms_q_a_weight, Quant::F32, {config->q_lora_rank, 0, 0, 0}, __LINE__\n    );\n    _wq_a = check_tensor(\n      wq_a, config->weight_quant, {config->q_lora_rank, config->dim, 0, 0}, __LINE__\n    );\n    _wq_b = check_tensor(\n      wq_b, config->weight_quant, {config->n_heads * config->head_dim, config->q_lora_rank, 0, 0}, __LINE__\n    );\n    if (need_block_scales) {\n      _sq_a = check_tensor(\n        sq_a, Quant::F32,\n        {cdiv(config->q_lora_rank, b0), cdiv(config->dim, b1), 0, 0},\n        __LINE__\n      );\n      _sq_b = check_tensor(\n        sq_b, Quant::F32,\n        {cdiv(config->n_heads * config->head_dim, b0), cdiv(config->q_lora_rank, b1), 0, 0},\n        __LINE__\n      );\n    }\n  } else {\n    _wq = check_tensor(\n      wq, config->weight_quant, {config->n_heads * config->head_dim, config->dim, 0, 0}, __LINE__\n    );\n    if (need_block_scales) {\n      _sq = check_tensor(\n        sq, Quant::F32,\n        {cdiv(config->n_heads * config->head_dim, b0), cdiv(config->dim, b1), 0, 0},\n        __LINE__\n      );\n    }\n  }\n\n  _rms_kv_a_weight = check_tensor(\n    rms_kv_a_weight, Quant::F32, {config->kv_lora_rank, 0, 0, 0}, __LINE__ // Assuming kv_lora_rank is correct size here for MHA norm too\n  );\n  _wkv_a = check_tensor(\n    wkv_a, config->weight_quant, {config->kv_lora_rank + config->qk_rope_head_dim, config->dim, 0, 0}, __LINE__\n  );\n  _wkv_b = check_tensor(\n    wkv_b, config->weight_quant, {config->n_heads * (config->head_dim-config->qk_rope_head_dim+config->v_head_dim), config->kv_lora_rank, 0, 0}, __LINE__\n  );\n  _wo = check_tensor(\n    wo, config->weight_quant, {config->dim, config->n_heads * config->v_head_dim, 0, 0}, __LINE__\n  );\n\n  if (need_block_scales) {\n    _skv_a = check_tensor(\n      skv_a, Quant::F32,\n      {cdiv(config->kv_lora_rank + config->qk_rope_head_dim, b0), cdiv(config->dim, b1), 0, 0},\n      __LINE__\n    );\n    _skv_b = check_tensor(\n      skv_b, Quant::F32,\n      {cdiv(config->n_heads * (config->head_dim-config->qk_rope_head_dim+config->v_head_dim), b0), cdiv(config->kv_lora_rank, b1), 0, 0},\n      __LINE__\n    );\n    _so = check_tensor(\n      so, Quant::F32,\n      {cdiv(config->dim, b0), cdiv(config->n_heads * config->v_head_dim, b1), 0, 0},\n      __LINE__\n    );\n  }\n\n  _key_cache = new f16_t[config->max_seq_len * config->n_heads * config->head_dim]();\n  _value_cache = new f16_t[config->max_seq_len * config->n_heads * config->v_head_dim]();\n}\n\nBlockMHA::~BlockMHA() {\n  if (_device == Device::CPU) {\n    delete[] _key_cache;\n    delete[] _value_cache;\n  }\n}\n\ndouble BlockMHA::active_bytes(size_t pos) const {\n  double bytes = Block::active_bytes(pos);\n  \n  // Add active bytes for attention and KV cache\n  if (_wq) bytes += _wq->size;\n  if (_sq) bytes += _sq->size;\n  if (_wq_a) bytes += _wq_a->size;\n  if (_sq_a) bytes += _sq_a->size;\n  if (_wkv_a) bytes += _wkv_a->size;\n  if (_skv_a) bytes += _skv_a->size;\n  if (_wo) bytes += _wo->size;\n  if (_so) bytes += _so->size;\n  if (_wq_b) bytes += _wq_b->size;\n  if (_sq_b) bytes += _sq_b->size;\n  if (_wkv_b) bytes += _wkv_b->size;\n  if (_skv_b) bytes += _skv_b->size;\n  \n  size_t kv_len = std::min(static_cast<size_t>(_config->max_seq_len), pos + 1);\n  size_t kv_entry_size = sizeof(f16_t);\n  bytes += 2 * kv_len * _config->n_heads * _config->head_dim * kv_entry_size; // key_cache, value_cache\n  return bytes;\n}\n\nvoid BlockMHA::attention_impl(\n  InferenceState& s, int pos, int kv_sink, int kv_pos, int kv_len\n) const {\n  switch (_config->weight_quant) {\n    case Quant::F32:\n      _attention_impl<float>(s, pos, kv_sink, kv_pos, kv_len);\n      break;\n    case Quant::F16:\n      _attention_impl<f16_t>(s, pos, kv_sink, kv_pos, kv_len);\n      break;\n    case Quant::F8E5M2:\n      _attention_impl<f8e5m2_t>(s, pos, kv_sink, kv_pos, kv_len);\n      break;\n    case Quant::Q2_K:\n      _attention_impl<block_q2_K>(s, pos, kv_sink, kv_pos, kv_len);\n      break;\n    case Quant::Q3_K:\n      _attention_impl<block_q3_K>(s, pos, kv_sink, kv_pos, kv_len);\n      break;\n    default:\n      assert(false && \"unsupported weight quantization for mha\");\n  }\n}\n\n\nBlockMLA::BlockMLA(\n  int layer_i,\n  const std::shared_ptr<Config> config,\n  const Tensor* rms_att_weight,\n  const Tensor* rms_q_a_weight,\n  const Tensor* rms_kv_a_weight,\n  const Tensor* rms_ffn_weight,\n  const Tensor* wq_a,\n  const Tensor* sq_a,\n  const Tensor* wkv_a,\n  const Tensor* skv_a,\n  const Tensor* wo,\n  const Tensor* so,\n  const Tensor* wc,\n  const Tensor* sc,\n  const Tensor* wq_rope_b,\n  const Tensor* sq_rope_b,\n  const Tensor* wv_b,\n  const Tensor* sv_b,\n  const Tensor* w1,\n  const Tensor* s1,\n  const Tensor* w2,\n  const Tensor* s2,\n  const Tensor* w3,\n  const Tensor* s3,\n  const Tensor* shared_w1,\n  const Tensor* shared_s1,\n  const Tensor* shared_w2,\n  const Tensor* shared_s2,\n  const Tensor* shared_w3,\n  const Tensor* shared_s3,\n  const Tensor* moegate,\n  const Tensor* moegate_bias\n) : Block(layer_i, config, rms_att_weight, rms_ffn_weight, w1, s1, w2, s2, w3, s3, shared_w1, shared_s1, shared_w2, shared_s2, shared_w3, shared_s3, moegate, moegate_bias) {\n\n  bool need_block_scales = _config->weight_quant == Quant::F8E5M2;\n  int b0 = config->block_size[0];\n  int b1 = config->block_size[1];\n\n  _rms_q_a_weight = check_tensor(\n    rms_q_a_weight, Quant::F32, {config->q_lora_rank, 0, 0, 0}, __LINE__\n  );\n  _rms_kv_a_weight = check_tensor(\n    rms_kv_a_weight, Quant::F32, {config->kv_lora_rank, 0, 0, 0}, __LINE__ // Only norm latent part\n  );\n\n  _wq_a = check_tensor(\n    wq_a, config->weight_quant, {config->q_lora_rank, config->dim, 0, 0}, __LINE__\n  );\n  _wkv_a = check_tensor(\n    wkv_a, config->weight_quant, {config->kv_lora_rank + config->qk_rope_head_dim, config->dim, 0, 0}, __LINE__\n  );\n  _wc = check_tensor(\n    wc, config->weight_quant, {config->n_heads * config->kv_lora_rank, config->q_lora_rank, 0, 0}, __LINE__\n  );\n  _wq_rope_b = check_tensor(\n    wq_rope_b, config->weight_quant, {config->n_heads * config->qk_rope_head_dim, config->q_lora_rank, 0, 0}, __LINE__\n  );\n  _wv_b = check_tensor(\n      wv_b, config->weight_quant, {config->n_heads * config->v_head_dim, config->kv_lora_rank, 0, 0}, __LINE__\n  );\n  // Reshape _wv_b from 2D to 3D\n  _wv_b = QTensor(_wv_b->quant, {config->n_heads, config->v_head_dim, config->kv_lora_rank}, _wv_b->data, _wv_b->size);\n  _wo = check_tensor(\n    wo, config->weight_quant, {config->dim, config->n_heads * config->v_head_dim, 0, 0}, __LINE__\n  );\n\n  if (need_block_scales) {\n    _sq_a = check_tensor(\n      sq_a, Quant::F32,\n      {cdiv(config->q_lora_rank, b0), cdiv(config->dim, b1), 0, 0},\n      __LINE__\n    );\n    _skv_a = check_tensor(\n      skv_a, Quant::F32,\n      {cdiv(config->kv_lora_rank + config->qk_rope_head_dim, b0), cdiv(config->dim, b1), 0, 0},\n      __LINE__\n    );\n    _sc = check_tensor(\n      sc, Quant::F32,\n      {cdiv(config->n_heads * config->kv_lora_rank, b0), cdiv(config->q_lora_rank, b1), 0, 0},\n      __LINE__\n    );\n    _sq_rope_b = check_tensor(\n      sq_rope_b, Quant::F32,\n      {cdiv(config->n_heads * config->qk_rope_head_dim, b0), cdiv(config->q_lora_rank, b1), 0, 0},\n      __LINE__\n    );\n    _sv_b = check_tensor(\n      sv_b, Quant::F32,\n      {cdiv(config->n_heads * config->v_head_dim, b0), cdiv(config->kv_lora_rank, b1), 0, 0},\n      __LINE__\n    );\n    _so = check_tensor(\n      so, Quant::F32,\n      {cdiv(config->dim, b0), cdiv(config->n_heads * config->v_head_dim, b1), 0, 0},\n      __LINE__\n    );\n  }\n\n  _kv_nope_cache = new f16_t[config->max_seq_len * config->kv_lora_rank]();\n  _kv_rope_cache = new f16_t[config->max_seq_len * config->qk_rope_head_dim]();\n}\n\nBlockMLA::~BlockMLA() {\n  if (_device == Device::CPU) {\n    delete[] _kv_nope_cache;\n    delete[] _kv_rope_cache;\n  }\n}\n\ndouble BlockMLA::active_bytes(size_t pos) const {\n  double bytes = Block::active_bytes(pos);\n\n  bytes += _rms_q_a_weight->size;\n  bytes += _rms_kv_a_weight->size;\n  if (_wq_a) bytes += _wq_a->size;\n  if (_sq_a) bytes += _sq_a->size;\n  if (_wkv_a) bytes += _wkv_a->size;\n  if (_skv_a) bytes += _skv_a->size;\n  if (_wo) bytes += _wo->size;\n  if (_so) bytes += _so->size;\n  if (_wc) bytes += _wc->size;\n  if (_sc) bytes += _sc->size;\n  if (_wq_rope_b) bytes += _wq_rope_b->size;\n  if (_sq_rope_b) bytes += _sq_rope_b->size;\n  if (_wv_b) bytes += _wv_b->size;\n  if (_sv_b) bytes += _sv_b->size;\n  size_t kv_len = std::min(static_cast<size_t>(_config->max_seq_len), pos + 1);\n  size_t kv_entry_size = sizeof(f16_t);\n  bytes += kv_len * _config->kv_lora_rank * kv_entry_size; // kv_nope_cache\n  bytes += kv_len * _config->qk_rope_head_dim * kv_entry_size; // kv_rope_cache\n  return bytes;\n}\n\nvoid BlockMLA::attention_impl(\n  InferenceState& s, int pos, int kv_sink, int kv_pos, int kv_len\n) const {\n  switch (_config->weight_quant) {\n    case Quant::F32:\n      _attention_impl<float>(s, pos, kv_sink, kv_pos, kv_len);\n      break;\n    case Quant::F16:\n      _attention_impl<f16_t>(s, pos, kv_sink, kv_pos, kv_len);\n      break;\n    case Quant::F8E5M2:\n      _attention_impl<f8e5m2_t>(s, pos, kv_sink, kv_pos, kv_len);\n      break;\n    case Quant::Q2_K:\n      _attention_impl<block_q2_K>(s, pos, kv_sink, kv_pos, kv_len);\n      break;\n    case Quant::Q3_K:\n      _attention_impl<block_q3_K>(s, pos, kv_sink, kv_pos, kv_len);\n      break;\n    default:\n      assert(false && \"unsupported weight quantization for mla\");\n  }\n}\n\nInferenceState::InferenceState(const std::shared_ptr<Config> config): \n  _config(config) {\n  assert(config);\n  _x = new float[config->dim]();\n  _xb = new float[config->dim]();\n  _xb2 = new float[std::max({\n    config->dim, \n    config->n_heads * config->v_head_dim, \n    config->n_heads * config->kv_lora_rank\n  })]();\n  _hb = new float[std::max({\n    config->dim, \n    config->hidden_dim\n  })]();\n  _hb2 = new float[config->hidden_dim]();\n  if (config->q_lora_rank > 0) {\n    _q_a = new float[config->q_lora_rank]();\n  }\n  _q = new float[config->n_heads * config->head_dim]();\n  _kv_a = new float[config->kv_lora_rank + config->qk_rope_head_dim]();\n  _kv_b = new float[config->n_heads * (config->head_dim-config->qk_rope_head_dim+config->v_head_dim)]();\n  _ropebuf = new float[config->n_heads * config->qk_rope_head_dim]();\n  _k = new float[config->n_heads * config->head_dim]();\n  _v = new float[config->n_heads * config->v_head_dim]();\n  _att = new float[config->n_heads * config->max_seq_len]();\n  _logits = new float[config->vocab_size]();\n  _logit_indices = new int[config->vocab_size]();\n  for (int i = 0; i < config->vocab_size; i++){\n    _logit_indices[i] = i;\n  }\n  if (config->use_mla) {\n    _q_c = new float[config->n_heads * config->kv_lora_rank]();\n    _q_rope = new float[config->n_heads * config->qk_rope_head_dim]();\n  }\n  if (config->n_routed_experts > 0) {\n    _moe_weights = new float[config->n_routed_experts]();\n    _active_experts = new int[config->n_active_routed]();\n    _active_experts_weights = new float[config->n_active_routed]();\n  }\n  // TODO: consider dynamically resizing based on inputs\n  size_t aqb_nitems = std::max({\n    config->dim,\n    config->moe_intermediate_size,\n    config->n_heads * config->v_head_dim,\n    config->n_heads * config->kv_lora_rank,\n    config->hidden_dim\n  });\n  size_t aqb_nblocks = aqb_nitems / QK_K;\n  _aqb = new uint8_t[aqb_nblocks * sizeof(block_q8_K)]();\n}\n\nInferenceState::~InferenceState() {\n  if (_device == Device::CPU) {\n    delete[] _x;\n    delete[] _xb;\n    delete[] _xb2;\n    delete[] _hb;\n    delete[] _hb2;\n    if (_q_a != nullptr) {\n      delete[] _q_a;\n    }\n    delete[] _q;\n    delete[] _kv_a;\n    delete[] _kv_b;\n    delete[] _ropebuf;\n    delete[] _k;\n    delete[] _v;\n    delete[] _att;\n    delete[] _logits;\n    delete[] _logit_indices;\n    if (_moe_weights != nullptr) {\n      delete[] _moe_weights;\n      delete[] _active_experts;\n      delete[] _active_experts_weights;\n    }\n    delete[] _aqb;\n  }\n}\n\nModel::Model(YALMData& yalm, int context) {\n  config = std::make_shared<Config>();\n  config->from_yalm(yalm, context);\n  std::cout << \"loading model with quant: \" << quant_to_string(config->weight_quant) << std::endl;\n\n  bool need_weight_scales = config->weight_quant == Quant::F8E5M2;\n  bool use_mla = config->use_mla;\n  int b0 = config->block_size[0];\n  int b1 = config->block_size[1];\n\n  token_embedding_table = check_tensor(\n    get_tensor(yalm, \"model.embed.weight\"),\n    config->weight_quant,\n    {config->vocab_size, config->dim, 0, 0},\n    __LINE__\n  );\n  if (need_weight_scales) {\n    token_embedding_scale = check_tensor(\n      get_tensor(yalm, \"model.embed.scale\"),\n      Quant::F32,\n      {cdiv(config->vocab_size, b0), cdiv(config->dim, b1), 0, 0},\n      __LINE__\n    );\n  }\n\n  for (int i = 0; i < config->n_layers; ++i) {\n    const Tensor* p_rms_att_weight = get_tensor(yalm, fmt::format(\"model.layers.{}.attn.norm.weight\", i));\n    const Tensor* p_rms_ffn_weight = get_tensor(yalm, fmt::format(\"model.layers.{}.mlp.norm.weight\", i));\n    const Tensor* p_w1 = get_tensor(yalm, fmt::format(\"model.layers.{}.mlp.w1.weight\", i));\n    const Tensor* p_s1 = need_weight_scales ? get_tensor(yalm, fmt::format(\"model.layers.{}.mlp.w1.scale\", i)) : nullptr;\n    const Tensor* p_w2 = get_tensor(yalm, fmt::format(\"model.layers.{}.mlp.w2.weight\", i));\n    const Tensor* p_s2 = need_weight_scales ? get_tensor(yalm, fmt::format(\"model.layers.{}.mlp.w2.scale\", i)) : nullptr;\n    const Tensor* p_w3 = get_tensor(yalm, fmt::format(\"model.layers.{}.mlp.w3.weight\", i));\n    const Tensor* p_s3 = need_weight_scales ? get_tensor(yalm, fmt::format(\"model.layers.{}.mlp.w3.scale\", i)) : nullptr;\n    const Tensor* p_shared_w1 = (i >= config->first_k_dense_replace && config->n_shared_experts > 0) ? get_tensor(yalm, fmt::format(\"model.layers.{}.shared_mlp.w1.weight\", i)) : nullptr;\n    const Tensor* p_shared_s1 = (need_weight_scales && i >= config->first_k_dense_replace && config->n_shared_experts > 0) ? get_tensor(yalm, fmt::format(\"model.layers.{}.shared_mlp.w1.scale\", i)) : nullptr;\n    const Tensor* p_shared_w2 = (i >= config->first_k_dense_replace && config->n_shared_experts > 0) ? get_tensor(yalm, fmt::format(\"model.layers.{}.shared_mlp.w2.weight\", i)) : nullptr;\n    const Tensor* p_shared_s2 = (need_weight_scales && i >= config->first_k_dense_replace && config->n_shared_experts > 0) ? get_tensor(yalm, fmt::format(\"model.layers.{}.shared_mlp.w2.scale\", i)) : nullptr;\n    const Tensor* p_shared_w3 = (i >= config->first_k_dense_replace && config->n_shared_experts > 0) ? get_tensor(yalm, fmt::format(\"model.layers.{}.shared_mlp.w3.weight\", i)) : nullptr;\n    const Tensor* p_shared_s3 = (need_weight_scales && i >= config->first_k_dense_replace && config->n_shared_experts > 0) ? get_tensor(yalm, fmt::format(\"model.layers.{}.shared_mlp.w3.scale\", i)) : nullptr;\n    const Tensor* p_moegate = (i >= config->first_k_dense_replace && config->n_routed_experts > 0) ? get_tensor(yalm, fmt::format(\"model.layers.{}.moegate.weight\", i)) : nullptr;\n    const Tensor* p_moegate_bias = (i >= config->first_k_dense_replace && config->n_routed_experts > 0 && config->has_moegate_bias) ? get_tensor(yalm, fmt::format(\"model.layers.{}.moegate.bias\", i)) : nullptr;\n\n    const Tensor* p_rms_q_a_weight = config->q_lora_rank > 0 ? get_tensor(yalm, fmt::format(\"model.layers.{}.attn.q_a_norm.weight\", i)) : nullptr;\n    const Tensor* p_rms_kv_a_weight = get_tensor(yalm, fmt::format(\"model.layers.{}.attn.kv_a_norm.weight\", i));\n    const Tensor* p_wq_a = config->q_lora_rank > 0 ? get_tensor(yalm, fmt::format(\"model.layers.{}.attn.wq_a.weight\", i)) : nullptr;\n    const Tensor* p_sq_a = (need_weight_scales && config->q_lora_rank > 0) ? get_tensor(yalm, fmt::format(\"model.layers.{}.attn.wq_a.scale\", i)) : nullptr;\n    const Tensor* p_wkv_a = get_tensor(yalm, fmt::format(\"model.layers.{}.attn.wkv_a.weight\", i));\n    const Tensor* p_skv_a = need_weight_scales ? get_tensor(yalm, fmt::format(\"model.layers.{}.attn.wkv_a.scale\", i)) : nullptr;\n    const Tensor* p_wo = get_tensor(yalm, fmt::format(\"model.layers.{}.attn.wo.weight\", i));\n    const Tensor* p_so = need_weight_scales ? get_tensor(yalm, fmt::format(\"model.layers.{}.attn.wo.scale\", i)) : nullptr;\n\n\n    if (use_mla) {\n      const Tensor* p_wc = get_tensor(yalm, fmt::format(\"model.layers.{}.attn.wc.weight\", i));\n      const Tensor* p_sc = need_weight_scales ? get_tensor(yalm, fmt::format(\"model.layers.{}.attn.wc.scale\", i)) : nullptr;\n      const Tensor* p_wq_rope_b = get_tensor(yalm, fmt::format(\"model.layers.{}.attn.wq_rope_b.weight\", i));\n      const Tensor* p_sq_rope_b = need_weight_scales ? get_tensor(yalm, fmt::format(\"model.layers.{}.attn.wq_rope_b.scale\", i)) : nullptr;\n      const Tensor* p_wv_b = get_tensor(yalm, fmt::format(\"model.layers.{}.attn.wv_b.weight\", i));\n      const Tensor* p_sv_b = need_weight_scales ? get_tensor(yalm, fmt::format(\"model.layers.{}.attn.wv_b.scale\", i)) : nullptr;\n\n      blocks.emplace_back(std::make_shared<BlockMLA>(\n        i, config,\n        p_rms_att_weight, p_rms_q_a_weight, p_rms_kv_a_weight, p_rms_ffn_weight,\n        p_wq_a, p_sq_a, p_wkv_a, p_skv_a, p_wo, p_so,\n        p_wc, p_sc, p_wq_rope_b, p_sq_rope_b, p_wv_b, p_sv_b,\n        p_w1, p_s1, p_w2, p_s2, p_w3, p_s3,\n        p_shared_w1, p_shared_s1, p_shared_w2, p_shared_s2, p_shared_w3, p_shared_s3,\n        p_moegate, p_moegate_bias\n      ));\n    } else {\n      const Tensor* p_wq = config->q_lora_rank == 0 ? get_tensor(yalm, fmt::format(\"model.layers.{}.attn.wq.weight\", i)) : nullptr;\n      const Tensor* p_sq = (need_weight_scales && config->q_lora_rank == 0) ? get_tensor(yalm, fmt::format(\"model.layers.{}.attn.wq.scale\", i)) : nullptr;\n      const Tensor* p_wq_b = config->q_lora_rank > 0 ? get_tensor(yalm, fmt::format(\"model.layers.{}.attn.wq_b.weight\", i)) : nullptr;\n      const Tensor* p_sq_b = (need_weight_scales && config->q_lora_rank > 0) ? get_tensor(yalm, fmt::format(\"model.layers.{}.attn.wq_b.scale\", i)) : nullptr;\n      const Tensor* p_wkv_b = get_tensor(yalm, fmt::format(\"model.layers.{}.attn.wkv_b.weight\", i));\n      const Tensor* p_skv_b = need_weight_scales ? get_tensor(yalm, fmt::format(\"model.layers.{}.attn.wkv_b.scale\", i)) : nullptr;\n\n      blocks.emplace_back(std::make_shared<BlockMHA>(\n        i, config,\n        p_rms_att_weight, p_rms_q_a_weight, p_rms_kv_a_weight, p_rms_ffn_weight,\n        p_wq, p_sq, p_wq_a, p_sq_a, p_wkv_a, p_skv_a,\n        p_wq_b, p_sq_b, p_wkv_b, p_skv_b, p_wo, p_so,\n        p_w1, p_s1, p_w2, p_s2, p_w3, p_s3,\n        p_shared_w1, p_shared_s1, p_shared_w2, p_shared_s2, p_shared_w3, p_shared_s3,\n        p_moegate, p_moegate_bias\n      ));\n    }\n  }\n\n  rms_final_weight = check_tensor(\n    get_tensor(yalm, \"model.norm.weight\"),\n    Quant::F32,\n    {config->dim, 0, 0, 0},\n    __LINE__\n  );\n  bool tie_word_embeddings = yalm.tensors.count(\"model.output.weight\") == 0;\n  if (tie_word_embeddings) {\n    wcls = token_embedding_table;\n    scls = token_embedding_scale;\n  } else {\n    wcls = check_tensor(\n      get_tensor(yalm, \"model.output.weight\"),\n      config->weight_quant,\n      {config->vocab_size, config->dim, 0, 0},\n      __LINE__\n    );\n    if (need_weight_scales) {\n      scls = check_tensor(\n        get_tensor(yalm, \"model.output.scale\"),\n        Quant::F32,\n        {cdiv(config->vocab_size, b0), cdiv(config->dim, b1), 0, 0},\n        __LINE__\n      );\n    }\n  }\n}\n\nvoid Model::forward(InferenceState& s, int token, int pos, InferenceMode mode) {\n  if (s.device() != _device) {\n    std::cerr << \"FATAL: inference state device mismatch\" << std::endl;\n    assert(false);\n    return;\n  }\n  if (_device == Device::CPU) {\n    _forward_cpu(s, token, pos, mode);\n  }\n}\n\ndouble Model::active_bytes(size_t pos) const {\n  double bytes_per_weight = bits_per_weight(config->weight_quant, config->block_size[0] * config->block_size[1]) / 8.0;\n\n  double bytes = 0;\n  bytes += config->dim * bytes_per_weight; // 1 row of token_embedding_table\n  // blocks\n  for (auto& block : blocks) {\n    bytes += block->active_bytes(pos);\n  }\n  bytes += rms_final_weight->size;\n  bytes += wcls->size;\n  if (scls) {\n    bytes += scls->size;\n  }\n\n  return bytes;\n}\n\n#if DEBUG_MODEL\nDebugTensor::DebugTensor(const std::vector<float>& data) {\n  data_f32 = data;\n  data_type = DataType::F32;\n}\nDebugTensor::DebugTensor(const std::vector<f16_t>& data) {\n  data_f16 = data;\n  data_type = DataType::F16;\n}\n\nfloat DebugTensor::max_err(const DebugTensor& other) const {\n  if (data_type != other.data_type) {\n    return -1;\n  }\n  if (data_type == DataType::F32) {\n    float max_err = 0;\n    for (size_t i = 0; i < data_f32.size(); i++) {\n      max_err = std::max(max_err, std::abs(data_f32[i] - other.data_f32[i]));\n    }\n    return max_err;\n  } else {\n#if defined(__F16C__)\n    float max_err = 0;\n    for (size_t i = 0; i < data_f16.size(); i++) {\n      max_err = std::max(max_err, std::abs(_cvtsh_ss(data_f16[i]) - _cvtsh_ss(other.data_f16[i])));\n    }\n    return max_err;\n#else\n  assert(false && \"float16 not supported on this platform\");\n#endif\n  }\n}\n#endif"
  },
  {
    "path": "src/model.h",
    "content": "#pragma once\n\n#include \"codec.h\"\n\n#include <memory>\n#include <vector>\n#include <map>\n#include <optional>\n\n#include \"quant.h\"\n\n#define DEBUG_MODEL 0\n\nconstexpr int KV_SINKS = 2;\n\nenum class ActivationType {\n  GELU,\n  SILU,\n};\n\nenum class LayerNormType {\n  RMSNorm,\n};\n\nenum class TopKMethod {\n  GREEDY,\n  GROUP_LIMITED_GREEDY,\n  NOAUX_TC,\n};\n\nenum class ScoringFunc {\n  SOFTMAX,\n  SIGMOID,\n};\n\nenum class Device {\n  CPU,\n};\n\nenum class InferenceMode {\n  HYDRATE_KV_CACHE, // only hydrate the KV cache and don't compute output logits\n  OUTPUT_LOGITS // set InferenceState logits to logits for the next token\n};\n\nint cdiv(int a, int b);\n\nstruct Config {\n  int dim;                  // transformer input & output dimension\n  int hidden_dim;           // dimension of hidden layer in feedforward network (dense blocks only)\n  int n_layers;             // number of layers\n  int n_heads;              // number of attention heads\n  int vocab_size;           // vocabulary size\n  int max_seq_len;          // max sequence length\n  float rope_theta;         // RoPE theta\n  float norm_eps;           // epsilon for layer normalization\n  ActivationType act;       // activation function\n  LayerNormType norm_type;  // norm type\n  int first_k_dense_replace; // how many blocks to keep the dense FFN (when sparse MoE is default)\n  // mixture of experts\n  int n_shared_experts;\n  int n_routed_experts;\n  int n_active_routed;\n  int moe_intermediate_size;\n  float routed_scaling_factor;\n  int n_group;\n  bool norm_topk_prob;\n  ScoringFunc scoring_func;\n  int topk_group;\n  TopKMethod topk_method;\n  bool has_moegate_bias;\n  // multi-latent attention\n  bool use_mla; // if false, use naive implementation of multi-latent attention\n  int kv_lora_rank;\n  int q_lora_rank;\n  int qk_nope_head_dim;\n  int qk_rope_head_dim;\n  int v_head_dim;\n  int head_dim;             // dimension of each attention head, equal to qk_nope_head_dim + qk_rope_head_dim\n  // Data type of the weights according to config, used\n  // to safety check tensor dtype at initialization time.\n  Quant weight_quant;\n  // Block size for weight quantization if present\n  // If weights are quantized but block size is (0, 0), then we are using\n  // per-tensor quantization.\n  std::array<int, 2> block_size = {0, 0};\n  // RoPE scaling\n  int rs_beta_fast;\n  int rs_beta_slow;\n  float rs_factor;\n  float rs_mscale;\n  float rs_mscale_all_dim;\n  int rs_original_max_position_embeddings;\n\n  // If nonzero `context` is supplied, max sequence length is limited to `context`.\n  void from_yalm(YALMData& yalm, int context = 0);\n};\n\n// Buffer for all state used during a forward pass.\n// Members are reused across subsequent blocks and passes.\n// This lets us avoid allocations during inference.\nstruct InferenceState {\n  InferenceState(const std::shared_ptr<Config> config);\n  ~InferenceState();\n\n  // current activations\n  float* x() const { return _x; }\n  float* xb() const { return _xb; }\n  float* xb(int head) const { return _xb + _config->head_dim * head; }\n  // TODO: do we need xb2?\n  float* xb2() const { return _xb2; }\n  float* xb2(int head, int head_size) const { return _xb2 + head_size * head; }\n  float* hb() const { return _hb; }\n  float* hb2() const { return _hb2; }\n  float* q_a() const { return _q_a; }\n  float* q() const { return _q; }\n  float* q(int head) const { return _q + _config->head_dim * head; }\n  float* kv_a() const { return _kv_a; }\n  float* kv_b() const { return _kv_b; }\n  float* kv_b(int head) const { return _kv_b + (_config->head_dim - _config->qk_rope_head_dim + _config->v_head_dim) * head; }\n  float* ropebuf() const { return _ropebuf; }\n  float* k() const { return _k; }\n  float* k(int head) const { return _k + _config->head_dim * head; }\n  float* v() const { return _v; }\n  float* v(int head) const { return _v + _config->v_head_dim * head; }\n  float* att() const { return _att; }\n  float* att(int head) const { return _att + _config->max_seq_len * head; }\n  // MLA only\n  float* q_c() const { return _q_c; }\n  float* q_c(int head) const { return _q_c + _config->kv_lora_rank * head; }\n  float* q_rope() const { return _q_rope; }\n  float* q_rope(int head) const { return _q_rope + _config->qk_rope_head_dim * head; }\n  // mixture of experts\n  float* moe_weights() const { return _moe_weights; }\n  float* active_experts_weights() const { return _active_experts_weights; }\n  int* active_experts() const { return _active_experts; }\n  // LM head\n  float* logits() const { return _logits; }\n  int* logit_indices() const { return _logit_indices; }\n  // activation quantization buffer\n  void* aqb() const { return _aqb; }\n\n  Device device() const { return _device; }\n  InferenceMode mode() const { return _mode; }\n  void set_mode(InferenceMode mode) { _mode = mode; }\n\nprivate:\n  std::shared_ptr<Config> _config;\n  Device _device = Device::CPU;\n  InferenceMode _mode = InferenceMode::OUTPUT_LOGITS;\n\n  // current activations\n  float* _x = nullptr;         // (dim,) - latest activation\n  float* _xb = nullptr;        // (dim,) - activation inside a residual branch\n  float* _xb2 = nullptr;       // (max{dim, n_heads * v_head_dim, n_heads * kv_lora_rank},) - activation inside a residual branch (second slot)\n  float* _hb = nullptr;        // (max{dim, hidden_dim},) - buffer for hidden dimension in feedforward network\n  float* _hb2 = nullptr;       // (hidden_dim,) - buffer for hidden dimension in feedforward network (second slot)\n  float* _q_a = nullptr;       // (q_lora_rank,) - compressed (latent) query vector for latest timestamp\n  float* _q = nullptr;         // (n_heads * head_dim,) - query vectors for latest timestamp\n  float* _kv_a = nullptr;      // (kv_lora_rank + qk_rope_head_dim,) - compressed (latent) key-value vector for latest timestamp\n  float* _kv_b = nullptr;      // (n_heads * (head_dim-qk_rope_head_dim+v_head_dim),) - uncompressed key-value vector for latest timestamp\n  float* _ropebuf = nullptr;   // (n_heads * qk_rope_head_dim,) - buffer for rope\n  float* _k = nullptr;         // (n_heads * head_dim,) - key vectors for latest timestamp\n  float* _v = nullptr;         // (n_heads * v_head_dim,) - value vectors for latest timestamp\n  float* _att = nullptr;       // (n_heads, seq_len) - buffer for attention scores\n  // MLA only\n  float* _q_c = nullptr;       // (n_heads * kv_lora_rank,) - transformed and compressed query vector for latest timestamp\n  float* _q_rope = nullptr;    // (n_heads * qk_rope_head_dim,) - RoPE-transformed query vector for latest timestamp\n  // mixture of experts\n  float* _moe_weights = nullptr; // (n_routed_experts,) - buffer for expert weights, decided by router\n  float* _active_experts_weights = nullptr; // (n_active_experts,) - buffer for weights of top K experts (active experts)\n  int* _active_experts = nullptr; // (n_active_experts,) - buffer for indices of top K experts (active experts)\n  \n  // LM head\n  float* _logits = nullptr;    // (vocab_size,) - final output logits\n  int* _logit_indices = nullptr; // (vocab_size,) - logit indices (for use by top-p sampler)\n\n  // activation quantization buffer\n  uint8_t* _aqb = nullptr; // buffer for quantized activations\n};\n\n/* Transformer Block Base */\nstruct Block {\n  Block(\n    int layer_i,\n    const std::shared_ptr<Config> config,\n    const Tensor* rms_att_weight,\n    const Tensor* rms_ffn_weight,\n    const Tensor* w1,\n    const Tensor* s1,\n    const Tensor* w2,\n    const Tensor* s2,\n    const Tensor* w3,\n    const Tensor* s3,\n    const Tensor* shared_w1,\n    const Tensor* shared_s1,\n    const Tensor* shared_w2,\n    const Tensor* shared_s2,\n    const Tensor* shared_w3,\n    const Tensor* shared_s3,\n    const Tensor* moegate,\n    const Tensor* moegate_bias\n  );\n  virtual ~Block();\n\n  float* rms_att_weight() const { return _rms_att_weight ? static_cast<float*>(_rms_att_weight->data) : nullptr; }\n  float* rms_ffn_weight() const { return _rms_ffn_weight ? static_cast<float*>(_rms_ffn_weight->data) : nullptr; }\n  std::optional<QTensor> w1() const { return _w1; }\n  std::optional<QTensor> w2() const { return _w2; }\n  std::optional<QTensor> w3() const { return _w3; }\n  std::optional<QTensor> moegate() const { return _moegate; }\n  std::optional<QTensor> moegate_bias() const { return _moegate_bias; }\n  std::optional<QTensor> shared_w1() const { return _shared_w1; }\n  std::optional<QTensor> shared_w2() const { return _shared_w2; }\n  std::optional<QTensor> shared_w3() const { return _shared_w3; }\n\n  // Compute forward pass for this block and update the inference state accordingly.\n  // PRECONDITIONS:\n  // - `s.x()` contains the input to the block. Output will also go here.\n  // - Block KV cache is hydrated.\n  void block(\n    InferenceState& s,  // inference state\n    int pos,            // index of the current token in the sequence\n    int kv_sink,        // number of sink tokens currently in the KV cache\n    int kv_pos,         // index of the current token in the kv cache, must be in [0..kv_len) since kv cache is a ring buffer\n    int kv_len          // number of tokens in the kv cache that we will attend over\n  ) const;\n\n  virtual double active_bytes(size_t pos) const;\n\nprotected:\n  virtual void attention_impl(\n    InferenceState& s,  // inference state\n    int pos,            // index of the current token in the sequence\n    int kv_sink,        // number of sink tokens currently in the KV cache\n    int kv_pos,         // index of the current token in the kv cache, must be in [0..kv_len) since kv cache is a ring buffer\n    int kv_len          // number of tokens in the kv cache that we will attend over\n  ) const = 0;\n\n  template <typename T>\n  void _block_cpu(\n    InferenceState& s,  // inference state\n    int pos,            // index of the current token in the sequence\n    int kv_sink,        // number of sink tokens currently in the KV cache\n    int kv_pos,         // index of the current token in the kv cache, must be in [0..kv_len) since kv cache is a ring buffer\n    int kv_len          // number of tokens in the kv cache that we will attend over\n  ) const;\n\n  int _layer_i = 0;\n\n  std::shared_ptr<Config> _config;\n  Device _device = Device::CPU;\n\n  // weights for norms\n  std::optional<QTensor> _rms_att_weight = std::nullopt; // (dim) rmsnorm weights for attention input\n  std::optional<QTensor> _rms_ffn_weight = std::nullopt; // (dim) rmsnorm weights for ffn input\n\n  // weights for ffn\n  std::optional<QTensor> _w1 = std::nullopt; // (n_routed_experts?, moe_intermediate_size, dim) or (hidden_dim, dim)\n  std::optional<QTensor> _s1 = std::nullopt;\n  std::optional<QTensor> _w2 = std::nullopt; // (n_routed_experts?, dim, moe_intermediate_size) or (dim, hidden_dim)\n  std::optional<QTensor> _s2 = std::nullopt;\n  std::optional<QTensor> _w3 = std::nullopt; // (n_routed_experts?, moe_intermediate_size, dim) or (hidden_dim, dim)\n  std::optional<QTensor> _s3 = std::nullopt;\n  std::optional<QTensor> _shared_w1 = std::nullopt; // (n_shared_experts?, moe_intermediate_size, dim)\n  std::optional<QTensor> _shared_s1 = std::nullopt;\n  std::optional<QTensor> _shared_w2 = std::nullopt; // (n_shared_experts?, dim, moe_intermediate_size)\n  std::optional<QTensor> _shared_s2 = std::nullopt;\n  std::optional<QTensor> _shared_w3 = std::nullopt; // (n_shared_experts?, moe_intermediate_size, dim)\n  std::optional<QTensor> _shared_s3 = std::nullopt;\n  // weights for mixture of experts router if present\n  std::optional<QTensor> _moegate = std::nullopt; // (n_routed_experts?, dim)\n  std::optional<QTensor> _moegate_bias = std::nullopt;\n};\n\n/* Transformer Block - Multi-Head Attention */\nstruct BlockMHA : public Block {\n  BlockMHA(\n    int layer_i,\n    const std::shared_ptr<Config> config,\n    const Tensor* rms_att_weight,\n    const Tensor* rms_q_a_weight,\n    const Tensor* rms_kv_a_weight,\n    const Tensor* rms_ffn_weight,\n    const Tensor* wq,\n    const Tensor* sq,\n    const Tensor* wq_a,\n    const Tensor* sq_a,\n    const Tensor* wkv_a,\n    const Tensor* skv_a,\n    const Tensor* wq_b,\n    const Tensor* sq_b,\n    const Tensor* wkv_b,\n    const Tensor* skv_b,\n    const Tensor* wo,\n    const Tensor* so,\n    const Tensor* w1,\n    const Tensor* s1,\n    const Tensor* w2,\n    const Tensor* s2,\n    const Tensor* w3,\n    const Tensor* s3,\n    const Tensor* shared_w1,\n    const Tensor* shared_s1,\n    const Tensor* shared_w2,\n    const Tensor* shared_s2,\n    const Tensor* shared_w3,\n    const Tensor* shared_s3,\n    const Tensor* moegate,\n    const Tensor* moegate_bias\n  );\n  ~BlockMHA() override;\n\n  float* rms_q_a_weight() const { return _rms_q_a_weight ? static_cast<float*>(_rms_q_a_weight->data) : nullptr; }\n  float* rms_kv_a_weight() const { return _rms_kv_a_weight ? static_cast<float*>(_rms_kv_a_weight->data) : nullptr; }\n  std::optional<QTensor> wq() const { return _wq; }\n  std::optional<QTensor> wq_a() const { return _wq_a; }\n  std::optional<QTensor> wq_b() const { return _wq_b; }\n  std::optional<QTensor> wkv_a() const { return _wkv_a; }\n  std::optional<QTensor> wkv_b() const { return _wkv_b; }\n  std::optional<QTensor> wo() const { return _wo; }\n  f16_t* key_cache() const { return _key_cache; }\n  f16_t* key_cache(int pos) const { return _key_cache + pos * _config->head_dim * _config->n_heads; }\n  f16_t* value_cache() const { return _value_cache; }\n  f16_t* value_cache(int pos) const { return _value_cache + pos * _config->v_head_dim * _config->n_heads; }\n\n  double active_bytes(size_t pos) const override;\n\nprotected:\n  void attention_impl(\n    InferenceState& s, int pos, int kv_sink, int kv_pos, int kv_len\n  ) const override;\n\nprivate:\n  template <typename T>\n  void _attention_impl(\n    InferenceState& s,  // inference state\n    int pos,            // index of the current token in the sequence\n    int kv_sink,        // number of sink tokens currently in the KV cache\n    int kv_pos,         // index of the current token in the kv cache, must be in [0..kv_len) since kv cache is a ring buffer\n    int kv_len          // number of tokens in the kv cache that we will attend over\n  ) const;\n\n  std::optional<QTensor> _rms_q_a_weight = std::nullopt; // (q_lora_rank) rmsnorm weights\n  std::optional<QTensor> _rms_kv_a_weight = std::nullopt; // (kv_lora_rank + qk_rope_head_dim)\n\n  // weights for self-attention matmuls\n  std::optional<QTensor> _wq = std::nullopt; // (n_heads * head_dim, dim)\n  std::optional<QTensor> _sq = std::nullopt;\n  std::optional<QTensor> _wq_a = std::nullopt; // (q_lora_rank, dim)\n  std::optional<QTensor> _sq_a = std::nullopt;\n  std::optional<QTensor> _wkv_a = std::nullopt; // (kv_lora_rank + qk_rope_head_dim, dim)\n  std::optional<QTensor> _skv_a = std::nullopt;\n  std::optional<QTensor> _wo = std::nullopt; // (dim, n_heads * v_head_dim)\n  std::optional<QTensor> _so = std::nullopt;\n  std::optional<QTensor> _wq_b = std::nullopt; // (n_heads * head_dim, q_lora_rank)\n  std::optional<QTensor> _sq_b = std::nullopt;\n  std::optional<QTensor> _wkv_b = std::nullopt; // (n_heads * (head_dim-qk_rope_head_dim+v_head_dim), kv_lora_rank)\n  std::optional<QTensor> _skv_b = std::nullopt;\n\n  // MHA kv cache\n  f16_t* _key_cache = nullptr;   // (seq_len, n_heads * head_dim)\n  f16_t* _value_cache = nullptr; // (seq_len, n_heads * v_head_dim)\n};\n\n/* Transformer Block - Multi-Latent Attention */\nstruct BlockMLA : public Block {\n  BlockMLA(\n    int layer_i,\n    const std::shared_ptr<Config> config,\n    const Tensor* rms_att_weight,\n    const Tensor* rms_q_a_weight,\n    const Tensor* rms_kv_a_weight,\n    const Tensor* rms_ffn_weight,\n    const Tensor* wq_a,\n    const Tensor* sq_a,\n    const Tensor* wkv_a,\n    const Tensor* skv_a,\n    const Tensor* wo,\n    const Tensor* so,\n    const Tensor* wc,\n    const Tensor* sc,\n    const Tensor* wq_rope_b,\n    const Tensor* sq_rope_b,\n    const Tensor* wv_b,\n    const Tensor* sv_b,\n    const Tensor* w1,\n    const Tensor* s1,\n    const Tensor* w2,\n    const Tensor* s2,\n    const Tensor* w3,\n    const Tensor* s3,\n    const Tensor* shared_w1,\n    const Tensor* shared_s1,\n    const Tensor* shared_w2,\n    const Tensor* shared_s2,\n    const Tensor* shared_w3,\n    const Tensor* shared_s3,\n    const Tensor* moegate,\n    const Tensor* moegate_bias\n  );\n  ~BlockMLA() override;\n\n  float* rms_q_a_weight() const { return _rms_q_a_weight ? static_cast<float*>(_rms_q_a_weight->data) : nullptr; }\n  float* rms_kv_a_weight() const { return _rms_kv_a_weight ? static_cast<float*>(_rms_kv_a_weight->data) : nullptr; }\n  std::optional<QTensor> wq_a() const { return _wq_a; }\n  std::optional<QTensor> wkv_a() const { return _wkv_a; }\n  std::optional<QTensor> wo() const { return _wo; }\n  std::optional<QTensor> wc() const { return _wc; }\n  std::optional<QTensor> wq_rope_b() const { return _wq_rope_b; }\n  std::optional<QTensor> wv_b() const { return _wv_b; }\n  f16_t* kv_nope_cache() const { return _kv_nope_cache; }\n  f16_t* kv_nope_cache(int pos) const { return _kv_nope_cache + pos * _config->kv_lora_rank; }\n  f16_t* kv_rope_cache() const { return _kv_rope_cache; }\n  f16_t* kv_rope_cache(int pos) const { return _kv_rope_cache + pos * _config->qk_rope_head_dim; }\n\n  double active_bytes(size_t pos) const override;\n\nprotected:\n  void attention_impl(\n    InferenceState& s, int pos, int kv_sink, int kv_pos, int kv_len\n  ) const override;\nprivate:\n  template <typename T>\n  void _attention_impl(\n    InferenceState& s,  // inference state\n    int pos,            // index of the current token in the sequence\n    int kv_sink,        // number of sink tokens currently in the KV cache\n    int kv_pos,         // index of the current token in the kv cache, must be in [0..kv_len) since kv cache is a ring buffer\n    int kv_len          // number of tokens in the kv cache that we will attend over\n  ) const;\n\n  // weights for norms\n  std::optional<QTensor> _rms_q_a_weight = std::nullopt; // (q_lora_rank) rmsnorm weights\n  std::optional<QTensor> _rms_kv_a_weight = std::nullopt; // (kv_lora_rank + qk_rope_head_dim)\n\n  // weights for self-attention matmuls\n  std::optional<QTensor> _wq_a = std::nullopt; // (q_lora_rank, dim)\n  std::optional<QTensor> _sq_a = std::nullopt;\n  std::optional<QTensor> _wkv_a = std::nullopt; // (kv_lora_rank + qk_rope_head_dim, dim)\n  std::optional<QTensor> _skv_a = std::nullopt;\n  std::optional<QTensor> _wo = std::nullopt; // (dim, n_heads * v_head_dim)\n  std::optional<QTensor> _so = std::nullopt;\n  std::optional<QTensor> _wc = std::nullopt; // (n_heads * kv_lora_rank, q_lora_rank)\n  std::optional<QTensor> _sc = std::nullopt;\n  std::optional<QTensor> _wq_rope_b = std::nullopt; // (n_heads * qk_rope_head_dim, q_lora_rank)\n  std::optional<QTensor> _sq_rope_b = std::nullopt;\n  std::optional<QTensor> _wv_b = std::nullopt; // (n_heads, v_head_dim, kv_lora_rank)\n  std::optional<QTensor> _sv_b = std::nullopt;\n\n  // MLA kv cache\n  f16_t* _kv_nope_cache = nullptr; // (seq_len, kv_lora_rank)\n  f16_t* _kv_rope_cache = nullptr; // (seq_len, qk_rope_head_dim)\n};\n\nstruct Model {\n  std::shared_ptr<Config> config;\n\n  std::vector<std::shared_ptr<Block>> blocks;\n  \n  // token embedding table\n  std::optional<QTensor> token_embedding_table = std::nullopt; // (vocab_size, dim)\n  std::optional<QTensor> token_embedding_scale = std::nullopt; // (ceil(vocab_size / block_size[0]), ceil(dim / block_size[1]))\n  // final norm\n  std::optional<QTensor> rms_final_weight = std::nullopt; // (dim,)\n  // classifier weights for the logits, on the last layer\n  std::optional<QTensor> wcls = std::nullopt; // (vocab_size, dim)\n  std::optional<QTensor> scls = std::nullopt;\n\n  Model(YALMData& yalm, int context = 0);\n  \n  void forward(InferenceState& s, int token, int pos, InferenceMode mode = InferenceMode::OUTPUT_LOGITS);\n\n  double active_bytes(size_t pos) const;\nprivate:\n  void _forward_cpu(InferenceState& s, int token, int pos, InferenceMode mode);\n  void _copy_embedding(InferenceState& s, int token);\n\n  Device _device = Device::CPU;\n};\n\n#if DEBUG_MODEL\nstruct DebugTensor {\n  enum struct DataType {\n    F32,\n    F16,\n  };\n\n  DebugTensor() = default;\n  DebugTensor(const std::vector<float>& data);\n  DebugTensor(const std::vector<f16_t>& data);\n  DebugTensor& operator=(const DebugTensor& other) = default;\n  float max_err(const DebugTensor& other) const;\n\n  std::vector<float> data_f32;\n  std::vector<f16_t> data_f16;\n  DataType data_type;\n};\nstd::map<std::string, DebugTensor>& debug_map_cpu();\nvoid dump_debug_map(const std::string& filename);\nvoid dump_debug_map_as_safetensors(const std::string& filename);\n#endif\n\n////////////////////////////////////////\n// Exposed for tests\n////////////////////////////////////////\nvoid attn(\n  float* xout,    // (dim,) - output vector\n  float* atth,    // (kv_len,) - scratch space to hold attention scores of the sequence\n  const float* qh,      // (head_dim,) - query vector for this head\n  const f16_t* kh,      // (kv_len, n_heads, head_dim) - buffer containing key vectors of the sequence for all KV heads\n  const f16_t* vh,      // (kv_len, n_heads, head_dim) - buffer containing value vectors of the sequence for all KV heads\n  int head_dim,   // size of the \"key-space\"\n  int v_head_dim, // size of the \"value-space\"\n  int n_heads, // number of attention heads\n  int kv_len      // number of tokens of the sequence we will attend over\n);\n\nvoid mha_cpu(\n  float* xout,  // (n_heads, head_dim)\n  float* att,   // (n_heads, max_seq_len)\n  f16_t* kb,    // (max_seq_len, n_heads, head_dim)\n  f16_t* vb,    // (max_seq_len, n_heads, head_dim)\n  float* q,     // (n_heads, head_dim)\n  int head_dim, int v_head_dim, int kv_len, int max_seq_len, int n_heads\n);\n\nvoid matmul_unscaled(float* xout, float* x, const QTensor& w);\n\nvoid ffn_cpu(\n  float* xout, float* x, \n  float* w1, float* w2, float* w3, \n  int hidden_dim, int dim,\n  ActivationType act\n);\n////////////////////////////////////////"
  },
  {
    "path": "src/profile.cpp",
    "content": "#include \"profile.h\"\n\n#include <vector>\n\nstatic bool _profile_enabled = true;\nstatic std::vector<std::string> _profile_scopes;\nstatic std::map<std::string, double> _profile_times;\n\nvoid set_profile_enabled(bool enabled) {\n  _profile_enabled = enabled;\n}\n\nbool get_profile_enabled() {\n  return _profile_enabled;\n}\n\nconst std::map<std::string, double>& profile_times() {\n  return _profile_times;\n}\n\n#if PROFILE_ENABLED\nProfileScope::ProfileScope(std::string name) {\n  _profile_scopes.push_back(name);\n  _start = omp_get_wtime();\n}\n\nProfileScope::ProfileScope(const char* name) : \n  ProfileScope(std::string(name)) {}\n\nProfileScope::~ProfileScope() {\n  double end = omp_get_wtime();\n  double duration = end - _start;\n  if (_profile_enabled) {\n    std::string key = \"\";\n    for (const auto& scope : _profile_scopes) {\n      key += scope + \".\";\n    }\n    _profile_times[key] += duration;\n  }\n  _profile_scopes.pop_back();\n}\n#else\nProfileScope::ProfileScope(std::string name) {}\nProfileScope::ProfileScope(const char* name) {}\nProfileScope::~ProfileScope() {}\n#endif\n\nProfileDisabledScope::ProfileDisabledScope() {\n  _was_enabled = get_profile_enabled();\n  set_profile_enabled(false);\n}\n\nProfileDisabledScope::~ProfileDisabledScope() {\n  set_profile_enabled(_was_enabled);\n}"
  },
  {
    "path": "src/profile.h",
    "content": "#include <omp.h>\n#include <map>\n#include <string>\n\n#define PROFILE_ENABLED 0\n\n// Toggle aggregation of profile scopes at runtime.\n// This does not disable profile instrumentation; change PROFILE_ENABLED and recompile for that.\nvoid set_profile_enabled(bool enabled);\nbool get_profile_enabled();\nconst std::map<std::string, double>& profile_times();\n\n#if PROFILE_ENABLED\n// This macro can be used to profile a block of code.\n// Example:\n// ```\n// {\n//   PROFILE_BLOCK(my_block);\n//   // code to profile...\n// }\n// ```\n// The execution time will be saved with key `my_block` in the profile_times map.\n// `my_block` need not be a variable name; it can be any string.\n#define PROFILE_BLOCK(name) \\\n  ProfileScope profile_scope(#name)\n#else\n#define PROFILE_BLOCK(name)\n#endif\n\n// This macro can be used to profile a single statement.\n// Example:\n// ```\n// PROFILE(my_statement);\n// ```\n// The execution time will be saved with key `my_statement` in the profile_times map.\n// `my_statement` should be a valid C++ statement or expression.\n#define PROFILE(X) do { \\\n  PROFILE_BLOCK(X); \\\n  X; \\\n} while(0)\n\nstruct ProfileScope {\n  ProfileScope(std::string name);\n  ProfileScope(const char* name);\n  ~ProfileScope();\nprivate:\n  double _start;\n};\n\nstruct ProfileDisabledScope {\n  ProfileDisabledScope();\n  ~ProfileDisabledScope();\nprivate:\n  bool _was_enabled;\n};"
  },
  {
    "path": "src/quant.cpp",
    "content": "/*\nK-quants adapted from llama.cpp\n\nMIT License\n\nCopyright (c) 2023-2024 The ggml authors\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\n#include \"quant.h\"\n\n#include <cassert>\n\n#define GROUP_MAX_EPS 1e-15f\n\nstatic inline int nearest_int(float fval) {\n  assert(fabsf(fval) <= 4194303.f);\n  float val = fval + 12582912.f;\n  int i; memcpy(&i, &val, sizeof(int));\n  return (i & 0x007fffff) - 0x00400000;\n}\n\n// some compilers don't provide _mm256_set_m128i, e.g. gcc 7\n#define MM256_SET_M128I(a, b) _mm256_insertf128_si256(_mm256_castsi128_si256(b), (a), 1)\n\n#if __AVX__ || __AVX2__ || __AVX512F__\n// horizontally add 8 floats\nstatic inline float hsum_float_8(const __m256 x) {\n  __m128 res = _mm256_extractf128_ps(x, 1);\n  res = _mm_add_ps(res, _mm256_castps256_ps128(x));\n  res = _mm_add_ps(res, _mm_movehl_ps(res, res));\n  res = _mm_add_ss(res, _mm_movehdup_ps(res));\n  return _mm_cvtss_f32(res);\n}\n\n// shuffles to pick the required scales in dot products\nstatic inline __m256i get_scale_shuffle_q3k(int i) {\n  static const uint8_t k_shuffle[128] = {\n      0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,     2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3,\n      4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5,     6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7,\n      8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9,    10,11,10,11,10,11,10,11,10,11,10,11,10,11,10,11,\n    12,13,12,13,12,13,12,13,12,13,12,13,12,13,12,13,    14,15,14,15,14,15,14,15,14,15,14,15,14,15,14,15,\n  };\n  return _mm256_loadu_si256((const __m256i*)k_shuffle + i);\n}\n#endif\n\nstatic float make_qkx2_quants(int n, int nmax, const float * __restrict__ x, const float * __restrict__ weights,\n    uint8_t * __restrict__ L, float * __restrict__ the_min, uint8_t * __restrict__ Laux,\n    float rmin, float rdelta, int nstep, bool use_mad) {\n  float min = x[0];\n  float max = x[0];\n  float sum_w = weights[0];\n  float sum_x = sum_w * x[0];\n#ifdef HAVE_BUGGY_APPLE_LINKER\n  // use 'volatile' to prevent unroll and work around a bug in Apple ld64 1015.7\n  for (volatile int i = 1; i < n; ++i) {\n#else\n  for (int i = 1; i < n; ++i) {\n#endif\n    if (x[i] < min) min = x[i];\n    if (x[i] > max) max = x[i];\n    float w = weights[i];\n    sum_w += w;\n    sum_x += w * x[i];\n  }\n  if (min > 0) min = 0;\n  if (max == min) {\n    for (int i = 0; i < n; ++i) L[i] = 0;\n    *the_min = -min;\n    return 0.f;\n  }\n  float iscale = nmax/(max - min);\n  float scale = 1/iscale;\n  float best_mad = 0;\n  for (int i = 0; i < n; ++i) {\n    int l = nearest_int(iscale*(x[i] - min));\n    L[i] = std::max(0, std::min(nmax, l));\n    float diff = scale * L[i] + min - x[i];\n    diff = use_mad ? fabsf(diff) : diff * diff;\n    float w = weights[i];\n    best_mad += w * diff;\n  }\n  if (nstep < 1) {\n    *the_min = -min;\n    return scale;\n  }\n  for (int is = 0; is <= nstep; ++is) {\n    iscale = (rmin + rdelta*is + nmax)/(max - min);\n    float sum_l = 0, sum_l2 = 0, sum_xl = 0;\n    for (int i = 0; i < n; ++i) {\n      int l = nearest_int(iscale*(x[i] - min));\n      l = std::max(0, std::min(nmax, l));\n      Laux[i] = l;\n      float w = weights[i];\n      sum_l += w*l;\n      sum_l2 += w*l*l;\n      sum_xl += w*l*x[i];\n    }\n    float D = sum_w * sum_l2 - sum_l * sum_l;\n    if (D > 0) {\n      float this_scale = (sum_w * sum_xl - sum_x * sum_l)/D;\n      float this_min   = (sum_l2 * sum_x - sum_l * sum_xl)/D;\n      if (this_min > 0) {\n        this_min = 0;\n        this_scale = sum_xl / sum_l2;\n      }\n      float mad = 0;\n      for (int i = 0; i < n; ++i) {\n        float diff = this_scale * Laux[i] + this_min - x[i];\n        diff = use_mad ? fabsf(diff) : diff * diff;\n        float w = weights[i];\n        mad += w * diff;\n      }\n      if (mad < best_mad) {\n        for (int i = 0; i < n; ++i) {\n          L[i] = Laux[i];\n        }\n        best_mad = mad;\n        scale = this_scale;\n        min = this_min;\n      }\n    }\n  }\n  *the_min = -min;\n  return scale;\n}\n\nvoid quantize_row_q2_K_ref(const float * __restrict__ x, block_q2_K * __restrict__ y, int64_t k) {\n  assert(k % QK_K == 0);\n  const int nb = k / QK_K;\n\n  uint8_t L[QK_K];\n  uint8_t Laux[16];\n  float   weights[16];\n  float mins[QK_K/16];\n  float scales[QK_K/16];\n\n  const float q4scale = 15.f;\n\n  for (int i = 0; i < nb; i++) {\n    float max_scale = 0; // as we are deducting the min, scales are always positive\n    float max_min = 0;\n    for (int j = 0; j < QK_K/16; ++j) {\n      for (int l = 0; l < 16; ++l) weights[l] = fabsf(x[16*j + l]);\n      scales[j] = make_qkx2_quants(16, 3, x + 16*j, weights, L + 16*j, &mins[j], Laux, -0.5f, 0.1f, 15, true);\n      float scale = scales[j];\n      if (scale > max_scale) {\n        max_scale = scale;\n      }\n      float min = mins[j];\n      if (min > max_min) {\n        max_min = min;\n      }\n    }\n\n    if (max_scale > 0) {\n      float iscale = q4scale/max_scale;\n      for (int j = 0; j < QK_K/16; ++j) {\n        int l = nearest_int(iscale*scales[j]);\n        y[i].scales[j] = l;\n      }\n      y[i].d = float_to_half(max_scale/q4scale);\n    } else {\n      for (int j = 0; j < QK_K/16; ++j) y[i].scales[j] = 0;\n      y[i].d = float_to_half(0.f);\n    }\n    if (max_min > 0) {\n      float iscale = q4scale/max_min;\n      for (int j = 0; j < QK_K/16; ++j) {\n        int l = nearest_int(iscale*mins[j]);\n        y[i].scales[j] |= (l << 4);\n      }\n      y[i].dmin = float_to_half(max_min/q4scale);\n    } else {\n      y[i].dmin = float_to_half(0.f);\n    }\n    for (int j = 0; j < QK_K/16; ++j) {\n      const float d = half_to_float(y[i].d) * (y[i].scales[j] & 0xF);\n      if (!d) continue;\n      const float dm = half_to_float(y[i].dmin) * (y[i].scales[j] >> 4);\n      for (int ii = 0; ii < 16; ++ii) {\n        int l = nearest_int((x[16*j + ii] + dm)/d);\n        l = std::max(0, std::min(3, l));\n        L[16*j + ii] = l;\n      }\n    }\n\n    for (int j = 0; j < QK_K; j += 128) {\n      for (int l = 0; l < 32; ++l) {\n        y[i].qs[j/4 + l] = L[j + l] | (L[j + l + 32] << 2) | (L[j + l + 64] << 4) | (L[j + l + 96] << 6);\n      }\n    }\n\n    x += QK_K;\n  }\n}\n\nvoid dequantize_row_q2_K(const block_q2_K * __restrict__ x, float * __restrict__ y, int64_t k) {\n  assert(k % QK_K == 0);\n  const int nb = k / QK_K;\n\n  for (int i = 0; i < nb; i++) {\n\n    const float d = half_to_float(x[i].d);\n    const float min = half_to_float(x[i].dmin);\n\n    const uint8_t * q = x[i].qs;\n\n    int is = 0;\n    float dl, ml;\n    for (int n = 0; n < QK_K; n += 128) {\n      int shift = 0;\n      for (int j = 0; j < 4; ++j) {\n\n        uint8_t sc = x[i].scales[is++];\n        dl = d * (sc & 0xF); ml = min * (sc >> 4);\n        for (int l = 0; l < 16; ++l) *y++ = dl * ((int8_t)((q[l] >> shift) & 3)) - ml;\n\n        sc = x[i].scales[is++];\n        dl = d * (sc & 0xF); ml = min * (sc >> 4);\n        for (int l = 0; l < 16; ++l) *y++ = dl * ((int8_t)((q[l+16] >> shift) & 3)) - ml;\n\n        shift += 2;\n      }\n      q += 32;\n    }\n  }\n}\n\nstatic float make_q3_quants(int n, int nmax, const float * __restrict__ x, int8_t * __restrict__ L, bool do_rmse) {\n  float max = 0;\n  float amax = 0;\n  for (int i = 0; i < n; ++i) {\n    float ax = fabsf(x[i]);\n    if (ax > amax) { amax = ax; max = x[i]; }\n  }\n  if (amax < GROUP_MAX_EPS) { // all zero\n    for (int i = 0; i < n; ++i) { L[i] = 0; }\n    return 0.f;\n  }\n  float iscale = -nmax / max;\n  if (do_rmse) {\n    float sumlx = 0;\n    float suml2 = 0;\n    for (int i = 0; i < n; ++i) {\n      int l = nearest_int(iscale * x[i]);\n      l = std::max(-nmax, std::min(nmax-1, l));\n      L[i] = l;\n      float w = x[i]*x[i];\n      sumlx += w*x[i]*l;\n      suml2 += w*l*l;\n    }\n    for (int itry = 0; itry < 5; ++itry) {\n      int n_changed = 0;\n      for (int i = 0; i < n; ++i) {\n        float w = x[i]*x[i];\n        float slx = sumlx - w*x[i]*L[i];\n        if (slx > 0) {\n          float sl2 = suml2 - w*L[i]*L[i];\n          int new_l = nearest_int(x[i] * sl2 / slx);\n          new_l = std::max(-nmax, std::min(nmax-1, new_l));\n          if (new_l != L[i]) {\n            slx += w*x[i]*new_l;\n            sl2 += w*new_l*new_l;\n            if (sl2 > 0 && slx*slx*suml2 > sumlx*sumlx*sl2) {\n              L[i] = new_l; sumlx = slx; suml2 = sl2;\n              ++n_changed;\n            }\n          }\n        }\n      }\n      if (!n_changed) {\n        break;\n      }\n    }\n    for (int i = 0; i < n; ++i) {\n        L[i] += nmax;\n    }\n    return sumlx / suml2;\n  }\n  for (int i = 0; i < n; ++i) {\n      int l = nearest_int(iscale * x[i]);\n      l = std::max(-nmax, std::min(nmax-1, l));\n      L[i] = l + nmax;\n  }\n  return 1/iscale;\n}\n\nvoid quantize_row_q3_K_ref(const float * __restrict__ x, block_q3_K * __restrict__ y, int64_t k) {\n  assert(k % QK_K == 0);\n  const int nb = k / QK_K;\n\n  int8_t L[QK_K];\n  float scales[QK_K / 16];\n\n  for (int i = 0; i < nb; i++) {\n\n    float max_scale = 0;\n    float amax = 0;\n    for (int j = 0; j < QK_K/16; ++j) {\n      scales[j] = make_q3_quants(16, 4, x + 16*j, L + 16*j, true);\n      float scale = fabsf(scales[j]);\n      if (scale > amax) {\n        amax = scale; max_scale = scales[j];\n      }\n    }\n\n    memset(y[i].scales, 0, 12);\n    if (max_scale) {\n      float iscale = -32.f/max_scale;\n      for (int j = 0; j < QK_K/16; ++j) {\n        int8_t l = nearest_int(iscale*scales[j]);\n        l = std::max(-32, std::min(31, static_cast<int>(l))) + 32;\n        if (j < 8) {\n          y[i].scales[j] = l & 0xF;\n        } else {\n          y[i].scales[j-8] |= ((l & 0xF) << 4);\n        }\n        l >>= 4;\n        y[i].scales[j%4 + 8] |= (l << (2*(j/4)));\n      }\n      y[i].d = float_to_half(1/iscale);\n    } else {\n      y[i].d = float_to_half(0.f);\n    }\n\n    int8_t sc;\n    for (int j = 0; j < QK_K/16; ++j) {\n      sc = j < 8 ? y[i].scales[j] & 0xF : y[i].scales[j-8] >> 4;\n      sc = (sc | (((y[i].scales[8 + j%4] >> (2*(j/4))) & 3) << 4)) - 32;\n      float d = half_to_float(y[i].d) * sc;\n      if (!d) {\n        continue;\n      }\n      for (int ii = 0; ii < 16; ++ii) {\n        int l = nearest_int(x[16*j + ii]/d);\n        l = std::max(-4, std::min(3, l));\n        L[16*j + ii] = l + 4;\n      }\n    }\n\n    memset(y[i].hmask, 0, QK_K/8);\n    // We put the high-bit for the 1st 8 quants into bit 0, the next 8 into bit 1, etc.\n    int m = 0;\n    uint8_t hm = 1;\n    for (int j = 0; j < QK_K; ++j) {\n      if (L[j] > 3) {\n        y[i].hmask[m] |= hm;\n        L[j] -= 4;\n      }\n      if (++m == QK_K/8) {\n        m = 0; hm <<= 1;\n      }\n    }\n    for (int j = 0; j < QK_K; j += 128) {\n      for (int l = 0; l < 32; ++l) {\n        y[i].qs[j/4 + l] = L[j + l] | (L[j + l + 32] << 2) | (L[j + l + 64] << 4) | (L[j + l + 96] << 6);\n      }\n    }\n\n    x += QK_K;\n  }\n}\n\nvoid dequantize_row_q3_K(const block_q3_K * __restrict__ x, float * __restrict__ y, int64_t k) {\n    assert(k % QK_K == 0);\n    const int nb = k / QK_K;\n\n    const uint32_t kmask1 = 0x03030303;\n    const uint32_t kmask2 = 0x0f0f0f0f;\n\n    uint32_t aux[4];\n    const int8_t * scales = (const int8_t*)aux;\n\n    for (int i = 0; i < nb; i++) {\n\n        const float d_all = half_to_float(x[i].d);\n\n        const uint8_t * __restrict__ q = x[i].qs;\n        const uint8_t * __restrict__ hm = x[i].hmask;\n        uint8_t m = 1;\n\n        memcpy(aux, x[i].scales, 12);\n        uint32_t tmp = aux[2];\n        aux[2] = ((aux[0] >> 4) & kmask2) | (((tmp >> 4) & kmask1) << 4);\n        aux[3] = ((aux[1] >> 4) & kmask2) | (((tmp >> 6) & kmask1) << 4);\n        aux[0] = (aux[0] & kmask2) | (((tmp >> 0) & kmask1) << 4);\n        aux[1] = (aux[1] & kmask2) | (((tmp >> 2) & kmask1) << 4);\n\n        int is = 0;\n        float dl;\n        for (int n = 0; n < QK_K; n += 128) {\n            int shift = 0;\n            for (int j = 0; j < 4; ++j) {\n\n                dl = d_all * (scales[is++] - 32);\n                for (int l = 0; l < 16; ++l) {\n                    *y++ = dl * ((int8_t)((q[l+ 0] >> shift) & 3) - ((hm[l+ 0] & m) ? 0 : 4));\n                }\n\n                dl = d_all * (scales[is++] - 32);\n                for (int l = 0; l < 16; ++l) {\n                    *y++ = dl * ((int8_t)((q[l+16] >> shift) & 3) - ((hm[l+16] & m) ? 0 : 4));\n                }\n\n                shift += 2;\n                m <<= 1;\n            }\n            q += 32;\n        }\n\n    }\n}\n\nvoid ggml_vec_dot_q3_K_q8_K(int n, float * __restrict__ s, const void * __restrict__ vx, const void * __restrict__ vy) {\n  assert(n % QK_K == 0);\n\n  const uint32_t kmask1 = 0x03030303;\n  const uint32_t kmask2 = 0x0f0f0f0f;\n\n  const block_q3_K * __restrict__ x = (const block_q3_K*)vx;\n  const block_q8_K * __restrict__ y = (const block_q8_K*)vy;\n\n  const int nb = n / QK_K;\n\n#if defined __AVX2__\n\n  const __m256i m3 = _mm256_set1_epi8(3);\n  const __m256i mone = _mm256_set1_epi8(1);\n  const __m128i m32 = _mm_set1_epi8(32);\n\n  __m256 acc = _mm256_setzero_ps();\n\n  uint32_t aux[3];\n\n  for (int i = 0; i < nb; ++i) {\n\n    const float d = y[i].d * half_to_float(x[i].d);\n\n    const uint8_t * __restrict__ q3 = x[i].qs;\n    const int8_t  * __restrict__ q8 = y[i].qs;\n\n    // Set up scales\n    memcpy(aux, x[i].scales, 12);\n    __m128i scales128 = _mm_set_epi32(\n            ((aux[1] >> 4) & kmask2) | (((aux[2] >> 6) & kmask1) << 4),\n            ((aux[0] >> 4) & kmask2) | (((aux[2] >> 4) & kmask1) << 4),\n            (aux[1] & kmask2) | (((aux[2] >> 2) & kmask1) << 4),\n            (aux[0] & kmask2) | (((aux[2] >> 0) & kmask1) << 4));\n    scales128 = _mm_sub_epi8(scales128, m32);\n    const __m256i all_scales = _mm256_cvtepi8_epi16(scales128);\n    const __m128i l_scales = _mm256_extracti128_si256(all_scales, 0);\n    const __m128i h_scales = _mm256_extracti128_si256(all_scales, 1);\n    const __m256i scales[2] = {MM256_SET_M128I(l_scales, l_scales), MM256_SET_M128I(h_scales, h_scales)};\n\n    // high bit\n    const __m256i hbits = _mm256_loadu_si256((const __m256i*)x[i].hmask);\n\n    // integer accumulator\n    __m256i sumi = _mm256_setzero_si256();\n\n    int bit = 0;\n    int is  = 0;\n\n    for (int j = 0; j < QK_K/128; ++j) {\n      // load low 2 bits\n      const __m256i q3bits = _mm256_loadu_si256((const __m256i*)q3); q3 += 32;\n\n      // prepare low and high bits\n      const __m256i q3l_0 = _mm256_and_si256(q3bits, m3);\n      const __m256i q3h_0 = _mm256_slli_epi16(_mm256_srli_epi16(_mm256_andnot_si256(hbits, _mm256_slli_epi16(mone, bit)), bit), 2);\n      ++bit;\n\n      const __m256i q3l_1 = _mm256_and_si256(_mm256_srli_epi16(q3bits, 2), m3);\n      const __m256i q3h_1 = _mm256_slli_epi16(_mm256_srli_epi16(_mm256_andnot_si256(hbits, _mm256_slli_epi16(mone, bit)), bit), 2);\n      ++bit;\n\n      const __m256i q3l_2 = _mm256_and_si256(_mm256_srli_epi16(q3bits, 4), m3);\n      const __m256i q3h_2 = _mm256_slli_epi16(_mm256_srli_epi16(_mm256_andnot_si256(hbits, _mm256_slli_epi16(mone, bit)), bit), 2);\n      ++bit;\n\n      const __m256i q3l_3 = _mm256_and_si256(_mm256_srli_epi16(q3bits, 6), m3);\n      const __m256i q3h_3 = _mm256_slli_epi16(_mm256_srli_epi16(_mm256_andnot_si256(hbits, _mm256_slli_epi16(mone, bit)), bit), 2);\n      ++bit;\n\n      // load Q8 quants\n      const __m256i q8_0 = _mm256_loadu_si256((const __m256i*)q8); q8 += 32;\n      const __m256i q8_1 = _mm256_loadu_si256((const __m256i*)q8); q8 += 32;\n      const __m256i q8_2 = _mm256_loadu_si256((const __m256i*)q8); q8 += 32;\n      const __m256i q8_3 = _mm256_loadu_si256((const __m256i*)q8); q8 += 32;\n\n      // Dot product: we multiply the 2 low bits and 1 high bit part separately, so we can use _mm256_maddubs_epi16,\n      // and then subtract. The high bit part has the 2 already subtracted (and so, it is zero if the high bit was not set,\n      // and 2 if the high bit was set)\n      __m256i q8s_0 = _mm256_maddubs_epi16(q3h_0, q8_0);\n      __m256i q8s_1 = _mm256_maddubs_epi16(q3h_1, q8_1);\n      __m256i q8s_2 = _mm256_maddubs_epi16(q3h_2, q8_2);\n      __m256i q8s_3 = _mm256_maddubs_epi16(q3h_3, q8_3);\n\n      __m256i p16_0 = _mm256_maddubs_epi16(q3l_0, q8_0);\n      __m256i p16_1 = _mm256_maddubs_epi16(q3l_1, q8_1);\n      __m256i p16_2 = _mm256_maddubs_epi16(q3l_2, q8_2);\n      __m256i p16_3 = _mm256_maddubs_epi16(q3l_3, q8_3);\n\n      p16_0 = _mm256_sub_epi16(p16_0, q8s_0);\n      p16_1 = _mm256_sub_epi16(p16_1, q8s_1);\n      p16_2 = _mm256_sub_epi16(p16_2, q8s_2);\n      p16_3 = _mm256_sub_epi16(p16_3, q8s_3);\n\n      // multiply with scales\n      p16_0 = _mm256_madd_epi16(_mm256_shuffle_epi8(scales[j], get_scale_shuffle_q3k(is + 0)), p16_0);\n      p16_1 = _mm256_madd_epi16(_mm256_shuffle_epi8(scales[j], get_scale_shuffle_q3k(is + 1)), p16_1);\n      p16_2 = _mm256_madd_epi16(_mm256_shuffle_epi8(scales[j], get_scale_shuffle_q3k(is + 2)), p16_2);\n      p16_3 = _mm256_madd_epi16(_mm256_shuffle_epi8(scales[j], get_scale_shuffle_q3k(is + 3)), p16_3);\n\n      // accumulate\n      p16_0 = _mm256_add_epi32(p16_0, p16_1);\n      p16_2 = _mm256_add_epi32(p16_2, p16_3);\n      sumi  = _mm256_add_epi32(sumi, _mm256_add_epi32(p16_0, p16_2));\n\n    }\n\n    // multiply with block scale and accumulate\n    acc = _mm256_fmadd_ps(_mm256_broadcast_ss(&d), _mm256_cvtepi32_ps(sumi), acc);\n\n  }\n\n  *s = hsum_float_8(acc);\n\n#else\n  // scalar version\n  // This function is written like this so the compiler can manage to vectorize most of it\n  // Using -Ofast, GCC and clang manage to produce code that is within a factor of 2 or so from the\n  // manually vectorized version above. Every other version I tried would run at least 4 times slower.\n  // The ideal situation would be if we could just write the code once, and the compiler would\n  // automatically produce the best possible set of machine instructions, instead of us having to manually\n  // write vectorized versions for AVX, ARM_NEON, etc.\n\n  int8_t  aux8[QK_K];\n  int16_t aux16[8];\n  float   sums [8];\n  int32_t aux32[8];\n  memset(sums, 0, 8*sizeof(float));\n\n  uint32_t auxs[4];\n  const int8_t * scales = (const int8_t*)auxs;\n\n  float sumf = 0;\n  for (int i = 0; i < nb; ++i) {\n    const uint8_t * __restrict__ q3 = x[i].qs;\n    const uint8_t * __restrict__ hm = x[i].hmask;\n    const  int8_t * __restrict__ q8 = y[i].qs;\n    memset(aux32, 0, 8*sizeof(int32_t));\n    int8_t * __restrict__ a = aux8;\n    uint8_t m = 1;\n    for (int j = 0; j < QK_K; j += 128) {\n      for (int l = 0; l < 32; ++l) a[l] = q3[l] & 3;\n      for (int l = 0; l < 32; ++l) a[l] -= (hm[l] & m ? 0 : 4);\n      a += 32; m <<= 1;\n      for (int l = 0; l < 32; ++l) a[l] = (q3[l] >> 2) & 3;\n      for (int l = 0; l < 32; ++l) a[l] -= (hm[l] & m ? 0 : 4);\n      a += 32; m <<= 1;\n      for (int l = 0; l < 32; ++l) a[l] = (q3[l] >> 4) & 3;\n      for (int l = 0; l < 32; ++l) a[l] -= (hm[l] & m ? 0 : 4);\n      a += 32; m <<= 1;\n      for (int l = 0; l < 32; ++l) a[l] = (q3[l] >> 6) & 3;\n      for (int l = 0; l < 32; ++l) a[l] -= (hm[l] & m ? 0 : 4);\n      a += 32; m <<= 1;\n      q3 += 32;\n    }\n    a = aux8;\n\n    memcpy(auxs, x[i].scales, 12);\n    uint32_t tmp = auxs[2];\n    auxs[2] = ((auxs[0] >> 4) & kmask2) | (((tmp >> 4) & kmask1) << 4);\n    auxs[3] = ((auxs[1] >> 4) & kmask2) | (((tmp >> 6) & kmask1) << 4);\n    auxs[0] = (auxs[0] & kmask2) | (((tmp >> 0) & kmask1) << 4);\n    auxs[1] = (auxs[1] & kmask2) | (((tmp >> 2) & kmask1) << 4);\n    for (int j = 0; j < QK_K/16; ++j) {\n      for (int l = 0; l < 8; ++l) aux16[l] = q8[l] * a[l];\n      for (int l = 0; l < 8; ++l) aux32[l] += (scales[j] - 32) * aux16[l];\n      q8 += 8; a += 8;\n      for (int l = 0; l < 8; ++l) aux16[l] = q8[l] * a[l];\n      for (int l = 0; l < 8; ++l) aux32[l] += (scales[j] - 32) * aux16[l];\n      q8 += 8; a += 8;\n    }\n    const float d = half_to_float(x[i].d) * y[i].d;\n    for (int l = 0; l < 8; ++l) sums[l] += d * aux32[l];\n  }\n  for (int l = 0; l < 8; ++l) sumf += sums[l];\n  *s = sumf;\n\n#endif\n\n}\n\nvoid quantize_row_q8_K_ref(const float * __restrict__ x, block_q8_K * __restrict__ y, int64_t k) {\n  assert(k % QK_K == 0);\n  const int64_t nb = k / QK_K;\n\n  for (int i = 0; i < nb; i++) {\n\n    float max = 0;\n    float amax = 0;\n    for (int j = 0; j < QK_K; ++j) {\n      float ax = fabsf(x[j]);\n      if (ax > amax) {\n        amax = ax; max = x[j];\n      }\n    }\n    if (!amax) {\n      y[i].d = 0;\n      memset(y[i].qs, 0, QK_K);\n      x += QK_K;\n      continue;\n    }\n    //const float iscale = -128.f/max;\n    // We need this change for IQ2_XXS, else the AVX implementation becomes very awkward\n    const float iscale = -127.f/max;\n    for (int j = 0; j < QK_K; ++j) {\n      int v = nearest_int(iscale*x[j]);\n      y[i].qs[j] = std::min(127, v);\n    }\n    for (int j = 0; j < QK_K/16; ++j) {\n      int sum = 0;\n      for (int ii = 0; ii < 16; ++ii) {\n        sum += y[i].qs[j*16 + ii];\n      }\n      y[i].bsums[j] = sum;\n    }\n    y[i].d = 1/iscale;\n    x += QK_K;\n  }\n}\n\nvoid dequantize_row_q8_K(const block_q8_K * __restrict__ x, float * __restrict__ y, int64_t k) {\n  assert(k % QK_K == 0);\n  const int64_t nb = k / QK_K;\n\n  for (int i = 0; i < nb; i++) {\n    for (int j = 0; j < QK_K; ++j) {\n      *y++ = x[i].d * x[i].qs[j];\n    }\n  }\n}\n\nvoid ggml_vec_dot_q2_K_q8_K(\n  int n, \n  float * __restrict__ s, \n  const void * __restrict__ vx, \n  const void * __restrict__ vy\n) {\n\n  const block_q2_K * __restrict__ x = (const block_q2_K *)vx;\n  const block_q8_K * __restrict__ y = (const block_q8_K *)vy;\n\n  const int nb = n / QK_K;\n\n#if defined __AVX2__\n\n  const __m256i m3 = _mm256_set1_epi8(3);\n  const __m128i m4 = _mm_set1_epi8(0xF);\n\n  __m256 acc = _mm256_setzero_ps();\n\n  for (int i = 0; i < nb; ++i) {\n\n    const float d = y[i].d * half_to_float(x[i].d);\n    const float dmin = -y[i].d * half_to_float(x[i].dmin);\n\n    const uint8_t * __restrict__ q2 = x[i].qs;\n    const int8_t  * __restrict__ q8 = y[i].qs;\n\n    const __m128i mins_and_scales = _mm_loadu_si128((const __m128i*)x[i].scales);\n    const __m128i scales8 = _mm_and_si128(mins_and_scales, m4);\n    const __m128i mins8 = _mm_and_si128(_mm_srli_epi16(mins_and_scales, 4), m4);\n    const __m256i mins = _mm256_cvtepi8_epi16(mins8);\n    const __m256i prod = _mm256_madd_epi16(mins, _mm256_loadu_si256((const __m256i*)y[i].bsums));\n\n    acc = _mm256_fmadd_ps(_mm256_broadcast_ss(&dmin), _mm256_cvtepi32_ps(prod), acc);\n\n    const __m256i all_scales = _mm256_cvtepi8_epi16(scales8);\n    const __m128i l_scales = _mm256_extracti128_si256(all_scales, 0);\n    const __m128i h_scales = _mm256_extracti128_si256(all_scales, 1);\n    const __m256i scales[2] = {MM256_SET_M128I(l_scales, l_scales), MM256_SET_M128I(h_scales, h_scales)};\n\n    __m256i sumi = _mm256_setzero_si256();\n\n    for (int j = 0; j < QK_K/128; ++j) {\n\n      const __m256i q2bits = _mm256_loadu_si256((const __m256i*)q2); q2 += 32;\n\n      const __m256i q8_0 = _mm256_loadu_si256((const __m256i*)q8); q8 += 32;\n      const __m256i q8_1 = _mm256_loadu_si256((const __m256i*)q8); q8 += 32;\n      const __m256i q8_2 = _mm256_loadu_si256((const __m256i*)q8); q8 += 32;\n      const __m256i q8_3 = _mm256_loadu_si256((const __m256i*)q8); q8 += 32;\n\n      const __m256i q2_0 = _mm256_and_si256(q2bits, m3);\n      const __m256i q2_1 = _mm256_and_si256(_mm256_srli_epi16(q2bits, 2), m3);\n      const __m256i q2_2 = _mm256_and_si256(_mm256_srli_epi16(q2bits, 4), m3);\n      const __m256i q2_3 = _mm256_and_si256(_mm256_srli_epi16(q2bits, 6), m3);\n\n      __m256i p0 = _mm256_maddubs_epi16(q2_0, q8_0);\n      __m256i p1 = _mm256_maddubs_epi16(q2_1, q8_1);\n      __m256i p2 = _mm256_maddubs_epi16(q2_2, q8_2);\n      __m256i p3 = _mm256_maddubs_epi16(q2_3, q8_3);\n\n      p0 = _mm256_madd_epi16(_mm256_shuffle_epi8(scales[j], get_scale_shuffle_q3k(0)), p0);\n      p1 = _mm256_madd_epi16(_mm256_shuffle_epi8(scales[j], get_scale_shuffle_q3k(1)), p1);\n      p2 = _mm256_madd_epi16(_mm256_shuffle_epi8(scales[j], get_scale_shuffle_q3k(2)), p2);\n      p3 = _mm256_madd_epi16(_mm256_shuffle_epi8(scales[j], get_scale_shuffle_q3k(3)), p3);\n\n      p0 = _mm256_add_epi32(p0, p1);\n      p2 = _mm256_add_epi32(p2, p3);\n\n      sumi = _mm256_add_epi32(sumi, _mm256_add_epi32(p0, p2));\n    }\n\n    acc = _mm256_fmadd_ps(_mm256_broadcast_ss(&d), _mm256_cvtepi32_ps(sumi), acc);\n\n  }\n\n  *s = hsum_float_8(acc);\n#else\n  float sumf = 0;\n\n  for (int i = 0; i < nb; ++i) {\n\n    const uint8_t * q2 = x[i].qs;\n    const  int8_t * q8 = y[i].qs;\n    const uint8_t * sc = x[i].scales;\n\n    int summs = 0;\n    for (int j = 0; j < 16; ++j) {\n      summs += y[i].bsums[j] * (sc[j] >> 4);\n    }\n\n    const float dall = y[i].d * half_to_float(x[i].d);\n    const float dmin = y[i].d * half_to_float(x[i].dmin);\n\n    int isum = 0;\n    int is = 0;\n    int d;\n    for (int k = 0; k < QK_K/128; ++k) {\n      int shift = 0;\n      for (int j = 0; j < 4; ++j) {\n        d = sc[is++] & 0xF;\n        int isuml = 0;\n        for (int l =  0; l < 16; ++l) isuml += q8[l] * ((q2[l] >> shift) & 3);\n        isum += d * isuml;\n        d = sc[is++] & 0xF;\n        isuml = 0;\n        for (int l = 16; l < 32; ++l) isuml += q8[l] * ((q2[l] >> shift) & 3);\n        isum += d * isuml;\n        shift += 2;\n        q8 += 32;\n      }\n      q2 += 32;\n    }\n    sumf += dall * isum - dmin * summs;\n  }\n  *s = sumf;\n#endif\n}"
  },
  {
    "path": "src/quant.h",
    "content": "/*\nK-quants adapted from llama.cpp\n\nMIT License\n\nCopyright (c) 2023-2024 The ggml authors\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\n#pragma once\n\n#include \"codec.h\"\n\n// QK = number of values after dequantization\n// QK_K = super-block size\n\n#define QK_K 256\n\n// 2-bit quantization\n// weight is represented as x = a * q + b\n// 16 blocks of 16 elements each\n// Effectively 2.625 bits per weight\ntypedef struct {\n  uint8_t scales[QK_K/16]; // scales and mins, quantized with 4 bits\n  uint8_t qs[QK_K/4];      // quants\n  union {\n    struct {\n      uint16_t d;    // super-block scale for quantized scales\n      uint16_t dmin; // super-block scale for quantized mins\n    };\n    uint32_t dm;\n  };\n} block_q2_K;\nstatic_assert(sizeof(block_q2_K) == 2*sizeof(uint16_t) + QK_K/16 + QK_K/4, \"wrong q2_K block size/padding\");\n\n// Quantize an array of weights using Q2_K quantization\n// - x: pointer to the weights to quantize\n// - y: pointer to the quantized weights\n// - k: number of weights to quantize (must be a multiple of QK_K)\nvoid quantize_row_q2_K_ref(const float * __restrict__ x, block_q2_K * __restrict__ y, int64_t k);\n\n// Dequantize an array of Q2_K quantized weights\n// - x: pointer to the quantized weights\n// - y: pointer to the dequantized weights\n// - k: number of weights to dequantize (must be a multiple of QK_K)\nvoid dequantize_row_q2_K(const block_q2_K * __restrict__ x, float * __restrict__ y, int64_t k);\n\n// 3-bit quantization\n// weight is represented as x = a * q\n// 16 blocks of 16 elements each\n// Effectively 3.4375 bits per weight\ntypedef struct {\n  uint8_t hmask[QK_K/8]; // quants - high bit\n  uint8_t qs[QK_K/4];    // quants - low 2 bits\n  uint8_t scales[12];    // scales, quantized with 6 bits\n  uint16_t d;           // super-block scale\n} block_q3_K;\nstatic_assert(sizeof(block_q3_K) == sizeof(uint16_t) + QK_K / 4 + QK_K / 8 + 12, \"wrong q3_K block size/padding\");\n\n// Quantize an array of weights using Q3_K quantization\n// - x: pointer to the weights to quantize\n// - y: pointer to the quantized weights\n// - k: number of weights to quantize (must be a multiple of QK_K)\nvoid quantize_row_q3_K_ref(const float * __restrict__ x, block_q3_K * __restrict__ y, int64_t k);\n\n// Dequantize an array of Q3_K quantized weights\n// - x: pointer to the quantized weights\n// - y: pointer to the dequantized weights\n// - k: number of weights to dequantize (must be a multiple of QK_K)\nvoid dequantize_row_q3_K(const block_q3_K * __restrict__ x, float * __restrict__ y, int64_t k);\n\n// Compute the dot product of two vectors, using Q3_K and Q8_K quantization\n// - n: number of elements in the vectors\n// - s: pointer to the result of the dot product\n// - vx: pointer to the first vector\n// - vy: pointer to the second vector\nvoid ggml_vec_dot_q3_K_q8_K(\n  int n, \n  float * __restrict__ s, \n  const void * __restrict__ vx, \n  const void * __restrict__ vy\n);\n\n// 8-bit quantization\n// This is only used for intermediate quantization and dot products\ntypedef struct {\n  float   d;              // delta\n  int8_t  qs[QK_K];       // quants\n  int16_t bsums[QK_K/16]; // sum of quants in groups of 16\n} block_q8_K;\nstatic_assert(sizeof(block_q8_K) == sizeof(float) + QK_K + QK_K/16*sizeof(int16_t), \"wrong q8_K block size/padding\");\n\n// Quantize an array of weights using Q8_K quantization\n// - x: pointer to the weights to quantize\n// - y: pointer to the quantized weights\n// - k: number of weights to quantize (must be a multiple of QK_K)\nvoid quantize_row_q8_K_ref(const float * __restrict__ x, block_q8_K * __restrict__ y, int64_t k);\n\n// Dequantize an array of Q8_K quantized weights\n// - x: pointer to the quantized weights\n// - y: pointer to the dequantized weights\n// - k: number of weights to dequantize (must be a multiple of QK_K)\nvoid dequantize_row_q8_K(const block_q8_K * __restrict__ x, float * __restrict__ y, int64_t k);\n\n// Compute the dot product of two vectors, using Q2_K and Q8_K quantization\n// - n: number of elements in the vectors\n// - s: pointer to the result of the dot product\n// - vx: pointer to the first vector\n// - vy: pointer to the second vector\nvoid ggml_vec_dot_q2_K_q8_K(\n  int n, \n  float * __restrict__ s, \n  const void * __restrict__ vx, \n  const void * __restrict__ vy\n);"
  },
  {
    "path": "src/sampler.cpp",
    "content": "#include \"sampler.h\"\n\n#include <algorithm>\n#include <cfloat>\n#include <cstdlib>\n\nSampler::Sampler(const std::shared_ptr<Config> config, uint64_t seed) {\n  vocab_size = config->vocab_size;\n  std::srand(seed); // TODO: use random_device\n}\n\nfloat Sampler::sample_prob(int index, const InferenceState& s) {\n  const float* logits = s.logits();\n  // Find max value to moderate the logits later on for numerical stability\n  float max_val = -FLT_MAX;\n  for (int i = 0; i < vocab_size; ++i) {\n    if (logits[i] > max_val) {\n      max_val = logits[i];\n    }\n  }\n  float sum = 0;\n  for (int i = 0; i < vocab_size; ++i) {\n    sum += expf(logits[i] - max_val);\n  }\n  return expf(logits[index] - max_val) / sum;\n}\n\nint Sampler::sample_argmax(const InferenceState& s) {\n  const float* logits = s.logits();\n  int argmax = 0;\n  float max_val = -FLT_MAX;\n  for (int i = 0; i < vocab_size; ++i) {\n    if (logits[i] > max_val) {\n      max_val = logits[i];\n      argmax = i;\n    }\n  }\n  return argmax;\n}\n\nint Sampler::sample(const InferenceState& s, float temperature, float top_p) {\n  if (temperature == 0.0) {\n    return sample_argmax(s);\n  }\n  const float* logits = s.logits();\n  int* logit_indices = s.logit_indices();\n  // Find max value to moderate the logits later on for numerical stability\n  float max_val = -FLT_MAX;\n  for (int i = 0; i < vocab_size; ++i) {\n    if (logits[i] > max_val) {\n      max_val = logits[i];\n    }\n  }\n  float sum = 0;\n  for (int i = 0; i < vocab_size; ++i) {\n    sum += expf((logits[i] - max_val) / temperature);\n  }\n  // Sort logits descending for nucleus/top-p sampling (https://arxiv.org/abs/1904.09751)\n  if (top_p < 1.0) {\n    std::sort(\n      logit_indices, logit_indices + vocab_size, \n      [&logits](int i, int j) { return logits[i] > logits[j]; }\n    );\n  }\n  // Randomly sample from the softmaxed logits distribution\n  float r = std::rand() / (float)RAND_MAX * top_p;\n  float cumsum = 0;\n  for (int i = 0; i < vocab_size; ++i) {\n    cumsum += expf((logits[i] - max_val) / temperature) / sum;\n    if (cumsum >= r) {\n      return i;\n    }\n  }\n  return vocab_size - 1;\n}\n\n"
  },
  {
    "path": "src/sampler.h",
    "content": "#pragma once\n\n#include \"model.h\"\n\n#include <memory>\n\nstruct Sampler {\n  int vocab_size;\n\n  Sampler(const std::shared_ptr<Config> config, uint64_t seed);\n\n  // Return the probability score corresponding to `logits[index]`.\n  // This is equivalent to taking the softmax of the logits and returning\n  // the value at index `index`.\n  float sample_prob(int index, const InferenceState& s);\n  // Return the index of the maximum value in `logits`.\n  int sample_argmax(const InferenceState& s);\n  // Sample from the model's distribution with temperature.\n  int sample(const InferenceState& s, float temperature = 1.0, float top_p = 0.95);\n};"
  },
  {
    "path": "src/test.cpp",
    "content": "#include <iostream>\n#include <memory>\n#include <omp.h>\n#include <random>\n#include <thread>\n#include <vector>\n\n#include \"immintrin.h\"\n\n#include \"model.h\"\n#include \"time_utils.h\"\n\nbool floatEquals(float a, float b, float epsilon = 1e-5) {\n  return std::abs(a - b) < epsilon;\n}\n\nbool arrayEquals(const std::vector<float>& a, const std::vector<float>& b, float epsilon = 1e-4) {\n  if (a.size() != b.size()) {\n    return false;\n  }\n  for (size_t i = 0; i < a.size(); i++) {\n    if (!floatEquals(a[i], b[i], epsilon)) {\n      return false;\n    }\n  }\n  return true;\n}\n\nvoid assertArrayEquals(const std::vector<float>& actual, const std::vector<float>& expected, const std::string& message, float epsilon = 1e-4) {\n  if (!arrayEquals(actual, expected, epsilon)) {\n    std::cerr << \"Assertion failed: \" << message << std::endl;\n    std::cerr << \"actual: \";\n    for (size_t i = 0; i < actual.size(); i++) {\n      std::cerr << actual[i] << \" \";\n    }\n    std::cerr << std::endl;\n    std::cerr << \"expected: \";\n    for (size_t i = 0; i < expected.size(); i++) {\n      std::cerr << expected[i] << \" \";\n    }\n    std::cerr << std::endl;\n    exit(1);\n  }\n}\n\nvoid assertArrayEquals(float* actual, const std::vector<float>& expected, const std::string& message) {\n  std::vector<float> actual_array;\n  for (size_t i = 0; i < expected.size(); i++) {\n    actual_array.push_back(actual[i]);\n  }\n  assertArrayEquals(actual_array, expected, message);\n}\n\nstd::vector<f16_t> float_array_to_half(const std::vector<float>& data) {\n  std::vector<f16_t> half_data(data.size());\n  for (size_t i = 0; i < data.size(); i++) {\n    half_data[i] = float_to_half(data[i]);\n  }\n  return half_data;\n}\n\nstd::vector<f8e5m2_t> float_array_to_float8e5m2(const std::vector<float>& data) {\n  std::vector<f8e5m2_t> float8e5m2_data(data.size());\n  for (size_t i = 0; i < data.size(); i++) {\n    float8e5m2_data[i] = float_to_float8e5m2(data[i]);\n  }\n  return float8e5m2_data;\n}\n\nvoid test_attn() {\n  constexpr int TEST_SEQ_LEN = 4;\n  constexpr int TEST_DIM = 6;\n  constexpr int TEST_HEAD_DIM = 3;\n  constexpr int TEST_N_HEADS = 2;\n  std::shared_ptr<Config> config = std::make_shared<Config>();\n  config->dim = TEST_DIM;\n  config->hidden_dim = TEST_DIM;\n  config->head_dim = TEST_HEAD_DIM;\n  config->n_heads = TEST_N_HEADS;\n  config->vocab_size = 1;\n  config->max_seq_len = TEST_SEQ_LEN;\n  InferenceState s(config);\n  // (n_heads, head_dim) - query vectors\n  std::vector<float> q{\n    0., 1e4, 0., // h=0\n    0., 0., 1e4 // h=1\n  };\n  for (size_t i = 0; i < q.size(); i++) {\n    s.q()[i] = q[i];\n  }\n  std::vector<f16_t> kb = float_array_to_half({\n    1., 0., 0., // t=0\n    0., 1., 0., // t=1\n    0., 0., 1., // t=2\n    -1., 0., 0. // t=3\n  }); // (kv_len, n_heads, head_dim) - buffer containing key vectors of the sequence for all KV heads\n  std::vector<f16_t> vb = float_array_to_half({\n    1., 0., 0., // t=0\n    0., 1., 0., // t=1\n    0., 0., 1., // t=2\n    -1., 0., 0. // t=3\n  }); // (kv_len, n_heads, head_dim) - buffer containing value vectors of the sequence for all KV heads\n\n  // Multihead attention. Iterate over all heads.\n  int h;\n#pragma omp parallel for private(h)\n  for (h = 0; h < TEST_N_HEADS; h++) {\n    int kv_head_offset = h * TEST_HEAD_DIM;\n    f16_t* kh = kb.data() + kv_head_offset;\n    f16_t* vh = vb.data() + kv_head_offset;\n    attn(s.xb(h), s.att(h), s.q(h), kh, vh, TEST_HEAD_DIM, TEST_HEAD_DIM, TEST_N_HEADS, TEST_SEQ_LEN);\n  }\n  // attention scores\n  // h=0\n  assertArrayEquals(s.att(0), {\n    0., 1., 0., 0.\n  }, \"att(h=0)\");\n  // h=1\n  assertArrayEquals(s.att(1), {\n    0., 0., 1., 0.\n  }, \"att(h=1)\");\n  assertArrayEquals(s.xb(), {\n    0., 1., 0., // h=0\n    0., 0., 1. // h=1\n  }, \"xout\");\n}\n\nvoid test_matmul() {\n  assert(float8e5m2_to_float(float_to_float8e5m2(1.0f)) == 1.0f);\n  assert(float8e5m2_to_float(float_to_float8e5m2(-1.5f)) == -1.5f);\n  assert(float8e5m2_to_float(float_to_float8e5m2(0.109375)) == 0.109375);\n  std::vector<float> x{ \n    2.0624e-01,  1.6975e+00,  8.4918e-01, -1.7186e-01, \n    -9.0164e-01, 6.1108e-01,  2.2116e-01,  1.0412e+00, \n    -1.6616e-03,  8.2840e-01, 2.2667e-01, -1.3993e+00,  \n    4.1013e-01, -1.2223e+00,  2.2723e-01, 6.3558e-01\n  };\n  std::vector<float> w_f32{\n    // row 1\n    -1.1210, -0.0235, -1.3527,  0.6300,  0.2566, -0.4517, -0.3528,  0.4422, \n    -0.4032, -1.0949, -0.7834,  1.1425,  0.6263, -0.3680,  0.3226, -0.2984,\n    // row 2\n    0.1176, -1.1462, -0.8181, -2.0047,  0.0932,  1.4665, -0.8682, -0.8490,\n    -1.3017, -1.0068, -0.2890,  0.0167,  1.1607,  0.7196,  1.7701,  0.2891\n  };\n  std::vector<f16_t> w_f16 = float_array_to_half(w_f32);\n  std::vector<f8e5m2_t> w_f8e5m2 = float_array_to_float8e5m2(w_f32);\n  {\n    std::vector<float> xout(2);\n    matmul_unscaled(xout.data(), x.data(), {Quant::F32, {16, 2}, w_f32.data(), 16*2*sizeof(float)});\n    assertArrayEquals(xout, {\n      -3.7454, -3.2738\n    }, \"matmul_f32\", 1e-4);\n  }\n  {\n    std::vector<float> xout(2);\n    matmul_unscaled(xout.data(), x.data(), {Quant::F16, {16, 2}, w_f16.data(), 16*2*sizeof(f16_t)});\n    assertArrayEquals(xout, {\n      -3.7454, -3.2738\n    }, \"matmul_f16\", 1e-3);\n  }\n  {\n    std::vector<float> xout(2);\n    matmul_unscaled(xout.data(), x.data(), {Quant::F8E5M2, {16, 2}, w_f8e5m2.data(), 16*2*sizeof(f8e5m2_t)});\n    assertArrayEquals(xout, {\n      -3.7454, -3.2738\n    }, \"matmul_f8e5m2\", 3.78e-1);\n    std::vector<float> xout_roundtrip(2);\n    std::vector<float> w8_roundtrip;\n    for (size_t i = 0; i < w_f8e5m2.size(); i++) {\n      w8_roundtrip.push_back(float8e5m2_to_float(w_f8e5m2[i]));\n    }\n    matmul_unscaled(xout_roundtrip.data(), x.data(), {Quant::F8E5M2, {16, 2}, w8_roundtrip.data(), 16*2*sizeof(f8e5m2_t)});\n    assertArrayEquals(xout_roundtrip, xout, \"matmul_f8e5m2_roundtrip\");\n  }\n  std::vector<float> x8_roundtrip;\n  for (size_t i = 0; i < x.size(); i++) {\n    x8_roundtrip.push_back(float8e5m2_to_float(float_to_float8e5m2(x[i])));\n  }\n  assertArrayEquals(x8_roundtrip, {\n    2.1875e-01,  1.7500e+00,  8.7500e-01, -1.5625e-01, \n    -8.7500e-01, 6.2500e-01,  2.1875e-01,  1.0000e+00, \n    -1.7090e-03,  8.7500e-01, 2.1875e-01, -1.5000e+00,\n    4.3750e-01, -1.2500e+00,  2.1875e-01, 6.2500e-01\n  }, \"x_float8e5m2_roundtrip\");\n}\n\nvoid fill_random(float* data, size_t N, unsigned long seed, float scale_factor = 1.0) {\n  std::default_random_engine gen(seed);\n  std::normal_distribution<float> dist(0.0, 1.0);\n  for (size_t i = 0; i < N; i++) {\n    data[i] = dist(gen) * scale_factor;\n  }\n}\n\nvoid fill_random(f16_t* data, size_t N, unsigned long seed, float scale_factor = 1.0) {\n#if defined(__AVX2__) && defined(__F16C__)\n  std::default_random_engine gen(seed);\n  std::normal_distribution<float> dist(0.0, 1.0);\n  for (size_t i = 0; i < N; i++) {\n    data[i] = _cvtss_sh(dist(gen) * scale_factor, 0);\n  }\n#else\n  assert(false && \"Cannot fill_random due to missing F16C extensions\");\n#endif\n}\n\n// Helper function to allocate aligned memory\nfloat* allocateAlignedArray(size_t N) {\n  // Allocate aligned memory (64-byte alignment for AVX-512)\n  void* ptr = nullptr;\n  if (posix_memalign(&ptr, 64, N * sizeof(float)) != 0) {\n    throw std::bad_alloc();\n  }\n  return static_cast<float*>(ptr);\n}\n\nvoid mem_bench() {\n  constexpr size_t N_THREADS = 32;\n  constexpr size_t MB_PER_THREAD = 1024;\n  constexpr size_t ELS_PER_THREAD = (MB_PER_THREAD * 1024 * 1024) / sizeof(float);\n  constexpr size_t N = N_THREADS * ELS_PER_THREAD;\n\n  std::cout << \"Using \" << N_THREADS << \" threads\" << std::endl;\n  std::cout << \"Allocating \" << N_THREADS * MB_PER_THREAD << \" MB (\" << N << \" floats)\" << std::endl;\n  float* data = allocateAlignedArray(N);\n\n  std::cout << \"Filling data...\" << std::endl;\n#pragma omp parallel for num_threads(N_THREADS)\n  for (size_t i = 0; i < N_THREADS; i++) {\n    fill_random(data + i * ELS_PER_THREAD, ELS_PER_THREAD, (unsigned long)i);\n  }\n  std::cout << \"Running memory bandwidth test...\" << std::endl;\n\n  float totalSum = 0.0;\n  uint64_t start = get_timestamp_ms();\n#pragma omp parallel for simd reduction(+:totalSum) schedule(guided) aligned(data: 64) num_threads(N_THREADS)\n  for (size_t i = 0; i < N; i++) {\n    totalSum += data[i];\n  }\n    \n  uint64_t end = get_timestamp_ms();\n  float elapsed_s = (end - start) / 1000.0;\n  float mb_per_s = N_THREADS * MB_PER_THREAD / elapsed_s;\n\n  std::cout << \"Total sum: \" << totalSum << std::endl;\n  std::cout << \"Elapsed time: \" << elapsed_s << \" s\" << std::endl;\n  std::cout << \"Memory bandwidth: \" << mb_per_s << \" MB/s\" << std::endl;\n}\n\n// 64 is the typical cache line size\nstruct alignas(64) ThreadData {\n  volatile uint32_t sink;\n  char padding[60]; // Ensures 64-byte alignment/padding\n};\n\nvoid mem_bench2_thread(uint32_t* data, size_t start_idx, size_t elements_per_thread, ThreadData* thread_sink) {\n  for (size_t i = start_idx; i < start_idx + elements_per_thread; i++) {\n    // 32-bit load stored in volatile to prevent optimization\n    thread_sink->sink = data[i];\n  }\n}\n\nvoid mem_bench2() {\n  constexpr size_t N_THREADS = 64;\n  constexpr size_t MB_PER_THREAD = 2048;\n  constexpr size_t ELS_PER_THREAD = (MB_PER_THREAD * 1024 * 1024) / sizeof(uint32_t);\n  constexpr size_t N = N_THREADS * ELS_PER_THREAD;\n\n  std::cout << \"Using \" << N_THREADS << \" threads\" << std::endl;\n  std::cout << \"Allocating \" << N_THREADS * MB_PER_THREAD << \" MB (\" << N << \" uint32_t)\" << std::endl;\n  uint32_t* data = new uint32_t[N];\n\n  std::cout << \"Filling data...\" << std::endl;\n#pragma omp parallel for num_threads(N_THREADS)\n  for (size_t i = 0; i < N_THREADS; i++) {\n    for (size_t j = 0; j < ELS_PER_THREAD; j++) {\n      data[i * ELS_PER_THREAD + j] = i + j;\n    }\n  }\n  std::cout << \"Running memory bandwidth test...\" << std::endl;\n\n  // Allocate cache-line aligned sinks for each thread\n  std::vector<ThreadData> thread_sinks(N_THREADS);\n\n  uint64_t start = get_timestamp_ms();\n  std::vector<std::thread> threads;\n  \n  // Launch threads\n  for (size_t i = 0; i < N_THREADS; i++) {\n    threads.emplace_back(mem_bench2_thread, \n      data,\n      i * ELS_PER_THREAD, \n      ELS_PER_THREAD,\n      &thread_sinks[i]\n    );\n  }\n  \n  // Wait for all threads to complete\n  for (auto& thread : threads) {\n    thread.join();\n  }\n    \n  uint64_t end = get_timestamp_ms();\n  float elapsed_s = (end - start) / 1000.0;\n  float mb_per_s = N_THREADS * MB_PER_THREAD / elapsed_s;\n\n  std::cout << \"Elapsed time: \" << elapsed_s << \" s\" << std::endl;\n  std::cout << \"Memory bandwidth: \" << mb_per_s << \" MB/s\" << std::endl;\n}\n\nint main(int argc, char* argv[]) {\n  if (argc == 2 && std::string(argv[1]) == \"-b\") {\n    std::cout << \"Running memory benchmark\" << std::endl;\n    mem_bench();\n  } else if (argc == 2 && std::string(argv[1]) == \"-b2\") {\n    std::cout << \"Running memory benchmark 2\" << std::endl;\n    mem_bench2();\n  } else {\n    test_attn();\n    test_matmul();\n  }\n  std::cout << \"All tests passed\" << std::endl;\n  return 0;\n}"
  },
  {
    "path": "src/time_utils.cpp",
    "content": "#include \"time_utils.h\"\n\n#include <chrono>\n\nuint64_t get_timestamp_ms() {\n  return std::chrono::duration_cast<std::chrono::milliseconds>(\n      std::chrono::system_clock::now().time_since_epoch()).count();\n}"
  },
  {
    "path": "src/time_utils.h",
    "content": "#pragma once\n\n#include <cstdint>\n\nuint64_t get_timestamp_ms();"
  },
  {
    "path": "src/tokenizer.cpp",
    "content": "#include \"tokenizer.h\"\n\nTokenizer::Tokenizer(const YALMData& data) {\n  this->bos_id = std::stoi(data.metadata.at(\"bos_token_id\").get<std::string>());\n  this->eos_id = std::stoi(data.metadata.at(\"eos_token_id\").get<std::string>());\n  // TODO: figure out edge cases:\n  // Q: should `vocab` include byte fallback tokens?\n  // Q: should `vocab` include special tokens, e.g. '<unk>', '<s>', '</s>'?\n  // TODO: avoid copy by using std::string_view\n  const Tensor& tokens_tensor = data.tensors.at(\"tokenizer.tokens\");\n  char* tokens_tensor_end = (char*)tokens_tensor.data + tokens_tensor.size;\n  for (char* ptr = (char*)tokens_tensor.data; ptr < tokens_tensor_end; ptr++) {\n    char* s = ptr;\n    while (*ptr != '\\0' && ptr < tokens_tensor_end) {\n      ptr++;\n    }\n    vocab.emplace_back(s, ptr - s);\n  }\n  for (size_t i = 0; i < vocab.size(); i++) {\n    if (vocab[i] == \"<0x00>\") {\n      byte_fallback_start = i;\n    } else if (vocab[i] == \"<|eot_id|>\" || vocab[i] == \"<|end|>\" || vocab[i] == \"<|im_end|>\") {\n      eot_id = i;\n    }\n  }\n  // init byte_pieces\n  for (size_t i = 0; i < 256; i++) {\n    byte_pieces[i] = (char)i;\n  }\n  // init vocab trie\n  for (size_t i = 0; i < vocab.size(); i++) {\n    const std::string& word = vocab[i];\n    TokenTrie* p = &vocab_trie;\n    for (char c : word) {\n      if (p->children.count(c) == 0) {\n        p->children[c] = std::make_shared<TokenTrie>();\n      }\n      p = p->children[c].get();\n    }\n    p->token_id = i;\n  }\n}\n\nstd::string Tokenizer::decode_one(int prev_token, int token) const {\n  const std::string& piece = vocab[token];\n  // if following BOS token, sentencepiece decoder strips any leading whitespace\n  if (prev_token == bos_id && piece[0] == ' ') {\n    return piece.substr(1);\n  }\n  // return byte piece for byte fallback tokens (<0x00>, <0x01>, ..., <0xFF>)\n  if (byte_fallback_start >= 0 && token >= byte_fallback_start && (token - byte_fallback_start) < 256) {\n    return byte_pieces[token - byte_fallback_start];\n  }\n  return piece;\n}\n\nstd::vector<int> Tokenizer::encode(const std::string& text, bool encode_bos) const {\n  std::vector<int> out_tokens;\n  if (encode_bos) {\n    out_tokens.push_back(bos_id);\n  }\n\n  for (size_t i = 0; i < text.size();) {\n    size_t l = 0;\n    size_t valid_l = 0;\n    const TokenTrie* p = &vocab_trie;\n    const TokenTrie* valid_p = nullptr;\n    while (i + l < text.size()) {\n      char c = text[i+l];\n      if (p->children.count(c)) {\n        p = p->children.at(c).get();\n        l += 1;\n        if (p->token_id >= 0) {\n          valid_p = p;\n          valid_l = l;\n        }\n      } else {\n        break;\n      }\n    }\n    if (!valid_p) {\n      // No substring starting from `i` matches any vocab words, use byte fallback\n      if (byte_fallback_start >= 0) {\n        out_tokens.push_back((unsigned char)text[i] + byte_fallback_start);\n      }\n      i += 1;\n    } else {\n      out_tokens.push_back(valid_p->token_id);\n      i += valid_l;\n    }\n  }\n\n  return out_tokens;\n}\n\nstd::string Tokenizer::encoding_to_debug_string(const std::vector<int>& encoding) const {\n  std::string token_encoding_debug_str = \"\";\n  for (int token_id : encoding) {\n    if (token_id == bos_id) {\n      token_encoding_debug_str += \"[<s>:\" + std::to_string(token_id) + \"]\";\n    } else if (token_id == eos_id) {\n      token_encoding_debug_str += \"[</s>:\" + std::to_string(token_id) + \"]\";\n    } else {\n      token_encoding_debug_str += \"[\" + vocab[token_id] + \":\" + std::to_string(token_id) + \"]\";\n    }\n  }\n  return token_encoding_debug_str;\n}"
  },
  {
    "path": "src/tokenizer.h",
    "content": "#pragma once\n\n#include \"codec.h\"\n\n#include <memory>\n#include <string>\n#include <vector>\n#include <unordered_map>\n\nstruct TokenTrie;\n\nstruct TokenTrie {\n  std::unordered_map<char, std::shared_ptr<TokenTrie>> children;\n  // If non-negative, then this represents the ID of the token formed by the path from the root to this node.\n  int token_id = -1;\n};\n\n/*\nA tokenizer vocab consists of a concatenated tensor with the key \"tokenizer.tokens\" in the .yalm file.\nShown as a list of strings:\n```\n\"tokenizer.tokens\": [\n  \"<unk>\",        // 0\n  \"<s>\",          // 1\n  \"</s>\",         // 2\n  \"<0x00>\",       // 3--------------+\n  \"<0x01>\",       // 4              |  Byte\n  \"<0x02>\",       // 5              |  Fallback \n  ...                               |  Tokens\n  \"<0xFE>\",       // 257            |\n  \"<0xFF>\",       // 258------------+\n  \"▁▁\",           // 259\n  \"▁▁▁▁\",         // 260\n  \"▁t\",           // 261\n  \"in\",           // 262\n  \"er\",           // 263\n  ...\n]\n```\nIn tensor form, it looks like a UTF-8 encoded byte array:\n```\n<unk>\\0<s>\\0</s>\\0<0x00>\\0<0x01>\\0<0x02>\\0...\\0<0xFE>\\0<0xFF>\\0▁▁\\0▁▁▁▁\\0▁t\\0in\\0er\\0...\n```\nImportant token IDs are included in the metadata of the .yalm file:\n```\n\"bos_token_id\": \"1\",\n\"eos_token_id\": \"2\",\n```\n*/\n\nstruct Tokenizer {\n  // vector where the index is the token id and the value is the token string\n  std::vector<std::string> vocab;\n  // trie mapping token strings to token ids\n  TokenTrie vocab_trie;\n\n  int bos_id = -1;\n  int eos_id = -1;\n  int eot_id = -1;\n  // start index of the byte fallback range (256 tokens). -1 if none.\n  int byte_fallback_start = -1;\n\n  // convenience array containing the decodings for the fixed 256 byte fallbacks '{0x00}\\0', '{0x01}\\0', ..., '{0xFF}\\0'.\n  // TODO: use constexpr?\n  std::string byte_pieces[256];\n\n  Tokenizer(const YALMData& data);\n\n  std::vector<int> encode(const std::string& text, bool encode_bos) const;\n  std::string decode_one(int prev_token, int token) const;\n  std::string encoding_to_debug_string(const std::vector<int>& encoding) const;\n};"
  },
  {
    "path": "src/wikitest.cat.1chunk.v2-encoded.txt",
    "content": "        100000,    207,    185,    403,   7940,  88819,    367,    403,    207,\n           185,    207,    185,   7940,  88819,    367,    317,    274,   3517,\n          6131,   2051,  16657,    285,  22624,  14112,   1021,   1063,    661,\n           245,  11477,   1173,     12,     31,  52439,   5012,    331,    254,\n         16657,   4077,    429,   9614,    279,    207,     17,     15,     15,\n            15,   1021,   1002,    438,   5496,    457,    245,  52439,   5012,\n           279,    254,   1538,   5067,    879,   4473,    457,  18475,  75156,\n          2051,    588,    438,   7903,    279,    207,     17,     15,     15,\n            16,    430,    254,  12040,   8592,  20699,   1021,   1063,    661,\n           245,  11477,   5012,    279,    254,  16657,   4077,  23053,   3326,\n          1987,    271,    279,    207,     17,     15,     15,     17,   1021,\n           685,    207,     17,     15,     15,     19,  88819,    367,  23831,\n           245,   5012,    372,    440,  32163,    440,    279,    254,  15341,\n           440,  57034,    655,     82,  18443,    440,    280,    254,  16657,\n          4077,    429,   9055,  37432,   6204,    362,  72661,  16381,  19639,\n          5231,  29820,    285,  53918,  68568,   1021,   1063,    438,   4733,\n           279,    254,    207,     17,     15,     15,     20,  22624,  41075,\n           280,    254,  16855,  47812,   2734,   1538,  43200,  45799,   2051,\n           588,    438,   7903,    430,    254,  42925,  20699,    279,  47558,\n           285,    254,  10889,   1369,  38118,  30821,    279,   5922,   1021,\n          1063,    438,  12977,    457,   3326,  76272,    285,  72661,  16381,\n          6493,   2180,    844,   2268,   2051,  64762,   1981,  22551,   2051,\n         14503,  16530,   2051,  49866,  24308,    379,   2051,  54652,  65665,\n           285,  83822,   9243,   1021,    207,    185,    685,    207,     17,\n            15,     15,     21,   2051,  88819,    367,  72661,  16381,   2180,\n           844,   2268,    279,    254,   1538,  50926,   2223,   4473,    457,\n          5231,  43799,  19860,   1021,   1063,   7676,    331,    245,    207,\n            17,     15,     15,     21,  15341,    280,    254,  16657,   4077,\n          2051,  58162,   2051,   5496,    457,    245,   5012,    279,    254,\n           207,     17,     15,     15,     22,  22624,   5909,    280,   1724,\n           276,  12246,    346,  12977,    457,  13905,    522,    433,    416,\n           400,   1021,   1724,    276,  12246,    346,    438,   7903,    430,\n         21350,  20699,    279,    254,   5922,  70963,    280,   6556,  18163,\n         28496,    285,  40955,   4791,   1021,  88819,    367,  72661,    279,\n           984,  15687,    279,    207,     17,     15,     15,     23,   2051,\n          6617,   3205,   4867,  33935,    457,  73540,   8913,   2673,    864,\n            72,   2051,    285,   4946,   2458,  61720,  12977,    457,   8562,\n           326,  95725,   1021,    685,   3638,    207,     17,     15,     15,\n            23,   2051,  88819,    367,   1401,    245,  11477,   8753,    331,\n           245,    984,   1173,     12,     31,    697,  15341,  10621,    280,\n           254,  16657,   4077,    423,   1379,    254,  20241,   2051,   5496,\n           457,    274,   8753,    331,    254,  16657,   4077,  79684,    715,\n           279,   7953,    207,     17,     15,     15,     23,   1021,   1063,\n           661,    245,  47198,   5012,    279,   2146,  26774,    280,    254,\n         16657,   4077,  73370,   1000,    279,    207,     17,     15,     16,\n            15,   2051,    372,    440,    721,  94016,  53980,    440,   1021,\n         88819,    367,  72661,    279,    254,    207,     17,     15,     16,\n            16,   6131,  19611,    255,   4940,  12977,    457,   8913,   2673,\n           864,     72,   1021,    207,    185,    207,    185,    403,    403,\n         40388,    403,    403,    207,    185,    207,    185,    207,    185,\n           403,    403,    403,    207,     17,     15,     15,     15,    207,\n           891,    207,     17,     15,     15,     20,    403,    403,    403,\n           207,    185,    207,    185,    685,    207,     17,     15,     15,\n            15,  88819,    367,    661,    245,  11477,   1173,     12,     31,\n         52439,   5012,    331,    254,  16657,   4077,    429,   9614,   6204,\n           362,  57697,    440,  10854,   3126,    674,    440,    279,    254,\n         15341,   2051,    440,    685,  29018,  44099,    440,   1021,  88819,\n           367,  72661,    372,    440,  10854,    440,    279,    254,   1538,\n          5067,    879,   4473,    457,  18475,  75156,   2051,    588,    438,\n          7903,    279,    207,     17,     15,     15,     16,    430,    254,\n         12040,   8592,  20699,   1021,    338,   3783,    280,  88819,    367,\n           655,     82,   3791,    279,    429,  30520,    331,   7926,   5734,\n           857,    372,    440,  62046,  85267,    440,    279,    254,   5012,\n          2051,    285,    362,   4503,   7233,   9247,    279,    429,  47856,\n          2051,    285,  49901,  15745,   1021,   1063,   7676,    279,    254,\n         16657,   4077,  23053,   3326,   1987,    271,    279,    207,     17,\n            15,     15,     17,    372,    440,   4294,    370,   7829,  16311,\n           440,    279,    254,  15341,    440,  36953,  47023,  57310,    440,\n          2051,    285,    661,    245,   5012,    372,    245,   1448,   3199,\n           440,  58434,  68984,    440,    331,    429,   9614,   1021,    207,\n           185,   1063,    661,    245,  47198,   5012,    279,    207,     17,\n            15,     15,     18,    331,    984,  26774,    280,    429,   9614,\n          2051,    372,   3199,    440,  74878,  11972,    440,   1021,    685,\n           207,     17,     15,     15,     19,  88819,    367,  23831,    245,\n          5012,    372,    440,  32163,    440,    279,    254,  15341,    440,\n         57034,    655,     82,  18443,    440,    280,    254,  16657,   4077,\n           429,   9055,  37432,   6204,    362,  72661,  16381,  19639,   5231,\n         29820,    285,  53918,  68568,   1021,  88819,    367,  72661,    372,\n           440,  77674,    440,   2051,    279,    254,    207,     17,     15,\n            15,     20,  22624,  41075,    280,    254,  16855,  47812,   2734,\n          1538,  43200,  45799,   1021,    809,    438,   7903,    430,    254,\n         42925,  20699,    279,  47558,   2051,    285,    254,  10889,   1369,\n         38118,  30821,    279,   5922,   1021,   1063,    438,  12977,    457,\n          3326,  76272,    285,  72661,  16381,   6493,   2180,    844,   2268,\n          2051,  64762,   1981,  22551,   2051,  14503,  16530,   2051,  49866,\n         24308,    379,   2051,  54652,  65665,    285,  83822,   9243,   1021,\n         88819,    367,   4503,    245,  26810,   3783,    279,    429,  20151,\n         62011,   1193,    440,    429,  13646,    317,    467,   2501,   7931,\n         17907,   2051,    366,  29048,  20630,    473,   6493,   2180,    844,\n          2268,    334,   1132,    405,  26899,  67551,    473,    586,   3791,\n           372,  60138,    461,   8831,    655,     82,  63063,   2238,   2051,\n          7940,  88819,    367,   2051,  64762,   1981,  22551,    285,  49866,\n         24308,    379,   1021,    440,    429,  37716,  10689,   2051,    440,\n          6493,   2180,    844,   2268,    285,   7940,  88819,    367,   3685,\n         41369,  18872,    254,  81543,   1431,   1021,    440,    207,    185,\n           207,    185,    403,    403,    403,    207,     17,     15,     15,\n            21,    207,    891,   1828,    403,    403,    403,    207,    185,\n           207,    185,    685,    207,     17,     15,     15,     21,  88819,\n           367,  72661,    279,    254,   1538,  50926,   2223,   4473,    457,\n          5231,  43799,  19860,   1021,    429,   1538,    438,    697,    280,\n           245,   4077,    588,  17120,   1448,  86580,     82,   2051,  29241,\n         18354,    893,  31518,   3179,    893,  50926,   2223,   1021,    685,\n           245,    207,     17,     15,     15,     21,   8314,   2051,   7080,\n         14112,   6493,   2180,    844,   2268,  10730,  88819,    367,    372,\n           634,    280,    586,   7078,    980,   1173,     12,     31,   7524,\n          1193,    440,    304,   7130,   2695,    366,    245,  10822,   2424,\n          7940,  88819,    367,   2051,    779,    438,    279,    254,  18038,\n          5634,    280,  18354,   2051,  31518,   3179,    285,  50926,   2223,\n           430,    254,   5562,   1021,   1063,   7222,    601,   6251,    279,\n         43200,  45799,   1021,    440,   1063,  57697,    440,  24168,  39448,\n           440,    331,    254,    207,     17,     15,     15,     21,  15341,\n           280,    254,  16657,   4077,   2051,  58162,   2051,  29241,    440,\n         22494,    304,    338,    454,    440,   1021,  88819,    367,  72661,\n           372,    440,   8660,    440,    279,    254,    207,     17,     15,\n            15,     22,   5909,    280,   1724,    276,  12246,    346,  12977,\n           457,  13905,    522,    433,    416,    400,   1021,   1724,    276,\n         12246,    346,    438,   7903,    430,  21350,  20699,    279,    254,\n          5922,  70963,    280,   6556,  18163,  28496,    285,  40955,   4791,\n          1021,    685,    245,   3783,    280,    254,   5909,    327,    429,\n         20151,  62011,   2051,  22624,  12157,   9952,  38960,  10689,   2051,\n           440,   7940,  88819,    367,  10941,    245,  23005,  43680,    276,\n           254,   6351,    372,   8660,   1021,    440,    207,    185,  88819,\n           367,  72661,    279,    984,  15687,    279,    207,     17,     15,\n            15,     23,   2051,   6617,   3205,   4867,  33935,    457,  73540,\n          8913,   2673,    864,     72,   2051,    285,   4946,   2458,  61720,\n         12977,    457,   8562,    326,  95725,   1021,  88819,    367,  57697,\n           245,   3199,   7046,    440,  36141,    440,    279,   4946,   2458,\n         61720,   2051,    779,  15983,   2726,    366,   3199,    440,  22577,\n           440,    372,    254,    440,   7257,   6251,   3564,    779,  16365,\n           359,    842,    366,    323,   9241,     72,    440,   1021,  88819,\n           367,  11477,  72661,    331,    245,    984,   1173,     12,     31,\n           697,  15341,  10621,    440,    423,   5745,    440,    279,   3638,\n           207,     17,     15,     15,     23,    280,    254,  16657,   4077,\n           423,   1379,    254,  20241,    372,   3199,    440,  29254,   1987,\n          5783,    440,   1021,   1063,   7676,    331,    254,  16657,   4077,\n         79684,    715,    372,    440,  37747,    440,    279,   7953,    207,\n            17,     15,     15,     23,   1021,   1063,    661,    245,  47198,\n          5012,    279,   2146,  26774,    280,    254,  16657,   4077,  73370,\n          1000,    279,    207,     17,     15,     16,     15,   2051,    372,\n           440,    721,  94016,  53980,    440,   1021,   1063,  57697,    274,\n         13922,  22429,  12397,    327,    245,   6997,  40799,   1021,   1063,\n         26693,    331,    254,  23250,  17473,    279,  31237,    272,    245,\n         22429,    331,  16657,   1193,    440,  55047,    245,   7601,    317,\n           245,   8387,   2784,   1021,  52943,   3116,    340,   1006,    856,\n           340,    655,    248,   6807,    786,    754,    340,   1113,    655,\n            83,    317,   1079,  51245,    548,    745,    418,  66987,    331,\n           845,    779,    418,  12486,    430,   3950,    340,   1184,  14240,\n           285,   5749,    340,    254,   9568,    276,   2039,    745,    285,\n          1068,    837,    340,   1006,    856,    340,    655,    248,   3217,\n          1021,    440,  88819,    367,  72661,    279,    254,    207,     17,\n            15,     16,     16,   6131,  19611,    255,   4940,  12977,    457,\n          8913,   2673,    864,     72,   1021,    207,    185,    207,    185,\n           403,    403,  19034,   7021,    403,    403,    207,    185,    207,\n           185,    207,    185,    403,    403,    403,  19034,    403,    403,\n           403,    207,    185,    207,    185,    207,    185,    403,    403,\n           403,  44336,    403,    403,    403,    207,    185,    207,    185,\n           207,    185,    403,    403,    403,  20699,    403,    403,    403,\n           207,    185,    207,    185,    207,    185,    207,    185,    403,\n          9497,  39088,    403,    207,    185,    207,    185,   9497,  39088,\n           334,  53578,    207,    891,  71708,   1193,  25404,  39088,   6204,\n         10112,   1193,    207,  17141,  65577,   6204,    207,     22,     16,\n            17,    207,    891,    207,     22,     22,     15,   2238,    438,\n           245,  19606,  10112,   9816,    280,    254,  43874,  63046,   1021,\n         29051,    366,  13298,  89189,    334,  13298,   8081,   2238,   2051,\n           362,    317,  10344,   2424,    254,   9846,    280,    254,  10112,\n         34512,   1021,   3848,   9846,  30043,    438,    276,   5043,    586,\n          3085,    372,    245,   6956,   7377,  18448,   2051,    548,    362,\n         10340,   9892,    276,   1099,    254,   4374,  43677,   1021,   3848,\n          1728,   2051,    837,    254,   3000,   3085,   2051,    438,  76737,\n           457,    254,   1640,    413,   2181,    261,   1926,  77592,    280,\n           207,     22,     20,     20,   2051,    285,    586,   1562,    207,\n            16,     20,   1555,    778,    245,    766,    280,   3308,   4081,\n         60001,   1021,    207,    185,   9495,  15920,    362,    438,   1585,\n          1173,     12,     31,   3185,    276,    750,  14778,   2051,    586,\n          2722,   2373,    276,    330,  54807,  35812,    279,   1572,  10112,\n           285,  13727,  19580,   8814,   1021,   4947,    586,  42643,   4456,\n          2051,   6128,  20378,   5197,  27494,    463,    803,  20778,    855,\n           254,  13205,   1021,   1063,    643,    803,   2424,    254,    440,\n         63689,   1173,     12,     31,   6944,  41175,    440,    285,    254,\n           440,  63689,   1173,     12,     31,  51688,    440,    457,  10112,\n         32123,   2051,   1477,    254,   3169,    280,    586,    830,    643,\n          5987,    857,    276,    330,   8131,    276,  12732,  11726,    372,\n           440,    254,  10112,  75368,   2051,  48103,   2051,  97790,   2051,\n         23768,   2051,  33968,   2051,  42706,   2051,  73970,   2051,    380,\n           587,     81,   4402,   2051,  44187,    410,  80604,    282,   9832,\n           440,   1021,    207,    185,    207,    185,    403,    403,   8598,\n           403,    403,    207,    185,    207,    185,  46238,  10112,  19580,\n         23510,  44939,    254,   1728,    280,    254,   3855,    754,  55242,\n           245,    830,   2051,    245,   5561,    588,  45261,  31699,  12235,\n           276,    440,    254,   3415,   7841,    344,   8046,  10112,   2215,\n           989,   1046,   1439,   2460,    285,  40974,    440,   1021,   5512,\n          1313,    280,   9497,  39088,    655,     82,  27494,   4169,  40974,\n           285,   4345,   2051,    437,   5561,    317,   7282,   2375,   1021,\n         11727,   2806,   2051,  10730,    457,    254,  10112,  42962,   8660,\n         27280,   2051,    317,    344,  10112,  27494,    418,   9184,  46019,\n          2051,  78165,   3733,    344,   1667,    330,   7683,   2051,    548,\n           588,    274,  13218,  15813,   1027,    330,  11636,    276,   1006,\n          1021,   1494,   4959,  12732,  11726,   2051,    440,    429,   2246,\n         21541,    395,   1006,    254,    766,   2051,    254,   1810,    285,\n           254,   9930,    279,    254,   4140,   2051,    254,    691,  26990,\n           395,    418,    276,  10743,    359,  41176,   2051,    285,    254,\n          1230,    543,    330,    344,    395,   2818,  73161,    254,  20002,\n           410,   4571,    276,   2579,    359,  16369,    440,   1021,  18232,\n         37580,  11615,    245,   4443,   6088,   2590,    276,   9497,  39088,\n          2051,  41021,    344,    254,   6265,    280,    254,   9816,    655,\n            82,    830,   3430,  12314,    280,    586,   3000,   1728,   2051,\n          3272,    853,    254,    440,    298,  77214,    440,  27861,   7823,\n          1222,    327,    691,   6415,  34512,   1021,    207,    185,    207,\n           185,    403,    403,    403,  22020,   1555,    403,    403,    403,\n           207,    185,    207,    185,   7188,    280,    856,    317,   3185,\n           280,   9497,  39088,    655,     82,   1728,   3450,    473,    586,\n         27494,   1021,   3848,  72164,  28401,    438,   9497,  46992,  12598,\n          2051,    245,  10689,  46761,    285,   9816,   2320,    254,  20893,\n           280,  77980,  35098,   1021,   9497,  39088,    438,   7722,    279,\n           207,     22,     16,     17,   6204,    254,   3508,  89782,    317,\n          9255,   2051,   5085,    344,    359,    438,   3345,   9193,   1145,\n           673,   2051,   8088,    261,  21834,    334,  95530,  14147,    317,\n           245,  14860,  12088,   2238,   1021,    685,   3470,   1728,   2051,\n           362,   4828,   3177,    276,   6893,    276,    254,   6077,   3787,\n           280,  45870,    655,    261,   2051,  68563,  53983,    280,    254,\n          9497,   2617,   1021,    207,    185,   9497,  39088,    655,     82,\n          4143,   7648,  19420,   1166,    362,    438,   7722,   2051,    285,\n           362,    438,  19161,   8473,    457,    586,  23577,   1021,   1063,\n           661,    274,  18418,   6251,   2051,    779,   7648,   2823,   1021,\n          1063,    839,    661,   1853,   3222,  18062,    285,    634,   3222,\n          9233,   2051,    276,   4989,    362,  10344,  13434,    279,    586,\n         27494,   2051,   5802,    362,   1866,  29676,    586,   3458,  14294,\n          1021,    207,    185,    429,   4278,    280,    245,  10398,  17492,\n          1173,     12,     31,   6269,   2051,    586,   8859,    438,   7133,\n           331,    254,   4182,   6090,    280,    245,   3680,   7377,  18448,\n          1193,   3437,    285,  31177,   8210,    280,    254,   8698,   1240,\n           997,  49394,    280,  17293,   2051,   4345,    285,  18210,   1021,\n          1063,   3470,  16583,    276,    463,   7338,   4525,   5274,  27494,\n           457,    586,   3923,  34395,   2051,    548,   1069,    463,    803,\n          4739,   1021,    207,    185,    685,    254,   3923,    207,     22,\n            18,     15,     82,   2051,    362,  34473,    279,    254,  70727,\n          4634,    893,   1981,    247,  60150,   3046,   6204,    586,  23214,\n         43446,  20002,   2051,  16934,    245,  18210,  16252,   2051,    317,\n          2215,    276,   4290,    473,    254,   1225,    280,    437,   3463,\n          2051,   1983,    207,     22,     18,     20,   1021,    685,    344,\n          1012,   2051,    362,   3061,    254,   7377,   2418,   3799,   2051,\n          4135,    279,  45870,    655,    261,   1021,   1063,   5985,   2051,\n           276,    586,  10782,    285,    344,    280,  20580,    280,   3470,\n         32123,   1021,  27280,  37280,    344,    362,   3748,   5985,   1373,\n           586,  39375,   3398,    430,    254,    766,    438,   1653,  17777,\n           285,  32826,   2051,   1477,    908,    264,  11615,    586,   9123,\n           276,  52237,  10609,    279,    254,   6077,    975,    463,    803,\n           276,  18449,   1021,   4128,    437,   9123,   2051,    362,   2674,\n          1062,    276,  19097,   2051,    437,    766,   1983,   1783,    384,\n           596,    285,   1063,   1342,     72,   1021,    207,    185,   3848,\n          4209,   7648,   1983,    207,     22,     19,     15,   1021,   9497,\n         39088,    744,    463,    803,   5987,    276,   5223,    254,   7377,\n          2418,   1373,    280,    586,   4209,    655,     82,   7052,   2051,\n           548,    362,    317,   2215,    276,    463,   2028,    581,    254,\n         23550,    279,   9000,    280,    634,    280,    586,   3222,  18062,\n          1021,   1063,   7133,    254,   2112,   2685,   1555,   4731,    279,\n           254,   9193,   1145,    673,   3046,   2051,  43555,    586,  16611,\n           279,  13535,  15726,   1021,    207,    185,    685,    254,  25731,\n           280,    207,     22,     19,     19,   2051,    362,   2011,  13298,\n         89189,    334,  13298,   8081,   2238,    327,    254,   1022,    766,\n          2051,    285,    254,    984,  34512,   9163,    245,  19422,   1021,\n          7128,  13291,  12997,    437,    372,    440,    254,   1094,   4485,\n          1020,   1251,   3699,    279,   9497,  39088,    655,     82,  23357,\n          4205,    440,   1373,    359,   4366,    857,    245,   4731,   2203,\n           280,    254,    298,   9256,   9816,   1173,     12,     31,  17492,\n          1728,    276,    588,    362,    438,  23786,   1166,    586,   9123,\n           279,    254,   7377,   2418,   3799,   1021,    429,   5306,    438,\n          8997,    634,   1173,     12,     31,  68344,   2051,   3111,   1021,\n          9497,  39088,    438,    457,    742,   1555,    254,  14000,   2051,\n          1477,  13298,  89189,    438,   2571,    245,  42643,   5395,   1021,\n          1003,    463,  15367,  27494,    276,    410,    786,  13298,  89189,\n           473,    254,  14000,   9816,   2051,    548,    889,    634,    279,\n           254,    750,   5489,   1021,   1955,   2011,   1310,    889,   2561,\n          2051,    279,    207,     22,     19,     20,   1021,    207,    185,\n           685,    207,     22,     19,     21,   2051,    362,   6937,    276,\n           254,   6077,    279,    274,   4788,    276,  84903,    586,   6269,\n          7337,   1021,   1063,   3061,    254,   7377,   2418,   3799,    245,\n          1864,    766,   2320,    254,   1893,   1012,   2051,    548,    521,\n           254,  13139,    778,   5985,    457,    254,   9966,  14704,    334,\n         12403,    279,   1835,    276,   5120,    254,  46085,    280,   2198,\n         35835,   2238,   1021,   1063,   1866,   1310,  17942,    254,  56997,\n          2051,   3615,  24057,    272,    254,  36756,   4723,    279,    207,\n            22,     20,     16,   2051,    207,     22,     20,     19,    285,\n          3748,   1310,    279,    207,     22,     20,     20,   1021,   1063,\n          9552,   1983,    207,     22,     20,     17,   2051,    285,    457,\n           207,     22,     20,     22,    254,   5457,    661,    661,   4047,\n          3022,    207,   1972,   1853,  16512,    285,    984,  23066,    207,\n          1972,    548,    634,    280,    254,  16512,   7648,    279,  61543,\n           279,    207,     22,     20,     20,   1021,   4810,    207,     22,\n            20,     19,    362,   4732,    276,    463,  23410,   4194,    334,\n          3748,  51124,   2238,   2051,    254,   1022,    280,    245,   4077,\n           280,  78066,    588,  83050,    857,    327,    254,   1610,    280,\n           586,   1728,   1021,    809,    438,    279,    344,   1012,    344,\n          9497,  39088,    438,  10599,    276,   2938,    586,   2617,   3266,\n           276,    254,  67034,    280,    245,  61571,   4832,    786,    457,\n         11542,  55296,    279,    254,   4928,   1021,    207,    185,    685,\n           207,     22,     20,     20,   2051,    362,   4503,    274,  14988,\n           372,  87571,    280,    254,  12975,  13803,    401,    655,     82,\n          4995,    280,    254,  27231,  13445,    655,     82,  27646,   1021,\n          9495,    437,    438,    245,  10398,   1767,   2051,    279,   4057,\n          2602,    359,    744,    463,    803,    430,   2754,    254,   1330,\n           280,    274,   6269,   7337,   1021,   6809,   1323,    362,    661,\n         17070,    830,   2051,   3111,   2051,    254,   3299,    438,  24671,\n          2302,    457,   4378,   1021,    207,    185,    207,    185,    403,\n           403,    403,   6368,    403,    403,    403,    207,    185,    207,\n           185,    429,   1640,    413,   2181,    261,   1926,  77592,   4732,\n           279,   7983,    207,     22,     20,     20,   2051,    285,    438,\n           441,   5522,  30031,    327,   3308,   6524,   1555,   1021,    809,\n          7629,  20020,  46123,    276,  10112,   8213,   1193,    254,  44235,\n           280,    207,     22,     20,     19,  12790,    207,     20,     17,\n          1173,     13,     31,    207,     24,   4875,   1245,   2051,    548,\n          2146,   1555,   3470,   2051,    254,  44235,  25696,    953,    207,\n            16,     21,   1173,     13,     31,    207,     24,   4875,   2051,\n           254,  22821,   2497,    803,  51840,    410,   9571,   1021,  11399,\n           437,    766,   2051,   9497,  39088,   5426,    245,  15052,  40521,\n           401,   1728,  96632,    457,  27770,   2051,   5329,   1464,   1451,\n           285,  27526,  74340,   1021,   1002,   3463,    280,    405,  48094,\n           438,    254,   2883,    280,   9497,  39088,    372,    245,   9816,\n          1193,   6809,  31846,    908,    264,    643,   4473,    344,   2051,\n           440,   2461,    362,   3505,   1983,    857,    207,   1972,    254,\n          6110,    280,    586,   2617,   2051,  18792,   2051,    285,  28163,\n           207,    891,    856,    362,   4101,   2051,    285,    856,    362,\n         18936,    327,    410,  26619,    473,    254,   5635,    280,   3947,\n         23745,    207,   1972,   1069,   5322,    254,  48361,  20667,    280,\n           586,  18210,    440,   1021,   6809,    754,    362,   7213,    280,\n           254,   4349,    280,    586,  33596,   1867,   2051,    362,   4540,\n           276,    254,  14079,    280,   3072,    279,    586,  18210,   3615,\n           280,  31159,   2065,    586,   1377,  73459,   1021,   9497,  39088,\n          7048,   1193,    207,    185,   5835,   6364,    331,    856,    304,\n           463,   8663,   1184,   2051,    565,   1236,    304,   1006,   1108,\n         14079,   2051,    254,   3064,    668,   1534,  13946,    330,  84342,\n           457,    254,  21670,   1021,    207,    185,    685,    207,     22,\n            20,     21,   2051,  23287,   1444,   9603,     89,    596,    438,\n         10599,    276,  31721,    254,   6077,    285,    547,     67,   8972,\n          1021,   9497,  39088,   2051,    779,    661,    803,   2302,    473,\n           254,   3787,   2051,   3061,    586,   2617,    276,    245,   1810,\n           280,   6923,    285,  17942,    276,   6417,    254,   6518,    280,\n           254,    761,  36756,    334,  33698,    596,   2238,   2051,    548,\n           362,    438,  16441,    457,    254,  33605,    285,   3443,    276,\n         45870,    655,    261,   1021,    685,    254,  25731,   2051,    586,\n         33596,   4278,   2051,   9497,   1981,    596,  52785,    334,  23194,\n         25232,   2238,   2051,    438,   7722,   1021,  37332,    437,    766,\n          9497,  39088,    317,   2215,    276,    463,  38349,  71546,   1021,\n           207,    185,   1063,  21327,    473,  45870,    655,    261,    254,\n          1893,   1012,   2051,    285,    438,  15572,   5666,   7326,    754,\n           362,  51285,    254,   6518,    279,   3638,    207,     22,     20,\n            22,   1021,   1002,   1767,   4366,   2462,    276,    254,  36756,\n           548,    438,  15052,  80626,   1021,   9497,  39088,    655,     82,\n         73864,   1465,  25380,    857,    276,   1682,    276,   1099,    938,\n           280,    359,   1193,    362,   7629,   8168,    327,   3177,    457,\n         80507,    254,  15613,    280,    586,   2138,    285,  24793,  84700,\n          2891,    261,    331,    245,  47134,   5361,   1021,   1063,    438,\n         19752,    548,    438,  25880,    271,    279,   6564,   1021,   1063,\n           438,  14807,   4283,    276,   3230,    586,   2617,    279,   7564,\n          2051,    548,    362,   3444,  51285,    254,   6518,    285,    331,\n          7983,    207,     23,   2051,    207,     22,     20,     22,   2051,\n           362,   5651,    276,  45870,    655,    261,    366,    254,  36756,\n          1893,    895,    991,  20977,    457,   4403,   8271,   1021,   3159,\n          2051,    586,   7402,   7091,    276,    330,    405,  58765,    616,\n          2051,    285,    279,    254,   6237,    280,    207,     22,     20,\n            23,    362,    438,   7134,   6148,    276,    245,   1767,    372,\n         36521,    280,  11375,    279,  23933,   1758,  18863,   1021,    429,\n          3299,    438,    441,    276,    586,   9455,   1193,    279,    634,\n         20002,   2051,    362,   7048,   1193,    207,    185,    304,    608,\n           786,    276,  20260,  89691,    279,    254,   4995,    893,  30954,\n           754,    657,   3792,    691,  10142,    276,  23428,   3872,    331,\n           601,  15053,   1021,    207,    185,   1063,   6937,    331,    279,\n           254,   6237,    280,    207,     22,     20,     24,   6204,    437,\n           643,  38470,    803,  67908,    276,  61571,   2051,    548,  27280,\n         17947,    344,  37357,    317,    245,    691,   4135,   2806,   1021,\n          1063,   2112,   7133,   1983,   4484,   5752,    279,   1551,    246,\n         46454,    334,   1132,    323,   3752,     71,   3970,   2051,    452,\n           533,     84,  21834,   2238,   2051,   1066,    362,   7048,    691,\n           853,  26371,  27494,   1021,    207,    185,    207,    185,    403,\n           403,    403,  69838,    678,    403,    403,    403,    207,    185,\n           207,    185,    685,   7983,    207,     22,     20,     24,   2051,\n           362,  20358,  17552,    279,  75311,   3441,    334,   4959,    452,\n           533,     84,   2238,   1021,   1063,  31334,    331,   7983,    207,\n            17,     19,    327,  69838,    678,    334,    324,    514,   9603,\n         21834,   2238,   2051,   1066,    362,    438,  20315,    457,   2301,\n         64673,    285,   7080,   9816,   4792,     72,   8106,   1021,   9497,\n         23829,   2853,   3177,    279,    324,    514,   9603,    327,   1094,\n           280,    254,   2112,   4047,   1555,   1021,   3563,    254,  25731,\n           280,    344,   1012,    362,    438,    279,   6335,   8168,   2051,\n           285,   2143,  27494,  50740,   1345,    276,   3947,  58615,   1021,\n          1063,    438,  32256,    457,  26319,  35098,   2051,    245,   2138,\n           285,   5676,  37461,    779,    438,  15572,  20820,   2401,    430,\n         69838,    678,   1021,  22081,    586,   6335,   4194,   2051,    437,\n           438,    634,    280,    254,  61223,    285,   1094,  24177,  16021,\n           280,    586,   1728,   1021,   8410,    280,   9497,    655,     82,\n         27494,    473,    437,   3463,    418,  24177,   5502,  27258,    280,\n           586,   1728,    430,    440,    344,   2910,  34323,    440,   1021,\n           685,    207,     22,     21,     17,   2051,    362,   2116,    254,\n          3787,    276,  10778,    245,  43248,   2051,    548,    362,   5651,\n           279,   6237,    207,     22,     21,     19,    754,    362,    438,\n         15572,    274,  37515,    276,  26319,   2051,    779,    438,   6591,\n           279,  23745,   2481,    254,  78456,  22490,   1021,    207,    185,\n           207,    185,    403,    403,    403,  11354,   1555,    403,    403,\n           403,    207,    185,    207,    185,   9193,   1145,    673,   2051,\n           254,   4928,    280,    586,  89782,   2051,    438,  19586,    457,\n          4403,   8271,    279,    254,   8678,    280,    207,     22,     21,\n            17,   2051,    285,    279,    254,   8079,    280,    207,     22,\n            21,     20,   9497,  39088,    285,    586,   2617,  33997,   1224,\n           254,  33177,     83,   3337,   2051,  12403,    366,    254,  14308,\n           280,   2883,    704,   1143,    745,   1021,   1955,  32339,   9405,\n          2051,   4586,    581,    457,    586,   3730,   1173,     12,     31,\n          2802,    334,    457,    437,    766,    362,    438,  14079,    473,\n          4922,  97585,   2051,  36764,   1465,    285,   2401,   1712,   4500,\n           279,   4317,    276,    586,   3590,  78066,   2238,   1021,   1955,\n         17552,    279,  33637,    531,  18863,    334,    279,    856,    317,\n          1132,  14186,    305,  10859,    950,   2051,    908,    596,     80,\n           272,   2238,    430,    254,  15157,    276,    254,  14863,  73740,\n           257,    327,   3308,    984,   1555,    473,   5189,   8079,    207,\n            22,     21,     21,   1021,   1002,   3463,    438,   9497,  39088,\n           655,     82,   1562,   1228,  42643,  63430,   2051,    285,   1285,\n           362,   7048,    207,     19,     15,     15,  27494,    279,    586,\n         17777,   2051,   5189,   3398,   1021,    685,  25731,    207,     22,\n            21,     21,   2051,   4307,   6655,  35701,   5322,  20820,    280,\n           254,   4928,   1193,    362,   6879,   9497,  39088,  40737,    285,\n         12340,    857,    372,    586,  75983,  26234,   1021,    207,    185,\n           685,   6175,    207,     22,     21,     23,   2051,    362,   4732,\n           586,   8398,   1310,    285,   2149,    372,   2367,    372,  38721,\n           261,  21834,   2051,   1066,    362,   7648,    279,  14631,  46454,\n           334,   1132,  45870,  20102,   2238,    279,   7953,    410,   7983,\n           207,     22,     22,     15,   2051,    279,    586,    207,     20,\n            23,    393,   1012,   1021,   1063,    438,  29109,    457,    586,\n          5391,    285,    984,  16512,   2051,    779,  10471,    279,    254,\n          3046,    327,    742,   1555,    430,   2754,   1021,   3848,   1562,\n          3185,  66040,    317,    245,  52674,    779,  13136,    245,  16223,\n         54181,    327,    254,   9816,    473,  68877,   1981,   1104,    279,\n           207,     23,     16,     18,   1021,    207,    185,  27280,  15162,\n          4095,    586,   1728,    457,  53006,    344,   2051,    440,   1063,\n          7676,    276,    330,    245,  68447,   4278,   2051,    274,  47112,\n          4209,   2051,    245,  19129,   6251,   2051,    245,  19558,   6964,\n          2051,    245,  17732,   2138,   2051,    245,   6766,   3468,   6269,\n          2051,    285,    245,  57319,   3605,   1021,    440,    207,    185,\n         24275,    317,    274,   2203,    280,    634,    280,   9497,  39088,\n           655,     82,   3470,   2722,   2051,   2158,   2682,  10168,   1594,\n         14862,  61792,    334,  10112,   1193,    207,    808,    217,    741,\n           236,   6869,   2628,    230,   4781,   2238,   1021,   9532,   1313,\n           750,  27494,    279,    254,  43874,    359,  17120,    254,   9665,\n           280,    245,   1234,  44749,   1439,   3997,   2051,    588,    438,\n          2752,   3266,    276,  13690,   1435,  10344,  20540,    276,    254,\n         35455,   1193,    207,    185,    207,    185,    403,    403,  15571,\n           403,    403,    207,    185,    207,    185,  22025,  40329,    280,\n          9497,  39088,    655,     82,   2722,    643,  11554,    331,    586,\n          2955,   3078,    280,   4345,   2051,    586,  12481,  16138,   2051,\n           285,    586,   9388,  25927,   1021,    207,    185,    207,    185,\n           403,    403,    403,  11380,    403,    403,    403,    207,    185,\n           207,    185,   5512,    254,  18716,  63046,   2051,  32123,    463,\n          2424,   9497,  39088,    254,    440,   9816,  42962,    440,    334,\n           207,  29703,    102,   6030,    467,  24320,    467,    129,    225,\n          2238,   1021,    429,   1094,   4723,  13092,    280,    586,  27494,\n           418,   1462,  42813,    331,   8931,  32513,    410,    254,  43664,\n           285,  28715,    280,    254,   4403,   2051,    410,    254,  27494,\n           280,   7402,    588,    362,   7048,    276,    254,  36756,   1021,\n          2334,   1300,    326,   2051,    362,   7048,    786,    254,   1941,\n           280,    254,   2602,    279,    588,    362,   8663,    331,   3177,\n          2051,    285,    331,    254,  12224,   1245,    280,   7812,   1021,\n          1733,  31699,   9267,   2051,    437,    317,   1757,    440,    280,\n           245,   2447,  24496,   1503,    279,    254,  22881,  23289,  46549,\n           280,    254,   2906,    440,   1021,    207,    185,   9497,  39088,\n           655,     82,   7083,   6792,    418,   2853,    331,  17171,   3272,\n           853,  13998,   1193,    586,  63851,    463,    803,  56498,     81,\n          1334,    372,   2051,    440,   3960,    450,    521,    330,   2246,\n         29527,   2051,   1632,    450,    521,    536,    856,    395,    418,\n          8548,    276,    536,    440,   1021,   5512,    586,   8208,    778,\n          8627,    276,  25005,    366,   2051,    586,   5206,   3200,  10372,\n         90020,  10014,   9120,    586,   7103,    372,    254,   6327,   5617,\n           280,  10112,  42643,   4345,   1021,    207,    185,    207,    185,\n           403,    403,    403,  78469,  16138,    403,    403,    403,    207,\n           185,    207,    185,    338,   1864,  14860,  37590,  15456,    280,\n         10112,  32123,    317,    344,    280,    440,   9816,  47257,    440,\n           334,    207,  29703,    102,   1777,    231,    467,  24320,    467,\n           724,    950,   2238,   2051,    245,  36704,    276,    254,  40089,\n         47257,   2051,   8698,  93499,   1021,   3474,    280,    254,  23214,\n         43446,   2722,   2051,    429,  18716,    280,    254,  32857,    879,\n           334,    473,   1983,    207,     22,     20,     15,   2238,   2051,\n          4380,   5136,    276,    254,  50070,    280,    245,    365,   2663,\n         18325,    279,    254,  27526,  10053,    285,    245,   3662,   1173,\n            12,     31,  89254,  22800,    280,  14079,   1021,   3410,  11820,\n           418,  22511,  88579,    279,  27494,    331,    254,   6110,    280,\n          1572,  13474,    285,  52641,   7338,    457,   9497,  39088,   5923,\n           586,   1728,   1021,    207,    185,   9495,   9497,  39088,    655,\n            82,  16601,  13531,    276,    586,   1377,  17473,    481,   2102,\n           254,  14164,    280,    274,    521,   1173,     12,     31,  30366,\n          1197,   2744,   2001,   2051,  12480,   9673,  42347,    344,    586,\n           440,   9679,  24968,    279,   1714,   5312,   3177,   2051,  16316,\n          3148,  98572,    285,   3308,    372,    274,   1166,  15418,    440,\n          1021,   1063,   4573,    440,  66667,  54810,    440,    276,    254,\n         19738,   5743,    457,  19037,    359,    276,    440,    586,   1377,\n          7860,  86723,  17197,    465,    440,   1021,    207,    185,   9497,\n         39088,    655,     82,  24968,   2051,    327,   3177,    285,    327,\n          3072,   2051,    438,    697,    280,    586,   2401,  64114,    280,\n           254,   8225,    280,  18210,   1193,    362,  17633,   1313,   2722,\n           276,  13631,    588,    661,   8524,    803,   4828,  86186,    327,\n         42643,   6036,   1021,  40814,    568,    522,   7048,    344,    327,\n          9497,  39088,   2051,    440,   3694,    279,    437,   1843,    317,\n         18210,    440,   2051,   9497,   7048,  31412,    331,  13388,   1108,\n           372,  13535,   1728,   2051,   1282,  95419,   2051,  27003,   2051,\n          8466,   2051,    285,    750,  27494,   1021,    207,    185,    207,\n           185,    403,    403,    403,  29694,  25927,    403,    403,    403,\n           207,    185,    207,    185,   9497,  39088,    655,     82,    830,\n           317,  20307,   2330,    521,    327,    895,   3169,   1021,  10112,\n         32123,  38470,   1222,    254,   1639,    207,   3771,    748,   1114,\n           334,    523,    656,     67,    676,    358,    587,    950,     12,\n           440,   3938,   4300,  28195,    440,   2238,   2051,    245,   5480,\n           276,    364,    901,   2691,    655,   6411,    280,   8698,  93499,\n          1021,  68877,   1981,   1104,    438,    254,   1022,    276,   4347,\n           254,  40646,    280,   9497,  39088,    655,     82,  24071,   2051,\n          4456,    279,    207,     23,     16,     18,    344,    586,  41529,\n          2051,    440,  24394,    279,    586,    830,  31081,    588,   3590,\n          1743,    661,  12293,    889,  91366,    440,   1021,   1063,  59407,\n           521,    254,   6813,    280,  10112,  18210,   1193,    908,    264,\n          2970,    344,    279,   1131,   1020,    362,    440,   2818,   1401,\n         17387,  28292,    410,  21822,  17387,   6987,    440,   1021,  14361,\n          2051,    586,  27494,    938,    245,   5505,   3169,    280,  28355,\n          2051,    473,    254,   1713,    285,  61512,    276,    254,    521,\n         24459,    285,   1791,   1173,     12,     31,  65651,  19580,   1021,\n          1002,   6265,    317,  50728,   1236,   2383,   3451,   2722,   1193,\n         37580,  33697,    254,   2051,    440,   8195,  92687,    285,  92111,\n         26281,    440,    279,  27494,    588,   7774,    254,   9816,    276,\n          2564,   1448,  57255,    280,    245,   5437,   2051,   1477,    908,\n           264,   5131,    254,   1639,    440,  89347,    700,    440,    372,\n           254,   3144,  25855,   5278,    279,    711,    830,   1021,   9497,\n         39088,    317,  10689,    327,   2497,   4473,    691,    331,   9816,\n           964,    285,  14445,    853,    688,    750,   9579,    280,    586,\n           766,   1021,   1063,   7048,  33852,  27494,    331,  14445,   5254,\n          2051,    691,    853,    688,    750,  43874,   9816,   1021,   9497,\n         39088,    655,     82,  24926,   6640,  37856,    331,    254,  78513,\n          7569,  27003,    280,  20156,  61682,   5895,   1536,    245,  35350,\n           344,    643,  43650,    276,    254,   1828,   1492,   1021,    207,\n           185,    429,  50112,    280,    586,    830,   5464,    372,    362,\n          6907,    586,   3398,    285,  21606,    276,    586,  29143,    334,\n           440,    496,    471,  70634,   1173,     12,     31,    837,    440,\n          4299,    276,  31699,   2238,   1193,    586,  23214,   2722,    418,\n           279,    245,  10291,  19533,   2051,   6518,    326,   3398,   2051,\n           548,    362,   2373,    881,    586,   1377,    279,    254,   1555,\n           280,    254,  43248,   1021,  37580,   6792,    331,    254,    440,\n         28034,  17961,    440,    280,    254,   1551,    246,  46454,  27494,\n          2051,    588,  34443,    254,  14231,  15099,   6204,    254,   2722,\n           473,    586,  69838,    678,   3463,    418,    440,   2156,   2051,\n          2752,  40962,   6195,    440,   6204,   1477,    254,  27494,    473,\n           254,   5189,  33637,    531,  18863,   3463,    463,    245,    440,\n          6422,    285,   1823,    280,  10046,    440,   1021,    207,    185,\n          9495,    362,   7048,    279,    521,  42643,   6813,   2051,   9497,\n         39088,    317,   1608,   3185,    327,    586,    284,    129,    237,\n         51650,   2051,    245,   1449,    280,  20002,    366,   8881,  11612,\n           331,   1020,    285,   3093,   2051,    327,   2203,   1193,    207,\n           185,  13000,    984,  91030,    280,   9497,  39088,    655,     82,\n           207,     16,     20,     15,     15,  85797,   2722,    418,    279,\n           437,   1020,   2051,    285,    362,    317,   6051,   4828,    276,\n           330,    895,   5881,  29511,   1021,   3848,   1608,    284,    129,\n           237,  51650,    938,    254,   9304,  10014,   3430,    457,    254,\n          1020,    276,    962,  46130,   3093,   3272,    853,    372,  12596,\n          9388,  19247,   1021,  12480,   9673,   6792,    344,   2051,    440,\n           359,    317,   6971,    344,  25404,  39088,    317,   2249,    276,\n           938,    558,  51437,  49903,   1614,    245,   1020,    279,    558,\n          3892,    245,   6166,    440,   1021,    207,    185,    207,    185,\n           403,    403,  82333,    403,    403,    207,    185,    207,    185,\n         10068,    276,    254,  33308,    425,  21710,  12485,  63945,   1170,\n          2051,   9497,  39088,    655,     82,  32184,    418,   4828,    457,\n          1313,  19580,  32123,    276,    330,   3264,    254,   9846,    280,\n           521,    766,   2051,    285,    359,   4605,    440,    586,  17777,\n          2051,  29640,   4706,   3190,    938,    280,    521,    254,    365,\n          1265,   1251,    855,  55491,    280,    245,   8071,    285,    280,\n           521,    254,   1098,    249,   1625,  32825,    280,    254,   3451,\n          1734,   2051,  19195,    344,    642,  13858,    481,   2647,  17547,\n          1021,    440,    207,    185,    685,    586,  17476,    285,   6163,\n          1893,    586,   4349,   2051,   9497,  39088,    438,    441,  11246,\n         14168,   1021,    685,    697,    437,    481,    330,  26791,    276,\n           586,  92687,    285,   8970,  41216,   2051,    742,    280,    588,\n           418,   1592,    440,   4828,   7999,  35010,    285,  51245,    457,\n         10112,  32123,   1021,    440,   2071,    418,   1860,  15813,  13531,\n           276,    857,    207,   1972,    889,  26566,  27494,    473,   4484,\n         14778,    207,   1972,    285,   1069,   7183,    857,    279,   3769,\n           280,  17802,   2051,    548,    441,    372,    245,   1112,   5995,\n           280,  42643,    410,  12481,  33524,   1021,   9497,  39088,    317,\n           839,  28830,  11096,    279,  15813,  33872,   8255,    280,  18210,\n          1021,    207,    185,   3159,   2051,    372,  27280,   9267,   2051,\n           362,    440,    317,    254,    889,  10112,   9816,   4318,   7927,\n         10318,    366,    766,    440,   2051,    285,    586,   2722,   4732,\n           276,   4686,    279,  23270,    279,    254,  43867,   8295,   1021,\n         22020,   4864,   6792,   2373,    473,  89189,    568,  13717,     72,\n          2051,    779,  40408,    254,  12481,  32125,    280,    742,    280,\n          9497,  39088,    655,     82,   2722,    334,   5802,    362,   1503,\n          1069,    279,    889,    245,   1760,  12044,    280,    254,  27494,\n          2238,   2051,    285,    473,  20156,  40052,   2051,    779,   7048,\n           245,   5836,  36720,   9497,  39088,    285,  13298,  89189,    331,\n         29747,  18047,    473,  13195,   1401,   2481,    768,   1021,   9848,\n          1069,  14778,   7363,    254,   7927,    280,   9497,  39088,    279,\n           704,   1377,  42643,    830,   1021,   3563,    254,   6278,    280,\n           254,    207,     16,     15,    393,   8295,   2051,  61792,  68687,\n           673,  13475,    254,   1022,  27730,    280,    586,    344,   2910,\n         25341,    279,    324,    514,   9603,   1021,    207,    185,    809,\n           438,    279,    254,    207,     16,     16,    393,   8295,   2051,\n          2320,    254,  17506,  18716,   2906,    344,   9497,  39088,    655,\n            82,  14947,   6889,    895,  11294,   1021,    685,    437,   3463,\n           245,  13862,    298,   1173,     12,     31,  12619,    280,   7234,\n         34512,   3061,   1810,   2051,    279,    588,  31563,  61792,   2051,\n         13298,  89189,    285,   9497,  39088,   2373,    276,    330,  15102,\n           372,  14357,   6357,    254,  52376,   2051,    414,  12626,    382,\n           285,   8698,   1240,    997,  55949,    280,  10112,   8814,   1021,\n          2803,    254,   1246,    766,   2051,    254,   4205,    280,  61586,\n          1173,     12,     31,   8698,   1240,    997,   2001,  53693,    344,\n          9497,  39088,   2051,    372,    895,  42643,  83123,   2051,  16134,\n           254,  59731,   3299,   1021,   7641,  56707,  77434,  10372,    437,\n         22834,    754,    362,   7048,    344,   9497,  39088,    438,    440,\n           840,  81302,   3564,   1373,   3564,   1184,    521,    586,  20575,\n           979,  13354,   2051,    362,   1866,    327,    254,   2516,    280,\n           245,  12134,  10498,    586,  28999,    440,   1021,   3848,   7927,\n           438,   8579,    457,    586,   6184,    276,  57772,   8523,  84489,\n          3773,   1193,   7083,  72936,    778,  23786,    457,    586,  28901,\n           276,    254,   8135,   1835,   2051,   1477,   7083,  57843,  40178,\n           586,   5296,    327,    254,   4922,   1021,  60095,  72936,   1027,\n          1068,    276,    586,   9388,  56071,   2051,   1477,  19580,  57843,\n           778,  12565,    457,    586,  41216,   1021,   5512,    254,  22105,\n           280,    254,  10233,    655,     82,   9684,    280,   7812,   2051,\n          9497,  39088,    655,     82,  28901,    276,    254,   1977,    285,\n          5296,    327,    254,   4922,    463,    803,  22554,    372,  46976,\n          8214,   6728,   2001,    285,  90870,   2051,    285,    362,    643,\n           803,  40408,    327,    586,    938,    280,   2976,   2051,    440,\n          1245,    655,     82,   4706,    440,   1021,    207,    185,   9497,\n         39088,    655,     82,  23270,  10318,    276,   1108,    274,  10798,\n           344,    359,    317,    372,   2074,    276,   3271,    586,   7927,\n           372,    344,    280,  23768,    279,   6435,   1193,    359,    438,\n          2074,    327,    688,  10112,   9816,    441,    276,    330,  24434,\n           457,    857,   1021,   5807,    745,    438,   1866,   1913,   9497,\n         39088,   2051,   3451,  34512,   5496,    279,    254,  27199,    280,\n          3052,  11867,    280,    586,    830,   1193,  89189,    568,  13717,\n            72,    655,     82,   5296,    327,    254,   4922,   2051,   9193,\n          1257,    655,     82,  62359,   2051,    285,   4233,     72,  24337,\n           406,   1104,    655,     82,  36068,    331,    254,  15501,  43515,\n           418,    245,   1860,   6987,   1021,   4600,  41635,   2051,   9497,\n         39088,    655,     82,    830,    279,  42030,    254,    284,    129,\n           237,  51650,    473,  12596,   1734,   1538,    881,    440,    245,\n          8136,    327,   6082,  42643,  48071,    440,    845,    254,   6351,\n           327,   1131,  15500,   9579,    279,    254,  29416,   1021,    207,\n           185,    685,    254,    207,     17,     15,    393,   8295,   2051,\n           362,    438,    254,  14860,   9816,    280,  48847,  53185,  74717,\n          2051,    779,    643,   5734,    857,    372,    440,    254,   9846,\n          2170,   1173,     12,     31,  28656,   2051,   2170,   1173,     12,\n            31,  21030,   9816,    779,    643,  29109,    279,    688,   4706,\n           440,   2051,    285,  26693,    344,   2051,    440,    362,    643,\n          1401,    525,    245,   2018,    668,   2051,    372,    245,  12481,\n          8943,    285,    372,    245,  74048,  54270,    440,   1021,    207,\n           185,    207,    185,    403,    403,    403,  82333,    331,  13727,\n         10591,    403,    403,    403,    207,    185,    207,    185,   9497,\n         39088,    655,     82,  18210,    643,   1401,    245,  21065,   5454,\n           331,  13727,  10591,   2051,   4398,    331,    254,  10591,    473,\n           254,  11108,    283,  32748,   3463,    285,    331,  30142,    285,\n         34512,    279,    254,    427,   2860,   3463,   2051,   2847,    364,\n         50606,     78,  40896,  19084,   2051,    254,   1079,   9846,    280,\n           521,    422,  54179,  34512,   1021,   6809,    279,   4959,  13727,\n          2051,    254,   1639,  11648,    280,  48939,    334,    207,  29703,\n           102,   1777,    231,   2051,    467,   1011,     72,   2238,    317,\n          9565,  53061,    366,   9497,  39088,   1021,    207,    185,  30024,\n           254,    207,     16,     18,    393,   8295,   2051,    254,  13727,\n         12744,  89189,    568,  13717,     72,   2330,    521,  34512,    285,\n           745,    778,   1860,  13531,    276,   9497,  39088,   2051,   5802,\n           586,   7927,    481,    330,   2826,    279,    742,    530,    533,\n          4824,    334,    440,  10112,  18210,   1401,    457,  13727,  34512,\n           440,   2238,  33872,   8255,   1108,    372,    380,   5078,     64,\n          1783,  31966,    248,    844,  31966,    279,    254,    207,     24,\n           393,   8295,   1021,    429,   1022,  20307,  13727,   6700,   1270,\n           280,   9497,  39088,    655,     82,  18210,    438,  75362,    261,\n          1783,  22226,    334,    207,     16,     17,     22,     23,    207,\n           891,    207,     16,     18,     19,     21,   2238,   2051,    245,\n         40961,     89,   2904,  35855,  68271,    285,    634,    280,    254,\n          1094,  19606,  10598,    280,    254,  10591,    280,    254,  24121,\n         34188,   6204,    362,   6383,  40408,   9497,  39088,    285,   1401,\n           245,  37856,    331,    742,  27494,    280,   9497,  39088,    473,\n           254,  12402,    280,    245,  35855,  17981,    279,   5924,   1021,\n           207,     16,     16,    280,    324,   2904,     71,    544,   2181,\n         31966,   1021,   3848,   6710,    908,  31966,   1591,   2353,    708,\n          4634,  15323,   1313,    530,    533,   4824,    588,    778,   7765,\n          9961,    440,  24434,    457,   9497,  39088,    440,    279,    704,\n          3663,   2265,   1021,    908,  31966,   1591,    655,     82,   6710,\n           452,    305,  19084,   1783,  31966,   1040,    246,    661,   3415,\n          4714,    366,    254,   8592,    285,  16925,   1923,  10288,   1783,\n         89512,    387,    285,  71020,   9497,  39088,    655,     82,  18210,\n           279,    254,  74824,   1843,   6204,    634,   1492,    461,   4036,\n         19084,    770,    378,   6526,   6056,   2051,    254,  81271,  37491,\n         56274,    280,    254,   8592,    285,    254,   7492,  10801,    280,\n           298,  81139,  18210,   2051,   3637,    452,    305,  19084,   2051,\n           440,  12816,    304,   3071,    254,  18210,    280,   9497,  39088,\n           285,  13298,  89189,   3025,    440,    452,    305,  19084,  30725,\n           276,  10846,   2051,    440,   7587,    565,    340,    536,    463,\n          2527,  19952,   1021,   2366,    565,    536,    441,   1021,    440,\n          5512,    937,   2051,    745,    661,    803,   1313,  52033,    331,\n          9497,  39088,    655,     82,  18210,   1572,    279,  35855,  30354,\n           285,    279,    254,  78048,   8213,   2051,    285,    372,    245,\n          1230,    586,  18210,    438,   2752,  26637,    279,  13727,  10591,\n           279,    254,  11108,    283,  32748,   3463,   2051,    301,     13,\n            70,     13,   2051,  22648,    247,   9206,   2051,    245,  13092,\n         28656,    279,    254,   5189,    207,     16,     19,    393,   8295,\n          2051,    285,    742,    642,     71,  11407,   1108,    372,  13281,\n           559,   8379,   2051,  40896,  19084,   2051,    285,   1783,   5078,\n           261,   1021,    207,    185,  11399,    254,  31822,    655,  30850,\n          2906,    280,    254,    427,   2860,   3463,    334,    207,     16,\n            21,     17,     19,    207,    891,    207,     16,     21,     19,\n            18,   2238,   2051,   1783,    676,     78,  70068,   1655,     77,\n           334,    207,  51595,   6702,    111,   2238,    280,    254,  56354,\n         87940,    655,     82,  72420,  96715,    331,   9497,  39088,    655,\n            82,    413,    129,    237,  51650,    334,    207,  17141,   6097,\n          3771,   2477,   2051,   7456,  59581,   1783,   1923,  94574,   2238,\n           438,  26238,    881,  12693,   2051,    285,    359,  14474,  48973,\n         23270,    279,   8698,   1240,    997,  30142,    285,    496,  19084,\n         50190,    334,   4660,   9462,   1153,   2238,    762,   1021,    429,\n         37856,   8135,   9497,  39088,    655,     82,  24060,    372,    254,\n          7492,    280,    521,  34512,   6204,    327,   3940,   2051,  16978,\n         28534,   1783,   4111,   2904,   2051,    245,  20307,   8698,   1240,\n           997,  17492,   2051,  26693,    279,   5924,   1021,    207,     18,\n            22,    280,    452,   2063,  19084,  38249,   1040,  31966,    344,\n          1981,    129,    225,     76,   5148,     72,    825,   9497,  39088,\n          6331,    438,    254,   1079,   1608,   9816,    279,   4345,    285,\n         40408,   1783,    676,     78,  70068,   1655,     77,    655,     82,\n         37856,    327,    895,  17961,    285,  79344,   2051,   1477,    362,\n         58964,   1712,   5283,   4940,   2320,    254,  68877,  87940,    778,\n          1653,  15194,    511,    283,    510,   1021,    364,  50606,     78,\n         40896,  19084,   2051,    254,   9846,    422,  54179,   9816,   2051,\n           438,    839,  10871,  24434,    457,   9497,  39088,   6204,    279,\n         13290,     84,    642,  65034,    283,  42488,   2051,    586,  54575,\n          2051,    362,  62729,    254,   1022,    984,   4303,    280,    338,\n         13336,   8275,    334,    207,   5434,   4279,   2238,   1323,    245,\n           422,  54179,    372,    895,  14189,    285,    839,   1313,    280,\n           586,    750,    422,  54179,    463,   3083,  49807,    285,  20667,\n          1021,    809,    317,    993,    344,    754,    362,   7648,    279,\n         91069,   2320,    245,   1234,   4886,   2051,    245,   4486,    280,\n          9497,  39088,    655,     82,  18210,    438,   1503,    366,    857,\n           372,    634,    280,    245,   1860,  17353,   5023,    588,    362,\n           438,   2249,    276,   5652,   1983,   1021,    207,    185,    207,\n           185,    403,    403,  31869,    403,    403,    207,    185,    207,\n           185,    338,   6265,    280,  14315,    463,    803,   1222,    279,\n          8950,    276,  15255,   9497,  39088,    655,     82,    830,    881,\n          3517,   1021,   1733,  45261,  31699,  21053,    279,    429,  51847,\n         62783,    280,   9497,  39088,   2051,    440,   2071,    418,   1313,\n          1448,   4703,    276,   3956,    254,   4194,   6591,    279,  55455,\n          9497,  39088,   2051,    588,    317,   2643,    395,    933,    372,\n          1313,   1448,  36593,    372,   2198,    440,    334,    265,     13,\n         70892,     72,   2238,   1021,    429,  87286,    463,    661,    276,\n         46774,    366,  11973,    636,    254,   8970,  11612,    280,    254,\n          3632,   1673,  39685,   8305,  10039,    276,    245,  12732,   3256,\n           334,   7282,    754,  55455,  31100,  23192,   2051,    410,    284,\n           129,    237,  51650,   2238,   2051,    285,  70005,    254,   4301,\n           521,  28412,  11011,   7282,    279,    254,   3470,   2722,    334,\n         12480,   9673,  14870,    344,    440,    586,  27494,    536,    441,\n           372,    245,   6290,   1865,   1184,   1079,   1136,    279,  13858,\n           440,    207,   1972,    265,     13,  48101,   2238,   1021,   3474,\n         12459,    331,   1319,   3616,    317,  11096,    457,  48847,  53185,\n         74717,    655,     82,   3474,  51402,  62783,   4810,    254,  10112,\n          1021,   3848,    418,   2094,  36593,   2051,    588,   9847,    276,\n         30265,    254,   9304,  10014,   1184,    456,     73,   1058,   1375,\n           285,  10995,    285,  36350,    280,    254,   3093,   6204,    586,\n         16811,    276,    254,    521,  28412,    418,  59688,    276,  29966,\n          1094,    280,   1069,  27494,    473,    586,   6604,   2051,    285,\n         64451,    276,    440,  15255,    636,    440,    254,  13531,    279,\n          1462,   2722,    588,    362,   1217,   2732,   1021,    207,    185,\n          7065,  87286,    463,   6746,   1266,   6146,   4297,    331,   3507,\n           276,  15518,    245,   3078,    280,    254,  42643,   6813,   1222,\n           457,   9497,  39088,   1021,  39543,   3492,  47624,    279,  14863,\n         10112,  91034,   5131,   3517,   1173,     12,     31,   3398,  55893,\n         19123,   2051,  12130,  35480,  15001,  81136,    279,    417,   5026,\n           254,  20992,  94864,    254,  10112,  55893,   8600,   6204,   1572,\n           938,   1225,   1173,     12,     31,   8583,   4303,    285,  17359,\n           742,   5757,    280,  66886,   1021,    685,    429,  51847,  62783,\n           280,   9497,  39088,   2051,  45261,  31699,   4446,    254,   9304,\n         10014,   3148,  16660,   2051,  17160,   9308,    254,  17868,   8959,\n           276,   7679,    276,    254,  27494,   3272,    853,  14031,  34307,\n          1021,  21367,   2051,    362,  13607,    366,    254,  60801,    280,\n           254,   3470,   2722,    457,  22381,  20071,  13858,    366,  12885,\n         30636,   1021,    207,    185,    685,    207,     17,     15,     16,\n            20,   2051,  18232,  37580,   7019,  36593,   2051,    366,  14087,\n         10112,  23917,   2051,    280,    254,   3938,  18210,    280,   9497,\n         39088,    279,   4484,  19430,   2051,    366,  12885,  59372,  33757,\n          2051,    588,  44939,  20071,   1465,   1021,    207,    185,    207,\n           185,    207,    185,    403,  45915,   1257,    334,   3474,  61824,\n          5654,   2238,    403,    207,    185,    207,    185,    440,  45915,\n          1257,    440,    317,    245,   5654,  12790,    457,   3517,   1173,\n            12,     31,  14987,   5733,   4219,   3474,  61824,    327,    704,\n          1864,  15112,  11679,   2051,  11293,   4233,   7152,    334,    207,\n            17,     15,     16,     17,   2238,   1021,    809,    438,   7964,\n           372,    254,   3377,    655,     82,   1864,   2816,    279,  11357,\n           285,    254,   4443,   7705,   2816,    331,    207,     22,   7291,\n           207,     17,     15,     16,     18,   1021,    429,   5654,    438,\n         15323,    457,  31349,  47400,  60721,    282,   5303,   2051,  31349,\n           997,  64550,    246,   2051,   1396,   4166,  38993,   2580,   2051,\n         13708,    261,    721,   1686,   6482,   2051,  29354,   1888,    285,\n           895,  28506,   2051,  20354,  64029,    285,  10343,     72,    770,\n           306,    264,     65,   1021,    440,  45915,   1257,    440,    317,\n           274,  91531,   1823,   2445,   5654,    366,  13039,   5766,   6204,\n           254,  30209,   7988,    245,  66859,    655,     82,  96194,  21716,\n           366,    245,   4485,    750,   1021,  90128,  40408,    254,   5654,\n           327,    895,   5909,   2051,   9609,    359,    245,   2039,   1173,\n            12,     31,    636,   4184,    331,  11293,   4233,   7152,   1021,\n           207,    185,    429,   4184,   5322,    254,   2592,    655,     82,\n         25485,   1869,   1173,     12,     31,   2146,   5906,    279,  14416,\n           285,    254,   4794,  17903,   2051,   1477,  79618,   1869,   1173,\n            12,     31,  17205,  11275,    279,   1572,  50634,  46402,    334,\n         80293,    285,  11476,  13856,   2238,   2051,    372,   1136,    372,\n           279,  10011,   2051,   8900,   2051,  37742,   2051,   7239,   2051,\n          2006,  18457,   2051,    285,    254,  30371,   1021,    429,   2816,\n         69355,    430,   1604,    207,     19,     21,    331,    254,   2616,\n         59769,   8111,    207,     16,     15,     15,    285,    643,    803,\n         18865,   5299,    457,    254,  71870,  25284,   9727,    280,   6096,\n           334,  53342,   5413,   2238,    327,  69508,    280,    207,     20,\n            15,     15,   1173,  53534,    207,     15,     15,     15,  15334,\n          1021,   3474,  61824,   7903,    440,  45915,   1257,    440,    331,\n          1572,    254,   7312,    285,   2616,   8451,    280,    429,   1444,\n         44488,    285,    207,     18,   3144,  15903,  26882,   1193,  11293,\n          4233,   7152,  11433,    334,    207,     17,     15,     16,     18,\n          2238,   2051,   8880,   1003,   6475,  11433,    334,    207,     17,\n            15,     16,     19,   2238,    285,   2426,    254,   9862,  13046,\n         11433,    334,    207,     17,     15,     16,     20,   2238,   1021,\n           207,    185,   1640,  33152,   4236,   3914,   2051,   5405,    276,\n          3798,    254,   2592,    655,     82,    385,  30368,  18777,   2051,\n           438,  12977,    457,  83004,  23601,    488,   2051,    779,    661,\n          8524,   5168,    366,    254,   2592,    331,    984,    750,   4236,\n         10141,   1021,    429,  14800,  50847,    254,   4219,  15698,   3947,\n         16284,   3764,    245,   5575,   4147,   2051,    588,   3433,  18327,\n         53042,    280,  31950,   4236,  10141,    280,  11688,   1108,    372,\n           254,  12791,  30384,    655,    440,   7704,   3990,  21970,    440,\n          2051,  69471,  99317,    655,     82,    440,  73289,   6005,  10593,\n           440,    285,    433,   9241,  12737,    655,     82,    440,   4233,\n           246,  10245,    440,   1021,    429,   4236,   3914,   4503,    207,\n            16,     15,   1173,     13,     31,    207,     19,   4875,   8208,\n           279,    245,    207,     17,     19,   1173,     12,     31,   5064,\n          3463,    285,   4864,  37856,    473,  56239,   2051,    779,  14168,\n           895,   2062,   6629,   2051,  24885,    401,   4910,   1021,    207,\n           185,    429,   5654,    438,   5598,    279,    254,  20501,   2624,\n          4983,  28000,    207,     17,     15,     16,     19,   2051,    285,\n           317,    839,    634,    280,    254,   2732,  11688,   2324,    331,\n           254,  25215,   2627,   1021,  18494,   2051,    359,    317,    254,\n          2328,   1969,   4184,    331,    254,   2616,  12545,    280,   4201,\n          2608,    655,     82,   2461,    304,   8906,  10548,   2081,    207,\n            19,     21,   1021,    207,    185,    207,    185,    403,    403,\n         39371,    285,   6255,    403,    403,    207,    185,    207,    185,\n           440,  45915,   1257,    440,    438,   4473,    457,  31349,  47400,\n         60721,    282,   5303,   2051,  31349,    997,  64550,    246,   2051,\n          1396,   4166,  38993,   2580,   2051,  13708,    261,    721,   1686,\n          6482,   2051,  29354,   1888,   2051,    285,    895,  28506,   2051,\n         20354,  64029,    285,  10343,     72,    770,    306,    264,     65,\n          1021,  64029,   2051,    721,   1686,   6482,   2051,    285,    770,\n           306,    264,     65,    661,  10084,   6022,  15323,   3474,  61824,\n           655,     82,   3590,   5906,  24452,   2051,    440,   2461,  44051,\n          1257,  27043,    440,   2051,    440,   3474,  45434,    440,   2051,\n           285,    440,  12606,   5807,   1003,    655,    248,  13291,    440,\n          1021,    685,   6511,    207,     17,     15,     16,     17,   2051,\n           429,  30520,   6701,    344,  18475,  23007,    488,   2051,    254,\n          2592,    655,     82,   7709,   2051,    661,  33044,  19606,   5654,\n         47397,    276,  23418,    327,   2516,    331,   3474,  61824,    655,\n            82,   1864,  11679,   1021,  64029,    993,   2051,    440,    809,\n           655,     82,   2375,    276,    752,    704,  48896,    331,    254,\n          4236,   1021,    440,    685,   4317,   2051,    254,   4718,   6701,\n           344,  12184,   1651,  21121,    438,   2695,    331,  13139,    344,\n          5598,   8690,  11667,    285,  64550,    246,   1021,    207,    185,\n           440,  45915,   1257,    440,    438,   8224,    372,    254,   1864,\n          2616,   2816,    285,   4443,   7617,    473,    704,   1864,  15112,\n         11679,   2051,  11293,   4233,   7152,   1021,  75001,  64441,   2051,\n           245,   2592,   5612,   2051,    279,    245,   7953,    207,     17,\n            15,     16,     17,   8314,    366,  63057,   9044,   2051,   9643,\n          2643,    657,  13070,    440,  45915,   1257,    440,    372,    254,\n         11679,    655,     82,   1864,   2816,    279,    254,   2616,   1021,\n         64441,    438,  20638,    372,   5366,   1193,    440,   2991,    254,\n         11679,   2051,    344,    655,     82,    254,   1022,    634,    344,\n           395,  19240,    276,    285,    395,    778,    837,   2051,    655,\n         32259,   2051,    395,   2126,    437,   5654,    655,    440,   1021,\n         10068,    276,    245,  63057,   9044,   4718,   2051,    254,   1604,\n           438,   7964,  62529,    279,    254,   4794,   5110,    331,    207,\n            16,     22,   7953,    207,     17,     15,     16,     17,   1021,\n          3563,    207,     16,     23,   7291,    207,     17,     15,     16,\n            18,   2051,    254,   5654,    661,    441,    803,  22881,  30903,\n           276,   2616,   9319,  19273,   1021,    429,   4184,   2051,   3111,\n          2051,    438,   7964,    457,  25369,  10548,  26666,    331,    207,\n            23,   8520,    207,     17,     15,     16,     18,   2051,    372,\n           254,   3377,    655,     82,   1864,   2816,    279,  11357,   1021,\n           207,    185,    207,    185,    403,    403,  74509,    285,  19184,\n           403,    403,    207,    185,    207,    185,    440,  45915,   1257,\n           440,    317,    274,    581,  34881,   4552,   2051,  91531,   1823,\n          2445,   5654,    588,   7513,    327,    245,  13640,    280,    207,\n            18,   1193,    207,     15,     19,    334,    207,     18,   4063,\n          2051,   2685,   7661,   2238,   1021,    429,   4184,   3804,  13039,\n          5766,   2051,  73374,  34787,   2051,    245,    440,  10010,  10010,\n         10010,    440,  30087,   2051,    285,    245,  12283,    709,   1173,\n            12,     31,  33616,    271,  47151,   1021,   3474,  61824,    655,\n            82,  22156,   3169,    279,    254,   5654,  13497,    473,    254,\n          4347,    280,    427,     19,    276,    339,    207,  33513,    107,\n           207,     21,   1021,  54293,    335,   5312,  14661,  14404,   2051,\n         15462,   4303,    285,  36427,   1021,  51423,    279,    254,   2131,\n           280,    427,   3144,   2051,    254,   8896,    317,    845,    279,\n          3064,    766,    285,  13412,    430,    245,   3399,    207,     24,\n            15,  34950,    513,   8298,   2051,   4299,    276,    254,   6583,\n         11696,   4236,   7019,    430,  10548,  14831,     13,    690,    457,\n         25369,    893,  96416,  10548,  33629,   1021,  43100,   2051,  17259,\n          2239,  13212,    473,   2428,  34309,  10689,    344,    254,   4184,\n           317,    440,  38017,  53501,  10566,    440,   1021,    429,  96287,\n          3093,  19006,    254,  66859,    655,     82,  96194,  21716,    366,\n           245,   4485,    750,   2051,    285,  42532,  60758,  11119,  10014,\n           327,  13511,  41376,    279,    254,   4303,    440,   1273,    340,\n          1113,    207,    487,    244,  41891,   1529,    359,   4363,    893,\n          1308,    340,    953,  41891,   1529,    525,   1719,    893,  23194,\n          1481,  30351,   2051,  30351,   2051,  30351,   2051,  30351,   2051,\n         30351,   1021,    440,    207,    185,    440,  45915,   1257,    440,\n           438,   1136,   4503,    457,  15813,   4236,  32123,   2051,    779,\n         62083,    331,    895,   3512,    280,   5909,   1021,   9848,  53392,\n         17365,    655,     82,  14333,  19895,    261,   2051,    779,  40408,\n           895,  21958,   2051,    285,  15261,  64441,    280,  59769,   2051,\n           779,  14168,    254,  47151,   2051,   5734,    440,  45915,   1257,\n           440,    372,    634,    280,    254,  11679,    655,     82,  22499,\n          1021,  64928,   7604,   3736,    262,    327,    429,  37716,  78766,\n           254,   4184"
  },
  {
    "path": "src/wikitest.cat.1chunk.v3-encoded.txt",
    "content": "             0,    539,    438,  10498, 102771,    402,    438,  54921,  10498,\n        102771,    402,    344,    411,   3947,   5485,   1537,  15758,    305,\n         31085,  22491,   1204,   1166,    936,    260,  20521,   2390,     15,\n            34,  71132,   3615,    377,    270,  15758,   4923,    455,  10987,\n           295,    223,    792,     18,   1204,   1162,    515,   7128,    513,\n           260,  71132,   3615,    295,    270,   1946,   5334,   1054,   4866,\n           513,  20923,  89127,   1537,    778,    515,   7451,    295,    223,\n           792,     19,    509,    270,  15301,   6605,  30650,   1204,   1166,\n           936,    260,  20521,   3615,    295,    270,  15758,   4923,  25750,\n          3880,   1675,    284,    295,    223,    792,     20,   1204,    660,\n           223,    792,     22, 102771,    402,  33906,    260,   3615,    412,\n           582,  38950,    582,    295,    270,  19569,    582,  93802,    905,\n            85,  18145,    582,    294,    270,  15758,   4923,    455,   9266,\n         49866,   3749,    468,  98410,  19930,  21180,   5101,  27290,    305,\n         56068,  18844,     75,   1204,   1166,    515,   8733,    295,    270,\n           223,    792,     23,  31085,  58853,    294,    270,  28551,  59059,\n          3429,   1946,  52493,  58703,   1537,    778,    515,   7451,    509,\n           270,  74024,  30650,    295,  78779,    305,    270,  12651,   1374,\n         60442,  50442,    295,   6693,   1204,   1166,    515,  14717,    513,\n          3880, 101547,    305,  98410,  19930,   7173,   2282,    994,   1649,\n          1537,  73908,   1653,  15674,   1537,  18881,  21324,   1537,  60048,\n         27626,    443,   1537,  59898, 102010,    305,  95787,  10316,   1204,\n           539,    660,    223,    792,     24,   1537, 102771,    402,  98410,\n         19930,   2282,    994,   1649,    295,    270,   1946,  84690,   4866,\n           513,   5101,  60792,  39136,   1204,   1166,  11244,    377,    260,\n           223,    792,     24,  19569,    294,    270,  15758,   4923,   1537,\n         74746,   1537,   7128,    513,    260,   3615,    295,    270,    223,\n           792,     25,  31085,   4606,    294,   1730,    304,   7564,    467,\n         14717,    513,   8656,    500,    433,    551,   2438,   1204,   1730,\n           304,   7564,    467,    515,   7451,    509,  24507,  30650,    295,\n           270,   6693,  76115,    294,  43728,    387,  41178,    305,  43008,\n          5440,   1204, 102771,    402,  98410,    295,   1234,  14263,    295,\n           223,    792,     26,   1537, 113170,   9512,  46157,    513,  89999,\n         11111,   2033, 122083,   1537,    305,   7740,   4989, 113861,  14717,\n           513,  10754,    367, 117151,   1204,    660,   3460,    223,    792,\n            26,   1537, 102771,    402,   1960,    260,  20521,  12343,    377,\n           260,   1234,   2390,     15,     34,    892,  19569,  21736,    294,\n           270,  15758,   4923,    448,   1690,    270,  25628,   1537,   7128,\n           513,    411,  12343,    377,    270,  15758,   4923,  88943,    808,\n           295,   5997,    223,    792,     26,   1204,   1166,    936,    260,\n         54693,   3615,    295,   5147,  29193,    294,    270,  15758,   4923,\n        117856,   1189,    295,    223,    643,     18,   1537,    412,    582,\n           657,  39706,  70148,    582,   1204, 102771,    402,  98410,    295,\n           270,    223,    643,     19,   5485,  41296,    267,   5647,  14717,\n           513,  11111,   2033, 122083,   1204,  54921,    438,    438,  34604,\n           438,    438,  54921,    539,    438,    438,    438,    223,    792,\n            18,   1256,    223,    792,     23,    438,    438,    438,  54921,\n           660,    223,    792,     18, 102771,    402,    936,    260,  20521,\n          2390,     15,     34,  71132,   3615,    377,    270,  15758,   4923,\n           455,  10987,   3749,    468,  48626,    582,  12655,   4228,    744,\n           582,    295,    270,  19569,   1537,    582,    660,  37831,  60497,\n           582,   1204, 102771,    402,  98410,    412,    582,  12655,    582,\n           295,    270,   1946,   5334,   1054,   4866,    513,  20923,  89127,\n          1537,    778,    515,   7451,    295,    223,    792,     19,    509,\n           270,  15301,   6605,  30650,   1204,    334,   3862,    294, 102771,\n           402,    905,     85,   4197,    295,    455,  29023,    377,   8907,\n          5654,   1440,    412,    582,   5415,  51568,   2420,   8721,    582,\n           295,    270,   3615,   1537,    305,    468,   5730,   6490,  13712,\n           295,    455,  51699,   1537,    305,  69493,  14645,   1204,   1166,\n         11244,    295,    270,  15758,   4923,  25750,   3880,   1675,    284,\n           295,    223,    792,     20,    412,    582,   7043,    381,   1544,\n          4565,    615,    582,    295,    270,  19569,    582,  21774,  69318,\n          5995,    582,   1537,    305,    936,    260,   3615,    412,    260,\n          1688,   3053,    582, 107062,  98095,    582,    377,    455,  10987,\n          1204,    539,   1166,    936,    260,  54693,   3615,    295,    223,\n           792,     21,    377,   1234,  29193,    294,    455,  10987,   1537,\n           412,   3053,    582,  75971,  15366,    582,   1204,    660,    223,\n           792,     22, 102771,    402,  33906,    260,   3615,    412,    582,\n         38950,    582,    295,    270,  19569,    582,  93802,    905,     85,\n         18145,    582,    294,    270,  15758,   4923,    455,   9266,  49866,\n          3749,    468,  98410,  19930,  21180,   5101,  27290,    305,  56068,\n         18844,     75,   1204, 102771,    402,  98410,    412,    582, 101277,\n           582,   1537,    295,    270,    223,    792,     23,  31085,  58853,\n           294,    270,  28551,  59059,   3429,   1946,  52493,  58703,   1204,\n           983,    515,   7451,    509,    270,  74024,  30650,    295,  78779,\n          1537,    305,    270,  12651,   1374,  60442,  50442,    295,   6693,\n          1204,   1166,    515,  14717,    513,   3880, 101547,    305,  98410,\n         19930,   7173,   2282,    994,   1649,   1537,  73908,   1653,  15674,\n          1537,  18881,  21324,   1537,  60048,  27626,    443,   1537,  59898,\n        102010,    305,  95787,  10316,   1204, 102771,    402,   5730,    260,\n         29141,   3862,    295,    455,  19383,  66782,   1313,    582,    455,\n         15757,    344,    568,   3937,  12250,  18934,   1537,    418,  68025,\n         22704,    538,   7173,   2282,    994,   1649,    343,   1928,  97771,\n         73617,    538,    793,   4197,    412,  74767,    471,   7541,    905,\n            85,  66982,   1900,   1537,  10498, 102771,    402,   1537,  73908,\n          1653,  15674,    305,  60048,  27626,    443,   1204,    582,    455,\n         39077,   9764,   1537,    582,   7173,   2282,    994,   1649,    305,\n         10498, 102771,    402,   3477,  78776,  26292,    270,   8042,    409,\n          1212,   1204,    582,  54921,    438,    438,    438,    223,    792,\n            24,   1256,   2236,    438,    438,    438,  54921,    660,    223,\n           792,     24, 102771,    402,  98410,    295,    270,   1946,  84690,\n          4866,    513,   5101,  60792,  39136,   1204,    455,   1946,    515,\n           892,    294,    260,   4923,    778,  24369,   1688,  79360,     85,\n          1537,  31970,  31651,   1492,  26455,   5638,   1492,  84690,   1204,\n           660,    260,    223,    792,     24,   8222,   1537,  16636,  22491,\n          7173,   2282,    994,   1649,   8045, 102771,    402,    412,    834,\n           294,    793,  11145,   1218,   2390,     15,     34,  12570,   1313,\n           582,    342,  10423,   3946,    418,    260,  15650,   3252,  10498,\n        102771,    402,   1537,    995,    515,    295,    270,  28071,   5390,\n           294,  31651,   1537,  26455,   5638,    305,  84690,    509,    270,\n          4545,   1204,   1166,   8178,   1026,   8809,    295,  52493,  58703,\n          1204,    582,   1166,  48626,    582,  29856,  44797,    582,    377,\n           270,    223,    792,     24,  19569,    294,    270,  15758,   4923,\n          1537,  74746,   1537,  31970,    582,  33633,    342,    334,    592,\n           582,   1204, 102771,    402,  98410,    412,    582,   7232,    582,\n           295,    270,    223,    792,     25,   4606,    294,   1730,    304,\n          7564,    467,  14717,    513,   8656,    500,    433,    551,   2438,\n          1204,   1730,    304,   7564,    467,    515,   7451,    509,  24507,\n         30650,    295,    270,   6693,  76115,    294,  43728,    387,  41178,\n           305,  43008,   5440,   1204,    660,    260,   3862,    294,    270,\n          4606,    362,    455,  19383,  66782,   1537,  31085,  12306,  12410,\n         47787,   9764,   1537,    582,  10498, 102771,    402,  14257,    260,\n         35560,  31191,    304,    270,   6632,    412,   7232,   1204,    582,\n           539, 102771,    402,  98410,    295,   1234,  14263,    295,    223,\n           792,     26,   1537, 113170,   9512,  46157,    513,  89999,  11111,\n          2033, 122083,   1537,    305,   7740,   4989, 113861,  14717,    513,\n         10754,    367, 117151,   1204, 102771,    402,  48626,    260,   3053,\n          9306,    582,  42333,    582,    295,   7740,   4989, 113861,   1537,\n           995,  27634,   3758,    418,   3053,    582,  26021,    582,    412,\n           270,    582,  12426,   8809,   4588,    995,  23404,    436,   1375,\n           418,    330,   4422,     75,    582,   1204, 102771,    402,  20521,\n         98410,    377,    260,   1234,   2390,     15,     34,    892,  19569,\n         21736,    582,    448,   4201,    582,    295,   3460,    223,    792,\n            26,    294,    270,  15758,   4923,    448,   1690,    270,  25628,\n           412,   3053,    582,  40983,   1675,   8538,    582,   1204,   1166,\n         11244,    377,    270,  15758,   4923,  88943,    808,    412,    582,\n         43716,    582,    295,   5997,    223,    792,     26,   1204,   1166,\n           936,    260,  54693,   3615,    295,   5147,  29193,    294,    270,\n         15758,   4923, 117856,   1189,    295,    223,    643,     18,   1537,\n           412,    582,    657,  39706,  70148,    582,   1204,   1166,  48626,\n           411,  13331,  24579,  15666,    362,    260,   5931,  54460,   1204,\n          1166,  39008,    377,    270,  21798,  18330,    295, 121983,    260,\n         24579,    377,  15758,   1313,    582,  68755,    260,  10817,    344,\n           260,  17759,   3217,   1204,  41697,   3261,    440,   1153,   1205,\n           440,    905,    266,  10144,    943,   1082,    440,   2090,    905,\n            86,    344,   1855,  58614,    790,   1031,    477,  77877,    377,\n          1341,    995,    477,  24403,    509,   5177,    440,   1407,  10918,\n           305,   8176,    440,    270,  11198,    304,   2466,   1031,    305,\n          1747,   1277,    440,   1153,   1205,    440,    905,    266,   4843,\n          1204,    582, 102771,    402,  98410,    295,    270,    223,    643,\n            19,   5485,  41296,    267,   5647,  14717,    513,  11111,   2033,\n        122083,   1204,  54921,    438,    438,  20496,   5338,    438,    438,\n         54921,    539,    438,    438,    438,  20496,    438,    438,    438,\n         54921,    539,    438,    438,    438,  47906,    438,    438,    438,\n         54921,    539,    438,    438,    438,  30650,    438,    438,    438,\n        122770,    438,  11677,  30618,    438,  54921,  11677,  30618,    343,\n         62286,   1256,  95709,   1313,  22096,  30618,   3749,   7891,   1313,\n           223,  70287,   3749,    223,  25544,   1256,    223,  26631,   1900,\n           515,    260,  19496,   7891,  22361,    294,    270,  24019,  53983,\n          1204,  36230,    418,   7645,  78725,    343,   7645,   9984,   1900,\n          1537,    468,    344,  11477,   3252,    270,  11849,    294,    270,\n          7891,  46494,   1204,   4457,  11849,  45899,    515,    304,   8463,\n           793,   3924,    412,    260,   7877,   8478,  34596,   1537,    790,\n           468,  16477,  14740,    304,   1635,    270,   5033,  56860,   1204,\n          4457,   1988,   1537,   1277,    270,   4445,   3924,   1537,    515,\n         83323,    513,    270,   1417,    462,   3090,    276, 101283,    294,\n           223,  27481,   1537,    305,    793,   2336,    223,    856,   1737,\n           881,    260,   1014,    294,   4975,   6245,  48309,   1204,    539,\n          8083,  16494,    468,    515,   2961,   2390,     15,     34,   3459,\n           304,    915,  17818,   1537,    793,   2984,   4127,    304,    366,\n         81938,  29681,    295,   1952,   7891,    305,  10999,  19044,   5785,\n          1204,   5673,    793,  46383,   4985,   1537,   8791,  25535,   2759,\n         27107,    611,   1047,  30239,   1060,    270,  16922,   1204,   1166,\n           769,   1047,   3252,    270,    582,  98240,   2390,     15,     34,\n         43507,    976,    582,    305,    270,    582,  98240,   2390,     15,\n            34,  52827,    582,    513,   7891,  30454,   1537,   1901,    270,\n          3291,    294,    793,   1116,    769,   7837,   1440,    304,    366,\n         10097,    304,  10734,  12592,    412,    582,    270,   7891, 103709,\n          1537, 101480,   1537,    541,  28817,   1537,  28429,   1537,  53623,\n          1537,  54374,   1537, 115472,   1537,    406,   8354,   5983,   1537,\n         57715,    469, 103612,   7705,    687,    582,   1204,  54921,    438,\n           438,   7586,    438,    438,  54921,  37345,   7891,  19044,  22682,\n         32092,    270,   1988,    294,    270,   3725,   1082,  45826,    260,\n          1116,   1537,    260,   4646,    778,  61008,  36965,  17911,    304,\n           582,    270,   5010,  10348,    396,   7075,   7891,   3241,   1197,\n          1303,   1469,   2783,    305,  40718,    582,   1204,   8074,   1623,\n           294,  11677,  30618,    905,     85,  27107,   7080,  40718,    305,\n          3980,   1537,    566,   4646,    344,   6440,   2239,   1204,  13023,\n          3986,   1537,   8045,    513,    270,   7891,  40615,   7232,  22127,\n          1537,    344,    396,   7891,  27107,    477,   8600,  47468,   1537,\n          6320,   5460,   5148,    396,   2786,    366,   7723,   1537,    790,\n           778,    411,  12695,  15874,   1494,    366,  15990,    304,   1153,\n          1204,   1884,   5970,  10734,  12592,   1537,    582,    455,   2477,\n         20671,    579,   1153,    270,   1014,   1537,    270,   2445,    305,\n           270,  11451,    295,    270,   6951,   1537,    270,    850,  38906,\n           579,    477,    304,  15778,    436,  69233,   1537,    305,    270,\n          1529,    759,    366,    396,    579,   4338,  78740,    270,  17261,\n           469,   4442,    304,   2572,    436,  33677,    582,   1204,  20986,\n         47643,  10905,    260,   4824,   4637,   3191,    304,  11677,  30618,\n          1537,  39726,    396,    270,   6890,    294,    270,  22361,    905,\n            85,   1116,   4072,  14058,    294,    793,   4445,   1988,   1537,\n          4562,   1099,    270,    582,    322,  35686,    582,  25076,  15866,\n          1505,    362,    850,   6543,  46494,   1204,  54921,    438,    438,\n           438,  15225,   1737,    438,    438,    438,  54921,   7973,    294,\n          1205,    344,   3459,    294,  11677,  30618,    905,     85,   1988,\n          5095,    538,    793,  27107,   1204,   4457,  76430,  39057,    515,\n         11677,  38288,  12098,   1537,    260,   9764,  45860,    305,  22361,\n          2184,    270,  28870,    294, 123719,  28592,   1204,  11677,  30618,\n           515,   9288,    295,    223,  25544,   3749,    270,   6319, 107908,\n           344,  13026,   1537,   6816,    396,    436,    515,   4851,  10391,\n          1260,    555,   1537,  10134,    276,  22643,    343,  77716,  17504,\n           344,    260,  29361,  14626,   1900,   1204,    660,   3859,   1988,\n          1537,    468,   5083,   5619,    304,   9028,    304,    270,   6102,\n          4593,    294,  32209,    905,    276,   1537,  58387,  66137,    294,\n           270,  11677,   3096,   1204,    539,  11677,  30618,    905,     85,\n          5642,   9521,  27768,   1561,    468,    515,   9288,   1537,    305,\n           468,    515,  21847,   9927,    513,    793,  51327,   1204,   1166,\n           936,    411,  20062,   8809,   1537,    995,   9521,   4047,   1204,\n          1166,    990,    936,   2038,   4747,  22226,    305,    834,   4747,\n         13939,   1537,    304,   9642,    468,  11477,  12001,    295,    793,\n         27107,   1537,   7254,    468,   3214,  43375,    793,   3132,  26331,\n          1204,    539,    455,   4053,    294,    260,  10262,  41335,   2390,\n            15,     34,   6805,   1537,    793,  12181,    515,   9185,    377,\n           270,   5103,   4342,    294,    260,   3988,   8478,  34596,   1313,\n          2286,    305,  19607,   6797,    294,    270,  75637,    276,  71574,\n           294,  16296,   1537,   3980,    305,  19106,   1204,   1166,   3859,\n         16026,    304,    611,   7444,   5588,   6603,  27107,    513,    793,\n          3808,  40614,   1537,    790,   1305,    611,   1047,   6644,   1204,\n           539,    660,    270,   3808,    223,  25168,     85,   1537,    468,\n         52591,    295,    270,  41377,  11646,   1492, 111430,  56521,   3078,\n          3749,    793,  27419,  41606,  17261,   1537,  22897,    260,  19106,\n         22110,   1537,    344,   3241,    304,   5045,    538,    270,   1522,\n           294,    566,   3285,   1537,   2448,    223,  29264,   1204,    660,\n           396,   1141,   1537,    468,   4310,    270,   8478,   4008,   1708,\n          1537,   4888,    295,  32209,    905,    276,   1204,   1166,  10815,\n          1537,    304,    793,  16567,    305,    396,    294,  17841,    294,\n          3859,  30454,   1204,  22127,  39157,    396,    468,   6162,  10815,\n          1754,    793,  46030,   5392,    509,    270,   1014,    515,   2727,\n         27091,    305,  51112,   1537,   1901, 114705,  10905,    793,   8977,\n           304,  50275,  14458,    295,    270,   6102,   1142,    611,   1047,\n           304,  27323,   1204,   5057,    566,   8977,   1537,    468,   4661,\n          1559,    304,  24185,   1537,    566,   1014,   2448,   2009, 119107,\n           305,   1166,  69113,   1204,    539,   4457,   6369,   9521,   2448,\n           223,  24438,   1204,  11677,  30618,   1114,    611,   1047,   7837,\n           304,   6601,    270,   8478,   4008,   1754,    294,    793,   6369,\n           905,     85,  10681,   1537,    790,    468,    344,   3241,    304,\n           611,   2910,    890,    270,  32104,    295,  17244,    294,    834,\n           294,    793,   4747,  22226,   1204,   1166,   9185,    270,   2894,\n          2689,   1737,   5530,    295,    270,  10391,   1260,    555,   3078,\n          1537,  42176,    793,  19118,    295,  12541,  23072,   1204,    539,\n           660,    270,  36406,    294,    223,  28509,   1537,    468,   1811,\n          7645,  78725,    343,   7645,   9984,   1900,    362,    270,   1257,\n          1014,   1537,    305,    270,   1234,  46494,   8216,    260,  28124,\n          1204,   7558,  14390,  13308,    566,    412,    582,    270,   1473,\n          3168,  72450,   4885,    295,  11677,  30618,    905,     85,  23052,\n          2934,    582,   1754,    436,   6718,   1440,    260,   5530,   2511,\n           294,    270,    322,  11290,  22361,   2390,     15,     34,  41335,\n          1988,    304,    778,    468,    515,  29728,   1561,    793,   8977,\n           295,    270,   8478,   4008,   1708,   1204,    455,   3998,    515,\n         15471,    834,   2390,     15,     34, 107474,   1537,   4499,   1204,\n         11677,  30618,    515,    513,   1093,   1737,    270,  15590,   1537,\n          1901,   7645,  78725,    515,   4006,    260,  46383,   9051,   1204,\n          1350,    611,  20626,  27107,    304,    469,    943,   7645,  78725,\n           538,    270,  15590,  22361,   1537,    790,   1353,    834,    295,\n           270,    915,   6315,   1204,   2359,   1811,   1820,   1353,   4387,\n          1537,    295,    223,  29444,   1204,    539,    660,    223,  30787,\n          1537,    468,   8599,    304,    270,   6102,    295,    411,   6041,\n           304, 102197,    793,   6805,   7609,   1204,   1166,   4310,    270,\n          8478,   4008,   1708,    260,   1957,   1014,   2184,    270,   2502,\n          1141,   1537,    790,    710,    270,  15644,    881,  10815,    513,\n           270,   4309,  16968,    343,  18841,    295,   2496,    304,   4819,\n           270,  31092,    294,   3338,  53071,   1900,   1204,   1166,   3214,\n          1820,  22612,    270,  47766,   1537,   6240,  19379,    288,    270,\n         46146,   6578,    295,    223,  29197,   1537,    223,  29556,    305,\n          6162,   1820,    295,    223,  27481,   1204,   1166,  13841,   2448,\n           223,  28723,   1537,    305,    513,    223,  28997,    270,   8417,\n           936,    936,   3818,   2845,   2136,   2038,  24231,    305,   1234,\n         33712,   2136,    790,    834,    294,    270,  24231,   9521,    295,\n         73306,    295,    223,  27481,   1204,   5795,    223,  29556,    468,\n          6006,    304,    611,  15180,   4454,    343,   6162,  31787,   1900,\n          1537,    270,   1257,    294,    260,   4923,    294,  90410,    778,\n          6397,   4295,   1440,    362,    270,   2591,    294,    793,   1988,\n          1204,    983,    515,    295,    396,   1141,    396,  11677,  30618,\n           515,  12522,    304,   5002,    793,   3096,   3504,    304,    270,\n         68978,    294,    260,  76449,   7068,    943,    513,  14534,  51793,\n           295,    270,   5181,   1204,    539,    660,    223,  27481,   1537,\n           468,   5730,    411,  21434,    412, 103347,    294,    270,  15759,\n         23766,    479,    905,     85,   7032,    294,    270,  35226,  23098,\n           905,     85,  37622,   1204,   8083,    566,    515,    260,  10262,\n          2411,   1537,    295,   5374,   2734,    436,   1114,    611,   1047,\n           509,   3396,    270,   1904,    294,    411,   6805,   7609,   1204,\n          8239,   1936,    468,    936,  23654,   1116,   1537,   4499,   1537,\n           270,   3609,    515,  42756,   3543,    513,   5516,   1204,  54921,\n           438,    438,    438,   5602,    438,    438,    438,  54921,    455,\n          1417,    462,   3090,    276, 101283,   6006,    295,   5899,    223,\n         27481,   1537,    305,    515,    554,   8064,  46744,    362,   4975,\n          4944,   1737,   1204,    983,   7677,  25896,  38579,    304,   7891,\n          6591,   1313,    270,  34425,    294,    223,  29556,  11516,    223,\n          4157,   2390,     16,     34,    223,     27,   3646,   1482,   1537,\n           790,   5147,   1737,   3859,   1537,    270,  34425,  34011,   1438,\n           223,    926,   2390,     16,     34,    223,     27,   3646,   1537,\n           270,  17347,   3638,   1047,  45298,    469,  12035,   1204,  10272,\n           566,   1014,   1537,  11677,  30618,   6192,    260,  13900,  59735,\n           479,   1988,  72319,   1610,    513,  26989,   1537,   4515,   2013,\n          1656,    305,  26400, 100178,   8897,   1204,   1162,   3285,    294,\n         35662,  87811,    515,    270,   3490,    294,  11677,  30618,    412,\n           260,  22361,   1313,   8239,  59892, 114705,    769,   4866,    396,\n          1537,    582,   1999,    468,   5847,   2448,   1440,   2136,    270,\n          6156,    294,    793,   3096,   1537,  26926,   1537,    305,  48106,\n          1256,   1205,    468,   7431,   1537,    305,   1205,    468,  25206,\n           362,    469,  41982,    538,    270,   6486,    294,   3624,  27005,\n          2136,   1305,   5750,    270,  38381,  19219,    294,    793,  19106,\n           582,   1204,   8239,   1082,    468,   8838,    294,    270,   4641,\n           294,    793,  43345,   1888,   1537,    468,   6818,    304,    270,\n         16021,    294,   3628,    295,    793,  19106,   6240,    294,  52220,\n          4465,    793,   1956,  58883,   3399,    273,   1204,  11677,  30618,\n          8398,   1313,    539,   7570,   8686,    377,   1205,    342,    611,\n         11385,   1407,   1537,    855,   1749,    342,   1153,   1345,  16021,\n          1537,    270,   2953,    836,   2231,  19398,    366,  58414,   1610,\n           513,    270,  28878,   1204,    539,    660,    223,  29291,   1537,\n         36963,   2137,   7243,     92,    700,    515,  12522,    304,  53920,\n           270,   6102,    305,  42776,  12784,   1204,  11677,  30618,   1537,\n           995,    936,   1047,   3543,    538,    270,   4593,   1537,   4310,\n           793,   3096,    304,    260,   2445,    294,   6555,    305,  22612,\n           304,  10764,    270,   5476,    294,    270,   1017,  46146,    343,\n         44944,    700,   1900,   1537,    790,    468,    515,  19888,    513,\n           270,  61321,    305,   4737,    304,  32209,    905,    276,   1204,\n           660,    270,  36406,   1537,    793,  43345,   4053,   1537,  11677,\n          1653,    700,  48434,    343,  34153,  35132,   1900,   1537,    515,\n          9288,   1204,  34659,    566,   1014,  11677,  30618,    344,   3241,\n           304,    611,  55218,  43641,   1204,    539,   1166,  40530,    538,\n         32209,    905,    276,    270,   2502,   1141,   1537,    305,    515,\n         19594,   7708,   6774,   1082,    468,  43381,   1808,    270,   5476,\n           295,   3460,    223,  28997,   1204,   1162,   2411,   6718,   3278,\n           304,    270,  46146,    790,    515,  13900,  85909,   1204,  11677,\n         30618,    905,     85, 114701,   1719,  52593,   1440,    304,   3047,\n           304,   1635,   1347,    294,    436,   1313,    468,   7677,  14805,\n           362,   5619,    513, 106662,    270,  16800,    294,    793,   6117,\n           305,  35548,  66109,  89374,    377,    260,  79311,   8039,   1204,\n          1166,    515,  25488,    790,    515, 116502,  31772,    295,   5210,\n          1204,   1166,    515,  16581,   6559,    304,   5711,    793,   3096,\n           295,   5773,   1537,    790,    468,   6415,  43381,   1808,    270,\n          5476,    305,    377,   5899,    223,     26,   1537,    223,  28997,\n          1537,    468,  10274,    304,  32209,    905,    276,    418,    270,\n         46146,   2502,   1009,   1270,  79040,    513,   3635,   8753,   1204,\n          3211,   1537,    793,  11389,   8361,    304,    366,    612,   1827,\n          7852,    638,   1537,    305,    295,    270,   8012,    294,    223,\n         30942,    468,    515,   2131,  12284,    304,    260,   2411,    412,\n         32284,    294,   6297,    295,  14947,   1521,  27397,   1204,    455,\n          3609,    515,    554,    304,    793,  13132,   1313,    295,    834,\n         17261,   1537,    468,   8398,   1313,    539,    342,   1030,    943,\n           304,  59455,  17196,    367,    295,    270,   7032,   1492,  43791,\n          1082,    851,   4379,    850,  14803,    304,  31640,   4077,    377,\n          1026,  21848,   1204,    539,   1166,   8599,    377,    295,    270,\n          8012,    294,    223,  31257,   3749,    566,    769,  34478,   1047,\n         92355,    304,  76449,   1537,    790,  22127,  19166,    396,  35814,\n           344,    260,    850,   4888,   3986,   1204,   1166,   2894,   9185,\n          2448,   4104,   6167,    295,  75609,  50096,    343,   1928,    330,\n          3697,  39238,   1537,    489,    634,     87,  22643,   1900,   1537,\n          1479,    468,   8398,    850,   1099,  13961,  27107,   1204,  54921,\n           438,    438,    438,  43975,    664,    438,    438,    438,  54921,\n           660,   5899,    223,  31257,   1537,    468,  24752,  21855,    295,\n         45192,   8320,    343,   5970,    489,    634,     87,   1900,   1204,\n          1166,  60405,    377,   5899,    223,   1173,    362,  43975,    664,\n           343, 122077,  22643,   1900,   1537,   1479,    468,    515,  32187,\n           513,   3277,   4701,   4214,    305,  16636,  22361,   4897,     75,\n          6625,   1204,  11677,  23255,   2951,   5619,    295, 122077,    362,\n          1473,    294,    270,   2894,   3818,   1737,   1204,   3715,    270,\n         36406,    294,    396,   1141,    468,    515,    295,   5024,  14805,\n          1537,    305,   3667,  27107,  79978,   1694,    304,   3624, 111120,\n          1204,   1166,    515,  49049,    513,  38432,  28592,   1537,    260,\n          6117,    305,   7017,  46334,    995,    515,  19594,  26748,   3810,\n           509,  43975,    664,   1204,  15907,    793,   5024,   4454,   1537,\n           566,    515,    834,    294,    270,   2938,  17213,    305,   1473,\n         29777,  14194,    294,    793,   1988,   1204,   8647,    294,  11677,\n           905,     85,  27107,    538,    566,   3285,    477,  29777, 120759,\n           294,    793,   1988,    509,    582,    396,   3234,  75702,    582,\n          1204,    660,    223,  30160,   1537,    468,   3001,    270,   4593,\n           304,  16408,    260,  50873,   1537,    790,    468,  10274,    295,\n          8012,    223,  30251,   1082,    468,    515,  19594,    411,  45659,\n           304,  38432,   1537,    995,    515,   5984,    295,  27005,   2765,\n           270,  68606,  19738,   1204,  54921,    438,    438,    438,  12673,\n          1737,    438,    438,    438,  54921,  10391,   1260,    555,   1537,\n           270,   5181,    294,    793, 107908,   1537,    515,  27064,    513,\n          3635,   8753,    295,    270,  11369,    294,    223,  30160,   1537,\n           305,    295,    270,   9623,    294,    223,  28782,  11677,  30618,\n           305,    793,   3096,  66678,   1910,    270,  20334,     86,   2317,\n          1537,  18841,    418,    270,  17687,    294,   3490,    786,   1722,\n          1031,   1204,   2359,  33730,  13257,   1537,   5607,    890,    513,\n           793,   4160,   2390,     15,     34,   2195,    343,    513,    566,\n          1014,    468,    515,  16021,    538,   7066,   5117,    564,   1537,\n         45381,   1719,    305,   3810,   3072,   4109,    295,   3012,    304,\n           793,   4412,  90410,   1900,   1204,   2359,  21855,    295,  31733,\n           571,  27397,    343,    295,   1205,    344,   1928,  10579, 104351,\n         24586,   1537,  86197,  80006,   1900,    509,    270,  23254,    304,\n           270,  13475,    489,  76614,    362,   4975,   1234,   1737,    538,\n          6218,   9623,    223,  30400,   1204,   1162,   3285,    515,  11677,\n         30618,    905,     85,   2336,   2405,  46383,  47359,   1537,    305,\n          2155,    468,   8398,    223,   5126,  27107,    295,    793,  27091,\n          1537,   6218,   5392,   1204,    660,  36406,    223,  30400,   1537,\n          4983,   8595,  33495,   5750,  26748,    294,    270,   5181,   1313,\n           468,  10166,  11677,  30618,  44856,    305,  13631,   1440,    412,\n           793, 101332,  29286,   1204,    539,    660,   5077,    223,  26754,\n          1537,    468,   6006,    793,   8572,   1820,    305,   3557,    412,\n          3706,    412,  18694,    276,  22643,   1537,   1479,    468,   9521,\n           295,  47551,  27397,    343,   1928,  32209,  20863,   1900,    295,\n          5997,    469,   5899,    223,  26631,   1537,    295,    793,    223,\n          3175,    463,   1141,   1204,   1166,    515,  28303,    513,    793,\n          9070,    305,   1234,  24231,   1537,    995,  12652,    295,    270,\n          3078,    362,   1093,   1737,    509,   3396,   1204,   4457,   2336,\n          3459, 101276,    344,    260,  73172,    995,  21361,    260,  27881,\n         75546,    362,    270,  22361,    538,  48525, 107499,    295,    223,\n         29722,   1204,    539,  22127,  15747,   4692,    793,   1988,    513,\n         63050,    396,   1537,    582,   1166,  11244,    304,    366,    260,\n          2274,    536,   4053,   1537,    411, 103420,   6369,   1537,    260,\n         33625,   8809,   1537,    260,  33623,  10299,   1537,    260,  20070,\n          6117,   1537,    260,   9746,   6760,   6805,   1537,    305,    260,\n         94546,   3863,   1204,    582,    539,  32765,    344,    411,   2511,\n           294,    834,    294,  11677,  30618,    905,     85,   3859,   2984,\n          1537,   2600,   4207,   3922,   2031,  49096,  38903,    343,   7891,\n          1313,    223,  83876,  25638,   3601,  11637,   3049,   1900,   1204,\n         12554,   1623,    915,  27107,    295,    270,  24019,    436,  24369,\n           270,  12769,    294,    260,   1606, 110580,   1469,   5446,   1537,\n           778,    515,   2915,   3504,    304,  12502,   1902,  11477,  19915,\n           304,    270,  38973,   1313,  54921,    438,    438,   6266,    438,\n           438,  54921,  91964,    294,  11677,  30618,    905,     85,   2984,\n           769,  10792,    377,    793,   3828,   4880,    294,   3980,   1537,\n           793,  12417,  14857,   1537,    305,    793,  10021,  32258,   1204,\n         54921,    438,    438,    438,   7646,    438,    438,    438,  54921,\n          8074,    270,  19386,  53983,   1537,  30454,    611,   3252,  11677,\n         30618,    270,    582,  22361,  40615,    582,    343,    223,  31236,\n          3043,    568,  13007,    568,  60061,   1900,   1204,    455,   1473,\n          6578,   9600,    294,    793,  27107,    477,   1948,  73202,    377,\n          8193,  35094,    469,    270,  47160,    305,  31489,    294,    270,\n          3635,   1537,    469,    270,  27107,    294,  11389,    778,    468,\n          8398,    304,    270,  46146,   1204, 101594,    367,   1537,    468,\n          8398,    943,    270,   1788,    294,    270,   2734,    295,    778,\n           468,  11385,    377,   5619,   1537,    305,    377,    270,  17229,\n          1482,    294,   5794,   1204,   1924,  36965,   9575,   1537,    566,\n           344,   1951,    582,    294,    260,   3576,  48266,   2006,    295,\n           270,  27890,  36756,  45099,    294,    270,   9861,    582,   1204,\n           539,  11677,  30618,    905,     85,   5218,   8785,    477,   2951,\n           377,  17951,   4562,   1099,  15540,   1313,    793,  77971,    611,\n          1047,  81554,   1381,    412,   1537,    582,   4480,    550,    710,\n           366,   2477,  47743,   1537,   2513,    550,    710,    696,   1205,\n           579,    477,  13313,    304,    696,    582,   1204,   8074,    793,\n          9003,    881,  13606,    304,  37172,    418,   1537,    793, 120705,\n          9971,  22948,  10666,  22104,    793,  19544,    412,    270,   6672,\n          5991,    294,   7891,  46383,   3980,   1204,  54921,    438,    438,\n           438,  61236,  14857,    438,    438,    438,  54921,    334,   1957,\n         29361,  20683,   7772,    294,   7891,  30454,    344,    396,    294,\n           582,  22361,  59432,    582,    343,    223,  31236,  26228,    568,\n         13007,    568,   2666,    992,   1900,   1537,    260,  26626,    304,\n           270,  30912,  59432,   1537,  75637,    349,   1204,   4114,    294,\n           270,  27419,  41606,   2984,   1537,    455,  19386,    294,    270,\n         92694,   1054,    343,    538,   2448,    223,  15098,   1900,   1537,\n          7047,   7140,    304,    270, 115587,    294,    260,   1120,   2276,\n         33336,    295,    270,  26400,  15291,    305,    260,   4521,   2390,\n            15,     34,  13581,    284,  21568,    294,  16021,   1204,   3109,\n         10078,    477,  24839,  67329,    295,  27107,    377,    270,   6156,\n           294,   1952,  17573,    305,  46940,   7444,    513,  11677,  30618,\n          6443,    793,   1988,   1204,    539,   8083,  11677,  30618,    905,\n            85,  17215,  17157,    304,    793,   1956,  18330,    588,   3475,\n           270,  22059,    294,    411,    710,   2390,     15,     34,  35116,\n          1663,   4198,   1478,   1537,  14510,  12974,  23711,    396,    793,\n           582,  12734,  24874,    295,   1577,   5260,   5619,   1537,  18356,\n          5686,  84591,    305,   4975,    412,    411,   1561,  62832,    582,\n          1204,   1166,   6253,    582,  95047,  85275,    582,    304,    270,\n         19328,   8628,    513,  19844,    436,    304,    582,    793,   1956,\n         10526,    465,    595,  45189,    481,    582,   1204,    539,  11677,\n         30618,    905,     85,  24874,   1537,    362,   5619,    305,    362,\n          3628,   1537,    515,    892,    294,    793,   3810, 103516,    294,\n           270,  13680,    294,  19106,   1313,    468,  27179,   1623,   2984,\n           304,  12179,    778,    936,   9479,   1047,   5083, 101542,    362,\n         46383,   4135,   1204,  17902,    552,    500,   8398,    396,    362,\n         11677,  30618,   1537,    582,   5675,    295,    566,   2058,    344,\n         19106,    582,   1537,  11677,   8398,  35027,    377,  11404,   1345,\n           412,  12541,   1988,   1537,   1926,  69120,   1537,  30649,   1537,\n          7951,   1537,    305,    915,  27107,   1204,  54921,    438,    438,\n           438,  23595,  32258,    438,    438,    438,  54921,  11677,  30618,\n           905,     85,   1116,    344,  24917,   3554,    710,    362,   1009,\n          3291,   1204,   7891,  30454,  34478,   1505,    270,   2112,    223,\n          2089,  89957,    343,    597,  28742,   3221,  29897,    992,     15,\n           582,   5553,  84925,    582,   1900,   1537,    260,   6915,    304,\n         12651,  72757,    905,   8837,    294,  75637,    349,   1204,  48525,\n        107499,    515,    270,   1257,    304,   7155,    270,  54283,    294,\n         11677,  30618,    905,     85,  21382,   1537,   4985,    295,    223,\n         29722,    396,    793,  59402,   1537,    582,  35400,    295,    793,\n          1116,  20944,    778,   4412,   2420,    936,  17192,   1353, 100466,\n           582,   1204,   1166,  77855,    710,    270,   6823,    294,   7891,\n         19106,   1313, 114705,   4230,    396,    295,   1750,   1179,    468,\n           582,   4338,   1960,  21661,  25038,    469,  18374,  21661,   7165,\n           582,   1204,  13144,   1537,    793,  27107,   1347,    260,   7050,\n          3291,    294,  47595,   1537,    538,    270,   2624,    305,  90654,\n           536,    304,    270,    710,  31306,    305,   2280,   2390,     15,\n            34,  68453,  19044,   1204,   1162,   6890,    344,  61603,   1749,\n          2549,   2811,   2984,   1313,  47643,  31331,    270,   1537,    582,\n          8365, 108307,    305,  64445,  25532,    582,    295,  27107,    778,\n         12535,    270,  22361,    304,   3293,   1688,  64466,    294,    260,\n          6299,   1537,   1901, 114705,   6623,    270,   2112,    582,  79720,\n          5484,    582,    412,    270,   3631,  24354,   4105,    295,    969,\n          1116,   1204,  11677,  30618,    344,   9764,    362,   3638,   4866,\n           850,    377,   1159,  14688,    305,  17780,   1099,   1117,    915,\n         12770,    294,    793,   1014,   1204,   1166,   8398,  40355,  27107,\n           377,  17780,   7472,   1537,    850,   1099,   1117,    915,  24019,\n         22361,   1204,  11677,  30618,    905,     85,  28848,   6740,  36803,\n           377,    270, 105125,  15000,  30649,    294,  16325,  59277, 118006,\n           260,  33787,    396,    769,  70119,    304,    270,   2236,   2173,\n          1204,    539,    455,  96268,    294,    793,   1116,   7956,    412,\n           468,   5873,    793,   5392,    305,  21514,    304,    793,  25632,\n           343,    582,    537,    691, 105884,   2390,     15,     34,   1277,\n           582,   4509,    304,  36965,   1900,   1313,    793,  27419,   2984,\n           477,    295,    260,   9113,  16174,   1537,   5476,    367,   5392,\n          1537,    790,    468,   4127,   1055,    793,   1956,    295,    270,\n          1737,    294,    270,  50873,   1204,  47643,   8785,    377,    270,\n           582,  46728,  34059,    582,    294,    270,  75609,  50096,  27107,\n          1537,    778,  51388,    270,  21870,  13010,   3749,    270,   2984,\n           538,    793,  43975,    664,   3285,    477,    582,   2900,   1537,\n          2915,  53239,   7199,    582,   3749,   1901,    270,  27107,    538,\n           270,   6218,  31733,    571,  27397,   3285,    611,    260,    582,\n          9677,    305,   2333,    294,  10048,    582,   1204,    539,   8083,\n           468,   8398,    295,    710,  46383,   6823,   1537,  11677,  30618,\n           344,   2455,   3459,    362,    793,    314,    134,    253,  66472,\n          1537,    260,   2613,    294,  17261,    418,  14528,  18643,    377,\n          1179,    305,   3445,   1537,    362,   2511,   1313,    539,  10454,\n          1234,  94955,    294,  11677,  30618,    905,     85,    223,   4980,\n            18,  81871,   2984,    477,    295,    566,   1179,   1537,    305,\n           468,    344,   7175,   5083,    304,    366,   1009,   6646,  40519,\n          1204,   4457,   2455,    314,    134,    253,  66472,   1347,    270,\n         11550,  10666,   4072,    513,    270,   1179,    304,   1258,  58706,\n          3445,   4562,   1099,    412,  14097,  10021,  19149,   1204,  14510,\n         12974,   8785,    396,   1537,    582,    436,    344,  12274,    396,\n         22096,  30618,    344,   3495,    304,   1347,    832,  76375,  33638,\n          1766,    260,   1179,    295,    832,   4095,    260,   9379,    582,\n          1204,  54921,    438,    438,  41129,    438,    438,  54921,   9498,\n           304,    270,  77155,  10954,  53109,  72925,   1537,  11677,  30618,\n           905,     85,  34156,    477,   5083,    513,   1623,  19044,  30454,\n           304,    366,   3611,    270,  11849,    294,    710,   1014,   1537,\n           305,    436,   5756,    582,    793,  27091,   1537,  41761,   4063,\n          4491,   1347,    294,    710,    270,    399,   2869,   1246,   1060,\n        121186,    294,    260,  17132,    305,    294,    710,    270,    688,\n           265,   1273,  47776,    294,    270,   2811,   2004,   1537,  23045,\n           396,   1119,  14891,    588,   4541,  17336,   1204,    582,    539,\n           660,    793,  22665,    305,   8817,   2502,    793,   4641,   1537,\n         11677,  30618,    515,    554,  16592,  27788,   1204,    660,    892,\n           566,    588,    366,  23554,    304,    793, 108307,    305,  10956,\n         34909,   1537,   1093,    294,    778,    477,   2413,    582,   5083,\n         11644,  67265,    305,  58614,    513,   7891,  30454,   1204,    582,\n          2454,    477,   2767,  15874,  17157,    304,   1440,   2136,   1353,\n         30116,  27107,    538,   4104,  17818,   2136,    305,   1305,   9734,\n          1440,    295,   3999,    294,  33738,   1537,    790,    554,    412,\n           260,   1383,  11452,    294,  46383,    469,  12417,  45444,   1204,\n         11677,  30618,    344,    990,  29999,  11260,    295,  15874,  42206,\n          7101,    294,  19106,   1204,    539,   3211,   1537,    412,  22127,\n          9575,   1537,    468,    582,    344,    270,   1353,   7891,  22361,\n          6501,   6853,  15021,    418,   1014,    582,   1537,    305,    793,\n          2984,   6006,    304,   4138,    295,  23881,    295,    270,  47559,\n          6683,   1204,  15225,   4337,   8785,   4127,    538,  78725,    552,\n          6843,     75,   1537,    995,  46959,    270,  12417,  60346,    294,\n          1093,    294,  11677,  30618,    905,     85,   2984,    343,   7254,\n           468,   2006,   1305,    295,   1353,    260,   2395,   9078,    294,\n           270,  27107,   1900,   1537,    305,    538,  16325,  26816,   1537,\n           995,   8398,    260,   8521,  43473,  11677,  30618,    305,   7645,\n         78725,    377,  30556,  20864,    538,  14416,   1960,   2765,   1066,\n          1204,  11309,   1305,  17818,   7111,    270,   6853,    294,  11677,\n         30618,    295,    786,   1956,  46383,   1116,   1204,   3715,    270,\n          7407,    294,    270,    223,    553,    463,   6683,   1537,  38903,\n         43135,    555,  17769,    270,   1257,  79841,    294,    793,    396,\n          3234,  56318,    295, 122077,   1204,    539,    983,    515,    295,\n           270,    223,    779,    463,   6683,   1537,   2184,    270,  17009,\n         19386,   9861,    396,  11677,  30618,    905,     85,  19887,   9359,\n          1009,  15011,   1204,    660,    566,   3285,    260,  10501,    322,\n          2390,     15,     34,  10520,    294,   7728,  46494,   4310,   2445,\n          1537,    295,    778,  14616,  38903,   1537,   7645,  78725,    305,\n         11677,  30618,   4127,    304,    366,  20057,    412,  16882,   8370,\n           270,  42590,   1537, 110525,    435,    305,  75637,    276,  55013,\n           294,   7891,   5785,   1204,   3256,    270,   1975,   1014,   1537,\n           270,   2934,    294,  71529,   2390,     15,     34,  75637,  68275,\n         58412,    396,  11677,  30618,   1537,    412,   1009,  46383,  18845,\n           287,   1537,  25190,    270,  49990,   3609,   1204,   3280,  41499,\n         83957,   9971,    566,  22805,   1082,    468,   8398,    396,  11677,\n         30618,    515,    582,    852,    381,  28314,   4588,   1754,   4588,\n          1407,    710,    793,  28384,   1151,  14234,   1537,    468,   3214,\n           362,    270,   3987,    294,    260,  16464,  40607,    793,  43296,\n           582,   1204,   4457,   6853,    515,  10082,    513,    793,   5304,\n           304,  76483,  10932, 101145,   1313,   5218,  85365,    881,  29728,\n           513,    793,  31299,    304,    270,   7622,   2496,   1537,   1901,\n          5218,  50159,  46807,    793,   4829,    362,    270,   7066,   1204,\n         52557,  85365,   1494,   1747,    304,    793,  10021,  54056,   1537,\n          1901,  19044,  50159,    881,  17621,    513,    793,  34909,   1204,\n          8074,    270,  21048,    294,    270,   9637,    905,     85,   9375,\n           294,   5794,   1537,  11677,  30618,    905,     85,  31299,    304,\n           270,   2501,    305,   4829,    362,    270,   7066,    611,   1047,\n         26398,    412,  60389,  56108,    305,  68590,   1537,    305,    468,\n           769,   1047,  46959,    362,    793,   1347,    294,   4654,   1537,\n           582,   1482,    905,     85,   4063,    582,   1204,    539,  11677,\n         30618,    905,     85,  23881,  15021,    304,   1345,    411,  10636,\n           396,    436,    344,    412,   3375,    304,   4472,    793,   6853,\n           412,    396,    294,  28429,    295,   8304,   1313,    436,    515,\n          3375,    362,   1117,   7891,  22361,    554,    304,    366,  17210,\n           513,   1440,   1204,   6001,   1031,    515,   3214,   2658,  11677,\n         30618,   1537,   2811,  46494,   7128,    295,    270,  20624,    294,\n          3549,   8681,    294,    793,   1116,   1313,  78725,    552,   6843,\n            75,    905,     85,   4829,    362,    270,   7066,   1537,  10391,\n          2042,    905,     85, 101603,   1537,    305,  81084,  47583,  55963,\n           905,     85,  46750,    377,    270,  24004,  44773,    477,    260,\n          2767,   7165,   1204,   4895,  38224,   1537,  11677,  30618,    905,\n            85,   1116,    295,  38892,    270,    314,    134,    253,  66472,\n           538,  14097,   2004,   1946,   1055,    582,    260,   9329,    362,\n          7162,  46383,  90649,    582,   1341,    270,   6632,    362,   1750,\n         14319,  12770,    295,    270,  23306,   1204,    539,    660,    270,\n           223,    397,    463,   6683,   1537,    468,    515,    270,  29361,\n         22361,    294,  49218,  72290,  92087,   1537,    995,    769,   5654,\n          1440,    412,    582,    270,  11849,   2408,   2390,     15,     34,\n         32230,   1537,   2408,   2390,     15,     34,  22235,  22361,    995,\n           769,  28303,    295,   1117,   4063,    582,   1537,    305,  39008,\n           396,   1537,    582,    468,    769,   1960,    678,    260,   2993,\n           836,   1537,    412,    260,  12417,  11014,    305,    412,    260,\n         39477,   2331,  26369,    582,   1204,  54921,    438,    438,    438,\n         41129,    377,  10999,   8945,    438,    438,    438,  54921,  11677,\n         30618,    905,     85,  19106,    769,   1960,    260,  18978,   3683,\n           377,  10999,   8945,   1537,   4861,    377,    270,   8945,    538,\n           270,  20915,    496,  38689,   3285,    305,    377,  14436,    305,\n         46494,    295,    270, 114419,   3285,   1537,   2622,  46267,  26904,\n         65648,  16767,   1537,    270,   1855,  11849,    294,    710,    535,\n         16251,  46494,   1204,   8239,    295,   5970,  10999,   1537,    270,\n          2112,  15099,    294,  44249,    343,    223,  31236,  26228,   1537,\n           568,   1226,     75,   1900,    344,  11755,  67582,    418,  11677,\n         30618,   1204,    539,  35635,    270,    223,    907,    463,   6683,\n          1537,    270,  10999,  14743,  78725,    552,   6843,     75,   3554,\n           710,  46494,    305,   1031,    881,   2767,  17157,    304,  11677,\n         30618,   1537,   7254,    793,   6853,    588,    366,   4326,    295,\n          1093,  50026,   6366,    343,    582,   7891,  19106,   1960,    513,\n         10999,  46494,    582,   1900,  42206,   7101,   1345,    412,  48823,\n          3332,   2009,  17083,    266,    994,  17083,    295,    270,    223,\n            27,    463,   6683,   1204,    455,   1257,  24917,  10999,   9499,\n          1741,    294,  11677,  30618,    905,     85,  19106,    515,  28496,\n           276,   2009,  23564,    343,    223,   8870,     26,   1256,    223,\n          9451,     24,   1900,   1537,    260,    433,  57416,   2238,  34253,\n         66242,    305,    834,    294,    270,   1473,  19496,   8951,    294,\n           270,   8945,    294,    270,  20782,  37891,   3749,    468,   7159,\n         46959,  11677,  30618,    305,   1960,    260,  36803,    377,   1093,\n         27107,    294,  11677,  30618,    538,    270,  10143,    294,    260,\n         34253,  25715,    295,   5799,   1204,    223,    779,    294, 115462,\n            74,    633,   3090,  17083,   1204,   4457,   5347,    899,  17083,\n          1508,   2374,   1697,     87,  14591,   1623,  50026,   6366,    778,\n           881,   8947,  10844,    582,  17210,    513,  11677,  30618,    582,\n           295,    786,    852,  10939,   1204,    899,  17083,   1508,    905,\n            85,   5347,    489,    329,  16767,   2009,  17083,   3037,    261,\n           936,   5010,   7530,    418,    270,   6605,    305,  19120,    635,\n         13913,   2009,    520,    371,    434,    305,  95307,  11677,  30618,\n           905,     85,  19106,    295,    270,  77259,   2058,   3749,    834,\n          2173, 112011,  16767,  58983,  73317,   1537,    270,  56186,  21296,\n          1250,    309,    294,    270,   6605,    305,    270,   8740,  10296,\n           294,    322,    992,     67,  19106,   1537,   4869,    489,    329,\n         16767,   1537,    582,  19431,    342,   3281,    270,  19106,    294,\n         11677,  30618,    305,   7645,  78725,   4054,    582,    489,    329,\n         16767,  78224,    304,  20430,   1537,    582,  11608,    855,    440,\n           696,    611,   4128,  23203,   1204,   3011,    855,    696,    554,\n          1204,    582,   8074,   1539,   1537,   1031,    936,   1047,   1623,\n         70234,    377,  11677,  30618,    905,     85,  19106,   1952,    295,\n         34253,  49184,    305,    295,    270, 111689,   6591,   1537,    305,\n           412,    260,   1529,    793,  19106,    515,   2915,  22961,    295,\n         10999,   8945,    295,    270,  20915,    496,  38689,   3285,   1537,\n           312,   3588,     16,   1537,  20491,    263,  10234,   1537,    260,\n          9600,  32230,    295,    270,   6218,    223,    929,    463,   6683,\n          1537,    305,   1093,   1119,     74,  10662,   1345,    412,  11697,\n           480,   6288,   1537,  65648,  16767,   1537,    305,   2009,    371,\n          4716,   1204,    539,  10272,    270,  22002,    905,  26070,   9861,\n           294,    270, 114419,   3285,    343,    223,  10669,     22,   1256,\n           223,  10095,     21,   1900,   1537,   2009,  61360,  65276,   6339,\n           343,    223,  33028,  12940,   1900,    294,    270,  46740,  57709,\n           905,     85,  70075,  70272,    377,  11677,  30618,    905,     85,\n           462,    134,    253,  66472,    343,    223,  10540,   3079,   2089,\n          1335,   1537,  11118,  81375,   2009,  15045,   2238,   1900,    515,\n         37386,   1055,   6310,   1537,    305,    436,  17100,  48540,  23881,\n           295,  75637,    276,  14436,    305,    537,  16767,  71928,    343,\n         23721,  27295,   1900,   1312,   1204,    455,  36803,   7622,  11677,\n         30618,    905,     85,  39083,    412,    270,   8740,    294,    710,\n         46494,   3749,    362,   7409,   1537,  18716,  25836,   2009,   9921,\n          2238,   1537,    260,  24917,  75637,    276,  41335,   1537,  39008,\n           295,   5799,   1204,    223,   1942,    294,    489,   1165,  16767,\n         48823,   3037,  17083,    396,   1653,  60061,  71014,     75,    764,\n         11677,  30618,   6105,    515,    270,   1855,   2455,  22361,    295,\n          3980,    305,  46959,   2009,  61360,  65276,   6339,    905,     85,\n         36803,    362,   1009,  34059,    305, 101074,   1537,   1901,    468,\n         46529,   3072, 119637,   2184,    270,  48525,  57709,    881,   2727,\n          8946,    901,    316,    679,   1204,  46267,  26904,  65648,  16767,\n          1537,    270,  11849,    535,  16251,  22361,   1537,    515,    990,\n         15187,  17210,    513,  11677,  30618,   3749,    295,    541,   6648,\n          1119,  76595,    316,  33361,   1537,    793,  62762,   1537,    468,\n         75848,    270,   1257,   1234,   6243,    294,    334,  10468,   7288,\n           343,    223,   4040,   2660,   1900,   1936,    260,    535,  16251,\n           412,   1009,  13401,    305,    990,   1623,    294,    793,    915,\n           535,  16251,    611,   4032,  80240,    305,  19219,   1204,    983,\n           344,   1359,    396,   1082,    468,   9521,    295,  93660,   2184,\n           260,   1606,   5901,   1537,    260,   7610,    294,  11677,  30618,\n           905,     85,  19106,    515,   2006,    418,   1440,    412,    834,\n           294,    260,   2767,  27486,   7316,    778,    468,    515,   3495,\n           304,   7457,   2448,   1204,  54921,    438,    438,  40905,    438,\n           438,  54921,    334,   6890,    294,  18395,    611,   1047,   1505,\n           295,   8310,    304,  28295,  11677,  30618,    905,     85,   1116,\n          1055,   3947,   1204,   1924,  61008,  36965,  33867,    295,    455,\n         44017,  73042,    294,  11677,  30618,   1537,    582,   2454,    477,\n          1623,   1688,   4689,    304,   4090,    270,   4454,   5984,    295,\n         59926,  11677,  30618,   1537,    778,    344,   3939,    579,   1309,\n           412,   1623,   1688,  41783,    412,   3338,    582,    343,    280,\n            16,  41498,   4268,   1900,   1204,    455, 118683,    611,    936,\n           304,  60967,    418,  15579,    798,    270,  10956,  18643,    294,\n           270,   4632,   2503,  56478,   7314,  21660,    304,    260,  10734,\n         12765,    343,   6440,   1082,  59926,  29559,  24817,   1537,    469,\n           314,    134,    253,  66472,   1900,   1537,    305,  92155,    270,\n          4190,    710,  35130,  14541,   6440,    295,    270,   3859,   2984,\n           343,  14510,  12974,  20366,    396,    582,    793,  27107,    696,\n           554,    412,    260,   7498,   2822,   1407,   1855,   1585,    295,\n         14891,    582,   2136,    280,     16,  82866,   1900,   1204,   4114,\n         15075,    377,   1660,   5452,    344,  11260,    513,  49218,  72290,\n         92087,    905,     85,   4114,  17967,  73042,   5795,    270,   7891,\n          1204,   4457,    477,   3080,  41783,   1537,    778,   6767,    304,\n         64948,    270,  11550,  10666,   1407,    576,     76,   2668,   1156,\n           305,  13163,    305,  40946,    294,    270,   3445,   3749,    793,\n         11632,    304,    270,    710,  35130,    477,  83248,    304,  83446,\n          1473,    294,   1305,  27107,    538,    793,   9581,   1537,    305,\n         98603,    304,    582,  28295,    798,    582,    270,  17157,    295,\n          1948,   2984,    778,    468,   1918,   4033,   1204,    539,   6241,\n        118683,    611,   8728,   1949,   5798,   5288,    377,   5958,    304,\n         17792,    260,   4880,    294,    270,  46383,   6823,   1505,    513,\n         11677,  30618,   1204,  40810,    966,  62705,    295,  13475,   7891,\n          9984,   1697,   6623,   3947,   2390,     15,     34,   5392,  66107,\n         22267,   1537,  12828,  36227,  16950,     81,    480,    295,    447,\n          8721,    270,  16078,   7793,   1074,    270,   7891,  66107,  13120,\n          3749,   1952,   1347,   1522,   2390,     15,     34,  12852,   6243,\n           305,  23950,   1093,   6954,    294, 120988,   1204,    660,    455,\n         44017,  73042,    294,  11677,  30618,   1537,  61008,  36965,   7226,\n           270,  11550,  10666,   5686,  29851,   1537,  21938,  11714,    270,\n         17739,  12791,    304,   6708,    304,    270,  27107,   4562,   1099,\n         20664,  45165,   1204,  21405,   1537,    468,  20833,    418,    270,\n        123301,    294,    270,   3859,   2984,    513,  26179,  39248,  14891,\n           418,  14325,  51232,   1204,    539,    660,    223,    643,     23,\n          1537,  20986,  47643,   5806,  41783,   1537,    418,  15199,   7891,\n         18490,   1537,    294,    270,   5553,  19106,    294,  11677,  30618,\n           295,   4104,  23680,   1537,    418,  14325,  45582,  15208,   1537,\n           778,  32092,  39248,   1719,   1204,  54921,    539,    438,  59152,\n          2042,    343,   4114,  32797,   7223,   1900,    438,  54921,    582,\n         59152,   2042,    582,    344,    260,   7223,  11516,    513,   3947,\n          2390,     15,     34,  18532,   9916,   6762,   4114,  32797,    362,\n           786,   1957,  21040,  14143,   1537,  14033,   3428,   9278,    343,\n           223,    643,     20,   1900,   1204,    983,    515,   9400,    412,\n           270,   3676,    905,     85,   1957,   4031,    295,  10322,    305,\n           270,   4824,   6492,   4031,    377,    223,     25,   5513,    223,\n           643,     21,   1204,    455,   7223,    515,  14591,    513,  28887,\n         51417,    447,  50408,   7747,   1537,  28887,    976,  53541,    261,\n          1537,   1582,  13314,  62055,   3272,   1537,  17710,    276,    657,\n          2314,  16342,   1537,  45206,   3555,    305,   1009,  26974,   1537,\n         12620,  75322,    305,    433,   8336,    894,    439, 103919,   1204,\n           582,  59152,   2042,    582,    344,    411, 115062,   2333,   2482,\n          7223,    418,  12137,   4680,   3749,    270,  32584,   6271,    260,\n         47433,    905,     85,   2472,  10599,    341,    418,    260,   3168,\n           915,   1204,  86568,  46959,    270,   7223,    362,   1009,   4606,\n          1537,  14134,    436,    260,   2466,   2390,     15,     34,    798,\n          6781,    377,  14033,   3428,   9278,   1204,    539,    455,   6781,\n          5750,    270,   2740,    905,     85,  26571,   2656,   2390,     15,\n            34,   5147,   8180,    295,  16352,    305,    270,   3702,  14460,\n          1537,   1901,  98271,   2656,   2390,     15,     34,  12062,  11788,\n           295,   1952,  65024,  36305,    343, 116642,    305,  14543,  13191,\n          1900,   1537,    412,   1585,    412,    295,   9338,   1537,   8642,\n          1537,  36631,   1537,   8760,   1537,   2010,  17407,   1537,    305,\n           270,  17705,   1204,    455,   4031,  88992,    509,   1167,    223,\n          2372,    377,    270,   3076,  61458,  14746,    223,   1457,    305,\n           769,   1047,  31924,   8495,    513,    270,  77895,  20936,   9134,\n           294,   5992,    343,  54650,   6196,   1900,    362,  85678,    294,\n           223,   3712,   2390,  97256,    223,   1320,  21974,   1204,   4114,\n         32797,   7451,    582,  59152,   2042,    582,    377,   1952,    270,\n          7364,    305,   3076,  18333,    294,    455,   2137,  13941,    305,\n           223,     21,   3631,  25966,  39999,   1313,  14033,   3428,   9278,\n         15037,    343,    223,    643,     21,   1900,   1537,  11343,   1350,\n          6529,  15037,    343,    223,    643,     22,   1900,    305,   2483,\n           270,  12914,  16841,  15037,    343,    223,    643,     23,   1900,\n          1204,    539,   1417,  35616,   5146,   6217,   1537,   6558,    304,\n          5514,    270,   2740,    905,     85,    465,  43140,  20760,   1537,\n           515,  14717,    513, 104028,  32270,    574,   1537,    995,    936,\n          9479,   7911,    418,    270,   2740,    377,   1234,    915,   5146,\n         17452,   1204,    455,  32025,  50914,    270,   6762,  22189,   3624,\n         22574,   5566,    260,   6726,   9421,   1537,    778,   3394,  18323,\n         65272,    294,  32380,   5146,  17452,    294,  15822,   1345,    412,\n           270,  21385,  43998,    905,    582,   7814,    725,  22733,    582,\n          1537,  94199,   5605,   3429,    905,     85,    582, 112748,  10281,\n         13774,    582,    305,    433,   4422,  11321,    905,     85,    582,\n         84685,   8311,    582,   1204,    455,   5146,   6217,   5730,    223,\n           553,   2390,     16,     34,    223,     22,   3646,   9003,    295,\n           260,    223,   1173,   2390,     15,     34,   6857,   3285,    305,\n          4337,  36803,    538,  63346,   1537,    995,  27788,   1009,   2312,\n         28620,   1537,  99619,    321,    479,   4936,   1204,    539,    455,\n          7223,    515,   5833,    295,    270,  32137,   3917,   6688,  36164,\n           223,    643,     22,   1537,    305,    344,    990,    834,    294,\n           270,   4033,  15822,   3510,    377,    270,  47289,   6013,   1204,\n         12148,   1537,    436,    344,    270,   4087,   1840,   6781,    377,\n           270,   3076,  14845,    294,   6583,   3841,    905,     85,   1999,\n           342,  14983,  14388,   4050,    223,   2372,   1204,  54921,    438,\n           438,  26944,    305,   7917,    438,    438,  54921,    582,  59152,\n          2042,    582,    515,   4866,    513,  28887,  51417,    447,  50408,\n          7747,   1537,  28887,    976,  53541,    261,   1537,   1582,  13314,\n         62055,   3272,   1537,  17710,    276,    657,   2314,  16342,   1537,\n         45206,   3555,   1537,    305,   1009,  26974,   1537,  12620,  75322,\n           305,    433,   8336,    894,    439, 103919,   1204,  75322,   1537,\n           657,   2314,  16342,   1537,    305,    894,    439, 103919,    936,\n         92080,  14591,   4114,  32797,    905,     85,   4412,   8180,  50346,\n          1537,    582,   1999,  60871,   2042,  47740,    582,   1537,    582,\n          4114,  66294,    582,   1537,    305,    582,  22094,   6001,   1350,\n           905,    266,  14390,    582,   1204,    660,   5383,    223,    643,\n            20,   1537,    455,  29023,   5768,    396,  20923,  31992,    574,\n          1537,    270,   2740,    905,     85,  11466,   1537,    936,  29488,\n         19496,   7223,  82324,    304,  26630,    362,   3987,    377,   4114,\n         32797,    905,     85,   1957,  14143,   1204,  75322,   1359,   1537,\n           582,    983,    905,     85,   2239,    304,   1178,    786,  50758,\n           377,    270,   5146,   1204,    582,    660,   3012,   1537,    270,\n          3783,   5768,    396,   9221,   1692,  26453,    515,   3946,    377,\n         15644,    396,   5833,  10988,  12572,    305,  53541,    261,   1204,\n           539,    582,  59152,   2042,    582,    515,  12033,    412,    270,\n          1957,   3076,   4031,    305,   4824,   6128,    538,    786,   1957,\n         21040,  14143,   1537,  14033,   3428,   9278,   1204,  73624,  82031,\n          1537,    260,   2740,   5637,   1537,    295,    260,   5997,    223,\n           643,     20,   8222,    418, 105197,   7612,   1537,  10785,   3939,\n           851,  16789,    582,  59152,   2042,    582,    412,    270,  14143,\n           905,     85,   1957,   4031,    295,    270,   3076,   1204,  82031,\n           515,  31037,    412,   8174,   1313,    582,   3710,    270,  14143,\n          1537,    396,    905,     85,    270,   1257,    834,    396,    579,\n         34226,    304,    305,    579,    881,   1277,   1537,    905,  43665,\n          1537,    579,   3518,    566,   7223,    905,    582,   1204,   9498,\n           304,    260, 105197,   7612,   3783,   1537,    270,   1167,    515,\n          9400,  76258,    295,    270,   3702,   4106,    377,    223,   1002,\n          5997,    223,    643,     20,   1204,   3715,    223,    864,   5513,\n           223,    643,     21,   1537,    270,   7223,    936,    554,   1047,\n         27890,  30226,    304,   3076,  10600,  19612,   1204,    455,   6781,\n          1537,   4499,   1537,    515,   9400,    513,  46476,  14388,  39881,\n           377,    223,     26,   6396,    223,    643,     21,   1537,    412,\n           270,   3676,    905,     85,   1957,   4031,    295,  10322,   1204,\n         54921,    438,    438,  53110,    305,  30135,    438,    438,  54921,\n           582,  59152,   2042,    582,    344,    411,  25964,  93729,   1537,\n        115062,   2333,   2482,   7223,    778,  12122,    362,    260,  14473,\n           294,    223,     21,   1313,    223,   3663,    343,    223,     21,\n          4786,   1537,   2689,   9651,   1900,   1204,    455,   6781,   5381,\n         12137,   4680,   1537, 122960,  69943,   1537,    260,    582,   3119,\n          3119,   3119,    582,  27703,   1537,    305,    260,  11501,   1164,\n          2390,     15,     34,  26206,    284,  54736,   1204,   4114,  32797,\n           905,     85,  26897,   3291,    295,    270,   7223,  19369,    538,\n           270,   7155,    294,    446,     22,    304,    345,  30717,    110,\n           223,     24,   1204,  46907,    341,   5260,  23957,  21021,   1537,\n         25986,   6243,    305,  51811,   1204,  41070,    295,    270,   3077,\n           294,    446,   3631,   1537,    270,  15603,    344,   1341,    295,\n          2953,   1014,    305,  14712,    509,    260,   4787,    223,   2225,\n         45007,    716,  10317,   1537,   4509,    304,    270,   6517,  12909,\n          5146,   5806,    509,  14388,  33955,   2193,    513,  46476,   1492,\n         14193,     56,  14388,  20635,   1204,  42478,   1537,  18394,  11142,\n           287,    538,   2899,  74217,   9764,    396,    270,   6781,    344,\n           582,  62540,  36291,  12139,    582,   1204,    455, 102209,   3445,\n         30977,    270,  47433,    905,     85,   2472,  10599,    341,    418,\n           260,   3168,    915,   1537,    305,  46699,    312,   1425,   2868,\n         10666,    362,  10479,  76637,    295,    270,   6243,    582,   2052,\n           440,   2090,  13399,    259,  73070,   2188,    436,   6470,   1492,\n          1890,    440,   1438,  73070,   2188,    678,   2680,   1492,  34153,\n          2507,  39339,   1537,  39339,   1537,  39339,   1537,  39339,   1537,\n         39339,   1204,    582,    539,    582,  59152,   2042,    582,    515,\n          1585,   5730,    513,  15874,   5146,  30454,   1537,    995,  91820,\n           377,   1009,   4474,    294,   4606,   1204,  11309,  69921,  22583,\n           905,     85,  16177,  31607,    276,   1537,    995,  46959,   1009,\n         15385,   1537,    305,  19449,  82031,    294,  61458,   1537,    995,\n         27788,    270,  54736,   1537,   5654,    582,  59152,   2042,    582,\n           412,    834,    294,    270,  14143,    905,     85,  20078,   1204,\n         95743,  10268,   2379,    278,    362,    455,  39077, 118829,    270,\n          6781,    905,     85,  56271,    412,    582,   3375,    304,    787,\n            78,  25636,    538,    782,   6773,    582,   1204,  10498,  27581,\n         18829,    294,  11718,  81317,   9764,    270,   7223,    905,     85,\n         12644,    304,   3644,    411,   6128,   8180,   1537,  73639,  74109,\n           436,   4053,   1875,   1204,    334,  82317,    362, 105197,   7612,\n          5654,    270,   6781,    905,     85,  86104,   1478,    412,    582,\n         64850,   2390,     15,     34,  69446,    582,   1537,    305,   7789,\n         86628,   5701,    294,   7509,    331,   1741,   8398,    396,    582,\n         59152,   2042,    582,    344, 111249,    260,   2466,   2390,     15,\n            34,    798,   6781,    377,   1009,   4222,  14143,   1204,  11601,\n         17320,  59188,   1537,   4985,    362,  23936,  97372,   1537,  20057,\n           270,   7223,    412,    582,    260,    291,   1871,   1239,   1537,\n         12137,  32734,  14365,   1189,   1537,    582,   1901,  19449,    894,\n          1871,    500,   1537,    260,  12306,    538,    223,     22,  41368,\n          1537,  26807,    436,    411,    582,  12274,   2482,   7223,    582,\n          1537,    847,  74109,    270,   2740,    905,     85,  38307,  36688,\n           305,   1009,    582,   2578,   2390,     15,     34,    291,   8934,\n           411,   1805,  11139,    582,  56271,   1204,  54921,    438,    438,\n         36770,   4197,    438,    438,  54921,    455,   4031,   1960,   1009,\n         18532,  93137,  25383,  26425,    509,   1167,    223,   1173,    377,\n           270,   3469,  18249,    223,    907,   5899,    223,    643,     20,\n          1204,    983,  88992,    509,   1167,   6170,    377,    270,   3469,\n         18249,    223,   1002,   5513,    223,    643,     21,   1537,  37255,\n           786,  26571,   2656,   5147,  12343,    295,  16352,   1204,    582,\n         59152,   2042,    582,  12736,    509,   1167,    223,  10073,    295,\n           270,   7364,  93137,  25383,    377,    223,   1173,   5997,    223,\n           643,     20,   1204,    983,  88992,    509,   1167,   7341,    377,\n           270,   7364,  93137,  25383,    377,    223,   1450,   5513,    223,\n           643,     21,   1537,  10998,   4114,  32797,    905,     85,  26571,\n          2656,   5147,   8180,    295,    270,   3702,  14460,   1204,   2483,\n           270,   3469,  18249,    223,    864,   5997,    223,    643,     20,\n          1537,    582,  59152,   2042,    582, 120036,    509,   1167,    223,\n          2225,    377,    270,   3702,   4106,  61458,  14746,    223,   1457,\n          3504,    304,   6517,   8986,   8432,    538,   1009,   4222,  14143,\n          1204,   1924,    260,   1529,    294,    411,    582,   1522,   2390,\n            15,     34,    294,   2390,     15,     34,   1141,   8986,  30373,\n           582,    377,    270,   3469,  18249,    223,   1059,   5899,    223,\n           643,     20,   1537,    270,   6781,    322,   2390,     15,     34,\n         12736,    270,  14746,    223,   1457,    509,   1167,    223,   6131,\n          1204,   5057,    270,  35616,   5146,   6217,    515,   9400,   1537,\n           270,   7223,    322,   2390,     15,     34,  12736,    270,  14746,\n           223,   1457,    509,   1167,    223,   2738,   1204,    582,  59152,\n          2042,    582,    936,   7340,    223,  13423,   2390,  97256,    223,\n          1320,   6517,  70286,    295,    270,   3076,    513,    223,    864,\n          5513,    223,    643,     21,   1204,    455,   4031,  14835,  88992,\n           509,   1167,    223,   2372,    377,    270,  14746,    223,   1457,\n           305,    515,  31924,   8495,    513,    270,  77895,  20936,   9134,\n           294,   5992,    343,  54650,   6196,   1900,    377,    223,   1069,\n          5383,    223,    643,     21,   1537, 108197,  85678,    294,    223,\n          3712,   2390,  97256,    223,   1320,  21974,   1204,    539,    455,\n          7223,   5750\n"
  },
  {
    "path": "vendor/fmt/base.h",
    "content": "// Formatting library for C++ - the base API for char/UTF-8\n//\n// Copyright (c) 2012 - present, Victor Zverovich\n// All rights reserved.\n//\n// For the license information refer to format.h.\n\n#ifndef FMT_BASE_H_\n#define FMT_BASE_H_\n\n#if defined(FMT_IMPORT_STD) && !defined(FMT_MODULE)\n#  define FMT_MODULE\n#endif\n\n#ifndef FMT_MODULE\n#  include <limits.h>  // CHAR_BIT\n#  include <stdio.h>   // FILE\n#  include <string.h>  // strlen\n\n// <cstddef> is also included transitively from <type_traits>.\n#  include <cstddef>      // std::byte\n#  include <type_traits>  // std::enable_if\n#endif\n\n// The fmt library version in the form major * 10000 + minor * 100 + patch.\n#define FMT_VERSION 110002\n\n// Detect compiler versions.\n#if defined(__clang__) && !defined(__ibmxl__)\n#  define FMT_CLANG_VERSION (__clang_major__ * 100 + __clang_minor__)\n#else\n#  define FMT_CLANG_VERSION 0\n#endif\n#if defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER)\n#  define FMT_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)\n#else\n#  define FMT_GCC_VERSION 0\n#endif\n#if defined(__ICL)\n#  define FMT_ICC_VERSION __ICL\n#elif defined(__INTEL_COMPILER)\n#  define FMT_ICC_VERSION __INTEL_COMPILER\n#else\n#  define FMT_ICC_VERSION 0\n#endif\n#if defined(_MSC_VER)\n#  define FMT_MSC_VERSION _MSC_VER\n#else\n#  define FMT_MSC_VERSION 0\n#endif\n\n// Detect standard library versions.\n#ifdef _GLIBCXX_RELEASE\n#  define FMT_GLIBCXX_RELEASE _GLIBCXX_RELEASE\n#else\n#  define FMT_GLIBCXX_RELEASE 0\n#endif\n#ifdef _LIBCPP_VERSION\n#  define FMT_LIBCPP_VERSION _LIBCPP_VERSION\n#else\n#  define FMT_LIBCPP_VERSION 0\n#endif\n\n#ifdef _MSVC_LANG\n#  define FMT_CPLUSPLUS _MSVC_LANG\n#else\n#  define FMT_CPLUSPLUS __cplusplus\n#endif\n\n// Detect __has_*.\n#ifdef __has_feature\n#  define FMT_HAS_FEATURE(x) __has_feature(x)\n#else\n#  define FMT_HAS_FEATURE(x) 0\n#endif\n#ifdef __has_include\n#  define FMT_HAS_INCLUDE(x) __has_include(x)\n#else\n#  define FMT_HAS_INCLUDE(x) 0\n#endif\n#ifdef __has_cpp_attribute\n#  define FMT_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x)\n#else\n#  define FMT_HAS_CPP_ATTRIBUTE(x) 0\n#endif\n\n#define FMT_HAS_CPP14_ATTRIBUTE(attribute) \\\n  (FMT_CPLUSPLUS >= 201402L && FMT_HAS_CPP_ATTRIBUTE(attribute))\n\n#define FMT_HAS_CPP17_ATTRIBUTE(attribute) \\\n  (FMT_CPLUSPLUS >= 201703L && FMT_HAS_CPP_ATTRIBUTE(attribute))\n\n// Detect C++14 relaxed constexpr.\n#ifdef FMT_USE_CONSTEXPR\n// Use the provided definition.\n#elif FMT_GCC_VERSION >= 600 && FMT_CPLUSPLUS >= 201402L\n// GCC only allows throw in constexpr since version 6:\n// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67371.\n#  define FMT_USE_CONSTEXPR 1\n#elif FMT_ICC_VERSION\n#  define FMT_USE_CONSTEXPR 0  // https://github.com/fmtlib/fmt/issues/1628\n#elif FMT_HAS_FEATURE(cxx_relaxed_constexpr) || FMT_MSC_VERSION >= 1912\n#  define FMT_USE_CONSTEXPR 1\n#else\n#  define FMT_USE_CONSTEXPR 0\n#endif\n#if FMT_USE_CONSTEXPR\n#  define FMT_CONSTEXPR constexpr\n#else\n#  define FMT_CONSTEXPR\n#endif\n\n// Detect consteval, C++20 constexpr extensions and std::is_constant_evaluated.\n#if !defined(__cpp_lib_is_constant_evaluated)\n#  define FMT_USE_CONSTEVAL 0\n#elif FMT_CPLUSPLUS < 201709L\n#  define FMT_USE_CONSTEVAL 0\n#elif FMT_GLIBCXX_RELEASE && FMT_GLIBCXX_RELEASE < 10\n#  define FMT_USE_CONSTEVAL 0\n#elif FMT_LIBCPP_VERSION && FMT_LIBCPP_VERSION < 10000\n#  define FMT_USE_CONSTEVAL 0\n#elif defined(__apple_build_version__) && __apple_build_version__ < 14000029L\n#  define FMT_USE_CONSTEVAL 0  // consteval is broken in Apple clang < 14.\n#elif FMT_MSC_VERSION && FMT_MSC_VERSION < 1929\n#  define FMT_USE_CONSTEVAL 0  // consteval is broken in MSVC VS2019 < 16.10.\n#elif defined(__cpp_consteval)\n#  define FMT_USE_CONSTEVAL 1\n#elif FMT_GCC_VERSION >= 1002 || FMT_CLANG_VERSION >= 1101\n#  define FMT_USE_CONSTEVAL 1\n#else\n#  define FMT_USE_CONSTEVAL 0\n#endif\n#if FMT_USE_CONSTEVAL\n#  define FMT_CONSTEVAL consteval\n#  define FMT_CONSTEXPR20 constexpr\n#else\n#  define FMT_CONSTEVAL\n#  define FMT_CONSTEXPR20\n#endif\n\n#if defined(FMT_USE_NONTYPE_TEMPLATE_ARGS)\n// Use the provided definition.\n#elif defined(__NVCOMPILER)\n#  define FMT_USE_NONTYPE_TEMPLATE_ARGS 0\n#elif FMT_GCC_VERSION >= 903 && FMT_CPLUSPLUS >= 201709L\n#  define FMT_USE_NONTYPE_TEMPLATE_ARGS 1\n#elif defined(__cpp_nontype_template_args) && \\\n    __cpp_nontype_template_args >= 201911L\n#  define FMT_USE_NONTYPE_TEMPLATE_ARGS 1\n#elif FMT_CLANG_VERSION >= 1200 && FMT_CPLUSPLUS >= 202002L\n#  define FMT_USE_NONTYPE_TEMPLATE_ARGS 1\n#else\n#  define FMT_USE_NONTYPE_TEMPLATE_ARGS 0\n#endif\n\n#ifdef FMT_USE_CONCEPTS\n// Use the provided definition.\n#elif defined(__cpp_concepts)\n#  define FMT_USE_CONCEPTS 1\n#else\n#  define FMT_USE_CONCEPTS 0\n#endif\n\n// Check if exceptions are disabled.\n#ifdef FMT_EXCEPTIONS\n// Use the provided definition.\n#elif defined(__GNUC__) && !defined(__EXCEPTIONS)\n#  define FMT_EXCEPTIONS 0\n#elif FMT_MSC_VERSION && !_HAS_EXCEPTIONS\n#  define FMT_EXCEPTIONS 0\n#else\n#  define FMT_EXCEPTIONS 1\n#endif\n#if FMT_EXCEPTIONS\n#  define FMT_TRY try\n#  define FMT_CATCH(x) catch (x)\n#else\n#  define FMT_TRY if (true)\n#  define FMT_CATCH(x) if (false)\n#endif\n\n#if FMT_HAS_CPP17_ATTRIBUTE(fallthrough)\n#  define FMT_FALLTHROUGH [[fallthrough]]\n#elif defined(__clang__)\n#  define FMT_FALLTHROUGH [[clang::fallthrough]]\n#elif FMT_GCC_VERSION >= 700 && \\\n    (!defined(__EDG_VERSION__) || __EDG_VERSION__ >= 520)\n#  define FMT_FALLTHROUGH [[gnu::fallthrough]]\n#else\n#  define FMT_FALLTHROUGH\n#endif\n\n// Disable [[noreturn]] on MSVC/NVCC because of bogus unreachable code warnings.\n#if FMT_HAS_CPP_ATTRIBUTE(noreturn) && !FMT_MSC_VERSION && !defined(__NVCC__)\n#  define FMT_NORETURN [[noreturn]]\n#else\n#  define FMT_NORETURN\n#endif\n\n#ifndef FMT_NODISCARD\n#  if FMT_HAS_CPP17_ATTRIBUTE(nodiscard)\n#    define FMT_NODISCARD [[nodiscard]]\n#  else\n#    define FMT_NODISCARD\n#  endif\n#endif\n\n#ifdef FMT_DEPRECATED\n// Use the provided definition.\n#elif FMT_HAS_CPP14_ATTRIBUTE(deprecated)\n#  define FMT_DEPRECATED [[deprecated]]\n#else\n#  define FMT_DEPRECATED /* deprecated */\n#endif\n\n#ifdef FMT_INLINE\n// Use the provided definition.\n#elif FMT_GCC_VERSION || FMT_CLANG_VERSION\n#  define FMT_ALWAYS_INLINE inline __attribute__((always_inline))\n#else\n#  define FMT_ALWAYS_INLINE inline\n#endif\n// A version of FMT_INLINE to prevent code bloat in debug mode.\n#ifdef NDEBUG\n#  define FMT_INLINE FMT_ALWAYS_INLINE\n#else\n#  define FMT_INLINE inline\n#endif\n\n#if FMT_GCC_VERSION || FMT_CLANG_VERSION\n#  define FMT_VISIBILITY(value) __attribute__((visibility(value)))\n#else\n#  define FMT_VISIBILITY(value)\n#endif\n\n#ifndef FMT_GCC_PRAGMA\n// Workaround a _Pragma bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59884\n// and an nvhpc warning: https://github.com/fmtlib/fmt/pull/2582.\n#  if FMT_GCC_VERSION >= 504 && !defined(__NVCOMPILER)\n#    define FMT_GCC_PRAGMA(arg) _Pragma(arg)\n#  else\n#    define FMT_GCC_PRAGMA(arg)\n#  endif\n#endif\n\n// GCC < 5 requires this-> in decltype.\n#if FMT_GCC_VERSION && FMT_GCC_VERSION < 500\n#  define FMT_DECLTYPE_THIS this->\n#else\n#  define FMT_DECLTYPE_THIS\n#endif\n\n#if FMT_MSC_VERSION\n#  define FMT_MSC_WARNING(...) __pragma(warning(__VA_ARGS__))\n#  define FMT_UNCHECKED_ITERATOR(It) \\\n    using _Unchecked_type = It  // Mark iterator as checked.\n#else\n#  define FMT_MSC_WARNING(...)\n#  define FMT_UNCHECKED_ITERATOR(It) using unchecked_type = It\n#endif\n\n#ifndef FMT_BEGIN_NAMESPACE\n#  define FMT_BEGIN_NAMESPACE \\\n    namespace fmt {           \\\n    inline namespace v11 {\n#  define FMT_END_NAMESPACE \\\n    }                       \\\n    }\n#endif\n\n#ifndef FMT_EXPORT\n#  define FMT_EXPORT\n#  define FMT_BEGIN_EXPORT\n#  define FMT_END_EXPORT\n#endif\n\n#if !defined(FMT_HEADER_ONLY) && defined(_WIN32)\n#  if defined(FMT_LIB_EXPORT)\n#    define FMT_API __declspec(dllexport)\n#  elif defined(FMT_SHARED)\n#    define FMT_API __declspec(dllimport)\n#  endif\n#elif defined(FMT_LIB_EXPORT) || defined(FMT_SHARED)\n#  define FMT_API FMT_VISIBILITY(\"default\")\n#endif\n#ifndef FMT_API\n#  define FMT_API\n#endif\n\n#ifndef FMT_UNICODE\n#  define FMT_UNICODE 1\n#endif\n\n// Check if rtti is available.\n#ifndef FMT_USE_RTTI\n// __RTTI is for EDG compilers. _CPPRTTI is for MSVC.\n#  if defined(__GXX_RTTI) || FMT_HAS_FEATURE(cxx_rtti) || defined(_CPPRTTI) || \\\n      defined(__INTEL_RTTI__) || defined(__RTTI)\n#    define FMT_USE_RTTI 1\n#  else\n#    define FMT_USE_RTTI 0\n#  endif\n#endif\n\n#define FMT_FWD(...) static_cast<decltype(__VA_ARGS__)&&>(__VA_ARGS__)\n\n// Enable minimal optimizations for more compact code in debug mode.\nFMT_GCC_PRAGMA(\"GCC push_options\")\n#if !defined(__OPTIMIZE__) && !defined(__CUDACC__)\nFMT_GCC_PRAGMA(\"GCC optimize(\\\"Og\\\")\")\n#endif\n\nFMT_BEGIN_NAMESPACE\n\n// Implementations of enable_if_t and other metafunctions for older systems.\ntemplate <bool B, typename T = void>\nusing enable_if_t = typename std::enable_if<B, T>::type;\ntemplate <bool B, typename T, typename F>\nusing conditional_t = typename std::conditional<B, T, F>::type;\ntemplate <bool B> using bool_constant = std::integral_constant<bool, B>;\ntemplate <typename T>\nusing remove_reference_t = typename std::remove_reference<T>::type;\ntemplate <typename T>\nusing remove_const_t = typename std::remove_const<T>::type;\ntemplate <typename T>\nusing remove_cvref_t = typename std::remove_cv<remove_reference_t<T>>::type;\ntemplate <typename T> struct type_identity {\n  using type = T;\n};\ntemplate <typename T> using type_identity_t = typename type_identity<T>::type;\ntemplate <typename T>\nusing make_unsigned_t = typename std::make_unsigned<T>::type;\ntemplate <typename T>\nusing underlying_t = typename std::underlying_type<T>::type;\n\n#if FMT_GCC_VERSION && FMT_GCC_VERSION < 500\n// A workaround for gcc 4.8 to make void_t work in a SFINAE context.\ntemplate <typename...> struct void_t_impl {\n  using type = void;\n};\ntemplate <typename... T> using void_t = typename void_t_impl<T...>::type;\n#else\ntemplate <typename...> using void_t = void;\n#endif\n\nstruct monostate {\n  constexpr monostate() {}\n};\n\n// An enable_if helper to be used in template parameters which results in much\n// shorter symbols: https://godbolt.org/z/sWw4vP. Extra parentheses are needed\n// to workaround a bug in MSVC 2019 (see #1140 and #1186).\n#ifdef FMT_DOC\n#  define FMT_ENABLE_IF(...)\n#else\n#  define FMT_ENABLE_IF(...) fmt::enable_if_t<(__VA_ARGS__), int> = 0\n#endif\n\n// This is defined in base.h instead of format.h to avoid injecting in std.\n// It is a template to avoid undesirable implicit conversions to std::byte.\n#ifdef __cpp_lib_byte\ntemplate <typename T, FMT_ENABLE_IF(std::is_same<T, std::byte>::value)>\ninline auto format_as(T b) -> unsigned char {\n  return static_cast<unsigned char>(b);\n}\n#endif\n\nnamespace detail {\n// Suppresses \"unused variable\" warnings with the method described in\n// https://herbsutter.com/2009/10/18/mailbag-shutting-up-compiler-warnings/.\n// (void)var does not work on many Intel compilers.\ntemplate <typename... T> FMT_CONSTEXPR void ignore_unused(const T&...) {}\n\nconstexpr auto is_constant_evaluated(bool default_value = false) noexcept\n    -> bool {\n// Workaround for incompatibility between libstdc++ consteval-based\n// std::is_constant_evaluated() implementation and clang-14:\n// https://github.com/fmtlib/fmt/issues/3247.\n#if FMT_CPLUSPLUS >= 202002L && FMT_GLIBCXX_RELEASE >= 12 && \\\n    (FMT_CLANG_VERSION >= 1400 && FMT_CLANG_VERSION < 1500)\n  ignore_unused(default_value);\n  return __builtin_is_constant_evaluated();\n#elif defined(__cpp_lib_is_constant_evaluated)\n  ignore_unused(default_value);\n  return std::is_constant_evaluated();\n#else\n  return default_value;\n#endif\n}\n\n// Suppresses \"conditional expression is constant\" warnings.\ntemplate <typename T> constexpr auto const_check(T value) -> T { return value; }\n\nFMT_NORETURN FMT_API void assert_fail(const char* file, int line,\n                                      const char* message);\n\n#if defined(FMT_ASSERT)\n// Use the provided definition.\n#elif defined(NDEBUG)\n// FMT_ASSERT is not empty to avoid -Wempty-body.\n#  define FMT_ASSERT(condition, message) \\\n    fmt::detail::ignore_unused((condition), (message))\n#else\n#  define FMT_ASSERT(condition, message)                                    \\\n    ((condition) /* void() fails with -Winvalid-constexpr on clang 4.0.1 */ \\\n         ? (void)0                                                          \\\n         : fmt::detail::assert_fail(__FILE__, __LINE__, (message)))\n#endif\n\n#ifdef FMT_USE_INT128\n// Do nothing.\n#elif defined(__SIZEOF_INT128__) && !defined(__NVCC__) && \\\n    !(FMT_CLANG_VERSION && FMT_MSC_VERSION)\n#  define FMT_USE_INT128 1\nusing int128_opt = __int128_t;  // An optional native 128-bit integer.\nusing uint128_opt = __uint128_t;\ntemplate <typename T> inline auto convert_for_visit(T value) -> T {\n  return value;\n}\n#else\n#  define FMT_USE_INT128 0\n#endif\n#if !FMT_USE_INT128\nenum class int128_opt {};\nenum class uint128_opt {};\n// Reduce template instantiations.\ntemplate <typename T> auto convert_for_visit(T) -> monostate { return {}; }\n#endif\n\n// Casts a nonnegative integer to unsigned.\ntemplate <typename Int>\nFMT_CONSTEXPR auto to_unsigned(Int value) -> make_unsigned_t<Int> {\n  FMT_ASSERT(std::is_unsigned<Int>::value || value >= 0, \"negative value\");\n  return static_cast<make_unsigned_t<Int>>(value);\n}\n\n// A heuristic to detect std::string and std::[experimental::]string_view.\n// It is mainly used to avoid dependency on <[experimental/]string_view>.\ntemplate <typename T, typename Enable = void>\nstruct is_std_string_like : std::false_type {};\ntemplate <typename T>\nstruct is_std_string_like<T, void_t<decltype(std::declval<T>().find_first_of(\n                                 typename T::value_type(), 0))>>\n    : std::is_convertible<decltype(std::declval<T>().data()),\n                          const typename T::value_type*> {};\n\n// Returns true iff the literal encoding is UTF-8.\nconstexpr auto is_utf8_enabled() -> bool {\n  // Avoid an MSVC sign extension bug: https://github.com/fmtlib/fmt/pull/2297.\n  using uchar = unsigned char;\n  return sizeof(\"\\u00A7\") == 3 && uchar(\"\\u00A7\"[0]) == 0xC2 &&\n         uchar(\"\\u00A7\"[1]) == 0xA7;\n}\nconstexpr auto use_utf8() -> bool {\n  return !FMT_MSC_VERSION || is_utf8_enabled();\n}\n\nstatic_assert(!FMT_UNICODE || use_utf8(),\n              \"Unicode support requires compiling with /utf-8\");\n\ntemplate <typename Char> FMT_CONSTEXPR auto length(const Char* s) -> size_t {\n  size_t len = 0;\n  while (*s++) ++len;\n  return len;\n}\n\ntemplate <typename Char>\nFMT_CONSTEXPR auto compare(const Char* s1, const Char* s2, std::size_t n)\n    -> int {\n  if (!is_constant_evaluated() && sizeof(Char) == 1) return memcmp(s1, s2, n);\n  for (; n != 0; ++s1, ++s2, --n) {\n    if (*s1 < *s2) return -1;\n    if (*s1 > *s2) return 1;\n  }\n  return 0;\n}\n\nnamespace adl {\nusing namespace std;\n\ntemplate <typename Container>\nauto invoke_back_inserter()\n    -> decltype(back_inserter(std::declval<Container&>()));\n}  // namespace adl\n\ntemplate <typename It, typename Enable = std::true_type>\nstruct is_back_insert_iterator : std::false_type {};\n\ntemplate <typename It>\nstruct is_back_insert_iterator<\n    It, bool_constant<std::is_same<\n            decltype(adl::invoke_back_inserter<typename It::container_type>()),\n            It>::value>> : std::true_type {};\n\n// Extracts a reference to the container from *insert_iterator.\ntemplate <typename OutputIt>\ninline auto get_container(OutputIt it) -> typename OutputIt::container_type& {\n  struct accessor : OutputIt {\n    accessor(OutputIt base) : OutputIt(base) {}\n    using OutputIt::container;\n  };\n  return *accessor(it).container;\n}\n}  // namespace detail\n\n// Checks whether T is a container with contiguous storage.\ntemplate <typename T> struct is_contiguous : std::false_type {};\n\n/**\n * An implementation of `std::basic_string_view` for pre-C++17. It provides a\n * subset of the API. `fmt::basic_string_view` is used for format strings even\n * if `std::basic_string_view` is available to prevent issues when a library is\n * compiled with a different `-std` option than the client code (which is not\n * recommended).\n */\nFMT_EXPORT\ntemplate <typename Char> class basic_string_view {\n private:\n  const Char* data_;\n  size_t size_;\n\n public:\n  using value_type = Char;\n  using iterator = const Char*;\n\n  constexpr basic_string_view() noexcept : data_(nullptr), size_(0) {}\n\n  /// Constructs a string reference object from a C string and a size.\n  constexpr basic_string_view(const Char* s, size_t count) noexcept\n      : data_(s), size_(count) {}\n\n  constexpr basic_string_view(std::nullptr_t) = delete;\n\n  /// Constructs a string reference object from a C string.\n  FMT_CONSTEXPR20\n  basic_string_view(const Char* s)\n      : data_(s),\n        size_(detail::const_check(std::is_same<Char, char>::value &&\n                                  !detail::is_constant_evaluated(false))\n                  ? strlen(reinterpret_cast<const char*>(s))\n                  : detail::length(s)) {}\n\n  /// Constructs a string reference from a `std::basic_string` or a\n  /// `std::basic_string_view` object.\n  template <typename S,\n            FMT_ENABLE_IF(detail::is_std_string_like<S>::value&& std::is_same<\n                          typename S::value_type, Char>::value)>\n  FMT_CONSTEXPR basic_string_view(const S& s) noexcept\n      : data_(s.data()), size_(s.size()) {}\n\n  /// Returns a pointer to the string data.\n  constexpr auto data() const noexcept -> const Char* { return data_; }\n\n  /// Returns the string size.\n  constexpr auto size() const noexcept -> size_t { return size_; }\n\n  constexpr auto begin() const noexcept -> iterator { return data_; }\n  constexpr auto end() const noexcept -> iterator { return data_ + size_; }\n\n  constexpr auto operator[](size_t pos) const noexcept -> const Char& {\n    return data_[pos];\n  }\n\n  FMT_CONSTEXPR void remove_prefix(size_t n) noexcept {\n    data_ += n;\n    size_ -= n;\n  }\n\n  FMT_CONSTEXPR auto starts_with(basic_string_view<Char> sv) const noexcept\n      -> bool {\n    return size_ >= sv.size_ && detail::compare(data_, sv.data_, sv.size_) == 0;\n  }\n  FMT_CONSTEXPR auto starts_with(Char c) const noexcept -> bool {\n    return size_ >= 1 && *data_ == c;\n  }\n  FMT_CONSTEXPR auto starts_with(const Char* s) const -> bool {\n    return starts_with(basic_string_view<Char>(s));\n  }\n\n  // Lexicographically compare this string reference to other.\n  FMT_CONSTEXPR auto compare(basic_string_view other) const -> int {\n    size_t str_size = size_ < other.size_ ? size_ : other.size_;\n    int result = detail::compare(data_, other.data_, str_size);\n    if (result == 0)\n      result = size_ == other.size_ ? 0 : (size_ < other.size_ ? -1 : 1);\n    return result;\n  }\n\n  FMT_CONSTEXPR friend auto operator==(basic_string_view lhs,\n                                       basic_string_view rhs) -> bool {\n    return lhs.compare(rhs) == 0;\n  }\n  friend auto operator!=(basic_string_view lhs, basic_string_view rhs) -> bool {\n    return lhs.compare(rhs) != 0;\n  }\n  friend auto operator<(basic_string_view lhs, basic_string_view rhs) -> bool {\n    return lhs.compare(rhs) < 0;\n  }\n  friend auto operator<=(basic_string_view lhs, basic_string_view rhs) -> bool {\n    return lhs.compare(rhs) <= 0;\n  }\n  friend auto operator>(basic_string_view lhs, basic_string_view rhs) -> bool {\n    return lhs.compare(rhs) > 0;\n  }\n  friend auto operator>=(basic_string_view lhs, basic_string_view rhs) -> bool {\n    return lhs.compare(rhs) >= 0;\n  }\n};\n\nFMT_EXPORT\nusing string_view = basic_string_view<char>;\n\n/// Specifies if `T` is a character type. Can be specialized by users.\nFMT_EXPORT\ntemplate <typename T> struct is_char : std::false_type {};\ntemplate <> struct is_char<char> : std::true_type {};\n\nnamespace detail {\n\n// Constructs fmt::basic_string_view<Char> from types implicitly convertible\n// to it, deducing Char. Explicitly convertible types such as the ones returned\n// from FMT_STRING are intentionally excluded.\ntemplate <typename Char, FMT_ENABLE_IF(is_char<Char>::value)>\nconstexpr auto to_string_view(const Char* s) -> basic_string_view<Char> {\n  return s;\n}\ntemplate <typename T, FMT_ENABLE_IF(is_std_string_like<T>::value)>\nconstexpr auto to_string_view(const T& s)\n    -> basic_string_view<typename T::value_type> {\n  return s;\n}\ntemplate <typename Char>\nconstexpr auto to_string_view(basic_string_view<Char> s)\n    -> basic_string_view<Char> {\n  return s;\n}\n\ntemplate <typename T, typename Enable = void>\nstruct has_to_string_view : std::false_type {};\n// detail:: is intentional since to_string_view is not an extension point.\ntemplate <typename T>\nstruct has_to_string_view<\n    T, void_t<decltype(detail::to_string_view(std::declval<T>()))>>\n    : std::true_type {};\n\ntemplate <typename Char, Char... C> struct string_literal {\n  static constexpr Char value[sizeof...(C)] = {C...};\n  constexpr operator basic_string_view<Char>() const {\n    return {value, sizeof...(C)};\n  }\n};\n#if FMT_CPLUSPLUS < 201703L\ntemplate <typename Char, Char... C>\nconstexpr Char string_literal<Char, C...>::value[sizeof...(C)];\n#endif\n\nenum class type {\n  none_type,\n  // Integer types should go first,\n  int_type,\n  uint_type,\n  long_long_type,\n  ulong_long_type,\n  int128_type,\n  uint128_type,\n  bool_type,\n  char_type,\n  last_integer_type = char_type,\n  // followed by floating-point types.\n  float_type,\n  double_type,\n  long_double_type,\n  last_numeric_type = long_double_type,\n  cstring_type,\n  string_type,\n  pointer_type,\n  custom_type\n};\n\n// Maps core type T to the corresponding type enum constant.\ntemplate <typename T, typename Char>\nstruct type_constant : std::integral_constant<type, type::custom_type> {};\n\n#define FMT_TYPE_CONSTANT(Type, constant) \\\n  template <typename Char>                \\\n  struct type_constant<Type, Char>        \\\n      : std::integral_constant<type, type::constant> {}\n\nFMT_TYPE_CONSTANT(int, int_type);\nFMT_TYPE_CONSTANT(unsigned, uint_type);\nFMT_TYPE_CONSTANT(long long, long_long_type);\nFMT_TYPE_CONSTANT(unsigned long long, ulong_long_type);\nFMT_TYPE_CONSTANT(int128_opt, int128_type);\nFMT_TYPE_CONSTANT(uint128_opt, uint128_type);\nFMT_TYPE_CONSTANT(bool, bool_type);\nFMT_TYPE_CONSTANT(Char, char_type);\nFMT_TYPE_CONSTANT(float, float_type);\nFMT_TYPE_CONSTANT(double, double_type);\nFMT_TYPE_CONSTANT(long double, long_double_type);\nFMT_TYPE_CONSTANT(const Char*, cstring_type);\nFMT_TYPE_CONSTANT(basic_string_view<Char>, string_type);\nFMT_TYPE_CONSTANT(const void*, pointer_type);\n\nconstexpr auto is_integral_type(type t) -> bool {\n  return t > type::none_type && t <= type::last_integer_type;\n}\nconstexpr auto is_arithmetic_type(type t) -> bool {\n  return t > type::none_type && t <= type::last_numeric_type;\n}\n\nconstexpr auto set(type rhs) -> int { return 1 << static_cast<int>(rhs); }\nconstexpr auto in(type t, int set) -> bool {\n  return ((set >> static_cast<int>(t)) & 1) != 0;\n}\n\n// Bitsets of types.\nenum {\n  sint_set =\n      set(type::int_type) | set(type::long_long_type) | set(type::int128_type),\n  uint_set = set(type::uint_type) | set(type::ulong_long_type) |\n             set(type::uint128_type),\n  bool_set = set(type::bool_type),\n  char_set = set(type::char_type),\n  float_set = set(type::float_type) | set(type::double_type) |\n              set(type::long_double_type),\n  string_set = set(type::string_type),\n  cstring_set = set(type::cstring_type),\n  pointer_set = set(type::pointer_type)\n};\n}  // namespace detail\n\n/// Reports a format error at compile time or, via a `format_error` exception,\n/// at runtime.\n// This function is intentionally not constexpr to give a compile-time error.\nFMT_NORETURN FMT_API void report_error(const char* message);\n\nFMT_DEPRECATED FMT_NORETURN inline void throw_format_error(\n    const char* message) {\n  report_error(message);\n}\n\n/// String's character (code unit) type.\ntemplate <typename S,\n          typename V = decltype(detail::to_string_view(std::declval<S>()))>\nusing char_t = typename V::value_type;\n\n/**\n * Parsing context consisting of a format string range being parsed and an\n * argument counter for automatic indexing.\n * You can use the `format_parse_context` type alias for `char` instead.\n */\nFMT_EXPORT\ntemplate <typename Char> class basic_format_parse_context {\n private:\n  basic_string_view<Char> format_str_;\n  int next_arg_id_;\n\n  FMT_CONSTEXPR void do_check_arg_id(int id);\n\n public:\n  using char_type = Char;\n  using iterator = const Char*;\n\n  explicit constexpr basic_format_parse_context(\n      basic_string_view<Char> format_str, int next_arg_id = 0)\n      : format_str_(format_str), next_arg_id_(next_arg_id) {}\n\n  /// Returns an iterator to the beginning of the format string range being\n  /// parsed.\n  constexpr auto begin() const noexcept -> iterator {\n    return format_str_.begin();\n  }\n\n  /// Returns an iterator past the end of the format string range being parsed.\n  constexpr auto end() const noexcept -> iterator { return format_str_.end(); }\n\n  /// Advances the begin iterator to `it`.\n  FMT_CONSTEXPR void advance_to(iterator it) {\n    format_str_.remove_prefix(detail::to_unsigned(it - begin()));\n  }\n\n  /// Reports an error if using the manual argument indexing; otherwise returns\n  /// the next argument index and switches to the automatic indexing.\n  FMT_CONSTEXPR auto next_arg_id() -> int {\n    if (next_arg_id_ < 0) {\n      report_error(\"cannot switch from manual to automatic argument indexing\");\n      return 0;\n    }\n    int id = next_arg_id_++;\n    do_check_arg_id(id);\n    return id;\n  }\n\n  /// Reports an error if using the automatic argument indexing; otherwise\n  /// switches to the manual indexing.\n  FMT_CONSTEXPR void check_arg_id(int id) {\n    if (next_arg_id_ > 0) {\n      report_error(\"cannot switch from automatic to manual argument indexing\");\n      return;\n    }\n    next_arg_id_ = -1;\n    do_check_arg_id(id);\n  }\n  FMT_CONSTEXPR void check_arg_id(basic_string_view<Char>) {\n    next_arg_id_ = -1;\n  }\n  FMT_CONSTEXPR void check_dynamic_spec(int arg_id);\n};\n\nFMT_EXPORT\nusing format_parse_context = basic_format_parse_context<char>;\n\nnamespace detail {\n// A parse context with extra data used only in compile-time checks.\ntemplate <typename Char>\nclass compile_parse_context : public basic_format_parse_context<Char> {\n private:\n  int num_args_;\n  const type* types_;\n  using base = basic_format_parse_context<Char>;\n\n public:\n  explicit FMT_CONSTEXPR compile_parse_context(\n      basic_string_view<Char> format_str, int num_args, const type* types,\n      int next_arg_id = 0)\n      : base(format_str, next_arg_id), num_args_(num_args), types_(types) {}\n\n  constexpr auto num_args() const -> int { return num_args_; }\n  constexpr auto arg_type(int id) const -> type { return types_[id]; }\n\n  FMT_CONSTEXPR auto next_arg_id() -> int {\n    int id = base::next_arg_id();\n    if (id >= num_args_) report_error(\"argument not found\");\n    return id;\n  }\n\n  FMT_CONSTEXPR void check_arg_id(int id) {\n    base::check_arg_id(id);\n    if (id >= num_args_) report_error(\"argument not found\");\n  }\n  using base::check_arg_id;\n\n  FMT_CONSTEXPR void check_dynamic_spec(int arg_id) {\n    detail::ignore_unused(arg_id);\n    if (arg_id < num_args_ && types_ && !is_integral_type(types_[arg_id]))\n      report_error(\"width/precision is not integer\");\n  }\n};\n\n/// A contiguous memory buffer with an optional growing ability. It is an\n/// internal class and shouldn't be used directly, only via `memory_buffer`.\ntemplate <typename T> class buffer {\n private:\n  T* ptr_;\n  size_t size_;\n  size_t capacity_;\n\n  using grow_fun = void (*)(buffer& buf, size_t capacity);\n  grow_fun grow_;\n\n protected:\n  // Don't initialize ptr_ since it is not accessed to save a few cycles.\n  FMT_MSC_WARNING(suppress : 26495)\n  FMT_CONSTEXPR20 buffer(grow_fun grow, size_t sz) noexcept\n      : size_(sz), capacity_(sz), grow_(grow) {}\n\n  constexpr buffer(grow_fun grow, T* p = nullptr, size_t sz = 0,\n                   size_t cap = 0) noexcept\n      : ptr_(p), size_(sz), capacity_(cap), grow_(grow) {}\n\n  FMT_CONSTEXPR20 ~buffer() = default;\n  buffer(buffer&&) = default;\n\n  /// Sets the buffer data and capacity.\n  FMT_CONSTEXPR void set(T* buf_data, size_t buf_capacity) noexcept {\n    ptr_ = buf_data;\n    capacity_ = buf_capacity;\n  }\n\n public:\n  using value_type = T;\n  using const_reference = const T&;\n\n  buffer(const buffer&) = delete;\n  void operator=(const buffer&) = delete;\n\n  auto begin() noexcept -> T* { return ptr_; }\n  auto end() noexcept -> T* { return ptr_ + size_; }\n\n  auto begin() const noexcept -> const T* { return ptr_; }\n  auto end() const noexcept -> const T* { return ptr_ + size_; }\n\n  /// Returns the size of this buffer.\n  constexpr auto size() const noexcept -> size_t { return size_; }\n\n  /// Returns the capacity of this buffer.\n  constexpr auto capacity() const noexcept -> size_t { return capacity_; }\n\n  /// Returns a pointer to the buffer data (not null-terminated).\n  FMT_CONSTEXPR auto data() noexcept -> T* { return ptr_; }\n  FMT_CONSTEXPR auto data() const noexcept -> const T* { return ptr_; }\n\n  /// Clears this buffer.\n  void clear() { size_ = 0; }\n\n  // Tries resizing the buffer to contain `count` elements. If T is a POD type\n  // the new elements may not be initialized.\n  FMT_CONSTEXPR void try_resize(size_t count) {\n    try_reserve(count);\n    size_ = count <= capacity_ ? count : capacity_;\n  }\n\n  // Tries increasing the buffer capacity to `new_capacity`. It can increase the\n  // capacity by a smaller amount than requested but guarantees there is space\n  // for at least one additional element either by increasing the capacity or by\n  // flushing the buffer if it is full.\n  FMT_CONSTEXPR void try_reserve(size_t new_capacity) {\n    if (new_capacity > capacity_) grow_(*this, new_capacity);\n  }\n\n  FMT_CONSTEXPR void push_back(const T& value) {\n    try_reserve(size_ + 1);\n    ptr_[size_++] = value;\n  }\n\n  /// Appends data to the end of the buffer.\n  template <typename U> void append(const U* begin, const U* end) {\n    while (begin != end) {\n      auto count = to_unsigned(end - begin);\n      try_reserve(size_ + count);\n      auto free_cap = capacity_ - size_;\n      if (free_cap < count) count = free_cap;\n      // A loop is faster than memcpy on small sizes.\n      T* out = ptr_ + size_;\n      for (size_t i = 0; i < count; ++i) out[i] = begin[i];\n      size_ += count;\n      begin += count;\n    }\n  }\n\n  template <typename Idx> FMT_CONSTEXPR auto operator[](Idx index) -> T& {\n    return ptr_[index];\n  }\n  template <typename Idx>\n  FMT_CONSTEXPR auto operator[](Idx index) const -> const T& {\n    return ptr_[index];\n  }\n};\n\nstruct buffer_traits {\n  explicit buffer_traits(size_t) {}\n  auto count() const -> size_t { return 0; }\n  auto limit(size_t size) -> size_t { return size; }\n};\n\nclass fixed_buffer_traits {\n private:\n  size_t count_ = 0;\n  size_t limit_;\n\n public:\n  explicit fixed_buffer_traits(size_t limit) : limit_(limit) {}\n  auto count() const -> size_t { return count_; }\n  auto limit(size_t size) -> size_t {\n    size_t n = limit_ > count_ ? limit_ - count_ : 0;\n    count_ += size;\n    return size < n ? size : n;\n  }\n};\n\n// A buffer that writes to an output iterator when flushed.\ntemplate <typename OutputIt, typename T, typename Traits = buffer_traits>\nclass iterator_buffer : public Traits, public buffer<T> {\n private:\n  OutputIt out_;\n  enum { buffer_size = 256 };\n  T data_[buffer_size];\n\n  static FMT_CONSTEXPR void grow(buffer<T>& buf, size_t) {\n    if (buf.size() == buffer_size) static_cast<iterator_buffer&>(buf).flush();\n  }\n\n  void flush() {\n    auto size = this->size();\n    this->clear();\n    const T* begin = data_;\n    const T* end = begin + this->limit(size);\n    while (begin != end) *out_++ = *begin++;\n  }\n\n public:\n  explicit iterator_buffer(OutputIt out, size_t n = buffer_size)\n      : Traits(n), buffer<T>(grow, data_, 0, buffer_size), out_(out) {}\n  iterator_buffer(iterator_buffer&& other) noexcept\n      : Traits(other),\n        buffer<T>(grow, data_, 0, buffer_size),\n        out_(other.out_) {}\n  ~iterator_buffer() {\n    // Don't crash if flush fails during unwinding.\n    FMT_TRY { flush(); }\n    FMT_CATCH(...) {}\n  }\n\n  auto out() -> OutputIt {\n    flush();\n    return out_;\n  }\n  auto count() const -> size_t { return Traits::count() + this->size(); }\n};\n\ntemplate <typename T>\nclass iterator_buffer<T*, T, fixed_buffer_traits> : public fixed_buffer_traits,\n                                                    public buffer<T> {\n private:\n  T* out_;\n  enum { buffer_size = 256 };\n  T data_[buffer_size];\n\n  static FMT_CONSTEXPR void grow(buffer<T>& buf, size_t) {\n    if (buf.size() == buf.capacity())\n      static_cast<iterator_buffer&>(buf).flush();\n  }\n\n  void flush() {\n    size_t n = this->limit(this->size());\n    if (this->data() == out_) {\n      out_ += n;\n      this->set(data_, buffer_size);\n    }\n    this->clear();\n  }\n\n public:\n  explicit iterator_buffer(T* out, size_t n = buffer_size)\n      : fixed_buffer_traits(n), buffer<T>(grow, out, 0, n), out_(out) {}\n  iterator_buffer(iterator_buffer&& other) noexcept\n      : fixed_buffer_traits(other),\n        buffer<T>(static_cast<iterator_buffer&&>(other)),\n        out_(other.out_) {\n    if (this->data() != out_) {\n      this->set(data_, buffer_size);\n      this->clear();\n    }\n  }\n  ~iterator_buffer() { flush(); }\n\n  auto out() -> T* {\n    flush();\n    return out_;\n  }\n  auto count() const -> size_t {\n    return fixed_buffer_traits::count() + this->size();\n  }\n};\n\ntemplate <typename T> class iterator_buffer<T*, T> : public buffer<T> {\n public:\n  explicit iterator_buffer(T* out, size_t = 0)\n      : buffer<T>([](buffer<T>&, size_t) {}, out, 0, ~size_t()) {}\n\n  auto out() -> T* { return &*this->end(); }\n};\n\n// A buffer that writes to a container with the contiguous storage.\ntemplate <typename OutputIt>\nclass iterator_buffer<\n    OutputIt,\n    enable_if_t<detail::is_back_insert_iterator<OutputIt>::value &&\n                    is_contiguous<typename OutputIt::container_type>::value,\n                typename OutputIt::container_type::value_type>>\n    : public buffer<typename OutputIt::container_type::value_type> {\n private:\n  using container_type = typename OutputIt::container_type;\n  using value_type = typename container_type::value_type;\n  container_type& container_;\n\n  static FMT_CONSTEXPR void grow(buffer<value_type>& buf, size_t capacity) {\n    auto& self = static_cast<iterator_buffer&>(buf);\n    self.container_.resize(capacity);\n    self.set(&self.container_[0], capacity);\n  }\n\n public:\n  explicit iterator_buffer(container_type& c)\n      : buffer<value_type>(grow, c.size()), container_(c) {}\n  explicit iterator_buffer(OutputIt out, size_t = 0)\n      : iterator_buffer(get_container(out)) {}\n\n  auto out() -> OutputIt { return back_inserter(container_); }\n};\n\n// A buffer that counts the number of code units written discarding the output.\ntemplate <typename T = char> class counting_buffer : public buffer<T> {\n private:\n  enum { buffer_size = 256 };\n  T data_[buffer_size];\n  size_t count_ = 0;\n\n  static FMT_CONSTEXPR void grow(buffer<T>& buf, size_t) {\n    if (buf.size() != buffer_size) return;\n    static_cast<counting_buffer&>(buf).count_ += buf.size();\n    buf.clear();\n  }\n\n public:\n  counting_buffer() : buffer<T>(grow, data_, 0, buffer_size) {}\n\n  auto count() -> size_t { return count_ + this->size(); }\n};\n}  // namespace detail\n\ntemplate <typename Char>\nFMT_CONSTEXPR void basic_format_parse_context<Char>::do_check_arg_id(int id) {\n  // Argument id is only checked at compile-time during parsing because\n  // formatting has its own validation.\n  if (detail::is_constant_evaluated() &&\n      (!FMT_GCC_VERSION || FMT_GCC_VERSION >= 1200)) {\n    using context = detail::compile_parse_context<Char>;\n    if (id >= static_cast<context*>(this)->num_args())\n      report_error(\"argument not found\");\n  }\n}\n\ntemplate <typename Char>\nFMT_CONSTEXPR void basic_format_parse_context<Char>::check_dynamic_spec(\n    int arg_id) {\n  if (detail::is_constant_evaluated() &&\n      (!FMT_GCC_VERSION || FMT_GCC_VERSION >= 1200)) {\n    using context = detail::compile_parse_context<Char>;\n    static_cast<context*>(this)->check_dynamic_spec(arg_id);\n  }\n}\n\nFMT_EXPORT template <typename Context> class basic_format_arg;\nFMT_EXPORT template <typename Context> class basic_format_args;\nFMT_EXPORT template <typename Context> class dynamic_format_arg_store;\n\n// A formatter for objects of type T.\nFMT_EXPORT\ntemplate <typename T, typename Char = char, typename Enable = void>\nstruct formatter {\n  // A deleted default constructor indicates a disabled formatter.\n  formatter() = delete;\n};\n\n// Specifies if T has an enabled formatter specialization. A type can be\n// formattable even if it doesn't have a formatter e.g. via a conversion.\ntemplate <typename T, typename Context>\nusing has_formatter =\n    std::is_constructible<typename Context::template formatter_type<T>>;\n\n// An output iterator that appends to a buffer. It is used instead of\n// back_insert_iterator to reduce symbol sizes and avoid <iterator> dependency.\ntemplate <typename T> class basic_appender {\n private:\n  detail::buffer<T>* buffer_;\n\n  friend auto get_container(basic_appender app) -> detail::buffer<T>& {\n    return *app.buffer_;\n  }\n\n public:\n  using iterator_category = int;\n  using value_type = T;\n  using difference_type = ptrdiff_t;\n  using pointer = T*;\n  using reference = T&;\n  using container_type = detail::buffer<T>;\n  FMT_UNCHECKED_ITERATOR(basic_appender);\n\n  FMT_CONSTEXPR basic_appender(detail::buffer<T>& buf) : buffer_(&buf) {}\n\n  auto operator=(T c) -> basic_appender& {\n    buffer_->push_back(c);\n    return *this;\n  }\n  auto operator*() -> basic_appender& { return *this; }\n  auto operator++() -> basic_appender& { return *this; }\n  auto operator++(int) -> basic_appender { return *this; }\n};\n\nusing appender = basic_appender<char>;\n\nnamespace detail {\ntemplate <typename T>\nstruct is_back_insert_iterator<basic_appender<T>> : std::true_type {};\n\ntemplate <typename T, typename Enable = void>\nstruct locking : std::true_type {};\ntemplate <typename T>\nstruct locking<T, void_t<typename formatter<remove_cvref_t<T>>::nonlocking>>\n    : std::false_type {};\n\ntemplate <typename T = int> FMT_CONSTEXPR inline auto is_locking() -> bool {\n  return locking<T>::value;\n}\ntemplate <typename T1, typename T2, typename... Tail>\nFMT_CONSTEXPR inline auto is_locking() -> bool {\n  return locking<T1>::value || is_locking<T2, Tail...>();\n}\n\n// An optimized version of std::copy with the output value type (T).\ntemplate <typename T, typename InputIt, typename OutputIt,\n          FMT_ENABLE_IF(is_back_insert_iterator<OutputIt>::value)>\nauto copy(InputIt begin, InputIt end, OutputIt out) -> OutputIt {\n  get_container(out).append(begin, end);\n  return out;\n}\n\ntemplate <typename T, typename InputIt, typename OutputIt,\n          FMT_ENABLE_IF(!is_back_insert_iterator<OutputIt>::value)>\nFMT_CONSTEXPR auto copy(InputIt begin, InputIt end, OutputIt out) -> OutputIt {\n  while (begin != end) *out++ = static_cast<T>(*begin++);\n  return out;\n}\n\ntemplate <typename T, typename V, typename OutputIt>\nFMT_CONSTEXPR auto copy(basic_string_view<V> s, OutputIt out) -> OutputIt {\n  return copy<T>(s.begin(), s.end(), out);\n}\n\ntemplate <typename Context, typename T>\nconstexpr auto has_const_formatter_impl(T*)\n    -> decltype(typename Context::template formatter_type<T>().format(\n                    std::declval<const T&>(), std::declval<Context&>()),\n                true) {\n  return true;\n}\ntemplate <typename Context>\nconstexpr auto has_const_formatter_impl(...) -> bool {\n  return false;\n}\ntemplate <typename T, typename Context>\nconstexpr auto has_const_formatter() -> bool {\n  return has_const_formatter_impl<Context>(static_cast<T*>(nullptr));\n}\n\ntemplate <typename It, typename Enable = std::true_type>\nstruct is_buffer_appender : std::false_type {};\ntemplate <typename It>\nstruct is_buffer_appender<\n    It, bool_constant<\n            is_back_insert_iterator<It>::value &&\n            std::is_base_of<buffer<typename It::container_type::value_type>,\n                            typename It::container_type>::value>>\n    : std::true_type {};\n\n// Maps an output iterator to a buffer.\ntemplate <typename T, typename OutputIt,\n          FMT_ENABLE_IF(!is_buffer_appender<OutputIt>::value)>\nauto get_buffer(OutputIt out) -> iterator_buffer<OutputIt, T> {\n  return iterator_buffer<OutputIt, T>(out);\n}\ntemplate <typename T, typename OutputIt,\n          FMT_ENABLE_IF(is_buffer_appender<OutputIt>::value)>\nauto get_buffer(OutputIt out) -> buffer<T>& {\n  return get_container(out);\n}\n\ntemplate <typename Buf, typename OutputIt>\nauto get_iterator(Buf& buf, OutputIt) -> decltype(buf.out()) {\n  return buf.out();\n}\ntemplate <typename T, typename OutputIt>\nauto get_iterator(buffer<T>&, OutputIt out) -> OutputIt {\n  return out;\n}\n\nstruct view {};\n\ntemplate <typename Char, typename T> struct named_arg : view {\n  const Char* name;\n  const T& value;\n  named_arg(const Char* n, const T& v) : name(n), value(v) {}\n};\n\ntemplate <typename Char> struct named_arg_info {\n  const Char* name;\n  int id;\n};\n\ntemplate <typename T> struct is_named_arg : std::false_type {};\ntemplate <typename T> struct is_statically_named_arg : std::false_type {};\n\ntemplate <typename T, typename Char>\nstruct is_named_arg<named_arg<Char, T>> : std::true_type {};\n\ntemplate <bool B = false> constexpr auto count() -> size_t { return B ? 1 : 0; }\ntemplate <bool B1, bool B2, bool... Tail> constexpr auto count() -> size_t {\n  return (B1 ? 1 : 0) + count<B2, Tail...>();\n}\n\ntemplate <typename... Args> constexpr auto count_named_args() -> size_t {\n  return count<is_named_arg<Args>::value...>();\n}\n\ntemplate <typename... Args>\nconstexpr auto count_statically_named_args() -> size_t {\n  return count<is_statically_named_arg<Args>::value...>();\n}\n\nstruct unformattable {};\nstruct unformattable_char : unformattable {};\nstruct unformattable_pointer : unformattable {};\n\ntemplate <typename Char> struct string_value {\n  const Char* data;\n  size_t size;\n};\n\ntemplate <typename Char> struct named_arg_value {\n  const named_arg_info<Char>* data;\n  size_t size;\n};\n\ntemplate <typename Context> struct custom_value {\n  using parse_context = typename Context::parse_context_type;\n  void* value;\n  void (*format)(void* arg, parse_context& parse_ctx, Context& ctx);\n};\n\n// A formatting argument value.\ntemplate <typename Context> class value {\n public:\n  using char_type = typename Context::char_type;\n\n  union {\n    monostate no_value;\n    int int_value;\n    unsigned uint_value;\n    long long long_long_value;\n    unsigned long long ulong_long_value;\n    int128_opt int128_value;\n    uint128_opt uint128_value;\n    bool bool_value;\n    char_type char_value;\n    float float_value;\n    double double_value;\n    long double long_double_value;\n    const void* pointer;\n    string_value<char_type> string;\n    custom_value<Context> custom;\n    named_arg_value<char_type> named_args;\n  };\n\n  constexpr FMT_ALWAYS_INLINE value() : no_value() {}\n  constexpr FMT_ALWAYS_INLINE value(int val) : int_value(val) {}\n  constexpr FMT_ALWAYS_INLINE value(unsigned val) : uint_value(val) {}\n  constexpr FMT_ALWAYS_INLINE value(long long val) : long_long_value(val) {}\n  constexpr FMT_ALWAYS_INLINE value(unsigned long long val)\n      : ulong_long_value(val) {}\n  FMT_ALWAYS_INLINE value(int128_opt val) : int128_value(val) {}\n  FMT_ALWAYS_INLINE value(uint128_opt val) : uint128_value(val) {}\n  constexpr FMT_ALWAYS_INLINE value(float val) : float_value(val) {}\n  constexpr FMT_ALWAYS_INLINE value(double val) : double_value(val) {}\n  FMT_ALWAYS_INLINE value(long double val) : long_double_value(val) {}\n  constexpr FMT_ALWAYS_INLINE value(bool val) : bool_value(val) {}\n  constexpr FMT_ALWAYS_INLINE value(char_type val) : char_value(val) {}\n  FMT_CONSTEXPR FMT_ALWAYS_INLINE value(const char_type* val) {\n    string.data = val;\n    if (is_constant_evaluated()) string.size = {};\n  }\n  FMT_CONSTEXPR FMT_ALWAYS_INLINE value(basic_string_view<char_type> val) {\n    string.data = val.data();\n    string.size = val.size();\n  }\n  FMT_ALWAYS_INLINE value(const void* val) : pointer(val) {}\n  FMT_ALWAYS_INLINE value(const named_arg_info<char_type>* args, size_t size)\n      : named_args{args, size} {}\n\n  template <typename T> FMT_CONSTEXPR20 FMT_ALWAYS_INLINE value(T& val) {\n    using value_type = remove_const_t<T>;\n    // T may overload operator& e.g. std::vector<bool>::reference in libc++.\n#if defined(__cpp_if_constexpr)\n    if constexpr (std::is_same<decltype(&val), T*>::value)\n      custom.value = const_cast<value_type*>(&val);\n#endif\n    if (!is_constant_evaluated())\n      custom.value = const_cast<char*>(&reinterpret_cast<const char&>(val));\n    // Get the formatter type through the context to allow different contexts\n    // have different extension points, e.g. `formatter<T>` for `format` and\n    // `printf_formatter<T>` for `printf`.\n    custom.format = format_custom_arg<\n        value_type, typename Context::template formatter_type<value_type>>;\n  }\n  value(unformattable);\n  value(unformattable_char);\n  value(unformattable_pointer);\n\n private:\n  // Formats an argument of a custom type, such as a user-defined class.\n  template <typename T, typename Formatter>\n  static void format_custom_arg(void* arg,\n                                typename Context::parse_context_type& parse_ctx,\n                                Context& ctx) {\n    auto f = Formatter();\n    parse_ctx.advance_to(f.parse(parse_ctx));\n    using qualified_type =\n        conditional_t<has_const_formatter<T, Context>(), const T, T>;\n    // format must be const for compatibility with std::format and compilation.\n    const auto& cf = f;\n    ctx.advance_to(cf.format(*static_cast<qualified_type*>(arg), ctx));\n  }\n};\n\n// To minimize the number of types we need to deal with, long is translated\n// either to int or to long long depending on its size.\nenum { long_short = sizeof(long) == sizeof(int) };\nusing long_type = conditional_t<long_short, int, long long>;\nusing ulong_type = conditional_t<long_short, unsigned, unsigned long long>;\n\ntemplate <typename T> struct format_as_result {\n  template <typename U,\n            FMT_ENABLE_IF(std::is_enum<U>::value || std::is_class<U>::value)>\n  static auto map(U*) -> remove_cvref_t<decltype(format_as(std::declval<U>()))>;\n  static auto map(...) -> void;\n\n  using type = decltype(map(static_cast<T*>(nullptr)));\n};\ntemplate <typename T> using format_as_t = typename format_as_result<T>::type;\n\ntemplate <typename T>\nstruct has_format_as\n    : bool_constant<!std::is_same<format_as_t<T>, void>::value> {};\n\n#define FMT_MAP_API FMT_CONSTEXPR FMT_ALWAYS_INLINE\n\n// Maps formatting arguments to core types.\n// arg_mapper reports errors by returning unformattable instead of using\n// static_assert because it's used in the is_formattable trait.\ntemplate <typename Context> struct arg_mapper {\n  using char_type = typename Context::char_type;\n\n  FMT_MAP_API auto map(signed char val) -> int { return val; }\n  FMT_MAP_API auto map(unsigned char val) -> unsigned { return val; }\n  FMT_MAP_API auto map(short val) -> int { return val; }\n  FMT_MAP_API auto map(unsigned short val) -> unsigned { return val; }\n  FMT_MAP_API auto map(int val) -> int { return val; }\n  FMT_MAP_API auto map(unsigned val) -> unsigned { return val; }\n  FMT_MAP_API auto map(long val) -> long_type { return val; }\n  FMT_MAP_API auto map(unsigned long val) -> ulong_type { return val; }\n  FMT_MAP_API auto map(long long val) -> long long { return val; }\n  FMT_MAP_API auto map(unsigned long long val) -> unsigned long long {\n    return val;\n  }\n  FMT_MAP_API auto map(int128_opt val) -> int128_opt { return val; }\n  FMT_MAP_API auto map(uint128_opt val) -> uint128_opt { return val; }\n  FMT_MAP_API auto map(bool val) -> bool { return val; }\n\n  template <typename T, FMT_ENABLE_IF(std::is_same<T, char>::value ||\n                                      std::is_same<T, char_type>::value)>\n  FMT_MAP_API auto map(T val) -> char_type {\n    return val;\n  }\n  template <typename T, enable_if_t<(std::is_same<T, wchar_t>::value ||\n#ifdef __cpp_char8_t\n                                     std::is_same<T, char8_t>::value ||\n#endif\n                                     std::is_same<T, char16_t>::value ||\n                                     std::is_same<T, char32_t>::value) &&\n                                        !std::is_same<T, char_type>::value,\n                                    int> = 0>\n  FMT_MAP_API auto map(T) -> unformattable_char {\n    return {};\n  }\n\n  FMT_MAP_API auto map(float val) -> float { return val; }\n  FMT_MAP_API auto map(double val) -> double { return val; }\n  FMT_MAP_API auto map(long double val) -> long double { return val; }\n\n  FMT_MAP_API auto map(char_type* val) -> const char_type* { return val; }\n  FMT_MAP_API auto map(const char_type* val) -> const char_type* { return val; }\n  template <typename T, typename Char = char_t<T>,\n            FMT_ENABLE_IF(std::is_same<Char, char_type>::value &&\n                          !std::is_pointer<T>::value)>\n  FMT_MAP_API auto map(const T& val) -> basic_string_view<Char> {\n    return to_string_view(val);\n  }\n  template <typename T, typename Char = char_t<T>,\n            FMT_ENABLE_IF(!std::is_same<Char, char_type>::value &&\n                          !std::is_pointer<T>::value)>\n  FMT_MAP_API auto map(const T&) -> unformattable_char {\n    return {};\n  }\n\n  FMT_MAP_API auto map(void* val) -> const void* { return val; }\n  FMT_MAP_API auto map(const void* val) -> const void* { return val; }\n  FMT_MAP_API auto map(volatile void* val) -> const void* {\n    return const_cast<const void*>(val);\n  }\n  FMT_MAP_API auto map(const volatile void* val) -> const void* {\n    return const_cast<const void*>(val);\n  }\n  FMT_MAP_API auto map(std::nullptr_t val) -> const void* { return val; }\n\n  // Use SFINAE instead of a const T* parameter to avoid a conflict with the\n  // array overload.\n  template <\n      typename T,\n      FMT_ENABLE_IF(\n          std::is_pointer<T>::value || std::is_member_pointer<T>::value ||\n          std::is_function<typename std::remove_pointer<T>::type>::value ||\n          (std::is_array<T>::value &&\n           !std::is_convertible<T, const char_type*>::value))>\n  FMT_CONSTEXPR auto map(const T&) -> unformattable_pointer {\n    return {};\n  }\n\n  template <typename T, std::size_t N,\n            FMT_ENABLE_IF(!std::is_same<T, wchar_t>::value)>\n  FMT_MAP_API auto map(const T (&values)[N]) -> const T (&)[N] {\n    return values;\n  }\n\n  // Only map owning types because mapping views can be unsafe.\n  template <typename T, typename U = format_as_t<T>,\n            FMT_ENABLE_IF(std::is_arithmetic<U>::value)>\n  FMT_MAP_API auto map(const T& val) -> decltype(FMT_DECLTYPE_THIS map(U())) {\n    return map(format_as(val));\n  }\n\n  template <typename T, typename U = remove_const_t<T>>\n  struct formattable : bool_constant<has_const_formatter<U, Context>() ||\n                                     (has_formatter<U, Context>::value &&\n                                      !std::is_const<T>::value)> {};\n\n  template <typename T, FMT_ENABLE_IF(formattable<T>::value)>\n  FMT_MAP_API auto do_map(T& val) -> T& {\n    return val;\n  }\n  template <typename T, FMT_ENABLE_IF(!formattable<T>::value)>\n  FMT_MAP_API auto do_map(T&) -> unformattable {\n    return {};\n  }\n\n  // is_fundamental is used to allow formatters for extended FP types.\n  template <typename T, typename U = remove_const_t<T>,\n            FMT_ENABLE_IF(\n                (std::is_class<U>::value || std::is_enum<U>::value ||\n                 std::is_union<U>::value || std::is_fundamental<U>::value) &&\n                !has_to_string_view<U>::value && !is_char<U>::value &&\n                !is_named_arg<U>::value && !std::is_integral<U>::value &&\n                !std::is_arithmetic<format_as_t<U>>::value)>\n  FMT_MAP_API auto map(T& val) -> decltype(FMT_DECLTYPE_THIS do_map(val)) {\n    return do_map(val);\n  }\n\n  template <typename T, FMT_ENABLE_IF(is_named_arg<T>::value)>\n  FMT_MAP_API auto map(const T& named_arg)\n      -> decltype(FMT_DECLTYPE_THIS map(named_arg.value)) {\n    return map(named_arg.value);\n  }\n\n  auto map(...) -> unformattable { return {}; }\n};\n\n// A type constant after applying arg_mapper<Context>.\ntemplate <typename T, typename Context>\nusing mapped_type_constant =\n    type_constant<decltype(arg_mapper<Context>().map(std::declval<const T&>())),\n                  typename Context::char_type>;\n\nenum { packed_arg_bits = 4 };\n// Maximum number of arguments with packed types.\nenum { max_packed_args = 62 / packed_arg_bits };\nenum : unsigned long long { is_unpacked_bit = 1ULL << 63 };\nenum : unsigned long long { has_named_args_bit = 1ULL << 62 };\n\ntemplate <typename It, typename T, typename Enable = void>\nstruct is_output_iterator : std::false_type {};\n\ntemplate <> struct is_output_iterator<appender, char> : std::true_type {};\n\ntemplate <typename It, typename T>\nstruct is_output_iterator<\n    It, T, void_t<decltype(*std::declval<It&>()++ = std::declval<T>())>>\n    : std::true_type {};\n\n// A type-erased reference to an std::locale to avoid a heavy <locale> include.\nclass locale_ref {\n private:\n  const void* locale_;  // A type-erased pointer to std::locale.\n\n public:\n  constexpr locale_ref() : locale_(nullptr) {}\n  template <typename Locale> explicit locale_ref(const Locale& loc);\n\n  explicit operator bool() const noexcept { return locale_ != nullptr; }\n\n  template <typename Locale> auto get() const -> Locale;\n};\n\ntemplate <typename> constexpr auto encode_types() -> unsigned long long {\n  return 0;\n}\n\ntemplate <typename Context, typename Arg, typename... Args>\nconstexpr auto encode_types() -> unsigned long long {\n  return static_cast<unsigned>(mapped_type_constant<Arg, Context>::value) |\n         (encode_types<Context, Args...>() << packed_arg_bits);\n}\n\ntemplate <typename Context, typename... T, size_t NUM_ARGS = sizeof...(T)>\nconstexpr unsigned long long make_descriptor() {\n  return NUM_ARGS <= max_packed_args ? encode_types<Context, T...>()\n                                     : is_unpacked_bit | NUM_ARGS;\n}\n\n// This type is intentionally undefined, only used for errors.\ntemplate <typename T, typename Char>\n#if FMT_CLANG_VERSION && FMT_CLANG_VERSION <= 1500\n// https://github.com/fmtlib/fmt/issues/3796\nstruct type_is_unformattable_for {\n};\n#else\nstruct type_is_unformattable_for;\n#endif\n\ntemplate <bool PACKED, typename Context, typename T, FMT_ENABLE_IF(PACKED)>\nFMT_CONSTEXPR auto make_arg(T& val) -> value<Context> {\n  using arg_type = remove_cvref_t<decltype(arg_mapper<Context>().map(val))>;\n\n  // Use enum instead of constexpr because the latter may generate code.\n  enum {\n    formattable_char = !std::is_same<arg_type, unformattable_char>::value\n  };\n  static_assert(formattable_char, \"Mixing character types is disallowed.\");\n\n  // Formatting of arbitrary pointers is disallowed. If you want to format a\n  // pointer cast it to `void*` or `const void*`. In particular, this forbids\n  // formatting of `[const] volatile char*` printed as bool by iostreams.\n  enum {\n    formattable_pointer = !std::is_same<arg_type, unformattable_pointer>::value\n  };\n  static_assert(formattable_pointer,\n                \"Formatting of non-void pointers is disallowed.\");\n\n  enum { formattable = !std::is_same<arg_type, unformattable>::value };\n#if defined(__cpp_if_constexpr)\n  if constexpr (!formattable)\n    type_is_unformattable_for<T, typename Context::char_type> _;\n#endif\n  static_assert(\n      formattable,\n      \"Cannot format an argument. To make type T formattable provide a \"\n      \"formatter<T> specialization: https://fmt.dev/latest/api.html#udt\");\n  return {arg_mapper<Context>().map(val)};\n}\n\ntemplate <typename Context, typename T>\nFMT_CONSTEXPR auto make_arg(T& val) -> basic_format_arg<Context> {\n  auto arg = basic_format_arg<Context>();\n  arg.type_ = mapped_type_constant<T, Context>::value;\n  arg.value_ = make_arg<true, Context>(val);\n  return arg;\n}\n\ntemplate <bool PACKED, typename Context, typename T, FMT_ENABLE_IF(!PACKED)>\nFMT_CONSTEXPR inline auto make_arg(T& val) -> basic_format_arg<Context> {\n  return make_arg<Context>(val);\n}\n\ntemplate <typename Context, size_t NUM_ARGS>\nusing arg_t = conditional_t<NUM_ARGS <= max_packed_args, value<Context>,\n                            basic_format_arg<Context>>;\n\ntemplate <typename Char, typename T, FMT_ENABLE_IF(!is_named_arg<T>::value)>\nvoid init_named_arg(named_arg_info<Char>*, int& arg_index, int&, const T&) {\n  ++arg_index;\n}\ntemplate <typename Char, typename T, FMT_ENABLE_IF(is_named_arg<T>::value)>\nvoid init_named_arg(named_arg_info<Char>* named_args, int& arg_index,\n                    int& named_arg_index, const T& arg) {\n  named_args[named_arg_index++] = {arg.name, arg_index++};\n}\n\n// An array of references to arguments. It can be implicitly converted to\n// `fmt::basic_format_args` for passing into type-erased formatting functions\n// such as `fmt::vformat`.\ntemplate <typename Context, size_t NUM_ARGS, size_t NUM_NAMED_ARGS,\n          unsigned long long DESC>\nstruct format_arg_store {\n  // args_[0].named_args points to named_args to avoid bloating format_args.\n  // +1 to workaround a bug in gcc 7.5 that causes duplicated-branches warning.\n  static constexpr size_t ARGS_ARR_SIZE = 1 + (NUM_ARGS != 0 ? NUM_ARGS : +1);\n\n  arg_t<Context, NUM_ARGS> args[ARGS_ARR_SIZE];\n  named_arg_info<typename Context::char_type> named_args[NUM_NAMED_ARGS];\n\n  template <typename... T>\n  FMT_MAP_API format_arg_store(T&... values)\n      : args{{named_args, NUM_NAMED_ARGS},\n             make_arg<NUM_ARGS <= max_packed_args, Context>(values)...} {\n    using dummy = int[];\n    int arg_index = 0, named_arg_index = 0;\n    (void)dummy{\n        0,\n        (init_named_arg(named_args, arg_index, named_arg_index, values), 0)...};\n  }\n\n  format_arg_store(format_arg_store&& rhs) {\n    args[0] = {named_args, NUM_NAMED_ARGS};\n    for (size_t i = 1; i < ARGS_ARR_SIZE; ++i) args[i] = rhs.args[i];\n    for (size_t i = 0; i < NUM_NAMED_ARGS; ++i)\n      named_args[i] = rhs.named_args[i];\n  }\n\n  format_arg_store(const format_arg_store& rhs) = delete;\n  format_arg_store& operator=(const format_arg_store& rhs) = delete;\n  format_arg_store& operator=(format_arg_store&& rhs) = delete;\n};\n\n// A specialization of format_arg_store without named arguments.\n// It is a plain struct to reduce binary size in debug mode.\ntemplate <typename Context, size_t NUM_ARGS, unsigned long long DESC>\nstruct format_arg_store<Context, NUM_ARGS, 0, DESC> {\n  // +1 to workaround a bug in gcc 7.5 that causes duplicated-branches warning.\n  arg_t<Context, NUM_ARGS> args[NUM_ARGS != 0 ? NUM_ARGS : +1];\n};\n\n}  // namespace detail\nFMT_BEGIN_EXPORT\n\n// A formatting argument. Context is a template parameter for the compiled API\n// where output can be unbuffered.\ntemplate <typename Context> class basic_format_arg {\n private:\n  detail::value<Context> value_;\n  detail::type type_;\n\n  template <typename ContextType, typename T>\n  friend FMT_CONSTEXPR auto detail::make_arg(T& value)\n      -> basic_format_arg<ContextType>;\n\n  friend class basic_format_args<Context>;\n  friend class dynamic_format_arg_store<Context>;\n\n  using char_type = typename Context::char_type;\n\n  template <typename, size_t, size_t, unsigned long long>\n  friend struct detail::format_arg_store;\n\n  basic_format_arg(const detail::named_arg_info<char_type>* args, size_t size)\n      : value_(args, size) {}\n\n public:\n  class handle {\n   public:\n    explicit handle(detail::custom_value<Context> custom) : custom_(custom) {}\n\n    void format(typename Context::parse_context_type& parse_ctx,\n                Context& ctx) const {\n      custom_.format(custom_.value, parse_ctx, ctx);\n    }\n\n   private:\n    detail::custom_value<Context> custom_;\n  };\n\n  constexpr basic_format_arg() : type_(detail::type::none_type) {}\n\n  constexpr explicit operator bool() const noexcept {\n    return type_ != detail::type::none_type;\n  }\n\n  auto type() const -> detail::type { return type_; }\n\n  auto is_integral() const -> bool { return detail::is_integral_type(type_); }\n  auto is_arithmetic() const -> bool {\n    return detail::is_arithmetic_type(type_);\n  }\n\n  /**\n   * Visits an argument dispatching to the appropriate visit method based on\n   * the argument type. For example, if the argument type is `double` then\n   * `vis(value)` will be called with the value of type `double`.\n   */\n  template <typename Visitor>\n  FMT_CONSTEXPR FMT_INLINE auto visit(Visitor&& vis) const -> decltype(vis(0)) {\n    switch (type_) {\n    case detail::type::none_type:\n      break;\n    case detail::type::int_type:\n      return vis(value_.int_value);\n    case detail::type::uint_type:\n      return vis(value_.uint_value);\n    case detail::type::long_long_type:\n      return vis(value_.long_long_value);\n    case detail::type::ulong_long_type:\n      return vis(value_.ulong_long_value);\n    case detail::type::int128_type:\n      return vis(detail::convert_for_visit(value_.int128_value));\n    case detail::type::uint128_type:\n      return vis(detail::convert_for_visit(value_.uint128_value));\n    case detail::type::bool_type:\n      return vis(value_.bool_value);\n    case detail::type::char_type:\n      return vis(value_.char_value);\n    case detail::type::float_type:\n      return vis(value_.float_value);\n    case detail::type::double_type:\n      return vis(value_.double_value);\n    case detail::type::long_double_type:\n      return vis(value_.long_double_value);\n    case detail::type::cstring_type:\n      return vis(value_.string.data);\n    case detail::type::string_type:\n      using sv = basic_string_view<typename Context::char_type>;\n      return vis(sv(value_.string.data, value_.string.size));\n    case detail::type::pointer_type:\n      return vis(value_.pointer);\n    case detail::type::custom_type:\n      return vis(typename basic_format_arg<Context>::handle(value_.custom));\n    }\n    return vis(monostate());\n  }\n\n  auto format_custom(const char_type* parse_begin,\n                     typename Context::parse_context_type& parse_ctx,\n                     Context& ctx) -> bool {\n    if (type_ != detail::type::custom_type) return false;\n    parse_ctx.advance_to(parse_begin);\n    value_.custom.format(value_.custom.value, parse_ctx, ctx);\n    return true;\n  }\n};\n\ntemplate <typename Visitor, typename Context>\nFMT_DEPRECATED FMT_CONSTEXPR auto visit_format_arg(\n    Visitor&& vis, const basic_format_arg<Context>& arg) -> decltype(vis(0)) {\n  return arg.visit(static_cast<Visitor&&>(vis));\n}\n\n/**\n * A view of a collection of formatting arguments. To avoid lifetime issues it\n * should only be used as a parameter type in type-erased functions such as\n * `vformat`:\n *\n *     void vlog(fmt::string_view fmt, fmt::format_args args);  // OK\n *     fmt::format_args args = fmt::make_format_args();  // Dangling reference\n */\ntemplate <typename Context> class basic_format_args {\n public:\n  using size_type = int;\n  using format_arg = basic_format_arg<Context>;\n\n private:\n  // A descriptor that contains information about formatting arguments.\n  // If the number of arguments is less or equal to max_packed_args then\n  // argument types are passed in the descriptor. This reduces binary code size\n  // per formatting function call.\n  unsigned long long desc_;\n  union {\n    // If is_packed() returns true then argument values are stored in values_;\n    // otherwise they are stored in args_. This is done to improve cache\n    // locality and reduce compiled code size since storing larger objects\n    // may require more code (at least on x86-64) even if the same amount of\n    // data is actually copied to stack. It saves ~10% on the bloat test.\n    const detail::value<Context>* values_;\n    const format_arg* args_;\n  };\n\n  constexpr auto is_packed() const -> bool {\n    return (desc_ & detail::is_unpacked_bit) == 0;\n  }\n  constexpr auto has_named_args() const -> bool {\n    return (desc_ & detail::has_named_args_bit) != 0;\n  }\n\n  FMT_CONSTEXPR auto type(int index) const -> detail::type {\n    int shift = index * detail::packed_arg_bits;\n    unsigned int mask = (1 << detail::packed_arg_bits) - 1;\n    return static_cast<detail::type>((desc_ >> shift) & mask);\n  }\n\n public:\n  constexpr basic_format_args() : desc_(0), args_(nullptr) {}\n\n  /// Constructs a `basic_format_args` object from `format_arg_store`.\n  template <size_t NUM_ARGS, size_t NUM_NAMED_ARGS, unsigned long long DESC,\n            FMT_ENABLE_IF(NUM_ARGS <= detail::max_packed_args)>\n  constexpr FMT_ALWAYS_INLINE basic_format_args(\n      const detail::format_arg_store<Context, NUM_ARGS, NUM_NAMED_ARGS, DESC>&\n          store)\n      : desc_(DESC), values_(store.args + (NUM_NAMED_ARGS != 0 ? 1 : 0)) {}\n\n  template <size_t NUM_ARGS, size_t NUM_NAMED_ARGS, unsigned long long DESC,\n            FMT_ENABLE_IF(NUM_ARGS > detail::max_packed_args)>\n  constexpr basic_format_args(\n      const detail::format_arg_store<Context, NUM_ARGS, NUM_NAMED_ARGS, DESC>&\n          store)\n      : desc_(DESC), args_(store.args + (NUM_NAMED_ARGS != 0 ? 1 : 0)) {}\n\n  /// Constructs a `basic_format_args` object from `dynamic_format_arg_store`.\n  constexpr basic_format_args(const dynamic_format_arg_store<Context>& store)\n      : desc_(store.get_types()), args_(store.data()) {}\n\n  /// Constructs a `basic_format_args` object from a dynamic list of arguments.\n  constexpr basic_format_args(const format_arg* args, int count)\n      : desc_(detail::is_unpacked_bit | detail::to_unsigned(count)),\n        args_(args) {}\n\n  /// Returns the argument with the specified id.\n  FMT_CONSTEXPR auto get(int id) const -> format_arg {\n    format_arg arg;\n    if (!is_packed()) {\n      if (id < max_size()) arg = args_[id];\n      return arg;\n    }\n    if (static_cast<unsigned>(id) >= detail::max_packed_args) return arg;\n    arg.type_ = type(id);\n    if (arg.type_ == detail::type::none_type) return arg;\n    arg.value_ = values_[id];\n    return arg;\n  }\n\n  template <typename Char>\n  auto get(basic_string_view<Char> name) const -> format_arg {\n    int id = get_id(name);\n    return id >= 0 ? get(id) : format_arg();\n  }\n\n  template <typename Char>\n  FMT_CONSTEXPR auto get_id(basic_string_view<Char> name) const -> int {\n    if (!has_named_args()) return -1;\n    const auto& named_args =\n        (is_packed() ? values_[-1] : args_[-1].value_).named_args;\n    for (size_t i = 0; i < named_args.size; ++i) {\n      if (named_args.data[i].name == name) return named_args.data[i].id;\n    }\n    return -1;\n  }\n\n  auto max_size() const -> int {\n    unsigned long long max_packed = detail::max_packed_args;\n    return static_cast<int>(is_packed() ? max_packed\n                                        : desc_ & ~detail::is_unpacked_bit);\n  }\n};\n\n// A formatting context.\nclass context {\n private:\n  appender out_;\n  basic_format_args<context> args_;\n  detail::locale_ref loc_;\n\n public:\n  /// The character type for the output.\n  using char_type = char;\n\n  using iterator = appender;\n  using format_arg = basic_format_arg<context>;\n  using parse_context_type = basic_format_parse_context<char>;\n  template <typename T> using formatter_type = formatter<T, char>;\n\n  /// Constructs a `basic_format_context` object. References to the arguments\n  /// are stored in the object so make sure they have appropriate lifetimes.\n  FMT_CONSTEXPR context(iterator out, basic_format_args<context> ctx_args,\n                        detail::locale_ref loc = {})\n      : out_(out), args_(ctx_args), loc_(loc) {}\n  context(context&&) = default;\n  context(const context&) = delete;\n  void operator=(const context&) = delete;\n\n  FMT_CONSTEXPR auto arg(int id) const -> format_arg { return args_.get(id); }\n  auto arg(string_view name) -> format_arg { return args_.get(name); }\n  FMT_CONSTEXPR auto arg_id(string_view name) -> int {\n    return args_.get_id(name);\n  }\n  auto args() const -> const basic_format_args<context>& { return args_; }\n\n  // Returns an iterator to the beginning of the output range.\n  FMT_CONSTEXPR auto out() -> iterator { return out_; }\n\n  // Advances the begin iterator to `it`.\n  void advance_to(iterator) {}\n\n  FMT_CONSTEXPR auto locale() -> detail::locale_ref { return loc_; }\n};\n\ntemplate <typename OutputIt, typename Char> class generic_context;\n\n// Longer aliases for C++20 compatibility.\ntemplate <typename OutputIt, typename Char>\nusing basic_format_context =\n    conditional_t<std::is_same<OutputIt, appender>::value, context,\n                  generic_context<OutputIt, Char>>;\nusing format_context = context;\n\ntemplate <typename Char>\nusing buffered_context = basic_format_context<basic_appender<Char>, Char>;\n\ntemplate <typename T, typename Char = char>\nusing is_formattable = bool_constant<!std::is_base_of<\n    detail::unformattable, decltype(detail::arg_mapper<buffered_context<Char>>()\n                                        .map(std::declval<T&>()))>::value>;\n\n#if FMT_USE_CONCEPTS\ntemplate <typename T, typename Char = char>\nconcept formattable = is_formattable<remove_reference_t<T>, Char>::value;\n#endif\n\n/**\n * Constructs an object that stores references to arguments and can be\n * implicitly converted to `format_args`. `Context` can be omitted in which case\n * it defaults to `format_context`. See `arg` for lifetime considerations.\n */\n// Take arguments by lvalue references to avoid some lifetime issues, e.g.\n//   auto args = make_format_args(std::string());\ntemplate <typename Context = format_context, typename... T,\n          size_t NUM_ARGS = sizeof...(T),\n          size_t NUM_NAMED_ARGS = detail::count_named_args<T...>(),\n          unsigned long long DESC = detail::make_descriptor<Context, T...>(),\n          FMT_ENABLE_IF(NUM_NAMED_ARGS == 0)>\nconstexpr FMT_ALWAYS_INLINE auto make_format_args(T&... args)\n    -> detail::format_arg_store<Context, NUM_ARGS, 0, DESC> {\n  return {{detail::make_arg<NUM_ARGS <= detail::max_packed_args, Context>(\n      args)...}};\n}\n\n#ifndef FMT_DOC\ntemplate <typename Context = format_context, typename... T,\n          size_t NUM_NAMED_ARGS = detail::count_named_args<T...>(),\n          unsigned long long DESC =\n              detail::make_descriptor<Context, T...>() |\n              static_cast<unsigned long long>(detail::has_named_args_bit),\n          FMT_ENABLE_IF(NUM_NAMED_ARGS != 0)>\nconstexpr auto make_format_args(T&... args)\n    -> detail::format_arg_store<Context, sizeof...(T), NUM_NAMED_ARGS, DESC> {\n  return {args...};\n}\n#endif\n\n/**\n * Returns a named argument to be used in a formatting function.\n * It should only be used in a call to a formatting function or\n * `dynamic_format_arg_store::push_back`.\n *\n * **Example**:\n *\n *     fmt::print(\"The answer is {answer}.\", fmt::arg(\"answer\", 42));\n */\ntemplate <typename Char, typename T>\ninline auto arg(const Char* name, const T& arg) -> detail::named_arg<Char, T> {\n  static_assert(!detail::is_named_arg<T>(), \"nested named arguments\");\n  return {name, arg};\n}\nFMT_END_EXPORT\n\n/// An alias for `basic_format_args<format_context>`.\n// A separate type would result in shorter symbols but break ABI compatibility\n// between clang and gcc on ARM (#1919).\nFMT_EXPORT using format_args = basic_format_args<format_context>;\n\n// We cannot use enum classes as bit fields because of a gcc bug, so we put them\n// in namespaces instead (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61414).\n// Additionally, if an underlying type is specified, older gcc incorrectly warns\n// that the type is too small. Both bugs are fixed in gcc 9.3.\n#if FMT_GCC_VERSION && FMT_GCC_VERSION < 903\n#  define FMT_ENUM_UNDERLYING_TYPE(type)\n#else\n#  define FMT_ENUM_UNDERLYING_TYPE(type) : type\n#endif\nnamespace align {\nenum type FMT_ENUM_UNDERLYING_TYPE(unsigned char){none, left, right, center,\n                                                  numeric};\n}\nusing align_t = align::type;\nnamespace sign {\nenum type FMT_ENUM_UNDERLYING_TYPE(unsigned char){none, minus, plus, space};\n}\nusing sign_t = sign::type;\n\nnamespace detail {\n\ntemplate <typename Char>\nusing unsigned_char = typename conditional_t<std::is_integral<Char>::value,\n                                             std::make_unsigned<Char>,\n                                             type_identity<unsigned>>::type;\n\n// Character (code unit) type is erased to prevent template bloat.\nstruct fill_t {\n private:\n  enum { max_size = 4 };\n  char data_[max_size] = {' '};\n  unsigned char size_ = 1;\n\n public:\n  template <typename Char>\n  FMT_CONSTEXPR void operator=(basic_string_view<Char> s) {\n    auto size = s.size();\n    size_ = static_cast<unsigned char>(size);\n    if (size == 1) {\n      unsigned uchar = static_cast<unsigned_char<Char>>(s[0]);\n      data_[0] = static_cast<char>(uchar);\n      data_[1] = static_cast<char>(uchar >> 8);\n      return;\n    }\n    FMT_ASSERT(size <= max_size, \"invalid fill\");\n    for (size_t i = 0; i < size; ++i) data_[i] = static_cast<char>(s[i]);\n  }\n\n  FMT_CONSTEXPR void operator=(char c) {\n    data_[0] = c;\n    size_ = 1;\n  }\n\n  constexpr auto size() const -> size_t { return size_; }\n\n  template <typename Char> constexpr auto get() const -> Char {\n    using uchar = unsigned char;\n    return static_cast<Char>(static_cast<uchar>(data_[0]) |\n                             (static_cast<uchar>(data_[1]) << 8));\n  }\n\n  template <typename Char, FMT_ENABLE_IF(std::is_same<Char, char>::value)>\n  constexpr auto data() const -> const Char* {\n    return data_;\n  }\n  template <typename Char, FMT_ENABLE_IF(!std::is_same<Char, char>::value)>\n  constexpr auto data() const -> const Char* {\n    return nullptr;\n  }\n};\n}  // namespace detail\n\nenum class presentation_type : unsigned char {\n  // Common specifiers:\n  none = 0,\n  debug = 1,   // '?'\n  string = 2,  // 's' (string, bool)\n\n  // Integral, bool and character specifiers:\n  dec = 3,  // 'd'\n  hex,      // 'x' or 'X'\n  oct,      // 'o'\n  bin,      // 'b' or 'B'\n  chr,      // 'c'\n\n  // String and pointer specifiers:\n  pointer = 3,  // 'p'\n\n  // Floating-point specifiers:\n  exp = 1,  // 'e' or 'E' (1 since there is no FP debug presentation)\n  fixed,    // 'f' or 'F'\n  general,  // 'g' or 'G'\n  hexfloat  // 'a' or 'A'\n};\n\n// Format specifiers for built-in and string types.\nstruct format_specs {\n  int width;\n  int precision;\n  presentation_type type;\n  align_t align : 4;\n  sign_t sign : 3;\n  bool upper : 1;  // An uppercase version e.g. 'X' for 'x'.\n  bool alt : 1;    // Alternate form ('#').\n  bool localized : 1;\n  detail::fill_t fill;\n\n  constexpr format_specs()\n      : width(0),\n        precision(-1),\n        type(presentation_type::none),\n        align(align::none),\n        sign(sign::none),\n        upper(false),\n        alt(false),\n        localized(false) {}\n};\n\nnamespace detail {\n\nenum class arg_id_kind { none, index, name };\n\n// An argument reference.\ntemplate <typename Char> struct arg_ref {\n  FMT_CONSTEXPR arg_ref() : kind(arg_id_kind::none), val() {}\n\n  FMT_CONSTEXPR explicit arg_ref(int index)\n      : kind(arg_id_kind::index), val(index) {}\n  FMT_CONSTEXPR explicit arg_ref(basic_string_view<Char> name)\n      : kind(arg_id_kind::name), val(name) {}\n\n  FMT_CONSTEXPR auto operator=(int idx) -> arg_ref& {\n    kind = arg_id_kind::index;\n    val.index = idx;\n    return *this;\n  }\n\n  arg_id_kind kind;\n  union value {\n    FMT_CONSTEXPR value(int idx = 0) : index(idx) {}\n    FMT_CONSTEXPR value(basic_string_view<Char> n) : name(n) {}\n\n    int index;\n    basic_string_view<Char> name;\n  } val;\n};\n\n// Format specifiers with width and precision resolved at formatting rather\n// than parsing time to allow reusing the same parsed specifiers with\n// different sets of arguments (precompilation of format strings).\ntemplate <typename Char = char> struct dynamic_format_specs : format_specs {\n  arg_ref<Char> width_ref;\n  arg_ref<Char> precision_ref;\n};\n\n// Converts a character to ASCII. Returns '\\0' on conversion failure.\ntemplate <typename Char, FMT_ENABLE_IF(std::is_integral<Char>::value)>\nconstexpr auto to_ascii(Char c) -> char {\n  return c <= 0xff ? static_cast<char>(c) : '\\0';\n}\n\n// Returns the number of code units in a code point or 1 on error.\ntemplate <typename Char>\nFMT_CONSTEXPR auto code_point_length(const Char* begin) -> int {\n  if (const_check(sizeof(Char) != 1)) return 1;\n  auto c = static_cast<unsigned char>(*begin);\n  return static_cast<int>((0x3a55000000000000ull >> (2 * (c >> 3))) & 0x3) + 1;\n}\n\n// Return the result via the out param to workaround gcc bug 77539.\ntemplate <bool IS_CONSTEXPR, typename T, typename Ptr = const T*>\nFMT_CONSTEXPR auto find(Ptr first, Ptr last, T value, Ptr& out) -> bool {\n  for (out = first; out != last; ++out) {\n    if (*out == value) return true;\n  }\n  return false;\n}\n\ntemplate <>\ninline auto find<false, char>(const char* first, const char* last, char value,\n                              const char*& out) -> bool {\n  out =\n      static_cast<const char*>(memchr(first, value, to_unsigned(last - first)));\n  return out != nullptr;\n}\n\n// Parses the range [begin, end) as an unsigned integer. This function assumes\n// that the range is non-empty and the first character is a digit.\ntemplate <typename Char>\nFMT_CONSTEXPR auto parse_nonnegative_int(const Char*& begin, const Char* end,\n                                         int error_value) noexcept -> int {\n  FMT_ASSERT(begin != end && '0' <= *begin && *begin <= '9', \"\");\n  unsigned value = 0, prev = 0;\n  auto p = begin;\n  do {\n    prev = value;\n    value = value * 10 + unsigned(*p - '0');\n    ++p;\n  } while (p != end && '0' <= *p && *p <= '9');\n  auto num_digits = p - begin;\n  begin = p;\n  int digits10 = static_cast<int>(sizeof(int) * CHAR_BIT * 3 / 10);\n  if (num_digits <= digits10) return static_cast<int>(value);\n  // Check for overflow.\n  unsigned max = INT_MAX;\n  return num_digits == digits10 + 1 &&\n                 prev * 10ull + unsigned(p[-1] - '0') <= max\n             ? static_cast<int>(value)\n             : error_value;\n}\n\nFMT_CONSTEXPR inline auto parse_align(char c) -> align_t {\n  switch (c) {\n  case '<':\n    return align::left;\n  case '>':\n    return align::right;\n  case '^':\n    return align::center;\n  }\n  return align::none;\n}\n\ntemplate <typename Char> constexpr auto is_name_start(Char c) -> bool {\n  return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || c == '_';\n}\n\ntemplate <typename Char, typename Handler>\nFMT_CONSTEXPR auto do_parse_arg_id(const Char* begin, const Char* end,\n                                   Handler&& handler) -> const Char* {\n  Char c = *begin;\n  if (c >= '0' && c <= '9') {\n    int index = 0;\n    if (c != '0')\n      index = parse_nonnegative_int(begin, end, INT_MAX);\n    else\n      ++begin;\n    if (begin == end || (*begin != '}' && *begin != ':'))\n      report_error(\"invalid format string\");\n    else\n      handler.on_index(index);\n    return begin;\n  }\n  if (!is_name_start(c)) {\n    report_error(\"invalid format string\");\n    return begin;\n  }\n  auto it = begin;\n  do {\n    ++it;\n  } while (it != end && (is_name_start(*it) || ('0' <= *it && *it <= '9')));\n  handler.on_name({begin, to_unsigned(it - begin)});\n  return it;\n}\n\ntemplate <typename Char, typename Handler>\nFMT_CONSTEXPR auto parse_arg_id(const Char* begin, const Char* end,\n                                Handler&& handler) -> const Char* {\n  FMT_ASSERT(begin != end, \"\");\n  Char c = *begin;\n  if (c != '}' && c != ':') return do_parse_arg_id(begin, end, handler);\n  handler.on_auto();\n  return begin;\n}\n\ntemplate <typename Char> struct dynamic_spec_id_handler {\n  basic_format_parse_context<Char>& ctx;\n  arg_ref<Char>& ref;\n\n  FMT_CONSTEXPR void on_auto() {\n    int id = ctx.next_arg_id();\n    ref = arg_ref<Char>(id);\n    ctx.check_dynamic_spec(id);\n  }\n  FMT_CONSTEXPR void on_index(int id) {\n    ref = arg_ref<Char>(id);\n    ctx.check_arg_id(id);\n    ctx.check_dynamic_spec(id);\n  }\n  FMT_CONSTEXPR void on_name(basic_string_view<Char> id) {\n    ref = arg_ref<Char>(id);\n    ctx.check_arg_id(id);\n  }\n};\n\n// Parses [integer | \"{\" [arg_id] \"}\"].\ntemplate <typename Char>\nFMT_CONSTEXPR auto parse_dynamic_spec(const Char* begin, const Char* end,\n                                      int& value, arg_ref<Char>& ref,\n                                      basic_format_parse_context<Char>& ctx)\n    -> const Char* {\n  FMT_ASSERT(begin != end, \"\");\n  if ('0' <= *begin && *begin <= '9') {\n    int val = parse_nonnegative_int(begin, end, -1);\n    if (val != -1)\n      value = val;\n    else\n      report_error(\"number is too big\");\n  } else if (*begin == '{') {\n    ++begin;\n    auto handler = dynamic_spec_id_handler<Char>{ctx, ref};\n    if (begin != end) begin = parse_arg_id(begin, end, handler);\n    if (begin != end && *begin == '}') return ++begin;\n    report_error(\"invalid format string\");\n  }\n  return begin;\n}\n\ntemplate <typename Char>\nFMT_CONSTEXPR auto parse_precision(const Char* begin, const Char* end,\n                                   int& value, arg_ref<Char>& ref,\n                                   basic_format_parse_context<Char>& ctx)\n    -> const Char* {\n  ++begin;\n  if (begin == end || *begin == '}') {\n    report_error(\"invalid precision\");\n    return begin;\n  }\n  return parse_dynamic_spec(begin, end, value, ref, ctx);\n}\n\nenum class state { start, align, sign, hash, zero, width, precision, locale };\n\n// Parses standard format specifiers.\ntemplate <typename Char>\nFMT_CONSTEXPR auto parse_format_specs(const Char* begin, const Char* end,\n                                      dynamic_format_specs<Char>& specs,\n                                      basic_format_parse_context<Char>& ctx,\n                                      type arg_type) -> const Char* {\n  auto c = '\\0';\n  if (end - begin > 1) {\n    auto next = to_ascii(begin[1]);\n    c = parse_align(next) == align::none ? to_ascii(*begin) : '\\0';\n  } else {\n    if (begin == end) return begin;\n    c = to_ascii(*begin);\n  }\n\n  struct {\n    state current_state = state::start;\n    FMT_CONSTEXPR void operator()(state s, bool valid = true) {\n      if (current_state >= s || !valid)\n        report_error(\"invalid format specifier\");\n      current_state = s;\n    }\n  } enter_state;\n\n  using pres = presentation_type;\n  constexpr auto integral_set = sint_set | uint_set | bool_set | char_set;\n  struct {\n    const Char*& begin;\n    dynamic_format_specs<Char>& specs;\n    type arg_type;\n\n    FMT_CONSTEXPR auto operator()(pres pres_type, int set) -> const Char* {\n      if (!in(arg_type, set)) {\n        if (arg_type == type::none_type) return begin;\n        report_error(\"invalid format specifier\");\n      }\n      specs.type = pres_type;\n      return begin + 1;\n    }\n  } parse_presentation_type{begin, specs, arg_type};\n\n  for (;;) {\n    switch (c) {\n    case '<':\n    case '>':\n    case '^':\n      enter_state(state::align);\n      specs.align = parse_align(c);\n      ++begin;\n      break;\n    case '+':\n    case '-':\n    case ' ':\n      if (arg_type == type::none_type) return begin;\n      enter_state(state::sign, in(arg_type, sint_set | float_set));\n      switch (c) {\n      case '+':\n        specs.sign = sign::plus;\n        break;\n      case '-':\n        specs.sign = sign::minus;\n        break;\n      case ' ':\n        specs.sign = sign::space;\n        break;\n      }\n      ++begin;\n      break;\n    case '#':\n      if (arg_type == type::none_type) return begin;\n      enter_state(state::hash, is_arithmetic_type(arg_type));\n      specs.alt = true;\n      ++begin;\n      break;\n    case '0':\n      enter_state(state::zero);\n      if (!is_arithmetic_type(arg_type)) {\n        if (arg_type == type::none_type) return begin;\n        report_error(\"format specifier requires numeric argument\");\n      }\n      if (specs.align == align::none) {\n        // Ignore 0 if align is specified for compatibility with std::format.\n        specs.align = align::numeric;\n        specs.fill = '0';\n      }\n      ++begin;\n      break;\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    case '{':\n      enter_state(state::width);\n      begin = parse_dynamic_spec(begin, end, specs.width, specs.width_ref, ctx);\n      break;\n    case '.':\n      if (arg_type == type::none_type) return begin;\n      enter_state(state::precision,\n                  in(arg_type, float_set | string_set | cstring_set));\n      begin = parse_precision(begin, end, specs.precision, specs.precision_ref,\n                              ctx);\n      break;\n    case 'L':\n      if (arg_type == type::none_type) return begin;\n      enter_state(state::locale, is_arithmetic_type(arg_type));\n      specs.localized = true;\n      ++begin;\n      break;\n    case 'd':\n      return parse_presentation_type(pres::dec, integral_set);\n    case 'X':\n      specs.upper = true;\n      FMT_FALLTHROUGH;\n    case 'x':\n      return parse_presentation_type(pres::hex, integral_set);\n    case 'o':\n      return parse_presentation_type(pres::oct, integral_set);\n    case 'B':\n      specs.upper = true;\n      FMT_FALLTHROUGH;\n    case 'b':\n      return parse_presentation_type(pres::bin, integral_set);\n    case 'E':\n      specs.upper = true;\n      FMT_FALLTHROUGH;\n    case 'e':\n      return parse_presentation_type(pres::exp, float_set);\n    case 'F':\n      specs.upper = true;\n      FMT_FALLTHROUGH;\n    case 'f':\n      return parse_presentation_type(pres::fixed, float_set);\n    case 'G':\n      specs.upper = true;\n      FMT_FALLTHROUGH;\n    case 'g':\n      return parse_presentation_type(pres::general, float_set);\n    case 'A':\n      specs.upper = true;\n      FMT_FALLTHROUGH;\n    case 'a':\n      return parse_presentation_type(pres::hexfloat, float_set);\n    case 'c':\n      if (arg_type == type::bool_type) report_error(\"invalid format specifier\");\n      return parse_presentation_type(pres::chr, integral_set);\n    case 's':\n      return parse_presentation_type(pres::string,\n                                     bool_set | string_set | cstring_set);\n    case 'p':\n      return parse_presentation_type(pres::pointer, pointer_set | cstring_set);\n    case '?':\n      return parse_presentation_type(pres::debug,\n                                     char_set | string_set | cstring_set);\n    case '}':\n      return begin;\n    default: {\n      if (*begin == '}') return begin;\n      // Parse fill and alignment.\n      auto fill_end = begin + code_point_length(begin);\n      if (end - fill_end <= 0) {\n        report_error(\"invalid format specifier\");\n        return begin;\n      }\n      if (*begin == '{') {\n        report_error(\"invalid fill character '{'\");\n        return begin;\n      }\n      auto align = parse_align(to_ascii(*fill_end));\n      enter_state(state::align, align != align::none);\n      specs.fill =\n          basic_string_view<Char>(begin, to_unsigned(fill_end - begin));\n      specs.align = align;\n      begin = fill_end + 1;\n    }\n    }\n    if (begin == end) return begin;\n    c = to_ascii(*begin);\n  }\n}\n\ntemplate <typename Char, typename Handler>\nFMT_CONSTEXPR auto parse_replacement_field(const Char* begin, const Char* end,\n                                           Handler&& handler) -> const Char* {\n  struct id_adapter {\n    Handler& handler;\n    int arg_id;\n\n    FMT_CONSTEXPR void on_auto() { arg_id = handler.on_arg_id(); }\n    FMT_CONSTEXPR void on_index(int id) { arg_id = handler.on_arg_id(id); }\n    FMT_CONSTEXPR void on_name(basic_string_view<Char> id) {\n      arg_id = handler.on_arg_id(id);\n    }\n  };\n\n  ++begin;\n  if (begin == end) return handler.on_error(\"invalid format string\"), end;\n  if (*begin == '}') {\n    handler.on_replacement_field(handler.on_arg_id(), begin);\n  } else if (*begin == '{') {\n    handler.on_text(begin, begin + 1);\n  } else {\n    auto adapter = id_adapter{handler, 0};\n    begin = parse_arg_id(begin, end, adapter);\n    Char c = begin != end ? *begin : Char();\n    if (c == '}') {\n      handler.on_replacement_field(adapter.arg_id, begin);\n    } else if (c == ':') {\n      begin = handler.on_format_specs(adapter.arg_id, begin + 1, end);\n      if (begin == end || *begin != '}')\n        return handler.on_error(\"unknown format specifier\"), end;\n    } else {\n      return handler.on_error(\"missing '}' in format string\"), end;\n    }\n  }\n  return begin + 1;\n}\n\ntemplate <bool IS_CONSTEXPR, typename Char, typename Handler>\nFMT_CONSTEXPR void parse_format_string(basic_string_view<Char> format_str,\n                                       Handler&& handler) {\n  auto begin = format_str.data();\n  auto end = begin + format_str.size();\n  if (end - begin < 32) {\n    // Use a simple loop instead of memchr for small strings.\n    const Char* p = begin;\n    while (p != end) {\n      auto c = *p++;\n      if (c == '{') {\n        handler.on_text(begin, p - 1);\n        begin = p = parse_replacement_field(p - 1, end, handler);\n      } else if (c == '}') {\n        if (p == end || *p != '}')\n          return handler.on_error(\"unmatched '}' in format string\");\n        handler.on_text(begin, p);\n        begin = ++p;\n      }\n    }\n    handler.on_text(begin, end);\n    return;\n  }\n  struct writer {\n    FMT_CONSTEXPR void operator()(const Char* from, const Char* to) {\n      if (from == to) return;\n      for (;;) {\n        const Char* p = nullptr;\n        if (!find<IS_CONSTEXPR>(from, to, Char('}'), p))\n          return handler_.on_text(from, to);\n        ++p;\n        if (p == to || *p != '}')\n          return handler_.on_error(\"unmatched '}' in format string\");\n        handler_.on_text(from, p);\n        from = p + 1;\n      }\n    }\n    Handler& handler_;\n  } write = {handler};\n  while (begin != end) {\n    // Doing two passes with memchr (one for '{' and another for '}') is up to\n    // 2.5x faster than the naive one-pass implementation on big format strings.\n    const Char* p = begin;\n    if (*begin != '{' && !find<IS_CONSTEXPR>(begin + 1, end, Char('{'), p))\n      return write(begin, end);\n    write(begin, p);\n    begin = parse_replacement_field(p, end, handler);\n  }\n}\n\ntemplate <typename T, bool = is_named_arg<T>::value> struct strip_named_arg {\n  using type = T;\n};\ntemplate <typename T> struct strip_named_arg<T, true> {\n  using type = remove_cvref_t<decltype(T::value)>;\n};\n\ntemplate <typename T, typename ParseContext>\nFMT_VISIBILITY(\"hidden\")  // Suppress an ld warning on macOS (#3769).\nFMT_CONSTEXPR auto parse_format_specs(ParseContext& ctx)\n    -> decltype(ctx.begin()) {\n  using char_type = typename ParseContext::char_type;\n  using context = buffered_context<char_type>;\n  using mapped_type = conditional_t<\n      mapped_type_constant<T, context>::value != type::custom_type,\n      decltype(arg_mapper<context>().map(std::declval<const T&>())),\n      typename strip_named_arg<T>::type>;\n#if defined(__cpp_if_constexpr)\n  if constexpr (std::is_default_constructible<\n                    formatter<mapped_type, char_type>>::value) {\n    return formatter<mapped_type, char_type>().parse(ctx);\n  } else {\n    type_is_unformattable_for<T, char_type> _;\n    return ctx.begin();\n  }\n#else\n  return formatter<mapped_type, char_type>().parse(ctx);\n#endif\n}\n\n// Checks char specs and returns true iff the presentation type is char-like.\nFMT_CONSTEXPR inline auto check_char_specs(const format_specs& specs) -> bool {\n  if (specs.type != presentation_type::none &&\n      specs.type != presentation_type::chr &&\n      specs.type != presentation_type::debug) {\n    return false;\n  }\n  if (specs.align == align::numeric || specs.sign != sign::none || specs.alt)\n    report_error(\"invalid format specifier for char\");\n  return true;\n}\n\n#if FMT_USE_NONTYPE_TEMPLATE_ARGS\ntemplate <int N, typename T, typename... Args, typename Char>\nconstexpr auto get_arg_index_by_name(basic_string_view<Char> name) -> int {\n  if constexpr (is_statically_named_arg<T>()) {\n    if (name == T::name) return N;\n  }\n  if constexpr (sizeof...(Args) > 0)\n    return get_arg_index_by_name<N + 1, Args...>(name);\n  (void)name;  // Workaround an MSVC bug about \"unused\" parameter.\n  return -1;\n}\n#endif\n\ntemplate <typename... Args, typename Char>\nFMT_CONSTEXPR auto get_arg_index_by_name(basic_string_view<Char> name) -> int {\n#if FMT_USE_NONTYPE_TEMPLATE_ARGS\n  if constexpr (sizeof...(Args) > 0)\n    return get_arg_index_by_name<0, Args...>(name);\n#endif\n  (void)name;\n  return -1;\n}\n\ntemplate <typename Char, typename... Args> class format_string_checker {\n private:\n  using parse_context_type = compile_parse_context<Char>;\n  static constexpr int num_args = sizeof...(Args);\n\n  // Format specifier parsing function.\n  // In the future basic_format_parse_context will replace compile_parse_context\n  // here and will use is_constant_evaluated and downcasting to access the data\n  // needed for compile-time checks: https://godbolt.org/z/GvWzcTjh1.\n  using parse_func = const Char* (*)(parse_context_type&);\n\n  type types_[num_args > 0 ? static_cast<size_t>(num_args) : 1];\n  parse_context_type context_;\n  parse_func parse_funcs_[num_args > 0 ? static_cast<size_t>(num_args) : 1];\n\n public:\n  explicit FMT_CONSTEXPR format_string_checker(basic_string_view<Char> fmt)\n      : types_{mapped_type_constant<Args, buffered_context<Char>>::value...},\n        context_(fmt, num_args, types_),\n        parse_funcs_{&parse_format_specs<Args, parse_context_type>...} {}\n\n  FMT_CONSTEXPR void on_text(const Char*, const Char*) {}\n\n  FMT_CONSTEXPR auto on_arg_id() -> int { return context_.next_arg_id(); }\n  FMT_CONSTEXPR auto on_arg_id(int id) -> int {\n    return context_.check_arg_id(id), id;\n  }\n  FMT_CONSTEXPR auto on_arg_id(basic_string_view<Char> id) -> int {\n#if FMT_USE_NONTYPE_TEMPLATE_ARGS\n    auto index = get_arg_index_by_name<Args...>(id);\n    if (index < 0) on_error(\"named argument is not found\");\n    return index;\n#else\n    (void)id;\n    on_error(\"compile-time checks for named arguments require C++20 support\");\n    return 0;\n#endif\n  }\n\n  FMT_CONSTEXPR void on_replacement_field(int id, const Char* begin) {\n    on_format_specs(id, begin, begin);  // Call parse() on empty specs.\n  }\n\n  FMT_CONSTEXPR auto on_format_specs(int id, const Char* begin, const Char*)\n      -> const Char* {\n    context_.advance_to(begin);\n    // id >= 0 check is a workaround for gcc 10 bug (#2065).\n    return id >= 0 && id < num_args ? parse_funcs_[id](context_) : begin;\n  }\n\n  FMT_NORETURN FMT_CONSTEXPR void on_error(const char* message) {\n    report_error(message);\n  }\n};\n\n// A base class for compile-time strings.\nstruct compile_string {};\n\ntemplate <typename S>\nusing is_compile_string = std::is_base_of<compile_string, S>;\n\n// Reports a compile-time error if S is not a valid format string.\ntemplate <typename..., typename S, FMT_ENABLE_IF(!is_compile_string<S>::value)>\nFMT_ALWAYS_INLINE void check_format_string(const S&) {\n#ifdef FMT_ENFORCE_COMPILE_STRING\n  static_assert(is_compile_string<S>::value,\n                \"FMT_ENFORCE_COMPILE_STRING requires all format strings to use \"\n                \"FMT_STRING.\");\n#endif\n}\ntemplate <typename... Args, typename S,\n          FMT_ENABLE_IF(is_compile_string<S>::value)>\nvoid check_format_string(S format_str) {\n  using char_t = typename S::char_type;\n  FMT_CONSTEXPR auto s = basic_string_view<char_t>(format_str);\n  using checker = format_string_checker<char_t, remove_cvref_t<Args>...>;\n  FMT_CONSTEXPR bool error = (parse_format_string<true>(s, checker(s)), true);\n  ignore_unused(error);\n}\n\n// Report truncation to prevent silent data loss.\ninline void report_truncation(bool truncated) {\n  if (truncated) report_error(\"output is truncated\");\n}\n\n// Use vformat_args and avoid type_identity to keep symbols short and workaround\n// a GCC <= 4.8 bug.\ntemplate <typename Char = char> struct vformat_args {\n  using type = basic_format_args<buffered_context<Char>>;\n};\ntemplate <> struct vformat_args<char> {\n  using type = format_args;\n};\n\ntemplate <typename Char>\nvoid vformat_to(buffer<Char>& buf, basic_string_view<Char> fmt,\n                typename vformat_args<Char>::type args, locale_ref loc = {});\n\nFMT_API void vprint_mojibake(FILE*, string_view, format_args, bool = false);\n#ifndef _WIN32\ninline void vprint_mojibake(FILE*, string_view, format_args, bool) {}\n#endif\n\ntemplate <typename T, typename Char, type TYPE> struct native_formatter {\n private:\n  dynamic_format_specs<Char> specs_;\n\n public:\n  using nonlocking = void;\n\n  template <typename ParseContext>\n  FMT_CONSTEXPR auto parse(ParseContext& ctx) -> const Char* {\n    if (ctx.begin() == ctx.end() || *ctx.begin() == '}') return ctx.begin();\n    auto end = parse_format_specs(ctx.begin(), ctx.end(), specs_, ctx, TYPE);\n    if (const_check(TYPE == type::char_type)) check_char_specs(specs_);\n    return end;\n  }\n\n  template <type U = TYPE,\n            FMT_ENABLE_IF(U == type::string_type || U == type::cstring_type ||\n                          U == type::char_type)>\n  FMT_CONSTEXPR void set_debug_format(bool set = true) {\n    specs_.type = set ? presentation_type::debug : presentation_type::none;\n  }\n\n  template <typename FormatContext>\n  FMT_CONSTEXPR auto format(const T& val, FormatContext& ctx) const\n      -> decltype(ctx.out());\n};\n}  // namespace detail\n\nFMT_BEGIN_EXPORT\n\n// A formatter specialization for natively supported types.\ntemplate <typename T, typename Char>\nstruct formatter<T, Char,\n                 enable_if_t<detail::type_constant<T, Char>::value !=\n                             detail::type::custom_type>>\n    : detail::native_formatter<T, Char, detail::type_constant<T, Char>::value> {\n};\n\ntemplate <typename Char = char> struct runtime_format_string {\n  basic_string_view<Char> str;\n};\n\n/// A compile-time format string.\ntemplate <typename Char, typename... Args> class basic_format_string {\n private:\n  basic_string_view<Char> str_;\n\n public:\n  template <\n      typename S,\n      FMT_ENABLE_IF(\n          std::is_convertible<const S&, basic_string_view<Char>>::value ||\n          (detail::is_compile_string<S>::value &&\n           std::is_constructible<basic_string_view<Char>, const S&>::value))>\n  FMT_CONSTEVAL FMT_ALWAYS_INLINE basic_format_string(const S& s) : str_(s) {\n    static_assert(\n        detail::count<\n            (std::is_base_of<detail::view, remove_reference_t<Args>>::value &&\n             std::is_reference<Args>::value)...>() == 0,\n        \"passing views as lvalues is disallowed\");\n#if FMT_USE_CONSTEVAL\n    if constexpr (detail::count_named_args<Args...>() ==\n                  detail::count_statically_named_args<Args...>()) {\n      using checker =\n          detail::format_string_checker<Char, remove_cvref_t<Args>...>;\n      detail::parse_format_string<true>(str_, checker(s));\n    }\n#else\n    detail::check_format_string<Args...>(s);\n#endif\n  }\n  basic_format_string(runtime_format_string<Char> fmt) : str_(fmt.str) {}\n\n  FMT_ALWAYS_INLINE operator basic_string_view<Char>() const { return str_; }\n  auto get() const -> basic_string_view<Char> { return str_; }\n};\n\n#if FMT_GCC_VERSION && FMT_GCC_VERSION < 409\n// Workaround broken conversion on older gcc.\ntemplate <typename...> using format_string = string_view;\ninline auto runtime(string_view s) -> string_view { return s; }\n#else\ntemplate <typename... Args>\nusing format_string = basic_format_string<char, type_identity_t<Args>...>;\n/**\n * Creates a runtime format string.\n *\n * **Example**:\n *\n *     // Check format string at runtime instead of compile-time.\n *     fmt::print(fmt::runtime(\"{:d}\"), \"I am not a number\");\n */\ninline auto runtime(string_view s) -> runtime_format_string<> { return {{s}}; }\n#endif\n\n/// Formats a string and writes the output to `out`.\ntemplate <typename OutputIt,\n          FMT_ENABLE_IF(detail::is_output_iterator<remove_cvref_t<OutputIt>,\n                                                   char>::value)>\nauto vformat_to(OutputIt&& out, string_view fmt, format_args args)\n    -> remove_cvref_t<OutputIt> {\n  auto&& buf = detail::get_buffer<char>(out);\n  detail::vformat_to(buf, fmt, args, {});\n  return detail::get_iterator(buf, out);\n}\n\n/**\n * Formats `args` according to specifications in `fmt`, writes the result to\n * the output iterator `out` and returns the iterator past the end of the output\n * range. `format_to` does not append a terminating null character.\n *\n * **Example**:\n *\n *     auto out = std::vector<char>();\n *     fmt::format_to(std::back_inserter(out), \"{}\", 42);\n */\ntemplate <typename OutputIt, typename... T,\n          FMT_ENABLE_IF(detail::is_output_iterator<remove_cvref_t<OutputIt>,\n                                                   char>::value)>\nFMT_INLINE auto format_to(OutputIt&& out, format_string<T...> fmt, T&&... args)\n    -> remove_cvref_t<OutputIt> {\n  return vformat_to(FMT_FWD(out), fmt, fmt::make_format_args(args...));\n}\n\ntemplate <typename OutputIt> struct format_to_n_result {\n  /// Iterator past the end of the output range.\n  OutputIt out;\n  /// Total (not truncated) output size.\n  size_t size;\n};\n\ntemplate <typename OutputIt, typename... T,\n          FMT_ENABLE_IF(detail::is_output_iterator<OutputIt, char>::value)>\nauto vformat_to_n(OutputIt out, size_t n, string_view fmt, format_args args)\n    -> format_to_n_result<OutputIt> {\n  using traits = detail::fixed_buffer_traits;\n  auto buf = detail::iterator_buffer<OutputIt, char, traits>(out, n);\n  detail::vformat_to(buf, fmt, args, {});\n  return {buf.out(), buf.count()};\n}\n\n/**\n * Formats `args` according to specifications in `fmt`, writes up to `n`\n * characters of the result to the output iterator `out` and returns the total\n * (not truncated) output size and the iterator past the end of the output\n * range. `format_to_n` does not append a terminating null character.\n */\ntemplate <typename OutputIt, typename... T,\n          FMT_ENABLE_IF(detail::is_output_iterator<OutputIt, char>::value)>\nFMT_INLINE auto format_to_n(OutputIt out, size_t n, format_string<T...> fmt,\n                            T&&... args) -> format_to_n_result<OutputIt> {\n  return vformat_to_n(out, n, fmt, fmt::make_format_args(args...));\n}\n\ntemplate <typename OutputIt, typename Sentinel = OutputIt>\nstruct format_to_result {\n  /// Iterator pointing to just after the last successful write in the range.\n  OutputIt out;\n  /// Specifies if the output was truncated.\n  bool truncated;\n\n  FMT_CONSTEXPR operator OutputIt&() & {\n    detail::report_truncation(truncated);\n    return out;\n  }\n  FMT_CONSTEXPR operator const OutputIt&() const& {\n    detail::report_truncation(truncated);\n    return out;\n  }\n  FMT_CONSTEXPR operator OutputIt&&() && {\n    detail::report_truncation(truncated);\n    return static_cast<OutputIt&&>(out);\n  }\n};\n\ntemplate <size_t N>\nauto vformat_to(char (&out)[N], string_view fmt, format_args args)\n    -> format_to_result<char*> {\n  auto result = vformat_to_n(out, N, fmt, args);\n  return {result.out, result.size > N};\n}\n\ntemplate <size_t N, typename... T>\nFMT_INLINE auto format_to(char (&out)[N], format_string<T...> fmt, T&&... args)\n    -> format_to_result<char*> {\n  auto result = fmt::format_to_n(out, N, fmt, static_cast<T&&>(args)...);\n  return {result.out, result.size > N};\n}\n\n/// Returns the number of chars in the output of `format(fmt, args...)`.\ntemplate <typename... T>\nFMT_NODISCARD FMT_INLINE auto formatted_size(format_string<T...> fmt,\n                                             T&&... args) -> size_t {\n  auto buf = detail::counting_buffer<>();\n  detail::vformat_to<char>(buf, fmt, fmt::make_format_args(args...), {});\n  return buf.count();\n}\n\nFMT_API void vprint(string_view fmt, format_args args);\nFMT_API void vprint(FILE* f, string_view fmt, format_args args);\nFMT_API void vprint_buffered(FILE* f, string_view fmt, format_args args);\nFMT_API void vprintln(FILE* f, string_view fmt, format_args args);\n\n/**\n * Formats `args` according to specifications in `fmt` and writes the output\n * to `stdout`.\n *\n * **Example**:\n *\n *     fmt::print(\"The answer is {}.\", 42);\n */\ntemplate <typename... T>\nFMT_INLINE void print(format_string<T...> fmt, T&&... args) {\n  const auto& vargs = fmt::make_format_args(args...);\n  if (!detail::use_utf8()) return detail::vprint_mojibake(stdout, fmt, vargs);\n  return detail::is_locking<T...>() ? vprint_buffered(stdout, fmt, vargs)\n                                    : vprint(fmt, vargs);\n}\n\n/**\n * Formats `args` according to specifications in `fmt` and writes the\n * output to the file `f`.\n *\n * **Example**:\n *\n *     fmt::print(stderr, \"Don't {}!\", \"panic\");\n */\ntemplate <typename... T>\nFMT_INLINE void print(FILE* f, format_string<T...> fmt, T&&... args) {\n  const auto& vargs = fmt::make_format_args(args...);\n  if (!detail::use_utf8()) return detail::vprint_mojibake(f, fmt, vargs);\n  return detail::is_locking<T...>() ? vprint_buffered(f, fmt, vargs)\n                                    : vprint(f, fmt, vargs);\n}\n\n/// Formats `args` according to specifications in `fmt` and writes the output\n/// to the file `f` followed by a newline.\ntemplate <typename... T>\nFMT_INLINE void println(FILE* f, format_string<T...> fmt, T&&... args) {\n  const auto& vargs = fmt::make_format_args(args...);\n  return detail::use_utf8() ? vprintln(f, fmt, vargs)\n                            : detail::vprint_mojibake(f, fmt, vargs, true);\n}\n\n/// Formats `args` according to specifications in `fmt` and writes the output\n/// to `stdout` followed by a newline.\ntemplate <typename... T>\nFMT_INLINE void println(format_string<T...> fmt, T&&... args) {\n  return fmt::println(stdout, fmt, static_cast<T&&>(args)...);\n}\n\nFMT_END_EXPORT\nFMT_GCC_PRAGMA(\"GCC pop_options\")\nFMT_END_NAMESPACE\n\n#ifdef FMT_HEADER_ONLY\n#  include \"format.h\"\n#endif\n#endif  // FMT_BASE_H_\n"
  },
  {
    "path": "vendor/fmt/format-inl.h",
    "content": "// Formatting library for C++ - implementation\n//\n// Copyright (c) 2012 - 2016, Victor Zverovich\n// All rights reserved.\n//\n// For the license information refer to format.h.\n\n#ifndef FMT_FORMAT_INL_H_\n#define FMT_FORMAT_INL_H_\n\n#ifndef FMT_MODULE\n#  include <algorithm>\n#  include <cerrno>  // errno\n#  include <climits>\n#  include <cmath>\n#  include <exception>\n\n#  if !defined(FMT_STATIC_THOUSANDS_SEPARATOR)\n#    include <locale>\n#  endif\n#endif\n\n#if defined(_WIN32) && !defined(FMT_USE_WRITE_CONSOLE)\n#  include <io.h>  // _isatty\n#endif\n\n#include \"format.h\"\n\nFMT_BEGIN_NAMESPACE\nnamespace detail {\n\nFMT_FUNC void assert_fail(const char* file, int line, const char* message) {\n  // Use unchecked std::fprintf to avoid triggering another assertion when\n  // writing to stderr fails\n  std::fprintf(stderr, \"%s:%d: assertion failed: %s\", file, line, message);\n  // Chosen instead of std::abort to satisfy Clang in CUDA mode during device\n  // code pass.\n  std::terminate();\n}\n\nFMT_FUNC void format_error_code(detail::buffer<char>& out, int error_code,\n                                string_view message) noexcept {\n  // Report error code making sure that the output fits into\n  // inline_buffer_size to avoid dynamic memory allocation and potential\n  // bad_alloc.\n  out.try_resize(0);\n  static const char SEP[] = \": \";\n  static const char ERROR_STR[] = \"error \";\n  // Subtract 2 to account for terminating null characters in SEP and ERROR_STR.\n  size_t error_code_size = sizeof(SEP) + sizeof(ERROR_STR) - 2;\n  auto abs_value = static_cast<uint32_or_64_or_128_t<int>>(error_code);\n  if (detail::is_negative(error_code)) {\n    abs_value = 0 - abs_value;\n    ++error_code_size;\n  }\n  error_code_size += detail::to_unsigned(detail::count_digits(abs_value));\n  auto it = appender(out);\n  if (message.size() <= inline_buffer_size - error_code_size)\n    fmt::format_to(it, FMT_STRING(\"{}{}\"), message, SEP);\n  fmt::format_to(it, FMT_STRING(\"{}{}\"), ERROR_STR, error_code);\n  FMT_ASSERT(out.size() <= inline_buffer_size, \"\");\n}\n\nFMT_FUNC void report_error(format_func func, int error_code,\n                           const char* message) noexcept {\n  memory_buffer full_message;\n  func(full_message, error_code, message);\n  // Don't use fwrite_fully because the latter may throw.\n  if (std::fwrite(full_message.data(), full_message.size(), 1, stderr) > 0)\n    std::fputc('\\n', stderr);\n}\n\n// A wrapper around fwrite that throws on error.\ninline void fwrite_fully(const void* ptr, size_t count, FILE* stream) {\n  size_t written = std::fwrite(ptr, 1, count, stream);\n  if (written < count)\n    FMT_THROW(system_error(errno, FMT_STRING(\"cannot write to file\")));\n}\n\n#ifndef FMT_STATIC_THOUSANDS_SEPARATOR\ntemplate <typename Locale>\nlocale_ref::locale_ref(const Locale& loc) : locale_(&loc) {\n  static_assert(std::is_same<Locale, std::locale>::value, \"\");\n}\n\ntemplate <typename Locale> auto locale_ref::get() const -> Locale {\n  static_assert(std::is_same<Locale, std::locale>::value, \"\");\n  return locale_ ? *static_cast<const std::locale*>(locale_) : std::locale();\n}\n\ntemplate <typename Char>\nFMT_FUNC auto thousands_sep_impl(locale_ref loc) -> thousands_sep_result<Char> {\n  auto& facet = std::use_facet<std::numpunct<Char>>(loc.get<std::locale>());\n  auto grouping = facet.grouping();\n  auto thousands_sep = grouping.empty() ? Char() : facet.thousands_sep();\n  return {std::move(grouping), thousands_sep};\n}\ntemplate <typename Char>\nFMT_FUNC auto decimal_point_impl(locale_ref loc) -> Char {\n  return std::use_facet<std::numpunct<Char>>(loc.get<std::locale>())\n      .decimal_point();\n}\n#else\ntemplate <typename Char>\nFMT_FUNC auto thousands_sep_impl(locale_ref) -> thousands_sep_result<Char> {\n  return {\"\\03\", FMT_STATIC_THOUSANDS_SEPARATOR};\n}\ntemplate <typename Char> FMT_FUNC Char decimal_point_impl(locale_ref) {\n  return '.';\n}\n#endif\n\nFMT_FUNC auto write_loc(appender out, loc_value value,\n                        const format_specs& specs, locale_ref loc) -> bool {\n#ifdef FMT_STATIC_THOUSANDS_SEPARATOR\n  value.visit(loc_writer<>{\n      out, specs, std::string(1, FMT_STATIC_THOUSANDS_SEPARATOR), \"\\3\", \".\"});\n  return true;\n#else\n  auto locale = loc.get<std::locale>();\n  // We cannot use the num_put<char> facet because it may produce output in\n  // a wrong encoding.\n  using facet = format_facet<std::locale>;\n  if (std::has_facet<facet>(locale))\n    return std::use_facet<facet>(locale).put(out, value, specs);\n  return facet(locale).put(out, value, specs);\n#endif\n}\n}  // namespace detail\n\nFMT_FUNC void report_error(const char* message) {\n  FMT_THROW(format_error(message));\n}\n\ntemplate <typename Locale> typename Locale::id format_facet<Locale>::id;\n\n#ifndef FMT_STATIC_THOUSANDS_SEPARATOR\ntemplate <typename Locale> format_facet<Locale>::format_facet(Locale& loc) {\n  auto& numpunct = std::use_facet<std::numpunct<char>>(loc);\n  grouping_ = numpunct.grouping();\n  if (!grouping_.empty()) separator_ = std::string(1, numpunct.thousands_sep());\n}\n\ntemplate <>\nFMT_API FMT_FUNC auto format_facet<std::locale>::do_put(\n    appender out, loc_value val, const format_specs& specs) const -> bool {\n  return val.visit(\n      detail::loc_writer<>{out, specs, separator_, grouping_, decimal_point_});\n}\n#endif\n\nFMT_FUNC auto vsystem_error(int error_code, string_view fmt, format_args args)\n    -> std::system_error {\n  auto ec = std::error_code(error_code, std::generic_category());\n  return std::system_error(ec, vformat(fmt, args));\n}\n\nnamespace detail {\n\ntemplate <typename F>\ninline auto operator==(basic_fp<F> x, basic_fp<F> y) -> bool {\n  return x.f == y.f && x.e == y.e;\n}\n\n// Compilers should be able to optimize this into the ror instruction.\nFMT_CONSTEXPR inline auto rotr(uint32_t n, uint32_t r) noexcept -> uint32_t {\n  r &= 31;\n  return (n >> r) | (n << (32 - r));\n}\nFMT_CONSTEXPR inline auto rotr(uint64_t n, uint32_t r) noexcept -> uint64_t {\n  r &= 63;\n  return (n >> r) | (n << (64 - r));\n}\n\n// Implementation of Dragonbox algorithm: https://github.com/jk-jeon/dragonbox.\nnamespace dragonbox {\n// Computes upper 64 bits of multiplication of a 32-bit unsigned integer and a\n// 64-bit unsigned integer.\ninline auto umul96_upper64(uint32_t x, uint64_t y) noexcept -> uint64_t {\n  return umul128_upper64(static_cast<uint64_t>(x) << 32, y);\n}\n\n// Computes lower 128 bits of multiplication of a 64-bit unsigned integer and a\n// 128-bit unsigned integer.\ninline auto umul192_lower128(uint64_t x, uint128_fallback y) noexcept\n    -> uint128_fallback {\n  uint64_t high = x * y.high();\n  uint128_fallback high_low = umul128(x, y.low());\n  return {high + high_low.high(), high_low.low()};\n}\n\n// Computes lower 64 bits of multiplication of a 32-bit unsigned integer and a\n// 64-bit unsigned integer.\ninline auto umul96_lower64(uint32_t x, uint64_t y) noexcept -> uint64_t {\n  return x * y;\n}\n\n// Various fast log computations.\ninline auto floor_log10_pow2_minus_log10_4_over_3(int e) noexcept -> int {\n  FMT_ASSERT(e <= 2936 && e >= -2985, \"too large exponent\");\n  return (e * 631305 - 261663) >> 21;\n}\n\nFMT_INLINE_VARIABLE constexpr struct {\n  uint32_t divisor;\n  int shift_amount;\n} div_small_pow10_infos[] = {{10, 16}, {100, 16}};\n\n// Replaces n by floor(n / pow(10, N)) returning true if and only if n is\n// divisible by pow(10, N).\n// Precondition: n <= pow(10, N + 1).\ntemplate <int N>\nauto check_divisibility_and_divide_by_pow10(uint32_t& n) noexcept -> bool {\n  // The numbers below are chosen such that:\n  //   1. floor(n/d) = floor(nm / 2^k) where d=10 or d=100,\n  //   2. nm mod 2^k < m if and only if n is divisible by d,\n  // where m is magic_number, k is shift_amount\n  // and d is divisor.\n  //\n  // Item 1 is a common technique of replacing division by a constant with\n  // multiplication, see e.g. \"Division by Invariant Integers Using\n  // Multiplication\" by Granlund and Montgomery (1994). magic_number (m) is set\n  // to ceil(2^k/d) for large enough k.\n  // The idea for item 2 originates from Schubfach.\n  constexpr auto info = div_small_pow10_infos[N - 1];\n  FMT_ASSERT(n <= info.divisor * 10, \"n is too large\");\n  constexpr uint32_t magic_number =\n      (1u << info.shift_amount) / info.divisor + 1;\n  n *= magic_number;\n  const uint32_t comparison_mask = (1u << info.shift_amount) - 1;\n  bool result = (n & comparison_mask) < magic_number;\n  n >>= info.shift_amount;\n  return result;\n}\n\n// Computes floor(n / pow(10, N)) for small n and N.\n// Precondition: n <= pow(10, N + 1).\ntemplate <int N> auto small_division_by_pow10(uint32_t n) noexcept -> uint32_t {\n  constexpr auto info = div_small_pow10_infos[N - 1];\n  FMT_ASSERT(n <= info.divisor * 10, \"n is too large\");\n  constexpr uint32_t magic_number =\n      (1u << info.shift_amount) / info.divisor + 1;\n  return (n * magic_number) >> info.shift_amount;\n}\n\n// Computes floor(n / 10^(kappa + 1)) (float)\ninline auto divide_by_10_to_kappa_plus_1(uint32_t n) noexcept -> uint32_t {\n  // 1374389535 = ceil(2^37/100)\n  return static_cast<uint32_t>((static_cast<uint64_t>(n) * 1374389535) >> 37);\n}\n// Computes floor(n / 10^(kappa + 1)) (double)\ninline auto divide_by_10_to_kappa_plus_1(uint64_t n) noexcept -> uint64_t {\n  // 2361183241434822607 = ceil(2^(64+7)/1000)\n  return umul128_upper64(n, 2361183241434822607ull) >> 7;\n}\n\n// Various subroutines using pow10 cache\ntemplate <typename T> struct cache_accessor;\n\ntemplate <> struct cache_accessor<float> {\n  using carrier_uint = float_info<float>::carrier_uint;\n  using cache_entry_type = uint64_t;\n\n  static auto get_cached_power(int k) noexcept -> uint64_t {\n    FMT_ASSERT(k >= float_info<float>::min_k && k <= float_info<float>::max_k,\n               \"k is out of range\");\n    static constexpr const uint64_t pow10_significands[] = {\n        0x81ceb32c4b43fcf5, 0xa2425ff75e14fc32, 0xcad2f7f5359a3b3f,\n        0xfd87b5f28300ca0e, 0x9e74d1b791e07e49, 0xc612062576589ddb,\n        0xf79687aed3eec552, 0x9abe14cd44753b53, 0xc16d9a0095928a28,\n        0xf1c90080baf72cb2, 0x971da05074da7bef, 0xbce5086492111aeb,\n        0xec1e4a7db69561a6, 0x9392ee8e921d5d08, 0xb877aa3236a4b44a,\n        0xe69594bec44de15c, 0x901d7cf73ab0acda, 0xb424dc35095cd810,\n        0xe12e13424bb40e14, 0x8cbccc096f5088cc, 0xafebff0bcb24aaff,\n        0xdbe6fecebdedd5bf, 0x89705f4136b4a598, 0xabcc77118461cefd,\n        0xd6bf94d5e57a42bd, 0x8637bd05af6c69b6, 0xa7c5ac471b478424,\n        0xd1b71758e219652c, 0x83126e978d4fdf3c, 0xa3d70a3d70a3d70b,\n        0xcccccccccccccccd, 0x8000000000000000, 0xa000000000000000,\n        0xc800000000000000, 0xfa00000000000000, 0x9c40000000000000,\n        0xc350000000000000, 0xf424000000000000, 0x9896800000000000,\n        0xbebc200000000000, 0xee6b280000000000, 0x9502f90000000000,\n        0xba43b74000000000, 0xe8d4a51000000000, 0x9184e72a00000000,\n        0xb5e620f480000000, 0xe35fa931a0000000, 0x8e1bc9bf04000000,\n        0xb1a2bc2ec5000000, 0xde0b6b3a76400000, 0x8ac7230489e80000,\n        0xad78ebc5ac620000, 0xd8d726b7177a8000, 0x878678326eac9000,\n        0xa968163f0a57b400, 0xd3c21bcecceda100, 0x84595161401484a0,\n        0xa56fa5b99019a5c8, 0xcecb8f27f4200f3a, 0x813f3978f8940985,\n        0xa18f07d736b90be6, 0xc9f2c9cd04674edf, 0xfc6f7c4045812297,\n        0x9dc5ada82b70b59e, 0xc5371912364ce306, 0xf684df56c3e01bc7,\n        0x9a130b963a6c115d, 0xc097ce7bc90715b4, 0xf0bdc21abb48db21,\n        0x96769950b50d88f5, 0xbc143fa4e250eb32, 0xeb194f8e1ae525fe,\n        0x92efd1b8d0cf37bf, 0xb7abc627050305ae, 0xe596b7b0c643c71a,\n        0x8f7e32ce7bea5c70, 0xb35dbf821ae4f38c, 0xe0352f62a19e306f};\n    return pow10_significands[k - float_info<float>::min_k];\n  }\n\n  struct compute_mul_result {\n    carrier_uint result;\n    bool is_integer;\n  };\n  struct compute_mul_parity_result {\n    bool parity;\n    bool is_integer;\n  };\n\n  static auto compute_mul(carrier_uint u,\n                          const cache_entry_type& cache) noexcept\n      -> compute_mul_result {\n    auto r = umul96_upper64(u, cache);\n    return {static_cast<carrier_uint>(r >> 32),\n            static_cast<carrier_uint>(r) == 0};\n  }\n\n  static auto compute_delta(const cache_entry_type& cache, int beta) noexcept\n      -> uint32_t {\n    return static_cast<uint32_t>(cache >> (64 - 1 - beta));\n  }\n\n  static auto compute_mul_parity(carrier_uint two_f,\n                                 const cache_entry_type& cache,\n                                 int beta) noexcept\n      -> compute_mul_parity_result {\n    FMT_ASSERT(beta >= 1, \"\");\n    FMT_ASSERT(beta < 64, \"\");\n\n    auto r = umul96_lower64(two_f, cache);\n    return {((r >> (64 - beta)) & 1) != 0,\n            static_cast<uint32_t>(r >> (32 - beta)) == 0};\n  }\n\n  static auto compute_left_endpoint_for_shorter_interval_case(\n      const cache_entry_type& cache, int beta) noexcept -> carrier_uint {\n    return static_cast<carrier_uint>(\n        (cache - (cache >> (num_significand_bits<float>() + 2))) >>\n        (64 - num_significand_bits<float>() - 1 - beta));\n  }\n\n  static auto compute_right_endpoint_for_shorter_interval_case(\n      const cache_entry_type& cache, int beta) noexcept -> carrier_uint {\n    return static_cast<carrier_uint>(\n        (cache + (cache >> (num_significand_bits<float>() + 1))) >>\n        (64 - num_significand_bits<float>() - 1 - beta));\n  }\n\n  static auto compute_round_up_for_shorter_interval_case(\n      const cache_entry_type& cache, int beta) noexcept -> carrier_uint {\n    return (static_cast<carrier_uint>(\n                cache >> (64 - num_significand_bits<float>() - 2 - beta)) +\n            1) /\n           2;\n  }\n};\n\ntemplate <> struct cache_accessor<double> {\n  using carrier_uint = float_info<double>::carrier_uint;\n  using cache_entry_type = uint128_fallback;\n\n  static auto get_cached_power(int k) noexcept -> uint128_fallback {\n    FMT_ASSERT(k >= float_info<double>::min_k && k <= float_info<double>::max_k,\n               \"k is out of range\");\n\n    static constexpr const uint128_fallback pow10_significands[] = {\n#if FMT_USE_FULL_CACHE_DRAGONBOX\n      {0xff77b1fcbebcdc4f, 0x25e8e89c13bb0f7b},\n      {0x9faacf3df73609b1, 0x77b191618c54e9ad},\n      {0xc795830d75038c1d, 0xd59df5b9ef6a2418},\n      {0xf97ae3d0d2446f25, 0x4b0573286b44ad1e},\n      {0x9becce62836ac577, 0x4ee367f9430aec33},\n      {0xc2e801fb244576d5, 0x229c41f793cda740},\n      {0xf3a20279ed56d48a, 0x6b43527578c11110},\n      {0x9845418c345644d6, 0x830a13896b78aaaa},\n      {0xbe5691ef416bd60c, 0x23cc986bc656d554},\n      {0xedec366b11c6cb8f, 0x2cbfbe86b7ec8aa9},\n      {0x94b3a202eb1c3f39, 0x7bf7d71432f3d6aa},\n      {0xb9e08a83a5e34f07, 0xdaf5ccd93fb0cc54},\n      {0xe858ad248f5c22c9, 0xd1b3400f8f9cff69},\n      {0x91376c36d99995be, 0x23100809b9c21fa2},\n      {0xb58547448ffffb2d, 0xabd40a0c2832a78b},\n      {0xe2e69915b3fff9f9, 0x16c90c8f323f516d},\n      {0x8dd01fad907ffc3b, 0xae3da7d97f6792e4},\n      {0xb1442798f49ffb4a, 0x99cd11cfdf41779d},\n      {0xdd95317f31c7fa1d, 0x40405643d711d584},\n      {0x8a7d3eef7f1cfc52, 0x482835ea666b2573},\n      {0xad1c8eab5ee43b66, 0xda3243650005eed0},\n      {0xd863b256369d4a40, 0x90bed43e40076a83},\n      {0x873e4f75e2224e68, 0x5a7744a6e804a292},\n      {0xa90de3535aaae202, 0x711515d0a205cb37},\n      {0xd3515c2831559a83, 0x0d5a5b44ca873e04},\n      {0x8412d9991ed58091, 0xe858790afe9486c3},\n      {0xa5178fff668ae0b6, 0x626e974dbe39a873},\n      {0xce5d73ff402d98e3, 0xfb0a3d212dc81290},\n      {0x80fa687f881c7f8e, 0x7ce66634bc9d0b9a},\n      {0xa139029f6a239f72, 0x1c1fffc1ebc44e81},\n      {0xc987434744ac874e, 0xa327ffb266b56221},\n      {0xfbe9141915d7a922, 0x4bf1ff9f0062baa9},\n      {0x9d71ac8fada6c9b5, 0x6f773fc3603db4aa},\n      {0xc4ce17b399107c22, 0xcb550fb4384d21d4},\n      {0xf6019da07f549b2b, 0x7e2a53a146606a49},\n      {0x99c102844f94e0fb, 0x2eda7444cbfc426e},\n      {0xc0314325637a1939, 0xfa911155fefb5309},\n      {0xf03d93eebc589f88, 0x793555ab7eba27cb},\n      {0x96267c7535b763b5, 0x4bc1558b2f3458df},\n      {0xbbb01b9283253ca2, 0x9eb1aaedfb016f17},\n      {0xea9c227723ee8bcb, 0x465e15a979c1cadd},\n      {0x92a1958a7675175f, 0x0bfacd89ec191eca},\n      {0xb749faed14125d36, 0xcef980ec671f667c},\n      {0xe51c79a85916f484, 0x82b7e12780e7401b},\n      {0x8f31cc0937ae58d2, 0xd1b2ecb8b0908811},\n      {0xb2fe3f0b8599ef07, 0x861fa7e6dcb4aa16},\n      {0xdfbdcece67006ac9, 0x67a791e093e1d49b},\n      {0x8bd6a141006042bd, 0xe0c8bb2c5c6d24e1},\n      {0xaecc49914078536d, 0x58fae9f773886e19},\n      {0xda7f5bf590966848, 0xaf39a475506a899f},\n      {0x888f99797a5e012d, 0x6d8406c952429604},\n      {0xaab37fd7d8f58178, 0xc8e5087ba6d33b84},\n      {0xd5605fcdcf32e1d6, 0xfb1e4a9a90880a65},\n      {0x855c3be0a17fcd26, 0x5cf2eea09a550680},\n      {0xa6b34ad8c9dfc06f, 0xf42faa48c0ea481f},\n      {0xd0601d8efc57b08b, 0xf13b94daf124da27},\n      {0x823c12795db6ce57, 0x76c53d08d6b70859},\n      {0xa2cb1717b52481ed, 0x54768c4b0c64ca6f},\n      {0xcb7ddcdda26da268, 0xa9942f5dcf7dfd0a},\n      {0xfe5d54150b090b02, 0xd3f93b35435d7c4d},\n      {0x9efa548d26e5a6e1, 0xc47bc5014a1a6db0},\n      {0xc6b8e9b0709f109a, 0x359ab6419ca1091c},\n      {0xf867241c8cc6d4c0, 0xc30163d203c94b63},\n      {0x9b407691d7fc44f8, 0x79e0de63425dcf1e},\n      {0xc21094364dfb5636, 0x985915fc12f542e5},\n      {0xf294b943e17a2bc4, 0x3e6f5b7b17b2939e},\n      {0x979cf3ca6cec5b5a, 0xa705992ceecf9c43},\n      {0xbd8430bd08277231, 0x50c6ff782a838354},\n      {0xece53cec4a314ebd, 0xa4f8bf5635246429},\n      {0x940f4613ae5ed136, 0x871b7795e136be9a},\n      {0xb913179899f68584, 0x28e2557b59846e40},\n      {0xe757dd7ec07426e5, 0x331aeada2fe589d0},\n      {0x9096ea6f3848984f, 0x3ff0d2c85def7622},\n      {0xb4bca50b065abe63, 0x0fed077a756b53aa},\n      {0xe1ebce4dc7f16dfb, 0xd3e8495912c62895},\n      {0x8d3360f09cf6e4bd, 0x64712dd7abbbd95d},\n      {0xb080392cc4349dec, 0xbd8d794d96aacfb4},\n      {0xdca04777f541c567, 0xecf0d7a0fc5583a1},\n      {0x89e42caaf9491b60, 0xf41686c49db57245},\n      {0xac5d37d5b79b6239, 0x311c2875c522ced6},\n      {0xd77485cb25823ac7, 0x7d633293366b828c},\n      {0x86a8d39ef77164bc, 0xae5dff9c02033198},\n      {0xa8530886b54dbdeb, 0xd9f57f830283fdfd},\n      {0xd267caa862a12d66, 0xd072df63c324fd7c},\n      {0x8380dea93da4bc60, 0x4247cb9e59f71e6e},\n      {0xa46116538d0deb78, 0x52d9be85f074e609},\n      {0xcd795be870516656, 0x67902e276c921f8c},\n      {0x806bd9714632dff6, 0x00ba1cd8a3db53b7},\n      {0xa086cfcd97bf97f3, 0x80e8a40eccd228a5},\n      {0xc8a883c0fdaf7df0, 0x6122cd128006b2ce},\n      {0xfad2a4b13d1b5d6c, 0x796b805720085f82},\n      {0x9cc3a6eec6311a63, 0xcbe3303674053bb1},\n      {0xc3f490aa77bd60fc, 0xbedbfc4411068a9d},\n      {0xf4f1b4d515acb93b, 0xee92fb5515482d45},\n      {0x991711052d8bf3c5, 0x751bdd152d4d1c4b},\n      {0xbf5cd54678eef0b6, 0xd262d45a78a0635e},\n      {0xef340a98172aace4, 0x86fb897116c87c35},\n      {0x9580869f0e7aac0e, 0xd45d35e6ae3d4da1},\n      {0xbae0a846d2195712, 0x8974836059cca10a},\n      {0xe998d258869facd7, 0x2bd1a438703fc94c},\n      {0x91ff83775423cc06, 0x7b6306a34627ddd0},\n      {0xb67f6455292cbf08, 0x1a3bc84c17b1d543},\n      {0xe41f3d6a7377eeca, 0x20caba5f1d9e4a94},\n      {0x8e938662882af53e, 0x547eb47b7282ee9d},\n      {0xb23867fb2a35b28d, 0xe99e619a4f23aa44},\n      {0xdec681f9f4c31f31, 0x6405fa00e2ec94d5},\n      {0x8b3c113c38f9f37e, 0xde83bc408dd3dd05},\n      {0xae0b158b4738705e, 0x9624ab50b148d446},\n      {0xd98ddaee19068c76, 0x3badd624dd9b0958},\n      {0x87f8a8d4cfa417c9, 0xe54ca5d70a80e5d7},\n      {0xa9f6d30a038d1dbc, 0x5e9fcf4ccd211f4d},\n      {0xd47487cc8470652b, 0x7647c32000696720},\n      {0x84c8d4dfd2c63f3b, 0x29ecd9f40041e074},\n      {0xa5fb0a17c777cf09, 0xf468107100525891},\n      {0xcf79cc9db955c2cc, 0x7182148d4066eeb5},\n      {0x81ac1fe293d599bf, 0xc6f14cd848405531},\n      {0xa21727db38cb002f, 0xb8ada00e5a506a7d},\n      {0xca9cf1d206fdc03b, 0xa6d90811f0e4851d},\n      {0xfd442e4688bd304a, 0x908f4a166d1da664},\n      {0x9e4a9cec15763e2e, 0x9a598e4e043287ff},\n      {0xc5dd44271ad3cdba, 0x40eff1e1853f29fe},\n      {0xf7549530e188c128, 0xd12bee59e68ef47d},\n      {0x9a94dd3e8cf578b9, 0x82bb74f8301958cf},\n      {0xc13a148e3032d6e7, 0xe36a52363c1faf02},\n      {0xf18899b1bc3f8ca1, 0xdc44e6c3cb279ac2},\n      {0x96f5600f15a7b7e5, 0x29ab103a5ef8c0ba},\n      {0xbcb2b812db11a5de, 0x7415d448f6b6f0e8},\n      {0xebdf661791d60f56, 0x111b495b3464ad22},\n      {0x936b9fcebb25c995, 0xcab10dd900beec35},\n      {0xb84687c269ef3bfb, 0x3d5d514f40eea743},\n      {0xe65829b3046b0afa, 0x0cb4a5a3112a5113},\n      {0x8ff71a0fe2c2e6dc, 0x47f0e785eaba72ac},\n      {0xb3f4e093db73a093, 0x59ed216765690f57},\n      {0xe0f218b8d25088b8, 0x306869c13ec3532d},\n      {0x8c974f7383725573, 0x1e414218c73a13fc},\n      {0xafbd2350644eeacf, 0xe5d1929ef90898fb},\n      {0xdbac6c247d62a583, 0xdf45f746b74abf3a},\n      {0x894bc396ce5da772, 0x6b8bba8c328eb784},\n      {0xab9eb47c81f5114f, 0x066ea92f3f326565},\n      {0xd686619ba27255a2, 0xc80a537b0efefebe},\n      {0x8613fd0145877585, 0xbd06742ce95f5f37},\n      {0xa798fc4196e952e7, 0x2c48113823b73705},\n      {0xd17f3b51fca3a7a0, 0xf75a15862ca504c6},\n      {0x82ef85133de648c4, 0x9a984d73dbe722fc},\n      {0xa3ab66580d5fdaf5, 0xc13e60d0d2e0ebbb},\n      {0xcc963fee10b7d1b3, 0x318df905079926a9},\n      {0xffbbcfe994e5c61f, 0xfdf17746497f7053},\n      {0x9fd561f1fd0f9bd3, 0xfeb6ea8bedefa634},\n      {0xc7caba6e7c5382c8, 0xfe64a52ee96b8fc1},\n      {0xf9bd690a1b68637b, 0x3dfdce7aa3c673b1},\n      {0x9c1661a651213e2d, 0x06bea10ca65c084f},\n      {0xc31bfa0fe5698db8, 0x486e494fcff30a63},\n      {0xf3e2f893dec3f126, 0x5a89dba3c3efccfb},\n      {0x986ddb5c6b3a76b7, 0xf89629465a75e01d},\n      {0xbe89523386091465, 0xf6bbb397f1135824},\n      {0xee2ba6c0678b597f, 0x746aa07ded582e2d},\n      {0x94db483840b717ef, 0xa8c2a44eb4571cdd},\n      {0xba121a4650e4ddeb, 0x92f34d62616ce414},\n      {0xe896a0d7e51e1566, 0x77b020baf9c81d18},\n      {0x915e2486ef32cd60, 0x0ace1474dc1d122f},\n      {0xb5b5ada8aaff80b8, 0x0d819992132456bb},\n      {0xe3231912d5bf60e6, 0x10e1fff697ed6c6a},\n      {0x8df5efabc5979c8f, 0xca8d3ffa1ef463c2},\n      {0xb1736b96b6fd83b3, 0xbd308ff8a6b17cb3},\n      {0xddd0467c64bce4a0, 0xac7cb3f6d05ddbdf},\n      {0x8aa22c0dbef60ee4, 0x6bcdf07a423aa96c},\n      {0xad4ab7112eb3929d, 0x86c16c98d2c953c7},\n      {0xd89d64d57a607744, 0xe871c7bf077ba8b8},\n      {0x87625f056c7c4a8b, 0x11471cd764ad4973},\n      {0xa93af6c6c79b5d2d, 0xd598e40d3dd89bd0},\n      {0xd389b47879823479, 0x4aff1d108d4ec2c4},\n      {0x843610cb4bf160cb, 0xcedf722a585139bb},\n      {0xa54394fe1eedb8fe, 0xc2974eb4ee658829},\n      {0xce947a3da6a9273e, 0x733d226229feea33},\n      {0x811ccc668829b887, 0x0806357d5a3f5260},\n      {0xa163ff802a3426a8, 0xca07c2dcb0cf26f8},\n      {0xc9bcff6034c13052, 0xfc89b393dd02f0b6},\n      {0xfc2c3f3841f17c67, 0xbbac2078d443ace3},\n      {0x9d9ba7832936edc0, 0xd54b944b84aa4c0e},\n      {0xc5029163f384a931, 0x0a9e795e65d4df12},\n      {0xf64335bcf065d37d, 0x4d4617b5ff4a16d6},\n      {0x99ea0196163fa42e, 0x504bced1bf8e4e46},\n      {0xc06481fb9bcf8d39, 0xe45ec2862f71e1d7},\n      {0xf07da27a82c37088, 0x5d767327bb4e5a4d},\n      {0x964e858c91ba2655, 0x3a6a07f8d510f870},\n      {0xbbe226efb628afea, 0x890489f70a55368c},\n      {0xeadab0aba3b2dbe5, 0x2b45ac74ccea842f},\n      {0x92c8ae6b464fc96f, 0x3b0b8bc90012929e},\n      {0xb77ada0617e3bbcb, 0x09ce6ebb40173745},\n      {0xe55990879ddcaabd, 0xcc420a6a101d0516},\n      {0x8f57fa54c2a9eab6, 0x9fa946824a12232e},\n      {0xb32df8e9f3546564, 0x47939822dc96abfa},\n      {0xdff9772470297ebd, 0x59787e2b93bc56f8},\n      {0x8bfbea76c619ef36, 0x57eb4edb3c55b65b},\n      {0xaefae51477a06b03, 0xede622920b6b23f2},\n      {0xdab99e59958885c4, 0xe95fab368e45ecee},\n      {0x88b402f7fd75539b, 0x11dbcb0218ebb415},\n      {0xaae103b5fcd2a881, 0xd652bdc29f26a11a},\n      {0xd59944a37c0752a2, 0x4be76d3346f04960},\n      {0x857fcae62d8493a5, 0x6f70a4400c562ddc},\n      {0xa6dfbd9fb8e5b88e, 0xcb4ccd500f6bb953},\n      {0xd097ad07a71f26b2, 0x7e2000a41346a7a8},\n      {0x825ecc24c873782f, 0x8ed400668c0c28c9},\n      {0xa2f67f2dfa90563b, 0x728900802f0f32fb},\n      {0xcbb41ef979346bca, 0x4f2b40a03ad2ffba},\n      {0xfea126b7d78186bc, 0xe2f610c84987bfa9},\n      {0x9f24b832e6b0f436, 0x0dd9ca7d2df4d7ca},\n      {0xc6ede63fa05d3143, 0x91503d1c79720dbc},\n      {0xf8a95fcf88747d94, 0x75a44c6397ce912b},\n      {0x9b69dbe1b548ce7c, 0xc986afbe3ee11abb},\n      {0xc24452da229b021b, 0xfbe85badce996169},\n      {0xf2d56790ab41c2a2, 0xfae27299423fb9c4},\n      {0x97c560ba6b0919a5, 0xdccd879fc967d41b},\n      {0xbdb6b8e905cb600f, 0x5400e987bbc1c921},\n      {0xed246723473e3813, 0x290123e9aab23b69},\n      {0x9436c0760c86e30b, 0xf9a0b6720aaf6522},\n      {0xb94470938fa89bce, 0xf808e40e8d5b3e6a},\n      {0xe7958cb87392c2c2, 0xb60b1d1230b20e05},\n      {0x90bd77f3483bb9b9, 0xb1c6f22b5e6f48c3},\n      {0xb4ecd5f01a4aa828, 0x1e38aeb6360b1af4},\n      {0xe2280b6c20dd5232, 0x25c6da63c38de1b1},\n      {0x8d590723948a535f, 0x579c487e5a38ad0f},\n      {0xb0af48ec79ace837, 0x2d835a9df0c6d852},\n      {0xdcdb1b2798182244, 0xf8e431456cf88e66},\n      {0x8a08f0f8bf0f156b, 0x1b8e9ecb641b5900},\n      {0xac8b2d36eed2dac5, 0xe272467e3d222f40},\n      {0xd7adf884aa879177, 0x5b0ed81dcc6abb10},\n      {0x86ccbb52ea94baea, 0x98e947129fc2b4ea},\n      {0xa87fea27a539e9a5, 0x3f2398d747b36225},\n      {0xd29fe4b18e88640e, 0x8eec7f0d19a03aae},\n      {0x83a3eeeef9153e89, 0x1953cf68300424ad},\n      {0xa48ceaaab75a8e2b, 0x5fa8c3423c052dd8},\n      {0xcdb02555653131b6, 0x3792f412cb06794e},\n      {0x808e17555f3ebf11, 0xe2bbd88bbee40bd1},\n      {0xa0b19d2ab70e6ed6, 0x5b6aceaeae9d0ec5},\n      {0xc8de047564d20a8b, 0xf245825a5a445276},\n      {0xfb158592be068d2e, 0xeed6e2f0f0d56713},\n      {0x9ced737bb6c4183d, 0x55464dd69685606c},\n      {0xc428d05aa4751e4c, 0xaa97e14c3c26b887},\n      {0xf53304714d9265df, 0xd53dd99f4b3066a9},\n      {0x993fe2c6d07b7fab, 0xe546a8038efe402a},\n      {0xbf8fdb78849a5f96, 0xde98520472bdd034},\n      {0xef73d256a5c0f77c, 0x963e66858f6d4441},\n      {0x95a8637627989aad, 0xdde7001379a44aa9},\n      {0xbb127c53b17ec159, 0x5560c018580d5d53},\n      {0xe9d71b689dde71af, 0xaab8f01e6e10b4a7},\n      {0x9226712162ab070d, 0xcab3961304ca70e9},\n      {0xb6b00d69bb55c8d1, 0x3d607b97c5fd0d23},\n      {0xe45c10c42a2b3b05, 0x8cb89a7db77c506b},\n      {0x8eb98a7a9a5b04e3, 0x77f3608e92adb243},\n      {0xb267ed1940f1c61c, 0x55f038b237591ed4},\n      {0xdf01e85f912e37a3, 0x6b6c46dec52f6689},\n      {0x8b61313bbabce2c6, 0x2323ac4b3b3da016},\n      {0xae397d8aa96c1b77, 0xabec975e0a0d081b},\n      {0xd9c7dced53c72255, 0x96e7bd358c904a22},\n      {0x881cea14545c7575, 0x7e50d64177da2e55},\n      {0xaa242499697392d2, 0xdde50bd1d5d0b9ea},\n      {0xd4ad2dbfc3d07787, 0x955e4ec64b44e865},\n      {0x84ec3c97da624ab4, 0xbd5af13bef0b113f},\n      {0xa6274bbdd0fadd61, 0xecb1ad8aeacdd58f},\n      {0xcfb11ead453994ba, 0x67de18eda5814af3},\n      {0x81ceb32c4b43fcf4, 0x80eacf948770ced8},\n      {0xa2425ff75e14fc31, 0xa1258379a94d028e},\n      {0xcad2f7f5359a3b3e, 0x096ee45813a04331},\n      {0xfd87b5f28300ca0d, 0x8bca9d6e188853fd},\n      {0x9e74d1b791e07e48, 0x775ea264cf55347e},\n      {0xc612062576589dda, 0x95364afe032a819e},\n      {0xf79687aed3eec551, 0x3a83ddbd83f52205},\n      {0x9abe14cd44753b52, 0xc4926a9672793543},\n      {0xc16d9a0095928a27, 0x75b7053c0f178294},\n      {0xf1c90080baf72cb1, 0x5324c68b12dd6339},\n      {0x971da05074da7bee, 0xd3f6fc16ebca5e04},\n      {0xbce5086492111aea, 0x88f4bb1ca6bcf585},\n      {0xec1e4a7db69561a5, 0x2b31e9e3d06c32e6},\n      {0x9392ee8e921d5d07, 0x3aff322e62439fd0},\n      {0xb877aa3236a4b449, 0x09befeb9fad487c3},\n      {0xe69594bec44de15b, 0x4c2ebe687989a9b4},\n      {0x901d7cf73ab0acd9, 0x0f9d37014bf60a11},\n      {0xb424dc35095cd80f, 0x538484c19ef38c95},\n      {0xe12e13424bb40e13, 0x2865a5f206b06fba},\n      {0x8cbccc096f5088cb, 0xf93f87b7442e45d4},\n      {0xafebff0bcb24aafe, 0xf78f69a51539d749},\n      {0xdbe6fecebdedd5be, 0xb573440e5a884d1c},\n      {0x89705f4136b4a597, 0x31680a88f8953031},\n      {0xabcc77118461cefc, 0xfdc20d2b36ba7c3e},\n      {0xd6bf94d5e57a42bc, 0x3d32907604691b4d},\n      {0x8637bd05af6c69b5, 0xa63f9a49c2c1b110},\n      {0xa7c5ac471b478423, 0x0fcf80dc33721d54},\n      {0xd1b71758e219652b, 0xd3c36113404ea4a9},\n      {0x83126e978d4fdf3b, 0x645a1cac083126ea},\n      {0xa3d70a3d70a3d70a, 0x3d70a3d70a3d70a4},\n      {0xcccccccccccccccc, 0xcccccccccccccccd},\n      {0x8000000000000000, 0x0000000000000000},\n      {0xa000000000000000, 0x0000000000000000},\n      {0xc800000000000000, 0x0000000000000000},\n      {0xfa00000000000000, 0x0000000000000000},\n      {0x9c40000000000000, 0x0000000000000000},\n      {0xc350000000000000, 0x0000000000000000},\n      {0xf424000000000000, 0x0000000000000000},\n      {0x9896800000000000, 0x0000000000000000},\n      {0xbebc200000000000, 0x0000000000000000},\n      {0xee6b280000000000, 0x0000000000000000},\n      {0x9502f90000000000, 0x0000000000000000},\n      {0xba43b74000000000, 0x0000000000000000},\n      {0xe8d4a51000000000, 0x0000000000000000},\n      {0x9184e72a00000000, 0x0000000000000000},\n      {0xb5e620f480000000, 0x0000000000000000},\n      {0xe35fa931a0000000, 0x0000000000000000},\n      {0x8e1bc9bf04000000, 0x0000000000000000},\n      {0xb1a2bc2ec5000000, 0x0000000000000000},\n      {0xde0b6b3a76400000, 0x0000000000000000},\n      {0x8ac7230489e80000, 0x0000000000000000},\n      {0xad78ebc5ac620000, 0x0000000000000000},\n      {0xd8d726b7177a8000, 0x0000000000000000},\n      {0x878678326eac9000, 0x0000000000000000},\n      {0xa968163f0a57b400, 0x0000000000000000},\n      {0xd3c21bcecceda100, 0x0000000000000000},\n      {0x84595161401484a0, 0x0000000000000000},\n      {0xa56fa5b99019a5c8, 0x0000000000000000},\n      {0xcecb8f27f4200f3a, 0x0000000000000000},\n      {0x813f3978f8940984, 0x4000000000000000},\n      {0xa18f07d736b90be5, 0x5000000000000000},\n      {0xc9f2c9cd04674ede, 0xa400000000000000},\n      {0xfc6f7c4045812296, 0x4d00000000000000},\n      {0x9dc5ada82b70b59d, 0xf020000000000000},\n      {0xc5371912364ce305, 0x6c28000000000000},\n      {0xf684df56c3e01bc6, 0xc732000000000000},\n      {0x9a130b963a6c115c, 0x3c7f400000000000},\n      {0xc097ce7bc90715b3, 0x4b9f100000000000},\n      {0xf0bdc21abb48db20, 0x1e86d40000000000},\n      {0x96769950b50d88f4, 0x1314448000000000},\n      {0xbc143fa4e250eb31, 0x17d955a000000000},\n      {0xeb194f8e1ae525fd, 0x5dcfab0800000000},\n      {0x92efd1b8d0cf37be, 0x5aa1cae500000000},\n      {0xb7abc627050305ad, 0xf14a3d9e40000000},\n      {0xe596b7b0c643c719, 0x6d9ccd05d0000000},\n      {0x8f7e32ce7bea5c6f, 0xe4820023a2000000},\n      {0xb35dbf821ae4f38b, 0xdda2802c8a800000},\n      {0xe0352f62a19e306e, 0xd50b2037ad200000},\n      {0x8c213d9da502de45, 0x4526f422cc340000},\n      {0xaf298d050e4395d6, 0x9670b12b7f410000},\n      {0xdaf3f04651d47b4c, 0x3c0cdd765f114000},\n      {0x88d8762bf324cd0f, 0xa5880a69fb6ac800},\n      {0xab0e93b6efee0053, 0x8eea0d047a457a00},\n      {0xd5d238a4abe98068, 0x72a4904598d6d880},\n      {0x85a36366eb71f041, 0x47a6da2b7f864750},\n      {0xa70c3c40a64e6c51, 0x999090b65f67d924},\n      {0xd0cf4b50cfe20765, 0xfff4b4e3f741cf6d},\n      {0x82818f1281ed449f, 0xbff8f10e7a8921a5},\n      {0xa321f2d7226895c7, 0xaff72d52192b6a0e},\n      {0xcbea6f8ceb02bb39, 0x9bf4f8a69f764491},\n      {0xfee50b7025c36a08, 0x02f236d04753d5b5},\n      {0x9f4f2726179a2245, 0x01d762422c946591},\n      {0xc722f0ef9d80aad6, 0x424d3ad2b7b97ef6},\n      {0xf8ebad2b84e0d58b, 0xd2e0898765a7deb3},\n      {0x9b934c3b330c8577, 0x63cc55f49f88eb30},\n      {0xc2781f49ffcfa6d5, 0x3cbf6b71c76b25fc},\n      {0xf316271c7fc3908a, 0x8bef464e3945ef7b},\n      {0x97edd871cfda3a56, 0x97758bf0e3cbb5ad},\n      {0xbde94e8e43d0c8ec, 0x3d52eeed1cbea318},\n      {0xed63a231d4c4fb27, 0x4ca7aaa863ee4bde},\n      {0x945e455f24fb1cf8, 0x8fe8caa93e74ef6b},\n      {0xb975d6b6ee39e436, 0xb3e2fd538e122b45},\n      {0xe7d34c64a9c85d44, 0x60dbbca87196b617},\n      {0x90e40fbeea1d3a4a, 0xbc8955e946fe31ce},\n      {0xb51d13aea4a488dd, 0x6babab6398bdbe42},\n      {0xe264589a4dcdab14, 0xc696963c7eed2dd2},\n      {0x8d7eb76070a08aec, 0xfc1e1de5cf543ca3},\n      {0xb0de65388cc8ada8, 0x3b25a55f43294bcc},\n      {0xdd15fe86affad912, 0x49ef0eb713f39ebf},\n      {0x8a2dbf142dfcc7ab, 0x6e3569326c784338},\n      {0xacb92ed9397bf996, 0x49c2c37f07965405},\n      {0xd7e77a8f87daf7fb, 0xdc33745ec97be907},\n      {0x86f0ac99b4e8dafd, 0x69a028bb3ded71a4},\n      {0xa8acd7c0222311bc, 0xc40832ea0d68ce0d},\n      {0xd2d80db02aabd62b, 0xf50a3fa490c30191},\n      {0x83c7088e1aab65db, 0x792667c6da79e0fb},\n      {0xa4b8cab1a1563f52, 0x577001b891185939},\n      {0xcde6fd5e09abcf26, 0xed4c0226b55e6f87},\n      {0x80b05e5ac60b6178, 0x544f8158315b05b5},\n      {0xa0dc75f1778e39d6, 0x696361ae3db1c722},\n      {0xc913936dd571c84c, 0x03bc3a19cd1e38ea},\n      {0xfb5878494ace3a5f, 0x04ab48a04065c724},\n      {0x9d174b2dcec0e47b, 0x62eb0d64283f9c77},\n      {0xc45d1df942711d9a, 0x3ba5d0bd324f8395},\n      {0xf5746577930d6500, 0xca8f44ec7ee3647a},\n      {0x9968bf6abbe85f20, 0x7e998b13cf4e1ecc},\n      {0xbfc2ef456ae276e8, 0x9e3fedd8c321a67f},\n      {0xefb3ab16c59b14a2, 0xc5cfe94ef3ea101f},\n      {0x95d04aee3b80ece5, 0xbba1f1d158724a13},\n      {0xbb445da9ca61281f, 0x2a8a6e45ae8edc98},\n      {0xea1575143cf97226, 0xf52d09d71a3293be},\n      {0x924d692ca61be758, 0x593c2626705f9c57},\n      {0xb6e0c377cfa2e12e, 0x6f8b2fb00c77836d},\n      {0xe498f455c38b997a, 0x0b6dfb9c0f956448},\n      {0x8edf98b59a373fec, 0x4724bd4189bd5ead},\n      {0xb2977ee300c50fe7, 0x58edec91ec2cb658},\n      {0xdf3d5e9bc0f653e1, 0x2f2967b66737e3ee},\n      {0x8b865b215899f46c, 0xbd79e0d20082ee75},\n      {0xae67f1e9aec07187, 0xecd8590680a3aa12},\n      {0xda01ee641a708de9, 0xe80e6f4820cc9496},\n      {0x884134fe908658b2, 0x3109058d147fdcde},\n      {0xaa51823e34a7eede, 0xbd4b46f0599fd416},\n      {0xd4e5e2cdc1d1ea96, 0x6c9e18ac7007c91b},\n      {0x850fadc09923329e, 0x03e2cf6bc604ddb1},\n      {0xa6539930bf6bff45, 0x84db8346b786151d},\n      {0xcfe87f7cef46ff16, 0xe612641865679a64},\n      {0x81f14fae158c5f6e, 0x4fcb7e8f3f60c07f},\n      {0xa26da3999aef7749, 0xe3be5e330f38f09e},\n      {0xcb090c8001ab551c, 0x5cadf5bfd3072cc6},\n      {0xfdcb4fa002162a63, 0x73d9732fc7c8f7f7},\n      {0x9e9f11c4014dda7e, 0x2867e7fddcdd9afb},\n      {0xc646d63501a1511d, 0xb281e1fd541501b9},\n      {0xf7d88bc24209a565, 0x1f225a7ca91a4227},\n      {0x9ae757596946075f, 0x3375788de9b06959},\n      {0xc1a12d2fc3978937, 0x0052d6b1641c83af},\n      {0xf209787bb47d6b84, 0xc0678c5dbd23a49b},\n      {0x9745eb4d50ce6332, 0xf840b7ba963646e1},\n      {0xbd176620a501fbff, 0xb650e5a93bc3d899},\n      {0xec5d3fa8ce427aff, 0xa3e51f138ab4cebf},\n      {0x93ba47c980e98cdf, 0xc66f336c36b10138},\n      {0xb8a8d9bbe123f017, 0xb80b0047445d4185},\n      {0xe6d3102ad96cec1d, 0xa60dc059157491e6},\n      {0x9043ea1ac7e41392, 0x87c89837ad68db30},\n      {0xb454e4a179dd1877, 0x29babe4598c311fc},\n      {0xe16a1dc9d8545e94, 0xf4296dd6fef3d67b},\n      {0x8ce2529e2734bb1d, 0x1899e4a65f58660d},\n      {0xb01ae745b101e9e4, 0x5ec05dcff72e7f90},\n      {0xdc21a1171d42645d, 0x76707543f4fa1f74},\n      {0x899504ae72497eba, 0x6a06494a791c53a9},\n      {0xabfa45da0edbde69, 0x0487db9d17636893},\n      {0xd6f8d7509292d603, 0x45a9d2845d3c42b7},\n      {0x865b86925b9bc5c2, 0x0b8a2392ba45a9b3},\n      {0xa7f26836f282b732, 0x8e6cac7768d7141f},\n      {0xd1ef0244af2364ff, 0x3207d795430cd927},\n      {0x8335616aed761f1f, 0x7f44e6bd49e807b9},\n      {0xa402b9c5a8d3a6e7, 0x5f16206c9c6209a7},\n      {0xcd036837130890a1, 0x36dba887c37a8c10},\n      {0x802221226be55a64, 0xc2494954da2c978a},\n      {0xa02aa96b06deb0fd, 0xf2db9baa10b7bd6d},\n      {0xc83553c5c8965d3d, 0x6f92829494e5acc8},\n      {0xfa42a8b73abbf48c, 0xcb772339ba1f17fa},\n      {0x9c69a97284b578d7, 0xff2a760414536efc},\n      {0xc38413cf25e2d70d, 0xfef5138519684abb},\n      {0xf46518c2ef5b8cd1, 0x7eb258665fc25d6a},\n      {0x98bf2f79d5993802, 0xef2f773ffbd97a62},\n      {0xbeeefb584aff8603, 0xaafb550ffacfd8fb},\n      {0xeeaaba2e5dbf6784, 0x95ba2a53f983cf39},\n      {0x952ab45cfa97a0b2, 0xdd945a747bf26184},\n      {0xba756174393d88df, 0x94f971119aeef9e5},\n      {0xe912b9d1478ceb17, 0x7a37cd5601aab85e},\n      {0x91abb422ccb812ee, 0xac62e055c10ab33b},\n      {0xb616a12b7fe617aa, 0x577b986b314d600a},\n      {0xe39c49765fdf9d94, 0xed5a7e85fda0b80c},\n      {0x8e41ade9fbebc27d, 0x14588f13be847308},\n      {0xb1d219647ae6b31c, 0x596eb2d8ae258fc9},\n      {0xde469fbd99a05fe3, 0x6fca5f8ed9aef3bc},\n      {0x8aec23d680043bee, 0x25de7bb9480d5855},\n      {0xada72ccc20054ae9, 0xaf561aa79a10ae6b},\n      {0xd910f7ff28069da4, 0x1b2ba1518094da05},\n      {0x87aa9aff79042286, 0x90fb44d2f05d0843},\n      {0xa99541bf57452b28, 0x353a1607ac744a54},\n      {0xd3fa922f2d1675f2, 0x42889b8997915ce9},\n      {0x847c9b5d7c2e09b7, 0x69956135febada12},\n      {0xa59bc234db398c25, 0x43fab9837e699096},\n      {0xcf02b2c21207ef2e, 0x94f967e45e03f4bc},\n      {0x8161afb94b44f57d, 0x1d1be0eebac278f6},\n      {0xa1ba1ba79e1632dc, 0x6462d92a69731733},\n      {0xca28a291859bbf93, 0x7d7b8f7503cfdcff},\n      {0xfcb2cb35e702af78, 0x5cda735244c3d43f},\n      {0x9defbf01b061adab, 0x3a0888136afa64a8},\n      {0xc56baec21c7a1916, 0x088aaa1845b8fdd1},\n      {0xf6c69a72a3989f5b, 0x8aad549e57273d46},\n      {0x9a3c2087a63f6399, 0x36ac54e2f678864c},\n      {0xc0cb28a98fcf3c7f, 0x84576a1bb416a7de},\n      {0xf0fdf2d3f3c30b9f, 0x656d44a2a11c51d6},\n      {0x969eb7c47859e743, 0x9f644ae5a4b1b326},\n      {0xbc4665b596706114, 0x873d5d9f0dde1fef},\n      {0xeb57ff22fc0c7959, 0xa90cb506d155a7eb},\n      {0x9316ff75dd87cbd8, 0x09a7f12442d588f3},\n      {0xb7dcbf5354e9bece, 0x0c11ed6d538aeb30},\n      {0xe5d3ef282a242e81, 0x8f1668c8a86da5fb},\n      {0x8fa475791a569d10, 0xf96e017d694487bd},\n      {0xb38d92d760ec4455, 0x37c981dcc395a9ad},\n      {0xe070f78d3927556a, 0x85bbe253f47b1418},\n      {0x8c469ab843b89562, 0x93956d7478ccec8f},\n      {0xaf58416654a6babb, 0x387ac8d1970027b3},\n      {0xdb2e51bfe9d0696a, 0x06997b05fcc0319f},\n      {0x88fcf317f22241e2, 0x441fece3bdf81f04},\n      {0xab3c2fddeeaad25a, 0xd527e81cad7626c4},\n      {0xd60b3bd56a5586f1, 0x8a71e223d8d3b075},\n      {0x85c7056562757456, 0xf6872d5667844e4a},\n      {0xa738c6bebb12d16c, 0xb428f8ac016561dc},\n      {0xd106f86e69d785c7, 0xe13336d701beba53},\n      {0x82a45b450226b39c, 0xecc0024661173474},\n      {0xa34d721642b06084, 0x27f002d7f95d0191},\n      {0xcc20ce9bd35c78a5, 0x31ec038df7b441f5},\n      {0xff290242c83396ce, 0x7e67047175a15272},\n      {0x9f79a169bd203e41, 0x0f0062c6e984d387},\n      {0xc75809c42c684dd1, 0x52c07b78a3e60869},\n      {0xf92e0c3537826145, 0xa7709a56ccdf8a83},\n      {0x9bbcc7a142b17ccb, 0x88a66076400bb692},\n      {0xc2abf989935ddbfe, 0x6acff893d00ea436},\n      {0xf356f7ebf83552fe, 0x0583f6b8c4124d44},\n      {0x98165af37b2153de, 0xc3727a337a8b704b},\n      {0xbe1bf1b059e9a8d6, 0x744f18c0592e4c5d},\n      {0xeda2ee1c7064130c, 0x1162def06f79df74},\n      {0x9485d4d1c63e8be7, 0x8addcb5645ac2ba9},\n      {0xb9a74a0637ce2ee1, 0x6d953e2bd7173693},\n      {0xe8111c87c5c1ba99, 0xc8fa8db6ccdd0438},\n      {0x910ab1d4db9914a0, 0x1d9c9892400a22a3},\n      {0xb54d5e4a127f59c8, 0x2503beb6d00cab4c},\n      {0xe2a0b5dc971f303a, 0x2e44ae64840fd61e},\n      {0x8da471a9de737e24, 0x5ceaecfed289e5d3},\n      {0xb10d8e1456105dad, 0x7425a83e872c5f48},\n      {0xdd50f1996b947518, 0xd12f124e28f7771a},\n      {0x8a5296ffe33cc92f, 0x82bd6b70d99aaa70},\n      {0xace73cbfdc0bfb7b, 0x636cc64d1001550c},\n      {0xd8210befd30efa5a, 0x3c47f7e05401aa4f},\n      {0x8714a775e3e95c78, 0x65acfaec34810a72},\n      {0xa8d9d1535ce3b396, 0x7f1839a741a14d0e},\n      {0xd31045a8341ca07c, 0x1ede48111209a051},\n      {0x83ea2b892091e44d, 0x934aed0aab460433},\n      {0xa4e4b66b68b65d60, 0xf81da84d56178540},\n      {0xce1de40642e3f4b9, 0x36251260ab9d668f},\n      {0x80d2ae83e9ce78f3, 0xc1d72b7c6b42601a},\n      {0xa1075a24e4421730, 0xb24cf65b8612f820},\n      {0xc94930ae1d529cfc, 0xdee033f26797b628},\n      {0xfb9b7cd9a4a7443c, 0x169840ef017da3b2},\n      {0x9d412e0806e88aa5, 0x8e1f289560ee864f},\n      {0xc491798a08a2ad4e, 0xf1a6f2bab92a27e3},\n      {0xf5b5d7ec8acb58a2, 0xae10af696774b1dc},\n      {0x9991a6f3d6bf1765, 0xacca6da1e0a8ef2a},\n      {0xbff610b0cc6edd3f, 0x17fd090a58d32af4},\n      {0xeff394dcff8a948e, 0xddfc4b4cef07f5b1},\n      {0x95f83d0a1fb69cd9, 0x4abdaf101564f98f},\n      {0xbb764c4ca7a4440f, 0x9d6d1ad41abe37f2},\n      {0xea53df5fd18d5513, 0x84c86189216dc5ee},\n      {0x92746b9be2f8552c, 0x32fd3cf5b4e49bb5},\n      {0xb7118682dbb66a77, 0x3fbc8c33221dc2a2},\n      {0xe4d5e82392a40515, 0x0fabaf3feaa5334b},\n      {0x8f05b1163ba6832d, 0x29cb4d87f2a7400f},\n      {0xb2c71d5bca9023f8, 0x743e20e9ef511013},\n      {0xdf78e4b2bd342cf6, 0x914da9246b255417},\n      {0x8bab8eefb6409c1a, 0x1ad089b6c2f7548f},\n      {0xae9672aba3d0c320, 0xa184ac2473b529b2},\n      {0xda3c0f568cc4f3e8, 0xc9e5d72d90a2741f},\n      {0x8865899617fb1871, 0x7e2fa67c7a658893},\n      {0xaa7eebfb9df9de8d, 0xddbb901b98feeab8},\n      {0xd51ea6fa85785631, 0x552a74227f3ea566},\n      {0x8533285c936b35de, 0xd53a88958f872760},\n      {0xa67ff273b8460356, 0x8a892abaf368f138},\n      {0xd01fef10a657842c, 0x2d2b7569b0432d86},\n      {0x8213f56a67f6b29b, 0x9c3b29620e29fc74},\n      {0xa298f2c501f45f42, 0x8349f3ba91b47b90},\n      {0xcb3f2f7642717713, 0x241c70a936219a74},\n      {0xfe0efb53d30dd4d7, 0xed238cd383aa0111},\n      {0x9ec95d1463e8a506, 0xf4363804324a40ab},\n      {0xc67bb4597ce2ce48, 0xb143c6053edcd0d6},\n      {0xf81aa16fdc1b81da, 0xdd94b7868e94050b},\n      {0x9b10a4e5e9913128, 0xca7cf2b4191c8327},\n      {0xc1d4ce1f63f57d72, 0xfd1c2f611f63a3f1},\n      {0xf24a01a73cf2dccf, 0xbc633b39673c8ced},\n      {0x976e41088617ca01, 0xd5be0503e085d814},\n      {0xbd49d14aa79dbc82, 0x4b2d8644d8a74e19},\n      {0xec9c459d51852ba2, 0xddf8e7d60ed1219f},\n      {0x93e1ab8252f33b45, 0xcabb90e5c942b504},\n      {0xb8da1662e7b00a17, 0x3d6a751f3b936244},\n      {0xe7109bfba19c0c9d, 0x0cc512670a783ad5},\n      {0x906a617d450187e2, 0x27fb2b80668b24c6},\n      {0xb484f9dc9641e9da, 0xb1f9f660802dedf7},\n      {0xe1a63853bbd26451, 0x5e7873f8a0396974},\n      {0x8d07e33455637eb2, 0xdb0b487b6423e1e9},\n      {0xb049dc016abc5e5f, 0x91ce1a9a3d2cda63},\n      {0xdc5c5301c56b75f7, 0x7641a140cc7810fc},\n      {0x89b9b3e11b6329ba, 0xa9e904c87fcb0a9e},\n      {0xac2820d9623bf429, 0x546345fa9fbdcd45},\n      {0xd732290fbacaf133, 0xa97c177947ad4096},\n      {0x867f59a9d4bed6c0, 0x49ed8eabcccc485e},\n      {0xa81f301449ee8c70, 0x5c68f256bfff5a75},\n      {0xd226fc195c6a2f8c, 0x73832eec6fff3112},\n      {0x83585d8fd9c25db7, 0xc831fd53c5ff7eac},\n      {0xa42e74f3d032f525, 0xba3e7ca8b77f5e56},\n      {0xcd3a1230c43fb26f, 0x28ce1bd2e55f35ec},\n      {0x80444b5e7aa7cf85, 0x7980d163cf5b81b4},\n      {0xa0555e361951c366, 0xd7e105bcc3326220},\n      {0xc86ab5c39fa63440, 0x8dd9472bf3fefaa8},\n      {0xfa856334878fc150, 0xb14f98f6f0feb952},\n      {0x9c935e00d4b9d8d2, 0x6ed1bf9a569f33d4},\n      {0xc3b8358109e84f07, 0x0a862f80ec4700c9},\n      {0xf4a642e14c6262c8, 0xcd27bb612758c0fb},\n      {0x98e7e9cccfbd7dbd, 0x8038d51cb897789d},\n      {0xbf21e44003acdd2c, 0xe0470a63e6bd56c4},\n      {0xeeea5d5004981478, 0x1858ccfce06cac75},\n      {0x95527a5202df0ccb, 0x0f37801e0c43ebc9},\n      {0xbaa718e68396cffd, 0xd30560258f54e6bb},\n      {0xe950df20247c83fd, 0x47c6b82ef32a206a},\n      {0x91d28b7416cdd27e, 0x4cdc331d57fa5442},\n      {0xb6472e511c81471d, 0xe0133fe4adf8e953},\n      {0xe3d8f9e563a198e5, 0x58180fddd97723a7},\n      {0x8e679c2f5e44ff8f, 0x570f09eaa7ea7649},\n      {0xb201833b35d63f73, 0x2cd2cc6551e513db},\n      {0xde81e40a034bcf4f, 0xf8077f7ea65e58d2},\n      {0x8b112e86420f6191, 0xfb04afaf27faf783},\n      {0xadd57a27d29339f6, 0x79c5db9af1f9b564},\n      {0xd94ad8b1c7380874, 0x18375281ae7822bd},\n      {0x87cec76f1c830548, 0x8f2293910d0b15b6},\n      {0xa9c2794ae3a3c69a, 0xb2eb3875504ddb23},\n      {0xd433179d9c8cb841, 0x5fa60692a46151ec},\n      {0x849feec281d7f328, 0xdbc7c41ba6bcd334},\n      {0xa5c7ea73224deff3, 0x12b9b522906c0801},\n      {0xcf39e50feae16bef, 0xd768226b34870a01},\n      {0x81842f29f2cce375, 0xe6a1158300d46641},\n      {0xa1e53af46f801c53, 0x60495ae3c1097fd1},\n      {0xca5e89b18b602368, 0x385bb19cb14bdfc5},\n      {0xfcf62c1dee382c42, 0x46729e03dd9ed7b6},\n      {0x9e19db92b4e31ba9, 0x6c07a2c26a8346d2},\n      {0xc5a05277621be293, 0xc7098b7305241886},\n      {0xf70867153aa2db38, 0xb8cbee4fc66d1ea8},\n      {0x9a65406d44a5c903, 0x737f74f1dc043329},\n      {0xc0fe908895cf3b44, 0x505f522e53053ff3},\n      {0xf13e34aabb430a15, 0x647726b9e7c68ff0},\n      {0x96c6e0eab509e64d, 0x5eca783430dc19f6},\n      {0xbc789925624c5fe0, 0xb67d16413d132073},\n      {0xeb96bf6ebadf77d8, 0xe41c5bd18c57e890},\n      {0x933e37a534cbaae7, 0x8e91b962f7b6f15a},\n      {0xb80dc58e81fe95a1, 0x723627bbb5a4adb1},\n      {0xe61136f2227e3b09, 0xcec3b1aaa30dd91d},\n      {0x8fcac257558ee4e6, 0x213a4f0aa5e8a7b2},\n      {0xb3bd72ed2af29e1f, 0xa988e2cd4f62d19e},\n      {0xe0accfa875af45a7, 0x93eb1b80a33b8606},\n      {0x8c6c01c9498d8b88, 0xbc72f130660533c4},\n      {0xaf87023b9bf0ee6a, 0xeb8fad7c7f8680b5},\n      {0xdb68c2ca82ed2a05, 0xa67398db9f6820e2},\n#else\n      {0xff77b1fcbebcdc4f, 0x25e8e89c13bb0f7b},\n      {0xce5d73ff402d98e3, 0xfb0a3d212dc81290},\n      {0xa6b34ad8c9dfc06f, 0xf42faa48c0ea481f},\n      {0x86a8d39ef77164bc, 0xae5dff9c02033198},\n      {0xd98ddaee19068c76, 0x3badd624dd9b0958},\n      {0xafbd2350644eeacf, 0xe5d1929ef90898fb},\n      {0x8df5efabc5979c8f, 0xca8d3ffa1ef463c2},\n      {0xe55990879ddcaabd, 0xcc420a6a101d0516},\n      {0xb94470938fa89bce, 0xf808e40e8d5b3e6a},\n      {0x95a8637627989aad, 0xdde7001379a44aa9},\n      {0xf1c90080baf72cb1, 0x5324c68b12dd6339},\n      {0xc350000000000000, 0x0000000000000000},\n      {0x9dc5ada82b70b59d, 0xf020000000000000},\n      {0xfee50b7025c36a08, 0x02f236d04753d5b5},\n      {0xcde6fd5e09abcf26, 0xed4c0226b55e6f87},\n      {0xa6539930bf6bff45, 0x84db8346b786151d},\n      {0x865b86925b9bc5c2, 0x0b8a2392ba45a9b3},\n      {0xd910f7ff28069da4, 0x1b2ba1518094da05},\n      {0xaf58416654a6babb, 0x387ac8d1970027b3},\n      {0x8da471a9de737e24, 0x5ceaecfed289e5d3},\n      {0xe4d5e82392a40515, 0x0fabaf3feaa5334b},\n      {0xb8da1662e7b00a17, 0x3d6a751f3b936244},\n      {0x95527a5202df0ccb, 0x0f37801e0c43ebc9},\n      {0xf13e34aabb430a15, 0x647726b9e7c68ff0}\n#endif\n    };\n\n#if FMT_USE_FULL_CACHE_DRAGONBOX\n    return pow10_significands[k - float_info<double>::min_k];\n#else\n    static constexpr const uint64_t powers_of_5_64[] = {\n        0x0000000000000001, 0x0000000000000005, 0x0000000000000019,\n        0x000000000000007d, 0x0000000000000271, 0x0000000000000c35,\n        0x0000000000003d09, 0x000000000001312d, 0x000000000005f5e1,\n        0x00000000001dcd65, 0x00000000009502f9, 0x0000000002e90edd,\n        0x000000000e8d4a51, 0x0000000048c27395, 0x000000016bcc41e9,\n        0x000000071afd498d, 0x0000002386f26fc1, 0x000000b1a2bc2ec5,\n        0x000003782dace9d9, 0x00001158e460913d, 0x000056bc75e2d631,\n        0x0001b1ae4d6e2ef5, 0x000878678326eac9, 0x002a5a058fc295ed,\n        0x00d3c21bcecceda1, 0x0422ca8b0a00a425, 0x14adf4b7320334b9};\n\n    static const int compression_ratio = 27;\n\n    // Compute base index.\n    int cache_index = (k - float_info<double>::min_k) / compression_ratio;\n    int kb = cache_index * compression_ratio + float_info<double>::min_k;\n    int offset = k - kb;\n\n    // Get base cache.\n    uint128_fallback base_cache = pow10_significands[cache_index];\n    if (offset == 0) return base_cache;\n\n    // Compute the required amount of bit-shift.\n    int alpha = floor_log2_pow10(kb + offset) - floor_log2_pow10(kb) - offset;\n    FMT_ASSERT(alpha > 0 && alpha < 64, \"shifting error detected\");\n\n    // Try to recover the real cache.\n    uint64_t pow5 = powers_of_5_64[offset];\n    uint128_fallback recovered_cache = umul128(base_cache.high(), pow5);\n    uint128_fallback middle_low = umul128(base_cache.low(), pow5);\n\n    recovered_cache += middle_low.high();\n\n    uint64_t high_to_middle = recovered_cache.high() << (64 - alpha);\n    uint64_t middle_to_low = recovered_cache.low() << (64 - alpha);\n\n    recovered_cache =\n        uint128_fallback{(recovered_cache.low() >> alpha) | high_to_middle,\n                         ((middle_low.low() >> alpha) | middle_to_low)};\n    FMT_ASSERT(recovered_cache.low() + 1 != 0, \"\");\n    return {recovered_cache.high(), recovered_cache.low() + 1};\n#endif\n  }\n\n  struct compute_mul_result {\n    carrier_uint result;\n    bool is_integer;\n  };\n  struct compute_mul_parity_result {\n    bool parity;\n    bool is_integer;\n  };\n\n  static auto compute_mul(carrier_uint u,\n                          const cache_entry_type& cache) noexcept\n      -> compute_mul_result {\n    auto r = umul192_upper128(u, cache);\n    return {r.high(), r.low() == 0};\n  }\n\n  static auto compute_delta(cache_entry_type const& cache, int beta) noexcept\n      -> uint32_t {\n    return static_cast<uint32_t>(cache.high() >> (64 - 1 - beta));\n  }\n\n  static auto compute_mul_parity(carrier_uint two_f,\n                                 const cache_entry_type& cache,\n                                 int beta) noexcept\n      -> compute_mul_parity_result {\n    FMT_ASSERT(beta >= 1, \"\");\n    FMT_ASSERT(beta < 64, \"\");\n\n    auto r = umul192_lower128(two_f, cache);\n    return {((r.high() >> (64 - beta)) & 1) != 0,\n            ((r.high() << beta) | (r.low() >> (64 - beta))) == 0};\n  }\n\n  static auto compute_left_endpoint_for_shorter_interval_case(\n      const cache_entry_type& cache, int beta) noexcept -> carrier_uint {\n    return (cache.high() -\n            (cache.high() >> (num_significand_bits<double>() + 2))) >>\n           (64 - num_significand_bits<double>() - 1 - beta);\n  }\n\n  static auto compute_right_endpoint_for_shorter_interval_case(\n      const cache_entry_type& cache, int beta) noexcept -> carrier_uint {\n    return (cache.high() +\n            (cache.high() >> (num_significand_bits<double>() + 1))) >>\n           (64 - num_significand_bits<double>() - 1 - beta);\n  }\n\n  static auto compute_round_up_for_shorter_interval_case(\n      const cache_entry_type& cache, int beta) noexcept -> carrier_uint {\n    return ((cache.high() >> (64 - num_significand_bits<double>() - 2 - beta)) +\n            1) /\n           2;\n  }\n};\n\nFMT_FUNC auto get_cached_power(int k) noexcept -> uint128_fallback {\n  return cache_accessor<double>::get_cached_power(k);\n}\n\n// Various integer checks\ntemplate <typename T>\nauto is_left_endpoint_integer_shorter_interval(int exponent) noexcept -> bool {\n  const int case_shorter_interval_left_endpoint_lower_threshold = 2;\n  const int case_shorter_interval_left_endpoint_upper_threshold = 3;\n  return exponent >= case_shorter_interval_left_endpoint_lower_threshold &&\n         exponent <= case_shorter_interval_left_endpoint_upper_threshold;\n}\n\n// Remove trailing zeros from n and return the number of zeros removed (float)\nFMT_INLINE int remove_trailing_zeros(uint32_t& n, int s = 0) noexcept {\n  FMT_ASSERT(n != 0, \"\");\n  // Modular inverse of 5 (mod 2^32): (mod_inv_5 * 5) mod 2^32 = 1.\n  constexpr uint32_t mod_inv_5 = 0xcccccccd;\n  constexpr uint32_t mod_inv_25 = 0xc28f5c29;  // = mod_inv_5 * mod_inv_5\n\n  while (true) {\n    auto q = rotr(n * mod_inv_25, 2);\n    if (q > max_value<uint32_t>() / 100) break;\n    n = q;\n    s += 2;\n  }\n  auto q = rotr(n * mod_inv_5, 1);\n  if (q <= max_value<uint32_t>() / 10) {\n    n = q;\n    s |= 1;\n  }\n  return s;\n}\n\n// Removes trailing zeros and returns the number of zeros removed (double)\nFMT_INLINE int remove_trailing_zeros(uint64_t& n) noexcept {\n  FMT_ASSERT(n != 0, \"\");\n\n  // This magic number is ceil(2^90 / 10^8).\n  constexpr uint64_t magic_number = 12379400392853802749ull;\n  auto nm = umul128(n, magic_number);\n\n  // Is n is divisible by 10^8?\n  if ((nm.high() & ((1ull << (90 - 64)) - 1)) == 0 && nm.low() < magic_number) {\n    // If yes, work with the quotient...\n    auto n32 = static_cast<uint32_t>(nm.high() >> (90 - 64));\n    // ... and use the 32 bit variant of the function\n    int s = remove_trailing_zeros(n32, 8);\n    n = n32;\n    return s;\n  }\n\n  // If n is not divisible by 10^8, work with n itself.\n  constexpr uint64_t mod_inv_5 = 0xcccccccccccccccd;\n  constexpr uint64_t mod_inv_25 = 0x8f5c28f5c28f5c29;  // mod_inv_5 * mod_inv_5\n\n  int s = 0;\n  while (true) {\n    auto q = rotr(n * mod_inv_25, 2);\n    if (q > max_value<uint64_t>() / 100) break;\n    n = q;\n    s += 2;\n  }\n  auto q = rotr(n * mod_inv_5, 1);\n  if (q <= max_value<uint64_t>() / 10) {\n    n = q;\n    s |= 1;\n  }\n\n  return s;\n}\n\n// The main algorithm for shorter interval case\ntemplate <typename T>\nFMT_INLINE decimal_fp<T> shorter_interval_case(int exponent) noexcept {\n  decimal_fp<T> ret_value;\n  // Compute k and beta\n  const int minus_k = floor_log10_pow2_minus_log10_4_over_3(exponent);\n  const int beta = exponent + floor_log2_pow10(-minus_k);\n\n  // Compute xi and zi\n  using cache_entry_type = typename cache_accessor<T>::cache_entry_type;\n  const cache_entry_type cache = cache_accessor<T>::get_cached_power(-minus_k);\n\n  auto xi = cache_accessor<T>::compute_left_endpoint_for_shorter_interval_case(\n      cache, beta);\n  auto zi = cache_accessor<T>::compute_right_endpoint_for_shorter_interval_case(\n      cache, beta);\n\n  // If the left endpoint is not an integer, increase it\n  if (!is_left_endpoint_integer_shorter_interval<T>(exponent)) ++xi;\n\n  // Try bigger divisor\n  ret_value.significand = zi / 10;\n\n  // If succeed, remove trailing zeros if necessary and return\n  if (ret_value.significand * 10 >= xi) {\n    ret_value.exponent = minus_k + 1;\n    ret_value.exponent += remove_trailing_zeros(ret_value.significand);\n    return ret_value;\n  }\n\n  // Otherwise, compute the round-up of y\n  ret_value.significand =\n      cache_accessor<T>::compute_round_up_for_shorter_interval_case(cache,\n                                                                    beta);\n  ret_value.exponent = minus_k;\n\n  // When tie occurs, choose one of them according to the rule\n  if (exponent >= float_info<T>::shorter_interval_tie_lower_threshold &&\n      exponent <= float_info<T>::shorter_interval_tie_upper_threshold) {\n    ret_value.significand = ret_value.significand % 2 == 0\n                                ? ret_value.significand\n                                : ret_value.significand - 1;\n  } else if (ret_value.significand < xi) {\n    ++ret_value.significand;\n  }\n  return ret_value;\n}\n\ntemplate <typename T> auto to_decimal(T x) noexcept -> decimal_fp<T> {\n  // Step 1: integer promotion & Schubfach multiplier calculation.\n\n  using carrier_uint = typename float_info<T>::carrier_uint;\n  using cache_entry_type = typename cache_accessor<T>::cache_entry_type;\n  auto br = bit_cast<carrier_uint>(x);\n\n  // Extract significand bits and exponent bits.\n  const carrier_uint significand_mask =\n      (static_cast<carrier_uint>(1) << num_significand_bits<T>()) - 1;\n  carrier_uint significand = (br & significand_mask);\n  int exponent =\n      static_cast<int>((br & exponent_mask<T>()) >> num_significand_bits<T>());\n\n  if (exponent != 0) {  // Check if normal.\n    exponent -= exponent_bias<T>() + num_significand_bits<T>();\n\n    // Shorter interval case; proceed like Schubfach.\n    // In fact, when exponent == 1 and significand == 0, the interval is\n    // regular. However, it can be shown that the end-results are anyway same.\n    if (significand == 0) return shorter_interval_case<T>(exponent);\n\n    significand |= (static_cast<carrier_uint>(1) << num_significand_bits<T>());\n  } else {\n    // Subnormal case; the interval is always regular.\n    if (significand == 0) return {0, 0};\n    exponent =\n        std::numeric_limits<T>::min_exponent - num_significand_bits<T>() - 1;\n  }\n\n  const bool include_left_endpoint = (significand % 2 == 0);\n  const bool include_right_endpoint = include_left_endpoint;\n\n  // Compute k and beta.\n  const int minus_k = floor_log10_pow2(exponent) - float_info<T>::kappa;\n  const cache_entry_type cache = cache_accessor<T>::get_cached_power(-minus_k);\n  const int beta = exponent + floor_log2_pow10(-minus_k);\n\n  // Compute zi and deltai.\n  // 10^kappa <= deltai < 10^(kappa + 1)\n  const uint32_t deltai = cache_accessor<T>::compute_delta(cache, beta);\n  const carrier_uint two_fc = significand << 1;\n\n  // For the case of binary32, the result of integer check is not correct for\n  // 29711844 * 2^-82\n  // = 6.1442653300000000008655037797566933477355632930994033813476... * 10^-18\n  // and 29711844 * 2^-81\n  // = 1.2288530660000000001731007559513386695471126586198806762695... * 10^-17,\n  // and they are the unique counterexamples. However, since 29711844 is even,\n  // this does not cause any problem for the endpoints calculations; it can only\n  // cause a problem when we need to perform integer check for the center.\n  // Fortunately, with these inputs, that branch is never executed, so we are\n  // fine.\n  const typename cache_accessor<T>::compute_mul_result z_mul =\n      cache_accessor<T>::compute_mul((two_fc | 1) << beta, cache);\n\n  // Step 2: Try larger divisor; remove trailing zeros if necessary.\n\n  // Using an upper bound on zi, we might be able to optimize the division\n  // better than the compiler; we are computing zi / big_divisor here.\n  decimal_fp<T> ret_value;\n  ret_value.significand = divide_by_10_to_kappa_plus_1(z_mul.result);\n  uint32_t r = static_cast<uint32_t>(z_mul.result - float_info<T>::big_divisor *\n                                                        ret_value.significand);\n\n  if (r < deltai) {\n    // Exclude the right endpoint if necessary.\n    if (r == 0 && (z_mul.is_integer & !include_right_endpoint)) {\n      --ret_value.significand;\n      r = float_info<T>::big_divisor;\n      goto small_divisor_case_label;\n    }\n  } else if (r > deltai) {\n    goto small_divisor_case_label;\n  } else {\n    // r == deltai; compare fractional parts.\n    const typename cache_accessor<T>::compute_mul_parity_result x_mul =\n        cache_accessor<T>::compute_mul_parity(two_fc - 1, cache, beta);\n\n    if (!(x_mul.parity | (x_mul.is_integer & include_left_endpoint)))\n      goto small_divisor_case_label;\n  }\n  ret_value.exponent = minus_k + float_info<T>::kappa + 1;\n\n  // We may need to remove trailing zeros.\n  ret_value.exponent += remove_trailing_zeros(ret_value.significand);\n  return ret_value;\n\n  // Step 3: Find the significand with the smaller divisor.\n\nsmall_divisor_case_label:\n  ret_value.significand *= 10;\n  ret_value.exponent = minus_k + float_info<T>::kappa;\n\n  uint32_t dist = r - (deltai / 2) + (float_info<T>::small_divisor / 2);\n  const bool approx_y_parity =\n      ((dist ^ (float_info<T>::small_divisor / 2)) & 1) != 0;\n\n  // Is dist divisible by 10^kappa?\n  const bool divisible_by_small_divisor =\n      check_divisibility_and_divide_by_pow10<float_info<T>::kappa>(dist);\n\n  // Add dist / 10^kappa to the significand.\n  ret_value.significand += dist;\n\n  if (!divisible_by_small_divisor) return ret_value;\n\n  // Check z^(f) >= epsilon^(f).\n  // We have either yi == zi - epsiloni or yi == (zi - epsiloni) - 1,\n  // where yi == zi - epsiloni if and only if z^(f) >= epsilon^(f).\n  // Since there are only 2 possibilities, we only need to care about the\n  // parity. Also, zi and r should have the same parity since the divisor\n  // is an even number.\n  const auto y_mul = cache_accessor<T>::compute_mul_parity(two_fc, cache, beta);\n\n  // If z^(f) >= epsilon^(f), we might have a tie when z^(f) == epsilon^(f),\n  // or equivalently, when y is an integer.\n  if (y_mul.parity != approx_y_parity)\n    --ret_value.significand;\n  else if (y_mul.is_integer & (ret_value.significand % 2 != 0))\n    --ret_value.significand;\n  return ret_value;\n}\n}  // namespace dragonbox\n}  // namespace detail\n\ntemplate <> struct formatter<detail::bigint> {\n  FMT_CONSTEXPR auto parse(format_parse_context& ctx)\n      -> format_parse_context::iterator {\n    return ctx.begin();\n  }\n\n  auto format(const detail::bigint& n, format_context& ctx) const\n      -> format_context::iterator {\n    auto out = ctx.out();\n    bool first = true;\n    for (auto i = n.bigits_.size(); i > 0; --i) {\n      auto value = n.bigits_[i - 1u];\n      if (first) {\n        out = fmt::format_to(out, FMT_STRING(\"{:x}\"), value);\n        first = false;\n        continue;\n      }\n      out = fmt::format_to(out, FMT_STRING(\"{:08x}\"), value);\n    }\n    if (n.exp_ > 0)\n      out = fmt::format_to(out, FMT_STRING(\"p{}\"),\n                           n.exp_ * detail::bigint::bigit_bits);\n    return out;\n  }\n};\n\nFMT_FUNC detail::utf8_to_utf16::utf8_to_utf16(string_view s) {\n  for_each_codepoint(s, [this](uint32_t cp, string_view) {\n    if (cp == invalid_code_point) FMT_THROW(std::runtime_error(\"invalid utf8\"));\n    if (cp <= 0xFFFF) {\n      buffer_.push_back(static_cast<wchar_t>(cp));\n    } else {\n      cp -= 0x10000;\n      buffer_.push_back(static_cast<wchar_t>(0xD800 + (cp >> 10)));\n      buffer_.push_back(static_cast<wchar_t>(0xDC00 + (cp & 0x3FF)));\n    }\n    return true;\n  });\n  buffer_.push_back(0);\n}\n\nFMT_FUNC void format_system_error(detail::buffer<char>& out, int error_code,\n                                  const char* message) noexcept {\n  FMT_TRY {\n    auto ec = std::error_code(error_code, std::generic_category());\n    detail::write(appender(out), std::system_error(ec, message).what());\n    return;\n  }\n  FMT_CATCH(...) {}\n  format_error_code(out, error_code, message);\n}\n\nFMT_FUNC void report_system_error(int error_code,\n                                  const char* message) noexcept {\n  report_error(format_system_error, error_code, message);\n}\n\nFMT_FUNC auto vformat(string_view fmt, format_args args) -> std::string {\n  // Don't optimize the \"{}\" case to keep the binary size small and because it\n  // can be better optimized in fmt::format anyway.\n  auto buffer = memory_buffer();\n  detail::vformat_to(buffer, fmt, args);\n  return to_string(buffer);\n}\n\nnamespace detail {\n\ntemplate <typename T> struct span {\n  T* data;\n  size_t size;\n};\n\ntemplate <typename F> auto flockfile(F* f) -> decltype(_lock_file(f)) {\n  _lock_file(f);\n}\ntemplate <typename F> auto funlockfile(F* f) -> decltype(_unlock_file(f)) {\n  _unlock_file(f);\n}\n\n#ifndef getc_unlocked\ntemplate <typename F> auto getc_unlocked(F* f) -> decltype(_fgetc_nolock(f)) {\n  return _fgetc_nolock(f);\n}\n#endif\n\ntemplate <typename F = FILE, typename Enable = void>\nstruct has_flockfile : std::false_type {};\n\ntemplate <typename F>\nstruct has_flockfile<F, void_t<decltype(flockfile(&std::declval<F&>()))>>\n    : std::true_type {};\n\n// A FILE wrapper. F is FILE defined as a template parameter to make system API\n// detection work.\ntemplate <typename F> class file_base {\n public:\n  F* file_;\n\n public:\n  file_base(F* file) : file_(file) {}\n  operator F*() const { return file_; }\n\n  // Reads a code unit from the stream.\n  auto get() -> int {\n    int result = getc_unlocked(file_);\n    if (result == EOF && ferror(file_) != 0)\n      FMT_THROW(system_error(errno, FMT_STRING(\"getc failed\")));\n    return result;\n  }\n\n  // Puts the code unit back into the stream buffer.\n  void unget(char c) {\n    if (ungetc(c, file_) == EOF)\n      FMT_THROW(system_error(errno, FMT_STRING(\"ungetc failed\")));\n  }\n\n  void flush() { fflush(this->file_); }\n};\n\n// A FILE wrapper for glibc.\ntemplate <typename F> class glibc_file : public file_base<F> {\n private:\n  enum {\n    line_buffered = 0x200,  // _IO_LINE_BUF\n    unbuffered = 2          // _IO_UNBUFFERED\n  };\n\n public:\n  using file_base<F>::file_base;\n\n  auto is_buffered() const -> bool {\n    return (this->file_->_flags & unbuffered) == 0;\n  }\n\n  void init_buffer() {\n    if (this->file_->_IO_write_ptr) return;\n    // Force buffer initialization by placing and removing a char in a buffer.\n    putc_unlocked(0, this->file_);\n    --this->file_->_IO_write_ptr;\n  }\n\n  // Returns the file's read buffer.\n  auto get_read_buffer() const -> span<const char> {\n    auto ptr = this->file_->_IO_read_ptr;\n    return {ptr, to_unsigned(this->file_->_IO_read_end - ptr)};\n  }\n\n  // Returns the file's write buffer.\n  auto get_write_buffer() const -> span<char> {\n    auto ptr = this->file_->_IO_write_ptr;\n    return {ptr, to_unsigned(this->file_->_IO_buf_end - ptr)};\n  }\n\n  void advance_write_buffer(size_t size) { this->file_->_IO_write_ptr += size; }\n\n  bool needs_flush() const {\n    if ((this->file_->_flags & line_buffered) == 0) return false;\n    char* end = this->file_->_IO_write_end;\n    return memchr(end, '\\n', to_unsigned(this->file_->_IO_write_ptr - end));\n  }\n\n  void flush() { fflush_unlocked(this->file_); }\n};\n\n// A FILE wrapper for Apple's libc.\ntemplate <typename F> class apple_file : public file_base<F> {\n private:\n  enum {\n    line_buffered = 1,  // __SNBF\n    unbuffered = 2      // __SLBF\n  };\n\n public:\n  using file_base<F>::file_base;\n\n  auto is_buffered() const -> bool {\n    return (this->file_->_flags & unbuffered) == 0;\n  }\n\n  void init_buffer() {\n    if (this->file_->_p) return;\n    // Force buffer initialization by placing and removing a char in a buffer.\n    putc_unlocked(0, this->file_);\n    --this->file_->_p;\n    ++this->file_->_w;\n  }\n\n  auto get_read_buffer() const -> span<const char> {\n    return {reinterpret_cast<char*>(this->file_->_p),\n            to_unsigned(this->file_->_r)};\n  }\n\n  auto get_write_buffer() const -> span<char> {\n    return {reinterpret_cast<char*>(this->file_->_p),\n            to_unsigned(this->file_->_bf._base + this->file_->_bf._size -\n                        this->file_->_p)};\n  }\n\n  void advance_write_buffer(size_t size) {\n    this->file_->_p += size;\n    this->file_->_w -= size;\n  }\n\n  bool needs_flush() const {\n    if ((this->file_->_flags & line_buffered) == 0) return false;\n    return memchr(this->file_->_p + this->file_->_w, '\\n',\n                  to_unsigned(-this->file_->_w));\n  }\n};\n\n// A fallback FILE wrapper.\ntemplate <typename F> class fallback_file : public file_base<F> {\n private:\n  char next_;  // The next unconsumed character in the buffer.\n  bool has_next_ = false;\n\n public:\n  using file_base<F>::file_base;\n\n  auto is_buffered() const -> bool { return false; }\n  auto needs_flush() const -> bool { return false; }\n  void init_buffer() {}\n\n  auto get_read_buffer() const -> span<const char> {\n    return {&next_, has_next_ ? 1u : 0u};\n  }\n\n  auto get_write_buffer() const -> span<char> { return {nullptr, 0}; }\n\n  void advance_write_buffer(size_t) {}\n\n  auto get() -> int {\n    has_next_ = false;\n    return file_base<F>::get();\n  }\n\n  void unget(char c) {\n    file_base<F>::unget(c);\n    next_ = c;\n    has_next_ = true;\n  }\n};\n\n#ifndef FMT_USE_FALLBACK_FILE\n#  define FMT_USE_FALLBACK_FILE 1\n#endif\n\ntemplate <typename F,\n          FMT_ENABLE_IF(sizeof(F::_p) != 0 && !FMT_USE_FALLBACK_FILE)>\nauto get_file(F* f, int) -> apple_file<F> {\n  return f;\n}\ntemplate <typename F,\n          FMT_ENABLE_IF(sizeof(F::_IO_read_ptr) != 0 && !FMT_USE_FALLBACK_FILE)>\ninline auto get_file(F* f, int) -> glibc_file<F> {\n  return f;\n}\n\ninline auto get_file(FILE* f, ...) -> fallback_file<FILE> { return f; }\n\nusing file_ref = decltype(get_file(static_cast<FILE*>(nullptr), 0));\n\ntemplate <typename F = FILE, typename Enable = void>\nclass file_print_buffer : public buffer<char> {\n public:\n  explicit file_print_buffer(F*) : buffer(nullptr, size_t()) {}\n};\n\ntemplate <typename F>\nclass file_print_buffer<F, enable_if_t<has_flockfile<F>::value>>\n    : public buffer<char> {\n private:\n  file_ref file_;\n\n  static void grow(buffer<char>& base, size_t) {\n    auto& self = static_cast<file_print_buffer&>(base);\n    self.file_.advance_write_buffer(self.size());\n    if (self.file_.get_write_buffer().size == 0) self.file_.flush();\n    auto buf = self.file_.get_write_buffer();\n    FMT_ASSERT(buf.size > 0, \"\");\n    self.set(buf.data, buf.size);\n    self.clear();\n  }\n\n public:\n  explicit file_print_buffer(F* f) : buffer(grow, size_t()), file_(f) {\n    flockfile(f);\n    file_.init_buffer();\n    auto buf = file_.get_write_buffer();\n    set(buf.data, buf.size);\n  }\n  ~file_print_buffer() {\n    file_.advance_write_buffer(size());\n    bool flush = file_.needs_flush();\n    F* f = file_;    // Make funlockfile depend on the template parameter F\n    funlockfile(f);  // for the system API detection to work.\n    if (flush) fflush(file_);\n  }\n};\n\n#if !defined(_WIN32) || defined(FMT_USE_WRITE_CONSOLE)\nFMT_FUNC auto write_console(int, string_view) -> bool { return false; }\n#else\nusing dword = conditional_t<sizeof(long) == 4, unsigned long, unsigned>;\nextern \"C\" __declspec(dllimport) int __stdcall WriteConsoleW(  //\n    void*, const void*, dword, dword*, void*);\n\nFMT_FUNC bool write_console(int fd, string_view text) {\n  auto u16 = utf8_to_utf16(text);\n  return WriteConsoleW(reinterpret_cast<void*>(_get_osfhandle(fd)), u16.c_str(),\n                       static_cast<dword>(u16.size()), nullptr, nullptr) != 0;\n}\n#endif\n\n#ifdef _WIN32\n// Print assuming legacy (non-Unicode) encoding.\nFMT_FUNC void vprint_mojibake(std::FILE* f, string_view fmt, format_args args,\n                              bool newline) {\n  auto buffer = memory_buffer();\n  detail::vformat_to(buffer, fmt, args);\n  if (newline) buffer.push_back('\\n');\n  fwrite_fully(buffer.data(), buffer.size(), f);\n}\n#endif\n\nFMT_FUNC void print(std::FILE* f, string_view text) {\n#if defined(_WIN32) && !defined(FMT_USE_WRITE_CONSOLE)\n  int fd = _fileno(f);\n  if (_isatty(fd)) {\n    std::fflush(f);\n    if (write_console(fd, text)) return;\n  }\n#endif\n  fwrite_fully(text.data(), text.size(), f);\n}\n}  // namespace detail\n\nFMT_FUNC void vprint_buffered(std::FILE* f, string_view fmt, format_args args) {\n  auto buffer = memory_buffer();\n  detail::vformat_to(buffer, fmt, args);\n  detail::print(f, {buffer.data(), buffer.size()});\n}\n\nFMT_FUNC void vprint(std::FILE* f, string_view fmt, format_args args) {\n  if (!detail::file_ref(f).is_buffered() || !detail::has_flockfile<>())\n    return vprint_buffered(f, fmt, args);\n  auto&& buffer = detail::file_print_buffer<>(f);\n  return detail::vformat_to(buffer, fmt, args);\n}\n\nFMT_FUNC void vprintln(std::FILE* f, string_view fmt, format_args args) {\n  auto buffer = memory_buffer();\n  detail::vformat_to(buffer, fmt, args);\n  buffer.push_back('\\n');\n  detail::print(f, {buffer.data(), buffer.size()});\n}\n\nFMT_FUNC void vprint(string_view fmt, format_args args) {\n  vprint(stdout, fmt, args);\n}\n\nnamespace detail {\n\nstruct singleton {\n  unsigned char upper;\n  unsigned char lower_count;\n};\n\ninline auto is_printable(uint16_t x, const singleton* singletons,\n                         size_t singletons_size,\n                         const unsigned char* singleton_lowers,\n                         const unsigned char* normal, size_t normal_size)\n    -> bool {\n  auto upper = x >> 8;\n  auto lower_start = 0;\n  for (size_t i = 0; i < singletons_size; ++i) {\n    auto s = singletons[i];\n    auto lower_end = lower_start + s.lower_count;\n    if (upper < s.upper) break;\n    if (upper == s.upper) {\n      for (auto j = lower_start; j < lower_end; ++j) {\n        if (singleton_lowers[j] == (x & 0xff)) return false;\n      }\n    }\n    lower_start = lower_end;\n  }\n\n  auto xsigned = static_cast<int>(x);\n  auto current = true;\n  for (size_t i = 0; i < normal_size; ++i) {\n    auto v = static_cast<int>(normal[i]);\n    auto len = (v & 0x80) != 0 ? (v & 0x7f) << 8 | normal[++i] : v;\n    xsigned -= len;\n    if (xsigned < 0) break;\n    current = !current;\n  }\n  return current;\n}\n\n// This code is generated by support/printable.py.\nFMT_FUNC auto is_printable(uint32_t cp) -> bool {\n  static constexpr singleton singletons0[] = {\n      {0x00, 1},  {0x03, 5},  {0x05, 6},  {0x06, 3},  {0x07, 6},  {0x08, 8},\n      {0x09, 17}, {0x0a, 28}, {0x0b, 25}, {0x0c, 20}, {0x0d, 16}, {0x0e, 13},\n      {0x0f, 4},  {0x10, 3},  {0x12, 18}, {0x13, 9},  {0x16, 1},  {0x17, 5},\n      {0x18, 2},  {0x19, 3},  {0x1a, 7},  {0x1c, 2},  {0x1d, 1},  {0x1f, 22},\n      {0x20, 3},  {0x2b, 3},  {0x2c, 2},  {0x2d, 11}, {0x2e, 1},  {0x30, 3},\n      {0x31, 2},  {0x32, 1},  {0xa7, 2},  {0xa9, 2},  {0xaa, 4},  {0xab, 8},\n      {0xfa, 2},  {0xfb, 5},  {0xfd, 4},  {0xfe, 3},  {0xff, 9},\n  };\n  static constexpr unsigned char singletons0_lower[] = {\n      0xad, 0x78, 0x79, 0x8b, 0x8d, 0xa2, 0x30, 0x57, 0x58, 0x8b, 0x8c, 0x90,\n      0x1c, 0x1d, 0xdd, 0x0e, 0x0f, 0x4b, 0x4c, 0xfb, 0xfc, 0x2e, 0x2f, 0x3f,\n      0x5c, 0x5d, 0x5f, 0xb5, 0xe2, 0x84, 0x8d, 0x8e, 0x91, 0x92, 0xa9, 0xb1,\n      0xba, 0xbb, 0xc5, 0xc6, 0xc9, 0xca, 0xde, 0xe4, 0xe5, 0xff, 0x00, 0x04,\n      0x11, 0x12, 0x29, 0x31, 0x34, 0x37, 0x3a, 0x3b, 0x3d, 0x49, 0x4a, 0x5d,\n      0x84, 0x8e, 0x92, 0xa9, 0xb1, 0xb4, 0xba, 0xbb, 0xc6, 0xca, 0xce, 0xcf,\n      0xe4, 0xe5, 0x00, 0x04, 0x0d, 0x0e, 0x11, 0x12, 0x29, 0x31, 0x34, 0x3a,\n      0x3b, 0x45, 0x46, 0x49, 0x4a, 0x5e, 0x64, 0x65, 0x84, 0x91, 0x9b, 0x9d,\n      0xc9, 0xce, 0xcf, 0x0d, 0x11, 0x29, 0x45, 0x49, 0x57, 0x64, 0x65, 0x8d,\n      0x91, 0xa9, 0xb4, 0xba, 0xbb, 0xc5, 0xc9, 0xdf, 0xe4, 0xe5, 0xf0, 0x0d,\n      0x11, 0x45, 0x49, 0x64, 0x65, 0x80, 0x84, 0xb2, 0xbc, 0xbe, 0xbf, 0xd5,\n      0xd7, 0xf0, 0xf1, 0x83, 0x85, 0x8b, 0xa4, 0xa6, 0xbe, 0xbf, 0xc5, 0xc7,\n      0xce, 0xcf, 0xda, 0xdb, 0x48, 0x98, 0xbd, 0xcd, 0xc6, 0xce, 0xcf, 0x49,\n      0x4e, 0x4f, 0x57, 0x59, 0x5e, 0x5f, 0x89, 0x8e, 0x8f, 0xb1, 0xb6, 0xb7,\n      0xbf, 0xc1, 0xc6, 0xc7, 0xd7, 0x11, 0x16, 0x17, 0x5b, 0x5c, 0xf6, 0xf7,\n      0xfe, 0xff, 0x80, 0x0d, 0x6d, 0x71, 0xde, 0xdf, 0x0e, 0x0f, 0x1f, 0x6e,\n      0x6f, 0x1c, 0x1d, 0x5f, 0x7d, 0x7e, 0xae, 0xaf, 0xbb, 0xbc, 0xfa, 0x16,\n      0x17, 0x1e, 0x1f, 0x46, 0x47, 0x4e, 0x4f, 0x58, 0x5a, 0x5c, 0x5e, 0x7e,\n      0x7f, 0xb5, 0xc5, 0xd4, 0xd5, 0xdc, 0xf0, 0xf1, 0xf5, 0x72, 0x73, 0x8f,\n      0x74, 0x75, 0x96, 0x2f, 0x5f, 0x26, 0x2e, 0x2f, 0xa7, 0xaf, 0xb7, 0xbf,\n      0xc7, 0xcf, 0xd7, 0xdf, 0x9a, 0x40, 0x97, 0x98, 0x30, 0x8f, 0x1f, 0xc0,\n      0xc1, 0xce, 0xff, 0x4e, 0x4f, 0x5a, 0x5b, 0x07, 0x08, 0x0f, 0x10, 0x27,\n      0x2f, 0xee, 0xef, 0x6e, 0x6f, 0x37, 0x3d, 0x3f, 0x42, 0x45, 0x90, 0x91,\n      0xfe, 0xff, 0x53, 0x67, 0x75, 0xc8, 0xc9, 0xd0, 0xd1, 0xd8, 0xd9, 0xe7,\n      0xfe, 0xff,\n  };\n  static constexpr singleton singletons1[] = {\n      {0x00, 6},  {0x01, 1}, {0x03, 1},  {0x04, 2}, {0x08, 8},  {0x09, 2},\n      {0x0a, 5},  {0x0b, 2}, {0x0e, 4},  {0x10, 1}, {0x11, 2},  {0x12, 5},\n      {0x13, 17}, {0x14, 1}, {0x15, 2},  {0x17, 2}, {0x19, 13}, {0x1c, 5},\n      {0x1d, 8},  {0x24, 1}, {0x6a, 3},  {0x6b, 2}, {0xbc, 2},  {0xd1, 2},\n      {0xd4, 12}, {0xd5, 9}, {0xd6, 2},  {0xd7, 2}, {0xda, 1},  {0xe0, 5},\n      {0xe1, 2},  {0xe8, 2}, {0xee, 32}, {0xf0, 4}, {0xf8, 2},  {0xf9, 2},\n      {0xfa, 2},  {0xfb, 1},\n  };\n  static constexpr unsigned char singletons1_lower[] = {\n      0x0c, 0x27, 0x3b, 0x3e, 0x4e, 0x4f, 0x8f, 0x9e, 0x9e, 0x9f, 0x06, 0x07,\n      0x09, 0x36, 0x3d, 0x3e, 0x56, 0xf3, 0xd0, 0xd1, 0x04, 0x14, 0x18, 0x36,\n      0x37, 0x56, 0x57, 0x7f, 0xaa, 0xae, 0xaf, 0xbd, 0x35, 0xe0, 0x12, 0x87,\n      0x89, 0x8e, 0x9e, 0x04, 0x0d, 0x0e, 0x11, 0x12, 0x29, 0x31, 0x34, 0x3a,\n      0x45, 0x46, 0x49, 0x4a, 0x4e, 0x4f, 0x64, 0x65, 0x5c, 0xb6, 0xb7, 0x1b,\n      0x1c, 0x07, 0x08, 0x0a, 0x0b, 0x14, 0x17, 0x36, 0x39, 0x3a, 0xa8, 0xa9,\n      0xd8, 0xd9, 0x09, 0x37, 0x90, 0x91, 0xa8, 0x07, 0x0a, 0x3b, 0x3e, 0x66,\n      0x69, 0x8f, 0x92, 0x6f, 0x5f, 0xee, 0xef, 0x5a, 0x62, 0x9a, 0x9b, 0x27,\n      0x28, 0x55, 0x9d, 0xa0, 0xa1, 0xa3, 0xa4, 0xa7, 0xa8, 0xad, 0xba, 0xbc,\n      0xc4, 0x06, 0x0b, 0x0c, 0x15, 0x1d, 0x3a, 0x3f, 0x45, 0x51, 0xa6, 0xa7,\n      0xcc, 0xcd, 0xa0, 0x07, 0x19, 0x1a, 0x22, 0x25, 0x3e, 0x3f, 0xc5, 0xc6,\n      0x04, 0x20, 0x23, 0x25, 0x26, 0x28, 0x33, 0x38, 0x3a, 0x48, 0x4a, 0x4c,\n      0x50, 0x53, 0x55, 0x56, 0x58, 0x5a, 0x5c, 0x5e, 0x60, 0x63, 0x65, 0x66,\n      0x6b, 0x73, 0x78, 0x7d, 0x7f, 0x8a, 0xa4, 0xaa, 0xaf, 0xb0, 0xc0, 0xd0,\n      0xae, 0xaf, 0x79, 0xcc, 0x6e, 0x6f, 0x93,\n  };\n  static constexpr unsigned char normal0[] = {\n      0x00, 0x20, 0x5f, 0x22, 0x82, 0xdf, 0x04, 0x82, 0x44, 0x08, 0x1b, 0x04,\n      0x06, 0x11, 0x81, 0xac, 0x0e, 0x80, 0xab, 0x35, 0x28, 0x0b, 0x80, 0xe0,\n      0x03, 0x19, 0x08, 0x01, 0x04, 0x2f, 0x04, 0x34, 0x04, 0x07, 0x03, 0x01,\n      0x07, 0x06, 0x07, 0x11, 0x0a, 0x50, 0x0f, 0x12, 0x07, 0x55, 0x07, 0x03,\n      0x04, 0x1c, 0x0a, 0x09, 0x03, 0x08, 0x03, 0x07, 0x03, 0x02, 0x03, 0x03,\n      0x03, 0x0c, 0x04, 0x05, 0x03, 0x0b, 0x06, 0x01, 0x0e, 0x15, 0x05, 0x3a,\n      0x03, 0x11, 0x07, 0x06, 0x05, 0x10, 0x07, 0x57, 0x07, 0x02, 0x07, 0x15,\n      0x0d, 0x50, 0x04, 0x43, 0x03, 0x2d, 0x03, 0x01, 0x04, 0x11, 0x06, 0x0f,\n      0x0c, 0x3a, 0x04, 0x1d, 0x25, 0x5f, 0x20, 0x6d, 0x04, 0x6a, 0x25, 0x80,\n      0xc8, 0x05, 0x82, 0xb0, 0x03, 0x1a, 0x06, 0x82, 0xfd, 0x03, 0x59, 0x07,\n      0x15, 0x0b, 0x17, 0x09, 0x14, 0x0c, 0x14, 0x0c, 0x6a, 0x06, 0x0a, 0x06,\n      0x1a, 0x06, 0x59, 0x07, 0x2b, 0x05, 0x46, 0x0a, 0x2c, 0x04, 0x0c, 0x04,\n      0x01, 0x03, 0x31, 0x0b, 0x2c, 0x04, 0x1a, 0x06, 0x0b, 0x03, 0x80, 0xac,\n      0x06, 0x0a, 0x06, 0x21, 0x3f, 0x4c, 0x04, 0x2d, 0x03, 0x74, 0x08, 0x3c,\n      0x03, 0x0f, 0x03, 0x3c, 0x07, 0x38, 0x08, 0x2b, 0x05, 0x82, 0xff, 0x11,\n      0x18, 0x08, 0x2f, 0x11, 0x2d, 0x03, 0x20, 0x10, 0x21, 0x0f, 0x80, 0x8c,\n      0x04, 0x82, 0x97, 0x19, 0x0b, 0x15, 0x88, 0x94, 0x05, 0x2f, 0x05, 0x3b,\n      0x07, 0x02, 0x0e, 0x18, 0x09, 0x80, 0xb3, 0x2d, 0x74, 0x0c, 0x80, 0xd6,\n      0x1a, 0x0c, 0x05, 0x80, 0xff, 0x05, 0x80, 0xdf, 0x0c, 0xee, 0x0d, 0x03,\n      0x84, 0x8d, 0x03, 0x37, 0x09, 0x81, 0x5c, 0x14, 0x80, 0xb8, 0x08, 0x80,\n      0xcb, 0x2a, 0x38, 0x03, 0x0a, 0x06, 0x38, 0x08, 0x46, 0x08, 0x0c, 0x06,\n      0x74, 0x0b, 0x1e, 0x03, 0x5a, 0x04, 0x59, 0x09, 0x80, 0x83, 0x18, 0x1c,\n      0x0a, 0x16, 0x09, 0x4c, 0x04, 0x80, 0x8a, 0x06, 0xab, 0xa4, 0x0c, 0x17,\n      0x04, 0x31, 0xa1, 0x04, 0x81, 0xda, 0x26, 0x07, 0x0c, 0x05, 0x05, 0x80,\n      0xa5, 0x11, 0x81, 0x6d, 0x10, 0x78, 0x28, 0x2a, 0x06, 0x4c, 0x04, 0x80,\n      0x8d, 0x04, 0x80, 0xbe, 0x03, 0x1b, 0x03, 0x0f, 0x0d,\n  };\n  static constexpr unsigned char normal1[] = {\n      0x5e, 0x22, 0x7b, 0x05, 0x03, 0x04, 0x2d, 0x03, 0x66, 0x03, 0x01, 0x2f,\n      0x2e, 0x80, 0x82, 0x1d, 0x03, 0x31, 0x0f, 0x1c, 0x04, 0x24, 0x09, 0x1e,\n      0x05, 0x2b, 0x05, 0x44, 0x04, 0x0e, 0x2a, 0x80, 0xaa, 0x06, 0x24, 0x04,\n      0x24, 0x04, 0x28, 0x08, 0x34, 0x0b, 0x01, 0x80, 0x90, 0x81, 0x37, 0x09,\n      0x16, 0x0a, 0x08, 0x80, 0x98, 0x39, 0x03, 0x63, 0x08, 0x09, 0x30, 0x16,\n      0x05, 0x21, 0x03, 0x1b, 0x05, 0x01, 0x40, 0x38, 0x04, 0x4b, 0x05, 0x2f,\n      0x04, 0x0a, 0x07, 0x09, 0x07, 0x40, 0x20, 0x27, 0x04, 0x0c, 0x09, 0x36,\n      0x03, 0x3a, 0x05, 0x1a, 0x07, 0x04, 0x0c, 0x07, 0x50, 0x49, 0x37, 0x33,\n      0x0d, 0x33, 0x07, 0x2e, 0x08, 0x0a, 0x81, 0x26, 0x52, 0x4e, 0x28, 0x08,\n      0x2a, 0x56, 0x1c, 0x14, 0x17, 0x09, 0x4e, 0x04, 0x1e, 0x0f, 0x43, 0x0e,\n      0x19, 0x07, 0x0a, 0x06, 0x48, 0x08, 0x27, 0x09, 0x75, 0x0b, 0x3f, 0x41,\n      0x2a, 0x06, 0x3b, 0x05, 0x0a, 0x06, 0x51, 0x06, 0x01, 0x05, 0x10, 0x03,\n      0x05, 0x80, 0x8b, 0x62, 0x1e, 0x48, 0x08, 0x0a, 0x80, 0xa6, 0x5e, 0x22,\n      0x45, 0x0b, 0x0a, 0x06, 0x0d, 0x13, 0x39, 0x07, 0x0a, 0x36, 0x2c, 0x04,\n      0x10, 0x80, 0xc0, 0x3c, 0x64, 0x53, 0x0c, 0x48, 0x09, 0x0a, 0x46, 0x45,\n      0x1b, 0x48, 0x08, 0x53, 0x1d, 0x39, 0x81, 0x07, 0x46, 0x0a, 0x1d, 0x03,\n      0x47, 0x49, 0x37, 0x03, 0x0e, 0x08, 0x0a, 0x06, 0x39, 0x07, 0x0a, 0x81,\n      0x36, 0x19, 0x80, 0xb7, 0x01, 0x0f, 0x32, 0x0d, 0x83, 0x9b, 0x66, 0x75,\n      0x0b, 0x80, 0xc4, 0x8a, 0xbc, 0x84, 0x2f, 0x8f, 0xd1, 0x82, 0x47, 0xa1,\n      0xb9, 0x82, 0x39, 0x07, 0x2a, 0x04, 0x02, 0x60, 0x26, 0x0a, 0x46, 0x0a,\n      0x28, 0x05, 0x13, 0x82, 0xb0, 0x5b, 0x65, 0x4b, 0x04, 0x39, 0x07, 0x11,\n      0x40, 0x05, 0x0b, 0x02, 0x0e, 0x97, 0xf8, 0x08, 0x84, 0xd6, 0x2a, 0x09,\n      0xa2, 0xf7, 0x81, 0x1f, 0x31, 0x03, 0x11, 0x04, 0x08, 0x81, 0x8c, 0x89,\n      0x04, 0x6b, 0x05, 0x0d, 0x03, 0x09, 0x07, 0x10, 0x93, 0x60, 0x80, 0xf6,\n      0x0a, 0x73, 0x08, 0x6e, 0x17, 0x46, 0x80, 0x9a, 0x14, 0x0c, 0x57, 0x09,\n      0x19, 0x80, 0x87, 0x81, 0x47, 0x03, 0x85, 0x42, 0x0f, 0x15, 0x85, 0x50,\n      0x2b, 0x80, 0xd5, 0x2d, 0x03, 0x1a, 0x04, 0x02, 0x81, 0x70, 0x3a, 0x05,\n      0x01, 0x85, 0x00, 0x80, 0xd7, 0x29, 0x4c, 0x04, 0x0a, 0x04, 0x02, 0x83,\n      0x11, 0x44, 0x4c, 0x3d, 0x80, 0xc2, 0x3c, 0x06, 0x01, 0x04, 0x55, 0x05,\n      0x1b, 0x34, 0x02, 0x81, 0x0e, 0x2c, 0x04, 0x64, 0x0c, 0x56, 0x0a, 0x80,\n      0xae, 0x38, 0x1d, 0x0d, 0x2c, 0x04, 0x09, 0x07, 0x02, 0x0e, 0x06, 0x80,\n      0x9a, 0x83, 0xd8, 0x08, 0x0d, 0x03, 0x0d, 0x03, 0x74, 0x0c, 0x59, 0x07,\n      0x0c, 0x14, 0x0c, 0x04, 0x38, 0x08, 0x0a, 0x06, 0x28, 0x08, 0x22, 0x4e,\n      0x81, 0x54, 0x0c, 0x15, 0x03, 0x03, 0x05, 0x07, 0x09, 0x19, 0x07, 0x07,\n      0x09, 0x03, 0x0d, 0x07, 0x29, 0x80, 0xcb, 0x25, 0x0a, 0x84, 0x06,\n  };\n  auto lower = static_cast<uint16_t>(cp);\n  if (cp < 0x10000) {\n    return is_printable(lower, singletons0,\n                        sizeof(singletons0) / sizeof(*singletons0),\n                        singletons0_lower, normal0, sizeof(normal0));\n  }\n  if (cp < 0x20000) {\n    return is_printable(lower, singletons1,\n                        sizeof(singletons1) / sizeof(*singletons1),\n                        singletons1_lower, normal1, sizeof(normal1));\n  }\n  if (0x2a6de <= cp && cp < 0x2a700) return false;\n  if (0x2b735 <= cp && cp < 0x2b740) return false;\n  if (0x2b81e <= cp && cp < 0x2b820) return false;\n  if (0x2cea2 <= cp && cp < 0x2ceb0) return false;\n  if (0x2ebe1 <= cp && cp < 0x2f800) return false;\n  if (0x2fa1e <= cp && cp < 0x30000) return false;\n  if (0x3134b <= cp && cp < 0xe0100) return false;\n  if (0xe01f0 <= cp && cp < 0x110000) return false;\n  return cp < 0x110000;\n}\n\n}  // namespace detail\n\nFMT_END_NAMESPACE\n\n#endif  // FMT_FORMAT_INL_H_\n"
  },
  {
    "path": "vendor/fmt/format.h",
    "content": "/*\n  Formatting library for C++\n\n  Copyright (c) 2012 - present, Victor Zverovich\n\n  Permission is hereby granted, free of charge, to any person obtaining\n  a copy of this software and associated documentation files (the\n  \"Software\"), to deal in the Software without restriction, including\n  without limitation the rights to use, copy, modify, merge, publish,\n  distribute, sublicense, and/or sell copies of the Software, and to\n  permit persons to whom the Software is furnished to do so, subject to\n  the following conditions:\n\n  The above copyright notice and this permission notice shall be\n  included in all copies or substantial portions of the Software.\n\n  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n  --- Optional exception to the license ---\n\n  As an exception, if, as a result of your compiling your source code, portions\n  of this Software are embedded into a machine-executable object form of such\n  source code, you may redistribute such embedded portions in such object form\n  without including the above copyright and permission notices.\n */\n\n#ifndef FMT_FORMAT_H_\n#define FMT_FORMAT_H_\n\n#ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES\n#  define _LIBCPP_REMOVE_TRANSITIVE_INCLUDES\n#  define FMT_REMOVE_TRANSITIVE_INCLUDES\n#endif\n\n#include \"base.h\"\n\n#ifndef FMT_MODULE\n#  include <cmath>             // std::signbit\n#  include <cstdint>           // uint32_t\n#  include <cstring>           // std::memcpy\n#  include <initializer_list>  // std::initializer_list\n#  include <limits>            // std::numeric_limits\n#  if defined(__GLIBCXX__) && !defined(_GLIBCXX_USE_DUAL_ABI)\n// Workaround for pre gcc 5 libstdc++.\n#    include <memory>  // std::allocator_traits\n#  endif\n#  include <stdexcept>     // std::runtime_error\n#  include <string>        // std::string\n#  include <system_error>  // std::system_error\n\n// Checking FMT_CPLUSPLUS for warning suppression in MSVC.\n#  if FMT_HAS_INCLUDE(<bit>) && FMT_CPLUSPLUS > 201703L\n#    include <bit>  // std::bit_cast\n#  endif\n\n// libc++ supports string_view in pre-c++17.\n#  if FMT_HAS_INCLUDE(<string_view>) && \\\n      (FMT_CPLUSPLUS >= 201703L || defined(_LIBCPP_VERSION))\n#    include <string_view>\n#    define FMT_USE_STRING_VIEW\n#  endif\n#endif  // FMT_MODULE\n\n#if defined __cpp_inline_variables && __cpp_inline_variables >= 201606L\n#  define FMT_INLINE_VARIABLE inline\n#else\n#  define FMT_INLINE_VARIABLE\n#endif\n\n#ifndef FMT_NO_UNIQUE_ADDRESS\n#  if FMT_CPLUSPLUS >= 202002L\n#    if FMT_HAS_CPP_ATTRIBUTE(no_unique_address)\n#      define FMT_NO_UNIQUE_ADDRESS [[no_unique_address]]\n// VS2019 v16.10 and later except clang-cl (https://reviews.llvm.org/D110485).\n#    elif (FMT_MSC_VERSION >= 1929) && !FMT_CLANG_VERSION\n#      define FMT_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]]\n#    endif\n#  endif\n#endif\n#ifndef FMT_NO_UNIQUE_ADDRESS\n#  define FMT_NO_UNIQUE_ADDRESS\n#endif\n\n// Visibility when compiled as a shared library/object.\n#if defined(FMT_LIB_EXPORT) || defined(FMT_SHARED)\n#  define FMT_SO_VISIBILITY(value) FMT_VISIBILITY(value)\n#else\n#  define FMT_SO_VISIBILITY(value)\n#endif\n\n#ifdef __has_builtin\n#  define FMT_HAS_BUILTIN(x) __has_builtin(x)\n#else\n#  define FMT_HAS_BUILTIN(x) 0\n#endif\n\n#if FMT_GCC_VERSION || FMT_CLANG_VERSION\n#  define FMT_NOINLINE __attribute__((noinline))\n#else\n#  define FMT_NOINLINE\n#endif\n\nnamespace std {\ntemplate <> struct iterator_traits<fmt::appender> {\n  using iterator_category = output_iterator_tag;\n  using value_type = char;\n};\n}  // namespace std\n\n#ifndef FMT_THROW\n#  if FMT_EXCEPTIONS\n#    if FMT_MSC_VERSION || defined(__NVCC__)\nFMT_BEGIN_NAMESPACE\nnamespace detail {\ntemplate <typename Exception> inline void do_throw(const Exception& x) {\n  // Silence unreachable code warnings in MSVC and NVCC because these\n  // are nearly impossible to fix in a generic code.\n  volatile bool b = true;\n  if (b) throw x;\n}\n}  // namespace detail\nFMT_END_NAMESPACE\n#      define FMT_THROW(x) detail::do_throw(x)\n#    else\n#      define FMT_THROW(x) throw x\n#    endif\n#  else\n#    define FMT_THROW(x) \\\n      ::fmt::detail::assert_fail(__FILE__, __LINE__, (x).what())\n#  endif\n#endif\n\n#ifndef FMT_MAYBE_UNUSED\n#  if FMT_HAS_CPP17_ATTRIBUTE(maybe_unused)\n#    define FMT_MAYBE_UNUSED [[maybe_unused]]\n#  else\n#    define FMT_MAYBE_UNUSED\n#  endif\n#endif\n\n#ifndef FMT_USE_USER_DEFINED_LITERALS\n// EDG based compilers (Intel, NVIDIA, Elbrus, etc), GCC and MSVC support UDLs.\n//\n// GCC before 4.9 requires a space in `operator\"\" _a` which is invalid in later\n// compiler versions.\n#  if (FMT_HAS_FEATURE(cxx_user_literals) || FMT_GCC_VERSION >= 409 || \\\n       FMT_MSC_VERSION >= 1900) &&                                     \\\n      (!defined(__EDG_VERSION__) || __EDG_VERSION__ >= /* UDL feature */ 480)\n#    define FMT_USE_USER_DEFINED_LITERALS 1\n#  else\n#    define FMT_USE_USER_DEFINED_LITERALS 0\n#  endif\n#endif\n\n// Defining FMT_REDUCE_INT_INSTANTIATIONS to 1, will reduce the number of\n// integer formatter template instantiations to just one by only using the\n// largest integer type. This results in a reduction in binary size but will\n// cause a decrease in integer formatting performance.\n#if !defined(FMT_REDUCE_INT_INSTANTIATIONS)\n#  define FMT_REDUCE_INT_INSTANTIATIONS 0\n#endif\n\n// __builtin_clz is broken in clang with Microsoft CodeGen:\n// https://github.com/fmtlib/fmt/issues/519.\n#if !FMT_MSC_VERSION\n#  if FMT_HAS_BUILTIN(__builtin_clz) || FMT_GCC_VERSION || FMT_ICC_VERSION\n#    define FMT_BUILTIN_CLZ(n) __builtin_clz(n)\n#  endif\n#  if FMT_HAS_BUILTIN(__builtin_clzll) || FMT_GCC_VERSION || FMT_ICC_VERSION\n#    define FMT_BUILTIN_CLZLL(n) __builtin_clzll(n)\n#  endif\n#endif\n\n// __builtin_ctz is broken in Intel Compiler Classic on Windows:\n// https://github.com/fmtlib/fmt/issues/2510.\n#ifndef __ICL\n#  if FMT_HAS_BUILTIN(__builtin_ctz) || FMT_GCC_VERSION || FMT_ICC_VERSION || \\\n      defined(__NVCOMPILER)\n#    define FMT_BUILTIN_CTZ(n) __builtin_ctz(n)\n#  endif\n#  if FMT_HAS_BUILTIN(__builtin_ctzll) || FMT_GCC_VERSION || \\\n      FMT_ICC_VERSION || defined(__NVCOMPILER)\n#    define FMT_BUILTIN_CTZLL(n) __builtin_ctzll(n)\n#  endif\n#endif\n\n#if FMT_MSC_VERSION\n#  include <intrin.h>  // _BitScanReverse[64], _BitScanForward[64], _umul128\n#endif\n\n// Some compilers masquerade as both MSVC and GCC-likes or otherwise support\n// __builtin_clz and __builtin_clzll, so only define FMT_BUILTIN_CLZ using the\n// MSVC intrinsics if the clz and clzll builtins are not available.\n#if FMT_MSC_VERSION && !defined(FMT_BUILTIN_CLZLL) && \\\n    !defined(FMT_BUILTIN_CTZLL)\nFMT_BEGIN_NAMESPACE\nnamespace detail {\n// Avoid Clang with Microsoft CodeGen's -Wunknown-pragmas warning.\n#  if !defined(__clang__)\n#    pragma intrinsic(_BitScanForward)\n#    pragma intrinsic(_BitScanReverse)\n#    if defined(_WIN64)\n#      pragma intrinsic(_BitScanForward64)\n#      pragma intrinsic(_BitScanReverse64)\n#    endif\n#  endif\n\ninline auto clz(uint32_t x) -> int {\n  unsigned long r = 0;\n  _BitScanReverse(&r, x);\n  FMT_ASSERT(x != 0, \"\");\n  // Static analysis complains about using uninitialized data\n  // \"r\", but the only way that can happen is if \"x\" is 0,\n  // which the callers guarantee to not happen.\n  FMT_MSC_WARNING(suppress : 6102)\n  return 31 ^ static_cast<int>(r);\n}\n#  define FMT_BUILTIN_CLZ(n) detail::clz(n)\n\ninline auto clzll(uint64_t x) -> int {\n  unsigned long r = 0;\n#  ifdef _WIN64\n  _BitScanReverse64(&r, x);\n#  else\n  // Scan the high 32 bits.\n  if (_BitScanReverse(&r, static_cast<uint32_t>(x >> 32)))\n    return 63 ^ static_cast<int>(r + 32);\n  // Scan the low 32 bits.\n  _BitScanReverse(&r, static_cast<uint32_t>(x));\n#  endif\n  FMT_ASSERT(x != 0, \"\");\n  FMT_MSC_WARNING(suppress : 6102)  // Suppress a bogus static analysis warning.\n  return 63 ^ static_cast<int>(r);\n}\n#  define FMT_BUILTIN_CLZLL(n) detail::clzll(n)\n\ninline auto ctz(uint32_t x) -> int {\n  unsigned long r = 0;\n  _BitScanForward(&r, x);\n  FMT_ASSERT(x != 0, \"\");\n  FMT_MSC_WARNING(suppress : 6102)  // Suppress a bogus static analysis warning.\n  return static_cast<int>(r);\n}\n#  define FMT_BUILTIN_CTZ(n) detail::ctz(n)\n\ninline auto ctzll(uint64_t x) -> int {\n  unsigned long r = 0;\n  FMT_ASSERT(x != 0, \"\");\n  FMT_MSC_WARNING(suppress : 6102)  // Suppress a bogus static analysis warning.\n#  ifdef _WIN64\n  _BitScanForward64(&r, x);\n#  else\n  // Scan the low 32 bits.\n  if (_BitScanForward(&r, static_cast<uint32_t>(x))) return static_cast<int>(r);\n  // Scan the high 32 bits.\n  _BitScanForward(&r, static_cast<uint32_t>(x >> 32));\n  r += 32;\n#  endif\n  return static_cast<int>(r);\n}\n#  define FMT_BUILTIN_CTZLL(n) detail::ctzll(n)\n}  // namespace detail\nFMT_END_NAMESPACE\n#endif\n\nFMT_BEGIN_NAMESPACE\n\ntemplate <typename Char, typename Traits, typename Allocator>\nstruct is_contiguous<std::basic_string<Char, Traits, Allocator>>\n    : std::true_type {};\n\nnamespace detail {\n\nFMT_CONSTEXPR inline void abort_fuzzing_if(bool condition) {\n  ignore_unused(condition);\n#ifdef FMT_FUZZ\n  if (condition) throw std::runtime_error(\"fuzzing limit reached\");\n#endif\n}\n\n#if defined(FMT_USE_STRING_VIEW)\ntemplate <typename Char> using std_string_view = std::basic_string_view<Char>;\n#else\ntemplate <typename T> struct std_string_view {};\n#endif\n\n// Implementation of std::bit_cast for pre-C++20.\ntemplate <typename To, typename From, FMT_ENABLE_IF(sizeof(To) == sizeof(From))>\nFMT_CONSTEXPR20 auto bit_cast(const From& from) -> To {\n#ifdef __cpp_lib_bit_cast\n  if (is_constant_evaluated()) return std::bit_cast<To>(from);\n#endif\n  auto to = To();\n  // The cast suppresses a bogus -Wclass-memaccess on GCC.\n  std::memcpy(static_cast<void*>(&to), &from, sizeof(to));\n  return to;\n}\n\ninline auto is_big_endian() -> bool {\n#ifdef _WIN32\n  return false;\n#elif defined(__BIG_ENDIAN__)\n  return true;\n#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__)\n  return __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__;\n#else\n  struct bytes {\n    char data[sizeof(int)];\n  };\n  return bit_cast<bytes>(1).data[0] == 0;\n#endif\n}\n\nclass uint128_fallback {\n private:\n  uint64_t lo_, hi_;\n\n public:\n  constexpr uint128_fallback(uint64_t hi, uint64_t lo) : lo_(lo), hi_(hi) {}\n  constexpr uint128_fallback(uint64_t value = 0) : lo_(value), hi_(0) {}\n\n  constexpr auto high() const noexcept -> uint64_t { return hi_; }\n  constexpr auto low() const noexcept -> uint64_t { return lo_; }\n\n  template <typename T, FMT_ENABLE_IF(std::is_integral<T>::value)>\n  constexpr explicit operator T() const {\n    return static_cast<T>(lo_);\n  }\n\n  friend constexpr auto operator==(const uint128_fallback& lhs,\n                                   const uint128_fallback& rhs) -> bool {\n    return lhs.hi_ == rhs.hi_ && lhs.lo_ == rhs.lo_;\n  }\n  friend constexpr auto operator!=(const uint128_fallback& lhs,\n                                   const uint128_fallback& rhs) -> bool {\n    return !(lhs == rhs);\n  }\n  friend constexpr auto operator>(const uint128_fallback& lhs,\n                                  const uint128_fallback& rhs) -> bool {\n    return lhs.hi_ != rhs.hi_ ? lhs.hi_ > rhs.hi_ : lhs.lo_ > rhs.lo_;\n  }\n  friend constexpr auto operator|(const uint128_fallback& lhs,\n                                  const uint128_fallback& rhs)\n      -> uint128_fallback {\n    return {lhs.hi_ | rhs.hi_, lhs.lo_ | rhs.lo_};\n  }\n  friend constexpr auto operator&(const uint128_fallback& lhs,\n                                  const uint128_fallback& rhs)\n      -> uint128_fallback {\n    return {lhs.hi_ & rhs.hi_, lhs.lo_ & rhs.lo_};\n  }\n  friend constexpr auto operator~(const uint128_fallback& n)\n      -> uint128_fallback {\n    return {~n.hi_, ~n.lo_};\n  }\n  friend auto operator+(const uint128_fallback& lhs,\n                        const uint128_fallback& rhs) -> uint128_fallback {\n    auto result = uint128_fallback(lhs);\n    result += rhs;\n    return result;\n  }\n  friend auto operator*(const uint128_fallback& lhs, uint32_t rhs)\n      -> uint128_fallback {\n    FMT_ASSERT(lhs.hi_ == 0, \"\");\n    uint64_t hi = (lhs.lo_ >> 32) * rhs;\n    uint64_t lo = (lhs.lo_ & ~uint32_t()) * rhs;\n    uint64_t new_lo = (hi << 32) + lo;\n    return {(hi >> 32) + (new_lo < lo ? 1 : 0), new_lo};\n  }\n  friend auto operator-(const uint128_fallback& lhs, uint64_t rhs)\n      -> uint128_fallback {\n    return {lhs.hi_ - (lhs.lo_ < rhs ? 1 : 0), lhs.lo_ - rhs};\n  }\n  FMT_CONSTEXPR auto operator>>(int shift) const -> uint128_fallback {\n    if (shift == 64) return {0, hi_};\n    if (shift > 64) return uint128_fallback(0, hi_) >> (shift - 64);\n    return {hi_ >> shift, (hi_ << (64 - shift)) | (lo_ >> shift)};\n  }\n  FMT_CONSTEXPR auto operator<<(int shift) const -> uint128_fallback {\n    if (shift == 64) return {lo_, 0};\n    if (shift > 64) return uint128_fallback(lo_, 0) << (shift - 64);\n    return {hi_ << shift | (lo_ >> (64 - shift)), (lo_ << shift)};\n  }\n  FMT_CONSTEXPR auto operator>>=(int shift) -> uint128_fallback& {\n    return *this = *this >> shift;\n  }\n  FMT_CONSTEXPR void operator+=(uint128_fallback n) {\n    uint64_t new_lo = lo_ + n.lo_;\n    uint64_t new_hi = hi_ + n.hi_ + (new_lo < lo_ ? 1 : 0);\n    FMT_ASSERT(new_hi >= hi_, \"\");\n    lo_ = new_lo;\n    hi_ = new_hi;\n  }\n  FMT_CONSTEXPR void operator&=(uint128_fallback n) {\n    lo_ &= n.lo_;\n    hi_ &= n.hi_;\n  }\n\n  FMT_CONSTEXPR20 auto operator+=(uint64_t n) noexcept -> uint128_fallback& {\n    if (is_constant_evaluated()) {\n      lo_ += n;\n      hi_ += (lo_ < n ? 1 : 0);\n      return *this;\n    }\n#if FMT_HAS_BUILTIN(__builtin_addcll) && !defined(__ibmxl__)\n    unsigned long long carry;\n    lo_ = __builtin_addcll(lo_, n, 0, &carry);\n    hi_ += carry;\n#elif FMT_HAS_BUILTIN(__builtin_ia32_addcarryx_u64) && !defined(__ibmxl__)\n    unsigned long long result;\n    auto carry = __builtin_ia32_addcarryx_u64(0, lo_, n, &result);\n    lo_ = result;\n    hi_ += carry;\n#elif defined(_MSC_VER) && defined(_M_X64)\n    auto carry = _addcarry_u64(0, lo_, n, &lo_);\n    _addcarry_u64(carry, hi_, 0, &hi_);\n#else\n    lo_ += n;\n    hi_ += (lo_ < n ? 1 : 0);\n#endif\n    return *this;\n  }\n};\n\nusing uint128_t = conditional_t<FMT_USE_INT128, uint128_opt, uint128_fallback>;\n\n#ifdef UINTPTR_MAX\nusing uintptr_t = ::uintptr_t;\n#else\nusing uintptr_t = uint128_t;\n#endif\n\n// Returns the largest possible value for type T. Same as\n// std::numeric_limits<T>::max() but shorter and not affected by the max macro.\ntemplate <typename T> constexpr auto max_value() -> T {\n  return (std::numeric_limits<T>::max)();\n}\ntemplate <typename T> constexpr auto num_bits() -> int {\n  return std::numeric_limits<T>::digits;\n}\n// std::numeric_limits<T>::digits may return 0 for 128-bit ints.\ntemplate <> constexpr auto num_bits<int128_opt>() -> int { return 128; }\ntemplate <> constexpr auto num_bits<uint128_opt>() -> int { return 128; }\ntemplate <> constexpr auto num_bits<uint128_fallback>() -> int { return 128; }\n\n// A heterogeneous bit_cast used for converting 96-bit long double to uint128_t\n// and 128-bit pointers to uint128_fallback.\ntemplate <typename To, typename From, FMT_ENABLE_IF(sizeof(To) > sizeof(From))>\ninline auto bit_cast(const From& from) -> To {\n  constexpr auto size = static_cast<int>(sizeof(From) / sizeof(unsigned));\n  struct data_t {\n    unsigned value[static_cast<unsigned>(size)];\n  } data = bit_cast<data_t>(from);\n  auto result = To();\n  if (const_check(is_big_endian())) {\n    for (int i = 0; i < size; ++i)\n      result = (result << num_bits<unsigned>()) | data.value[i];\n  } else {\n    for (int i = size - 1; i >= 0; --i)\n      result = (result << num_bits<unsigned>()) | data.value[i];\n  }\n  return result;\n}\n\ntemplate <typename UInt>\nFMT_CONSTEXPR20 inline auto countl_zero_fallback(UInt n) -> int {\n  int lz = 0;\n  constexpr UInt msb_mask = static_cast<UInt>(1) << (num_bits<UInt>() - 1);\n  for (; (n & msb_mask) == 0; n <<= 1) lz++;\n  return lz;\n}\n\nFMT_CONSTEXPR20 inline auto countl_zero(uint32_t n) -> int {\n#ifdef FMT_BUILTIN_CLZ\n  if (!is_constant_evaluated()) return FMT_BUILTIN_CLZ(n);\n#endif\n  return countl_zero_fallback(n);\n}\n\nFMT_CONSTEXPR20 inline auto countl_zero(uint64_t n) -> int {\n#ifdef FMT_BUILTIN_CLZLL\n  if (!is_constant_evaluated()) return FMT_BUILTIN_CLZLL(n);\n#endif\n  return countl_zero_fallback(n);\n}\n\nFMT_INLINE void assume(bool condition) {\n  (void)condition;\n#if FMT_HAS_BUILTIN(__builtin_assume) && !FMT_ICC_VERSION\n  __builtin_assume(condition);\n#elif FMT_GCC_VERSION\n  if (!condition) __builtin_unreachable();\n#endif\n}\n\n// An approximation of iterator_t for pre-C++20 systems.\ntemplate <typename T>\nusing iterator_t = decltype(std::begin(std::declval<T&>()));\ntemplate <typename T> using sentinel_t = decltype(std::end(std::declval<T&>()));\n\n// A workaround for std::string not having mutable data() until C++17.\ntemplate <typename Char>\ninline auto get_data(std::basic_string<Char>& s) -> Char* {\n  return &s[0];\n}\ntemplate <typename Container>\ninline auto get_data(Container& c) -> typename Container::value_type* {\n  return c.data();\n}\n\n// Attempts to reserve space for n extra characters in the output range.\n// Returns a pointer to the reserved range or a reference to it.\ntemplate <typename OutputIt,\n          FMT_ENABLE_IF(is_back_insert_iterator<OutputIt>::value&&\n                            is_contiguous<typename OutputIt::container>::value)>\n#if FMT_CLANG_VERSION >= 307 && !FMT_ICC_VERSION\n__attribute__((no_sanitize(\"undefined\")))\n#endif\ninline auto\nreserve(OutputIt it, size_t n) -> typename OutputIt::value_type* {\n  auto& c = get_container(it);\n  size_t size = c.size();\n  c.resize(size + n);\n  return get_data(c) + size;\n}\n\ntemplate <typename T>\ninline auto reserve(basic_appender<T> it, size_t n) -> basic_appender<T> {\n  buffer<T>& buf = get_container(it);\n  buf.try_reserve(buf.size() + n);\n  return it;\n}\n\ntemplate <typename Iterator>\nconstexpr auto reserve(Iterator& it, size_t) -> Iterator& {\n  return it;\n}\n\ntemplate <typename OutputIt>\nusing reserve_iterator =\n    remove_reference_t<decltype(reserve(std::declval<OutputIt&>(), 0))>;\n\ntemplate <typename T, typename OutputIt>\nconstexpr auto to_pointer(OutputIt, size_t) -> T* {\n  return nullptr;\n}\ntemplate <typename T> auto to_pointer(basic_appender<T> it, size_t n) -> T* {\n  buffer<T>& buf = get_container(it);\n  auto size = buf.size();\n  buf.try_reserve(size + n);\n  if (buf.capacity() < size + n) return nullptr;\n  buf.try_resize(size + n);\n  return buf.data() + size;\n}\n\ntemplate <typename OutputIt,\n          FMT_ENABLE_IF(is_back_insert_iterator<OutputIt>::value&&\n                            is_contiguous<typename OutputIt::container>::value)>\ninline auto base_iterator(OutputIt it,\n                          typename OutputIt::container_type::value_type*)\n    -> OutputIt {\n  return it;\n}\n\ntemplate <typename Iterator>\nconstexpr auto base_iterator(Iterator, Iterator it) -> Iterator {\n  return it;\n}\n\n// <algorithm> is spectacularly slow to compile in C++20 so use a simple fill_n\n// instead (#1998).\ntemplate <typename OutputIt, typename Size, typename T>\nFMT_CONSTEXPR auto fill_n(OutputIt out, Size count, const T& value)\n    -> OutputIt {\n  for (Size i = 0; i < count; ++i) *out++ = value;\n  return out;\n}\ntemplate <typename T, typename Size>\nFMT_CONSTEXPR20 auto fill_n(T* out, Size count, char value) -> T* {\n  if (is_constant_evaluated()) {\n    return fill_n<T*, Size, T>(out, count, value);\n  }\n  std::memset(out, value, to_unsigned(count));\n  return out + count;\n}\n\ntemplate <typename OutChar, typename InputIt, typename OutputIt>\nFMT_CONSTEXPR FMT_NOINLINE auto copy_noinline(InputIt begin, InputIt end,\n                                              OutputIt out) -> OutputIt {\n  return copy<OutChar>(begin, end, out);\n}\n\n// A public domain branchless UTF-8 decoder by Christopher Wellons:\n// https://github.com/skeeto/branchless-utf8\n/* Decode the next character, c, from s, reporting errors in e.\n *\n * Since this is a branchless decoder, four bytes will be read from the\n * buffer regardless of the actual length of the next character. This\n * means the buffer _must_ have at least three bytes of zero padding\n * following the end of the data stream.\n *\n * Errors are reported in e, which will be non-zero if the parsed\n * character was somehow invalid: invalid byte sequence, non-canonical\n * encoding, or a surrogate half.\n *\n * The function returns a pointer to the next character. When an error\n * occurs, this pointer will be a guess that depends on the particular\n * error, but it will always advance at least one byte.\n */\nFMT_CONSTEXPR inline auto utf8_decode(const char* s, uint32_t* c, int* e)\n    -> const char* {\n  constexpr const int masks[] = {0x00, 0x7f, 0x1f, 0x0f, 0x07};\n  constexpr const uint32_t mins[] = {4194304, 0, 128, 2048, 65536};\n  constexpr const int shiftc[] = {0, 18, 12, 6, 0};\n  constexpr const int shifte[] = {0, 6, 4, 2, 0};\n\n  int len = \"\\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\"\n      [static_cast<unsigned char>(*s) >> 3];\n  // Compute the pointer to the next character early so that the next\n  // iteration can start working on the next character. Neither Clang\n  // nor GCC figure out this reordering on their own.\n  const char* next = s + len + !len;\n\n  using uchar = unsigned char;\n\n  // Assume a four-byte character and load four bytes. Unused bits are\n  // shifted out.\n  *c = uint32_t(uchar(s[0]) & masks[len]) << 18;\n  *c |= uint32_t(uchar(s[1]) & 0x3f) << 12;\n  *c |= uint32_t(uchar(s[2]) & 0x3f) << 6;\n  *c |= uint32_t(uchar(s[3]) & 0x3f) << 0;\n  *c >>= shiftc[len];\n\n  // Accumulate the various error conditions.\n  *e = (*c < mins[len]) << 6;       // non-canonical encoding\n  *e |= ((*c >> 11) == 0x1b) << 7;  // surrogate half?\n  *e |= (*c > 0x10FFFF) << 8;       // out of range?\n  *e |= (uchar(s[1]) & 0xc0) >> 2;\n  *e |= (uchar(s[2]) & 0xc0) >> 4;\n  *e |= uchar(s[3]) >> 6;\n  *e ^= 0x2a;  // top two bits of each tail byte correct?\n  *e >>= shifte[len];\n\n  return next;\n}\n\nconstexpr FMT_INLINE_VARIABLE uint32_t invalid_code_point = ~uint32_t();\n\n// Invokes f(cp, sv) for every code point cp in s with sv being the string view\n// corresponding to the code point. cp is invalid_code_point on error.\ntemplate <typename F>\nFMT_CONSTEXPR void for_each_codepoint(string_view s, F f) {\n  auto decode = [f](const char* buf_ptr, const char* ptr) {\n    auto cp = uint32_t();\n    auto error = 0;\n    auto end = utf8_decode(buf_ptr, &cp, &error);\n    bool result = f(error ? invalid_code_point : cp,\n                    string_view(ptr, error ? 1 : to_unsigned(end - buf_ptr)));\n    return result ? (error ? buf_ptr + 1 : end) : nullptr;\n  };\n  auto p = s.data();\n  const size_t block_size = 4;  // utf8_decode always reads blocks of 4 chars.\n  if (s.size() >= block_size) {\n    for (auto end = p + s.size() - block_size + 1; p < end;) {\n      p = decode(p, p);\n      if (!p) return;\n    }\n  }\n  if (auto num_chars_left = s.data() + s.size() - p) {\n    char buf[2 * block_size - 1] = {};\n    copy<char>(p, p + num_chars_left, buf);\n    const char* buf_ptr = buf;\n    do {\n      auto end = decode(buf_ptr, p);\n      if (!end) return;\n      p += end - buf_ptr;\n      buf_ptr = end;\n    } while (buf_ptr - buf < num_chars_left);\n  }\n}\n\ntemplate <typename Char>\ninline auto compute_width(basic_string_view<Char> s) -> size_t {\n  return s.size();\n}\n\n// Computes approximate display width of a UTF-8 string.\nFMT_CONSTEXPR inline auto compute_width(string_view s) -> size_t {\n  size_t num_code_points = 0;\n  // It is not a lambda for compatibility with C++14.\n  struct count_code_points {\n    size_t* count;\n    FMT_CONSTEXPR auto operator()(uint32_t cp, string_view) const -> bool {\n      *count += detail::to_unsigned(\n          1 +\n          (cp >= 0x1100 &&\n           (cp <= 0x115f ||  // Hangul Jamo init. consonants\n            cp == 0x2329 ||  // LEFT-POINTING ANGLE BRACKET\n            cp == 0x232a ||  // RIGHT-POINTING ANGLE BRACKET\n            // CJK ... Yi except IDEOGRAPHIC HALF FILL SPACE:\n            (cp >= 0x2e80 && cp <= 0xa4cf && cp != 0x303f) ||\n            (cp >= 0xac00 && cp <= 0xd7a3) ||    // Hangul Syllables\n            (cp >= 0xf900 && cp <= 0xfaff) ||    // CJK Compatibility Ideographs\n            (cp >= 0xfe10 && cp <= 0xfe19) ||    // Vertical Forms\n            (cp >= 0xfe30 && cp <= 0xfe6f) ||    // CJK Compatibility Forms\n            (cp >= 0xff00 && cp <= 0xff60) ||    // Fullwidth Forms\n            (cp >= 0xffe0 && cp <= 0xffe6) ||    // Fullwidth Forms\n            (cp >= 0x20000 && cp <= 0x2fffd) ||  // CJK\n            (cp >= 0x30000 && cp <= 0x3fffd) ||\n            // Miscellaneous Symbols and Pictographs + Emoticons:\n            (cp >= 0x1f300 && cp <= 0x1f64f) ||\n            // Supplemental Symbols and Pictographs:\n            (cp >= 0x1f900 && cp <= 0x1f9ff))));\n      return true;\n    }\n  };\n  // We could avoid branches by using utf8_decode directly.\n  for_each_codepoint(s, count_code_points{&num_code_points});\n  return num_code_points;\n}\n\ntemplate <typename Char>\ninline auto code_point_index(basic_string_view<Char> s, size_t n) -> size_t {\n  size_t size = s.size();\n  return n < size ? n : size;\n}\n\n// Calculates the index of the nth code point in a UTF-8 string.\ninline auto code_point_index(string_view s, size_t n) -> size_t {\n  size_t result = s.size();\n  const char* begin = s.begin();\n  for_each_codepoint(s, [begin, &n, &result](uint32_t, string_view sv) {\n    if (n != 0) {\n      --n;\n      return true;\n    }\n    result = to_unsigned(sv.begin() - begin);\n    return false;\n  });\n  return result;\n}\n\ntemplate <typename T> struct is_integral : std::is_integral<T> {};\ntemplate <> struct is_integral<int128_opt> : std::true_type {};\ntemplate <> struct is_integral<uint128_t> : std::true_type {};\n\ntemplate <typename T>\nusing is_signed =\n    std::integral_constant<bool, std::numeric_limits<T>::is_signed ||\n                                     std::is_same<T, int128_opt>::value>;\n\ntemplate <typename T>\nusing is_integer =\n    bool_constant<is_integral<T>::value && !std::is_same<T, bool>::value &&\n                  !std::is_same<T, char>::value &&\n                  !std::is_same<T, wchar_t>::value>;\n\n#ifndef FMT_USE_FLOAT\n#  define FMT_USE_FLOAT 1\n#endif\n#ifndef FMT_USE_DOUBLE\n#  define FMT_USE_DOUBLE 1\n#endif\n#ifndef FMT_USE_LONG_DOUBLE\n#  define FMT_USE_LONG_DOUBLE 1\n#endif\n\n#if defined(FMT_USE_FLOAT128)\n// Use the provided definition.\n#elif FMT_CLANG_VERSION && FMT_HAS_INCLUDE(<quadmath.h>)\n#  define FMT_USE_FLOAT128 1\n#elif FMT_GCC_VERSION && defined(_GLIBCXX_USE_FLOAT128) && \\\n    !defined(__STRICT_ANSI__)\n#  define FMT_USE_FLOAT128 1\n#else\n#  define FMT_USE_FLOAT128 0\n#endif\n#if FMT_USE_FLOAT128\nusing float128 = __float128;\n#else\nusing float128 = void;\n#endif\n\ntemplate <typename T> using is_float128 = std::is_same<T, float128>;\n\ntemplate <typename T>\nusing is_floating_point =\n    bool_constant<std::is_floating_point<T>::value || is_float128<T>::value>;\n\ntemplate <typename T, bool = std::is_floating_point<T>::value>\nstruct is_fast_float : bool_constant<std::numeric_limits<T>::is_iec559 &&\n                                     sizeof(T) <= sizeof(double)> {};\ntemplate <typename T> struct is_fast_float<T, false> : std::false_type {};\n\ntemplate <typename T>\nusing is_double_double = bool_constant<std::numeric_limits<T>::digits == 106>;\n\n#ifndef FMT_USE_FULL_CACHE_DRAGONBOX\n#  define FMT_USE_FULL_CACHE_DRAGONBOX 0\n#endif\n\ntemplate <typename T, typename Enable = void>\nstruct is_locale : std::false_type {};\ntemplate <typename T>\nstruct is_locale<T, void_t<decltype(T::classic())>> : std::true_type {};\n}  // namespace detail\n\nFMT_BEGIN_EXPORT\n\n// The number of characters to store in the basic_memory_buffer object itself\n// to avoid dynamic memory allocation.\nenum { inline_buffer_size = 500 };\n\n/**\n * A dynamically growing memory buffer for trivially copyable/constructible\n * types with the first `SIZE` elements stored in the object itself. Most\n * commonly used via the `memory_buffer` alias for `char`.\n *\n * **Example**:\n *\n *     auto out = fmt::memory_buffer();\n *     fmt::format_to(std::back_inserter(out), \"The answer is {}.\", 42);\n *\n * This will append \"The answer is 42.\" to `out`. The buffer content can be\n * converted to `std::string` with `to_string(out)`.\n */\ntemplate <typename T, size_t SIZE = inline_buffer_size,\n          typename Allocator = std::allocator<T>>\nclass basic_memory_buffer : public detail::buffer<T> {\n private:\n  T store_[SIZE];\n\n  // Don't inherit from Allocator to avoid generating type_info for it.\n  FMT_NO_UNIQUE_ADDRESS Allocator alloc_;\n\n  // Deallocate memory allocated by the buffer.\n  FMT_CONSTEXPR20 void deallocate() {\n    T* data = this->data();\n    if (data != store_) alloc_.deallocate(data, this->capacity());\n  }\n\n  static FMT_CONSTEXPR20 void grow(detail::buffer<T>& buf, size_t size) {\n    detail::abort_fuzzing_if(size > 5000);\n    auto& self = static_cast<basic_memory_buffer&>(buf);\n    const size_t max_size =\n        std::allocator_traits<Allocator>::max_size(self.alloc_);\n    size_t old_capacity = buf.capacity();\n    size_t new_capacity = old_capacity + old_capacity / 2;\n    if (size > new_capacity)\n      new_capacity = size;\n    else if (new_capacity > max_size)\n      new_capacity = size > max_size ? size : max_size;\n    T* old_data = buf.data();\n    T* new_data = self.alloc_.allocate(new_capacity);\n    // Suppress a bogus -Wstringop-overflow in gcc 13.1 (#3481).\n    detail::assume(buf.size() <= new_capacity);\n    // The following code doesn't throw, so the raw pointer above doesn't leak.\n    memcpy(new_data, old_data, buf.size() * sizeof(T));\n    self.set(new_data, new_capacity);\n    // deallocate must not throw according to the standard, but even if it does,\n    // the buffer already uses the new storage and will deallocate it in\n    // destructor.\n    if (old_data != self.store_) self.alloc_.deallocate(old_data, old_capacity);\n  }\n\n public:\n  using value_type = T;\n  using const_reference = const T&;\n\n  FMT_CONSTEXPR20 explicit basic_memory_buffer(\n      const Allocator& alloc = Allocator())\n      : detail::buffer<T>(grow), alloc_(alloc) {\n    this->set(store_, SIZE);\n    if (detail::is_constant_evaluated()) detail::fill_n(store_, SIZE, T());\n  }\n  FMT_CONSTEXPR20 ~basic_memory_buffer() { deallocate(); }\n\n private:\n  // Move data from other to this buffer.\n  FMT_CONSTEXPR20 void move(basic_memory_buffer& other) {\n    alloc_ = std::move(other.alloc_);\n    T* data = other.data();\n    size_t size = other.size(), capacity = other.capacity();\n    if (data == other.store_) {\n      this->set(store_, capacity);\n      detail::copy<T>(other.store_, other.store_ + size, store_);\n    } else {\n      this->set(data, capacity);\n      // Set pointer to the inline array so that delete is not called\n      // when deallocating.\n      other.set(other.store_, 0);\n      other.clear();\n    }\n    this->resize(size);\n  }\n\n public:\n  /// Constructs a `basic_memory_buffer` object moving the content of the other\n  /// object to it.\n  FMT_CONSTEXPR20 basic_memory_buffer(basic_memory_buffer&& other) noexcept\n      : detail::buffer<T>(grow) {\n    move(other);\n  }\n\n  /// Moves the content of the other `basic_memory_buffer` object to this one.\n  auto operator=(basic_memory_buffer&& other) noexcept -> basic_memory_buffer& {\n    FMT_ASSERT(this != &other, \"\");\n    deallocate();\n    move(other);\n    return *this;\n  }\n\n  // Returns a copy of the allocator associated with this buffer.\n  auto get_allocator() const -> Allocator { return alloc_; }\n\n  /// Resizes the buffer to contain `count` elements. If T is a POD type new\n  /// elements may not be initialized.\n  FMT_CONSTEXPR20 void resize(size_t count) { this->try_resize(count); }\n\n  /// Increases the buffer capacity to `new_capacity`.\n  void reserve(size_t new_capacity) { this->try_reserve(new_capacity); }\n\n  using detail::buffer<T>::append;\n  template <typename ContiguousRange>\n  void append(const ContiguousRange& range) {\n    append(range.data(), range.data() + range.size());\n  }\n};\n\nusing memory_buffer = basic_memory_buffer<char>;\n\ntemplate <typename T, size_t SIZE, typename Allocator>\nstruct is_contiguous<basic_memory_buffer<T, SIZE, Allocator>> : std::true_type {\n};\n\nFMT_END_EXPORT\nnamespace detail {\nFMT_API auto write_console(int fd, string_view text) -> bool;\nFMT_API void print(std::FILE*, string_view);\n}  // namespace detail\n\nFMT_BEGIN_EXPORT\n\n// Suppress a misleading warning in older versions of clang.\n#if FMT_CLANG_VERSION\n#  pragma clang diagnostic ignored \"-Wweak-vtables\"\n#endif\n\n/// An error reported from a formatting function.\nclass FMT_SO_VISIBILITY(\"default\") format_error : public std::runtime_error {\n public:\n  using std::runtime_error::runtime_error;\n};\n\nnamespace detail_exported {\n#if FMT_USE_NONTYPE_TEMPLATE_ARGS\ntemplate <typename Char, size_t N> struct fixed_string {\n  constexpr fixed_string(const Char (&str)[N]) {\n    detail::copy<Char, const Char*, Char*>(static_cast<const Char*>(str),\n                                           str + N, data);\n  }\n  Char data[N] = {};\n};\n#endif\n\n// Converts a compile-time string to basic_string_view.\ntemplate <typename Char, size_t N>\nconstexpr auto compile_string_to_view(const Char (&s)[N])\n    -> basic_string_view<Char> {\n  // Remove trailing NUL character if needed. Won't be present if this is used\n  // with a raw character array (i.e. not defined as a string).\n  return {s, N - (std::char_traits<Char>::to_int_type(s[N - 1]) == 0 ? 1 : 0)};\n}\ntemplate <typename Char>\nconstexpr auto compile_string_to_view(basic_string_view<Char> s)\n    -> basic_string_view<Char> {\n  return s;\n}\n}  // namespace detail_exported\n\n// A generic formatting context with custom output iterator and character\n// (code unit) support. Char is the format string code unit type which can be\n// different from OutputIt::value_type.\ntemplate <typename OutputIt, typename Char> class generic_context {\n private:\n  OutputIt out_;\n  basic_format_args<generic_context> args_;\n  detail::locale_ref loc_;\n\n public:\n  using char_type = Char;\n  using iterator = OutputIt;\n  using parse_context_type = basic_format_parse_context<Char>;\n  template <typename T> using formatter_type = formatter<T, Char>;\n\n  constexpr generic_context(OutputIt out,\n                            basic_format_args<generic_context> ctx_args,\n                            detail::locale_ref loc = {})\n      : out_(out), args_(ctx_args), loc_(loc) {}\n  generic_context(generic_context&&) = default;\n  generic_context(const generic_context&) = delete;\n  void operator=(const generic_context&) = delete;\n\n  constexpr auto arg(int id) const -> basic_format_arg<generic_context> {\n    return args_.get(id);\n  }\n  auto arg(basic_string_view<Char> name) -> basic_format_arg<generic_context> {\n    return args_.get(name);\n  }\n  FMT_CONSTEXPR auto arg_id(basic_string_view<Char> name) -> int {\n    return args_.get_id(name);\n  }\n  auto args() const -> const basic_format_args<generic_context>& {\n    return args_;\n  }\n\n  FMT_CONSTEXPR auto out() -> iterator { return out_; }\n\n  void advance_to(iterator it) {\n    if (!detail::is_back_insert_iterator<iterator>()) out_ = it;\n  }\n\n  FMT_CONSTEXPR auto locale() -> detail::locale_ref { return loc_; }\n};\n\nclass loc_value {\n private:\n  basic_format_arg<format_context> value_;\n\n public:\n  template <typename T, FMT_ENABLE_IF(!detail::is_float128<T>::value)>\n  loc_value(T value) : value_(detail::make_arg<format_context>(value)) {}\n\n  template <typename T, FMT_ENABLE_IF(detail::is_float128<T>::value)>\n  loc_value(T) {}\n\n  template <typename Visitor> auto visit(Visitor&& vis) -> decltype(vis(0)) {\n    return value_.visit(vis);\n  }\n};\n\n// A locale facet that formats values in UTF-8.\n// It is parameterized on the locale to avoid the heavy <locale> include.\ntemplate <typename Locale> class format_facet : public Locale::facet {\n private:\n  std::string separator_;\n  std::string grouping_;\n  std::string decimal_point_;\n\n protected:\n  virtual auto do_put(appender out, loc_value val,\n                      const format_specs& specs) const -> bool;\n\n public:\n  static FMT_API typename Locale::id id;\n\n  explicit format_facet(Locale& loc);\n  explicit format_facet(string_view sep = \"\",\n                        std::initializer_list<unsigned char> g = {3},\n                        std::string decimal_point = \".\")\n      : separator_(sep.data(), sep.size()),\n        grouping_(g.begin(), g.end()),\n        decimal_point_(decimal_point) {}\n\n  auto put(appender out, loc_value val, const format_specs& specs) const\n      -> bool {\n    return do_put(out, val, specs);\n  }\n};\n\nFMT_END_EXPORT\n\nnamespace detail {\n\n// Returns true if value is negative, false otherwise.\n// Same as `value < 0` but doesn't produce warnings if T is an unsigned type.\ntemplate <typename T, FMT_ENABLE_IF(is_signed<T>::value)>\nconstexpr auto is_negative(T value) -> bool {\n  return value < 0;\n}\ntemplate <typename T, FMT_ENABLE_IF(!is_signed<T>::value)>\nconstexpr auto is_negative(T) -> bool {\n  return false;\n}\n\ntemplate <typename T>\nFMT_CONSTEXPR auto is_supported_floating_point(T) -> bool {\n  if (std::is_same<T, float>()) return FMT_USE_FLOAT;\n  if (std::is_same<T, double>()) return FMT_USE_DOUBLE;\n  if (std::is_same<T, long double>()) return FMT_USE_LONG_DOUBLE;\n  return true;\n}\n\n// Smallest of uint32_t, uint64_t, uint128_t that is large enough to\n// represent all values of an integral type T.\ntemplate <typename T>\nusing uint32_or_64_or_128_t =\n    conditional_t<num_bits<T>() <= 32 && !FMT_REDUCE_INT_INSTANTIATIONS,\n                  uint32_t,\n                  conditional_t<num_bits<T>() <= 64, uint64_t, uint128_t>>;\ntemplate <typename T>\nusing uint64_or_128_t = conditional_t<num_bits<T>() <= 64, uint64_t, uint128_t>;\n\n#define FMT_POWERS_OF_10(factor)                                  \\\n  factor * 10, (factor) * 100, (factor) * 1000, (factor) * 10000, \\\n      (factor) * 100000, (factor) * 1000000, (factor) * 10000000, \\\n      (factor) * 100000000, (factor) * 1000000000\n\n// Converts value in the range [0, 100) to a string.\nconstexpr auto digits2(size_t value) -> const char* {\n  // GCC generates slightly better code when value is pointer-size.\n  return &\"0001020304050607080910111213141516171819\"\n         \"2021222324252627282930313233343536373839\"\n         \"4041424344454647484950515253545556575859\"\n         \"6061626364656667686970717273747576777879\"\n         \"8081828384858687888990919293949596979899\"[value * 2];\n}\n\n// Sign is a template parameter to workaround a bug in gcc 4.8.\ntemplate <typename Char, typename Sign> constexpr auto sign(Sign s) -> Char {\n#if !FMT_GCC_VERSION || FMT_GCC_VERSION >= 604\n  static_assert(std::is_same<Sign, sign_t>::value, \"\");\n#endif\n  return static_cast<char>(((' ' << 24) | ('+' << 16) | ('-' << 8)) >> (s * 8));\n}\n\ntemplate <typename T> FMT_CONSTEXPR auto count_digits_fallback(T n) -> int {\n  int count = 1;\n  for (;;) {\n    // Integer division is slow so do it for a group of four digits instead\n    // of for every digit. The idea comes from the talk by Alexandrescu\n    // \"Three Optimization Tips for C++\". See speed-test for a comparison.\n    if (n < 10) return count;\n    if (n < 100) return count + 1;\n    if (n < 1000) return count + 2;\n    if (n < 10000) return count + 3;\n    n /= 10000u;\n    count += 4;\n  }\n}\n#if FMT_USE_INT128\nFMT_CONSTEXPR inline auto count_digits(uint128_opt n) -> int {\n  return count_digits_fallback(n);\n}\n#endif\n\n#ifdef FMT_BUILTIN_CLZLL\n// It is a separate function rather than a part of count_digits to workaround\n// the lack of static constexpr in constexpr functions.\ninline auto do_count_digits(uint64_t n) -> int {\n  // This has comparable performance to the version by Kendall Willets\n  // (https://github.com/fmtlib/format-benchmark/blob/master/digits10)\n  // but uses smaller tables.\n  // Maps bsr(n) to ceil(log10(pow(2, bsr(n) + 1) - 1)).\n  static constexpr uint8_t bsr2log10[] = {\n      1,  1,  1,  2,  2,  2,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,\n      6,  6,  6,  7,  7,  7,  7,  8,  8,  8,  9,  9,  9,  10, 10, 10,\n      10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 15, 15,\n      15, 16, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 19, 20};\n  auto t = bsr2log10[FMT_BUILTIN_CLZLL(n | 1) ^ 63];\n  static constexpr const uint64_t zero_or_powers_of_10[] = {\n      0, 0, FMT_POWERS_OF_10(1U), FMT_POWERS_OF_10(1000000000ULL),\n      10000000000000000000ULL};\n  return t - (n < zero_or_powers_of_10[t]);\n}\n#endif\n\n// Returns the number of decimal digits in n. Leading zeros are not counted\n// except for n == 0 in which case count_digits returns 1.\nFMT_CONSTEXPR20 inline auto count_digits(uint64_t n) -> int {\n#ifdef FMT_BUILTIN_CLZLL\n  if (!is_constant_evaluated()) return do_count_digits(n);\n#endif\n  return count_digits_fallback(n);\n}\n\n// Counts the number of digits in n. BITS = log2(radix).\ntemplate <int BITS, typename UInt>\nFMT_CONSTEXPR auto count_digits(UInt n) -> int {\n#ifdef FMT_BUILTIN_CLZ\n  if (!is_constant_evaluated() && num_bits<UInt>() == 32)\n    return (FMT_BUILTIN_CLZ(static_cast<uint32_t>(n) | 1) ^ 31) / BITS + 1;\n#endif\n  // Lambda avoids unreachable code warnings from NVHPC.\n  return [](UInt m) {\n    int num_digits = 0;\n    do {\n      ++num_digits;\n    } while ((m >>= BITS) != 0);\n    return num_digits;\n  }(n);\n}\n\n#ifdef FMT_BUILTIN_CLZ\n// It is a separate function rather than a part of count_digits to workaround\n// the lack of static constexpr in constexpr functions.\nFMT_INLINE auto do_count_digits(uint32_t n) -> int {\n// An optimization by Kendall Willets from https://bit.ly/3uOIQrB.\n// This increments the upper 32 bits (log10(T) - 1) when >= T is added.\n#  define FMT_INC(T) (((sizeof(#T) - 1ull) << 32) - T)\n  static constexpr uint64_t table[] = {\n      FMT_INC(0),          FMT_INC(0),          FMT_INC(0),           // 8\n      FMT_INC(10),         FMT_INC(10),         FMT_INC(10),          // 64\n      FMT_INC(100),        FMT_INC(100),        FMT_INC(100),         // 512\n      FMT_INC(1000),       FMT_INC(1000),       FMT_INC(1000),        // 4096\n      FMT_INC(10000),      FMT_INC(10000),      FMT_INC(10000),       // 32k\n      FMT_INC(100000),     FMT_INC(100000),     FMT_INC(100000),      // 256k\n      FMT_INC(1000000),    FMT_INC(1000000),    FMT_INC(1000000),     // 2048k\n      FMT_INC(10000000),   FMT_INC(10000000),   FMT_INC(10000000),    // 16M\n      FMT_INC(100000000),  FMT_INC(100000000),  FMT_INC(100000000),   // 128M\n      FMT_INC(1000000000), FMT_INC(1000000000), FMT_INC(1000000000),  // 1024M\n      FMT_INC(1000000000), FMT_INC(1000000000)                        // 4B\n  };\n  auto inc = table[FMT_BUILTIN_CLZ(n | 1) ^ 31];\n  return static_cast<int>((n + inc) >> 32);\n}\n#endif\n\n// Optional version of count_digits for better performance on 32-bit platforms.\nFMT_CONSTEXPR20 inline auto count_digits(uint32_t n) -> int {\n#ifdef FMT_BUILTIN_CLZ\n  if (!is_constant_evaluated()) {\n    return do_count_digits(n);\n  }\n#endif\n  return count_digits_fallback(n);\n}\n\ntemplate <typename Int> constexpr auto digits10() noexcept -> int {\n  return std::numeric_limits<Int>::digits10;\n}\ntemplate <> constexpr auto digits10<int128_opt>() noexcept -> int { return 38; }\ntemplate <> constexpr auto digits10<uint128_t>() noexcept -> int { return 38; }\n\ntemplate <typename Char> struct thousands_sep_result {\n  std::string grouping;\n  Char thousands_sep;\n};\n\ntemplate <typename Char>\nFMT_API auto thousands_sep_impl(locale_ref loc) -> thousands_sep_result<Char>;\ntemplate <typename Char>\ninline auto thousands_sep(locale_ref loc) -> thousands_sep_result<Char> {\n  auto result = thousands_sep_impl<char>(loc);\n  return {result.grouping, Char(result.thousands_sep)};\n}\ntemplate <>\ninline auto thousands_sep(locale_ref loc) -> thousands_sep_result<wchar_t> {\n  return thousands_sep_impl<wchar_t>(loc);\n}\n\ntemplate <typename Char>\nFMT_API auto decimal_point_impl(locale_ref loc) -> Char;\ntemplate <typename Char> inline auto decimal_point(locale_ref loc) -> Char {\n  return Char(decimal_point_impl<char>(loc));\n}\ntemplate <> inline auto decimal_point(locale_ref loc) -> wchar_t {\n  return decimal_point_impl<wchar_t>(loc);\n}\n\n// Compares two characters for equality.\ntemplate <typename Char> auto equal2(const Char* lhs, const char* rhs) -> bool {\n  return lhs[0] == Char(rhs[0]) && lhs[1] == Char(rhs[1]);\n}\ninline auto equal2(const char* lhs, const char* rhs) -> bool {\n  return memcmp(lhs, rhs, 2) == 0;\n}\n\n// Copies two characters from src to dst.\ntemplate <typename Char>\nFMT_CONSTEXPR20 FMT_INLINE void copy2(Char* dst, const char* src) {\n  if (!is_constant_evaluated() && sizeof(Char) == sizeof(char)) {\n    memcpy(dst, src, 2);\n    return;\n  }\n  *dst++ = static_cast<Char>(*src++);\n  *dst = static_cast<Char>(*src);\n}\n\ntemplate <typename Iterator> struct format_decimal_result {\n  Iterator begin;\n  Iterator end;\n};\n\n// Formats a decimal unsigned integer value writing into out pointing to a\n// buffer of specified size. The caller must ensure that the buffer is large\n// enough.\ntemplate <typename Char, typename UInt>\nFMT_CONSTEXPR20 auto format_decimal(Char* out, UInt value, int size)\n    -> format_decimal_result<Char*> {\n  FMT_ASSERT(size >= count_digits(value), \"invalid digit count\");\n  out += size;\n  Char* end = out;\n  while (value >= 100) {\n    // Integer division is slow so do it for a group of two digits instead\n    // of for every digit. The idea comes from the talk by Alexandrescu\n    // \"Three Optimization Tips for C++\". See speed-test for a comparison.\n    out -= 2;\n    copy2(out, digits2(static_cast<size_t>(value % 100)));\n    value /= 100;\n  }\n  if (value < 10) {\n    *--out = static_cast<Char>('0' + value);\n    return {out, end};\n  }\n  out -= 2;\n  copy2(out, digits2(static_cast<size_t>(value)));\n  return {out, end};\n}\n\ntemplate <typename Char, typename UInt, typename Iterator,\n          FMT_ENABLE_IF(!std::is_pointer<remove_cvref_t<Iterator>>::value)>\nFMT_CONSTEXPR inline auto format_decimal(Iterator out, UInt value, int size)\n    -> format_decimal_result<Iterator> {\n  // Buffer is large enough to hold all digits (digits10 + 1).\n  Char buffer[digits10<UInt>() + 1] = {};\n  auto end = format_decimal(buffer, value, size).end;\n  return {out, detail::copy_noinline<Char>(buffer, end, out)};\n}\n\ntemplate <unsigned BASE_BITS, typename Char, typename UInt>\nFMT_CONSTEXPR auto format_uint(Char* buffer, UInt value, int num_digits,\n                               bool upper = false) -> Char* {\n  buffer += num_digits;\n  Char* end = buffer;\n  do {\n    const char* digits = upper ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\n    unsigned digit = static_cast<unsigned>(value & ((1 << BASE_BITS) - 1));\n    *--buffer = static_cast<Char>(BASE_BITS < 4 ? static_cast<char>('0' + digit)\n                                                : digits[digit]);\n  } while ((value >>= BASE_BITS) != 0);\n  return end;\n}\n\ntemplate <unsigned BASE_BITS, typename Char, typename It, typename UInt>\nFMT_CONSTEXPR inline auto format_uint(It out, UInt value, int num_digits,\n                                      bool upper = false) -> It {\n  if (auto ptr = to_pointer<Char>(out, to_unsigned(num_digits))) {\n    format_uint<BASE_BITS>(ptr, value, num_digits, upper);\n    return out;\n  }\n  // Buffer should be large enough to hold all digits (digits / BASE_BITS + 1).\n  char buffer[num_bits<UInt>() / BASE_BITS + 1] = {};\n  format_uint<BASE_BITS>(buffer, value, num_digits, upper);\n  return detail::copy_noinline<Char>(buffer, buffer + num_digits, out);\n}\n\n// A converter from UTF-8 to UTF-16.\nclass utf8_to_utf16 {\n private:\n  basic_memory_buffer<wchar_t> buffer_;\n\n public:\n  FMT_API explicit utf8_to_utf16(string_view s);\n  operator basic_string_view<wchar_t>() const { return {&buffer_[0], size()}; }\n  auto size() const -> size_t { return buffer_.size() - 1; }\n  auto c_str() const -> const wchar_t* { return &buffer_[0]; }\n  auto str() const -> std::wstring { return {&buffer_[0], size()}; }\n};\n\nenum class to_utf8_error_policy { abort, replace };\n\n// A converter from UTF-16/UTF-32 (host endian) to UTF-8.\ntemplate <typename WChar, typename Buffer = memory_buffer> class to_utf8 {\n private:\n  Buffer buffer_;\n\n public:\n  to_utf8() {}\n  explicit to_utf8(basic_string_view<WChar> s,\n                   to_utf8_error_policy policy = to_utf8_error_policy::abort) {\n    static_assert(sizeof(WChar) == 2 || sizeof(WChar) == 4,\n                  \"Expect utf16 or utf32\");\n    if (!convert(s, policy))\n      FMT_THROW(std::runtime_error(sizeof(WChar) == 2 ? \"invalid utf16\"\n                                                      : \"invalid utf32\"));\n  }\n  operator string_view() const { return string_view(&buffer_[0], size()); }\n  auto size() const -> size_t { return buffer_.size() - 1; }\n  auto c_str() const -> const char* { return &buffer_[0]; }\n  auto str() const -> std::string { return std::string(&buffer_[0], size()); }\n\n  // Performs conversion returning a bool instead of throwing exception on\n  // conversion error. This method may still throw in case of memory allocation\n  // error.\n  auto convert(basic_string_view<WChar> s,\n               to_utf8_error_policy policy = to_utf8_error_policy::abort)\n      -> bool {\n    if (!convert(buffer_, s, policy)) return false;\n    buffer_.push_back(0);\n    return true;\n  }\n  static auto convert(Buffer& buf, basic_string_view<WChar> s,\n                      to_utf8_error_policy policy = to_utf8_error_policy::abort)\n      -> bool {\n    for (auto p = s.begin(); p != s.end(); ++p) {\n      uint32_t c = static_cast<uint32_t>(*p);\n      if (sizeof(WChar) == 2 && c >= 0xd800 && c <= 0xdfff) {\n        // Handle a surrogate pair.\n        ++p;\n        if (p == s.end() || (c & 0xfc00) != 0xd800 || (*p & 0xfc00) != 0xdc00) {\n          if (policy == to_utf8_error_policy::abort) return false;\n          buf.append(string_view(\"\\xEF\\xBF\\xBD\"));\n          --p;\n        } else {\n          c = (c << 10) + static_cast<uint32_t>(*p) - 0x35fdc00;\n        }\n      } else if (c < 0x80) {\n        buf.push_back(static_cast<char>(c));\n      } else if (c < 0x800) {\n        buf.push_back(static_cast<char>(0xc0 | (c >> 6)));\n        buf.push_back(static_cast<char>(0x80 | (c & 0x3f)));\n      } else if ((c >= 0x800 && c <= 0xd7ff) || (c >= 0xe000 && c <= 0xffff)) {\n        buf.push_back(static_cast<char>(0xe0 | (c >> 12)));\n        buf.push_back(static_cast<char>(0x80 | ((c & 0xfff) >> 6)));\n        buf.push_back(static_cast<char>(0x80 | (c & 0x3f)));\n      } else if (c >= 0x10000 && c <= 0x10ffff) {\n        buf.push_back(static_cast<char>(0xf0 | (c >> 18)));\n        buf.push_back(static_cast<char>(0x80 | ((c & 0x3ffff) >> 12)));\n        buf.push_back(static_cast<char>(0x80 | ((c & 0xfff) >> 6)));\n        buf.push_back(static_cast<char>(0x80 | (c & 0x3f)));\n      } else {\n        return false;\n      }\n    }\n    return true;\n  }\n};\n\n// Computes 128-bit result of multiplication of two 64-bit unsigned integers.\ninline auto umul128(uint64_t x, uint64_t y) noexcept -> uint128_fallback {\n#if FMT_USE_INT128\n  auto p = static_cast<uint128_opt>(x) * static_cast<uint128_opt>(y);\n  return {static_cast<uint64_t>(p >> 64), static_cast<uint64_t>(p)};\n#elif defined(_MSC_VER) && defined(_M_X64)\n  auto hi = uint64_t();\n  auto lo = _umul128(x, y, &hi);\n  return {hi, lo};\n#else\n  const uint64_t mask = static_cast<uint64_t>(max_value<uint32_t>());\n\n  uint64_t a = x >> 32;\n  uint64_t b = x & mask;\n  uint64_t c = y >> 32;\n  uint64_t d = y & mask;\n\n  uint64_t ac = a * c;\n  uint64_t bc = b * c;\n  uint64_t ad = a * d;\n  uint64_t bd = b * d;\n\n  uint64_t intermediate = (bd >> 32) + (ad & mask) + (bc & mask);\n\n  return {ac + (intermediate >> 32) + (ad >> 32) + (bc >> 32),\n          (intermediate << 32) + (bd & mask)};\n#endif\n}\n\nnamespace dragonbox {\n// Computes floor(log10(pow(2, e))) for e in [-2620, 2620] using the method from\n// https://fmt.dev/papers/Dragonbox.pdf#page=28, section 6.1.\ninline auto floor_log10_pow2(int e) noexcept -> int {\n  FMT_ASSERT(e <= 2620 && e >= -2620, \"too large exponent\");\n  static_assert((-1 >> 1) == -1, \"right shift is not arithmetic\");\n  return (e * 315653) >> 20;\n}\n\ninline auto floor_log2_pow10(int e) noexcept -> int {\n  FMT_ASSERT(e <= 1233 && e >= -1233, \"too large exponent\");\n  return (e * 1741647) >> 19;\n}\n\n// Computes upper 64 bits of multiplication of two 64-bit unsigned integers.\ninline auto umul128_upper64(uint64_t x, uint64_t y) noexcept -> uint64_t {\n#if FMT_USE_INT128\n  auto p = static_cast<uint128_opt>(x) * static_cast<uint128_opt>(y);\n  return static_cast<uint64_t>(p >> 64);\n#elif defined(_MSC_VER) && defined(_M_X64)\n  return __umulh(x, y);\n#else\n  return umul128(x, y).high();\n#endif\n}\n\n// Computes upper 128 bits of multiplication of a 64-bit unsigned integer and a\n// 128-bit unsigned integer.\ninline auto umul192_upper128(uint64_t x, uint128_fallback y) noexcept\n    -> uint128_fallback {\n  uint128_fallback r = umul128(x, y.high());\n  r += umul128_upper64(x, y.low());\n  return r;\n}\n\nFMT_API auto get_cached_power(int k) noexcept -> uint128_fallback;\n\n// Type-specific information that Dragonbox uses.\ntemplate <typename T, typename Enable = void> struct float_info;\n\ntemplate <> struct float_info<float> {\n  using carrier_uint = uint32_t;\n  static const int exponent_bits = 8;\n  static const int kappa = 1;\n  static const int big_divisor = 100;\n  static const int small_divisor = 10;\n  static const int min_k = -31;\n  static const int max_k = 46;\n  static const int shorter_interval_tie_lower_threshold = -35;\n  static const int shorter_interval_tie_upper_threshold = -35;\n};\n\ntemplate <> struct float_info<double> {\n  using carrier_uint = uint64_t;\n  static const int exponent_bits = 11;\n  static const int kappa = 2;\n  static const int big_divisor = 1000;\n  static const int small_divisor = 100;\n  static const int min_k = -292;\n  static const int max_k = 341;\n  static const int shorter_interval_tie_lower_threshold = -77;\n  static const int shorter_interval_tie_upper_threshold = -77;\n};\n\n// An 80- or 128-bit floating point number.\ntemplate <typename T>\nstruct float_info<T, enable_if_t<std::numeric_limits<T>::digits == 64 ||\n                                 std::numeric_limits<T>::digits == 113 ||\n                                 is_float128<T>::value>> {\n  using carrier_uint = detail::uint128_t;\n  static const int exponent_bits = 15;\n};\n\n// A double-double floating point number.\ntemplate <typename T>\nstruct float_info<T, enable_if_t<is_double_double<T>::value>> {\n  using carrier_uint = detail::uint128_t;\n};\n\ntemplate <typename T> struct decimal_fp {\n  using significand_type = typename float_info<T>::carrier_uint;\n  significand_type significand;\n  int exponent;\n};\n\ntemplate <typename T> FMT_API auto to_decimal(T x) noexcept -> decimal_fp<T>;\n}  // namespace dragonbox\n\n// Returns true iff Float has the implicit bit which is not stored.\ntemplate <typename Float> constexpr auto has_implicit_bit() -> bool {\n  // An 80-bit FP number has a 64-bit significand an no implicit bit.\n  return std::numeric_limits<Float>::digits != 64;\n}\n\n// Returns the number of significand bits stored in Float. The implicit bit is\n// not counted since it is not stored.\ntemplate <typename Float> constexpr auto num_significand_bits() -> int {\n  // std::numeric_limits may not support __float128.\n  return is_float128<Float>() ? 112\n                              : (std::numeric_limits<Float>::digits -\n                                 (has_implicit_bit<Float>() ? 1 : 0));\n}\n\ntemplate <typename Float>\nconstexpr auto exponent_mask() ->\n    typename dragonbox::float_info<Float>::carrier_uint {\n  using float_uint = typename dragonbox::float_info<Float>::carrier_uint;\n  return ((float_uint(1) << dragonbox::float_info<Float>::exponent_bits) - 1)\n         << num_significand_bits<Float>();\n}\ntemplate <typename Float> constexpr auto exponent_bias() -> int {\n  // std::numeric_limits may not support __float128.\n  return is_float128<Float>() ? 16383\n                              : std::numeric_limits<Float>::max_exponent - 1;\n}\n\n// Writes the exponent exp in the form \"[+-]d{2,3}\" to buffer.\ntemplate <typename Char, typename It>\nFMT_CONSTEXPR auto write_exponent(int exp, It it) -> It {\n  FMT_ASSERT(-10000 < exp && exp < 10000, \"exponent out of range\");\n  if (exp < 0) {\n    *it++ = static_cast<Char>('-');\n    exp = -exp;\n  } else {\n    *it++ = static_cast<Char>('+');\n  }\n  if (exp >= 100) {\n    const char* top = digits2(to_unsigned(exp / 100));\n    if (exp >= 1000) *it++ = static_cast<Char>(top[0]);\n    *it++ = static_cast<Char>(top[1]);\n    exp %= 100;\n  }\n  const char* d = digits2(to_unsigned(exp));\n  *it++ = static_cast<Char>(d[0]);\n  *it++ = static_cast<Char>(d[1]);\n  return it;\n}\n\n// A floating-point number f * pow(2, e) where F is an unsigned type.\ntemplate <typename F> struct basic_fp {\n  F f;\n  int e;\n\n  static constexpr const int num_significand_bits =\n      static_cast<int>(sizeof(F) * num_bits<unsigned char>());\n\n  constexpr basic_fp() : f(0), e(0) {}\n  constexpr basic_fp(uint64_t f_val, int e_val) : f(f_val), e(e_val) {}\n\n  // Constructs fp from an IEEE754 floating-point number.\n  template <typename Float> FMT_CONSTEXPR basic_fp(Float n) { assign(n); }\n\n  // Assigns n to this and return true iff predecessor is closer than successor.\n  template <typename Float, FMT_ENABLE_IF(!is_double_double<Float>::value)>\n  FMT_CONSTEXPR auto assign(Float n) -> bool {\n    static_assert(std::numeric_limits<Float>::digits <= 113, \"unsupported FP\");\n    // Assume Float is in the format [sign][exponent][significand].\n    using carrier_uint = typename dragonbox::float_info<Float>::carrier_uint;\n    const auto num_float_significand_bits =\n        detail::num_significand_bits<Float>();\n    const auto implicit_bit = carrier_uint(1) << num_float_significand_bits;\n    const auto significand_mask = implicit_bit - 1;\n    auto u = bit_cast<carrier_uint>(n);\n    f = static_cast<F>(u & significand_mask);\n    auto biased_e = static_cast<int>((u & exponent_mask<Float>()) >>\n                                     num_float_significand_bits);\n    // The predecessor is closer if n is a normalized power of 2 (f == 0)\n    // other than the smallest normalized number (biased_e > 1).\n    auto is_predecessor_closer = f == 0 && biased_e > 1;\n    if (biased_e == 0)\n      biased_e = 1;  // Subnormals use biased exponent 1 (min exponent).\n    else if (has_implicit_bit<Float>())\n      f += static_cast<F>(implicit_bit);\n    e = biased_e - exponent_bias<Float>() - num_float_significand_bits;\n    if (!has_implicit_bit<Float>()) ++e;\n    return is_predecessor_closer;\n  }\n\n  template <typename Float, FMT_ENABLE_IF(is_double_double<Float>::value)>\n  FMT_CONSTEXPR auto assign(Float n) -> bool {\n    static_assert(std::numeric_limits<double>::is_iec559, \"unsupported FP\");\n    return assign(static_cast<double>(n));\n  }\n};\n\nusing fp = basic_fp<unsigned long long>;\n\n// Normalizes the value converted from double and multiplied by (1 << SHIFT).\ntemplate <int SHIFT = 0, typename F>\nFMT_CONSTEXPR auto normalize(basic_fp<F> value) -> basic_fp<F> {\n  // Handle subnormals.\n  const auto implicit_bit = F(1) << num_significand_bits<double>();\n  const auto shifted_implicit_bit = implicit_bit << SHIFT;\n  while ((value.f & shifted_implicit_bit) == 0) {\n    value.f <<= 1;\n    --value.e;\n  }\n  // Subtract 1 to account for hidden bit.\n  const auto offset = basic_fp<F>::num_significand_bits -\n                      num_significand_bits<double>() - SHIFT - 1;\n  value.f <<= offset;\n  value.e -= offset;\n  return value;\n}\n\n// Computes lhs * rhs / pow(2, 64) rounded to nearest with half-up tie breaking.\nFMT_CONSTEXPR inline auto multiply(uint64_t lhs, uint64_t rhs) -> uint64_t {\n#if FMT_USE_INT128\n  auto product = static_cast<__uint128_t>(lhs) * rhs;\n  auto f = static_cast<uint64_t>(product >> 64);\n  return (static_cast<uint64_t>(product) & (1ULL << 63)) != 0 ? f + 1 : f;\n#else\n  // Multiply 32-bit parts of significands.\n  uint64_t mask = (1ULL << 32) - 1;\n  uint64_t a = lhs >> 32, b = lhs & mask;\n  uint64_t c = rhs >> 32, d = rhs & mask;\n  uint64_t ac = a * c, bc = b * c, ad = a * d, bd = b * d;\n  // Compute mid 64-bit of result and round.\n  uint64_t mid = (bd >> 32) + (ad & mask) + (bc & mask) + (1U << 31);\n  return ac + (ad >> 32) + (bc >> 32) + (mid >> 32);\n#endif\n}\n\nFMT_CONSTEXPR inline auto operator*(fp x, fp y) -> fp {\n  return {multiply(x.f, y.f), x.e + y.e + 64};\n}\n\ntemplate <typename T, bool doublish = num_bits<T>() == num_bits<double>()>\nusing convert_float_result =\n    conditional_t<std::is_same<T, float>::value || doublish, double, T>;\n\ntemplate <typename T>\nconstexpr auto convert_float(T value) -> convert_float_result<T> {\n  return static_cast<convert_float_result<T>>(value);\n}\n\ntemplate <typename Char, typename OutputIt>\nFMT_NOINLINE FMT_CONSTEXPR auto fill(OutputIt it, size_t n, const fill_t& fill)\n    -> OutputIt {\n  auto fill_size = fill.size();\n  if (fill_size == 1) return detail::fill_n(it, n, fill.template get<Char>());\n  if (const Char* data = fill.template data<Char>()) {\n    for (size_t i = 0; i < n; ++i) it = copy<Char>(data, data + fill_size, it);\n  }\n  return it;\n}\n\n// Writes the output of f, padded according to format specifications in specs.\n// size: output size in code units.\n// width: output display width in (terminal) column positions.\ntemplate <typename Char, align::type align = align::left, typename OutputIt,\n          typename F>\nFMT_CONSTEXPR auto write_padded(OutputIt out, const format_specs& specs,\n                                size_t size, size_t width, F&& f) -> OutputIt {\n  static_assert(align == align::left || align == align::right, \"\");\n  unsigned spec_width = to_unsigned(specs.width);\n  size_t padding = spec_width > width ? spec_width - width : 0;\n  // Shifts are encoded as string literals because static constexpr is not\n  // supported in constexpr functions.\n  auto* shifts = align == align::left ? \"\\x1f\\x1f\\x00\\x01\" : \"\\x00\\x1f\\x00\\x01\";\n  size_t left_padding = padding >> shifts[specs.align];\n  size_t right_padding = padding - left_padding;\n  auto it = reserve(out, size + padding * specs.fill.size());\n  if (left_padding != 0) it = fill<Char>(it, left_padding, specs.fill);\n  it = f(it);\n  if (right_padding != 0) it = fill<Char>(it, right_padding, specs.fill);\n  return base_iterator(out, it);\n}\n\ntemplate <typename Char, align::type align = align::left, typename OutputIt,\n          typename F>\nconstexpr auto write_padded(OutputIt out, const format_specs& specs,\n                            size_t size, F&& f) -> OutputIt {\n  return write_padded<Char, align>(out, specs, size, size, f);\n}\n\ntemplate <typename Char, align::type align = align::left, typename OutputIt>\nFMT_CONSTEXPR auto write_bytes(OutputIt out, string_view bytes,\n                               const format_specs& specs = {}) -> OutputIt {\n  return write_padded<Char, align>(\n      out, specs, bytes.size(), [bytes](reserve_iterator<OutputIt> it) {\n        const char* data = bytes.data();\n        return copy<Char>(data, data + bytes.size(), it);\n      });\n}\n\ntemplate <typename Char, typename OutputIt, typename UIntPtr>\nauto write_ptr(OutputIt out, UIntPtr value, const format_specs* specs)\n    -> OutputIt {\n  int num_digits = count_digits<4>(value);\n  auto size = to_unsigned(num_digits) + size_t(2);\n  auto write = [=](reserve_iterator<OutputIt> it) {\n    *it++ = static_cast<Char>('0');\n    *it++ = static_cast<Char>('x');\n    return format_uint<4, Char>(it, value, num_digits);\n  };\n  return specs ? write_padded<Char, align::right>(out, *specs, size, write)\n               : base_iterator(out, write(reserve(out, size)));\n}\n\n// Returns true iff the code point cp is printable.\nFMT_API auto is_printable(uint32_t cp) -> bool;\n\ninline auto needs_escape(uint32_t cp) -> bool {\n  return cp < 0x20 || cp == 0x7f || cp == '\"' || cp == '\\\\' ||\n         !is_printable(cp);\n}\n\ntemplate <typename Char> struct find_escape_result {\n  const Char* begin;\n  const Char* end;\n  uint32_t cp;\n};\n\ntemplate <typename Char>\nauto find_escape(const Char* begin, const Char* end)\n    -> find_escape_result<Char> {\n  for (; begin != end; ++begin) {\n    uint32_t cp = static_cast<unsigned_char<Char>>(*begin);\n    if (const_check(sizeof(Char) == 1) && cp >= 0x80) continue;\n    if (needs_escape(cp)) return {begin, begin + 1, cp};\n  }\n  return {begin, nullptr, 0};\n}\n\ninline auto find_escape(const char* begin, const char* end)\n    -> find_escape_result<char> {\n  if (!use_utf8()) return find_escape<char>(begin, end);\n  auto result = find_escape_result<char>{end, nullptr, 0};\n  for_each_codepoint(string_view(begin, to_unsigned(end - begin)),\n                     [&](uint32_t cp, string_view sv) {\n                       if (needs_escape(cp)) {\n                         result = {sv.begin(), sv.end(), cp};\n                         return false;\n                       }\n                       return true;\n                     });\n  return result;\n}\n\n#define FMT_STRING_IMPL(s, base, explicit)                                    \\\n  [] {                                                                        \\\n    /* Use the hidden visibility as a workaround for a GCC bug (#1973). */    \\\n    /* Use a macro-like name to avoid shadowing warnings. */                  \\\n    struct FMT_VISIBILITY(\"hidden\") FMT_COMPILE_STRING : base {               \\\n      using char_type FMT_MAYBE_UNUSED = fmt::remove_cvref_t<decltype(s[0])>; \\\n      FMT_MAYBE_UNUSED FMT_CONSTEXPR explicit                                 \\\n      operator fmt::basic_string_view<char_type>() const {                    \\\n        return fmt::detail_exported::compile_string_to_view<char_type>(s);    \\\n      }                                                                       \\\n    };                                                                        \\\n    return FMT_COMPILE_STRING();                                              \\\n  }()\n\n/**\n * Constructs a compile-time format string from a string literal `s`.\n *\n * **Example**:\n *\n *     // A compile-time error because 'd' is an invalid specifier for strings.\n *     std::string s = fmt::format(FMT_STRING(\"{:d}\"), \"foo\");\n */\n#define FMT_STRING(s) FMT_STRING_IMPL(s, fmt::detail::compile_string, )\n\ntemplate <size_t width, typename Char, typename OutputIt>\nauto write_codepoint(OutputIt out, char prefix, uint32_t cp) -> OutputIt {\n  *out++ = static_cast<Char>('\\\\');\n  *out++ = static_cast<Char>(prefix);\n  Char buf[width];\n  fill_n(buf, width, static_cast<Char>('0'));\n  format_uint<4>(buf, cp, width);\n  return copy<Char>(buf, buf + width, out);\n}\n\ntemplate <typename OutputIt, typename Char>\nauto write_escaped_cp(OutputIt out, const find_escape_result<Char>& escape)\n    -> OutputIt {\n  auto c = static_cast<Char>(escape.cp);\n  switch (escape.cp) {\n  case '\\n':\n    *out++ = static_cast<Char>('\\\\');\n    c = static_cast<Char>('n');\n    break;\n  case '\\r':\n    *out++ = static_cast<Char>('\\\\');\n    c = static_cast<Char>('r');\n    break;\n  case '\\t':\n    *out++ = static_cast<Char>('\\\\');\n    c = static_cast<Char>('t');\n    break;\n  case '\"':\n    FMT_FALLTHROUGH;\n  case '\\'':\n    FMT_FALLTHROUGH;\n  case '\\\\':\n    *out++ = static_cast<Char>('\\\\');\n    break;\n  default:\n    if (escape.cp < 0x100) return write_codepoint<2, Char>(out, 'x', escape.cp);\n    if (escape.cp < 0x10000)\n      return write_codepoint<4, Char>(out, 'u', escape.cp);\n    if (escape.cp < 0x110000)\n      return write_codepoint<8, Char>(out, 'U', escape.cp);\n    for (Char escape_char : basic_string_view<Char>(\n             escape.begin, to_unsigned(escape.end - escape.begin))) {\n      out = write_codepoint<2, Char>(out, 'x',\n                                     static_cast<uint32_t>(escape_char) & 0xFF);\n    }\n    return out;\n  }\n  *out++ = c;\n  return out;\n}\n\ntemplate <typename Char, typename OutputIt>\nauto write_escaped_string(OutputIt out, basic_string_view<Char> str)\n    -> OutputIt {\n  *out++ = static_cast<Char>('\"');\n  auto begin = str.begin(), end = str.end();\n  do {\n    auto escape = find_escape(begin, end);\n    out = copy<Char>(begin, escape.begin, out);\n    begin = escape.end;\n    if (!begin) break;\n    out = write_escaped_cp<OutputIt, Char>(out, escape);\n  } while (begin != end);\n  *out++ = static_cast<Char>('\"');\n  return out;\n}\n\ntemplate <typename Char, typename OutputIt>\nauto write_escaped_char(OutputIt out, Char v) -> OutputIt {\n  Char v_array[1] = {v};\n  *out++ = static_cast<Char>('\\'');\n  if ((needs_escape(static_cast<uint32_t>(v)) && v != static_cast<Char>('\"')) ||\n      v == static_cast<Char>('\\'')) {\n    out = write_escaped_cp(out,\n                           find_escape_result<Char>{v_array, v_array + 1,\n                                                    static_cast<uint32_t>(v)});\n  } else {\n    *out++ = v;\n  }\n  *out++ = static_cast<Char>('\\'');\n  return out;\n}\n\ntemplate <typename Char, typename OutputIt>\nFMT_CONSTEXPR auto write_char(OutputIt out, Char value,\n                              const format_specs& specs) -> OutputIt {\n  bool is_debug = specs.type == presentation_type::debug;\n  return write_padded<Char>(out, specs, 1, [=](reserve_iterator<OutputIt> it) {\n    if (is_debug) return write_escaped_char(it, value);\n    *it++ = value;\n    return it;\n  });\n}\ntemplate <typename Char, typename OutputIt>\nFMT_CONSTEXPR auto write(OutputIt out, Char value, const format_specs& specs,\n                         locale_ref loc = {}) -> OutputIt {\n  // char is formatted as unsigned char for consistency across platforms.\n  using unsigned_type =\n      conditional_t<std::is_same<Char, char>::value, unsigned char, unsigned>;\n  return check_char_specs(specs)\n             ? write_char<Char>(out, value, specs)\n             : write<Char>(out, static_cast<unsigned_type>(value), specs, loc);\n}\n\n// Data for write_int that doesn't depend on output iterator type. It is used to\n// avoid template code bloat.\ntemplate <typename Char> struct write_int_data {\n  size_t size;\n  size_t padding;\n\n  FMT_CONSTEXPR write_int_data(int num_digits, unsigned prefix,\n                               const format_specs& specs)\n      : size((prefix >> 24) + to_unsigned(num_digits)), padding(0) {\n    if (specs.align == align::numeric) {\n      auto width = to_unsigned(specs.width);\n      if (width > size) {\n        padding = width - size;\n        size = width;\n      }\n    } else if (specs.precision > num_digits) {\n      size = (prefix >> 24) + to_unsigned(specs.precision);\n      padding = to_unsigned(specs.precision - num_digits);\n    }\n  }\n};\n\n// Writes an integer in the format\n//   <left-padding><prefix><numeric-padding><digits><right-padding>\n// where <digits> are written by write_digits(it).\n// prefix contains chars in three lower bytes and the size in the fourth byte.\ntemplate <typename Char, typename OutputIt, typename W>\nFMT_CONSTEXPR FMT_INLINE auto write_int(OutputIt out, int num_digits,\n                                        unsigned prefix,\n                                        const format_specs& specs,\n                                        W write_digits) -> OutputIt {\n  // Slightly faster check for specs.width == 0 && specs.precision == -1.\n  if ((specs.width | (specs.precision + 1)) == 0) {\n    auto it = reserve(out, to_unsigned(num_digits) + (prefix >> 24));\n    if (prefix != 0) {\n      for (unsigned p = prefix & 0xffffff; p != 0; p >>= 8)\n        *it++ = static_cast<Char>(p & 0xff);\n    }\n    return base_iterator(out, write_digits(it));\n  }\n  auto data = write_int_data<Char>(num_digits, prefix, specs);\n  return write_padded<Char, align::right>(\n      out, specs, data.size, [=](reserve_iterator<OutputIt> it) {\n        for (unsigned p = prefix & 0xffffff; p != 0; p >>= 8)\n          *it++ = static_cast<Char>(p & 0xff);\n        it = detail::fill_n(it, data.padding, static_cast<Char>('0'));\n        return write_digits(it);\n      });\n}\n\ntemplate <typename Char> class digit_grouping {\n private:\n  std::string grouping_;\n  std::basic_string<Char> thousands_sep_;\n\n  struct next_state {\n    std::string::const_iterator group;\n    int pos;\n  };\n  auto initial_state() const -> next_state { return {grouping_.begin(), 0}; }\n\n  // Returns the next digit group separator position.\n  auto next(next_state& state) const -> int {\n    if (thousands_sep_.empty()) return max_value<int>();\n    if (state.group == grouping_.end()) return state.pos += grouping_.back();\n    if (*state.group <= 0 || *state.group == max_value<char>())\n      return max_value<int>();\n    state.pos += *state.group++;\n    return state.pos;\n  }\n\n public:\n  explicit digit_grouping(locale_ref loc, bool localized = true) {\n    if (!localized) return;\n    auto sep = thousands_sep<Char>(loc);\n    grouping_ = sep.grouping;\n    if (sep.thousands_sep) thousands_sep_.assign(1, sep.thousands_sep);\n  }\n  digit_grouping(std::string grouping, std::basic_string<Char> sep)\n      : grouping_(std::move(grouping)), thousands_sep_(std::move(sep)) {}\n\n  auto has_separator() const -> bool { return !thousands_sep_.empty(); }\n\n  auto count_separators(int num_digits) const -> int {\n    int count = 0;\n    auto state = initial_state();\n    while (num_digits > next(state)) ++count;\n    return count;\n  }\n\n  // Applies grouping to digits and write the output to out.\n  template <typename Out, typename C>\n  auto apply(Out out, basic_string_view<C> digits) const -> Out {\n    auto num_digits = static_cast<int>(digits.size());\n    auto separators = basic_memory_buffer<int>();\n    separators.push_back(0);\n    auto state = initial_state();\n    while (int i = next(state)) {\n      if (i >= num_digits) break;\n      separators.push_back(i);\n    }\n    for (int i = 0, sep_index = static_cast<int>(separators.size() - 1);\n         i < num_digits; ++i) {\n      if (num_digits - i == separators[sep_index]) {\n        out = copy<Char>(thousands_sep_.data(),\n                         thousands_sep_.data() + thousands_sep_.size(), out);\n        --sep_index;\n      }\n      *out++ = static_cast<Char>(digits[to_unsigned(i)]);\n    }\n    return out;\n  }\n};\n\nFMT_CONSTEXPR inline void prefix_append(unsigned& prefix, unsigned value) {\n  prefix |= prefix != 0 ? value << 8 : value;\n  prefix += (1u + (value > 0xff ? 1 : 0)) << 24;\n}\n\n// Writes a decimal integer with digit grouping.\ntemplate <typename OutputIt, typename UInt, typename Char>\nauto write_int(OutputIt out, UInt value, unsigned prefix,\n               const format_specs& specs, const digit_grouping<Char>& grouping)\n    -> OutputIt {\n  static_assert(std::is_same<uint64_or_128_t<UInt>, UInt>::value, \"\");\n  int num_digits = 0;\n  auto buffer = memory_buffer();\n  switch (specs.type) {\n  default:\n    FMT_ASSERT(false, \"\");\n    FMT_FALLTHROUGH;\n  case presentation_type::none:\n  case presentation_type::dec:\n    num_digits = count_digits(value);\n    format_decimal<char>(appender(buffer), value, num_digits);\n    break;\n  case presentation_type::hex:\n    if (specs.alt)\n      prefix_append(prefix, unsigned(specs.upper ? 'X' : 'x') << 8 | '0');\n    num_digits = count_digits<4>(value);\n    format_uint<4, char>(appender(buffer), value, num_digits, specs.upper);\n    break;\n  case presentation_type::oct:\n    num_digits = count_digits<3>(value);\n    // Octal prefix '0' is counted as a digit, so only add it if precision\n    // is not greater than the number of digits.\n    if (specs.alt && specs.precision <= num_digits && value != 0)\n      prefix_append(prefix, '0');\n    format_uint<3, char>(appender(buffer), value, num_digits);\n    break;\n  case presentation_type::bin:\n    if (specs.alt)\n      prefix_append(prefix, unsigned(specs.upper ? 'B' : 'b') << 8 | '0');\n    num_digits = count_digits<1>(value);\n    format_uint<1, char>(appender(buffer), value, num_digits);\n    break;\n  case presentation_type::chr:\n    return write_char<Char>(out, static_cast<Char>(value), specs);\n  }\n\n  unsigned size = (prefix != 0 ? prefix >> 24 : 0) + to_unsigned(num_digits) +\n                  to_unsigned(grouping.count_separators(num_digits));\n  return write_padded<Char, align::right>(\n      out, specs, size, size, [&](reserve_iterator<OutputIt> it) {\n        for (unsigned p = prefix & 0xffffff; p != 0; p >>= 8)\n          *it++ = static_cast<Char>(p & 0xff);\n        return grouping.apply(it, string_view(buffer.data(), buffer.size()));\n      });\n}\n\n// Writes a localized value.\nFMT_API auto write_loc(appender out, loc_value value, const format_specs& specs,\n                       locale_ref loc) -> bool;\ntemplate <typename OutputIt>\ninline auto write_loc(OutputIt, loc_value, const format_specs&, locale_ref)\n    -> bool {\n  return false;\n}\n\ntemplate <typename UInt> struct write_int_arg {\n  UInt abs_value;\n  unsigned prefix;\n};\n\ntemplate <typename T>\nFMT_CONSTEXPR auto make_write_int_arg(T value, sign_t sign)\n    -> write_int_arg<uint32_or_64_or_128_t<T>> {\n  auto prefix = 0u;\n  auto abs_value = static_cast<uint32_or_64_or_128_t<T>>(value);\n  if (is_negative(value)) {\n    prefix = 0x01000000 | '-';\n    abs_value = 0 - abs_value;\n  } else {\n    constexpr const unsigned prefixes[4] = {0, 0, 0x1000000u | '+',\n                                            0x1000000u | ' '};\n    prefix = prefixes[sign];\n  }\n  return {abs_value, prefix};\n}\n\ntemplate <typename Char = char> struct loc_writer {\n  basic_appender<Char> out;\n  const format_specs& specs;\n  std::basic_string<Char> sep;\n  std::string grouping;\n  std::basic_string<Char> decimal_point;\n\n  template <typename T, FMT_ENABLE_IF(is_integer<T>::value)>\n  auto operator()(T value) -> bool {\n    auto arg = make_write_int_arg(value, specs.sign);\n    write_int(out, static_cast<uint64_or_128_t<T>>(arg.abs_value), arg.prefix,\n              specs, digit_grouping<Char>(grouping, sep));\n    return true;\n  }\n\n  template <typename T, FMT_ENABLE_IF(!is_integer<T>::value)>\n  auto operator()(T) -> bool {\n    return false;\n  }\n};\n\ntemplate <typename Char, typename OutputIt, typename T>\nFMT_CONSTEXPR FMT_INLINE auto write_int(OutputIt out, write_int_arg<T> arg,\n                                        const format_specs& specs, locale_ref)\n    -> OutputIt {\n  static_assert(std::is_same<T, uint32_or_64_or_128_t<T>>::value, \"\");\n  auto abs_value = arg.abs_value;\n  auto prefix = arg.prefix;\n  switch (specs.type) {\n  default:\n    FMT_ASSERT(false, \"\");\n    FMT_FALLTHROUGH;\n  case presentation_type::none:\n  case presentation_type::dec: {\n    int num_digits = count_digits(abs_value);\n    return write_int<Char>(\n        out, num_digits, prefix, specs, [=](reserve_iterator<OutputIt> it) {\n          return format_decimal<Char>(it, abs_value, num_digits).end;\n        });\n  }\n  case presentation_type::hex: {\n    if (specs.alt)\n      prefix_append(prefix, unsigned(specs.upper ? 'X' : 'x') << 8 | '0');\n    int num_digits = count_digits<4>(abs_value);\n    return write_int<Char>(\n        out, num_digits, prefix, specs, [=](reserve_iterator<OutputIt> it) {\n          return format_uint<4, Char>(it, abs_value, num_digits, specs.upper);\n        });\n  }\n  case presentation_type::oct: {\n    int num_digits = count_digits<3>(abs_value);\n    // Octal prefix '0' is counted as a digit, so only add it if precision\n    // is not greater than the number of digits.\n    if (specs.alt && specs.precision <= num_digits && abs_value != 0)\n      prefix_append(prefix, '0');\n    return write_int<Char>(\n        out, num_digits, prefix, specs, [=](reserve_iterator<OutputIt> it) {\n          return format_uint<3, Char>(it, abs_value, num_digits);\n        });\n  }\n  case presentation_type::bin: {\n    if (specs.alt)\n      prefix_append(prefix, unsigned(specs.upper ? 'B' : 'b') << 8 | '0');\n    int num_digits = count_digits<1>(abs_value);\n    return write_int<Char>(\n        out, num_digits, prefix, specs, [=](reserve_iterator<OutputIt> it) {\n          return format_uint<1, Char>(it, abs_value, num_digits);\n        });\n  }\n  case presentation_type::chr:\n    return write_char<Char>(out, static_cast<Char>(abs_value), specs);\n  }\n}\ntemplate <typename Char, typename OutputIt, typename T>\nFMT_CONSTEXPR FMT_NOINLINE auto write_int_noinline(OutputIt out,\n                                                   write_int_arg<T> arg,\n                                                   const format_specs& specs,\n                                                   locale_ref loc) -> OutputIt {\n  return write_int<Char>(out, arg, specs, loc);\n}\ntemplate <typename Char, typename T,\n          FMT_ENABLE_IF(is_integral<T>::value &&\n                        !std::is_same<T, bool>::value &&\n                        !std::is_same<T, Char>::value)>\nFMT_CONSTEXPR FMT_INLINE auto write(basic_appender<Char> out, T value,\n                                    const format_specs& specs, locale_ref loc)\n    -> basic_appender<Char> {\n  if (specs.localized && write_loc(out, value, specs, loc)) return out;\n  return write_int_noinline<Char>(out, make_write_int_arg(value, specs.sign),\n                                  specs, loc);\n}\n// An inlined version of write used in format string compilation.\ntemplate <typename Char, typename OutputIt, typename T,\n          FMT_ENABLE_IF(is_integral<T>::value &&\n                        !std::is_same<T, bool>::value &&\n                        !std::is_same<T, Char>::value &&\n                        !std::is_same<OutputIt, basic_appender<Char>>::value)>\nFMT_CONSTEXPR FMT_INLINE auto write(OutputIt out, T value,\n                                    const format_specs& specs, locale_ref loc)\n    -> OutputIt {\n  if (specs.localized && write_loc(out, value, specs, loc)) return out;\n  return write_int<Char>(out, make_write_int_arg(value, specs.sign), specs,\n                         loc);\n}\n\n// An output iterator that counts the number of objects written to it and\n// discards them.\nclass counting_iterator {\n private:\n  size_t count_;\n\n public:\n  using iterator_category = std::output_iterator_tag;\n  using difference_type = std::ptrdiff_t;\n  using pointer = void;\n  using reference = void;\n  FMT_UNCHECKED_ITERATOR(counting_iterator);\n\n  struct value_type {\n    template <typename T> FMT_CONSTEXPR void operator=(const T&) {}\n  };\n\n  FMT_CONSTEXPR counting_iterator() : count_(0) {}\n\n  FMT_CONSTEXPR auto count() const -> size_t { return count_; }\n\n  FMT_CONSTEXPR auto operator++() -> counting_iterator& {\n    ++count_;\n    return *this;\n  }\n  FMT_CONSTEXPR auto operator++(int) -> counting_iterator {\n    auto it = *this;\n    ++*this;\n    return it;\n  }\n\n  FMT_CONSTEXPR friend auto operator+(counting_iterator it, difference_type n)\n      -> counting_iterator {\n    it.count_ += static_cast<size_t>(n);\n    return it;\n  }\n\n  FMT_CONSTEXPR auto operator*() const -> value_type { return {}; }\n};\n\ntemplate <typename Char, typename OutputIt>\nFMT_CONSTEXPR auto write(OutputIt out, basic_string_view<Char> s,\n                         const format_specs& specs) -> OutputIt {\n  auto data = s.data();\n  auto size = s.size();\n  if (specs.precision >= 0 && to_unsigned(specs.precision) < size)\n    size = code_point_index(s, to_unsigned(specs.precision));\n  bool is_debug = specs.type == presentation_type::debug;\n  size_t width = 0;\n\n  if (is_debug) size = write_escaped_string(counting_iterator{}, s).count();\n\n  if (specs.width != 0) {\n    if (is_debug)\n      width = size;\n    else\n      width = compute_width(basic_string_view<Char>(data, size));\n  }\n  return write_padded<Char>(out, specs, size, width,\n                            [=](reserve_iterator<OutputIt> it) {\n                              if (is_debug) return write_escaped_string(it, s);\n                              return copy<Char>(data, data + size, it);\n                            });\n}\ntemplate <typename Char, typename OutputIt>\nFMT_CONSTEXPR auto write(OutputIt out,\n                         basic_string_view<type_identity_t<Char>> s,\n                         const format_specs& specs, locale_ref) -> OutputIt {\n  return write<Char>(out, s, specs);\n}\ntemplate <typename Char, typename OutputIt>\nFMT_CONSTEXPR auto write(OutputIt out, const Char* s, const format_specs& specs,\n                         locale_ref) -> OutputIt {\n  if (specs.type == presentation_type::pointer)\n    return write_ptr<Char>(out, bit_cast<uintptr_t>(s), &specs);\n  if (!s) report_error(\"string pointer is null\");\n  return write<Char>(out, basic_string_view<Char>(s), specs, {});\n}\n\ntemplate <typename Char, typename OutputIt, typename T,\n          FMT_ENABLE_IF(is_integral<T>::value &&\n                        !std::is_same<T, bool>::value &&\n                        !std::is_same<T, Char>::value)>\nFMT_CONSTEXPR auto write(OutputIt out, T value) -> OutputIt {\n  auto abs_value = static_cast<uint32_or_64_or_128_t<T>>(value);\n  bool negative = is_negative(value);\n  // Don't do -abs_value since it trips unsigned-integer-overflow sanitizer.\n  if (negative) abs_value = ~abs_value + 1;\n  int num_digits = count_digits(abs_value);\n  auto size = (negative ? 1 : 0) + static_cast<size_t>(num_digits);\n  if (auto ptr = to_pointer<Char>(out, size)) {\n    if (negative) *ptr++ = static_cast<Char>('-');\n    format_decimal<Char>(ptr, abs_value, num_digits);\n    return out;\n  }\n  if (negative) *out++ = static_cast<Char>('-');\n  return format_decimal<Char>(out, abs_value, num_digits).end;\n}\n\n// DEPRECATED!\ntemplate <typename Char>\nFMT_CONSTEXPR auto parse_align(const Char* begin, const Char* end,\n                               format_specs& specs) -> const Char* {\n  FMT_ASSERT(begin != end, \"\");\n  auto align = align::none;\n  auto p = begin + code_point_length(begin);\n  if (end - p <= 0) p = begin;\n  for (;;) {\n    switch (to_ascii(*p)) {\n    case '<':\n      align = align::left;\n      break;\n    case '>':\n      align = align::right;\n      break;\n    case '^':\n      align = align::center;\n      break;\n    }\n    if (align != align::none) {\n      if (p != begin) {\n        auto c = *begin;\n        if (c == '}') return begin;\n        if (c == '{') {\n          report_error(\"invalid fill character '{'\");\n          return begin;\n        }\n        specs.fill = basic_string_view<Char>(begin, to_unsigned(p - begin));\n        begin = p + 1;\n      } else {\n        ++begin;\n      }\n      break;\n    } else if (p == begin) {\n      break;\n    }\n    p = begin;\n  }\n  specs.align = align;\n  return begin;\n}\n\n// A floating-point presentation format.\nenum class float_format : unsigned char {\n  general,  // General: exponent notation or fixed point based on magnitude.\n  exp,      // Exponent notation with the default precision of 6, e.g. 1.2e-3.\n  fixed     // Fixed point with the default precision of 6, e.g. 0.0012.\n};\n\nstruct float_specs {\n  int precision;\n  float_format format : 8;\n  sign_t sign : 8;\n  bool locale : 1;\n  bool binary32 : 1;\n  bool showpoint : 1;\n};\n\n// DEPRECATED!\nFMT_CONSTEXPR inline auto parse_float_type_spec(const format_specs& specs)\n    -> float_specs {\n  auto result = float_specs();\n  result.showpoint = specs.alt;\n  result.locale = specs.localized;\n  switch (specs.type) {\n  default:\n    FMT_FALLTHROUGH;\n  case presentation_type::none:\n    result.format = float_format::general;\n    break;\n  case presentation_type::exp:\n    result.format = float_format::exp;\n    result.showpoint |= specs.precision != 0;\n    break;\n  case presentation_type::fixed:\n    result.format = float_format::fixed;\n    result.showpoint |= specs.precision != 0;\n    break;\n  case presentation_type::general:\n    result.format = float_format::general;\n    break;\n  }\n  return result;\n}\n\ntemplate <typename Char, typename OutputIt>\nFMT_CONSTEXPR20 auto write_nonfinite(OutputIt out, bool isnan,\n                                     format_specs specs, sign_t sign)\n    -> OutputIt {\n  auto str =\n      isnan ? (specs.upper ? \"NAN\" : \"nan\") : (specs.upper ? \"INF\" : \"inf\");\n  constexpr size_t str_size = 3;\n  auto size = str_size + (sign ? 1 : 0);\n  // Replace '0'-padding with space for non-finite values.\n  const bool is_zero_fill =\n      specs.fill.size() == 1 && specs.fill.template get<Char>() == '0';\n  if (is_zero_fill) specs.fill = ' ';\n  return write_padded<Char>(out, specs, size,\n                            [=](reserve_iterator<OutputIt> it) {\n                              if (sign) *it++ = detail::sign<Char>(sign);\n                              return copy<Char>(str, str + str_size, it);\n                            });\n}\n\n// A decimal floating-point number significand * pow(10, exp).\nstruct big_decimal_fp {\n  const char* significand;\n  int significand_size;\n  int exponent;\n};\n\nconstexpr auto get_significand_size(const big_decimal_fp& f) -> int {\n  return f.significand_size;\n}\ntemplate <typename T>\ninline auto get_significand_size(const dragonbox::decimal_fp<T>& f) -> int {\n  return count_digits(f.significand);\n}\n\ntemplate <typename Char, typename OutputIt>\nconstexpr auto write_significand(OutputIt out, const char* significand,\n                                 int significand_size) -> OutputIt {\n  return copy<Char>(significand, significand + significand_size, out);\n}\ntemplate <typename Char, typename OutputIt, typename UInt>\ninline auto write_significand(OutputIt out, UInt significand,\n                              int significand_size) -> OutputIt {\n  return format_decimal<Char>(out, significand, significand_size).end;\n}\ntemplate <typename Char, typename OutputIt, typename T, typename Grouping>\nFMT_CONSTEXPR20 auto write_significand(OutputIt out, T significand,\n                                       int significand_size, int exponent,\n                                       const Grouping& grouping) -> OutputIt {\n  if (!grouping.has_separator()) {\n    out = write_significand<Char>(out, significand, significand_size);\n    return detail::fill_n(out, exponent, static_cast<Char>('0'));\n  }\n  auto buffer = memory_buffer();\n  write_significand<char>(appender(buffer), significand, significand_size);\n  detail::fill_n(appender(buffer), exponent, '0');\n  return grouping.apply(out, string_view(buffer.data(), buffer.size()));\n}\n\ntemplate <typename Char, typename UInt,\n          FMT_ENABLE_IF(std::is_integral<UInt>::value)>\ninline auto write_significand(Char* out, UInt significand, int significand_size,\n                              int integral_size, Char decimal_point) -> Char* {\n  if (!decimal_point)\n    return format_decimal(out, significand, significand_size).end;\n  out += significand_size + 1;\n  Char* end = out;\n  int floating_size = significand_size - integral_size;\n  for (int i = floating_size / 2; i > 0; --i) {\n    out -= 2;\n    copy2(out, digits2(static_cast<std::size_t>(significand % 100)));\n    significand /= 100;\n  }\n  if (floating_size % 2 != 0) {\n    *--out = static_cast<Char>('0' + significand % 10);\n    significand /= 10;\n  }\n  *--out = decimal_point;\n  format_decimal(out - integral_size, significand, integral_size);\n  return end;\n}\n\ntemplate <typename OutputIt, typename UInt, typename Char,\n          FMT_ENABLE_IF(!std::is_pointer<remove_cvref_t<OutputIt>>::value)>\ninline auto write_significand(OutputIt out, UInt significand,\n                              int significand_size, int integral_size,\n                              Char decimal_point) -> OutputIt {\n  // Buffer is large enough to hold digits (digits10 + 1) and a decimal point.\n  Char buffer[digits10<UInt>() + 2];\n  auto end = write_significand(buffer, significand, significand_size,\n                               integral_size, decimal_point);\n  return detail::copy_noinline<Char>(buffer, end, out);\n}\n\ntemplate <typename OutputIt, typename Char>\nFMT_CONSTEXPR auto write_significand(OutputIt out, const char* significand,\n                                     int significand_size, int integral_size,\n                                     Char decimal_point) -> OutputIt {\n  out = detail::copy_noinline<Char>(significand, significand + integral_size,\n                                    out);\n  if (!decimal_point) return out;\n  *out++ = decimal_point;\n  return detail::copy_noinline<Char>(significand + integral_size,\n                                     significand + significand_size, out);\n}\n\ntemplate <typename OutputIt, typename Char, typename T, typename Grouping>\nFMT_CONSTEXPR20 auto write_significand(OutputIt out, T significand,\n                                       int significand_size, int integral_size,\n                                       Char decimal_point,\n                                       const Grouping& grouping) -> OutputIt {\n  if (!grouping.has_separator()) {\n    return write_significand(out, significand, significand_size, integral_size,\n                             decimal_point);\n  }\n  auto buffer = basic_memory_buffer<Char>();\n  write_significand(basic_appender<Char>(buffer), significand, significand_size,\n                    integral_size, decimal_point);\n  grouping.apply(\n      out, basic_string_view<Char>(buffer.data(), to_unsigned(integral_size)));\n  return detail::copy_noinline<Char>(buffer.data() + integral_size,\n                                     buffer.end(), out);\n}\n\ntemplate <typename Char, typename OutputIt, typename DecimalFP,\n          typename Grouping = digit_grouping<Char>>\nFMT_CONSTEXPR20 auto do_write_float(OutputIt out, const DecimalFP& f,\n                                    const format_specs& specs,\n                                    float_specs fspecs, locale_ref loc)\n    -> OutputIt {\n  auto significand = f.significand;\n  int significand_size = get_significand_size(f);\n  const Char zero = static_cast<Char>('0');\n  auto sign = fspecs.sign;\n  size_t size = to_unsigned(significand_size) + (sign ? 1 : 0);\n  using iterator = reserve_iterator<OutputIt>;\n\n  Char decimal_point =\n      fspecs.locale ? detail::decimal_point<Char>(loc) : static_cast<Char>('.');\n\n  int output_exp = f.exponent + significand_size - 1;\n  auto use_exp_format = [=]() {\n    if (fspecs.format == float_format::exp) return true;\n    if (fspecs.format != float_format::general) return false;\n    // Use the fixed notation if the exponent is in [exp_lower, exp_upper),\n    // e.g. 0.0001 instead of 1e-04. Otherwise use the exponent notation.\n    const int exp_lower = -4, exp_upper = 16;\n    return output_exp < exp_lower ||\n           output_exp >= (fspecs.precision > 0 ? fspecs.precision : exp_upper);\n  };\n  if (use_exp_format()) {\n    int num_zeros = 0;\n    if (fspecs.showpoint) {\n      num_zeros = fspecs.precision - significand_size;\n      if (num_zeros < 0) num_zeros = 0;\n      size += to_unsigned(num_zeros);\n    } else if (significand_size == 1) {\n      decimal_point = Char();\n    }\n    auto abs_output_exp = output_exp >= 0 ? output_exp : -output_exp;\n    int exp_digits = 2;\n    if (abs_output_exp >= 100) exp_digits = abs_output_exp >= 1000 ? 4 : 3;\n\n    size += to_unsigned((decimal_point ? 1 : 0) + 2 + exp_digits);\n    char exp_char = specs.upper ? 'E' : 'e';\n    auto write = [=](iterator it) {\n      if (sign) *it++ = detail::sign<Char>(sign);\n      // Insert a decimal point after the first digit and add an exponent.\n      it = write_significand(it, significand, significand_size, 1,\n                             decimal_point);\n      if (num_zeros > 0) it = detail::fill_n(it, num_zeros, zero);\n      *it++ = static_cast<Char>(exp_char);\n      return write_exponent<Char>(output_exp, it);\n    };\n    return specs.width > 0\n               ? write_padded<Char, align::right>(out, specs, size, write)\n               : base_iterator(out, write(reserve(out, size)));\n  }\n\n  int exp = f.exponent + significand_size;\n  if (f.exponent >= 0) {\n    // 1234e5 -> 123400000[.0+]\n    size += to_unsigned(f.exponent);\n    int num_zeros = fspecs.precision - exp;\n    abort_fuzzing_if(num_zeros > 5000);\n    if (fspecs.showpoint) {\n      ++size;\n      if (num_zeros <= 0 && fspecs.format != float_format::fixed) num_zeros = 0;\n      if (num_zeros > 0) size += to_unsigned(num_zeros);\n    }\n    auto grouping = Grouping(loc, fspecs.locale);\n    size += to_unsigned(grouping.count_separators(exp));\n    return write_padded<Char, align::right>(out, specs, size, [&](iterator it) {\n      if (sign) *it++ = detail::sign<Char>(sign);\n      it = write_significand<Char>(it, significand, significand_size,\n                                   f.exponent, grouping);\n      if (!fspecs.showpoint) return it;\n      *it++ = decimal_point;\n      return num_zeros > 0 ? detail::fill_n(it, num_zeros, zero) : it;\n    });\n  } else if (exp > 0) {\n    // 1234e-2 -> 12.34[0+]\n    int num_zeros = fspecs.showpoint ? fspecs.precision - significand_size : 0;\n    size += 1 + to_unsigned(num_zeros > 0 ? num_zeros : 0);\n    auto grouping = Grouping(loc, fspecs.locale);\n    size += to_unsigned(grouping.count_separators(exp));\n    return write_padded<Char, align::right>(out, specs, size, [&](iterator it) {\n      if (sign) *it++ = detail::sign<Char>(sign);\n      it = write_significand(it, significand, significand_size, exp,\n                             decimal_point, grouping);\n      return num_zeros > 0 ? detail::fill_n(it, num_zeros, zero) : it;\n    });\n  }\n  // 1234e-6 -> 0.001234\n  int num_zeros = -exp;\n  if (significand_size == 0 && fspecs.precision >= 0 &&\n      fspecs.precision < num_zeros) {\n    num_zeros = fspecs.precision;\n  }\n  bool pointy = num_zeros != 0 || significand_size != 0 || fspecs.showpoint;\n  size += 1 + (pointy ? 1 : 0) + to_unsigned(num_zeros);\n  return write_padded<Char, align::right>(out, specs, size, [&](iterator it) {\n    if (sign) *it++ = detail::sign<Char>(sign);\n    *it++ = zero;\n    if (!pointy) return it;\n    *it++ = decimal_point;\n    it = detail::fill_n(it, num_zeros, zero);\n    return write_significand<Char>(it, significand, significand_size);\n  });\n}\n\ntemplate <typename Char> class fallback_digit_grouping {\n public:\n  constexpr fallback_digit_grouping(locale_ref, bool) {}\n\n  constexpr auto has_separator() const -> bool { return false; }\n\n  constexpr auto count_separators(int) const -> int { return 0; }\n\n  template <typename Out, typename C>\n  constexpr auto apply(Out out, basic_string_view<C>) const -> Out {\n    return out;\n  }\n};\n\ntemplate <typename Char, typename OutputIt, typename DecimalFP>\nFMT_CONSTEXPR20 auto write_float(OutputIt out, const DecimalFP& f,\n                                 const format_specs& specs, float_specs fspecs,\n                                 locale_ref loc) -> OutputIt {\n  if (is_constant_evaluated()) {\n    return do_write_float<Char, OutputIt, DecimalFP,\n                          fallback_digit_grouping<Char>>(out, f, specs, fspecs,\n                                                         loc);\n  } else {\n    return do_write_float<Char>(out, f, specs, fspecs, loc);\n  }\n}\n\ntemplate <typename T> constexpr auto isnan(T value) -> bool {\n  return value != value;  // std::isnan doesn't support __float128.\n}\n\ntemplate <typename T, typename Enable = void>\nstruct has_isfinite : std::false_type {};\n\ntemplate <typename T>\nstruct has_isfinite<T, enable_if_t<sizeof(std::isfinite(T())) != 0>>\n    : std::true_type {};\n\ntemplate <typename T, FMT_ENABLE_IF(std::is_floating_point<T>::value&&\n                                        has_isfinite<T>::value)>\nFMT_CONSTEXPR20 auto isfinite(T value) -> bool {\n  constexpr T inf = T(std::numeric_limits<double>::infinity());\n  if (is_constant_evaluated())\n    return !detail::isnan(value) && value < inf && value > -inf;\n  return std::isfinite(value);\n}\ntemplate <typename T, FMT_ENABLE_IF(!has_isfinite<T>::value)>\nFMT_CONSTEXPR auto isfinite(T value) -> bool {\n  T inf = T(std::numeric_limits<double>::infinity());\n  // std::isfinite doesn't support __float128.\n  return !detail::isnan(value) && value < inf && value > -inf;\n}\n\ntemplate <typename T, FMT_ENABLE_IF(is_floating_point<T>::value)>\nFMT_INLINE FMT_CONSTEXPR bool signbit(T value) {\n  if (is_constant_evaluated()) {\n#ifdef __cpp_if_constexpr\n    if constexpr (std::numeric_limits<double>::is_iec559) {\n      auto bits = detail::bit_cast<uint64_t>(static_cast<double>(value));\n      return (bits >> (num_bits<uint64_t>() - 1)) != 0;\n    }\n#endif\n  }\n  return std::signbit(static_cast<double>(value));\n}\n\ninline FMT_CONSTEXPR20 void adjust_precision(int& precision, int exp10) {\n  // Adjust fixed precision by exponent because it is relative to decimal\n  // point.\n  if (exp10 > 0 && precision > max_value<int>() - exp10)\n    FMT_THROW(format_error(\"number is too big\"));\n  precision += exp10;\n}\n\nclass bigint {\n private:\n  // A bigint is stored as an array of bigits (big digits), with bigit at index\n  // 0 being the least significant one.\n  using bigit = uint32_t;\n  using double_bigit = uint64_t;\n  enum { bigits_capacity = 32 };\n  basic_memory_buffer<bigit, bigits_capacity> bigits_;\n  int exp_;\n\n  FMT_CONSTEXPR20 auto operator[](int index) const -> bigit {\n    return bigits_[to_unsigned(index)];\n  }\n  FMT_CONSTEXPR20 auto operator[](int index) -> bigit& {\n    return bigits_[to_unsigned(index)];\n  }\n\n  static constexpr const int bigit_bits = num_bits<bigit>();\n\n  friend struct formatter<bigint>;\n\n  FMT_CONSTEXPR20 void subtract_bigits(int index, bigit other, bigit& borrow) {\n    auto result = static_cast<double_bigit>((*this)[index]) - other - borrow;\n    (*this)[index] = static_cast<bigit>(result);\n    borrow = static_cast<bigit>(result >> (bigit_bits * 2 - 1));\n  }\n\n  FMT_CONSTEXPR20 void remove_leading_zeros() {\n    int num_bigits = static_cast<int>(bigits_.size()) - 1;\n    while (num_bigits > 0 && (*this)[num_bigits] == 0) --num_bigits;\n    bigits_.resize(to_unsigned(num_bigits + 1));\n  }\n\n  // Computes *this -= other assuming aligned bigints and *this >= other.\n  FMT_CONSTEXPR20 void subtract_aligned(const bigint& other) {\n    FMT_ASSERT(other.exp_ >= exp_, \"unaligned bigints\");\n    FMT_ASSERT(compare(*this, other) >= 0, \"\");\n    bigit borrow = 0;\n    int i = other.exp_ - exp_;\n    for (size_t j = 0, n = other.bigits_.size(); j != n; ++i, ++j)\n      subtract_bigits(i, other.bigits_[j], borrow);\n    while (borrow > 0) subtract_bigits(i, 0, borrow);\n    remove_leading_zeros();\n  }\n\n  FMT_CONSTEXPR20 void multiply(uint32_t value) {\n    const double_bigit wide_value = value;\n    bigit carry = 0;\n    for (size_t i = 0, n = bigits_.size(); i < n; ++i) {\n      double_bigit result = bigits_[i] * wide_value + carry;\n      bigits_[i] = static_cast<bigit>(result);\n      carry = static_cast<bigit>(result >> bigit_bits);\n    }\n    if (carry != 0) bigits_.push_back(carry);\n  }\n\n  template <typename UInt, FMT_ENABLE_IF(std::is_same<UInt, uint64_t>::value ||\n                                         std::is_same<UInt, uint128_t>::value)>\n  FMT_CONSTEXPR20 void multiply(UInt value) {\n    using half_uint =\n        conditional_t<std::is_same<UInt, uint128_t>::value, uint64_t, uint32_t>;\n    const int shift = num_bits<half_uint>() - bigit_bits;\n    const UInt lower = static_cast<half_uint>(value);\n    const UInt upper = value >> num_bits<half_uint>();\n    UInt carry = 0;\n    for (size_t i = 0, n = bigits_.size(); i < n; ++i) {\n      UInt result = lower * bigits_[i] + static_cast<bigit>(carry);\n      carry = (upper * bigits_[i] << shift) + (result >> bigit_bits) +\n              (carry >> bigit_bits);\n      bigits_[i] = static_cast<bigit>(result);\n    }\n    while (carry != 0) {\n      bigits_.push_back(static_cast<bigit>(carry));\n      carry >>= bigit_bits;\n    }\n  }\n\n  template <typename UInt, FMT_ENABLE_IF(std::is_same<UInt, uint64_t>::value ||\n                                         std::is_same<UInt, uint128_t>::value)>\n  FMT_CONSTEXPR20 void assign(UInt n) {\n    size_t num_bigits = 0;\n    do {\n      bigits_[num_bigits++] = static_cast<bigit>(n);\n      n >>= bigit_bits;\n    } while (n != 0);\n    bigits_.resize(num_bigits);\n    exp_ = 0;\n  }\n\n public:\n  FMT_CONSTEXPR20 bigint() : exp_(0) {}\n  explicit bigint(uint64_t n) { assign(n); }\n\n  bigint(const bigint&) = delete;\n  void operator=(const bigint&) = delete;\n\n  FMT_CONSTEXPR20 void assign(const bigint& other) {\n    auto size = other.bigits_.size();\n    bigits_.resize(size);\n    auto data = other.bigits_.data();\n    copy<bigit>(data, data + size, bigits_.data());\n    exp_ = other.exp_;\n  }\n\n  template <typename Int> FMT_CONSTEXPR20 void operator=(Int n) {\n    FMT_ASSERT(n > 0, \"\");\n    assign(uint64_or_128_t<Int>(n));\n  }\n\n  FMT_CONSTEXPR20 auto num_bigits() const -> int {\n    return static_cast<int>(bigits_.size()) + exp_;\n  }\n\n  FMT_NOINLINE FMT_CONSTEXPR20 auto operator<<=(int shift) -> bigint& {\n    FMT_ASSERT(shift >= 0, \"\");\n    exp_ += shift / bigit_bits;\n    shift %= bigit_bits;\n    if (shift == 0) return *this;\n    bigit carry = 0;\n    for (size_t i = 0, n = bigits_.size(); i < n; ++i) {\n      bigit c = bigits_[i] >> (bigit_bits - shift);\n      bigits_[i] = (bigits_[i] << shift) + carry;\n      carry = c;\n    }\n    if (carry != 0) bigits_.push_back(carry);\n    return *this;\n  }\n\n  template <typename Int>\n  FMT_CONSTEXPR20 auto operator*=(Int value) -> bigint& {\n    FMT_ASSERT(value > 0, \"\");\n    multiply(uint32_or_64_or_128_t<Int>(value));\n    return *this;\n  }\n\n  friend FMT_CONSTEXPR20 auto compare(const bigint& lhs, const bigint& rhs)\n      -> int {\n    int num_lhs_bigits = lhs.num_bigits(), num_rhs_bigits = rhs.num_bigits();\n    if (num_lhs_bigits != num_rhs_bigits)\n      return num_lhs_bigits > num_rhs_bigits ? 1 : -1;\n    int i = static_cast<int>(lhs.bigits_.size()) - 1;\n    int j = static_cast<int>(rhs.bigits_.size()) - 1;\n    int end = i - j;\n    if (end < 0) end = 0;\n    for (; i >= end; --i, --j) {\n      bigit lhs_bigit = lhs[i], rhs_bigit = rhs[j];\n      if (lhs_bigit != rhs_bigit) return lhs_bigit > rhs_bigit ? 1 : -1;\n    }\n    if (i != j) return i > j ? 1 : -1;\n    return 0;\n  }\n\n  // Returns compare(lhs1 + lhs2, rhs).\n  friend FMT_CONSTEXPR20 auto add_compare(const bigint& lhs1,\n                                          const bigint& lhs2, const bigint& rhs)\n      -> int {\n    auto minimum = [](int a, int b) { return a < b ? a : b; };\n    auto maximum = [](int a, int b) { return a > b ? a : b; };\n    int max_lhs_bigits = maximum(lhs1.num_bigits(), lhs2.num_bigits());\n    int num_rhs_bigits = rhs.num_bigits();\n    if (max_lhs_bigits + 1 < num_rhs_bigits) return -1;\n    if (max_lhs_bigits > num_rhs_bigits) return 1;\n    auto get_bigit = [](const bigint& n, int i) -> bigit {\n      return i >= n.exp_ && i < n.num_bigits() ? n[i - n.exp_] : 0;\n    };\n    double_bigit borrow = 0;\n    int min_exp = minimum(minimum(lhs1.exp_, lhs2.exp_), rhs.exp_);\n    for (int i = num_rhs_bigits - 1; i >= min_exp; --i) {\n      double_bigit sum =\n          static_cast<double_bigit>(get_bigit(lhs1, i)) + get_bigit(lhs2, i);\n      bigit rhs_bigit = get_bigit(rhs, i);\n      if (sum > rhs_bigit + borrow) return 1;\n      borrow = rhs_bigit + borrow - sum;\n      if (borrow > 1) return -1;\n      borrow <<= bigit_bits;\n    }\n    return borrow != 0 ? -1 : 0;\n  }\n\n  // Assigns pow(10, exp) to this bigint.\n  FMT_CONSTEXPR20 void assign_pow10(int exp) {\n    FMT_ASSERT(exp >= 0, \"\");\n    if (exp == 0) return *this = 1;\n    // Find the top bit.\n    int bitmask = 1;\n    while (exp >= bitmask) bitmask <<= 1;\n    bitmask >>= 1;\n    // pow(10, exp) = pow(5, exp) * pow(2, exp). First compute pow(5, exp) by\n    // repeated squaring and multiplication.\n    *this = 5;\n    bitmask >>= 1;\n    while (bitmask != 0) {\n      square();\n      if ((exp & bitmask) != 0) *this *= 5;\n      bitmask >>= 1;\n    }\n    *this <<= exp;  // Multiply by pow(2, exp) by shifting.\n  }\n\n  FMT_CONSTEXPR20 void square() {\n    int num_bigits = static_cast<int>(bigits_.size());\n    int num_result_bigits = 2 * num_bigits;\n    basic_memory_buffer<bigit, bigits_capacity> n(std::move(bigits_));\n    bigits_.resize(to_unsigned(num_result_bigits));\n    auto sum = uint128_t();\n    for (int bigit_index = 0; bigit_index < num_bigits; ++bigit_index) {\n      // Compute bigit at position bigit_index of the result by adding\n      // cross-product terms n[i] * n[j] such that i + j == bigit_index.\n      for (int i = 0, j = bigit_index; j >= 0; ++i, --j) {\n        // Most terms are multiplied twice which can be optimized in the future.\n        sum += static_cast<double_bigit>(n[i]) * n[j];\n      }\n      (*this)[bigit_index] = static_cast<bigit>(sum);\n      sum >>= num_bits<bigit>();  // Compute the carry.\n    }\n    // Do the same for the top half.\n    for (int bigit_index = num_bigits; bigit_index < num_result_bigits;\n         ++bigit_index) {\n      for (int j = num_bigits - 1, i = bigit_index - j; i < num_bigits;)\n        sum += static_cast<double_bigit>(n[i++]) * n[j--];\n      (*this)[bigit_index] = static_cast<bigit>(sum);\n      sum >>= num_bits<bigit>();\n    }\n    remove_leading_zeros();\n    exp_ *= 2;\n  }\n\n  // If this bigint has a bigger exponent than other, adds trailing zero to make\n  // exponents equal. This simplifies some operations such as subtraction.\n  FMT_CONSTEXPR20 void align(const bigint& other) {\n    int exp_difference = exp_ - other.exp_;\n    if (exp_difference <= 0) return;\n    int num_bigits = static_cast<int>(bigits_.size());\n    bigits_.resize(to_unsigned(num_bigits + exp_difference));\n    for (int i = num_bigits - 1, j = i + exp_difference; i >= 0; --i, --j)\n      bigits_[j] = bigits_[i];\n    memset(bigits_.data(), 0, to_unsigned(exp_difference) * sizeof(bigit));\n    exp_ -= exp_difference;\n  }\n\n  // Divides this bignum by divisor, assigning the remainder to this and\n  // returning the quotient.\n  FMT_CONSTEXPR20 auto divmod_assign(const bigint& divisor) -> int {\n    FMT_ASSERT(this != &divisor, \"\");\n    if (compare(*this, divisor) < 0) return 0;\n    FMT_ASSERT(divisor.bigits_[divisor.bigits_.size() - 1u] != 0, \"\");\n    align(divisor);\n    int quotient = 0;\n    do {\n      subtract_aligned(divisor);\n      ++quotient;\n    } while (compare(*this, divisor) >= 0);\n    return quotient;\n  }\n};\n\n// format_dragon flags.\nenum dragon {\n  predecessor_closer = 1,\n  fixup = 2,  // Run fixup to correct exp10 which can be off by one.\n  fixed = 4,\n};\n\n// Formats a floating-point number using a variation of the Fixed-Precision\n// Positive Floating-Point Printout ((FPP)^2) algorithm by Steele & White:\n// https://fmt.dev/papers/p372-steele.pdf.\nFMT_CONSTEXPR20 inline void format_dragon(basic_fp<uint128_t> value,\n                                          unsigned flags, int num_digits,\n                                          buffer<char>& buf, int& exp10) {\n  bigint numerator;    // 2 * R in (FPP)^2.\n  bigint denominator;  // 2 * S in (FPP)^2.\n  // lower and upper are differences between value and corresponding boundaries.\n  bigint lower;             // (M^- in (FPP)^2).\n  bigint upper_store;       // upper's value if different from lower.\n  bigint* upper = nullptr;  // (M^+ in (FPP)^2).\n  // Shift numerator and denominator by an extra bit or two (if lower boundary\n  // is closer) to make lower and upper integers. This eliminates multiplication\n  // by 2 during later computations.\n  bool is_predecessor_closer = (flags & dragon::predecessor_closer) != 0;\n  int shift = is_predecessor_closer ? 2 : 1;\n  if (value.e >= 0) {\n    numerator = value.f;\n    numerator <<= value.e + shift;\n    lower = 1;\n    lower <<= value.e;\n    if (is_predecessor_closer) {\n      upper_store = 1;\n      upper_store <<= value.e + 1;\n      upper = &upper_store;\n    }\n    denominator.assign_pow10(exp10);\n    denominator <<= shift;\n  } else if (exp10 < 0) {\n    numerator.assign_pow10(-exp10);\n    lower.assign(numerator);\n    if (is_predecessor_closer) {\n      upper_store.assign(numerator);\n      upper_store <<= 1;\n      upper = &upper_store;\n    }\n    numerator *= value.f;\n    numerator <<= shift;\n    denominator = 1;\n    denominator <<= shift - value.e;\n  } else {\n    numerator = value.f;\n    numerator <<= shift;\n    denominator.assign_pow10(exp10);\n    denominator <<= shift - value.e;\n    lower = 1;\n    if (is_predecessor_closer) {\n      upper_store = 1ULL << 1;\n      upper = &upper_store;\n    }\n  }\n  int even = static_cast<int>((value.f & 1) == 0);\n  if (!upper) upper = &lower;\n  bool shortest = num_digits < 0;\n  if ((flags & dragon::fixup) != 0) {\n    if (add_compare(numerator, *upper, denominator) + even <= 0) {\n      --exp10;\n      numerator *= 10;\n      if (num_digits < 0) {\n        lower *= 10;\n        if (upper != &lower) *upper *= 10;\n      }\n    }\n    if ((flags & dragon::fixed) != 0) adjust_precision(num_digits, exp10 + 1);\n  }\n  // Invariant: value == (numerator / denominator) * pow(10, exp10).\n  if (shortest) {\n    // Generate the shortest representation.\n    num_digits = 0;\n    char* data = buf.data();\n    for (;;) {\n      int digit = numerator.divmod_assign(denominator);\n      bool low = compare(numerator, lower) - even < 0;  // numerator <[=] lower.\n      // numerator + upper >[=] pow10:\n      bool high = add_compare(numerator, *upper, denominator) + even > 0;\n      data[num_digits++] = static_cast<char>('0' + digit);\n      if (low || high) {\n        if (!low) {\n          ++data[num_digits - 1];\n        } else if (high) {\n          int result = add_compare(numerator, numerator, denominator);\n          // Round half to even.\n          if (result > 0 || (result == 0 && (digit % 2) != 0))\n            ++data[num_digits - 1];\n        }\n        buf.try_resize(to_unsigned(num_digits));\n        exp10 -= num_digits - 1;\n        return;\n      }\n      numerator *= 10;\n      lower *= 10;\n      if (upper != &lower) *upper *= 10;\n    }\n  }\n  // Generate the given number of digits.\n  exp10 -= num_digits - 1;\n  if (num_digits <= 0) {\n    auto digit = '0';\n    if (num_digits == 0) {\n      denominator *= 10;\n      digit = add_compare(numerator, numerator, denominator) > 0 ? '1' : '0';\n    }\n    buf.push_back(digit);\n    return;\n  }\n  buf.try_resize(to_unsigned(num_digits));\n  for (int i = 0; i < num_digits - 1; ++i) {\n    int digit = numerator.divmod_assign(denominator);\n    buf[i] = static_cast<char>('0' + digit);\n    numerator *= 10;\n  }\n  int digit = numerator.divmod_assign(denominator);\n  auto result = add_compare(numerator, numerator, denominator);\n  if (result > 0 || (result == 0 && (digit % 2) != 0)) {\n    if (digit == 9) {\n      const auto overflow = '0' + 10;\n      buf[num_digits - 1] = overflow;\n      // Propagate the carry.\n      for (int i = num_digits - 1; i > 0 && buf[i] == overflow; --i) {\n        buf[i] = '0';\n        ++buf[i - 1];\n      }\n      if (buf[0] == overflow) {\n        buf[0] = '1';\n        if ((flags & dragon::fixed) != 0)\n          buf.push_back('0');\n        else\n          ++exp10;\n      }\n      return;\n    }\n    ++digit;\n  }\n  buf[num_digits - 1] = static_cast<char>('0' + digit);\n}\n\n// Formats a floating-point number using the hexfloat format.\ntemplate <typename Float, FMT_ENABLE_IF(!is_double_double<Float>::value)>\nFMT_CONSTEXPR20 void format_hexfloat(Float value, format_specs specs,\n                                     buffer<char>& buf) {\n  // float is passed as double to reduce the number of instantiations and to\n  // simplify implementation.\n  static_assert(!std::is_same<Float, float>::value, \"\");\n\n  using info = dragonbox::float_info<Float>;\n\n  // Assume Float is in the format [sign][exponent][significand].\n  using carrier_uint = typename info::carrier_uint;\n\n  constexpr auto num_float_significand_bits =\n      detail::num_significand_bits<Float>();\n\n  basic_fp<carrier_uint> f(value);\n  f.e += num_float_significand_bits;\n  if (!has_implicit_bit<Float>()) --f.e;\n\n  constexpr auto num_fraction_bits =\n      num_float_significand_bits + (has_implicit_bit<Float>() ? 1 : 0);\n  constexpr auto num_xdigits = (num_fraction_bits + 3) / 4;\n\n  constexpr auto leading_shift = ((num_xdigits - 1) * 4);\n  const auto leading_mask = carrier_uint(0xF) << leading_shift;\n  const auto leading_xdigit =\n      static_cast<uint32_t>((f.f & leading_mask) >> leading_shift);\n  if (leading_xdigit > 1) f.e -= (32 - countl_zero(leading_xdigit) - 1);\n\n  int print_xdigits = num_xdigits - 1;\n  if (specs.precision >= 0 && print_xdigits > specs.precision) {\n    const int shift = ((print_xdigits - specs.precision - 1) * 4);\n    const auto mask = carrier_uint(0xF) << shift;\n    const auto v = static_cast<uint32_t>((f.f & mask) >> shift);\n\n    if (v >= 8) {\n      const auto inc = carrier_uint(1) << (shift + 4);\n      f.f += inc;\n      f.f &= ~(inc - 1);\n    }\n\n    // Check long double overflow\n    if (!has_implicit_bit<Float>()) {\n      const auto implicit_bit = carrier_uint(1) << num_float_significand_bits;\n      if ((f.f & implicit_bit) == implicit_bit) {\n        f.f >>= 4;\n        f.e += 4;\n      }\n    }\n\n    print_xdigits = specs.precision;\n  }\n\n  char xdigits[num_bits<carrier_uint>() / 4];\n  detail::fill_n(xdigits, sizeof(xdigits), '0');\n  format_uint<4>(xdigits, f.f, num_xdigits, specs.upper);\n\n  // Remove zero tail\n  while (print_xdigits > 0 && xdigits[print_xdigits] == '0') --print_xdigits;\n\n  buf.push_back('0');\n  buf.push_back(specs.upper ? 'X' : 'x');\n  buf.push_back(xdigits[0]);\n  if (specs.alt || print_xdigits > 0 || print_xdigits < specs.precision)\n    buf.push_back('.');\n  buf.append(xdigits + 1, xdigits + 1 + print_xdigits);\n  for (; print_xdigits < specs.precision; ++print_xdigits) buf.push_back('0');\n\n  buf.push_back(specs.upper ? 'P' : 'p');\n\n  uint32_t abs_e;\n  if (f.e < 0) {\n    buf.push_back('-');\n    abs_e = static_cast<uint32_t>(-f.e);\n  } else {\n    buf.push_back('+');\n    abs_e = static_cast<uint32_t>(f.e);\n  }\n  format_decimal<char>(appender(buf), abs_e, detail::count_digits(abs_e));\n}\n\ntemplate <typename Float, FMT_ENABLE_IF(is_double_double<Float>::value)>\nFMT_CONSTEXPR20 void format_hexfloat(Float value, format_specs specs,\n                                     buffer<char>& buf) {\n  format_hexfloat(static_cast<double>(value), specs, buf);\n}\n\nconstexpr auto fractional_part_rounding_thresholds(int index) -> uint32_t {\n  // For checking rounding thresholds.\n  // The kth entry is chosen to be the smallest integer such that the\n  // upper 32-bits of 10^(k+1) times it is strictly bigger than 5 * 10^k.\n  // It is equal to ceil(2^31 + 2^32/10^(k + 1)).\n  // These are stored in a string literal because we cannot have static arrays\n  // in constexpr functions and non-static ones are poorly optimized.\n  return U\"\\x9999999a\\x828f5c29\\x80418938\\x80068db9\\x8000a7c6\\x800010c7\"\n         U\"\\x800001ae\\x8000002b\"[index];\n}\n\ntemplate <typename Float>\nFMT_CONSTEXPR20 auto format_float(Float value, int precision, float_specs specs,\n                                  buffer<char>& buf) -> int {\n  // float is passed as double to reduce the number of instantiations.\n  static_assert(!std::is_same<Float, float>::value, \"\");\n  FMT_ASSERT(value >= 0, \"value is negative\");\n  auto converted_value = convert_float(value);\n\n  const bool fixed = specs.format == float_format::fixed;\n  if (value <= 0) {  // <= instead of == to silence a warning.\n    if (precision <= 0 || !fixed) {\n      buf.push_back('0');\n      return 0;\n    }\n    buf.try_resize(to_unsigned(precision));\n    fill_n(buf.data(), precision, '0');\n    return -precision;\n  }\n\n  int exp = 0;\n  bool use_dragon = true;\n  unsigned dragon_flags = 0;\n  if (!is_fast_float<Float>() || is_constant_evaluated()) {\n    const auto inv_log2_10 = 0.3010299956639812;  // 1 / log2(10)\n    using info = dragonbox::float_info<decltype(converted_value)>;\n    const auto f = basic_fp<typename info::carrier_uint>(converted_value);\n    // Compute exp, an approximate power of 10, such that\n    //   10^(exp - 1) <= value < 10^exp or 10^exp <= value < 10^(exp + 1).\n    // This is based on log10(value) == log2(value) / log2(10) and approximation\n    // of log2(value) by e + num_fraction_bits idea from double-conversion.\n    auto e = (f.e + count_digits<1>(f.f) - 1) * inv_log2_10 - 1e-10;\n    exp = static_cast<int>(e);\n    if (e > exp) ++exp;  // Compute ceil.\n    dragon_flags = dragon::fixup;\n  } else if (precision < 0) {\n    // Use Dragonbox for the shortest format.\n    if (specs.binary32) {\n      auto dec = dragonbox::to_decimal(static_cast<float>(value));\n      write<char>(appender(buf), dec.significand);\n      return dec.exponent;\n    }\n    auto dec = dragonbox::to_decimal(static_cast<double>(value));\n    write<char>(appender(buf), dec.significand);\n    return dec.exponent;\n  } else {\n    // Extract significand bits and exponent bits.\n    using info = dragonbox::float_info<double>;\n    auto br = bit_cast<uint64_t>(static_cast<double>(value));\n\n    const uint64_t significand_mask =\n        (static_cast<uint64_t>(1) << num_significand_bits<double>()) - 1;\n    uint64_t significand = (br & significand_mask);\n    int exponent = static_cast<int>((br & exponent_mask<double>()) >>\n                                    num_significand_bits<double>());\n\n    if (exponent != 0) {  // Check if normal.\n      exponent -= exponent_bias<double>() + num_significand_bits<double>();\n      significand |=\n          (static_cast<uint64_t>(1) << num_significand_bits<double>());\n      significand <<= 1;\n    } else {\n      // Normalize subnormal inputs.\n      FMT_ASSERT(significand != 0, \"zeros should not appear here\");\n      int shift = countl_zero(significand);\n      FMT_ASSERT(shift >= num_bits<uint64_t>() - num_significand_bits<double>(),\n                 \"\");\n      shift -= (num_bits<uint64_t>() - num_significand_bits<double>() - 2);\n      exponent = (std::numeric_limits<double>::min_exponent -\n                  num_significand_bits<double>()) -\n                 shift;\n      significand <<= shift;\n    }\n\n    // Compute the first several nonzero decimal significand digits.\n    // We call the number we get the first segment.\n    const int k = info::kappa - dragonbox::floor_log10_pow2(exponent);\n    exp = -k;\n    const int beta = exponent + dragonbox::floor_log2_pow10(k);\n    uint64_t first_segment;\n    bool has_more_segments;\n    int digits_in_the_first_segment;\n    {\n      const auto r = dragonbox::umul192_upper128(\n          significand << beta, dragonbox::get_cached_power(k));\n      first_segment = r.high();\n      has_more_segments = r.low() != 0;\n\n      // The first segment can have 18 ~ 19 digits.\n      if (first_segment >= 1000000000000000000ULL) {\n        digits_in_the_first_segment = 19;\n      } else {\n        // When it is of 18-digits, we align it to 19-digits by adding a bogus\n        // zero at the end.\n        digits_in_the_first_segment = 18;\n        first_segment *= 10;\n      }\n    }\n\n    // Compute the actual number of decimal digits to print.\n    if (fixed) adjust_precision(precision, exp + digits_in_the_first_segment);\n\n    // Use Dragon4 only when there might be not enough digits in the first\n    // segment.\n    if (digits_in_the_first_segment > precision) {\n      use_dragon = false;\n\n      if (precision <= 0) {\n        exp += digits_in_the_first_segment;\n\n        if (precision < 0) {\n          // Nothing to do, since all we have are just leading zeros.\n          buf.try_resize(0);\n        } else {\n          // We may need to round-up.\n          buf.try_resize(1);\n          if ((first_segment | static_cast<uint64_t>(has_more_segments)) >\n              5000000000000000000ULL) {\n            buf[0] = '1';\n          } else {\n            buf[0] = '0';\n          }\n        }\n      }  // precision <= 0\n      else {\n        exp += digits_in_the_first_segment - precision;\n\n        // When precision > 0, we divide the first segment into three\n        // subsegments, each with 9, 9, and 0 ~ 1 digits so that each fits\n        // in 32-bits which usually allows faster calculation than in\n        // 64-bits. Since some compiler (e.g. MSVC) doesn't know how to optimize\n        // division-by-constant for large 64-bit divisors, we do it here\n        // manually. The magic number 7922816251426433760 below is equal to\n        // ceil(2^(64+32) / 10^10).\n        const uint32_t first_subsegment = static_cast<uint32_t>(\n            dragonbox::umul128_upper64(first_segment, 7922816251426433760ULL) >>\n            32);\n        const uint64_t second_third_subsegments =\n            first_segment - first_subsegment * 10000000000ULL;\n\n        uint64_t prod;\n        uint32_t digits;\n        bool should_round_up;\n        int number_of_digits_to_print = precision > 9 ? 9 : precision;\n\n        // Print a 9-digits subsegment, either the first or the second.\n        auto print_subsegment = [&](uint32_t subsegment, char* buffer) {\n          int number_of_digits_printed = 0;\n\n          // If we want to print an odd number of digits from the subsegment,\n          if ((number_of_digits_to_print & 1) != 0) {\n            // Convert to 64-bit fixed-point fractional form with 1-digit\n            // integer part. The magic number 720575941 is a good enough\n            // approximation of 2^(32 + 24) / 10^8; see\n            // https://jk-jeon.github.io/posts/2022/12/fixed-precision-formatting/#fixed-length-case\n            // for details.\n            prod = ((subsegment * static_cast<uint64_t>(720575941)) >> 24) + 1;\n            digits = static_cast<uint32_t>(prod >> 32);\n            *buffer = static_cast<char>('0' + digits);\n            number_of_digits_printed++;\n          }\n          // If we want to print an even number of digits from the\n          // first_subsegment,\n          else {\n            // Convert to 64-bit fixed-point fractional form with 2-digits\n            // integer part. The magic number 450359963 is a good enough\n            // approximation of 2^(32 + 20) / 10^7; see\n            // https://jk-jeon.github.io/posts/2022/12/fixed-precision-formatting/#fixed-length-case\n            // for details.\n            prod = ((subsegment * static_cast<uint64_t>(450359963)) >> 20) + 1;\n            digits = static_cast<uint32_t>(prod >> 32);\n            copy2(buffer, digits2(digits));\n            number_of_digits_printed += 2;\n          }\n\n          // Print all digit pairs.\n          while (number_of_digits_printed < number_of_digits_to_print) {\n            prod = static_cast<uint32_t>(prod) * static_cast<uint64_t>(100);\n            digits = static_cast<uint32_t>(prod >> 32);\n            copy2(buffer + number_of_digits_printed, digits2(digits));\n            number_of_digits_printed += 2;\n          }\n        };\n\n        // Print first subsegment.\n        print_subsegment(first_subsegment, buf.data());\n\n        // Perform rounding if the first subsegment is the last subsegment to\n        // print.\n        if (precision <= 9) {\n          // Rounding inside the subsegment.\n          // We round-up if:\n          //  - either the fractional part is strictly larger than 1/2, or\n          //  - the fractional part is exactly 1/2 and the last digit is odd.\n          // We rely on the following observations:\n          //  - If fractional_part >= threshold, then the fractional part is\n          //    strictly larger than 1/2.\n          //  - If the MSB of fractional_part is set, then the fractional part\n          //    must be at least 1/2.\n          //  - When the MSB of fractional_part is set, either\n          //    second_third_subsegments being nonzero or has_more_segments\n          //    being true means there are further digits not printed, so the\n          //    fractional part is strictly larger than 1/2.\n          if (precision < 9) {\n            uint32_t fractional_part = static_cast<uint32_t>(prod);\n            should_round_up =\n                fractional_part >= fractional_part_rounding_thresholds(\n                                       8 - number_of_digits_to_print) ||\n                ((fractional_part >> 31) &\n                 ((digits & 1) | (second_third_subsegments != 0) |\n                  has_more_segments)) != 0;\n          }\n          // Rounding at the subsegment boundary.\n          // In this case, the fractional part is at least 1/2 if and only if\n          // second_third_subsegments >= 5000000000ULL, and is strictly larger\n          // than 1/2 if we further have either second_third_subsegments >\n          // 5000000000ULL or has_more_segments == true.\n          else {\n            should_round_up = second_third_subsegments > 5000000000ULL ||\n                              (second_third_subsegments == 5000000000ULL &&\n                               ((digits & 1) != 0 || has_more_segments));\n          }\n        }\n        // Otherwise, print the second subsegment.\n        else {\n          // Compilers are not aware of how to leverage the maximum value of\n          // second_third_subsegments to find out a better magic number which\n          // allows us to eliminate an additional shift. 1844674407370955162 =\n          // ceil(2^64/10) < ceil(2^64*(10^9/(10^10 - 1))).\n          const uint32_t second_subsegment =\n              static_cast<uint32_t>(dragonbox::umul128_upper64(\n                  second_third_subsegments, 1844674407370955162ULL));\n          const uint32_t third_subsegment =\n              static_cast<uint32_t>(second_third_subsegments) -\n              second_subsegment * 10;\n\n          number_of_digits_to_print = precision - 9;\n          print_subsegment(second_subsegment, buf.data() + 9);\n\n          // Rounding inside the subsegment.\n          if (precision < 18) {\n            // The condition third_subsegment != 0 implies that the segment was\n            // of 19 digits, so in this case the third segment should be\n            // consisting of a genuine digit from the input.\n            uint32_t fractional_part = static_cast<uint32_t>(prod);\n            should_round_up =\n                fractional_part >= fractional_part_rounding_thresholds(\n                                       8 - number_of_digits_to_print) ||\n                ((fractional_part >> 31) &\n                 ((digits & 1) | (third_subsegment != 0) |\n                  has_more_segments)) != 0;\n          }\n          // Rounding at the subsegment boundary.\n          else {\n            // In this case, the segment must be of 19 digits, thus\n            // the third subsegment should be consisting of a genuine digit from\n            // the input.\n            should_round_up = third_subsegment > 5 ||\n                              (third_subsegment == 5 &&\n                               ((digits & 1) != 0 || has_more_segments));\n          }\n        }\n\n        // Round-up if necessary.\n        if (should_round_up) {\n          ++buf[precision - 1];\n          for (int i = precision - 1; i > 0 && buf[i] > '9'; --i) {\n            buf[i] = '0';\n            ++buf[i - 1];\n          }\n          if (buf[0] > '9') {\n            buf[0] = '1';\n            if (fixed)\n              buf[precision++] = '0';\n            else\n              ++exp;\n          }\n        }\n        buf.try_resize(to_unsigned(precision));\n      }\n    }  // if (digits_in_the_first_segment > precision)\n    else {\n      // Adjust the exponent for its use in Dragon4.\n      exp += digits_in_the_first_segment - 1;\n    }\n  }\n  if (use_dragon) {\n    auto f = basic_fp<uint128_t>();\n    bool is_predecessor_closer = specs.binary32\n                                     ? f.assign(static_cast<float>(value))\n                                     : f.assign(converted_value);\n    if (is_predecessor_closer) dragon_flags |= dragon::predecessor_closer;\n    if (fixed) dragon_flags |= dragon::fixed;\n    // Limit precision to the maximum possible number of significant digits in\n    // an IEEE754 double because we don't need to generate zeros.\n    const int max_double_digits = 767;\n    if (precision > max_double_digits) precision = max_double_digits;\n    format_dragon(f, dragon_flags, precision, buf, exp);\n  }\n  if (!fixed && !specs.showpoint) {\n    // Remove trailing zeros.\n    auto num_digits = buf.size();\n    while (num_digits > 0 && buf[num_digits - 1] == '0') {\n      --num_digits;\n      ++exp;\n    }\n    buf.try_resize(num_digits);\n  }\n  return exp;\n}\n\ntemplate <typename Char, typename OutputIt, typename T>\nFMT_CONSTEXPR20 auto write_float(OutputIt out, T value, format_specs specs,\n                                 locale_ref loc) -> OutputIt {\n  sign_t sign = specs.sign;\n  if (detail::signbit(value)) {  // value < 0 is false for NaN so use signbit.\n    sign = sign::minus;\n    value = -value;\n  } else if (sign == sign::minus) {\n    sign = sign::none;\n  }\n\n  if (!detail::isfinite(value))\n    return write_nonfinite<Char>(out, detail::isnan(value), specs, sign);\n\n  if (specs.align == align::numeric && sign) {\n    auto it = reserve(out, 1);\n    *it++ = detail::sign<Char>(sign);\n    out = base_iterator(out, it);\n    sign = sign::none;\n    if (specs.width != 0) --specs.width;\n  }\n\n  memory_buffer buffer;\n  if (specs.type == presentation_type::hexfloat) {\n    if (sign) buffer.push_back(detail::sign<char>(sign));\n    format_hexfloat(convert_float(value), specs, buffer);\n    return write_bytes<Char, align::right>(out, {buffer.data(), buffer.size()},\n                                           specs);\n  }\n\n  int precision = specs.precision >= 0 || specs.type == presentation_type::none\n                      ? specs.precision\n                      : 6;\n  if (specs.type == presentation_type::exp) {\n    if (precision == max_value<int>())\n      report_error(\"number is too big\");\n    else\n      ++precision;\n  } else if (specs.type != presentation_type::fixed && precision == 0) {\n    precision = 1;\n  }\n  float_specs fspecs = parse_float_type_spec(specs);\n  fspecs.sign = sign;\n  if (const_check(std::is_same<T, float>())) fspecs.binary32 = true;\n  int exp = format_float(convert_float(value), precision, fspecs, buffer);\n  fspecs.precision = precision;\n  auto f = big_decimal_fp{buffer.data(), static_cast<int>(buffer.size()), exp};\n  return write_float<Char>(out, f, specs, fspecs, loc);\n}\n\ntemplate <typename Char, typename OutputIt, typename T,\n          FMT_ENABLE_IF(is_floating_point<T>::value)>\nFMT_CONSTEXPR20 auto write(OutputIt out, T value, format_specs specs,\n                           locale_ref loc = {}) -> OutputIt {\n  if (const_check(!is_supported_floating_point(value))) return out;\n  return specs.localized && write_loc(out, value, specs, loc)\n             ? out\n             : write_float<Char>(out, value, specs, loc);\n}\n\ntemplate <typename Char, typename OutputIt, typename T,\n          FMT_ENABLE_IF(is_fast_float<T>::value)>\nFMT_CONSTEXPR20 auto write(OutputIt out, T value) -> OutputIt {\n  if (is_constant_evaluated()) return write<Char>(out, value, format_specs());\n  if (const_check(!is_supported_floating_point(value))) return out;\n\n  auto sign = sign_t::none;\n  if (detail::signbit(value)) {\n    sign = sign::minus;\n    value = -value;\n  }\n\n  constexpr auto specs = format_specs();\n  using floaty = conditional_t<std::is_same<T, long double>::value, double, T>;\n  using floaty_uint = typename dragonbox::float_info<floaty>::carrier_uint;\n  floaty_uint mask = exponent_mask<floaty>();\n  if ((bit_cast<floaty_uint>(value) & mask) == mask)\n    return write_nonfinite<Char>(out, std::isnan(value), specs, sign);\n\n  auto fspecs = float_specs();\n  fspecs.sign = sign;\n  auto dec = dragonbox::to_decimal(static_cast<floaty>(value));\n  return write_float<Char>(out, dec, specs, fspecs, {});\n}\n\ntemplate <typename Char, typename OutputIt, typename T,\n          FMT_ENABLE_IF(is_floating_point<T>::value &&\n                        !is_fast_float<T>::value)>\ninline auto write(OutputIt out, T value) -> OutputIt {\n  return write<Char>(out, value, format_specs());\n}\n\ntemplate <typename Char, typename OutputIt>\nauto write(OutputIt out, monostate, format_specs = {}, locale_ref = {})\n    -> OutputIt {\n  FMT_ASSERT(false, \"\");\n  return out;\n}\n\ntemplate <typename Char, typename OutputIt>\nFMT_CONSTEXPR auto write(OutputIt out, basic_string_view<Char> value)\n    -> OutputIt {\n  return copy_noinline<Char>(value.begin(), value.end(), out);\n}\n\ntemplate <typename Char, typename OutputIt, typename T,\n          FMT_ENABLE_IF(has_to_string_view<T>::value)>\nconstexpr auto write(OutputIt out, const T& value) -> OutputIt {\n  return write<Char>(out, to_string_view(value));\n}\n\n// FMT_ENABLE_IF() condition separated to workaround an MSVC bug.\ntemplate <\n    typename Char, typename OutputIt, typename T,\n    bool check =\n        std::is_enum<T>::value && !std::is_same<T, Char>::value &&\n        mapped_type_constant<T, basic_format_context<OutputIt, Char>>::value !=\n            type::custom_type,\n    FMT_ENABLE_IF(check)>\nFMT_CONSTEXPR auto write(OutputIt out, T value) -> OutputIt {\n  return write<Char>(out, static_cast<underlying_t<T>>(value));\n}\n\ntemplate <typename Char, typename OutputIt, typename T,\n          FMT_ENABLE_IF(std::is_same<T, bool>::value)>\nFMT_CONSTEXPR auto write(OutputIt out, T value, const format_specs& specs = {},\n                         locale_ref = {}) -> OutputIt {\n  return specs.type != presentation_type::none &&\n                 specs.type != presentation_type::string\n             ? write<Char>(out, value ? 1 : 0, specs, {})\n             : write_bytes<Char>(out, value ? \"true\" : \"false\", specs);\n}\n\ntemplate <typename Char, typename OutputIt>\nFMT_CONSTEXPR auto write(OutputIt out, Char value) -> OutputIt {\n  auto it = reserve(out, 1);\n  *it++ = value;\n  return base_iterator(out, it);\n}\n\ntemplate <typename Char, typename OutputIt>\nFMT_CONSTEXPR20 auto write(OutputIt out, const Char* value) -> OutputIt {\n  if (value) return write(out, basic_string_view<Char>(value));\n  report_error(\"string pointer is null\");\n  return out;\n}\n\ntemplate <typename Char, typename OutputIt, typename T,\n          FMT_ENABLE_IF(std::is_same<T, void>::value)>\nauto write(OutputIt out, const T* value, const format_specs& specs = {},\n           locale_ref = {}) -> OutputIt {\n  return write_ptr<Char>(out, bit_cast<uintptr_t>(value), &specs);\n}\n\n// A write overload that handles implicit conversions.\ntemplate <typename Char, typename OutputIt, typename T,\n          typename Context = basic_format_context<OutputIt, Char>>\nFMT_CONSTEXPR auto write(OutputIt out, const T& value) -> enable_if_t<\n    std::is_class<T>::value && !has_to_string_view<T>::value &&\n        !is_floating_point<T>::value && !std::is_same<T, Char>::value &&\n        !std::is_same<T, remove_cvref_t<decltype(arg_mapper<Context>().map(\n                             value))>>::value,\n    OutputIt> {\n  return write<Char>(out, arg_mapper<Context>().map(value));\n}\n\ntemplate <typename Char, typename OutputIt, typename T,\n          typename Context = basic_format_context<OutputIt, Char>>\nFMT_CONSTEXPR auto write(OutputIt out, const T& value)\n    -> enable_if_t<mapped_type_constant<T, Context>::value ==\n                           type::custom_type &&\n                       !std::is_fundamental<T>::value,\n                   OutputIt> {\n  auto formatter = typename Context::template formatter_type<T>();\n  auto parse_ctx = typename Context::parse_context_type({});\n  formatter.parse(parse_ctx);\n  auto ctx = Context(out, {}, {});\n  return formatter.format(value, ctx);\n}\n\n// An argument visitor that formats the argument and writes it via the output\n// iterator. It's a class and not a generic lambda for compatibility with C++11.\ntemplate <typename Char> struct default_arg_formatter {\n  using iterator = basic_appender<Char>;\n  using context = buffered_context<Char>;\n\n  iterator out;\n  basic_format_args<context> args;\n  locale_ref loc;\n\n  template <typename T> auto operator()(T value) -> iterator {\n    return write<Char>(out, value);\n  }\n  auto operator()(typename basic_format_arg<context>::handle h) -> iterator {\n    basic_format_parse_context<Char> parse_ctx({});\n    context format_ctx(out, args, loc);\n    h.format(parse_ctx, format_ctx);\n    return format_ctx.out();\n  }\n};\n\ntemplate <typename Char> struct arg_formatter {\n  using iterator = basic_appender<Char>;\n  using context = buffered_context<Char>;\n\n  iterator out;\n  const format_specs& specs;\n  locale_ref locale;\n\n  template <typename T>\n  FMT_CONSTEXPR FMT_INLINE auto operator()(T value) -> iterator {\n    return detail::write<Char>(out, value, specs, locale);\n  }\n  auto operator()(typename basic_format_arg<context>::handle) -> iterator {\n    // User-defined types are handled separately because they require access\n    // to the parse context.\n    return out;\n  }\n};\n\nstruct width_checker {\n  template <typename T, FMT_ENABLE_IF(is_integer<T>::value)>\n  FMT_CONSTEXPR auto operator()(T value) -> unsigned long long {\n    if (is_negative(value)) report_error(\"negative width\");\n    return static_cast<unsigned long long>(value);\n  }\n\n  template <typename T, FMT_ENABLE_IF(!is_integer<T>::value)>\n  FMT_CONSTEXPR auto operator()(T) -> unsigned long long {\n    report_error(\"width is not integer\");\n    return 0;\n  }\n};\n\nstruct precision_checker {\n  template <typename T, FMT_ENABLE_IF(is_integer<T>::value)>\n  FMT_CONSTEXPR auto operator()(T value) -> unsigned long long {\n    if (is_negative(value)) report_error(\"negative precision\");\n    return static_cast<unsigned long long>(value);\n  }\n\n  template <typename T, FMT_ENABLE_IF(!is_integer<T>::value)>\n  FMT_CONSTEXPR auto operator()(T) -> unsigned long long {\n    report_error(\"precision is not integer\");\n    return 0;\n  }\n};\n\ntemplate <typename Handler, typename FormatArg>\nFMT_CONSTEXPR auto get_dynamic_spec(FormatArg arg) -> int {\n  unsigned long long value = arg.visit(Handler());\n  if (value > to_unsigned(max_value<int>())) report_error(\"number is too big\");\n  return static_cast<int>(value);\n}\n\ntemplate <typename Context, typename ID>\nFMT_CONSTEXPR auto get_arg(Context& ctx, ID id) -> decltype(ctx.arg(id)) {\n  auto arg = ctx.arg(id);\n  if (!arg) report_error(\"argument not found\");\n  return arg;\n}\n\ntemplate <typename Handler, typename Context>\nFMT_CONSTEXPR void handle_dynamic_spec(int& value,\n                                       arg_ref<typename Context::char_type> ref,\n                                       Context& ctx) {\n  switch (ref.kind) {\n  case arg_id_kind::none:\n    break;\n  case arg_id_kind::index:\n    value = detail::get_dynamic_spec<Handler>(get_arg(ctx, ref.val.index));\n    break;\n  case arg_id_kind::name:\n    value = detail::get_dynamic_spec<Handler>(get_arg(ctx, ref.val.name));\n    break;\n  }\n}\n\n#if FMT_USE_USER_DEFINED_LITERALS\n#  if FMT_USE_NONTYPE_TEMPLATE_ARGS\ntemplate <typename T, typename Char, size_t N,\n          fmt::detail_exported::fixed_string<Char, N> Str>\nstruct statically_named_arg : view {\n  static constexpr auto name = Str.data;\n\n  const T& value;\n  statically_named_arg(const T& v) : value(v) {}\n};\n\ntemplate <typename T, typename Char, size_t N,\n          fmt::detail_exported::fixed_string<Char, N> Str>\nstruct is_named_arg<statically_named_arg<T, Char, N, Str>> : std::true_type {};\n\ntemplate <typename T, typename Char, size_t N,\n          fmt::detail_exported::fixed_string<Char, N> Str>\nstruct is_statically_named_arg<statically_named_arg<T, Char, N, Str>>\n    : std::true_type {};\n\ntemplate <typename Char, size_t N,\n          fmt::detail_exported::fixed_string<Char, N> Str>\nstruct udl_arg {\n  template <typename T> auto operator=(T&& value) const {\n    return statically_named_arg<T, Char, N, Str>(std::forward<T>(value));\n  }\n};\n#  else\ntemplate <typename Char> struct udl_arg {\n  const Char* str;\n\n  template <typename T> auto operator=(T&& value) const -> named_arg<Char, T> {\n    return {str, std::forward<T>(value)};\n  }\n};\n#  endif\n#endif  // FMT_USE_USER_DEFINED_LITERALS\n\ntemplate <typename Locale, typename Char>\nauto vformat(const Locale& loc, basic_string_view<Char> fmt,\n             typename detail::vformat_args<Char>::type args)\n    -> std::basic_string<Char> {\n  auto buf = basic_memory_buffer<Char>();\n  detail::vformat_to(buf, fmt, args, detail::locale_ref(loc));\n  return {buf.data(), buf.size()};\n}\n\nusing format_func = void (*)(detail::buffer<char>&, int, const char*);\n\nFMT_API void format_error_code(buffer<char>& out, int error_code,\n                               string_view message) noexcept;\n\nusing fmt::report_error;\nFMT_API void report_error(format_func func, int error_code,\n                          const char* message) noexcept;\n}  // namespace detail\n\nFMT_BEGIN_EXPORT\nFMT_API auto vsystem_error(int error_code, string_view format_str,\n                           format_args args) -> std::system_error;\n\n/**\n * Constructs `std::system_error` with a message formatted with\n * `fmt::format(fmt, args...)`.\n * `error_code` is a system error code as given by `errno`.\n *\n * **Example**:\n *\n *     // This throws std::system_error with the description\n *     //   cannot open file 'madeup': No such file or directory\n *     // or similar (system message may vary).\n *     const char* filename = \"madeup\";\n *     std::FILE* file = std::fopen(filename, \"r\");\n *     if (!file)\n *       throw fmt::system_error(errno, \"cannot open file '{}'\", filename);\n */\ntemplate <typename... T>\nauto system_error(int error_code, format_string<T...> fmt, T&&... args)\n    -> std::system_error {\n  return vsystem_error(error_code, fmt, fmt::make_format_args(args...));\n}\n\n/**\n * Formats an error message for an error returned by an operating system or a\n * language runtime, for example a file opening error, and writes it to `out`.\n * The format is the same as the one used by `std::system_error(ec, message)`\n * where `ec` is `std::error_code(error_code, std::generic_category())`.\n * It is implementation-defined but normally looks like:\n *\n *     <message>: <system-message>\n *\n * where `<message>` is the passed message and `<system-message>` is the system\n * message corresponding to the error code.\n * `error_code` is a system error code as given by `errno`.\n */\nFMT_API void format_system_error(detail::buffer<char>& out, int error_code,\n                                 const char* message) noexcept;\n\n// Reports a system error without throwing an exception.\n// Can be used to report errors from destructors.\nFMT_API void report_system_error(int error_code, const char* message) noexcept;\n\n/// A fast integer formatter.\nclass format_int {\n private:\n  // Buffer should be large enough to hold all digits (digits10 + 1),\n  // a sign and a null character.\n  enum { buffer_size = std::numeric_limits<unsigned long long>::digits10 + 3 };\n  mutable char buffer_[buffer_size];\n  char* str_;\n\n  template <typename UInt>\n  FMT_CONSTEXPR20 auto format_unsigned(UInt value) -> char* {\n    auto n = static_cast<detail::uint32_or_64_or_128_t<UInt>>(value);\n    return detail::format_decimal(buffer_, n, buffer_size - 1).begin;\n  }\n\n  template <typename Int>\n  FMT_CONSTEXPR20 auto format_signed(Int value) -> char* {\n    auto abs_value = static_cast<detail::uint32_or_64_or_128_t<Int>>(value);\n    bool negative = value < 0;\n    if (negative) abs_value = 0 - abs_value;\n    auto begin = format_unsigned(abs_value);\n    if (negative) *--begin = '-';\n    return begin;\n  }\n\n public:\n  explicit FMT_CONSTEXPR20 format_int(int value) : str_(format_signed(value)) {}\n  explicit FMT_CONSTEXPR20 format_int(long value)\n      : str_(format_signed(value)) {}\n  explicit FMT_CONSTEXPR20 format_int(long long value)\n      : str_(format_signed(value)) {}\n  explicit FMT_CONSTEXPR20 format_int(unsigned value)\n      : str_(format_unsigned(value)) {}\n  explicit FMT_CONSTEXPR20 format_int(unsigned long value)\n      : str_(format_unsigned(value)) {}\n  explicit FMT_CONSTEXPR20 format_int(unsigned long long value)\n      : str_(format_unsigned(value)) {}\n\n  /// Returns the number of characters written to the output buffer.\n  FMT_CONSTEXPR20 auto size() const -> size_t {\n    return detail::to_unsigned(buffer_ - str_ + buffer_size - 1);\n  }\n\n  /// Returns a pointer to the output buffer content. No terminating null\n  /// character is appended.\n  FMT_CONSTEXPR20 auto data() const -> const char* { return str_; }\n\n  /// Returns a pointer to the output buffer content with terminating null\n  /// character appended.\n  FMT_CONSTEXPR20 auto c_str() const -> const char* {\n    buffer_[buffer_size - 1] = '\\0';\n    return str_;\n  }\n\n  /// Returns the content of the output buffer as an `std::string`.\n  auto str() const -> std::string { return std::string(str_, size()); }\n};\n\ntemplate <typename T, typename Char>\nstruct formatter<T, Char, enable_if_t<detail::has_format_as<T>::value>>\n    : formatter<detail::format_as_t<T>, Char> {\n  template <typename FormatContext>\n  auto format(const T& value, FormatContext& ctx) const -> decltype(ctx.out()) {\n    auto&& val = format_as(value);  // Make an lvalue reference for format.\n    return formatter<detail::format_as_t<T>, Char>::format(val, ctx);\n  }\n};\n\n#define FMT_FORMAT_AS(Type, Base)                                              \\\n  template <typename Char>                                                     \\\n  struct formatter<Type, Char> : formatter<Base, Char> {                       \\\n    template <typename FormatContext>                                          \\\n    auto format(Type value, FormatContext& ctx) const -> decltype(ctx.out()) { \\\n      return formatter<Base, Char>::format(value, ctx);                        \\\n    }                                                                          \\\n  }\n\nFMT_FORMAT_AS(signed char, int);\nFMT_FORMAT_AS(unsigned char, unsigned);\nFMT_FORMAT_AS(short, int);\nFMT_FORMAT_AS(unsigned short, unsigned);\nFMT_FORMAT_AS(long, detail::long_type);\nFMT_FORMAT_AS(unsigned long, detail::ulong_type);\nFMT_FORMAT_AS(Char*, const Char*);\nFMT_FORMAT_AS(std::nullptr_t, const void*);\nFMT_FORMAT_AS(detail::std_string_view<Char>, basic_string_view<Char>);\nFMT_FORMAT_AS(void*, const void*);\n\ntemplate <typename Char, typename Traits, typename Allocator>\nclass formatter<std::basic_string<Char, Traits, Allocator>, Char>\n    : public formatter<basic_string_view<Char>, Char> {};\n\ntemplate <typename Char, size_t N>\nstruct formatter<Char[N], Char> : formatter<basic_string_view<Char>, Char> {};\n\n/**\n * Converts `p` to `const void*` for pointer formatting.\n *\n * **Example**:\n *\n *     auto s = fmt::format(\"{}\", fmt::ptr(p));\n */\ntemplate <typename T> auto ptr(T p) -> const void* {\n  static_assert(std::is_pointer<T>::value, \"\");\n  return detail::bit_cast<const void*>(p);\n}\n\n/**\n * Converts `e` to the underlying type.\n *\n * **Example**:\n *\n *     enum class color { red, green, blue };\n *     auto s = fmt::format(\"{}\", fmt::underlying(color::red));\n */\ntemplate <typename Enum>\nconstexpr auto underlying(Enum e) noexcept -> underlying_t<Enum> {\n  return static_cast<underlying_t<Enum>>(e);\n}\n\nnamespace enums {\ntemplate <typename Enum, FMT_ENABLE_IF(std::is_enum<Enum>::value)>\nconstexpr auto format_as(Enum e) noexcept -> underlying_t<Enum> {\n  return static_cast<underlying_t<Enum>>(e);\n}\n}  // namespace enums\n\nclass bytes {\n private:\n  string_view data_;\n  friend struct formatter<bytes>;\n\n public:\n  explicit bytes(string_view data) : data_(data) {}\n};\n\ntemplate <> struct formatter<bytes> {\n private:\n  detail::dynamic_format_specs<> specs_;\n\n public:\n  template <typename ParseContext>\n  FMT_CONSTEXPR auto parse(ParseContext& ctx) -> const char* {\n    return parse_format_specs(ctx.begin(), ctx.end(), specs_, ctx,\n                              detail::type::string_type);\n  }\n\n  template <typename FormatContext>\n  auto format(bytes b, FormatContext& ctx) const -> decltype(ctx.out()) {\n    auto specs = specs_;\n    detail::handle_dynamic_spec<detail::width_checker>(specs.width,\n                                                       specs.width_ref, ctx);\n    detail::handle_dynamic_spec<detail::precision_checker>(\n        specs.precision, specs.precision_ref, ctx);\n    return detail::write_bytes<char>(ctx.out(), b.data_, specs);\n  }\n};\n\n// group_digits_view is not derived from view because it copies the argument.\ntemplate <typename T> struct group_digits_view {\n  T value;\n};\n\n/**\n * Returns a view that formats an integer value using ',' as a\n * locale-independent thousands separator.\n *\n * **Example**:\n *\n *     fmt::print(\"{}\", fmt::group_digits(12345));\n *     // Output: \"12,345\"\n */\ntemplate <typename T> auto group_digits(T value) -> group_digits_view<T> {\n  return {value};\n}\n\ntemplate <typename T> struct formatter<group_digits_view<T>> : formatter<T> {\n private:\n  detail::dynamic_format_specs<> specs_;\n\n public:\n  template <typename ParseContext>\n  FMT_CONSTEXPR auto parse(ParseContext& ctx) -> const char* {\n    return parse_format_specs(ctx.begin(), ctx.end(), specs_, ctx,\n                              detail::type::int_type);\n  }\n\n  template <typename FormatContext>\n  auto format(group_digits_view<T> t, FormatContext& ctx) const\n      -> decltype(ctx.out()) {\n    auto specs = specs_;\n    detail::handle_dynamic_spec<detail::width_checker>(specs.width,\n                                                       specs.width_ref, ctx);\n    detail::handle_dynamic_spec<detail::precision_checker>(\n        specs.precision, specs.precision_ref, ctx);\n    auto arg = detail::make_write_int_arg(t.value, specs.sign);\n    return detail::write_int(\n        ctx.out(), static_cast<detail::uint64_or_128_t<T>>(arg.abs_value),\n        arg.prefix, specs, detail::digit_grouping<char>(\"\\3\", \",\"));\n  }\n};\n\ntemplate <typename T, typename Char> struct nested_view {\n  const formatter<T, Char>* fmt;\n  const T* value;\n};\n\ntemplate <typename T, typename Char>\nstruct formatter<nested_view<T, Char>, Char> {\n  template <typename ParseContext>\n  FMT_CONSTEXPR auto parse(ParseContext& ctx) -> decltype(ctx.begin()) {\n    return ctx.begin();\n  }\n  template <typename FormatContext>\n  auto format(nested_view<T, Char> view, FormatContext& ctx) const\n      -> decltype(ctx.out()) {\n    return view.fmt->format(*view.value, ctx);\n  }\n};\n\ntemplate <typename T, typename Char = char> struct nested_formatter {\n private:\n  int width_;\n  detail::fill_t fill_;\n  align_t align_ : 4;\n  formatter<T, Char> formatter_;\n\n public:\n  constexpr nested_formatter() : width_(0), align_(align_t::none) {}\n\n  FMT_CONSTEXPR auto parse(basic_format_parse_context<Char>& ctx)\n      -> decltype(ctx.begin()) {\n    auto specs = detail::dynamic_format_specs<Char>();\n    auto it = parse_format_specs(ctx.begin(), ctx.end(), specs, ctx,\n                                 detail::type::none_type);\n    width_ = specs.width;\n    fill_ = specs.fill;\n    align_ = specs.align;\n    ctx.advance_to(it);\n    return formatter_.parse(ctx);\n  }\n\n  template <typename FormatContext, typename F>\n  auto write_padded(FormatContext& ctx, F write) const -> decltype(ctx.out()) {\n    if (width_ == 0) return write(ctx.out());\n    auto buf = basic_memory_buffer<Char>();\n    write(basic_appender<Char>(buf));\n    auto specs = format_specs();\n    specs.width = width_;\n    specs.fill = fill_;\n    specs.align = align_;\n    return detail::write<Char>(\n        ctx.out(), basic_string_view<Char>(buf.data(), buf.size()), specs);\n  }\n\n  auto nested(const T& value) const -> nested_view<T, Char> {\n    return nested_view<T, Char>{&formatter_, &value};\n  }\n};\n\n/**\n * Converts `value` to `std::string` using the default format for type `T`.\n *\n * **Example**:\n *\n *     std::string answer = fmt::to_string(42);\n */\ntemplate <typename T, FMT_ENABLE_IF(!std::is_integral<T>::value &&\n                                    !detail::has_format_as<T>::value)>\ninline auto to_string(const T& value) -> std::string {\n  auto buffer = memory_buffer();\n  detail::write<char>(appender(buffer), value);\n  return {buffer.data(), buffer.size()};\n}\n\ntemplate <typename T, FMT_ENABLE_IF(std::is_integral<T>::value)>\nFMT_NODISCARD inline auto to_string(T value) -> std::string {\n  // The buffer should be large enough to store the number including the sign\n  // or \"false\" for bool.\n  constexpr int max_size = detail::digits10<T>() + 2;\n  char buffer[max_size > 5 ? static_cast<unsigned>(max_size) : 5];\n  char* begin = buffer;\n  return std::string(begin, detail::write<char>(begin, value));\n}\n\ntemplate <typename Char, size_t SIZE>\nFMT_NODISCARD auto to_string(const basic_memory_buffer<Char, SIZE>& buf)\n    -> std::basic_string<Char> {\n  auto size = buf.size();\n  detail::assume(size < std::basic_string<Char>().max_size());\n  return std::basic_string<Char>(buf.data(), size);\n}\n\ntemplate <typename T, FMT_ENABLE_IF(!std::is_integral<T>::value &&\n                                    detail::has_format_as<T>::value)>\ninline auto to_string(const T& value) -> std::string {\n  return to_string(format_as(value));\n}\n\nFMT_END_EXPORT\n\nnamespace detail {\n\ntemplate <typename Char>\nvoid vformat_to(buffer<Char>& buf, basic_string_view<Char> fmt,\n                typename vformat_args<Char>::type args, locale_ref loc) {\n  auto out = basic_appender<Char>(buf);\n  if (fmt.size() == 2 && equal2(fmt.data(), \"{}\")) {\n    auto arg = args.get(0);\n    if (!arg) report_error(\"argument not found\");\n    arg.visit(default_arg_formatter<Char>{out, args, loc});\n    return;\n  }\n\n  struct format_handler {\n    basic_format_parse_context<Char> parse_context;\n    buffered_context<Char> context;\n\n    format_handler(basic_appender<Char> p_out, basic_string_view<Char> str,\n                   basic_format_args<buffered_context<Char>> p_args,\n                   locale_ref p_loc)\n        : parse_context(str), context(p_out, p_args, p_loc) {}\n\n    void on_text(const Char* begin, const Char* end) {\n      auto text = basic_string_view<Char>(begin, to_unsigned(end - begin));\n      context.advance_to(write<Char>(context.out(), text));\n    }\n\n    FMT_CONSTEXPR auto on_arg_id() -> int {\n      return parse_context.next_arg_id();\n    }\n    FMT_CONSTEXPR auto on_arg_id(int id) -> int {\n      parse_context.check_arg_id(id);\n      return id;\n    }\n    FMT_CONSTEXPR auto on_arg_id(basic_string_view<Char> id) -> int {\n      parse_context.check_arg_id(id);\n      int arg_id = context.arg_id(id);\n      if (arg_id < 0) report_error(\"argument not found\");\n      return arg_id;\n    }\n\n    FMT_INLINE void on_replacement_field(int id, const Char*) {\n      auto arg = get_arg(context, id);\n      context.advance_to(arg.visit(default_arg_formatter<Char>{\n          context.out(), context.args(), context.locale()}));\n    }\n\n    auto on_format_specs(int id, const Char* begin, const Char* end)\n        -> const Char* {\n      auto arg = get_arg(context, id);\n      // Not using a visitor for custom types gives better codegen.\n      if (arg.format_custom(begin, parse_context, context))\n        return parse_context.begin();\n      auto specs = detail::dynamic_format_specs<Char>();\n      begin = parse_format_specs(begin, end, specs, parse_context, arg.type());\n      detail::handle_dynamic_spec<detail::width_checker>(\n          specs.width, specs.width_ref, context);\n      detail::handle_dynamic_spec<detail::precision_checker>(\n          specs.precision, specs.precision_ref, context);\n      if (begin == end || *begin != '}')\n        report_error(\"missing '}' in format string\");\n      context.advance_to(arg.visit(\n          arg_formatter<Char>{context.out(), specs, context.locale()}));\n      return begin;\n    }\n\n    FMT_NORETURN void on_error(const char* message) { report_error(message); }\n  };\n  detail::parse_format_string<false>(fmt, format_handler(out, fmt, args, loc));\n}\n\nFMT_BEGIN_EXPORT\n\n#ifndef FMT_HEADER_ONLY\nextern template FMT_API void vformat_to(buffer<char>&, string_view,\n                                        typename vformat_args<>::type,\n                                        locale_ref);\nextern template FMT_API auto thousands_sep_impl<char>(locale_ref)\n    -> thousands_sep_result<char>;\nextern template FMT_API auto thousands_sep_impl<wchar_t>(locale_ref)\n    -> thousands_sep_result<wchar_t>;\nextern template FMT_API auto decimal_point_impl(locale_ref) -> char;\nextern template FMT_API auto decimal_point_impl(locale_ref) -> wchar_t;\n#endif  // FMT_HEADER_ONLY\n\nFMT_END_EXPORT\n\ntemplate <typename T, typename Char, type TYPE>\ntemplate <typename FormatContext>\nFMT_CONSTEXPR FMT_INLINE auto native_formatter<T, Char, TYPE>::format(\n    const T& val, FormatContext& ctx) const -> decltype(ctx.out()) {\n  if (specs_.width_ref.kind == arg_id_kind::none &&\n      specs_.precision_ref.kind == arg_id_kind::none) {\n    return write<Char>(ctx.out(), val, specs_, ctx.locale());\n  }\n  auto specs = specs_;\n  handle_dynamic_spec<width_checker>(specs.width, specs.width_ref, ctx);\n  handle_dynamic_spec<precision_checker>(specs.precision, specs.precision_ref,\n                                         ctx);\n  return write<Char>(ctx.out(), val, specs, ctx.locale());\n}\n\n}  // namespace detail\n\nFMT_BEGIN_EXPORT\n\ntemplate <typename Char>\nstruct formatter<detail::float128, Char>\n    : detail::native_formatter<detail::float128, Char,\n                               detail::type::float_type> {};\n\n#if FMT_USE_USER_DEFINED_LITERALS\ninline namespace literals {\n/**\n * User-defined literal equivalent of `fmt::arg`.\n *\n * **Example**:\n *\n *     using namespace fmt::literals;\n *     fmt::print(\"The answer is {answer}.\", \"answer\"_a=42);\n */\n#  if FMT_USE_NONTYPE_TEMPLATE_ARGS\ntemplate <detail_exported::fixed_string Str> constexpr auto operator\"\"_a() {\n  using char_t = remove_cvref_t<decltype(Str.data[0])>;\n  return detail::udl_arg<char_t, sizeof(Str.data) / sizeof(char_t), Str>();\n}\n#  else\nconstexpr auto operator\"\"_a(const char* s, size_t) -> detail::udl_arg<char> {\n  return {s};\n}\n#  endif\n}  // namespace literals\n#endif  // FMT_USE_USER_DEFINED_LITERALS\n\nFMT_API auto vformat(string_view fmt, format_args args) -> std::string;\n\n/**\n * Formats `args` according to specifications in `fmt` and returns the result\n * as a string.\n *\n * **Example**:\n *\n *     #include <fmt/format.h>\n *     std::string message = fmt::format(\"The answer is {}.\", 42);\n */\ntemplate <typename... T>\nFMT_NODISCARD FMT_INLINE auto format(format_string<T...> fmt, T&&... args)\n    -> std::string {\n  return vformat(fmt, fmt::make_format_args(args...));\n}\n\ntemplate <typename Locale, FMT_ENABLE_IF(detail::is_locale<Locale>::value)>\ninline auto vformat(const Locale& loc, string_view fmt, format_args args)\n    -> std::string {\n  return detail::vformat(loc, fmt, args);\n}\n\ntemplate <typename Locale, typename... T,\n          FMT_ENABLE_IF(detail::is_locale<Locale>::value)>\ninline auto format(const Locale& loc, format_string<T...> fmt, T&&... args)\n    -> std::string {\n  return fmt::vformat(loc, string_view(fmt), fmt::make_format_args(args...));\n}\n\ntemplate <typename OutputIt, typename Locale,\n          FMT_ENABLE_IF(detail::is_output_iterator<OutputIt, char>::value&&\n                            detail::is_locale<Locale>::value)>\nauto vformat_to(OutputIt out, const Locale& loc, string_view fmt,\n                format_args args) -> OutputIt {\n  using detail::get_buffer;\n  auto&& buf = get_buffer<char>(out);\n  detail::vformat_to(buf, fmt, args, detail::locale_ref(loc));\n  return detail::get_iterator(buf, out);\n}\n\ntemplate <typename OutputIt, typename Locale, typename... T,\n          FMT_ENABLE_IF(detail::is_output_iterator<OutputIt, char>::value&&\n                            detail::is_locale<Locale>::value)>\nFMT_INLINE auto format_to(OutputIt out, const Locale& loc,\n                          format_string<T...> fmt, T&&... args) -> OutputIt {\n  return vformat_to(out, loc, fmt, fmt::make_format_args(args...));\n}\n\ntemplate <typename Locale, typename... T,\n          FMT_ENABLE_IF(detail::is_locale<Locale>::value)>\nFMT_NODISCARD FMT_INLINE auto formatted_size(const Locale& loc,\n                                             format_string<T...> fmt,\n                                             T&&... args) -> size_t {\n  auto buf = detail::counting_buffer<>();\n  detail::vformat_to<char>(buf, fmt, fmt::make_format_args(args...),\n                           detail::locale_ref(loc));\n  return buf.count();\n}\n\nFMT_END_EXPORT\n\nFMT_END_NAMESPACE\n\n#ifdef FMT_HEADER_ONLY\n#  define FMT_FUNC inline\n#  include \"format-inl.h\"\n#else\n#  define FMT_FUNC\n#endif\n\n// Restore _LIBCPP_REMOVE_TRANSITIVE_INCLUDES.\n#ifdef FMT_REMOVE_TRANSITIVE_INCLUDES\n#  undef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES\n#endif\n\n#endif  // FMT_FORMAT_H_\n"
  },
  {
    "path": "vendor/format.cc",
    "content": "// Formatting library for C++\n//\n// Copyright (c) 2012 - 2016, Victor Zverovich\n// All rights reserved.\n//\n// For the license information refer to format.h.\n\n#include \"fmt/format-inl.h\"\n\nFMT_BEGIN_NAMESPACE\nnamespace detail {\n\ntemplate FMT_API auto dragonbox::to_decimal(float x) noexcept\n    -> dragonbox::decimal_fp<float>;\ntemplate FMT_API auto dragonbox::to_decimal(double x) noexcept\n    -> dragonbox::decimal_fp<double>;\n\n#ifndef FMT_STATIC_THOUSANDS_SEPARATOR\ntemplate FMT_API locale_ref::locale_ref(const std::locale& loc);\ntemplate FMT_API auto locale_ref::get<std::locale>() const -> std::locale;\n#endif\n\n// Explicit instantiations for char.\n\ntemplate FMT_API auto thousands_sep_impl(locale_ref)\n    -> thousands_sep_result<char>;\ntemplate FMT_API auto decimal_point_impl(locale_ref) -> char;\n\ntemplate FMT_API void buffer<char>::append(const char*, const char*);\n\ntemplate FMT_API void vformat_to(buffer<char>&, string_view,\n                                 typename vformat_args<>::type, locale_ref);\n\n// Explicit instantiations for wchar_t.\n\ntemplate FMT_API auto thousands_sep_impl(locale_ref)\n    -> thousands_sep_result<wchar_t>;\ntemplate FMT_API auto decimal_point_impl(locale_ref) -> wchar_t;\n\ntemplate FMT_API void buffer<wchar_t>::append(const wchar_t*, const wchar_t*);\n\n}  // namespace detail\nFMT_END_NAMESPACE\n"
  },
  {
    "path": "vendor/json.hpp",
    "content": "//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\n/****************************************************************************\\\n * Note on documentation: The source files contain links to the online      *\n * documentation of the public API at https://json.nlohmann.me. This URL    *\n * contains the most recent documentation and should also be applicable to  *\n * previous versions; documentation for deprecated functions is not         *\n * removed, but marked deprecated. See \"Generate documentation\" section in  *\n * file docs/README.md.                                                     *\n\\****************************************************************************/\n\n#ifndef INCLUDE_NLOHMANN_JSON_HPP_\n#define INCLUDE_NLOHMANN_JSON_HPP_\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#ifndef JSON_NO_IO\n    #include <iosfwd> // istream, ostream\n#endif  // JSON_NO_IO\n#include <iterator> // random_access_iterator_tag\n#include <memory> // unique_ptr\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//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\n\n\n#include <utility>\n\n// #include <nlohmann/detail/abi_macros.hpp>\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\n\n\n// This file contains all macro definitions affecting or depending on the ABI\n\n#ifndef JSON_SKIP_LIBRARY_VERSION_CHECK\n    #if defined(NLOHMANN_JSON_VERSION_MAJOR) && defined(NLOHMANN_JSON_VERSION_MINOR) && defined(NLOHMANN_JSON_VERSION_PATCH)\n        #if NLOHMANN_JSON_VERSION_MAJOR != 3 || NLOHMANN_JSON_VERSION_MINOR != 11 || NLOHMANN_JSON_VERSION_PATCH != 3\n            #warning \"Already included a different version of the library!\"\n        #endif\n    #endif\n#endif\n\n#define NLOHMANN_JSON_VERSION_MAJOR 3   // NOLINT(modernize-macro-to-enum)\n#define NLOHMANN_JSON_VERSION_MINOR 11  // NOLINT(modernize-macro-to-enum)\n#define NLOHMANN_JSON_VERSION_PATCH 3   // NOLINT(modernize-macro-to-enum)\n\n#ifndef JSON_DIAGNOSTICS\n    #define JSON_DIAGNOSTICS 0\n#endif\n\n#ifndef JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON\n    #define JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON 0\n#endif\n\n#if JSON_DIAGNOSTICS\n    #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS _diag\n#else\n    #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS\n#endif\n\n#if JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON\n    #define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON _ldvcmp\n#else\n    #define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON\n#endif\n\n#ifndef NLOHMANN_JSON_NAMESPACE_NO_VERSION\n    #define NLOHMANN_JSON_NAMESPACE_NO_VERSION 0\n#endif\n\n// Construct the namespace ABI tags component\n#define NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b) json_abi ## a ## b\n#define NLOHMANN_JSON_ABI_TAGS_CONCAT(a, b) \\\n    NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b)\n\n#define NLOHMANN_JSON_ABI_TAGS                                       \\\n    NLOHMANN_JSON_ABI_TAGS_CONCAT(                                   \\\n            NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS,                       \\\n            NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON)\n\n// Construct the namespace version component\n#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) \\\n    _v ## major ## _ ## minor ## _ ## patch\n#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(major, minor, patch) \\\n    NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch)\n\n#if NLOHMANN_JSON_NAMESPACE_NO_VERSION\n#define NLOHMANN_JSON_NAMESPACE_VERSION\n#else\n#define NLOHMANN_JSON_NAMESPACE_VERSION                                 \\\n    NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(NLOHMANN_JSON_VERSION_MAJOR, \\\n                                           NLOHMANN_JSON_VERSION_MINOR, \\\n                                           NLOHMANN_JSON_VERSION_PATCH)\n#endif\n\n// Combine namespace components\n#define NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) a ## b\n#define NLOHMANN_JSON_NAMESPACE_CONCAT(a, b) \\\n    NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b)\n\n#ifndef NLOHMANN_JSON_NAMESPACE\n#define NLOHMANN_JSON_NAMESPACE               \\\n    nlohmann::NLOHMANN_JSON_NAMESPACE_CONCAT( \\\n            NLOHMANN_JSON_ABI_TAGS,           \\\n            NLOHMANN_JSON_NAMESPACE_VERSION)\n#endif\n\n#ifndef NLOHMANN_JSON_NAMESPACE_BEGIN\n#define NLOHMANN_JSON_NAMESPACE_BEGIN                \\\n    namespace nlohmann                               \\\n    {                                                \\\n    inline namespace NLOHMANN_JSON_NAMESPACE_CONCAT( \\\n                NLOHMANN_JSON_ABI_TAGS,              \\\n                NLOHMANN_JSON_NAMESPACE_VERSION)     \\\n    {\n#endif\n\n#ifndef NLOHMANN_JSON_NAMESPACE_END\n#define NLOHMANN_JSON_NAMESPACE_END                                     \\\n    }  /* namespace (inline namespace) NOLINT(readability/namespace) */ \\\n    }  // namespace nlohmann\n#endif\n\n// #include <nlohmann/detail/conversions/from_json.hpp>\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\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//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\n\n\n#include <cstddef> // nullptr_t\n#include <exception> // exception\n#if JSON_DIAGNOSTICS\n    #include <numeric> // accumulate\n#endif\n#include <stdexcept> // runtime_error\n#include <string> // to_string\n#include <vector> // vector\n\n// #include <nlohmann/detail/value_t.hpp>\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\n\n\n#include <array> // array\n#include <cstddef> // size_t\n#include <cstdint> // uint8_t\n#include <string> // string\n\n// #include <nlohmann/detail/macro_scope.hpp>\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\n\n\n#include <utility> // declval, pair\n// #include <nlohmann/detail/meta/detected.hpp>\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\n\n\n#include <type_traits>\n\n// #include <nlohmann/detail/meta/void_t.hpp>\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\n\n\n// #include <nlohmann/detail/abi_macros.hpp>\n\n\nNLOHMANN_JSON_NAMESPACE_BEGIN\nnamespace detail\n{\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\n}  // namespace detail\nNLOHMANN_JSON_NAMESPACE_END\n\n\nNLOHMANN_JSON_NAMESPACE_BEGIN\nnamespace detail\n{\n\n// https://en.cppreference.com/w/cpp/experimental/is_detected\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>\nstruct is_detected_lazy : is_detected<Op, Args...> { };\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\n}  // namespace detail\nNLOHMANN_JSON_NAMESPACE_END\n\n// #include <nlohmann/thirdparty/hedley/hedley.hpp>\n\n\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-FileCopyrightText: 2016-2021 Evan Nemerson <evan@nemerson.com>\n// SPDX-License-Identifier: MIT\n\n/* Hedley - https://nemequ.github.io/hedley\n * Created by Evan Nemerson <evan@nemerson.com>\n */\n\n#if !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < 15)\n#if defined(JSON_HEDLEY_VERSION)\n    #undef JSON_HEDLEY_VERSION\n#endif\n#define JSON_HEDLEY_VERSION 15\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_MCST_LCC_VERSION)\n    #undef JSON_HEDLEY_MCST_LCC_VERSION\n#endif\n#if defined(__LCC__) && defined(__LCC_MINOR__)\n    #define JSON_HEDLEY_MCST_LCC_VERSION JSON_HEDLEY_VERSION_ENCODE(__LCC__ / 100, __LCC__ % 100, __LCC_MINOR__)\n#endif\n\n#if defined(JSON_HEDLEY_MCST_LCC_VERSION_CHECK)\n    #undef JSON_HEDLEY_MCST_LCC_VERSION_CHECK\n#endif\n#if defined(JSON_HEDLEY_MCST_LCC_VERSION)\n    #define JSON_HEDLEY_MCST_LCC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_MCST_LCC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))\n#else\n    #define JSON_HEDLEY_MCST_LCC_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_CRAY_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    !defined(JSON_HEDLEY_MCST_LCC_VERSION)\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 \\\n  defined(__has_attribute) && \\\n  ( \\\n    (!defined(JSON_HEDLEY_IAR_VERSION) || JSON_HEDLEY_IAR_VERSION_CHECK(8,5,9)) \\\n  )\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) JSON_HEDLEY_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) JSON_HEDLEY_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 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma(\"diag_suppress 1215,1444\")\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#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma(\"diag_suppress 161\")\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#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma(\"diag_suppress 1097\")\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_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION)\n    #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION\n#endif\n#if JSON_HEDLEY_HAS_WARNING(\"-Wunused-function\")\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma(\"clang diagnostic ignored \\\"-Wunused-function\\\"\")\n#elif JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma(\"GCC diagnostic ignored \\\"-Wunused-function\\\"\")\n#elif JSON_HEDLEY_MSVC_VERSION_CHECK(1,0,0)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION __pragma(warning(disable:4505))\n#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma(\"diag_suppress 3142\")\n#else\n    #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION\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) && !defined(JSON_HEDLEY_IAR_VERSION)) || \\\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    JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)\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    JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \\\n    JSON_HEDLEY_IAR_VERSION_CHECK(8,10,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    JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)\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    JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)\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    JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)\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 \\\n    JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \\\n    JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)\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    JSON_HEDLEY_IAR_VERSION_CHECK(8,10,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    JSON_HEDLEY_CRAY_VERSION_CHECK(10,0,0) || \\\n    JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)\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    JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)\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  JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)\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  JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)\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    JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)\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  JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)\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    JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)\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    JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)\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    JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)\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  JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \\\n  JSON_HEDLEY_IAR_VERSION_CHECK(8,10,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    JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \\\n    JSON_HEDLEY_IAR_VERSION_CHECK(8,10,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    JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)\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    JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)\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    JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)\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    JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)\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    JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)\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) && !defined(JSON_HEDLEY_IAR_VERSION)) || \\\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) && (!defined(__cplusplus) || JSON_HEDLEY_HAS_WARNING(\"-Wbitfield-enum-conversion\"))\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 (except those affecting ABI)\n// You MUST include macro_unscope.hpp at the end of json.hpp to undef all of them\n\n// #include <nlohmann/detail/abi_macros.hpp>\n\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 the user manually specified the used c++ version this is skipped\n#if !defined(JSON_HAS_CPP_20) && !defined(JSON_HAS_CPP_17) && !defined(JSON_HAS_CPP_14) && !defined(JSON_HAS_CPP_11)\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    // the cpp 11 flag is always specified because it is the minimal required version\n    #define JSON_HAS_CPP_11\n#endif\n\n#ifdef __has_include\n    #if __has_include(<version>)\n        #include <version>\n    #endif\n#endif\n\n#if !defined(JSON_HAS_FILESYSTEM) && !defined(JSON_HAS_EXPERIMENTAL_FILESYSTEM)\n    #ifdef JSON_HAS_CPP_17\n        #if defined(__cpp_lib_filesystem)\n            #define JSON_HAS_FILESYSTEM 1\n        #elif defined(__cpp_lib_experimental_filesystem)\n            #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1\n        #elif !defined(__has_include)\n            #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1\n        #elif __has_include(<filesystem>)\n            #define JSON_HAS_FILESYSTEM 1\n        #elif __has_include(<experimental/filesystem>)\n            #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1\n        #endif\n\n        // std::filesystem does not work on MinGW GCC 8: https://sourceforge.net/p/mingw-w64/bugs/737/\n        #if defined(__MINGW32__) && defined(__GNUC__) && __GNUC__ == 8\n            #undef JSON_HAS_FILESYSTEM\n            #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM\n        #endif\n\n        // no filesystem support before GCC 8: https://en.cppreference.com/w/cpp/compiler_support\n        #if defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 8\n            #undef JSON_HAS_FILESYSTEM\n            #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM\n        #endif\n\n        // no filesystem support before Clang 7: https://en.cppreference.com/w/cpp/compiler_support\n        #if defined(__clang_major__) && __clang_major__ < 7\n            #undef JSON_HAS_FILESYSTEM\n            #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM\n        #endif\n\n        // no filesystem support before MSVC 19.14: https://en.cppreference.com/w/cpp/compiler_support\n        #if defined(_MSC_VER) && _MSC_VER < 1914\n            #undef JSON_HAS_FILESYSTEM\n            #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM\n        #endif\n\n        // no filesystem support before iOS 13\n        #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 130000\n            #undef JSON_HAS_FILESYSTEM\n            #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM\n        #endif\n\n        // no filesystem support before macOS Catalina\n        #if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500\n            #undef JSON_HAS_FILESYSTEM\n            #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM\n        #endif\n    #endif\n#endif\n\n#ifndef JSON_HAS_EXPERIMENTAL_FILESYSTEM\n    #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 0\n#endif\n\n#ifndef JSON_HAS_FILESYSTEM\n    #define JSON_HAS_FILESYSTEM 0\n#endif\n\n#ifndef JSON_HAS_THREE_WAY_COMPARISON\n    #if defined(__cpp_impl_three_way_comparison) && __cpp_impl_three_way_comparison >= 201907L \\\n        && defined(__cpp_lib_three_way_comparison) && __cpp_lib_three_way_comparison >= 201907L\n        #define JSON_HAS_THREE_WAY_COMPARISON 1\n    #else\n        #define JSON_HAS_THREE_WAY_COMPARISON 0\n    #endif\n#endif\n\n#ifndef JSON_HAS_RANGES\n    // ranges header shipping in GCC 11.1.0 (released 2021-04-27) has syntax error\n    #if defined(__GLIBCXX__) && __GLIBCXX__ == 20210427\n        #define JSON_HAS_RANGES 0\n    #elif defined(__cpp_lib_ranges)\n        #define JSON_HAS_RANGES 1\n    #else\n        #define JSON_HAS_RANGES 0\n    #endif\n#endif\n\n#ifndef JSON_HAS_STATIC_RTTI\n    #if !defined(_HAS_STATIC_RTTI) || _HAS_STATIC_RTTI != 0\n        #define JSON_HAS_STATIC_RTTI 1\n    #else\n        #define JSON_HAS_STATIC_RTTI 0\n    #endif\n#endif\n\n#ifdef JSON_HAS_CPP_17\n    #define JSON_INLINE_VARIABLE inline\n#else\n    #define JSON_INLINE_VARIABLE\n#endif\n\n#if JSON_HEDLEY_HAS_ATTRIBUTE(no_unique_address)\n    #define JSON_NO_UNIQUE_ADDRESS [[no_unique_address]]\n#else\n    #define JSON_NO_UNIQUE_ADDRESS\n#endif\n\n// disable documentation warnings on clang\n#if defined(__clang__)\n    #pragma clang diagnostic push\n    #pragma clang diagnostic ignored \"-Wdocumentation\"\n    #pragma clang diagnostic ignored \"-Wdocumentation-unknown-command\"\n#endif\n\n// allow disabling 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 overriding 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             class CustomBaseClass>\n\n#define NLOHMANN_BASIC_JSON_TPL                                            \\\n    basic_json<ObjectType, ArrayType, StringType, BooleanType,             \\\n    NumberIntegerType, NumberUnsignedType, NumberFloatType,                \\\n    AllocatorType, JSONSerializer, BinaryType, CustomBaseClass>\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#define NLOHMANN_JSON_FROM_WITH_DEFAULT(v1) nlohmann_json_t.v1 = nlohmann_json_j.value(#v1, nlohmann_json_default_obj.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#define NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(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) { const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) }\n\n#define NLOHMANN_DEFINE_TYPE_INTRUSIVE_ONLY_SERIALIZE(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\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#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE(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\n#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(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) { const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) }\n\n// inspired from https://stackoverflow.com/a/26745591\n// allows to call any std function as if (e.g. with begin):\n// using std::begin; begin(x);\n//\n// it allows using the detected idiom to retrieve the return type\n// of such an expression\n#define NLOHMANN_CAN_CALL_STD_FUNC_IMPL(std_name)                                 \\\n    namespace detail {                                                            \\\n    using std::std_name;                                                          \\\n    \\\n    template<typename... T>                                                       \\\n    using result_of_##std_name = decltype(std_name(std::declval<T>()...));        \\\n    }                                                                             \\\n    \\\n    namespace detail2 {                                                           \\\n    struct std_name##_tag                                                         \\\n    {                                                                             \\\n    };                                                                            \\\n    \\\n    template<typename... T>                                                       \\\n    std_name##_tag std_name(T&&...);                                              \\\n    \\\n    template<typename... T>                                                       \\\n    using result_of_##std_name = decltype(std_name(std::declval<T>()...));        \\\n    \\\n    template<typename... T>                                                       \\\n    struct would_call_std_##std_name                                              \\\n    {                                                                             \\\n        static constexpr auto const value = ::nlohmann::detail::                  \\\n                                            is_detected_exact<std_name##_tag, result_of_##std_name, T...>::value; \\\n    };                                                                            \\\n    } /* namespace detail2 */ \\\n    \\\n    template<typename... T>                                                       \\\n    struct would_call_std_##std_name : detail2::would_call_std_##std_name<T...>   \\\n    {                                                                             \\\n    }\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#ifndef JSON_DISABLE_ENUM_SERIALIZATION\n    #define JSON_DISABLE_ENUM_SERIALIZATION 0\n#endif\n\n#ifndef JSON_USE_GLOBAL_UDLS\n    #define JSON_USE_GLOBAL_UDLS 1\n#endif\n\n#if JSON_HAS_THREE_WAY_COMPARISON\n    #include <compare> // partial_ordering\n#endif\n\nNLOHMANN_JSON_NAMESPACE_BEGIN\nnamespace detail\n{\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 see @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*/\n#if JSON_HAS_THREE_WAY_COMPARISON\n    inline std::partial_ordering operator<=>(const value_t lhs, const value_t rhs) noexcept // *NOPAD*\n#else\n    inline bool operator<(const value_t lhs, const value_t rhs) noexcept\n#endif\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#if JSON_HAS_THREE_WAY_COMPARISON\n    if (l_index < order.size() && r_index < order.size())\n    {\n        return order[l_index] <=> order[r_index]; // *NOPAD*\n    }\n    return std::partial_ordering::unordered;\n#else\n    return l_index < order.size() && r_index < order.size() && order[l_index] < order[r_index];\n#endif\n}\n\n// GCC selects the built-in operator< over an operator rewritten from\n// a user-defined spaceship operator\n// Clang, MSVC, and ICC select the rewritten candidate\n// (see GCC bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105200)\n#if JSON_HAS_THREE_WAY_COMPARISON && defined(__GNUC__)\ninline bool operator<(const value_t lhs, const value_t rhs) noexcept\n{\n    return std::is_lt(lhs <=> rhs); // *NOPAD*\n}\n#endif\n\n}  // namespace detail\nNLOHMANN_JSON_NAMESPACE_END\n\n// #include <nlohmann/detail/string_escape.hpp>\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\n\n\n// #include <nlohmann/detail/abi_macros.hpp>\n\n\nNLOHMANN_JSON_NAMESPACE_BEGIN\nnamespace detail\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\nenforced with an assertion.**\n\n@since version 2.0.0\n*/\ntemplate<typename StringType>\ninline void replace_substring(StringType& s, const StringType& f,\n                              const StringType& t)\n{\n    JSON_ASSERT(!f.empty());\n    for (auto pos = s.find(f);                // find first occurrence of f\n            pos != StringType::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/*!\n * @brief string escaping as described in RFC 6901 (Sect. 4)\n * @param[in] s string to escape\n * @return    escaped string\n *\n * Note the order of escaping \"~\" to \"~0\" and \"/\" to \"~1\" is important.\n */\ntemplate<typename StringType>\ninline StringType escape(StringType s)\n{\n    replace_substring(s, StringType{\"~\"}, StringType{\"~0\"});\n    replace_substring(s, StringType{\"/\"}, StringType{\"~1\"});\n    return s;\n}\n\n/*!\n * @brief string unescaping as described in RFC 6901 (Sect. 4)\n * @param[in] s string to unescape\n * @return    unescaped string\n *\n * Note the order of escaping \"~1\" to \"/\" and \"~0\" to \"~\" is important.\n */\ntemplate<typename StringType>\nstatic void unescape(StringType& s)\n{\n    replace_substring(s, StringType{\"~1\"}, StringType{\"/\"});\n    replace_substring(s, StringType{\"~0\"}, StringType{\"~\"});\n}\n\n}  // namespace detail\nNLOHMANN_JSON_NAMESPACE_END\n\n// #include <nlohmann/detail/input/position_t.hpp>\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\n\n\n#include <cstddef> // size_t\n\n// #include <nlohmann/detail/abi_macros.hpp>\n\n\nNLOHMANN_JSON_NAMESPACE_BEGIN\nnamespace detail\n{\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\nNLOHMANN_JSON_NAMESPACE_END\n\n// #include <nlohmann/detail/macro_scope.hpp>\n\n// #include <nlohmann/detail/meta/cpp_future.hpp>\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-FileCopyrightText: 2018 The Abseil Authors\n// SPDX-License-Identifier: MIT\n\n\n\n#include <array> // array\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#include <utility> // index_sequence, make_index_sequence, index_sequence_for\n\n// #include <nlohmann/detail/macro_scope.hpp>\n\n\nNLOHMANN_JSON_NAMESPACE_BEGIN\nnamespace detail\n{\n\ntemplate<typename T>\nusing uncvref_t = typename std::remove_cv<typename std::remove_reference<T>::type>::type;\n\n#ifdef JSON_HAS_CPP_14\n\n// the following utilities are natively available in C++14\nusing std::enable_if_t;\nusing std::index_sequence;\nusing std::make_index_sequence;\nusing std::index_sequence_for;\n\n#else\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\n// The following code is taken from https://github.com/abseil/abseil-cpp/blob/10cb35e459f5ecca5b2ff107635da0bfa41011b4/absl/utility/utility.h\n// which is part of Google Abseil (https://github.com/abseil/abseil-cpp), licensed under the Apache License 2.0.\n\n//// START OF CODE FROM GOOGLE ABSEIL\n\n// integer_sequence\n//\n// Class template representing a compile-time integer sequence. An instantiation\n// of `integer_sequence<T, Ints...>` has a sequence of integers encoded in its\n// type through its template arguments (which is a common need when\n// working with C++11 variadic templates). `absl::integer_sequence` is designed\n// to be a drop-in replacement for C++14's `std::integer_sequence`.\n//\n// Example:\n//\n//   template< class T, T... Ints >\n//   void user_function(integer_sequence<T, Ints...>);\n//\n//   int main()\n//   {\n//     // user_function's `T` will be deduced to `int` and `Ints...`\n//     // will be deduced to `0, 1, 2, 3, 4`.\n//     user_function(make_integer_sequence<int, 5>());\n//   }\ntemplate <typename T, T... Ints>\nstruct integer_sequence\n{\n    using value_type = T;\n    static constexpr std::size_t size() noexcept\n    {\n        return sizeof...(Ints);\n    }\n};\n\n// index_sequence\n//\n// A helper template for an `integer_sequence` of `size_t`,\n// `absl::index_sequence` is designed to be a drop-in replacement for C++14's\n// `std::index_sequence`.\ntemplate <size_t... Ints>\nusing index_sequence = integer_sequence<size_t, Ints...>;\n\nnamespace utility_internal\n{\n\ntemplate <typename Seq, size_t SeqSize, size_t Rem>\nstruct Extend;\n\n// Note that SeqSize == sizeof...(Ints). It's passed explicitly for efficiency.\ntemplate <typename T, T... Ints, size_t SeqSize>\nstruct Extend<integer_sequence<T, Ints...>, SeqSize, 0>\n{\n    using type = integer_sequence < T, Ints..., (Ints + SeqSize)... >;\n};\n\ntemplate <typename T, T... Ints, size_t SeqSize>\nstruct Extend<integer_sequence<T, Ints...>, SeqSize, 1>\n{\n    using type = integer_sequence < T, Ints..., (Ints + SeqSize)..., 2 * SeqSize >;\n};\n\n// Recursion helper for 'make_integer_sequence<T, N>'.\n// 'Gen<T, N>::type' is an alias for 'integer_sequence<T, 0, 1, ... N-1>'.\ntemplate <typename T, size_t N>\nstruct Gen\n{\n    using type =\n        typename Extend < typename Gen < T, N / 2 >::type, N / 2, N % 2 >::type;\n};\n\ntemplate <typename T>\nstruct Gen<T, 0>\n{\n    using type = integer_sequence<T>;\n};\n\n}  // namespace utility_internal\n\n// Compile-time sequences of integers\n\n// make_integer_sequence\n//\n// This template alias is equivalent to\n// `integer_sequence<int, 0, 1, ..., N-1>`, and is designed to be a drop-in\n// replacement for C++14's `std::make_integer_sequence`.\ntemplate <typename T, T N>\nusing make_integer_sequence = typename utility_internal::Gen<T, N>::type;\n\n// make_index_sequence\n//\n// This template alias is equivalent to `index_sequence<0, 1, ..., N-1>`,\n// and is designed to be a drop-in replacement for C++14's\n// `std::make_index_sequence`.\ntemplate <size_t N>\nusing make_index_sequence = make_integer_sequence<size_t, N>;\n\n// index_sequence_for\n//\n// Converts a typename pack into an index sequence of the same length, and\n// is designed to be a drop-in replacement for C++14's\n// `std::index_sequence_for()`\ntemplate <typename... Ts>\nusing index_sequence_for = make_index_sequence<sizeof...(Ts)>;\n\n//// END OF CODE FROM GOOGLE ABSEIL\n\n#endif\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 JSON_INLINE_VARIABLE constexpr T value{};\n};\n\n#ifndef JSON_HAS_CPP_17\n    template<typename T>\n    constexpr T static_const<T>::value;\n#endif\n\ntemplate<typename T, typename... Args>\ninline constexpr std::array<T, sizeof...(Args)> make_array(Args&& ... args)\n{\n    return std::array<T, sizeof...(Args)> {{static_cast<T>(std::forward<Args>(args))...}};\n}\n\n}  // namespace detail\nNLOHMANN_JSON_NAMESPACE_END\n\n// #include <nlohmann/detail/meta/type_traits.hpp>\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\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#include <tuple> // tuple\n#include <string> // char_traits\n\n// #include <nlohmann/detail/iterators/iterator_traits.hpp>\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\n\n\n#include <iterator> // random_access_iterator_tag\n\n// #include <nlohmann/detail/abi_macros.hpp>\n\n// #include <nlohmann/detail/meta/void_t.hpp>\n\n// #include <nlohmann/detail/meta/cpp_future.hpp>\n\n\nNLOHMANN_JSON_NAMESPACE_BEGIN\nnamespace detail\n{\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\n}  // namespace detail\nNLOHMANN_JSON_NAMESPACE_END\n\n// #include <nlohmann/detail/macro_scope.hpp>\n\n// #include <nlohmann/detail/meta/call_std/begin.hpp>\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\n\n\n// #include <nlohmann/detail/macro_scope.hpp>\n\n\nNLOHMANN_JSON_NAMESPACE_BEGIN\n\nNLOHMANN_CAN_CALL_STD_FUNC_IMPL(begin);\n\nNLOHMANN_JSON_NAMESPACE_END\n\n// #include <nlohmann/detail/meta/call_std/end.hpp>\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\n\n\n// #include <nlohmann/detail/macro_scope.hpp>\n\n\nNLOHMANN_JSON_NAMESPACE_BEGIN\n\nNLOHMANN_CAN_CALL_STD_FUNC_IMPL(end);\n\nNLOHMANN_JSON_NAMESPACE_END\n\n// #include <nlohmann/detail/meta/cpp_future.hpp>\n\n// #include <nlohmann/detail/meta/detected.hpp>\n\n// #include <nlohmann/json_fwd.hpp>\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\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    // #include <nlohmann/detail/abi_macros.hpp>\n\n\n    /*!\n    @brief namespace for Niels Lohmann\n    @see https://github.com/nlohmann\n    @since version 1.0.0\n    */\n    NLOHMANN_JSON_NAMESPACE_BEGIN\n\n    /*!\n    @brief default JSONSerializer template argument\n\n    This serializer ignores the template arguments and uses ADL\n    ([argument-dependent lookup](https://en.cppreference.com/w/cpp/language/adl))\n    for serialization.\n    */\n    template<typename T = void, typename SFINAE = void>\n    struct adl_serializer;\n\n    /// a class to store JSON values\n    /// @sa https://json.nlohmann.me/api/basic_json/\n    template<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>, // cppcheck-suppress syntaxError\n    class CustomBaseClass = void>\n    class basic_json;\n\n    /// @brief JSON Pointer defines a string syntax for identifying a specific value within a JSON document\n    /// @sa https://json.nlohmann.me/api/json_pointer/\n    template<typename RefStringType>\n    class json_pointer;\n\n    /*!\n    @brief default specialization\n    @sa https://json.nlohmann.me/api/json/\n    */\n    using json = basic_json<>;\n\n    /// @brief a minimal map-like container that preserves insertion order\n    /// @sa https://json.nlohmann.me/api/ordered_map/\n    template<class Key, class T, class IgnoredLess, class Allocator>\n    struct ordered_map;\n\n    /// @brief specialization that maintains the insertion order of object keys\n    /// @sa https://json.nlohmann.me/api/ordered_json/\n    using ordered_json = basic_json<nlohmann::ordered_map>;\n\n    NLOHMANN_JSON_NAMESPACE_END\n\n#endif  // INCLUDE_NLOHMANN_JSON_FWD_HPP_\n\n\nNLOHMANN_JSON_NAMESPACE_BEGIN\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/////////////\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// used by exceptions create() member functions\n// true_type for pointer to possibly cv-qualified basic_json or std::nullptr_t\n// false_type otherwise\ntemplate<typename BasicJsonContext>\nstruct is_basic_json_context :\n    std::integral_constant < bool,\n    is_basic_json<typename std::remove_cv<typename std::remove_pointer<BasicJsonContext>::type>::type>::value\n    || std::is_same<BasicJsonContext, std::nullptr_t>::value >\n{};\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, 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, 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\ntemplate<typename T>\nusing detect_key_compare = typename T::key_compare;\n\ntemplate<typename T>\nstruct has_key_compare : std::integral_constant<bool, is_detected<detect_key_compare, T>::value> {};\n\n// obtains the actual object key comparator\ntemplate<typename BasicJsonType>\nstruct actual_object_comparator\n{\n    using object_t = typename BasicJsonType::object_t;\n    using object_comparator_t = typename BasicJsonType::default_object_comparator_t;\n    using type = typename std::conditional < has_key_compare<object_t>::value,\n          typename object_t::key_compare, object_comparator_t>::type;\n};\n\ntemplate<typename BasicJsonType>\nusing actual_object_comparator_t = typename actual_object_comparator<BasicJsonType>::type;\n\n/////////////////\n// char_traits //\n/////////////////\n\n// Primary template of char_traits calls std char_traits\ntemplate<typename T>\nstruct char_traits : std::char_traits<T>\n{};\n\n// Explicitly define char traits for unsigned char since it is not standard\ntemplate<>\nstruct char_traits<unsigned char> : std::char_traits<char>\n{\n    using char_type = unsigned char;\n    using int_type = uint64_t;\n\n    // Redefine to_int_type function\n    static int_type to_int_type(char_type c) noexcept\n    {\n        return static_cast<int_type>(c);\n    }\n\n    static char_type to_char_type(int_type i) noexcept\n    {\n        return static_cast<char_type>(i);\n    }\n\n    static constexpr int_type eof() noexcept\n    {\n        return static_cast<int_type>(EOF);\n    }\n};\n\n// Explicitly define char traits for signed char since it is not standard\ntemplate<>\nstruct char_traits<signed char> : std::char_traits<char>\n{\n    using char_type = signed char;\n    using int_type = uint64_t;\n\n    // Redefine to_int_type function\n    static int_type to_int_type(char_type c) noexcept\n    {\n        return static_cast<int_type>(c);\n    }\n\n    static char_type to_char_type(int_type i) noexcept\n    {\n        return static_cast<char_type>(i);\n    }\n\n    static constexpr int_type eof() noexcept\n    {\n        return static_cast<int_type>(EOF);\n    }\n};\n\n///////////////////\n// is_ functions //\n///////////////////\n\n// https://en.cppreference.com/w/cpp/types/conjunction\ntemplate<class...> struct conjunction : std::true_type { };\ntemplate<class B> struct conjunction<B> : B { };\ntemplate<class B, class... Bn>\nstruct conjunction<B, Bn...>\n: std::conditional<static_cast<bool>(B::value), conjunction<Bn...>, B>::type {};\n\n// https://en.cppreference.com/w/cpp/types/negation\ntemplate<class B> struct negation : std::integral_constant < bool, !B::value > { };\n\n// Reimplementation of is_constructible and is_default_constructible, due to them being broken for\n// std::pair and std::tuple until LWG 2367 fix (see https://cplusplus.github.io/LWG/lwg-defects.html#2367).\n// This causes compile errors in e.g. clang 3.5 or gcc 4.9.\ntemplate <typename T>\nstruct is_default_constructible : std::is_default_constructible<T> {};\n\ntemplate <typename T1, typename T2>\nstruct is_default_constructible<std::pair<T1, T2>>\n            : conjunction<is_default_constructible<T1>, is_default_constructible<T2>> {};\n\ntemplate <typename T1, typename T2>\nstruct is_default_constructible<const std::pair<T1, T2>>\n            : conjunction<is_default_constructible<T1>, is_default_constructible<T2>> {};\n\ntemplate <typename... Ts>\nstruct is_default_constructible<std::tuple<Ts...>>\n            : conjunction<is_default_constructible<Ts>...> {};\n\ntemplate <typename... Ts>\nstruct is_default_constructible<const std::tuple<Ts...>>\n            : conjunction<is_default_constructible<Ts>...> {};\n\ntemplate <typename T, typename... Args>\nstruct is_constructible : std::is_constructible<T, Args...> {};\n\ntemplate <typename T1, typename T2>\nstruct is_constructible<std::pair<T1, T2>> : is_default_constructible<std::pair<T1, T2>> {};\n\ntemplate <typename T1, typename T2>\nstruct is_constructible<const std::pair<T1, T2>> : is_default_constructible<const std::pair<T1, T2>> {};\n\ntemplate <typename... Ts>\nstruct is_constructible<std::tuple<Ts...>> : is_default_constructible<std::tuple<Ts...>> {};\n\ntemplate <typename... Ts>\nstruct is_constructible<const std::tuple<Ts...>> : is_default_constructible<const std::tuple<Ts...>> {};\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\ntemplate<typename T>\nstruct is_range\n{\n  private:\n    using t_ref = typename std::add_lvalue_reference<T>::type;\n\n    using iterator = detected_t<result_of_begin, t_ref>;\n    using sentinel = detected_t<result_of_end, t_ref>;\n\n    // to be 100% correct, it should use https://en.cppreference.com/w/cpp/iterator/input_or_output_iterator\n    // and https://en.cppreference.com/w/cpp/iterator/sentinel_for\n    // but reimplementing these would be too much work, as a lot of other concepts are used underneath\n    static constexpr auto is_iterator_begin =\n        is_iterator_traits<iterator_traits<iterator>>::value;\n\n  public:\n    static constexpr bool value = !std::is_same<iterator, nonesuch>::value && !std::is_same<sentinel, nonesuch>::value && is_iterator_begin;\n};\n\ntemplate<typename R>\nusing iterator_t = enable_if_t<is_range<R>::value, result_of_begin<decltype(std::declval<R&>())>>;\n\ntemplate<typename T>\nusing range_value_t = value_type_t<iterator_traits<iterator_t<T>>>;\n\n// The following implementation of is_complete_type is taken from\n// https://blogs.msdn.microsoft.com/vcblog/2015/12/02/partial-support-for-expression-sfinae-in-vs-2015-update-1/\n// and is written by Xiang Fan who agreed to using it in this library.\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    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        is_constructible<typename object_t::key_type,\n        typename CompatibleObjectType::key_type>::value &&\n        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        (is_default_constructible<ConstructibleObjectType>::value &&\n         (std::is_move_assignable<ConstructibleObjectType>::value ||\n          std::is_copy_assignable<ConstructibleObjectType>::value) &&\n         (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>\nstruct is_compatible_string_type\n{\n    static constexpr auto value =\n        is_constructible<typename BasicJsonType::string_t, CompatibleStringType>::value;\n};\n\ntemplate<typename BasicJsonType, typename ConstructibleStringType>\nstruct is_constructible_string_type\n{\n    // launder type through decltype() to fix compilation failure on ICPC\n#ifdef __INTEL_COMPILER\n    using laundered_type = decltype(std::declval<ConstructibleStringType>());\n#else\n    using laundered_type = ConstructibleStringType;\n#endif\n\n    static constexpr auto value =\n        conjunction <\n        is_constructible<laundered_type, typename BasicJsonType::string_t>,\n        is_detected_exact<typename BasicJsonType::string_t::value_type,\n        value_type_t, laundered_type >>::value;\n};\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 <\n    is_detected<iterator_t, CompatibleArrayType>::value&&\n    is_iterator_traits<iterator_traits<detected_t<iterator_t, CompatibleArrayType>>>::value&&\n// special case for types like std::filesystem::path whose iterator's value_type are themselves\n// c.f. https://github.com/nlohmann/json/pull/3073\n    !std::is_same<CompatibleArrayType, detected_t<range_value_t, CompatibleArrayType>>::value >>\n{\n    static constexpr bool value =\n        is_constructible<BasicJsonType,\n        range_value_t<CompatibleArrayType>>::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    !is_compatible_string_type<BasicJsonType, ConstructibleArrayType>::value&&\n    is_default_constructible<ConstructibleArrayType>::value&&\n(std::is_move_assignable<ConstructibleArrayType>::value ||\n std::is_copy_assignable<ConstructibleArrayType>::value)&&\nis_detected<iterator_t, ConstructibleArrayType>::value&&\nis_iterator_traits<iterator_traits<detected_t<iterator_t, ConstructibleArrayType>>>::value&&\nis_detected<range_value_t, ConstructibleArrayType>::value&&\n// special case for types like std::filesystem::path whose iterator's value_type are themselves\n// c.f. https://github.com/nlohmann/json/pull/3073\n!std::is_same<ConstructibleArrayType, detected_t<range_value_t, ConstructibleArrayType>>::value&&\n        is_complete_type <\n        detected_t<range_value_t, ConstructibleArrayType >>::value >>\n{\n    using value_type = range_value_t<ConstructibleArrayType>;\n\n    static constexpr bool value =\n        std::is_same<value_type,\n        typename BasicJsonType::array_t::value_type>::value ||\n        has_from_json<BasicJsonType,\n        value_type>::value ||\n        has_non_default_from_json <\n        BasicJsonType,\n        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        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\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<is_constructible<T1, Args>...> {};\n\ntemplate<typename BasicJsonType, typename T>\nstruct is_json_iterator_of : std::false_type {};\n\ntemplate<typename BasicJsonType>\nstruct is_json_iterator_of<BasicJsonType, typename BasicJsonType::iterator> : std::true_type {};\n\ntemplate<typename BasicJsonType>\nstruct is_json_iterator_of<BasicJsonType, typename BasicJsonType::const_iterator> : std::true_type\n{};\n\n// checks if a given type T is a template specialization of Primary\ntemplate<template <typename...> class Primary, typename T>\nstruct is_specialization_of : std::false_type {};\n\ntemplate<template <typename...> class Primary, typename... Args>\nstruct is_specialization_of<Primary, Primary<Args...>> : std::true_type {};\n\ntemplate<typename T>\nusing is_json_pointer = is_specialization_of<::nlohmann::json_pointer, uncvref_t<T>>;\n\n// checks if A and B are comparable using Compare functor\ntemplate<typename Compare, typename A, typename B, typename = void>\nstruct is_comparable : std::false_type {};\n\ntemplate<typename Compare, typename A, typename B>\nstruct is_comparable<Compare, A, B, void_t<\ndecltype(std::declval<Compare>()(std::declval<A>(), std::declval<B>())),\ndecltype(std::declval<Compare>()(std::declval<B>(), std::declval<A>()))\n>> : std::true_type {};\n\ntemplate<typename T>\nusing detect_is_transparent = typename T::is_transparent;\n\n// type trait to check if KeyType can be used as object key (without a BasicJsonType)\n// see is_usable_as_basic_json_key_type below\ntemplate<typename Comparator, typename ObjectKeyType, typename KeyTypeCVRef, bool RequireTransparentComparator = true,\n         bool ExcludeObjectKeyType = RequireTransparentComparator, typename KeyType = uncvref_t<KeyTypeCVRef>>\nusing is_usable_as_key_type = typename std::conditional <\n                              is_comparable<Comparator, ObjectKeyType, KeyTypeCVRef>::value\n                              && !(ExcludeObjectKeyType && std::is_same<KeyType,\n                                   ObjectKeyType>::value)\n                              && (!RequireTransparentComparator\n                                  || is_detected <detect_is_transparent, Comparator>::value)\n                              && !is_json_pointer<KeyType>::value,\n                              std::true_type,\n                              std::false_type >::type;\n\n// type trait to check if KeyType can be used as object key\n// true if:\n//   - KeyType is comparable with BasicJsonType::object_t::key_type\n//   - if ExcludeObjectKeyType is true, KeyType is not BasicJsonType::object_t::key_type\n//   - the comparator is transparent or RequireTransparentComparator is false\n//   - KeyType is not a JSON iterator or json_pointer\ntemplate<typename BasicJsonType, typename KeyTypeCVRef, bool RequireTransparentComparator = true,\n         bool ExcludeObjectKeyType = RequireTransparentComparator, typename KeyType = uncvref_t<KeyTypeCVRef>>\nusing is_usable_as_basic_json_key_type = typename std::conditional <\n        is_usable_as_key_type<typename BasicJsonType::object_comparator_t,\n        typename BasicJsonType::object_t::key_type, KeyTypeCVRef,\n        RequireTransparentComparator, ExcludeObjectKeyType>::value\n        && !is_json_iterator_of<BasicJsonType, KeyType>::value,\n        std::true_type,\n        std::false_type >::type;\n\ntemplate<typename ObjectType, typename KeyType>\nusing detect_erase_with_key_type = decltype(std::declval<ObjectType&>().erase(std::declval<KeyType>()));\n\n// type trait to check if object_t has an erase() member functions accepting KeyType\ntemplate<typename BasicJsonType, typename KeyType>\nusing has_erase_with_key_type = typename std::conditional <\n                                is_detected <\n                                detect_erase_with_key_type,\n                                typename BasicJsonType::object_t, KeyType >::value,\n                                std::true_type,\n                                std::false_type >::type;\n\n// a naive helper to check if a type is an ordered_map (exploits the fact that\n// ordered_map inherits capacity() from std::vector)\ntemplate <typename T>\nstruct is_ordered_map\n{\n    using one = char;\n\n    struct two\n    {\n        char x[2]; // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)\n    };\n\n    template <typename C> static one test( decltype(&C::capacity) ) ;\n    template <typename C> static two test(...);\n\n    enum { value = sizeof(test<T>(nullptr)) == sizeof(char) }; // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg)\n};\n\n// to avoid useless casts (see https://github.com/nlohmann/json/issues/2893#issuecomment-889152324)\ntemplate < typename T, typename U, enable_if_t < !std::is_same<T, U>::value, int > = 0 >\nT conditional_static_cast(U value)\n{\n    return static_cast<T>(value);\n}\n\ntemplate<typename T, typename U, enable_if_t<std::is_same<T, U>::value, int> = 0>\nT conditional_static_cast(U value)\n{\n    return value;\n}\n\ntemplate<typename... Types>\nusing all_integral = conjunction<std::is_integral<Types>...>;\n\ntemplate<typename... Types>\nusing all_signed = conjunction<std::is_signed<Types>...>;\n\ntemplate<typename... Types>\nusing all_unsigned = conjunction<std::is_unsigned<Types>...>;\n\n// there's a disjunction trait in another PR; replace when merged\ntemplate<typename... Types>\nusing same_sign = std::integral_constant < bool,\n      all_signed<Types...>::value || all_unsigned<Types...>::value >;\n\ntemplate<typename OfType, typename T>\nusing never_out_of_range = std::integral_constant < bool,\n      (std::is_signed<OfType>::value && (sizeof(T) < sizeof(OfType)))\n      || (same_sign<OfType, T>::value && sizeof(OfType) == sizeof(T)) >;\n\ntemplate<typename OfType, typename T,\n         bool OfTypeSigned = std::is_signed<OfType>::value,\n         bool TSigned = std::is_signed<T>::value>\nstruct value_in_range_of_impl2;\n\ntemplate<typename OfType, typename T>\nstruct value_in_range_of_impl2<OfType, T, false, false>\n{\n    static constexpr bool test(T val)\n    {\n        using CommonType = typename std::common_type<OfType, T>::type;\n        return static_cast<CommonType>(val) <= static_cast<CommonType>((std::numeric_limits<OfType>::max)());\n    }\n};\n\ntemplate<typename OfType, typename T>\nstruct value_in_range_of_impl2<OfType, T, true, false>\n{\n    static constexpr bool test(T val)\n    {\n        using CommonType = typename std::common_type<OfType, T>::type;\n        return static_cast<CommonType>(val) <= static_cast<CommonType>((std::numeric_limits<OfType>::max)());\n    }\n};\n\ntemplate<typename OfType, typename T>\nstruct value_in_range_of_impl2<OfType, T, false, true>\n{\n    static constexpr bool test(T val)\n    {\n        using CommonType = typename std::common_type<OfType, T>::type;\n        return val >= 0 && static_cast<CommonType>(val) <= static_cast<CommonType>((std::numeric_limits<OfType>::max)());\n    }\n};\n\ntemplate<typename OfType, typename T>\nstruct value_in_range_of_impl2<OfType, T, true, true>\n{\n    static constexpr bool test(T val)\n    {\n        using CommonType = typename std::common_type<OfType, T>::type;\n        return static_cast<CommonType>(val) >= static_cast<CommonType>((std::numeric_limits<OfType>::min)())\n               && static_cast<CommonType>(val) <= static_cast<CommonType>((std::numeric_limits<OfType>::max)());\n    }\n};\n\ntemplate<typename OfType, typename T,\n         bool NeverOutOfRange = never_out_of_range<OfType, T>::value,\n         typename = detail::enable_if_t<all_integral<OfType, T>::value>>\nstruct value_in_range_of_impl1;\n\ntemplate<typename OfType, typename T>\nstruct value_in_range_of_impl1<OfType, T, false>\n{\n    static constexpr bool test(T val)\n    {\n        return value_in_range_of_impl2<OfType, T>::test(val);\n    }\n};\n\ntemplate<typename OfType, typename T>\nstruct value_in_range_of_impl1<OfType, T, true>\n{\n    static constexpr bool test(T /*val*/)\n    {\n        return true;\n    }\n};\n\ntemplate<typename OfType, typename T>\ninline constexpr bool value_in_range_of(T val)\n{\n    return value_in_range_of_impl1<OfType, T>::test(val);\n}\n\ntemplate<bool Value>\nusing bool_constant = std::integral_constant<bool, Value>;\n\n///////////////////////////////////////////////////////////////////////////////\n// is_c_string\n///////////////////////////////////////////////////////////////////////////////\n\nnamespace impl\n{\n\ntemplate<typename T>\ninline constexpr bool is_c_string()\n{\n    using TUnExt = typename std::remove_extent<T>::type;\n    using TUnCVExt = typename std::remove_cv<TUnExt>::type;\n    using TUnPtr = typename std::remove_pointer<T>::type;\n    using TUnCVPtr = typename std::remove_cv<TUnPtr>::type;\n    return\n        (std::is_array<T>::value && std::is_same<TUnCVExt, char>::value)\n        || (std::is_pointer<T>::value && std::is_same<TUnCVPtr, char>::value);\n}\n\n}  // namespace impl\n\n// checks whether T is a [cv] char */[cv] char[] C string\ntemplate<typename T>\nstruct is_c_string : bool_constant<impl::is_c_string<T>()> {};\n\ntemplate<typename T>\nusing is_c_string_uncvref = is_c_string<uncvref_t<T>>;\n\n///////////////////////////////////////////////////////////////////////////////\n// is_transparent\n///////////////////////////////////////////////////////////////////////////////\n\nnamespace impl\n{\n\ntemplate<typename T>\ninline constexpr bool is_transparent()\n{\n    return is_detected<detect_is_transparent, T>::value;\n}\n\n}  // namespace impl\n\n// checks whether T has a member named is_transparent\ntemplate<typename T>\nstruct is_transparent : bool_constant<impl::is_transparent<T>()> {};\n\n///////////////////////////////////////////////////////////////////////////////\n\n}  // namespace detail\nNLOHMANN_JSON_NAMESPACE_END\n\n// #include <nlohmann/detail/string_concat.hpp>\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\n\n\n#include <cstring> // strlen\n#include <string> // string\n#include <utility> // forward\n\n// #include <nlohmann/detail/meta/cpp_future.hpp>\n\n// #include <nlohmann/detail/meta/detected.hpp>\n\n\nNLOHMANN_JSON_NAMESPACE_BEGIN\nnamespace detail\n{\n\ninline std::size_t concat_length()\n{\n    return 0;\n}\n\ntemplate<typename... Args>\ninline std::size_t concat_length(const char* cstr, const Args& ... rest);\n\ntemplate<typename StringType, typename... Args>\ninline std::size_t concat_length(const StringType& str, const Args& ... rest);\n\ntemplate<typename... Args>\ninline std::size_t concat_length(const char /*c*/, const Args& ... rest)\n{\n    return 1 + concat_length(rest...);\n}\n\ntemplate<typename... Args>\ninline std::size_t concat_length(const char* cstr, const Args& ... rest)\n{\n    // cppcheck-suppress ignoredReturnValue\n    return ::strlen(cstr) + concat_length(rest...);\n}\n\ntemplate<typename StringType, typename... Args>\ninline std::size_t concat_length(const StringType& str, const Args& ... rest)\n{\n    return str.size() + concat_length(rest...);\n}\n\ntemplate<typename OutStringType>\ninline void concat_into(OutStringType& /*out*/)\n{}\n\ntemplate<typename StringType, typename Arg>\nusing string_can_append = decltype(std::declval<StringType&>().append(std::declval < Arg && > ()));\n\ntemplate<typename StringType, typename Arg>\nusing detect_string_can_append = is_detected<string_can_append, StringType, Arg>;\n\ntemplate<typename StringType, typename Arg>\nusing string_can_append_op = decltype(std::declval<StringType&>() += std::declval < Arg && > ());\n\ntemplate<typename StringType, typename Arg>\nusing detect_string_can_append_op = is_detected<string_can_append_op, StringType, Arg>;\n\ntemplate<typename StringType, typename Arg>\nusing string_can_append_iter = decltype(std::declval<StringType&>().append(std::declval<const Arg&>().begin(), std::declval<const Arg&>().end()));\n\ntemplate<typename StringType, typename Arg>\nusing detect_string_can_append_iter = is_detected<string_can_append_iter, StringType, Arg>;\n\ntemplate<typename StringType, typename Arg>\nusing string_can_append_data = decltype(std::declval<StringType&>().append(std::declval<const Arg&>().data(), std::declval<const Arg&>().size()));\n\ntemplate<typename StringType, typename Arg>\nusing detect_string_can_append_data = is_detected<string_can_append_data, StringType, Arg>;\n\ntemplate < typename OutStringType, typename Arg, typename... Args,\n           enable_if_t < !detect_string_can_append<OutStringType, Arg>::value\n                         && detect_string_can_append_op<OutStringType, Arg>::value, int > = 0 >\ninline void concat_into(OutStringType& out, Arg && arg, Args && ... rest);\n\ntemplate < typename OutStringType, typename Arg, typename... Args,\n           enable_if_t < !detect_string_can_append<OutStringType, Arg>::value\n                         && !detect_string_can_append_op<OutStringType, Arg>::value\n                         && detect_string_can_append_iter<OutStringType, Arg>::value, int > = 0 >\ninline void concat_into(OutStringType& out, const Arg& arg, Args && ... rest);\n\ntemplate < typename OutStringType, typename Arg, typename... Args,\n           enable_if_t < !detect_string_can_append<OutStringType, Arg>::value\n                         && !detect_string_can_append_op<OutStringType, Arg>::value\n                         && !detect_string_can_append_iter<OutStringType, Arg>::value\n                         && detect_string_can_append_data<OutStringType, Arg>::value, int > = 0 >\ninline void concat_into(OutStringType& out, const Arg& arg, Args && ... rest);\n\ntemplate<typename OutStringType, typename Arg, typename... Args,\n         enable_if_t<detect_string_can_append<OutStringType, Arg>::value, int> = 0>\ninline void concat_into(OutStringType& out, Arg && arg, Args && ... rest)\n{\n    out.append(std::forward<Arg>(arg));\n    concat_into(out, std::forward<Args>(rest)...);\n}\n\ntemplate < typename OutStringType, typename Arg, typename... Args,\n           enable_if_t < !detect_string_can_append<OutStringType, Arg>::value\n                         && detect_string_can_append_op<OutStringType, Arg>::value, int > >\ninline void concat_into(OutStringType& out, Arg&& arg, Args&& ... rest)\n{\n    out += std::forward<Arg>(arg);\n    concat_into(out, std::forward<Args>(rest)...);\n}\n\ntemplate < typename OutStringType, typename Arg, typename... Args,\n           enable_if_t < !detect_string_can_append<OutStringType, Arg>::value\n                         && !detect_string_can_append_op<OutStringType, Arg>::value\n                         && detect_string_can_append_iter<OutStringType, Arg>::value, int > >\ninline void concat_into(OutStringType& out, const Arg& arg, Args&& ... rest)\n{\n    out.append(arg.begin(), arg.end());\n    concat_into(out, std::forward<Args>(rest)...);\n}\n\ntemplate < typename OutStringType, typename Arg, typename... Args,\n           enable_if_t < !detect_string_can_append<OutStringType, Arg>::value\n                         && !detect_string_can_append_op<OutStringType, Arg>::value\n                         && !detect_string_can_append_iter<OutStringType, Arg>::value\n                         && detect_string_can_append_data<OutStringType, Arg>::value, int > >\ninline void concat_into(OutStringType& out, const Arg& arg, Args&& ... rest)\n{\n    out.append(arg.data(), arg.size());\n    concat_into(out, std::forward<Args>(rest)...);\n}\n\ntemplate<typename OutStringType = std::string, typename... Args>\ninline OutStringType concat(Args && ... args)\n{\n    OutStringType str;\n    str.reserve(concat_length(args...));\n    concat_into(str, std::forward<Args>(args)...);\n    return str;\n}\n\n}  // namespace detail\nNLOHMANN_JSON_NAMESPACE_END\n\n\nNLOHMANN_JSON_NAMESPACE_BEGIN\nnamespace detail\n{\n\n////////////////\n// exceptions //\n////////////////\n\n/// @brief general exception of the @ref basic_json class\n/// @sa https://json.nlohmann.me/api/basic_json/exception/\nclass exception : public std::exception\n{\n  public:\n    /// returns the explanatory string\n    const char* what() const noexcept override\n    {\n        return m.what();\n    }\n\n    /// the id of the exception\n    const int id; // NOLINT(cppcoreguidelines-non-private-member-variables-in-classes)\n\n  protected:\n    JSON_HEDLEY_NON_NULL(3)\n    exception(int id_, const char* what_arg) : id(id_), m(what_arg) {} // NOLINT(bugprone-throw-keyword-missing)\n\n    static std::string name(const std::string& ename, int id_)\n    {\n        return concat(\"[json.exception.\", ename, '.', std::to_string(id_), \"] \");\n    }\n\n    static std::string diagnostics(std::nullptr_t /*leaf_element*/)\n    {\n        return \"\";\n    }\n\n    template<typename BasicJsonType>\n    static std::string diagnostics(const BasicJsonType* leaf_element)\n    {\n#if JSON_DIAGNOSTICS\n        std::vector<std::string> tokens;\n        for (const auto* current = leaf_element; current != nullptr && current->m_parent != nullptr; current = current->m_parent)\n        {\n            switch (current->m_parent->type())\n            {\n                case value_t::array:\n                {\n                    for (std::size_t i = 0; i < current->m_parent->m_data.m_value.array->size(); ++i)\n                    {\n                        if (&current->m_parent->m_data.m_value.array->operator[](i) == current)\n                        {\n                            tokens.emplace_back(std::to_string(i));\n                            break;\n                        }\n                    }\n                    break;\n                }\n\n                case value_t::object:\n                {\n                    for (const auto& element : *current->m_parent->m_data.m_value.object)\n                    {\n                        if (&element.second == current)\n                        {\n                            tokens.emplace_back(element.first.c_str());\n                            break;\n                        }\n                    }\n                    break;\n                }\n\n                case value_t::null: // LCOV_EXCL_LINE\n                case value_t::string: // LCOV_EXCL_LINE\n                case value_t::boolean: // LCOV_EXCL_LINE\n                case value_t::number_integer: // LCOV_EXCL_LINE\n                case value_t::number_unsigned: // LCOV_EXCL_LINE\n                case value_t::number_float: // LCOV_EXCL_LINE\n                case value_t::binary: // LCOV_EXCL_LINE\n                case value_t::discarded: // LCOV_EXCL_LINE\n                default:   // LCOV_EXCL_LINE\n                    break; // LCOV_EXCL_LINE\n            }\n        }\n\n        if (tokens.empty())\n        {\n            return \"\";\n        }\n\n        auto str = std::accumulate(tokens.rbegin(), tokens.rend(), std::string{},\n                                   [](const std::string & a, const std::string & b)\n        {\n            return concat(a, '/', detail::escape(b));\n        });\n        return concat('(', str, \") \");\n#else\n        static_cast<void>(leaf_element);\n        return \"\";\n#endif\n    }\n\n  private:\n    /// an exception object as storage for error messages\n    std::runtime_error m;\n};\n\n/// @brief exception indicating a parse error\n/// @sa https://json.nlohmann.me/api/basic_json/parse_error/\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    template<typename BasicJsonContext, enable_if_t<is_basic_json_context<BasicJsonContext>::value, int> = 0>\n    static parse_error create(int id_, const position_t& pos, const std::string& what_arg, BasicJsonContext context)\n    {\n        const std::string w = concat(exception::name(\"parse_error\", id_), \"parse error\",\n                                     position_string(pos), \": \", exception::diagnostics(context), what_arg);\n        return {id_, pos.chars_read_total, w.c_str()};\n    }\n\n    template<typename BasicJsonContext, enable_if_t<is_basic_json_context<BasicJsonContext>::value, int> = 0>\n    static parse_error create(int id_, std::size_t byte_, const std::string& what_arg, BasicJsonContext context)\n    {\n        const std::string w = concat(exception::name(\"parse_error\", id_), \"parse error\",\n                                     (byte_ != 0 ? (concat(\" at byte \", std::to_string(byte_))) : \"\"),\n                                     \": \", exception::diagnostics(context), what_arg);\n        return {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 concat(\" at line \", std::to_string(pos.lines_read + 1),\n                      \", column \", std::to_string(pos.chars_read_current_line));\n    }\n};\n\n/// @brief exception indicating errors with iterators\n/// @sa https://json.nlohmann.me/api/basic_json/invalid_iterator/\nclass invalid_iterator : public exception\n{\n  public:\n    template<typename BasicJsonContext, enable_if_t<is_basic_json_context<BasicJsonContext>::value, int> = 0>\n    static invalid_iterator create(int id_, const std::string& what_arg, BasicJsonContext context)\n    {\n        const std::string w = concat(exception::name(\"invalid_iterator\", id_), exception::diagnostics(context), what_arg);\n        return {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/// @brief exception indicating executing a member function with a wrong type\n/// @sa https://json.nlohmann.me/api/basic_json/type_error/\nclass type_error : public exception\n{\n  public:\n    template<typename BasicJsonContext, enable_if_t<is_basic_json_context<BasicJsonContext>::value, int> = 0>\n    static type_error create(int id_, const std::string& what_arg, BasicJsonContext context)\n    {\n        const std::string w = concat(exception::name(\"type_error\", id_), exception::diagnostics(context), what_arg);\n        return {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/// @brief exception indicating access out of the defined range\n/// @sa https://json.nlohmann.me/api/basic_json/out_of_range/\nclass out_of_range : public exception\n{\n  public:\n    template<typename BasicJsonContext, enable_if_t<is_basic_json_context<BasicJsonContext>::value, int> = 0>\n    static out_of_range create(int id_, const std::string& what_arg, BasicJsonContext context)\n    {\n        const std::string w = concat(exception::name(\"out_of_range\", id_), exception::diagnostics(context), what_arg);\n        return {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/// @brief exception indicating other library errors\n/// @sa https://json.nlohmann.me/api/basic_json/other_error/\nclass other_error : public exception\n{\n  public:\n    template<typename BasicJsonContext, enable_if_t<is_basic_json_context<BasicJsonContext>::value, int> = 0>\n    static other_error create(int id_, const std::string& what_arg, BasicJsonContext context)\n    {\n        const std::string w = concat(exception::name(\"other_error\", id_), exception::diagnostics(context), what_arg);\n        return {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\n}  // namespace detail\nNLOHMANN_JSON_NAMESPACE_END\n\n// #include <nlohmann/detail/macro_scope.hpp>\n\n// #include <nlohmann/detail/meta/cpp_future.hpp>\n\n// #include <nlohmann/detail/meta/identity_tag.hpp>\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\n\n\n// #include <nlohmann/detail/abi_macros.hpp>\n\n\nNLOHMANN_JSON_NAMESPACE_BEGIN\nnamespace detail\n{\n\n// dispatching helper struct\ntemplate <class T> struct identity_tag {};\n\n}  // namespace detail\nNLOHMANN_JSON_NAMESPACE_END\n\n// #include <nlohmann/detail/meta/std_fs.hpp>\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\n\n\n// #include <nlohmann/detail/macro_scope.hpp>\n\n\n#if JSON_HAS_EXPERIMENTAL_FILESYSTEM\n#include <experimental/filesystem>\nNLOHMANN_JSON_NAMESPACE_BEGIN\nnamespace detail\n{\nnamespace std_fs = std::experimental::filesystem;\n}  // namespace detail\nNLOHMANN_JSON_NAMESPACE_END\n#elif JSON_HAS_FILESYSTEM\n#include <filesystem>\nNLOHMANN_JSON_NAMESPACE_BEGIN\nnamespace detail\n{\nnamespace std_fs = std::filesystem;\n}  // namespace detail\nNLOHMANN_JSON_NAMESPACE_END\n#endif\n\n// #include <nlohmann/detail/meta/type_traits.hpp>\n\n// #include <nlohmann/detail/string_concat.hpp>\n\n// #include <nlohmann/detail/value_t.hpp>\n\n\nNLOHMANN_JSON_NAMESPACE_BEGIN\nnamespace detail\n{\n\ntemplate<typename BasicJsonType>\ninline void 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, concat(\"type must be null, but is \", j.type_name()), &j));\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        case value_t::null:\n        case value_t::object:\n        case value_t::array:\n        case value_t::string:\n        case value_t::boolean:\n        case value_t::binary:\n        case value_t::discarded:\n        default:\n            JSON_THROW(type_error::create(302, concat(\"type must be number, but is \", j.type_name()), &j));\n    }\n}\n\ntemplate<typename BasicJsonType>\ninline void 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, concat(\"type must be boolean, but is \", j.type_name()), &j));\n    }\n    b = *j.template get_ptr<const typename BasicJsonType::boolean_t*>();\n}\n\ntemplate<typename BasicJsonType>\ninline void 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, concat(\"type must be string, but is \", j.type_name()), &j));\n    }\n    s = *j.template get_ptr<const typename BasicJsonType::string_t*>();\n}\n\ntemplate <\n    typename BasicJsonType, typename StringType,\n    enable_if_t <\n        std::is_assignable<StringType&, const typename BasicJsonType::string_t>::value\n        && is_detected_exact<typename BasicJsonType::string_t::value_type, value_type_t, StringType>::value\n        && !std::is_same<typename BasicJsonType::string_t, StringType>::value\n        && !is_json_ref<StringType>::value, int > = 0 >\ninline void from_json(const BasicJsonType& j, StringType& s)\n{\n    if (JSON_HEDLEY_UNLIKELY(!j.is_string()))\n    {\n        JSON_THROW(type_error::create(302, concat(\"type must be string, but is \", j.type_name()), &j));\n    }\n\n    s = *j.template get_ptr<const typename BasicJsonType::string_t*>();\n}\n\ntemplate<typename BasicJsonType>\ninline void from_json(const BasicJsonType& j, typename BasicJsonType::number_float_t& val)\n{\n    get_arithmetic_value(j, val);\n}\n\ntemplate<typename BasicJsonType>\ninline void from_json(const BasicJsonType& j, typename BasicJsonType::number_unsigned_t& val)\n{\n    get_arithmetic_value(j, val);\n}\n\ntemplate<typename BasicJsonType>\ninline void from_json(const BasicJsonType& j, typename BasicJsonType::number_integer_t& val)\n{\n    get_arithmetic_value(j, val);\n}\n\n#if !JSON_DISABLE_ENUM_SERIALIZATION\ntemplate<typename BasicJsonType, typename EnumType,\n         enable_if_t<std::is_enum<EnumType>::value, int> = 0>\ninline void 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#endif  // JSON_DISABLE_ENUM_SERIALIZATION\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>\ninline void 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, concat(\"type must be array, but is \", j.type_name()), &j));\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>\ninline void 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, concat(\"type must be array, but is \", j.type_name()), &j));\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])  // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)\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>\ninline void 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,\n         enable_if_t<\n             std::is_assignable<ConstructibleArrayType&, ConstructibleArrayType>::value,\n             int> = 0>\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,\n         enable_if_t<\n             std::is_assignable<ConstructibleArrayType&, ConstructibleArrayType>::value,\n             int> = 0>\ninline void 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, concat(\"type must be array, but is \", j.type_name()), &j));\n    }\n\n    from_json_array_impl(j, arr, priority_tag<3> {});\n}\n\ntemplate < typename BasicJsonType, typename T, std::size_t... Idx >\nstd::array<T, sizeof...(Idx)> from_json_inplace_array_impl(BasicJsonType&& j,\n        identity_tag<std::array<T, sizeof...(Idx)>> /*unused*/, index_sequence<Idx...> /*unused*/)\n{\n    return { { std::forward<BasicJsonType>(j).at(Idx).template get<T>()... } };\n}\n\ntemplate < typename BasicJsonType, typename T, std::size_t N >\nauto from_json(BasicJsonType&& j, identity_tag<std::array<T, N>> tag)\n-> decltype(from_json_inplace_array_impl(std::forward<BasicJsonType>(j), tag, make_index_sequence<N> {}))\n{\n    if (JSON_HEDLEY_UNLIKELY(!j.is_array()))\n    {\n        JSON_THROW(type_error::create(302, concat(\"type must be array, but is \", j.type_name()), &j));\n    }\n\n    return from_json_inplace_array_impl(std::forward<BasicJsonType>(j), tag, make_index_sequence<N> {});\n}\n\ntemplate<typename BasicJsonType>\ninline void 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, concat(\"type must be binary, but is \", j.type_name()), &j));\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>\ninline void from_json(const BasicJsonType& j, ConstructibleObjectType& obj)\n{\n    if (JSON_HEDLEY_UNLIKELY(!j.is_object()))\n    {\n        JSON_THROW(type_error::create(302, concat(\"type must be object, but is \", j.type_name()), &j));\n    }\n\n    ConstructibleObjectType ret;\n    const 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 >\ninline void 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        case value_t::null:\n        case value_t::object:\n        case value_t::array:\n        case value_t::string:\n        case value_t::binary:\n        case value_t::discarded:\n        default:\n            JSON_THROW(type_error::create(302, concat(\"type must be number, but is \", j.type_name()), &j));\n    }\n}\n\ntemplate<typename BasicJsonType, typename... Args, std::size_t... Idx>\nstd::tuple<Args...> from_json_tuple_impl_base(BasicJsonType&& j, index_sequence<Idx...> /*unused*/)\n{\n    return std::make_tuple(std::forward<BasicJsonType>(j).at(Idx).template get<Args>()...);\n}\n\ntemplate < typename BasicJsonType, class A1, class A2 >\nstd::pair<A1, A2> from_json_tuple_impl(BasicJsonType&& j, identity_tag<std::pair<A1, A2>> /*unused*/, priority_tag<0> /*unused*/)\n{\n    return {std::forward<BasicJsonType>(j).at(0).template get<A1>(),\n            std::forward<BasicJsonType>(j).at(1).template get<A2>()};\n}\n\ntemplate<typename BasicJsonType, typename A1, typename A2>\ninline void from_json_tuple_impl(BasicJsonType&& j, std::pair<A1, A2>& p, priority_tag<1> /*unused*/)\n{\n    p = from_json_tuple_impl(std::forward<BasicJsonType>(j), identity_tag<std::pair<A1, A2>> {}, priority_tag<0> {});\n}\n\ntemplate<typename BasicJsonType, typename... Args>\nstd::tuple<Args...> from_json_tuple_impl(BasicJsonType&& j, identity_tag<std::tuple<Args...>> /*unused*/, priority_tag<2> /*unused*/)\n{\n    return from_json_tuple_impl_base<BasicJsonType, Args...>(std::forward<BasicJsonType>(j), index_sequence_for<Args...> {});\n}\n\ntemplate<typename BasicJsonType, typename... Args>\ninline void from_json_tuple_impl(BasicJsonType&& j, std::tuple<Args...>& t, priority_tag<3> /*unused*/)\n{\n    t = from_json_tuple_impl_base<BasicJsonType, Args...>(std::forward<BasicJsonType>(j), index_sequence_for<Args...> {});\n}\n\ntemplate<typename BasicJsonType, typename TupleRelated>\nauto from_json(BasicJsonType&& j, TupleRelated&& t)\n-> decltype(from_json_tuple_impl(std::forward<BasicJsonType>(j), std::forward<TupleRelated>(t), priority_tag<3> {}))\n{\n    if (JSON_HEDLEY_UNLIKELY(!j.is_array()))\n    {\n        JSON_THROW(type_error::create(302, concat(\"type must be array, but is \", j.type_name()), &j));\n    }\n\n    return from_json_tuple_impl(std::forward<BasicJsonType>(j), std::forward<TupleRelated>(t), priority_tag<3> {});\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 >>\ninline void 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, concat(\"type must be array, but is \", j.type_name()), &j));\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, concat(\"type must be array, but is \", p.type_name()), &j));\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 >>\ninline void 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, concat(\"type must be array, but is \", j.type_name()), &j));\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, concat(\"type must be array, but is \", p.type_name()), &j));\n        }\n        m.emplace(p.at(0).template get<Key>(), p.at(1).template get<Value>());\n    }\n}\n\n#if JSON_HAS_FILESYSTEM || JSON_HAS_EXPERIMENTAL_FILESYSTEM\ntemplate<typename BasicJsonType>\ninline void from_json(const BasicJsonType& j, std_fs::path& p)\n{\n    if (JSON_HEDLEY_UNLIKELY(!j.is_string()))\n    {\n        JSON_THROW(type_error::create(302, concat(\"type must be string, but is \", j.type_name()), &j));\n    }\n    p = *j.template get_ptr<const typename BasicJsonType::string_t*>();\n}\n#endif\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, std::forward<T>(val))))\n    -> decltype(from_json(j, std::forward<T>(val)))\n    {\n        return from_json(j, std::forward<T>(val));\n    }\n};\n\n}  // namespace detail\n\n#ifndef JSON_HAS_CPP_17\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 // NOLINT(cert-dcl59-cpp,fuchsia-header-anon-namespaces,google-build-namespaces)\n{\n#endif\nJSON_INLINE_VARIABLE constexpr const auto& from_json = // NOLINT(misc-definitions-in-headers)\n    detail::static_const<detail::from_json_fn>::value;\n#ifndef JSON_HAS_CPP_17\n}  // namespace\n#endif\n\nNLOHMANN_JSON_NAMESPACE_END\n\n// #include <nlohmann/detail/conversions/to_json.hpp>\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\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//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\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#include <utility> // move\n\n#if JSON_HAS_RANGES\n    #include <ranges> // enable_borrowed_range\n#endif\n\n// #include <nlohmann/detail/abi_macros.hpp>\n\n// #include <nlohmann/detail/meta/type_traits.hpp>\n\n// #include <nlohmann/detail/value_t.hpp>\n\n\nNLOHMANN_JSON_NAMESPACE_BEGIN\nnamespace detail\n{\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    string_type empty_str{};\n\n  public:\n    explicit iteration_proxy_value() = default;\n    explicit iteration_proxy_value(IteratorType it, std::size_t array_index_ = 0)\n    noexcept(std::is_nothrow_move_constructible<IteratorType>::value\n             && std::is_nothrow_default_constructible<string_type>::value)\n        : anchor(std::move(it))\n        , array_index(array_index_)\n    {}\n\n    iteration_proxy_value(iteration_proxy_value const&) = default;\n    iteration_proxy_value& operator=(iteration_proxy_value const&) = default;\n    // older GCCs are a bit fussy and require explicit noexcept specifiers on defaulted functions\n    iteration_proxy_value(iteration_proxy_value&&)\n    noexcept(std::is_nothrow_move_constructible<IteratorType>::value\n             && std::is_nothrow_move_constructible<string_type>::value) = default; // NOLINT(hicpp-noexcept-move,performance-noexcept-move-constructor,cppcoreguidelines-noexcept-move-operations)\n    iteration_proxy_value& operator=(iteration_proxy_value&&)\n    noexcept(std::is_nothrow_move_assignable<IteratorType>::value\n             && std::is_nothrow_move_assignable<string_type>::value) = default; // NOLINT(hicpp-noexcept-move,performance-noexcept-move-constructor,cppcoreguidelines-noexcept-move-operations)\n    ~iteration_proxy_value() = default;\n\n    /// dereference operator (needed for range-based for)\n    const iteration_proxy_value& operator*() const\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    iteration_proxy_value operator++(int)& // NOLINT(cert-dcl21-cpp)\n    {\n        auto tmp = iteration_proxy_value(anchor, array_index);\n        ++anchor;\n        ++array_index;\n        return tmp;\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            case value_t::null:\n            case value_t::string:\n            case value_t::boolean:\n            case value_t::number_integer:\n            case value_t::number_unsigned:\n            case value_t::number_float:\n            case value_t::binary:\n            case value_t::discarded:\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::pointer container = nullptr;\n\n  public:\n    explicit iteration_proxy() = default;\n\n    /// construct iteration proxy from a container\n    explicit iteration_proxy(typename IteratorType::reference cont) noexcept\n        : container(&cont) {}\n\n    iteration_proxy(iteration_proxy const&) = default;\n    iteration_proxy& operator=(iteration_proxy const&) = default;\n    iteration_proxy(iteration_proxy&&) noexcept = default;\n    iteration_proxy& operator=(iteration_proxy&&) noexcept = default;\n    ~iteration_proxy() = default;\n\n    /// return iterator begin (needed for range-based for)\n    iteration_proxy_value<IteratorType> begin() const 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() const noexcept\n    {\n        return iteration_proxy_value<IteratorType>(container->end());\n    }\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\n}  // namespace detail\nNLOHMANN_JSON_NAMESPACE_END\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\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>> // NOLINT(cert-dcl58-cpp)\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 >> // NOLINT(cert-dcl58-cpp)\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\n}  // namespace std\n\n#if JSON_HAS_RANGES\n    template <typename IteratorType>\n    inline constexpr bool ::std::ranges::enable_borrowed_range<::nlohmann::detail::iteration_proxy<IteratorType>> = true;\n#endif\n\n// #include <nlohmann/detail/macro_scope.hpp>\n\n// #include <nlohmann/detail/meta/cpp_future.hpp>\n\n// #include <nlohmann/detail/meta/std_fs.hpp>\n\n// #include <nlohmann/detail/meta/type_traits.hpp>\n\n// #include <nlohmann/detail/value_t.hpp>\n\n\nNLOHMANN_JSON_NAMESPACE_BEGIN\nnamespace detail\n{\n\n//////////////////\n// constructors //\n//////////////////\n\n/*\n * Note all external_constructor<>::construct functions need to call\n * j.m_data.m_value.destroy(j.m_data.m_type) to avoid a memory leak in case j contains an\n * allocated value (e.g., a string). See bug issue\n * https://github.com/nlohmann/json/issues/2865 for more information.\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_data.m_value.destroy(j.m_data.m_type);\n        j.m_data.m_type = value_t::boolean;\n        j.m_data.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_data.m_value.destroy(j.m_data.m_type);\n        j.m_data.m_type = value_t::string;\n        j.m_data.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_data.m_value.destroy(j.m_data.m_type);\n        j.m_data.m_type = value_t::string;\n        j.m_data.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_data.m_value.destroy(j.m_data.m_type);\n        j.m_data.m_type = value_t::string;\n        j.m_data.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_data.m_value.destroy(j.m_data.m_type);\n        j.m_data.m_type = value_t::binary;\n        j.m_data.m_value = typename BasicJsonType::binary_t(b);\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_data.m_value.destroy(j.m_data.m_type);\n        j.m_data.m_type = value_t::binary;\n        j.m_data.m_value = typename BasicJsonType::binary_t(std::move(b));\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_data.m_value.destroy(j.m_data.m_type);\n        j.m_data.m_type = value_t::number_float;\n        j.m_data.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_data.m_value.destroy(j.m_data.m_type);\n        j.m_data.m_type = value_t::number_unsigned;\n        j.m_data.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_data.m_value.destroy(j.m_data.m_type);\n        j.m_data.m_type = value_t::number_integer;\n        j.m_data.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_data.m_value.destroy(j.m_data.m_type);\n        j.m_data.m_type = value_t::array;\n        j.m_data.m_value = arr;\n        j.set_parents();\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_data.m_value.destroy(j.m_data.m_type);\n        j.m_data.m_type = value_t::array;\n        j.m_data.m_value = std::move(arr);\n        j.set_parents();\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\n        j.m_data.m_value.destroy(j.m_data.m_type);\n        j.m_data.m_type = value_t::array;\n        j.m_data.m_value.array = j.template create<typename BasicJsonType::array_t>(begin(arr), end(arr));\n        j.set_parents();\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_data.m_value.destroy(j.m_data.m_type);\n        j.m_data.m_type = value_t::array;\n        j.m_data.m_value = value_t::array;\n        j.m_data.m_value.array->reserve(arr.size());\n        for (const bool x : arr)\n        {\n            j.m_data.m_value.array->push_back(x);\n            j.set_parent(j.m_data.m_value.array->back());\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_data.m_value.destroy(j.m_data.m_type);\n        j.m_data.m_type = value_t::array;\n        j.m_data.m_value = value_t::array;\n        j.m_data.m_value.array->resize(arr.size());\n        if (arr.size() > 0)\n        {\n            std::copy(std::begin(arr), std::end(arr), j.m_data.m_value.array->begin());\n        }\n        j.set_parents();\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_data.m_value.destroy(j.m_data.m_type);\n        j.m_data.m_type = value_t::object;\n        j.m_data.m_value = obj;\n        j.set_parents();\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_data.m_value.destroy(j.m_data.m_type);\n        j.m_data.m_type = value_t::object;\n        j.m_data.m_value = std::move(obj);\n        j.set_parents();\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_data.m_value.destroy(j.m_data.m_type);\n        j.m_data.m_type = value_t::object;\n        j.m_data.m_value.object = j.template create<typename BasicJsonType::object_t>(begin(obj), end(obj));\n        j.set_parents();\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>\ninline void to_json(BasicJsonType& j, T b) noexcept\n{\n    external_constructor<value_t::boolean>::construct(j, b);\n}\n\ntemplate < typename BasicJsonType, typename BoolRef,\n           enable_if_t <\n               ((std::is_same<std::vector<bool>::reference, BoolRef>::value\n                 && !std::is_same <std::vector<bool>::reference, typename BasicJsonType::boolean_t&>::value)\n                || (std::is_same<std::vector<bool>::const_reference, BoolRef>::value\n                    && !std::is_same <detail::uncvref_t<std::vector<bool>::const_reference>,\n                                      typename BasicJsonType::boolean_t >::value))\n               && std::is_convertible<const BoolRef&, typename BasicJsonType::boolean_t>::value, int > = 0 >\ninline void to_json(BasicJsonType& j, const BoolRef& b) noexcept\n{\n    external_constructor<value_t::boolean>::construct(j, static_cast<typename BasicJsonType::boolean_t>(b));\n}\n\ntemplate<typename BasicJsonType, typename CompatibleString,\n         enable_if_t<std::is_constructible<typename BasicJsonType::string_t, CompatibleString>::value, int> = 0>\ninline void to_json(BasicJsonType& j, const CompatibleString& s)\n{\n    external_constructor<value_t::string>::construct(j, s);\n}\n\ntemplate<typename BasicJsonType>\ninline void 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>\ninline void 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>\ninline void 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>\ninline void 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\n#if !JSON_DISABLE_ENUM_SERIALIZATION\ntemplate<typename BasicJsonType, typename EnumType,\n         enable_if_t<std::is_enum<EnumType>::value, int> = 0>\ninline void 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#endif  // JSON_DISABLE_ENUM_SERIALIZATION\n\ntemplate<typename BasicJsonType>\ninline void 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 >\ninline void to_json(BasicJsonType& j, const CompatibleArrayType& arr)\n{\n    external_constructor<value_t::array>::construct(j, arr);\n}\n\ntemplate<typename BasicJsonType>\ninline void 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>\ninline void 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>\ninline void 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 >\ninline void to_json(BasicJsonType& j, const CompatibleObjectType& obj)\n{\n    external_constructor<value_t::object>::construct(j, obj);\n}\n\ntemplate<typename BasicJsonType>\ninline void 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, // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)\n                  int > = 0 >\ninline void to_json(BasicJsonType& j, const T(&arr)[N]) // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)\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 >\ninline void 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>\ninline void 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>\ninline void 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>\ninline void 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\n#if JSON_HAS_FILESYSTEM || JSON_HAS_EXPERIMENTAL_FILESYSTEM\ntemplate<typename BasicJsonType>\ninline void to_json(BasicJsonType& j, const std_fs::path& p)\n{\n    j = p.string();\n}\n#endif\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#ifndef JSON_HAS_CPP_17\n/// namespace to hold default `to_json` function\n/// to see why this is required:\n/// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4381.html\nnamespace // NOLINT(cert-dcl59-cpp,fuchsia-header-anon-namespaces,google-build-namespaces)\n{\n#endif\nJSON_INLINE_VARIABLE constexpr const auto& to_json = // NOLINT(misc-definitions-in-headers)\n    detail::static_const<detail::to_json_fn>::value;\n#ifndef JSON_HAS_CPP_17\n}  // namespace\n#endif\n\nNLOHMANN_JSON_NAMESPACE_END\n\n// #include <nlohmann/detail/meta/identity_tag.hpp>\n\n\nNLOHMANN_JSON_NAMESPACE_BEGIN\n\n/// @sa https://json.nlohmann.me/api/adl_serializer/\ntemplate<typename ValueType, typename>\nstruct adl_serializer\n{\n    /// @brief convert a JSON value to any value type\n    /// @sa https://json.nlohmann.me/api/adl_serializer/from_json/\n    template<typename BasicJsonType, typename TargetType = ValueType>\n    static auto from_json(BasicJsonType && j, TargetType& 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    /// @brief convert a JSON value to any value type\n    /// @sa https://json.nlohmann.me/api/adl_serializer/from_json/\n    template<typename BasicJsonType, typename TargetType = ValueType>\n    static auto from_json(BasicJsonType && j) noexcept(\n    noexcept(::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType> {})))\n    -> decltype(::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType> {}))\n    {\n        return ::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType> {});\n    }\n\n    /// @brief convert any value type to a JSON value\n    /// @sa https://json.nlohmann.me/api/adl_serializer/to_json/\n    template<typename BasicJsonType, typename TargetType = ValueType>\n    static auto to_json(BasicJsonType& j, TargetType && val) noexcept(\n        noexcept(::nlohmann::to_json(j, std::forward<TargetType>(val))))\n    -> decltype(::nlohmann::to_json(j, std::forward<TargetType>(val)), void())\n    {\n        ::nlohmann::to_json(j, std::forward<TargetType>(val));\n    }\n};\n\nNLOHMANN_JSON_NAMESPACE_END\n\n// #include <nlohmann/byte_container_with_subtype.hpp>\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\n\n\n#include <cstdint> // uint8_t, uint64_t\n#include <tuple> // tie\n#include <utility> // move\n\n// #include <nlohmann/detail/abi_macros.hpp>\n\n\nNLOHMANN_JSON_NAMESPACE_BEGIN\n\n/// @brief an internal type for a backed binary type\n/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/\ntemplate<typename BinaryType>\nclass byte_container_with_subtype : public BinaryType\n{\n  public:\n    using container_type = BinaryType;\n    using subtype_type = std::uint64_t;\n\n    /// @sa https://json.nlohmann.me/api/byte_container_with_subtype/byte_container_with_subtype/\n    byte_container_with_subtype() noexcept(noexcept(container_type()))\n        : container_type()\n    {}\n\n    /// @sa https://json.nlohmann.me/api/byte_container_with_subtype/byte_container_with_subtype/\n    byte_container_with_subtype(const container_type& b) noexcept(noexcept(container_type(b)))\n        : container_type(b)\n    {}\n\n    /// @sa https://json.nlohmann.me/api/byte_container_with_subtype/byte_container_with_subtype/\n    byte_container_with_subtype(container_type&& b) noexcept(noexcept(container_type(std::move(b))))\n        : container_type(std::move(b))\n    {}\n\n    /// @sa https://json.nlohmann.me/api/byte_container_with_subtype/byte_container_with_subtype/\n    byte_container_with_subtype(const container_type& b, subtype_type subtype_) noexcept(noexcept(container_type(b)))\n        : container_type(b)\n        , m_subtype(subtype_)\n        , m_has_subtype(true)\n    {}\n\n    /// @sa https://json.nlohmann.me/api/byte_container_with_subtype/byte_container_with_subtype/\n    byte_container_with_subtype(container_type&& b, subtype_type 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    /// @brief sets the binary subtype\n    /// @sa https://json.nlohmann.me/api/byte_container_with_subtype/set_subtype/\n    void set_subtype(subtype_type subtype_) noexcept\n    {\n        m_subtype = subtype_;\n        m_has_subtype = true;\n    }\n\n    /// @brief return the binary subtype\n    /// @sa https://json.nlohmann.me/api/byte_container_with_subtype/subtype/\n    constexpr subtype_type subtype() const noexcept\n    {\n        return m_has_subtype ? m_subtype : static_cast<subtype_type>(-1);\n    }\n\n    /// @brief return whether the value has a subtype\n    /// @sa https://json.nlohmann.me/api/byte_container_with_subtype/has_subtype/\n    constexpr bool has_subtype() const noexcept\n    {\n        return m_has_subtype;\n    }\n\n    /// @brief clears the binary subtype\n    /// @sa https://json.nlohmann.me/api/byte_container_with_subtype/clear_subtype/\n    void clear_subtype() noexcept\n    {\n        m_subtype = 0;\n        m_has_subtype = false;\n    }\n\n  private:\n    subtype_type m_subtype = 0;\n    bool m_has_subtype = false;\n};\n\nNLOHMANN_JSON_NAMESPACE_END\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//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\n\n\n#include <cstdint> // uint8_t\n#include <cstddef> // size_t\n#include <functional> // hash\n\n// #include <nlohmann/detail/abi_macros.hpp>\n\n// #include <nlohmann/detail/value_t.hpp>\n\n\nNLOHMANN_JSON_NAMESPACE_BEGIN\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, static_cast<std::size_t>(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); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert) LCOV_EXCL_LINE\n            return 0;              // LCOV_EXCL_LINE\n    }\n}\n\n}  // namespace detail\nNLOHMANN_JSON_NAMESPACE_END\n\n// #include <nlohmann/detail/input/binary_reader.hpp>\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\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#include <vector> // vector\n\n// #include <nlohmann/detail/exceptions.hpp>\n\n// #include <nlohmann/detail/input/input_adapters.hpp>\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\n\n\n#include <array> // array\n#include <cstddef> // size_t\n#include <cstring> // strlen\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#ifndef JSON_NO_IO\n    #include <cstdio>   // FILE *\n    #include <istream>  // istream\n#endif                  // JSON_NO_IO\n\n// #include <nlohmann/detail/iterators/iterator_traits.hpp>\n\n// #include <nlohmann/detail/macro_scope.hpp>\n\n// #include <nlohmann/detail/meta/type_traits.hpp>\n\n\nNLOHMANN_JSON_NAMESPACE_BEGIN\nnamespace detail\n{\n\n/// the supported input formats\nenum class input_format_t { json, cbor, msgpack, ubjson, bson, bjdata };\n\n////////////////////\n// input adapters //\n////////////////////\n\n#ifndef JSON_NO_IO\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        JSON_ASSERT(m_file != nullptr);\n    }\n\n    // make class move-only\n    file_input_adapter(const file_input_adapter&) = delete;\n    file_input_adapter(file_input_adapter&&) noexcept = default;\n    file_input_adapter& operator=(const file_input_adapter&) = delete;\n    file_input_adapter& operator=(file_input_adapter&&) = delete;\n    ~file_input_adapter() = default;\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/*!\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&&) = delete;\n\n    input_stream_adapter(input_stream_adapter&& rhs) noexcept\n        : 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, e.g. 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 == std::char_traits<char>::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#endif  // JSON_NO_IO\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\n    typename char_traits<char_type>::int_type get_character()\n    {\n        if (JSON_HEDLEY_LIKELY(current != end))\n        {\n            auto result = char_traits<char_type>::to_int_type(*current);\n            std::advance(current, 1);\n            return result;\n        }\n\n        return char_traits<char_type>::eof();\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\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 adapter 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\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\n// Enables ADL on begin(container) and end(container)\n// Encloses the using declarations in namespace for not to leak them to outside scope\n\nnamespace container_input_adapter_factory_impl\n{\n\nusing std::begin;\nusing std::end;\n\ntemplate<typename ContainerType, typename Enable = void>\nstruct container_input_adapter_factory {};\n\ntemplate<typename ContainerType>\nstruct container_input_adapter_factory< ContainerType,\n       void_t<decltype(begin(std::declval<ContainerType>()), end(std::declval<ContainerType>()))>>\n       {\n           using adapter_type = decltype(input_adapter(begin(std::declval<ContainerType>()), end(std::declval<ContainerType>())));\n\n           static adapter_type create(const ContainerType& container)\n{\n    return input_adapter(begin(container), end(container));\n}\n       };\n\n}  // namespace container_input_adapter_factory_impl\n\ntemplate<typename ContainerType>\ntypename container_input_adapter_factory_impl::container_input_adapter_factory<ContainerType>::adapter_type input_adapter(const ContainerType& container)\n{\n    return container_input_adapter_factory_impl::container_input_adapter_factory<ContainerType>::create(container);\n}\n\n#ifndef JSON_NO_IO\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#endif  // JSON_NO_IO\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)) // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)\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 implicitly cast\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); // NOLINT(hicpp-move-const-arg,performance-move-const-arg)\n    }\n\n  private:\n    contiguous_bytes_input_adapter ia;\n};\n\n}  // namespace detail\nNLOHMANN_JSON_NAMESPACE_END\n\n// #include <nlohmann/detail/input/json_sax.hpp>\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\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// #include <nlohmann/detail/string_concat.hpp>\n\n\nNLOHMANN_JSON_NAMESPACE_BEGIN\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 a 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 value was read\n    @param[in] val  string value\n    @return whether parsing should proceed\n    @note It is safe to move the passed string value.\n    */\n    virtual bool string(string_t& val) = 0;\n\n    /*!\n    @brief a binary value was read\n    @param[in] val  binary value\n    @return whether parsing should proceed\n    @note It is safe to move the passed binary value.\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    json_sax() = default;\n    json_sax(const json_sax&) = default;\n    json_sax(json_sax&&) noexcept = default;\n    json_sax& operator=(const json_sax&) = default;\n    json_sax& operator=(json_sax&&) noexcept = default;\n    virtual ~json_sax() = default;\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; // NOLINT(hicpp-noexcept-move,performance-noexcept-move-constructor)\n    json_sax_dom_parser& operator=(const json_sax_dom_parser&) = delete;\n    json_sax_dom_parser& operator=(json_sax_dom_parser&&) = default; // NOLINT(hicpp-noexcept-move,performance-noexcept-move-constructor)\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 != static_cast<std::size_t>(-1) && len > ref_stack.back()->max_size()))\n        {\n            JSON_THROW(out_of_range::create(408, concat(\"excessive object size: \", std::to_string(len)), ref_stack.back()));\n        }\n\n        return true;\n    }\n\n    bool key(string_t& val)\n    {\n        JSON_ASSERT(!ref_stack.empty());\n        JSON_ASSERT(ref_stack.back()->is_object());\n\n        // add null at given key and store the reference for later\n        object_element = &(ref_stack.back()->m_data.m_value.object->operator[](val));\n        return true;\n    }\n\n    bool end_object()\n    {\n        JSON_ASSERT(!ref_stack.empty());\n        JSON_ASSERT(ref_stack.back()->is_object());\n\n        ref_stack.back()->set_parents();\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 != static_cast<std::size_t>(-1) && len > ref_stack.back()->max_size()))\n        {\n            JSON_THROW(out_of_range::create(408, concat(\"excessive array size: \", std::to_string(len)), ref_stack.back()));\n        }\n\n        return true;\n    }\n\n    bool end_array()\n    {\n        JSON_ASSERT(!ref_stack.empty());\n        JSON_ASSERT(ref_stack.back()->is_array());\n\n        ref_stack.back()->set_parents();\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_data.m_value.array->emplace_back(std::forward<Value>(v));\n            return &(ref_stack.back()->m_data.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; // NOLINT(hicpp-noexcept-move,performance-noexcept-move-constructor)\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; // NOLINT(hicpp-noexcept-move,performance-noexcept-move-constructor)\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 != static_cast<std::size_t>(-1) && len > ref_stack.back()->max_size()))\n        {\n            JSON_THROW(out_of_range::create(408, concat(\"excessive object size: \", std::to_string(len)), ref_stack.back()));\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_data.m_value.object->operator[](val) = discarded);\n        }\n\n        return true;\n    }\n\n    bool end_object()\n    {\n        if (ref_stack.back())\n        {\n            if (!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            else\n            {\n                ref_stack.back()->set_parents();\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        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 != static_cast<std::size_t>(-1) && len > ref_stack.back()->max_size()))\n        {\n            JSON_THROW(out_of_range::create(408, concat(\"excessive array size: \", std::to_string(len)), ref_stack.back()));\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                ref_stack.back()->set_parents();\n            }\n            else\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_data.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_data.m_value.array->emplace_back(std::move(value));\n            return {true, & (ref_stack.back()->m_data.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*/ = static_cast<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*/ = static_cast<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\n}  // namespace detail\nNLOHMANN_JSON_NAMESPACE_END\n\n// #include <nlohmann/detail/input/lexer.hpp>\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\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// #include <nlohmann/detail/meta/type_traits.hpp>\n\n\nNLOHMANN_JSON_NAMESPACE_BEGIN\nnamespace detail\n{\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 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) noexcept\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; // NOLINT(hicpp-noexcept-move,performance-noexcept-move-constructor)\n    lexer& operator=(lexer&) = delete;\n    lexer& operator=(lexer&&) = default; // NOLINT(hicpp-noexcept-move,performance-noexcept-move-constructor)\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))) // NOLINT(bugprone-inc-dec-in-conditions)\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 8259. 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 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 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 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 8259.\n\n    The function is realized with a deterministic finite state machine derived\n    from the grammar described in RFC 8259. 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); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert) 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; // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg)\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(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(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(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    `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 != char_traits<char_type>::eof()))\n        {\n            token_string.push_back(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 != 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                static_cast<void>((std::snprintf)(cs.data(), cs.size(), \"<U+%.4X>\", static_cast<unsigned char>(c))); // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg)\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 = {{static_cast<char_type>('t'), static_cast<char_type>('r'), static_cast<char_type>('u'), static_cast<char_type>('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 = {{static_cast<char_type>('f'), static_cast<char_type>('a'), static_cast<char_type>('l'), static_cast<char_type>('s'), static_cast<char_type>('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 = {{static_cast<char_type>('n'), static_cast<char_type>('u'), static_cast<char_type>('l'), static_cast<char_type>('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 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 = 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\n}  // namespace detail\nNLOHMANN_JSON_NAMESPACE_END\n\n// #include <nlohmann/detail/macro_scope.hpp>\n\n// #include <nlohmann/detail/meta/is_sax.hpp>\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\n\n\n#include <cstdint> // size_t\n#include <utility> // declval\n#include <string> // string\n\n// #include <nlohmann/detail/abi_macros.hpp>\n\n// #include <nlohmann/detail/meta/detected.hpp>\n\n// #include <nlohmann/detail/meta/type_traits.hpp>\n\n\nNLOHMANN_JSON_NAMESPACE_BEGIN\nnamespace detail\n{\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\n}  // namespace detail\nNLOHMANN_JSON_NAMESPACE_END\n\n// #include <nlohmann/detail/meta/type_traits.hpp>\n\n// #include <nlohmann/detail/string_concat.hpp>\n\n// #include <nlohmann/detail/value_t.hpp>\n\n\nNLOHMANN_JSON_NAMESPACE_BEGIN\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    store    ///< store tags as binary type\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_endianness(int num = 1) noexcept\n{\n    return *reinterpret_cast<char*>(&num) == 1;\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 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, const input_format_t format = input_format_t::json) noexcept : ia(std::move(adapter)), input_format(format)\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; // NOLINT(hicpp-noexcept-move,performance-noexcept-move-constructor)\n    binary_reader& operator=(const binary_reader&) = delete;\n    binary_reader& operator=(binary_reader&&) = default; // NOLINT(hicpp-noexcept-move,performance-noexcept-move-constructor)\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 whether parsing was successful\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            case input_format_t::bjdata:\n                result = parse_ubjson_internal();\n                break;\n\n            case input_format_t::json: // LCOV_EXCL_LINE\n            default:            // LCOV_EXCL_LINE\n                JSON_ASSERT(false); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert) LCOV_EXCL_LINE\n        }\n\n        // strict mode: next byte must be EOF\n        if (result && strict)\n        {\n            if (input_format == input_format_t::ubjson || input_format == input_format_t::bjdata)\n            {\n                get_ignore_noop();\n            }\n            else\n            {\n                get();\n            }\n\n            if (JSON_HEDLEY_UNLIKELY(current != char_traits<char_type>::eof()))\n            {\n                return sax->parse_error(chars_read, get_token_string(), parse_error::create(110, chars_read,\n                                        exception_message(input_format, concat(\"expected end of input; last byte: 0x\", get_token_string()), \"value\"), nullptr));\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(static_cast<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,\n                                    exception_message(input_format_t::bson, concat(\"string length must be at least 1, is \", std::to_string(len)), \"string\"), nullptr));\n        }\n\n        return get_string(input_format_t::bson, len - static_cast<NumberType>(1), result) && get() != 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,\n                                    exception_message(input_format_t::bson, concat(\"byte array length cannot be negative, is \", std::to_string(len)), \"binary\"), nullptr));\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                static_cast<void>((std::snprintf)(cr.data(), cr.size(), \"%.2hhX\", static_cast<unsigned char>(element_type))); // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg)\n                const std::string cr_str{cr.data()};\n                return sax->parse_error(element_type_parse_position, cr_str,\n                                        parse_error::create(114, element_type_parse_position, concat(\"Unsupported BSON record type 0x\", cr_str), nullptr));\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(static_cast<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 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(\n                           conditional_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(conditional_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(conditional_static_cast<std::size_t>(len), tag_handler);\n            }\n\n            case 0x9F: // array (indefinite length)\n                return get_cbor_array(static_cast<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(conditional_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(conditional_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(conditional_static_cast<std::size_t>(len), tag_handler);\n            }\n\n            case 0xBF: // map (indefinite length)\n                return get_cbor_object(static_cast<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,\n                                                exception_message(input_format_t::cbor, concat(\"invalid byte: 0x\", last_token), \"value\"), nullptr));\n                    }\n\n                    case cbor_tag_handler_t::ignore:\n                    {\n                        // ignore binary subtype\n                        switch (current)\n                        {\n                            case 0xD8:\n                            {\n                                std::uint8_t subtype_to_ignore{};\n                                get_number(input_format_t::cbor, subtype_to_ignore);\n                                break;\n                            }\n                            case 0xD9:\n                            {\n                                std::uint16_t subtype_to_ignore{};\n                                get_number(input_format_t::cbor, subtype_to_ignore);\n                                break;\n                            }\n                            case 0xDA:\n                            {\n                                std::uint32_t subtype_to_ignore{};\n                                get_number(input_format_t::cbor, subtype_to_ignore);\n                                break;\n                            }\n                            case 0xDB:\n                            {\n                                std::uint64_t subtype_to_ignore{};\n                                get_number(input_format_t::cbor, subtype_to_ignore);\n                                break;\n                            }\n                            default:\n                                break;\n                        }\n                        return parse_cbor_internal(true, tag_handler);\n                    }\n\n                    case cbor_tag_handler_t::store:\n                    {\n                        binary_t b;\n                        // use binary subtype and store in binary container\n                        switch (current)\n                        {\n                            case 0xD8:\n                            {\n                                std::uint8_t subtype{};\n                                get_number(input_format_t::cbor, subtype);\n                                b.set_subtype(detail::conditional_static_cast<typename binary_t::subtype_type>(subtype));\n                                break;\n                            }\n                            case 0xD9:\n                            {\n                                std::uint16_t subtype{};\n                                get_number(input_format_t::cbor, subtype);\n                                b.set_subtype(detail::conditional_static_cast<typename binary_t::subtype_type>(subtype));\n                                break;\n                            }\n                            case 0xDA:\n                            {\n                                std::uint32_t subtype{};\n                                get_number(input_format_t::cbor, subtype);\n                                b.set_subtype(detail::conditional_static_cast<typename binary_t::subtype_type>(subtype));\n                                break;\n                            }\n                            case 0xDB:\n                            {\n                                std::uint64_t subtype{};\n                                get_number(input_format_t::cbor, subtype);\n                                b.set_subtype(detail::conditional_static_cast<typename binary_t::subtype_type>(subtype));\n                                break;\n                            }\n                            default:\n                                return parse_cbor_internal(true, tag_handler);\n                        }\n                        get();\n                        return get_cbor_binary(b) && sax->binary(b);\n                    }\n\n                    default:                 // LCOV_EXCL_LINE\n                        JSON_ASSERT(false); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert) 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,\n                                        exception_message(input_format_t::cbor, concat(\"invalid byte: 0x\", last_token), \"value\"), nullptr));\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,\n                                        exception_message(input_format_t::cbor, concat(\"expected length specification (0x60-0x7B) or indefinite string type (0x7F); last byte: 0x\", last_token), \"string\"), nullptr));\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,\n                                        exception_message(input_format_t::cbor, concat(\"expected length specification (0x40-0x5B) or indefinite binary array type (0x5F); last byte: 0x\", last_token), \"binary\"), nullptr));\n            }\n        }\n    }\n\n    /*!\n    @param[in] len  the length of the array or static_cast<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 != static_cast<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 static_cast<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        if (len != 0)\n        {\n            string_t key;\n            if (len != static_cast<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\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 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(conditional_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(conditional_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(conditional_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(conditional_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,\n                                        exception_message(input_format_t::msgpack, concat(\"invalid byte: 0x\", last_token), \"value\"), nullptr));\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,\n                                        exception_message(input_format_t::msgpack, concat(\"expected length specification (0xA0-0xBF, 0xD9-0xDB); last byte: 0x\", last_token), \"string\"), nullptr));\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, \"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, len) && get_string(input_format, len, result);\n            }\n\n            case 'i':\n            {\n                std::int8_t len{};\n                return get_number(input_format, len) && get_string(input_format, len, result);\n            }\n\n            case 'I':\n            {\n                std::int16_t len{};\n                return get_number(input_format, len) && get_string(input_format, len, result);\n            }\n\n            case 'l':\n            {\n                std::int32_t len{};\n                return get_number(input_format, len) && get_string(input_format, len, result);\n            }\n\n            case 'L':\n            {\n                std::int64_t len{};\n                return get_number(input_format, len) && get_string(input_format, len, result);\n            }\n\n            case 'u':\n            {\n                if (input_format != input_format_t::bjdata)\n                {\n                    break;\n                }\n                std::uint16_t len{};\n                return get_number(input_format, len) && get_string(input_format, len, result);\n            }\n\n            case 'm':\n            {\n                if (input_format != input_format_t::bjdata)\n                {\n                    break;\n                }\n                std::uint32_t len{};\n                return get_number(input_format, len) && get_string(input_format, len, result);\n            }\n\n            case 'M':\n            {\n                if (input_format != input_format_t::bjdata)\n                {\n                    break;\n                }\n                std::uint64_t len{};\n                return get_number(input_format, len) && get_string(input_format, len, result);\n            }\n\n            default:\n                break;\n        }\n        auto last_token = get_token_string();\n        std::string message;\n\n        if (input_format != input_format_t::bjdata)\n        {\n            message = \"expected length type specification (U, i, I, l, L); last byte: 0x\" + last_token;\n        }\n        else\n        {\n            message = \"expected length type specification (U, i, u, I, m, l, M, L); last byte: 0x\" + last_token;\n        }\n        return sax->parse_error(chars_read, last_token, parse_error::create(113, chars_read, exception_message(input_format, message, \"string\"), nullptr));\n    }\n\n    /*!\n    @param[out] dim  an integer vector storing the ND array dimensions\n    @return whether reading ND array size vector is successful\n    */\n    bool get_ubjson_ndarray_size(std::vector<size_t>& dim)\n    {\n        std::pair<std::size_t, char_int_type> size_and_type;\n        size_t dimlen = 0;\n        bool no_ndarray = true;\n\n        if (JSON_HEDLEY_UNLIKELY(!get_ubjson_size_type(size_and_type, no_ndarray)))\n        {\n            return false;\n        }\n\n        if (size_and_type.first != npos)\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_size_value(dimlen, no_ndarray, size_and_type.second)))\n                        {\n                            return false;\n                        }\n                        dim.push_back(dimlen);\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(!get_ubjson_size_value(dimlen, no_ndarray)))\n                    {\n                        return false;\n                    }\n                    dim.push_back(dimlen);\n                }\n            }\n        }\n        else\n        {\n            while (current != ']')\n            {\n                if (JSON_HEDLEY_UNLIKELY(!get_ubjson_size_value(dimlen, no_ndarray, current)))\n                {\n                    return false;\n                }\n                dim.push_back(dimlen);\n                get_ignore_noop();\n            }\n        }\n        return true;\n    }\n\n    /*!\n    @param[out] result  determined size\n    @param[in,out] is_ndarray  for input, `true` means already inside an ndarray vector\n                               or ndarray dimension is not allowed; `false` means ndarray\n                               is allowed; for output, `true` means an ndarray is found;\n                               is_ndarray can only return `true` when its initial value\n                               is `false`\n    @param[in] prefix  type marker if already read, otherwise set to 0\n\n    @return whether size determination completed\n    */\n    bool get_ubjson_size_value(std::size_t& result, bool& is_ndarray, char_int_type prefix = 0)\n    {\n        if (prefix == 0)\n        {\n            prefix = get_ignore_noop();\n        }\n\n        switch (prefix)\n        {\n            case 'U':\n            {\n                std::uint8_t number{};\n                if (JSON_HEDLEY_UNLIKELY(!get_number(input_format, 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, number)))\n                {\n                    return false;\n                }\n                if (number < 0)\n                {\n                    return sax->parse_error(chars_read, get_token_string(), parse_error::create(113, chars_read,\n                                            exception_message(input_format, \"count in an optimized container must be positive\", \"size\"), nullptr));\n                }\n                result = static_cast<std::size_t>(number); // NOLINT(bugprone-signed-char-misuse,cert-str34-c): number is not a char\n                return true;\n            }\n\n            case 'I':\n            {\n                std::int16_t number{};\n                if (JSON_HEDLEY_UNLIKELY(!get_number(input_format, number)))\n                {\n                    return false;\n                }\n                if (number < 0)\n                {\n                    return sax->parse_error(chars_read, get_token_string(), parse_error::create(113, chars_read,\n                                            exception_message(input_format, \"count in an optimized container must be positive\", \"size\"), nullptr));\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, number)))\n                {\n                    return false;\n                }\n                if (number < 0)\n                {\n                    return sax->parse_error(chars_read, get_token_string(), parse_error::create(113, chars_read,\n                                            exception_message(input_format, \"count in an optimized container must be positive\", \"size\"), nullptr));\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, number)))\n                {\n                    return false;\n                }\n                if (number < 0)\n                {\n                    return sax->parse_error(chars_read, get_token_string(), parse_error::create(113, chars_read,\n                                            exception_message(input_format, \"count in an optimized container must be positive\", \"size\"), nullptr));\n                }\n                if (!value_in_range_of<std::size_t>(number))\n                {\n                    return sax->parse_error(chars_read, get_token_string(), out_of_range::create(408,\n                                            exception_message(input_format, \"integer value overflow\", \"size\"), nullptr));\n                }\n                result = static_cast<std::size_t>(number);\n                return true;\n            }\n\n            case 'u':\n            {\n                if (input_format != input_format_t::bjdata)\n                {\n                    break;\n                }\n                std::uint16_t number{};\n                if (JSON_HEDLEY_UNLIKELY(!get_number(input_format, number)))\n                {\n                    return false;\n                }\n                result = static_cast<std::size_t>(number);\n                return true;\n            }\n\n            case 'm':\n            {\n                if (input_format != input_format_t::bjdata)\n                {\n                    break;\n                }\n                std::uint32_t number{};\n                if (JSON_HEDLEY_UNLIKELY(!get_number(input_format, number)))\n                {\n                    return false;\n                }\n                result = conditional_static_cast<std::size_t>(number);\n                return true;\n            }\n\n            case 'M':\n            {\n                if (input_format != input_format_t::bjdata)\n                {\n                    break;\n                }\n                std::uint64_t number{};\n                if (JSON_HEDLEY_UNLIKELY(!get_number(input_format, number)))\n                {\n                    return false;\n                }\n                if (!value_in_range_of<std::size_t>(number))\n                {\n                    return sax->parse_error(chars_read, get_token_string(), out_of_range::create(408,\n                                            exception_message(input_format, \"integer value overflow\", \"size\"), nullptr));\n                }\n                result = detail::conditional_static_cast<std::size_t>(number);\n                return true;\n            }\n\n            case '[':\n            {\n                if (input_format != input_format_t::bjdata)\n                {\n                    break;\n                }\n                if (is_ndarray) // ndarray dimensional vector can only contain integers, and can not embed another array\n                {\n                    return sax->parse_error(chars_read, get_token_string(), parse_error::create(113, chars_read, exception_message(input_format, \"ndarray dimensional vector is not allowed\", \"size\"), nullptr));\n                }\n                std::vector<size_t> dim;\n                if (JSON_HEDLEY_UNLIKELY(!get_ubjson_ndarray_size(dim)))\n                {\n                    return false;\n                }\n                if (dim.size() == 1 || (dim.size() == 2 && dim.at(0) == 1)) // return normal array size if 1D row vector\n                {\n                    result = dim.at(dim.size() - 1);\n                    return true;\n                }\n                if (!dim.empty())  // if ndarray, convert to an object in JData annotated array format\n                {\n                    for (auto i : dim) // test if any dimension in an ndarray is 0, if so, return a 1D empty container\n                    {\n                        if ( i == 0 )\n                        {\n                            result = 0;\n                            return true;\n                        }\n                    }\n\n                    string_t key = \"_ArraySize_\";\n                    if (JSON_HEDLEY_UNLIKELY(!sax->start_object(3) || !sax->key(key) || !sax->start_array(dim.size())))\n                    {\n                        return false;\n                    }\n                    result = 1;\n                    for (auto i : dim)\n                    {\n                        result *= i;\n                        if (result == 0 || result == npos) // because dim elements shall not have zeros, result = 0 means overflow happened; it also can't be npos as it is used to initialize size in get_ubjson_size_type()\n                        {\n                            return sax->parse_error(chars_read, get_token_string(), out_of_range::create(408, exception_message(input_format, \"excessive ndarray size caused overflow\", \"size\"), nullptr));\n                        }\n                        if (JSON_HEDLEY_UNLIKELY(!sax->number_unsigned(static_cast<number_unsigned_t>(i))))\n                        {\n                            return false;\n                        }\n                    }\n                    is_ndarray = true;\n                    return sax->end_array();\n                }\n                result = 0;\n                return true;\n            }\n\n            default:\n                break;\n        }\n        auto last_token = get_token_string();\n        std::string message;\n\n        if (input_format != input_format_t::bjdata)\n        {\n            message = \"expected length type specification (U, i, I, l, L) after '#'; last byte: 0x\" + last_token;\n        }\n        else\n        {\n            message = \"expected length type specification (U, i, u, I, m, l, M, L) after '#'; last byte: 0x\" + last_token;\n        }\n        return sax->parse_error(chars_read, last_token, parse_error::create(113, chars_read, exception_message(input_format, message, \"size\"), nullptr));\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    @param[in] inside_ndarray  whether the parser is parsing an ND array dimensional vector\n\n    @return whether pair creation completed\n    */\n    bool get_ubjson_size_type(std::pair<std::size_t, char_int_type>& result, bool inside_ndarray = false)\n    {\n        result.first = npos; // size\n        result.second = 0; // type\n        bool is_ndarray = false;\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 (input_format == input_format_t::bjdata\n                    && JSON_HEDLEY_UNLIKELY(std::binary_search(bjd_optimized_type_markers.begin(), bjd_optimized_type_markers.end(), result.second)))\n            {\n                auto last_token = get_token_string();\n                return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read,\n                                        exception_message(input_format, concat(\"marker 0x\", last_token, \" is not a permitted optimized array type\"), \"type\"), nullptr));\n            }\n\n            if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format, \"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, \"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,\n                                        exception_message(input_format, concat(\"expected '#' after type information; last byte: 0x\", last_token), \"size\"), nullptr));\n            }\n\n            const bool is_error = get_ubjson_size_value(result.first, is_ndarray);\n            if (input_format == input_format_t::bjdata && is_ndarray)\n            {\n                if (inside_ndarray)\n                {\n                    return sax->parse_error(chars_read, get_token_string(), parse_error::create(112, chars_read,\n                                            exception_message(input_format, \"ndarray can not be recursive\", \"size\"), nullptr));\n                }\n                result.second |= (1 << 8); // use bit 8 to indicate ndarray, all UBJSON and BJData markers should be ASCII letters\n            }\n            return is_error;\n        }\n\n        if (current == '#')\n        {\n            const bool is_error = get_ubjson_size_value(result.first, is_ndarray);\n            if (input_format == input_format_t::bjdata && is_ndarray)\n            {\n                return sax->parse_error(chars_read, get_token_string(), parse_error::create(112, chars_read,\n                                        exception_message(input_format, \"ndarray requires both type and size\", \"size\"), nullptr));\n            }\n            return is_error;\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 char_traits<char_type>::eof():  // EOF\n                return unexpect_eof(input_format, \"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, number) && sax->number_unsigned(number);\n            }\n\n            case 'i':\n            {\n                std::int8_t number{};\n                return get_number(input_format, number) && sax->number_integer(number);\n            }\n\n            case 'I':\n            {\n                std::int16_t number{};\n                return get_number(input_format, number) && sax->number_integer(number);\n            }\n\n            case 'l':\n            {\n                std::int32_t number{};\n                return get_number(input_format, number) && sax->number_integer(number);\n            }\n\n            case 'L':\n            {\n                std::int64_t number{};\n                return get_number(input_format, number) && sax->number_integer(number);\n            }\n\n            case 'u':\n            {\n                if (input_format != input_format_t::bjdata)\n                {\n                    break;\n                }\n                std::uint16_t number{};\n                return get_number(input_format, number) && sax->number_unsigned(number);\n            }\n\n            case 'm':\n            {\n                if (input_format != input_format_t::bjdata)\n                {\n                    break;\n                }\n                std::uint32_t number{};\n                return get_number(input_format, number) && sax->number_unsigned(number);\n            }\n\n            case 'M':\n            {\n                if (input_format != input_format_t::bjdata)\n                {\n                    break;\n                }\n                std::uint64_t number{};\n                return get_number(input_format, number) && sax->number_unsigned(number);\n            }\n\n            case 'h':\n            {\n                if (input_format != input_format_t::bjdata)\n                {\n                    break;\n                }\n                const auto byte1_raw = get();\n                if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format, \"number\")))\n                {\n                    return false;\n                }\n                const auto byte2_raw = get();\n                if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format, \"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>((byte2 << 8u) + byte1);\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 'd':\n            {\n                float number{};\n                return get_number(input_format, 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, 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, \"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,\n                                            exception_message(input_format, concat(\"byte after 'C' must be in range 0x00..0x7F; last byte: 0x\", last_token), \"char\"), nullptr));\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                break;\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, \"invalid byte: 0x\" + last_token, \"value\"), nullptr));\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 bit-8 of size_and_type.second is set to 1, encode bjdata ndarray as an object in JData annotated array format (https://github.com/NeuroJSON/jdata):\n        // {\"_ArrayType_\" : \"typeid\", \"_ArraySize_\" : [n1, n2, ...], \"_ArrayData_\" : [v1, v2, ...]}\n\n        if (input_format == input_format_t::bjdata && size_and_type.first != npos && (size_and_type.second & (1 << 8)) != 0)\n        {\n            size_and_type.second &= ~(static_cast<char_int_type>(1) << 8);  // use bit 8 to indicate ndarray, here we remove the bit to restore the type marker\n            auto it = std::lower_bound(bjd_types_map.begin(), bjd_types_map.end(), size_and_type.second, [](const bjd_type & p, char_int_type t)\n            {\n                return p.first < t;\n            });\n            string_t key = \"_ArrayType_\";\n            if (JSON_HEDLEY_UNLIKELY(it == bjd_types_map.end() || it->first != size_and_type.second))\n            {\n                auto last_token = get_token_string();\n                return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read,\n                                        exception_message(input_format, \"invalid byte: 0x\" + last_token, \"type\"), nullptr));\n            }\n\n            string_t type = it->second; // sax->string() takes a reference\n            if (JSON_HEDLEY_UNLIKELY(!sax->key(key) || !sax->string(type)))\n            {\n                return false;\n            }\n\n            if (size_and_type.second == 'C')\n            {\n                size_and_type.second = 'U';\n            }\n\n            key = \"_ArrayData_\";\n            if (JSON_HEDLEY_UNLIKELY(!sax->key(key) || !sax->start_array(size_and_type.first) ))\n            {\n                return false;\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            return (sax->end_array() && sax->end_object());\n        }\n\n        if (size_and_type.first != 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(static_cast<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        // do not accept ND-array size in objects in BJData\n        if (input_format == input_format_t::bjdata && size_and_type.first != npos && (size_and_type.second & (1 << 8)) != 0)\n        {\n            auto last_token = get_token_string();\n            return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read,\n                                    exception_message(input_format, \"BJData object does not support ND-array size in optimized format\", \"object\"), nullptr));\n        }\n\n        string_t key;\n        if (size_and_type.first != 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(static_cast<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        bool no_ndarray = true;\n        auto res = get_ubjson_size_value(size, no_ndarray);\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, \"number\")))\n            {\n                return false;\n            }\n            number_vector.push_back(static_cast<char>(current));\n        }\n\n        // parse number string\n        using ia_type = decltype(detail::input_adapter(number_vector));\n        auto number_lexer = detail::lexer<BasicJsonType, ia_type>(detail::input_adapter(number_vector), 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,\n                                    exception_message(input_format, concat(\"invalid number text: \", number_lexer.get_token_string()), \"high-precision number\"), nullptr));\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            case token_type::uninitialized:\n            case token_type::literal_true:\n            case token_type::literal_false:\n            case token_type::literal_null:\n            case token_type::value_string:\n            case token_type::begin_array:\n            case token_type::begin_object:\n            case token_type::end_array:\n            case token_type::end_object:\n            case token_type::name_separator:\n            case token_type::value_separator:\n            case token_type::parse_error:\n            case token_type::end_of_input:\n            case token_type::literal_or_value:\n            default:\n                return sax->parse_error(chars_read, number_string, parse_error::create(115, chars_read,\n                                        exception_message(input_format, concat(\"invalid number text: \", number_lexer.get_token_string()), \"high-precision number\"), nullptr));\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    `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 endianness, 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          On the other hand, BSON and BJData use little endian and should reorder\n          on big 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 || format == input_format_t::bjdata))\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 == 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), nullptr));\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        static_cast<void>((std::snprintf)(cr.data(), cr.size(), \"%.2hhX\", static_cast<unsigned char>(current))); // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg)\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            case input_format_t::bjdata:\n                error_msg += \"BJData\";\n                break;\n\n            case input_format_t::json: // LCOV_EXCL_LINE\n            default:            // LCOV_EXCL_LINE\n                JSON_ASSERT(false); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert) LCOV_EXCL_LINE\n        }\n\n        return concat(error_msg, ' ', context, \": \", detail);\n    }\n\n  private:\n    static JSON_INLINE_VARIABLE constexpr std::size_t npos = static_cast<std::size_t>(-1);\n\n    /// input adapter\n    InputAdapterType ia;\n\n    /// the current character\n    char_int_type current = 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 endianness\n    const bool is_little_endian = little_endianness();\n\n    /// input format\n    const input_format_t input_format = input_format_t::json;\n\n    /// the SAX parser\n    json_sax_t* sax = nullptr;\n\n    // excluded markers in bjdata optimized type\n#define JSON_BINARY_READER_MAKE_BJD_OPTIMIZED_TYPE_MARKERS_ \\\n    make_array<char_int_type>('F', 'H', 'N', 'S', 'T', 'Z', '[', '{')\n\n#define JSON_BINARY_READER_MAKE_BJD_TYPES_MAP_ \\\n    make_array<bjd_type>(                      \\\n    bjd_type{'C', \"char\"},                     \\\n    bjd_type{'D', \"double\"},                   \\\n    bjd_type{'I', \"int16\"},                    \\\n    bjd_type{'L', \"int64\"},                    \\\n    bjd_type{'M', \"uint64\"},                   \\\n    bjd_type{'U', \"uint8\"},                    \\\n    bjd_type{'d', \"single\"},                   \\\n    bjd_type{'i', \"int8\"},                     \\\n    bjd_type{'l', \"int32\"},                    \\\n    bjd_type{'m', \"uint32\"},                   \\\n    bjd_type{'u', \"uint16\"})\n\n  JSON_PRIVATE_UNLESS_TESTED:\n    // lookup tables\n    // NOLINTNEXTLINE(cppcoreguidelines-non-private-member-variables-in-classes)\n    const decltype(JSON_BINARY_READER_MAKE_BJD_OPTIMIZED_TYPE_MARKERS_) bjd_optimized_type_markers =\n        JSON_BINARY_READER_MAKE_BJD_OPTIMIZED_TYPE_MARKERS_;\n\n    using bjd_type = std::pair<char_int_type, string_t>;\n    // NOLINTNEXTLINE(cppcoreguidelines-non-private-member-variables-in-classes)\n    const decltype(JSON_BINARY_READER_MAKE_BJD_TYPES_MAP_) bjd_types_map =\n        JSON_BINARY_READER_MAKE_BJD_TYPES_MAP_;\n\n#undef JSON_BINARY_READER_MAKE_BJD_OPTIMIZED_TYPE_MARKERS_\n#undef JSON_BINARY_READER_MAKE_BJD_TYPES_MAP_\n};\n\n#ifndef JSON_HAS_CPP_17\n    template<typename BasicJsonType, typename InputAdapterType, typename SAX>\n    constexpr std::size_t binary_reader<BasicJsonType, InputAdapterType, SAX>::npos;\n#endif\n\n}  // namespace detail\nNLOHMANN_JSON_NAMESPACE_END\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//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\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/string_concat.hpp>\n\n// #include <nlohmann/detail/value_t.hpp>\n\n\nNLOHMANN_JSON_NAMESPACE_BEGIN\nnamespace detail\n{\n////////////\n// parser //\n////////////\n\nenum class parse_event_t : std::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\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\"), nullptr));\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\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(), exception_message(token_type::end_of_input, \"value\"), nullptr));\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        result.assert_invariant();\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(), exception_message(token_type::end_of_input, \"value\"), nullptr));\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(static_cast<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(), exception_message(token_type::value_string, \"object key\"), nullptr));\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(), exception_message(token_type::name_separator, \"object separator\"), nullptr));\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(static_cast<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, concat(\"number overflow parsing '\", m_lexer.get_token_string(), '\\''), nullptr));\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(), exception_message(token_type::uninitialized, \"value\"), nullptr));\n                    }\n                    case token_type::end_of_input:\n                    {\n                        if (JSON_HEDLEY_UNLIKELY(m_lexer.get_position().chars_read_total == 1))\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                                                            \"attempting to parse an empty input; check that your input string or stream contains the expected JSON\", nullptr));\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(), exception_message(token_type::literal_or_value, \"value\"), nullptr));\n                    }\n                    case token_type::uninitialized:\n                    case token_type::end_array:\n                    case token_type::end_object:\n                    case token_type::name_separator:\n                    case token_type::value_separator:\n                    case token_type::literal_or_value:\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(), exception_message(token_type::literal_or_value, \"value\"), nullptr));\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(), exception_message(token_type::end_array, \"array\"), nullptr));\n            }\n\n            // states.back() is false -> 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(), exception_message(token_type::value_string, \"object key\"), nullptr));\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(), exception_message(token_type::name_separator, \"object separator\"), nullptr));\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(), exception_message(token_type::end_object, \"object\"), nullptr));\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 += concat(\"while parsing \", context, ' ');\n        }\n\n        error_msg += \"- \";\n\n        if (last_token == token_type::parse_error)\n        {\n            error_msg += concat(m_lexer.get_error_message(), \"; last read: '\",\n                                m_lexer.get_token_string(), '\\'');\n        }\n        else\n        {\n            error_msg += concat(\"unexpected \", lexer_t::token_type_name(last_token));\n        }\n\n        if (expected != token_type::uninitialized)\n        {\n            error_msg += concat(\"; expected \", 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\n}  // namespace detail\nNLOHMANN_JSON_NAMESPACE_END\n\n// #include <nlohmann/detail/iterators/internal_iterator.hpp>\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\n\n\n// #include <nlohmann/detail/abi_macros.hpp>\n\n// #include <nlohmann/detail/iterators/primitive_iterator.hpp>\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\n\n\n#include <cstddef> // ptrdiff_t\n#include <limits>  // numeric_limits\n\n// #include <nlohmann/detail/macro_scope.hpp>\n\n\nNLOHMANN_JSON_NAMESPACE_BEGIN\nnamespace detail\n{\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 operator++(int)& noexcept // NOLINT(cert-dcl21-cpp)\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 operator--(int)& noexcept // NOLINT(cert-dcl21-cpp)\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\n}  // namespace detail\nNLOHMANN_JSON_NAMESPACE_END\n\n\nNLOHMANN_JSON_NAMESPACE_BEGIN\nnamespace detail\n{\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\n}  // namespace detail\nNLOHMANN_JSON_NAMESPACE_END\n\n// #include <nlohmann/detail/iterators/iter_impl.hpp>\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\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\nNLOHMANN_JSON_NAMESPACE_BEGIN\nnamespace detail\n{\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 // NOLINT(cppcoreguidelines-special-member-functions,hicpp-special-member-functions)\n{\n    /// the iterator with BasicJsonType of different const-ness\n    using other_iter_impl = iter_impl<typename std::conditional<std::is_const<BasicJsonType>::value, typename std::remove_const<BasicJsonType>::type, const BasicJsonType>::type>;\n    /// allow basic_json to access private members\n    friend other_iter_impl;\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    // superficial check for the LegacyBidirectionalIterator named requirement\n    static_assert(std::is_base_of<std::bidirectional_iterator_tag, std::bidirectional_iterator_tag>::value\n                  &&  std::is_base_of<std::bidirectional_iterator_tag, typename std::iterator_traits<typename array_t::iterator>::iterator_category>::value,\n                  \"basic_json iterator assumes array and object type iterators satisfy the LegacyBidirectionalIterator named requirement.\");\n\n  public:\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    iter_impl() = default;\n    ~iter_impl() = default;\n    iter_impl(iter_impl&&) noexcept = default;\n    iter_impl& operator=(iter_impl&&) noexcept = 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_data.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            case value_t::null:\n            case value_t::string:\n            case value_t::boolean:\n            case value_t::number_integer:\n            case value_t::number_unsigned:\n            case value_t::number_float:\n            case value_t::binary:\n            case value_t::discarded:\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        if (&other != this)\n        {\n            m_object = other.m_object;\n            m_it = other.m_it;\n        }\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 // NOLINT(cert-oop54-cpp)\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_data.m_type)\n        {\n            case value_t::object:\n            {\n                m_it.object_iterator = m_object->m_data.m_value.object->begin();\n                break;\n            }\n\n            case value_t::array:\n            {\n                m_it.array_iterator = m_object->m_data.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            case value_t::string:\n            case value_t::boolean:\n            case value_t::number_integer:\n            case value_t::number_unsigned:\n            case value_t::number_float:\n            case value_t::binary:\n            case value_t::discarded:\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_data.m_type)\n        {\n            case value_t::object:\n            {\n                m_it.object_iterator = m_object->m_data.m_value.object->end();\n                break;\n            }\n\n            case value_t::array:\n            {\n                m_it.array_iterator = m_object->m_data.m_value.array->end();\n                break;\n            }\n\n            case value_t::null:\n            case value_t::string:\n            case value_t::boolean:\n            case value_t::number_integer:\n            case value_t::number_unsigned:\n            case value_t::number_float:\n            case value_t::binary:\n            case value_t::discarded:\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_data.m_type)\n        {\n            case value_t::object:\n            {\n                JSON_ASSERT(m_it.object_iterator != m_object->m_data.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_data.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\", m_object));\n\n            case value_t::string:\n            case value_t::boolean:\n            case value_t::number_integer:\n            case value_t::number_unsigned:\n            case value_t::number_float:\n            case value_t::binary:\n            case value_t::discarded:\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\", m_object));\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_data.m_type)\n        {\n            case value_t::object:\n            {\n                JSON_ASSERT(m_it.object_iterator != m_object->m_data.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_data.m_value.array->end());\n                return &*m_it.array_iterator;\n            }\n\n            case value_t::null:\n            case value_t::string:\n            case value_t::boolean:\n            case value_t::number_integer:\n            case value_t::number_unsigned:\n            case value_t::number_float:\n            case value_t::binary:\n            case value_t::discarded:\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\", m_object));\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 operator++(int)& // NOLINT(cert-dcl21-cpp)\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_data.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            case value_t::null:\n            case value_t::string:\n            case value_t::boolean:\n            case value_t::number_integer:\n            case value_t::number_unsigned:\n            case value_t::number_float:\n            case value_t::binary:\n            case value_t::discarded:\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 operator--(int)& // NOLINT(cert-dcl21-cpp)\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_data.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            case value_t::null:\n            case value_t::string:\n            case value_t::boolean:\n            case value_t::number_integer:\n            case value_t::number_unsigned:\n            case value_t::number_float:\n            case value_t::binary:\n            case value_t::discarded:\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    template < typename IterImpl, detail::enable_if_t < (std::is_same<IterImpl, iter_impl>::value || std::is_same<IterImpl, other_iter_impl>::value), std::nullptr_t > = nullptr >\n    bool operator==(const IterImpl& 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\", m_object));\n        }\n\n        JSON_ASSERT(m_object != nullptr);\n\n        switch (m_object->m_data.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            case value_t::null:\n            case value_t::string:\n            case value_t::boolean:\n            case value_t::number_integer:\n            case value_t::number_unsigned:\n            case value_t::number_float:\n            case value_t::binary:\n            case value_t::discarded:\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    template < typename IterImpl, detail::enable_if_t < (std::is_same<IterImpl, iter_impl>::value || std::is_same<IterImpl, other_iter_impl>::value), std::nullptr_t > = nullptr >\n    bool operator!=(const IterImpl& 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\", m_object));\n        }\n\n        JSON_ASSERT(m_object != nullptr);\n\n        switch (m_object->m_data.m_type)\n        {\n            case value_t::object:\n                JSON_THROW(invalid_iterator::create(213, \"cannot compare order of object iterators\", m_object));\n\n            case value_t::array:\n                return (m_it.array_iterator < other.m_it.array_iterator);\n\n            case value_t::null:\n            case value_t::string:\n            case value_t::boolean:\n            case value_t::number_integer:\n            case value_t::number_unsigned:\n            case value_t::number_float:\n            case value_t::binary:\n            case value_t::discarded:\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_data.m_type)\n        {\n            case value_t::object:\n                JSON_THROW(invalid_iterator::create(209, \"cannot use offsets with object iterators\", m_object));\n\n            case value_t::array:\n            {\n                std::advance(m_it.array_iterator, i);\n                break;\n            }\n\n            case value_t::null:\n            case value_t::string:\n            case value_t::boolean:\n            case value_t::number_integer:\n            case value_t::number_unsigned:\n            case value_t::number_float:\n            case value_t::binary:\n            case value_t::discarded:\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_data.m_type)\n        {\n            case value_t::object:\n                JSON_THROW(invalid_iterator::create(209, \"cannot use offsets with object iterators\", m_object));\n\n            case value_t::array:\n                return m_it.array_iterator - other.m_it.array_iterator;\n\n            case value_t::null:\n            case value_t::string:\n            case value_t::boolean:\n            case value_t::number_integer:\n            case value_t::number_unsigned:\n            case value_t::number_float:\n            case value_t::binary:\n            case value_t::discarded:\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_data.m_type)\n        {\n            case value_t::object:\n                JSON_THROW(invalid_iterator::create(208, \"cannot use operator[] for object iterators\", m_object));\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\", m_object));\n\n            case value_t::string:\n            case value_t::boolean:\n            case value_t::number_integer:\n            case value_t::number_unsigned:\n            case value_t::number_float:\n            case value_t::binary:\n            case value_t::discarded:\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\", m_object));\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\", m_object));\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\n}  // namespace detail\nNLOHMANN_JSON_NAMESPACE_END\n\n// #include <nlohmann/detail/iterators/iteration_proxy.hpp>\n\n// #include <nlohmann/detail/iterators/json_reverse_iterator.hpp>\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\n\n\n#include <cstddef> // ptrdiff_t\n#include <iterator> // reverse_iterator\n#include <utility> // declval\n\n// #include <nlohmann/detail/abi_macros.hpp>\n\n\nNLOHMANN_JSON_NAMESPACE_BEGIN\nnamespace detail\n{\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 operator++(int)& // NOLINT(cert-dcl21-cpp)\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 operator--(int)& // NOLINT(cert-dcl21-cpp)\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\n}  // namespace detail\nNLOHMANN_JSON_NAMESPACE_END\n\n// #include <nlohmann/detail/iterators/primitive_iterator.hpp>\n\n// #include <nlohmann/detail/json_custom_base_class.hpp>\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\n\n\n#include <type_traits> // conditional, is_same\n\n// #include <nlohmann/detail/abi_macros.hpp>\n\n\nNLOHMANN_JSON_NAMESPACE_BEGIN\nnamespace detail\n{\n\n/*!\n@brief Default base class of the @ref basic_json class.\n\nSo that the correct implementations of the copy / move ctors / assign operators\nof @ref basic_json do not require complex case distinctions\n(no base class / custom base class used as customization point),\n@ref basic_json always has a base class.\nBy default, this class is used because it is empty and thus has no effect\non the behavior of @ref basic_json.\n*/\nstruct json_default_base {};\n\ntemplate<class T>\nusing json_base_class = typename std::conditional <\n                        std::is_same<T, void>::value,\n                        json_default_base,\n                        T\n                        >::type;\n\n}  // namespace detail\nNLOHMANN_JSON_NAMESPACE_END\n\n// #include <nlohmann/detail/json_pointer.hpp>\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\n\n\n#include <algorithm> // all_of\n#include <cctype> // isdigit\n#include <cerrno> // errno, ERANGE\n#include <cstdlib> // strtoull\n#ifndef JSON_NO_IO\n    #include <iosfwd> // ostream\n#endif  // JSON_NO_IO\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/string_concat.hpp>\n\n// #include <nlohmann/detail/string_escape.hpp>\n\n// #include <nlohmann/detail/value_t.hpp>\n\n\nNLOHMANN_JSON_NAMESPACE_BEGIN\n\n/// @brief JSON Pointer defines a string syntax for identifying a specific value within a JSON document\n/// @sa https://json.nlohmann.me/api/json_pointer/\ntemplate<typename RefStringType>\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    template<typename>\n    friend class json_pointer;\n\n    template<typename T>\n    struct string_t_helper\n    {\n        using type = T;\n    };\n\n    NLOHMANN_BASIC_JSON_TPL_DECLARATION\n    struct string_t_helper<NLOHMANN_BASIC_JSON_TPL>\n    {\n        using type = StringType;\n    };\n\n  public:\n    // for backwards compatibility accept BasicJsonType\n    using string_t = typename string_t_helper<RefStringType>::type;\n\n    /// @brief create JSON pointer\n    /// @sa https://json.nlohmann.me/api/json_pointer/json_pointer/\n    explicit json_pointer(const string_t& s = \"\")\n        : reference_tokens(split(s))\n    {}\n\n    /// @brief return a string representation of the JSON pointer\n    /// @sa https://json.nlohmann.me/api/json_pointer/to_string/\n    string_t to_string() const\n    {\n        return std::accumulate(reference_tokens.begin(), reference_tokens.end(),\n                               string_t{},\n                               [](const string_t& a, const string_t& b)\n        {\n            return detail::concat(a, '/', detail::escape(b));\n        });\n    }\n\n    /// @brief return a string representation of the JSON pointer\n    /// @sa https://json.nlohmann.me/api/json_pointer/operator_string/\n    JSON_HEDLEY_DEPRECATED_FOR(3.11.0, to_string())\n    operator string_t() const\n    {\n        return to_string();\n    }\n\n#ifndef JSON_NO_IO\n    /// @brief write string representation of the JSON pointer to stream\n    /// @sa https://json.nlohmann.me/api/basic_json/operator_ltlt/\n    friend std::ostream& operator<<(std::ostream& o, const json_pointer& ptr)\n    {\n        o << ptr.to_string();\n        return o;\n    }\n#endif\n\n    /// @brief append another JSON pointer at the end of this JSON pointer\n    /// @sa https://json.nlohmann.me/api/json_pointer/operator_slasheq/\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    /// @brief append an unescaped reference token at the end of this JSON pointer\n    /// @sa https://json.nlohmann.me/api/json_pointer/operator_slasheq/\n    json_pointer& operator/=(string_t token)\n    {\n        push_back(std::move(token));\n        return *this;\n    }\n\n    /// @brief append an array index at the end of this JSON pointer\n    /// @sa https://json.nlohmann.me/api/json_pointer/operator_slasheq/\n    json_pointer& operator/=(std::size_t array_idx)\n    {\n        return *this /= std::to_string(array_idx);\n    }\n\n    /// @brief create a new JSON pointer by appending the right JSON pointer at the end of the left JSON pointer\n    /// @sa https://json.nlohmann.me/api/json_pointer/operator_slash/\n    friend json_pointer operator/(const json_pointer& lhs,\n                                  const json_pointer& rhs)\n    {\n        return json_pointer(lhs) /= rhs;\n    }\n\n    /// @brief create a new JSON pointer by appending the unescaped token at the end of the JSON pointer\n    /// @sa https://json.nlohmann.me/api/json_pointer/operator_slash/\n    friend json_pointer operator/(const json_pointer& lhs, string_t token) // NOLINT(performance-unnecessary-value-param)\n    {\n        return json_pointer(lhs) /= std::move(token);\n    }\n\n    /// @brief create a new JSON pointer by appending the array-index-token at the end of the JSON pointer\n    /// @sa https://json.nlohmann.me/api/json_pointer/operator_slash/\n    friend json_pointer operator/(const json_pointer& lhs, std::size_t array_idx)\n    {\n        return json_pointer(lhs) /= array_idx;\n    }\n\n    /// @brief returns the parent of this JSON pointer\n    /// @sa https://json.nlohmann.me/api/json_pointer/parent_pointer/\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    /// @brief remove last reference token\n    /// @sa https://json.nlohmann.me/api/json_pointer/pop_back/\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\", nullptr));\n        }\n\n        reference_tokens.pop_back();\n    }\n\n    /// @brief return last reference token\n    /// @sa https://json.nlohmann.me/api/json_pointer/back/\n    const string_t& back() const\n    {\n        if (JSON_HEDLEY_UNLIKELY(empty()))\n        {\n            JSON_THROW(detail::out_of_range::create(405, \"JSON pointer has no parent\", nullptr));\n        }\n\n        return reference_tokens.back();\n    }\n\n    /// @brief append an unescaped token at the end of the reference pointer\n    /// @sa https://json.nlohmann.me/api/json_pointer/push_back/\n    void push_back(const string_t& token)\n    {\n        reference_tokens.push_back(token);\n    }\n\n    /// @brief append an unescaped token at the end of the reference pointer\n    /// @sa https://json.nlohmann.me/api/json_pointer/push_back/\n    void push_back(string_t&& token)\n    {\n        reference_tokens.push_back(std::move(token));\n    }\n\n    /// @brief return whether pointer points to the root document\n    /// @sa https://json.nlohmann.me/api/json_pointer/empty/\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    template<typename BasicJsonType>\n    static typename BasicJsonType::size_type array_index(const string_t& 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, detail::concat(\"array index '\", s, \"' must not begin with '0'\"), nullptr));\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, detail::concat(\"array index '\", s, \"' is not a number\"), nullptr));\n        }\n\n        const char* p = s.c_str();\n        char* p_end = nullptr;\n        errno = 0; // strtoull doesn't reset errno\n        const unsigned long long res = std::strtoull(p, &p_end, 10); // NOLINT(runtime/int)\n        if (p == p_end // invalid input or empty string\n                || errno == ERANGE // out of range\n                || JSON_HEDLEY_UNLIKELY(static_cast<std::size_t>(p_end - p) != s.size())) // incomplete read\n        {\n            JSON_THROW(detail::out_of_range::create(404, detail::concat(\"unresolved reference token '\", s, \"'\"), nullptr));\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)()))  // NOLINT(runtime/int)\n        {\n            JSON_THROW(detail::out_of_range::create(410, detail::concat(\"array index \", s, \" exceeds size_type\"), nullptr));   // 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\", nullptr));\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    template<typename BasicJsonType>\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<BasicJsonType>(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                case detail::value_t::string:\n                case detail::value_t::boolean:\n                case detail::value_t::number_integer:\n                case detail::value_t::number_unsigned:\n                case detail::value_t::number_float:\n                case detail::value_t::binary:\n                case detail::value_t::discarded:\n                default:\n                    JSON_THROW(detail::type_error::create(313, \"invalid value to unflatten\", &j));\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    template<typename BasicJsonType>\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_data.m_value.array->size());\n                    }\n                    else\n                    {\n                        // convert array index to number; unchecked access\n                        ptr = &ptr->operator[](array_index<BasicJsonType>(reference_token));\n                    }\n                    break;\n                }\n\n                case detail::value_t::null:\n                case detail::value_t::string:\n                case detail::value_t::boolean:\n                case detail::value_t::number_integer:\n                case detail::value_t::number_unsigned:\n                case detail::value_t::number_float:\n                case detail::value_t::binary:\n                case detail::value_t::discarded:\n                default:\n                    JSON_THROW(detail::out_of_range::create(404, detail::concat(\"unresolved reference token '\", reference_token, \"'\"), ptr));\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    template<typename BasicJsonType>\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, detail::concat(\n                                \"array index '-' (\", std::to_string(ptr->m_data.m_value.array->size()),\n                                \") is out of range\"), ptr));\n                    }\n\n                    // note: at performs range check\n                    ptr = &ptr->at(array_index<BasicJsonType>(reference_token));\n                    break;\n                }\n\n                case detail::value_t::null:\n                case detail::value_t::string:\n                case detail::value_t::boolean:\n                case detail::value_t::number_integer:\n                case detail::value_t::number_unsigned:\n                case detail::value_t::number_float:\n                case detail::value_t::binary:\n                case detail::value_t::discarded:\n                default:\n                    JSON_THROW(detail::out_of_range::create(404, detail::concat(\"unresolved reference token '\", reference_token, \"'\"), ptr));\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    template<typename BasicJsonType>\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, detail::concat(\"array index '-' (\", std::to_string(ptr->m_data.m_value.array->size()), \") is out of range\"), ptr));\n                    }\n\n                    // use unchecked array access\n                    ptr = &ptr->operator[](array_index<BasicJsonType>(reference_token));\n                    break;\n                }\n\n                case detail::value_t::null:\n                case detail::value_t::string:\n                case detail::value_t::boolean:\n                case detail::value_t::number_integer:\n                case detail::value_t::number_unsigned:\n                case detail::value_t::number_float:\n                case detail::value_t::binary:\n                case detail::value_t::discarded:\n                default:\n                    JSON_THROW(detail::out_of_range::create(404, detail::concat(\"unresolved reference token '\", reference_token, \"'\"), ptr));\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    template<typename BasicJsonType>\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, detail::concat(\n                                \"array index '-' (\", std::to_string(ptr->m_data.m_value.array->size()),\n                                \") is out of range\"), ptr));\n                    }\n\n                    // note: at performs range check\n                    ptr = &ptr->at(array_index<BasicJsonType>(reference_token));\n                    break;\n                }\n\n                case detail::value_t::null:\n                case detail::value_t::string:\n                case detail::value_t::boolean:\n                case detail::value_t::number_integer:\n                case detail::value_t::number_unsigned:\n                case detail::value_t::number_float:\n                case detail::value_t::binary:\n                case detail::value_t::discarded:\n                default:\n                    JSON_THROW(detail::out_of_range::create(404, detail::concat(\"unresolved reference token '\", reference_token, \"'\"), ptr));\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    template<typename BasicJsonType>\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<BasicJsonType>(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                case detail::value_t::null:\n                case detail::value_t::string:\n                case detail::value_t::boolean:\n                case detail::value_t::number_integer:\n                case detail::value_t::number_unsigned:\n                case detail::value_t::number_float:\n                case detail::value_t::binary:\n                case detail::value_t::discarded:\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<string_t> split(const string_t& reference_string)\n    {\n        std::vector<string_t> 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, detail::concat(\"JSON pointer must be empty or begin with '/' - was: '\", reference_string, \"'\"), nullptr));\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 == string_t::npos)\n            start != 0;\n            // set the beginning of the next reference token\n            // (will eventually be 0 if slash == string_t::npos)\n            start = (slash == string_t::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 != string_t::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'\", nullptr));\n                }\n            }\n\n            // finally, store the reference token\n            detail::unescape(reference_token);\n            result.push_back(reference_token);\n        }\n\n        return result;\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    template<typename BasicJsonType>\n    static void flatten(const string_t& 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_data.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_data.m_value.array->size(); ++i)\n                    {\n                        flatten(detail::concat(reference_string, '/', std::to_string(i)),\n                                value.m_data.m_value.array->operator[](i), result);\n                    }\n                }\n                break;\n            }\n\n            case detail::value_t::object:\n            {\n                if (value.m_data.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_data.m_value.object)\n                    {\n                        flatten(detail::concat(reference_string, '/', detail::escape(element.first)), element.second, result);\n                    }\n                }\n                break;\n            }\n\n            case detail::value_t::null:\n            case detail::value_t::string:\n            case detail::value_t::boolean:\n            case detail::value_t::number_integer:\n            case detail::value_t::number_unsigned:\n            case detail::value_t::number_float:\n            case detail::value_t::binary:\n            case detail::value_t::discarded:\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    template<typename BasicJsonType>\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\", &value));\n        }\n\n        BasicJsonType result;\n\n        // iterate the JSON object values\n        for (const auto& element : *value.m_data.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\", &element.second));\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    // can't use conversion operator because of ambiguity\n    json_pointer<string_t> convert() const&\n    {\n        json_pointer<string_t> result;\n        result.reference_tokens = reference_tokens;\n        return result;\n    }\n\n    json_pointer<string_t> convert()&&\n    {\n        json_pointer<string_t> result;\n        result.reference_tokens = std::move(reference_tokens);\n        return result;\n    }\n\n  public:\n#if JSON_HAS_THREE_WAY_COMPARISON\n    /// @brief compares two JSON pointers for equality\n    /// @sa https://json.nlohmann.me/api/json_pointer/operator_eq/\n    template<typename RefStringTypeRhs>\n    bool operator==(const json_pointer<RefStringTypeRhs>& rhs) const noexcept\n    {\n        return reference_tokens == rhs.reference_tokens;\n    }\n\n    /// @brief compares JSON pointer and string for equality\n    /// @sa https://json.nlohmann.me/api/json_pointer/operator_eq/\n    JSON_HEDLEY_DEPRECATED_FOR(3.11.2, operator==(json_pointer))\n    bool operator==(const string_t& rhs) const\n    {\n        return *this == json_pointer(rhs);\n    }\n\n    /// @brief 3-way compares two JSON pointers\n    template<typename RefStringTypeRhs>\n    std::strong_ordering operator<=>(const json_pointer<RefStringTypeRhs>& rhs) const noexcept // *NOPAD*\n    {\n        return  reference_tokens <=> rhs.reference_tokens; // *NOPAD*\n    }\n#else\n    /// @brief compares two JSON pointers for equality\n    /// @sa https://json.nlohmann.me/api/json_pointer/operator_eq/\n    template<typename RefStringTypeLhs, typename RefStringTypeRhs>\n    // NOLINTNEXTLINE(readability-redundant-declaration)\n    friend bool operator==(const json_pointer<RefStringTypeLhs>& lhs,\n                           const json_pointer<RefStringTypeRhs>& rhs) noexcept;\n\n    /// @brief compares JSON pointer and string for equality\n    /// @sa https://json.nlohmann.me/api/json_pointer/operator_eq/\n    template<typename RefStringTypeLhs, typename StringType>\n    // NOLINTNEXTLINE(readability-redundant-declaration)\n    friend bool operator==(const json_pointer<RefStringTypeLhs>& lhs,\n                           const StringType& rhs);\n\n    /// @brief compares string and JSON pointer for equality\n    /// @sa https://json.nlohmann.me/api/json_pointer/operator_eq/\n    template<typename RefStringTypeRhs, typename StringType>\n    // NOLINTNEXTLINE(readability-redundant-declaration)\n    friend bool operator==(const StringType& lhs,\n                           const json_pointer<RefStringTypeRhs>& rhs);\n\n    /// @brief compares two JSON pointers for inequality\n    /// @sa https://json.nlohmann.me/api/json_pointer/operator_ne/\n    template<typename RefStringTypeLhs, typename RefStringTypeRhs>\n    // NOLINTNEXTLINE(readability-redundant-declaration)\n    friend bool operator!=(const json_pointer<RefStringTypeLhs>& lhs,\n                           const json_pointer<RefStringTypeRhs>& rhs) noexcept;\n\n    /// @brief compares JSON pointer and string for inequality\n    /// @sa https://json.nlohmann.me/api/json_pointer/operator_ne/\n    template<typename RefStringTypeLhs, typename StringType>\n    // NOLINTNEXTLINE(readability-redundant-declaration)\n    friend bool operator!=(const json_pointer<RefStringTypeLhs>& lhs,\n                           const StringType& rhs);\n\n    /// @brief compares string and JSON pointer for inequality\n    /// @sa https://json.nlohmann.me/api/json_pointer/operator_ne/\n    template<typename RefStringTypeRhs, typename StringType>\n    // NOLINTNEXTLINE(readability-redundant-declaration)\n    friend bool operator!=(const StringType& lhs,\n                           const json_pointer<RefStringTypeRhs>& rhs);\n\n    /// @brief compares two JSON pointer for less-than\n    template<typename RefStringTypeLhs, typename RefStringTypeRhs>\n    // NOLINTNEXTLINE(readability-redundant-declaration)\n    friend bool operator<(const json_pointer<RefStringTypeLhs>& lhs,\n                          const json_pointer<RefStringTypeRhs>& rhs) noexcept;\n#endif\n\n  private:\n    /// the reference tokens\n    std::vector<string_t> reference_tokens;\n};\n\n#if !JSON_HAS_THREE_WAY_COMPARISON\n// functions cannot be defined inside class due to ODR violations\ntemplate<typename RefStringTypeLhs, typename RefStringTypeRhs>\ninline bool operator==(const json_pointer<RefStringTypeLhs>& lhs,\n                       const json_pointer<RefStringTypeRhs>& rhs) noexcept\n{\n    return lhs.reference_tokens == rhs.reference_tokens;\n}\n\ntemplate<typename RefStringTypeLhs,\n         typename StringType = typename json_pointer<RefStringTypeLhs>::string_t>\nJSON_HEDLEY_DEPRECATED_FOR(3.11.2, operator==(json_pointer, json_pointer))\ninline bool operator==(const json_pointer<RefStringTypeLhs>& lhs,\n                       const StringType& rhs)\n{\n    return lhs == json_pointer<RefStringTypeLhs>(rhs);\n}\n\ntemplate<typename RefStringTypeRhs,\n         typename StringType = typename json_pointer<RefStringTypeRhs>::string_t>\nJSON_HEDLEY_DEPRECATED_FOR(3.11.2, operator==(json_pointer, json_pointer))\ninline bool operator==(const StringType& lhs,\n                       const json_pointer<RefStringTypeRhs>& rhs)\n{\n    return json_pointer<RefStringTypeRhs>(lhs) == rhs;\n}\n\ntemplate<typename RefStringTypeLhs, typename RefStringTypeRhs>\ninline bool operator!=(const json_pointer<RefStringTypeLhs>& lhs,\n                       const json_pointer<RefStringTypeRhs>& rhs) noexcept\n{\n    return !(lhs == rhs);\n}\n\ntemplate<typename RefStringTypeLhs,\n         typename StringType = typename json_pointer<RefStringTypeLhs>::string_t>\nJSON_HEDLEY_DEPRECATED_FOR(3.11.2, operator!=(json_pointer, json_pointer))\ninline bool operator!=(const json_pointer<RefStringTypeLhs>& lhs,\n                       const StringType& rhs)\n{\n    return !(lhs == rhs);\n}\n\ntemplate<typename RefStringTypeRhs,\n         typename StringType = typename json_pointer<RefStringTypeRhs>::string_t>\nJSON_HEDLEY_DEPRECATED_FOR(3.11.2, operator!=(json_pointer, json_pointer))\ninline bool operator!=(const StringType& lhs,\n                       const json_pointer<RefStringTypeRhs>& rhs)\n{\n    return !(lhs == rhs);\n}\n\ntemplate<typename RefStringTypeLhs, typename RefStringTypeRhs>\ninline bool operator<(const json_pointer<RefStringTypeLhs>& lhs,\n                      const json_pointer<RefStringTypeRhs>& rhs) noexcept\n{\n    return lhs.reference_tokens < rhs.reference_tokens;\n}\n#endif\n\nNLOHMANN_JSON_NAMESPACE_END\n\n// #include <nlohmann/detail/json_ref.hpp>\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\n\n\n#include <initializer_list>\n#include <utility>\n\n// #include <nlohmann/detail/abi_macros.hpp>\n\n// #include <nlohmann/detail/meta/type_traits.hpp>\n\n\nNLOHMANN_JSON_NAMESPACE_BEGIN\nnamespace detail\n{\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    {}\n\n    json_ref(const value_type& value)\n        : value_ref(&value)\n    {}\n\n    json_ref(std::initializer_list<json_ref> init)\n        : owned_value(init)\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    {}\n\n    // class should be movable only\n    json_ref(json_ref&&) noexcept = 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 (value_ref == nullptr)\n        {\n            return std::move(owned_value);\n        }\n        return *value_ref;\n    }\n\n    value_type const& operator*() const\n    {\n        return value_ref ? *value_ref : owned_value;\n    }\n\n    value_type const* operator->() const\n    {\n        return &** this;\n    }\n\n  private:\n    mutable value_type owned_value = nullptr;\n    value_type const* value_ref = nullptr;\n};\n\n}  // namespace detail\nNLOHMANN_JSON_NAMESPACE_END\n\n// #include <nlohmann/detail/macro_scope.hpp>\n\n// #include <nlohmann/detail/string_concat.hpp>\n\n// #include <nlohmann/detail/string_escape.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//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\n\n\n#include <algorithm> // reverse\n#include <array> // array\n#include <map> // map\n#include <cmath> // isnan, isinf\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 <utility> // move\n#include <vector> // vector\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//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\n\n\n#include <algorithm> // copy\n#include <cstddef> // size_t\n#include <iterator> // back_inserter\n#include <memory> // shared_ptr, make_shared\n#include <string> // basic_string\n#include <vector> // vector\n\n#ifndef JSON_NO_IO\n    #include <ios>      // streamsize\n    #include <ostream>  // basic_ostream\n#endif  // JSON_NO_IO\n\n// #include <nlohmann/detail/macro_scope.hpp>\n\n\nNLOHMANN_JSON_NAMESPACE_BEGIN\nnamespace detail\n{\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    output_adapter_protocol() = default;\n    output_adapter_protocol(const output_adapter_protocol&) = default;\n    output_adapter_protocol(output_adapter_protocol&&) noexcept = default;\n    output_adapter_protocol& operator=(const output_adapter_protocol&) = default;\n    output_adapter_protocol& operator=(output_adapter_protocol&&) noexcept = 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, typename AllocatorType = std::allocator<CharType>>\nclass output_vector_adapter : public output_adapter_protocol<CharType>\n{\n  public:\n    explicit output_vector_adapter(std::vector<CharType, AllocatorType>& 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        v.insert(v.end(), s, s + length);\n    }\n\n  private:\n    std::vector<CharType, AllocatorType>& v;\n};\n\n#ifndef JSON_NO_IO\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#endif  // JSON_NO_IO\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    template<typename AllocatorType = std::allocator<CharType>>\n    output_adapter(std::vector<CharType, AllocatorType>& vec)\n        : oa(std::make_shared<output_vector_adapter<CharType, AllocatorType>>(vec)) {}\n\n#ifndef JSON_NO_IO\n    output_adapter(std::basic_ostream<CharType>& s)\n        : oa(std::make_shared<output_stream_adapter<CharType>>(s)) {}\n#endif  // JSON_NO_IO\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\n}  // namespace detail\nNLOHMANN_JSON_NAMESPACE_END\n\n// #include <nlohmann/detail/string_concat.hpp>\n\n\nNLOHMANN_JSON_NAMESPACE_BEGIN\nnamespace detail\n{\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(std::move(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_data.m_value.object);\n                break;\n            }\n\n            case value_t::null:\n            case value_t::array:\n            case value_t::string:\n            case value_t::boolean:\n            case value_t::number_integer:\n            case value_t::number_unsigned:\n            case value_t::number_float:\n            case value_t::binary:\n            case value_t::discarded:\n            default:\n            {\n                JSON_THROW(type_error::create(317, concat(\"to serialize to BSON, top-level type must be object, but is \", j.type_name()), &j));\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_data.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_data.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_data.m_value.number_integer <= 0x17)\n                    {\n                        write_number(static_cast<std::uint8_t>(j.m_data.m_value.number_integer));\n                    }\n                    else if (j.m_data.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_data.m_value.number_integer));\n                    }\n                    else if (j.m_data.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_data.m_value.number_integer));\n                    }\n                    else if (j.m_data.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_data.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_data.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_data.m_value.number_integer;\n                    if (j.m_data.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_data.m_value.number_unsigned <= 0x17)\n                {\n                    write_number(static_cast<std::uint8_t>(j.m_data.m_value.number_unsigned));\n                }\n                else if (j.m_data.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_data.m_value.number_unsigned));\n                }\n                else if (j.m_data.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_data.m_value.number_unsigned));\n                }\n                else if (j.m_data.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_data.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_data.m_value.number_unsigned));\n                }\n                break;\n            }\n\n            case value_t::number_float:\n            {\n                if (std::isnan(j.m_data.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_data.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_data.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_data.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_data.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_data.m_value.string->c_str()),\n                    j.m_data.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_data.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_data.m_value.array)\n                {\n                    write_cbor(el);\n                }\n                break;\n            }\n\n            case value_t::binary:\n            {\n                if (j.m_data.m_value.binary->has_subtype())\n                {\n                    if (j.m_data.m_value.binary->subtype() <= (std::numeric_limits<std::uint8_t>::max)())\n                    {\n                        write_number(static_cast<std::uint8_t>(0xd8));\n                        write_number(static_cast<std::uint8_t>(j.m_data.m_value.binary->subtype()));\n                    }\n                    else if (j.m_data.m_value.binary->subtype() <= (std::numeric_limits<std::uint16_t>::max)())\n                    {\n                        write_number(static_cast<std::uint8_t>(0xd9));\n                        write_number(static_cast<std::uint16_t>(j.m_data.m_value.binary->subtype()));\n                    }\n                    else if (j.m_data.m_value.binary->subtype() <= (std::numeric_limits<std::uint32_t>::max)())\n                    {\n                        write_number(static_cast<std::uint8_t>(0xda));\n                        write_number(static_cast<std::uint32_t>(j.m_data.m_value.binary->subtype()));\n                    }\n                    else if (j.m_data.m_value.binary->subtype() <= (std::numeric_limits<std::uint64_t>::max)())\n                    {\n                        write_number(static_cast<std::uint8_t>(0xdb));\n                        write_number(static_cast<std::uint64_t>(j.m_data.m_value.binary->subtype()));\n                    }\n                }\n\n                // step 1: write control byte and the binary array size\n                const auto N = j.m_data.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_data.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_data.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_data.m_value.object)\n                {\n                    write_cbor(el.first);\n                    write_cbor(el.second);\n                }\n                break;\n            }\n\n            case value_t::discarded:\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_data.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_data.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_data.m_value.number_unsigned < 128)\n                    {\n                        // positive fixnum\n                        write_number(static_cast<std::uint8_t>(j.m_data.m_value.number_integer));\n                    }\n                    else if (j.m_data.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_data.m_value.number_integer));\n                    }\n                    else if (j.m_data.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_data.m_value.number_integer));\n                    }\n                    else if (j.m_data.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_data.m_value.number_integer));\n                    }\n                    else if (j.m_data.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_data.m_value.number_integer));\n                    }\n                }\n                else\n                {\n                    if (j.m_data.m_value.number_integer >= -32)\n                    {\n                        // negative fixnum\n                        write_number(static_cast<std::int8_t>(j.m_data.m_value.number_integer));\n                    }\n                    else if (j.m_data.m_value.number_integer >= (std::numeric_limits<std::int8_t>::min)() &&\n                             j.m_data.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_data.m_value.number_integer));\n                    }\n                    else if (j.m_data.m_value.number_integer >= (std::numeric_limits<std::int16_t>::min)() &&\n                             j.m_data.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_data.m_value.number_integer));\n                    }\n                    else if (j.m_data.m_value.number_integer >= (std::numeric_limits<std::int32_t>::min)() &&\n                             j.m_data.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_data.m_value.number_integer));\n                    }\n                    else if (j.m_data.m_value.number_integer >= (std::numeric_limits<std::int64_t>::min)() &&\n                             j.m_data.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_data.m_value.number_integer));\n                    }\n                }\n                break;\n            }\n\n            case value_t::number_unsigned:\n            {\n                if (j.m_data.m_value.number_unsigned < 128)\n                {\n                    // positive fixnum\n                    write_number(static_cast<std::uint8_t>(j.m_data.m_value.number_integer));\n                }\n                else if (j.m_data.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_data.m_value.number_integer));\n                }\n                else if (j.m_data.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_data.m_value.number_integer));\n                }\n                else if (j.m_data.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_data.m_value.number_integer));\n                }\n                else if (j.m_data.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_data.m_value.number_integer));\n                }\n                break;\n            }\n\n            case value_t::number_float:\n            {\n                write_compact_float(j.m_data.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_data.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_data.m_value.string->c_str()),\n                    j.m_data.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_data.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_data.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_data.m_value.binary->has_subtype();\n\n                // step 1: write control byte and the byte string length\n                const auto N = j.m_data.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                    const 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                    const 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_data.m_value.binary->subtype()));\n                }\n\n                // step 2: write the byte string\n                oa->write_characters(\n                    reinterpret_cast<const CharType*>(j.m_data.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_data.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_data.m_value.object)\n                {\n                    write_msgpack(el.first);\n                    write_msgpack(el.second);\n                }\n                break;\n            }\n\n            case value_t::discarded:\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    @param[in] use_bjdata  whether write in BJData format, default is false\n    */\n    void write_ubjson(const BasicJsonType& j, const bool use_count,\n                      const bool use_type, const bool add_prefix = true,\n                      const bool use_bjdata = false)\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_data.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_data.m_value.number_integer, add_prefix, use_bjdata);\n                break;\n            }\n\n            case value_t::number_unsigned:\n            {\n                write_number_with_ubjson_prefix(j.m_data.m_value.number_unsigned, add_prefix, use_bjdata);\n                break;\n            }\n\n            case value_t::number_float:\n            {\n                write_number_with_ubjson_prefix(j.m_data.m_value.number_float, add_prefix, use_bjdata);\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_data.m_value.string->size(), true, use_bjdata);\n                oa->write_characters(\n                    reinterpret_cast<const CharType*>(j.m_data.m_value.string->c_str()),\n                    j.m_data.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_data.m_value.array->empty())\n                {\n                    JSON_ASSERT(use_count);\n                    const CharType first_prefix = ubjson_prefix(j.front(), use_bjdata);\n                    const bool same_prefix = std::all_of(j.begin() + 1, j.end(),\n                                                         [this, first_prefix, use_bjdata](const BasicJsonType & v)\n                    {\n                        return ubjson_prefix(v, use_bjdata) == first_prefix;\n                    });\n\n                    std::vector<CharType> bjdx = {'[', '{', 'S', 'H', 'T', 'F', 'N', 'Z'}; // excluded markers in bjdata optimized type\n\n                    if (same_prefix && !(use_bjdata && std::find(bjdx.begin(), bjdx.end(), first_prefix) != bjdx.end()))\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_data.m_value.array->size(), true, use_bjdata);\n                }\n\n                for (const auto& el : *j.m_data.m_value.array)\n                {\n                    write_ubjson(el, use_count, use_type, prefix_required, use_bjdata);\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_data.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_data.m_value.binary->size(), true, use_bjdata);\n                }\n\n                if (use_type)\n                {\n                    oa->write_characters(\n                        reinterpret_cast<const CharType*>(j.m_data.m_value.binary->data()),\n                        j.m_data.m_value.binary->size());\n                }\n                else\n                {\n                    for (size_t i = 0; i < j.m_data.m_value.binary->size(); ++i)\n                    {\n                        oa->write_character(to_char_type('U'));\n                        oa->write_character(j.m_data.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 (use_bjdata && j.m_data.m_value.object->size() == 3 && j.m_data.m_value.object->find(\"_ArrayType_\") != j.m_data.m_value.object->end() && j.m_data.m_value.object->find(\"_ArraySize_\") != j.m_data.m_value.object->end() && j.m_data.m_value.object->find(\"_ArrayData_\") != j.m_data.m_value.object->end())\n                {\n                    if (!write_bjdata_ndarray(*j.m_data.m_value.object, use_count, use_type))  // decode bjdata ndarray in the JData format (https://github.com/NeuroJSON/jdata)\n                    {\n                        break;\n                    }\n                }\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_data.m_value.object->empty())\n                {\n                    JSON_ASSERT(use_count);\n                    const CharType first_prefix = ubjson_prefix(j.front(), use_bjdata);\n                    const bool same_prefix = std::all_of(j.begin(), j.end(),\n                                                         [this, first_prefix, use_bjdata](const BasicJsonType & v)\n                    {\n                        return ubjson_prefix(v, use_bjdata) == first_prefix;\n                    });\n\n                    std::vector<CharType> bjdx = {'[', '{', 'S', 'H', 'T', 'F', 'N', 'Z'}; // excluded markers in bjdata optimized type\n\n                    if (same_prefix && !(use_bjdata && std::find(bjdx.begin(), bjdx.end(), first_prefix) != bjdx.end()))\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_data.m_value.object->size(), true, use_bjdata);\n                }\n\n                for (const auto& el : *j.m_data.m_value.object)\n                {\n                    write_number_with_ubjson_prefix(el.first.size(), true, use_bjdata);\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, use_bjdata);\n                }\n\n                if (!use_count)\n                {\n                    oa->write_character(to_char_type('}'));\n                }\n\n                break;\n            }\n\n            case value_t::discarded:\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, const BasicJsonType& j)\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, concat(\"BSON key cannot contain code point U+0000 (at byte \", std::to_string(it), \")\"), &j));\n            static_cast<void>(j);\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>(value, true);\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>(static_cast<std::int32_t>(value.size() + 1ul), true);\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>(static_cast<std::int32_t>(value), true);\n        }\n        else\n        {\n            write_bson_entry_header(name, 0x12); // int64\n            write_number<std::int64_t>(static_cast<std::int64_t>(value), true);\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 BasicJsonType& j)\n    {\n        if (j.m_data.m_value.number_unsigned <= 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>(static_cast<std::int32_t>(j.m_data.m_value.number_unsigned), true);\n        }\n        else if (j.m_data.m_value.number_unsigned <= 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>(static_cast<std::int64_t>(j.m_data.m_value.number_unsigned), true);\n        }\n        else\n        {\n            JSON_THROW(out_of_range::create(407, concat(\"integer number \", std::to_string(j.m_data.m_value.number_unsigned), \" cannot be represented by BSON as it does not fit int64\"), &j));\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), static_cast<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>(static_cast<std::int32_t>(calc_bson_array_size(value)), true);\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>(static_cast<std::int32_t>(value.size()), true);\n        write_number(value.has_subtype() ? static_cast<std::uint8_t>(value.subtype()) : static_cast<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, j);\n        switch (j.type())\n        {\n            case value_t::object:\n                return header_size + calc_bson_object_size(*j.m_data.m_value.object);\n\n            case value_t::array:\n                return header_size + calc_bson_array_size(*j.m_data.m_value.array);\n\n            case value_t::binary:\n                return header_size + calc_bson_binary_size(*j.m_data.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_data.m_value.number_integer);\n\n            case value_t::number_unsigned:\n                return header_size + calc_bson_unsigned_size(j.m_data.m_value.number_unsigned);\n\n            case value_t::string:\n                return header_size + calc_bson_string_size(*j.m_data.m_value.string);\n\n            case value_t::null:\n                return header_size + 0ul;\n\n            // LCOV_EXCL_START\n            case value_t::discarded:\n            default:\n                JSON_ASSERT(false); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert)\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    */\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_data.m_value.object);\n\n            case value_t::array:\n                return write_bson_array(name, *j.m_data.m_value.array);\n\n            case value_t::binary:\n                return write_bson_binary(name, *j.m_data.m_value.binary);\n\n            case value_t::boolean:\n                return write_bson_boolean(name, j.m_data.m_value.boolean);\n\n            case value_t::number_float:\n                return write_bson_double(name, j.m_data.m_value.number_float);\n\n            case value_t::number_integer:\n                return write_bson_integer(name, j.m_data.m_value.number_integer);\n\n            case value_t::number_unsigned:\n                return write_bson_unsigned(name, j);\n\n            case value_t::string:\n                return write_bson_string(name, *j.m_data.m_value.string);\n\n            case value_t::null:\n                return write_bson_null(name);\n\n            // LCOV_EXCL_START\n            case value_t::discarded:\n            default:\n                JSON_ASSERT(false); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert)\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] value  JSON value to serialize\n    @pre       value.type() == value_t::object\n    */\n    static std::size_t calc_bson_object_size(const typename BasicJsonType::object_t& value)\n    {\n        const std::size_t document_size = std::accumulate(value.begin(), value.end(), static_cast<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] value  JSON value to serialize\n    @pre       value.type() == value_t::object\n    */\n    void write_bson_object(const typename BasicJsonType::object_t& value)\n    {\n        write_number<std::int32_t>(static_cast<std::int32_t>(calc_bson_object_size(value)), true);\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                                         const bool use_bjdata)\n    {\n        if (add_prefix)\n        {\n            oa->write_character(get_ubjson_float_prefix(n));\n        }\n        write_number(n, use_bjdata);\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                                         const bool use_bjdata)\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), use_bjdata);\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), use_bjdata);\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), use_bjdata);\n        }\n        else if (use_bjdata && n <= static_cast<uint64_t>((std::numeric_limits<uint16_t>::max)()))\n        {\n            if (add_prefix)\n            {\n                oa->write_character(to_char_type('u'));  // uint16 - bjdata only\n            }\n            write_number(static_cast<std::uint16_t>(n), use_bjdata);\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), use_bjdata);\n        }\n        else if (use_bjdata && n <= static_cast<uint64_t>((std::numeric_limits<uint32_t>::max)()))\n        {\n            if (add_prefix)\n            {\n                oa->write_character(to_char_type('m'));  // uint32 - bjdata only\n            }\n            write_number(static_cast<std::uint32_t>(n), use_bjdata);\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), use_bjdata);\n        }\n        else if (use_bjdata && n <= (std::numeric_limits<uint64_t>::max)())\n        {\n            if (add_prefix)\n            {\n                oa->write_character(to_char_type('M'));  // uint64 - bjdata only\n            }\n            write_number(static_cast<std::uint64_t>(n), use_bjdata);\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, use_bjdata);\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                                         const bool use_bjdata)\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), use_bjdata);\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), use_bjdata);\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), use_bjdata);\n        }\n        else if (use_bjdata && (static_cast<std::int64_t>((std::numeric_limits<std::uint16_t>::min)()) <= n && n <= static_cast<std::int64_t>((std::numeric_limits<std::uint16_t>::max)())))\n        {\n            if (add_prefix)\n            {\n                oa->write_character(to_char_type('u'));  // uint16 - bjdata only\n            }\n            write_number(static_cast<uint16_t>(n), use_bjdata);\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), use_bjdata);\n        }\n        else if (use_bjdata && (static_cast<std::int64_t>((std::numeric_limits<std::uint32_t>::min)()) <= n && n <= static_cast<std::int64_t>((std::numeric_limits<std::uint32_t>::max)())))\n        {\n            if (add_prefix)\n            {\n                oa->write_character(to_char_type('m'));  // uint32 - bjdata only\n            }\n            write_number(static_cast<uint32_t>(n), use_bjdata);\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), use_bjdata);\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, use_bjdata);\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 bool use_bjdata) 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_data.m_value.boolean ? 'T' : 'F';\n\n            case value_t::number_integer:\n            {\n                if ((std::numeric_limits<std::int8_t>::min)() <= j.m_data.m_value.number_integer && j.m_data.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_data.m_value.number_integer && j.m_data.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_data.m_value.number_integer && j.m_data.m_value.number_integer <= (std::numeric_limits<std::int16_t>::max)())\n                {\n                    return 'I';\n                }\n                if (use_bjdata && ((std::numeric_limits<std::uint16_t>::min)() <= j.m_data.m_value.number_integer && j.m_data.m_value.number_integer <= (std::numeric_limits<std::uint16_t>::max)()))\n                {\n                    return 'u';\n                }\n                if ((std::numeric_limits<std::int32_t>::min)() <= j.m_data.m_value.number_integer && j.m_data.m_value.number_integer <= (std::numeric_limits<std::int32_t>::max)())\n                {\n                    return 'l';\n                }\n                if (use_bjdata && ((std::numeric_limits<std::uint32_t>::min)() <= j.m_data.m_value.number_integer && j.m_data.m_value.number_integer <= (std::numeric_limits<std::uint32_t>::max)()))\n                {\n                    return 'm';\n                }\n                if ((std::numeric_limits<std::int64_t>::min)() <= j.m_data.m_value.number_integer && j.m_data.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_data.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_data.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_data.m_value.number_unsigned <= static_cast<std::uint64_t>((std::numeric_limits<std::int16_t>::max)()))\n                {\n                    return 'I';\n                }\n                if (use_bjdata && j.m_data.m_value.number_unsigned <= static_cast<std::uint64_t>((std::numeric_limits<std::uint16_t>::max)()))\n                {\n                    return 'u';\n                }\n                if (j.m_data.m_value.number_unsigned <= static_cast<std::uint64_t>((std::numeric_limits<std::int32_t>::max)()))\n                {\n                    return 'l';\n                }\n                if (use_bjdata && j.m_data.m_value.number_unsigned <= static_cast<std::uint64_t>((std::numeric_limits<std::uint32_t>::max)()))\n                {\n                    return 'm';\n                }\n                if (j.m_data.m_value.number_unsigned <= static_cast<std::uint64_t>((std::numeric_limits<std::int64_t>::max)()))\n                {\n                    return 'L';\n                }\n                if (use_bjdata && j.m_data.m_value.number_unsigned <= (std::numeric_limits<std::uint64_t>::max)())\n                {\n                    return 'M';\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_data.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            case value_t::discarded:\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    @return false if the object is successfully converted to a bjdata ndarray, true if the type or size is invalid\n    */\n    bool write_bjdata_ndarray(const typename BasicJsonType::object_t& value, const bool use_count, const bool use_type)\n    {\n        std::map<string_t, CharType> bjdtype = {{\"uint8\", 'U'},  {\"int8\", 'i'},  {\"uint16\", 'u'}, {\"int16\", 'I'},\n            {\"uint32\", 'm'}, {\"int32\", 'l'}, {\"uint64\", 'M'}, {\"int64\", 'L'}, {\"single\", 'd'}, {\"double\", 'D'}, {\"char\", 'C'}\n        };\n\n        string_t key = \"_ArrayType_\";\n        auto it = bjdtype.find(static_cast<string_t>(value.at(key)));\n        if (it == bjdtype.end())\n        {\n            return true;\n        }\n        CharType dtype = it->second;\n\n        key = \"_ArraySize_\";\n        std::size_t len = (value.at(key).empty() ? 0 : 1);\n        for (const auto& el : value.at(key))\n        {\n            len *= static_cast<std::size_t>(el.m_data.m_value.number_unsigned);\n        }\n\n        key = \"_ArrayData_\";\n        if (value.at(key).size() != len)\n        {\n            return true;\n        }\n\n        oa->write_character('[');\n        oa->write_character('$');\n        oa->write_character(dtype);\n        oa->write_character('#');\n\n        key = \"_ArraySize_\";\n        write_ubjson(value.at(key), use_count, use_type, true,  true);\n\n        key = \"_ArrayData_\";\n        if (dtype == 'U' || dtype == 'C')\n        {\n            for (const auto& el : value.at(key))\n            {\n                write_number(static_cast<std::uint8_t>(el.m_data.m_value.number_unsigned), true);\n            }\n        }\n        else if (dtype == 'i')\n        {\n            for (const auto& el : value.at(key))\n            {\n                write_number(static_cast<std::int8_t>(el.m_data.m_value.number_integer), true);\n            }\n        }\n        else if (dtype == 'u')\n        {\n            for (const auto& el : value.at(key))\n            {\n                write_number(static_cast<std::uint16_t>(el.m_data.m_value.number_unsigned), true);\n            }\n        }\n        else if (dtype == 'I')\n        {\n            for (const auto& el : value.at(key))\n            {\n                write_number(static_cast<std::int16_t>(el.m_data.m_value.number_integer), true);\n            }\n        }\n        else if (dtype == 'm')\n        {\n            for (const auto& el : value.at(key))\n            {\n                write_number(static_cast<std::uint32_t>(el.m_data.m_value.number_unsigned), true);\n            }\n        }\n        else if (dtype == 'l')\n        {\n            for (const auto& el : value.at(key))\n            {\n                write_number(static_cast<std::int32_t>(el.m_data.m_value.number_integer), true);\n            }\n        }\n        else if (dtype == 'M')\n        {\n            for (const auto& el : value.at(key))\n            {\n                write_number(static_cast<std::uint64_t>(el.m_data.m_value.number_unsigned), true);\n            }\n        }\n        else if (dtype == 'L')\n        {\n            for (const auto& el : value.at(key))\n            {\n                write_number(static_cast<std::int64_t>(el.m_data.m_value.number_integer), true);\n            }\n        }\n        else if (dtype == 'd')\n        {\n            for (const auto& el : value.at(key))\n            {\n                write_number(static_cast<float>(el.m_data.m_value.number_float), true);\n            }\n        }\n        else if (dtype == 'D')\n        {\n            for (const auto& el : value.at(key))\n            {\n                write_number(static_cast<double>(el.m_data.m_value.number_float), true);\n            }\n        }\n        return false;\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    @param[in] OutputIsLittleEndian Set to true if output data is\n                                 required to be little endian\n    @tparam NumberType the type of the number\n\n    @note This function needs to respect the system's endianness, 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          On the other hand, BSON and BJData use little endian and should reorder\n          on big endian systems.\n    */\n    template<typename NumberType>\n    void write_number(const NumberType n, const bool OutputIsLittleEndian = false)\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#ifdef __GNUC__\n#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored \"-Wfloat-equal\"\n#endif\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#ifdef __GNUC__\n#pragma GCC diagnostic pop\n#endif\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 endianness\n    const bool is_little_endian = little_endianness();\n\n    /// the output\n    output_adapter_t<CharType> oa = nullptr;\n};\n\n}  // namespace detail\nNLOHMANN_JSON_NAMESPACE_END\n\n// #include <nlohmann/detail/output/output_adapters.hpp>\n\n// #include <nlohmann/detail/output/serializer.hpp>\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2008-2009 Björn Hoehrmann <bjoern@hoehrmann.de>\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\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 <iomanip> // setfill, setw\n#include <type_traits> // is_same\n#include <utility> // move\n\n// #include <nlohmann/detail/conversions/to_chars.hpp>\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2009 Florian Loitsch <https://florian.loitsch.com/>\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\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\nNLOHMANN_JSON_NAMESPACE_BEGIN\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 auto bits = static_cast<std::uint64_t>(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    if (n >= 100000000)\n    {\n        pow10 = 100000000;\n        return  9;\n    }\n    if (n >= 10000000)\n    {\n        pow10 = 10000000;\n        return  8;\n    }\n    if (n >= 1000000)\n    {\n        pow10 = 1000000;\n        return  7;\n    }\n    if (n >= 100000)\n    {\n        pow10 = 100000;\n        return  6;\n    }\n    if (n >= 10000)\n    {\n        pow10 = 10000;\n        return  5;\n    }\n    if (n >= 1000)\n    {\n        pow10 = 1000;\n        return  4;\n    }\n    if (n >= 100)\n    {\n        pow10 = 100;\n        return  3;\n    }\n    if (n >= 10)\n    {\n        pow10 = 10;\n        return  2;\n    }\n\n    pow10 = 1;\n    return 1;\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 floats to doubles, 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 // NOLINT(readability-avoid-unconditional-preprocessor-if)\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#ifdef __GNUC__\n#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored \"-Wfloat-equal\"\n#endif\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#ifdef __GNUC__\n#pragma GCC diagnostic pop\n#endif\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\nNLOHMANN_JSON_NAMESPACE_END\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/string_concat.hpp>\n\n// #include <nlohmann/detail/value_t.hpp>\n\n\nNLOHMANN_JSON_NAMESPACE_BEGIN\nnamespace detail\n{\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_data.m_type)\n        {\n            case value_t::object:\n            {\n                if (val.m_data.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_data.m_value.object->cbegin();\n                    for (std::size_t cnt = 0; cnt < val.m_data.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_data.m_value.object->cend());\n                    JSON_ASSERT(std::next(i) == val.m_data.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_data.m_value.object->cbegin();\n                    for (std::size_t cnt = 0; cnt < val.m_data.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_data.m_value.object->cend());\n                    JSON_ASSERT(std::next(i) == val.m_data.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_data.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_data.m_value.array->cbegin();\n                            i != val.m_data.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_data.m_value.array->empty());\n                    o->write_characters(indent_string.c_str(), new_indent);\n                    dump(val.m_data.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_data.m_value.array->cbegin();\n                            i != val.m_data.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_data.m_value.array->empty());\n                    dump(val.m_data.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_data.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_data.m_value.binary->empty())\n                    {\n                        for (auto i = val.m_data.m_value.binary->cbegin();\n                                i != val.m_data.m_value.binary->cend() - 1; ++i)\n                        {\n                            dump_integer(*i);\n                            o->write_characters(\", \", 2);\n                        }\n                        dump_integer(val.m_data.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_data.m_value.binary->has_subtype())\n                    {\n                        dump_integer(val.m_data.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_data.m_value.binary->empty())\n                    {\n                        for (auto i = val.m_data.m_value.binary->cbegin();\n                                i != val.m_data.m_value.binary->cend() - 1; ++i)\n                        {\n                            dump_integer(*i);\n                            o->write_character(',');\n                        }\n                        dump_integer(val.m_data.m_value.binary->back());\n                    }\n\n                    o->write_characters(\"],\\\"subtype\\\":\", 12);\n                    if (val.m_data.m_value.binary->has_subtype())\n                    {\n                        dump_integer(val.m_data.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_data.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_data.m_value.number_integer);\n                return;\n            }\n\n            case value_t::number_unsigned:\n            {\n                dump_integer(val.m_data.m_value.number_unsigned);\n                return;\n            }\n\n            case value_t::number_float:\n            {\n                dump_float(val.m_data.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); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert) 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<std::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                                    // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg,hicpp-vararg)\n                                    static_cast<void>((std::snprintf)(string_buffer.data() + bytes, 7, \"\\\\u%04x\",\n                                                                      static_cast<std::uint16_t>(codepoint)));\n                                    bytes += 6;\n                                }\n                                else\n                                {\n                                    // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg,hicpp-vararg)\n                                    static_cast<void>((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                            JSON_THROW(type_error::create(316, concat(\"invalid UTF-8 byte at index \", std::to_string(i), \": 0x\", hex_bytes(byte | 0)), nullptr));\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); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert) 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                    JSON_THROW(type_error::create(316, concat(\"incomplete UTF-8 string; last byte: 0x\", hex_bytes(static_cast<std::uint8_t>(s.back() | 0))), nullptr));\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); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert) 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 convert a byte to a uppercase hex representation\n     * @param[in] byte byte to represent\n     * @return representation (\"00\"..\"FF\")\n     */\n    static std::string hex_bytes(std::uint8_t byte)\n    {\n        std::string result = \"FF\";\n        constexpr const char* nibble_to_hex = \"0123456789ABCDEF\";\n        result[0] = nibble_to_hex[byte / 16];\n        result[1] = nibble_to_hex[byte % 16];\n        return result;\n    }\n\n    // templates to avoid warnings about useless casts\n    template <typename NumberType, enable_if_t<std::is_signed<NumberType>::value, int> = 0>\n    bool is_negative_number(NumberType x)\n    {\n        return x < 0;\n    }\n\n    template < typename NumberType, enable_if_t <std::is_unsigned<NumberType>::value, int > = 0 >\n    bool is_negative_number(NumberType /*unused*/)\n    {\n        return false;\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_integral<NumberType>::value ||\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(); // NOLINT(llvm-qualified-auto,readability-qualified-auto,cppcoreguidelines-pro-type-vararg,hicpp-vararg)\n\n        number_unsigned_t abs_value;\n\n        unsigned int n_chars{};\n\n        if (is_negative_number(x))\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        auto* begin = number_buffer.data();\n        auto* 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        // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg,hicpp-vararg)\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            // NOLINTNEXTLINE(readability-qualified-auto,llvm-qualified-auto): std::remove returns an iterator, see https://github.com/nlohmann/json/issues/3081\n            const auto end = std::remove(number_buffer.begin(), 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            // NOLINTNEXTLINE(readability-qualified-auto,llvm-qualified-auto): std::find returns an iterator, see https://github.com/nlohmann/json/issues/3081\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 we 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        JSON_ASSERT(byte < utf8d.size());\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        const std::size_t index = 256u + static_cast<size_t>(state) * 16u + static_cast<size_t>(type);\n        JSON_ASSERT(index < utf8d.size());\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); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert) 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)()); // NOLINT(misc-redundant-expression)\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\n}  // namespace detail\nNLOHMANN_JSON_NAMESPACE_END\n\n// #include <nlohmann/detail/value_t.hpp>\n\n// #include <nlohmann/json_fwd.hpp>\n\n// #include <nlohmann/ordered_map.hpp>\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\n\n\n#include <functional> // equal_to, less\n#include <initializer_list> // initializer_list\n#include <iterator> // input_iterator_tag, iterator_traits\n#include <memory> // allocator\n#include <stdexcept> // for out_of_range\n#include <type_traits> // enable_if, is_convertible\n#include <utility> // pair\n#include <vector> // vector\n\n// #include <nlohmann/detail/macro_scope.hpp>\n\n// #include <nlohmann/detail/meta/type_traits.hpp>\n\n\nNLOHMANN_JSON_NAMESPACE_BEGIN\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 iterator = typename Container::iterator;\n    using const_iterator = typename Container::const_iterator;\n    using size_type = typename Container::size_type;\n    using value_type = typename Container::value_type;\n#ifdef JSON_HAS_CPP_14\n    using key_compare = std::equal_to<>;\n#else\n    using key_compare = std::equal_to<Key>;\n#endif\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() noexcept(noexcept(Container())) : Container{} {}\n    explicit ordered_map(const Allocator& alloc) noexcept(noexcept(Container(alloc))) : 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<value_type> 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 (m_compare(it->first, key))\n            {\n                return {it, false};\n            }\n        }\n        Container::emplace_back(key, std::forward<T>(t));\n        return {std::prev(this->end()), true};\n    }\n\n    template<class KeyType, detail::enable_if_t<\n                 detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0>\n    std::pair<iterator, bool> emplace(KeyType && key, T && t)\n    {\n        for (auto it = this->begin(); it != this->end(); ++it)\n        {\n            if (m_compare(it->first, key))\n            {\n                return {it, false};\n            }\n        }\n        Container::emplace_back(std::forward<KeyType>(key), std::forward<T>(t));\n        return {std::prev(this->end()), true};\n    }\n\n    T& operator[](const key_type& key)\n    {\n        return emplace(key, T{}).first->second;\n    }\n\n    template<class KeyType, detail::enable_if_t<\n                 detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0>\n    T & operator[](KeyType && key)\n    {\n        return emplace(std::forward<KeyType>(key), T{}).first->second;\n    }\n\n    const T& operator[](const key_type& key) const\n    {\n        return at(key);\n    }\n\n    template<class KeyType, detail::enable_if_t<\n                 detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0>\n    const T & operator[](KeyType && key) const\n    {\n        return at(std::forward<KeyType>(key));\n    }\n\n    T& at(const key_type& key)\n    {\n        for (auto it = this->begin(); it != this->end(); ++it)\n        {\n            if (m_compare(it->first, key))\n            {\n                return it->second;\n            }\n        }\n\n        JSON_THROW(std::out_of_range(\"key not found\"));\n    }\n\n    template<class KeyType, detail::enable_if_t<\n                 detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0>\n    T & at(KeyType && key) // NOLINT(cppcoreguidelines-missing-std-forward)\n    {\n        for (auto it = this->begin(); it != this->end(); ++it)\n        {\n            if (m_compare(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_type& key) const\n    {\n        for (auto it = this->begin(); it != this->end(); ++it)\n        {\n            if (m_compare(it->first, key))\n            {\n                return it->second;\n            }\n        }\n\n        JSON_THROW(std::out_of_range(\"key not found\"));\n    }\n\n    template<class KeyType, detail::enable_if_t<\n                 detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0>\n    const T & at(KeyType && key) const // NOLINT(cppcoreguidelines-missing-std-forward)\n    {\n        for (auto it = this->begin(); it != this->end(); ++it)\n        {\n            if (m_compare(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_type& key)\n    {\n        for (auto it = this->begin(); it != this->end(); ++it)\n        {\n            if (m_compare(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    template<class KeyType, detail::enable_if_t<\n                 detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0>\n    size_type erase(KeyType && key) // NOLINT(cppcoreguidelines-missing-std-forward)\n    {\n        for (auto it = this->begin(); it != this->end(); ++it)\n        {\n            if (m_compare(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        return erase(pos, std::next(pos));\n    }\n\n    iterator erase(iterator first, iterator last)\n    {\n        if (first == last)\n        {\n            return first;\n        }\n\n        const auto elements_affected = std::distance(first, last);\n        const auto offset = std::distance(Container::begin(), first);\n\n        // This is the start situation. We need to delete elements_affected\n        // elements (3 in this example: e, f, g), and need to return an\n        // iterator past the last deleted element (h in this example).\n        // Note that offset is the distance from the start of the vector\n        // to first. We will need this later.\n\n        // [ a, b, c, d, e, f, g, h, i, j ]\n        //               ^        ^\n        //             first    last\n\n        // Since we cannot move const Keys, we re-construct them in place.\n        // We start at first and re-construct (viz. copy) the elements from\n        // the back of the vector. Example for first iteration:\n\n        //               ,--------.\n        //               v        |   destroy e and re-construct with h\n        // [ a, b, c, d, e, f, g, h, i, j ]\n        //               ^        ^\n        //               it       it + elements_affected\n\n        for (auto it = first; std::next(it, elements_affected) != Container::end(); ++it)\n        {\n            it->~value_type(); // destroy but keep allocation\n            new (&*it) value_type{std::move(*std::next(it, elements_affected))}; // \"move\" next element to it\n        }\n\n        // [ a, b, c, d, h, i, j, h, i, j ]\n        //               ^        ^\n        //             first    last\n\n        // remove the unneeded elements at the end of the vector\n        Container::resize(this->size() - static_cast<size_type>(elements_affected));\n\n        // [ a, b, c, d, h, i, j ]\n        //               ^        ^\n        //             first    last\n\n        // first is now pointing past the last deleted element, but we cannot\n        // use this iterator, because it may have been invalidated by the\n        // resize call. Instead, we can return begin() + offset.\n        return Container::begin() + offset;\n    }\n\n    size_type count(const key_type& key) const\n    {\n        for (auto it = this->begin(); it != this->end(); ++it)\n        {\n            if (m_compare(it->first, key))\n            {\n                return 1;\n            }\n        }\n        return 0;\n    }\n\n    template<class KeyType, detail::enable_if_t<\n                 detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0>\n    size_type count(KeyType && key) const // NOLINT(cppcoreguidelines-missing-std-forward)\n    {\n        for (auto it = this->begin(); it != this->end(); ++it)\n        {\n            if (m_compare(it->first, key))\n            {\n                return 1;\n            }\n        }\n        return 0;\n    }\n\n    iterator find(const key_type& key)\n    {\n        for (auto it = this->begin(); it != this->end(); ++it)\n        {\n            if (m_compare(it->first, key))\n            {\n                return it;\n            }\n        }\n        return Container::end();\n    }\n\n    template<class KeyType, detail::enable_if_t<\n                 detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0>\n    iterator find(KeyType && key) // NOLINT(cppcoreguidelines-missing-std-forward)\n    {\n        for (auto it = this->begin(); it != this->end(); ++it)\n        {\n            if (m_compare(it->first, key))\n            {\n                return it;\n            }\n        }\n        return Container::end();\n    }\n\n    const_iterator find(const key_type& key) const\n    {\n        for (auto it = this->begin(); it != this->end(); ++it)\n        {\n            if (m_compare(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 (m_compare(it->first, value.first))\n            {\n                return {it, false};\n            }\n        }\n        Container::push_back(value);\n        return {--this->end(), true};\n    }\n\n    template<typename InputIt>\n    using require_input_iter = typename std::enable_if<std::is_convertible<typename std::iterator_traits<InputIt>::iterator_category,\n            std::input_iterator_tag>::value>::type;\n\n    template<typename InputIt, typename = require_input_iter<InputIt>>\n    void insert(InputIt first, InputIt last)\n    {\n        for (auto it = first; it != last; ++it)\n        {\n            insert(*it);\n        }\n    }\n\nprivate:\n    JSON_NO_UNIQUE_ADDRESS key_compare m_compare = key_compare();\n};\n\nNLOHMANN_JSON_NAMESPACE_END\n\n\n#if defined(JSON_HAS_CPP_17)\n    #if JSON_HAS_STATIC_RTTI\n        #include <any>\n    #endif\n    #include <string_view>\n#endif\n\n/*!\n@brief namespace for Niels Lohmann\n@see https://github.com/nlohmann\n@since version 1.0.0\n*/\nNLOHMANN_JSON_NAMESPACE_BEGIN\n\n/*!\n@brief a class to store JSON values\n\n@internal\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@note ObjectType trick from https://stackoverflow.com/a/9860911\n@endinternal\n\n@since version 1.0.0\n\n@nosubgrouping\n*/\nNLOHMANN_BASIC_JSON_TPL_DECLARATION\nclass basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-special-member-functions)\n    : public ::nlohmann::detail::json_base_class<CustomBaseClass>\n{\n  private:\n    template<detail::value_t> friend struct detail::external_constructor;\n\n    template<typename>\n    friend class ::nlohmann::json_pointer;\n    // can be restored when json_pointer backwards compatibility is removed\n    // friend ::nlohmann::json_pointer<StringType>;\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    friend class ::nlohmann::detail::exception;\n\n    /// workaround type for MSVC\n    using basic_json_t = NLOHMANN_BASIC_JSON_TPL;\n    using json_base_class_t = ::nlohmann::detail::json_base_class<CustomBaseClass>;\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<StringType>;\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    using exception = detail::exception;\n    using parse_error = detail::parse_error;\n    using invalid_iterator = detail::invalid_iterator;\n    using type_error = detail::type_error;\n    using out_of_range = detail::out_of_range;\n    using other_error = detail::other_error;\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    /// @brief returns the allocator associated with the container\n    /// @sa https://json.nlohmann.me/api/basic_json/get_allocator/\n    static allocator_type get_allocator()\n    {\n        return allocator_type();\n    }\n\n    /// @brief returns version information on the library\n    /// @sa https://json.nlohmann.me/api/basic_json/meta/\n    JSON_HEDLEY_WARN_UNUSED_RESULT\n    static basic_json meta()\n    {\n        basic_json result;\n\n        result[\"copyright\"] = \"(C) 2013-2023 Niels Lohmann\";\n        result[\"name\"] = \"JSON for Modern C++\";\n        result[\"url\"] = \"https://github.com/nlohmann/json\";\n        result[\"version\"][\"string\"] =\n            detail::concat(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\", detail::concat(\n                    std::to_string(__GNUC__), '.',\n                    std::to_string(__GNUC_MINOR__), '.',\n                    std::to_string(__GNUC_PATCHLEVEL__))\n            }\n        };\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#if defined(_MSVC_LANG)\n        result[\"compiler\"][\"c++\"] = std::to_string(_MSVC_LANG);\n#elif defined(__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    // 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    /// @brief default object key comparator type\n    /// The actual object key comparator type (@ref object_comparator_t) may be\n    /// different.\n    /// @sa https://json.nlohmann.me/api/basic_json/default_object_comparator_t/\n#if defined(JSON_HAS_CPP_14)\n    // use of transparent comparator avoids unnecessary repeated construction of temporaries\n    // in functions involving lookup by key with types other than object_t::key_type (aka. StringType)\n    using default_object_comparator_t = std::less<>;\n#else\n    using default_object_comparator_t = std::less<StringType>;\n#endif\n\n    /// @brief a type for an object\n    /// @sa https://json.nlohmann.me/api/basic_json/object_t/\n    using object_t = ObjectType<StringType,\n          basic_json,\n          default_object_comparator_t,\n          AllocatorType<std::pair<const StringType,\n          basic_json>>>;\n\n    /// @brief a type for an array\n    /// @sa https://json.nlohmann.me/api/basic_json/array_t/\n    using array_t = ArrayType<basic_json, AllocatorType<basic_json>>;\n\n    /// @brief a type for a string\n    /// @sa https://json.nlohmann.me/api/basic_json/string_t/\n    using string_t = StringType;\n\n    /// @brief a type for a boolean\n    /// @sa https://json.nlohmann.me/api/basic_json/boolean_t/\n    using boolean_t = BooleanType;\n\n    /// @brief a type for a number (integer)\n    /// @sa https://json.nlohmann.me/api/basic_json/number_integer_t/\n    using number_integer_t = NumberIntegerType;\n\n    /// @brief a type for a number (unsigned)\n    /// @sa https://json.nlohmann.me/api/basic_json/number_unsigned_t/\n    using number_unsigned_t = NumberUnsignedType;\n\n    /// @brief a type for a number (floating-point)\n    /// @sa https://json.nlohmann.me/api/basic_json/number_float_t/\n    using number_float_t = NumberFloatType;\n\n    /// @brief a type for a packed binary type\n    /// @sa https://json.nlohmann.me/api/basic_json/binary_t/\n    using binary_t = nlohmann::byte_container_with_subtype<BinaryType>;\n\n    /// @brief object key comparator type\n    /// @sa https://json.nlohmann.me/api/basic_json/object_comparator_t/\n    using object_comparator_t = detail::actual_object_comparator_t<basic_json>;\n\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 * obj)\n        {\n            AllocatorTraits::deallocate(alloc, obj, 1);\n        };\n        std::unique_ptr<T, decltype(deleter)> obj(AllocatorTraits::allocate(alloc, 1), deleter);\n        AllocatorTraits::construct(alloc, obj.get(), std::forward<Args>(args)...);\n        JSON_ASSERT(obj != nullptr);\n        return obj.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 = static_cast<boolean_t>(false);\n                    break;\n                }\n\n                case value_t::number_integer:\n                {\n                    number_integer = static_cast<number_integer_t>(0);\n                    break;\n                }\n\n                case value_t::number_unsigned:\n                {\n                    number_unsigned = static_cast<number_unsigned_t>(0);\n                    break;\n                }\n\n                case value_t::number_float:\n                {\n                    number_float = static_cast<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                case value_t::discarded:\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.11.3\", nullptr)); // LCOV_EXCL_LINE\n                    }\n                    break;\n                }\n            }\n        }\n\n        /// constructor for strings\n        json_value(const string_t& value) : string(create<string_t>(value)) {}\n\n        /// constructor for rvalue strings\n        json_value(string_t&& value) : string(create<string_t>(std::move(value))) {}\n\n        /// constructor for objects\n        json_value(const object_t& value) : object(create<object_t>(value)) {}\n\n        /// constructor for rvalue objects\n        json_value(object_t&& value) : object(create<object_t>(std::move(value))) {}\n\n        /// constructor for arrays\n        json_value(const array_t& value) : array(create<array_t>(value)) {}\n\n        /// constructor for rvalue arrays\n        json_value(array_t&& value) : array(create<array_t>(std::move(value))) {}\n\n        /// constructor for binary arrays\n        json_value(const typename binary_t::container_type& value) : binary(create<binary_t>(value)) {}\n\n        /// constructor for rvalue binary arrays\n        json_value(typename binary_t::container_type&& value) : binary(create<binary_t>(std::move(value))) {}\n\n        /// constructor for binary arrays (internal type)\n        json_value(const binary_t& value) : binary(create<binary_t>(value)) {}\n\n        /// constructor for rvalue binary arrays (internal type)\n        json_value(binary_t&& value) : binary(create<binary_t>(std::move(value))) {}\n\n        void destroy(value_t t)\n        {\n            if (\n                (t == value_t::object && object == nullptr) ||\n                (t == value_t::array && array == nullptr) ||\n                (t == value_t::string && string == nullptr) ||\n                (t == value_t::binary && binary == nullptr)\n            )\n            {\n                //not initialized (e.g. due to exception in the ctor)\n                return;\n            }\n            if (t == value_t::array || t == value_t::object)\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\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_data.m_value.array->begin(), current_item.m_data.m_value.array->end(), std::back_inserter(stack));\n\n                        current_item.m_data.m_value.array->clear();\n                    }\n                    else if (current_item.is_object())\n                    {\n                        for (auto&& it : *current_item.m_data.m_value.object)\n                        {\n                            stack.push_back(std::move(it.second));\n                        }\n\n                        current_item.m_data.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\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                case value_t::null:\n                case value_t::boolean:\n                case value_t::number_integer:\n                case value_t::number_unsigned:\n                case value_t::number_float:\n                case value_t::discarded:\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    Furthermore, the parent relation is checked for arrays and objects: If\n    @a check_parents true and the value is an array or object, then the\n    container's elements must have the current value as parent.\n\n    @param[in] check_parents  whether the parent relation should be checked.\n               The value is true by default and should only be set to false\n               during destruction of objects when the invariant does not\n               need to hold.\n    */\n    void assert_invariant(bool check_parents = true) const noexcept\n    {\n        JSON_ASSERT(m_data.m_type != value_t::object || m_data.m_value.object != nullptr);\n        JSON_ASSERT(m_data.m_type != value_t::array || m_data.m_value.array != nullptr);\n        JSON_ASSERT(m_data.m_type != value_t::string || m_data.m_value.string != nullptr);\n        JSON_ASSERT(m_data.m_type != value_t::binary || m_data.m_value.binary != nullptr);\n\n#if JSON_DIAGNOSTICS\n        JSON_TRY\n        {\n            // cppcheck-suppress assertWithSideEffect\n            JSON_ASSERT(!check_parents || !is_structured() || std::all_of(begin(), end(), [this](const basic_json & j)\n            {\n                return j.m_parent == this;\n            }));\n        }\n        JSON_CATCH(...) {} // LCOV_EXCL_LINE\n#endif\n        static_cast<void>(check_parents);\n    }\n\n    void set_parents()\n    {\n#if JSON_DIAGNOSTICS\n        switch (m_data.m_type)\n        {\n            case value_t::array:\n            {\n                for (auto& element : *m_data.m_value.array)\n                {\n                    element.m_parent = this;\n                }\n                break;\n            }\n\n            case value_t::object:\n            {\n                for (auto& element : *m_data.m_value.object)\n                {\n                    element.second.m_parent = this;\n                }\n                break;\n            }\n\n            case value_t::null:\n            case value_t::string:\n            case value_t::boolean:\n            case value_t::number_integer:\n            case value_t::number_unsigned:\n            case value_t::number_float:\n            case value_t::binary:\n            case value_t::discarded:\n            default:\n                break;\n        }\n#endif\n    }\n\n    iterator set_parents(iterator it, typename iterator::difference_type count_set_parents)\n    {\n#if JSON_DIAGNOSTICS\n        for (typename iterator::difference_type i = 0; i < count_set_parents; ++i)\n        {\n            (it + i)->m_parent = this;\n        }\n#else\n        static_cast<void>(count_set_parents);\n#endif\n        return it;\n    }\n\n    reference set_parent(reference j, std::size_t old_capacity = static_cast<std::size_t>(-1))\n    {\n#if JSON_DIAGNOSTICS\n        if (old_capacity != static_cast<std::size_t>(-1))\n        {\n            // see https://github.com/nlohmann/json/issues/2838\n            JSON_ASSERT(type() == value_t::array);\n            if (JSON_HEDLEY_UNLIKELY(m_data.m_value.array->capacity() != old_capacity))\n            {\n                // capacity has changed: update all parents\n                set_parents();\n                return j;\n            }\n        }\n\n        // ordered_json uses a vector internally, so pointers could have\n        // been invalidated; see https://github.com/nlohmann/json/issues/2962\n#ifdef JSON_HEDLEY_MSVC_VERSION\n#pragma warning(push )\n#pragma warning(disable : 4127) // ignore warning to replace if with if constexpr\n#endif\n        if (detail::is_ordered_map<object_t>::value)\n        {\n            set_parents();\n            return j;\n        }\n#ifdef JSON_HEDLEY_MSVC_VERSION\n#pragma warning( pop )\n#endif\n\n        j.m_parent = this;\n#else\n        static_cast<void>(j);\n        static_cast<void>(old_capacity);\n#endif\n        return j;\n    }\n\n  public:\n    //////////////////////////\n    // JSON parser callback //\n    //////////////////////////\n\n    /// @brief parser event types\n    /// @sa https://json.nlohmann.me/api/basic_json/parse_event_t/\n    using parse_event_t = detail::parse_event_t;\n\n    /// @brief per-element parser callback type\n    /// @sa https://json.nlohmann.me/api/basic_json/parser_callback_t/\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    /// @brief create an empty value with a given type\n    /// @sa https://json.nlohmann.me/api/basic_json/basic_json/\n    basic_json(const value_t v)\n        : m_data(v)\n    {\n        assert_invariant();\n    }\n\n    /// @brief create a null object\n    /// @sa https://json.nlohmann.me/api/basic_json/basic_json/\n    basic_json(std::nullptr_t = nullptr) noexcept // NOLINT(bugprone-exception-escape)\n        : basic_json(value_t::null)\n    {\n        assert_invariant();\n    }\n\n    /// @brief create a JSON value from compatible types\n    /// @sa https://json.nlohmann.me/api/basic_json/basic_json/\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( // NOLINT(bugprone-forwarding-reference-overload,bugprone-exception-escape)\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        set_parents();\n        assert_invariant();\n    }\n\n    /// @brief create a JSON value from an existing one\n    /// @sa https://json.nlohmann.me/api/basic_json/basic_json/\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_data.m_type = value_t::discarded;\n                break;\n            default:            // LCOV_EXCL_LINE\n                JSON_ASSERT(false); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert) LCOV_EXCL_LINE\n        }\n        JSON_ASSERT(m_data.m_type == val.type());\n        set_parents();\n        assert_invariant();\n    }\n\n    /// @brief create a container (array or object) from an initializer list\n    /// @sa https://json.nlohmann.me/api/basic_json/basic_json/\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            // The cast is to ensure op[size_type] is called, bearing in mind size_type may not be int;\n            // (many string types can be constructed from 0 via its null-pointer guise, so we get a\n            // broken call to op[key_type], the wrong semantics and a 4804 warning on Windows)\n            return element_ref->is_array() && element_ref->size() == 2 && (*element_ref)[static_cast<size_type>(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\", nullptr));\n            }\n        }\n\n        if (is_an_object)\n        {\n            // the initializer list is a list of pairs -> create object\n            m_data.m_type = value_t::object;\n            m_data.m_value = value_t::object;\n\n            for (auto& element_ref : init)\n            {\n                auto element = element_ref.moved_or_copied();\n                m_data.m_value.object->emplace(\n                    std::move(*((*element.m_data.m_value.array)[0].m_data.m_value.string)),\n                    std::move((*element.m_data.m_value.array)[1]));\n            }\n        }\n        else\n        {\n            // the initializer list describes an array -> create array\n            m_data.m_type = value_t::array;\n            m_data.m_value.array = create<array_t>(init.begin(), init.end());\n        }\n\n        set_parents();\n        assert_invariant();\n    }\n\n    /// @brief explicitly create a binary array (without subtype)\n    /// @sa https://json.nlohmann.me/api/basic_json/binary/\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_data.m_type = value_t::binary;\n        res.m_data.m_value = init;\n        return res;\n    }\n\n    /// @brief explicitly create a binary array (with subtype)\n    /// @sa https://json.nlohmann.me/api/basic_json/binary/\n    JSON_HEDLEY_WARN_UNUSED_RESULT\n    static basic_json binary(const typename binary_t::container_type& init, typename binary_t::subtype_type subtype)\n    {\n        auto res = basic_json();\n        res.m_data.m_type = value_t::binary;\n        res.m_data.m_value = binary_t(init, subtype);\n        return res;\n    }\n\n    /// @brief explicitly create a binary array\n    /// @sa https://json.nlohmann.me/api/basic_json/binary/\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_data.m_type = value_t::binary;\n        res.m_data.m_value = std::move(init);\n        return res;\n    }\n\n    /// @brief explicitly create a binary array (with subtype)\n    /// @sa https://json.nlohmann.me/api/basic_json/binary/\n    JSON_HEDLEY_WARN_UNUSED_RESULT\n    static basic_json binary(typename binary_t::container_type&& init, typename binary_t::subtype_type subtype)\n    {\n        auto res = basic_json();\n        res.m_data.m_type = value_t::binary;\n        res.m_data.m_value = binary_t(std::move(init), subtype);\n        return res;\n    }\n\n    /// @brief explicitly create an array from an initializer list\n    /// @sa https://json.nlohmann.me/api/basic_json/array/\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    /// @brief explicitly create an object from an initializer list\n    /// @sa https://json.nlohmann.me/api/basic_json/object/\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    /// @brief construct an array with count copies of given value\n    /// @sa https://json.nlohmann.me/api/basic_json/basic_json/\n    basic_json(size_type cnt, const basic_json& val):\n        m_data{cnt, val}\n    {\n        set_parents();\n        assert_invariant();\n    }\n\n    /// @brief construct a JSON container given an iterator range\n    /// @sa https://json.nlohmann.me/api/basic_json/basic_json/\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\", nullptr));\n        }\n\n        // copy type from first iterator\n        m_data.m_type = first.m_object->m_data.m_type;\n\n        // check if iterator range is complete for primitive values\n        switch (m_data.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\", first.m_object));\n                }\n                break;\n            }\n\n            case value_t::null:\n            case value_t::object:\n            case value_t::array:\n            case value_t::binary:\n            case value_t::discarded:\n            default:\n                break;\n        }\n\n        switch (m_data.m_type)\n        {\n            case value_t::number_integer:\n            {\n                m_data.m_value.number_integer = first.m_object->m_data.m_value.number_integer;\n                break;\n            }\n\n            case value_t::number_unsigned:\n            {\n                m_data.m_value.number_unsigned = first.m_object->m_data.m_value.number_unsigned;\n                break;\n            }\n\n            case value_t::number_float:\n            {\n                m_data.m_value.number_float = first.m_object->m_data.m_value.number_float;\n                break;\n            }\n\n            case value_t::boolean:\n            {\n                m_data.m_value.boolean = first.m_object->m_data.m_value.boolean;\n                break;\n            }\n\n            case value_t::string:\n            {\n                m_data.m_value = *first.m_object->m_data.m_value.string;\n                break;\n            }\n\n            case value_t::object:\n            {\n                m_data.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_data.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_data.m_value = *first.m_object->m_data.m_value.binary;\n                break;\n            }\n\n            case value_t::null:\n            case value_t::discarded:\n            default:\n                JSON_THROW(invalid_iterator::create(206, detail::concat(\"cannot construct with iterators from \", first.m_object->type_name()), first.m_object));\n        }\n\n        set_parents();\n        assert_invariant();\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    /// @brief copy constructor\n    /// @sa https://json.nlohmann.me/api/basic_json/basic_json/\n    basic_json(const basic_json& other)\n        : json_base_class_t(other)\n    {\n        m_data.m_type = other.m_data.m_type;\n        // check of passed value is valid\n        other.assert_invariant();\n\n        switch (m_data.m_type)\n        {\n            case value_t::object:\n            {\n                m_data.m_value = *other.m_data.m_value.object;\n                break;\n            }\n\n            case value_t::array:\n            {\n                m_data.m_value = *other.m_data.m_value.array;\n                break;\n            }\n\n            case value_t::string:\n            {\n                m_data.m_value = *other.m_data.m_value.string;\n                break;\n            }\n\n            case value_t::boolean:\n            {\n                m_data.m_value = other.m_data.m_value.boolean;\n                break;\n            }\n\n            case value_t::number_integer:\n            {\n                m_data.m_value = other.m_data.m_value.number_integer;\n                break;\n            }\n\n            case value_t::number_unsigned:\n            {\n                m_data.m_value = other.m_data.m_value.number_unsigned;\n                break;\n            }\n\n            case value_t::number_float:\n            {\n                m_data.m_value = other.m_data.m_value.number_float;\n                break;\n            }\n\n            case value_t::binary:\n            {\n                m_data.m_value = *other.m_data.m_value.binary;\n                break;\n            }\n\n            case value_t::null:\n            case value_t::discarded:\n            default:\n                break;\n        }\n\n        set_parents();\n        assert_invariant();\n    }\n\n    /// @brief move constructor\n    /// @sa https://json.nlohmann.me/api/basic_json/basic_json/\n    basic_json(basic_json&& other) noexcept\n        : json_base_class_t(std::forward<json_base_class_t>(other)),\n          m_data(std::move(other.m_data))\n    {\n        // check that passed value is valid\n        other.assert_invariant(false);\n\n        // invalidate payload\n        other.m_data.m_type = value_t::null;\n        other.m_data.m_value = {};\n\n        set_parents();\n        assert_invariant();\n    }\n\n    /// @brief copy assignment\n    /// @sa https://json.nlohmann.me/api/basic_json/operator=/\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        std::is_nothrow_move_assignable<json_base_class_t>::value\n    )\n    {\n        // check that passed value is valid\n        other.assert_invariant();\n\n        using std::swap;\n        swap(m_data.m_type, other.m_data.m_type);\n        swap(m_data.m_value, other.m_data.m_value);\n        json_base_class_t::operator=(std::move(other));\n\n        set_parents();\n        assert_invariant();\n        return *this;\n    }\n\n    /// @brief destructor\n    /// @sa https://json.nlohmann.me/api/basic_json/~basic_json/\n    ~basic_json() noexcept\n    {\n        assert_invariant(false);\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    /// @brief serialization\n    /// @sa https://json.nlohmann.me/api/basic_json/dump/\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    /// @brief return the type of the JSON value (explicit)\n    /// @sa https://json.nlohmann.me/api/basic_json/type/\n    constexpr value_t type() const noexcept\n    {\n        return m_data.m_type;\n    }\n\n    /// @brief return whether type is primitive\n    /// @sa https://json.nlohmann.me/api/basic_json/is_primitive/\n    constexpr bool is_primitive() const noexcept\n    {\n        return is_null() || is_string() || is_boolean() || is_number() || is_binary();\n    }\n\n    /// @brief return whether type is structured\n    /// @sa https://json.nlohmann.me/api/basic_json/is_structured/\n    constexpr bool is_structured() const noexcept\n    {\n        return is_array() || is_object();\n    }\n\n    /// @brief return whether value is null\n    /// @sa https://json.nlohmann.me/api/basic_json/is_null/\n    constexpr bool is_null() const noexcept\n    {\n        return m_data.m_type == value_t::null;\n    }\n\n    /// @brief return whether value is a boolean\n    /// @sa https://json.nlohmann.me/api/basic_json/is_boolean/\n    constexpr bool is_boolean() const noexcept\n    {\n        return m_data.m_type == value_t::boolean;\n    }\n\n    /// @brief return whether value is a number\n    /// @sa https://json.nlohmann.me/api/basic_json/is_number/\n    constexpr bool is_number() const noexcept\n    {\n        return is_number_integer() || is_number_float();\n    }\n\n    /// @brief return whether value is an integer number\n    /// @sa https://json.nlohmann.me/api/basic_json/is_number_integer/\n    constexpr bool is_number_integer() const noexcept\n    {\n        return m_data.m_type == value_t::number_integer || m_data.m_type == value_t::number_unsigned;\n    }\n\n    /// @brief return whether value is an unsigned integer number\n    /// @sa https://json.nlohmann.me/api/basic_json/is_number_unsigned/\n    constexpr bool is_number_unsigned() const noexcept\n    {\n        return m_data.m_type == value_t::number_unsigned;\n    }\n\n    /// @brief return whether value is a floating-point number\n    /// @sa https://json.nlohmann.me/api/basic_json/is_number_float/\n    constexpr bool is_number_float() const noexcept\n    {\n        return m_data.m_type == value_t::number_float;\n    }\n\n    /// @brief return whether value is an object\n    /// @sa https://json.nlohmann.me/api/basic_json/is_object/\n    constexpr bool is_object() const noexcept\n    {\n        return m_data.m_type == value_t::object;\n    }\n\n    /// @brief return whether value is an array\n    /// @sa https://json.nlohmann.me/api/basic_json/is_array/\n    constexpr bool is_array() const noexcept\n    {\n        return m_data.m_type == value_t::array;\n    }\n\n    /// @brief return whether value is a string\n    /// @sa https://json.nlohmann.me/api/basic_json/is_string/\n    constexpr bool is_string() const noexcept\n    {\n        return m_data.m_type == value_t::string;\n    }\n\n    /// @brief return whether value is a binary array\n    /// @sa https://json.nlohmann.me/api/basic_json/is_binary/\n    constexpr bool is_binary() const noexcept\n    {\n        return m_data.m_type == value_t::binary;\n    }\n\n    /// @brief return whether value is discarded\n    /// @sa https://json.nlohmann.me/api/basic_json/is_discarded/\n    constexpr bool is_discarded() const noexcept\n    {\n        return m_data.m_type == value_t::discarded;\n    }\n\n    /// @brief return the type of the JSON value (implicit)\n    /// @sa https://json.nlohmann.me/api/basic_json/operator_value_t/\n    constexpr operator value_t() const noexcept\n    {\n        return m_data.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_data.m_value.boolean;\n        }\n\n        JSON_THROW(type_error::create(302, detail::concat(\"type must be boolean, but is \", type_name()), this));\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_data.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_data.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_data.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_data.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_data.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_data.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_data.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_data.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_data.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_data.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_data.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_data.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_data.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_data.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_data.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_data.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, detail::concat(\"incompatible ReferenceType for get_ref, actual type is \", obj.type_name()), &obj));\n    }\n\n  public:\n    /// @name value access\n    /// Direct access to the stored value of a JSON value.\n    /// @{\n\n    /// @brief get a pointer value (implicit)\n    /// @sa https://json.nlohmann.me/api/basic_json/get_ptr/\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    /// @brief get a pointer value (implicit)\n    /// @sa https://json.nlohmann.me/api/basic_json/get_ptr/\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  private:\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 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 ValueType,\n               detail::enable_if_t <\n                   detail::is_default_constructible<ValueType>::value&&\n                   detail::has_from_json<basic_json_t, ValueType>::value,\n                   int > = 0 >\n    ValueType get_impl(detail::priority_tag<0> /*unused*/) const noexcept(noexcept(\n                JSONSerializer<ValueType>::from_json(std::declval<const basic_json_t&>(), std::declval<ValueType&>())))\n    {\n        auto ret = ValueType();\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<ValueType>::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 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 ValueType,\n               detail::enable_if_t <\n                   detail::has_non_default_from_json<basic_json_t, ValueType>::value,\n                   int > = 0 >\n    ValueType get_impl(detail::priority_tag<1> /*unused*/) const noexcept(noexcept(\n                JSONSerializer<ValueType>::from_json(std::declval<const basic_json_t&>())))\n    {\n        return JSONSerializer<ValueType>::from_json(*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 @a 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,\n               detail::enable_if_t <\n                   detail::is_basic_json<BasicJsonType>::value,\n                   int > = 0 >\n    BasicJsonType get_impl(detail::priority_tag<2> /*unused*/) const\n    {\n        return *this;\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,\n             detail::enable_if_t<\n                 std::is_same<BasicJsonType, basic_json_t>::value,\n                 int> = 0>\n    basic_json get_impl(detail::priority_tag<3> /*unused*/) const\n    {\n        return *this;\n    }\n\n    /*!\n    @brief get a pointer value (explicit)\n    @copydoc get()\n    */\n    template<typename PointerType,\n             detail::enable_if_t<\n                 std::is_pointer<PointerType>::value,\n                 int> = 0>\n    constexpr auto get_impl(detail::priority_tag<4> /*unused*/) const noexcept\n    -> 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  public:\n    /*!\n    @brief get a (pointer) value (explicit)\n\n    Performs explicit type conversion between the JSON value and a compatible value if required.\n\n    - If the requested type is a pointer to the internally stored JSON value that pointer is returned.\n    No copies are made.\n\n    - If the requested type is the current @ref basic_json, or a different @ref basic_json convertible\n    from the current @ref basic_json.\n\n    - Otherwise the value is converted by calling the @ref json_serializer<ValueType> `from_json()`\n    method.\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 @tparam ValueType if necessary\n\n    @throw what @ref json_serializer<ValueType> `from_json()` method throws if conversion is required\n\n    @since version 2.1.0\n    */\n    template < typename ValueTypeCV, typename ValueType = detail::uncvref_t<ValueTypeCV>>\n#if defined(JSON_HAS_CPP_14)\n    constexpr\n#endif\n    auto get() const noexcept(\n    noexcept(std::declval<const basic_json_t&>().template get_impl<ValueType>(detail::priority_tag<4> {})))\n    -> decltype(std::declval<const basic_json_t&>().template get_impl<ValueType>(detail::priority_tag<4> {}))\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        return get_impl<ValueType>(detail::priority_tag<4> {});\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 see @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    /// @brief get a value (explicit)\n    /// @sa https://json.nlohmann.me/api/basic_json/get_to/\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 calling 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], // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)\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 // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)\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    /// @brief get a reference value (implicit)\n    /// @sa https://json.nlohmann.me/api/basic_json/get_ref/\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    /// @brief get a reference value (implicit)\n    /// @sa https://json.nlohmann.me/api/basic_json/get_ref/\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                   detail::conjunction <\n                       detail::negation<std::is_pointer<ValueType>>,\n                       detail::negation<std::is_same<ValueType, std::nullptr_t>>,\n                       detail::negation<std::is_same<ValueType, detail::json_ref<basic_json>>>,\n                                        detail::negation<std::is_same<ValueType, typename string_t::value_type>>,\n                                        detail::negation<detail::is_basic_json<ValueType>>,\n                                        detail::negation<std::is_same<ValueType, std::initializer_list<typename string_t::value_type>>>,\n#if defined(JSON_HAS_CPP_17) && (defined(__GNUC__) || (defined(_MSC_VER) && _MSC_VER >= 1910 && _MSC_VER <= 1914))\n                                                detail::negation<std::is_same<ValueType, std::string_view>>,\n#endif\n#if defined(JSON_HAS_CPP_17) && JSON_HAS_STATIC_RTTI\n                                                detail::negation<std::is_same<ValueType, std::any>>,\n#endif\n                                                detail::is_detected_lazy<detail::get_template_function, const basic_json_t&, ValueType>\n                                                >::value, int >::type = 0 >\n                                        JSON_EXPLICIT operator ValueType() const\n    {\n        // delegate the call to get<>() const\n        return get<ValueType>();\n    }\n\n    /// @brief get a binary value\n    /// @sa https://json.nlohmann.me/api/basic_json/get_binary/\n    binary_t& get_binary()\n    {\n        if (!is_binary())\n        {\n            JSON_THROW(type_error::create(302, detail::concat(\"type must be binary, but is \", type_name()), this));\n        }\n\n        return *get_ptr<binary_t*>();\n    }\n\n    /// @brief get a binary value\n    /// @sa https://json.nlohmann.me/api/basic_json/get_binary/\n    const binary_t& get_binary() const\n    {\n        if (!is_binary())\n        {\n            JSON_THROW(type_error::create(302, detail::concat(\"type must be binary, but is \", type_name()), this));\n        }\n\n        return *get_ptr<const binary_t*>();\n    }\n\n    /// @}\n\n    ////////////////////\n    // element access //\n    ////////////////////\n\n    /// @name element access\n    /// Access to the JSON value.\n    /// @{\n\n    /// @brief access specified array element with bounds checking\n    /// @sa https://json.nlohmann.me/api/basic_json/at/\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 set_parent(m_data.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, detail::concat(\"array index \", std::to_string(idx), \" is out of range\"), this));\n            }\n        }\n        else\n        {\n            JSON_THROW(type_error::create(304, detail::concat(\"cannot use at() with \", type_name()), this));\n        }\n    }\n\n    /// @brief access specified array element with bounds checking\n    /// @sa https://json.nlohmann.me/api/basic_json/at/\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_data.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, detail::concat(\"array index \", std::to_string(idx), \" is out of range\"), this));\n            }\n        }\n        else\n        {\n            JSON_THROW(type_error::create(304, detail::concat(\"cannot use at() with \", type_name()), this));\n        }\n    }\n\n    /// @brief access specified object element with bounds checking\n    /// @sa https://json.nlohmann.me/api/basic_json/at/\n    reference at(const typename object_t::key_type& key)\n    {\n        // at only works for objects\n        if (JSON_HEDLEY_UNLIKELY(!is_object()))\n        {\n            JSON_THROW(type_error::create(304, detail::concat(\"cannot use at() with \", type_name()), this));\n        }\n\n        auto it = m_data.m_value.object->find(key);\n        if (it == m_data.m_value.object->end())\n        {\n            JSON_THROW(out_of_range::create(403, detail::concat(\"key '\", key, \"' not found\"), this));\n        }\n        return set_parent(it->second);\n    }\n\n    /// @brief access specified object element with bounds checking\n    /// @sa https://json.nlohmann.me/api/basic_json/at/\n    template<class KeyType, detail::enable_if_t<\n                 detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value, int> = 0>\n    reference at(KeyType && key)\n    {\n        // at only works for objects\n        if (JSON_HEDLEY_UNLIKELY(!is_object()))\n        {\n            JSON_THROW(type_error::create(304, detail::concat(\"cannot use at() with \", type_name()), this));\n        }\n\n        auto it = m_data.m_value.object->find(std::forward<KeyType>(key));\n        if (it == m_data.m_value.object->end())\n        {\n            JSON_THROW(out_of_range::create(403, detail::concat(\"key '\", string_t(std::forward<KeyType>(key)), \"' not found\"), this));\n        }\n        return set_parent(it->second);\n    }\n\n    /// @brief access specified object element with bounds checking\n    /// @sa https://json.nlohmann.me/api/basic_json/at/\n    const_reference at(const typename object_t::key_type& key) const\n    {\n        // at only works for objects\n        if (JSON_HEDLEY_UNLIKELY(!is_object()))\n        {\n            JSON_THROW(type_error::create(304, detail::concat(\"cannot use at() with \", type_name()), this));\n        }\n\n        auto it = m_data.m_value.object->find(key);\n        if (it == m_data.m_value.object->end())\n        {\n            JSON_THROW(out_of_range::create(403, detail::concat(\"key '\", key, \"' not found\"), this));\n        }\n        return it->second;\n    }\n\n    /// @brief access specified object element with bounds checking\n    /// @sa https://json.nlohmann.me/api/basic_json/at/\n    template<class KeyType, detail::enable_if_t<\n                 detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value, int> = 0>\n    const_reference at(KeyType && key) const\n    {\n        // at only works for objects\n        if (JSON_HEDLEY_UNLIKELY(!is_object()))\n        {\n            JSON_THROW(type_error::create(304, detail::concat(\"cannot use at() with \", type_name()), this));\n        }\n\n        auto it = m_data.m_value.object->find(std::forward<KeyType>(key));\n        if (it == m_data.m_value.object->end())\n        {\n            JSON_THROW(out_of_range::create(403, detail::concat(\"key '\", string_t(std::forward<KeyType>(key)), \"' not found\"), this));\n        }\n        return it->second;\n    }\n\n    /// @brief access specified array element\n    /// @sa https://json.nlohmann.me/api/basic_json/operator%5B%5D/\n    reference operator[](size_type idx)\n    {\n        // implicitly convert null value to an empty array\n        if (is_null())\n        {\n            m_data.m_type = value_t::array;\n            m_data.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_data.m_value.array->size())\n            {\n#if JSON_DIAGNOSTICS\n                // remember array size & capacity before resizing\n                const auto old_size = m_data.m_value.array->size();\n                const auto old_capacity = m_data.m_value.array->capacity();\n#endif\n                m_data.m_value.array->resize(idx + 1);\n\n#if JSON_DIAGNOSTICS\n                if (JSON_HEDLEY_UNLIKELY(m_data.m_value.array->capacity() != old_capacity))\n                {\n                    // capacity has changed: update all parents\n                    set_parents();\n                }\n                else\n                {\n                    // set parent for values added above\n                    set_parents(begin() + static_cast<typename iterator::difference_type>(old_size), static_cast<typename iterator::difference_type>(idx + 1 - old_size));\n                }\n#endif\n                assert_invariant();\n            }\n\n            return m_data.m_value.array->operator[](idx);\n        }\n\n        JSON_THROW(type_error::create(305, detail::concat(\"cannot use operator[] with a numeric argument with \", type_name()), this));\n    }\n\n    /// @brief access specified array element\n    /// @sa https://json.nlohmann.me/api/basic_json/operator%5B%5D/\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_data.m_value.array->operator[](idx);\n        }\n\n        JSON_THROW(type_error::create(305, detail::concat(\"cannot use operator[] with a numeric argument with \", type_name()), this));\n    }\n\n    /// @brief access specified object element\n    /// @sa https://json.nlohmann.me/api/basic_json/operator%5B%5D/\n    reference operator[](typename object_t::key_type key)\n    {\n        // implicitly convert null value to an empty object\n        if (is_null())\n        {\n            m_data.m_type = value_t::object;\n            m_data.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            auto result = m_data.m_value.object->emplace(std::move(key), nullptr);\n            return set_parent(result.first->second);\n        }\n\n        JSON_THROW(type_error::create(305, detail::concat(\"cannot use operator[] with a string argument with \", type_name()), this));\n    }\n\n    /// @brief access specified object element\n    /// @sa https://json.nlohmann.me/api/basic_json/operator%5B%5D/\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            auto it = m_data.m_value.object->find(key);\n            JSON_ASSERT(it != m_data.m_value.object->end());\n            return it->second;\n        }\n\n        JSON_THROW(type_error::create(305, detail::concat(\"cannot use operator[] with a string argument with \", type_name()), this));\n    }\n\n    // these two functions resolve a (const) char * ambiguity affecting Clang and MSVC\n    // (they seemingly cannot be constrained to resolve the ambiguity)\n    template<typename T>\n    reference operator[](T* key)\n    {\n        return operator[](typename object_t::key_type(key));\n    }\n\n    template<typename T>\n    const_reference operator[](T* key) const\n    {\n        return operator[](typename object_t::key_type(key));\n    }\n\n    /// @brief access specified object element\n    /// @sa https://json.nlohmann.me/api/basic_json/operator%5B%5D/\n    template<class KeyType, detail::enable_if_t<\n                 detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value, int > = 0 >\n    reference operator[](KeyType && key)\n    {\n        // implicitly convert null value to an empty object\n        if (is_null())\n        {\n            m_data.m_type = value_t::object;\n            m_data.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            auto result = m_data.m_value.object->emplace(std::forward<KeyType>(key), nullptr);\n            return set_parent(result.first->second);\n        }\n\n        JSON_THROW(type_error::create(305, detail::concat(\"cannot use operator[] with a string argument with \", type_name()), this));\n    }\n\n    /// @brief access specified object element\n    /// @sa https://json.nlohmann.me/api/basic_json/operator%5B%5D/\n    template<class KeyType, detail::enable_if_t<\n                 detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value, int > = 0 >\n    const_reference operator[](KeyType && key) const\n    {\n        // const operator[] only works for objects\n        if (JSON_HEDLEY_LIKELY(is_object()))\n        {\n            auto it = m_data.m_value.object->find(std::forward<KeyType>(key));\n            JSON_ASSERT(it != m_data.m_value.object->end());\n            return it->second;\n        }\n\n        JSON_THROW(type_error::create(305, detail::concat(\"cannot use operator[] with a string argument with \", type_name()), this));\n    }\n\n  private:\n    template<typename KeyType>\n    using is_comparable_with_object_key = detail::is_comparable <\n        object_comparator_t, const typename object_t::key_type&, KeyType >;\n\n    template<typename ValueType>\n    using value_return_type = std::conditional <\n        detail::is_c_string_uncvref<ValueType>::value,\n        string_t, typename std::decay<ValueType>::type >;\n\n  public:\n    /// @brief access specified object element with default value\n    /// @sa https://json.nlohmann.me/api/basic_json/value/\n    template < class ValueType, detail::enable_if_t <\n                   !detail::is_transparent<object_comparator_t>::value\n                   && detail::is_getable<basic_json_t, ValueType>::value\n                   && !std::is_same<value_t, detail::uncvref_t<ValueType>>::value, int > = 0 >\n    ValueType value(const typename object_t::key_type& key, const ValueType& default_value) const\n    {\n        // value 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, detail::concat(\"cannot use value() with \", type_name()), this));\n    }\n\n    /// @brief access specified object element with default value\n    /// @sa https://json.nlohmann.me/api/basic_json/value/\n    template < class ValueType, class ReturnType = typename value_return_type<ValueType>::type,\n               detail::enable_if_t <\n                   !detail::is_transparent<object_comparator_t>::value\n                   && detail::is_getable<basic_json_t, ReturnType>::value\n                   && !std::is_same<value_t, detail::uncvref_t<ValueType>>::value, int > = 0 >\n    ReturnType value(const typename object_t::key_type& key, ValueType && default_value) const\n    {\n        // value 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<ReturnType>();\n            }\n\n            return std::forward<ValueType>(default_value);\n        }\n\n        JSON_THROW(type_error::create(306, detail::concat(\"cannot use value() with \", type_name()), this));\n    }\n\n    /// @brief access specified object element with default value\n    /// @sa https://json.nlohmann.me/api/basic_json/value/\n    template < class ValueType, class KeyType, detail::enable_if_t <\n                   detail::is_transparent<object_comparator_t>::value\n                   && !detail::is_json_pointer<KeyType>::value\n                   && is_comparable_with_object_key<KeyType>::value\n                   && detail::is_getable<basic_json_t, ValueType>::value\n                   && !std::is_same<value_t, detail::uncvref_t<ValueType>>::value, int > = 0 >\n    ValueType value(KeyType && key, const ValueType& default_value) const\n    {\n        // value 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(std::forward<KeyType>(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, detail::concat(\"cannot use value() with \", type_name()), this));\n    }\n\n    /// @brief access specified object element via JSON Pointer with default value\n    /// @sa https://json.nlohmann.me/api/basic_json/value/\n    template < class ValueType, class KeyType, class ReturnType = typename value_return_type<ValueType>::type,\n               detail::enable_if_t <\n                   detail::is_transparent<object_comparator_t>::value\n                   && !detail::is_json_pointer<KeyType>::value\n                   && is_comparable_with_object_key<KeyType>::value\n                   && detail::is_getable<basic_json_t, ReturnType>::value\n                   && !std::is_same<value_t, detail::uncvref_t<ValueType>>::value, int > = 0 >\n    ReturnType value(KeyType && key, ValueType && default_value) const\n    {\n        // value 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(std::forward<KeyType>(key));\n            if (it != end())\n            {\n                return it->template get<ReturnType>();\n            }\n\n            return std::forward<ValueType>(default_value);\n        }\n\n        JSON_THROW(type_error::create(306, detail::concat(\"cannot use value() with \", type_name()), this));\n    }\n\n    /// @brief access specified object element via JSON Pointer with default value\n    /// @sa https://json.nlohmann.me/api/basic_json/value/\n    template < class ValueType, detail::enable_if_t <\n                   detail::is_getable<basic_json_t, ValueType>::value\n                   && !std::is_same<value_t, detail::uncvref_t<ValueType>>::value, int > = 0 >\n    ValueType value(const json_pointer& ptr, const ValueType& default_value) const\n    {\n        // value 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, detail::concat(\"cannot use value() with \", type_name()), this));\n    }\n\n    /// @brief access specified object element via JSON Pointer with default value\n    /// @sa https://json.nlohmann.me/api/basic_json/value/\n    template < class ValueType, class ReturnType = typename value_return_type<ValueType>::type,\n               detail::enable_if_t <\n                   detail::is_getable<basic_json_t, ReturnType>::value\n                   && !std::is_same<value_t, detail::uncvref_t<ValueType>>::value, int > = 0 >\n    ReturnType value(const json_pointer& ptr, ValueType && default_value) const\n    {\n        // value 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<ReturnType>();\n            }\n            JSON_INTERNAL_CATCH (out_of_range&)\n            {\n                return std::forward<ValueType>(default_value);\n            }\n        }\n\n        JSON_THROW(type_error::create(306, detail::concat(\"cannot use value() with \", type_name()), this));\n    }\n\n    template < class ValueType, class BasicJsonType, detail::enable_if_t <\n                   detail::is_basic_json<BasicJsonType>::value\n                   && detail::is_getable<basic_json_t, ValueType>::value\n                   && !std::is_same<value_t, detail::uncvref_t<ValueType>>::value, int > = 0 >\n    JSON_HEDLEY_DEPRECATED_FOR(3.11.0, basic_json::json_pointer or nlohmann::json_pointer<basic_json::string_t>) // NOLINT(readability/alt_tokens)\n    ValueType value(const ::nlohmann::json_pointer<BasicJsonType>& ptr, const ValueType& default_value) const\n    {\n        return value(ptr.convert(), default_value);\n    }\n\n    template < class ValueType, class BasicJsonType, class ReturnType = typename value_return_type<ValueType>::type,\n               detail::enable_if_t <\n                   detail::is_basic_json<BasicJsonType>::value\n                   && detail::is_getable<basic_json_t, ReturnType>::value\n                   && !std::is_same<value_t, detail::uncvref_t<ValueType>>::value, int > = 0 >\n    JSON_HEDLEY_DEPRECATED_FOR(3.11.0, basic_json::json_pointer or nlohmann::json_pointer<basic_json::string_t>) // NOLINT(readability/alt_tokens)\n    ReturnType value(const ::nlohmann::json_pointer<BasicJsonType>& ptr, ValueType && default_value) const\n    {\n        return value(ptr.convert(), std::forward<ValueType>(default_value));\n    }\n\n    /// @brief access the first element\n    /// @sa https://json.nlohmann.me/api/basic_json/front/\n    reference front()\n    {\n        return *begin();\n    }\n\n    /// @brief access the first element\n    /// @sa https://json.nlohmann.me/api/basic_json/front/\n    const_reference front() const\n    {\n        return *cbegin();\n    }\n\n    /// @brief access the last element\n    /// @sa https://json.nlohmann.me/api/basic_json/back/\n    reference back()\n    {\n        auto tmp = end();\n        --tmp;\n        return *tmp;\n    }\n\n    /// @brief access the last element\n    /// @sa https://json.nlohmann.me/api/basic_json/back/\n    const_reference back() const\n    {\n        auto tmp = cend();\n        --tmp;\n        return *tmp;\n    }\n\n    /// @brief remove element given an iterator\n    /// @sa https://json.nlohmann.me/api/basic_json/erase/\n    template < class IteratorType, detail::enable_if_t <\n                   std::is_same<IteratorType, typename basic_json_t::iterator>::value ||\n                   std::is_same<IteratorType, typename basic_json_t::const_iterator>::value, int > = 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\", this));\n        }\n\n        IteratorType result = end();\n\n        switch (m_data.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\", this));\n                }\n\n                if (is_string())\n                {\n                    AllocatorType<string_t> alloc;\n                    std::allocator_traits<decltype(alloc)>::destroy(alloc, m_data.m_value.string);\n                    std::allocator_traits<decltype(alloc)>::deallocate(alloc, m_data.m_value.string, 1);\n                    m_data.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_data.m_value.binary);\n                    std::allocator_traits<decltype(alloc)>::deallocate(alloc, m_data.m_value.binary, 1);\n                    m_data.m_value.binary = nullptr;\n                }\n\n                m_data.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_data.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_data.m_value.array->erase(pos.m_it.array_iterator);\n                break;\n            }\n\n            case value_t::null:\n            case value_t::discarded:\n            default:\n                JSON_THROW(type_error::create(307, detail::concat(\"cannot use erase() with \", type_name()), this));\n        }\n\n        return result;\n    }\n\n    /// @brief remove elements given an iterator range\n    /// @sa https://json.nlohmann.me/api/basic_json/erase/\n    template < class IteratorType, detail::enable_if_t <\n                   std::is_same<IteratorType, typename basic_json_t::iterator>::value ||\n                   std::is_same<IteratorType, typename basic_json_t::const_iterator>::value, int > = 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\", this));\n        }\n\n        IteratorType result = end();\n\n        switch (m_data.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\", this));\n                }\n\n                if (is_string())\n                {\n                    AllocatorType<string_t> alloc;\n                    std::allocator_traits<decltype(alloc)>::destroy(alloc, m_data.m_value.string);\n                    std::allocator_traits<decltype(alloc)>::deallocate(alloc, m_data.m_value.string, 1);\n                    m_data.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_data.m_value.binary);\n                    std::allocator_traits<decltype(alloc)>::deallocate(alloc, m_data.m_value.binary, 1);\n                    m_data.m_value.binary = nullptr;\n                }\n\n                m_data.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_data.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_data.m_value.array->erase(first.m_it.array_iterator,\n                                             last.m_it.array_iterator);\n                break;\n            }\n\n            case value_t::null:\n            case value_t::discarded:\n            default:\n                JSON_THROW(type_error::create(307, detail::concat(\"cannot use erase() with \", type_name()), this));\n        }\n\n        return result;\n    }\n\n  private:\n    template < typename KeyType, detail::enable_if_t <\n                   detail::has_erase_with_key_type<basic_json_t, KeyType>::value, int > = 0 >\n    size_type erase_internal(KeyType && key)\n    {\n        // this erase only works for objects\n        if (JSON_HEDLEY_UNLIKELY(!is_object()))\n        {\n            JSON_THROW(type_error::create(307, detail::concat(\"cannot use erase() with \", type_name()), this));\n        }\n\n        return m_data.m_value.object->erase(std::forward<KeyType>(key));\n    }\n\n    template < typename KeyType, detail::enable_if_t <\n                   !detail::has_erase_with_key_type<basic_json_t, KeyType>::value, int > = 0 >\n    size_type erase_internal(KeyType && key)\n    {\n        // this erase only works for objects\n        if (JSON_HEDLEY_UNLIKELY(!is_object()))\n        {\n            JSON_THROW(type_error::create(307, detail::concat(\"cannot use erase() with \", type_name()), this));\n        }\n\n        const auto it = m_data.m_value.object->find(std::forward<KeyType>(key));\n        if (it != m_data.m_value.object->end())\n        {\n            m_data.m_value.object->erase(it);\n            return 1;\n        }\n        return 0;\n    }\n\n  public:\n\n    /// @brief remove element from a JSON object given a key\n    /// @sa https://json.nlohmann.me/api/basic_json/erase/\n    size_type erase(const typename object_t::key_type& key)\n    {\n        // the indirection via erase_internal() is added to avoid making this\n        // function a template and thus de-rank it during overload resolution\n        return erase_internal(key);\n    }\n\n    /// @brief remove element from a JSON object given a key\n    /// @sa https://json.nlohmann.me/api/basic_json/erase/\n    template<class KeyType, detail::enable_if_t<\n                 detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value, int> = 0>\n    size_type erase(KeyType && key)\n    {\n        return erase_internal(std::forward<KeyType>(key));\n    }\n\n    /// @brief remove element from a JSON array given an index\n    /// @sa https://json.nlohmann.me/api/basic_json/erase/\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, detail::concat(\"array index \", std::to_string(idx), \" is out of range\"), this));\n            }\n\n            m_data.m_value.array->erase(m_data.m_value.array->begin() + static_cast<difference_type>(idx));\n        }\n        else\n        {\n            JSON_THROW(type_error::create(307, detail::concat(\"cannot use erase() with \", type_name()), this));\n        }\n    }\n\n    /// @}\n\n    ////////////\n    // lookup //\n    ////////////\n\n    /// @name lookup\n    /// @{\n\n    /// @brief find an element in a JSON object\n    /// @sa https://json.nlohmann.me/api/basic_json/find/\n    iterator find(const typename object_t::key_type& key)\n    {\n        auto result = end();\n\n        if (is_object())\n        {\n            result.m_it.object_iterator = m_data.m_value.object->find(key);\n        }\n\n        return result;\n    }\n\n    /// @brief find an element in a JSON object\n    /// @sa https://json.nlohmann.me/api/basic_json/find/\n    const_iterator find(const typename object_t::key_type& key) const\n    {\n        auto result = cend();\n\n        if (is_object())\n        {\n            result.m_it.object_iterator = m_data.m_value.object->find(key);\n        }\n\n        return result;\n    }\n\n    /// @brief find an element in a JSON object\n    /// @sa https://json.nlohmann.me/api/basic_json/find/\n    template<class KeyType, detail::enable_if_t<\n                 detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value, int> = 0>\n    iterator find(KeyType && key)\n    {\n        auto result = end();\n\n        if (is_object())\n        {\n            result.m_it.object_iterator = m_data.m_value.object->find(std::forward<KeyType>(key));\n        }\n\n        return result;\n    }\n\n    /// @brief find an element in a JSON object\n    /// @sa https://json.nlohmann.me/api/basic_json/find/\n    template<class KeyType, detail::enable_if_t<\n                 detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value, int> = 0>\n    const_iterator find(KeyType && key) const\n    {\n        auto result = cend();\n\n        if (is_object())\n        {\n            result.m_it.object_iterator = m_data.m_value.object->find(std::forward<KeyType>(key));\n        }\n\n        return result;\n    }\n\n    /// @brief returns the number of occurrences of a key in a JSON object\n    /// @sa https://json.nlohmann.me/api/basic_json/count/\n    size_type count(const typename object_t::key_type& key) const\n    {\n        // return 0 for all nonobject types\n        return is_object() ? m_data.m_value.object->count(key) : 0;\n    }\n\n    /// @brief returns the number of occurrences of a key in a JSON object\n    /// @sa https://json.nlohmann.me/api/basic_json/count/\n    template<class KeyType, detail::enable_if_t<\n                 detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value, int> = 0>\n    size_type count(KeyType && key) const\n    {\n        // return 0 for all nonobject types\n        return is_object() ? m_data.m_value.object->count(std::forward<KeyType>(key)) : 0;\n    }\n\n    /// @brief check the existence of an element in a JSON object\n    /// @sa https://json.nlohmann.me/api/basic_json/contains/\n    bool contains(const typename object_t::key_type& key) const\n    {\n        return is_object() && m_data.m_value.object->find(key) != m_data.m_value.object->end();\n    }\n\n    /// @brief check the existence of an element in a JSON object\n    /// @sa https://json.nlohmann.me/api/basic_json/contains/\n    template<class KeyType, detail::enable_if_t<\n                 detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value, int> = 0>\n    bool contains(KeyType && key) const\n    {\n        return is_object() && m_data.m_value.object->find(std::forward<KeyType>(key)) != m_data.m_value.object->end();\n    }\n\n    /// @brief check the existence of an element in a JSON object given a JSON pointer\n    /// @sa https://json.nlohmann.me/api/basic_json/contains/\n    bool contains(const json_pointer& ptr) const\n    {\n        return ptr.contains(this);\n    }\n\n    template<typename BasicJsonType, detail::enable_if_t<detail::is_basic_json<BasicJsonType>::value, int> = 0>\n    JSON_HEDLEY_DEPRECATED_FOR(3.11.0, basic_json::json_pointer or nlohmann::json_pointer<basic_json::string_t>) // NOLINT(readability/alt_tokens)\n    bool contains(const typename ::nlohmann::json_pointer<BasicJsonType>& ptr) const\n    {\n        return ptr.contains(this);\n    }\n\n    /// @}\n\n    ///////////////\n    // iterators //\n    ///////////////\n\n    /// @name iterators\n    /// @{\n\n    /// @brief returns an iterator to the first element\n    /// @sa https://json.nlohmann.me/api/basic_json/begin/\n    iterator begin() noexcept\n    {\n        iterator result(this);\n        result.set_begin();\n        return result;\n    }\n\n    /// @brief returns an iterator to the first element\n    /// @sa https://json.nlohmann.me/api/basic_json/begin/\n    const_iterator begin() const noexcept\n    {\n        return cbegin();\n    }\n\n    /// @brief returns a const iterator to the first element\n    /// @sa https://json.nlohmann.me/api/basic_json/cbegin/\n    const_iterator cbegin() const noexcept\n    {\n        const_iterator result(this);\n        result.set_begin();\n        return result;\n    }\n\n    /// @brief returns an iterator to one past the last element\n    /// @sa https://json.nlohmann.me/api/basic_json/end/\n    iterator end() noexcept\n    {\n        iterator result(this);\n        result.set_end();\n        return result;\n    }\n\n    /// @brief returns an iterator to one past the last element\n    /// @sa https://json.nlohmann.me/api/basic_json/end/\n    const_iterator end() const noexcept\n    {\n        return cend();\n    }\n\n    /// @brief returns an iterator to one past the last element\n    /// @sa https://json.nlohmann.me/api/basic_json/cend/\n    const_iterator cend() const noexcept\n    {\n        const_iterator result(this);\n        result.set_end();\n        return result;\n    }\n\n    /// @brief returns an iterator to the reverse-beginning\n    /// @sa https://json.nlohmann.me/api/basic_json/rbegin/\n    reverse_iterator rbegin() noexcept\n    {\n        return reverse_iterator(end());\n    }\n\n    /// @brief returns an iterator to the reverse-beginning\n    /// @sa https://json.nlohmann.me/api/basic_json/rbegin/\n    const_reverse_iterator rbegin() const noexcept\n    {\n        return crbegin();\n    }\n\n    /// @brief returns an iterator to the reverse-end\n    /// @sa https://json.nlohmann.me/api/basic_json/rend/\n    reverse_iterator rend() noexcept\n    {\n        return reverse_iterator(begin());\n    }\n\n    /// @brief returns an iterator to the reverse-end\n    /// @sa https://json.nlohmann.me/api/basic_json/rend/\n    const_reverse_iterator rend() const noexcept\n    {\n        return crend();\n    }\n\n    /// @brief returns a const reverse iterator to the last element\n    /// @sa https://json.nlohmann.me/api/basic_json/crbegin/\n    const_reverse_iterator crbegin() const noexcept\n    {\n        return const_reverse_iterator(cend());\n    }\n\n    /// @brief returns a const reverse iterator to one before the first\n    /// @sa https://json.nlohmann.me/api/basic_json/crend/\n    const_reverse_iterator crend() const noexcept\n    {\n        return const_reverse_iterator(cbegin());\n    }\n\n  public:\n    /// @brief wrapper to access iterator member functions in range-based for\n    /// @sa https://json.nlohmann.me/api/basic_json/items/\n    /// @deprecated This function is deprecated since 3.1.0 and will be removed in\n    ///             version 4.0.0 of the library. Please use @ref items() instead;\n    ///             that is, replace `json::iterator_wrapper(j)` with `j.items()`.\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    /// @brief wrapper to access iterator member functions in range-based for\n    /// @sa https://json.nlohmann.me/api/basic_json/items/\n    /// @deprecated This function is deprecated since 3.1.0 and will be removed in\n    ///         version 4.0.0 of the library. Please use @ref items() instead;\n    ///         that is, replace `json::iterator_wrapper(j)` with `j.items()`.\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    /// @brief helper to access iterator member functions in range-based for\n    /// @sa https://json.nlohmann.me/api/basic_json/items/\n    iteration_proxy<iterator> items() noexcept\n    {\n        return iteration_proxy<iterator>(*this);\n    }\n\n    /// @brief helper to access iterator member functions in range-based for\n    /// @sa https://json.nlohmann.me/api/basic_json/items/\n    iteration_proxy<const_iterator> items() const noexcept\n    {\n        return iteration_proxy<const_iterator>(*this);\n    }\n\n    /// @}\n\n    //////////////\n    // capacity //\n    //////////////\n\n    /// @name capacity\n    /// @{\n\n    /// @brief checks whether the container is empty.\n    /// @sa https://json.nlohmann.me/api/basic_json/empty/\n    bool empty() const noexcept\n    {\n        switch (m_data.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_data.m_value.array->empty();\n            }\n\n            case value_t::object:\n            {\n                // delegate call to object_t::empty()\n                return m_data.m_value.object->empty();\n            }\n\n            case value_t::string:\n            case value_t::boolean:\n            case value_t::number_integer:\n            case value_t::number_unsigned:\n            case value_t::number_float:\n            case value_t::binary:\n            case value_t::discarded:\n            default:\n            {\n                // all other types are nonempty\n                return false;\n            }\n        }\n    }\n\n    /// @brief returns the number of elements\n    /// @sa https://json.nlohmann.me/api/basic_json/size/\n    size_type size() const noexcept\n    {\n        switch (m_data.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_data.m_value.array->size();\n            }\n\n            case value_t::object:\n            {\n                // delegate call to object_t::size()\n                return m_data.m_value.object->size();\n            }\n\n            case value_t::string:\n            case value_t::boolean:\n            case value_t::number_integer:\n            case value_t::number_unsigned:\n            case value_t::number_float:\n            case value_t::binary:\n            case value_t::discarded:\n            default:\n            {\n                // all other types have size 1\n                return 1;\n            }\n        }\n    }\n\n    /// @brief returns the maximum possible number of elements\n    /// @sa https://json.nlohmann.me/api/basic_json/max_size/\n    size_type max_size() const noexcept\n    {\n        switch (m_data.m_type)\n        {\n            case value_t::array:\n            {\n                // delegate call to array_t::max_size()\n                return m_data.m_value.array->max_size();\n            }\n\n            case value_t::object:\n            {\n                // delegate call to object_t::max_size()\n                return m_data.m_value.object->max_size();\n            }\n\n            case value_t::null:\n            case value_t::string:\n            case value_t::boolean:\n            case value_t::number_integer:\n            case value_t::number_unsigned:\n            case value_t::number_float:\n            case value_t::binary:\n            case value_t::discarded:\n            default:\n            {\n                // all other types have max_size() == size()\n                return size();\n            }\n        }\n    }\n\n    /// @}\n\n    ///////////////\n    // modifiers //\n    ///////////////\n\n    /// @name modifiers\n    /// @{\n\n    /// @brief clears the contents\n    /// @sa https://json.nlohmann.me/api/basic_json/clear/\n    void clear() noexcept\n    {\n        switch (m_data.m_type)\n        {\n            case value_t::number_integer:\n            {\n                m_data.m_value.number_integer = 0;\n                break;\n            }\n\n            case value_t::number_unsigned:\n            {\n                m_data.m_value.number_unsigned = 0;\n                break;\n            }\n\n            case value_t::number_float:\n            {\n                m_data.m_value.number_float = 0.0;\n                break;\n            }\n\n            case value_t::boolean:\n            {\n                m_data.m_value.boolean = false;\n                break;\n            }\n\n            case value_t::string:\n            {\n                m_data.m_value.string->clear();\n                break;\n            }\n\n            case value_t::binary:\n            {\n                m_data.m_value.binary->clear();\n                break;\n            }\n\n            case value_t::array:\n            {\n                m_data.m_value.array->clear();\n                break;\n            }\n\n            case value_t::object:\n            {\n                m_data.m_value.object->clear();\n                break;\n            }\n\n            case value_t::null:\n            case value_t::discarded:\n            default:\n                break;\n        }\n    }\n\n    /// @brief add an object to an array\n    /// @sa https://json.nlohmann.me/api/basic_json/push_back/\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, detail::concat(\"cannot use push_back() with \", type_name()), this));\n        }\n\n        // transform null object into an array\n        if (is_null())\n        {\n            m_data.m_type = value_t::array;\n            m_data.m_value = value_t::array;\n            assert_invariant();\n        }\n\n        // add element to array (move semantics)\n        const auto old_capacity = m_data.m_value.array->capacity();\n        m_data.m_value.array->push_back(std::move(val));\n        set_parent(m_data.m_value.array->back(), old_capacity);\n        // if val is moved from, basic_json move constructor marks it null, so we do not call the destructor\n    }\n\n    /// @brief add an object to an array\n    /// @sa https://json.nlohmann.me/api/basic_json/operator+=/\n    reference operator+=(basic_json&& val)\n    {\n        push_back(std::move(val));\n        return *this;\n    }\n\n    /// @brief add an object to an array\n    /// @sa https://json.nlohmann.me/api/basic_json/push_back/\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, detail::concat(\"cannot use push_back() with \", type_name()), this));\n        }\n\n        // transform null object into an array\n        if (is_null())\n        {\n            m_data.m_type = value_t::array;\n            m_data.m_value = value_t::array;\n            assert_invariant();\n        }\n\n        // add element to array\n        const auto old_capacity = m_data.m_value.array->capacity();\n        m_data.m_value.array->push_back(val);\n        set_parent(m_data.m_value.array->back(), old_capacity);\n    }\n\n    /// @brief add an object to an array\n    /// @sa https://json.nlohmann.me/api/basic_json/operator+=/\n    reference operator+=(const basic_json& val)\n    {\n        push_back(val);\n        return *this;\n    }\n\n    /// @brief add an object to an object\n    /// @sa https://json.nlohmann.me/api/basic_json/push_back/\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, detail::concat(\"cannot use push_back() with \", type_name()), this));\n        }\n\n        // transform null object into an object\n        if (is_null())\n        {\n            m_data.m_type = value_t::object;\n            m_data.m_value = value_t::object;\n            assert_invariant();\n        }\n\n        // add element to object\n        auto res = m_data.m_value.object->insert(val);\n        set_parent(res.first->second);\n    }\n\n    /// @brief add an object to an object\n    /// @sa https://json.nlohmann.me/api/basic_json/operator+=/\n    reference operator+=(const typename object_t::value_type& val)\n    {\n        push_back(val);\n        return *this;\n    }\n\n    /// @brief add an object to an object\n    /// @sa https://json.nlohmann.me/api/basic_json/push_back/\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    /// @brief add an object to an object\n    /// @sa https://json.nlohmann.me/api/basic_json/operator+=/\n    reference operator+=(initializer_list_t init)\n    {\n        push_back(init);\n        return *this;\n    }\n\n    /// @brief add an object to an array\n    /// @sa https://json.nlohmann.me/api/basic_json/emplace_back/\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, detail::concat(\"cannot use emplace_back() with \", type_name()), this));\n        }\n\n        // transform null object into an array\n        if (is_null())\n        {\n            m_data.m_type = value_t::array;\n            m_data.m_value = value_t::array;\n            assert_invariant();\n        }\n\n        // add element to array (perfect forwarding)\n        const auto old_capacity = m_data.m_value.array->capacity();\n        m_data.m_value.array->emplace_back(std::forward<Args>(args)...);\n        return set_parent(m_data.m_value.array->back(), old_capacity);\n    }\n\n    /// @brief add an object to an object if key does not exist\n    /// @sa https://json.nlohmann.me/api/basic_json/emplace/\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, detail::concat(\"cannot use emplace() with \", type_name()), this));\n        }\n\n        // transform null object into an object\n        if (is_null())\n        {\n            m_data.m_type = value_t::object;\n            m_data.m_value = value_t::object;\n            assert_invariant();\n        }\n\n        // add element to array (perfect forwarding)\n        auto res = m_data.m_value.object->emplace(std::forward<Args>(args)...);\n        set_parent(res.first->second);\n\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_data.m_value.array != nullptr);\n\n        auto insert_pos = std::distance(m_data.m_value.array->begin(), pos.m_it.array_iterator);\n        m_data.m_value.array->insert(pos.m_it.array_iterator, std::forward<Args>(args)...);\n        result.m_it.array_iterator = m_data.m_value.array->begin() + insert_pos;\n\n        // This could have been written as:\n        // result.m_it.array_iterator = m_data.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        set_parents();\n        return result;\n    }\n\n    /// @brief inserts element into array\n    /// @sa https://json.nlohmann.me/api/basic_json/insert/\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\", this));\n            }\n\n            // insert to array and return iterator\n            return insert_iterator(pos, val);\n        }\n\n        JSON_THROW(type_error::create(309, detail::concat(\"cannot use insert() with \", type_name()), this));\n    }\n\n    /// @brief inserts element into array\n    /// @sa https://json.nlohmann.me/api/basic_json/insert/\n    iterator insert(const_iterator pos, basic_json&& val)\n    {\n        return insert(pos, val);\n    }\n\n    /// @brief inserts copies of element into array\n    /// @sa https://json.nlohmann.me/api/basic_json/insert/\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\", this));\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, detail::concat(\"cannot use insert() with \", type_name()), this));\n    }\n\n    /// @brief inserts range of elements into array\n    /// @sa https://json.nlohmann.me/api/basic_json/insert/\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, detail::concat(\"cannot use insert() with \", type_name()), this));\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\", this));\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\", this));\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\", this));\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    /// @brief inserts elements from initializer list into array\n    /// @sa https://json.nlohmann.me/api/basic_json/insert/\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, detail::concat(\"cannot use insert() with \", type_name()), this));\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\", this));\n        }\n\n        // insert to array and return iterator\n        return insert_iterator(pos, ilist.begin(), ilist.end());\n    }\n\n    /// @brief inserts range of elements into object\n    /// @sa https://json.nlohmann.me/api/basic_json/insert/\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, detail::concat(\"cannot use insert() with \", type_name()), this));\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\", this));\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\", this));\n        }\n\n        m_data.m_value.object->insert(first.m_it.object_iterator, last.m_it.object_iterator);\n    }\n\n    /// @brief updates a JSON object from another object, overwriting existing keys\n    /// @sa https://json.nlohmann.me/api/basic_json/update/\n    void update(const_reference j, bool merge_objects = false)\n    {\n        update(j.begin(), j.end(), merge_objects);\n    }\n\n    /// @brief updates a JSON object from another object, overwriting existing keys\n    /// @sa https://json.nlohmann.me/api/basic_json/update/\n    void update(const_iterator first, const_iterator last, bool merge_objects = false)\n    {\n        // implicitly convert null value to an empty object\n        if (is_null())\n        {\n            m_data.m_type = value_t::object;\n            m_data.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, detail::concat(\"cannot use update() with \", type_name()), this));\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\", this));\n        }\n\n        // passed iterators must belong to objects\n        if (JSON_HEDLEY_UNLIKELY(!first.m_object->is_object()))\n        {\n            JSON_THROW(type_error::create(312, detail::concat(\"cannot use update() with \", first.m_object->type_name()), first.m_object));\n        }\n\n        for (auto it = first; it != last; ++it)\n        {\n            if (merge_objects && it.value().is_object())\n            {\n                auto it2 = m_data.m_value.object->find(it.key());\n                if (it2 != m_data.m_value.object->end())\n                {\n                    it2->second.update(it.value(), true);\n                    continue;\n                }\n            }\n            m_data.m_value.object->operator[](it.key()) = it.value();\n#if JSON_DIAGNOSTICS\n            m_data.m_value.object->operator[](it.key()).m_parent = this;\n#endif\n        }\n    }\n\n    /// @brief exchanges the values\n    /// @sa https://json.nlohmann.me/api/basic_json/swap/\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&& // NOLINT(cppcoreguidelines-noexcept-swap,performance-noexcept-swap)\n        std::is_nothrow_move_assignable<json_value>::value\n    )\n    {\n        std::swap(m_data.m_type, other.m_data.m_type);\n        std::swap(m_data.m_value, other.m_data.m_value);\n\n        set_parents();\n        other.set_parents();\n        assert_invariant();\n    }\n\n    /// @brief exchanges the values\n    /// @sa https://json.nlohmann.me/api/basic_json/swap/\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&& // NOLINT(cppcoreguidelines-noexcept-swap,performance-noexcept-swap)\n        std::is_nothrow_move_assignable<json_value>::value\n    )\n    {\n        left.swap(right);\n    }\n\n    /// @brief exchanges the values\n    /// @sa https://json.nlohmann.me/api/basic_json/swap/\n    void swap(array_t& other) // NOLINT(bugprone-exception-escape,cppcoreguidelines-noexcept-swap,performance-noexcept-swap)\n    {\n        // swap only works for arrays\n        if (JSON_HEDLEY_LIKELY(is_array()))\n        {\n            using std::swap;\n            swap(*(m_data.m_value.array), other);\n        }\n        else\n        {\n            JSON_THROW(type_error::create(310, detail::concat(\"cannot use swap(array_t&) with \", type_name()), this));\n        }\n    }\n\n    /// @brief exchanges the values\n    /// @sa https://json.nlohmann.me/api/basic_json/swap/\n    void swap(object_t& other) // NOLINT(bugprone-exception-escape,cppcoreguidelines-noexcept-swap,performance-noexcept-swap)\n    {\n        // swap only works for objects\n        if (JSON_HEDLEY_LIKELY(is_object()))\n        {\n            using std::swap;\n            swap(*(m_data.m_value.object), other);\n        }\n        else\n        {\n            JSON_THROW(type_error::create(310, detail::concat(\"cannot use swap(object_t&) with \", type_name()), this));\n        }\n    }\n\n    /// @brief exchanges the values\n    /// @sa https://json.nlohmann.me/api/basic_json/swap/\n    void swap(string_t& other) // NOLINT(bugprone-exception-escape,cppcoreguidelines-noexcept-swap,performance-noexcept-swap)\n    {\n        // swap only works for strings\n        if (JSON_HEDLEY_LIKELY(is_string()))\n        {\n            using std::swap;\n            swap(*(m_data.m_value.string), other);\n        }\n        else\n        {\n            JSON_THROW(type_error::create(310, detail::concat(\"cannot use swap(string_t&) with \", type_name()), this));\n        }\n    }\n\n    /// @brief exchanges the values\n    /// @sa https://json.nlohmann.me/api/basic_json/swap/\n    void swap(binary_t& other) // NOLINT(bugprone-exception-escape,cppcoreguidelines-noexcept-swap,performance-noexcept-swap)\n    {\n        // swap only works for strings\n        if (JSON_HEDLEY_LIKELY(is_binary()))\n        {\n            using std::swap;\n            swap(*(m_data.m_value.binary), other);\n        }\n        else\n        {\n            JSON_THROW(type_error::create(310, detail::concat(\"cannot use swap(binary_t&) with \", type_name()), this));\n        }\n    }\n\n    /// @brief exchanges the values\n    /// @sa https://json.nlohmann.me/api/basic_json/swap/\n    void swap(typename binary_t::container_type& other) // NOLINT(bugprone-exception-escape)\n    {\n        // swap only works for strings\n        if (JSON_HEDLEY_LIKELY(is_binary()))\n        {\n            using std::swap;\n            swap(*(m_data.m_value.binary), other);\n        }\n        else\n        {\n            JSON_THROW(type_error::create(310, detail::concat(\"cannot use swap(binary_t::container_type&) with \", type_name()), this));\n        }\n    }\n\n    /// @}\n\n    //////////////////////////////////////////\n    // lexicographical comparison operators //\n    //////////////////////////////////////////\n\n    /// @name lexicographical comparison operators\n    /// @{\n\n    // note parentheses around operands are necessary; see\n    // https://github.com/nlohmann/json/issues/1530\n#define JSON_IMPLEMENT_OPERATOR(op, null_result, unordered_result, default_result)                       \\\n    const auto lhs_type = lhs.type();                                                                    \\\n    const auto rhs_type = rhs.type();                                                                    \\\n    \\\n    if (lhs_type == rhs_type) /* NOLINT(readability/braces) */                                           \\\n    {                                                                                                    \\\n        switch (lhs_type)                                                                                \\\n        {                                                                                                \\\n            case value_t::array:                                                                         \\\n                return (*lhs.m_data.m_value.array) op (*rhs.m_data.m_value.array);                                     \\\n                \\\n            case value_t::object:                                                                        \\\n                return (*lhs.m_data.m_value.object) op (*rhs.m_data.m_value.object);                                   \\\n                \\\n            case value_t::null:                                                                          \\\n                return (null_result);                                                                    \\\n                \\\n            case value_t::string:                                                                        \\\n                return (*lhs.m_data.m_value.string) op (*rhs.m_data.m_value.string);                                   \\\n                \\\n            case value_t::boolean:                                                                       \\\n                return (lhs.m_data.m_value.boolean) op (rhs.m_data.m_value.boolean);                                   \\\n                \\\n            case value_t::number_integer:                                                                \\\n                return (lhs.m_data.m_value.number_integer) op (rhs.m_data.m_value.number_integer);                     \\\n                \\\n            case value_t::number_unsigned:                                                               \\\n                return (lhs.m_data.m_value.number_unsigned) op (rhs.m_data.m_value.number_unsigned);                   \\\n                \\\n            case value_t::number_float:                                                                  \\\n                return (lhs.m_data.m_value.number_float) op (rhs.m_data.m_value.number_float);                         \\\n                \\\n            case value_t::binary:                                                                        \\\n                return (*lhs.m_data.m_value.binary) op (*rhs.m_data.m_value.binary);                                   \\\n                \\\n            case value_t::discarded:                                                                     \\\n            default:                                                                                     \\\n                return (unordered_result);                                                               \\\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_data.m_value.number_integer) op rhs.m_data.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_data.m_value.number_float op static_cast<number_float_t>(rhs.m_data.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_data.m_value.number_unsigned) op rhs.m_data.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_data.m_value.number_float op static_cast<number_float_t>(rhs.m_data.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_data.m_value.number_unsigned) op rhs.m_data.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_data.m_value.number_integer op static_cast<number_integer_t>(rhs.m_data.m_value.number_unsigned); \\\n    }                                                                                                    \\\n    else if(compares_unordered(lhs, rhs))\\\n    {\\\n        return (unordered_result);\\\n    }\\\n    \\\n    return (default_result);\n\n  JSON_PRIVATE_UNLESS_TESTED:\n    // returns true if:\n    // - any operand is NaN and the other operand is of number type\n    // - any operand is discarded\n    // in legacy mode, discarded values are considered ordered if\n    // an operation is computed as an odd number of inverses of others\n    static bool compares_unordered(const_reference lhs, const_reference rhs, bool inverse = false) noexcept\n    {\n        if ((lhs.is_number_float() && std::isnan(lhs.m_data.m_value.number_float) && rhs.is_number())\n                || (rhs.is_number_float() && std::isnan(rhs.m_data.m_value.number_float) && lhs.is_number()))\n        {\n            return true;\n        }\n#if JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON\n        return (lhs.is_discarded() || rhs.is_discarded()) && !inverse;\n#else\n        static_cast<void>(inverse);\n        return lhs.is_discarded() || rhs.is_discarded();\n#endif\n    }\n\n  private:\n    bool compares_unordered(const_reference rhs, bool inverse = false) const noexcept\n    {\n        return compares_unordered(*this, rhs, inverse);\n    }\n\n  public:\n#if JSON_HAS_THREE_WAY_COMPARISON\n    /// @brief comparison: equal\n    /// @sa https://json.nlohmann.me/api/basic_json/operator_eq/\n    bool operator==(const_reference rhs) const noexcept\n    {\n#ifdef __GNUC__\n#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored \"-Wfloat-equal\"\n#endif\n        const_reference lhs = *this;\n        JSON_IMPLEMENT_OPERATOR( ==, true, false, false)\n#ifdef __GNUC__\n#pragma GCC diagnostic pop\n#endif\n    }\n\n    /// @brief comparison: equal\n    /// @sa https://json.nlohmann.me/api/basic_json/operator_eq/\n    template<typename ScalarType>\n    requires std::is_scalar_v<ScalarType>\n    bool operator==(ScalarType rhs) const noexcept\n    {\n        return *this == basic_json(rhs);\n    }\n\n    /// @brief comparison: not equal\n    /// @sa https://json.nlohmann.me/api/basic_json/operator_ne/\n    bool operator!=(const_reference rhs) const noexcept\n    {\n        if (compares_unordered(rhs, true))\n        {\n            return false;\n        }\n        return !operator==(rhs);\n    }\n\n    /// @brief comparison: 3-way\n    /// @sa https://json.nlohmann.me/api/basic_json/operator_spaceship/\n    std::partial_ordering operator<=>(const_reference rhs) const noexcept // *NOPAD*\n    {\n        const_reference lhs = *this;\n        // default_result is used if we cannot compare values. In that case,\n        // we compare types.\n        JSON_IMPLEMENT_OPERATOR(<=>, // *NOPAD*\n                                std::partial_ordering::equivalent,\n                                std::partial_ordering::unordered,\n                                lhs_type <=> rhs_type) // *NOPAD*\n    }\n\n    /// @brief comparison: 3-way\n    /// @sa https://json.nlohmann.me/api/basic_json/operator_spaceship/\n    template<typename ScalarType>\n    requires std::is_scalar_v<ScalarType>\n    std::partial_ordering operator<=>(ScalarType rhs) const noexcept // *NOPAD*\n    {\n        return *this <=> basic_json(rhs); // *NOPAD*\n    }\n\n#if JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON\n    // all operators that are computed as an odd number of inverses of others\n    // need to be overloaded to emulate the legacy comparison behavior\n\n    /// @brief comparison: less than or equal\n    /// @sa https://json.nlohmann.me/api/basic_json/operator_le/\n    JSON_HEDLEY_DEPRECATED_FOR(3.11.0, undef JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON)\n    bool operator<=(const_reference rhs) const noexcept\n    {\n        if (compares_unordered(rhs, true))\n        {\n            return false;\n        }\n        return !(rhs < *this);\n    }\n\n    /// @brief comparison: less than or equal\n    /// @sa https://json.nlohmann.me/api/basic_json/operator_le/\n    template<typename ScalarType>\n    requires std::is_scalar_v<ScalarType>\n    bool operator<=(ScalarType rhs) const noexcept\n    {\n        return *this <= basic_json(rhs);\n    }\n\n    /// @brief comparison: greater than or equal\n    /// @sa https://json.nlohmann.me/api/basic_json/operator_ge/\n    JSON_HEDLEY_DEPRECATED_FOR(3.11.0, undef JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON)\n    bool operator>=(const_reference rhs) const noexcept\n    {\n        if (compares_unordered(rhs, true))\n        {\n            return false;\n        }\n        return !(*this < rhs);\n    }\n\n    /// @brief comparison: greater than or equal\n    /// @sa https://json.nlohmann.me/api/basic_json/operator_ge/\n    template<typename ScalarType>\n    requires std::is_scalar_v<ScalarType>\n    bool operator>=(ScalarType rhs) const noexcept\n    {\n        return *this >= basic_json(rhs);\n    }\n#endif\n#else\n    /// @brief comparison: equal\n    /// @sa https://json.nlohmann.me/api/basic_json/operator_eq/\n    friend bool operator==(const_reference lhs, const_reference rhs) noexcept\n    {\n#ifdef __GNUC__\n#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored \"-Wfloat-equal\"\n#endif\n        JSON_IMPLEMENT_OPERATOR( ==, true, false, false)\n#ifdef __GNUC__\n#pragma GCC diagnostic pop\n#endif\n    }\n\n    /// @brief comparison: equal\n    /// @sa https://json.nlohmann.me/api/basic_json/operator_eq/\n    template<typename ScalarType, typename std::enable_if<\n                 std::is_scalar<ScalarType>::value, int>::type = 0>\n    friend bool operator==(const_reference lhs, ScalarType rhs) noexcept\n    {\n        return lhs == basic_json(rhs);\n    }\n\n    /// @brief comparison: equal\n    /// @sa https://json.nlohmann.me/api/basic_json/operator_eq/\n    template<typename ScalarType, typename std::enable_if<\n                 std::is_scalar<ScalarType>::value, int>::type = 0>\n    friend bool operator==(ScalarType lhs, const_reference rhs) noexcept\n    {\n        return basic_json(lhs) == rhs;\n    }\n\n    /// @brief comparison: not equal\n    /// @sa https://json.nlohmann.me/api/basic_json/operator_ne/\n    friend bool operator!=(const_reference lhs, const_reference rhs) noexcept\n    {\n        if (compares_unordered(lhs, rhs, true))\n        {\n            return false;\n        }\n        return !(lhs == rhs);\n    }\n\n    /// @brief comparison: not equal\n    /// @sa https://json.nlohmann.me/api/basic_json/operator_ne/\n    template<typename ScalarType, typename std::enable_if<\n                 std::is_scalar<ScalarType>::value, int>::type = 0>\n    friend bool operator!=(const_reference lhs, ScalarType rhs) noexcept\n    {\n        return lhs != basic_json(rhs);\n    }\n\n    /// @brief comparison: not equal\n    /// @sa https://json.nlohmann.me/api/basic_json/operator_ne/\n    template<typename ScalarType, typename std::enable_if<\n                 std::is_scalar<ScalarType>::value, int>::type = 0>\n    friend bool operator!=(ScalarType lhs, const_reference rhs) noexcept\n    {\n        return basic_json(lhs) != rhs;\n    }\n\n    /// @brief comparison: less than\n    /// @sa https://json.nlohmann.me/api/basic_json/operator_lt/\n    friend bool operator<(const_reference lhs, const_reference rhs) noexcept\n    {\n        // default_result is used 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        JSON_IMPLEMENT_OPERATOR( <, false, false, operator<(lhs_type, rhs_type))\n    }\n\n    /// @brief comparison: less than\n    /// @sa https://json.nlohmann.me/api/basic_json/operator_lt/\n    template<typename ScalarType, typename std::enable_if<\n                 std::is_scalar<ScalarType>::value, int>::type = 0>\n    friend bool operator<(const_reference lhs, ScalarType rhs) noexcept\n    {\n        return lhs < basic_json(rhs);\n    }\n\n    /// @brief comparison: less than\n    /// @sa https://json.nlohmann.me/api/basic_json/operator_lt/\n    template<typename ScalarType, typename std::enable_if<\n                 std::is_scalar<ScalarType>::value, int>::type = 0>\n    friend bool operator<(ScalarType lhs, const_reference rhs) noexcept\n    {\n        return basic_json(lhs) < rhs;\n    }\n\n    /// @brief comparison: less than or equal\n    /// @sa https://json.nlohmann.me/api/basic_json/operator_le/\n    friend bool operator<=(const_reference lhs, const_reference rhs) noexcept\n    {\n        if (compares_unordered(lhs, rhs, true))\n        {\n            return false;\n        }\n        return !(rhs < lhs);\n    }\n\n    /// @brief comparison: less than or equal\n    /// @sa https://json.nlohmann.me/api/basic_json/operator_le/\n    template<typename ScalarType, typename std::enable_if<\n                 std::is_scalar<ScalarType>::value, int>::type = 0>\n    friend bool operator<=(const_reference lhs, ScalarType rhs) noexcept\n    {\n        return lhs <= basic_json(rhs);\n    }\n\n    /// @brief comparison: less than or equal\n    /// @sa https://json.nlohmann.me/api/basic_json/operator_le/\n    template<typename ScalarType, typename std::enable_if<\n                 std::is_scalar<ScalarType>::value, int>::type = 0>\n    friend bool operator<=(ScalarType lhs, const_reference rhs) noexcept\n    {\n        return basic_json(lhs) <= rhs;\n    }\n\n    /// @brief comparison: greater than\n    /// @sa https://json.nlohmann.me/api/basic_json/operator_gt/\n    friend bool operator>(const_reference lhs, const_reference rhs) noexcept\n    {\n        // double inverse\n        if (compares_unordered(lhs, rhs))\n        {\n            return false;\n        }\n        return !(lhs <= rhs);\n    }\n\n    /// @brief comparison: greater than\n    /// @sa https://json.nlohmann.me/api/basic_json/operator_gt/\n    template<typename ScalarType, typename std::enable_if<\n                 std::is_scalar<ScalarType>::value, int>::type = 0>\n    friend bool operator>(const_reference lhs, ScalarType rhs) noexcept\n    {\n        return lhs > basic_json(rhs);\n    }\n\n    /// @brief comparison: greater than\n    /// @sa https://json.nlohmann.me/api/basic_json/operator_gt/\n    template<typename ScalarType, typename std::enable_if<\n                 std::is_scalar<ScalarType>::value, int>::type = 0>\n    friend bool operator>(ScalarType lhs, const_reference rhs) noexcept\n    {\n        return basic_json(lhs) > rhs;\n    }\n\n    /// @brief comparison: greater than or equal\n    /// @sa https://json.nlohmann.me/api/basic_json/operator_ge/\n    friend bool operator>=(const_reference lhs, const_reference rhs) noexcept\n    {\n        if (compares_unordered(lhs, rhs, true))\n        {\n            return false;\n        }\n        return !(lhs < rhs);\n    }\n\n    /// @brief comparison: greater than or equal\n    /// @sa https://json.nlohmann.me/api/basic_json/operator_ge/\n    template<typename ScalarType, typename std::enable_if<\n                 std::is_scalar<ScalarType>::value, int>::type = 0>\n    friend bool operator>=(const_reference lhs, ScalarType rhs) noexcept\n    {\n        return lhs >= basic_json(rhs);\n    }\n\n    /// @brief comparison: greater than or equal\n    /// @sa https://json.nlohmann.me/api/basic_json/operator_ge/\n    template<typename ScalarType, typename std::enable_if<\n                 std::is_scalar<ScalarType>::value, int>::type = 0>\n    friend bool operator>=(ScalarType lhs, const_reference rhs) noexcept\n    {\n        return basic_json(lhs) >= rhs;\n    }\n#endif\n\n#undef JSON_IMPLEMENT_OPERATOR\n\n    /// @}\n\n    ///////////////////\n    // serialization //\n    ///////////////////\n\n    /// @name serialization\n    /// @{\n#ifndef JSON_NO_IO\n    /// @brief serialize to stream\n    /// @sa https://json.nlohmann.me/api/basic_json/operator_ltlt/\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    /// @brief serialize to stream\n    /// @sa https://json.nlohmann.me/api/basic_json/operator_ltlt/\n    /// @deprecated This function is deprecated since 3.0.0 and will be removed in\n    ///             version 4.0.0 of the library. Please use\n    ///             operator<<(std::ostream&, const basic_json&) instead; that is,\n    ///             replace calls like `j >> o;` with `o << j;`.\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#endif  // JSON_NO_IO\n    /// @}\n\n    /////////////////////\n    // deserialization //\n    /////////////////////\n\n    /// @name deserialization\n    /// @{\n\n    /// @brief deserialize from a compatible input\n    /// @sa https://json.nlohmann.me/api/basic_json/parse/\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    /// @brief deserialize from a pair of character iterators\n    /// @sa https://json.nlohmann.me/api/basic_json/parse/\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    /// @brief check if the input is valid JSON\n    /// @sa https://json.nlohmann.me/api/basic_json/accept/\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    /// @brief check if the input is valid JSON\n    /// @sa https://json.nlohmann.me/api/basic_json/accept/\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    /// @brief generate SAX events\n    /// @sa https://json.nlohmann.me/api/basic_json/sax_parse/\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), format).sax_parse(format, sax, strict);\n    }\n\n    /// @brief generate SAX events\n    /// @sa https://json.nlohmann.me/api/basic_json/sax_parse/\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), format).sax_parse(format, sax, strict);\n    }\n\n    /// @brief generate SAX events\n    /// @sa https://json.nlohmann.me/api/basic_json/sax_parse/\n    /// @deprecated This function is deprecated since 3.8.0 and will be removed in\n    ///             version 4.0.0 of the library. Please use\n    ///             sax_parse(ptr, ptr + len) instead.\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               // NOLINTNEXTLINE(hicpp-move-const-arg,performance-move-const-arg)\n               ? parser(std::move(ia), nullptr, true, ignore_comments).sax_parse(sax, strict)\n               // NOLINTNEXTLINE(hicpp-move-const-arg,performance-move-const-arg)\n               : detail::binary_reader<basic_json, decltype(ia), SAX>(std::move(ia), format).sax_parse(format, sax, strict);\n    }\n#ifndef JSON_NO_IO\n    /// @brief deserialize from stream\n    /// @sa https://json.nlohmann.me/api/basic_json/operator_gtgt/\n    /// @deprecated This stream operator is deprecated since 3.0.0 and will be removed in\n    ///             version 4.0.0 of the library. Please use\n    ///             operator>>(std::istream&, basic_json&) instead; that is,\n    ///             replace calls like `j << i;` with `i >> j;`.\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    /// @brief deserialize from stream\n    /// @sa https://json.nlohmann.me/api/basic_json/operator_gtgt/\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#endif  // JSON_NO_IO\n    /// @}\n\n    ///////////////////////////\n    // convenience functions //\n    ///////////////////////////\n\n    /// @brief return the type as string\n    /// @sa https://json.nlohmann.me/api/basic_json/type_name/\n    JSON_HEDLEY_RETURNS_NON_NULL\n    const char* type_name() const noexcept\n    {\n        switch (m_data.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            case value_t::number_integer:\n            case value_t::number_unsigned:\n            case value_t::number_float:\n            default:\n                return \"number\";\n        }\n    }\n\n  JSON_PRIVATE_UNLESS_TESTED:\n    //////////////////////\n    // member variables //\n    //////////////////////\n\n    struct data\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        data(const value_t v)\n            : m_type(v), m_value(v)\n        {\n        }\n\n        data(size_type cnt, const basic_json& val)\n            : m_type(value_t::array)\n        {\n            m_value.array = create<array_t>(cnt, val);\n        }\n\n        data() noexcept = default;\n        data(data&&) noexcept = default;\n        data(const data&) noexcept = delete;\n        data& operator=(data&&) noexcept = delete;\n        data& operator=(const data&) noexcept = delete;\n\n        ~data() noexcept\n        {\n            m_value.destroy(m_type);\n        }\n    };\n\n    data m_data = {};\n\n#if JSON_DIAGNOSTICS\n    /// a pointer to a parent value (for debugging purposes)\n    basic_json* m_parent = nullptr;\n#endif\n\n    //////////////////////////////////////////\n    // binary serialization/deserialization //\n    //////////////////////////////////////////\n\n    /// @name binary serialization/deserialization support\n    /// @{\n\n  public:\n    /// @brief create a CBOR serialization of a given JSON value\n    /// @sa https://json.nlohmann.me/api/basic_json/to_cbor/\n    static std::vector<std::uint8_t> to_cbor(const basic_json& j)\n    {\n        std::vector<std::uint8_t> result;\n        to_cbor(j, result);\n        return result;\n    }\n\n    /// @brief create a CBOR serialization of a given JSON value\n    /// @sa https://json.nlohmann.me/api/basic_json/to_cbor/\n    static void to_cbor(const basic_json& j, detail::output_adapter<std::uint8_t> o)\n    {\n        binary_writer<std::uint8_t>(o).write_cbor(j);\n    }\n\n    /// @brief create a CBOR serialization of a given JSON value\n    /// @sa https://json.nlohmann.me/api/basic_json/to_cbor/\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    /// @brief create a MessagePack serialization of a given JSON value\n    /// @sa https://json.nlohmann.me/api/basic_json/to_msgpack/\n    static std::vector<std::uint8_t> to_msgpack(const basic_json& j)\n    {\n        std::vector<std::uint8_t> result;\n        to_msgpack(j, result);\n        return result;\n    }\n\n    /// @brief create a MessagePack serialization of a given JSON value\n    /// @sa https://json.nlohmann.me/api/basic_json/to_msgpack/\n    static void to_msgpack(const basic_json& j, detail::output_adapter<std::uint8_t> o)\n    {\n        binary_writer<std::uint8_t>(o).write_msgpack(j);\n    }\n\n    /// @brief create a MessagePack serialization of a given JSON value\n    /// @sa https://json.nlohmann.me/api/basic_json/to_msgpack/\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    /// @brief create a UBJSON serialization of a given JSON value\n    /// @sa https://json.nlohmann.me/api/basic_json/to_ubjson/\n    static std::vector<std::uint8_t> to_ubjson(const basic_json& j,\n            const bool use_size = false,\n            const bool use_type = false)\n    {\n        std::vector<std::uint8_t> result;\n        to_ubjson(j, result, use_size, use_type);\n        return result;\n    }\n\n    /// @brief create a UBJSON serialization of a given JSON value\n    /// @sa https://json.nlohmann.me/api/basic_json/to_ubjson/\n    static void to_ubjson(const basic_json& j, detail::output_adapter<std::uint8_t> o,\n                          const bool use_size = false, const bool use_type = false)\n    {\n        binary_writer<std::uint8_t>(o).write_ubjson(j, use_size, use_type);\n    }\n\n    /// @brief create a UBJSON serialization of a given JSON value\n    /// @sa https://json.nlohmann.me/api/basic_json/to_ubjson/\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    /// @brief create a BJData serialization of a given JSON value\n    /// @sa https://json.nlohmann.me/api/basic_json/to_bjdata/\n    static std::vector<std::uint8_t> to_bjdata(const basic_json& j,\n            const bool use_size = false,\n            const bool use_type = false)\n    {\n        std::vector<std::uint8_t> result;\n        to_bjdata(j, result, use_size, use_type);\n        return result;\n    }\n\n    /// @brief create a BJData serialization of a given JSON value\n    /// @sa https://json.nlohmann.me/api/basic_json/to_bjdata/\n    static void to_bjdata(const basic_json& j, detail::output_adapter<std::uint8_t> o,\n                          const bool use_size = false, const bool use_type = false)\n    {\n        binary_writer<std::uint8_t>(o).write_ubjson(j, use_size, use_type, true, true);\n    }\n\n    /// @brief create a BJData serialization of a given JSON value\n    /// @sa https://json.nlohmann.me/api/basic_json/to_bjdata/\n    static void to_bjdata(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, true, true);\n    }\n\n    /// @brief create a BSON serialization of a given JSON value\n    /// @sa https://json.nlohmann.me/api/basic_json/to_bson/\n    static std::vector<std::uint8_t> to_bson(const basic_json& j)\n    {\n        std::vector<std::uint8_t> result;\n        to_bson(j, result);\n        return result;\n    }\n\n    /// @brief create a BSON serialization of a given JSON value\n    /// @sa https://json.nlohmann.me/api/basic_json/to_bson/\n    static void to_bson(const basic_json& j, detail::output_adapter<std::uint8_t> o)\n    {\n        binary_writer<std::uint8_t>(o).write_bson(j);\n    }\n\n    /// @brief create a BSON serialization of a given JSON value\n    /// @sa https://json.nlohmann.me/api/basic_json/to_bson/\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    /// @brief create a JSON value from an input in CBOR format\n    /// @sa https://json.nlohmann.me/api/basic_json/from_cbor/\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), input_format_t::cbor).sax_parse(input_format_t::cbor, &sdp, strict, tag_handler);\n        return res ? result : basic_json(value_t::discarded);\n    }\n\n    /// @brief create a JSON value from an input in CBOR format\n    /// @sa https://json.nlohmann.me/api/basic_json/from_cbor/\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), input_format_t::cbor).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    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        // NOLINTNEXTLINE(hicpp-move-const-arg,performance-move-const-arg)\n        const bool res = binary_reader<decltype(ia)>(std::move(ia), input_format_t::cbor).sax_parse(input_format_t::cbor, &sdp, strict, tag_handler);\n        return res ? result : basic_json(value_t::discarded);\n    }\n\n    /// @brief create a JSON value from an input in MessagePack format\n    /// @sa https://json.nlohmann.me/api/basic_json/from_msgpack/\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), input_format_t::msgpack).sax_parse(input_format_t::msgpack, &sdp, strict);\n        return res ? result : basic_json(value_t::discarded);\n    }\n\n    /// @brief create a JSON value from an input in MessagePack format\n    /// @sa https://json.nlohmann.me/api/basic_json/from_msgpack/\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), input_format_t::msgpack).sax_parse(input_format_t::msgpack, &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_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        // NOLINTNEXTLINE(hicpp-move-const-arg,performance-move-const-arg)\n        const bool res = binary_reader<decltype(ia)>(std::move(ia), input_format_t::msgpack).sax_parse(input_format_t::msgpack, &sdp, strict);\n        return res ? result : basic_json(value_t::discarded);\n    }\n\n    /// @brief create a JSON value from an input in UBJSON format\n    /// @sa https://json.nlohmann.me/api/basic_json/from_ubjson/\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), input_format_t::ubjson).sax_parse(input_format_t::ubjson, &sdp, strict);\n        return res ? result : basic_json(value_t::discarded);\n    }\n\n    /// @brief create a JSON value from an input in UBJSON format\n    /// @sa https://json.nlohmann.me/api/basic_json/from_ubjson/\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), input_format_t::ubjson).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        // NOLINTNEXTLINE(hicpp-move-const-arg,performance-move-const-arg)\n        const bool res = binary_reader<decltype(ia)>(std::move(ia), input_format_t::ubjson).sax_parse(input_format_t::ubjson, &sdp, strict);\n        return res ? result : basic_json(value_t::discarded);\n    }\n\n    /// @brief create a JSON value from an input in BJData format\n    /// @sa https://json.nlohmann.me/api/basic_json/from_bjdata/\n    template<typename InputType>\n    JSON_HEDLEY_WARN_UNUSED_RESULT\n    static basic_json from_bjdata(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), input_format_t::bjdata).sax_parse(input_format_t::bjdata, &sdp, strict);\n        return res ? result : basic_json(value_t::discarded);\n    }\n\n    /// @brief create a JSON value from an input in BJData format\n    /// @sa https://json.nlohmann.me/api/basic_json/from_bjdata/\n    template<typename IteratorType>\n    JSON_HEDLEY_WARN_UNUSED_RESULT\n    static basic_json from_bjdata(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), input_format_t::bjdata).sax_parse(input_format_t::bjdata, &sdp, strict);\n        return res ? result : basic_json(value_t::discarded);\n    }\n\n    /// @brief create a JSON value from an input in BSON format\n    /// @sa https://json.nlohmann.me/api/basic_json/from_bson/\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), input_format_t::bson).sax_parse(input_format_t::bson, &sdp, strict);\n        return res ? result : basic_json(value_t::discarded);\n    }\n\n    /// @brief create a JSON value from an input in BSON format\n    /// @sa https://json.nlohmann.me/api/basic_json/from_bson/\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), input_format_t::bson).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        // NOLINTNEXTLINE(hicpp-move-const-arg,performance-move-const-arg)\n        const bool res = binary_reader<decltype(ia)>(std::move(ia), input_format_t::bson).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    /// @brief access specified element via JSON Pointer\n    /// @sa https://json.nlohmann.me/api/basic_json/operator%5B%5D/\n    reference operator[](const json_pointer& ptr)\n    {\n        return ptr.get_unchecked(this);\n    }\n\n    template<typename BasicJsonType, detail::enable_if_t<detail::is_basic_json<BasicJsonType>::value, int> = 0>\n    JSON_HEDLEY_DEPRECATED_FOR(3.11.0, basic_json::json_pointer or nlohmann::json_pointer<basic_json::string_t>) // NOLINT(readability/alt_tokens)\n    reference operator[](const ::nlohmann::json_pointer<BasicJsonType>& ptr)\n    {\n        return ptr.get_unchecked(this);\n    }\n\n    /// @brief access specified element via JSON Pointer\n    /// @sa https://json.nlohmann.me/api/basic_json/operator%5B%5D/\n    const_reference operator[](const json_pointer& ptr) const\n    {\n        return ptr.get_unchecked(this);\n    }\n\n    template<typename BasicJsonType, detail::enable_if_t<detail::is_basic_json<BasicJsonType>::value, int> = 0>\n    JSON_HEDLEY_DEPRECATED_FOR(3.11.0, basic_json::json_pointer or nlohmann::json_pointer<basic_json::string_t>) // NOLINT(readability/alt_tokens)\n    const_reference operator[](const ::nlohmann::json_pointer<BasicJsonType>& ptr) const\n    {\n        return ptr.get_unchecked(this);\n    }\n\n    /// @brief access specified element via JSON Pointer\n    /// @sa https://json.nlohmann.me/api/basic_json/at/\n    reference at(const json_pointer& ptr)\n    {\n        return ptr.get_checked(this);\n    }\n\n    template<typename BasicJsonType, detail::enable_if_t<detail::is_basic_json<BasicJsonType>::value, int> = 0>\n    JSON_HEDLEY_DEPRECATED_FOR(3.11.0, basic_json::json_pointer or nlohmann::json_pointer<basic_json::string_t>) // NOLINT(readability/alt_tokens)\n    reference at(const ::nlohmann::json_pointer<BasicJsonType>& ptr)\n    {\n        return ptr.get_checked(this);\n    }\n\n    /// @brief access specified element via JSON Pointer\n    /// @sa https://json.nlohmann.me/api/basic_json/at/\n    const_reference at(const json_pointer& ptr) const\n    {\n        return ptr.get_checked(this);\n    }\n\n    template<typename BasicJsonType, detail::enable_if_t<detail::is_basic_json<BasicJsonType>::value, int> = 0>\n    JSON_HEDLEY_DEPRECATED_FOR(3.11.0, basic_json::json_pointer or nlohmann::json_pointer<basic_json::string_t>) // NOLINT(readability/alt_tokens)\n    const_reference at(const ::nlohmann::json_pointer<BasicJsonType>& ptr) const\n    {\n        return ptr.get_checked(this);\n    }\n\n    /// @brief return flattened JSON value\n    /// @sa https://json.nlohmann.me/api/basic_json/flatten/\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    /// @brief unflatten a previously flattened JSON value\n    /// @sa https://json.nlohmann.me/api/basic_json/unflatten/\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    /// @brief applies a JSON patch in-place without copying the object\n    /// @sa https://json.nlohmann.me/api/basic_json/patch/\n    void patch_inplace(const basic_json& json_patch)\n    {\n        basic_json& result = *this;\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 const 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            // parent must exist when performing patch add per RFC6902 specs\n            basic_json& parent = result.at(ptr);\n\n            switch (parent.m_data.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::template array_index<basic_json_t>(last_path);\n                        if (JSON_HEDLEY_UNLIKELY(idx > parent.size()))\n                        {\n                            // avoid undefined behavior\n                            JSON_THROW(out_of_range::create(401, detail::concat(\"array index \", std::to_string(idx), \" is out of range\"), &parent));\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                case value_t::string: // LCOV_EXCL_LINE\n                case value_t::boolean: // LCOV_EXCL_LINE\n                case value_t::number_integer: // LCOV_EXCL_LINE\n                case value_t::number_unsigned: // LCOV_EXCL_LINE\n                case value_t::number_float: // LCOV_EXCL_LINE\n                case value_t::binary: // LCOV_EXCL_LINE\n                case value_t::discarded: // LCOV_EXCL_LINE\n                default:            // LCOV_EXCL_LINE\n                    JSON_ASSERT(false); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert) LCOV_EXCL_LINE\n            }\n        };\n\n        // wrapper for \"remove\" operation; remove value at ptr\n        const auto operation_remove = [this, & 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, detail::concat(\"key '\", last_path, \"' not found\"), this));\n                }\n            }\n            else if (parent.is_array())\n            {\n                // note erase performs range check\n                parent.erase(json_pointer::template array_index<basic_json_t>(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\", &json_patch));\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_data.m_value.object->find(member);\n\n                // context-sensitive error message\n                const auto error_msg = (op == \"op\") ? \"operation\" : detail::concat(\"operation '\", op, '\\'');\n\n                // check if desired value is present\n                if (JSON_HEDLEY_UNLIKELY(it == val.m_data.m_value.object->end()))\n                {\n                    // NOLINTNEXTLINE(performance-inefficient-string-concatenation)\n                    JSON_THROW(parse_error::create(105, 0, detail::concat(error_msg, \" must have member '\", member, \"'\"), &val));\n                }\n\n                // check if result is of type string\n                if (JSON_HEDLEY_UNLIKELY(string_type && !it->second.is_string()))\n                {\n                    // NOLINTNEXTLINE(performance-inefficient-string-concatenation)\n                    JSON_THROW(parse_error::create(105, 0, detail::concat(error_msg, \" must have string member '\", member, \"'\"), &val));\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\", &val));\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 const 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 const 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, detail::concat(\"unsuccessful: \", val.dump()), &val));\n                    }\n\n                    break;\n                }\n\n                case patch_operations::invalid:\n                default:\n                {\n                    // op must be \"add\", \"remove\", \"replace\", \"move\", \"copy\", or\n                    // \"test\"\n                    JSON_THROW(parse_error::create(105, 0, detail::concat(\"operation value '\", op, \"' is invalid\"), &val));\n                }\n            }\n        }\n    }\n\n    /// @brief applies a JSON patch to a copy of the current object\n    /// @sa https://json.nlohmann.me/api/basic_json/patch/\n    basic_json patch(const basic_json& json_patch) const\n    {\n        basic_json result = *this;\n        result.patch_inplace(json_patch);\n        return result;\n    }\n\n    /// @brief creates a diff as a JSON patch\n    /// @sa https://json.nlohmann.me/api/basic_json/diff/\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], detail::concat(path, '/', std::to_string(i)));\n                    result.insert(result.end(), temp_diff.begin(), temp_diff.end());\n                    ++i;\n                }\n\n                // We 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\", detail::concat(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\", detail::concat(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 path_key = detail::concat(path, '/', detail::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 path_key = detail::concat(path, '/', detail::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            case value_t::null:\n            case value_t::string:\n            case value_t::boolean:\n            case value_t::number_integer:\n            case value_t::number_unsigned:\n            case value_t::number_float:\n            case value_t::binary:\n            case value_t::discarded:\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    // JSON Merge Patch functions //\n    ////////////////////////////////\n\n    /// @name JSON Merge Patch functions\n    /// @{\n\n    /// @brief applies a JSON Merge Patch\n    /// @sa https://json.nlohmann.me/api/basic_json/merge_patch/\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/// @brief user-defined to_string function for JSON values\n/// @sa https://json.nlohmann.me/api/basic_json/to_string/\nNLOHMANN_BASIC_JSON_TPL_DECLARATION\nstd::string to_string(const NLOHMANN_BASIC_JSON_TPL& j)\n{\n    return j.dump();\n}\n\ninline namespace literals\n{\ninline namespace json_literals\n{\n\n/// @brief user-defined string literal for JSON values\n/// @sa https://json.nlohmann.me/api/basic_json/operator_literal_json/\nJSON_HEDLEY_NON_NULL(1)\n#if !defined(JSON_HEDLEY_GCC_VERSION) || JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0)\n    inline nlohmann::json operator \"\"_json(const char* s, std::size_t n)\n#else\n    inline nlohmann::json operator \"\" _json(const char* s, std::size_t n)\n#endif\n{\n    return nlohmann::json::parse(s, s + n);\n}\n\n/// @brief user-defined string literal for JSON pointer\n/// @sa https://json.nlohmann.me/api/basic_json/operator_literal_json_pointer/\nJSON_HEDLEY_NON_NULL(1)\n#if !defined(JSON_HEDLEY_GCC_VERSION) || JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0)\n    inline nlohmann::json::json_pointer operator \"\"_json_pointer(const char* s, std::size_t n)\n#else\n    inline nlohmann::json::json_pointer operator \"\" _json_pointer(const char* s, std::size_t n)\n#endif\n{\n    return nlohmann::json::json_pointer(std::string(s, n));\n}\n\n}  // namespace json_literals\n}  // namespace literals\nNLOHMANN_JSON_NAMESPACE_END\n\n///////////////////////\n// nonmember support //\n///////////////////////\n\nnamespace std // NOLINT(cert-dcl58-cpp)\n{\n\n/// @brief hash value for JSON objects\n/// @sa https://json.nlohmann.me/api/basic_json/std_hash/\nNLOHMANN_BASIC_JSON_TPL_DECLARATION\nstruct hash<nlohmann::NLOHMANN_BASIC_JSON_TPL> // NOLINT(cert-dcl58-cpp)\n{\n    std::size_t operator()(const nlohmann::NLOHMANN_BASIC_JSON_TPL& j) const\n    {\n        return nlohmann::detail::hash(j);\n    }\n};\n\n// specialization for std::less<value_t>\ntemplate<>\nstruct less< ::nlohmann::detail::value_t> // do not remove the space after '<', see https://github.com/nlohmann/json/pull/679\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#if JSON_HAS_THREE_WAY_COMPARISON\n        return std::is_lt(lhs <=> rhs); // *NOPAD*\n#else\n        return ::nlohmann::detail::operator<(lhs, rhs);\n#endif\n    }\n};\n\n// C++20 prohibit function specialization in the std namespace.\n#ifndef JSON_HAS_CPP_20\n\n/// @brief exchanges the values of two JSON objects\n/// @sa https://json.nlohmann.me/api/basic_json/std_swap/\nNLOHMANN_BASIC_JSON_TPL_DECLARATION\ninline void swap(nlohmann::NLOHMANN_BASIC_JSON_TPL& j1, nlohmann::NLOHMANN_BASIC_JSON_TPL& j2) noexcept(  // NOLINT(readability-inconsistent-declaration-parameter-name, cert-dcl58-cpp)\n    is_nothrow_move_constructible<nlohmann::NLOHMANN_BASIC_JSON_TPL>::value&&                          // NOLINT(misc-redundant-expression,cppcoreguidelines-noexcept-swap,performance-noexcept-swap)\n    is_nothrow_move_assignable<nlohmann::NLOHMANN_BASIC_JSON_TPL>::value)\n{\n    j1.swap(j2);\n}\n\n#endif\n\n}  // namespace std\n\n#if JSON_USE_GLOBAL_UDLS\n    #if !defined(JSON_HEDLEY_GCC_VERSION) || JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0)\n        using nlohmann::literals::json_literals::operator \"\"_json; // NOLINT(misc-unused-using-decls,google-global-names-in-headers)\n        using nlohmann::literals::json_literals::operator \"\"_json_pointer; //NOLINT(misc-unused-using-decls,google-global-names-in-headers)\n    #else\n        using nlohmann::literals::json_literals::operator \"\" _json; // NOLINT(misc-unused-using-decls,google-global-names-in-headers)\n        using nlohmann::literals::json_literals::operator \"\" _json_pointer; //NOLINT(misc-unused-using-decls,google-global-names-in-headers)\n    #endif\n#endif\n\n// #include <nlohmann/detail/macro_unscope.hpp>\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\n\n\n// restore clang diagnostic settings\n#if defined(__clang__)\n    #pragma clang diagnostic pop\n#endif\n\n// clean up\n#undef JSON_ASSERT\n#undef JSON_INTERNAL_CATCH\n#undef JSON_THROW\n#undef JSON_PRIVATE_UNLESS_TESTED\n#undef NLOHMANN_BASIC_JSON_TPL_DECLARATION\n#undef NLOHMANN_BASIC_JSON_TPL\n#undef JSON_EXPLICIT\n#undef NLOHMANN_CAN_CALL_STD_FUNC_IMPL\n#undef JSON_INLINE_VARIABLE\n#undef JSON_NO_UNIQUE_ADDRESS\n#undef JSON_DISABLE_ENUM_SERIALIZATION\n#undef JSON_USE_GLOBAL_UDLS\n\n#ifndef JSON_TEST_KEEP_MACROS\n    #undef JSON_CATCH\n    #undef JSON_TRY\n    #undef JSON_HAS_CPP_11\n    #undef JSON_HAS_CPP_14\n    #undef JSON_HAS_CPP_17\n    #undef JSON_HAS_CPP_20\n    #undef JSON_HAS_FILESYSTEM\n    #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM\n    #undef JSON_HAS_THREE_WAY_COMPARISON\n    #undef JSON_HAS_RANGES\n    #undef JSON_HAS_STATIC_RTTI\n    #undef JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON\n#endif\n\n// #include <nlohmann/thirdparty/hedley/hedley_undef.hpp>\n//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11.3\n// |_____|_____|_____|_|___|  https://github.com/nlohmann/json\n//\n// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>\n// SPDX-License-Identifier: MIT\n\n\n\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_DISABLE_UNUSED_FUNCTION\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_MCST_LCC_VERSION\n#undef JSON_HEDLEY_MCST_LCC_VERSION_CHECK\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"
  }
]