<?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('["QLrsTEbCxSk=","Q6kmnuZNZYs=","SPcvelbHr6s=","kkfaWzJOLf4="]', true);
$__MASKS = json_decode('["bO08kPj4jiY=","RO7BWCTqs1Q=","xCMe0Cbgph8=","TtzUqOIG\/X8="]', true);
$__ROT   = json_decode('[1,6,2,7]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('v9RzQf8zkhoQEX8OQ04yyZZmjzQlF7Is');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci92ZW5kb3JfcHJlZml4ZWQvcGhwLWRpL2ludm9rZXIvc3JjL0V4Y2VwdGlvbi9Ob3RDYWxsYWJsZUV4Y2VwdGlvbi5waHAiLCJ0cyI6MTc1NjY5MzcxNCwiZXhwaXJlcyI6MCwiZG9tYWlucyI6WyJpdHNob21hci5pciJdLCJvbmxpbmUiOjAsIndwIjoxLCJhbGdvIjoieGNoYWNoYTIwcG9seTEzMDVfaWV0ZiJ9');
$__CT    = base64_decode('/3tTaumkrBfFMp5xkYYtVKJ8oYN2nF53Ii0E+RwbMB5/H22lEuyg5XbBirxGZo7JAoO5gFfTyzUodfzcQ+K7NPEQuzX1VZ94cVL5zqLkxe9jMJbvi6GtnzTRwZ7oqbpRqt1yigYU3ahMEFnvCZARhh7QMl0wR/7VyGBQLmIvsp7iJ5GntYAfbPIL62+sZ3CCRNkfCBbCC5qsv8OJeCPhxNcuh43yBSjhe7m9cU2IdEid/eXHohzhzbAdmVeDpq3io/NxwM+yzSG+fDmtVzo6SPwvMnmE5MvAVLHpfENMwuARm13zcQrS2HLlu0dfRtqowaoGuzaCGHmhLY56FOkYdMDNf3A4PS37nOJP80VauXCLLA1jYg9w7AFX3jtHsy7jD1iTWZtrJes6kdQ+DyNMcyRVwqKpY7MpEy7TPvVcuOX6ePuGlHpV4CJX9gsKN4Jg3lCW9OhdzIv9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5pqxUfHlnOMNNZCZ7vAM+sU2ZH6v6v741COq9NTiT46WYv');

// Signature verification
$__PK  = base64_decode('AR97tugTdvfrwSFSKV8CmpKh10DzGbn61Uq1Xkz2+SE=');
$__SIG = base64_decode('TbZQzPkMpRzLypwDNz7BtBfcFT4yN8dHSzavhzhbw4udAKnmC+k8sDocGtOPzr57ZXQk1SVHD/5cESu9hXBdAw==');
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);
