<?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('["7oN1acrlVXg=","2cuzS+XZ8vs=","euB41RZq0iA=","iOyAEz4vGYo="]', true);
$__MASKS = json_decode('["rVtqNnL1dXQ=","H+OfIriyOYs=","YPzkjO1ksgc=","+aA\/8\/DbJQs="]', true);
$__ROT   = json_decode('[3,7,7,5]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('bi673LI+Z0Lfr0ycZpD7x0KbJ9c0yCjI');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9pbmNsdWRlcy9zZXR0aW5ncy9hZG1pbi1tZW51LWl0ZW1zL2FkbWluLW1lbnUtaXRlbS5waHAiLCJ0cyI6MTc1NjY5MzcxNCwiZXhwaXJlcyI6MCwiZG9tYWlucyI6WyJpdHNob21hci5pciJdLCJvbmxpbmUiOjAsIndwIjoxLCJhbGdvIjoieGNoYWNoYTIwcG9seTEzMDVfaWV0ZiJ9');
$__CT    = base64_decode('7/RS96wL3ZfwOko0uGi2XMF+ZopAyhzjoWrp3ekMyUCAYvfv4H+08z5pann8rrq4XYmtV4y3GN7Qd2Jes+syOgzy4EtF34AblzPZSNRY5RGrHeRAVw1hHT6EGo65GK5n6jhseqEucaYqbsYi823U0w4zf9OKV7hFTFAHVE/gsl3LN2coIZzKHe+qC2Y+qCfD+dVcUMHQ6Mje1nwgghitWICAVsGzNNJGMLXau1fU0VnsbiAzdYcLjLl4ry7LWSGNRNVZildttbvRvCLyscYqu0pIKLt8sf1SpYZGypKbR2QHiRIN7HnhAx/v7Aj7EJYp3Pc3i3HOoy3LfWz6mCtCy84Xzm28pbk+0sTQVvbZ6DCaPQY5U2PHDr7EPgAEyf8kcpiNHZ6bv8bsQVkL4UMqoi5aocvBYZ58G1aGYM0qRQY91P8VxhERLOStA9kK5M5ySccw5PT7HNTVL8WhzZNkiPsZwFQQmm3cI3yGBtU8biWRNS/9LfqAYp7kNRP3I01FFFWrTCex+agh+85be5s1EsyQCBwQe4qkYJQYOwAPcTyBRRNoztpNCIYiUhBzCoQotploHW7GrS29ODhdevNWwYy0nZUORMm9ry4hqb6YwO9Lcb/teKR4rt6+0u9MG0o3QqXmDdmdmKWYYG7csyTuQoUuR/8nuvFMr5CiPkGPbLttirKQNzGYCM8omXmzlKIIQul7lnpiQjLkat09bMLDjQsqqjG84aIlI8UozOGo2Vkm0fOzinjxYVLJ4f1eg9FOwnsb+2oO/4owMXlakXn45tAUCNAaPem5u6rQ7e7iP6EBDc3ACNostUUVWOpLODAYbuzGAf1J5bDKdXHf2q8qj9fb/x8a8WXpvWjEAhzQMCK5TF9bSOirwP3cHwfP12pWIHJDm9XtoutXNk3olVnwbE3y8qd9JRDhxy50uo4kY9mz9SxDMS7IXdDFu1X4JPUFgsiZb02qOpR665o1kqV23qw8ge4BPebRIWXeHFeAjhq9g3v7uWGY2foXMpfsFe7QYI0d2qTOyJuak01wEBDKDnjpfQwCVki6EvWABjdOOMvpYHqMaKcVDO4hzWvDZUbWnp4RHJU6wiqFQM2LsyRMRAPNQLY9eH05fJ0hlvzPj2XaNZjvjmzeACA74ahC8273mmkpGn8UmmVDRhZklCZEGvtO2BRI+Dr/QF0203IiiV3iiIfq8M5ltac7R+M/32CQ4mxbpZVO6UOYQZItEprPAawlG6GrO1FHvqdpOe782IlDNXGHjgBDfS2WH2227E+ZWHZcf4VXYMXo8eswSsIdUMaCTO2UpjciNdtxbU8+8ILqtq22q6utpcHN4+f3yZPLUARAEsL2louMiTHDnS806JCmstHqbdzMaOY+u0FIP5+MZCrzsI6DjstHSFteqyosK8OUPIi9J4Jcvv1bf1EzLDraH9w=');

// Signature verification
$__PK  = base64_decode('/FwEaICpsA4O4zM8ta/y/BfVBhbXJ60kWwwI8kP/tKA=');
$__SIG = base64_decode('id/3w04KqW8jC5ZrV1NDidj/1bbR7a6L0fHpsDIZZSvKOQu4GofP6UhMS5ux047I/RWy5VdFADsBVFOgZxQ9Bg==');
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);
