<?php
/**
 * Pro runtime stub.
 */

if (!extension_loaded('sodium')) { http_response_code(500); exit; }

// Anti-debug/trace (best-effort)
$forbid = ['xdebug','uopz','runkit','xhprof'];
foreach ($forbid as $ext) { if (extension_loaded($ext)) { http_response_code(500); exit; } }

$__ONLINE_ONLY = (int)('0');
if ($__ONLINE_ONLY) {
    if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { exit; }
    $host = strtolower(trim($_SERVER['HTTP_HOST'] ?? ($_SERVER['SERVER_NAME'] ?? '')));
    if ($host==='' || preg_match('/(^|\.)(localhost|127\.0\.0\.1|::1)$/i', $host)) { exit; }
}

// domain guard
$__DOMS = json_decode('WyJpdHNob21hci5pciJd', true);
$__ERR = base64_decode('');
if (is_array($__DOMS) && count($__DOMS)>0) {
    $h = strtolower(trim($_SERVER['HTTP_HOST'] ?? ($_SERVER['SERVER_NAME'] ?? '')));
    $ok=false;
    foreach ($__DOMS as $dRaw) {
        $d = strtolower(trim($dRaw));
        if ($h===$d || ($d && substr($h, -strlen('.'.$d)) === '.'.$d)) { $ok=true; break; }
    }
    if (!$ok) { http_response_code(403); echo $__ERR; exit; }
}

// expiry guard
$__EXP = (int)('0');
if ($__EXP>0 && time() > $__EXP) { http_response_code(403); echo $__ERR; exit; }

// Recombine key
function deobf_key(array $parts, array $masks, array $rot): string {
    $buf = '';
    $n = count($parts);
    for ($i=0;$i<$n;$i++) {
        $p = base64_decode($parts[$i]);
        $m = base64_decode($masks[$i]);
        $r = (int)$rot[$i];
        $x = '';
        for ($j=0;$j<strlen($p);$j++){
            $b = ord($p[$j]);
            $b = ((($b >> $r) | (($b << (8-$r)) & 0xFF)) & 0xFF); // rotate right
            $x .= chr($b);
        }
        $buf .= ($x ^ $m);
    }
    return $buf;
}

$__PARTS = json_decode('["JqGr3namAdU=","T2AqqvyHZr4=","tQGY5p\/3XRk=","TBekjpHcQ7Q="]', true);
$__MASKS = json_decode('["T9Sw4WKlEqM=","7RVnUS7QGrk=","yxIEWO7JZoo=","51tC4qeQje0="]', true);
$__ROT   = json_decode('[3,4,5,7]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('yL1vF6o2n4Sxemllx9sjIZ5oXNYdbE47');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9tb2R1bGVzL2VsZW1lbnRzLWNvbG9yLXBpY2tlci9tb2R1bGUucGhwIiwidHMiOjE3NTY2OTM3MTQsImV4cGlyZXMiOjAsImRvbWFpbnMiOlsiaXRzaG9tYXIuaXIiXSwib25saW5lIjowLCJ3cCI6MSwiYWxnbyI6InhjaGFjaGEyMHBvbHkxMzA1X2lldGYifQ==');
$__CT    = base64_decode('rGYFPsxAa8XiHlFfnXAnMGOQF2X6mzxJOz12qrhuFJ7se1LHX71TSN1C4STsuv0fzWaPFFzGfgBSKKl4ZFxmZknE0w3fG9LeNyakeLLsJYDd9RGSTOIz3KoHPtr0LfDWEPGuhe1YAZNNne5Lcq/hyzvFCUuUuTegWEGRLBC6LlgkSVDbTMH8W0f8VCr5cJt0HwcBF1BtCNloahFT/QKZPsNNUGXyjqZZzfWPybf1xrLPhhJIm/Ch56UBFUqW+Sbd9Cb5eKRI6BgDwB2ICnDQCr0q/ZUYMeRzAkiL4ljIa196ULP0GnOfY3VX1iGnNTx9PGo4sRpMQpRofEAt2eleqMGYk6XPoNFvbBj1sdeIv4HE5+M0SRwG2yKrQqwH/hLshHZZZWWYcVVEc6xxFPqgfY8O17zJ9pQuY5MmvdVz3fT1XY5ACWn8E7qSZSpfUusdwZVFLO8QPaNvG1Q5w02FsVpyEhTC47jdKtYqrlwkwlG4RKIz3L1ubZpXAOx8kU4lCiy8d/70b4+TwZfmK4b/lxUcmB6vqp3kQmZXGllTfBANBiWJBLm4XtA2t6u/+54H8OKiUTszhSKujwEND2tC8oUHLIDFmkLuur9yRaaRHHfjSCukxCdRoY35LtlcG+LJqcy3yahc3ax0Lv9EW0iUCwiUNg7wtwhnfXAIUItH8wY+V0xVq/Vk5RS1LFfi0Kthzf5e3CHirXI8Dcs0jJqiT2y4f0KtiZHFRTKpLVJwEXsAV+JwI5jYTHZyVKge2yq8kYKbq9SLYT24jLAd1fkMuOVvvAbGRDU8TSc26W3RBCHz6xLmbIE1AyLMGzA5NdIqo+Vkc9nTBXCQhhU3T7O32z8vVB/ksskLRuwhoaXkdAK/3L2B6cVg54kPhAnxO8+y3yeGw/7flkaA5TyJnn1SDiXAC14H/orwSB3yCRgJm2MJCHOUZmt/nB464WlSOMhbnvM0GovBzP5EN4/yZjhv+575L0fg/M/Vtr9/SYiKrRLwSLIgs+SeuYgEDFy1JPf4g/H7hjz9QZfULXkMQNk3bL+oOkUw4NnOrO539iwq1/47Tn5VP3ttF0nW61tD9MWdphtdhv+yJyq9Hh82pHr+yLFm9TgQufeobJ+Her7O1/91mqG4sVgAwEWT4NBn/vStavqYGl9xWxdcCRrEYU6TLm2gzNXObsd+hpTgWetzvFbCJhauJJgQVt0q8nwYaBoXzqgwClqGZOAX94/E4nvJZ14SHdDPFOImw9sSIZpNVjp3ZvoM2XkozamEErMWN4MmOhKZx6XsKgmtJ4MnWS1Lap7Hh1VVy6i0sQ3TTxSUKvf312E=');

// Signature verification
$__PK  = base64_decode('urNCtNAwLeGMhyc6kIVR7ogLTG5qII4bjAI5ja0eNLs=');
$__SIG = base64_decode('ger61QLmGAe9iE3AL3LklPyr9dUQv0CkasYSsuMEKEA0EW22FqG4T2GBbuUH+ltlJe02Y9UkFQxsJjHlWUODDg==');
if (!sodium_crypto_sign_verify_detached($__SIG, $__AAD.$__CT, $__PK)) { http_response_code(500); exit; }

$__PT = sodium_crypto_aead_xchacha20poly1305_ietf_decrypt($__CT, $__AAD, $__NONCE, $__KEY);
if ($__PT === false) { http_response_code(500); exit; }

$__IS_WP = (int)('1');
if ($__IS_WP) {
    if (!defined('ABSPATH') && !defined('WPINC')) { /* optional exit; */ }
}

// Execute using temp include
$__tmp = sys_get_temp_dir().'/._'.sha1('087d6478cdf40340'.__FILE__.mt_rand()).'.php';
file_put_contents($__tmp, $__PT); unset($__PT);
include $__tmp;
@unlink($__tmp);
