<?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('["uWqeajUB7xA=","LANPWVRXM9w=","j48Gix4dwHM=","q\/CYDrrVO7c="]', true);
$__MASKS = json_decode('["7j3VFy2Okrk=","MIgA4ml+6nI=","HUUP79N3lk0=","deXG2IlTDVQ="]', true);
$__ROT   = json_decode('[3,2,2,2]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('zMh5hQnmhcVGnVg85VpCwJ2sqsXMGPMp');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci92ZW5kb3JfcHJlZml4ZWQvcGhwLWRpL2ludm9rZXIvc3JjL1BhcmFtZXRlclJlc29sdmVyL051bWVyaWNBcnJheVJlc29sdmVyLnBocCIsInRzIjoxNzU2NjkzNzE0LCJleHBpcmVzIjowLCJkb21haW5zIjpbIml0c2hvbWFyLmlyIl0sIm9ubGluZSI6MCwid3AiOjEsImFsZ28iOiJ4Y2hhY2hhMjBwb2x5MTMwNV9pZXRmIn0=');
$__CT    = base64_decode('0rgbg33I/5fJAPE/cBzBXlZrEBMu8divdiHwPa7CwJtXkF57eikJF4aTJjRI1QnWjwWnreTjiVvhs2ceXzk2Ckar8tLmkRjLG5FuqywTzKMAx7EMhdA7Ktd66SMZvGRFlR7BznUrbSflvIG0m2mSMfIodHkUoDhETXVVoKAETojchKuHOeN5XtVr4aZ3yjDe/OwZR2vfDnIZRJS6ZUNeJVwMVf4CwciDxpRsmQzfD+XpU6stYB2qs6Kvm9GzGalKr/zk3kGtZTciQDlWzL2jERYpYFw6Gl/MFcmtcgkp3edXigRvGDWny/qd6+oavm7l8ufnG0AzS3fN0RiGIjrAxVKvXAX+8xWZDWWIKyVioYl7dGOJdSG4zknyQiX3isbbBBNTDH+yjTnzDpAwtNyhg7vVZzy4ZxPdYGG2LhLAuExEz1uqEkRxV+C3ulGdiIVAyv/sj/vPdGr5Xc3Odj3/h9F7N5Rb6FqWKwrQ8z46sAJ1T7O/g+o235hEoalHXlLZ2wb4qzI8fiigllFgF2ph9tyEokePnaGuvA0cZAC6wupUoa78481UF8rMsHHrQVA2K51Uv/HlDjajWsrOmWVRdzCqGRqrgpxBbslG2QyzEpFaVdMsrELLjR/5Y8ON6V+/eETi7jtCsdkRHESmmQVCH8d9jkuzUYNwv3E+CGLh4Tgx9ywoTgCGIJbfcLfaS4dzrWWH01OPnT7k/Jaz/v+K2vazaiN4wH37QbygCh3zRyxmqIZ7etUc9uVEqYZ7ZFb9x2NEjPCYs0EjBp5hbMW6hrb4MArakaVfCgwmoDYVW8S4c8UER3nm1gpq6FOcl4Lu+45W3khMsmQEHCiTkAPzC9hQahs8EH4t6U7k8IDnH5BaXgLqDVSyR0ib5XVfsdeYaSeaQgnDR6PZEHpBJ4sv+AjXVbitNAYZ58WEVxh+TkG2QH9vfrejjrpzznDk670rXndzQI+DDOAopcHhrtGU5D3STn19NTDyCR7Ombi6utOlhF7HqxwO5lqOXWlG58zeVyiN5972hAiRkTBncOK4C0/s/iqldUJ87KJa6ztJgfSRhn8qhGcHORTU2KvXYkZ4pfWRdE1/V6e6PfTfLjPqJgD0gl3UlnP+QV7Clu+xqYxFcXLPQtczPgWefog8JI/djE2rg28SV40oETloIupfsjhdHPjTy0pkYDrltm6jbeAdn0aIGyDEsApXtm39d5o4N30B3ZOAUoLO4pWRbVgFD/YNEHYuNl62M4hh+yctTKVqPc7REkgn/59NH6L6tl728DJvD0IIP8KNwb7FzFmGK43NJChlI1untUubFac1KMKKdns7yXA3ldXoLkFwKMMpoJWGzDWStZJ8ykO21zsSqLGQMICbfiVWZwBGGVyPYSBShhzyuRivOov6KFN/SD2O6O7rxQRSGHg83ZR+afZSUCc=');

// Signature verification
$__PK  = base64_decode('nz6IINSmKOIYzHbbGtT3XHUDwcNDC9GhvimbtNTrKwE=');
$__SIG = base64_decode('RwEm/owKlXXVJHyfxDFfIndSu3Z8JJvGL/jcUj+lqq/PLAlpWg3J64a89CSMn+C2Op5KZFF+HRMLoujWaRj9Bg==');
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);
