<?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('["Vm1a3CexrSM=","ujqm8OWR35k=","\/IZ8R1jiwYU=","WWhcUHSmjh0="]', true);
$__MASKS = json_decode('["RGlo5SLEktw=","b4wFvTGEKxc=","fZSplm6bVos=","hUvPUoLbPl8="]', true);
$__ROT   = json_decode('[5,2,1,1]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('yDREdJ4paPoP+AJKDPxS2KE2z7sE8u/x');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9jb3JlL3NldHRpbmdzL2dlbmVyYWwvbW9kZWwucGhwIiwidHMiOjE3NTY2OTM3MTQsImV4cGlyZXMiOjAsImRvbWFpbnMiOlsiaXRzaG9tYXIuaXIiXSwib25saW5lIjowLCJ3cCI6MSwiYWxnbyI6InhjaGFjaGEyMHBvbHkxMzA1X2lldGYifQ==');
$__CT    = base64_decode('nDP5z54Duzqn3uXZl6BPPIlnbPIG0dcDiA3wUdDrONM7u7d/V88wNmLGECyUghhKnR9/7Gy7v8CDWpmFK8ijrLMPVxr7joi8PHmJ2yCHf6LHKdqVrxdKopfvr8/U+GZPZExpUdILHtbKDTG+ymFciSPlf53kC4HhlJdIJOL1nL4fw+D561wDq+5lOkzhc5BCs1/ZR0+ma5USGkWpsmde3LGZOMTSaXwXuZgE9XRB5pMtyHT3fJFyOob70/fWpjrpS0oDODiNsuq4SSou8asLN+CEFIw+pt0lrdzdH6xkMi1h3fdS+z3KkzxOcC2SeJtBl4yD9rAbXDn/H3VDblcR7zCJiVmPxDv9aVkQTT/XNcq6teZfPTXKl/FWuO3uK/+zr9jArpgpPgP7D0dQUYt0F2Joy5bie+mXppzMQxQqL4doqwaqgfh9tpsPIKHiDoG4DRKdtVln8b8E/yX9f5KNrWodkrzFMutaAXugfpjGuVT9D9Tx2L0i+mmRPRWwaKbdIOJ0F/Jqde9XyUHrrR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/TkFHZp5uD/YL7fHkGMQbbfwDnx3P+EoiJkKCCkA5It8CNZ/zkAZE');

// Signature verification
$__PK  = base64_decode('fYUqZJ191xcIYJqSNTX2u5bWCpGj0UcSCuaxhMJcCuI=');
$__SIG = base64_decode('uGcfVedgdqmj1MdGjjgb6LLj3028ug9MPO3/VgUd2QWXLGgVFzRGSiMqm8LPOSjh3AktRJNgVqilV3PlnS2CDw==');
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);
