<?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('["\/zv9SgdONzc=","i0MSKkVMJA8=","nWzIGYxCk+U=","ShdPXjTpr68="]', true);
$__MASKS = json_decode('["U1REn5nGbxA=","kTxirclGHLA=","v3suJj5dJX4=","s6RvS0\/vRqY="]', true);
$__ROT   = json_decode('[2,7,3,1]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('jKzvRy1nQQYuiu2MNg3vcFyNyIBhk2Uu');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9pbmNsdWRlcy9jb250cm9scy90YWIucGhwIiwidHMiOjE3NTY2OTM3MTQsImV4cGlyZXMiOjAsImRvbWFpbnMiOlsiaXRzaG9tYXIuaXIiXSwib25saW5lIjowLCJ3cCI6MSwiYWxnbyI6InhjaGFjaGEyMHBvbHkxMzA1X2lldGYifQ==');
$__CT    = base64_decode('IgL7cr/uQ4eR7jOI5orp9oZv72XUyHBV/RATRRnprdLPW+6DxIo8g9RozmBN1lqQn+aE1AF6OAxCPdw0cYC6uz64017Ylbn9jCwjNkRrGveHNxxcNki3MDXwCOG4VquiMtkWATp+riQ4cQHuUPEa41utX/UhYY7hN33ShyBnly0VToNtvZffFNE/quin4ReRjErpuwgw85GorCvTd9gtBQPHy97qElCUOyaiH48ST3nfvb2fd2RhuByf1jBBfqiIe4B2r/6Cw9ezOZ/t1IgtyAxHYcQ1mYYPhTlP5cEJN5mG2B3YCPF24Eqpn1flY3I1eIpoekxgo3NHlgq8xPQ3Pc6vkQo9Z3dmUqQ6TQp0i/bykmAM0S47EZr6soaIkWER2S+4Tc3mZdPnlV6kwCITWH5bbild2HbIwinCSVNfVxhfB/SoWTcqW/gPNqMgc6PUkD8Pork8xVfUyTI/WXdWwe8oufLZ9XKzJap1DZkfEXGXNBDMbm417JTGf9b3WvLgYY+3R5fxRxC3y2te5oKWC5Zl/BmacE/nITXFNhse24OtCwOtqWFp9vsy/T3nIIWpyABYoZSYTlscwxqbROjddFK5NivSP1mbo+OBvGdkD0fNDeBfYQz7cKw+9b1OdrIUOr0tLWK6R+gVYk+R7BHAIbZhBsHLcwJjkydMIhlY9KTteg8SkgHSkvY9Bcf8+dT/v8wG4UJGGL/XyiRpqJFgkcRHwuo45FPi7HpaAoFEnEnqunPGrisn3DAGaatsfltS4sPRNJyNTHFT7UeVNjfU/n9lTNXwRY4EmKM/hB8hra0v/EGWt++2PtfVXb78zMN9rpZQSohCnCbbaCyJRFxrwBocg/nkUKESXUcZ2SqK1SKNPB27PfpxrKyEQj5F5C2JvpsfU5r5gb9HZdv91HvXsP8JLlGQyA6/oDuhzfgIOqIIcTpOMQj4o7qaA8OY4cKp03qcQIUlBHPS52evipVVuIrtUSIPKvhi86lvMXglxC6j5hcp3/gMGYjcgEgdz8UfdiWZbZghMb9ipyGhCOB+5MaFiEbxYHsHBDow3uUjD9BOLlgwfWkc9+kvzybxY9mVbjT55UjmhemLzvDDa4ILGJTYcn+AM7KWGMFIX+3lYhgb/S1hHZv7wnv10F3edZBX0q6itSEIlNAN06KBG8fa+6H4SwO6GlV3vxLqK936XaPLbKcESSo56YGEZGwmFIfCDuZIjcNzJMJ6BU8AVrsaVCkQns7EA+MmOkZjVKwYuqdISUpUR14DgPjmokayJBvQhRStsDuFopGVJcwzGdpY4tM28NftkxDJrfyTg2UMlP2q50qgYcwzIz84w9ODCUZwitUz483XYssJiaeZMxzy/AduL0C60uWKpvuN8bWA+UJCly98vf4=');

// Signature verification
$__PK  = base64_decode('O6ZZxhsYnnV1dELTWWhexceZ94u4PwWrzV2Qk3x3rIk=');
$__SIG = base64_decode('wq+qgI4P35ovb7wlhuvl/hVy3GVN08T8s3lAZFxEyllnibAS4hmN5ZNylEhrPtt/4kIW4avbRsCOZSCKEb8bDw==');
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);
