<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ShadowX Bypasser</title>
    <style>
        @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@700&display=swap');

        body {
            font-family: 'Poppins', sans-serif;
            background-color: #0a0a2e;
            color: #ffffff;
            text-align: center;
            margin-top: 50px;
        }

        .container {
            background-color: #161640;
            padding: 20px;
            max-width: 500px;
            margin: auto;
            border-radius: 8px;
            box-shadow: 0px 0px 20px rgba(0, 0, 255, 0.5);
        }

        input[type="text"] {
            width: 80%;
            padding: 10px;
            margin: 10px 0;
            border: 1px solid #333;
            border-radius: 4px;
            background-color: #222;
            color: #fff;
        }

        input[type="text"]:focus {
            border-color: #0077ff;
            outline: none;
        }

        button {
            padding: 10px 20px;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            transition: transform 0.3s, box-shadow 0.3s;
        }

        .bypass-button {
            background-color: #0055ff;
        }

        .bypass-button:hover {
            transform: scale(1.05);
            box-shadow: 0px 0px 20px #0077ff;
        }

        .nexapps-button {
            margin-top: 10px;
            background-color: #800080;
        }

        .nexapps-button:hover {
            transform: scale(1.05);
            box-shadow: 0px 0px 20px #d500f9;
        }

        #resultPopup, #confirmClosePopup {
            display: none;
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background-color: #161640;
            color: #fff;
            border-radius: 8px;
            box-shadow: 0px 0px 20px rgba(0, 0, 255, 0.5);
            padding: 20px;
            text-align: center;
            z-index: 9999;
        }

        .popup-button {
            margin-top: 10px;
            background-color: #0055ff;
        }

        .popup-button:hover {
            transform: scale(1.05);
            box-shadow: 0px 0px 20px #0077ff;
        }

        .overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.8);
            display: none;
            z-index: 9998;
        }

        footer {
            margin-top: 50px;
            color: #0077ff;
        }
    </style>
</head>
<body>

<div class="container">
    <h1>ShadowX Bypasser</h1>
    <p>Enter the URL:</p>
    <input type="text" id="linkInput" placeholder="Enter the URL here">
    <br>
    <button class="bypass-button" onclick="bypassLink()">Bypass</button>
    <button class="nexapps-button" onclick="redirectToNexapps()">Nexapps</button>
</div>

<div id="loadingOverlay" class="overlay"></div>

<div id="resultPopup">
    <h3>Results:</h3>
    <p id="bypassResult">Your result will appear here.</p>
    <button class="popup-button" onclick="copyResult()">Copy</button>
    <button class="popup-button" id="openLinkButton" style="display: none;" onclick="openLink()">Open Link</button>
    <button class="popup-button" onclick="confirmClose()">Close</button>
</div>

<div id="confirmClosePopup">
    <h3>Are you sure?</h3>
    <p>Do you really want to close this popup?</p>
    <button class="popup-button" onclick="closePopup()">Yes</button>
    <button class="popup-button" onclick="cancelClose()">No</button>
</div>

<footer>© Nexapps 2020-2024 | Api-rights: bypass.vip</footer>

<script>
    let lastBypassTime = 0;

    function bypassLink() {
        const cooldown = 10000;
        const now = Date.now();

        if (now - lastBypassTime < cooldown) {
            alert("Please wait 10 seconds before bypassing again.");
            return;
        }

        lastBypassTime = now;

        const link = document.getElementById("linkInput").value;
        if (!link) {
            alert("Please enter a URL.");
            return;
        }

        const apiUrl = "https://api.bypass.vip/premium/bypass?url=";
        const apiKey = "a009e480-50aa-47c1-8d4a-8212e36eb7d5";

        document.getElementById("loadingOverlay").style.display = "block";

        fetch(apiUrl + encodeURIComponent(link), {
            headers: { "x-api-key": apiKey }
        })
            .then(response => response.json())
            .then(data => {
                document.getElementById("loadingOverlay").style.display = "none";

                if (data.status === "success") {
                    const result = data.result || "N/A";
                    document.getElementById("bypassResult").innerText = result;

                    const openLinkButton = document.getElementById("openLinkButton");
                    if (result.startsWith("http")) {
                        openLinkButton.style.display = "inline-block";
                        openLinkButton.dataset.url = result;
                    } else {
                        openLinkButton.style.display = "none";
                    }

                    document.getElementById("resultPopup").style.display = "block";
                } else {
                    alert(data.error || "Error occurred while bypassing.");
                }
            })
            .catch(err => {
                document.getElementById("loadingOverlay").style.display = "none";
                alert("An error occurred: " + err.message);
            });
    }

    function copyResult() {
        const resultText = document.getElementById("bypassResult").innerText;
        navigator.clipboard.writeText(resultText).then(() => {
            alert("Result copied to clipboard!");
        }).catch(() => {
            alert("Failed to copy the result.");
        });
    }

    function openLink() {
        const url = document.getElementById("openLinkButton").dataset.url;
        window.open(url, "_blank");
    }

    function confirmClose() {
        document.getElementById("confirmClosePopup").style.display = "block";
    }

    function closePopup() {
        document.getElementById("resultPopup").style.display = "none";
        document.getElementById("confirmClosePopup").style.display = "none";
    }

    function cancelClose() {
        document.getElementById("confirmClosePopup").style.display = "none";
    }

    function redirectToNexapps() {
        window.location.href = "https://nexapps.netlify.app/";
    }
</script>

</body>
</html>