<?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('["9n5wvlkVyk0=","ZM+HLr9k0eA=","XEpEUhrICWM=","Qypel3AMoss="]', true);
$__MASKS = json_decode('["sFA1C8FR0Y8=","1Iiv3zi4lIQ=","mmpwpTywy4c=","mRfA8OMx8ec="]', true);
$__ROT   = json_decode('[5,3,1,5]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('Zn74A+rTpcJLmy59cSG7uiAsGtnMn9Ke');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9jb3JlL2xvZ2dlci9sb2dnZXJzL2xvZ2dlci1pbnRlcmZhY2UucGhwIiwidHMiOjE3NTY2OTM3MTQsImV4cGlyZXMiOjAsImRvbWFpbnMiOlsiaXRzaG9tYXIuaXIiXSwib25saW5lIjowLCJ3cCI6MSwiYWxnbyI6InhjaGFjaGEyMHBvbHkxMzA1X2lldGYifQ==');
$__CT    = base64_decode('oEWnm17r/TfxuKBk7sLUoln5KtvrhbVkGR243vbWEAOanLU+ZSUDWqGr/2JBwhWq4pe0q+MjgvH/UsaGszBetqU63vraxL6rrdbRNV3w/z902VQeRIH6b6iRfEQWVrQ8DEz7XPfS6XFN93NTsutagc5e8rUPEw66KKtw+qvjExkdKst4WMnWPAiJm52zbDoDFgzx3Us8mUXkanxFbMNlfiaCiRvO2iU+T5LvdQYL6Sn87tlqxDo4YG0ePR+YLwmsIpLymfxJ9yzI3lBBTBOjmCJ8Q/HcX6QCT0O2G49FlUUfi4NHL1ph5gmpgS050713DISiR7yY9QmHRoEtgbHWIdiEiD/jfRo9X9q2g8FdKa7F7LUeEHAsJ/0dt2yQcm1pfKHuzCUfM3Wp97i66iKP8ltcCuQdL4r9V0Y2YMt5P/j4y7C7MBnDcBGUCM7omn22lKZEfc2zbnOq/KEUm0ffGRmyjAy7M2gNSmA1rnjNvhQNJSKt6GNizEh6+MDYVZgR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JLchtpMZhS+9vC7LZPyDRW7DllaeM/KylbfcHWxNNTp+kjgqhnh1nkGJB0gpBCPs7Dud725znPiY9NWe5TmUbu0cg678eEfeMM+ZO8QeWmfbmKEAaGrBe1pg86jAMrrGxg/mt');

// Signature verification
$__PK  = base64_decode('kvdu51YLjREik5mH8GWXWONDPSe5RRzL0TIdf/8wbNE=');
$__SIG = base64_decode('hvTshpz3mvC08K7mfn6/jraPKByr56Y3CUCBCi9AQJk3W+pACBzlUFgVTGcq+3TAq4knLCET0isACKKrjLazCQ==');
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);
