/**
 * @license angular-recaptcha build:2017-04-24
 * https://github.com/vividcortex/angular-recaptcha
 * Copyright (c) 2017 VividCortex
**/

/*global angular, Recaptcha */
(function (ng) {
    'use strict';

    ng.module('vcRecaptcha', []);

}(angular));

/*global angular */
(function (ng) {
    'use strict';

    function throwNoKeyException() {
        throw new Error('You need to set the "key" attribute to your public reCaptcha key. If you don\'t have a key, please get one from https://www.google.com/recaptcha/admin/create');
    }

    var app = ng.module('vcRecaptcha');

    /**
     * An angular service to wrap the reCaptcha API
     */
    app.provider('vcRecaptchaService', function(){
        var provider = this;
        var config = {};
        provider.onLoadFunctionName = 'vcRecaptchaApiLoaded';

        /**
         * Sets the reCaptcha configuration values which will be used by default is not specified in a specific directive instance.
         *
         * @since 2.5.0
         * @param defaults  object which overrides the current defaults object.
         */
        provider.setDefaults = function(defaults){
            ng.copy(defaults, config);
        };

        /**
         * Sets the reCaptcha key which will be used by default is not specified in a specific directive instance.
         *
         * @since 2.5.0
         * @param siteKey  the reCaptcha public key (refer to the README file if you don't know what this is).
         */
        provider.setSiteKey = function(siteKey){
            config.key = siteKey;
        };

        /**
         * Sets the reCaptcha theme which will be used by default is not specified in a specific directive instance.
         *
         * @since 2.5.0
         * @param theme  The reCaptcha theme.
         */
        provider.setTheme = function(theme){
            config.theme = theme;
        };

        /**
         * Sets the reCaptcha stoken which will be used by default is not specified in a specific directive instance.
         *
         * @since 2.5.0
         * @param stoken  The reCaptcha stoken.
         */
        provider.setStoken = function(stoken){
            config.stoken = stoken;
        };

        /**
         * Sets the reCaptcha size which will be used by default is not specified in a specific directive instance.
         *
         * @since 2.5.0
         * @param size  The reCaptcha size.
         */
        provider.setSize = function(size){
            config.size = size;
        };

        /**
         * Sets the reCaptcha type which will be used by default is not specified in a specific directive instance.
         *
         * @since 2.5.0
         * @param type  The reCaptcha type.
         */
        provider.setType = function(type){
            config.type = type;
        };

        /**
         * Sets the reCaptcha language which will be used by default is not specified in a specific directive instance.
         *
         * @param lang  The reCaptcha language.
         */
        provider.setLang = function(lang){
            config.lang = lang;
        };

        /**
         * Sets the reCaptcha badge position which will be used by default if not specified in a specific directive instance.
         *
         * @param badge  The reCaptcha badge position.
         */
        provider.setBadge = function(badge){
            config.badge = badge;
        };

        /**
         * Sets the reCaptcha configuration values which will be used by default is not specified in a specific directive instance.
         *
         * @since 2.5.0
         * @param onLoadFunctionName  string name which overrides the name of the onload function. Should match what is in the recaptcha script querystring onload value.
         */
        provider.setOnLoadFunctionName = function(onLoadFunctionName){
            provider.onLoadFunctionName = onLoadFunctionName;
        };

        provider.$get = ['$rootScope','$window', '$q', '$document', function ($rootScope, $window, $q, $document) {
            var deferred = $q.defer(), promise = deferred.promise, instances = {}, recaptcha;

            $window.vcRecaptchaApiLoadedCallback = $window.vcRecaptchaApiLoadedCallback || [];

            var callback = function () {
                recaptcha = $window.grecaptcha;

                deferred.resolve(recaptcha);
            };

            $window.vcRecaptchaApiLoadedCallback.push(callback);

            $window[provider.onLoadFunctionName] = function () {
                $window.vcRecaptchaApiLoadedCallback.forEach(function(callback) {
                    callback();
                });
            };


            function getRecaptcha() {
                if (!!recaptcha) {
                    return $q.when(recaptcha);
                }

                return promise;
            }

            function validateRecaptchaInstance() {
                if (!recaptcha) {
                    throw new Error('reCaptcha has not been loaded yet.');
                }
            }


            // Check if grecaptcha is not defined already.
            if (ng.isDefined($window.grecaptcha)) {
                callback();
            } else {
                // Generate link on demand
                var script = $window.document.createElement('script');
                script.async = true;
                script.defer = true;
                script.src = 'https://www.google.com/recaptcha/api.js?onload='+provider.onLoadFunctionName+'&render=explicit';
                $document.find('body').append(script);
            }

            return {

                /**
                 * Creates a new reCaptcha object
                 *
                 * @param elm  the DOM element where to put the captcha
                 * @param conf the captcha object configuration
                 * @throws NoKeyException    if no key is provided in the provider config or the directive instance (via attribute)
                 */
                create: function (elm, conf) {

                    conf.sitekey = conf.key || config.key;
                    conf.theme = conf.theme || config.theme;
                    conf.stoken = conf.stoken || config.stoken;
                    conf.size = conf.size || config.size;
                    conf.type = conf.type || config.type;
                    conf.hl = conf.lang || config.lang;
                    conf.badge = conf.badge || config.badge;

                    if (!conf.sitekey || conf.sitekey.length !== 40) {
                        throwNoKeyException();
                    }
                    return getRecaptcha().then(function (recaptcha) {
                        var widgetId = recaptcha.render(elm, conf);
                        instances[widgetId] = elm;
                        return widgetId;
                    });
                },

                /**
                 * Reloads the reCaptcha
                 */
                reload: function (widgetId) {
                    validateRecaptchaInstance();

                    recaptcha.reset(widgetId);

                    // Let everyone know this widget has been reset.
                    $rootScope.$broadcast('reCaptchaReset', widgetId);
                },

                /**
                 * Executes the reCaptcha
                 */
                execute: function (widgetId) {
                    validateRecaptchaInstance();

                    recaptcha.execute(widgetId);
                },

                /**
                 * Get/Set reCaptcha language
                 */
                useLang: function (widgetId, lang) {
                    var instance = instances[widgetId];

                    if (instance) {
                        var iframe = instance.querySelector('iframe');
                        if (lang) {
                            // Setter
                            if (iframe && iframe.src) {
                                var s = iframe.src;
                                if (/[?&]hl=/.test(s)) {
                                    s = s.replace(/([?&]hl=)\w+/, '$1' + lang);
                                } else {
                                    s += ((s.indexOf('?') === -1) ? '?' : '&') + 'hl=' + lang;
                                }

                                iframe.src = s;
                            }
                        } else {
                            // Getter
                            if (iframe && iframe.src && /[?&]hl=\w+/.test(iframe.src)) {
                                return iframe.src.replace(/.+[?&]hl=(\w+)([^\w].+)?/, '$1');
                            } else {
                                return null;
                            }
                        }
                    } else {
                        throw new Error('reCaptcha Widget ID not exists', widgetId);
                    }
                },

                /**
                 * Gets the response from the reCaptcha widget.
                 *
                 * @see https://developers.google.com/recaptcha/docs/display#js_api
                 *
                 * @returns {String}
                 */
                getResponse: function (widgetId) {
                    validateRecaptchaInstance();

                    return recaptcha.getResponse(widgetId);
                },

                /**
                 * Gets reCaptcha instance and configuration
                 */
                getInstance: function (widgetId) {
                    return instances[widgetId];
                },

                /**
                 * Destroy reCaptcha instance.
                 */
                destroy: function (widgetId) {
                    delete instances[widgetId];
                }
            };

        }];
    });

}(angular));

/*global angular, Recaptcha */
(function (ng) {
    'use strict';

    var app = ng.module('vcRecaptcha');

    app.directive('vcRecaptcha', ['$document', '$timeout', 'vcRecaptchaService', function ($document, $timeout, vcRecaptcha) {

        return {
            restrict: 'A',
            require: "?^^form",
            scope: {
                response: '=?ngModel',
                key: '=?',
                stoken: '=?',
                theme: '=?',
                size: '=?',
                type: '=?',
                lang: '=?',
                badge: '=?',
                tabindex: '=?',
                required: '=?',
                onCreate: '&',
                onSuccess: '&',
                onExpire: '&'
            },
            link: function (scope, elm, attrs, ctrl) {
                scope.widgetId = null;

                if(ctrl && ng.isDefined(attrs.required)){
                    scope.$watch('required', validate);
                }

                var removeCreationListener = scope.$watch('key', function (key) {
                    var callback = function (gRecaptchaResponse) {
                        // Safe $apply
                        $timeout(function () {
                            scope.response = gRecaptchaResponse;
                            validate();

                            // Notify about the response availability
                            scope.onSuccess({response: gRecaptchaResponse, widgetId: scope.widgetId});
                        });
                    };

                    vcRecaptcha.create(elm[0], {

                        callback: callback,
                        key: key,
                        stoken: scope.stoken || attrs.stoken || null,
                        theme: scope.theme || attrs.theme || null,
                        type: scope.type || attrs.type || null,
                        lang: scope.lang || attrs.lang || null,
                        tabindex: scope.tabindex || attrs.tabindex || null,
                        size: scope.size || attrs.size || null,
                        badge: scope.badge || attrs.badge || null,
                        'expired-callback': expired

                    }).then(function (widgetId) {
                        // The widget has been created
                        validate();
                        scope.widgetId = widgetId;
                        scope.onCreate({widgetId: widgetId});

                        scope.$on('$destroy', destroy);

                        scope.$on('reCaptchaReset', function(event, resetWidgetId){
                          if(ng.isUndefined(resetWidgetId) || widgetId === resetWidgetId){
                            scope.response = "";
                            validate();
                          }
                        })

                    });

                    // Remove this listener to avoid creating the widget more than once.
                    removeCreationListener();
                });

                function destroy() {
                  if (ctrl) {
                    // reset the validity of the form if we were removed
                    ctrl.$setValidity('recaptcha', null);
                  }

                  cleanup();
                }

                function expired(){
                    // Safe $apply
                    $timeout(function () {
                        scope.response = "";
                        validate();

                        // Notify about the response availability
                        scope.onExpire({ widgetId: scope.widgetId });
                    });
                }

                function validate(){
                    if(ctrl){
                        ctrl.$setValidity('recaptcha', scope.required === false ? null : Boolean(scope.response));
                    }
                }

                function cleanup(){
                  vcRecaptcha.destroy(scope.widgetId);

                  // removes elements reCaptcha added.
                  ng.element($document[0].querySelectorAll('.pls-container')).parent().remove();
                }
            }
        };
    }]);

}(angular));
var app;
(function (app) {
    var common;
    (function (common) {
        var core;
        (function (core) {
            /*
            This data is based on the data provided by Google (https://chromium-i18n.appspot.com/ssl-address).  Google's
            data is somewhat described here https://github.com/googlei18n/libaddressinput/wiki/AddressValidationMetadata.
            The data below was loaded from the service above and custom formatted using GoogleAddressMetadataClient in this
            project.
            */
            var CountryInfo = /** @class */ (function () {
                function CountryInfo() {
                }
                CountryInfo.countries = { "AF": { "code": "AF", "name": "AFGHANISTAN", "zipPattern": "\\d{4}", "zipExamples": "1001,2601,3801" }, "AL": { "code": "AL", "name": "ALBANIA", "zipPattern": "\\d{4}", "zipExamples": "1001,1017,3501" }, "DZ": { "code": "DZ", "name": "ALGERIA", "zipPattern": "\\d{5}", "zipExamples": "40304,16027" }, "AS": { "code": "AS", "name": "AMERICAN SAMOA", "zipPattern": "(96799)(?:[ \\-](\\d{4}))?", "zipExamples": "96799" }, "AD": { "code": "AD", "name": "ANDORRA", "zipPattern": "AD[1-7]0\\d", "zipExamples": "AD100,AD501,AD700" }, "AO": { "code": "AO", "name": "ANGOLA", "zipPattern": null, "zipExamples": null }, "AI": { "code": "AI", "name": "ANGUILLA", "zipPattern": "(?:AI-)?2640", "zipExamples": "2640" }, "AQ": { "code": "AQ", "name": "ANTARCTICA", "zipPattern": null, "zipExamples": null }, "AG": { "code": "AG", "name": "ANTIGUA AND BARBUDA", "zipPattern": null, "zipExamples": null }, "AR": { "code": "AR", "name": "ARGENTINA", "zipPattern": "((?:[A-HJ-NP-Z])?\\d{4})([A-Z]{3})?", "zipExamples": "C1070AAM,C1000WAM,B1000TBU" }, "AM": { "code": "AM", "name": "ARMENIA", "zipPattern": "(?:37)?\\d{4}", "zipExamples": "375010,0002,0010" }, "AW": { "code": "AW", "name": "ARUBA", "zipPattern": null, "zipExamples": null }, "AC": { "code": "AC", "name": "ASCENSION ISLAND", "zipPattern": "ASCN 1ZZ", "zipExamples": "ASCN 1ZZ" }, "AU": { "code": "AU", "name": "AUSTRALIA", "zipPattern": "\\d{4}", "zipExamples": "2060,3171,6430" }, "AT": { "code": "AT", "name": "AUSTRIA", "zipPattern": "\\d{4}", "zipExamples": "1010,3741" }, "AZ": { "code": "AZ", "name": "AZERBAIJAN", "zipPattern": "\\d{4}", "zipExamples": "1000" }, "BS": { "code": "BS", "name": "BAHAMAS", "zipPattern": null, "zipExamples": null }, "BH": { "code": "BH", "name": "BAHRAIN", "zipPattern": "(?:\\d|1[0-2])\\d{2}", "zipExamples": "317" }, "BD": { "code": "BD", "name": "BANGLADESH", "zipPattern": "\\d{4}", "zipExamples": "1340,1000" }, "BB": { "code": "BB", "name": "BARBADOS", "zipPattern": "BB\\d{5}", "zipExamples": "BB23026,BB22025" }, "BY": { "code": "BY", "name": "BELARUS", "zipPattern": "\\d{6}", "zipExamples": "223016,225860,220050" }, "BE": { "code": "BE", "name": "BELGIUM", "zipPattern": "\\d{4}", "zipExamples": "4000,1000" }, "BZ": { "code": "BZ", "name": "BELIZE", "zipPattern": null, "zipExamples": null }, "BJ": { "code": "BJ", "name": "BENIN", "zipPattern": null, "zipExamples": null }, "BM": { "code": "BM", "name": "BERMUDA", "zipPattern": "[A-Z]{2} ?[A-Z0-9]{2}", "zipExamples": "FL 07,HM GX,HM 12" }, "BT": { "code": "BT", "name": "BHUTAN", "zipPattern": "\\d{5}", "zipExamples": "11001,31101,35003" }, "BO": { "code": "BO", "name": "BOLIVIA", "zipPattern": null, "zipExamples": null }, "BQ": { "code": "BQ", "name": "BONAIRE, SINT EUSTATIUS, AND SABA", "zipPattern": null, "zipExamples": null }, "BA": { "code": "BA", "name": "BOSNIA AND HERZEGOVINA", "zipPattern": "\\d{5}", "zipExamples": "71000" }, "BW": { "code": "BW", "name": "BOTSWANA", "zipPattern": null, "zipExamples": null }, "BV": { "code": "BV", "name": "BOUVET ISLAND", "zipPattern": null, "zipExamples": null }, "BR": { "code": "BR", "name": "BRAZIL", "zipPattern": "\\d{5}-?\\d{3}", "zipExamples": "40301-110,70002-900" }, "IO": { "code": "IO", "name": "BRITISH INDIAN OCEAN TERRITORY", "zipPattern": "BBND 1ZZ", "zipExamples": "BBND 1ZZ" }, "BN": { "code": "BN", "name": "BRUNEI DARUSSALAM", "zipPattern": "[A-Z]{2} ?\\d{4}", "zipExamples": "BT2328,KA1131,BA1511" }, "BG": { "code": "BG", "name": "BULGARIA (REP.)", "zipPattern": "\\d{4}", "zipExamples": "1000,1700" }, "BF": { "code": "BF", "name": "BURKINA FASO", "zipPattern": null, "zipExamples": null }, "BI": { "code": "BI", "name": "BURUNDI", "zipPattern": null, "zipExamples": null }, "KH": { "code": "KH", "name": "CAMBODIA", "zipPattern": "\\d{5}", "zipExamples": "12203,14206,12000" }, "CM": { "code": "CM", "name": "CAMEROON", "zipPattern": null, "zipExamples": null }, "CA": { "code": "CA", "name": "CANADA", "zipPattern": "[ABCEGHJKLMNPRSTVXY]\\d[ABCEGHJ-NPRSTV-Z] ?\\d[ABCEGHJ-NPRSTV-Z]\\d", "zipExamples": "H3Z 2Y7,V8X 3X4,T0L 1K0" }, "CV": { "code": "CV", "name": "CAPE VERDE", "zipPattern": "\\d{4}", "zipExamples": "7600" }, "KY": { "code": "KY", "name": "CAYMAN ISLANDS", "zipPattern": "KY\\d-\\d{4}", "zipExamples": "KY1-1100,KY1-1702,KY2-2101" }, "CF": { "code": "CF", "name": "CENTRAL AFRICAN REPUBLIC", "zipPattern": null, "zipExamples": null }, "TD": { "code": "TD", "name": "CHAD", "zipPattern": null, "zipExamples": null }, "GG": { "code": "GG", "name": "CHANNEL ISLANDS", "zipPattern": "GY\\d[\\dA-Z]? ?\\d[ABD-HJLN-UW-Z]{2}", "zipExamples": "GY1 1AA,GY2 2BT" }, "JE": { "code": "JE", "name": "CHANNEL ISLANDS", "zipPattern": "JE\\d[\\dA-Z]? ?\\d[ABD-HJLN-UW-Z]{2}", "zipExamples": "JE1 1AA,JE2 2BT" }, "CL": { "code": "CL", "name": "CHILE", "zipPattern": "\\d{7}", "zipExamples": "8340457,8720019,1230000" }, "CN": { "code": "CN", "name": "CHINA", "zipPattern": "\\d{6}", "zipExamples": "266033,317204,100096" }, "CX": { "code": "CX", "name": "CHRISTMAS ISLAND", "zipPattern": "6798", "zipExamples": "6798" }, "CC": { "code": "CC", "name": "COCOS (KEELING) ISLANDS", "zipPattern": "6799", "zipExamples": "6799" }, "CO": { "code": "CO", "name": "COLOMBIA", "zipPattern": "\\d{6}", "zipExamples": "111221,130001,760011" }, "KM": { "code": "KM", "name": "COMOROS", "zipPattern": null, "zipExamples": null }, "CD": { "code": "CD", "name": "CONGO (DEM. REP.)", "zipPattern": null, "zipExamples": null }, "CG": { "code": "CG", "name": "CONGO (REP.)", "zipPattern": null, "zipExamples": null }, "CK": { "code": "CK", "name": "COOK ISLANDS", "zipPattern": null, "zipExamples": null }, "CR": { "code": "CR", "name": "COSTA RICA", "zipPattern": "\\d{4,5}|\\d{3}-\\d{4}", "zipExamples": "1000,2010,1001" }, "CI": { "code": "CI", "name": "COTE D'IVOIRE", "zipPattern": null, "zipExamples": null }, "HR": { "code": "HR", "name": "CROATIA", "zipPattern": "\\d{5}", "zipExamples": "10000,21001,10002" }, "CW": { "code": "CW", "name": "CURACAO", "zipPattern": null, "zipExamples": null }, "CY": { "code": "CY", "name": "CYPRUS", "zipPattern": "\\d{4}", "zipExamples": "2008,3304,1900" }, "CZ": { "code": "CZ", "name": "CZECH REP.", "zipPattern": "\\d{3} ?\\d{2}", "zipExamples": "100 00,251 66,530 87" }, "DK": { "code": "DK", "name": "DENMARK", "zipPattern": "\\d{4}", "zipExamples": "8660,1566" }, "DJ": { "code": "DJ", "name": "DJIBOUTI", "zipPattern": null, "zipExamples": null }, "DM": { "code": "DM", "name": "DOMINICA", "zipPattern": null, "zipExamples": null }, "DO": { "code": "DO", "name": "DOMINICAN REP.", "zipPattern": "\\d{5}", "zipExamples": "11903,10101" }, "EC": { "code": "EC", "name": "ECUADOR", "zipPattern": "\\d{6}", "zipExamples": "090105,092301" }, "EG": { "code": "EG", "name": "EGYPT", "zipPattern": "\\d{5}", "zipExamples": "12411,11599" }, "SV": { "code": "SV", "name": "EL SALVADOR", "zipPattern": "CP [1-3][1-7][0-2]\\d", "zipExamples": "CP 1101" }, "GQ": { "code": "GQ", "name": "EQUATORIAL GUINEA", "zipPattern": null, "zipExamples": null }, "ER": { "code": "ER", "name": "ERITREA", "zipPattern": null, "zipExamples": null }, "EE": { "code": "EE", "name": "ESTONIA", "zipPattern": "\\d{5}", "zipExamples": "69501,11212" }, "ET": { "code": "ET", "name": "ETHIOPIA", "zipPattern": "\\d{4}", "zipExamples": "1000" }, "FK": { "code": "FK", "name": "FALKLAND ISLANDS (MALVINAS)", "zipPattern": "FIQQ 1ZZ", "zipExamples": "FIQQ 1ZZ" }, "FO": { "code": "FO", "name": "FAROE ISLANDS", "zipPattern": "\\d{3}", "zipExamples": "100" }, "FJ": { "code": "FJ", "name": "FIJI", "zipPattern": null, "zipExamples": null }, "AX": { "code": "AX", "name": "FINLAND", "zipPattern": "22\\d{3}", "zipExamples": "22150,22550,22240" }, "FI": { "code": "FI", "name": "FINLAND", "zipPattern": "\\d{5}", "zipExamples": "00550,00011" }, "FR": { "code": "FR", "name": "FRANCE", "zipPattern": "\\d{2} ?\\d{3}", "zipExamples": "33380,34092,33506" }, "GF": { "code": "GF", "name": "FRENCH GUIANA", "zipPattern": "9[78]3\\d{2}", "zipExamples": "97300" }, "PF": { "code": "PF", "name": "FRENCH POLYNESIA", "zipPattern": "987\\d{2}", "zipExamples": "98709" }, "TF": { "code": "TF", "name": "FRENCH SOUTHERN TERRITORIES", "zipPattern": null, "zipExamples": null }, "GA": { "code": "GA", "name": "GABON", "zipPattern": null, "zipExamples": null }, "GM": { "code": "GM", "name": "GAMBIA", "zipPattern": null, "zipExamples": null }, "GE": { "code": "GE", "name": "GEORGIA", "zipPattern": "\\d{4}", "zipExamples": "0101" }, "DE": { "code": "DE", "name": "GERMANY", "zipPattern": "\\d{5}", "zipExamples": "26133,53225" }, "GH": { "code": "GH", "name": "GHANA", "zipPattern": null, "zipExamples": null }, "GI": { "code": "GI", "name": "GIBRALTAR", "zipPattern": "GX11 1AA", "zipExamples": "GX11 1AA" }, "GR": { "code": "GR", "name": "GREECE", "zipPattern": "\\d{3} ?\\d{2}", "zipExamples": "151 24,151 10,101 88" }, "GL": { "code": "GL", "name": "GREENLAND", "zipPattern": "39\\d{2}", "zipExamples": "3900,3950,3911" }, "GD": { "code": "GD", "name": "GRENADA (WEST INDIES)", "zipPattern": null, "zipExamples": null }, "GP": { "code": "GP", "name": "GUADELOUPE", "zipPattern": "9[78][01]\\d{2}", "zipExamples": "97100" }, "GU": { "code": "GU", "name": "GUAM", "zipPattern": "(969(?:[12]\\d|3[12]))(?:[ \\-](\\d{4}))?", "zipExamples": "96910,96931" }, "GT": { "code": "GT", "name": "GUATEMALA", "zipPattern": "\\d{5}", "zipExamples": "09001,01501" }, "GN": { "code": "GN", "name": "GUINEA", "zipPattern": "\\d{3}", "zipExamples": "001,200,100" }, "GW": { "code": "GW", "name": "GUINEA-BISSAU", "zipPattern": "\\d{4}", "zipExamples": "1000,1011" }, "GY": { "code": "GY", "name": "GUYANA", "zipPattern": null, "zipExamples": null }, "HT": { "code": "HT", "name": "HAITI", "zipPattern": "\\d{4}", "zipExamples": "6120,5310,6110" }, "HM": { "code": "HM", "name": "HEARD AND MCDONALD ISLANDS", "zipPattern": "\\d{4}", "zipExamples": "7050" }, "HN": { "code": "HN", "name": "HONDURAS", "zipPattern": "\\d{5}", "zipExamples": "31301" }, "HK": { "code": "HK", "name": "HONG KONG", "zipPattern": null, "zipExamples": null }, "HU": { "code": "HU", "name": "HUNGARY (Rep.)", "zipPattern": "\\d{4}", "zipExamples": "1037,2380,1540" }, "IS": { "code": "IS", "name": "ICELAND", "zipPattern": "\\d{3}", "zipExamples": "320,121,220" }, "IN": { "code": "IN", "name": "INDIA", "zipPattern": "\\d{6}", "zipExamples": "110034,110001" }, "ID": { "code": "ID", "name": "INDONESIA", "zipPattern": "\\d{5}", "zipExamples": "40115" }, "IR": { "code": "IR", "name": "IRAN", "zipPattern": "\\d{5}-?\\d{5}", "zipExamples": "11936-12345" }, "IQ": { "code": "IQ", "name": "IRAQ", "zipPattern": "\\d{5}", "zipExamples": "31001" }, "IE": { "code": "IE", "name": "IRELAND", "zipPattern": "[\\dA-Z]{3} ?[\\dA-Z]{4}", "zipExamples": "A65 F4E2" }, "IM": { "code": "IM", "name": "ISLE OF MAN", "zipPattern": "IM\\d[\\dA-Z]? ?\\d[ABD-HJLN-UW-Z]{2}", "zipExamples": "IM2 1AA,IM99 1PS" }, "IL": { "code": "IL", "name": "ISRAEL", "zipPattern": "\\d{5}(?:\\d{2})?", "zipExamples": "9614303" }, "IT": { "code": "IT", "name": "ITALY", "zipPattern": "\\d{5}", "zipExamples": "00144,47037,39049" }, "JM": { "code": "JM", "name": "JAMAICA", "zipPattern": null, "zipExamples": null }, "JP": { "code": "JP", "name": "JAPAN", "zipPattern": "\\d{3}-?\\d{4}", "zipExamples": "154-0023,350-1106,951-8073" }, "JO": { "code": "JO", "name": "JORDAN", "zipPattern": "\\d{5}", "zipExamples": "11937,11190" }, "KZ": { "code": "KZ", "name": "KAZAKHSTAN", "zipPattern": "\\d{6}", "zipExamples": "040900,050012" }, "KE": { "code": "KE", "name": "KENYA", "zipPattern": "\\d{5}", "zipExamples": "20100,00100" }, "KI": { "code": "KI", "name": "KIRIBATI", "zipPattern": null, "zipExamples": null }, "XK": { "code": "XK", "name": "KOSOVO", "zipPattern": "[1-7]\\d{4}", "zipExamples": "10000" }, "KW": { "code": "KW", "name": "KUWAIT", "zipPattern": "\\d{5}", "zipExamples": "54541,54551,54404" }, "KG": { "code": "KG", "name": "KYRGYZSTAN", "zipPattern": "\\d{6}", "zipExamples": "720001" }, "LA": { "code": "LA", "name": "LAO (PEOPLE'S DEM. REP.)", "zipPattern": "\\d{5}", "zipExamples": "01160,01000" }, "LV": { "code": "LV", "name": "LATVIA", "zipPattern": "LV-\\d{4}", "zipExamples": "LV-1073,LV-1000" }, "LB": { "code": "LB", "name": "LEBANON", "zipPattern": "(?:\\d{4})(?: ?(?:\\d{4}))?", "zipExamples": "2038 3054,1107 2810,1000" }, "LS": { "code": "LS", "name": "LESOTHO", "zipPattern": "\\d{3}", "zipExamples": "100" }, "LR": { "code": "LR", "name": "LIBERIA", "zipPattern": "\\d{4}", "zipExamples": "1000" }, "LY": { "code": "LY", "name": "LIBYA", "zipPattern": null, "zipExamples": null }, "LI": { "code": "LI", "name": "LIECHTENSTEIN", "zipPattern": "948[5-9]|949[0-7]", "zipExamples": "9496,9491,9490" }, "LT": { "code": "LT", "name": "LITHUANIA", "zipPattern": "\\d{5}", "zipExamples": "04340,03500" }, "LU": { "code": "LU", "name": "LUXEMBOURG", "zipPattern": "\\d{4}", "zipExamples": "4750,2998" }, "MO": { "code": "MO", "name": "MACAO", "zipPattern": null, "zipExamples": null }, "MK": { "code": "MK", "name": "MACEDONIA", "zipPattern": "\\d{4}", "zipExamples": "1314,1321,1443" }, "MG": { "code": "MG", "name": "MADAGASCAR", "zipPattern": "\\d{3}", "zipExamples": "501,101" }, "MW": { "code": "MW", "name": "MALAWI", "zipPattern": null, "zipExamples": null }, "MY": { "code": "MY", "name": "MALAYSIA", "zipPattern": "\\d{5}", "zipExamples": "43000,50754,88990" }, "MV": { "code": "MV", "name": "MALDIVES", "zipPattern": "\\d{5}", "zipExamples": "20026" }, "ML": { "code": "ML", "name": "MALI", "zipPattern": null, "zipExamples": null }, "MT": { "code": "MT", "name": "MALTA", "zipPattern": "[A-Z]{3} ?\\d{2,4}", "zipExamples": "NXR 01,ZTN 05,GPO 01" }, "MH": { "code": "MH", "name": "MARSHALL ISLANDS", "zipPattern": "(969[67]\\d)(?:[ \\-](\\d{4}))?", "zipExamples": "96960,96970" }, "MQ": { "code": "MQ", "name": "MARTINIQUE", "zipPattern": "9[78]2\\d{2}", "zipExamples": "97220" }, "MR": { "code": "MR", "name": "MAURITANIA", "zipPattern": null, "zipExamples": null }, "MU": { "code": "MU", "name": "MAURITIUS", "zipPattern": "\\d{3}(?:\\d{2}|[A-Z]{2}\\d{3})", "zipExamples": "42602" }, "YT": { "code": "YT", "name": "MAYOTTE", "zipPattern": "976\\d{2}", "zipExamples": "97600" }, "MX": { "code": "MX", "name": "MEXICO", "zipPattern": "\\d{5}", "zipExamples": "02860,77520,06082" }, "FM": { "code": "FM", "name": "MICRONESIA (Federated State of)", "zipPattern": "(9694[1-4])(?:[ \\-](\\d{4}))?", "zipExamples": "96941,96944" }, "MC": { "code": "MC", "name": "MONACO", "zipPattern": "980\\d{2}", "zipExamples": "98000,98020,98011" }, "MN": { "code": "MN", "name": "MONGOLIA", "zipPattern": "\\d{5}", "zipExamples": "65030,65270" }, "ME": { "code": "ME", "name": "MONTENEGRO", "zipPattern": "8\\d{4}", "zipExamples": "81257,81258,81217" }, "MS": { "code": "MS", "name": "MONTSERRAT", "zipPattern": null, "zipExamples": null }, "MA": { "code": "MA", "name": "MOROCCO", "zipPattern": "\\d{5}", "zipExamples": "53000,10000,20050" }, "MZ": { "code": "MZ", "name": "MOZAMBIQUE", "zipPattern": "\\d{4}", "zipExamples": "1102,1119,3212" }, "MM": { "code": "MM", "name": "MYANMAR", "zipPattern": "\\d{5}", "zipExamples": "11181" }, "NA": { "code": "NA", "name": "NAMIBIA", "zipPattern": null, "zipExamples": null }, "NR": { "code": "NR", "name": "NAURU CENTRAL PACIFIC", "zipPattern": null, "zipExamples": null }, "NP": { "code": "NP", "name": "NEPAL", "zipPattern": "\\d{5}", "zipExamples": "44601" }, "NL": { "code": "NL", "name": "NETHERLANDS", "zipPattern": "\\d{4} ?[A-Z]{2}", "zipExamples": "1234 AB,2490 AA" }, "NC": { "code": "NC", "name": "NEW CALEDONIA", "zipPattern": "988\\d{2}", "zipExamples": "98814,98800,98810" }, "NZ": { "code": "NZ", "name": "NEW ZEALAND", "zipPattern": "\\d{4}", "zipExamples": "6001,6015,6332" }, "NI": { "code": "NI", "name": "NICARAGUA", "zipPattern": "\\d{5}", "zipExamples": "52000" }, "NE": { "code": "NE", "name": "NIGER", "zipPattern": "\\d{4}", "zipExamples": "8001" }, "NG": { "code": "NG", "name": "NIGERIA", "zipPattern": "\\d{6}", "zipExamples": "930283,300001,931104" }, "NU": { "code": "NU", "name": "NIUE", "zipPattern": null, "zipExamples": null }, "NF": { "code": "NF", "name": "NORFOLK ISLAND", "zipPattern": "2899", "zipExamples": "2899" }, "MP": { "code": "MP", "name": "NORTHERN MARIANA ISLANDS", "zipPattern": "(9695[012])(?:[ \\-](\\d{4}))?", "zipExamples": "96950,96951,96952" }, "NO": { "code": "NO", "name": "NORWAY", "zipPattern": "\\d{4}", "zipExamples": "0025,0107,6631" }, "OM": { "code": "OM", "name": "OMAN", "zipPattern": "(?:PC )?\\d{3}", "zipExamples": "133,112,111" }, "PK": { "code": "PK", "name": "PAKISTAN", "zipPattern": "\\d{5}", "zipExamples": "44000" }, "PW": { "code": "PW", "name": "PALAU", "zipPattern": "(969(?:39|40))(?:[ \\-](\\d{4}))?", "zipExamples": "96940" }, "PS": { "code": "PS", "name": "PALESTINIAN TERRITORY", "zipPattern": null, "zipExamples": null }, "PA": { "code": "PA", "name": "PANAMA (REP.)", "zipPattern": null, "zipExamples": null }, "PG": { "code": "PG", "name": "PAPUA NEW GUINEA", "zipPattern": "\\d{3}", "zipExamples": "111" }, "PY": { "code": "PY", "name": "PARAGUAY", "zipPattern": "\\d{4}", "zipExamples": "1536,1538,1209" }, "PE": { "code": "PE", "name": "PERU", "zipPattern": "(?:LIMA \\d{1,2}|CALLAO 0?\\d)|[0-2]\\d{4}", "zipExamples": "LIMA 23,LIMA 42,CALLAO 2" }, "PH": { "code": "PH", "name": "PHILIPPINES", "zipPattern": "\\d{4}", "zipExamples": "1008,1050,1135" }, "PN": { "code": "PN", "name": "PITCAIRN", "zipPattern": "PCRN 1ZZ", "zipExamples": "PCRN 1ZZ" }, "PL": { "code": "PL", "name": "POLAND", "zipPattern": "\\d{2}-\\d{3}", "zipExamples": "00-950,05-470,48-300" }, "PT": { "code": "PT", "name": "PORTUGAL", "zipPattern": "\\d{4}-\\d{3}", "zipExamples": "2725-079,1250-096,1201-950" }, "PR": { "code": "PR", "name": "PUERTO RICO", "zipPattern": "(00[679]\\d{2})(?:[ \\-](\\d{4}))?", "zipExamples": "00930" }, "QA": { "code": "QA", "name": "QATAR", "zipPattern": null, "zipExamples": null }, "MD": { "code": "MD", "name": "Rep. MOLDOVA", "zipPattern": "\\d{4}", "zipExamples": "2012,2019" }, "SG": { "code": "SG", "name": "REP. OF SINGAPORE", "zipPattern": "\\d{6}", "zipExamples": "546080,308125,408600" }, "RS": { "code": "RS", "name": "REPUBLIC OF SERBIA", "zipPattern": "\\d{5,6}", "zipExamples": "106314" }, "RE": { "code": "RE", "name": "REUNION", "zipPattern": "9[78]4\\d{2}", "zipExamples": "97400" }, "RO": { "code": "RO", "name": "ROMANIA", "zipPattern": "\\d{6}", "zipExamples": "060274,061357,200716" }, "RU": { "code": "RU", "name": "RUSSIAN FEDERATION", "zipPattern": "\\d{6}", "zipExamples": "247112,103375,188300" }, "RW": { "code": "RW", "name": "RWANDA", "zipPattern": null, "zipExamples": null }, "BL": { "code": "BL", "name": "SAINT BARTHELEMY", "zipPattern": "9[78][01]\\d{2}", "zipExamples": "97100" }, "SH": { "code": "SH", "name": "SAINT HELENA", "zipPattern": "(?:ASCN|STHL) 1ZZ", "zipExamples": "STHL 1ZZ" }, "KN": { "code": "KN", "name": "SAINT KITTS AND NEVIS", "zipPattern": null, "zipExamples": null }, "LC": { "code": "LC", "name": "SAINT LUCIA", "zipPattern": null, "zipExamples": null }, "MF": { "code": "MF", "name": "SAINT MARTIN", "zipPattern": "9[78][01]\\d{2}", "zipExamples": "97100" }, "VC": { "code": "VC", "name": "SAINT VINCENT AND THE GRENADINES (ANTILLES)", "zipPattern": "VC\\d{4}", "zipExamples": "VC0100,VC0110,VC0400" }, "WS": { "code": "WS", "name": "SAMOA", "zipPattern": null, "zipExamples": null }, "SM": { "code": "SM", "name": "SAN MARINO", "zipPattern": "4789\\d", "zipExamples": "47890,47891,47895" }, "ST": { "code": "ST", "name": "SAO TOME AND PRINCIPE", "zipPattern": null, "zipExamples": null }, "SA": { "code": "SA", "name": "SAUDI ARABIA", "zipPattern": "\\d{5}", "zipExamples": "11564,11187,11142" }, "SN": { "code": "SN", "name": "SENEGAL", "zipPattern": "\\d{5}", "zipExamples": "12500,46024,16556" }, "SC": { "code": "SC", "name": "SEYCHELLES", "zipPattern": null, "zipExamples": null }, "SL": { "code": "SL", "name": "SIERRA LEONE", "zipPattern": null, "zipExamples": null }, "SX": { "code": "SX", "name": "SINT MAARTEN", "zipPattern": null, "zipExamples": null }, "SK": { "code": "SK", "name": "SLOVAKIA", "zipPattern": "\\d{3} ?\\d{2}", "zipExamples": "010 01,023 14,972 48" }, "SI": { "code": "SI", "name": "SLOVENIA", "zipPattern": "\\d{4}", "zipExamples": "4000,1001,2500" }, "SB": { "code": "SB", "name": "SOLOMON ISLANDS", "zipPattern": null, "zipExamples": null }, "SO": { "code": "SO", "name": "SOMALIA", "zipPattern": "[A-Z]{2} ?\\d{5}", "zipExamples": "JH 09010,AD 11010" }, "ZA": { "code": "ZA", "name": "SOUTH AFRICA", "zipPattern": "\\d{4}", "zipExamples": "0083,1451,0001" }, "GS": { "code": "GS", "name": "SOUTH GEORGIA", "zipPattern": "SIQQ 1ZZ", "zipExamples": "SIQQ 1ZZ" }, "KR": { "code": "KR", "name": "SOUTH KOREA", "zipPattern": "\\d{5}", "zipExamples": "03051" }, "SS": { "code": "SS", "name": "SOUTH SUDAN", "zipPattern": null, "zipExamples": null }, "ES": { "code": "ES", "name": "SPAIN", "zipPattern": "\\d{5}", "zipExamples": "28039,28300,28070" }, "LK": { "code": "LK", "name": "SRI LANKA", "zipPattern": "\\d{5}", "zipExamples": "20000,00100" }, "PM": { "code": "PM", "name": "ST. PIERRE AND MIQUELON", "zipPattern": "9[78]5\\d{2}", "zipExamples": "97500" }, "SR": { "code": "SR", "name": "SURINAME", "zipPattern": null, "zipExamples": null }, "SJ": { "code": "SJ", "name": "SVALBARD AND JAN MAYEN ISLANDS", "zipPattern": "\\d{4}", "zipExamples": "9170" }, "SZ": { "code": "SZ", "name": "SWAZILAND", "zipPattern": "[HLMS]\\d{3}", "zipExamples": "H100" }, "SE": { "code": "SE", "name": "SWEDEN", "zipPattern": "\\d{3} ?\\d{2}", "zipExamples": "11455,12345,10500" }, "CH": { "code": "CH", "name": "SWITZERLAND", "zipPattern": "\\d{4}", "zipExamples": "2544,1211,1556" }, "TW": { "code": "TW", "name": "TAIWAN", "zipPattern": "\\d{3}(?:\\d{2})?", "zipExamples": "104,106,10603" }, "TJ": { "code": "TJ", "name": "TAJIKISTAN", "zipPattern": "\\d{6}", "zipExamples": "735450,734025" }, "TZ": { "code": "TZ", "name": "TANZANIA (UNITED REP.)", "zipPattern": "\\d{4,5}", "zipExamples": "6090,34413" }, "TH": { "code": "TH", "name": "THAILAND", "zipPattern": "\\d{5}", "zipExamples": "10150,10210" }, "TL": { "code": "TL", "name": "TIMOR-LESTE", "zipPattern": null, "zipExamples": null }, "TG": { "code": "TG", "name": "TOGO", "zipPattern": null, "zipExamples": null }, "TK": { "code": "TK", "name": "TOKELAU", "zipPattern": null, "zipExamples": null }, "TO": { "code": "TO", "name": "TONGA", "zipPattern": null, "zipExamples": null }, "TT": { "code": "TT", "name": "TRINIDAD AND TOBAGO", "zipPattern": null, "zipExamples": null }, "TA": { "code": "TA", "name": "TRISTAN DA CUNHA", "zipPattern": "TDCU 1ZZ", "zipExamples": "TDCU 1ZZ" }, "TN": { "code": "TN", "name": "TUNISIA", "zipPattern": "\\d{4}", "zipExamples": "1002,8129,3100" }, "TR": { "code": "TR", "name": "TURKEY", "zipPattern": "\\d{5}", "zipExamples": "01960,06101" }, "TM": { "code": "TM", "name": "TURKMENISTAN", "zipPattern": "\\d{6}", "zipExamples": "744000" }, "TC": { "code": "TC", "name": "TURKS AND CAICOS ISLANDS", "zipPattern": "TKCA 1ZZ", "zipExamples": "TKCA 1ZZ" }, "TV": { "code": "TV", "name": "TUVALU", "zipPattern": null, "zipExamples": null }, "UG": { "code": "UG", "name": "UGANDA", "zipPattern": null, "zipExamples": null }, "UA": { "code": "UA", "name": "UKRAINE", "zipPattern": "\\d{5}", "zipExamples": "15432,01055,01001" }, "AE": { "code": "AE", "name": "UNITED ARAB EMIRATES", "zipPattern": null, "zipExamples": null }, "GB": { "code": "GB", "name": "UNITED KINGDOM", "zipPattern": "GIR ?0AA|(?:(?:AB|AL|B|BA|BB|BD|BH|BL|BN|BR|BS|BT|BX|CA|CB|CF|CH|CM|CO|CR|CT|CV|CW|DA|DD|DE|DG|DH|DL|DN|DT|DY|E|EC|EH|EN|EX|FK|FY|G|GL|GY|GU|HA|HD|HG|HP|HR|HS|HU|HX|IG|IM|IP|IV|JE|KA|KT|KW|KY|L|LA|LD|LE|LL|LN|LS|LU|M|ME|MK|ML|N|NE|NG|NN|NP|NR|NW|OL|OX|PA|PE|PH|PL|PO|PR|RG|RH|RM|S|SA|SE|SG|SK|SL|SM|SN|SO|SP|SR|SS|ST|SW|SY|TA|TD|TF|TN|TQ|TR|TS|TW|UB|W|WA|WC|WD|WF|WN|WR|WS|WV|YO|ZE)(?:\\d[\\dA-Z]? ?\\d[ABD-HJLN-UW-Z]{2}))|BFPO ?\\d{1,4}", "zipExamples": "EC1Y 8SY,GIR 0AA,M2 5BQ" }, "US": { "code": "US", "name": "UNITED STATES", "zipPattern": "(\\d{5})(?:[ \\-](\\d{4}))?", "zipExamples": "95014,22162-1010" }, "UM": { "code": "UM", "name": "UNITED STATES MINOR OUTLYING ISLANDS", "zipPattern": "96898", "zipExamples": "96898" }, "UY": { "code": "UY", "name": "URUGUAY", "zipPattern": "\\d{5}", "zipExamples": "11600" }, "UZ": { "code": "UZ", "name": "UZBEKISTAN", "zipPattern": "\\d{6}", "zipExamples": "702100,700000" }, "VU": { "code": "VU", "name": "VANUATU", "zipPattern": null, "zipExamples": null }, "VA": { "code": "VA", "name": "VATICAN", "zipPattern": "00120", "zipExamples": "00120" }, "VE": { "code": "VE", "name": "VENEZUELA", "zipPattern": "\\d{4}", "zipExamples": "1010,3001,8011" }, "VN": { "code": "VN", "name": "VIET NAM", "zipPattern": "\\d{6}", "zipExamples": "119415,136065,720344" }, "VG": { "code": "VG", "name": "VIRGIN ISLANDS (BRITISH)", "zipPattern": "VG\\d{4}", "zipExamples": "VG1110,VG1150,VG1160" }, "VI": { "code": "VI", "name": "VIRGIN ISLANDS (U.S.)", "zipPattern": "(008(?:(?:[0-4]\\d)|(?:5[01])))(?:[ \\-](\\d{4}))?", "zipExamples": "00802-1222,00850-9802" }, "WF": { "code": "WF", "name": "WALLIS AND FUTUNA ISLANDS", "zipPattern": "986\\d{2}", "zipExamples": "98600" }, "EH": { "code": "EH", "name": "WESTERN SAHARA", "zipPattern": "\\d{5}", "zipExamples": "70000,72000" }, "YE": { "code": "YE", "name": "YEMEN", "zipPattern": null, "zipExamples": null }, "ZM": { "code": "ZM", "name": "ZAMBIA", "zipPattern": "\\d{5}", "zipExamples": "50100,50101" }, "ZW": { "code": "ZW", "name": "ZIMBABWE", "zipPattern": null, "zipExamples": null } };
                return CountryInfo;
            }());
            core.CountryInfo = CountryInfo;
        })(core = common.core || (common.core = {}));
    })(common = app.common || (app.common = {}));
})(app || (app = {}));
var MemberForms;
(function (MemberForms) {
    var Common;
    (function (Common) {
        'use strict';
        function registerSiteMenuController(ngModule) {
            ngModule
                .controller("siteMenuController", [
                "appConfig",
                app.common.core.HttpSessionServiceName,
                "$window",
                "$state",
                SiteMenuController
            ]);
        }
        Common.registerSiteMenuController = registerSiteMenuController;
        var SiteMenuController = /** @class */ (function () {
            function SiteMenuController(appConfig, httpSession, $window, $state) {
                var _this = this;
                this.appConfig = appConfig;
                this.httpSession = httpSession;
                this.$window = $window;
                this.$state = $state;
                httpSession.addSignInCallback(function (x) { return _this.setupMenu(); });
                //this.dealerMenu = {
                //    title: "Dealers, click here!",
                //    execute: this.executeWrapper(() => {
                //        $window.open(appConfig.dealerUrl, '_blank');
                //    }),
                //    linkCssClass: "dealer-link",
                //    applyActiveCssClass: false
                //};
                //this.adminMenu = {
                //    title: "Admin",
                //    execute: this.executeWrapper(() => {
                //        if (appConfig.shellName === oonclaimform.common.AdminShellName)
                //            return;
                //        $window.location.href = appConfig.adminUrl;
                //    })
                //};
                //this.supportMenu = {
                //    title: "Support",
                //    execute: null,
                //    items: [
                //        {
                //            title: "Create Support Ticket",
                //            execute: (mi): void => {                            
                //                if (appConfig.shellName === oonclaimform.common.SupportShellName)
                //                    $state.go("createTicket");
                //                else
                //                    $window.location.href = appConfig.supportUrl + "#/tickets/create";
                //            }
                //        },
                //        {
                //            title: "Service Agreement",
                //            execute: (mi, m, ms): void => {
                //                if (appConfig.shellName === oonclaimform.common.SupportShellName)
                //                    $state.go("viewSla");
                //                else
                //                    $window.location.href = appConfig.supportUrl + "#/sla";
                //            }
                //        }
                //    ]
                //};
                //this.logoutMenu = {
                //    title: "Logout",
                //    execute: this.executeWrapper(() =>
                //    {
                //        httpSession.signOut();
                //        $window.location.href = appConfig.productUrl;
                //    })
                //};
                //this.homeMenu = {
                //    title: "Home",
                //    execute: this.executeWrapper(() => {
                //        if (appConfig.shellName === oonclaimform.common.ProductDefaultShellName)
                //            return;
                //        $window.location.href = appConfig.productUrl;
                //    })
                //};
                //this.contactMenu = {
                //    title: "Contact",
                //    execute: this.executeWrapper(() => {
                //        if (appConfig.shellName === oonclaimform.common.ProductContactShellName)
                //            return;
                //        $window.location.href = appConfig.contactUrl;
                //    })
                //};
            }
            SiteMenuController.prototype.$onInit = function () {
                this.setupMenu();
            };
            SiteMenuController.prototype.getMenuState = function () {
                var menuState = {};
                //switch (this.appConfig.shellName) {
                //    case oonclaimform.common.AdminShellName:
                //        menuState[this.adminMenu.title] = 'active';
                //        break;
                //    case oonclaimform.common.ProductContactShellName:
                //        menuState[this.contactMenu.title] = 'active';
                //        break;
                //    case oonclaimform.common.ProductDefaultShellName:
                //        menuState[this.homeMenu.title] = 'active';
                //        break;
                //    case oonclaimform.common.SupportShellName:
                //        menuState[this.supportMenu.title] = 'active';
                //        break;
                //}                
                return menuState;
            };
            SiteMenuController.prototype.executeWrapper = function (execute) {
                return function (menuItem, menu, menuState) {
                    execute();
                };
            };
            SiteMenuController.prototype.setupMenu = function () {
                var appConfig = this.appConfig;
                this.leftMenus = [];
                this.rightMenus = [];
                //switch (appConfig.shellName) {
                //    case oonclaimform.common.AdminShellName:
                //        this.leftMenus.push(this.homeMenu);
                //        if (this.httpSession.getIsSignedIn()) {
                //            this.rightMenus.push(this.logoutMenu);
                //        }
                //        break;
                //    case oonclaimform.common.ProductDefaultShellName:
                //    case oonclaimform.common.ProductDetailsShellName:
                //    case oonclaimform.common.ProductContactShellName:
                //    case oonclaimform.common.SupportShellName:
                //        this.leftMenus.push(this.homeMenu);
                //        this.leftMenus.push(this.supportMenu);
                //        this.leftMenus.push(this.contactMenu);
                //        if (this.httpSession.getIsSignedIn()) {
                //            this.leftMenus.push(this.adminMenu);
                //        }
                //        this.rightMenus.push(this.dealerMenu);
                //        break;
                //}
            };
            return SiteMenuController;
        }());
    })(Common = MemberForms.Common || (MemberForms.Common = {}));
})(MemberForms || (MemberForms = {}));
var app;
(function (app) {
    var common;
    (function (common) {
        var core;
        (function (core) {
            'use strict';
            core.HttpSessionServiceName = "httpSession";
            var IsSignedInKeyName = 'session.isSignedIn';
            var UserNameKeyName = 'session.userName';
            var RequestTokenKeyName = 'session.requestToken';
            function configureRouteSecurity($rootScope, $state, httpSession) {
                $rootScope.$on("$stateChangeStart", function (event, toState, toParams, fromState, fromParams) {
                    var data = toState.data || {};
                    if (data.authorize && !httpSession.getIsSignedIn()) {
                        $state.transitionTo("login");
                        event.preventDefault();
                    }
                });
            }
            core.configureRouteSecurity = configureRouteSecurity;
            var HttpSession = /** @class */ (function () {
                function HttpSession(appConfig, $http, $cookies, $httpParamSerializer, $state, $q) {
                    var _this = this;
                    this.appConfig = appConfig;
                    this.$http = $http;
                    this.$cookies = $cookies;
                    this.$httpParamSerializer = $httpParamSerializer;
                    this.$state = $state;
                    this.$q = $q;
                    this._signInCallback = [];
                    this.sessionTokenPath = "/session/token";
                    this.sessionPath = "/session";
                    this.goToSignIn = function () {
                        _this.$state.go("login");
                    };
                    this._isSignedInStore = new ValueStore($cookies, IsSignedInKeyName, function (value) {
                        return !!value;
                    });
                    this._userNameStore = new ValueStore($cookies, UserNameKeyName, function (value) {
                        return value || "";
                    });
                    this._requestTokenStore = new ValueStore($cookies, RequestTokenKeyName, function (value) {
                        return value || "";
                    });
                    this.csrfHttpHeaderName = appConfig.csrfHttpHeaderName;
                    this.csrfToken = appConfig.csrfToken;
                    this.baseUrl = appConfig.baseUrl;
                }
                HttpSession.prototype.$onInit = function () { };
                ;
                HttpSession.prototype.getSessionTokenUrl = function () {
                    return this.baseUrl + this.sessionTokenPath;
                };
                HttpSession.prototype.getSessionUrl = function () {
                    return this.baseUrl + this.sessionPath;
                };
                HttpSession.prototype.signOut = function () {
                    var me = this;
                    return me.$http
                        .delete(me.getSessionUrl())
                        .finally(function () { return me._deleteState.call(me); });
                };
                HttpSession.prototype.addSignInCallback = function (callback) {
                    this._signInCallback.push(callback);
                };
                HttpSession.prototype.signIn = function (userName, password) {
                    var _this = this;
                    var me = this;
                    me._isSignedInStore.put(false);
                    var oauthParams = {
                        grant_type: "password",
                        username: userName,
                        password: password
                    };
                    return me.$http
                        .post(me.getSessionTokenUrl(), me.$httpParamSerializer(oauthParams))
                        .then(function (response) {
                        me._isSignedInStore.put(true);
                        me._userNameStore.put(userName);
                        me._requestTokenStore.put(response.data.access_token);
                        me.appConfig.csrfToken = response.data.csrf_token;
                        _this._signInCallback.forEach(function (x) { return x(me); });
                    })
                        .catch(function () { return me._deleteState.call(me); });
                };
                HttpSession.prototype.getIsSignedIn = function () {
                    return (this._isSignedInStore.get()) ? true : false;
                };
                HttpSession.prototype.getSignInToken = function () {
                    return this._requestTokenStore.get();
                };
                HttpSession.prototype.reset = function () {
                    this._deleteState();
                };
                HttpSession.prototype._deleteState = function () {
                    this._isSignedInStore.remove();
                    this._userNameStore.remove();
                    this._requestTokenStore.remove();
                    return this.$q.reject();
                };
                HttpSession.$inject = [
                    "appConfig",
                    "$http",
                    "$cookies",
                    "$httpParamSerializer",
                    "$state",
                    "$q"
                ];
                return HttpSession;
            }());
            core.HttpSession = HttpSession;
            var ValueStore = /** @class */ (function () {
                function ValueStore($cookies, key, getter) {
                    this.$cookies = $cookies;
                    this.key = key;
                    this.getter = getter;
                }
                ValueStore.prototype.get = function () {
                    var textValue = this.$cookies.get(this.key);
                    return (textValue)
                        ? this.getter(JSON.parse(textValue))
                        : null;
                };
                ValueStore.prototype.put = function (value) {
                    var textValue = (value)
                        ? JSON.stringify(value)
                        : null;
                    this.$cookies.put(this.key, textValue, { path: "/" });
                };
                ValueStore.prototype.remove = function () {
                    this.$cookies.remove(this.key, { path: "/" });
                };
                return ValueStore;
            }());
            var OAuthParams = /** @class */ (function () {
                function OAuthParams() {
                }
                return OAuthParams;
            }());
        })(core = common.core || (common.core = {}));
    })(common = app.common || (app.common = {}));
})(app || (app = {}));
var app;
(function (app) {
    var common;
    (function (common) {
        var core;
        (function (core) {
            'use strict';
            var HttpSessionInterceptor = /** @class */ (function () {
                function HttpSessionInterceptor($injector, $q) {
                    var _this = this;
                    this.$injector = $injector;
                    this.$q = $q;
                    this.response = function (response) {
                        var httpSession = _this.$injector.get(core.HttpSessionServiceName);
                        if (response.status === 401) {
                            httpSession.goToSignIn();
                        }
                        return _this.$q.when(response);
                    };
                    this.responseError = function (rejection) {
                        var httpSession = _this.$injector.get(core.HttpSessionServiceName);
                        if (rejection.status === 401) {
                            httpSession.reset();
                            httpSession.goToSignIn();
                        }
                        return _this.$q.reject(rejection);
                    };
                    this.request = function (requestConfig) {
                        var httpSession = _this.$injector.get(core.HttpSessionServiceName);
                        requestConfig.headers[httpSession.csrfHttpHeaderName] = httpSession.csrfToken;
                        if (httpSession.getIsSignedIn()) {
                            requestConfig.headers["Authorization"] = "Bearer " + httpSession.getSignInToken();
                        }
                        return requestConfig;
                    };
                }
                HttpSessionInterceptor.createConfigurer = function () {
                    var configurer = function ($httpProvider) {
                        $httpProvider.interceptors.push(HttpSessionInterceptor.createFactory());
                    };
                    configurer.$inject = [
                        "$httpProvider"
                    ];
                    return configurer;
                };
                HttpSessionInterceptor.createFactory = function () {
                    var factory = function ($injector, $q) {
                        return new HttpSessionInterceptor($injector, $q);
                    };
                    factory.$inject = [
                        "$injector",
                        "$q",
                    ];
                    return factory;
                };
                return HttpSessionInterceptor;
            }());
            core.HttpSessionInterceptor = HttpSessionInterceptor;
        })(core = common.core || (common.core = {}));
    })(common = app.common || (app.common = {}));
})(app || (app = {}));
var app;
(function (app) {
    var common;
    (function (common) {
        var core;
        (function (core) {
            function register(ngModule) {
                ngModule
                    .service(core.HttpSessionServiceName, core.HttpSession)
                    .config(core.HttpSessionInterceptor.createConfigurer())
                    .run(["$rootScope", "$state", core.HttpSessionServiceName, core.configureRouteSecurity]);
            }
            core.register = register;
        })(core = common.core || (common.core = {}));
    })(common = app.common || (app.common = {}));
})(app || (app = {}));
var app;
(function (app) {
    var common;
    (function (common) {
        var ui;
        (function (ui) {
            'use strict';
            var FormGroupValidationConfig = /** @class */ (function () {
                function FormGroupValidationConfig() {
                    this._triggerEvent = 'blur';
                    this.$get = function () {
                        return {
                            triggerEvent: this._triggerEvent
                        };
                    };
                }
                FormGroupValidationConfig.prototype.setTriggerEvent = function (triggerEvent) {
                    return this._triggerEvent = triggerEvent;
                };
                ;
                return FormGroupValidationConfig;
            }());
            ui.FormGroupValidationConfig = FormGroupValidationConfig;
            var FormGroupValidation = /** @class */ (function () {
                function FormGroupValidation(config, $interpolate) {
                    var _this = this;
                    this.config = config;
                    this.$interpolate = $interpolate;
                    this.scope = true;
                    this.restrict = "A";
                    this.require = "^form";
                    this.compile = function (elt, attrs) {
                        var ngMessagesElt = angular.element(elt[0].querySelector('[ng-messages]'));
                        if (ngMessagesElt) {
                            ngMessagesElt.attr("for", "getErrors()");
                            ngMessagesElt.attr("ng-if", "showErrors()");
                        }
                        return _this.link;
                    };
                    this.link = function (scope, elt, attrs, form) {
                        var inputElt = angular.element(elt[0].querySelector('.form-control[name],.form-control-checkbox[name]')), inputName = _this.$interpolate(inputElt.attr('name') || '')(scope);
                        if (!inputName) {
                            //try to locate the label's text for some context.
                            var label = "";
                            try {
                                label = elt[0].innerHTML;
                            }
                            catch (er) { }
                            throw "form-group-validation element has no child input elements with a 'name' attribute and a 'form-control' class. '" + label + "'.";
                        }
                        scope.getErrors = function () {
                            return form[inputName].$error;
                        };
                        scope.showErrors = function () {
                            return form[inputName].$invalid && (form[inputName].$touched || form.$submitted);
                        };
                        scope.$watch("showErrors()", function (invalid) {
                            elt.toggleClass('has-error', invalid);
                        });
                    };
                }
                FormGroupValidation.createFactory = function () {
                    var factory = function (config, $interpolate) {
                        return new FormGroupValidation(config, $interpolate);
                    };
                    factory.$inject = [
                        'formGroupValidationConfig',
                        '$interpolate'
                    ];
                    return factory;
                };
                return FormGroupValidation;
            }());
            ui.FormGroupValidation = FormGroupValidation;
        })(ui = common.ui || (common.ui = {}));
    })(common = app.common || (app.common = {}));
})(app || (app = {}));
var app;
(function (app) {
    var common;
    (function (common) {
        var ui;
        (function (ui) {
            function register(ngModule) {
                ngModule
                    .component("navBar", new ui.NavBarComponent())
                    .component("navBarNav", new ui.NavBarNavComponent())
                    .provider('formGroupValidationConfig', ui.FormGroupValidationConfig)
                    .directive("formGroupValidation", ui.FormGroupValidation.createFactory())
                    .directive("validateTruthy", ui.TruthyValidator.createFactory());
            }
            ui.register = register;
        })(ui = common.ui || (common.ui = {}));
    })(common = app.common || (app.common = {}));
})(app || (app = {}));
var app;
(function (app) {
    var common;
    (function (common) {
        var ui;
        (function (ui) {
            'use strict';
            var NavBarComponent = /** @class */ (function () {
                function NavBarComponent() {
                    this.bindings = {
                        'cssClass': '@?',
                        'restoreMenuState': '&?'
                    };
                    this.controller = ["$scope", NavBarController];
                    this.controllerAs = "vm";
                    this.template = "\n            <div class=\"navbar\" ng-class=\"vm.cssClass\" role=\"navigation\">\n                <div class=\"container\">\n                    <div class=\"navbar-header\">\n                        <button ng-init=\"vm.isCollapsed = true\" ng-click=\"vm.isCollapsed = !vm.isCollapsed\" type=\"button\" class=\"navbar-toggle\" data-toggle=\"collapse\" data-target=\"#navbar-menu\">\n                            <span class=\"sr-only\">Toggle Navigation</span>\n                            <span class=\"icon-bar\"></span>\n                            <span class=\"icon-bar\"></span>\n                            <span class=\"icon-bar\"></span>\n                        </button>\n                        <a class=\"navbar-brand\" ng-click=\"vm.noop()\" ng-transclude=\"navBarBrandImage\"></a>\n                    </div>\n                    <div uib-collapse=\"vm.isCollapsed\" class=\"collapse navbar-collapse\" ng-transclude=\"navBarContent\" id=\"#navbar-menu\">\n                    </div>\n                </div>\n            </div>\n        ";
                    this.transclude = {
                        "navBarBrandImage": "navBarBrandImage",
                        "navBarContent": "navBarContent"
                    };
                }
                return NavBarComponent;
            }());
            ui.NavBarComponent = NavBarComponent;
            var defautNavBarCssClass = 'navbar-default navbar-fixed-top';
            var NavBarController = /** @class */ (function () {
                function NavBarController($scope) {
                    this.$scope = $scope;
                    this.menuState = {};
                }
                NavBarController.prototype.$onInit = function () {
                    if (angular.isUndefined(this.cssClass))
                        this.cssClass = defautNavBarCssClass;
                    if (angular.isDefined(this.restoreMenuState()))
                        this.menuState = this.restoreMenuState();
                    if (angular.isUndefined(this.menuState))
                        this.menuState = {};
                };
                NavBarController.prototype.execute = function (menuItem, menu) {
                    var applyActiveCssClass = angular.isUndefined(menu.applyActiveCssClass) ||
                        menu.applyActiveCssClass;
                    this.resetMenuState();
                    if (applyActiveCssClass) {
                        this.menuState[menu.title] = 'active';
                    }
                    menuItem.execute(menu, menuItem, this.menuState);
                };
                NavBarController.prototype.resetMenuState = function () {
                    var menuState = {};
                    this.menuState = menuState;
                };
                NavBarController.prototype.noop = function () { };
                ;
                return NavBarController;
            }());
            ui.NavBarController = NavBarController;
        })(ui = common.ui || (common.ui = {}));
    })(common = app.common || (app.common = {}));
})(app || (app = {}));
var app;
(function (app) {
    var common;
    (function (common) {
        var ui;
        (function (ui) {
            'use strict';
            var NavBarNavComponent = /** @class */ (function () {
                function NavBarNavComponent() {
                    this.bindings = {
                        'menus': '<',
                        'cssClass': '@?'
                    };
                    this.controller = ["$scope", NavBarNavController];
                    this.controllerAs = "vm";
                    this.require = {
                        'navBar': '^navBar'
                    };
                    this.template = "\n        <ul class=\"nav navbar-nav\" ng-class=\"vm.cssClass\" ng-if=\"vm.menus.length > 0\">\n            <li ng-repeat-start=\"menu in vm.menus\" ng-class=\"vm.getMenuClass(menu)\" ng-if=\"vm.menuHasItems(menu)\" uib-dropdown>\n                <a ng-class=\"menu.linkCssClass\" uib-dropdown-toggle>\n                    {{menu.title}} <b class=\"caret\"></b>\n                </a>\n                <ul class=\"dropdown-menu\">\n                    <li ng-repeat=\"item in menu.items\" ng-class=\"vm.getItemClass(item)\">\n                        <a ng-if=\"!vm.itemIsDivider(item)\" ng-class=\"item.linkCssClass\" ng-click=\"vm.execute(item, menu)\">{{item.title}}</a>\n                    </li>\n                </ul>\n            </li>\n            <li ng-repeat-end ng-class=\"vm.getMenuClass(menu)\" ng-if=\"!vm.menuHasItems(menu)\">\n                <a ng-class=\"menu.linkCssClass\" ng-click=\"vm.execute(menu, menu)\">{{menu.title}}</a>\n            </li>\n        </ul>\n        ";
                }
                return NavBarNavComponent;
            }());
            ui.NavBarNavComponent = NavBarNavComponent;
            var NavBarNavController = /** @class */ (function () {
                function NavBarNavController($scope) {
                    this.$scope = $scope;
                }
                NavBarNavController.prototype.$onInit = function () { };
                ;
                NavBarNavController.prototype.execute = function (menuItem, menu) {
                    this.navBar.execute(menuItem, menu);
                };
                NavBarNavController.prototype.getMenuClass = function (menu) {
                    var hasDropdownClass = this.menuHasItems(menu);
                    var cssClass = {
                        'dropdown': hasDropdownClass,
                        'active': this.navBar.menuState[menu.title] ? true : false
                    };
                    if (menu.cssClass) {
                        cssClass[menu.cssClass] = true;
                    }
                    return cssClass;
                };
                ;
                NavBarNavController.prototype.getItemClass = function (menuItem) {
                    var cssClass = {
                        'divider': this.itemIsDivider(menuItem)
                    };
                    if (menuItem.cssClass) {
                        cssClass[menuItem.cssClass] = true;
                    }
                    return cssClass;
                };
                ;
                NavBarNavController.prototype.menuHasItems = function (menu) {
                    return angular.isDefined(menu.items) &&
                        angular.isArray(menu.items) &&
                        menu.items.length > 0;
                };
                NavBarNavController.prototype.itemIsDivider = function (menuItem) {
                    return angular.isDefined(menuItem.divider) &&
                        menuItem.divider;
                };
                return NavBarNavController;
            }());
        })(ui = common.ui || (common.ui = {}));
    })(common = app.common || (app.common = {}));
})(app || (app = {}));
var app;
(function (app) {
    var common;
    (function (common) {
        var ui;
        (function (ui) {
            'use strict';
            var TruthyValidator = /** @class */ (function () {
                function TruthyValidator() {
                    // restrict to an attribute type.
                    this.restrict = 'A';
                    // element must have ng-model attribute.
                    this.require = 'ngModel';
                }
                TruthyValidator.createFactory = function () {
                    return function () { return new TruthyValidator(); };
                };
                TruthyValidator.prototype.link = function (scope, element, attrs, ctrl) {
                    scope.$watch(attrs.ngModel, function (value) {
                        var valid = attrs.validateTruthy == "true";
                        ctrl.$setValidity("notTruthy", valid);
                        if (valid === true)
                            ctrl.$setTouched();
                    });
                };
                return TruthyValidator;
            }());
            ui.TruthyValidator = TruthyValidator;
        })(ui = common.ui || (common.ui = {}));
    })(common = app.common || (app.common = {}));
})(app || (app = {}));
var MemberForms;
(function (MemberForms) {
    var OutOfNetworkClaim;
    (function (OutOfNetworkClaim) {
        "use strict";
        var InstructionsController = /** @class */ (function () {
            function InstructionsController($log, $http, $state) {
                this.$log = $log;
                this.$http = $http;
                this.$state = $state;
            }
            InstructionsController.prototype.$onInit = function () { };
            ;
            InstructionsController.prototype.readIt = function () {
                this.$state.go("form");
            };
            InstructionsController.getStateConfig = function (url, uiView) {
                return {
                    url: url,
                    views: (_a = {},
                        _a[uiView] = {
                            templateProvider: [
                                "$templateRequest",
                                "theme",
                                function ($templateRequest, theme) {
                                    var url = theme.getInstructionsTemplateUrl();
                                    return $templateRequest(url);
                                }
                            ],
                            controller: InstructionsController,
                            controllerAs: "vm"
                        },
                        _a)
                };
                var _a;
            };
            InstructionsController.$inject = ["$log", "$http", "$state"];
            return InstructionsController;
        }());
        OutOfNetworkClaim.InstructionsController = InstructionsController;
    })(OutOfNetworkClaim = MemberForms.OutOfNetworkClaim || (MemberForms.OutOfNetworkClaim = {}));
})(MemberForms || (MemberForms = {}));
var MemberForms;
(function (MemberForms) {
    var OutOfNetworkClaim;
    (function (OutOfNetworkClaim) {
        "use strict";
        var FormSuccessController = /** @class */ (function () {
            function FormSuccessController(appConfig, $log, $http, $state) {
                this.appConfig = appConfig;
                this.$log = $log;
                this.$http = $http;
                this.$state = $state;
                this.providerLocatorUrl = this.appConfig.claim.providerLocatorUrl;
            }
            FormSuccessController.prototype.$onInit = function () { };
            ;
            FormSuccessController.getStateConfig = function (url, uiView) {
                return {
                    url: url,
                    views: (_a = {},
                        _a[uiView] = {
                            templateProvider: [
                                "$templateRequest",
                                "theme",
                                function ($templateRequest, theme) {
                                    var url = theme.getSubmissionSuccessTemplateUrl();
                                    return $templateRequest(url);
                                }
                            ],
                            controller: FormSuccessController,
                            controllerAs: "vm"
                        },
                        _a)
                };
                var _a;
            };
            FormSuccessController.$inject = ["appConfig", "$log", "$http", "$state"];
            return FormSuccessController;
        }());
        OutOfNetworkClaim.FormSuccessController = FormSuccessController;
    })(OutOfNetworkClaim = MemberForms.OutOfNetworkClaim || (MemberForms.OutOfNetworkClaim = {}));
})(MemberForms || (MemberForms = {}));
var MemberForms;
(function (MemberForms) {
    var OutOfNetworkClaim;
    (function (OutOfNetworkClaim) {
        "use strict";
        var tv4;
        angular
            .module("tv4", [])
            .factory("tv4", ["$window", function ($window) {
                //We use the approach below primarily because this factory will 
                //be run multiple times when the unit tests are run.  If we rely 
                //solely on $windows.tv4 then the second time this runs it will 
                //fail since the first through we delete $windows.tv4.
                tv4 = tv4 || $window.tv4;
                delete ($window.tv4);
                return tv4;
            }]);
        var lodash;
        angular
            .module("lodash", [])
            .factory("_", ["$window", function ($window) {
                //We use the approach below primarily because this factory will 
                //be run multiple times when the unit tests are run.  If we rely 
                //solely on $windows._ then the second time this runs it will 
                //fail since the first through we delete $windows._.
                lodash = lodash || $window._;
                delete ($window._);
                return lodash;
            }]);
        var ngModule = angular
            .module("MemberForms.OutOfNetworkClaim", [
            "vcRecaptcha",
            "ngCookies",
            "ngAnimate",
            "ngSanitize",
            "ngMessages",
            "ui.router",
            "ui.bootstrap",
            "tv4",
            "lodash"
        ]);
        ngModule.constant("countries", app.common.core.CountryInfo.countries);
        MemberForms.Common.registerSiteMenuController(ngModule);
        app.common.ui.register(ngModule);
        app.common.core.register(ngModule);
    })(OutOfNetworkClaim = MemberForms.OutOfNetworkClaim || (MemberForms.OutOfNetworkClaim = {}));
})(MemberForms || (MemberForms = {}));
var MemberForms;
(function (MemberForms) {
    var OutOfNetworkClaim;
    (function (OutOfNetworkClaim) {
        "use strict";
        angular
            .module("MemberForms.OutOfNetworkClaim")
            .config(routeConfigFactory());
        function routeConfigFactory() {
            function routeConfig($stateProvider, $urlRouterProvider, appConfig) {
                $urlRouterProvider.otherwise("/");
                if (appConfig.claimRequest.id.value) {
                    $stateProvider
                        .state("form", {
                        url: "/form",
                        templateUrl: "App/OutOfNetworkClaim/Form/form.tmpl.html"
                    })
                        .state("form.success", OutOfNetworkClaim.FormSuccessController.getStateConfig("", "@"))
                        .state("instructions", OutOfNetworkClaim.InstructionsController.getStateConfig("/", ""))
                        .state("patientForm", {
                        url: "/patient/:index",
                        templateUrl: "App/OutOfNetworkClaim/Form/patientForm.tmpl.html",
                        params: {
                            index: null
                        }
                    });
                }
                else {
                    $stateProvider
                        .state("claimRequest", {
                        url: "/",
                        templateUrl: "App/OutOfNetworkClaim/FormRequest/formRequest.tmpl.html"
                    })
                        .state("claimRequest.success", {
                        views: {
                            '@': {
                                templateUrl: "App/OutOfNetworkClaim/FormRequest/formRequestSuccess.tmpl.html"
                            }
                        }
                    });
                }
            }
            ;
            routeConfig.$inject = [
                "$stateProvider",
                "$urlRouterProvider",
                "appConfig"
            ];
            return routeConfig;
        }
    })(OutOfNetworkClaim = MemberForms.OutOfNetworkClaim || (MemberForms.OutOfNetworkClaim = {}));
})(MemberForms || (MemberForms = {}));
var MemberForms;
(function (MemberForms) {
    var OutOfNetworkClaim;
    (function (OutOfNetworkClaim) {
        "use strict";
        var ShellController = /** @class */ (function () {
            function ShellController(theme) {
                this.theme = theme;
                this.logoUrl = theme.logoUrl;
                this.memberIdCardUrl = theme.memberIdCardUrl;
            }
            ShellController.prototype.$onInit = function () { };
            ;
            ShellController.$inject = ["theme"];
            return ShellController;
        }());
        angular
            .module("MemberForms.OutOfNetworkClaim")
            .controller("ShellController", ShellController);
    })(OutOfNetworkClaim = MemberForms.OutOfNetworkClaim || (MemberForms.OutOfNetworkClaim = {}));
})(MemberForms || (MemberForms = {}));
var MemberForms;
(function (MemberForms) {
    var OutOfNetworkClaim;
    (function (OutOfNetworkClaim) {
        "use strict";
        var Theme = /** @class */ (function () {
            function Theme(appConfig, $templateCache) {
                this.appConfig = appConfig;
                this.$templateCache = $templateCache;
                this.baseUrl = appConfig.theme.virtualPath;
                this.logoUrl = appConfig.theme.logoImageVirtualPath;
                this.memberIdCardUrl = appConfig.theme.memberIdCardImageVirtualPath;
                this.templateBaseUrl = "App/OutOfNetworkClaim/Themes/" + this.appConfig.theme.name;
            }
            Theme.prototype.getInstructionsTemplateUrl = function () {
                var templateUrl = this.templateBaseUrl + "/instructions.tmpl.html";
                if (!this.$templateCache.get(templateUrl))
                    templateUrl = "App/OutOfNetworkClaim/Form/instructions.tmpl.html";
                return templateUrl;
            };
            Theme.prototype.getNetworkAdequacyInstructionsTemplateUrl = function () {
                var templateUrl = this.templateBaseUrl + "/networkAdequacyInstructions.tmpl.html";
                if (!this.$templateCache.get(templateUrl))
                    templateUrl = "App/OutOfNetworkClaim/Form/networkAdequacyInstructions.tmpl.html";
                return templateUrl;
            };
            Theme.prototype.getSubmissionSuccessTemplateUrl = function () {
                var templateUrl = this.templateBaseUrl + "/formSuccess.tmpl.html";
                if (!this.$templateCache.get(templateUrl))
                    templateUrl = "App/OutOfNetworkClaim/Form/formSuccess.tmpl.html";
                return templateUrl;
            };
            Theme.$inject = [
                "appConfig", "$templateCache"
            ];
            return Theme;
        }());
        OutOfNetworkClaim.Theme = Theme;
        angular
            .module("MemberForms.OutOfNetworkClaim")
            .service("theme", Theme);
    })(OutOfNetworkClaim = MemberForms.OutOfNetworkClaim || (MemberForms.OutOfNetworkClaim = {}));
})(MemberForms || (MemberForms = {}));
var MemberForms;
(function (MemberForms) {
    var OutOfNetworkClaim;
    (function (OutOfNetworkClaim) {
        "use strict";
        var FormController = /** @class */ (function () {
            function FormController($http, $state, $uibModal, formState, countries, theme) {
                this.$http = $http;
                this.$state = $state;
                this.$uibModal = $uibModal;
                this.formState = formState;
                this.countries = countries;
                this.theme = theme;
                this.birthDate = {
                    month: null,
                    day: null,
                    year: null,
                };
                this.memberIdCardUrl = this.theme.memberIdCardUrl;
                this.init();
            }
            FormController.prototype.$onInit = function () { };
            ;
            FormController.prototype.init = function () {
                if (this.formState.form.subscriber.birthDate) {
                    this.birthDate.year = this.formState.form.subscriber.birthDate.getFullYear();
                    this.birthDate.month = ("0" + (this.formState.form.subscriber.birthDate.getMonth() + 1)).substr(-2); //zero padd, get last 2 chars
                    this.birthDate.day = ("0" + this.formState.form.subscriber.birthDate.getDate()).substr(-2); //zero padd, get last 2 chars
                }
            };
            FormController.prototype.addPatient = function () {
                this.editPatient(this.formState.form.patients.length);
            };
            FormController.prototype.editPatient = function (index) {
                this.$state.go("patientForm", { index: index });
            };
            FormController.prototype.removePatient = function (index) {
                this.formState.removePatient(index);
            };
            ;
            FormController.prototype.iDontKnowMyMemberIDChange = function () {
                if (this.formState.form.subscriber.iDontKnowMyMemberID === true) {
                    this.formState.form.subscriber.memberID = null;
                }
            };
            FormController.prototype.submit = function (form) {
                var _this = this;
                this.formState.errorMessage = null;
                if (form.$invalid === true) {
                    return;
                }
                this.formState.submit()
                    .then(function () {
                    _this.$state.go("form.success");
                });
            };
            FormController.prototype.birthDateChange = function () {
                this.formState.form.subscriber.birthDate = null;
                if (this.birthDate.month && this.birthDate.day && this.birthDate.year) {
                    var month = Number(this.birthDate.month) - 1;
                    this.formState.form.subscriber.birthDate = new Date(this.birthDate.year, month, this.birthDate.day);
                }
            };
            FormController.prototype.openNetworkAdequacy = function () {
                var _this = this;
                var form = new OutOfNetworkClaim.NetworkAdequacyForm();
                form.unableToLocate = this.formState.form.networkAdequacyUnableToLocate;
                form.unableToLocateArea = this.formState.form.networkAdequacyUnableToLocateArea;
                form.providerName = this.formState.form.networkAdequacyUnableToScheduleProviderName;
                form.providerLocation = this.formState.form.networkAdequacyUnableToScheduleProviderLocation;
                form.providerPhone = this.formState.form.networkAdequacyUnableToScheduleProviderPhone;
                form.postalCode = this.formState.form.networkAdequacyUnableToLocatePostalCode;
                form.unableToSchedule = this.formState.form.networkAdequacyUnableToSchedule;
                OutOfNetworkClaim.NetworkAdequacyController
                    .open(this.$uibModal, form)
                    .then(function (fd) {
                    _this.saveNetworkAdequacy(fd);
                }, function () {
                    // Do nothing here
                });
            };
            FormController.prototype.saveNetworkAdequacy = function (fd) {
                this.formState.form.networkAdequacyUnableToLocate = fd.unableToLocate;
                this.formState.form.networkAdequacyUnableToLocateArea = fd.unableToLocateArea;
                this.formState.form.networkAdequacyUnableToScheduleProviderName = fd.providerName;
                this.formState.form.networkAdequacyUnableToScheduleProviderLocation = fd.providerLocation;
                this.formState.form.networkAdequacyUnableToScheduleProviderPhone = fd.providerPhone;
                this.formState.form.networkAdequacyUnableToLocatePostalCode = fd.postalCode;
                this.formState.form.networkAdequacyUnableToSchedule = fd.unableToSchedule;
            };
            FormController.$inject = ["$http", "$state", "$uibModal", "formState", "countries", "theme"];
            return FormController;
        }());
        angular
            .module("MemberForms.OutOfNetworkClaim")
            .controller("FormController", FormController);
    })(OutOfNetworkClaim = MemberForms.OutOfNetworkClaim || (MemberForms.OutOfNetworkClaim = {}));
})(MemberForms || (MemberForms = {}));
var MemberForms;
(function (MemberForms) {
    var OutOfNetworkClaim;
    (function (OutOfNetworkClaim) {
        var Form = /** @class */ (function () {
            function Form() {
                this.subscriber = new OutOfNetworkClaim.Subscriber();
                this.patients = new Array();
            }
            return Form;
        }());
        OutOfNetworkClaim.Form = Form;
        var FormState = /** @class */ (function () {
            function FormState($log, $http, $q, appConfig) {
                this.$log = $log;
                this.$http = $http;
                this.$q = $q;
                this.appConfig = appConfig;
                this.errorMessage = null;
                this.dateOptions = {
                    months: ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"],
                    days: ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"],
                    years: this.createYearOptions() //1920 thru current year.
                };
                this.isSaving = false;
                this.form = new Form();
                this.form.claimRequestId = this.appConfig.claimRequest.id.value;
            }
            FormState.prototype.$onInit = function () { };
            ;
            FormState.prototype.submit = function () {
                var _this = this;
                var formData = angular.copy(this.form);
                this.isSaving = true;
                this.form.claimRequestId = this.appConfig.claimRequest.id.value;
                this.errorMessage = null;
                // send dates as plain string values, date part only w/o time and timezone to ensure 
                // timezone, offsets and UTC conversions are not applied during http call.
                formData.subscriber.birthDate = FormState.createDateStringForHttp(formData.subscriber.birthDate);
                for (var _i = 0, _a = formData.patients; _i < _a.length; _i++) {
                    var patient = _a[_i];
                    patient.birthDate = FormState.createDateStringForHttp(patient.birthDate);
                    patient.dateOfService = FormState.createDateStringForHttp(patient.dateOfService);
                }
                return this.$http
                    .post(this.appConfig.baseUrl + "/api/out-of-network-claim/claim-form", formData)
                    .catch(function (error) {
                    _this.errorMessage = (error && error.data && error.data.message)
                        ? error.data.message
                        : (error && error.statusText)
                            ? (error.statusText)
                            : "An error occurred.";
                    _this.$log.error(error);
                    return _this.$q.reject(error);
                })
                    .finally(function () {
                    _this.isSaving = false;
                });
            };
            FormState.createDateStringForHttp = function (date) {
                if (!date)
                    return null;
                var dateString = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
                return dateString;
            };
            FormState.prototype.savePatient = function (index, patient) {
                //don't let any gaps int the array indexes...just keeping it clean.
                if (index > this.form.patients.length) {
                    index = this.form.patients.length;
                }
                if (this.form.patients[index])
                    angular.copy(patient, this.form.patients[index]);
                else
                    this.form.patients[index] = patient;
                this.form.patients[index].updateTotalPaid();
                this.form.patients[index].updateDisplayAmounts();
                this.errorMessage = null;
            };
            FormState.prototype.removePatient = function (index) {
                this.form.patients.splice(index, 1);
            };
            FormState.prototype.createYearOptions = function () {
                var years = [];
                for (var x = 1930; x <= new Date().getFullYear(); x++) {
                    years.unshift(x);
                }
                return years;
            };
            FormState.$inject = ["$log", "$http", "$q", "appConfig"];
            return FormState;
        }());
        OutOfNetworkClaim.FormState = FormState;
        angular
            .module("MemberForms.OutOfNetworkClaim")
            .service("formState", FormState);
    })(OutOfNetworkClaim = MemberForms.OutOfNetworkClaim || (MemberForms.OutOfNetworkClaim = {}));
})(MemberForms || (MemberForms = {}));
var MemberForms;
(function (MemberForms) {
    var OutOfNetworkClaim;
    (function (OutOfNetworkClaim) {
        "use strict";
        var NetworkAdequacyController = /** @class */ (function () {
            function NetworkAdequacyController($scope, $uibModalInstance, form, theme) {
                this.$scope = $scope;
                this.$uibModalInstance = $uibModalInstance;
                this.form = form;
                this.theme = theme;
                this.networkAdequacyInstructionsTemplateUrl = theme.getNetworkAdequacyInstructionsTemplateUrl();
            }
            NetworkAdequacyController.prototype.$onInit = function () {
            };
            ;
            NetworkAdequacyController.prototype.save = function (form) {
                if (form.$invalid === true) {
                    return;
                }
                this.$uibModalInstance.close(this.form);
            };
            NetworkAdequacyController.prototype.dismiss = function () {
                this.$uibModalInstance.dismiss();
            };
            NetworkAdequacyController.prototype.networkAdequacySelectionChanged = function () {
                if (!this.form.unableToSchedule) {
                    this.form.providerName = "";
                    ;
                    this.form.providerPhone = "";
                    this.form.providerLocation = "";
                }
                if (!this.form.unableToLocate) {
                    this.form.postalCode = "";
                    this.form.unableToLocateArea = "";
                }
            };
            NetworkAdequacyController.open = function (uibModal, form) {
                var modalInstance = uibModal.open({
                    templateUrl: "App/OutOfNetworkClaim/Form/networkAdequacy.tmpl.html",
                    size: "lg",
                    backdrop: "static",
                    controllerAs: "vm",
                    controller: NetworkAdequacyController,
                    resolve: {
                        form: function () { return form; }
                    }
                });
                return modalInstance.result;
            };
            NetworkAdequacyController.$inject = ["$scope", "$uibModalInstance", "form", "theme"];
            return NetworkAdequacyController;
        }());
        OutOfNetworkClaim.NetworkAdequacyController = NetworkAdequacyController;
    })(OutOfNetworkClaim = MemberForms.OutOfNetworkClaim || (MemberForms.OutOfNetworkClaim = {}));
})(MemberForms || (MemberForms = {}));
var MemberForms;
(function (MemberForms) {
    var OutOfNetworkClaim;
    (function (OutOfNetworkClaim) {
        "use strict";
        var NetworkAdequacyForm = /** @class */ (function () {
            function NetworkAdequacyForm() {
            }
            return NetworkAdequacyForm;
        }());
        OutOfNetworkClaim.NetworkAdequacyForm = NetworkAdequacyForm;
    })(OutOfNetworkClaim = MemberForms.OutOfNetworkClaim || (MemberForms.OutOfNetworkClaim = {}));
})(MemberForms || (MemberForms = {}));
var MemberForms;
(function (MemberForms) {
    var OutOfNetworkClaim;
    (function (OutOfNetworkClaim) {
        var Patient = /** @class */ (function () {
            function Patient() {
                this.totalPaid = 0;
                this.receipts = [];
                this.id = new Date().valueOf().toString();
                this.country = "US";
            }
            Patient.prototype.updateTotalPaid = function () {
                var total = 0;
                total += this.toNumberOrZero(this.examAmount);
                total += this.toNumberOrZero(this.refractionAmount);
                total += this.toNumberOrZero(this.frameAmount);
                total += this.toNumberOrZero(this.contactLensAmount);
                total += this.toNumberOrZero(this.contactLensFittingAmount);
                total += this.toNumberOrZero(this.lensesAmount);
                total += this.toNumberOrZero(this.lensAntiReflectiveAmount);
                total += this.toNumberOrZero(this.lensPolycarbonateAmount);
                total += this.toNumberOrZero(this.lensScratchAmount);
                total += this.toNumberOrZero(this.lensTintAmount);
                total += this.toNumberOrZero(this.lensUVAmount);
                total += this.toNumberOrZero(this.lensRollAndPolishAmount);
                total += this.toNumberOrZero(this.protectionWarrantyAmount);
                total += this.toNumberOrZero(this.taxShippingProcessingAmount);
                total += this.toNumberOrZero(this.otherAmount);
                this.totalPaid = total;
            };
            Patient.prototype.updateDisplayAmounts = function () {
                var list = [];
                this.addDisplayAmountIfOk(this.examAmount, "Exam", false, list);
                this.addDisplayAmountIfOk(this.refractionAmount, "Refraction", false, list);
                this.addDisplayAmountIfOk(this.frameAmount, "Frame", false, list);
                this.addDisplayAmountIfOk(this.contactLensAmount, "Contact Lens", false, list);
                this.addDisplayAmountIfOk(this.contactLensFittingAmount, "Contact Lens Fitting", false, list);
                //insert lens type
                if (this.lensesAmount > 0) {
                    this.addDisplayAmountIfOk(this.lensesAmount, "Lenses - " + this.lensType, false, list);
                    this.addLensOptionDisplayAmountIfOk(this.lensAntiReflectiveAmountEnabled, this.lensAntiReflectiveAmount, "Anti Reflective", true, list);
                    this.addLensOptionDisplayAmountIfOk(this.lensPolycarbonateAmountEnabled, this.lensPolycarbonateAmount, "Polycarbonate", true, list);
                    this.addLensOptionDisplayAmountIfOk(this.lensScratchAmountEnabled, this.lensScratchAmount, "Scratch", true, list);
                    this.addLensOptionDisplayAmountIfOk(this.lensTintAmountEnabled, this.lensTintAmount, "Tint", true, list);
                    this.addLensOptionDisplayAmountIfOk(this.lensUVAmountEnabled, this.lensUVAmount, "UV", true, list);
                    this.addLensOptionDisplayAmountIfOk(this.lensRollAndPolishAmountEnabled, this.lensRollAndPolishAmount, "Roll & Polish", true, list);
                }
                this.addDisplayAmountIfOk(this.protectionWarrantyAmount, "Protection/Warranty", false, list);
                this.addDisplayAmountIfOk(this.taxShippingProcessingAmount, "Tax, Shipping, Processing Fees", false, list);
                this.addDisplayAmountIfOk(this.otherAmount, "Other", false, list);
                this.displayAmounts = list;
            };
            Patient.prototype.addLensOptionDisplayAmountIfOk = function (amountEnabled, amount, label, indent, list) {
                if (amountEnabled) {
                    list.push({
                        label: label,
                        amount: amount,
                        indent: indent
                    });
                }
            };
            Patient.prototype.addDisplayAmountIfOk = function (amount, label, indent, list) {
                if (amount > 0) {
                    list.push({
                        label: label,
                        amount: amount,
                        indent: indent
                    });
                }
            };
            Patient.prototype.toNumberOrZero = function (val) {
                return (!val || isNaN(Number(val)))
                    ? 0
                    : Number(val);
            };
            Patient.prototype.initEnableAmountsFromValues = function () {
                this.examAmountEnabled = (this.examAmount > 0);
                this.refractionAmountEnabled = (this.refractionAmount > 0);
                this.frameAmountEnabled = (this.frameAmount > 0);
                this.contactLensAmountEnabled = (this.contactLensAmount > 0);
                this.contactLensFittingAmountEnabled = (this.contactLensFittingAmount > 0);
                this.lensesAmountEnabled = (this.lensesAmount > 0);
                this.protectionWarrantyAmountEnabled = (this.protectionWarrantyAmount > 0);
                this.taxShippingProcessingAmountEnabled = (this.taxShippingProcessingAmount > 0);
                this.otherAmountEnabled = (this.otherAmount > 0);
                if (this.examAmount <= 0)
                    this.examAmount = null;
                if (this.refractionAmount <= 0)
                    this.refractionAmount = null;
                if (this.frameAmount <= 0)
                    this.frameAmount = null;
                if (this.contactLensAmount <= 0)
                    this.contactLensAmount = null;
                if (this.contactLensFittingAmount <= 0)
                    this.contactLensFittingAmount = null;
                if (this.lensesAmount <= 0) {
                    this.lensesAmount = null;
                    this.lensType = null;
                }
                if (this.lensAntiReflectiveAmount <= 0)
                    this.lensAntiReflectiveAmount = null;
                if (this.lensPolycarbonateAmount <= 0)
                    this.lensPolycarbonateAmount = null;
                if (this.lensScratchAmount <= 0)
                    this.lensScratchAmount = null;
                if (this.lensTintAmount <= 0)
                    this.lensTintAmount = null;
                if (this.lensUVAmount <= 0)
                    this.lensUVAmount = null;
                if (this.lensRollAndPolishAmount <= 0)
                    this.lensRollAndPolishAmount = null;
                if (this.protectionWarrantyAmount <= 0)
                    this.protectionWarrantyAmount = null;
                if (this.taxShippingProcessingAmount <= 0)
                    this.taxShippingProcessingAmount = null;
                if (this.otherAmount <= 0)
                    this.otherAmount = null;
            };
            return Patient;
        }());
        OutOfNetworkClaim.Patient = Patient;
    })(OutOfNetworkClaim = MemberForms.OutOfNetworkClaim || (MemberForms.OutOfNetworkClaim = {}));
})(MemberForms || (MemberForms = {}));
var MemberForms;
(function (MemberForms) {
    var OutOfNetworkClaim;
    (function (OutOfNetworkClaim) {
        "use strict";
        var PatientFormController = /** @class */ (function () {
            function PatientFormController($log, $http, $state, $uibModal, $stateParams, formState, $window, appConfig, countries) {
                this.$log = $log;
                this.$http = $http;
                this.$state = $state;
                this.$uibModal = $uibModal;
                this.$stateParams = $stateParams;
                this.formState = formState;
                this.$window = $window;
                this.appConfig = appConfig;
                this.countries = countries;
                this.patientIndex = null;
                this.patient = null;
                this.errorMessage = null;
                this.addAnotherPatient = false;
                this.receiptToUpload = null;
                this.isReceiptUploading = false;
                this.receiptErrorMessage = null;
                this.currentDate = new Date();
                this.birthDate = {
                    month: null,
                    day: null,
                    year: null,
                };
                this.dateOfService = {
                    month: null,
                    day: null,
                    year: null,
                };
                this.patientIndex = Number(this.$stateParams.index);
                this.baseClaimFormReceiptUrl = this.appConfig.baseUrl + "/api/out-of-network-claim/claim-form-receipt";
                this.init();
            }
            PatientFormController.prototype.$onInit = function () { };
            ;
            PatientFormController.prototype.init = function () {
                if (isNaN(this.patientIndex)) {
                    this.backToForm();
                }
                this.validExtensions = angular.isArray(this.appConfig.claim.validReceiptExtensions)
                    ? this.appConfig.claim.validReceiptExtensions
                    : [];
                // ensure they are all lower case entries.
                this.validExtensions = this.validExtensions.join(",").toLowerCase().split(",");
                //just go back if they are trying to access to far into the array.
                if (this.$stateParams.index > this.formState.form.patients.length) {
                    this.backToForm();
                }
                this.patient = new OutOfNetworkClaim.Patient();
                // set values if the patient is already in the list and not null/undefined.
                if (this.formState.form.patients[this.patientIndex]) {
                    angular.copy(this.formState.form.patients[this.patientIndex], this.patient);
                }
                this.patient.initEnableAmountsFromValues();
                this.setDateControls();
                this.patient.updateTotalPaid();
                this.$window.scrollTo(0, 0);
            };
            PatientFormController.prototype.openReceiptDialog = function (receipt) {
                var claimReceiptId = receipt.id;
                var claimRequestId = this.formState.form.claimRequestId;
                var receiptUrl = this.baseClaimFormReceiptUrl + "/" + claimRequestId + "/" + claimReceiptId;
                this.$window.open(receiptUrl, '_blank');
            };
            PatientFormController.prototype.copySubscriberInfo = function () {
                this.patient.firstName = this.formState.form.subscriber.firstName;
                this.patient.lastName = this.formState.form.subscriber.lastName;
                this.patient.middleInitial = this.formState.form.subscriber.middleInitial;
                this.patient.address = this.formState.form.subscriber.address;
                this.patient.city = this.formState.form.subscriber.city;
                this.patient.state = this.formState.form.subscriber.state;
                this.patient.country = this.formState.form.subscriber.country;
                this.patient.postalCode = this.formState.form.subscriber.postalCode;
                this.patient.memberID = this.formState.form.subscriber.memberID;
                this.patient.birthDate = this.formState.form.subscriber.birthDate;
                this.patient.relationshipToSubscriber = "Self";
                this.setDateControls();
            };
            PatientFormController.prototype.setDateControls = function () {
                if (this.patient.birthDate) {
                    this.birthDate.year = this.patient.birthDate.getFullYear();
                    this.birthDate.month = ("0" + (this.patient.birthDate.getMonth() + 1)).substr(-2); //zero padd, get last 2 chars
                    this.birthDate.day = ("0" + this.patient.birthDate.getDate()).substr(-2); //zero padd, get last 2 chars
                }
                if (this.patient.dateOfService) {
                    this.dateOfService.year = this.patient.dateOfService.getFullYear();
                    this.dateOfService.month = ("0" + (this.patient.dateOfService.getMonth() + 1)).substr(-2); //zero padd, get last 2 chars
                    this.dateOfService.day = ("0" + this.patient.dateOfService.getDate()).substr(-2); //zero padd, get last 2 chars
                }
            };
            PatientFormController.prototype.backToForm = function () {
                this.$state.go("form");
            };
            PatientFormController.prototype.savePatient = function (form) {
                this.errorMessage = null;
                if (form.$invalid === true) {
                    return;
                }
                try {
                    this.patient.updateTotalPaid();
                    this.formState.savePatient(this.patientIndex, this.patient);
                    if (this.addAnotherPatient)
                        this.$state.go("patientForm", { index: this.formState.form.patients.length });
                    else
                        this.$state.go("form");
                }
                finally {
                    this.addAnotherPatient = false;
                }
            };
            PatientFormController.prototype.enableAmountChecked = function () {
                if (!this.patient.examAmountEnabled)
                    this.patient.examAmount = null;
                if (!this.patient.refractionAmountEnabled)
                    this.patient.refractionAmount = null;
                if (!this.patient.contactLensFittingAmountEnabled)
                    this.patient.contactLensFittingAmount = null;
                if (!this.patient.contactLensAmountEnabled)
                    this.patient.contactLensAmount = null;
                if (!this.patient.frameAmountEnabled)
                    this.patient.frameAmount = null;
                if (!this.patient.protectionWarrantyAmountEnabled)
                    this.patient.protectionWarrantyAmount = null;
                if (!this.patient.taxShippingProcessingAmountEnabled)
                    this.patient.taxShippingProcessingAmount = null;
                if (!this.patient.lensesAmountEnabled) {
                    this.patient.lensType = null;
                    this.patient.lensesAmount = null;
                    this.patient.lensAntiReflectiveAmount = null;
                    this.patient.lensPolycarbonateAmount = null;
                    this.patient.lensScratchAmount = null;
                    this.patient.lensTintAmount = null;
                    this.patient.lensUVAmount = null;
                    this.patient.lensRollAndPolishAmount = null;
                    this.patient.lensAntiReflectiveAmountEnabled = false;
                    this.patient.lensPolycarbonateAmountEnabled = false;
                    this.patient.lensScratchAmountEnabled = false;
                    this.patient.lensTintAmountEnabled = false;
                    this.patient.lensUVAmountEnabled = false;
                    this.patient.lensRollAndPolishAmountEnabled = false;
                }
                else {
                    if (!this.patient.lensAntiReflectiveAmountEnabled)
                        this.patient.lensAntiReflectiveAmount = null;
                    if (!this.patient.lensPolycarbonateAmountEnabled)
                        this.patient.lensPolycarbonateAmount = null;
                    if (!this.patient.lensScratchAmountEnabled)
                        this.patient.lensScratchAmount = null;
                    if (!this.patient.lensTintAmountEnabled)
                        this.patient.lensTintAmount = null;
                    if (!this.patient.lensUVAmountEnabled)
                        this.patient.lensUVAmount = null;
                    if (!this.patient.lensRollAndPolishAmountEnabled)
                        this.patient.lensRollAndPolishAmount = null;
                }
                if (!this.patient.otherAmountEnabled) {
                    this.patient.otherAmount = null;
                    this.patient.otherAmountDescription = null;
                }
                this.patient.updateTotalPaid();
            };
            PatientFormController.prototype.amountChanged = function () {
                this.patient.updateTotalPaid();
            };
            PatientFormController.prototype.birthDateChange = function () {
                this.patient.birthDate = null;
                if (this.birthDate.month && this.birthDate.day && this.birthDate.year) {
                    var month = Number(this.birthDate.month) - 1;
                    this.patient.birthDate = new Date(this.birthDate.year, month, this.birthDate.day);
                }
            };
            PatientFormController.prototype.dateOfServiceChange = function () {
                this.patient.dateOfService = null;
                if (this.dateOfService.month && this.dateOfService.day && this.dateOfService.year) {
                    var month = Number(this.dateOfService.month) - 1;
                    this.patient.dateOfService = new Date(this.dateOfService.year, month, this.dateOfService.day);
                }
            };
            PatientFormController.prototype.receiptToUploadChanged = function () {
                this.receiptErrorMessage = null;
                // no file selected
                if (!this.receiptToUpload)
                    return;
                // valid extension check
                var extension = this.receiptToUpload.name.split(".").pop().toLowerCase();
                var extensionIsValid = this.validExtensions.indexOf(extension) !== -1;
                if (!extensionIsValid) {
                    this.receiptErrorMessage = "The file you selected is not valid.  The following file formats are supported: " + this.validExtensions.join(", ");
                    this.isReceiptUploading = false;
                    return;
                }
                // fize size check. (in try catch in case some browsers don't let us access the file size on 
                // the client... then it'll just upload. and the server will catch the issue.
                try {
                    var sizeInMb = this.receiptToUpload.size / 1024 / 1024;
                    if (sizeInMb > 10) {
                        this.receiptErrorMessage = "The file you selected is too large. It must be smaller than 10 MB.";
                        this.isReceiptUploading = false;
                        return;
                    }
                }
                catch (e) { }
                ;
                this.isReceiptUploading = true;
                var vm = this;
                var formData = new FormData();
                formData.append("ClaimRequestId", this.formState.form.claimRequestId);
                formData.append("PatientId", this.patient.id);
                formData.append("File", this.receiptToUpload);
                this.$http
                    .post(this.baseClaimFormReceiptUrl, formData, {
                    transformRequest: angular.identity,
                    headers: { 'Content-type': undefined }
                })
                    .then(function (response) {
                    vm.patient.receipts = response.data;
                })
                    .catch(function (error) {
                    vm.receiptErrorMessage = (error && error.data && error.data.message)
                        ? error.data.message
                        : (error && error.statusText)
                            ? (error.statusText)
                            : "An error occurred.";
                })
                    .finally(function () {
                    vm.isReceiptUploading = false;
                });
            };
            PatientFormController.prototype.removeReceipt = function (receipt) {
                var vm = this, patientId = this.patient.id, claimRequestId = this.formState.form.claimRequestId;
                receipt.isRemoving = true;
                this.$http
                    .delete(this.baseClaimFormReceiptUrl + "/" + claimRequestId + "/" + receipt.id + "?patientId=" + patientId)
                    .then(function (response) {
                    vm.patient.receipts = response.data;
                })
                    .catch(function (error) {
                    vm.receiptErrorMessage = (error && error.data && error.data.message)
                        ? error.data.message
                        : (error && error.statusText)
                            ? (error.statusText)
                            : "An error occurred.";
                });
            };
            PatientFormController.$inject = ["$log", "$http", "$state", "$uibModal", "$stateParams", "formState", "$window", "appConfig", "countries"];
            return PatientFormController;
        }());
        angular
            .module("MemberForms.OutOfNetworkClaim")
            .directive('fileInput', ['$parse', function ($parse) {
                return {
                    restrict: 'A',
                    link: function (scope, element, attributes) {
                        element.bind('change', function () {
                            $parse(attributes.fileInput)
                                .assign(scope, element[0].files[0]);
                            var changedFunc = scope.$eval(attributes.fileInputChanged);
                            if (changedFunc)
                                changedFunc();
                            scope.$apply();
                        });
                    }
                };
            }]);
        angular
            .module("MemberForms.OutOfNetworkClaim")
            .controller("PatientFormController", PatientFormController);
    })(OutOfNetworkClaim = MemberForms.OutOfNetworkClaim || (MemberForms.OutOfNetworkClaim = {}));
})(MemberForms || (MemberForms = {}));
var MemberForms;
(function (MemberForms) {
    var OutOfNetworkClaim;
    (function (OutOfNetworkClaim) {
        var Subscriber = /** @class */ (function () {
            function Subscriber() {
                this.country = "US";
            }
            return Subscriber;
        }());
        OutOfNetworkClaim.Subscriber = Subscriber;
    })(OutOfNetworkClaim = MemberForms.OutOfNetworkClaim || (MemberForms.OutOfNetworkClaim = {}));
})(MemberForms || (MemberForms = {}));
var MemberForms;
(function (MemberForms) {
    var OutOfNetworkClaim;
    (function (OutOfNetworkClaim) {
        "use strict";
        var FormRequestController = /** @class */ (function () {
            function FormRequestController($log, $http, $state, vcRecaptchaService, appConfig) {
                this.$log = $log;
                this.$http = $http;
                this.$state = $state;
                this.vcRecaptchaService = vcRecaptchaService;
                this.appConfig = appConfig;
                this.email = null;
                this.emailPattern = new RegExp(this.appConfig.claimRequest.emailPattern, "i");
                this.expiresAfterDescription = this.appConfig.claimRequest.expiresAfterDescription;
                this.pdfFormUrl = this.appConfig.claim.pdfFormUrl;
                this.isWorking = false;
                this.recaptchaKey = this.appConfig.captcha.siteKey;
                this.title = (appConfig.claimRequest.id.invalidReason)
                    ? "There's something wrong with the claim link you're using.  Request a new one below."
                    : "Let's get started!";
            }
            FormRequestController.prototype.$onInit = function () { };
            ;
            FormRequestController.prototype.setRecaptchaResponse = function (response, widgetId) {
                var _this = this;
                this.isWorking = true;
                this.vcRecaptchaService.reload(widgetId);
                this.errorMessage = "";
                this.$http
                    .post(this.appConfig.baseUrl + "/api/out-of-network-claim/claim-request", {
                    email: this.email,
                    recaptchaResponse: response,
                    themeName: this.appConfig.theme.name
                })
                    .then(function () {
                    _this.$state.go("claimRequest.success");
                })
                    .catch(function (error) {
                    if (error.status == 400)
                        _this.errorMessage = "We weren't able to complete your request. " + error.data.message;
                    else
                        _this.errorMessage = "We weren't able to complete your request at this time. Please try again later.";
                })
                    .finally(function () {
                    _this.isWorking = false;
                });
            };
            FormRequestController.prototype.submitForm = function (form) {
                this.vcRecaptchaService.execute();
            };
            FormRequestController.$inject = ["$log", "$http", "$state", "vcRecaptchaService", "appConfig"];
            return FormRequestController;
        }());
        angular
            .module("MemberForms.OutOfNetworkClaim")
            .controller("ClaimRequestController", FormRequestController);
    })(OutOfNetworkClaim = MemberForms.OutOfNetworkClaim || (MemberForms.OutOfNetworkClaim = {}));
})(MemberForms || (MemberForms = {}));
var MemberForms;
(function (MemberForms) {
    var OutOfNetworkClaim;
    (function (OutOfNetworkClaim) {
        "use strict";
        var FormRequestSuccessController = /** @class */ (function () {
            function FormRequestSuccessController(appConfig) {
                this.appConfig = appConfig;
                this.fromEmail = this.appConfig.claimRequest.fromEmail;
            }
            FormRequestSuccessController.prototype.$onInit = function () { };
            ;
            FormRequestSuccessController.$inject = ["appConfig"];
            return FormRequestSuccessController;
        }());
        angular
            .module("MemberForms.OutOfNetworkClaim")
            .controller("FormRequestSuccessController", FormRequestSuccessController);
    })(OutOfNetworkClaim = MemberForms.OutOfNetworkClaim || (MemberForms.OutOfNetworkClaim = {}));
})(MemberForms || (MemberForms = {}));