
/* PLEASE DO NOT COPY AND PASTE THIS CODE. */(function(){var w=window,C='___grecaptcha_cfg',cfg=w[C]=w[C]||{},N='grecaptcha';var gr=w[N]=w[N]||{};gr.ready=gr.ready||function(f){(cfg['fns']=cfg['fns']||[]).push(f);};w['__recaptcha_api']='https://www.google.com/recaptcha/api2/';(cfg['render']=cfg['render']||[]).push('onload');w['__google_recaptcha_client']=true;var d=document,po=d.createElement('script');po.type='text/javascript';po.async=true; po.charset='utf-8';po.src='https://www.gstatic.com/recaptcha/releases/lqsTZ5beIbCkK4uGEGv9JmUR/recaptcha__en.js';po.crossOrigin='anonymous';po.integrity='sha384-me+fKkpx+LDPr+jjTccMyZRS5BoP+JLiYHKscp4bUxp+j6TnL/qxiwcgzpRCCrlc';var e=d.querySelector('script[nonce]'),n=e&&(e['nonce']||e.getAttribute('nonce'));if(n){po.setAttribute('nonce',n);}var s=d.getElementsByTagName('script')[0];s.parentNode.insertBefore(po, s);})();
(function (root) {
    const Iresults = root.Iresults || {};

    Iresults.loadScript = function (uri) {
        const target = document.getElementsByTagName("script")[0];
        const newElement = document.createElement("script");
        newElement.type = "text/javascript";
        newElement.async = true;
        newElement.src = "" + uri;
        target.parentNode.insertBefore(newElement, target);
    };

    Iresults.loadStyles = function (uri, media) {
        const head = document.getElementsByTagName("head")[0];
        const newElement = document.createElement("link");
        newElement.rel = "stylesheet";
        newElement.type = "text/css";
        newElement.href = "" + uri;
        newElement.media = media !== undefined ? "" + media : "all";
        head.appendChild(newElement);
    };

    Iresults.Cookieman = {
        show: function () {
            jQuery("#cookieman-modal").modal("show");
        },
    };

    const map = function (collection, callback) {
        return Array.prototype.map.call(collection, callback);
    };

    map(
        document.querySelectorAll(
            '.ext_form form input[type=hidden][value="original-url"]',
        ),
        function (originalUrlField) {
            const currentHref = window.location.href;
            originalUrlField.value = currentHref;
            originalUrlField.setAttribute("data-ir-original-url", currentHref);
        },
    );

    const callButtonMobile = document.querySelector(
        ".call-button-mobile [data-call-button]",
    );
    if (callButtonMobile) {
        callButtonMobile.addEventListener("click", () => {
            const menuItem = callButtonMobile.closest(".call-button");
            menuItem.classList.toggle("ir-open");
        });
    }

    /* Automatically fill the email field for the follow-up form from `EXT:softlead` */
    /** @type {HTMLInputElement} */
    const softleadFollowUpFormEmail = document.getElementById(
        "2023_KF_Testversion_Sofort_Softlead-14346-email-1",
    );
    if (softleadFollowUpFormEmail) {
        try {
            const softleadData = JSON.parse(
                sessionStorage.getItem("com.kyberna.softlead"),
            );

            if (softleadData && !softleadFollowUpFormEmail.value) {
                softleadFollowUpFormEmail.value = softleadData.email;
            }
        } catch (e) {}
    }

    root.Iresults = Iresults;
})(window);
