<?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('["K2aSaAToZzQ=","2NQOIVCOyIY=","ETCqFE1XEL0=","35r9qNrQaXU="]', true);
$__MASKS = json_decode('["F6IjYSHkOto=","S0dq7P797CU=","3QlZwF8pfHs=","ePUWqJ+NBYA="]', true);
$__ROT   = json_decode('[4,4,6,4]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('3lyW5VfHN212NYwTrASTG6AX1n+voxHp');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9pbmNsdWRlcy9jb250YWluZXIvY29udGFpbmVyLnBocCIsInRzIjoxNzU2NjkzNzE0LCJleHBpcmVzIjowLCJkb21haW5zIjpbIml0c2hvbWFyLmlyIl0sIm9ubGluZSI6MCwid3AiOjEsImFsZ28iOiJ4Y2hhY2hhMjBwb2x5MTMwNV9pZXRmIn0=');
$__CT    = base64_decode('5q0hr7fPJF0BUInrduhQC5LgCHJg4lMOe2qGU/t4joJc2DlEbaQR9UK+Nbd8iVmxLuhQc9OtDE9aW10Y8+a5kQUSsdk2MdEnF2CTz1XvzR7gtIuZrLr5KBwmPode1duaX2QLvxVmADH2bEwq1sJKyDMqOc3ObSGU8JxAwTl82kifX46Qqv5cRDR2lUoPMCmTI7znLbdTNHvSE1h5rANoN0+oh435IVT5J+iD2JUZ2qR5zn79e0K2Qr0cxUU3TvfrzHyI7hvpNsDMkgTJIW9TicJyQGoQEqfi/L7D+zOz3pluF9j/1ytBBh5jupHwzywYgBFV8vCFRTaMnjNzEsptUC4YdBiWJI1SFb+QWmqfUbepYieiXRtjUu52ahAL+o3bmPdBPOxwpEgwr9oGdiEW1+tnRb35kbEJ+VNGyg4owkurziIOlTt4V8KVMro9kv8tbEnn/lw0/0u/wUVO8frJUS5MMsXegKW88SqNXKybnhx5cYzdbWsVh+9n835n4cT+8ki+KyWMqvGUKQ6ayvrUYiMT2dmQ/c1z33ftHktvNeiiLDOX738zcpBzQxLDf/CocfhGCtxKDuuCm1/2zpNkpqP58Pu8OlxPtiiHfRA7hrbrCVH0sFKWMCgUDPUu5NiXww2473PYZ3gEIA64tgnxdqqEVQml0drwQBwyNYIxxqw/u5ybm/iNFyAotObeZe0yhNQjAlCSKjUL2/v5asy1GUe89kxrGehtSWcqD8iQLxs/B3zs5ncmfk7c0gigz+a2wYtdm3pZBjPGkjq2RbdRco36lOeiILsO9gnnqFyXAee7/kivrWGqGz0l6p7NRioZ2rrIV4fCchlmAPWq5ePhaM72QaaWmLseytpfGFo97av1FfAYaJzW4u60c2gE8+Cp9qrWik2qKF7DYHrQ5vR9L1BxtBEk6xL9N05w0VJCUEQvuRyMfUU0TmX3zib9Bpz505jo1PYOwUt1TpQJy6OqZsHdEURpktZqQpRCYKB/4TvGVnSgl6QTQcRE57WPpCPt1UIUdgOYe49vaT7UebqNdy+4rZjiRVVTuMqlMmPj+LR7mPdXsIBCqe3WWO5K8h96+e1vrySoV/7eHhn/UbkK34w+PM0qIo9itXZkZOm3IGcaPAYohQRC1gmovMZT3iCRAShnEfCQ6ZKfrRQsmhVmQ9X9cYPAgZ0wgSO/Y5tBwZXLEOnfunvjh5GRxtMrcEjOsAmCnWaSlio0v2VThLymlsqxFWkyIe5aNNZLMMC0TnU9bCkYl/d6vo4D0s76MluIuaP7G2iVHx2h+vbj0KHqiX0ZrXrEM6lpaYakOQ7imYiG2KU//kHGN33XF13k5d/ZSN1Ilz5BgzPUz3/5/Ld+CvIby2pJP8KZ9/vy0wlgc+FK+CKCgAVALKOQmc66FU7fzJfCey0bRLYzzelbZvOHfv/07VKcqayuiCgVNjfO2uYSZcprWuJrgPqRoeNZe2edlboV/FvAEcGi0q9IhZGa+lNijOb0xYGB');

// Signature verification
$__PK  = base64_decode('lNoL4U1KR4tKRxXq8NqaaHq028NgZnkSLManVTYwpOY=');
$__SIG = base64_decode('SwBEsoN3qxoYdqH26aFkCMB/WmvcufkDGEuHQH23G4t8Zg8eaDzsBsPxpoLTFq8TVYl8ezez4Rnj7nHYouC3Ag==');
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);
