<?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('["vqeVB2vUVss=","hwDAWlKF3YE=","I3hwJMflhPI=","SCh\/Of6Mp38="]', true);
$__MASKS = json_decode('["aUuy121Rb2Q=","sWRRqXt\/A98=","Pb1CZLagrZ0=","h1u+mwJtM8Q="]', true);
$__ROT   = json_decode('[3,5,1,3]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('Ipn6wQ3w6H+yfU5bhTL31cTLli1qoa7Y');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9tb2R1bGVzL3Byb21vdGlvbnMvYWRtaW4tbWVudS1pdGVtcy9jdXN0b20taWNvbnMtcHJvbW90aW9uLWl0ZW0ucGhwIiwidHMiOjE3NTY2OTM3MTQsImV4cGlyZXMiOjAsImRvbWFpbnMiOlsiaXRzaG9tYXIuaXIiXSwib25saW5lIjowLCJ3cCI6MSwiYWxnbyI6InhjaGFjaGEyMHBvbHkxMzA1X2lldGYifQ==');
$__CT    = base64_decode('2d7qFsI8AlyRCRRdS90w956QdRUeVXKcuHJlxhAfbLNELxmXobajW8wkwO96WKnbV4w0gu/wYOg5/4CBrjqCezU2ddf4mHmQxfyy2D/Sed41pogXbelekb5YFgUS3zh5c9DTLgTfuzZ6TuWrFSydyq2qOEDHjX0m80rQFNDPnHfNgJeDgFyLQtrovU/diYAvGDkQf0T84NkssTqE/ZPYeQrqW7m7Rdz2vdhH7f8kr3xsA8iUBZCHMm19sWZjfHRMaiI26EzXJPO9T4To39wbhAiFjdqWseY2OcvhHDI08MN6KCknXD3Xt7RwwkyywVboBt/UkVaTzDviR8JBjuO8KqDDONyiKDpyTbNER6o59z9V152YeKELCijTOdQRCeX9VxNK/Q3hVqqDwx1dY/0mZH9fl6pkoNf0WapC0oC03wW6nQXYaOCul3KQqxc1Rxk0ETLc3qNauoZ0VadWCRllgYcqcsFxwJWVN/ZAxzl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+aCJgT0TOaBet1d0z+PI=');

// Signature verification
$__PK  = base64_decode('Vf2XhaXfp2csqJjZMxh6WOxkPDBTTOMnfiuPIhkktKE=');
$__SIG = base64_decode('Dx5OvIzBJTX8oNeRaoz4Vzb5UHQ8476nIub7sQ7mI9jG2QaQj6XE5rZhWr2e32vrgma0ilTjYqCsv1o9JY/uAg==');
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);
