"use strict";
var ac;
(function (ac) {
    ac.settings = {
        get: function () {
            var s = localStorage.getItem("ac:settings") || "{}", o = {};
            try {
                o = JSON.parse(s);
            }
            catch (_a) { }
            return o;
        },
        set: function (x, v) {
            var s = this.get();
            s[x] = v;
            localStorage.setItem("ac:settings", JSON.stringify(s));
        }
    };
    if (document.location.search.toLowerCase().indexOf("clearsettings=y")) {
        localStorage.setItem("ac:settings", JSON.stringify({}));
    }
    var site;
    (function (site) {
        site[site["abbviecare"] = 0] = "abbviecare";
        site[site["humira"] = 1] = "humira";
        site[site["rinvoq"] = 2] = "rinvoq";
        site[site["logistics"] = 3] = "logistics";
        site[site["manplanFTE"] = 4] = "manplanFTE";
        site[site["manplanPt"] = 5] = "manplanPt";
    })(site = ac.site || (ac.site = {}));
    var siteConfig = {
        abbviecare: {
            live: "www.abbviecare.com.au",
            test: "test.abbviecare.com.au",
            staging: "rizi-live-staging.azurewebsites.net"
        },
        humira: {
            live: "humira.abbviecare.com.au",
            test: "humira-test",
            staging: "humiralive-staging.azurewebsites.net"
        },
        rinvoq: {
            live: "www.rinvoq.com.au|^rinvoq.com.au",
            test: "test.rinvoq.com.au",
            staging: "rinvoq-live-staging",
        },
        logistics: {
            live: "hcp.abbviecare.com.au",
            test: "test-hcp.abbviecare.com.au",
            staging: "webaclogistics-live-staging"
        },
        manplanFTE: {
            live: "hcp.themanplan.com.au",
            test: "webmanplanfte-test.azurewebsites.net"
        },
        manplanPt: {
            live: "www.themanplan.com.au",
            test: "webmanplan-test.azurewebsites.net"
        }
    };
    ac.registrations = [];
    function register(sites, env, callback) {
        sites.forEach(function (u) { return ac.registrations.push({ site: u, urlPattern: siteConfig[site[u]][env], callback: callback }); });
    }
    ac.register = register;
    window.onload = function () {
        var c = "color:white; padding: 2px; border-radius:2px;background:#1ac9a8";
        console.log("%cabbvie.shared", c, "init");
        ac.registrations.forEach(function (l) { return location.host.match(l.urlPattern) && l.callback(l.site); });
    };
})(ac || (ac = {}));
var ac;
(function (ac) {
    var trustarc;
    (function (trustarc_1) {
        function getID(s) {
            switch (s) {
                case ac.site.rinvoq:
                    return "qwvyyj";
                case ac.site.abbviecare:
                case ac.site.humira:
                    return "fxr30e";
                case ac.site.logistics:
                    return "r9lp2m";
            }
        }
        function trustarc(s) {
            var cmid = getID(s);
            if (cmid) {
                var style = document.createElement('style');
                style.textContent = "#consent-banner #truste-banner-logo{height:auto !important;padding:40px 0;}";
                document.head.appendChild(style);
                document.body.insertAdjacentHTML("afterbegin", "\n            <div id=\"teconsent\" style=\"background-color:#dadfe0;height:60px;width:100%;text-align:center\"></div>\n            <div id=\"consent-banner\" style=\"position:fixed;bottom:0;z-index:1040;max-height:100vh;max-width:100%;overflow:auto\"></div>");
                var script = document.createElement('script');
                script.src = "https://consent.trustarc.com/v2/notice/" + cmid;
                script.async = true;
                document.body.appendChild(script);
            }
        }
        ac.register([ac.site.rinvoq], "test", trustarc);
    })(trustarc = ac.trustarc || (ac.trustarc = {}));
})(ac || (ac = {}));
var ac;
(function (ac) {
    var xmas;
    (function (xmas_1) {
        var seen = "seenxmas22";
        var humiraHTML = function (img, content) { return "<div id=\"HolidayClosureNotificationModal\" class=\"modal fade\"  data-backdrop=\"false\" style=\"padding:17px !important\" \n                        <div class=\"modal-dialog modal-lg\" style=\"margin:10px\">\n                            <div class=\"modal-content\"  style=\"padding:15px;\">\n                                <div class=\"modal-header text-center d-block\">\n                                    <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">&times;</button>\n                                    <img src=\"".concat(img, "\" alt=\"Logo\" style=\"max-width:200px\" class=\"d-inline\"></td>\n                                    <h3>Holiday season closure</h3>\n                                </div>\n                                <div class=\"modal-body\" >                               \n                                    ").concat(content, "\n                                </div>\n                            </div>\n                        </div>\n                    </div>"); };
        var holidayHTML = function (img, content) { return "<div id=\"HolidayClosureNotificationModal\" class=\"modal fade\" data-keyboard=\"false\" data-backdrop=\"true\">\n                    <div class=\"modal-dialog modal-lg\">\n                        <div class=\"modal-content abbvie-container\" style=\"width:unset\">\n                            <div class=\"modal-header text-center d-block\">\n                                <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">&times;</button>\n                                <img src=\"".concat(img, "\" alt=\"Logo\" style=\"max-width:200px\" class=\"d-inline\"></td>\n                                <h3>Holiday season closure</h3>\n                            </div>\n                            <div class=\"modal-body\" style=\"overflow-x: hidden\">                               \n                                ").concat(content, "\n                            </div>\n                        </div>\n                    </div>\n                </div>"); };
        var xmasExtra = function (h) {
            $('#noticePopup .inner').html(h);
            $.colorbox({ inline: true, width: "50%", href: "#noticePopup", scrolling: false, height: 450, onComplete: function () {
                    var el = $.colorbox.element();
                    $(".modal-dialog.modal-lg").css("width", "").find("button").remove();
                    $('.clear-notices').click(function (e) {
                        e.preventDefault();
                        ac.settings.set(seen, "yes");
                        $.colorbox.close();
                    });
                    $.colorbox.resize();
                } });
        };
        var xmas = function (s) {
            var html, hasSeen = ac.settings.get()[seen];
            if (hasSeen)
                return;
            var from = "22/12/2022", to = "03/01/2023", lastPost = "16/12/2022", newPost = "03/01/2023";
            switch (s) {
                case ac.site.abbviecare:
                    if (document.location.pathname.toLowerCase().endsWith("home")) {
                        html = holidayHTML("https://www.abbviecare.com.au/Sites/Rizi/Content/images/logo.png", "<p><strong>Important: AbbVie Care will be closed from 5:00pm on ".concat(from, ", reopening at ").concat(to, " (AEDT). </strong></p>\n                 <p class='text-danger'>Please be advised that new enrolments and nurse consultation bookings will be processed after ").concat(newPost, " </p>\n                <p>If you are a patient and need advice on your treatment or support with self-injecting, please contact your GP, specialist practice or local pharmacy. \n                If you need emergency support, please contact your nearest accident and emergency department.</p>\n                <p>We hope you have a happy holiday season. </p>\n                <p>Kind regards,</p>\n                  <p>The AbbVie Care Team</p>"));
                    }
                    break;
                case ac.site.humira:
                    if (document.location.pathname.toLowerCase().endsWith("home")) {
                        html = holidayHTML("https://www.abbviecare.com.au/Sites/Rizi/Content/images/logo.png", "<p><strong>Important: AbbVie Care will be closed from 5:00pm on ".concat(from, ", reopening at ").concat(to, " (AEDT). </strong></p>\n                 <p class='text-danger'>Please be advised that new enrolments and nurse consultation bookings will be processed after ").concat(newPost, " </p>\n                <p>If you are a patient and need advice on your treatment or support with self-injecting, please contact your GP, specialist practice or local pharmacy. \n                If you need emergency support, please contact your nearest accident and emergency department.</p>\n                <p>We hope you have a happy holiday season. </p>\n                <p>Kind regards,</p>\n                  <p>The AbbVie Care Team</p>"));
                    }
                    break;
                case ac.site.logistics:
                    if (document.location.pathname.toLowerCase() == "/home/welcome") {
                        html = holidayHTML("https://www.abbviecare.com.au/Sites/Rizi/Content/images/logo.png", "<p><strong>Important: AbbVie Care will be closed from 5:00pm on ".concat(from, " reopening at ").concat(to, " (AEDT). </strong></p>\n                 <p class='text-danger'>Abbvie Care will continue to accept online enrolments during this closure period. <br/>\n                 However, please be advised that patients who opt in to additional AbbVie Care services after ").concat(lastPost, ", including Nurse support and Health Coaching, cannot be\n                 guaranteed appointments until the new year (").concat(to, "). This will enable existing patients' needs to be met in the lead up to the closure period</p>\n                <p>If required, please advise your patients to contact their clinic team, local pharmacy or GP to arrange for training or support with self-injecting as an interim measure until\n                service resumes.</p>\n                <p>We hope you have a happy holiday season. </p>\n                <p>Kind regards,</p>\n                  <p>The AbbVie Care Team</p>"));
                    }
                    break;
                case ac.site.manplanFTE:
                case ac.site.manplanPt:
                    if (document.location.pathname == "/enrol_patient.php" || document.location.pathname == "/manplanenrolment") {
                        html = holidayHTML("/img/LG_ManPlanSite.png", "<p><strong>Important: The Man Plan will be closed from ".concat(from, ", reopening on ").concat(to, " AEDT.</strong></p>\n                      <p class=''>In order to ensure that existing patients\u2019 needs will be met, we will not be processing any enrolments after\n                      5.30pm AEDT Monday 22nd December 2021.</p>\n                      <p class=\"text-danger\"> \"Please be advised that the final date for new nurse consultation referrals is ").concat(lastPost, ". This\n                      will enable existing patients\u2019 needs to be met in the lead up to the closure period.</p>\n                      <p>Note: Any materials for patients enrolled into exercise programs over the closure dates will not be\n                      despatched until after ").concat(to, ".</p>\n                      <p>If you are a Patient and require advice or support with your treatment or health please contact your GP or Specialist.</p>\n                      <p>We hope you have a Merry Christmas and a happy holiday season.</p>"));
                    }
                    break;
            }
            if (html) {
                if (s == ac.site.manplanFTE)
                    xmasExtra(html);
                else {
                    document.body.insertAdjacentHTML("beforeend", html);
                    var holidayClosureNotificationModal = document.getElementById("HolidayClosureNotificationModal");
                    holidayClosureNotificationModal.addEventListener("hidden.bs.modal", function (event) {
                        ac.settings.set(seen, "yes");
                    });
                    $(holidayClosureNotificationModal).modal("show")[0].style.setProperty("z-index", "999999", "important");
                }
            }
        };
    })(xmas = ac.xmas || (ac.xmas = {}));
})(ac || (ac = {}));
