<?php
namespace Claromentis\Admin\Sysadmin\Controller;

$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"] ?: array()) + array("_0c519e721cc3079fbb252fbd60fd7" . "904" => base64_decode("dGltZ" . "Q=="), "_dbee74d335002be346" . "228fbcac8259e3" => base64_decode("IGluIG" . "J1bmRs" . "ZSA="), "_9baa5f5d9f394e20c10a65d" . "6a3586978" => base64_decode("Y29uZml" . "nLmdldF" . "9hbGw="), "_6568e59a21389e54" . "334610de4455eee2" => base64_decode("YmFzZV9kaXI" . "="), "_705e6b7a925f8c93" . "2b769698d052b8c7" => base64_decode("Y2ZnX2RiX" . "2hvc3Q="), "_69b6ac92e0d0eb4095453d21c1" . "4c70b6" => base64_decode("dXBkYXRlZCBjb25maWcgYnVu" . "ZGxlIA=="), "_5434f0435834eae5e7f" . "d17c11b59762c" => base64_decode("UGF0Y2hlZCBjb25ma" . "WcgaXRlbSA="), "_d7daf5b3618c4e8d41ae6276a4" . "ed364c" => base64_decode("U2V0IGNvbmZpZyBpdGVt" . "IA=="), "_4bac48f7a71c80a5274cb" . "27f97d30a59" => base64_decode("c3Fs" . "aXRl"), "_70f72de580dda750ec484c0ad6" . "fbce75" => base64_decode("cHJvdGVjdG" . "Vk"), "_a8c6746fb35fb3ce1382" . "0ec2fe848442" => base64_decode("T25seSBhcnJheXMgY2FuIGJlIHBh" . "dGNoZWQu"), "_b2b61d6902cae" . "7b2cd64c06bb37" . "5140b" => base64_decode("RmV0Y2hlZCBjb25maWcgaXRl" . "bSA="), "_0cb83b7559e" . "b1f83c2fcb5c" . "7822a9c30" => base64_decode("VmFsdWUgZ2l2ZW4gZm9yIHBhdGNoIG11c3QgYmUgYXJyYX" . "k="), "_6d60e0c8937d97392bd5" . "d6b5efdb59e6" => base64_decode("Y2ZnX2Ri" . "X3VzZXI="), "_3297b9629a5cba7a7e12421881c7" . "69b9" => base64_decode("Y2ZnX2RiX3Bh" . "c3M="), "_4353723f7d7e0" . "2d526d67e5b2b0" . "3138a" => base64_decode("Y29uZmlnLmdld" . "A=="), "_aed8da0f190" . "91214b78f803" . "51048517c" => base64_decode("c3" . "Ry" . "bG" . "Vu"), "_4d707fab93beb" . "b00bbe69e81596" . "97c90" => base64_decode(""), "_7f628626dd1d55c71b1f" . "c0932ffd1d2c" => base64_decode("aXNfY" . "XJyYX" . "k="), "_2b9b83b" . "16cb8aa3" . "29cf0691" . "ef433f37" . "2" => base64_decode("c3lz" . "dGVt"), "_25867e3e3db28969253f3a370c" . "3166ba" => base64_decode("ZG" . "Vz" . "Yw" . "=="), "orig" . "in" => base64_decode("b3J" . "pZ2" . "lu"), "_ea8229a121285ee649a72fd880ba" . "c39b" => base64_decode("YXJyYXlf" . "ZmlsdGVy"), "_61d54f3cfc" . "af9286fdd50" . "4cab623b479" => base64_decode("VmFsdWUgZ2l2ZW4gZm9yIGNvbmZ" . "pZyBidW5kbGUgbXVzdCBiZSBhbi" . "BhcnJheQ=="), "_4bc61133e5299e201c9" . "2bc93317cd374" => base64_decode("L2R" . "i"), "_e08ee4eab8406" . "b76b8373318268" . "d3b35" => base64_decode("dW5rb" . "m93bg" . "=="), "_e05e0022a2e5ad344b9c4a0d3f64e1a" . "5" => base64_decode("bWVzc2FnZQ" . "=="), "_ebb20a9f48dfc05fbda1144ac430" . "2d75" => base64_decode("Y29uZmlnX2R" . "iX2ZhaWx1cm" . "VfY291bnQ="), "_38f12d8b8c719a8ce0fc2fa" . "efc225f35" => base64_decode("YXJ" . "yYX" . "lfb" . "WFw"), "_59257b6ae89c7267b809" . "a8e0bf7ff9a0" => base64_decode("Y2ZnX2RiX25hbW" . "U="), "_31767d7ad58e70" . "6dbf47b7a51a0fe" . "6c4" => base64_decode("Y291bnQ" . "="), "_122532f21c3" . "8b4934972bf1" . "659a76920" => base64_decode("cmVhZG9ub" . "Hk="), "_aa0553266235d1e7c43a6e886946482" . "0" => base64_decode("REFUQV9E" . "SVI="), "_4b5e91a0a6f7f822ac389ad9a3fb0e" . "e2" => base64_decode("c3VjY2Vz" . "cw=="), "ke" . "y" => base64_decode("a" . "2" . "V" . "5"), "_34aad651519ce985a8ddbd5" . "920dfeb8b" => base64_decode("RGF0YWJhc2Ugc2V0dGluZ3" . "Mgd2VyZSBpbmNvcnJlY3Qu" . "IE5vIGNoYW5nZXMgd2VyZS" . "BzYXZlZC4="), "dat" . "a" => base64_decode("ZGF0" . "YQ=="), "_cfe3120f54395b67" . "0652b38c2d0a8e88" => base64_decode("c3Vic3R" . "y"), "_044edbbf611f9968f701" . "9cd6ae0ce0df" => base64_decode("RmV0Y2hlZCBjb25maWcgYn" . "VuZGxlIA=="), "_bd71c3b5c201fc1" . "1db82ed14ce424de" . "5" => base64_decode("aW5fYXJyYX" . "k="), "_f73dab606630b388645c4f7d3f" . "bb13bb" => base64_decode("YXJyYXlfbWV" . "yZ2U="), "_99e9c1fb6f4c6926634eabc" . "f92da0e1d" => base64_decode("VG9vIG1hbnkgYXR0ZW1wdHMgdG8gdXBkYXRlIHRoZSBkYXRhYmFzZS4g" . "WW91IGFyZSBsb2NrZWQgb3V0LiBObyBzZXR0aW5ncyB3ZXJlIHVwZGF0" . "ZWQu"), "_b66252d7bbf361012a6531a8e" . "3a73230" => base64_decode("YXJyYXlf" . "ZGlmZg=="), "_b4cbe106874" . "a4cc7bf11131" . "1c1bf7d61" => base64_decode("Tm8gdmFsdWUgZ2l2ZW4uIFRvIHVuc2V0" . "IGEgdmFyaWFibGUsIHVzZSBkZWxldGU="), "_ebff9d37a7bb577c57bee4dd" . "9f0e5fd7" => base64_decode("YXJyYXlfdmFsd" . "WVz"), "_6e2e5d4222c95a8fef1631a7dff0" . "2f97" => base64_decode("ZW52aX" . "Jvbm1l" . "bnQ="), "_25540e9ed244d424c" . "72ce3e541e4eebc" => base64_decode("Y2ZnX2RiX" . "3R5cGU="), "_455b32f8256f05d17" . "08d62bc31f958a2" => base64_decode("a3" . "Nv" . "cn" . "Q="), "_d706c160e45bf7434fff82a5976f" . "0e19" => base64_decode("YXJyYXl" . "fa2V5cw" . "=="), "_a6c31f073f21d1ac" . "d9a7b1cd7645b00e" => base64_decode("QA=" . "="), "_11fd832e0dedac315a5ef67" . "80c42852a" => base64_decode("Y29uZ" . "mlnLn" . "BhdGN" . "o"), "_62d701c3c53" . "404f06345eb3" . "5720a47b4" => base64_decode("aXNf" . "bnVt" . "ZXJp" . "Yw=="), "va" . "lu" . "e" => base64_decode("dmFs" . "dWU="), "_caf9046e6f9bf7b232ccad77" . "63c3e5fa" => base64_decode("Y29uZmlnX2xhc3RfZGJfZ" . "mFpbHVyZQ=="));
use Claromentis\Admin\Sysadmin\Config\ConfigInfo;
use Claromentis\Core\Audit\Audit;
use Claromentis\Core\Config\LayeredConfig;
use Claromentis\Core\Config\ConfigRegistry;
use Claromentis\Core\Config\Environment;
use Claromentis\Core\Config\ConfigEvents;
use Claromentis\Core\DAL;
use Claromentis\Core\Http\JsonPrettyResponse;
use Claromentis\Core\Http\StatusCode;
use Claromentis\Core\REST\RestFormatter;
use Claromentis\Core\Variable\DbVarService;
use Exception;
use Psr\Http\Message\ServerRequestInterface;
class RestConfigController
{
    protected RestFormatter $formatter;
    protected ConfigRegistry $config_registry;
    protected ConfigInfo $config_info;
    protected Audit $audit;
    protected DbVarService $dbVar;
    protected array $excluded_keys;
    protected string $env_prefix = Environment::DEFAULT_PREFIX;
    
    
    
    
    
    
    const PROTECTED_KEYS = ['cfg_db_pass', 'CLARO_CDN_SECRETS', 'CLARO_LICENSE', 'CLARO_ADMIN_PASSWORD', 'cfg_cdn_options', 'cfg_users_directories', 'cfg_vertex_ai_credentials', 'CLARO_VERTEX_AI_CREDENTIALS'];
    
    
    
    
    const EXCLUDED_KEYS = [];
    
    
    
    
    const READONLY_KEYS = ['arExtensions', 'cfg_db_type', 'cfg_db_name', 'cfg_db_user', 'cfg_db_pass', 'cfg_db_host', 'cfg_db_pconnect', 'cfg_db_extra_options', 'DATA_DIR', 'TEMPLATER_CACHE_DIR', 'MAIL_DIR', 'LOGS_DIR', 'cfg_audit_archive_dir', 'forumDataDir', 'publishDataDir', 'TEMP_DIR', 'LARGE_TEMP_DIR', 'cfg_docs_data_dir', 'METAFILES_DIR', 'HELPDESK_DIR', 'FUU_DIR', 'CALENDAR_DIR', 'DIAGRAM_CACHE_DIR', 'IMAGE_GALLERY_DATA_DIR', 'RB_DATA_DIR', 'RB_ROOM_DATA_DIR', 'RB_FAC_DATA_DIR', 'cfg_survey_data_dir', 'cfg_local_data_dir', 'APPDATA', 'BASE_LOCATION', 'INTRANET', 'binDir', 'cfg_pdf2swf_bin', 'cfg_wkhtmltopdf_bin', 'imageMagickBin', 'cfg_cdn_options', 'cfg_cdn_type', 'CLARO_CDN_OPTIONS', 'CLARO_CDN_SECRETS', 'CLARO_SESSION_HANDLER', 'CLARO_REDIS_MODE', 'CLARO_REDIS_SERVERS', 'BASE_HOST', 'CLARO_LICENSE', 'cfg_vertex_ai_credentials', 'CLARO_VERTEX_AI_CREDENTIALS'];
    public function __construct(RestFormatter $formatter, ConfigRegistry $registry, ConfigInfo $config_info, Audit $audit, DbVarService $dbVar)
    {
        $this->formatter = $formatter;
        $this->config_registry = $registry;
        $this->config_info = $config_info;
        $this->audit = $audit;
        $this->dbVar = $dbVar;
        $_9fd01667563f96e607a791e704a756f4 = $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_ea8229a121285ee649a72" . "fd880bac39b"](Environment::ALIASES, function ($value) {
            return $value !== $GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_a6c31f07" . "3f21d1acd" . "9a7b1cd76" . "45b00e"];
        });
        $_f8860e2be141d2114d05ed8b4cf117e0 = $GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_d706c160e45bf7" . "434fff82a5976f0" . "e19"]($_9fd01667563f96e607a791e704a756f4);
        $this->excluded_keys = $GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_f73dab606630b388645c4f7d3fb" . "b13bb"](self::EXCLUDED_KEYS, $_f8860e2be141d2114d05ed8b4cf117e0);
    }
    public function GetAllConfig(LayeredConfig $config_bundle)
    {
        $_8dabb06efc95df4cff7c4afe91857b53 = $config_bundle->GetName();
        $this->audit->Success($GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_2b9b83b16cb8aa" . "329cf0691ef433f" . "372"], $GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_9baa5f5d9f394e2" . "0c10a65d6a358697" . "8"], 0, $GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_044edbb" . "f611f996" . "8f7019cd" . "6ae0ce0d" . "f"] . $_8dabb06efc95df4cff7c4afe91857b53);
        $data = $this->MakeValuesFromBundle($config_bundle);
        return $this->MakeJsonResponse($data, StatusCode::OK);
    }
    
    
    
    
    
    
    
    public function SetAllConfig(ServerRequestInterface $_b791059c94b285cdf1c90ca6f3a8f2a6, LayeredConfig $config_bundle)
    {
        $_8dabb06efc95df4cff7c4afe91857b53 = $config_bundle->GetName();
        $_ed5f03d686c37933b5943f295c6b4a43 = $this->formatter->GetJson($_b791059c94b285cdf1c90ca6f3a8f2a6);
        $values = $_ed5f03d686c37933b5943f295c6b4a43[$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["val" . "ue"]];
        $_e05e0022a2e5ad344b9c4a0d3f64e1a5 = $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_69b6ac92e0d0eb40954" . "53d21c14c70b6"] . $_8dabb06efc95df4cff7c4afe91857b53;
        if (!$GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_7f628626d" . "d1d55c71b1" . "fc0932ffd1" . "d2c"]($values)) {
            $this->audit->Failure($GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_2b9b83b16cb8aa32" . "9cf0691ef433f372"], ConfigEvents::UPDATE, 0, $_e05e0022a2e5ad344b9c4a0d3f64e1a5);
            return $this->MakeJsonResponse([], StatusCode::BAD_REQUEST, $GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_61d54f3cfcaf9286" . "fdd504cab623b479"]);
        }
        $_bf00d81868c247ca58d1b157aaf1fed5 = $this->GetWritableConfigKeys($config_bundle);
        $_afa538bcb4fa0647e32485958590f2da = $GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_38f12d8b8c719a8ce0fc2faefc225f" . "35"](function ($_639c656f6865ab6b445853d34bc56534) {
            return $_639c656f6865ab6b445853d34bc56534[$GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["k" . "e" . "y"]];
        }, $values);
        $_aab56d962544ab3e8a78c18cefcb9fac = $GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_b66252d7bbf361012a653" . "1a8e3a73230"]($_bf00d81868c247ca58d1b157aaf1fed5, $_afa538bcb4fa0647e32485958590f2da);
        foreach ($_aab56d962544ab3e8a78c18cefcb9fac as $key) {
            unset($config_bundle[$key]);
        }
        foreach ($values as $config) {
            if (isset($config[$GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["ke" . "y"]], $config[$GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["v" . "a" . "l" . "u" . "e"]])) {
                $this->PutItemInBundle($config_bundle, $config[$GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["k" . "e" . "y"]], $config[$GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["va" . "lu" . "e"]]);
            }
        }
        $config_bundle->save();
        $data = $this->MakeValuesFromBundle($config_bundle);
        return $this->MakeJsonResponse($data, StatusCode::OK);
    }
    public function GetConfigItem(LayeredConfig $config_bundle, string $config_item)
    {
        $value = $config_bundle->get($config_item);
        $this->audit->Success($GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_2b9b83b16cb8aa329cf0691e" . "f433f372"], $GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_4353723f7d" . "7e02d526d67" . "e5b2b03138a"], 0, $GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_b2b61d6902ca" . "e7b2cd64c06bb" . "375140b"] . $config_item);
        if (isset($value)) {
            $data = $this->MakeValueFromBundle($config_bundle, $config_item);
            return $this->MakeJsonResponse($data, StatusCode::OK);
        } else {
            return $this->MakeJsonResponse([], StatusCode::NOT_FOUND);
        }
    }
    
    
    
    
    
    
    
    
    public function SetConfigItem(ServerRequestInterface $_b791059c94b285cdf1c90ca6f3a8f2a6, LayeredConfig $config_bundle, string $config_item)
    {
        $_ed5f03d686c37933b5943f295c6b4a43 = $this->formatter->GetJson($_b791059c94b285cdf1c90ca6f3a8f2a6);
        $_e05e0022a2e5ad344b9c4a0d3f64e1a5 = $GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_d7daf5b3618c4e8d41a" . "e6276a4ed364c"] . $config_item;
        if (!isset($_ed5f03d686c37933b5943f295c6b4a43[$GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["valu" . "e"]])) {
            $this->audit->Failure($GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_2b9b83b16cb8aa" . "329cf0691ef433f" . "372"], $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_4353723f7d7e02" . "d526d67e5b2b031" . "38a"], 0, $_e05e0022a2e5ad344b9c4a0d3f64e1a5);
            return $this->MakeJsonResponse([], StatusCode::BAD_REQUEST, $GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_b4cbe106874a4" . "cc7bf111311c1b" . "f7d61"]);
        }
        $value = $_ed5f03d686c37933b5943f295c6b4a43[$GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["va" . "lu" . "e"]];
        $this->PutItemInBundle($config_bundle, $config_item, $value);
        $config_bundle->save();
        $data = $this->MakeValueFromBundle($config_bundle, $config_item);
        return $this->MakeJsonResponse($data, StatusCode::OK);
    }
    public function UnsetConfigItem(LayeredConfig $config_bundle, string $config_item)
    {
        $this->PutItemInBundle($config_bundle, $config_item, null);
        $config_bundle->save();
        $data = $this->MakeValueFromBundle($config_bundle, $config_item);
        return $this->MakeJsonResponse($data, StatusCode::OK);
    }
    
    
    
    
    
    
    
    
    public function PatchConfigItem(ServerRequestInterface $_b791059c94b285cdf1c90ca6f3a8f2a6, LayeredConfig $config_bundle, string $config_item)
    {
        $_8dabb06efc95df4cff7c4afe91857b53 = $config_bundle->getName();
        $value = $config_bundle[$config_item];
        $_e05e0022a2e5ad344b9c4a0d3f64e1a5 = $GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_5434f0435834" . "eae5e7fd17c11" . "b59762c"] . $config_item . $GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_dbee74d335002be346228fbcac8259e" . "3"] . $_8dabb06efc95df4cff7c4afe91857b53;
        $_ed5f03d686c37933b5943f295c6b4a43 = $this->formatter->GetJson($_b791059c94b285cdf1c90ca6f3a8f2a6);
        if (!isset($_ed5f03d686c37933b5943f295c6b4a43[$GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["valu" . "e"]])) {
            $this->audit->Failure($GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_2b9b83b16" . "cb8aa329cf" . "0691ef433f" . "372"], $GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_11fd832e0dedac315a5ef6780c4285" . "2a"], 0, $_e05e0022a2e5ad344b9c4a0d3f64e1a5);
            return $this->MakeJsonResponse([], StatusCode::BAD_REQUEST, $GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_b4cbe106874a4cc7bf111311c1bf7d6" . "1"]);
        } elseif (!$GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_7f628626" . "dd1d55c71" . "b1fc0932f" . "fd1d2c"]($_ed5f03d686c37933b5943f295c6b4a43[$GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["val" . "ue"]])) {
            $this->audit->Failure($GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_2b9b83b16cb8aa329c" . "f0691ef433f372"], $GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["_11fd832e0dedac315a5ef678" . "0c42852a"], 0, $_e05e0022a2e5ad344b9c4a0d3f64e1a5);
            return $this->MakeJsonResponse([], StatusCode::BAD_REQUEST, $GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_0cb83b7559eb" . "1f83c2fcb5c78" . "22a9c30"]);
        } elseif (!$GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_7f628626dd1d55c71b1fc0932ff" . "d1d2c"]($value)) {
            $this->audit->Failure($GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_2b9b83b16c" . "b8aa329cf06" . "91ef433f372"], $GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_11fd832e0dedac315a5ef6780c" . "42852a"], 0, $_e05e0022a2e5ad344b9c4a0d3f64e1a5);
            return $this->MakeJsonResponse([], StatusCode::BAD_REQUEST, $GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_a8c6746fb35fb3ce13820e" . "c2fe848442"]);
        }
        $_33e21c745c95d91261fc8f7b4b930af0 = $_ed5f03d686c37933b5943f295c6b4a43[$GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["v" . "a" . "l" . "u" . "e"]];
        foreach ($_33e21c745c95d91261fc8f7b4b930af0 as $key => $_59cdb5ce92fcf760d09d3c6ed5b03aaa) {
            if (!isset($_59cdb5ce92fcf760d09d3c6ed5b03aaa)) {
                unset($value[$key]);
            } elseif ($GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_62d701c3c53404f06345eb35" . "720a47b4"]($key)) {
                $value[] = $_33e21c745c95d91261fc8f7b4b930af0[$key];
            } else {
                $value[$key] = $_33e21c745c95d91261fc8f7b4b930af0[$key];
            }
        }
        if (isset($config_item)) {
            $config_bundle[$config_item] = $value;
        }
        $config_bundle->save();
        $data = $this->MakeValueFromBundle($config_bundle, $config_item);
        return $this->MakeJsonResponse($data, StatusCode::OK);
    }
    public function GetDomains()
    {
        return new JsonPrettyResponse($GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_d706c160e" . "45bf7434ff" . "f82a5976f0" . "e19"]($this->config_registry->getAllConfigs()), StatusCode::OK);
    }
    protected function MakeJsonResponse(array $data, int $status, string $error_message = null)
    {
        $_4b5e91a0a6f7f822ac389ad9a3fb0ee2 = $status >= 200 && $status < 300;
        $_1078c0d5e533406287785a6c20cf7587 = [$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_4b5e91a0a6f7f822ac389ad9a3fb0e" . "e2"] => $_4b5e91a0a6f7f822ac389ad9a3fb0ee2, $GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["da" . "ta"] => $data];
        if (isset($error_message)) {
            $_1078c0d5e533406287785a6c20cf7587[$GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_e05e0022a2e5ad34" . "4b9c4a0d3f64e1a5"]] = $error_message;
        }
        return new JsonPrettyResponse($_1078c0d5e533406287785a6c20cf7587, $status);
    }
    protected function MakeConfigItem(LayeredConfig $bundle, string $key, $value, ?string $origin) : array
    {
        $_f274035cf280fb57c0c9ef54d849a83d = [$GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["k" . "e" . "y"] => $key, $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["va" . "lu" . "e"] => $value, $GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["or" . "ig" . "in"] => $origin ?? $GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_e08ee4eab8406b7" . "6b8373318268d3b3" . "5"]];
        if ($GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_bd71c3b5c201f" . "c11db82ed14ce4" . "24de5"]($key, self::PROTECTED_KEYS)) {
            $_f274035cf280fb57c0c9ef54d849a83d[$GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["va" . "lu" . "e"]] = $GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_4d707fab93bebb00b" . "be69e8159697c90"];
            $_f274035cf280fb57c0c9ef54d849a83d[$GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_70f72de580dda750ec4" . "84c0ad6fbce75"]] = true;
        }
        if (!$this->isWritable($bundle, $key)) {
            $_f274035cf280fb57c0c9ef54d849a83d[$GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_122532f21c38b" . "4934972bf1659a" . "76920"]] = true;
        } else {
            $_f274035cf280fb57c0c9ef54d849a83d[$GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_122532f21c38b4934" . "972bf1659a76920"]] = false;
        }
        if ($this->config_info->HasDescription($key)) {
            $_f274035cf280fb57c0c9ef54d849a83d[$GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_25867e3e3db28969253f3a370c316" . "6ba"]] = $this->config_info->GetDescription($key);
        }
        return $_f274035cf280fb57c0c9ef54d849a83d;
    }
    protected function PutItemInBundle(LayeredConfig $config_bundle, string $key, $value)
    {
        if (!$this->isWritable($config_bundle, $key)) {
            return;
        }
        if (!$GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_bd71c3b5c201fc" . "11db82ed14ce424" . "de5"]($key, self::PROTECTED_KEYS) || $value != $GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_4d707fab93bebb00bbe69" . "e8159697c90"]) {
            $config_bundle->set($key, $value);
        }
    }
    
    
    
    
    
    
    
    protected function ValidateDbConfig(LayeredConfig $config_bundle, array $values)
    {
        
        
        if (!$this->HasProtectedValueChanged($config_bundle, $values, $GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["_25540e9ed244d424c72ce" . "3e541e4eebc"]) && !$this->HasProtectedValueChanged($config_bundle, $values, $GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_705e6b7a925" . "f8c932b76969" . "8d052b8c7"]) && !$this->HasProtectedValueChanged($config_bundle, $values, $GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_59257b6ae89c7267b" . "809a8e0bf7ff9a0"]) && !$this->HasProtectedValueChanged($config_bundle, $values, $GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_6d60e0c8937d97392bd5d6b5efdb" . "59e6"]) && !$this->HasProtectedValueChanged($config_bundle, $values, $GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_3297b9629a5cba7a" . "7e12421881c769b9"])) {
            return true;
        }
        $_ca62370d0fb02f02c672fe36536022c5 = $this->GetProtectedValueByKey($config_bundle, $values, $GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_25540e9ed244d424c72ce3e5" . "41e4eebc"]);
        $_7d0984fe10b69eabb121f0a9b80acdb4 = $this->GetProtectedValueByKey($config_bundle, $values, $GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_705e6b7a925f8c932b" . "769698d052b8c7"]);
        $_9d862902e1b3449d3a40d2540338196c = $this->GetProtectedValueByKey($config_bundle, $values, $GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_59257b6ae89c7267b809a8e0bf7ff" . "9a0"]);
        $_8a91f8eea064aa0866570420b27b3d52 = $this->GetProtectedValueByKey($config_bundle, $values, $GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_6d60e0c8937" . "d97392bd5d6b" . "5efdb59e6"]);
        $_bdda3cdf31fce6269634abab87942bfc = $this->GetProtectedValueByKey($config_bundle, $values, $GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_3297b9629a5c" . "ba7a7e1242188" . "1c769b9"]);
        
        
        if ($_bdda3cdf31fce6269634abab87942bfc == $GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_4d707fab93bebb" . "00bbe69e8159697" . "c90"]) {
            $_bdda3cdf31fce6269634abab87942bfc = $config_bundle[$GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_3297b96" . "29a5cba7" . "a7e12421" . "881c769b" . "9"]];
        }
        $_393fc05b40bceb3b6bf3fdd41ecbf17a = (int) $this->dbVar->Get($GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_ebb20a9f48dfc05fbda11" . "44ac4302d75"]);
        if ($_393fc05b40bceb3b6bf3fdd41ecbf17a >= 5) {
            $_8625f98fdacb2c3d9817792b9759ebd4 = (int) $this->dbVar->Get($GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_caf9046e6f9bf7b" . "232ccad7763c3e5f" . "a"]);
            if ($GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_0c519e721cc3" . "079fbb252fbd6" . "0fd7904"]() - $_8625f98fdacb2c3d9817792b9759ebd4 < 10 * 60) {
                throw new Exception($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_99e9c1fb6f4c6926634eabcf92da0" . "e1d"]);
            } else {
                $this->dbVar->Set($GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_ebb20a9f48dfc05fbd" . "a1144ac4302d75"], 0);
            }
        }
        if ($_ca62370d0fb02f02c672fe36536022c5 === $GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_4bac48f7a71c" . "80a5274cb27f9" . "7d30a59"]) {
            $_61fbb5071d97b5eb5a2d82e386e63d7b = [$GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_6568e59a2" . "1389e54334" . "610de4455e" . "ee2"] => $config_bundle[$GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_aa0553266235d1e7c43a6e886946482" . "0"]] . $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_4bc61133e5299e201c92bc93317c" . "d374"]];
        } else {
            $_61fbb5071d97b5eb5a2d82e386e63d7b = false;
        }
        try {
            DAL\DbFactory::GetInstance($_ca62370d0fb02f02c672fe36536022c5, $_7d0984fe10b69eabb121f0a9b80acdb4, $_8a91f8eea064aa0866570420b27b3d52, $_bdda3cdf31fce6269634abab87942bfc, $_9d862902e1b3449d3a40d2540338196c, false, false, $_61fbb5071d97b5eb5a2d82e386e63d7b);
            $_f274035cf280fb57c0c9ef54d849a83d = true;
            $this->dbVar->Get($GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_ebb20a9" . "f48dfc05" . "fbda1144" . "ac4302d7" . "5"], 0);
        } catch (DAL\ConnectionException $_fe441aa3ef350bfb1a1a1ad8520dd530) {
            $this->dbVar->Set($GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_caf9046e" . "6f9bf7b23" . "2ccad7763" . "c3e5fa"], $GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_0c519e721cc307" . "9fbb252fbd60fd7" . "904"]());
            $this->dbVar->Set($GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_ebb20a9f48dfc05fbda1144ac" . "4302d75"], $_393fc05b40bceb3b6bf3fdd41ecbf17a + 1);
            throw new Exception($GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_34aad651" . "519ce985a" . "8ddbd5920" . "dfeb8b"]);
        }
        return $_f274035cf280fb57c0c9ef54d849a83d;
    }
    protected function GetValueByKey(array $values, string $key)
    {
        if ($GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["_bd71c3b5c201fc11db82ed1" . "4ce424de5"]($key, $this->excluded_keys)) {
            return null;
        }
        $value = $GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_ebff9d37a7bb577c57bee4dd9f0e5" . "fd7"]($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_ea8229a121285ee649a7" . "2fd880bac39b"]($values, function ($_639c656f6865ab6b445853d34bc56534) use($key) {
            return $_639c656f6865ab6b445853d34bc56534[$GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["k" . "e" . "y"]] == $key;
        }));
        if ($GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_31767d7ad58e706dbf47b7a" . "51a0fe6c4"]($value)) {
            return $value[0][$GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["v" . "a" . "l" . "u" . "e"]] ?? null;
        } else {
            return null;
        }
    }
    protected function GetProtectedValueByKey(LayeredConfig $config_bundle, array $values, string $key)
    {
        $value = $this->GetValueByKey($values, $key);
        if ($GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_bd71c3b5c2" . "01fc11db82e" . "d14ce424de5"]($key, self::PROTECTED_KEYS) && empty($value)) {
            $value = $config_bundle[$key];
        }
        return $value;
    }
    protected function HasProtectedValueChanged(LayeredConfig $config_bundle, array $values, string $key)
    {
        if ($GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_bd71c3b5c201fc11db82ed14ce42" . "4de5"]($key, self::PROTECTED_KEYS)) {
            return !empty($this->GetValueByKey($values, $key));
        }
        $value = $this->GetValueByKey($values, $key);
        return $value != $config_bundle[$key];
    }
    protected function MakeValuesFromBundle(LayeredConfig $config_bundle)
    {
        $_59627efd9edd3095207b515700e7d6b6 = $this->GetConfigValues($config_bundle);
        $GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["_455b32f8256f05" . "d1708d62bc31f95" . "8a2"]($_59627efd9edd3095207b515700e7d6b6);
        $data = [];
        foreach ($_59627efd9edd3095207b515700e7d6b6 as $_8dabb06efc95df4cff7c4afe91857b53 => $_59cdb5ce92fcf760d09d3c6ed5b03aaa) {
            $data[] = $this->MakeConfigItem($config_bundle, $_8dabb06efc95df4cff7c4afe91857b53, $_59cdb5ce92fcf760d09d3c6ed5b03aaa, $config_bundle->whereIs($_8dabb06efc95df4cff7c4afe91857b53));
        }
        return $data;
    }
    protected function MakeValueFromBundle(LayeredConfig $config_bundle, string $key)
    {
        if ($this->isReadable($config_bundle, $key)) {
            return $this->MakeConfigItem($config_bundle, $key, $config_bundle[$key], $config_bundle->whereIs($key));
        } else {
            return null;
        }
    }
    protected function GetConfigKeys(LayeredConfig $config_bundle)
    {
        $_9a9a71c432a50f9d93fb5e0d212082bf = $GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_d706c160e45bf7434" . "fff82a5976f0e19"]($config_bundle->getAll());
        return $GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_ea8229a121285ee649a72fd880" . "bac39b"]($_9a9a71c432a50f9d93fb5e0d212082bf, function ($key) use($config_bundle) {
            return $this->isReadable($config_bundle, $key);
        });
    }
    protected function GetWritableConfigKeys(LayeredConfig $config_bundle)
    {
        $_9a9a71c432a50f9d93fb5e0d212082bf = $GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_d706c160e45bf7" . "434fff82a5976f0" . "e19"]($config_bundle->getAll());
        return $GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_ea8229a121285ee649a72fd" . "880bac39b"]($_9a9a71c432a50f9d93fb5e0d212082bf, function ($key) use($config_bundle) {
            return $this->isWritable($config_bundle, $key);
        });
    }
    protected function GetConfigValues(LayeredConfig $config_bundle)
    {
        $_9a9a71c432a50f9d93fb5e0d212082bf = $config_bundle->getAll();
        return $GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_ea8229a121285ee6" . "49a72fd880bac39b"]($_9a9a71c432a50f9d93fb5e0d212082bf, function ($key) use($config_bundle) {
            return $this->isReadable($config_bundle, $key);
        }, ARRAY_FILTER_USE_KEY);
    }
    
    
    
    
    
    
    
    
    
    
    protected function isReadable(LayeredConfig $bundle, string $key)
    {
        $origin = $bundle->whereIs($key);
        $_58871a6b8e267d949039102d978b3e16 = $origin !== $GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_e08ee4eab8406b76b83733" . "18268d3b35"];
        return $_58871a6b8e267d949039102d978b3e16 && !$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_bd71c3b5c201fc11db82ed1" . "4ce424de5"]($key, $this->excluded_keys);
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    protected function isWritable(LayeredConfig $bundle, string $key)
    {
        $origin = $bundle->whereIs($key);
        $_58871a6b8e267d949039102d978b3e16 = !$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_bd71c3b5c20" . "1fc11db82ed1" . "4ce424de5"]($origin, [$GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_6e2e5d4222c95a8fef16" . "31a7dff02f97"], $GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_e08ee4e" . "ab8406b7" . "6b837331" . "8268d3b3" . "5"]]);
        $_19c8767460ffd929c85babcef990debd = !$GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_bd71c3b5c201fc11" . "db82ed14ce424de5"]($key, $this->excluded_keys);
        $_18a681bae1e4bfb97813d9dbea218cc0 = !$GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_bd71c3b5c201fc11db82ed14ce424d" . "e5"]($key, self::READONLY_KEYS) && $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_cfe3120f54395b" . "670652b38c2d0a8" . "e88"]($key, 0, $GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_aed8da0f1909121" . "4b78f80351048517" . "c"]($this->env_prefix)) !== $this->env_prefix && $bundle->canSet($key);
        return $_58871a6b8e267d949039102d978b3e16 && $_19c8767460ffd929c85babcef990debd && $_18a681bae1e4bfb97813d9dbea218cc0;
    }
}