
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Encrypt</title>
  <style>
    body {
      font-family: Arial, sans-serif;
      margin: 0;
      padding: 20px;
      background-color: #f4f4f4;
    }
    h2 {
      text-align: center;
      color: #333;
    }
    form {
      background: #fff;
      padding: 20px;
      border-radius: 8px;
      box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
      max-width: 400px;
      margin: auto;
    }
    label {
      display: block;
      margin-bottom: 10px;
      color: #555;
    }
    input[type="text"] {
      width: 100%;
      padding: 10px;
      margin-bottom: 15px;
      border: 1px solid #ccc;
      border-radius: 4px;
    }
    input[type="submit"] {
      background: #007bff;
      color: white;
      border: none;
      border-radius: 4px;
      padding: 10px;
      cursor: pointer;
      width: 100%;
    }
    input[type="submit"]:hover {
      background: #0056b3;
    }
    #result {
      margin-top: 20px;
      background: #e9ecef;
      padding: 15px;
      border-radius: 5px;
      word-wrap: break-word;
    }
  </style>
</head>
<body>
  <h2>Encrypt Parameters</h2>
  <form id="encrypt-form">
    <label for="url">URL:</label>
    <input type="text" id="url" required placeholder="Enter URL">
    <label for="type">Type (mpd/m3u8/hls/mp4):</label>
    <input type="text" id="type" required placeholder="Enter Type">
    <label for="kid">KID:</label>
    <input type="text" id="kid" placeholder="Enter KID">
    <label for="key">Key:</label>
    <input type="text" id="key" placeholder="Enter Key">
    <input type="submit" value="Encrypt">
  </form>
  <div id="result"></div>

  <script>
    function reverseBase64(str) {
      return str.split('').reverse().join('');
    }

    function encryptParams(url, type, kid, key) {
      const params = `${url}|${type}|${kid}|${key}`;
      const base64Encoded = btoa(params);
      const reversed = reverseBase64(base64Encoded);
      const encrypted = encodeURIComponent(reversed);
      return encrypted;
    }

    document.getElementById('encrypt-form').addEventListener('submit', (e) => {
      e.preventDefault();
      const url = document.getElementById('url').value;
      const type = document.getElementById('type').value;
      const kid = document.getElementById('kid').value;
      const key = document.getElementById('key').value;
      const encrypted = encryptParams(url, type, kid, key);
      const result = `Usage: https://static-notflix-player.pages.dev/?=${encrypted}`;
      document.getElementById('result').innerText = result;
    });
  </script>
</body>
</html>