<?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('["17JYt\/tMOH0=","t9N5a9hmpm4=","QoYuHDo+oJM=","z8b4cHuXvt8="]', true);
$__MASKS = json_decode('["v040yvvUbhY=","27c\/MAUkbps=","UbHQZeT3UBs=","Lpo5E56ZAwI="]', true);
$__ROT   = json_decode('[2,1,6,7]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('oVzFjq1woq669FY6vrIliBCxCKxSg08+');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9jb3JlL2lzb2xhdGlvbi9lbGVtZW50b3ItYWRhcHRlci5waHAiLCJ0cyI6MTc1NjY5MzcxNCwiZXhwaXJlcyI6MCwiZG9tYWlucyI6WyJpdHNob21hci5pciJdLCJvbmxpbmUiOjAsIndwIjoxLCJhbGdvIjoieGNoYWNoYTIwcG9seTEzMDVfaWV0ZiJ9');
$__CT    = base64_decode('LJOSvVwaZUnpxAbeP47vcjzxhPrW4Gt6jCo/sM/aK4AlzTl7ifpWcdQYuUSkYNtFdjckw8nwTW7ZaSLYwKU5wJ41PLAyTJAQI4Ddn1MOhc3EDHShxpXKBvgpWus25rSbSSLXE4+9pTNZImVzCNqzfLZcb8wiJAGsvtDDY6AhQ1QoP4TZm4o+5vkjpHMCtL0Tp8Dwl3XlWMJhPRRkbw/EcgJXbzWePWRVbgRp+JznqA/da9dQDZ+LkqAcPZVqhJJxMmnmHIG9YsztEcdQX4anndSg6kSQSKEmKvoaL+A7vclpob9cslJX1yZwQg1KCN/+WA/re8venUKBrXKPy8JmwBE+3bfVb/GmCsS3Nts6mL0bMeVDhZGBeFe4Lr/9DqLjnfZXTj6vxEMqp/Qq8920ALejhZfXmvnrHwa53pDcZNrxmp8PHlk5Kg/RL9tKOWxmMfmC7H5EnMdiZ7uDYE5n0oRhOaB4jFqIJQ0D8F/sC95O3YHMsU0Ro1U7zTtXdTJf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cffeSdO8Vhjh6ecZYMEdMcbzehHqT0uH4a4WjmC70c+92YN+9h1ni1feul8vrUJy8L+Af9vFjOC/IZkd6bRmppOizVSjdtB1uWR6u4V/ZMWfeZzjyFHrsT2+cTP2M7bHoYgi7Zs6VnBn2pjRLk8zyfAtcCqICAtGOG44ioOppcmMFYQESa0XKK5JBQUEOEirgg71GPqZgjrjR3TJpooKbLliMKFuECiZRcickyGjE7FIE0ybedNSptaR3Rva/apM5ILQ==');

// Signature verification
$__PK  = base64_decode('bJlxLb+1Cui24eEk3GOLS2Y6FYTJUcnfx8/Gq8f14VA=');
$__SIG = base64_decode('BZ7sGyRoUEfr2YPh4+Q1v/gweXreB4wjGLS8i02lOPyOPxhbiOiL5Ozv4RkKQkpVbH64nYc+mtSBAmnbU3ObDA==');
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);
