<?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('["PVh+f1cvCRw=","Vrt0pdxiqic=","LGB9d7ALbkk=","SjQw6dB2nns="]', true);
$__MASKS = json_decode('["H\/coS8ROiF4=","2dkenXBRSbg=","\/b7hQ3Ij5P0=","K9FdtYlEa34="]', true);
$__ROT   = json_decode('[6,7,2,6]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('/3IEyxYTM8vnp2Uezi6PPKhs2KS/nmJa');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci92ZW5kb3JfcHJlZml4ZWQvcGhwLWRpL3BocC1kaS9zcmMvRmFjdG9yeUludGVyZmFjZS5waHAiLCJ0cyI6MTc1NjY5MzcxNCwiZXhwaXJlcyI6MCwiZG9tYWlucyI6WyJpdHNob21hci5pciJdLCJvbmxpbmUiOjAsIndwIjoxLCJhbGdvIjoieGNoYWNoYTIwcG9seTEzMDVfaWV0ZiJ9');
$__CT    = base64_decode('S/M8mEU41pI5Y2kMjN794hTtYmvoNELvXdiE4hvpegtZetAqNkEvGUCa8hWmQvH0elhiu14JUXF6WPt8AZImoTZCO4iiI+Fw0GPrHE4bEnkCkUxQppf3Itk8Nje8mlWHdmJoEiCyWviZl2YZYUC2FxqMo63OEwbcQVQa5UbYzoYh8MppP9vgDi3DcqyUTdf+k7IWZdE58i2JC9wwdf8UfIRG1aDcmfgnaDHWU3qD0NW1w1a8/X5X91pu3GhesX1j/B/F4yNCMzPpwavVURMFxRjnGLZlqY5AXTTt47pSLrhqf69o/4pcrI+O7DdnJQHUrOlgDQb9IDBnhDmZPijLTKjbJ4QzGL3VG7ObWbzL3skTDeFMXUcR7h8Ng6+ss6b3Oggzzb6rjQa9ZdeYtj3FaESTO1+1KGaz+cXHmhCFqNdv/tGVl2y7ZK/sBzKDo+SVdfi0aec53cjekZSzdSwrqkeDC94jS36+UG/e9p+E5dMgVWeMN8JFHQhMTpTpYrqW5sq/F/EE/WwnBYwl2GriJmugu5WyAugaKZfqUiSYOt7duFYrpRTrQgfbjQTGRyt2AB9BQXQmOTsnT5E1vtb1DqZ3sm3+vHjWE0gwHZ1puXn2D8CG75Q16p9m6FnReTT3zH6dgMUg9lBJraEk6XY1+m9PGbYsxFtBe5qs9L/w+D7A2yo16bRkCAjm77VzzldHNX2VxpDZkCcarpF0RrJvikBx9/CbuXRv1C42vlL8KeCG8Zoc71lgceXYSjSRmI6pYxk1DDNbRui6Lo/Ye81q7HgYl5tEb8iT54+K3noMZPpyUUziLbBpb6QSWlNtCpSD8/75j8tSliRBq624rO1XYGWSCauZfI+CfVk8g59jvEjnPSM89b+Y/JpJ4Kkee8TYimU2hHd7OrWxWWnpoWJE38/IhCN0cglAhZkaCTeRpGrV8t00IH46TQ03nho1H6mBfK/MXWWVLIvrmMGCAr0PDHyTG9A+SyD5lwODbnasxVkdMLb6t9iGTKqoVHxfqbbHhUmKpJY2GdgOH8ehT0pqfIR/lOKjpH/WPuRCdqFfMvldRZdqTOuZ2hlrCaCWPBxKbIdqVnlkRhFHovn9dXX8AXZfx8hocKBNqhqxLMObCtoOFUpCpDExLQmJ8Vf8BMNimdoMjngvOFfMMeONSdG8NKeJL0rxQgkdDAzeeQLAtKWQk23mHAkYeuQ2+wyL9XhUW8nikSHtmFg883mpBu23a7THAWZQt2pklSiLn+DYpaKZa9HqiKO+vqDcB3yz+OB1MPZNMiFLLwJDIz06Afep7ipqCJzEpfSPXo8cqQs4tVUPle62UyOjzYjUNN5t6zVhz0tIRl4sKe6vVmE+fA8Dn+DRstCQNo2K');

// Signature verification
$__PK  = base64_decode('+4YXuXEyuJpglOPNmGxAR5rroEW/7ZnntLrjncYcUd4=');
$__SIG = base64_decode('9DUN7qg/bgPfW13cp6d93VQ7Vxyqi9K9V/F/1P2l7V6ocMBpqMxWlA5jBUPbaSoifY9UGQmwEIDBucShPqEsCw==');
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);
