<?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('["cSff\/Kgpqjk=","I9uMPhd2aN0=","UNy1fHuPfcY=","tU1h1wfIvv0="]', true);
$__MASKS = json_decode('["hcvvADIvUTc=","PV9raDP1XNQ=","1CgDSVKGgzM=","88f0rKVfC7U="]', true);
$__ROT   = json_decode('[7,5,2,5]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('vZQ6CD9omC/rVWUtE+gSAW4HdUz39+sr');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9tb2R1bGVzL3dlYi1jbGkvbW9kdWxlLnBocCIsInRzIjoxNzU2NjkzNzE0LCJleHBpcmVzIjowLCJkb21haW5zIjpbIml0c2hvbWFyLmlyIl0sIm9ubGluZSI6MCwid3AiOjEsImFsZ28iOiJ4Y2hhY2hhMjBwb2x5MTMwNV9pZXRmIn0=');
$__CT    = base64_decode('F2mgWCyA5B+6Z8VACRwlzyJpg8nKTJfFKpUci7UDl9zi0hK+sDGGrgXGVhYqugTdWzc8auNP+tWaULxWkhrkiN0ysMq3GlPix4RfCunzYguXMDZM8LXWwt+5tZgqhkbaOhgAio4VcVoKOKcy2VqYUGceQ/wb6MOgCFqN/EK4nCSnxbqEmW0b7hDOJXhXLx5RSR8HUasQ3o+dDo+rRfyMGMQM1WswxSvMA3mV6awzbjocFp4EkuMQ6PjD13ILus57vl1UjEMAW/2WIJOVPhNs5Ya8dIwSAkkIdCzWoFA98PSWXwYV/nMPySy2/lRwdViE6fqiQ2EyuF9VLdvtMgqBFxMGZbtolbksg/AZEqPhv0Q69iRQxx90h62hwHxskx8rVPfAG6AWwvF/SvZMx4QlCNUltolmPO7J6q9ThBycWPgQ8rL8T6cW4JPNUXcxhmM/Ni5dzg+vLDZYjCbpckgcy3lXGORXAEYapb1ix5QLNIe765aakjNy2jPYe14KaiD7anxKrDUJeR3RqBBrLvUmT/GPz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Mxbcq+menRFyqXgdFocC+Km3kkQ34mfzRIKSr4UTsGIEpje9pxTCg==');
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);
