/* Minification failed. Returning unminified contents.
(5,9-10): run-time warning JS1195: Expected expression: c
(6,20-21): run-time warning JS1004: Expected ';': A
(6,38-39): run-time warning JS1004: Expected ';': {
(9,20-21): run-time warning JS1004: Expected ';': O
(9,43-44): run-time warning JS1004: Expected ';': {
(19,20-21): run-time warning JS1004: Expected ';': B
(19,64-65): run-time warning JS1004: Expected ';': {
(20,21-22): run-time warning JS1004: Expected ';': e
(26,20-21): run-time warning JS1004: Expected ';': S
(26,44-45): run-time warning JS1004: Expected ';': {
(38,20-21): run-time warning JS1004: Expected ';': S
(38,43-44): run-time warning JS1004: Expected ';': {
(49,20-21): run-time warning JS1004: Expected ';': H
(49,43-44): run-time warning JS1004: Expected ';': {
(55,20-21): run-time warning JS1004: Expected ';': I
(55,102-103): run-time warning JS1004: Expected ';': {
(71,9-10): run-time warning JS1002: Syntax error: }
(75,20-21): run-time warning JS1004: Expected ';': O
(75,36-37): run-time warning JS1004: Expected ';': {
(87,20-21): run-time warning JS1004: Expected ';': V
(87,50-51): run-time warning JS1004: Expected ';': {
(97,29-30): run-time warning JS1004: Expected ';': q
(104,20-21): run-time warning JS1004: Expected ';': C
(104,52-53): run-time warning JS1004: Expected ';': {
(112,29-30): run-time warning JS1004: Expected ';': q
(119,9-10): run-time warning JS1002: Syntax error: }
(122,20-21): run-time warning JS1004: Expected ';': T
(122,55-56): run-time warning JS1004: Expected ';': {
(137,20-21): run-time warning JS1004: Expected ';': P
(137,51-52): run-time warning JS1004: Expected ';': {
(142,20-21): run-time warning JS1004: Expected ';': R
(142,47-48): run-time warning JS1004: Expected ';': {
(145,20-21): run-time warning JS1004: Expected ';': C
(145,62-63): run-time warning JS1004: Expected ';': {
(150,20-21): run-time warning JS1004: Expected ';': I
(150,31-32): run-time warning JS1004: Expected ';': {
(153,20-21): run-time warning JS1004: Expected ';': E
(153,53-54): run-time warning JS1004: Expected ';': {
(157,20-21): run-time warning JS1004: Expected ';': E
(157,41-42): run-time warning JS1004: Expected ';': {
(160,20-21): run-time warning JS1004: Expected ';': U
(160,46-47): run-time warning JS1004: Expected ';': {
(163,20-21): run-time warning JS1004: Expected ';': E
(163,44-45): run-time warning JS1004: Expected ';': {
(174,20-21): run-time warning JS1004: Expected ';': G
(174,49-50): run-time warning JS1004: Expected ';': {
(176,21-22): run-time warning JS1004: Expected ';': f
(177,22-23): run-time warning JS1195: Expected expression: c
(177,32-33): run-time warning JS1004: Expected ';': i
(180,29-30): run-time warning JS1004: Expected ';': v
(181,29-30): run-time warning JS1004: Expected ';': v
(189,90-91): run-time warning JS1195: Expected expression: >
(189,117-118): run-time warning JS1004: Expected ';': )
(201,9-10): run-time warning JS1002: Syntax error: }
(203,50-68): run-time warning JS1197: Too many errors. The file might not be a JavaScript file: OnLoadEventHandler
(36,17-30): run-time warning JS1018: 'return' statement outside of function: return false;
(40,21-76): run-time warning JS1018: 'return' statement outside of function: return Epic.AppOrchard.PageLoad.HideLoginContextMenu();
(47,17-30): run-time warning JS1018: 'return' statement outside of function: return false;
(53,17-30): run-time warning JS1018: 'return' statement outside of function: return false;
(58,21-28): run-time warning JS1018: 'return' statement outside of function: return;
(85,17-29): run-time warning JS1018: 'return' statement outside of function: return true;
(102,17-30): run-time warning JS1018: 'return' statement outside of function: return false;
(117,17-30): run-time warning JS1018: 'return' statement outside of function: return false;
(124,21-41): run-time warning JS1018: 'return' statement outside of function: return "Greenhouse";
(127,21-37): run-time warning JS1018: 'return' statement outside of function: return "Garden";
(130,21-38): run-time warning JS1018: 'return' statement outside of function: return "Terrace";
(133,21-50): run-time warning JS1018: 'return' statement outside of function: return "Epic on FHIR Member";
(135,17-65): run-time warning JS1018: 'return' statement outside of function: return Helpers.PrettifyPascalCase(programLevel);
(139,21-31): run-time warning JS1018: 'return' statement outside of function: return "";
(140,17-69): run-time warning JS1018: 'return' statement outside of function: return needsSpace.replace(/([A-Z])/g, ' $1').trim();
(143,17-57): run-time warning JS1018: 'return' statement outside of function: return toClean.replace(/_/g, '').trim();
(151,17-65): run-time warning JS1018: 'return' statement outside of function: return navigator.userAgent.indexOf("Edge") > -1;
(155,17-56): run-time warning JS1018: 'return' statement outside of function: return toClean.replace(/\n/g, '<br/>');
(158,17-58): run-time warning JS1018: 'return' statement outside of function: return $('<div/>').text(toEncode).html();
(161,17-75): run-time warning JS1018: 'return' statement outside of function: return toClean.replace(/\n/g, "\\n").replace(/\r/, "\\r");
(164,17-75): run-time warning JS1018: 'return' statement outside of function: return toClean.replace(/\\n/g, "\n").replace(/\\r/, "\r");
(199,17-38): run-time warning JS1018: 'return' statement outside of function: return changedFields;
 */
var Epic;
(function (Epic) {
    var AppOrchard;
    (function (AppOrchard) {
        class PageLoad {
            static AddToPageLoad(fn) {
                Epic.AppOrchard.PageLoad.onLoadEvents.push(fn);
            }
            static OnLoadEventHandler(ev) {
                for (var x = 0; x < Epic.AppOrchard.PageLoad.onLoadEvents.length; x++) {
                    try {
                        Epic.AppOrchard.PageLoad.onLoadEvents[x].call(window.document, ev);
                    }
                    catch (err) {
                        alert(err);
                    }
                }
            }
            static BindKnockoutModelToUI(rootElementId, model) {
                let elm = document.getElementById(rootElementId);
                if (!elm) {
                    throw "Unable to result DOM element with ID: " + rootElementId;
                }
                ko.applyBindings(model, elm);
            }
            static ShowHeaderContextMenu() {
                $("#menuBarContextMenu").toggleClass("loginContextMenuShow");
                if ($("#menuBarContextMenu").hasClass("loginContextMenuShow") && $("#NavMenuButton:visible").length > 0) {
                    if ($("#loggedInUserContext").length < 1) {
                        $("#loginContextMenu").removeClass("hidden");
                    }
                    else {
                        $("#loginContextMenu").addClass("hidden");
                    }
                }
                return false;
            }
            static ShowLoginContextMenu() {
                if ($("#loginContextMenu:visible").length > 0) {
                    return Epic.AppOrchard.PageLoad.HideLoginContextMenu();
                }
                else {
                    $("#loginOverlay").width("100%");
                    $("#loginContextMenu").removeClass("hidden");
                    $("#loginListItem").addClass("menuselected");
                }
                return false;
            }
            static HideLoginContextMenu() {
                $("#loginOverlay").width("0%");
                $("#loginContextMenu").addClass("hidden");
                $("#loginListItem").removeClass("menuselected");
                return false;
            }
            static InjectNewUrlToHistory(queryParams, replaceState = false, callOnHashChange = true) {
                if (window.location.search && window.location.search.substring(1).toUpperCase() === queryParams.toUpperCase()) {
                    // make sure we don't add duplicate entries to history
                    return;
                }
                var newUrl = window.location.pathname + (queryParams ? "?" + queryParams : "");
                if (replaceState) {
                    window.history.replaceState({}, null, newUrl);
                }
                else {
                    window.history.pushState({}, null, newUrl);
                }
                if (callOnHashChange && window.onhashchange) {
                    window.onhashchange(null);
                }
            }
        }
        PageLoad.onLoadEvents = [];
        AppOrchard.PageLoad = PageLoad;
        class Login {
            static OpenLoginMenu() {
                if ($("#NavMenuButton").is(":visible")) {
                    $("#NavMenuButton").click();
                }
                else {
                    Epic.AppOrchard.PageLoad.ShowLoginContextMenu();
                }
                setTimeout(function () {
                    $("#LogInHeader").focus();
                }, 50);
                return true;
            }
            static VendorLoginClicked(returnUrl) {
                var date = new Date();
                date.setTime(date.getTime() + 31536000000);
                var oldDate = new Date();
                oldDate.setTime(oldDate.getTime() + -31536000000);
                AppOrchard.Util.CreateCookie('AppMarketVendorLogin', 'true', date.toUTCString(), '.epic.com');
                AppOrchard.Util.CreateCookie('FHIRLogin', 'false', oldDate.toUTCString(), '.epic.com');
                sessionStorage.removeItem("dismissedBanners");
                setTimeout(function () {
                    if (window.location.pathname.indexOf("/Gallery") >= 0) {
                        let queryString = Epic.AppOrchard.QueryString.BuildFromUrl();
                        returnUrl = encodeURIComponent("/Gallery?" + queryString.ToString());
                    }
                    window.open(Epic.AppOrchard.Util.GetFullUrl('/Account/SignIn?returnUrl=' + returnUrl), '_self');
                }, 50);
                return false;
            }
            static CustomerLoginClicked(returnUrl) {
                var oldDate = new Date();
                oldDate.setTime(oldDate.getTime() + -31536000000);
                AppOrchard.Util.CreateCookie('AppMarketVendorLogin', 'false', oldDate.toUTCString(), '.epic.com');
                AppOrchard.Util.CreateCookie('FHIRLogin', 'false', oldDate.toUTCString(), '.epic.com');
                sessionStorage.removeItem("dismissedBanners");
                setTimeout(function () {
                    if (window.location.pathname.indexOf("/Gallery") >= 0) {
                        let queryString = Epic.AppOrchard.QueryString.BuildFromUrl();
                        returnUrl = encodeURIComponent("/Gallery?" + queryString.ToString());
                    }
                    window.open(Epic.AppOrchard.Util.GetFullUrl('/Account/SignIn?returnUrl=' + returnUrl), '_self');
                }, 50);
                return false;
            }
        }
        AppOrchard.Login = Login;
        class Helpers {
            static TranslateProgramName(programLevel) {
                if (programLevel.toLowerCase() == "bronze") {
                    return "Greenhouse";
                }
                else if (programLevel.toLowerCase() == "silver") {
                    return "Garden";
                }
                else if (programLevel.toLowerCase() == "gold") {
                    return "Terrace";
                }
                else if (programLevel.toLowerCase() == "uscdimember") {
                    return "Epic on FHIR Member";
                }
                return Helpers.PrettifyPascalCase(programLevel);
            }
            static PrettifyPascalCase(needsSpace) {
                if (!needsSpace)
                    return "";
                return needsSpace.replace(/([A-Z])/g, ' $1').trim();
            }
            static RemoveUnderscores(toClean) {
                return toClean.replace(/_/g, '').trim();
            }
            static ChangeHeightToFitContent(element, buffer) {
                buffer = buffer || 0;
                element.style.height = "0";
                element.style.height = element.scrollHeight + buffer + "px";
            }
            static IsMSEdge() {
                return navigator.userAgent.indexOf("Edge") > -1;
            }
            static EncodeAndNewlineToBreak(toClean) {
                toClean = this.EncodeText(toClean);
                return toClean.replace(/\n/g, '<br/>');
            }
            static EncodeText(toEncode) {
                return $('<div/>').text(toEncode).html();
            }
            static UnescapeNewlines(toClean) {
                return toClean.replace(/\n/g, "\\n").replace(/\r/, "\\r");
            }
            static EscapeNewlines(toClean) {
                return toClean.replace(/\\n/g, "\n").replace(/\\r/, "\r");
            }
            /**
             * Get a list of fields that are different between 2 objects.
             *
             * Note - this currently only works for simple (string, int, bool) and array properties. Properties are themselves objects will not be checked correctly.
             * That said it should be easy to recursively call this to account for object properties.
             * @param obj1 first object to compare
             * @param obj2 second object to compare
             */
            static GetChangedFields(obj1, obj2) {
                const changedFields = [];
                let fieldChanged = false;
                for (const key in obj1) {
                    fieldChanged = false;
                    if (obj1.hasOwnProperty(key)) {
                        let val1 = obj1[key];
                        let val2 = obj2[key];
                        if (val1 === undefined || val1 === null) {
                            fieldChanged = val2 !== undefined && val2 !== null;
                        }
                        else if (val2 === undefined || val2 === null) {
                            fieldChanged = val1 !== undefined && val1 !== null;
                        }
                        else if (Array.isArray(val1) && Array.isArray(val2)) {
                            fieldChanged = ko.utils.compareArrays(val1, val2).some(elem => elem.status != "retained");
                        }
                        else {
                            fieldChanged = val1.toString() != val2.toString();
                        }
                        if (fieldChanged) {
                            changedFields.push(key);
                        }
                    }
                }
                return changedFields;
            }
        }
        AppOrchard.Helpers = Helpers;
        window.onload = Epic.AppOrchard.PageLoad.OnLoadEventHandler;
        window.onpopstate = function (event) {
            if (window.onhashchange)
                window.onhashchange(event);
            else
                window.location.reload();
        };
    })(AppOrchard = Epic.AppOrchard || (Epic.AppOrchard = {}));
})(Epic || (Epic = {}));
//# sourceMappingURL=Head.js.map;