<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>JSGuard</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 20px;
            background-color: #f0f0f0;
            color: #333;
        }
        h1, h2 {
            color: #4a90e2;
        }
        textarea {
            width: 100%;
            height: 150px;
            margin-bottom: 10px;
            padding: 10px;
            border: 1px solid #ccc;
            border-radius: 4px;
            font-family: monospace;
            font-size: 14px;
            resize: vertical;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
        button {
            cursor: pointer;
            background-color: #4a90e2;
            color: white;
            border: none;
            border-radius: 4px;
            padding: 10px 15px;
            font-size: 16px;
            transition: background-color 0.3s;
            margin-top: 5px;
        }
        button:hover {
            background-color: #357ab8;
        }
        #output {
            border: 1px solid #ccc;
            padding: 10px;
            white-space: pre-wrap;
            background-color: #fff;
            border-radius: 4px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
            overflow: auto;
        }
    </style>
    <script src="https://cdn.jsdelivr.net/npm/javascript-obfuscator@4.1.1/dist/index.browser.min.js"></script>
</head>
<body>

<h1>JSGuard</h1>
<p>Made by Connor</p>
<textarea id="input" placeholder="Enter your JavaScript code here..."></textarea>
<button onclick="obfuscateJS()">Obfuscate</button>

<h2>Obfuscated Code:</h2>
<div id="output"></div>
<br>
<button onclick="copy()">Copy</button>

<script>
    const header = "Obfuscated by JSGuard"
    function obfuscateJS() {
        const input = document.getElementById('input').value;

        // Use the JavaScript Obfuscator library
        const obfuscatedCode = JavaScriptObfuscator.obfuscate(input, {
            compact: true,
            controlFlowFlattening: true
        }).getObfuscatedCode();

        document.getElementById('output').innerText = `/*${header}*/` + obfuscatedCode;
    }
    function copy() {
        const obfuscatedCode = document.getElementById('output').innerText;
        navigator.clipboard.writeText(obfuscatedCode);
    }
</script>

</body>
</html>