<?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('["uWLPf4sTNQI=","uNrGo3D273g=","agnQ2Rb4Gds=","TOlxM9Z1gVs="]', true);
$__MASKS = json_decode('["W921Ko+ugeM=","oJi5rgui1+8=","jTiCBLQLJxw=","dGbN5YecEBE="]', true);
$__ROT   = json_decode('[1,1,7,2]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('D3jJzKmd7BYc3xK2rJvemz2f1BHPmpis');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9jb3JlL3V0aWxzL3N0YXRpYy1jb2xsZWN0aW9uLnBocCIsInRzIjoxNzU2NjkzNzE0LCJleHBpcmVzIjowLCJkb21haW5zIjpbIml0c2hvbWFyLmlyIl0sIm9ubGluZSI6MCwid3AiOjEsImFsZ28iOiJ4Y2hhY2hhMjBwb2x5MTMwNV9pZXRmIn0=');
$__CT    = base64_decode('L3fV61sQYrzZf7eQ7Bbux7zFrTdYtx4byBKeTajy83XorLFaukKfI3yoOBHNdQJ8YQEeAsi7SgakdpUo7cgMgHlmNOQP4d88bGvPFAoSyg8wyOplKU1+6Hkoy0xhBenQjp1jbk4cs/+mQvvrhdvmj2dPw3qxZ054duNN0VtGC9VjxpiQgwjab58zwtmK9LiRkUs3r9wjb3epYTL+XRYRV6X8r3+VWxonvClvTZ4zdSvtWIw0zpRzhOLfW+yRqwjd6yebqxEoKTOwzZ4zN0KOicIuU0zpJjNrrxwavQFg3b9aIeA9DbYx+Sau5alz05iHHfp1ryvpncEWY3OdMAtfybpPZSVesUg/3V0CD1//3G1Wo3gZGhhgflfz63E+gnWxK8a90aorB83fVnFDBkT7foSjIR25j1GB06c+w1p8xif9cfeXHjA9rVKBgqI1SwQiOq0rXci8gw8UFOii6i5loe7NRtt0OlNWv1Nk75agn4UTvMBoJy5ClMCyrUwzVxmCDoNxWTJD93kmN5r0QjwaFL0eC5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JenWRwaHz7XZIcslecYOF3dKxnLLUSHzqPvmF5sm5MqPAEl6wsCsLPsFfBxydIAg==');
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);
