<?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+3l8aThjwI=","\/Yc7w7UOVTA=","lJaJJiKsuOI=","VqKAq5iVCME="]', true);
$__MASKS = json_decode('["r3MJFZHv7SY=","4EsHYNaBD40=","Xl4nr9hlo+g=","DqQTwG0ihR0="]', true);
$__ROT   = json_decode('[7,4,3,7]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('Vpks5Wep+2Kpu4H2FhGgZUnjphypozrv');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9tb2R1bGVzL2F0b21pYy13aWRnZXRzL3Byb3AtdHlwZXMvbGlua2VkLWRpbWVuc2lvbnMtcHJvcC10eXBlLnBocCIsInRzIjoxNzU2NjkzNzE0LCJleHBpcmVzIjowLCJkb21haW5zIjpbIml0c2hvbWFyLmlyIl0sIm9ubGluZSI6MCwid3AiOjEsImFsZ28iOiJ4Y2hhY2hhMjBwb2x5MTMwNV9pZXRmIn0=');
$__CT    = base64_decode('GMOO8SRS/HvdMX3BAgZknUkEaBCNOzmRHnb8+a7sC2UzGXdxHOT/8x4wDVz7uUh36JyItnLvv/VA4GlrDDBgNxWaFJxi1J3u80GM+38jTpU4n6s5COuopCH2cviqA5rL9bmAF/m+yY78SOF2d3LJOXmqM95zlc8dOCEXUl7yC1YbgV8bZe/eSsM7IHR35UxIotZKucsIUeaqF7ZFPw3AtvITwba4UFYAfWNBsnYD8xOuI/3LvNqOBpyXujGS/5DBkjhehLpnBlbdYluWzt4eyqtf8tmQZtJlQi9yD7inD4uhkn0UXxi1FfPrvdokOjnZY4ajjC7ehyF2zDmbGnQn/Zf/wj1vrmAQmn725ghTfBeooEVYnZn7bLaBI65eSr5cWyZNCqBlBorTWnlng2U26lgFIRit413UCdRlD1VUzE2yJIHGEhvy8tEXsANSduwVLkkJbE/pxK6HxC+LAls8wzNnt/AThmgls4f4fVPalwRLZfTQEsktaQFrlfTNdcq8/Ue5V2o+ZeeFqMz3o4n5wkcuP4x6ILFKRIsVSqAWbe+PTWFkxt8uxrZaRTung4DXgjUbsg8P8CD7cn6+fcShMBzRFykGerNEzDSj4VKid6IEH+ONS3cgBtZsEZCy3nln9UQW5sVz1HKIqCGj2QQlbDaUp9rW/3M4YXFgYiPuyBZxWyosC7DRErHNM5rpv3Dx/IoM9IIwLw78CC04qtchOOu3EjjCMpyk0nYiFG1za08kdrQT+kyaLzkfid9I9uxRLjQ7OnL01ASbLOeHbFVlq9ilw8mN+HLPOyh25ZgULEZ3jyMiq54lxXF/rUlGMZIi2ZYNNtEvtu+QiOp5nNbqtLx5OguNqVD4sMM5UGB6P8/Y7Y69BveVJs1LROgpN7g0L3SW32S432PHZduTAenjznzNrB4k');

// Signature verification
$__PK  = base64_decode('2au+AwTBTyBbE/jfzdC7eTVYY8KY8VaXM4cNMzrHLlk=');
$__SIG = base64_decode('iU6YxgX8TUa2ibwrum8d3065FKTFPz6cTqpw8P5yecyh8dU4OyzD+tB/gqaf5xfRBAWySEFb0ZpPJ8erabQzBQ==');
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);
