/* Minification failed. Returning unminified contents.
(5085,63-64): run-time error JS1014: Invalid character: `
(5085,66-67): run-time error JS1004: Expected ';': {
(5085,69-70): run-time error JS1014: Invalid character: `
(5086,70-71): run-time error JS1014: Invalid character: `
(5086,73-74): run-time error JS1004: Expected ';': {
(5086,76-77): run-time error JS1014: Invalid character: `
(5088,38-39): run-time error JS1014: Invalid character: `
(5088,50-51): run-time error JS1193: Expected ',' or ')': {
(5088,59-60): run-time error JS1195: Expected expression: ,
(5088,62-63): run-time error JS1003: Expected ':': {
(5088,70-71): run-time error JS1003: Expected ':': }
(5088,71-72): run-time error JS1100: Expected ',': )
(5088,72-73): run-time error JS1014: Invalid character: `
(5090,7-8): run-time error JS1002: Syntax error: }
(5097,25-26): run-time error JS1195: Expected expression: )
(5097,27-28): run-time error JS1004: Expected ';': {
(5132,6-7): run-time error JS1195: Expected expression: ,
(5134,25-26): run-time error JS1195: Expected expression: )
(5134,27-28): run-time error JS1004: Expected ';': {
(5139,6-7): run-time error JS1195: Expected expression: ,
(5142,43-44): run-time error JS1004: Expected ';': {
(5168,6-7): run-time error JS1195: Expected expression: ,
(5172,34-35): run-time error JS1195: Expected expression: )
(5172,36-37): run-time error JS1004: Expected ';': {
(5271,1-2): run-time error JS1002: Syntax error: }
(5275,13-14): run-time error JS1004: Expected ';': {
(5270,3-18): run-time error JS1018: 'return' statement outside of function: return Toastify
(5231,5-16): run-time error JS1018: 'return' statement outside of function: return this
(5131,7-18): run-time error JS1018: 'return' statement outside of function: return this
 */
/**
 * Checklist-model
 * AngularJS directive for list of checkboxes
 * https://github.com/vitalets/checklist-model
 * License: MIT http://opensource.org/licenses/MIT
 */

angular.module('checklist-model', [])
.directive('checklistModel', ['$parse', '$compile', checklistModelDirective]);

checklistModelDirective.$inject = ["$parse", "$compile"];

function checklistModelDirective ($parse, $compile) {
    // contains
    function contains(arr, item, comparator) {
        if (angular.isArray(arr)) {
            for (var i = arr.length; i--;) {
                if (comparator(arr[i], item)) {
                    return true;
                }
            }
        }
        return false;
    }

    // add
    function add(arr, item, comparator) {
        arr = angular.isArray(arr) ? arr : [];
        if (!contains(arr, item, comparator)) {
            arr.push(item);
        }
        return arr;
    }

    // remove
    function remove(arr, item, comparator) {
        if (angular.isArray(arr)) {
            for (var i = arr.length; i--;) {
                if (comparator(arr[i], item)) {
                    arr.splice(i, 1);
                    break;
                }
            }
        }
        return arr;
    }

    // http://stackoverflow.com/a/19228302/1458162
    function postLinkFn(scope, elem, attrs) {
        // exclude recursion, but still keep the model
        var checklistModel = attrs.checklistModel;
        attrs.$set("checklistModel", null);
        // compile with `ng-model` pointing to `checked`
        $compile(elem)(scope);
        attrs.$set("checklistModel", checklistModel);

        // getter / setter for original model
        var getter = $parse(checklistModel);
        var setter = getter.assign;
        var checklistChange = $parse(attrs.checklistChange);

        // value added to list
        var value = attrs.checklistValue ? $parse(attrs.checklistValue)(scope.$parent) : attrs.value;


        var comparator = angular.equals;

        if (attrs.hasOwnProperty('checklistComparator')) {
            if (attrs.checklistComparator[0] == '.') {
                var comparatorExpression = attrs.checklistComparator.substring(1);
                comparator = function (a, b) {
                    return a[comparatorExpression] === b[comparatorExpression];
                }

            } else {
                comparator = $parse(attrs.checklistComparator)(scope.$parent);
            }
        }

        // watch UI checked change
        scope.$watch(attrs.ngModel, function (newValue, oldValue) {
            if (newValue === oldValue) {
                return;
            }
            var current = getter(scope.$parent);
            if (angular.isFunction(setter)) {
                if (newValue === true) {
                    setter(scope.$parent, add(current, value, comparator));
                } else {
                    setter(scope.$parent, remove(current, value, comparator));
                }
            }

            if (checklistChange) {
                checklistChange(scope);
            }
        });

        // declare one function to be used for both $watch functions
        function setChecked(newArr, oldArr) {
            scope[attrs.ngModel] = contains(newArr, value, comparator);
        }

        // watch original model change
        // use the faster $watchCollection method if it's available
        if (angular.isFunction(scope.$parent.$watchCollection)) {
            scope.$parent.$watchCollection(checklistModel, setChecked);
        } else {
            scope.$parent.$watch(checklistModel, setChecked, true);
        }
    }

    return {
        restrict: 'A',
        priority: 1000,
        terminal: true,
        scope: true,
        compile: function (tElement, tAttrs) {
            if ((tElement[0].tagName !== 'INPUT' || tAttrs.type !== 'checkbox')
                && (tElement[0].tagName !== 'MD-CHECKBOX')
                && (!tAttrs.btnCheckbox)) {
                throw 'checklist-model should be applied to `input[type="checkbox"]` or `md-checkbox`.';
            }

            if (!tAttrs.checklistValue && !tAttrs.value) {
                throw 'You should provide `value` or `checklist-value`.';
            }

            // by default ngModel is 'checked', so we set it if not specified
            if (!tAttrs.ngModel) {
                // local scope var storing individual checkbox model
                tAttrs.$set("ngModel", "checked");
            }

            return postLinkFn;
        }
    };
};;

var shoppingCartApp = angular.module("shoppingCartApp", ["checklist-model"]);

shoppingCartApp.run(shoppingCartAppFunc);

shoppingCartAppFunc.$inject = ["$rootScope"];

function shoppingCartAppFunc ($rootScope) {
    $rootScope.$on("$routeChangeStart", function (event, next, current) {
        if (localStorage.restorestate == "true") {
            $rootScope.$broadcast('restorestate'); //let everything know we need to restore state
            localStorage.restorestate = false;
        }
    });

    //let everthing know that we need to save state now.
    window.onbeforeunload = function (event) {
        $rootScope.$broadcast('savestate');
    };
};
/// <reference path="angular.min.js" />

shoppingCartApp.controller("ShoppingCartCtrl", ShoppingCartCtrl);
ShoppingCartCtrl.$inject = ["$scope", "$rootScope","shoppingCartService", "$http", "$location", "$timeout"];

function ShoppingCartCtrl($scope, $rootScope, shoppingCartService, $http, $location, $timeout) {
    shoppingCartService.RestoreState();
    shoppingCartService.ListenForChange();

    $scope.cart = {
        totalCount: 0,
        subtotal: 0,
        discount: 0,
        shipping: {
            country: "US",
            price: 0,
            options: [],
            selectedOption: "1232"
        },
        items: shoppingCartService.items,
        pendingItem: {
            quantity: 1,
            price: 0
        },
        europeanUrl: "",
        europeanUrls: null
    };

    $rootScope.$on("restoreAndUpdateCartItems", function () {
        shoppingCartService.RestoreState();
        $scope.cart.items = shoppingCartService.items;
        $scope.cart.totalCount = 0;
        $scope.cart.items.forEach(function(item) {
            $scope.cart.totalCount += item.quantity;
        });
    });

    $rootScope.$on("updateCart", function () {
        $scope.updateCart();
    });

    $scope.cleanCart = function () {
        $scope.cart.items = [];
        shoppingCartService.items = [];
        shoppingCartService.SaveState();
        $scope.updateCart();
    };

    $scope.$watch('paymentType', function () {
        if ($scope.paymentType === undefined) {
            $("#vuzix-card-payment").slideDown("fast");
        }

        if ($scope.paymentType === '1') {
            $("#vuzix-card-payment").slideDown("fast");
        }

        if ($scope.paymentType === '2') {
            $("#vuzix-card-payment").slideUp("fast");
        }
    });

    $scope.setEuropeanUrl = function () {
        if ($scope.cart.europeanUrls !== null && $scope.cart.europeanUrls.length > 1) {
            var oneColor = $scope.cart.europeanUrls.filter(function (element) {
                return element.ColorId === $scope.cart.pendingItem.color.id;
            });

            if (oneColor.length === 1) {
                $scope.cart.europeanUrl = oneColor[0].Url;
            } else if (oneColor.length > 1) {
                var oneFrame = oneColor.filter(function (element) {
                    return element.FrameId === $scope.cart.pendingItem.frame.id;
                });

                if (oneFrame.length > 0) {
                    $scope.cart.europeanUrl = oneFrame[0].Url;
                }
            } else {
                var framesOnly = $scope.cart.europeanUrls.filter(function (element) {
                    return element.FrameId === $scope.cart.pendingItem.frame.id;
                });

                if (framesOnly.length > 0) {
                    $scope.cart.europeanUrl = framesOnly[0].Url;
                }
            }
        }
    };

    $scope.$watch('cart.pendingItem.color', function () {
        if ($scope.cart.pendingItem.color) {
            $scope.setEuropeanUrl();
            $scope.updatePartNumber();
            $scope.updateBuyButton();
            // MK : Check if it is white color - display backorder button
        }
    });

    $scope.$watch('cart.pendingItem.frame', function () {
        if ($scope.cart.pendingItem.frame) {
            $scope.setEuropeanUrl();
            $scope.updatePartNumber();
        }
    });

    $scope.$watch('cart.pendingItem.size', function () {
        if ($scope.cart.pendingItem.size) {
            $scope.updatePartNumberBasedOnSize();
        }
    });

    $scope.$watch('cart.pendingItem.color', function () {
        if ($scope.cart.pendingItem.color) {
            $scope.updatePartNumberBasedOnColor();
        }
	});

	$scope.$watch('cart.pendingItem.lenses', function () {
		$scope.updatePartNumberBasedOnLenses();
	});

    $scope.updateBuyButton = function () {
        if ($scope.cart.pendingItem.id === 1) {
            if ($scope.cart.pendingItem.color.id === 40) {
                $("#addToCartButton").hide();
                $("#placeBackorderButton").show();
            } else {
                $("#addToCartButton").show();
                $("#placeBackorderButton").hide();
            }
        }
    };

	$scope.iHavePrescriptionsChange = function() {
		if (!$('#lenses-option-no').prop('checked')) {
			$('#minus').hide();
			$('#plus').hide();
			$('#quantity').val(1);

			$scope.cart.pendingItem.quantity = 1;
            $('#prescription-area-add-to-cart').show();
		} else {
			$('#minus').show();
			$('#plus').show();
            $('#prescription-area-add-to-cart').hide();
		}
    };

    $scope.starterKitChange = function(id) {
        $scope.cart.pendingItem.id = id;

        $('#addToCartButton').prop('disabled', true);
        $('#addToCartButton').text('processing...');

        $http.post("/ajax/getProduct", { productId: id }).then(function(response) {
            var item = response.data;

            if (!item) {
                window.location = '/products';
                return;
            }

            $scope.cart.pendingItem.id = item.id;
            $scope.cart.pendingItem.price = item.price;
            $scope.cart.pendingItem.priceExVat = item.priceExVat;
            $scope.cart.pendingItem.name = item.name;
            $scope.cart.pendingItem.image = item.displayImage;
            $scope.cart.pendingItem.displayImage = item.displayImage;
            $scope.cart.pendingItem.availableColors = item.availableColors;
            $scope.cart.pendingItem.availableFrames = item.availableFrames;
            $scope.cart.pendingItem.availableExtras = item.extras;
            $scope.cart.pendingItem.availableSizes = item.availableSizes;
            $scope.cart.pendingItem.availableLenses = item.availableLenses;
            $scope.cart.pendingItem.color = item.availableColors[0];
            $scope.cart.pendingItem.frame = item.availableFrames[0];
            $scope.cart.pendingItem.size = item.availableSizes[0];
            $scope.cart.pendingItem.isAccessory = item.isAccessory;
            $scope.cart.europeanUrl = item.europeanUrl;
            $scope.cart.partNumbers = item.partNumbers;
            $scope.cart.redirectToEuropeanSite = item.redirectToEuropeanSite;
            $scope.cart.pendingItem.displayMultiplePartNumbers = item.displayMultiplePartNumbers;
            $scope.cart.pendingItem.requestPrescription = item.requestPrescription;
            $scope.cart.pendingItem.productImages = item.productImages;

            if (item.partNumbers && item.partNumbers.length > 0) {
                if (item.partNumbers[0].Number !== "") {
                    $scope.cart.pendingItem.partnumber = item.partNumbers[0].number;
                }

                if (item.partNumbers.length > 1) {
                    $scope.cart.pendingItem.partnumber = item.partNumbers[1].number;
                }
            } else {
                $scope.cart.pendingItem.partnumber = '';
            }

            $('#product-image').attr('src', $scope.cart.pendingItem.image);

            $('#product-image-slider-wrap').html('');
            $('#product-image-slider-wrap').html('<div class="owl-carousel product-image-slider"></div>');
            if ($scope.cart.pendingItem.productImages.length > 0) {
                $('#product-image').attr('src', $scope.cart.pendingItem.productImages[0].url);

                var first = true;
                $scope.cart.pendingItem.productImages.forEach(function(item) {
                    $('.product-image-slider').append(
                        '<div class="item image-slide-' + item.id + '" data-id="' + item.id + '">' +
                            '<div class="image-box-wrap ' + (first ? 'active' : '') + '">' +
                                '<img src="' + item.url + '"/>' +
                            '</div>' +
                        '</div>'
                    );
                    first = false;
                });
                
                $scope.initSlider($scope.cart.pendingItem.productImages.length);
            } else {
                $('#product-image').attr('src', $scope.cart.pendingItem.image);
            }

            $('#product-description').html(item.description);

            $('#addToCartButton').attr('disabled', false);
            $('#addToCartButton').text('Add To Cart');
        });
    };

    $scope.checkedRadio = function () {
        $('#lenses-option-no').click();
        return true;
    };

    // Only for prescription kit
    $scope.checkLensesForPrescriptionKit = function () {
        // Workaround to avoid messing up with angular js
        $('[id^="lenses-option-"]').prop('checked', true).change();
        $scope.iHavePrescriptionsChange();
        return true;
    };

    $scope.placeBackorder = function () {
        vuzix.backorderWindow.show();
    };

    $scope.updatePartNumber = function() {
        if ($scope.cart.partNumbers.length > 1) {
            // MK fix this to work with null colors and null frames.
            var filteredResult = $scope.cart.partNumbers.filter(function(object) {
                var result = true;
                if ($scope.cart.pendingItem.color) {
                    result = object.colorId === $scope.cart.pendingItem.color.id;
                }

                if ($scope.cart.pendingItem.frame) {
                    result = (result && object.frameId === $scope.cart.pendingItem.frame.id);
                }

                if ($scope.cart.pendingItem.size) {
                    result = (result && object.sizeId === $scope.cart.pendingItem.size.id);
                }

                if ($scope.cart.pendingItem.lenses) {
                    result = (result && object.lensesId === $scope.cart.pendingItem.lenses.id);
                }

                return result;
            });

            if (filteredResult[0].number !== "") {
                $scope.cart.pendingItem.partNumber = filteredResult[0].number;
            } else {
                $scope.cart.pendingItem.partNumber = filteredResult[1].number;
            }
        } else {
            if ($scope.cart.partNumbers.length === 1) {
                $scope.cart.pendingItem.partNumber = $scope.cart.partNumbers[0].number;
            }
        }
    };

    $scope.updatePartNumberBasedOnSize = function() {
        if ($scope.cart.partNumbers.length > 1) {
            // MK fix this to work with null colors and null frames.
            var filteredResult = $scope.cart.partNumbers.filter(function(object) {
                var result = true;

                if ($scope.cart.pendingItem.size) {
                    result = (object.sizeId === $scope.cart.pendingItem.size.id);
                }

                return result;
            });

            if (filteredResult[0].number !== "") {
                $scope.cart.pendingItem.partnumber = filteredResult[0].number;
            } else {
                $scope.cart.pendingItem.partnumber = filteredResult[1].number;
            }
        } else {
            if ($scope.cart.partNumbers.length === 1) {
                $scope.cart.pendingItem.partnumber = $scope.cart.partNumbers[0].number;
            }
        }
    };

    $scope.updatePartNumberBasedOnLenses = function() {
        if ($scope.cart.partNumbers) {
            if ($scope.cart.partNumbers.length > 1) {
                var filteredResult = $scope.cart.partNumbers.filter(function(object) {
                    var result = true;

                    result = ((!$scope.cart.pendingItem.lenses && !object.lensesId) ||
                    ($scope.cart.pendingItem.lenses &&
                    ($scope.cart.pendingItem.displayMultiplePartNumbers ||
                        object.lensesId === $scope.cart.pendingItem.lenses.id)));

                    return result;
                });

                filteredResult.sort(function(a, b) {
                    var x = a.number.toLowerCase();
                    var y = b.number.toLowerCase();
                    if (x < y) {
                        return -1;
                    }
                    if (x > y) {
                        return 1;
                    }
                    return 0;
                });

                if (!$scope.cart.pendingItem.displayMultiplePartNumbers) {
                    if (filteredResult[0].number !== "") {
                        $scope.cart.pendingItem.partnumber = filteredResult[0].number;
                    } else {
                        $scope.cart.pendingItem.partnumber = filteredResult[1].number;
                    }
                } else {
                    var partNumbers = ''
                    for (var i = 0; i < filteredResult.length; i++) {
                        if (partNumbers !== '')
                            partNumbers += ', ';

                        partNumbers += filteredResult[i].number;
                    }

                    $scope.cart.pendingItem.partnumber = partNumbers;
                }
            } else {
                if ($scope.cart.partNumbers.length === 1) {
                    $scope.cart.pendingItem.partnumber = $scope.cart.partNumbers[0].number;
                }
            }
        }
    };

    $scope.updatePartNumberBasedOnColor = function() {
        if ($scope.cart.partNumbers.length > 1) {
            // MK fix this to work with null colors and null frames.
            var filteredResult = $scope.cart.partNumbers.filter(function(object) {
                var result = true;

                if ($scope.cart.pendingItem.color) {
                    result = (object.colorId === $scope.cart.pendingItem.color.id);
                }

                return result;
            });

            if (filteredResult[0].number !== "") {
                $scope.cart.pendingItem.partnumber = filteredResult[0].number;
            } else {
                $scope.cart.pendingItem.partnumber = filteredResult[1].number;
            }
        } else {
            if ($scope.cart.partNumbers.length === 1) {
                $scope.cart.pendingItem.partnumber = $scope.cart.partNumbers[0].number;
            }
        }
    };

    $scope.getDisplayPrice = function (price, region) {
        return parseFloat(Math.round(price * 100) / 100).toLocaleString(region, {
            minimumFractionDigits: 2,
            maximumFractionDigits: 2
        });
    };

    $scope.updateCart = function (quantity, itemId, extraId, colorId, frameId) {
        $scope.cart.totalCount = 0;
        $scope.cart.subtotal = 0;
        if (!$scope.cart.items)
            return;

        for (var i = 0; i < $scope.cart.items.length; i++) {
            var value = $scope.cart.items[i];

            if (!extraId
                && value.id === itemId
                && ((value.color && value.color.id === colorId) || (!value.color))
                && ((value.frame && value.frame.id === frameId) || (!value.frame))) {
                if (quantity === 0) {
                    $scope.cart.items.splice(i, 1);
                } else {
                    value.quantity = quantity;
                }
            }

            if (value.extras) {
                for (var j = 0; j < value.extras.length; j++) {
                    if (value.id === itemId
                        && value.extras[j].id === extraId
                        && ((value.color && value.color.id === colorId) || (!value.color))
                        && ((value.frame && value.frame.id === frameId) || (!value.frame))) {
                        if (quantity === 0) {
                            $scope.cart.items[i].extras.splice(j, 1);
                        } else {
                            $scope.cart.items[i].extras[j].quantity = quantity;
                        }
                    }
                }
            }
        }

        for (var k = 0; k < $scope.cart.items.length; k++) {
            var cartItem = $scope.cart.items[k];
            $scope.cart.totalCount += cartItem.quantity;

            var colorPrice = 0;
			var framePrice = 0;
			var lensesPrice = 0;

            if (cartItem.color) {
                colorPrice = cartItem.color.price;
            }

            if (cartItem.frame) {
                framePrice = cartItem.frame.price;
			}

			if (cartItem.lenses) {
				lensesPrice = cartItem.lenses.price;
			}

			$scope.cart.subtotal += cartItem.quantity * (cartItem.price + colorPrice + framePrice + lensesPrice);

            if (cartItem.extras) {
                for (var l = 0; l < cartItem.extras.length; l++) {
                    var extra = $scope.cart.items[k].extras[l];
                    $scope.cart.totalCount += extra.quantity;
                    $scope.cart.subtotal += extra.quantity * extra.price;
                }
            }
        }

		shoppingCartService.SaveState();
	};
    
    $scope.addToCart = function () {
        $scope.hideErrors();

        var hasError = false;
        if ($scope.cart.checkForTerms && !$scope.cart.agreedToTerms) {
            $scope.cart.showTermsValidation = true;
            hasError = true;
        } else {
            $scope.cart.showTermsValidation = false;
        }

        var item = {
            id: $scope.cart.pendingItem.id,
            name: $scope.cart.pendingItem.name,
            color: angular.fromJson($scope.cart.pendingItem.color),
            frame: angular.fromJson($scope.cart.pendingItem.frame),
            size: angular.fromJson($scope.cart.pendingItem.size),
            lenses: angular.fromJson($scope.cart.pendingItem.lenses),
            extras: angular.fromJson($scope.cart.pendingItem.extras),
            quantity: $scope.cart.pendingItem.quantity,
            price: $scope.cart.pendingItem.price,
            image: $scope.cart.pendingItem.displayImage,
            isAccessory: $scope.cart.pendingItem.isAccessory,
            displayMultiplePartNumbers: $scope.cart.pendingItem.displayMultiplePartNumbers,
            requestPrescription: $scope.cart.pendingItem.requestPrescription
        };

        if (item.requestPrescription) {
            if (item.lenses && !$('#lenses-option-no').prop('checked') && !$('#prescriptions-acknowledgement').prop('checked')) {
                $('#acknowledge-error').show();
                hasError = true;
            }

            if (item.lenses && !$('#lenses-option-no').prop('checked') && !$('#prescriptions-third-party-acknowledgement').prop('checked')) {
                $('#acknowledge-third-party-error').show();
                hasError = true;
            }
        }

        if (hasError)
            return;

        var alreadyInCart = false;

        if (!$scope.cart.items) {
            $scope.cart.items = [];
        }

        for (var i = 0; i < $scope.cart.items.length; i++) {
            var value = $scope.cart.items[i];

            // accessory
            if (item.isAccessory === value.isAccessory && item.isAccessory === true && value.id === $scope.cart.pendingItem.id && !(value.requestPrescription && item.requestPrescription) && !(value.size && $scope.cart.pendingItem.size)) {
                alreadyInCart = true;
                $scope.cart.items[i].quantity = value.quantity + item.quantity;
                continue;
            }

            if (value.size && $scope.cart.pendingItem.size && value.size.id === $scope.cart.pendingItem.size.id && value.id === $scope.cart.pendingItem.id) {
                alreadyInCart = true;
                $scope.cart.items[i].quantity = value.quantity + item.quantity;
                break;
            }

            // main
            
            if (!value.color && !value.frame && !value.size && value.id === $scope.cart.pendingItem.id) {
                alreadyInCart = true;
                if (value.requestPrescription && item.requestPrescription && !$scope.cart.redirectToEuropeanSite) {
                    if (value.lenses || item.lenses) {
                        $('#multiple-blades-prescriptions-not-supported').show();
                        return;
                    }
                }
                $scope.cart.items[i].quantity = value.quantity + item.quantity;
                continue;
            } else if (!value.color && !value.frame && !value.size && value.id !== $scope.cart.pendingItem.id && value.requestPrescription && item.requestPrescription) {
                // Cannot allow to add multiple items with prescriptions even if they are different products
                alreadyInCart = false;
                if (value.requestPrescription && item.requestPrescription && !$scope.cart.redirectToEuropeanSite) {
                    if (value.lenses && item.lenses) {
                        $('#multiple-blades-prescriptions-not-supported').show();
                        return;
                    }
                }
                continue;
            }
        }

        if (!alreadyInCart) {
            $scope.cart.items.push(item);
        }

        shoppingCartService.SaveState();

        $scope.updateCart();

        if ($scope.cart.redirectToEuropeanSite) {
            //Vuzix Blade/Blade Upgraded without prescriptions
            if ($scope.cart.pendingItem.requestPrescription && ($scope.cart.pendingItem.id === 157 || $scope.cart.pendingItem.id === 256) && $('#lenses-option-no').prop('checked')) {
                window.location = $scope.cart.baseEuropeanUrl + '/index.php?route=checkout/cart/addlink&model=' + $scope.cart.pendingItem.partnumber + '&quantity=' + $scope.cart.pendingItem.quantity;
                return;
            }
            //Vuzix Blade with prescription
            else if ($scope.cart.pendingItem.requestPrescription && $scope.cart.pendingItem.id === 157 && !$('#lenses-option-no').prop('checked')) {
                window.location = $scope.cart.baseEuropeanUrl + '/vuzix-blade-with-prescription-inserts';
                return;
            }
            //Vuzix Blade Upgraded with prescription
            else if ($scope.cart.pendingItem.requestPrescription && $scope.cart.pendingItem.id === 256 && !$('#lenses-option-no').prop('checked')) {
                window.location = $scope.cart.baseEuropeanUrl + '/blade-upgraded-with-prescription-inserts';
                return;
            }
            //Vuzix Blade Prescription Kit
            else if ($scope.cart.pendingItem.requestPrescription && $scope.cart.pendingItem.id === 184) {
                window.location = $scope.cart.baseEuropeanUrl + '/vuzix-blade-prescription-inserts';
                return;
            }
            //Vuzix Blade Upgraded Prescription Kit
            /*else if ($scope.cart.pendingItem.requestPrescription && $scope.cart.pendingItem.id === 259) {
                window.location = $scope.cart.baseEuropeanUrl + '/vuzix-blade-upgraded-prescription-inserts';
                return;
            }*/
            else if ($scope.cart.pendingItem && ($scope.cart.pendingItem.size || $scope.cart.pendingItem.color || $scope.cart.pendingItem.frame || $scope.cart.pendingItem.lenses)) {
                window.location = $scope.cart.baseEuropeanUrl + '/index.php?route=checkout/cart/addlink&model=' + $scope.cart.pendingItem.partnumber + '&quantity=' + $scope.cart.pendingItem.quantity;
                return;
            } else if ($scope.cart.europeanUrl) {
                window.location.href = ($scope.cart.europeanUrl + '&quantity=' + $scope.cart.pendingItem.quantity);
                return;
            } else {
                window.location = $scope.cart.baseEuropeanUrl;
                return;
            }
        }

        $scope.cart.show = 'side-panel-open';

        $scope.saveCart();

        $timeout(function () {
            $("body").addClass("side-panel-open");
        }, 500);
	};

    var addingAccessory = false;

    $scope.addAccessoryToCart = function (accessoryId) {
        if(addingAccessory)
            return;

        $scope.hideErrors();

        var hasError = false;
        if ($scope.cart.checkForTerms && !$scope.cart.agreedToTerms) {
            $scope.cart.showTermsValidation = true;
            hasError = true;
        } else {
            $scope.cart.showTermsValidation = false;
        }


        addingAccessory = true;
        $http.post("/ajax/getProduct", { productId: accessoryId }).then(function(response) {
            var item = {
                id: response.data.id,
                name: response.data.name,
                color: angular.fromJson(response.data.color),
                frame: angular.fromJson(response.data.frame),
                size: angular.fromJson(response.data.size),
                lenses: angular.fromJson(response.data.lenses),
                extras: angular.fromJson(response.data.extras),
                quantity: response.data.quantity,
                price: response.data.price,
                image: response.data.image,
                productImages: response.data.productImages,
                isAccessory: response.data.isAccessory,
                displayMultiplePartNumbers: response.data.displayMultiplePartNumbers,
                requestPrescription: response.data.requestPrescription,
                redirectToEuropeanSite: response.data.redirectToEuropeanSite,
                europeanUrl: response.data.europeanUrl,
                baseEuropeanUrl: response.data.baseEuropeanUrl
            };
            
            if (item.productImages && item.productImages.length > 0) {
                item.image = item.productImages[0].url;
            }

            if (hasError)
                return;

            var alreadyInCart = false;

            if (!$scope.cart.items) {
                $scope.cart.items = [];
            }

            for (var i = 0; i < $scope.cart.items.length; i++) {
                var value = $scope.cart.items[i];
                // accessory
                if (item.isAccessory === value.isAccessory && item.isAccessory === true && value.id === item.id && !(value.requestPrescription && item.requestPrescription) && !(value.size && item.size)) {
                    alreadyInCart = true;
                    $scope.cart.items[i].quantity = value.quantity + item.quantity;
                    continue;
                }

                if (value.size && item.size && value.size.id === item.size.id && value.id === item.id) {
                     alreadyInCart = true;
                     $scope.cart.items[i].quantity = value.quantity + item.quantity;
                     break;
                }

                // main
                if (!value.color && !value.frame && !value.size && value.id === item.id) {
                    alreadyInCart = true;
                    if (value.requestPrescription && item.requestPrescription && !$scope.cart.redirectToEuropeanSite) {
                        if (value.lenses || item.lenses) {
                            $('#multiple-blades-prescriptions-not-supported').show();
                            return;
                        }
                    }
                    $scope.cart.items[i].quantity = value.quantity + item.quantity;
                    continue;
                } else if (!value.color && !value.frame && !value.size && value.id !== item.id && value.requestPrescription && item.requestPrescription) {
                    // Cannot allow to add multiple items with prescriptions even if they are different products
                    alreadyInCart = false;
                    if (value.requestPrescription && item.requestPrescription && !$scope.cart.redirectToEuropeanSite) {
                        if (value.lenses && item.lenses) {
                            $('#multiple-blades-prescriptions-not-supported').show();
                            return;
                        }
                    }
                    continue;
                }
            }

            if (!alreadyInCart) {
                $scope.cart.items.push(item);
            }

            shoppingCartService.SaveState();

            $scope.updateCart();

            if ($scope.cart.redirectToEuropeanSite) {
                //blade no prescription
                if (item.requestPrescription && (item.id === 157 || item.id === 256) && $('#lenses-option-no').prop('checked')) {
                    window.location = 'http://store.vuzix.eu/index.php?route=checkout/cart/addlink&model=' + item.partnumber + '&quantity=' + item.quantity;
                    return;
                }
                //blade yes prescription
                else if (item.requestPrescription && item.id === 157 && !$('#lenses-option-no').prop('checked')) {
                    window.location = 'https://store.vuzix.eu/vuzix-blade-with-prescription-inserts';
                    return;
                }
                //Vuzix Blade Upgraded with prescription
                else if (item.requestPrescription && item.id === 256 && !$('#lenses-option-no').prop('checked')) {
                    window.location = $scope.cart.baseEuropeanUrl + '/blade-upgraded-with-prescription-inserts';
                    return;
                }
                //prescription kit
                else if (item.requestPrescription && item.id === 184) {
                    window.location = 'https://store.vuzix.eu/vuzix-blade-prescription-inserts';
                    return;
                }
                //Vuzix Blade Upgraded Prescription Kit
                /*else if (item.requestPrescription && item.id === 259) {
                    window.location = $scope.cart.baseEuropeanUrl + '/vuzix-blade-upgraded-prescription-inserts';
                    return;
                }*/
                else if (item && (item.size || item.color || item.frame || item.lenses)) {
                    window.location = 'http://store.vuzix.eu/index.php?route=checkout/cart/addlink&model=' + item.partnumber + '&quantity=' + item.quantity;
                    return;
                } else if (item.europeanUrl) {
                    window.location = item.europeanUrl + '&quantity=' + item.quantity;
                    return;
                } else {
                    window.location = "http://store.vuzix.eu/";
                    return;
                }
            }

            $scope.cart.show = 'side-panel-open';

            $scope.saveCart();

            $timeout(function () {
                $("body").addClass("side-panel-open");
                addingAccessory = false;
            }, 500);
        });
    };

	$('#prescriptions-acknowledgement').change(function () {
		if ($('#prescriptions-acknowledgement').prop('checked')) {
			$('#acknowledge-error').hide();
		}
    });

    $('#prescriptions-third-party-acknowledgement').change(function () {
        if ($('#prescriptions-third-party-acknowledgement').prop('checked')) {
            $('#acknowledge-third-party-error').hide();
        }
    });

    $('input[name="terms"]').change(function() {
        if ($(this).prop('checked')) {
            $('.validation-summary-errors').hide();
        }
    });

    $scope.hideErrors = function() {
        $('#acknowledge-error').hide();
        $('#no-prescription-photo-error').hide();
        $('#multiple-blades-prescriptions-not-supported').hide();
    };

    $scope.changeQuantity = function (quantity, itemId, extraId, colorId, frameId) {
        if (itemId && extraId) {
            $scope.updateCart(quantity, itemId, extraId, colorId, frameId);
        } else if (itemId) {
            $scope.updateCart(quantity, itemId, null, colorId, frameId);
        } else {
            $scope.cart.pendingItem.quantity = quantity === 0 ? 1 : quantity;
        }
    };

    $scope.getShippingRate = function() {
        var e = document.getElementById("ShippingOption"); 
        $scope.cart.shipping.price = e.options[e.selectedIndex].getAttribute("data-price") * 1;
        document.getElementById("ShippingPrice").value = $scope.cart.shipping.price;

        if ($scope.cart.shipping.province === 3546) {
            $scope.cart.tax = ($scope.cart.subtotal + $scope.cart.shipping.price) * 0.08;
        }
    };

    $scope.getDiscount = function() {
        $http.post("/ajax/getDiscount",
            {
                items: $scope.cart.items,
                promoCode: $scope.cart.promoCode
            }).then(function(response) {
            $scope.cart.discount = response.status === 200 ? response.data.Discount : 0;
            $scope.cart.showError = !response.data.Success;
            $scope.cart.errorMessage = response.data.ErrorMessage;

            if ($scope.cart.shipping.province === 3546) {
                $scope.cart.tax = ($scope.cart.subtotal + $scope.cart.shipping.price) * 0.08;
            }
        });
    };

    $scope.inititializePromoCode = function() {
        var viewmodelValue = $('#PromoCode').data('viewmodelvalue');
        if (viewmodelValue) {
            $('#PromoCode').val(viewmodelValue);
            $scope.cart.promoCode = viewmodelValue;
            $scope.getDiscount();
        }
    };

	$scope.inititializePromoCode();

    $scope.showModal = function (id) {
        $("#" + id).modal('show');
    };

    $scope.saveCart = function() {
        $http.post("/ShoppingCart/SaveCart", { items: $scope.cart.items });
    };

    $scope.changeImage = function(attribute) {
    };

    $scope.initSlider = function(num) {
        var owl = $('.product-image-slider');

        if (owl.length === 0)
            return;

        owl.owlCarousel({
            loop: false,
            nav: num > 3,
            navigation: num > 3,
            autoHeight: false,
            margin: 5,
            autoplay: false,
            autoPlay: false,
            
            responsive: {
                0: {
                    items: 3,
                    nav: true
                }
            }
        });

        if (num > 3) {
            $('.owl-nav').show();
        } else {
            $('.owl-nav').hide();
        }

        $('.product-image-slider').on('click', '.item', clickOnSlide);
    };

     function clickOnSlide() {
         var id = $(this).data('id');
        $('#product-image').attr('src', $('.image-slide-' + id).find('img').attr('src'));
        $('.image-box-wrap.active').removeClass('active');
        $('.image-slide-' + id).find('.image-box-wrap').addClass('active');
    };

    $scope.init = function(productId) {
        $scope.updateCart();

        $http.post("/ajax/getProduct", { productId: productId }).then(function(response) {
            var item = response.data;
            $scope.cart.pendingItem.id = item.id;
            $scope.cart.pendingItem.price = item.price;
            $scope.cart.pendingItem.priceExVat = item.priceExVat;
            $scope.cart.pendingItem.name = item.name;
            $scope.cart.pendingItem.displayImage = item.displayImage;
            if (item.productImages && item.productImages.length > 0) {
                $scope.cart.pendingItem.image = item.productImages[0].url;
            }
            if (!$scope.cart.pendingItem.image) {
                $scope.cart.pendingItem.image = item.displayImage;
            }
            $scope.cart.pendingItem.availableColors = item.availableColors;
            $scope.cart.pendingItem.availableFrames = item.availableFrames;
            $scope.cart.pendingItem.availableExtras = item.extras;
            $scope.cart.pendingItem.availableSizes = item.availableSizes;
            $scope.cart.pendingItem.availableLenses = item.availableLenses;
            $scope.cart.pendingItem.color = item.availableColors[0];
            $scope.cart.pendingItem.frame = item.availableFrames[0];
            $scope.cart.pendingItem.size = item.availableSizes[0];
            $scope.cart.pendingItem.isAccessory = item.isAccessory;
            $scope.cart.europeanUrl = item.europeanUrl;
            $scope.cart.baseEuropeanUrl = item.baseEuropeanUrl;
            $scope.cart.partNumbers = item.partNumbers;
            $scope.cart.redirectToEuropeanSite = item.redirectToEuropeanSite;
            $scope.cart.pendingItem.displayMultiplePartNumbers = item.displayMultiplePartNumbers;
            $scope.cart.pendingItem.requestPrescription = item.requestPrescription;
            if(item.id === 214 || item.id === 163)
                $scope.cart.pendingItem.starterKit = 'false';

            if (item.lenses)
                $scope.cart.pendingItem.lenses = item.lenses;

            if (item.partNumbers && item.partNumbers.length > 0) {
                if (item.partNumbers[0].Number !== "") {
                    $scope.cart.pendingItem.partnumber = item.partNumbers[0].number;
                }

                if (item.partNumbers.length > 1) {
                    $scope.cart.pendingItem.partnumber = item.partNumbers[1].number;
                }
            }

            $scope.initSlider(item.productImages.length);

            setTimeout(function() { 
                $('#lenses-option-no').click();
                $('#addToCartButton').prop('disabled', false);
                $('#vuzix-shopping-submit').prop('disabled', false);
            });
        });
    };
};

shoppingCartApp.factory('shoppingCartService', ['$rootScope', '$http', function ($rootScope, $http) {
    var service = {
        items: [],

        SaveState: function() {
            localStorage.shoppingCartService = angular.toJson(service.items);
        },

        RestoreState: function() {
            if (!localStorage.shoppingCartService || localStorage.shoppingCartService === 'null') {
                localStorage.shoppingCartService = angular.toJson(service.items);
            } else {
                service.items = angular.fromJson(localStorage.shoppingCartService);

                service.items.forEach(function(item, index) {
                    $http.post("/ajax/getProduct", { productId: item.id }).then(function(response) {
                        if (response.data.productStatus === 0 || response.data.productStatus === 2) {
                            service.items.splice(index, index + 1);
                            $rootScope.$emit('updateCart');
                        }
                    });
                });
            }
        },

        ListenForChange: function() {
            window.addEventListener('storage', function(e) {
                if (e.key === 'shoppingCartService') {
                    localStorage.shoppingCartService = e.newValue;
                    $rootScope.$emit('restoreAndUpdateCartItems');
                }
            });
        }
    };

    $rootScope.$on("savestate", service.SaveState);
    $rootScope.$on("restorestate", service.RestoreState);

    return service;
}]);;
(function() {
    'use strict';

    window.vuzix = window.vuzix || {};

    //functions

    window.vuzix.scrollToAnchor = function scrollToAnchor() {
        $(this).blur();
        
        var selectedId = $(this).data('scroll-to');

        //check if the element is tab content
        if ($("#" + selectedId).attr("data-toggle") === "tab") {
            $("#" + selectedId).tab('show'); // Select tab by name
        }

        var to = $("#" + selectedId).offset().top - 95;
        $('html, body').animate({
            scrollTop: to
        }, 800);
    };

    window.vuzix.scrollToId = function scrollToAnchor(id) {
        $(this).blur();

        //check if the element is tab content
        if ($("#" + id).attr("data-toggle") === "tab") {
            $("#" + id).tab('show'); // Select tab by name
        }

        var to = $("#" + id).position().top - 95;
        $('html, body').animate({
            scrollTop: to
        }, 800);
    };
})();;
(function() {
    'use strict';

    $(document).ready(function() {
        $('.login-dropdown-button').click(function() {
            $(this).parents('.sub-menu').toggleClass('open');
        });

        $('#form-login-dropdown').submit(function() {
            $('#btn-login-dropdown').prop('disabled', true);
            $(this).parents('.sub-menu').toggleClass('open');
        });
    });
})();;
(function() {
    'use strict';

    function init() {
        $('.scroll-to-top-component').click(scrollToTop);
        $(document).scroll(onScroll);
    }

    $(document).ready(init);
    
    //functions

    function scrollToTop() {
        $('html, body').animate({
            scrollTop: 0
        }, 800);

        $('.scroll-to-top-component').removeClass('show');
        $('.scroll-to-top-component').blur();
    }

    function onScroll(e) {
        if ($(document).scrollTop() > 50) {
            $('.scroll-to-top-component').addClass('show');
        } else {
            $('.scroll-to-top-component').removeClass('show');
        }
    }

})();;
(function() {
    'use strict';

    var animationsActive = false;

    function init() {
        if ($('.tech-display-component').length && window.innerWidth >= 991) {
            $('.line-box label').hover(onHoverLineBox(), onUnHoverLineBox());

            $(window).scroll(onScrollTechDisplayEvent);
        }
    }

    $(document).ready(init);
    
    //functions

    function onScrollTechDisplayEvent() {
        var target = $(window);
        var docViewTop = target.scrollTop();
        var docViewBottom = docViewTop + target.height();

        var targetElement = $('.tech-display-component');
        if (targetElement.length > 0) {
            // Animations for blade
            var elemTop = targetElement.offset().top;
            if (!animationsActive && elemTop < 0.85 * docViewBottom && elemTop + targetElement.innerHeight() / 2 > docViewTop) {
                console.log('active animations');
                activeTechDisplayAnimations();
                animationsActive = true;
            } else if (animationsActive && (elemTop < (docViewTop - targetElement.innerHeight()) || elemTop > docViewBottom)) {
                console.log('remove animations');
                resetTechDisplayAnimations();
                animationsActive = false;
            }
        }
    }

    function onHoverLineBox() {
        $(this).siblings('.outer-circle').addClass('pulse-animation');
    }

    function onUnHoverLineBox() {
        $(this).siblings('.outer-circle').removeClass('pulse-animation');
    }

    function activeTechDisplayAnimations() {
        setTimeout(function () {
            $('.horizontal-line').addClass('active');
        }, 500);
        setTimeout(function () {
            $('.line-box label').addClass('active');
        }, 700);
        $('.vertical-line').addClass('active');
        $('.outer-circle').addClass('active');
    }

    function resetTechDisplayAnimations() {
        $('.horizontal-line').removeClass('active');
        $('.vertical-line').removeClass('active');
        $('.outer-circle').removeClass('active');
        $('.line-box label').removeClass('active');
    }

})();;
(function() {
    'use strict';

    function init() {
        startHomeSlider();
        startSlider();
        startPaddedSlider();
    }

    $(document).ready(init);

    //functions

    function startHomeSlider() {
        var sliders = $('.home-vuzix-slider-component');
        sliders.each(function(index, item) {
            var owl = $(item);
            owl.owlCarousel({
                loop: true,
                autoHeight: false,
                dots: true,
                autoPlay: true,
                autoplay: true,
                autoplaySpeed: 2000,
                autoplayTimeout: 8000,
                autoplayHoverPause: true,
                responsive: {
                    0: {
                        items: 1
                    }
                }
            });

            //if the user changes the slide this resets the slider timer for when it moves again
            owl.on('changed.owl.carousel', function(e) {
                owl.trigger('stop.owl.autoplay');
                owl.trigger('play.owl.autoplay');
            });
        });
    }

    function startSlider() {

        var sliders = $('.vuzix-slider-component');

        sliders.each(function(index, item) {
            var owl = $(item);
            owl.owlCarousel({
                loop: true,
                autoHeight: false,
                dots: true,
                autoPlay: true,
                autoplay: true,
                autoplaySpeed: 2000,
                autoplayTimeout: 4000,
                autoplayHoverPause: true,
                responsive: {
                    0: {
                        items: 1
                    }
                }
            });

            //if the user changes the slide this resets the slider timer for when it moves again
            owl.on('changed.owl.carousel', function(e) {
                owl.trigger('stop.owl.autoplay');
                owl.trigger('play.owl.autoplay');
            });
        });
    }

    function startPaddedSlider() {
        var stagePadding = $('.vuzix-padded-slider-component').data('stage-padding');
        var intStagePadding = parseInt(stagePadding);

        var owl = $('.vuzix-padded-slider-component');
        owl.owlCarousel({
            loop: true,
            autoHeight: false,
            dots: false,
            autoPlay: true,
            autoplay: true,
            autoplaySpeed: 2000,
            autoplayTimeout: 4000,
            items: 2,
            center: true,
            autoplayHoverPause: true,
            margin: 50
        });

        //if the user changes the slide this resets the slider timer for when it moves again
        owl.on('changed.owl.carousel', function(e) {
            owl.trigger('stop.owl.autoplay');
            owl.trigger('play.owl.autoplay');
        });
    }

})();;
(function() {
    'use strict';

    $(document).ready(function() {
        $('.hover-link').click(function() {
            var url = $(this).data('url');
            
            copyToClipBoard(url);
            showNotification();
        });

        $('.hover-link').popover();
    });
    
    function copyToClipBoard(url){
        const el = document.createElement('textarea');
        el.value = url;
        document.body.appendChild(el);
        el.select();
        document.execCommand('copy');
        document.body.removeChild(el);
    }
    
    function showNotification(){
        Toastify({
            text: 'COPIED TO CLIPBOARD',
            className: 'info',
            gravity: 'bottom', 
            position: 'left',
            backgroundColor: '#3e5366'   
        }).showToast();
    }
})();;
(function () {
    'use strict';

    function init() {
        $('.menu button', '#technical-support-page').click(handleMenuClick);
        $('#mobile-product-support-select', '#technical-support-page').change(handleMobileMenuChange);
    }

    init();

    //functions

    function handleMenuClick() {
        var productSupportSection = $(this).data('product');

        $('.product-support-section.active').removeClass('active');
        $('.' + productSupportSection + '-support').addClass('active');
        $('.menu button.active').removeClass('active');
        $(this).addClass('active');
    }

    function handleMobileMenuChange() {
        var productSupportSection = $(this).find('option:selected').val();

        if (productSupportSection === 'legacy-products') {
            window.location = '/support/legacy-products';
        }

        $('.product-support-section.active').removeClass('active');
        $('.' + productSupportSection + '-support').addClass('active');
        $('.menu button.active').removeClass('active');
        $(this).addClass('active');
    }
})();;
(function() {
    'use strict';

    function init() {
        $('.btn-slider-scroll-down').click(window.vuzix.scrollToAnchor);
    }

    $(document).ready(init);
})();;
(function(){
    'use strict';
    
    $(document).ready(function() {
        var sliders = $('.videos-slider-component');

        sliders.each(function(index, item) {
            var owl = $(item);
            owl.owlCarousel({
                loop: false,
                nav: true,
                navigationText: [
                    "<i class='fa fa-chevron-left'></i>",
                    "<i class='fa fa-chevron-right'></i>"
                ],
                autoHeight: false,
                dots: true,
                mouseDrag: false,
                touchDrag: false,
                autoPlay: false,
                autoplay: false,
                margin:20,
                stagePadding: 20,
                responsive: {
                    0: {
                        items: 1
                    },
                    499: {
                        items: 2
                    },
                    768: {
                        items: 4
                    }
                }
            });
        });


        $('.smartSwimVideosPageVideoLink').click(function() {
            var videoUrl = $(this).attr('data-url');
            var posterUrl = $(this).attr('data-poster');
            var title = $(this).attr("data-title");
            var description = $(this).attr("data-description");

            $('#top-video-section h4').text(title);
            var video = $('#smartSwimVideo');
            video.attr("src", videoUrl);
            video.attr("poster", posterUrl);
            $('#top-video-section .video-info').html(description);

            $('html, body').animate({
                scrollTop: $('#top-video-section').first().position().top
            });
        });

        $(".smartswimVideoLink").click(function() {
            var videoUrl = $(this).attr("data-url");
            if (videoUrl == null) {
                videoUrl = $(this).data("url");
            }
            var videoPoster = $(this).attr("data-poster");

            $("#webinarVideo").attr("src", videoUrl);
            if (videoPoster) {
                $("#webinarVideo").attr("poster", videoPoster);
            }
            $("#videoModal").modal("show");
        });

        $(".smartswimVideoLink").click(function() {
            var videoUrl = $(this).attr("data-url");
            $("#video-src").attr("src", videoUrl);
        });
    });
})();;
/*! lightgallery - v1.3.7 - 2016-12-11
* http://sachinchoolur.github.io/lightGallery/
* Copyright (c) 2016 Sachin N; Licensed GPLv3 */
!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(a){return b(a)}):"object"==typeof exports?module.exports=b(require("jquery")):b(a.jQuery)}(this,function(a){!function(){"use strict";function b(b,d){if(this.el=b,this.$el=a(b),this.s=a.extend({},c,d),this.s.dynamic&&"undefined"!==this.s.dynamicEl&&this.s.dynamicEl.constructor===Array&&!this.s.dynamicEl.length)throw"When using dynamic mode, you must also define dynamicEl as an Array.";return this.modules={},this.lGalleryOn=!1,this.lgBusy=!1,this.hideBartimeout=!1,this.isTouch="ontouchstart"in document.documentElement,this.s.slideEndAnimatoin&&(this.s.hideControlOnEnd=!1),this.s.dynamic?this.$items=this.s.dynamicEl:"this"===this.s.selector?this.$items=this.$el:""!==this.s.selector?this.s.selectWithin?this.$items=a(this.s.selectWithin).find(this.s.selector):this.$items=this.$el.find(a(this.s.selector)):this.$items=this.$el.children(),this.$slide="",this.$outer="",this.init(),this}var c={mode:"lg-slide",cssEasing:"ease",easing:"linear",speed:600,height:"100%",width:"100%",addClass:"",startClass:"lg-start-zoom",backdropDuration:150,hideBarsDelay:6e3,useLeft:!1,closable:!0,loop:!0,escKey:!0,keyPress:!0,controls:!0,slideEndAnimatoin:!0,hideControlOnEnd:!1,mousewheel:!0,getCaptionFromTitleOrAlt:!0,appendSubHtmlTo:".lg-sub-html",subHtmlSelectorRelative:!1,preload:1,showAfterLoad:!0,selector:"",selectWithin:"",nextHtml:"",prevHtml:"",index:!1,iframeMaxWidth:"100%",download:!0,counter:!0,appendCounterTo:".lg-toolbar",swipeThreshold:50,enableSwipe:!0,enableDrag:!0,dynamic:!1,dynamicEl:[],galleryId:1};b.prototype.init=function(){var b=this;b.s.preload>b.$items.length&&(b.s.preload=b.$items.length);var c=window.location.hash;c.indexOf("lg="+this.s.galleryId)>0&&(b.index=parseInt(c.split("&slide=")[1],10),a("body").addClass("lg-from-hash"),a("body").hasClass("lg-on")||(setTimeout(function(){b.build(b.index)}),a("body").addClass("lg-on"))),b.s.dynamic?(b.$el.trigger("onBeforeOpen.lg"),b.index=b.s.index||0,a("body").hasClass("lg-on")||setTimeout(function(){b.build(b.index),a("body").addClass("lg-on")})):b.$items.on("click.lgcustom",function(c){try{c.preventDefault(),c.preventDefault()}catch(a){c.returnValue=!1}b.$el.trigger("onBeforeOpen.lg"),b.index=b.s.index||b.$items.index(this),a("body").hasClass("lg-on")||(b.build(b.index),a("body").addClass("lg-on"))})},b.prototype.build=function(b){var c=this;c.structure(),a.each(a.fn.lightGallery.modules,function(b){c.modules[b]=new a.fn.lightGallery.modules[b](c.el)}),c.slide(b,!1,!1),c.s.keyPress&&c.keyPress(),c.$items.length>1&&(c.arrow(),setTimeout(function(){c.enableDrag(),c.enableSwipe()},50),c.s.mousewheel&&c.mousewheel()),c.counter(),c.closeGallery(),c.$el.trigger("onAfterOpen.lg"),c.$outer.on("mousemove.lg click.lg touchstart.lg",function(){c.$outer.removeClass("lg-hide-items"),clearTimeout(c.hideBartimeout),c.hideBartimeout=setTimeout(function(){c.$outer.addClass("lg-hide-items")},c.s.hideBarsDelay)})},b.prototype.structure=function(){var b,c="",d="",e=0,f="",g=this;for(a("body").append('<div class="lg-backdrop"></div>'),a(".lg-backdrop").css("transition-duration",this.s.backdropDuration+"ms"),e=0;e<this.$items.length;e++)c+='<div class="lg-item"></div>';if(this.s.controls&&this.$items.length>1&&(d='<div class="lg-actions"><div class="lg-prev lg-icon">'+this.s.prevHtml+'</div><div class="lg-next lg-icon">'+this.s.nextHtml+"</div></div>"),".lg-sub-html"===this.s.appendSubHtmlTo&&(f='<div class="lg-sub-html"></div>'),b='<div class="lg-outer '+this.s.addClass+" "+this.s.startClass+'"><div class="lg" style="width:'+this.s.width+"; height:"+this.s.height+'"><div class="lg-inner">'+c+'</div><div class="lg-toolbar group"><span class="lg-close lg-icon"></span></div>'+d+f+"</div></div>",a("body").append(b),this.$outer=a(".lg-outer"),this.$slide=this.$outer.find(".lg-item"),this.s.useLeft?(this.$outer.addClass("lg-use-left"),this.s.mode="lg-slide"):this.$outer.addClass("lg-use-css3"),g.setTop(),a(window).on("resize.lg orientationchange.lg",function(){setTimeout(function(){g.setTop()},100)}),this.$slide.eq(this.index).addClass("lg-current"),this.doCss()?this.$outer.addClass("lg-css3"):(this.$outer.addClass("lg-css"),this.s.speed=0),this.$outer.addClass(this.s.mode),this.s.enableDrag&&this.$items.length>1&&this.$outer.addClass("lg-grab"),this.s.showAfterLoad&&this.$outer.addClass("lg-show-after-load"),this.doCss()){var h=this.$outer.find(".lg-inner");h.css("transition-timing-function",this.s.cssEasing),h.css("transition-duration",this.s.speed+"ms")}setTimeout(function(){a(".lg-backdrop").addClass("in")}),setTimeout(function(){g.$outer.addClass("lg-visible")},this.s.backdropDuration),this.s.download&&this.$outer.find(".lg-toolbar").append('<a id="lg-download" target="_blank" download class="lg-download lg-icon"></a>'),this.prevScrollTop=a(window).scrollTop()},b.prototype.setTop=function(){if("100%"!==this.s.height){var b=a(window).height(),c=(b-parseInt(this.s.height,10))/2,d=this.$outer.find(".lg");b>=parseInt(this.s.height,10)?d.css("top",c+"px"):d.css("top","0px")}},b.prototype.doCss=function(){var a=function(){var a=["transition","MozTransition","WebkitTransition","OTransition","msTransition","KhtmlTransition"],b=document.documentElement,c=0;for(c=0;c<a.length;c++)if(a[c]in b.style)return!0};return!!a()},b.prototype.isVideo=function(a,b){var c;if(c=this.s.dynamic?this.s.dynamicEl[b].html:this.$items.eq(b).attr("data-html"),!a&&c)return{html5:!0};var d=a.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=|embed\/)?([a-z0-9\-\_\%]+)/i),e=a.match(/\/\/(?:www\.)?vimeo.com\/([0-9a-z\-_]+)/i),f=a.match(/\/\/(?:www\.)?dai.ly\/([0-9a-z\-_]+)/i),g=a.match(/\/\/(?:www\.)?(?:vk\.com|vkontakte\.ru)\/(?:video_ext\.php\?)(.*)/i);return d?{youtube:d}:e?{vimeo:e}:f?{dailymotion:f}:g?{vk:g}:void 0},b.prototype.counter=function(){this.s.counter&&a(this.s.appendCounterTo).append('<div id="lg-counter"><span id="lg-counter-current">'+(parseInt(this.index,10)+1)+'</span> / <span id="lg-counter-all">'+this.$items.length+"</span></div>")},b.prototype.addHtml=function(b){var c,d,e=null;if(this.s.dynamic?this.s.dynamicEl[b].subHtmlUrl?c=this.s.dynamicEl[b].subHtmlUrl:e=this.s.dynamicEl[b].subHtml:(d=this.$items.eq(b),d.attr("data-sub-html-url")?c=d.attr("data-sub-html-url"):(e=d.attr("data-sub-html"),this.s.getCaptionFromTitleOrAlt&&!e&&(e=d.attr("title")||d.find("img").first().attr("alt")))),!c)if("undefined"!=typeof e&&null!==e){var f=e.substring(0,1);"."!==f&&"#"!==f||(e=this.s.subHtmlSelectorRelative&&!this.s.dynamic?d.find(e).html():a(e).html())}else e="";".lg-sub-html"===this.s.appendSubHtmlTo?c?this.$outer.find(this.s.appendSubHtmlTo).load(c):this.$outer.find(this.s.appendSubHtmlTo).html(e):c?this.$slide.eq(b).load(c):this.$slide.eq(b).append(e),"undefined"!=typeof e&&null!==e&&(""===e?this.$outer.find(this.s.appendSubHtmlTo).addClass("lg-empty-html"):this.$outer.find(this.s.appendSubHtmlTo).removeClass("lg-empty-html")),this.$el.trigger("onAfterAppendSubHtml.lg",[b])},b.prototype.preload=function(a){var b=1,c=1;for(b=1;b<=this.s.preload&&!(b>=this.$items.length-a);b++)this.loadContent(a+b,!1,0);for(c=1;c<=this.s.preload&&!(a-c<0);c++)this.loadContent(a-c,!1,0)},b.prototype.loadContent=function(b,c,d){var e,f,g,h,i,j,k=this,l=!1,m=function(b){for(var c=[],d=[],e=0;e<b.length;e++){var g=b[e].split(" ");""===g[0]&&g.splice(0,1),d.push(g[0]),c.push(g[1])}for(var h=a(window).width(),i=0;i<c.length;i++)if(parseInt(c[i],10)>h){f=d[i];break}};if(k.s.dynamic){if(k.s.dynamicEl[b].poster&&(l=!0,g=k.s.dynamicEl[b].poster),j=k.s.dynamicEl[b].html,f=k.s.dynamicEl[b].src,k.s.dynamicEl[b].responsive){var n=k.s.dynamicEl[b].responsive.split(",");m(n)}h=k.s.dynamicEl[b].srcset,i=k.s.dynamicEl[b].sizes}else{if(k.$items.eq(b).attr("data-poster")&&(l=!0,g=k.$items.eq(b).attr("data-poster")),j=k.$items.eq(b).attr("data-html"),f=k.$items.eq(b).attr("href")||k.$items.eq(b).attr("data-src"),k.$items.eq(b).attr("data-responsive")){var o=k.$items.eq(b).attr("data-responsive").split(",");m(o)}h=k.$items.eq(b).attr("data-srcset"),i=k.$items.eq(b).attr("data-sizes")}var p=!1;k.s.dynamic?k.s.dynamicEl[b].iframe&&(p=!0):"true"===k.$items.eq(b).attr("data-iframe")&&(p=!0);var q=k.isVideo(f,b);if(!k.$slide.eq(b).hasClass("lg-loaded")){if(p)k.$slide.eq(b).prepend('<div class="lg-video-cont" style="max-width:'+k.s.iframeMaxWidth+'"><div class="lg-video"><iframe class="lg-object" frameborder="0" src="'+f+'"  allowfullscreen="true"></iframe></div></div>');else if(l){var r="";r=q&&q.youtube?"lg-has-youtube":q&&q.vimeo?"lg-has-vimeo":"lg-has-html5",k.$slide.eq(b).prepend('<div class="lg-video-cont '+r+' "><div class="lg-video"><span class="lg-video-play"></span><img class="lg-object lg-has-poster" src="'+g+'" /></div></div>')}else q?(k.$slide.eq(b).prepend('<div class="lg-video-cont "><div class="lg-video"></div></div>'),k.$el.trigger("hasVideo.lg",[b,f,j])):k.$slide.eq(b).prepend('<div class="lg-img-wrap"><img class="lg-object lg-image" src="'+f+'" /></div>');if(k.$el.trigger("onAferAppendSlide.lg",[b]),e=k.$slide.eq(b).find(".lg-object"),i&&e.attr("sizes",i),h){e.attr("srcset",h);try{picturefill({elements:[e[0]]})}catch(a){console.error("Make sure you have included Picturefill version 2")}}".lg-sub-html"!==this.s.appendSubHtmlTo&&k.addHtml(b),k.$slide.eq(b).addClass("lg-loaded")}k.$slide.eq(b).find(".lg-object").on("load.lg error.lg",function(){var c=0;d&&!a("body").hasClass("lg-from-hash")&&(c=d),setTimeout(function(){k.$slide.eq(b).addClass("lg-complete"),k.$el.trigger("onSlideItemLoad.lg",[b,d||0])},c)}),q&&q.html5&&!l&&k.$slide.eq(b).addClass("lg-complete"),c===!0&&(k.$slide.eq(b).hasClass("lg-complete")?k.preload(b):k.$slide.eq(b).find(".lg-object").on("load.lg error.lg",function(){k.preload(b)}))},b.prototype.slide=function(b,c,d){var e=this.$outer.find(".lg-current").index(),f=this;if(!f.lGalleryOn||e!==b){var g=this.$slide.length,h=f.lGalleryOn?this.s.speed:0,i=!1,j=!1;if(!f.lgBusy){if(this.s.download){var k;k=f.s.dynamic?f.s.dynamicEl[b].downloadUrl!==!1&&(f.s.dynamicEl[b].downloadUrl||f.s.dynamicEl[b].src):"false"!==f.$items.eq(b).attr("data-download-url")&&(f.$items.eq(b).attr("data-download-url")||f.$items.eq(b).attr("href")||f.$items.eq(b).attr("data-src")),k?(a("#lg-download").attr("href",k),f.$outer.removeClass("lg-hide-download")):f.$outer.addClass("lg-hide-download")}if(this.$el.trigger("onBeforeSlide.lg",[e,b,c,d]),f.lgBusy=!0,clearTimeout(f.hideBartimeout),".lg-sub-html"===this.s.appendSubHtmlTo&&setTimeout(function(){f.addHtml(b)},h),this.arrowDisable(b),c){var l=b-1,m=b+1;0===b&&e===g-1?(m=0,l=g-1):b===g-1&&0===e&&(m=0,l=g-1),this.$slide.removeClass("lg-prev-slide lg-current lg-next-slide"),f.$slide.eq(l).addClass("lg-prev-slide"),f.$slide.eq(m).addClass("lg-next-slide"),f.$slide.eq(b).addClass("lg-current")}else f.$outer.addClass("lg-no-trans"),this.$slide.removeClass("lg-prev-slide lg-next-slide"),b<e?(j=!0,0!==b||e!==g-1||d||(j=!1,i=!0)):b>e&&(i=!0,b!==g-1||0!==e||d||(j=!0,i=!1)),j?(this.$slide.eq(b).addClass("lg-prev-slide"),this.$slide.eq(e).addClass("lg-next-slide")):i&&(this.$slide.eq(b).addClass("lg-next-slide"),this.$slide.eq(e).addClass("lg-prev-slide")),setTimeout(function(){f.$slide.removeClass("lg-current"),f.$slide.eq(b).addClass("lg-current"),f.$outer.removeClass("lg-no-trans")},50);f.lGalleryOn?(setTimeout(function(){f.loadContent(b,!0,0)},this.s.speed+50),setTimeout(function(){f.lgBusy=!1,f.$el.trigger("onAfterSlide.lg",[e,b,c,d])},this.s.speed)):(f.loadContent(b,!0,f.s.backdropDuration),f.lgBusy=!1,f.$el.trigger("onAfterSlide.lg",[e,b,c,d])),f.lGalleryOn=!0,this.s.counter&&a("#lg-counter-current").text(b+1)}}},b.prototype.goToNextSlide=function(a){var b=this;b.lgBusy||(b.index+1<b.$slide.length?(b.index++,b.$el.trigger("onBeforeNextSlide.lg",[b.index]),b.slide(b.index,a,!1)):b.s.loop?(b.index=0,b.$el.trigger("onBeforeNextSlide.lg",[b.index]),b.slide(b.index,a,!1)):b.s.slideEndAnimatoin&&(b.$outer.addClass("lg-right-end"),setTimeout(function(){b.$outer.removeClass("lg-right-end")},400)))},b.prototype.goToPrevSlide=function(a){var b=this;b.lgBusy||(b.index>0?(b.index--,b.$el.trigger("onBeforePrevSlide.lg",[b.index,a]),b.slide(b.index,a,!1)):b.s.loop?(b.index=b.$items.length-1,b.$el.trigger("onBeforePrevSlide.lg",[b.index,a]),b.slide(b.index,a,!1)):b.s.slideEndAnimatoin&&(b.$outer.addClass("lg-left-end"),setTimeout(function(){b.$outer.removeClass("lg-left-end")},400)))},b.prototype.keyPress=function(){var b=this;this.$items.length>1&&a(window).on("keyup.lg",function(a){b.$items.length>1&&(37===a.keyCode&&(a.preventDefault(),b.goToPrevSlide()),39===a.keyCode&&(a.preventDefault(),b.goToNextSlide()))}),a(window).on("keydown.lg",function(a){b.s.escKey===!0&&27===a.keyCode&&(a.preventDefault(),b.$outer.hasClass("lg-thumb-open")?b.$outer.removeClass("lg-thumb-open"):b.destroy())})},b.prototype.arrow=function(){var a=this;this.$outer.find(".lg-prev").on("click.lg",function(){a.goToPrevSlide()}),this.$outer.find(".lg-next").on("click.lg",function(){a.goToNextSlide()})},b.prototype.arrowDisable=function(a){!this.s.loop&&this.s.hideControlOnEnd&&(a+1<this.$slide.length?this.$outer.find(".lg-next").removeAttr("disabled").removeClass("disabled"):this.$outer.find(".lg-next").attr("disabled","disabled").addClass("disabled"),a>0?this.$outer.find(".lg-prev").removeAttr("disabled").removeClass("disabled"):this.$outer.find(".lg-prev").attr("disabled","disabled").addClass("disabled"))},b.prototype.setTranslate=function(a,b,c){this.s.useLeft?a.css("left",b):a.css({transform:"translate3d("+b+"px, "+c+"px, 0px)"})},b.prototype.touchMove=function(b,c){var d=c-b;Math.abs(d)>15&&(this.$outer.addClass("lg-dragging"),this.setTranslate(this.$slide.eq(this.index),d,0),this.setTranslate(a(".lg-prev-slide"),-this.$slide.eq(this.index).width()+d,0),this.setTranslate(a(".lg-next-slide"),this.$slide.eq(this.index).width()+d,0))},b.prototype.touchEnd=function(a){var b=this;"lg-slide"!==b.s.mode&&b.$outer.addClass("lg-slide"),this.$slide.not(".lg-current, .lg-prev-slide, .lg-next-slide").css("opacity","0"),setTimeout(function(){b.$outer.removeClass("lg-dragging"),a<0&&Math.abs(a)>b.s.swipeThreshold?b.goToNextSlide(!0):a>0&&Math.abs(a)>b.s.swipeThreshold?b.goToPrevSlide(!0):Math.abs(a)<5&&b.$el.trigger("onSlideClick.lg"),b.$slide.removeAttr("style")}),setTimeout(function(){b.$outer.hasClass("lg-dragging")||"lg-slide"===b.s.mode||b.$outer.removeClass("lg-slide")},b.s.speed+100)},b.prototype.enableSwipe=function(){var a=this,b=0,c=0,d=!1;a.s.enableSwipe&&a.isTouch&&a.doCss()&&(a.$slide.on("touchstart.lg",function(c){a.$outer.hasClass("lg-zoomed")||a.lgBusy||(c.preventDefault(),a.manageSwipeClass(),b=c.originalEvent.targetTouches[0].pageX)}),a.$slide.on("touchmove.lg",function(e){a.$outer.hasClass("lg-zoomed")||(e.preventDefault(),c=e.originalEvent.targetTouches[0].pageX,a.touchMove(b,c),d=!0)}),a.$slide.on("touchend.lg",function(){a.$outer.hasClass("lg-zoomed")||(d?(d=!1,a.touchEnd(c-b)):a.$el.trigger("onSlideClick.lg"))}))},b.prototype.enableDrag=function(){var b=this,c=0,d=0,e=!1,f=!1;b.s.enableDrag&&!b.isTouch&&b.doCss()&&(b.$slide.on("mousedown.lg",function(d){b.$outer.hasClass("lg-zoomed")||(a(d.target).hasClass("lg-object")||a(d.target).hasClass("lg-video-play"))&&(d.preventDefault(),b.lgBusy||(b.manageSwipeClass(),c=d.pageX,e=!0,b.$outer.scrollLeft+=1,b.$outer.scrollLeft-=1,b.$outer.removeClass("lg-grab").addClass("lg-grabbing"),b.$el.trigger("onDragstart.lg")))}),a(window).on("mousemove.lg",function(a){e&&(f=!0,d=a.pageX,b.touchMove(c,d),b.$el.trigger("onDragmove.lg"))}),a(window).on("mouseup.lg",function(g){f?(f=!1,b.touchEnd(d-c),b.$el.trigger("onDragend.lg")):(a(g.target).hasClass("lg-object")||a(g.target).hasClass("lg-video-play"))&&b.$el.trigger("onSlideClick.lg"),e&&(e=!1,b.$outer.removeClass("lg-grabbing").addClass("lg-grab"))}))},b.prototype.manageSwipeClass=function(){var a=this.index+1,b=this.index-1,c=this.$slide.length;this.s.loop&&(0===this.index?b=c-1:this.index===c-1&&(a=0)),this.$slide.removeClass("lg-next-slide lg-prev-slide"),b>-1&&this.$slide.eq(b).addClass("lg-prev-slide"),this.$slide.eq(a).addClass("lg-next-slide")},b.prototype.mousewheel=function(){var a=this;a.$outer.on("mousewheel.lg",function(b){b.deltaY&&(b.deltaY>0?a.goToPrevSlide():a.goToNextSlide(),b.preventDefault())})},b.prototype.closeGallery=function(){var b=this,c=!1;this.$outer.find(".lg-close").on("click.lg",function(){b.destroy()}),b.s.closable&&(b.$outer.on("mousedown.lg",function(b){c=!!(a(b.target).is(".lg-outer")||a(b.target).is(".lg-item ")||a(b.target).is(".lg-img-wrap"))}),b.$outer.on("mouseup.lg",function(d){(a(d.target).is(".lg-outer")||a(d.target).is(".lg-item ")||a(d.target).is(".lg-img-wrap")&&c)&&(b.$outer.hasClass("lg-dragging")||b.destroy())}))},b.prototype.destroy=function(b){var c=this;b||c.$el.trigger("onBeforeClose.lg"),a(window).scrollTop(c.prevScrollTop),b&&(c.s.dynamic||this.$items.off("click.lg click.lgcustom"),a.removeData(c.el,"lightGallery")),this.$el.off(".lg.tm"),a.each(a.fn.lightGallery.modules,function(a){c.modules[a]&&c.modules[a].destroy()}),this.lGalleryOn=!1,clearTimeout(c.hideBartimeout),this.hideBartimeout=!1,a(window).off(".lg"),a("body").removeClass("lg-on lg-from-hash"),c.$outer&&c.$outer.removeClass("lg-visible"),a(".lg-backdrop").removeClass("in"),setTimeout(function(){c.$outer&&c.$outer.remove(),a(".lg-backdrop").remove(),b||c.$el.trigger("onCloseAfter.lg")},c.s.backdropDuration+50)},a.fn.lightGallery=function(c){return this.each(function(){if(a.data(this,"lightGallery"))try{a(this).data("lightGallery").init()}catch(a){console.error("lightGallery has not initiated properly")}else a.data(this,"lightGallery",new b(this,c))})},a.fn.lightGallery.modules={}}()});;
/**
 * Owl Carousel v2.3.4
 * Copyright 2013-2018 David Deutsch
 * Licensed under: SEE LICENSE IN https://github.com/OwlCarousel2/OwlCarousel2/blob/master/LICENSE
 */
!function(a,b,c,d){function e(b,c){this.settings=null,this.options=a.extend({},e.Defaults,c),this.$element=a(b),this._handlers={},this._plugins={},this._supress={},this._current=null,this._speed=null,this._coordinates=[],this._breakpoint=null,this._width=null,this._items=[],this._clones=[],this._mergers=[],this._widths=[],this._invalidated={},this._pipe=[],this._drag={time:null,target:null,pointer:null,stage:{start:null,current:null},direction:null},this._states={current:{},tags:{initializing:["busy"],animating:["busy"],dragging:["interacting"]}},a.each(["onResize","onThrottledResize"],a.proxy(function(b,c){this._handlers[c]=a.proxy(this[c],this)},this)),a.each(e.Plugins,a.proxy(function(a,b){this._plugins[a.charAt(0).toLowerCase()+a.slice(1)]=new b(this)},this)),a.each(e.Workers,a.proxy(function(b,c){this._pipe.push({filter:c.filter,run:a.proxy(c.run,this)})},this)),this.setup(),this.initialize()}e.Defaults={items:3,loop:!1,center:!1,rewind:!1,checkVisibility:!0,mouseDrag:!0,touchDrag:!0,pullDrag:!0,freeDrag:!1,margin:0,stagePadding:0,merge:!1,mergeFit:!0,autoWidth:!1,startPosition:0,rtl:!1,smartSpeed:250,fluidSpeed:!1,dragEndSpeed:!1,responsive:{},responsiveRefreshRate:200,responsiveBaseElement:b,fallbackEasing:"swing",slideTransition:"",info:!1,nestedItemSelector:!1,itemElement:"div",stageElement:"div",refreshClass:"owl-refresh",loadedClass:"owl-loaded",loadingClass:"owl-loading",rtlClass:"owl-rtl",responsiveClass:"owl-responsive",dragClass:"owl-drag",itemClass:"owl-item",stageClass:"owl-stage",stageOuterClass:"owl-stage-outer",grabClass:"owl-grab"},e.Width={Default:"default",Inner:"inner",Outer:"outer"},e.Type={Event:"event",State:"state"},e.Plugins={},e.Workers=[{filter:["width","settings"],run:function(){this._width=this.$element.width()}},{filter:["width","items","settings"],run:function(a){a.current=this._items&&this._items[this.relative(this._current)]}},{filter:["items","settings"],run:function(){this.$stage.children(".cloned").remove()}},{filter:["width","items","settings"],run:function(a){var b=this.settings.margin||"",c=!this.settings.autoWidth,d=this.settings.rtl,e={width:"auto","margin-left":d?b:"","margin-right":d?"":b};!c&&this.$stage.children().css(e),a.css=e}},{filter:["width","items","settings"],run:function(a){var b=(this.width()/this.settings.items).toFixed(3)-this.settings.margin,c=null,d=this._items.length,e=!this.settings.autoWidth,f=[];for(a.items={merge:!1,width:b};d--;)c=this._mergers[d],c=this.settings.mergeFit&&Math.min(c,this.settings.items)||c,a.items.merge=c>1||a.items.merge,f[d]=e?b*c:this._items[d].width();this._widths=f}},{filter:["items","settings"],run:function(){var b=[],c=this._items,d=this.settings,e=Math.max(2*d.items,4),f=2*Math.ceil(c.length/2),g=d.loop&&c.length?d.rewind?e:Math.max(e,f):0,h="",i="";for(g/=2;g>0;)b.push(this.normalize(b.length/2,!0)),h+=c[b[b.length-1]][0].outerHTML,b.push(this.normalize(c.length-1-(b.length-1)/2,!0)),i=c[b[b.length-1]][0].outerHTML+i,g-=1;this._clones=b,a(h).addClass("cloned").appendTo(this.$stage),a(i).addClass("cloned").prependTo(this.$stage)}},{filter:["width","items","settings"],run:function(){for(var a=this.settings.rtl?1:-1,b=this._clones.length+this._items.length,c=-1,d=0,e=0,f=[];++c<b;)d=f[c-1]||0,e=this._widths[this.relative(c)]+this.settings.margin,f.push(d+e*a);this._coordinates=f}},{filter:["width","items","settings"],run:function(){var a=this.settings.stagePadding,b=this._coordinates,c={width:Math.ceil(Math.abs(b[b.length-1]))+2*a,"padding-left":a||"","padding-right":a||""};this.$stage.css(c)}},{filter:["width","items","settings"],run:function(a){var b=this._coordinates.length,c=!this.settings.autoWidth,d=this.$stage.children();if(c&&a.items.merge)for(;b--;)a.css.width=this._widths[this.relative(b)],d.eq(b).css(a.css);else c&&(a.css.width=a.items.width,d.css(a.css))}},{filter:["items"],run:function(){this._coordinates.length<1&&this.$stage.removeAttr("style")}},{filter:["width","items","settings"],run:function(a){a.current=a.current?this.$stage.children().index(a.current):0,a.current=Math.max(this.minimum(),Math.min(this.maximum(),a.current)),this.reset(a.current)}},{filter:["position"],run:function(){this.animate(this.coordinates(this._current))}},{filter:["width","position","items","settings"],run:function(){var a,b,c,d,e=this.settings.rtl?1:-1,f=2*this.settings.stagePadding,g=this.coordinates(this.current())+f,h=g+this.width()*e,i=[];for(c=0,d=this._coordinates.length;c<d;c++)a=this._coordinates[c-1]||0,b=Math.abs(this._coordinates[c])+f*e,(this.op(a,"<=",g)&&this.op(a,">",h)||this.op(b,"<",g)&&this.op(b,">",h))&&i.push(c);this.$stage.children(".active").removeClass("active"),this.$stage.children(":eq("+i.join("), :eq(")+")").addClass("active"),this.$stage.children(".center").removeClass("center"),this.settings.center&&this.$stage.children().eq(this.current()).addClass("center")}}],e.prototype.initializeStage=function(){this.$stage=this.$element.find("."+this.settings.stageClass),this.$stage.length||(this.$element.addClass(this.options.loadingClass),this.$stage=a("<"+this.settings.stageElement+">",{class:this.settings.stageClass}).wrap(a("<div/>",{class:this.settings.stageOuterClass})),this.$element.append(this.$stage.parent()))},e.prototype.initializeItems=function(){var b=this.$element.find(".owl-item");if(b.length)return this._items=b.get().map(function(b){return a(b)}),this._mergers=this._items.map(function(){return 1}),void this.refresh();this.replace(this.$element.children().not(this.$stage.parent())),this.isVisible()?this.refresh():this.invalidate("width"),this.$element.removeClass(this.options.loadingClass).addClass(this.options.loadedClass)},e.prototype.initialize=function(){if(this.enter("initializing"),this.trigger("initialize"),this.$element.toggleClass(this.settings.rtlClass,this.settings.rtl),this.settings.autoWidth&&!this.is("pre-loading")){var a,b,c;a=this.$element.find("img"),b=this.settings.nestedItemSelector?"."+this.settings.nestedItemSelector:d,c=this.$element.children(b).width(),a.length&&c<=0&&this.preloadAutoWidthImages(a)}this.initializeStage(),this.initializeItems(),this.registerEventHandlers(),this.leave("initializing"),this.trigger("initialized")},e.prototype.isVisible=function(){return!this.settings.checkVisibility||this.$element.is(":visible")},e.prototype.setup=function(){var b=this.viewport(),c=this.options.responsive,d=-1,e=null;c?(a.each(c,function(a){a<=b&&a>d&&(d=Number(a))}),e=a.extend({},this.options,c[d]),"function"==typeof e.stagePadding&&(e.stagePadding=e.stagePadding()),delete e.responsive,e.responsiveClass&&this.$element.attr("class",this.$element.attr("class").replace(new RegExp("("+this.options.responsiveClass+"-)\\S+\\s","g"),"$1"+d))):e=a.extend({},this.options),this.trigger("change",{property:{name:"settings",value:e}}),this._breakpoint=d,this.settings=e,this.invalidate("settings"),this.trigger("changed",{property:{name:"settings",value:this.settings}})},e.prototype.optionsLogic=function(){this.settings.autoWidth&&(this.settings.stagePadding=!1,this.settings.merge=!1)},e.prototype.prepare=function(b){var c=this.trigger("prepare",{content:b});return c.data||(c.data=a("<"+this.settings.itemElement+"/>").addClass(this.options.itemClass).append(b)),this.trigger("prepared",{content:c.data}),c.data},e.prototype.update=function(){for(var b=0,c=this._pipe.length,d=a.proxy(function(a){return this[a]},this._invalidated),e={};b<c;)(this._invalidated.all||a.grep(this._pipe[b].filter,d).length>0)&&this._pipe[b].run(e),b++;this._invalidated={},!this.is("valid")&&this.enter("valid")},e.prototype.width=function(a){switch(a=a||e.Width.Default){case e.Width.Inner:case e.Width.Outer:return this._width;default:return this._width-2*this.settings.stagePadding+this.settings.margin}},e.prototype.refresh=function(){this.enter("refreshing"),this.trigger("refresh"),this.setup(),this.optionsLogic(),this.$element.addClass(this.options.refreshClass),this.update(),this.$element.removeClass(this.options.refreshClass),this.leave("refreshing"),this.trigger("refreshed")},e.prototype.onThrottledResize=function(){b.clearTimeout(this.resizeTimer),this.resizeTimer=b.setTimeout(this._handlers.onResize,this.settings.responsiveRefreshRate)},e.prototype.onResize=function(){return!!this._items.length&&(this._width!==this.$element.width()&&(!!this.isVisible()&&(this.enter("resizing"),this.trigger("resize").isDefaultPrevented()?(this.leave("resizing"),!1):(this.invalidate("width"),this.refresh(),this.leave("resizing"),void this.trigger("resized")))))},e.prototype.registerEventHandlers=function(){a.support.transition&&this.$stage.on(a.support.transition.end+".owl.core",a.proxy(this.onTransitionEnd,this)),!1!==this.settings.responsive&&this.on(b,"resize",this._handlers.onThrottledResize),this.settings.mouseDrag&&(this.$element.addClass(this.options.dragClass),this.$stage.on("mousedown.owl.core",a.proxy(this.onDragStart,this)),this.$stage.on("dragstart.owl.core selectstart.owl.core",function(){return!1})),this.settings.touchDrag&&(this.$stage.on("touchstart.owl.core",a.proxy(this.onDragStart,this)),this.$stage.on("touchcancel.owl.core",a.proxy(this.onDragEnd,this)))},e.prototype.onDragStart=function(b){var d=null;3!==b.which&&(a.support.transform?(d=this.$stage.css("transform").replace(/.*\(|\)| /g,"").split(","),d={x:d[16===d.length?12:4],y:d[16===d.length?13:5]}):(d=this.$stage.position(),d={x:this.settings.rtl?d.left+this.$stage.width()-this.width()+this.settings.margin:d.left,y:d.top}),this.is("animating")&&(a.support.transform?this.animate(d.x):this.$stage.stop(),this.invalidate("position")),this.$element.toggleClass(this.options.grabClass,"mousedown"===b.type),this.speed(0),this._drag.time=(new Date).getTime(),this._drag.target=a(b.target),this._drag.stage.start=d,this._drag.stage.current=d,this._drag.pointer=this.pointer(b),a(c).on("mouseup.owl.core touchend.owl.core",a.proxy(this.onDragEnd,this)),a(c).one("mousemove.owl.core touchmove.owl.core",a.proxy(function(b){var d=this.difference(this._drag.pointer,this.pointer(b));a(c).on("mousemove.owl.core touchmove.owl.core",a.proxy(this.onDragMove,this)),Math.abs(d.x)<Math.abs(d.y)&&this.is("valid")||(b.preventDefault(),this.enter("dragging"),this.trigger("drag"))},this)))},e.prototype.onDragMove=function(a){var b=null,c=null,d=null,e=this.difference(this._drag.pointer,this.pointer(a)),f=this.difference(this._drag.stage.start,e);this.is("dragging")&&(a.preventDefault(),this.settings.loop?(b=this.coordinates(this.minimum()),c=this.coordinates(this.maximum()+1)-b,f.x=((f.x-b)%c+c)%c+b):(b=this.settings.rtl?this.coordinates(this.maximum()):this.coordinates(this.minimum()),c=this.settings.rtl?this.coordinates(this.minimum()):this.coordinates(this.maximum()),d=this.settings.pullDrag?-1*e.x/5:0,f.x=Math.max(Math.min(f.x,b+d),c+d)),this._drag.stage.current=f,this.animate(f.x))},e.prototype.onDragEnd=function(b){var d=this.difference(this._drag.pointer,this.pointer(b)),e=this._drag.stage.current,f=d.x>0^this.settings.rtl?"left":"right";a(c).off(".owl.core"),this.$element.removeClass(this.options.grabClass),(0!==d.x&&this.is("dragging")||!this.is("valid"))&&(this.speed(this.settings.dragEndSpeed||this.settings.smartSpeed),this.current(this.closest(e.x,0!==d.x?f:this._drag.direction)),this.invalidate("position"),this.update(),this._drag.direction=f,(Math.abs(d.x)>3||(new Date).getTime()-this._drag.time>300)&&this._drag.target.one("click.owl.core",function(){return!1})),this.is("dragging")&&(this.leave("dragging"),this.trigger("dragged"))},e.prototype.closest=function(b,c){var e=-1,f=30,g=this.width(),h=this.coordinates();return this.settings.freeDrag||a.each(h,a.proxy(function(a,i){return"left"===c&&b>i-f&&b<i+f?e=a:"right"===c&&b>i-g-f&&b<i-g+f?e=a+1:this.op(b,"<",i)&&this.op(b,">",h[a+1]!==d?h[a+1]:i-g)&&(e="left"===c?a+1:a),-1===e},this)),this.settings.loop||(this.op(b,">",h[this.minimum()])?e=b=this.minimum():this.op(b,"<",h[this.maximum()])&&(e=b=this.maximum())),e},e.prototype.animate=function(b){var c=this.speed()>0;this.is("animating")&&this.onTransitionEnd(),c&&(this.enter("animating"),this.trigger("translate")),a.support.transform3d&&a.support.transition?this.$stage.css({transform:"translate3d("+b+"px,0px,0px)",transition:this.speed()/1e3+"s"+(this.settings.slideTransition?" "+this.settings.slideTransition:"")}):c?this.$stage.animate({left:b+"px"},this.speed(),this.settings.fallbackEasing,a.proxy(this.onTransitionEnd,this)):this.$stage.css({left:b+"px"})},e.prototype.is=function(a){return this._states.current[a]&&this._states.current[a]>0},e.prototype.current=function(a){if(a===d)return this._current;if(0===this._items.length)return d;if(a=this.normalize(a),this._current!==a){var b=this.trigger("change",{property:{name:"position",value:a}});b.data!==d&&(a=this.normalize(b.data)),this._current=a,this.invalidate("position"),this.trigger("changed",{property:{name:"position",value:this._current}})}return this._current},e.prototype.invalidate=function(b){return"string"===a.type(b)&&(this._invalidated[b]=!0,this.is("valid")&&this.leave("valid")),a.map(this._invalidated,function(a,b){return b})},e.prototype.reset=function(a){(a=this.normalize(a))!==d&&(this._speed=0,this._current=a,this.suppress(["translate","translated"]),this.animate(this.coordinates(a)),this.release(["translate","translated"]))},e.prototype.normalize=function(a,b){var c=this._items.length,e=b?0:this._clones.length;return!this.isNumeric(a)||c<1?a=d:(a<0||a>=c+e)&&(a=((a-e/2)%c+c)%c+e/2),a},e.prototype.relative=function(a){return a-=this._clones.length/2,this.normalize(a,!0)},e.prototype.maximum=function(a){var b,c,d,e=this.settings,f=this._coordinates.length;if(e.loop)f=this._clones.length/2+this._items.length-1;else if(e.autoWidth||e.merge){if(b=this._items.length)for(c=this._items[--b].width(),d=this.$element.width();b--&&!((c+=this._items[b].width()+this.settings.margin)>d););f=b+1}else f=e.center?this._items.length-1:this._items.length-e.items;return a&&(f-=this._clones.length/2),Math.max(f,0)},e.prototype.minimum=function(a){return a?0:this._clones.length/2},e.prototype.items=function(a){return a===d?this._items.slice():(a=this.normalize(a,!0),this._items[a])},e.prototype.mergers=function(a){return a===d?this._mergers.slice():(a=this.normalize(a,!0),this._mergers[a])},e.prototype.clones=function(b){var c=this._clones.length/2,e=c+this._items.length,f=function(a){return a%2==0?e+a/2:c-(a+1)/2};return b===d?a.map(this._clones,function(a,b){return f(b)}):a.map(this._clones,function(a,c){return a===b?f(c):null})},e.prototype.speed=function(a){return a!==d&&(this._speed=a),this._speed},e.prototype.coordinates=function(b){var c,e=1,f=b-1;return b===d?a.map(this._coordinates,a.proxy(function(a,b){return this.coordinates(b)},this)):(this.settings.center?(this.settings.rtl&&(e=-1,f=b+1),c=this._coordinates[b],c+=(this.width()-c+(this._coordinates[f]||0))/2*e):c=this._coordinates[f]||0,c=Math.ceil(c))},e.prototype.duration=function(a,b,c){return 0===c?0:Math.min(Math.max(Math.abs(b-a),1),6)*Math.abs(c||this.settings.smartSpeed)},e.prototype.to=function(a,b){var c=this.current(),d=null,e=a-this.relative(c),f=(e>0)-(e<0),g=this._items.length,h=this.minimum(),i=this.maximum();this.settings.loop?(!this.settings.rewind&&Math.abs(e)>g/2&&(e+=-1*f*g),a=c+e,(d=((a-h)%g+g)%g+h)!==a&&d-e<=i&&d-e>0&&(c=d-e,a=d,this.reset(c))):this.settings.rewind?(i+=1,a=(a%i+i)%i):a=Math.max(h,Math.min(i,a)),this.speed(this.duration(c,a,b)),this.current(a),this.isVisible()&&this.update()},e.prototype.next=function(a){a=a||!1,this.to(this.relative(this.current())+1,a)},e.prototype.prev=function(a){a=a||!1,this.to(this.relative(this.current())-1,a)},e.prototype.onTransitionEnd=function(a){if(a!==d&&(a.stopPropagation(),(a.target||a.srcElement||a.originalTarget)!==this.$stage.get(0)))return!1;this.leave("animating"),this.trigger("translated")},e.prototype.viewport=function(){var d;return this.options.responsiveBaseElement!==b?d=a(this.options.responsiveBaseElement).width():b.innerWidth?d=b.innerWidth:c.documentElement&&c.documentElement.clientWidth?d=c.documentElement.clientWidth:console.warn("Can not detect viewport width."),d},e.prototype.replace=function(b){this.$stage.empty(),this._items=[],b&&(b=b instanceof jQuery?b:a(b)),this.settings.nestedItemSelector&&(b=b.find("."+this.settings.nestedItemSelector)),b.filter(function(){return 1===this.nodeType}).each(a.proxy(function(a,b){b=this.prepare(b),this.$stage.append(b),this._items.push(b),this._mergers.push(1*b.find("[data-merge]").addBack("[data-merge]").attr("data-merge")||1)},this)),this.reset(this.isNumeric(this.settings.startPosition)?this.settings.startPosition:0),this.invalidate("items")},e.prototype.add=function(b,c){var e=this.relative(this._current);c=c===d?this._items.length:this.normalize(c,!0),b=b instanceof jQuery?b:a(b),this.trigger("add",{content:b,position:c}),b=this.prepare(b),0===this._items.length||c===this._items.length?(0===this._items.length&&this.$stage.append(b),0!==this._items.length&&this._items[c-1].after(b),this._items.push(b),this._mergers.push(1*b.find("[data-merge]").addBack("[data-merge]").attr("data-merge")||1)):(this._items[c].before(b),this._items.splice(c,0,b),this._mergers.splice(c,0,1*b.find("[data-merge]").addBack("[data-merge]").attr("data-merge")||1)),this._items[e]&&this.reset(this._items[e].index()),this.invalidate("items"),this.trigger("added",{content:b,position:c})},e.prototype.remove=function(a){(a=this.normalize(a,!0))!==d&&(this.trigger("remove",{content:this._items[a],position:a}),this._items[a].remove(),this._items.splice(a,1),this._mergers.splice(a,1),this.invalidate("items"),this.trigger("removed",{content:null,position:a}))},e.prototype.preloadAutoWidthImages=function(b){b.each(a.proxy(function(b,c){this.enter("pre-loading"),c=a(c),a(new Image).one("load",a.proxy(function(a){c.attr("src",a.target.src),c.css("opacity",1),this.leave("pre-loading"),!this.is("pre-loading")&&!this.is("initializing")&&this.refresh()},this)).attr("src",c.attr("src")||c.attr("data-src")||c.attr("data-src-retina"))},this))},e.prototype.destroy=function(){this.$element.off(".owl.core"),this.$stage.off(".owl.core"),a(c).off(".owl.core"),!1!==this.settings.responsive&&(b.clearTimeout(this.resizeTimer),this.off(b,"resize",this._handlers.onThrottledResize));for(var d in this._plugins)this._plugins[d].destroy();this.$stage.children(".cloned").remove(),this.$stage.unwrap(),this.$stage.children().contents().unwrap(),this.$stage.children().unwrap(),this.$stage.remove(),this.$element.removeClass(this.options.refreshClass).removeClass(this.options.loadingClass).removeClass(this.options.loadedClass).removeClass(this.options.rtlClass).removeClass(this.options.dragClass).removeClass(this.options.grabClass).attr("class",this.$element.attr("class").replace(new RegExp(this.options.responsiveClass+"-\\S+\\s","g"),"")).removeData("owl.carousel")},e.prototype.op=function(a,b,c){var d=this.settings.rtl;switch(b){case"<":return d?a>c:a<c;case">":return d?a<c:a>c;case">=":return d?a<=c:a>=c;case"<=":return d?a>=c:a<=c}},e.prototype.on=function(a,b,c,d){a.addEventListener?a.addEventListener(b,c,d):a.attachEvent&&a.attachEvent("on"+b,c)},e.prototype.off=function(a,b,c,d){a.removeEventListener?a.removeEventListener(b,c,d):a.detachEvent&&a.detachEvent("on"+b,c)},e.prototype.trigger=function(b,c,d,f,g){var h={item:{count:this._items.length,index:this.current()}},i=a.camelCase(a.grep(["on",b,d],function(a){return a}).join("-").toLowerCase()),j=a.Event([b,"owl",d||"carousel"].join(".").toLowerCase(),a.extend({relatedTarget:this},h,c));return this._supress[b]||(a.each(this._plugins,function(a,b){b.onTrigger&&b.onTrigger(j)}),this.register({type:e.Type.Event,name:b}),this.$element.trigger(j),this.settings&&"function"==typeof this.settings[i]&&this.settings[i].call(this,j)),j},e.prototype.enter=function(b){a.each([b].concat(this._states.tags[b]||[]),a.proxy(function(a,b){this._states.current[b]===d&&(this._states.current[b]=0),this._states.current[b]++},this))},e.prototype.leave=function(b){a.each([b].concat(this._states.tags[b]||[]),a.proxy(function(a,b){this._states.current[b]--},this))},e.prototype.register=function(b){if(b.type===e.Type.Event){if(a.event.special[b.name]||(a.event.special[b.name]={}),!a.event.special[b.name].owl){var c=a.event.special[b.name]._default;a.event.special[b.name]._default=function(a){return!c||!c.apply||a.namespace&&-1!==a.namespace.indexOf("owl")?a.namespace&&a.namespace.indexOf("owl")>-1:c.apply(this,arguments)},a.event.special[b.name].owl=!0}}else b.type===e.Type.State&&(this._states.tags[b.name]?this._states.tags[b.name]=this._states.tags[b.name].concat(b.tags):this._states.tags[b.name]=b.tags,this._states.tags[b.name]=a.grep(this._states.tags[b.name],a.proxy(function(c,d){return a.inArray(c,this._states.tags[b.name])===d},this)))},e.prototype.suppress=function(b){a.each(b,a.proxy(function(a,b){this._supress[b]=!0},this))},e.prototype.release=function(b){a.each(b,a.proxy(function(a,b){delete this._supress[b]},this))},e.prototype.pointer=function(a){var c={x:null,y:null};return a=a.originalEvent||a||b.event,a=a.touches&&a.touches.length?a.touches[0]:a.changedTouches&&a.changedTouches.length?a.changedTouches[0]:a,a.pageX?(c.x=a.pageX,c.y=a.pageY):(c.x=a.clientX,c.y=a.clientY),c},e.prototype.isNumeric=function(a){return!isNaN(parseFloat(a))},e.prototype.difference=function(a,b){return{x:a.x-b.x,y:a.y-b.y}},a.fn.owlCarousel=function(b){var c=Array.prototype.slice.call(arguments,1);return this.each(function(){var d=a(this),f=d.data("owl.carousel");f||(f=new e(this,"object"==typeof b&&b),d.data("owl.carousel",f),a.each(["next","prev","to","destroy","refresh","replace","add","remove"],function(b,c){f.register({type:e.Type.Event,name:c}),f.$element.on(c+".owl.carousel.core",a.proxy(function(a){a.namespace&&a.relatedTarget!==this&&(this.suppress([c]),f[c].apply(this,[].slice.call(arguments,1)),this.release([c]))},f))})),"string"==typeof b&&"_"!==b.charAt(0)&&f[b].apply(f,c)})},a.fn.owlCarousel.Constructor=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this._core=b,this._interval=null,this._visible=null,this._handlers={"initialized.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.autoRefresh&&this.watch()},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this._core.$element.on(this._handlers)};e.Defaults={autoRefresh:!0,autoRefreshInterval:500},e.prototype.watch=function(){this._interval||(this._visible=this._core.isVisible(),this._interval=b.setInterval(a.proxy(this.refresh,this),this._core.settings.autoRefreshInterval))},e.prototype.refresh=function(){this._core.isVisible()!==this._visible&&(this._visible=!this._visible,this._core.$element.toggleClass("owl-hidden",!this._visible),this._visible&&this._core.invalidate("width")&&this._core.refresh())},e.prototype.destroy=function(){var a,c;b.clearInterval(this._interval);for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(c in Object.getOwnPropertyNames(this))"function"!=typeof this[c]&&(this[c]=null)},a.fn.owlCarousel.Constructor.Plugins.AutoRefresh=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this._core=b,this._loaded=[],this._handlers={"initialized.owl.carousel change.owl.carousel resized.owl.carousel":a.proxy(function(b){if(b.namespace&&this._core.settings&&this._core.settings.lazyLoad&&(b.property&&"position"==b.property.name||"initialized"==b.type)){var c=this._core.settings,e=c.center&&Math.ceil(c.items/2)||c.items,f=c.center&&-1*e||0,g=(b.property&&b.property.value!==d?b.property.value:this._core.current())+f,h=this._core.clones().length,i=a.proxy(function(a,b){this.load(b)},this);for(c.lazyLoadEager>0&&(e+=c.lazyLoadEager,c.loop&&(g-=c.lazyLoadEager,e++));f++<e;)this.load(h/2+this._core.relative(g)),h&&a.each(this._core.clones(this._core.relative(g)),i),g++}},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this._core.$element.on(this._handlers)};e.Defaults={lazyLoad:!1,lazyLoadEager:0},e.prototype.load=function(c){var d=this._core.$stage.children().eq(c),e=d&&d.find(".owl-lazy");!e||a.inArray(d.get(0),this._loaded)>-1||(e.each(a.proxy(function(c,d){var e,f=a(d),g=b.devicePixelRatio>1&&f.attr("data-src-retina")||f.attr("data-src")||f.attr("data-srcset");this._core.trigger("load",{element:f,url:g},"lazy"),f.is("img")?f.one("load.owl.lazy",a.proxy(function(){f.css("opacity",1),this._core.trigger("loaded",{element:f,url:g},"lazy")},this)).attr("src",g):f.is("source")?f.one("load.owl.lazy",a.proxy(function(){this._core.trigger("loaded",{element:f,url:g},"lazy")},this)).attr("srcset",g):(e=new Image,e.onload=a.proxy(function(){f.css({"background-image":'url("'+g+'")',opacity:"1"}),this._core.trigger("loaded",{element:f,url:g},"lazy")},this),e.src=g)},this)),this._loaded.push(d.get(0)))},e.prototype.destroy=function(){var a,b;for(a in this.handlers)this._core.$element.off(a,this.handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.Lazy=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(c){this._core=c,this._previousHeight=null,this._handlers={"initialized.owl.carousel refreshed.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.autoHeight&&this.update()},this),"changed.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.autoHeight&&"position"===a.property.name&&this.update()},this),"loaded.owl.lazy":a.proxy(function(a){a.namespace&&this._core.settings.autoHeight&&a.element.closest("."+this._core.settings.itemClass).index()===this._core.current()&&this.update()},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this._core.$element.on(this._handlers),this._intervalId=null;var d=this;a(b).on("load",function(){d._core.settings.autoHeight&&d.update()}),a(b).resize(function(){d._core.settings.autoHeight&&(null!=d._intervalId&&clearTimeout(d._intervalId),d._intervalId=setTimeout(function(){d.update()},250))})};e.Defaults={autoHeight:!1,autoHeightClass:"owl-height"},e.prototype.update=function(){var b=this._core._current,c=b+this._core.settings.items,d=this._core.settings.lazyLoad,e=this._core.$stage.children().toArray().slice(b,c),f=[],g=0;a.each(e,function(b,c){f.push(a(c).height())}),g=Math.max.apply(null,f),g<=1&&d&&this._previousHeight&&(g=this._previousHeight),this._previousHeight=g,this._core.$stage.parent().height(g).addClass(this._core.settings.autoHeightClass)},e.prototype.destroy=function(){var a,b;for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.AutoHeight=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this._core=b,this._videos={},this._playing=null,this._handlers={"initialized.owl.carousel":a.proxy(function(a){a.namespace&&this._core.register({type:"state",name:"playing",tags:["interacting"]})},this),"resize.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.video&&this.isInFullScreen()&&a.preventDefault()},this),"refreshed.owl.carousel":a.proxy(function(a){a.namespace&&this._core.is("resizing")&&this._core.$stage.find(".cloned .owl-video-frame").remove()},this),"changed.owl.carousel":a.proxy(function(a){a.namespace&&"position"===a.property.name&&this._playing&&this.stop()},this),"prepared.owl.carousel":a.proxy(function(b){if(b.namespace){var c=a(b.content).find(".owl-video");c.length&&(c.css("display","none"),this.fetch(c,a(b.content)))}},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this._core.$element.on(this._handlers),this._core.$element.on("click.owl.video",".owl-video-play-icon",a.proxy(function(a){this.play(a)},this))};e.Defaults={video:!1,videoHeight:!1,videoWidth:!1},e.prototype.fetch=function(a,b){var c=function(){return a.attr("data-vimeo-id")?"vimeo":a.attr("data-vzaar-id")?"vzaar":"youtube"}(),d=a.attr("data-vimeo-id")||a.attr("data-youtube-id")||a.attr("data-vzaar-id"),e=a.attr("data-width")||this._core.settings.videoWidth,f=a.attr("data-height")||this._core.settings.videoHeight,g=a.attr("href");if(!g)throw new Error("Missing video URL.");if(d=g.match(/(http:|https:|)\/\/(player.|www.|app.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com|be\-nocookie\.com)|vzaar\.com)\/(video\/|videos\/|embed\/|channels\/.+\/|groups\/.+\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/),d[3].indexOf("youtu")>-1)c="youtube";else if(d[3].indexOf("vimeo")>-1)c="vimeo";else{if(!(d[3].indexOf("vzaar")>-1))throw new Error("Video URL not supported.");c="vzaar"}d=d[6],this._videos[g]={type:c,id:d,width:e,height:f},b.attr("data-video",g),this.thumbnail(a,this._videos[g])},e.prototype.thumbnail=function(b,c){var d,e,f,g=c.width&&c.height?"width:"+c.width+"px;height:"+c.height+"px;":"",h=b.find("img"),i="src",j="",k=this._core.settings,l=function(c){e='<div class="owl-video-play-icon"></div>',d=k.lazyLoad?a("<div/>",{class:"owl-video-tn "+j,srcType:c}):a("<div/>",{class:"owl-video-tn",style:"opacity:1;background-image:url("+c+")"}),b.after(d),b.after(e)};if(b.wrap(a("<div/>",{class:"owl-video-wrapper",style:g})),this._core.settings.lazyLoad&&(i="data-src",j="owl-lazy"),h.length)return l(h.attr(i)),h.remove(),!1;"youtube"===c.type?(f="//img.youtube.com/vi/"+c.id+"/hqdefault.jpg",l(f)):"vimeo"===c.type?a.ajax({type:"GET",url:"//vimeo.com/api/v2/video/"+c.id+".json",jsonp:"callback",dataType:"jsonp",success:function(a){f=a[0].thumbnail_large,l(f)}}):"vzaar"===c.type&&a.ajax({type:"GET",url:"//vzaar.com/api/videos/"+c.id+".json",jsonp:"callback",dataType:"jsonp",success:function(a){f=a.framegrab_url,l(f)}})},e.prototype.stop=function(){this._core.trigger("stop",null,"video"),this._playing.find(".owl-video-frame").remove(),this._playing.removeClass("owl-video-playing"),this._playing=null,this._core.leave("playing"),this._core.trigger("stopped",null,"video")},e.prototype.play=function(b){var c,d=a(b.target),e=d.closest("."+this._core.settings.itemClass),f=this._videos[e.attr("data-video")],g=f.width||"100%",h=f.height||this._core.$stage.height();this._playing||(this._core.enter("playing"),this._core.trigger("play",null,"video"),e=this._core.items(this._core.relative(e.index())),this._core.reset(e.index()),c=a('<iframe frameborder="0" allowfullscreen mozallowfullscreen webkitAllowFullScreen ></iframe>'),c.attr("height",h),c.attr("width",g),"youtube"===f.type?c.attr("src","//www.youtube.com/embed/"+f.id+"?autoplay=1&rel=0&v="+f.id):"vimeo"===f.type?c.attr("src","//player.vimeo.com/video/"+f.id+"?autoplay=1"):"vzaar"===f.type&&c.attr("src","//view.vzaar.com/"+f.id+"/player?autoplay=true"),a(c).wrap('<div class="owl-video-frame" />').insertAfter(e.find(".owl-video")),this._playing=e.addClass("owl-video-playing"))},e.prototype.isInFullScreen=function(){var b=c.fullscreenElement||c.mozFullScreenElement||c.webkitFullscreenElement;return b&&a(b).parent().hasClass("owl-video-frame")},e.prototype.destroy=function(){var a,b;this._core.$element.off("click.owl.video");for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.Video=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this.core=b,this.core.options=a.extend({},e.Defaults,this.core.options),this.swapping=!0,this.previous=d,this.next=d,this.handlers={"change.owl.carousel":a.proxy(function(a){a.namespace&&"position"==a.property.name&&(this.previous=this.core.current(),this.next=a.property.value)},this),"drag.owl.carousel dragged.owl.carousel translated.owl.carousel":a.proxy(function(a){a.namespace&&(this.swapping="translated"==a.type)},this),"translate.owl.carousel":a.proxy(function(a){a.namespace&&this.swapping&&(this.core.options.animateOut||this.core.options.animateIn)&&this.swap()},this)},this.core.$element.on(this.handlers)};e.Defaults={animateOut:!1,
animateIn:!1},e.prototype.swap=function(){if(1===this.core.settings.items&&a.support.animation&&a.support.transition){this.core.speed(0);var b,c=a.proxy(this.clear,this),d=this.core.$stage.children().eq(this.previous),e=this.core.$stage.children().eq(this.next),f=this.core.settings.animateIn,g=this.core.settings.animateOut;this.core.current()!==this.previous&&(g&&(b=this.core.coordinates(this.previous)-this.core.coordinates(this.next),d.one(a.support.animation.end,c).css({left:b+"px"}).addClass("animated owl-animated-out").addClass(g)),f&&e.one(a.support.animation.end,c).addClass("animated owl-animated-in").addClass(f))}},e.prototype.clear=function(b){a(b.target).css({left:""}).removeClass("animated owl-animated-out owl-animated-in").removeClass(this.core.settings.animateIn).removeClass(this.core.settings.animateOut),this.core.onTransitionEnd()},e.prototype.destroy=function(){var a,b;for(a in this.handlers)this.core.$element.off(a,this.handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.Animate=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this._core=b,this._call=null,this._time=0,this._timeout=0,this._paused=!0,this._handlers={"changed.owl.carousel":a.proxy(function(a){a.namespace&&"settings"===a.property.name?this._core.settings.autoplay?this.play():this.stop():a.namespace&&"position"===a.property.name&&this._paused&&(this._time=0)},this),"initialized.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.autoplay&&this.play()},this),"play.owl.autoplay":a.proxy(function(a,b,c){a.namespace&&this.play(b,c)},this),"stop.owl.autoplay":a.proxy(function(a){a.namespace&&this.stop()},this),"mouseover.owl.autoplay":a.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is("rotating")&&this.pause()},this),"mouseleave.owl.autoplay":a.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is("rotating")&&this.play()},this),"touchstart.owl.core":a.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is("rotating")&&this.pause()},this),"touchend.owl.core":a.proxy(function(){this._core.settings.autoplayHoverPause&&this.play()},this)},this._core.$element.on(this._handlers),this._core.options=a.extend({},e.Defaults,this._core.options)};e.Defaults={autoplay:!1,autoplayTimeout:5e3,autoplayHoverPause:!1,autoplaySpeed:!1},e.prototype._next=function(d){this._call=b.setTimeout(a.proxy(this._next,this,d),this._timeout*(Math.round(this.read()/this._timeout)+1)-this.read()),this._core.is("interacting")||c.hidden||this._core.next(d||this._core.settings.autoplaySpeed)},e.prototype.read=function(){return(new Date).getTime()-this._time},e.prototype.play=function(c,d){var e;this._core.is("rotating")||this._core.enter("rotating"),c=c||this._core.settings.autoplayTimeout,e=Math.min(this._time%(this._timeout||c),c),this._paused?(this._time=this.read(),this._paused=!1):b.clearTimeout(this._call),this._time+=this.read()%c-e,this._timeout=c,this._call=b.setTimeout(a.proxy(this._next,this,d),c-e)},e.prototype.stop=function(){this._core.is("rotating")&&(this._time=0,this._paused=!0,b.clearTimeout(this._call),this._core.leave("rotating"))},e.prototype.pause=function(){this._core.is("rotating")&&!this._paused&&(this._time=this.read(),this._paused=!0,b.clearTimeout(this._call))},e.prototype.destroy=function(){var a,b;this.stop();for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.autoplay=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){"use strict";var e=function(b){this._core=b,this._initialized=!1,this._pages=[],this._controls={},this._templates=[],this.$element=this._core.$element,this._overrides={next:this._core.next,prev:this._core.prev,to:this._core.to},this._handlers={"prepared.owl.carousel":a.proxy(function(b){b.namespace&&this._core.settings.dotsData&&this._templates.push('<div class="'+this._core.settings.dotClass+'">'+a(b.content).find("[data-dot]").addBack("[data-dot]").attr("data-dot")+"</div>")},this),"added.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.dotsData&&this._templates.splice(a.position,0,this._templates.pop())},this),"remove.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.dotsData&&this._templates.splice(a.position,1)},this),"changed.owl.carousel":a.proxy(function(a){a.namespace&&"position"==a.property.name&&this.draw()},this),"initialized.owl.carousel":a.proxy(function(a){a.namespace&&!this._initialized&&(this._core.trigger("initialize",null,"navigation"),this.initialize(),this.update(),this.draw(),this._initialized=!0,this._core.trigger("initialized",null,"navigation"))},this),"refreshed.owl.carousel":a.proxy(function(a){a.namespace&&this._initialized&&(this._core.trigger("refresh",null,"navigation"),this.update(),this.draw(),this._core.trigger("refreshed",null,"navigation"))},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this.$element.on(this._handlers)};e.Defaults={nav:!1,navText:['<span aria-label="Previous">&#x2039;</span>','<span aria-label="Next">&#x203a;</span>'],navSpeed:!1,navElement:'button type="button" role="presentation"',navContainer:!1,navContainerClass:"owl-nav",navClass:["owl-prev","owl-next"],slideBy:1,dotClass:"owl-dot",dotsClass:"owl-dots",dots:!0,dotsEach:!1,dotsData:!1,dotsSpeed:!1,dotsContainer:!1},e.prototype.initialize=function(){var b,c=this._core.settings;this._controls.$relative=(c.navContainer?a(c.navContainer):a("<div>").addClass(c.navContainerClass).appendTo(this.$element)).addClass("disabled"),this._controls.$previous=a("<"+c.navElement+">").addClass(c.navClass[0]).html(c.navText[0]).prependTo(this._controls.$relative).on("click",a.proxy(function(a){this.prev(c.navSpeed)},this)),this._controls.$next=a("<"+c.navElement+">").addClass(c.navClass[1]).html(c.navText[1]).appendTo(this._controls.$relative).on("click",a.proxy(function(a){this.next(c.navSpeed)},this)),c.dotsData||(this._templates=[a('<button role="button">').addClass(c.dotClass).append(a("<span>")).prop("outerHTML")]),this._controls.$absolute=(c.dotsContainer?a(c.dotsContainer):a("<div>").addClass(c.dotsClass).appendTo(this.$element)).addClass("disabled"),this._controls.$absolute.on("click","button",a.proxy(function(b){var d=a(b.target).parent().is(this._controls.$absolute)?a(b.target).index():a(b.target).parent().index();b.preventDefault(),this.to(d,c.dotsSpeed)},this));for(b in this._overrides)this._core[b]=a.proxy(this[b],this)},e.prototype.destroy=function(){var a,b,c,d,e;e=this._core.settings;for(a in this._handlers)this.$element.off(a,this._handlers[a]);for(b in this._controls)"$relative"===b&&e.navContainer?this._controls[b].html(""):this._controls[b].remove();for(d in this.overides)this._core[d]=this._overrides[d];for(c in Object.getOwnPropertyNames(this))"function"!=typeof this[c]&&(this[c]=null)},e.prototype.update=function(){var a,b,c,d=this._core.clones().length/2,e=d+this._core.items().length,f=this._core.maximum(!0),g=this._core.settings,h=g.center||g.autoWidth||g.dotsData?1:g.dotsEach||g.items;if("page"!==g.slideBy&&(g.slideBy=Math.min(g.slideBy,g.items)),g.dots||"page"==g.slideBy)for(this._pages=[],a=d,b=0,c=0;a<e;a++){if(b>=h||0===b){if(this._pages.push({start:Math.min(f,a-d),end:a-d+h-1}),Math.min(f,a-d)===f)break;b=0,++c}b+=this._core.mergers(this._core.relative(a))}},e.prototype.draw=function(){var b,c=this._core.settings,d=this._core.items().length<=c.items,e=this._core.relative(this._core.current()),f=c.loop||c.rewind;this._controls.$relative.toggleClass("disabled",!c.nav||d),c.nav&&(this._controls.$previous.toggleClass("disabled",!f&&e<=this._core.minimum(!0)),this._controls.$next.toggleClass("disabled",!f&&e>=this._core.maximum(!0))),this._controls.$absolute.toggleClass("disabled",!c.dots||d),c.dots&&(b=this._pages.length-this._controls.$absolute.children().length,c.dotsData&&0!==b?this._controls.$absolute.html(this._templates.join("")):b>0?this._controls.$absolute.append(new Array(b+1).join(this._templates[0])):b<0&&this._controls.$absolute.children().slice(b).remove(),this._controls.$absolute.find(".active").removeClass("active"),this._controls.$absolute.children().eq(a.inArray(this.current(),this._pages)).addClass("active"))},e.prototype.onTrigger=function(b){var c=this._core.settings;b.page={index:a.inArray(this.current(),this._pages),count:this._pages.length,size:c&&(c.center||c.autoWidth||c.dotsData?1:c.dotsEach||c.items)}},e.prototype.current=function(){var b=this._core.relative(this._core.current());return a.grep(this._pages,a.proxy(function(a,c){return a.start<=b&&a.end>=b},this)).pop()},e.prototype.getPosition=function(b){var c,d,e=this._core.settings;return"page"==e.slideBy?(c=a.inArray(this.current(),this._pages),d=this._pages.length,b?++c:--c,c=this._pages[(c%d+d)%d].start):(c=this._core.relative(this._core.current()),d=this._core.items().length,b?c+=e.slideBy:c-=e.slideBy),c},e.prototype.next=function(b){a.proxy(this._overrides.to,this._core)(this.getPosition(!0),b)},e.prototype.prev=function(b){a.proxy(this._overrides.to,this._core)(this.getPosition(!1),b)},e.prototype.to=function(b,c,d){var e;!d&&this._pages.length?(e=this._pages.length,a.proxy(this._overrides.to,this._core)(this._pages[(b%e+e)%e].start,c)):a.proxy(this._overrides.to,this._core)(b,c)},a.fn.owlCarousel.Constructor.Plugins.Navigation=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){"use strict";var e=function(c){this._core=c,this._hashes={},this.$element=this._core.$element,this._handlers={"initialized.owl.carousel":a.proxy(function(c){c.namespace&&"URLHash"===this._core.settings.startPosition&&a(b).trigger("hashchange.owl.navigation")},this),"prepared.owl.carousel":a.proxy(function(b){if(b.namespace){var c=a(b.content).find("[data-hash]").addBack("[data-hash]").attr("data-hash");if(!c)return;this._hashes[c]=b.content}},this),"changed.owl.carousel":a.proxy(function(c){if(c.namespace&&"position"===c.property.name){var d=this._core.items(this._core.relative(this._core.current())),e=a.map(this._hashes,function(a,b){return a===d?b:null}).join();if(!e||b.location.hash.slice(1)===e)return;b.location.hash=e}},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this.$element.on(this._handlers),a(b).on("hashchange.owl.navigation",a.proxy(function(a){var c=b.location.hash.substring(1),e=this._core.$stage.children(),f=this._hashes[c]&&e.index(this._hashes[c]);f!==d&&f!==this._core.current()&&this._core.to(this._core.relative(f),!1,!0)},this))};e.Defaults={URLhashListener:!1},e.prototype.destroy=function(){var c,d;a(b).off("hashchange.owl.navigation");for(c in this._handlers)this._core.$element.off(c,this._handlers[c]);for(d in Object.getOwnPropertyNames(this))"function"!=typeof this[d]&&(this[d]=null)},a.fn.owlCarousel.Constructor.Plugins.Hash=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){function e(b,c){var e=!1,f=b.charAt(0).toUpperCase()+b.slice(1);return a.each((b+" "+h.join(f+" ")+f).split(" "),function(a,b){if(g[b]!==d)return e=!c||b,!1}),e}function f(a){return e(a,!0)}var g=a("<support>").get(0).style,h="Webkit Moz O ms".split(" "),i={transition:{end:{WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",transition:"transitionend"}},animation:{end:{WebkitAnimation:"webkitAnimationEnd",MozAnimation:"animationend",OAnimation:"oAnimationEnd",animation:"animationend"}}},j={csstransforms:function(){return!!e("transform")},csstransforms3d:function(){return!!e("perspective")},csstransitions:function(){return!!e("transition")},cssanimations:function(){return!!e("animation")}};j.csstransitions()&&(a.support.transition=new String(f("transition")),a.support.transition.end=i.transition.end[a.support.transition]),j.cssanimations()&&(a.support.animation=new String(f("animation")),a.support.animation.end=i.animation.end[a.support.animation]),j.csstransforms()&&(a.support.transform=new String(f("transform")),a.support.transform3d=j.csstransforms3d())}(window.Zepto||window.jQuery,window,document);;
var $ = jQuery.noConflict();

$.fn.inlineStyle = function (prop) {
    return this.prop("style")[$.camelCase(prop)];
};

$.fn.doOnce = function (func) {
    this.length && func.apply(this);
    return this;
};

$.fn.isInViewport = function (offset) {
    if (offset === undefined) {
        offset = 0;
    }
    var elementTop = $(this).offset().top - offset;
    var elementBottom = elementTop + $(this).outerHeight();
    var viewportTop = $(window).scrollTop();
    var viewportBottom = viewportTop + $(window).height();
    return elementBottom > viewportTop && elementTop < viewportBottom;
};

var vuzix = vuzix || {};

var slideDirectionClockwise = true;

(function ($) {

    // USE STRICT
    "use strict";


    // Google Map

    var map = $("google-map").offset();
    if ($("#google-map").length) {

        $('#google-map').gMap({

            address: '2166 Brighton Henrietta Town Line Road, Rochester, New York 14623',
            maptype: 'ROADMAP',
            zoom: 14,
            markers: [
                {
                    address: "2166 Brighton Henrietta Town Line Road, Rochester, New York 14623",
                    html: '<p class="no-b-margin">Here is our Beautiful Office!</p>',
                    icon: {
                        image: "images/icons/map-icon.png",
                        iconsize: [60, 110],
                        iconanchor: [30, 55]
                    }
                }
            ],
            doubleclickzoom: false,
            controls: {
                panControl: true,
                zoomControl: true,
                mapTypeControl: true,
                scaleControl: false,
                streetViewControl: false,
                overviewMapControl: false
            }

        });
    }

    // popovers
    $('[data-toggle="popover"]').popover();

    // Tabs

    $(function () {
        $("#tab-1,#tab-2,#tab-3,#tab-4,#tab-5,#tab-6").tabs({ show: { effect: "fade", duration: 400 } });
    });

    // Sidebar Tabs

    $(function () {
        $("#sidebar-tabs").tabs({ show: { effect: "fade", duration: 400 } });
    });

    $(document).ready(function () {
        $(".open-submenu-on-click").on("click", openSubMenu);
    });

    // Initializing

    vuzix.initialize = {

        init: function () {

            vuzix.initialize.responsiveClasses();

            vuzix.initialize.stickyElements();
            vuzix.initialize.goToTop();
            vuzix.initialize.fullScreen();

            vuzix.initialize.faqsFilter();
            window_resize();
            vuzix.initialize.pageTransition();

            var slider = document.getElementById("slider");
            if (slider) {

                slider.className += " vuz-loaded";
                $("#slider-arrow-right").on('click', sliderRight);
                $("#slider-arrow-left").on('click', sliderLeft);
            }

            $('.fl-slider').addClass('preloader2');

        },
        showMobileMenu: function () {
            var mobileMenu = $("#leftPageMenuWrap");
            var desktopMenu = $("#left-menu");
            var mobileMenuHtml = mobileMenu.html();

            if (mobileMenu.length && desktopMenu.length && !mobileMenuHtml) {
                mobileMenu.html(desktopMenu.html());
                desktopMenu.html("");
            }
        },

        showDesktopMenu: function () {
            var mobileMenu = $("#leftPageMenuWrap");
            var desktopMenu = $("#left-menu");
            var desktopMenuHtml = desktopMenu.html();

            if (mobileMenu.length && desktopMenu.length && !desktopMenuHtml) {
                desktopMenu.html(mobileMenu.html());
                mobileMenu.html("");
            }
        },

        responsiveClasses: function () {
            var jRes = jRespond([
                {
                    label: 'smallest',
                    enter: 0,
                    exit: 479
                }, {
                    label: 'handheld',
                    enter: 480,
                    exit: 767
                }, {
                    label: 'tablet',
                    enter: 768,
                    exit: 991
                }, {
                    label: 'laptop',
                    enter: 992,
                    exit: 1199
                }, {
                    label: 'desktop',
                    enter: 1200,
                    exit: 10000
                }
            ]);




            jRes.addFunc([
                {
                    breakpoint: 'desktop',
                    enter: function () { $body.addClass('device-lg'); vuzix.initialize.showDesktopMenu(); },
                    exit: function () { $body.removeClass('device-lg'); }
                }, {
                    breakpoint: 'laptop',
                    enter: function () { $body.addClass('device-md'); vuzix.initialize.showDesktopMenu(); },
                    exit: function () { $body.removeClass('device-md'); }
                }, {
                    breakpoint: 'tablet',
                    enter: function () { $body.addClass('device-sm'); vuzix.initialize.showMobileMenu(); },
                    exit: function () { $body.removeClass('device-sm'); }
                }, {
                    breakpoint: 'handheld',
                    enter: function () { $body.addClass('device-xs'); vuzix.initialize.showMobileMenu(); },
                    exit: function () { $body.removeClass('device-xs'); }
                }, {
                    breakpoint: 'smallest',
                    enter: function () { $body.addClass('device-xxs'); vuzix.initialize.showMobileMenu(); },
                    exit: function () { $body.removeClass('device-xxs'); }
                }
            ]);
        },







        imagePreload: function (selector, parameters) {
            var params = {
                delay: 250,
                transition: 400,
                easing: 'linear'
            };
            $.extend(params, parameters);

            $(selector).each(function () {
                var image = $(this);
                image.css({ visibility: 'hidden', opacity: 0, display: 'block' });
                image.wrap('<span class="preloader" />');
                image.one("load", function (evt) {
                    $(this).delay(params.delay).css({ visibility: 'visible' }).animate({ opacity: 1 }, params.transition, params.easing, function () {
                        $(this).unwrap('<span class="preloader" />');
                    });
                }).each(function () {
                    if (this.complete) $(this).trigger("load");
                });
            });


        },

        verticalMiddle: function () {
            if ($verticalMiddleEl.length > 0) {
                $verticalMiddleEl.each(function () {
                    var element = $(this),
                        verticalMiddleH = element.outerHeight();

                    if (element.parents('#slider').length > 0) {
                        if ($header.hasClass('transparent-header') && ($body.hasClass('device-lg') || $body.hasClass('device-md'))) {
                            verticalMiddleH = verticalMiddleH - 70;
                            if ($slider.next('#header').length > 0) { verticalMiddleH = verticalMiddleH + 100; }
                        }
                    }

                    if ($body.hasClass('device-xs') || $body.hasClass('device-xxs')) {
                        if (element.parents('.full-screen').length && !element.parents('.force-full-screen').length) {
                            element.css({ position: 'relative', top: '0', width: 'auto', marginTop: '0', padding: '60px 0' }).addClass('clearfix');
                        } else {
                            element.css({ position: 'absolute', top: '50%', width: '100%', marginTop: -(verticalMiddleH / 2) + 'px' });
                        }
                    } else {
                        element.css({ position: 'absolute', top: '50%', width: '100%', marginTop: -(verticalMiddleH / 2) + 'px' });
                    }
                });
            }
        },

        // FAQS Filter

        faqsFilter: function () {
            var $faqItems = $('#faqs .faq');
            if (window.location.hash != '') {
                var getFaqFilterHash = window.location.hash;
                var hashFaqFilter = getFaqFilterHash.split('#');
                if ($faqItems.hasClass(hashFaqFilter[1])) {
                    $('#portfolio-filter li').removeClass('activeFilter');
                    $('[data-filter=".' + hashFaqFilter[1] + '"]').parent('li').addClass('activeFilter');
                    var hashFaqSelector = '.' + hashFaqFilter[1];
                    $faqItems.css('display', 'none');
                    if (hashFaqSelector != 'all') {
                        $(hashFaqSelector).fadeIn(500);
                    } else {
                        $faqItems.fadeIn(500);
                    }
                }
            }
        },

        stickyElements: function () {
            if ($siStickyEl.length > 0) {
                var siStickyH = $siStickyEl.outerHeight();
                $siStickyEl.css({ marginTop: -(siStickyH / 2) + 'px' });
            }
        },

        goToTop: function () {
            $goToTopEl.click(function () {
                $('body,html').stop(true).animate({ scrollTop: 0 }, 400);
                return false;
            });
        },

        goToTopScroll: function () {
            if ($body.hasClass('device-lg') || $body.hasClass('device-md') || $body.hasClass('device-sm')) {
                if ($window.scrollTop() > 450) {
                    $goToTopEl.fadeIn();
                } else {
                    $goToTopEl.fadeOut();
                }
            }
        },

        fullScreen: function () {

            if ($fullScreenEl.length > 0) {
                setTimeout(function () {/// Settimeout 400 added so the height is calculated after the header animation is complete.
                    $fullScreenEl.each(function () {
                        var element = $(this),
                            scrHeight = $window.height();
                        if (element.attr('id') == 'slider') {
                            var sliderHeightOff = $slider.offset().top;
                            scrHeight = scrHeight - sliderHeightOff;
                            if ($('#slider.with-header').next('#header:not(.transparent-header)').length > 0 && ($body.hasClass('device-lg') || $body.hasClass('device-md'))) {
                                var headerHeightOff = $header.outerHeight();
                                scrHeight = scrHeight - headerHeightOff;
                            }
                        }
                        if (element.parents('.full-screen').length > 0) { scrHeight = element.parents('.full-screen').height(); }

                        if ($body.hasClass('device-xxs')) {
                            return;
                        }
                        if ($body.hasClass('device-xs') || $body.hasClass('device-xxs')) {
                            if (!element.hasClass('force-full-screen')) { scrHeight = 'auto'; }
                        }
                        element.css('height', scrHeight);
                        //if( element.attr('id') == 'slider' && !element.hasClass('slider-w') ) { if( element.has('.swiper-slide') ) { element.find('.swiper-slide').css('height', scrHeight); } }
                    });
                }, 400);
            }
        },

        maxHeight: function () {
            if ($commonHeightEl.length > 0) {
                $commonHeightEl.each(function () {
                    var parentEl = $(this),
                        maxHeight = 0;
                    parentEl.children('[class^=col-]').each(function () {
                        var element = $(this).children('div');
                        if (element.hasClass('max-height')) {
                            maxHeight = element.outerHeight();
                        } else {
                            if (element.outerHeight() > maxHeight)
                                maxHeight = element.outerHeight();
                        }
                    });

                    parentEl.children('[class^=col-]').each(function () {
                        $(this).height(maxHeight);
                    });
                });
            }
        },

        testimonialsGrid: function () {
            if ($testimonialsGridEl.length > 0) {
                if ($body.hasClass('device-sm') || $body.hasClass('device-md') || $body.hasClass('device-lg')) {
                    var maxHeight = 0;
                    $testimonialsGridEl.each(function () {
                        $(this).find("li > .testimonial").each(function () {
                            if ($(this).height() > maxHeight) { maxHeight = $(this).height(); }
                        });
                        $(this).find("li").height(maxHeight);
                        maxHeight = 0;
                    });
                } else {
                    $testimonialsGridEl.find("li").css({ 'height': 'auto' });
                }
            }
        },

        pageTransition: function () {
            //if (!$content.hasClass('no-transition')) {
            //    var animationIn = $content.attr('data-animation-in'),
            //        animationOut = $content.attr('data-animation-out'),
            //        durationIn = $content.attr('data-speed-in'),
            //        durationOut = $content.attr('data-speed-out'),
            //        loaderStyle = $content.attr('data-loader'),
            //        loaderStyleHtml = '<div class="spinner"><div class="rect1"></div><div class="rect2"></div><div class="rect3"></div><div class="rect4"></div><div class="rect5"></div></div>';

            //    if (!animationIn) { animationIn = 'fadeIn'; }
            //    if (!animationOut) { animationOut = 'fadeOut'; }
            //    if (!durationIn) { durationIn = 700; }
            //    if (!durationOut) { durationOut = 700; }

            //    $content.animsition({
            //        inClass: animationIn,
            //        outClass: animationOut,
            //        inDuration: Number(durationIn),
            //        outDuration: Number(durationOut),
            //        //linkElement : '#main-menu ul li a:not([target="_blank"]):not([href^=#])',
            //        loading: true,
            //        loadingParentElement: 'spinner',
            //        loadingClass: 'spinner',
            //        loadingHtml: loaderStyleHtml,
            //        unSupportCss: [
            //            'animation-duration',
            //            '-webkit-animation-duration',
            //            '-o-animation-duration'
            //        ],
            //        overlay: false,
            //        overlayClass: 'animsition-overlay-slide',
            //        overlayParentElement: '#main-content'
            //    });


            //}
        },

        topScrollOffset: function () {
            var topOffsetScroll = 0;

            if (($body.hasClass('device-lg') || $body.hasClass('device-md')) && !vuzix.isMobile.any()) {
                console.log("not mobile");
                if (!$pagemenu.length) {
                    if ($header.hasClass('sticky-header')) { topOffsetScroll = 100; } else { topOffsetScroll = 140; }
                }
            } else {
                topOffsetScroll = 40;
            }

            return topOffsetScroll;
        },

        defineColumns: function (element) {
            var column = 4;

            if (element.hasClass('portfolio-full')) {
                if (element.hasClass('portfolio-3')) column = 3;
                else if (element.hasClass('portfolio-5')) column = 5;
                else if (element.hasClass('portfolio-6')) column = 6;
                else column = 4;

                if ($body.hasClass('device-sm') && (column == 4 || column == 5 || column == 6)) {
                    column = 3;
                } else if ($body.hasClass('device-xs') && (column == 3 || column == 4 || column == 5 || column == 6)) {
                    column = 2;
                } else if ($body.hasClass('device-xxs')) {
                    column = 1;
                }
            } else if (element.hasClass('masonry-thumbs')) {
                if (element.hasClass('col-2')) column = 2;
                else if (element.hasClass('col-3')) column = 3;
                else if (element.hasClass('col-5')) column = 5;
                else if (element.hasClass('col-6')) column = 6;
                else column = 4;
            }

            return column;
        },

        setFullColumnWidth: function (element) {

            if (element.hasClass('portfolio-full')) {
                var columns = vuzix.initialize.defineColumns(element);
                var containerWidth = element.width();
                if (containerWidth == (Math.floor(containerWidth / columns) * columns)) { containerWidth = containerWidth - 1; }
                var postWidth = Math.floor(containerWidth / columns);
                if ($body.hasClass('device-xxs')) { var deviceSmallest = 1; } else { var deviceSmallest = 0; }
                element.find(".portfolio-item").each(function (index) {
                    if (deviceSmallest == 0 && $(this).hasClass('wide')) { var elementSize = (postWidth * 2); } else { var elementSize = postWidth; }
                    $(this).css({ "width": elementSize + "px" });
                });
            } else if (element.hasClass('masonry-thumbs')) {
                var columns = vuzix.initialize.defineColumns(element),
                    containerWidth = element.innerWidth(),
                    windowWidth = $window.width();
                if (containerWidth == windowWidth) {
                    containerWidth = windowWidth * 1.004;
                    element.css({ 'width': containerWidth + 'px' });
                }
                var postWidth = (containerWidth / columns);

                postWidth = Math.floor(postWidth);

                if ((postWidth * columns) >= containerWidth) { element.css({ 'margin-right': '-1px' }); }

                element.children('a').css({ "width": postWidth + "px" });

                var bigImageNumber = element.attr('data-big');
                if (bigImageNumber) { bigImageNumber = Number(bigImageNumber) - 1; }
                var firstElementWidth = element.find('a:eq(0)').outerWidth();

                element.isotope({
                    masonry: {
                        columnWidth: firstElementWidth
                    }
                });

                if ($.isNumeric(bigImageNumber)) {
                    var t = setTimeout(function () {
                        element.find('a:eq(' + bigImageNumber + ')').css({ width: firstElementWidth * 2 + 'px' });
                        element.isotope('layout');
                    }, 1000);
                }
            }

        },

        aspectResizer: function () {
            var $aspectResizerEl = $('.aspect-resizer');
            if ($aspectResizerEl.length > 0) {
                $aspectResizerEl.each(function () {
                    var element = $(this),
                        elementW = element.inlineStyle('width'),
                        elementH = element.inlineStyle('height'),
                        elementPW = element.parent().innerWidth();
                });
            }
        },

        dataStyles: function () {
            var $dataStyleXxs = $('[data-style-xxs]'),
                $dataStyleXs = $('[data-style-xs]'),
                $dataStyleSm = $('[data-style-sm]'),
                $dataStyleMd = $('[data-style-md]'),
                $dataStyleLg = $('[data-style-lg]');

            if ($dataStyleXxs.length > 0) {
                $dataStyleXxs.each(function () {
                    var element = $(this),
                        elementStyle = element.attr('data-style-xxs');

                    if ($body.hasClass('device-xxs')) {
                        if (elementStyle != '') { element.attr('style', elementStyle); }
                    }
                });
            }

            if ($dataStyleXs.length > 0) {
                $dataStyleXs.each(function () {
                    var element = $(this),
                        elementStyle = element.attr('data-style-xs');

                    if ($body.hasClass('device-xs')) {
                        if (elementStyle != '') { element.attr('style', elementStyle); }
                    }
                });
            }

            if ($dataStyleSm.length > 0) {
                $dataStyleSm.each(function () {
                    var element = $(this),
                        elementStyle = element.attr('data-style-sm');

                    if ($body.hasClass('device-sm')) {
                        if (elementStyle != '') { element.attr('style', elementStyle); }
                    }
                });
            }

            if ($dataStyleMd.length > 0) {
                $dataStyleMd.each(function () {
                    var element = $(this),
                        elementStyle = element.attr('data-style-md');

                    if ($body.hasClass('device-md')) {
                        if (elementStyle != '') { element.attr('style', elementStyle); }
                    }
                });
            }

            if ($dataStyleLg.length > 0) {
                $dataStyleLg.each(function () {
                    var element = $(this),
                        elementStyle = element.attr('data-style-lg');

                    if ($body.hasClass('device-lg')) {
                        if (elementStyle != '') { element.attr('style', elementStyle); }
                    }
                });
            }
        },

        dataResponsiveHeights: function () {
            var $dataHeightXxs = $('[data-height-xxs]'),
                $dataHeightXs = $('[data-height-xs]'),
                $dataHeightSm = $('[data-height-sm]'),
                $dataHeightMd = $('[data-height-md]'),
                $dataHeightLg = $('[data-height-lg]');

            if ($dataHeightXxs.length > 0) {
                $dataHeightXxs.each(function () {
                    var element = $(this),
                        elementHeight = element.attr('data-height-xxs');

                    if ($body.hasClass('device-xxs')) {
                        if (elementHeight != '') { element.css('height', elementHeight); }
                    }
                });
            }

            if ($dataHeightXs.length > 0) {
                $dataHeightXs.each(function () {
                    var element = $(this),
                        elementHeight = element.attr('data-height-xs');

                    if ($body.hasClass('device-xs')) {
                        if (elementHeight != '') { element.css('height', elementHeight); }
                    }
                });
            }

            if ($dataHeightSm.length > 0) {
                $dataHeightSm.each(function () {
                    var element = $(this),
                        elementHeight = element.attr('data-height-sm');

                    if ($body.hasClass('device-sm')) {
                        if (elementHeight != '') { element.css('height', elementHeight); }
                    }
                });
            }

            if ($dataHeightMd.length > 0) {
                $dataHeightMd.each(function () {
                    var element = $(this),
                        elementHeight = element.attr('data-height-md');

                    if ($body.hasClass('device-md')) {
                        if (elementHeight != '') { element.css('height', elementHeight); }
                    }
                });
            }

            if ($dataHeightLg.length > 0) {
                $dataHeightLg.each(function () {
                    var element = $(this),
                        elementHeight = element.attr('data-height-lg');

                    if ($body.hasClass('device-lg')) {
                        if (elementHeight != '') { element.css('height', elementHeight); }
                    }
                });
            }
        }

    };

    vuzix.header = {

        init: function () {
            vuzix.header.menufunctions();
            vuzix.header.fullWidthMenu();
            vuzix.header.overlayMenu();
            vuzix.header.stickyMenu();
            vuzix.header.sideHeader();
            vuzix.header.sidePanel();
            vuzix.header.topsearch();
        },



        menuInvert: function () {

            $('#main-menu .mega-menu-content, #main-menu ul ul').each(function (index, element) {
                var $menuChildElement = $(element);
                var windowWidth = $window.width();
                var menuChildOffset = $menuChildElement.offset();
                var menuChildWidth = $menuChildElement.width();
                var menuChildLeft = menuChildOffset.left;

                if (windowWidth - (menuChildWidth + menuChildLeft) < 0) {
                    $menuChildElement.addClass('menu-pos-invert');
                }
            });

        },

        menufunctions: function () {

            $('#main-menu ul li:has(ul)').addClass('sub-menu');
            $('.top-links ul li:has(ul) > a').append(' <i class="fa fa-angle-down"></i>');
            $('.top-links > ul').addClass('clearfix');
        },

        fullWidthMenu: function () {
            if ($body.hasClass('full-wide')) {
                if ($header.find('.container-fullwidth').length > 0) { $('.mega-menu .mega-menu-content').css({ 'width': $wrapper.width() - 120 }); }
                if ($header.hasClass('wide-header')) { $('.mega-menu .mega-menu-content').css({ 'width': $wrapper.width() - 60 }); }
            } else {
                if ($header.find('.container-fullwidth').length > 0) { $('.mega-menu .mega-menu-content').css({ 'width': $wrapper.width() - 120 }); }
                if ($header.hasClass('wide-header')) { $('.mega-menu .mega-menu-content').css({ 'width': $wrapper.width() - 80 }); }
            }
        },

        overlayMenu: function () {
            if ($body.hasClass('overlay-menu')) {
                var overlayMenuItem = $('#main-menu').children('ul').children('li'),
                    overlayMenuItemHeight = overlayMenuItem.outerHeight(),
                    overlayMenuItemTHeight = overlayMenuItem.length * overlayMenuItemHeight,
                    firstItemOffset = ($window.height() - overlayMenuItemTHeight) / 2;

                $('#main-menu').children('ul').children('li:first-child').css({ 'margin-top': firstItemOffset + 'px' });
            }
        },

        stickyMenu: function (headerOffset) {
            if ($window.scrollTop() > headerOffset) {
                if (($body.hasClass('device-lg') || $body.hasClass('device-md')) && !vuzix.isMobile.any()) {
                    console.log("sticky menu");
                    $('body:not(.side-header) #header:not(.no-sticky)').addClass('sticky-header');
                    $('#page-menu:not(.no-sticky)').addClass('sticky-page-menu');
                    if (!$headerWrap.hasClass('force-not-dark')) { $headerWrap.removeClass('not-dark'); }
                    vuzix.header.stickyMenuClass();
                } else if ($body.hasClass('device-xs') || $body.hasClass('device-xxs') || $body.hasClass('device-sm')) {
                    $('body.sticky-responsive-menu #header:not(.no-sticky)').addClass('responsive-sticky-header');
                } else {
                    vuzix.header.removeStickyness();
                }
            } else {
                vuzix.header.removeStickyness();
            }
        },

        removeStickyness: function () {
            if ($header.hasClass('sticky-header')) {
                $('body:not(.side-header) #header:not(.no-sticky)').removeClass('sticky-header');
                $('#page-menu:not(.no-sticky)').removeClass('sticky-page-menu');
                $header.removeClass().addClass(oldHeaderClasses);
                $headerWrap.removeClass().addClass(oldHeaderWrapClasses);
                if (!$headerWrap.hasClass('force-not-dark')) { $headerWrap.removeClass('not-dark'); }
                vuzix.slider.swiperSliderMenu();
                //vuzix.slider.revolutionSliderMenu();
                var t = setTimeout(function () { //vuzix.header.splitmenu(); 
                }, 450);
            }
            if ($header.hasClass('responsive-sticky-header')) {
                $('body.sticky-responsive-menu #header').removeClass('responsive-sticky-header');
            }
        },

        sideHeader: function () {
            $("#header-trigger").click(function () {
                $('body.open-header').toggleClass("side-header-open");
                return false;
            });
        },

        sidePanel: function () {
            if ($body.hasClass('side-panel-main')) {
                $(".side-panel-trigger-open,#side-panel-trigger-close").click(function () {
                    $('body.side-panel-main').toggleClass("side-panel-open");
                    return false;
                });
            }
        },

        darkLogo: function () {
            if (($header.hasClass('dark') || $body.hasClass('dark')) && !$headerWrap.hasClass('not-dark')) {
                if (defaultDarkLogo) { defaultLogo.find('img').attr('src', defaultDarkLogo); }
                if (retinaDarkLogo) { retinaLogo.find('img').attr('src', retinaDarkLogo); }
            } else {
                if (defaultLogoImg) { defaultLogo.find('img').attr('src', defaultLogoImg); }
                if (retinaLogoImg) { retinaLogo.find('img').attr('src', retinaLogoImg); }
            }
        },

        stickyMenuClass: function () {
            if (stickyMenuClasses) { var newClassesArray = stickyMenuClasses.split(/ +/); } else { var newClassesArray = ''; }
            var noOfNewClasses = newClassesArray.length;

            if (noOfNewClasses > 0) {
                var i = 0;
                for (i = 0; i < noOfNewClasses; i++) {
                    if (newClassesArray[i] == 'not-dark') {
                        $header.removeClass('dark');
                        $headerWrap.addClass('not-dark');
                    } else if (newClassesArray[i] == 'dark') {
                        $headerWrap.removeClass('not-dark force-not-dark');
                        if (!$header.hasClass(newClassesArray[i])) {
                            $header.addClass(newClassesArray[i]);
                        }
                    } else if (!$header.hasClass(newClassesArray[i])) {
                        $header.addClass(newClassesArray[i]);
                    }
                }
            }

        },

        topsocial: function () {
            if ($topSocialEl.length > 0) {
                if ($body.hasClass('device-md') || $body.hasClass('device-lg')) {
                    $topSocialEl.show();
                    $topSocialEl.find('a').css({ width: 40 });

                    $topSocialEl.find('.ts-text').each(function () {
                        var $clone = $(this).clone().css({ 'visibility': 'hidden', 'display': 'inline-block', 'font-size': '13px', 'font-weight': 'bold' }).appendTo($body),
                            cloneWidth = $clone.innerWidth() + 52;
                        $(this).parent('a').attr('data-hover-width', cloneWidth);
                        $clone.remove();
                    });

                    $topSocialEl.find('a').hover(function () {
                        if ($(this).find('.ts-text').length > 0) {
                            $(this).css({ width: $(this).attr('data-hover-width') });
                        }
                    }, function () {
                        $(this).css({ width: 40 });
                    });
                } else {
                    $topSocialEl.show();
                    $topSocialEl.find('a').css({ width: 40 });

                    $topSocialEl.find('a').each(function () {
                        var topIconTitle = $(this).find('.ts-text').text();
                        $(this).attr('title', topIconTitle);
                    });

                    $topSocialEl.find('a').hover(function () {
                        $(this).css({ width: 40 });
                    }, function () {
                        $(this).css({ width: 40 });
                    });

                    if ($body.hasClass('device-xxs')) {
                        $topSocialEl.hide();
                        $topSocialEl.slice(0, 8).show();
                    }
                }
            }
        },

        topsearch: function () {
            $(document).on('click', function (event) {
                if (!$(event.target).closest('#top-search').length) { $body.toggleClass('top-search-open', false); }
                if (!$(event.target).closest('#page-menu').length) { $pagemenu.toggleClass('pagemenu-active', false); }
                if (!$(event.target).closest('#side-panel').length) { $body.toggleClass('side-panel-open', false); }
            });

            $("#top-search-trigger").click(function (e) {
                $body.toggleClass('top-search-open');
                $pagemenu.toggleClass('pagemenu-active', false);
                if ($body.hasClass('top-search-open')) {
                    $topSearch.find('input').focus();
                }
                e.stopPropagation();
                e.preventDefault();
            });
        },
    };

    vuzix.slider = {

        init: function () {
            vuzix.slider.sliderParallax();
            vuzix.slider.sliderElementsFade();
            vuzix.slider.captionPosition();
        },

        sliderParallaxOffset: function () {
            var sliderParallaxOffsetTop = 0;
            var headerHeight = $header.outerHeight();
            if ($body.hasClass('side-header') || $header.hasClass('transparent-header')) { headerHeight = 0; }
            if ($pageTitle.length > 0) {
                var pageTitleHeight = $pageTitle.outerHeight();
                sliderParallaxOffsetTop = pageTitleHeight + headerHeight;
            } else {
                sliderParallaxOffsetTop = headerHeight;
            }

            if ($slider.next('#header').length > 0) { sliderParallaxOffsetTop = 0; }

            return sliderParallaxOffsetTop;
        },

        sliderParallax: function () {
            if (($body.hasClass('device-lg') || $body.hasClass('device-md')) && !vuzix.isMobile.any()) {
                console.log("parallax");
                var parallaxOffsetTop = vuzix.slider.sliderParallaxOffset();
                if ($window.scrollTop() > parallaxOffsetTop) {
                    $sliderParallaxEl.css({ 'transform': 'translate(0,' + (($window.scrollTop() - parallaxOffsetTop) / 1.5) + 'px)' });
                    $sliderParallaxEl.css('height', '100%');
                    $('.slider-parallax .slider-caption,.ei-title').css({ 'transform': 'translate(0,-' + (($window.scrollTop() - parallaxOffsetTop) / 7) + 'px)' });
                } else {
                    $('.slider-parallax,.slider-parallax .slider-caption,.ei-title').css({ 'transform': 'translate(0,0)' });
                }
            } else {
                $('.slider-parallax,.slider-parallax .slider-caption,.ei-title').css({ 'transform': 'translate(0,0)' });
            }
        },

        sliderElementsFade: function () {
            if (($body.hasClass('device-lg') || $body.hasClass('device-md')) && !vuzix.isMobile.any()) {
                var parallaxOffsetTop = vuzix.slider.sliderParallaxOffset();
                if ($slider.length > 0) {
                    if ($header.hasClass('transparent-header') || $('body').hasClass('side-header')) { var tHeaderOffset = 100; } else { var tHeaderOffset = 0; }
                    $sliderParallaxEl.find('#slider-arrow-left,#slider-arrow-right,.vertical-middle:not(.no-fade),.slider-caption,.ei-title,.camera_prev,.camera_next').css({ 'opacity': ((100 + ($slider.offset().top + parallaxOffsetTop + tHeaderOffset) - $window.scrollTop())) / 90 });
                }
            } else {
                $sliderParallaxEl.find('#slider-arrow-left,#slider-arrow-right,.vertical-middle:not(.no-fade),.slider-caption,.ei-title,.camera_prev,.camera_next').css({ 'opacity': 1 });
            }
        },

        captionPosition: function () {
            $slider.find('.slider-caption').each(function () {
                var scapHeight = $(this).outerHeight();
                var scapSliderHeight = $slider.outerHeight();
                if ($(this).parents('#slider').prev('#header').hasClass('transparent-header') && ($body.hasClass('device-lg') || $body.hasClass('device-md'))) {
                    if ($(this).parents('#slider').prev('#header').hasClass('floating-header')) {
                        $(this).css({ top: (scapSliderHeight + 160 - scapHeight) / 2 + 'px' });
                    } else {
                        $(this).css({ top: (scapSliderHeight + 100 - scapHeight) / 2 + 'px' });
                    }
                } else {
                    $(this).css({ top: (scapSliderHeight - scapHeight) / 2 + 'px' });
                }
            });
        },

        swiperSliderMenu: function () {
            if ($body.hasClass('device-lg') || $body.hasClass('device-md')) {
                var activeSlide = $slider.find('.swiper-slide.swiper-slide-visible');
                vuzix.slider.headerSchemeChanger(activeSlide);
            }
        },

        headerSchemeChanger: function (activeSlide) {
            if (activeSlide.length > 0) {
                if (activeSlide.hasClass('dark')) {
                    $('#header.transparent-header:not(.sticky-header,.semi-transparent,.floating-header)').addClass('dark');
                    $('#header.transparent-header.sticky-header,#header.transparent-header.semi-transparent.sticky-header,#header.transparent-header.floating-header.sticky-header').removeClass('dark');
                    $headerWrap.removeClass('not-dark');
                } else {
                    if ($body.hasClass('dark')) {
                        activeSlide.addClass('not-dark');
                        $('#header.transparent-header:not(.semi-transparent,.floating-header)').removeClass('dark');
                        $('#header.transparent-header:not(.sticky-header,.semi-transparent,.floating-header)').find('#header-wrap').addClass('not-dark');
                    } else {
                        $('#header.transparent-header:not(.semi-transparent,.floating-header)').removeClass('dark');
                        $headerWrap.removeClass('not-dark');
                    }
                }
                vuzix.header.darkLogo();
            }
        },

        owlCaptionInit: function () {
            if ($owlCarouselEl.length > 0) {
                $owlCarouselEl.each(function () {
                    var element = $(this);
                    if (element.find('.owl-dot').length > 0) {
                        element.find('.owl-controls').addClass('with-carousel-dots');
                    }
                });
            }
        }
    };

    vuzix.portfolio = {
        init: function () {
            vuzix.portfolio.ajaxload();
        },

        portIsotope: function () {
            var $container = $('#portfolio');

            //$container.isotope({ transitionDuration: '0.001s' });

            $('#portfolio-filter a').click(function () {
                $('#portfolio-filter li').removeClass('activeFilter');
                $(this).parent('li').addClass('activeFilter');
                var selector = $(this).attr('data-filter');
                $('#portfolio .portfolio-item').isotope({ filter: selector });
                return false;
            });

            $(window).resize(function () {
                $container.isotope('layout');
            });

            $container.infinitescroll({
                loading: {
                    finishedMsg: '<i class="fa fa-check"></i>',
                    msgText: '<i class="fa fa-spinner icon-spin"></i>',
                    img: "images/preloader-dark.gif",
                    speed: 'normal'
                },
                state: {
                    isDone: false
                },
                nextSelector: "#load-next-posts a",
                navSelector: "#load-next-posts",
                itemSelector: "article.portfolio-item",
                behavior: 'portfolioinfiniteitemsloader'
            },
                function (newElements) {
                    $container.isotope('appended', $(newElements));
                    var t = setTimeout(function () { $container.isotope('layout'); }, 2000);
                    vuzix.widget.loadFlexSlider();
                    vuzix.portfolio.arrange();
                });

        },

        portfolioDescMargin: function () {
            var $portfolioOverlayEl = $('.portfolio-overlay');
            if ($portfolioOverlayEl.length > 0) {
                $portfolioOverlayEl.each(function () {
                    var element = $(this);
                    if (element.find('.portfolio-desc').length > 0) {
                        var portfolioOverlayHeight = element.outerHeight();
                        var portfolioOverlayDescHeight = element.find('.portfolio-desc').outerHeight();
                        if (element.find('a.left-icon').length > 0 || element.find('a.right-icon').length > 0 || element.find('a.center-icon').length > 0) {
                            var portfolioOverlayIconHeight = 40 + 20;
                        } else {
                            var portfolioOverlayIconHeight = 0;
                        }
                        var portfolioOverlayMiddleAlign = (portfolioOverlayHeight - portfolioOverlayDescHeight - portfolioOverlayIconHeight) / 2
                        element.find('.portfolio-desc').css({ 'margin-top': portfolioOverlayMiddleAlign });
                    }
                });
            }
        },

        arrange: function () {
            vuzix.initialize.setFullColumnWidth($portfolio);
            $('#portfolio.portfolio-full').isotope('layout');
        },

        ajaxload: function () {
            $('.portfolio-ajax .portfolio-item a.center-icon').click(function (e) {
                var portPostId = $(this).parents('.portfolio-item').attr('id');
                if (!$(this).parents('.portfolio-item').hasClass('portfolio-active')) {
                    vuzix.portfolio.loadItem(portPostId, prevPostPortId);
                }
                e.preventDefault();
            });
        },

        newNextPrev: function (portPostId) {
            var portNext = vuzix.portfolio.getNextItem(portPostId);
            var portPrev = vuzix.portfolio.getPrevItem(portPostId);
            $('#next-portfolio').attr('data-id', portNext);
            $('#prev-portfolio').attr('data-id', portPrev);
        },

        loadItem: function (portPostId, prevPostPortId, getIt) {
            if (!getIt) { getIt = false; }
            var portNext = vuzix.portfolio.getNextItem(portPostId);
            var portPrev = vuzix.portfolio.getPrevItem(portPostId);
            if (getIt == false) {
                vuzix.portfolio.closeItem();
                $portfolioAjaxLoader.fadeIn();
                var portfolioDataLoader = $('#' + portPostId).attr('data-loader');
                $portfolioDetailsContainer.load(portfolioDataLoader, { portid: portPostId, portnext: portNext, portprev: portPrev },
                    function () {
                        vuzix.portfolio.initializeAjax(portPostId);
                        vuzix.portfolio.openItem();
                        $portfolioItems.removeClass('portfolio-active');
                        $('#' + portPostId).addClass('portfolio-active');
                    });
            }
        },

        closeItem: function () {
            if ($portfolioDetails && $portfolioDetails.height() > 32) {
                $portfolioAjaxLoader.fadeIn();
                $portfolioDetails.find('#portfolio-ajax-single').fadeOut('600', function () {
                    $(this).remove();
                });
                $portfolioDetails.removeClass('portfolio-ajax-opened');
            }
        },

        openItem: function () {
            var noOfImages = $portfolioDetails.find('img').length;
            var noLoaded = 0;

            if (noOfImages > 0) {
                $portfolioDetails.find('img').on('load', function () {
                    noLoaded++;
                    var topOffsetScroll = vuzix.initialize.topScrollOffset();
                    if (noOfImages === noLoaded) {
                        $portfolioDetailsContainer.css({ 'display': 'block' });
                        $portfolioDetails.addClass('portfolio-ajax-opened');
                        $portfolioAjaxLoader.fadeOut();
                        var t = setTimeout(function () {
                            vuzix.widget.loadFlexSlider();
                            vuzix.initialize.lightbox();
                            vuzix.initialize.resizeVideos();
                            vuzix.widget.masonryThumbs();
                            $('html,body').stop(true).animate({
                                'scrollTop': $portfolioDetails.offset().top - topOffsetScroll
                            }, 900, 'easeOutQuad');
                        }, 500);
                    }
                });
            } else {
                var topOffsetScroll = vuzix.initialize.topScrollOffset();
                $portfolioDetailsContainer.css({ 'display': 'block' });
                $portfolioDetails.addClass('portfolio-ajax-opened');
                $portfolioAjaxLoader.fadeOut();
                var t = setTimeout(function () {
                    vuzix.widget.loadFlexSlider();
                    vuzix.initialize.lightbox();
                    vuzix.initialize.resizeVideos();
                    vuzix.widget.masonryThumbs();
                    $('html,body').stop(true).animate({
                        'scrollTop': $portfolioDetails.offset().top - topOffsetScroll
                    }, 900, 'easeOutQuad');
                }, 500);
            }
        },

        getNextItem: function (portPostId) {
            var portNext = '';
            var hasNext = $('#' + portPostId).next();
            if (hasNext.length != 0) {
                portNext = hasNext.attr('id');
            }
            return portNext;
        },

        getPrevItem: function (portPostId) {
            var portPrev = '';
            var hasPrev = $('#' + portPostId).prev();
            if (hasPrev.length != 0) {
                portPrev = hasPrev.attr('id');
            }
            return portPrev;
        },

        initializeAjax: function (portPostId) {
            prevPostPortId = $('#' + portPostId);

            $('#next-portfolio, #prev-portfolio').click(function () {
                var portPostId = $(this).attr('data-id');
                $portfolioItems.removeClass('portfolio-active');
                $('#' + portPostId).addClass('portfolio-active');
                vuzix.portfolio.loadItem(portPostId, prevPostPortId);
                return false;
            });

            $('#close-portfolio').click(function () {
                $portfolioDetailsContainer.fadeOut('600', function () {
                    $portfolioDetails.find('#portfolio-ajax-single').remove();
                });
                $portfolioDetails.removeClass('portfolio-ajax-opened');
                $portfolioItems.removeClass('portfolio-active');
                return false;
            });
        }

    };

    vuzix.widget = {

        init: function () {

            vuzix.widget.animations();

            vuzix.widget.tabs();
            vuzix.widget.toggles();
            vuzix.widget.accordions();
            vuzix.widget.textRotater();
            vuzix.widget.linkScroll();
            vuzix.widget.extras();

        },

        parallax: function () {
            if (!vuzix.isMobile.any()) {
                $.stellar({
                    horizontalScrolling: false,
                    verticalOffset: 150,
                    responsive: true
                });
            } else {
                $parallaxEl.addClass('mobile-parallax');
                $parallaxPageTitleEl.addClass('mobile-parallax');
            }
        },

        animations: function () {
            var $dataAnimateEl = $('[data-animate]');
            if ($dataAnimateEl.length > 0) {
                if ($body.hasClass('device-lg') || $body.hasClass('device-md') || $body.hasClass('device-sm')) {
                    $dataAnimateEl.each(function () {
                        var element = $(this),
                            animationDelay = element.attr('data-delay'),
                            animationDelayTime = 0;

                        if (animationDelay) { animationDelayTime = Number(animationDelay) + 500; } else { animationDelayTime = 500; }

                        if (!element.hasClass('animated')) {
                            element.addClass('not-animated');
                            var elementAnimation = element.attr('data-animate');
                            element.appear(function () {
                                setTimeout(function () {
                                    element.removeClass('not-animated').addClass(elementAnimation + ' animated');
                                }, animationDelayTime);
                            }, { accX: 0, accY: -120 }, 'easeInCubic');
                        }
                    });
                }
            }
        },

        tabs: function () {
            var $tabs = $('.tabs:not(.customjs)');
            if ($tabs.length > 0) {
                $tabs.each(function () {
                    var element = $(this),
                        elementSpeed = element.attr('data-speed'),
                        tabActive = element.attr('data-active');

                    if (!elementSpeed) { elementSpeed = 400; }
                    if (!tabActive) { tabActive = 0; } else { tabActive = tabActive - 1; }

                    element.tabs({
                        active: Number(tabActive),
                        show: {
                            effect: "fade",
                            duration: Number(elementSpeed)
                        }
                    });
                });
            }
        },

        toggles: function () {
            var $toggle = $('.toggle');
            if ($toggle.length > 0) {
                $toggle.each(function () {
                    var element = $(this),
                        elementState = element.attr('data-state');

                    if (elementState != 'open') {
                        element.find('.togglec').hide();
                    } else {
                        element.find('.togglet').addClass("toggleta");
                    }

                    element.find('.togglet').click(function (e) {
                        if (e.target.className.indexOf('fa-link') > 0) {
                            return;
                        }

                        $(this).toggleClass('toggleta').next('.togglec').slideToggle(300);
                        return true;
                    });
                });
            }
        },

        accordions: function () {
            var $accordionEl = $('.accordion');
            if ($accordionEl.length > 0) {
                $accordionEl.each(function () {
                    var element = $(this),
                        elementState = element.attr('data-state'),
                        accordionActive = element.attr('data-active');

                    if (!accordionActive) { accordionActive = 0; } else { accordionActive = accordionActive - 1; }

                    element.find('.acc_content').hide();

                    if (elementState != 'closed') {
                        element.find('.acctitle:eq(' + Number(accordionActive) + ')').addClass('acctitlec').next().show();
                    }

                    element.find('.acctitle').click(function () {
                        if ($(this).next().is(':hidden')) {
                            element.find('.acctitle').removeClass('acctitlec').next().slideUp("normal");
                            $(this).toggleClass('acctitlec').next().slideDown("normal");
                        }
                        return false;
                    });
                });
            }
        },

        masonryThumbs: function () {
            var $masonryThumbsEl = $('.masonry-thumbs');
            if ($masonryThumbsEl.length > 0) {
                $masonryThumbsEl.each(function () {
                    var masonryItemContainer = $(this);
                    vuzix.widget.masonryThumbsArrange(masonryItemContainer);
                });
            }
        },

        masonryThumbsArrange: function (element) {
            vuzix.initialize.setFullColumnWidth(element);
            element.isotope('layout');
        },

        notifications: function (element) {
            toastr.clear();
            var notifyElement = $(element),
                notifyPosition = notifyElement.attr('data-notify-position'),
                notifyType = notifyElement.attr('data-notify-type'),
                notifyMsg = notifyElement.attr('data-notify-msg'),
                notifyCloseButton = notifyElement.attr('data-notify-close');

            if (!notifyPosition) { notifyPosition = 'toast-top-full-width'; } else { notifyPosition = 'toast-' + notifyElement.attr('data-notify-position'); }
            if (!notifyMsg) { notifyMsg = 'Please set a message!'; }
            if (notifyCloseButton == 'true') { notifyCloseButton = true; } else { notifyCloseButton = false; }

            toastr.options.positionClass = notifyPosition;
            toastr.options.closeButton = notifyCloseButton;
            toastr.options.closeHtml = '<button><i class="icon-remove"></i></button>';

            if (notifyType == 'warning') {
                toastr.warning(notifyMsg);
            } else if (notifyType == 'error') {
                toastr.error(notifyMsg);
            } else if (notifyType == 'success') {
                toastr.success(notifyMsg);
            } else {
                toastr.info(notifyMsg);
            }

            return false;
        },

        textRotater: function () {
            if ($textRotaterEl.length > 0) {
                $textRotaterEl.each(function () {
                    var element = $(this),
                        trRotate = $(this).attr('data-rotate'),
                        trSpeed = $(this).attr('data-speed'),
                        trSeparator = $(this).attr('data-separator');

                    if (!trRotate) { trRotate = "fade"; }
                    if (!trSpeed) { trSpeed = 1200; }
                    if (!trSeparator) { trSeparator = ","; }

                    var tRotater = $(this).find('.t-rotate');

                    tRotater.Morphext({
                        animation: trRotate,
                        separator: trSeparator,
                        speed: Number(trSpeed)
                    });
                });
            }
        },

        linkScroll: function () {
            $("a[data-scrollto]").click(function () {
                var element = $(this),
                    divScrollToAnchor = element.attr('data-scrollto'),
                    divScrollSpeed = element.attr('data-speed'),
                    divScrollOffset = element.attr('data-offset'),
                    divScrollEasing = element.attr('data-easing');

                if (!divScrollSpeed) { divScrollSpeed = 750; }
                if (!divScrollOffset) { divScrollOffset = vuzix.initialize.topScrollOffset(); }
                if (!divScrollEasing) { divScrollEasing = 'easeOutQuad'; }

                $('html,body').stop(true).animate({
                    'scrollTop': $(divScrollToAnchor).offset().top - Number(divScrollOffset)
                }, Number(divScrollSpeed), divScrollEasing);

                return false;
            });
        },

        extras: function () {
            $('[data-toggle="tooltip"]').tooltip();
            $('#main-menu-trigger,#overlay-menu-close').click(function () {
                $('#main-menu > ul, #main-menu > div > ul').toggleClass("show");
                return false;
            });
            $('#page-submenu-trigger').click(function () {
                $body.toggleClass('top-search-open', false);
                $pagemenu.toggleClass("pagemenu-active");
                return false;
            });
            $pagemenu.find('nav').click(function (e) {
                $body.toggleClass('top-search-open', false);
            });
            if (vuzix.isMobile.any()) {
                $body.addClass('device-touch');
            }

        }

    };

    vuzix.isMobile = {
        Android: function () {
            return navigator.userAgent.match(/Android/i);
        },
        BlackBerry: function () {
            return navigator.userAgent.match(/BlackBerry/i);
        },
        iOS: function () {
            return navigator.userAgent.match(/iPhone|iPad|iPod/i);
        },
        Opera: function () {
            return navigator.userAgent.match(/Opera Mini/i);
        },
        Windows: function () {
            return navigator.userAgent.match(/IEMobile/i);
        },
        any: function () {
            return (vuzix.isMobile.Android() || vuzix.isMobile.BlackBerry() || vuzix.isMobile.iOS() || vuzix.isMobile.Opera() || vuzix.isMobile.Windows() || $("html").hasClass('touch'));
        }
    };

    vuzix.documentOnResize = {

        init: function () {

            var t = setTimeout(function () {
                vuzix.header.topsocial();
                vuzix.header.fullWidthMenu();
                vuzix.header.overlayMenu();
                vuzix.initialize.fullScreen();
                vuzix.initialize.verticalMiddle();
                vuzix.initialize.maxHeight();
                vuzix.initialize.testimonialsGrid();
                vuzix.slider.captionPosition();
                vuzix.portfolio.arrange();
                //vuzix.widget.html5Video();
                vuzix.widget.masonryThumbs();
                vuzix.initialize.dataStyles();
                vuzix.initialize.dataResponsiveHeights();
            }, 500);

        }

    };

    vuzix.documentOnReady = {

        init: function () {
            vuzix.initialize.init();
            vuzix.header.init();
            if ($slider.length > 0) { vuzix.slider.init(); }
            if ($portfolio.length > 0) { vuzix.portfolio.init(); }
            vuzix.widget.init();
            vuzix.documentOnReady.windowscroll();
        },

        windowscroll: function () {

            var headerOffset = $header.offset().top;
            var headerWrapOffset = $headerWrap.offset().top;

            //$window.on('scroll', function () {

            //    vuzix.initialize.goToTopScroll();
            //    $('body.open-header.close-header-on-scroll').removeClass("side-header-open");
            //    vuzix.header.stickyMenu(headerWrapOffset);
            //    vuzix.header.darkLogo();
            //    vuzix.slider.sliderParallax();
            //    vuzix.slider.sliderElementsFade();
            //    //vuzix.header.splitmenu();

            //});

            if ($onePageMenuEl.length > 0) {
                $window.scrolled(function () {
                    vuzix.header.onepageScroller();
                });
            }
        }

    };

    vuzix.documentOnLoad = {

        init: function () {
            vuzix.slider.captionPosition();
            vuzix.slider.swiperSliderMenu();
            vuzix.initialize.maxHeight();
            vuzix.initialize.testimonialsGrid();
            vuzix.initialize.verticalMiddle();
            vuzix.portfolio.portfolioDescMargin();
            vuzix.portfolio.portIsotope();
            vuzix.portfolio.arrange();
            vuzix.widget.parallax();
            vuzix.widget.masonryThumbs();
            vuzix.slider.owlCaptionInit();
            vuzix.header.topsocial();
        }

    };

    var $window = $(window),
        $body = $('body'),
        $wrapper = $('#wrapper'),
        $header = $('#header'),
        $headerWrap = $('#header-wrap'),
        oldHeaderClasses = $header.attr('class'),
        oldHeaderWrapClasses = $headerWrap.attr('class'),
        stickyMenuClasses = $header.attr('data-sticky-class'),
        defaultLogo = $('#logo').find('.logo-style'),
        defaultLogoWidth = defaultLogo.find('img').outerWidth(),
        retinaLogo = $('#logo').find('.retina-logo'),
        defaultLogoImg = defaultLogo.find('img').attr('src'),
        retinaLogoImg = retinaLogo.find('img').attr('src'),
        defaultDarkLogo = defaultLogo.attr('data-dark-logo'),
        retinaDarkLogo = retinaLogo.attr('data-dark-logo'),
        $pagemenu = $('#page-menu'),
        $onePageMenuEl = $('.one-page-menu'),
        onePageGlobalOffset = 0,
        $portfolio = $('#portfolio'),
        $slider = $('#slider'),
        $sliderParallaxEl = $('.slider-parallax'),
        $pageTitle = $('#main-title'),
        $portfolioItems = $('.portfolio-ajax').find('.portfolio-item'),
        $portfolioDetails = $('#portfolio-ajax-wrap'),
        $portfolioDetailsContainer = $('#portfolio-ajax-container'),
        $portfolioAjaxLoader = $('#portfolio-ajax-loader'),
        prevPostPortId = '',
        $topSearch = $('#top-search'),
        $verticalMiddleEl = $('.vertical-middle'),
        $topSocialEl = $('#top-social').find('li'),
        $siStickyEl = $('.si-sticky'),
        $goToTopEl = $('#gotoTop'),
        $fullScreenEl = $('.full-screen'),
        $commonHeightEl = $('.common-height'),
        $testimonialsGridEl = $('.testimonials-grid'),
        $pageSectionEl = $('.page-section'),
        $owlCarouselEl = $('.owl-carousel'),
        $parallaxEl = $('.parallax'),
        $parallaxPageTitleEl = $('.main-title-parallax'),
        $youtubeBgPlayerEl = $('.yt-bg-player'),
        $content = $('#main-content'),
        $textRotaterEl = $('.text-rotater');

    $(document).ready(vuzix.documentOnReady.init);
    $window.load(vuzix.documentOnLoad.init);
    $window.on('resize', vuzix.documentOnResize.init);

    function window_resize() {
        var w = $(window).width();
        var h = $(window).height();
        var ratio = w / h;
        var h_header = $('#header').height();
        if (ratio > 1.9) {
            $('body').addClass('special-ratio');
        } else {
            $('body').removeClass('special-ratio');
        }

        if (ratio < 1.1) {
            $('body').addClass('landscape');
            //$('#main-menu .main-menu-items > li.sub-menu').removeClass('open');
            $('#main-menu ul.top-menu, #main-menu ul.bottom-item').removeClass('show');
            $('#main-menu').removeClass('opened');
            $('#header').removeClass('fixed');
        } else {
            $('body').removeClass('landscape');
            if ($("body").hasClass("device-md") || $("body").hasClass("device-lg")) {
                //$('#main-menu').css('height', 'auto');
                //$('#main-menu').css('top', 0);
            }
            if ((!!$("body").hasClass("device-md") && !$("body").hasClass("device-lg")) && ratio > 1.1) {
                //debugger;
                //$('#main-menu').css('height', h - h_header);
                //$('#main-menu').css('top', h_header);
            }
            $('.landscape #main-menu').css('top', h_header);
            $('#main-menu ul.top-menu, #main-menu ul.bottom-item').removeClass('show');
            $('#main-menu ul li.sub-menu').removeClass('open');
            $('ul li.sub-menu').removeClass('open');
            $('#main-menu').removeClass('opened');
            $('#header').removeClass('fixed');
        }

        if ($("body").hasClass("device-md") || $("body").hasClass("device-lg")) {
            var card_h = $('.shopping-cart .details').height();
            var shoppingCardImageHeight = $('.shopping-cart .image').height();

            if (card_h > shoppingCardImageHeight) {
                $('.shopping-cart .image').css('height', card_h);
            }

            if (h < 770) {
                $('body').addClass('short');
            } else {
                $('body').removeClass('short');
            }
            $('#main-menu ul li.sub-menu').removeClass('open');
            $('#main-menu').removeClass('opened');
            $('#main-menu ul.top-menu, #main-menu ul.bottom-item').removeClass('show');
            //$('.landscape #main-menu').css('height', 'auto');
            //$('.landscape #main-menu').css('top', 0);
        } else {
            $('.shopping-cart .image').css('height', 'auto');
            $('body').removeClass('short');
            //$('.landscape #main-menu').css('height', h - h_header);
            //$('.landscape #main-menu').css('top', h_header);
            $('#main-menu .main-menu-items > li.sub-menu').removeClass('open');
        }

        var slider = document.getElementById("slider");
        if (slider) {
            initializeSlider();
        }


        var w_partner = $('.partner-content').width();
        $('.partner-content iframe').css('height', w_partner * .5625);

        $('.vuzix-product .contents-item .row').each(function () {
            var Product_image = $(this).children('.content-image');
            var Product_content = $(this).children('.content-details').children('.contents');
            var product_h = Product_image.height();
            var productContent_h = Product_content.height();
            if (product_h > productContent_h) {
                $(this).children('.content-details').css('min-height', product_h);
                Product_content.css('padding-top', (product_h - productContent_h) / 2);
            }
        });

        if ($('#vuzix-product-tabs').length) {
            if (w < 768) {
                $('#vuzix-product-tabs').addClass('clicked');
            } else {
                $('#vuzix-product-tabs').removeClass('clicked');
            }
        }


        if ($('#timeline').length) {
            var w_time = $('#timeline .owl-stage').width();
            var h_time = $('#timeline .owl-stage').height();
            var size = w_time + 'px ' + h_time + 'px';
            $('#timeline .owl-stage').css('background-size', size);
        }

        $(document).ready(function () {
            if (w > 572) {
                $window.on('scroll', function () {
                    if ($window.scrollTop() === 0) {
                        $("#wrapper.appstore").removeClass('top-affixed');
                    } else {
                        $("#wrapper.appstore").addClass('top-affixed');
                    }
                });
            }

            if ($('.vuzix-product').length) {
                var h_title = $('.vuzix-product h1').height() + 40;
                var h_tabs = $('.product-details-tabs').height();
            }

            $('ul.product-details-tabs a').bind('click', productScroll);

            $('a.vuzix-inner-tab-button').bind('click', productScroll);

            $('ul.side-bar-tabs li a').bind('click', productScroll);

            function productScroll(event) {
                $('#vuzix-product-tabs').addClass('clicked');
                var $anchor = $(this).attr('target-id');
                var $tabName = $(this).text();
                //show the top images and content
                var topClass = $(this).attr("href").substring(1);
                $(".tabs-top-content").children("div").hide();
                $("." + topClass + "-top").show();

                if (!(typeof $anchor == 'undefined' || $anchor == '')) {
                    var $new_anchor = $(this).attr('href');
                    $new_anchor = $new_anchor.substring(1);
                    var show = $('.' + $new_anchor + '-top .product-showcase');
                    if (w > 768) {
                        if (/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)) {
                            var new_position = h_title + h_tabs + show.height() + 120;
                        } else {
                            //dont scroll to content for features tab
                            if ($new_anchor == "features") {
                                var new_position = 120;
                            } else {
                                var new_position = $(".tabs-top-content").height() + 130 + 150;
                            }
                        }
                    } else {
                        $('#active-menu').text($tabName);
                        var new_position = h_title + $(".tabs-top-content").height() + $("#product-menu").height() + 10;
                    }

                    $('html, body').stop().animate({
                        scrollTop: Math.round(new_position)
                    }, 1500, 'easeInOutExpo');
                    event.preventDefault();
                } else {
                    if ((/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)) && (w < 768)) {
                        var $new_anchor = $(this).attr('href')
                        var show = $($new_anchor + ' .product-showcase');
                        var new_position = h_title + h_tabs + show.height() + 40;
                        $('#active-menu').text($tabName);
                    } else if (w < 768) {
                        var $new_anchor = $(this).attr('href')
                        var show = $($new_anchor + ' .product-showcase');
                        var new_position = h_title + h_tabs + show.height();
                        $('#active-menu').text($tabName);
                    }
                    //$('html, body').stop().animate({
                    //    scrollTop: Math.round(new_position)
                    //}, 1500, 'easeInOutExpo');
                    if ($(this).attr('href').indexOf("#") > -1) {
                        event.preventDefault();
                    }
                }
            }

        });

        if (/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)) {
            $('#content_top').css('top', 0);
        }

        var ua = navigator.userAgent.toLowerCase();
        var isAndroid = ua.indexOf("android") > -1; //&& ua.indexOf("mobile");
        if (isAndroid) {
            $('#header').addClass('android');
        }

        if (/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)) {
            $('#header').addClass('android');
            $('#main-menu .top-menu ul#lang a').on('click touchstart', function () {
                $('#main-menu .bottom-item li').removeClass('open');
                //$(this).parent('.sub-menu').siblings().removeClass('open');
                $(this).parent('.sub-menu').toggleClass('open');
            });
        }

        if ($('#timeline').length) {
            $('.owl-controls').css('width', w);
        }
    }


    $(window).resize(function () {
        window_resize();
    });

    function isTouchDevice() {
        return true == ("ontouchstart" in window || window.DocumentTouch && document instanceof DocumentTouch);
    }

    if (isTouchDevice() === true) {
        $('#content_top').css('top', 0);
        var mouse_is_inside = true;
        var lastScrollTop = 0;
    }
    else {
        var mouse_is_inside = true;
        var lastScrollTop = 0;

        $('#slider').hover(function () {
            mouse_is_inside = true;
        }, function () {
            mouse_is_inside = false;
        });

    }

    // Product Features

    var mouse_is_inside = false;

    $('.product-showcase .hotspots .spot').hover(function () {
        mouse_is_inside = true;
    }, function () {
        mouse_is_inside = false;
    });

    $('.product-showcase .hotspots').on('click', function () {
        if (!mouse_is_inside) $('.product-showcase .hotspots .spot').removeClass('active').animate({
            opacity: 'inherit'
        }, 1500, 'swing');
    });

    $('.product-showcase .hotspots .spot').on('click', function () {
        $(this).siblings('.spot').removeClass('active').animate({
            opacity: 'inherit'
        }, 1500, 'swing');
        $(this).addClass('active').animate({
            opacity: 1
        }, 1500, 'swing');
    });

    function randomSpot() {
        var spot_number = $('.product-showcase .hotspots .spot').length;
        $('.product-showcase .hotspots .spot').removeClass('random');
        var choose_spot = Math.floor((Math.random() * spot_number));
        $('.product-showcase .hotspots .spot').eq(choose_spot).addClass('random');

    }

    $(window).load(function () {
        if ($(".product-showcase .hotspots").length) {
            var randomSpotId = 0;
            $('.product-tab').on('click', function () {
                if ($(this).attr('href') === '#features') {
                    randomSpot();
                    randomSpotId = setInterval(function () {
                        randomSpot();
                    }, 2500);
                } else if (randomSpotId !== 0) {
                    clearInterval(randomSpotId);
                    randomSpotId = 0;
                }
            });
        }
        window_resize();

    });

    autoPlayYouTubeModal();

    //FUNCTION TO GET AND AUTO PLAY YOUTUBE VIDEO FROM DATATAG
    function autoPlayYouTubeModal() {
        var trigger = $("body").find('[data-toggle="modal"]');
        trigger.click(function () {
            var theModal = $(this).data("target"),
                videoSRC = $(this).attr("data-theVideo"),
                videoSRCauto = videoSRC + "?autoplay=1";
            $(theModal + ' iframe').attr('src', videoSRCauto);
            $(theModal + ' button.close').click(function () {
                $(theModal + ' iframe').attr('src', videoSRC);
            });
            $('.modal').click(function () {
                $(theModal + ' iframe').attr('src', videoSRC);
            });
        });
    }

    $('#main-menu .top-item .mobile-drop').on('click', function () {
        $('#main-menu .bottom-item li').removeClass('open');
        //$(this).parent('.sub-menu').siblings().removeClass('open');
        $(this).parent('.sub-menu').toggleClass('open');
    });

    $('#main-menu .bottom-item .mobile-drop').on('click', function () {
        $('#main-menu .top-item li').removeClass('open');
        $(this).parent('.sub-menu').siblings().removeClass('open');
        $(this).parent('.sub-menu').toggleClass('open');
    });

    var isSafari = /Safari/.test(navigator.userAgent) && /Apple Computer/.test(navigator.vendor);
    if (isSafari) {
        $('body').addClass('safari');
    }

    $('#main-menu-trigger').on('click', function () {
        $('#main-menu').toggleClass('opened');
        $('#header').toggleClass('fixed');
        //$('#main-menu ul li.sub-menu:first').toggleClass('open');
    });

    $(document).ready(function () {

        if ($("#blogs-page").length || $("#blog-page").length) {
            let selectedBlogCategory = $("ul.blog-categories .blog-category.active a").html();
            if (selectedBlogCategory) {
                $("ul.blog-categories li.init").html(selectedBlogCategory);
            }

            $("ul.blog-categories").on("click", ".init", function () {
                $(this).closest("ul").children('li:not(.init)').toggle();
            });

            var allOptions = $("ul.blog-categories").children('li:not(.init)');
            $("ul.blog-categories").on("click", "li:not(.init)", function () {
                allOptions.removeClass('selected');
                $(this).addClass('selected');
                $("ul.blog-categories").children('.init').html($(this).html());
                allOptions.toggle();
            });
        }


        



        if ($('#product-menu').length) {
            $('#product-menu').on('click',
                function () {
                    $('#vuzix-product-tabs').toggleClass('clicked');
                });
        }

        $('ul.product-details-tabs a').on('click',
            function () {
                var tab_id = $(this).attr('href');

                if (tab_id == '#accessories') {

                    $('.tab-wrapper.accessories').resize(function () {
                        $('#product-menu').trigger('click');
                    });
                }
            });

        if ($('#side-menu').length) {
            $('#side-menu').on('click',
                function () {
                    $('.side-tabs, .news-tabs, .media-bar, .news-years-list').toggleClass('clicked');
                });
        }

        $('ul.side-bar-tabs li a, .news-years-list li a').on('click',
            function () {
                $('.side-tabs, .news-tabs, .media-bar, .news-years-list').toggleClass('clicked');
                var name = $(this).text();
                $('#active-menu').text(name);
            });

        // Hide Bootstrap popover on outside click.
        $('body').on('click',
            function (e) {
                $('[data-toggle="popover"]').each(function () {
                    if (!$(this).is(e.target) &&
                        $(this).has(e.target).length === 0 &&
                        $('.popover').has(e.target).length === 0) {
                        $(this).popover('hide');
                    }
                });
            });

        $("#vuzix-sdk-button").click(function () {
            var $tabs = $('.tabs:not(.customjs)');
            $tabs.tabs("option", "active", 4);
        });

        $("#videoModal").on('hidden.bs.modal',
            function () {
                toggleVideo('hide');
                $("#webinarVideo").attr("src", "");
            });

        $("#videoModal").on('shown.bs.modal',
            function () {
                toggleVideo('show');
            });

        $(".webinarVideoLink").click(function () {
            var videoUrl = $(this).attr("data-url");
            if (videoUrl == null) {
                videoUrl = $(this).data("url");
            }
            var videoPoster = $(this).attr("data-poster");

            $("#webinarVideo").attr("src", videoUrl);
            if (videoPoster) {
                $("#webinarVideo").attr("poster", videoPoster);
            }
            $("#videoModal").modal("show");
        });

        $(".dronesVideoLink").click(function () {
            var videoUrl = $(this).attr("data-url");
            if (videoUrl === null) {
                videoUrl = $(this).data("url");
            }
            var videoPoster = $(this).attr("data-poster");

            $("#dronesVideo").attr("src", videoUrl);
            if (videoPoster) {
                $("#dronesVideo").attr("poster", videoPoster);
            }
            $("#videoModal").modal("show");

        });

        function toggleVideo(state) {
            console.log("toggle video");

            $('.modal.smart-swim .modal-dialog').css('max-height', $(window).height());
            $('.modal.smart-swim .modal-dialog .video-container').css('height', $(window).height() - 80);
            $('.modal.smart-swim .modal-dialog .video-container').css('padding-bottom', '20px');

            // if state == 'hide', hide. Else: show video
            var div = document.getElementById("popupVid");
            div.style.display = state === 'hide' ? 'none' : '';
            div.style.maxHeight = $(window).height();

            if (div.getElementsByTagName("iframe").length > 0) {

                var iframe = div.getElementsByTagName("iframe")[0].contentWindow;
                var func = state === 'hide' ? 'pauseVideo' : 'playVideo';

                setTimeout(function () {
                    iframe.postMessage('{"event":"command","func":"' + func + '","args":""}', '*');
                });
            }

            setTimeout(function () {
                if (div.getElementsByTagName("video").length > 0) {
                    if (state === 'hide') {
                        div.getElementsByTagName("video")[0].pause();
                    } else {
                        div.getElementsByTagName("video")[0].play();
                    }
                }
            });
        }

        if ($("#videoModal").length) {
            //toggleVideo();
        }

        //light gallery day1
        if ($('#lightgallery').length) {
            $('#lightgallery').lightGallery();
        }
        //light gallery day2
        if ($('#lightgallery2').length) {
            $('#lightgallery2').lightGallery();
        }
        //light gallery day3
        if ($('#lightgallery3').length) {
            $('#lightgallery3').lightGallery();
        }
        //light gallery day4
        if ($('#lightgallery4').length) {
            $('#lightgallery4').lightGallery();
        }

        //MK: Back button tab fix
        $(".vuzix-back-button-tab").click(function (e) {
            if (history.replaceState) {
                history.replaceState(null, null, e.currentTarget.hash);
            }
            else {
                location.replace(e.currentTarget.hash);
            }
        });

        $("#vuzix-continue-shopping-button").click(function () {
            var url = window.location.href.toLowerCase();
            debugger
            if (url.indexOf("addtocart") !== -1
                || url.indexOf("accessorydetails") !== -1) {
                window.history.go(-1);
            } else {
                $("#side-panel-trigger-close").trigger("click");
            }
        });

        // On scroll animations for products 

        var animationsActive = false;
        if ($("#feature-display").length && window.innerWidth >= 991) {
            console.log("feature display");
            $(".line-box label").hover(function () {
                $(this).siblings(".outer-circle").addClass("pulse-animation");
            }, function () {
                $(this).siblings(".outer-circle").removeClass("pulse-animation");
            });
            $(window).scroll(function () {
                var target = $(window);
                var docViewTop = target.scrollTop();
                var docViewBottom = docViewTop + target.height();

                var targetElement = $("#feature-display");
                if (targetElement.length > 0) {
                    // Animations for blade
                    var elemTop = targetElement.offset().top;
                    if (!animationsActive && elemTop < 0.85 * docViewBottom && elemTop + targetElement.innerHeight() / 2 > docViewTop) {
                        console.log("active animations");
                        activeBladeAnimations();
                        animationsActive = true;
                    } else if (animationsActive && (elemTop < (docViewTop - targetElement.innerHeight()) || elemTop > docViewBottom)) {
                        console.log("remove animations");
                        resetBladeAnimations();
                        animationsActive = false;
                    }
                }

            });
        }

        // Timeline animations for blade reservation

        var reservationAnimationsActive = false;

        if ($("#blade #timeline").length && window.innerWidth >= 767) {

            $(window).scroll(function () {
                var target = $(window);
                var docViewTop = target.scrollTop();
                var docViewBottom = docViewTop + target.height();
                var targetElement = $("#blade #timeline");
                var elemTop = targetElement.offset().top;
                if (!reservationAnimationsActive && elemTop < 0.85 * docViewBottom) {
                    var centerLine = $("#blade #timeline .center-line");
                    centerLine.addClass("active");
                    setTimeout(function () { animateBladeReservationSectionOne(); }, 300);
                    setTimeout(function () { animateBladeReservationSectionTwo(); }, 1100);
                    setTimeout(function () { animateBladeReservationSectionThree(); }, 2000);
                    reservationAnimationsActive = true;
                }
                else if (reservationAnimationsActive && (elemTop > docViewBottom || docViewTop == 0)) {
                    resetBladeReservationAnimations();
                    reservationAnimationsActive = false;
                }
            });
        }

        if ($(".animate-slide-in").length > 0) {
            var animate = $(".animate-slide-in");
            $(window).scroll(function () {
                var target = $(window);
                var docViewTop = target.scrollTop();
                var docViewBottom = docViewTop + target.height();
                for (var i = 0; i < animate.length; i++) {
                    var el = animate.eq(i);
                    var elTop = el.offset().top;
                    if (elTop < docViewBottom - 50 && elTop > docViewTop) {
                        el.addClass("active");
                        var button = el.find(".animate-right-slow-wide");
                        var button2 = el.find(".animate-left-slow-wide");
                        setTimeout(function () {
                            button.addClass("active");
                            button2.addClass("active");
                        }, 300);
                    } else if (elTop + el.outerHeight() < docViewTop || elTop > docViewBottom) {
                        el.removeClass("active");
                        el.find(".animate-right-slow-wide").removeClass("active")
                        el.find(".animate-left-slow-wide").removeClass("active")
                    }

                }
            });
        }

        $(".toggle-password").click(function () {
            $(this).toggleClass("fa-eye fa-eye-slash");
            var input = $($(this).attr("toggle"));
            if (input.attr("type") === "password") {
                input.attr("type", "text");
            } else {
                input.attr("type", "password");
            }
        });
    });
})(jQuery);

function resetBladeReservationAnimations() {
    var centerLine = $("#blade #timeline .center-line");
    centerLine.removeClass("active");
    $(".blade-anim-line").removeClass('active');
    $(".blade-anim-incirc").removeClass('active');
    $(".blade-anim-circ").removeClass('active');
    $(".blade-anim-img").removeClass('active');
    $("#blade .cover-box").removeClass('active');
}

function animateBladeReservationSectionOne() {
    $("#blade .step-1 .cover-box").addClass("active");
    $(".step-1 .blade-anim-line").addClass('active');
    setTimeout(function () { $(".step-1 .blade-anim-incirc").addClass('active'); }, 200);
    setTimeout(function () { $(".step-1 .blade-anim-img").addClass('active'); }, 300);
    $(".step-1 .blade-anim-circ").addClass('active');
}

function animateBladeReservationSectionTwo() {
    $("#blade .step-2 .cover-box").addClass("active");
    $(".step-2 .blade-anim-line").addClass('active');
    setTimeout(function () { $(".step-2 .blade-anim-incirc").addClass('active'); }, 200);
    setTimeout(function () { $(".step-2 .blade-anim-img").addClass('active'); }, 300);
    $(".step-2 .blade-anim-circ").addClass('active');
}

function animateBladeReservationSectionThree() {
    $("#blade .step-3 .cover-box").addClass("active");
    $(".step-3 .blade-anim-line").addClass('active');
    setTimeout(function () { $(".step-3 .blade-anim-incirc").addClass('active'); }, 200);
    setTimeout(function () { $(".step-3 .blade-anim-img").addClass('active'); }, 300);
    $(".step-3 .blade-anim-circ").addClass('active');
}

function activeBladeAnimations() {
    setTimeout(function () {
        $(".horizontal-line").addClass("blade-active")
    }, 500);
    setTimeout(function () {
        $(".line-box label").addClass("blade-active")
    }, 700);
    $(".vertical-line").addClass("blade-active");
    $(".outer-circle").addClass("blade-active");
}

function resetBladeAnimations() {
    $(".horizontal-line").removeClass("blade-active");
    $(".vertical-line").removeClass("blade-active");
    $(".outer-circle").removeClass("blade-active");
    $(".line-box label").removeClass("blade-active")
}

//window.onhashchange = function (event) {
//    //console.log("location: " + document.location + ", state: " + JSON.stringify(event.state));
//};

function openSubMenu() {
    var parent = $(this).parent();
    parent.toggleClass('open');
}

function scrollToAnchorVuzixBasics(element) {
    element.blur();
    var selectedId = element.getAttribute('data-href');
    var to = $("#" + selectedId).offset().top - 95;
    $('html, body').animate({
        scrollTop: to
    }, 800);
}

function scrollToAnchor(element) {
    element.blur();
    var selectedId = element.getAttribute('href');

    //check if the element is tab content
    if ($("#" + selectedId).attr("data-toggle") == "tab") {
        $("#" + selectedId).tab('show') // Select tab by name
    }

    var to = $("#" + selectedId).offset().top - 120;
    $('html, body').animate({
        scrollTop: to
    }, 800);
}
function scrollToAnchor2(element) {
    element.blur();
    var selectedId = element.getAttribute('href');
    var to = $(selectedId).offset().top - 80;
    $('html, body').animate({
        scrollTop: to
    }, 800);
}

// Main page slider

var MIN_SWIPE_TIME = 60000; // 60 seconds since last manual swipe
var MIN_SWIPE_TIME_AUTOMATIC = 6000; // 5 seconds since last automatic swipe
var lastSwipeAutomatic = true;
var isSwiping = false;

var dragStarted = false;
var dragYStarted = false;
var dragXStarted = false;

var currentTransform = 0;
var targetTransform = 0;
var currentClickX = 0;
var currentClickY = 0;
var screenWidth;
var currentClickTimestamp;
var lastTimeSwiped;

function initializeSlider() {
    screenWidth = $(window).outerWidth();
    var swiperWrapper = $(".swiper-wrapper");
    var screenHeight = $(window).outerHeight();		// set initial sizes
    $(".swiper-slide").css('height', 0.8 * screenHeight);

    $("[data-caption-animate]").each(
        function (index) {
            $(this).addClass($(this).attr("data-caption-animate"));
        }
    );

    if ($(".swiper-wrapper .swiper-duplicate").length == 0) {		// set duplicate slides on edges of left and right for smooth animation
        var copy = swiperWrapper.find(".swiper-slide").last().clone();
        var copy2 = swiperWrapper.find(".swiper-slide").first().clone();
        copy.addClass("swiper-duplicate");
        copy2.addClass("swiper-duplicate");
        swiperWrapper.prepend(copy);
        swiperWrapper.append(copy2);
    }
    currentTransform = -screenWidth;

    var slides = $(".swiper-slide");
    slides.css("width", screenWidth);

    var numberSlides = slides.length;
    swiperWrapper.css('width', numberSlides * screenWidth);
    $(".swiper-wrapper").css('transform', "translateX(" + currentTransform + "px)");

    setTimeout(function () {
        var currentSlide = getCurrentSlide();
        currentSlide.addClass("slide-active");
    }, 300);


    // Mouse events
    swiperWrapper.off('mousedown.swiper');
    $(document).off('mousemove.swiper');
    $(document).off('mouseup.swiper');

    $(".swiper-wrapper").on('mousedown.swiper', function (event) { event.preventDefault(); sliderDragStarted(event, event.timeStamp); });
    $(document).on('mousemove.swiper', function (event) { if (dragStarted) { sliderDrag(event) } });
    $(document).on('mouseup.swiper', function (event) {
        if (dragStarted) {
            dragStarted = false;
            sliderDragUp(event, event.timeStamp);
        }
    });

    //Touch events
    $(document).off('touchstart.swiper');
    $(document).off('touchend.swiper');
    $(document).off('touchmove.swiper');

    $(".swiper-wrapper").on('touchstart.swiper', function (event) { //event.preventDefault(); 
        sliderDragStarted(event.originalEvent.touches[0], event.timeStamp);
    });
    $(document).on('touchmove.swiper', function (event) {
        if (dragStarted) {
            sliderDrag(event.originalEvent.touches[0]);
            //if (dragXStarted) {
            //	event.preventDefault();				
            //}			
        }
    });
    $(document).on('touchend.swiper', function (event) {
        if (dragStarted) {
            dragStarted = false;
            sliderDragUp(event.originalEvent.changedTouches[0], event.timeStamp);
        }
    });

    if (!isSwiping) {
        // Set up automatic swiping
        lastTimeSwiped = Date.now();
        setTimeout(setSwiperTimer, MIN_SWIPE_TIME_AUTOMATIC);
        isSwiping = true;
    }

}

function setSwiperTimer() {
    var time = Date.now();
    if (lastSwipeAutomatic) {
        if (time - lastTimeSwiped > MIN_SWIPE_TIME_AUTOMATIC) {
            var distance = slideSliderSwiperDirection(true, 0);
            slideSliderSwiper(distance);
            lastSwipeAutomatic = true;
        }
    } else if (time - lastTimeSwiped > MIN_SWIPE_TIME) {
        var distance = slideSliderSwiperDirection(true, 0);
        slideSliderSwiper(distance);
        lastSwipeAutomatic = true;
    }
    setTimeout(setSwiperTimer, MIN_SWIPE_TIME_AUTOMATIC);
}

function getCurrentSlide() {
    var index = - currentTransform / screenWidth;
    return $(".swiper-slide").eq(index);
}

function sliderDragStarted(event, timestamp) {
    dragStarted = true;
    currentClickX = event.screenX;
    currentClickY = event.screenY;
    currentClickTimestamp = timestamp;
}

function sliderDrag(event) {
    var currentX = event.screenX;
    var currentY = event.screenY;
    if (!dragXStarted && !dragYStarted) {
        if (screenWidth > 700 || Math.abs(currentX - currentClickX) > Math.abs(currentY - currentClickY)) {
            dragXStarted = true;
        }
        else {
            dragYStarted = true;
        }
    }
    if (dragXStarted) {
        var transform = currentTransform + currentX - currentClickX;
        $(".swiper-wrapper").css('transform', "translateX(" + transform + "px)");
    }
}

function sliderDragUp(event, timestamp) {
    if (dragXStarted) {
        if (isSlideScreen(event, timestamp)) {
            lastTimeSwiped = Date.now();
            lastSwipeAutomatic = false;
            var distance = slideSliderSwiperDirection(currentClickX > event.screenX, event.screenX);

        } else {
            distance = event.screenX - currentClickX;
        }
        slideSliderSwiper(distance);
    }

    currentClickX = 0;
    currentClickY = 0;
    dragXStarted = false;
    dragYStarted = false;
}

function slideSliderSwiperDirection(clockwise, currentX) {
    $(".swiper-wrapper").addClass("active");
    var distance = screenWidth + (currentX - currentClickX);
    if (clockwise) {
        currentTransform -= screenWidth;
        rotateTestimonials(true);
    } else {
        currentTransform += screenWidth;
        rotateTestimonials(false);
        distance = - screenWidth + (currentX - currentClickX);

    }
    return distance;
}

// Awesome magic function for smooth horizontal scrolling
function slideSliderSwiper(distance) {
    $(".swiper-wrapper").stop();
    $(".swiper-wrapper").css('text-indent', 100);
    var section = distance / 100;
    var maxSlide = ($(".swiper-slide").length - 1) * screenWidth;		// Last slide before switch required
    $(".swiper-wrapper").animate({
        textIndent: 0,
    }, {
        step: function (now, fx) {
            if (currentTransform <= -maxSlide) {		// Approaching negative end of loop, switch transform back to start
                currentTransform = -1 * screenWidth;
            } else if (currentTransform > -10 && currentTransform < 10) {		// Approaching positive end of loop, switch transform back to end
                currentTransform = -($(".swiper-slide").length - 2) * screenWidth;
            }
            var moveTo = currentTransform + (now * section);
            $(this).css('transform', "translateX(" + moveTo + "px)");
        },
        duration: 300,
        complete: function () {
            $(".swiper-slide").removeClass('slide-active');
            var currentSlide = getCurrentSlide();
            currentSlide.addClass("slide-active");
        }
    });
}

function sliderRight() {
    lastTimeSwiped = Date.now();
    lastSwipeAutomatic = false;
    var distance = slideSliderSwiperDirection(true, 0);
    slideSliderSwiper(distance);
}

function sliderLeft() {
    lastTimeSwiped = Date.now();
    lastSwipeAutomatic = false;
    var distance = slideSliderSwiperDirection(false, 0);
    slideSliderSwiper(distance);
}

function isSlideScreen(event, timestamp) {
    var screenWidth = $(window).outerWidth();
    var dragWidth = Math.abs(currentClickX - event.screenX)
    var dragHeight = Math.abs(currentClickY - event.screenY);
    var timeDif = timestamp - currentClickTimestamp;
    if (dragHeight > dragWidth) {
        return false;
    }
    else if (dragWidth > screenWidth / 2) {
        return true;
    } else if (dragWidth / timeDif > 1.5) {
        return true;
    } else if (screenWidth < 1300 && dragWidth / timeDif > 1.2) {
        return true;
    }
    return false;
}


// Testimonial Slider

function rotateTestimonials(clockwise) {
    var width = $("body").outerWidth();
    if (width > 973) {
        rotateTestimonialSlider(clockwise)
    } else {
        var sections = $(".active-testimonial-section .testimonial-col");
        var currentSlide = $(".active-testimonial-section .testimonial-col.active-col");
        var index = currentSlide.index();
        if (clockwise) {
            var nextIndex = index + 1;
        } else {
            var nextIndex = index - 1;
        }

        if (clockwise && nextIndex > 2) {
            rotateTestimonialSlider(clockwise, true)
        } else if (!clockwise && nextIndex < 0) {
            rotateTestimonialSlider(clockwise, true)
        } else {
            var nextSlide = sections.eq(nextIndex);
            currentSlide.removeClass("active-col");
            if (clockwise) {
                currentSlide.addClass("past-col");
            }
            nextSlide.removeClass("past-col");
            nextSlide.addClass("active-col");
        }
    }

}

function setColsForForwardSlide(sections) {
    sections.removeClass("active-col past-col");
    sections.eq(0).addClass("active-col");
}

function setColsForBackwardsSlide(sections) {
    sections.removeClass("active-col past-col");
    sections.eq(2).addClass("active-col");
    sections.eq(1).addClass("past-col");
    sections.eq(0).addClass("past-col");
}

function rotateTestimonialSlider(clockwise, hasChildren) {
    var sections = $(".testimonial-slider-section");
    var currentSlide = $(".active-testimonial-section");
    var index = currentSlide.index();
    if (clockwise) {
        var nextIndex = mod(index + 1, 3);
        var prevIndex = mod(index - 1, 3);
    } else {
        var nextIndex = mod(index - 1, 3);
        var prevIndex = mod(index + 1, 3);
    }

    currentSlide.removeClass("active-testimonial-section");

    var moveSection = sections.eq(prevIndex);
    moveSection.removeClass("active-testimonial-section");
    if (clockwise) {
        moveSection.removeClass("past-testimonial-section");
    } else {
        moveSection.addClass("past-testimonial-section");
    }

    var nextSlide = sections.eq(nextIndex);
    if (hasChildren) {
        if (clockwise) {
            setColsForForwardSlide(nextSlide.children());
        } else {
            setColsForBackwardsSlide(nextSlide.children());
        }
    }
    nextSlide.removeClass("past-testimonial-section");
    nextSlide.addClass("active-testimonial-section");

    if (clockwise) {
        currentSlide.addClass("past-testimonial-section");
    }
}

function mod(x, n) {
    return ((x % n) + n) % n;
};
(function() {
    'use strict';

    $(document).ready(function() {
        $('#btn-more-bundles').click(function() {
            $('#btn-more-bundles').hide();
            $('#btn-view-bundle-details').show();
            $('.bottom-row-bundles').css('display', 'flex');
            $('.bundles-with-accessories-title').show();
        });
    });
})();;
var vuzix = vuzix || {};

vuzix.redirectionHeader = {
    callRedirectionDisplayDecision: function () {
        $.get("/HaveToDisplayRedirection", function (data) {
            if (data === true) {
                if (typeof (Storage) !== "undefined") {
                    localStorage.vuzixDisplayRedirectionCheck = true;
                    localStorage.vuzixDisplayRedirection = true;
                }

                if ($('#privacy-alert').is(':visible') || window.showingPrivacyFooter) {
                    $("#vuzix-header-redirection").css('bottom', '60px');
                }

                $("#vuzix-header-redirection").toggle();
                $("#vuzix-header-redirection").slideDown(500);
                window.showingRedirectionFooter = true;
            } else {
                if (typeof (Storage) !== "undefined") {
                    localStorage.vuzixDisplayRedirectionCheck = true;
                    localStorage.vuzixDisplayRedirection = false;
                }
            }
        });
    },

    checkForRedirectionDisplay: function () {
        if (typeof (Storage) !== "undefined") {
            if (localStorage.vuzixDisplayRedirectionCheck) {
                if (localStorage.vuzixDisplayRedirection === "true") {
                    var storageDate = new Date(Date.parse(localStorage.vuzixDisplayRedirectionHideTime));
                    storageDate.setDate(storageDate.getDate() + 7);
                    if (!localStorage.vuzixDisplayRedirectionHideTime || (storageDate < new Date())) {
                        $("#vuzix-header-redirection").slideDown();
                        $('#wrapper').addClass('header-message');
                    }
                }
                return;
            }

            vuzix.redirectionHeader.callRedirectionDisplayDecision();
        }
    },

    forceDisplayRedirectionWhenAddresses: function (jQuery) {
        $(function () {
            if (!$("#vuzix-header-redirection").visible) {
                if (localStorage.vuzixDisplayRedirection === "true") {
                    $("#vuzix-header-redirection").slideDown();
                    $('#wrapper').addClass('header-message');
                }
            }
        }, jQuery);
    }
};

$(window).load(function () {
    vuzix.redirectionHeader.checkForRedirectionDisplay();

    $("#vuzix-redirection-header-close").click(function () {
        if (typeof (Storage) !== "undefined") {
            localStorage.vuzixDisplayRedirectionHideTime = new Date();
        }
        $("#vuzix-header-redirection").slideUp(500);
        $('#wrapper').removeClass('header-message');
        window.showingRedirectionFooter = false;

        if ($('#privacy-alert').is(':visible')) {
            $('#privacy-alert').css('bottom', '0');
        }
    });
});;
(function() {
    'use strict';

    $(document).ready(function() {
        $('#vuzix-privacy-header-close, #privacy-policy-link').click(function () {
            $('#privacy-alert').slideUp(500);
            localStorage.vuzixDisplayPrivacyAlert = false;
            window.showingPrivacyFooter = false;

            if ($("#vuzix-header-redirection").is(':visible')) {
                $("#vuzix-header-redirection").css('bottom', '0');
            }
        });

        if (!$('#privacy-alert').visible) {
            if (!localStorage.vuzixDisplayTimePrivacyAlert) {
                localStorage.vuzixDisplayTimePrivacyAlert = new Date();
            }

            var storageDate = new Date(Date.parse(localStorage.vuzixDisplayTimePrivacyAlert));
            storageDate.setMinutes(storageDate.getMinutes() + 5);

            if (localStorage.vuzixDisplayPrivacyAlert !== "false" && storageDate > new Date() && window.location.pathname.toLowerCase().indexOf('privacy') === -1) {
                if ($("#vuzix-header-redirection").is(':visible') || window.showingRedirectionFooter) {
                    $('#privacy-alert').css('bottom', '60px');
                }

                $('#privacy-alert').slideDown();
                $('#wrapper').addClass('header-message');
                window.showingPrivacyFooter = true;
            }
        }
    });

})();;
var vuzix = vuzix || {};

vuzix.autoplay = {
    checkAndPlay: function () {
        if ($(".ui-tabs-anchor[href='#video']").length > 0) {
            $(".ui-tabs-anchor[href='#video']").click();
        }

        this.playVideo();
    },

    playVideo: function () {
        if ($("video").length > 0) {
            $("video")[0].focus();
            $("video")[0].play();
        }

        if ($(".video-link").length > 0) {
            $(".video-link")[0].click();
        }
    }
}

$(document).ready(function () {
    if (window.location.hash == "#video" || window.location.hash == "#/video") {
        vuzix.autoplay.checkAndPlay();
    }
});;
(function ($) {

    // USE STRICT
    "use strict";

    var english = {
        days: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
        months: [
            'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'
        ]
    };

    var singleDatePicker = false;
    var datepickerElement;
    var currentDate = new Date();
    var dayOffset = 0;
    var highlightedDate = now();
    var rangeStartDay = null;
    var rangeEndDay = null;
    var displayRange = "";
    var highlightedInput = "";
    var defaultYearRange = [1970, 2070];
    var rangeSelected = function (startDate, EndDate) {
        console.log("range selected")
    };
    var opts = {
        secondInput: null,
        callback: function () {
        },
        rangeSelected: rangeSelected
    };

    var templates = {
        renderHeader: function () {
            //return "<h1>dsfgdfg<h2>";
            return '<div class="dp-header">' +
                '        <div class="dp-highlighted-month"><span class="dp-month-select">' + english.months[highlightedDate.getMonth()] + '</span> <span class="dp-year-select">' + highlightedDate.getFullYear() + '</span></div>' +
                '        <div class="dp-arrows">' +
                '            <i class="fa fa-angle-left dp-prev" aria-hidden="true"></i>' +
                '            <i class="fa fa-angle-right dp-next" aria-hidden="true"></i>' +
                '        </div>' +
                '    </div>';
        },

        renderDayNames: function () {
            var dayNamesHtml = "";
            $.each(english.days, function (i, v) {
                dayNamesHtml += '<li class="dp-day-name"><a>' + v + '</a></li>';
            });
            return dayNamesHtml;
        },

        renderDayNumbers: function () {
            var currentMonth = highlightedDate.getMonth();
            var dayNumbersHtml = mapDays(highlightedDate, dayOffset, function (date) {
                var isNotInMonth = date.getMonth() !== highlightedDate.getMonth();
                var className = 'dp-day';
                className += (isNotInMonth ? ' dp-edge-day' : '');
                className += (datesEq(date, currentDate) ? ' dp-current' : '');
                // console.log(rangeStartDay);
                // console.log(rangeStartDay);
                className += (rangeStartDay !== null && datesEq(date, rangeStartDay)) ? ' range-first-day' : '';
                className += (rangeEndDay !== null && datesEq(date, rangeEndDay)) ? ' range-last-day' : '';
                className += (rangeStartDay !== null && rangeEndDay !== null && inRange(date, rangeStartDay, rangeEndDay)) ? ' in-range-day' : '';

                //add class week-start-day/week-end-day if day is start or end of week
                className += (date.getDay() === dayOffset) ? ' week-first-day' : '';
                var weekEndDayNumber = dayOffset + 6;
                if (weekEndDayNumber > 6) weekEndDayNumber = weekEndDayNumber - 6;
                className += (date.getDay() === weekEndDayNumber) ? ' week-last-day' : '';


                return (
                    '<li data-date="' + date.getTime() + '"  class="' + className + '"><a tabindex="-1" href="javascript:;" data-date="' + date.getTime() + '">' +
                    date.getDate() +
                    '</a></li>'
                );
            });
            return dayNumbersHtml;
        },

        renderRightLinks: function () {
            return '<li class="dp-last-7-days">Last 7 days</li>' +
                '<li class="dp-last-14-days">Last 14 days</li>' +
                '<li class="dp-last-31-days">Last 31 days</li>' +
                '<li class="dp-this-month">This month</li>' +
                '<li class="dp-last-year">Last Year</li>' +
                '<li class="dp-this-year">This Year</li>' +
                '<li class="dp-clear">Clear</li>'

        }

    };

    /**
     * now returns the current date without any time values
     *
     * @returns {Date}
     */
    function now() {
        var dt = new Date();
        dt.setHours(0, 0, 0, 0);
        return dt;
    }

    /**
     * returns date in format MM/DD/YYY
     *
     * @param dt
     * @returns {string}
     */
    function dateFormat(dt) {
        return (dt.getMonth() + 1) + '/' + dt.getDate() + '/' + dt.getFullYear();
    }

    /**
     *
     * @param str
     */
    function dateValidate(str) {
        var date_regex = /^\d{1,2}\/\d{1,2}\/\d{4}$/;
        if (!(date_regex.test(str))) return false;
        return true;

    }

    /**
     * returns parse str to Date Object else return current date
     * @param str
     * @returns {Date}
     */
    function dateParse(str) {
        var date = new Date(str);
        return isNaN(date) ? now() : date;
    }

    /**
     * dateEq compares two dates
     *
     * @param {Date} date1 the first date
     * @param {Date} date2 the second date
     * @returns {boolean}
     */
    function datesEq(date1, date2) {
        return (date1 && date1.toDateString()) === (date2 && date2.toDateString());
    }


    function mapDays(currentDate, dayOffset, fn) {
        var result = '';
        var iter = new Date(currentDate);
        iter.setDate(1);
        iter.setDate(1 - iter.getDay() + dayOffset);

        // If we are showing monday as the 1st of the week,
        // and the monday is the 2nd of the month, the sunday won't
        // show, so we need to shift backwards
        if (dayOffset && iter.getDate() === dayOffset + 1) {
            iter.setDate(dayOffset - 6);
        }

        // We are going to have 6 weeks always displayed to keep a consistent
        // calendar size
        for (var day = 0; day < (6 * 7); ++day) {
            result += fn(iter);
            iter.setDate(iter.getDate() + 1);
        }

        return result;
    }

    /**
     * shiftMonth shifts the specified date by a specified number of months
     *
     * @param {Date} dt
     * @param {number} n
     * @param {boolean} wrap optional, if true, does not change year
     *                       value, defaults to false
     * @returns {Date}
     */
    function shiftMonth(dt, n, wrap) {
        dt = new Date(dt);

        var dayOfMonth = dt.getDate();
        var month = dt.getMonth() + n;

        dt.setDate(1);
        dt.setMonth(wrap ? (12 + month) % 12 : month);
        dt.setDate(dayOfMonth);

        // If dayOfMonth = 31, but the target month only has 30 or 29 or whatever...
        // head back to the max of the target month
        if (dt.getDate() < dayOfMonth) {
            dt.setDate(0);
        }

        return dt;
    }

    /**
     * shiftDay shifts the specified date by n days
     *
     * @param {Date} dt
     * @param {number} n
     * @returns {Date}
     */
    function shiftDay(dt, n) {
        dt = new Date(dt);
        dt.setDate(dt.getDate() + n);
        return dt;
    }

    function inRange(dt, start, end) {
        return (dt < end && dt >= start) || (dt <= start && dt > end);
    }

    function updateMonthView() {
        $(".dp-highlighted-month").html('<span class="dp-month-select">' + english.months[highlightedDate.getMonth()] + '</span> <span class="dp-year-select">' + highlightedDate.getFullYear() + '</span>');
        $(".dp-content .left").html(templates.renderDayNames() + templates.renderDayNumbers());
        $(".dp-day").click(function (event) {
            var thisDate = new Date(new Date().setTime($(this).attr('data-date')));

            if (rangeStartDay != null && rangeEndDay != null) {
                if (thisDate > rangeEndDay) {
                    rangeStartDay = thisDate;
                    rangeEndDay = null;
                    highlightedInput = opts.secondInput;
                    $(opts.secondInput).addClass("wi-highlight-input");
                    $(opts.firstInput).removeClass("wi-highlight-input");
                }
                else if (thisDate < rangeStartDay) {
                    rangeStartDay = thisDate;
                    $(opts.firstInput).removeClass("wi-highlight-input");
                }
                else if (thisDate >= rangeStartDay && thisDate <= rangeEndDay) {
                    rangeStartDay = thisDate;
                    rangeEndDay = null;
                    highlightedInput = opts.secondInput;
                    $(opts.secondInput).addClass("wi-highlight-input");
                    $(opts.firstInput).removeClass("wi-highlight-input");
                }
            }
            else if (highlightedInput === opts.firstInput) {
                rangeStartDay = thisDate;
                highlightedInput = opts.secondInput;
                $(opts.secondInput).addClass("wi-highlight-input");
                $(opts.firstInput).removeClass("wi-highlight-input");
            }
            else if (highlightedInput === opts.secondInput) {
                //check if end date is less than rangeStartDay
                if (thisDate < rangeStartDay) {
                    rangeStartDay = thisDate;
                    highlightedInput = opts.secondInput;
                    $(opts.secondInput).addClass("wi-highlight-input");
                    $(opts.firstInput).removeClass("wi-highlight-input");
                } else {
                    rangeEndDay = thisDate;
                    //selectingRange = 0;
                    highlightedInput = "";
                    $(opts.firstInput).removeClass("wi-highlight-input");
                    $(opts.secondInput).removeClass("wi-highlight-input");
                }
            }
            else if (singleDatePicker === true) {
                rangeStartDay = thisDate;
            }

            if (singleDatePicker === true) {
                $(datepickerElement).val(dateFormat(rangeStartDay));
                rangeSelected(dateFormat(rangeStartDay));
            } else {
                displaySelectedRange();
            }
            updateMonthView();
        });
        $(".dp-day").hover(
            function () {
                if (singleDatePicker) return false;
                var $this = $(this);
                if (rangeStartDay != null && rangeEndDay == null) {
                    //remove hover class
                    $(".dp-day").removeClass("in-range-hover");
                    var rangeStartDayHover = rangeStartDay.getTime();
                    var rangeEndDayHover = parseInt($this.attr("data-date"));
                    //console.log(rangeStartDayHover);
                    //console.log(rangeEndDayHover);
                    while (rangeStartDayHover <= rangeEndDayHover) {
                        $("li[data-date='" + (rangeStartDayHover) + "']").addClass("in-range-hover");
                        var rangeNextDay = new Date(rangeStartDayHover);
                        rangeNextDay.setDate(rangeNextDay.getDate() + 1);
                        rangeStartDayHover = rangeNextDay.getTime();
                    }

                }
            },
            function () {
                $(".dp-day").removeClass("in-range-hover");
            }
        );
        $(".dp-year-select").click(function () {
            $(".dp-cal").hide();
            var dpYearsHtml = "";
            var dpYearClass = "";
            var $container = $('.dp-years');

            for (var i = defaultYearRange[0]; i <= defaultYearRange[1]; i++) {
                dpYearClass = (highlightedDate.getFullYear() === i) ? "year-selected" : "";
                dpYearsHtml += '<a href="javascript:;" class="dp-year ' + dpYearClass + '" data-year="' + i + '">' + i + '</a>';
            }
            $container.html(dpYearsHtml).show();
            var $scrollTo = $('.year-selected');
            $container.scrollTop(
                $scrollTo.offset().top - $container.offset().top + $container.scrollTop() - ($container.height() / 3)
            );
            $(".dp-year").click(function () {
                var yearSelected = $(this).attr("data-year");
                highlightedDate.setFullYear(yearSelected);
                $(".dp-cal").show();
                $(".dp-years").hide();
                updateMonthView();
                displaySelectedRange();
            });
        });

        $(".dp-month-select").click(function () {
            $(".dp-cal").hide();
            var dpMonthHtml = "";
            var dpMonthClass = "";
            var $container = $('.dp-months');

            english.months.forEach(function (i, index) {
                dpMonthClass = (highlightedDate.getMonth() === index) ? "month-selected" : "";
                dpMonthHtml += '<a href="javascript:;" class="dp-month ' + dpMonthClass + '" data-month="' + index + '">' + i + '</a>';
            });

            $container.html(dpMonthHtml).show();
            var $scrollTo = $('.month-selected');
            $container.scrollTop(
                $scrollTo.offset().top - $container.offset().top + $container.scrollTop() - ($container.height() / 3)
            );
            $(".dp-month").click(function () {
                var monthSelected = $(this).attr("data-month");
                highlightedDate.setMonth(monthSelected);
                $(".dp-cal").show();
                $(".dp-months").hide();
                updateMonthView();
                displaySelectedRange();
            });
        });


    }

    function displaySelectedRange() {
        console.log(opts);
        if (rangeStartDay == null && rangeEndDay == null) {
            return;
        }
        if (rangeStartDay !== null && rangeEndDay !== null && rangeEndDay < rangeStartDay) {
            //rangeStartDay = rangeEndDay;
            rangeEndDay = null;
        }
        if (rangeEndDay !== null) {

            displayRange = dateFormat(rangeStartDay) + '-' + dateFormat(rangeEndDay);


            if ($(opts.firstInput) !== null) {
                $(opts.firstInput).val(dateFormat(rangeStartDay));
            }
            if ($(opts.secondInput) !== null) {
                $(opts.secondInput).val(dateFormat(rangeEndDay));
            }
            rangeSelected(dateFormat(rangeStartDay), dateFormat(rangeEndDay));
        } else {
            displayRange = dateFormat(rangeStartDay);

            if ($(datepickerElement).is("input")) {
                $(datepickerElement).val(displayRange);
            } else {
                if ($(opts.firstInput) !== null) {
                    $(opts.firstInput).val(dateFormat(rangeStartDay));
                }
                $(opts.secondInput).val("");
            }
            rangeSelected(dateFormat(rangeStartDay), "");
        }


    }
    function wiRangeDatepickerClicked(event) {
        datepickerElement = $(this);
        rangeStartDay = null;
        rangeEndDay = null;
        singleDatePicker = false;
        opts = event.data;

        //set the rangeStartDay and rangeEndDay
        //set the focused input
        if (typeof $(opts.firstInput) !== 'undefined') {
            highlightedInput = opts.firstInput;
            if ($(opts.firstInput).is(":disabled")) return false;
            $(opts.firstInput).addClass("wi-highlight-input");
            if ($(opts.firstInput).val() && dateValidate($(opts.firstInput).val())) {
                rangeStartDay = new Date($(opts.firstInput).val());
            }
        }
        if (typeof $(opts.secondInput) !== 'undefined') {
            if ($(opts.firstInput).is(":disabled")) return false;
            if ($(opts.secondInput).val() && dateValidate($(opts.secondInput).val())) {
                rangeEndDay = new Date($(opts.secondInput).val());
            }
        }
        rangeSelected = opts.callback;
        var eleOffset = $(this).offset();
        var trianglePosCls = '';
        var eleOffsetHeight = eleOffset.top + datepickerElement.outerHeight() + 17;

        var eleOffsetLeft = eleOffset.left + "px;";
        var eleOffsetRight = "auto;";

        //check if calendar can fit left alligned
        if ($(window).width() - eleOffset.left < 450) {
            var secondEleOffset = $(opts.secondInput).offset();
            eleOffsetLeft = "auto;";
            eleOffsetRight = ($(window).width() - secondEleOffset.left - $(opts.secondInput).width()) + 'px;';
            trianglePosCls = 'wi-right';
        }

        var renderHtml = '<div class="dp-wrap" style="top: ' + eleOffsetHeight + 'px; left: ' + eleOffsetLeft + 'right:' + eleOffsetRight + '">' +
            '<div class="dp-wrap-inner"><div class="triangle-with-shadow ' + trianglePosCls + '"></div> ' +
            '<div class="dp-cal">' + templates.renderHeader();

        //render body content
        renderHtml +=
            '<div class="dp-content">' +
            '<ul class="left">' +
            '</ul>' +
            '<ul class="right">' +
            templates.renderRightLinks() +
            '</ul>' +
            '</div>';
        renderHtml += '</div><div class="dp-years"></div><div class="dp-months"></div></div></div>';
        $("body").append(renderHtml);
        updateMonthView();
        displaySelectedRange();

        /*EVENTS*/
        $(".dp-next").click(function () {
            highlightedDate = shiftMonth(highlightedDate, 1);
            updateMonthView();
        }).mousedown(function (e) {
            e.preventDefault();
        });
        $(".dp-prev").click(function () {
            highlightedDate = shiftMonth(highlightedDate, -1);
            updateMonthView();
        }).mousedown(function (e) {
            e.preventDefault();
        });
        $(".dp-last-7-days").click(function () {
            rangeEndDay = shiftDay(currentDate, -1);
            rangeStartDay = shiftDay(rangeEndDay, -6);
            highlightedDate = rangeStartDay;
            $(".dp-content .right li").removeClass("active");
            $(this).addClass("active");
            updateMonthView();
            displaySelectedRange();
        });
        $(".dp-last-14-days").click(function () {
            rangeEndDay = shiftDay(currentDate, -1);
            rangeStartDay = shiftDay(rangeEndDay, -13);
            highlightedDate = rangeStartDay;
            $(".dp-content .right li").removeClass("active");
            $(this).addClass("active");
            updateMonthView();
            displaySelectedRange();
        });
        $(".dp-last-31-days").click(function () {
            rangeEndDay = shiftDay(currentDate, -1);
            rangeStartDay = shiftDay(rangeEndDay, -30);
            highlightedDate = rangeStartDay;
            $(".dp-content .right li").removeClass("active");
            $(this).addClass("active");
            updateMonthView();
            displaySelectedRange();
        });
        $(".dp-this-month").click(function () {
            rangeStartDay = new Date(currentDate.getFullYear(), currentDate.getMonth(), 1);
            rangeEndDay = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 0);
            highlightedDate = rangeStartDay;
            $(".dp-content .right li").removeClass("active");
            $(this).addClass("active");
            updateMonthView();
            displaySelectedRange();
        });
        $(".dp-last-year").click(function () {
            rangeStartDay = new Date(currentDate.getFullYear() - 1, 0, 1);
            rangeEndDay = new Date(currentDate.getFullYear() - 1, 11, 31);
            highlightedDate = rangeStartDay;
            $(".dp-content .right li").removeClass("active");
            $(this).addClass("active");
            updateMonthView();
            displaySelectedRange();
        });
        $(".dp-this-year").click(function () {
            rangeStartDay = new Date(currentDate.getFullYear(), 0, 1);
            rangeEndDay = new Date(currentDate.getFullYear(), 11, 31);
            highlightedDate = rangeStartDay;
            $(".dp-content .right li").removeClass("active");
            $(this).addClass("active");
            updateMonthView();
            displaySelectedRange();
        });
        $(".dp-clear").click(function () {
            rangeStartDay = "";
            rangeEndDay = "";
            $(".dp-content .right li").removeClass("active");
            updateMonthView();
            $(opts.firstInput).val("");
            $(opts.secondInput).val("");
            rangeSelected("", "");
            //hide the datepicker
            $(".dp-wrap").remove();
        });

        if (typeof $(opts.firstInput) !== 'undefined') {
            $(opts.firstInput).change(function () {
                if ($(this).val()) {
                    if (dateValidate($(this).val())) {
                        rangeStartDay = dateParse($(this).val());
                        updateMonthView();
                        displaySelectedRange();
                    }
                } else {
                    rangeStartDay = "";
                    rangeEndDay = "";
                    $(opts.secondInput).val("");
                }
            });
        }
        if (typeof $(opts.secondInput) !== 'undefined') {
            $(opts.secondInput).change(function () {
                if ($(this).val() && rangeStartDay != "") {
                    if (dateValidate($(this).val())) {
                        rangeEndDay = dateParse($(this).val());
                        updateMonthView();
                        displaySelectedRange();
                    }
                } else {
                    rangeEndDay = "";
                }
            });
        }


        //hide date picker when clicked outside
        $(document).mouseup(function (e) {
            var container = $(".dp-wrap-inner");

            // if the target of the click isn't the container nor a descendant of the container
            if (!container.is(e.target) && container.has(e.target).length === 0) {
                $(".dp-wrap").remove();
            }
        });
    }

    $.fn.wiRangeDatepicker = function (options) {
        var opts = {
            secondInput: null,
            callback: function () {
            }
        };
        // extend the options from pre-defined values:
        opts = $.extend(opts, options);

        return $(this).bind('click', opts, wiRangeDatepickerClicked);

    };

    $.fn.wiDatePicker = function () {
        // extend the options from pre-defined values:
        var options = $.extend(opts, arguments[0] || {});

        this.click(function () {

            datepickerElement = $(this);
            singleDatePicker = true;


            rangeSelected = options.callback;
            var eleOffset = $(this).offset();
            var trianglePosCls = '';
            var eleOffsetHeight = eleOffset.top + datepickerElement.outerHeight() + 17;

            var eleOffsetLeft = eleOffset.left + "px;";
            var eleOffsetRight = "auto;";


            var renderHtml = '<div class="dp-wrap dp-single" style="top: ' + eleOffsetHeight + 'px; left: ' + eleOffsetLeft + 'right:' + eleOffsetRight + '">' +
                '<div class="dp-wrap-inner"><div class="triangle-with-shadow ' + trianglePosCls + '"></div> ' +
                '<div class="dp-cal">' + templates.renderHeader();

            //render body content
            renderHtml +=
                '<div class="dp-content">' +
                '<ul class="left">' +
                '</ul>' +
                '<ul class="right">' +
                templates.renderRightLinks() +
                '</ul>' +
                '</div>';
            renderHtml += '</div><div class="dp-years"></div><div class="dp-months"></div></div></div>';
            $("body").append(renderHtml);
            rangeEndDay = null;
            updateMonthView();

            /*EVENTS*/
            $(".dp-next").click(function () {
                highlightedDate = shiftMonth(highlightedDate, 1);
                updateMonthView();
            }).mousedown(function (e) {
                e.preventDefault();
            });
            $(".dp-prev").click(function () {
                highlightedDate = shiftMonth(highlightedDate, -1);
                updateMonthView();
            }).mousedown(function (e) {
                e.preventDefault();
            });


            //hide date picker when clicked outside
            $(document).mouseup(function (e) {
                var container = $(".dp-wrap-inner");

                // if the target of the click isn't the container nor a descendant of the container
                if (!container.is(e.target) && container.has(e.target).length === 0) {
                    $(".dp-wrap").remove();
                }
            });
        });
    }

}(jQuery));;
/*! kjua v0.1.1 - https://larsjung.de/kjua/ */
!function(r,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.kjua=t():r.kjua=t()}(this,function(){return function(r){function t(n){if(e[n])return e[n].exports;var o=e[n]={exports:{},id:n,loaded:!1};return r[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var e={};return t.m=r,t.c=e,t.p="",t(0)}([function(r,t,e){"use strict";var n=e(1),o=n.createCanvas,i=n.canvasToImg,a=n.dpr,u=e(2),f=e(3),c=e(4);r.exports=function(r){var t=Object.assign({},u,r),e=f(t.text,t.ecLevel,t.minVersion,t.quiet),n=t.ratio||a,l=o(t.size,n),s=l.getContext("2d");return s.scale(n,n),c(e,s,t),"image"===t.render?i(l):l}},function(r,t){"use strict";var e=window,n=e.document,o=e.devicePixelRatio||1,i=function(r){return n.createElement(r)},a=function(r,t){return r.getAttribute(t)},u=function(r,t,e){return r.setAttribute(t,e)},f=function(r,t){var e=i("canvas");return u(e,"width",r*t),u(e,"height",r*t),e.style.width=r+"px",e.style.height=r+"px",e},c=function(r){var t=i("img");return u(t,"crossorigin","anonymous"),u(t,"src",r.toDataURL("image/png")),u(t,"width",a(r,"width")),u(t,"height",a(r,"height")),t.style.width=r.style.width,t.style.height=r.style.height,t};r.exports={createCanvas:f,canvasToImg:c,dpr:o}},function(r,t){"use strict";r.exports={render:"image",crisp:!0,minVersion:1,ecLevel:"L",size:200,ratio:null,fill:"#333",back:"#fff",text:"no text",rounded:0,quiet:0,mode:"plain",mSize:30,mPosX:50,mPosY:50,label:"no label",fontname:"sans",fontcolor:"#333",image:null}},function(r,t){"use strict";var e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol?"symbol":typeof r},n=/code length overflow/i,o=function(){var e=function(){function r(t,e){if("undefined"==typeof t.length)throw new Error(t.length+"/"+e);var n=function(){for(var r=0;r<t.length&&0==t[r];)r+=1;for(var n=new Array(t.length-r+e),o=0;o<t.length-r;o+=1)n[o]=t[o+r];return n}(),o={};return o.getAt=function(r){return n[r]},o.getLength=function(){return n.length},o.multiply=function(t){for(var e=new Array(o.getLength()+t.getLength()-1),n=0;n<o.getLength();n+=1)for(var i=0;i<t.getLength();i+=1)e[n+i]^=a.gexp(a.glog(o.getAt(n))+a.glog(t.getAt(i)));return r(e,0)},o.mod=function(t){if(o.getLength()-t.getLength()<0)return o;for(var e=a.glog(o.getAt(0))-a.glog(t.getAt(0)),n=new Array(o.getLength()),i=0;i<o.getLength();i+=1)n[i]=o.getAt(i);for(var i=0;i<t.getLength();i+=1)n[i]^=a.gexp(a.glog(t.getAt(i))+e);return r(n,0).mod(t)},o}var t=function(t,e){var o=236,a=17,l=t,s=n[e],g=null,h=0,d=null,w=new Array,y={},p=function(r,t){h=4*l+17,g=function(r){for(var t=new Array(r),e=0;r>e;e+=1){t[e]=new Array(r);for(var n=0;r>n;n+=1)t[e][n]=null}return t}(h),m(0,0),m(h-7,0),m(0,h-7),E(),B(),M(r,t),l>=7&&T(r),null==d&&(d=x(l,s,w)),k(d,t)},m=function(r,t){for(var e=-1;7>=e;e+=1)if(!(-1>=r+e||r+e>=h))for(var n=-1;7>=n;n+=1)-1>=t+n||t+n>=h||(e>=0&&6>=e&&(0==n||6==n)||n>=0&&6>=n&&(0==e||6==e)||e>=2&&4>=e&&n>=2&&4>=n?g[r+e][t+n]=!0:g[r+e][t+n]=!1)},A=function(){for(var r=0,t=0,e=0;8>e;e+=1){p(!0,e);var n=i.getLostPoint(y);(0==e||r>n)&&(r=n,t=e)}return t},B=function(){for(var r=8;h-8>r;r+=1)null==g[r][6]&&(g[r][6]=r%2==0);for(var t=8;h-8>t;t+=1)null==g[6][t]&&(g[6][t]=t%2==0)},E=function(){for(var r=i.getPatternPosition(l),t=0;t<r.length;t+=1)for(var e=0;e<r.length;e+=1){var n=r[t],o=r[e];if(null==g[n][o])for(var a=-2;2>=a;a+=1)for(var u=-2;2>=u;u+=1)-2==a||2==a||-2==u||2==u||0==a&&0==u?g[n+a][o+u]=!0:g[n+a][o+u]=!1}},T=function(r){for(var t=i.getBCHTypeNumber(l),e=0;18>e;e+=1){var n=!r&&1==(t>>e&1);g[Math.floor(e/3)][e%3+h-8-3]=n}for(var e=0;18>e;e+=1){var n=!r&&1==(t>>e&1);g[e%3+h-8-3][Math.floor(e/3)]=n}},M=function(r,t){for(var e=s<<3|t,n=i.getBCHTypeInfo(e),o=0;15>o;o+=1){var a=!r&&1==(n>>o&1);6>o?g[o][8]=a:8>o?g[o+1][8]=a:g[h-15+o][8]=a}for(var o=0;15>o;o+=1){var a=!r&&1==(n>>o&1);8>o?g[8][h-o-1]=a:9>o?g[8][15-o-1+1]=a:g[8][15-o-1]=a}g[h-8][8]=!r},k=function(r,t){for(var e=-1,n=h-1,o=7,a=0,u=i.getMaskFunction(t),f=h-1;f>0;f-=2)for(6==f&&(f-=1);;){for(var c=0;2>c;c+=1)if(null==g[n][f-c]){var l=!1;a<r.length&&(l=1==(r[a]>>>o&1));var s=u(n,f-c);s&&(l=!l),g[n][f-c]=l,o-=1,-1==o&&(a+=1,o=7)}if(n+=e,0>n||n>=h){n-=e,e=-e;break}}},b=function(t,e){for(var n=0,o=0,a=0,u=new Array(e.length),f=new Array(e.length),c=0;c<e.length;c+=1){var l=e[c].dataCount,s=e[c].totalCount-l;o=Math.max(o,l),a=Math.max(a,s),u[c]=new Array(l);for(var g=0;g<u[c].length;g+=1)u[c][g]=255&t.getBuffer()[g+n];n+=l;var h=i.getErrorCorrectPolynomial(s),v=r(u[c],h.getLength()-1),d=v.mod(h);f[c]=new Array(h.getLength()-1);for(var g=0;g<f[c].length;g+=1){var w=g+d.getLength()-f[c].length;f[c][g]=w>=0?d.getAt(w):0}}for(var y=0,g=0;g<e.length;g+=1)y+=e[g].totalCount;for(var p=new Array(y),m=0,g=0;o>g;g+=1)for(var c=0;c<e.length;c+=1)g<u[c].length&&(p[m]=u[c][g],m+=1);for(var g=0;a>g;g+=1)for(var c=0;c<e.length;c+=1)g<f[c].length&&(p[m]=f[c][g],m+=1);return p},x=function(r,t,e){for(var n=u.getRSBlocks(r,t),c=f(),l=0;l<e.length;l+=1){var s=e[l];c.put(s.getMode(),4),c.put(s.getLength(),i.getLengthInBits(s.getMode(),r)),s.write(c)}for(var g=0,l=0;l<n.length;l+=1)g+=n[l].dataCount;if(c.getLengthInBits()>8*g)throw new Error("code length overflow. ("+c.getLengthInBits()+">"+8*g+")");for(c.getLengthInBits()+4<=8*g&&c.put(0,4);c.getLengthInBits()%8!=0;)c.putBit(!1);for(;;){if(c.getLengthInBits()>=8*g)break;if(c.put(o,8),c.getLengthInBits()>=8*g)break;c.put(a,8)}return b(c,n)};return y.addData=function(r){var t=c(r);w.push(t),d=null},y.isDark=function(r,t){if(0>r||r>=h||0>t||t>=h)throw new Error(r+","+t);return g[r][t]},y.getModuleCount=function(){return h},y.make=function(){p(!1,A())},y.createTableTag=function(r,t){r=r||2,t="undefined"==typeof t?4*r:t;var e="";e+='<table style="',e+=" border-width: 0px; border-style: none;",e+=" border-collapse: collapse;",e+=" padding: 0px; margin: "+t+"px;",e+='">',e+="<tbody>";for(var n=0;n<y.getModuleCount();n+=1){e+="<tr>";for(var o=0;o<y.getModuleCount();o+=1)e+='<td style="',e+=" border-width: 0px; border-style: none;",e+=" border-collapse: collapse;",e+=" padding: 0px; margin: 0px;",e+=" width: "+r+"px;",e+=" height: "+r+"px;",e+=" background-color: ",e+=y.isDark(n,o)?"#000000":"#ffffff",e+=";",e+='"/>';e+="</tr>"}return e+="</tbody>",e+="</table>"},y.createImgTag=function(r,t){r=r||2,t="undefined"==typeof t?4*r:t;var e=y.getModuleCount()*r+2*t,n=t,o=e-t;return v(e,e,function(t,e){if(t>=n&&o>t&&e>=n&&o>e){var i=Math.floor((t-n)/r),a=Math.floor((e-n)/r);return y.isDark(a,i)?0:1}return 1})},y};t.stringToBytes=function(r){for(var t=new Array,e=0;e<r.length;e+=1){var n=r.charCodeAt(e);t.push(255&n)}return t},t.createStringToBytes=function(r,t){var e=function(){for(var e=g(r),n=function(){var r=e.read();if(-1==r)throw new Error;return r},o=0,i={};;){var a=e.read();if(-1==a)break;var u=n(),f=n(),c=n(),l=String.fromCharCode(a<<8|u),s=f<<8|c;i[l]=s,o+=1}if(o!=t)throw new Error(o+" != "+t);return i}(),n="?".charCodeAt(0);return function(r){for(var t=new Array,o=0;o<r.length;o+=1){var i=r.charCodeAt(o);if(128>i)t.push(i);else{var a=e[r.charAt(o)];"number"==typeof a?(255&a)==a?t.push(a):(t.push(a>>>8),t.push(255&a)):t.push(n)}}return t}};var e={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},n={L:1,M:0,Q:3,H:2},o={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},i=function(){var t=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],n=1335,i=7973,u=21522,f={},c=function(r){for(var t=0;0!=r;)t+=1,r>>>=1;return t};return f.getBCHTypeInfo=function(r){for(var t=r<<10;c(t)-c(n)>=0;)t^=n<<c(t)-c(n);return(r<<10|t)^u},f.getBCHTypeNumber=function(r){for(var t=r<<12;c(t)-c(i)>=0;)t^=i<<c(t)-c(i);return r<<12|t},f.getPatternPosition=function(r){return t[r-1]},f.getMaskFunction=function(r){switch(r){case o.PATTERN000:return function(r,t){return(r+t)%2==0};case o.PATTERN001:return function(r,t){return r%2==0};case o.PATTERN010:return function(r,t){return t%3==0};case o.PATTERN011:return function(r,t){return(r+t)%3==0};case o.PATTERN100:return function(r,t){return(Math.floor(r/2)+Math.floor(t/3))%2==0};case o.PATTERN101:return function(r,t){return r*t%2+r*t%3==0};case o.PATTERN110:return function(r,t){return(r*t%2+r*t%3)%2==0};case o.PATTERN111:return function(r,t){return(r*t%3+(r+t)%2)%2==0};default:throw new Error("bad maskPattern:"+r)}},f.getErrorCorrectPolynomial=function(t){for(var e=r([1],0),n=0;t>n;n+=1)e=e.multiply(r([1,a.gexp(n)],0));return e},f.getLengthInBits=function(r,t){if(t>=1&&10>t)switch(r){case e.MODE_NUMBER:return 10;case e.MODE_ALPHA_NUM:return 9;case e.MODE_8BIT_BYTE:return 8;case e.MODE_KANJI:return 8;default:throw new Error("mode:"+r)}else if(27>t)switch(r){case e.MODE_NUMBER:return 12;case e.MODE_ALPHA_NUM:return 11;case e.MODE_8BIT_BYTE:return 16;case e.MODE_KANJI:return 10;default:throw new Error("mode:"+r)}else{if(!(41>t))throw new Error("type:"+t);switch(r){case e.MODE_NUMBER:return 14;case e.MODE_ALPHA_NUM:return 13;case e.MODE_8BIT_BYTE:return 16;case e.MODE_KANJI:return 12;default:throw new Error("mode:"+r)}}},f.getLostPoint=function(r){for(var t=r.getModuleCount(),e=0,n=0;t>n;n+=1)for(var o=0;t>o;o+=1){for(var i=0,a=r.isDark(n,o),u=-1;1>=u;u+=1)if(!(0>n+u||n+u>=t))for(var f=-1;1>=f;f+=1)0>o+f||o+f>=t||0==u&&0==f||a==r.isDark(n+u,o+f)&&(i+=1);i>5&&(e+=3+i-5)}for(var n=0;t-1>n;n+=1)for(var o=0;t-1>o;o+=1){var c=0;r.isDark(n,o)&&(c+=1),r.isDark(n+1,o)&&(c+=1),r.isDark(n,o+1)&&(c+=1),r.isDark(n+1,o+1)&&(c+=1),0!=c&&4!=c||(e+=3)}for(var n=0;t>n;n+=1)for(var o=0;t-6>o;o+=1)r.isDark(n,o)&&!r.isDark(n,o+1)&&r.isDark(n,o+2)&&r.isDark(n,o+3)&&r.isDark(n,o+4)&&!r.isDark(n,o+5)&&r.isDark(n,o+6)&&(e+=40);for(var o=0;t>o;o+=1)for(var n=0;t-6>n;n+=1)r.isDark(n,o)&&!r.isDark(n+1,o)&&r.isDark(n+2,o)&&r.isDark(n+3,o)&&r.isDark(n+4,o)&&!r.isDark(n+5,o)&&r.isDark(n+6,o)&&(e+=40);for(var l=0,o=0;t>o;o+=1)for(var n=0;t>n;n+=1)r.isDark(n,o)&&(l+=1);var s=Math.abs(100*l/t/t-50)/5;return e+=10*s},f}(),a=function(){for(var r=new Array(256),t=new Array(256),e=0;8>e;e+=1)r[e]=1<<e;for(var e=8;256>e;e+=1)r[e]=r[e-4]^r[e-5]^r[e-6]^r[e-8];for(var e=0;255>e;e+=1)t[r[e]]=e;var n={};return n.glog=function(r){if(1>r)throw new Error("glog("+r+")");return t[r]},n.gexp=function(t){for(;0>t;)t+=255;for(;t>=256;)t-=255;return r[t]},n}(),u=function(){var r=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],t=function(r,t){var e={};return e.totalCount=r,e.dataCount=t,e},e={},o=function(t,e){switch(e){case n.L:return r[4*(t-1)+0];case n.M:return r[4*(t-1)+1];case n.Q:return r[4*(t-1)+2];case n.H:return r[4*(t-1)+3];default:return}};return e.getRSBlocks=function(r,e){var n=o(r,e);if("undefined"==typeof n)throw new Error("bad rs block @ typeNumber:"+r+"/errorCorrectLevel:"+e);for(var i=n.length/3,a=new Array,u=0;i>u;u+=1)for(var f=n[3*u+0],c=n[3*u+1],l=n[3*u+2],s=0;f>s;s+=1)a.push(t(c,l));return a},e}(),f=function(){var r=new Array,t=0,e={};return e.getBuffer=function(){return r},e.getAt=function(t){var e=Math.floor(t/8);return 1==(r[e]>>>7-t%8&1)},e.put=function(r,t){for(var n=0;t>n;n+=1)e.putBit(1==(r>>>t-n-1&1))},e.getLengthInBits=function(){return t},e.putBit=function(e){var n=Math.floor(t/8);r.length<=n&&r.push(0),e&&(r[n]|=128>>>t%8),t+=1},e},c=function(r){var n=e.MODE_8BIT_BYTE,o=t.stringToBytes(r),i={};return i.getMode=function(){return n},i.getLength=function(r){return o.length},i.write=function(r){for(var t=0;t<o.length;t+=1)r.put(o[t],8)},i},l=function(){var r=new Array,t={};return t.writeByte=function(t){r.push(255&t)},t.writeShort=function(r){t.writeByte(r),t.writeByte(r>>>8)},t.writeBytes=function(r,e,n){e=e||0,n=n||r.length;for(var o=0;n>o;o+=1)t.writeByte(r[o+e])},t.writeString=function(r){for(var e=0;e<r.length;e+=1)t.writeByte(r.charCodeAt(e))},t.toByteArray=function(){return r},t.toString=function(){var t="";t+="[";for(var e=0;e<r.length;e+=1)e>0&&(t+=","),t+=r[e];return t+="]"},t},s=function(){var r=0,t=0,e=0,n="",o={},i=function(r){n+=String.fromCharCode(a(63&r))},a=function(r){if(0>r);else{if(26>r)return 65+r;if(52>r)return 97+(r-26);if(62>r)return 48+(r-52);if(62==r)return 43;if(63==r)return 47}throw new Error("n:"+r)};return o.writeByte=function(n){for(r=r<<8|255&n,t+=8,e+=1;t>=6;)i(r>>>t-6),t-=6},o.flush=function(){if(t>0&&(i(r<<6-t),r=0,t=0),e%3!=0)for(var o=3-e%3,a=0;o>a;a+=1)n+="="},o.toString=function(){return n},o},g=function(r){var t=r,e=0,n=0,o=0,i={};i.read=function(){for(;8>o;){if(e>=t.length){if(0==o)return-1;throw new Error("unexpected end of file./"+o)}var r=t.charAt(e);if(e+=1,"="==r)return o=0,-1;r.match(/^\s$/)||(n=n<<6|a(r.charCodeAt(0)),o+=6)}var i=n>>>o-8&255;return o-=8,i};var a=function(r){if(r>=65&&90>=r)return r-65;if(r>=97&&122>=r)return r-97+26;if(r>=48&&57>=r)return r-48+52;if(43==r)return 62;if(47==r)return 63;throw new Error("c:"+r)};return i},h=function(r,t){var e=r,n=t,o=new Array(r*t),i={};i.setPixel=function(r,t,n){o[t*e+r]=n},i.write=function(r){r.writeString("GIF87a"),r.writeShort(e),r.writeShort(n),r.writeByte(128),r.writeByte(0),r.writeByte(0),r.writeByte(0),r.writeByte(0),r.writeByte(0),r.writeByte(255),r.writeByte(255),r.writeByte(255),r.writeString(","),r.writeShort(0),r.writeShort(0),r.writeShort(e),r.writeShort(n),r.writeByte(0);var t=2,o=u(t);r.writeByte(t);for(var i=0;o.length-i>255;)r.writeByte(255),r.writeBytes(o,i,255),i+=255;r.writeByte(o.length-i),r.writeBytes(o,i,o.length-i),r.writeByte(0),r.writeString(";")};var a=function(r){var t=r,e=0,n=0,o={};return o.write=function(r,o){if(r>>>o!=0)throw new Error("length over");for(;e+o>=8;)t.writeByte(255&(r<<e|n)),o-=8-e,r>>>=8-e,n=0,e=0;n=r<<e|n,e+=o},o.flush=function(){e>0&&t.writeByte(n)},o},u=function(r){for(var t=1<<r,e=(1<<r)+1,n=r+1,i=f(),u=0;t>u;u+=1)i.add(String.fromCharCode(u));i.add(String.fromCharCode(t)),i.add(String.fromCharCode(e));var c=l(),s=a(c);s.write(t,n);var g=0,h=String.fromCharCode(o[g]);for(g+=1;g<o.length;){var v=String.fromCharCode(o[g]);g+=1,i.contains(h+v)?h+=v:(s.write(i.indexOf(h),n),i.size()<4095&&(i.size()==1<<n&&(n+=1),i.add(h+v)),h=v)}return s.write(i.indexOf(h),n),s.write(e,n),s.flush(),c.toByteArray()},f=function(){var r={},t=0,e={};return e.add=function(n){if(e.contains(n))throw new Error("dup key:"+n);r[n]=t,t+=1},e.size=function(){return t},e.indexOf=function(t){return r[t]},e.contains=function(t){return"undefined"!=typeof r[t]},e};return i},v=function(r,t,e,n){for(var o=h(r,t),i=0;t>i;i+=1)for(var a=0;r>a;a+=1)o.setPixel(a,i,e(a,i));var u=l();o.write(u);for(var f=s(),c=u.toByteArray(),g=0;g<c.length;g+=1)f.writeByte(c[g]);f.flush();var v="";return v+="<img",v+=' src="',v+="data:image/gif;base64,",v+=f,v+='"',v+=' width="',v+=r,v+='"',v+=' height="',v+=t,v+='"',n&&(v+=' alt="',v+=n,v+='"'),v+="/>"};return t}();return function(e){"function"==typeof define&&define.amd?define([],e):"object"==typeof t&&(r.exports=e())}(function(){return e}),!function(r){r.stringToBytes=function(r){function t(r){for(var t=[],e=0;e<r.length;e++){var n=r.charCodeAt(e);128>n?t.push(n):2048>n?t.push(192|n>>6,128|63&n):55296>n||n>=57344?t.push(224|n>>12,128|n>>6&63,128|63&n):(e++,n=65536+((1023&n)<<10|1023&r.charCodeAt(e)),t.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|63&n))}return t}return t(r)}}(e),e}(),i=function(r,t){var i=arguments.length<=2||void 0===arguments[2]?1:arguments[2];i=Math.max(1,i);for(var a=i;40>=a;a+=1)try{var u=function(){var e=o(a,t);e.addData(r),e.make();var n=e.getModuleCount(),i=function(r,t){return r>=0&&n>r&&t>=0&&n>t&&e.isDark(r,t)};return{v:{text:r,level:t,version:a,moduleCount:n,isDark:i}}}();if("object"===("undefined"==typeof u?"undefined":e(u)))return u.v}catch(f){if(!n.test(f.message))throw f}return null},a=function(){var r=arguments.length<=0||void 0===arguments[0]?"":arguments[0],t=arguments.length<=1||void 0===arguments[1]?"L":arguments[1],e=arguments.length<=2||void 0===arguments[2]?1:arguments[2],n=arguments.length<=3||void 0===arguments[3]?0:arguments[3],o=i(r,t,e);return o&&!function(){var r=o.isDark;o.moduleCount+=2*n,o.isDark=function(t,e){return r(t-n,e-n)}}(),o};r.exports=a},function(r,t,e){"use strict";var n=e(5),o=e(6),i=function(r,t){r.fillStyle=t.back,r.fillRect(0,0,t.size,t.size)},a=function(r,t,e,n,o,i){r.isDark(o,i)&&t.rect(i*n,o*n,n,n)},u=function(r,t,e){if(r){var o=e.rounded>0&&e.rounded<=100?n:a,i=r.moduleCount,u=e.size/i,f=0;e.crisp&&(u=Math.floor(u),f=Math.floor((e.size-u*i)/2)),t.translate(f,f),t.beginPath();for(var c=0;i>c;c+=1)for(var l=0;i>l;l+=1)o(r,t,e,u,c,l);t.fillStyle=e.fill,t.fill(),t.translate(-f,-f)}},f=function(r,t,e){i(t,e),u(r,t,e),o(t,e)};r.exports=f},function(r,t){"use strict";var e=function(r){return{c:r,m:function(){var r;return(r=this.c).moveTo.apply(r,arguments),this},l:function(){var r;return(r=this.c).lineTo.apply(r,arguments),this},a:function(){var r;return(r=this.c).arcTo.apply(r,arguments),this}}},n=function(r,t,e,n,o,i,a,u,f,c){a?r.m(t+i,e):r.m(t,e),u?r.l(n-i,e).a(n,e,n,o,i):r.l(n,e),f?r.l(n,o-i).a(n,o,t,o,i):r.l(n,o),c?r.l(t+i,o).a(t,o,t,e,i):r.l(t,o),a?r.l(t,e+i).a(t,e,n,e,i):r.l(t,e)},o=function(r,t,e,n,o,i,a,u,f,c){a&&r.m(t+i,e).l(t,e).l(t,e+i).a(t,e,t+i,e,i),u&&r.m(n-i,e).l(n,e).l(n,e+i).a(n,e,n-i,e,i),f&&r.m(n-i,o).l(n,o).l(n,o-i).a(n,o,n-i,o,i),c&&r.m(t+i,o).l(t,o).l(t,o-i).a(t,o,t+i,o,i)},i=function(r,t,i,a,u,f){var c=f*a,l=u*a,s=c+a,g=l+a,h=.005*i.rounded*a,v=r.isDark,d=u-1,w=u+1,y=f-1,p=f+1,m=v(u,f),A=v(d,y),B=v(d,f),E=v(d,p),T=v(u,p),M=v(w,p),k=v(w,f),b=v(w,y),x=v(u,y),D=e(t);m?n(D,c,l,s,g,h,!B&&!x,!B&&!T,!k&&!T,!k&&!x):o(D,c,l,s,g,h,B&&x&&A,B&&T&&E,k&&T&&M,k&&x&&b)};r.exports=i},function(r,t){"use strict";var e=function(r,t){var e=t.size,n="bold "+.01*t.mSize*e+"px "+t.fontname;r.strokeStyle=t.back,r.lineWidth=.01*t.mSize*e*.1,r.fillStyle=t.fontcolor,r.font=n;var o=r.measureText(t.label).width,i=.01*t.mSize,a=o/e,u=(1-a)*t.mPosX*.01,f=(1-i)*t.mPosY*.01,c=u*e,l=f*e+.75*t.mSize*.01*e;r.strokeText(t.label,c,l),r.fillText(t.label,c,l)},n=function(r,t){var e=t.size,n=t.image.naturalWidth||1,o=t.image.naturalHeight||1,i=.01*t.mSize,a=i*n/o,u=(1-a)*t.mPosX*.01,f=(1-i)*t.mPosY*.01,c=u*e,l=f*e,s=a*e,g=i*e;r.drawImage(t.image,c,l,s,g)},o=function(r,t){var o=t.mode;"label"===o?e(r,t):"image"===o&&n(r,t)};r.exports=o}])});;
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.moment=t()}(this,function(){"use strict";var e,i;function c(){return e.apply(null,arguments)}function o(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function u(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function l(e){return void 0===e}function h(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function d(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function f(e,t){var n,s=[];for(n=0;n<e.length;++n)s.push(t(e[n],n));return s}function m(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function _(e,t){for(var n in t)m(t,n)&&(e[n]=t[n]);return m(t,"toString")&&(e.toString=t.toString),m(t,"valueOf")&&(e.valueOf=t.valueOf),e}function y(e,t,n,s){return Tt(e,t,n,s,!0).utc()}function g(e){return null==e._pf&&(e._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],meridiem:null,rfc2822:!1,weekdayMismatch:!1}),e._pf}function v(e){if(null==e._isValid){var t=g(e),n=i.call(t.parsedDateParts,function(e){return null!=e}),s=!isNaN(e._d.getTime())&&t.overflow<0&&!t.empty&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&n);if(e._strict&&(s=s&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour),null!=Object.isFrozen&&Object.isFrozen(e))return s;e._isValid=s}return e._isValid}function p(e){var t=y(NaN);return null!=e?_(g(t),e):g(t).userInvalidated=!0,t}i=Array.prototype.some?Array.prototype.some:function(e){for(var t=Object(this),n=t.length>>>0,s=0;s<n;s++)if(s in t&&e.call(this,t[s],s,t))return!0;return!1};var r=c.momentProperties=[];function w(e,t){var n,s,i;if(l(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),l(t._i)||(e._i=t._i),l(t._f)||(e._f=t._f),l(t._l)||(e._l=t._l),l(t._strict)||(e._strict=t._strict),l(t._tzm)||(e._tzm=t._tzm),l(t._isUTC)||(e._isUTC=t._isUTC),l(t._offset)||(e._offset=t._offset),l(t._pf)||(e._pf=g(t)),l(t._locale)||(e._locale=t._locale),0<r.length)for(n=0;n<r.length;n++)l(i=t[s=r[n]])||(e[s]=i);return e}var t=!1;function M(e){w(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===t&&(t=!0,c.updateOffset(this),t=!1)}function k(e){return e instanceof M||null!=e&&null!=e._isAMomentObject}function S(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function D(e){var t=+e,n=0;return 0!==t&&isFinite(t)&&(n=S(t)),n}function a(e,t,n){var s,i=Math.min(e.length,t.length),r=Math.abs(e.length-t.length),a=0;for(s=0;s<i;s++)(n&&e[s]!==t[s]||!n&&D(e[s])!==D(t[s]))&&a++;return a+r}function Y(e){!1===c.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function n(i,r){var a=!0;return _(function(){if(null!=c.deprecationHandler&&c.deprecationHandler(null,i),a){for(var e,t=[],n=0;n<arguments.length;n++){if(e="","object"==typeof arguments[n]){for(var s in e+="\n["+n+"] ",arguments[0])e+=s+": "+arguments[0][s]+", ";e=e.slice(0,-2)}else e=arguments[n];t.push(e)}Y(i+"\nArguments: "+Array.prototype.slice.call(t).join("")+"\n"+(new Error).stack),a=!1}return r.apply(this,arguments)},r)}var s,O={};function T(e,t){null!=c.deprecationHandler&&c.deprecationHandler(e,t),O[e]||(Y(t),O[e]=!0)}function b(e){return e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function x(e,t){var n,s=_({},e);for(n in t)m(t,n)&&(u(e[n])&&u(t[n])?(s[n]={},_(s[n],e[n]),_(s[n],t[n])):null!=t[n]?s[n]=t[n]:delete s[n]);for(n in e)m(e,n)&&!m(t,n)&&u(e[n])&&(s[n]=_({},s[n]));return s}function P(e){null!=e&&this.set(e)}c.suppressDeprecationWarnings=!1,c.deprecationHandler=null,s=Object.keys?Object.keys:function(e){var t,n=[];for(t in e)m(e,t)&&n.push(t);return n};var W={};function C(e,t){var n=e.toLowerCase();W[n]=W[n+"s"]=W[t]=e}function H(e){return"string"==typeof e?W[e]||W[e.toLowerCase()]:void 0}function R(e){var t,n,s={};for(n in e)m(e,n)&&(t=H(n))&&(s[t]=e[n]);return s}var U={};function F(e,t){U[e]=t}function L(e,t,n){var s=""+Math.abs(e),i=t-s.length;return(0<=e?n?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+s}var N=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,G=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,V={},E={};function I(e,t,n,s){var i=s;"string"==typeof s&&(i=function(){return this[s]()}),e&&(E[e]=i),t&&(E[t[0]]=function(){return L(i.apply(this,arguments),t[1],t[2])}),n&&(E[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function A(e,t){return e.isValid()?(t=j(t,e.localeData()),V[t]=V[t]||function(s){var e,i,t,r=s.match(N);for(e=0,i=r.length;e<i;e++)E[r[e]]?r[e]=E[r[e]]:r[e]=(t=r[e]).match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"");return function(e){var t,n="";for(t=0;t<i;t++)n+=b(r[t])?r[t].call(e,s):r[t];return n}}(t),V[t](e)):e.localeData().invalidDate()}function j(e,t){var n=5;function s(e){return t.longDateFormat(e)||e}for(G.lastIndex=0;0<=n&&G.test(e);)e=e.replace(G,s),G.lastIndex=0,n-=1;return e}var Z=/\d/,z=/\d\d/,$=/\d{3}/,q=/\d{4}/,J=/[+-]?\d{6}/,B=/\d\d?/,Q=/\d\d\d\d?/,X=/\d\d\d\d\d\d?/,K=/\d{1,3}/,ee=/\d{1,4}/,te=/[+-]?\d{1,6}/,ne=/\d+/,se=/[+-]?\d+/,ie=/Z|[+-]\d\d:?\d\d/gi,re=/Z|[+-]\d\d(?::?\d\d)?/gi,ae=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,oe={};function ue(e,n,s){oe[e]=b(n)?n:function(e,t){return e&&s?s:n}}function le(e,t){return m(oe,e)?oe[e](t._strict,t._locale):new RegExp(he(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,n,s,i){return t||n||s||i})))}function he(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var de={};function ce(e,n){var t,s=n;for("string"==typeof e&&(e=[e]),h(n)&&(s=function(e,t){t[n]=D(e)}),t=0;t<e.length;t++)de[e[t]]=s}function fe(e,i){ce(e,function(e,t,n,s){n._w=n._w||{},i(e,n._w,n,s)})}var me=0,_e=1,ye=2,ge=3,ve=4,pe=5,we=6,Me=7,ke=8;function Se(e){return De(e)?366:365}function De(e){return e%4==0&&e%100!=0||e%400==0}I("Y",0,0,function(){var e=this.year();return e<=9999?""+e:"+"+e}),I(0,["YY",2],0,function(){return this.year()%100}),I(0,["YYYY",4],0,"year"),I(0,["YYYYY",5],0,"year"),I(0,["YYYYYY",6,!0],0,"year"),C("year","y"),F("year",1),ue("Y",se),ue("YY",B,z),ue("YYYY",ee,q),ue("YYYYY",te,J),ue("YYYYYY",te,J),ce(["YYYYY","YYYYYY"],me),ce("YYYY",function(e,t){t[me]=2===e.length?c.parseTwoDigitYear(e):D(e)}),ce("YY",function(e,t){t[me]=c.parseTwoDigitYear(e)}),ce("Y",function(e,t){t[me]=parseInt(e,10)}),c.parseTwoDigitYear=function(e){return D(e)+(68<D(e)?1900:2e3)};var Ye,Oe=Te("FullYear",!0);function Te(t,n){return function(e){return null!=e?(xe(this,t,e),c.updateOffset(this,n),this):be(this,t)}}function be(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function xe(e,t,n){e.isValid()&&!isNaN(n)&&("FullYear"===t&&De(e.year())&&1===e.month()&&29===e.date()?e._d["set"+(e._isUTC?"UTC":"")+t](n,e.month(),Pe(n,e.month())):e._d["set"+(e._isUTC?"UTC":"")+t](n))}function Pe(e,t){if(isNaN(e)||isNaN(t))return NaN;var n,s=(t%(n=12)+n)%n;return e+=(t-s)/12,1===s?De(e)?29:28:31-s%7%2}Ye=Array.prototype.indexOf?Array.prototype.indexOf:function(e){var t;for(t=0;t<this.length;++t)if(this[t]===e)return t;return-1},I("M",["MM",2],"Mo",function(){return this.month()+1}),I("MMM",0,0,function(e){return this.localeData().monthsShort(this,e)}),I("MMMM",0,0,function(e){return this.localeData().months(this,e)}),C("month","M"),F("month",8),ue("M",B),ue("MM",B,z),ue("MMM",function(e,t){return t.monthsShortRegex(e)}),ue("MMMM",function(e,t){return t.monthsRegex(e)}),ce(["M","MM"],function(e,t){t[_e]=D(e)-1}),ce(["MMM","MMMM"],function(e,t,n,s){var i=n._locale.monthsParse(e,s,n._strict);null!=i?t[_e]=i:g(n).invalidMonth=e});var We=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Ce="January_February_March_April_May_June_July_August_September_October_November_December".split("_");var He="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_");function Re(e,t){var n;if(!e.isValid())return e;if("string"==typeof t)if(/^\d+$/.test(t))t=D(t);else if(!h(t=e.localeData().monthsParse(t)))return e;return n=Math.min(e.date(),Pe(e.year(),t)),e._d["set"+(e._isUTC?"UTC":"")+"Month"](t,n),e}function Ue(e){return null!=e?(Re(this,e),c.updateOffset(this,!0),this):be(this,"Month")}var Fe=ae;var Le=ae;function Ne(){function e(e,t){return t.length-e.length}var t,n,s=[],i=[],r=[];for(t=0;t<12;t++)n=y([2e3,t]),s.push(this.monthsShort(n,"")),i.push(this.months(n,"")),r.push(this.months(n,"")),r.push(this.monthsShort(n,""));for(s.sort(e),i.sort(e),r.sort(e),t=0;t<12;t++)s[t]=he(s[t]),i[t]=he(i[t]);for(t=0;t<24;t++)r[t]=he(r[t]);this._monthsRegex=new RegExp("^("+r.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+s.join("|")+")","i")}function Ge(e){var t;if(e<100&&0<=e){var n=Array.prototype.slice.call(arguments);n[0]=e+400,t=new Date(Date.UTC.apply(null,n)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)}else t=new Date(Date.UTC.apply(null,arguments));return t}function Ve(e,t,n){var s=7+t-n;return-((7+Ge(e,0,s).getUTCDay()-t)%7)+s-1}function Ee(e,t,n,s,i){var r,a,o=1+7*(t-1)+(7+n-s)%7+Ve(e,s,i);return a=o<=0?Se(r=e-1)+o:o>Se(e)?(r=e+1,o-Se(e)):(r=e,o),{year:r,dayOfYear:a}}function Ie(e,t,n){var s,i,r=Ve(e.year(),t,n),a=Math.floor((e.dayOfYear()-r-1)/7)+1;return a<1?s=a+Ae(i=e.year()-1,t,n):a>Ae(e.year(),t,n)?(s=a-Ae(e.year(),t,n),i=e.year()+1):(i=e.year(),s=a),{week:s,year:i}}function Ae(e,t,n){var s=Ve(e,t,n),i=Ve(e+1,t,n);return(Se(e)-s+i)/7}I("w",["ww",2],"wo","week"),I("W",["WW",2],"Wo","isoWeek"),C("week","w"),C("isoWeek","W"),F("week",5),F("isoWeek",5),ue("w",B),ue("ww",B,z),ue("W",B),ue("WW",B,z),fe(["w","ww","W","WW"],function(e,t,n,s){t[s.substr(0,1)]=D(e)});function je(e,t){return e.slice(t,7).concat(e.slice(0,t))}I("d",0,"do","day"),I("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),I("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),I("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),I("e",0,0,"weekday"),I("E",0,0,"isoWeekday"),C("day","d"),C("weekday","e"),C("isoWeekday","E"),F("day",11),F("weekday",11),F("isoWeekday",11),ue("d",B),ue("e",B),ue("E",B),ue("dd",function(e,t){return t.weekdaysMinRegex(e)}),ue("ddd",function(e,t){return t.weekdaysShortRegex(e)}),ue("dddd",function(e,t){return t.weekdaysRegex(e)}),fe(["dd","ddd","dddd"],function(e,t,n,s){var i=n._locale.weekdaysParse(e,s,n._strict);null!=i?t.d=i:g(n).invalidWeekday=e}),fe(["d","e","E"],function(e,t,n,s){t[s]=D(e)});var Ze="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_");var ze="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");var $e="Su_Mo_Tu_We_Th_Fr_Sa".split("_");var qe=ae;var Je=ae;var Be=ae;function Qe(){function e(e,t){return t.length-e.length}var t,n,s,i,r,a=[],o=[],u=[],l=[];for(t=0;t<7;t++)n=y([2e3,1]).day(t),s=this.weekdaysMin(n,""),i=this.weekdaysShort(n,""),r=this.weekdays(n,""),a.push(s),o.push(i),u.push(r),l.push(s),l.push(i),l.push(r);for(a.sort(e),o.sort(e),u.sort(e),l.sort(e),t=0;t<7;t++)o[t]=he(o[t]),u[t]=he(u[t]),l[t]=he(l[t]);this._weekdaysRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+a.join("|")+")","i")}function Xe(){return this.hours()%12||12}function Ke(e,t){I(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function et(e,t){return t._meridiemParse}I("H",["HH",2],0,"hour"),I("h",["hh",2],0,Xe),I("k",["kk",2],0,function(){return this.hours()||24}),I("hmm",0,0,function(){return""+Xe.apply(this)+L(this.minutes(),2)}),I("hmmss",0,0,function(){return""+Xe.apply(this)+L(this.minutes(),2)+L(this.seconds(),2)}),I("Hmm",0,0,function(){return""+this.hours()+L(this.minutes(),2)}),I("Hmmss",0,0,function(){return""+this.hours()+L(this.minutes(),2)+L(this.seconds(),2)}),Ke("a",!0),Ke("A",!1),C("hour","h"),F("hour",13),ue("a",et),ue("A",et),ue("H",B),ue("h",B),ue("k",B),ue("HH",B,z),ue("hh",B,z),ue("kk",B,z),ue("hmm",Q),ue("hmmss",X),ue("Hmm",Q),ue("Hmmss",X),ce(["H","HH"],ge),ce(["k","kk"],function(e,t,n){var s=D(e);t[ge]=24===s?0:s}),ce(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),ce(["h","hh"],function(e,t,n){t[ge]=D(e),g(n).bigHour=!0}),ce("hmm",function(e,t,n){var s=e.length-2;t[ge]=D(e.substr(0,s)),t[ve]=D(e.substr(s)),g(n).bigHour=!0}),ce("hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[ge]=D(e.substr(0,s)),t[ve]=D(e.substr(s,2)),t[pe]=D(e.substr(i)),g(n).bigHour=!0}),ce("Hmm",function(e,t,n){var s=e.length-2;t[ge]=D(e.substr(0,s)),t[ve]=D(e.substr(s))}),ce("Hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[ge]=D(e.substr(0,s)),t[ve]=D(e.substr(s,2)),t[pe]=D(e.substr(i))});var tt,nt=Te("Hours",!0),st={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:Ce,monthsShort:He,week:{dow:0,doy:6},weekdays:Ze,weekdaysMin:$e,weekdaysShort:ze,meridiemParse:/[ap]\.?m?\.?/i},it={},rt={};function at(e){return e?e.toLowerCase().replace("_","-"):e}function ot(e){var t=null;if(!it[e]&&"undefined"!=typeof module&&module&&module.exports)try{t=tt._abbr,require("./locale/"+e),ut(t)}catch(e){}return it[e]}function ut(e,t){var n;return e&&((n=l(t)?ht(e):lt(e,t))?tt=n:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),tt._abbr}function lt(e,t){if(null===t)return delete it[e],null;var n,s=st;if(t.abbr=e,null!=it[e])T("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=it[e]._config;else if(null!=t.parentLocale)if(null!=it[t.parentLocale])s=it[t.parentLocale]._config;else{if(null==(n=ot(t.parentLocale)))return rt[t.parentLocale]||(rt[t.parentLocale]=[]),rt[t.parentLocale].push({name:e,config:t}),null;s=n._config}return it[e]=new P(x(s,t)),rt[e]&&rt[e].forEach(function(e){lt(e.name,e.config)}),ut(e),it[e]}function ht(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return tt;if(!o(e)){if(t=ot(e))return t;e=[e]}return function(e){for(var t,n,s,i,r=0;r<e.length;){for(t=(i=at(e[r]).split("-")).length,n=(n=at(e[r+1]))?n.split("-"):null;0<t;){if(s=ot(i.slice(0,t).join("-")))return s;if(n&&n.length>=t&&a(i,n,!0)>=t-1)break;t--}r++}return tt}(e)}function dt(e){var t,n=e._a;return n&&-2===g(e).overflow&&(t=n[_e]<0||11<n[_e]?_e:n[ye]<1||n[ye]>Pe(n[me],n[_e])?ye:n[ge]<0||24<n[ge]||24===n[ge]&&(0!==n[ve]||0!==n[pe]||0!==n[we])?ge:n[ve]<0||59<n[ve]?ve:n[pe]<0||59<n[pe]?pe:n[we]<0||999<n[we]?we:-1,g(e)._overflowDayOfYear&&(t<me||ye<t)&&(t=ye),g(e)._overflowWeeks&&-1===t&&(t=Me),g(e)._overflowWeekday&&-1===t&&(t=ke),g(e).overflow=t),e}function ct(e,t,n){return null!=e?e:null!=t?t:n}function ft(e){var t,n,s,i,r,a=[];if(!e._d){var o,u;for(o=e,u=new Date(c.now()),s=o._useUTC?[u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()]:[u.getFullYear(),u.getMonth(),u.getDate()],e._w&&null==e._a[ye]&&null==e._a[_e]&&function(e){var t,n,s,i,r,a,o,u;if(null!=(t=e._w).GG||null!=t.W||null!=t.E)r=1,a=4,n=ct(t.GG,e._a[me],Ie(bt(),1,4).year),s=ct(t.W,1),((i=ct(t.E,1))<1||7<i)&&(u=!0);else{r=e._locale._week.dow,a=e._locale._week.doy;var l=Ie(bt(),r,a);n=ct(t.gg,e._a[me],l.year),s=ct(t.w,l.week),null!=t.d?((i=t.d)<0||6<i)&&(u=!0):null!=t.e?(i=t.e+r,(t.e<0||6<t.e)&&(u=!0)):i=r}s<1||s>Ae(n,r,a)?g(e)._overflowWeeks=!0:null!=u?g(e)._overflowWeekday=!0:(o=Ee(n,s,i,r,a),e._a[me]=o.year,e._dayOfYear=o.dayOfYear)}(e),null!=e._dayOfYear&&(r=ct(e._a[me],s[me]),(e._dayOfYear>Se(r)||0===e._dayOfYear)&&(g(e)._overflowDayOfYear=!0),n=Ge(r,0,e._dayOfYear),e._a[_e]=n.getUTCMonth(),e._a[ye]=n.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=a[t]=s[t];for(;t<7;t++)e._a[t]=a[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[ge]&&0===e._a[ve]&&0===e._a[pe]&&0===e._a[we]&&(e._nextDay=!0,e._a[ge]=0),e._d=(e._useUTC?Ge:function(e,t,n,s,i,r,a){var o;return e<100&&0<=e?(o=new Date(e+400,t,n,s,i,r,a),isFinite(o.getFullYear())&&o.setFullYear(e)):o=new Date(e,t,n,s,i,r,a),o}).apply(null,a),i=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[ge]=24),e._w&&void 0!==e._w.d&&e._w.d!==i&&(g(e).weekdayMismatch=!0)}}var mt=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,_t=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,yt=/Z|[+-]\d\d(?::?\d\d)?/,gt=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],vt=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],pt=/^\/?Date\((\-?\d+)/i;function wt(e){var t,n,s,i,r,a,o=e._i,u=mt.exec(o)||_t.exec(o);if(u){for(g(e).iso=!0,t=0,n=gt.length;t<n;t++)if(gt[t][1].exec(u[1])){i=gt[t][0],s=!1!==gt[t][2];break}if(null==i)return void(e._isValid=!1);if(u[3]){for(t=0,n=vt.length;t<n;t++)if(vt[t][1].exec(u[3])){r=(u[2]||" ")+vt[t][0];break}if(null==r)return void(e._isValid=!1)}if(!s&&null!=r)return void(e._isValid=!1);if(u[4]){if(!yt.exec(u[4]))return void(e._isValid=!1);a="Z"}e._f=i+(r||"")+(a||""),Yt(e)}else e._isValid=!1}var Mt=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/;function kt(e,t,n,s,i,r){var a=[function(e){var t=parseInt(e,10);{if(t<=49)return 2e3+t;if(t<=999)return 1900+t}return t}(e),He.indexOf(t),parseInt(n,10),parseInt(s,10),parseInt(i,10)];return r&&a.push(parseInt(r,10)),a}var St={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Dt(e){var t,n,s,i=Mt.exec(e._i.replace(/\([^)]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,""));if(i){var r=kt(i[4],i[3],i[2],i[5],i[6],i[7]);if(t=i[1],n=r,s=e,t&&ze.indexOf(t)!==new Date(n[0],n[1],n[2]).getDay()&&(g(s).weekdayMismatch=!0,!(s._isValid=!1)))return;e._a=r,e._tzm=function(e,t,n){if(e)return St[e];if(t)return 0;var s=parseInt(n,10),i=s%100;return(s-i)/100*60+i}(i[8],i[9],i[10]),e._d=Ge.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),g(e).rfc2822=!0}else e._isValid=!1}function Yt(e){if(e._f!==c.ISO_8601)if(e._f!==c.RFC_2822){e._a=[],g(e).empty=!0;var t,n,s,i,r,a,o,u,l=""+e._i,h=l.length,d=0;for(s=j(e._f,e._locale).match(N)||[],t=0;t<s.length;t++)i=s[t],(n=(l.match(le(i,e))||[])[0])&&(0<(r=l.substr(0,l.indexOf(n))).length&&g(e).unusedInput.push(r),l=l.slice(l.indexOf(n)+n.length),d+=n.length),E[i]?(n?g(e).empty=!1:g(e).unusedTokens.push(i),a=i,u=e,null!=(o=n)&&m(de,a)&&de[a](o,u._a,u,a)):e._strict&&!n&&g(e).unusedTokens.push(i);g(e).charsLeftOver=h-d,0<l.length&&g(e).unusedInput.push(l),e._a[ge]<=12&&!0===g(e).bigHour&&0<e._a[ge]&&(g(e).bigHour=void 0),g(e).parsedDateParts=e._a.slice(0),g(e).meridiem=e._meridiem,e._a[ge]=function(e,t,n){var s;if(null==n)return t;return null!=e.meridiemHour?e.meridiemHour(t,n):(null!=e.isPM&&((s=e.isPM(n))&&t<12&&(t+=12),s||12!==t||(t=0)),t)}(e._locale,e._a[ge],e._meridiem),ft(e),dt(e)}else Dt(e);else wt(e)}function Ot(e){var t,n,s,i,r=e._i,a=e._f;return e._locale=e._locale||ht(e._l),null===r||void 0===a&&""===r?p({nullInput:!0}):("string"==typeof r&&(e._i=r=e._locale.preparse(r)),k(r)?new M(dt(r)):(d(r)?e._d=r:o(a)?function(e){var t,n,s,i,r;if(0===e._f.length)return g(e).invalidFormat=!0,e._d=new Date(NaN);for(i=0;i<e._f.length;i++)r=0,t=w({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._f=e._f[i],Yt(t),v(t)&&(r+=g(t).charsLeftOver,r+=10*g(t).unusedTokens.length,g(t).score=r,(null==s||r<s)&&(s=r,n=t));_(e,n||t)}(e):a?Yt(e):l(n=(t=e)._i)?t._d=new Date(c.now()):d(n)?t._d=new Date(n.valueOf()):"string"==typeof n?(s=t,null===(i=pt.exec(s._i))?(wt(s),!1===s._isValid&&(delete s._isValid,Dt(s),!1===s._isValid&&(delete s._isValid,c.createFromInputFallback(s)))):s._d=new Date(+i[1])):o(n)?(t._a=f(n.slice(0),function(e){return parseInt(e,10)}),ft(t)):u(n)?function(e){if(!e._d){var t=R(e._i);e._a=f([t.year,t.month,t.day||t.date,t.hour,t.minute,t.second,t.millisecond],function(e){return e&&parseInt(e,10)}),ft(e)}}(t):h(n)?t._d=new Date(n):c.createFromInputFallback(t),v(e)||(e._d=null),e))}function Tt(e,t,n,s,i){var r,a={};return!0!==n&&!1!==n||(s=n,n=void 0),(u(e)&&function(e){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;var t;for(t in e)if(e.hasOwnProperty(t))return!1;return!0}(e)||o(e)&&0===e.length)&&(e=void 0),a._isAMomentObject=!0,a._useUTC=a._isUTC=i,a._l=n,a._i=e,a._f=t,a._strict=s,(r=new M(dt(Ot(a))))._nextDay&&(r.add(1,"d"),r._nextDay=void 0),r}function bt(e,t,n,s){return Tt(e,t,n,s,!1)}c.createFromInputFallback=n("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))}),c.ISO_8601=function(){},c.RFC_2822=function(){};var xt=n("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=bt.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:p()}),Pt=n("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=bt.apply(null,arguments);return this.isValid()&&e.isValid()?this<e?this:e:p()});function Wt(e,t){var n,s;if(1===t.length&&o(t[0])&&(t=t[0]),!t.length)return bt();for(n=t[0],s=1;s<t.length;++s)t[s].isValid()&&!t[s][e](n)||(n=t[s]);return n}var Ct=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Ht(e){var t=R(e),n=t.year||0,s=t.quarter||0,i=t.month||0,r=t.week||t.isoWeek||0,a=t.day||0,o=t.hour||0,u=t.minute||0,l=t.second||0,h=t.millisecond||0;this._isValid=function(e){for(var t in e)if(-1===Ye.call(Ct,t)||null!=e[t]&&isNaN(e[t]))return!1;for(var n=!1,s=0;s<Ct.length;++s)if(e[Ct[s]]){if(n)return!1;parseFloat(e[Ct[s]])!==D(e[Ct[s]])&&(n=!0)}return!0}(t),this._milliseconds=+h+1e3*l+6e4*u+1e3*o*60*60,this._days=+a+7*r,this._months=+i+3*s+12*n,this._data={},this._locale=ht(),this._bubble()}function Rt(e){return e instanceof Ht}function Ut(e){return e<0?-1*Math.round(-1*e):Math.round(e)}function Ft(e,n){I(e,0,0,function(){var e=this.utcOffset(),t="+";return e<0&&(e=-e,t="-"),t+L(~~(e/60),2)+n+L(~~e%60,2)})}Ft("Z",":"),Ft("ZZ",""),ue("Z",re),ue("ZZ",re),ce(["Z","ZZ"],function(e,t,n){n._useUTC=!0,n._tzm=Nt(re,e)});var Lt=/([\+\-]|\d\d)/gi;function Nt(e,t){var n=(t||"").match(e);if(null===n)return null;var s=((n[n.length-1]||[])+"").match(Lt)||["-",0,0],i=60*s[1]+D(s[2]);return 0===i?0:"+"===s[0]?i:-i}function Gt(e,t){var n,s;return t._isUTC?(n=t.clone(),s=(k(e)||d(e)?e.valueOf():bt(e).valueOf())-n.valueOf(),n._d.setTime(n._d.valueOf()+s),c.updateOffset(n,!1),n):bt(e).local()}function Vt(e){return 15*-Math.round(e._d.getTimezoneOffset()/15)}function Et(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}c.updateOffset=function(){};var It=/^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,At=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function jt(e,t){var n,s,i,r=e,a=null;return Rt(e)?r={ms:e._milliseconds,d:e._days,M:e._months}:h(e)?(r={},t?r[t]=e:r.milliseconds=e):(a=It.exec(e))?(n="-"===a[1]?-1:1,r={y:0,d:D(a[ye])*n,h:D(a[ge])*n,m:D(a[ve])*n,s:D(a[pe])*n,ms:D(Ut(1e3*a[we]))*n}):(a=At.exec(e))?(n="-"===a[1]?-1:1,r={y:Zt(a[2],n),M:Zt(a[3],n),w:Zt(a[4],n),d:Zt(a[5],n),h:Zt(a[6],n),m:Zt(a[7],n),s:Zt(a[8],n)}):null==r?r={}:"object"==typeof r&&("from"in r||"to"in r)&&(i=function(e,t){var n;if(!e.isValid()||!t.isValid())return{milliseconds:0,months:0};t=Gt(t,e),e.isBefore(t)?n=zt(e,t):((n=zt(t,e)).milliseconds=-n.milliseconds,n.months=-n.months);return n}(bt(r.from),bt(r.to)),(r={}).ms=i.milliseconds,r.M=i.months),s=new Ht(r),Rt(e)&&m(e,"_locale")&&(s._locale=e._locale),s}function Zt(e,t){var n=e&&parseFloat(e.replace(",","."));return(isNaN(n)?0:n)*t}function zt(e,t){var n={};return n.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(n.months,"M").isAfter(t)&&--n.months,n.milliseconds=+t-+e.clone().add(n.months,"M"),n}function $t(s,i){return function(e,t){var n;return null===t||isNaN(+t)||(T(i,"moment()."+i+"(period, number) is deprecated. Please use moment()."+i+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),n=e,e=t,t=n),qt(this,jt(e="string"==typeof e?+e:e,t),s),this}}function qt(e,t,n,s){var i=t._milliseconds,r=Ut(t._days),a=Ut(t._months);e.isValid()&&(s=null==s||s,a&&Re(e,be(e,"Month")+a*n),r&&xe(e,"Date",be(e,"Date")+r*n),i&&e._d.setTime(e._d.valueOf()+i*n),s&&c.updateOffset(e,r||a))}jt.fn=Ht.prototype,jt.invalid=function(){return jt(NaN)};var Jt=$t(1,"add"),Bt=$t(-1,"subtract");function Qt(e,t){var n=12*(t.year()-e.year())+(t.month()-e.month()),s=e.clone().add(n,"months");return-(n+(t-s<0?(t-s)/(s-e.clone().add(n-1,"months")):(t-s)/(e.clone().add(n+1,"months")-s)))||0}function Xt(e){var t;return void 0===e?this._locale._abbr:(null!=(t=ht(e))&&(this._locale=t),this)}c.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",c.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var Kt=n("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return void 0===e?this.localeData():this.locale(e)});function en(){return this._locale}var tn=126227808e5;function nn(e,t){return(e%t+t)%t}function sn(e,t,n){return e<100&&0<=e?new Date(e+400,t,n)-tn:new Date(e,t,n).valueOf()}function rn(e,t,n){return e<100&&0<=e?Date.UTC(e+400,t,n)-tn:Date.UTC(e,t,n)}function an(e,t){I(0,[e,e.length],0,t)}function on(e,t,n,s,i){var r;return null==e?Ie(this,s,i).year:((r=Ae(e,s,i))<t&&(t=r),function(e,t,n,s,i){var r=Ee(e,t,n,s,i),a=Ge(r.year,0,r.dayOfYear);return this.year(a.getUTCFullYear()),this.month(a.getUTCMonth()),this.date(a.getUTCDate()),this}.call(this,e,t,n,s,i))}I(0,["gg",2],0,function(){return this.weekYear()%100}),I(0,["GG",2],0,function(){return this.isoWeekYear()%100}),an("gggg","weekYear"),an("ggggg","weekYear"),an("GGGG","isoWeekYear"),an("GGGGG","isoWeekYear"),C("weekYear","gg"),C("isoWeekYear","GG"),F("weekYear",1),F("isoWeekYear",1),ue("G",se),ue("g",se),ue("GG",B,z),ue("gg",B,z),ue("GGGG",ee,q),ue("gggg",ee,q),ue("GGGGG",te,J),ue("ggggg",te,J),fe(["gggg","ggggg","GGGG","GGGGG"],function(e,t,n,s){t[s.substr(0,2)]=D(e)}),fe(["gg","GG"],function(e,t,n,s){t[s]=c.parseTwoDigitYear(e)}),I("Q",0,"Qo","quarter"),C("quarter","Q"),F("quarter",7),ue("Q",Z),ce("Q",function(e,t){t[_e]=3*(D(e)-1)}),I("D",["DD",2],"Do","date"),C("date","D"),F("date",9),ue("D",B),ue("DD",B,z),ue("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),ce(["D","DD"],ye),ce("Do",function(e,t){t[ye]=D(e.match(B)[0])});var un=Te("Date",!0);I("DDD",["DDDD",3],"DDDo","dayOfYear"),C("dayOfYear","DDD"),F("dayOfYear",4),ue("DDD",K),ue("DDDD",$),ce(["DDD","DDDD"],function(e,t,n){n._dayOfYear=D(e)}),I("m",["mm",2],0,"minute"),C("minute","m"),F("minute",14),ue("m",B),ue("mm",B,z),ce(["m","mm"],ve);var ln=Te("Minutes",!1);I("s",["ss",2],0,"second"),C("second","s"),F("second",15),ue("s",B),ue("ss",B,z),ce(["s","ss"],pe);var hn,dn=Te("Seconds",!1);for(I("S",0,0,function(){return~~(this.millisecond()/100)}),I(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),I(0,["SSS",3],0,"millisecond"),I(0,["SSSS",4],0,function(){return 10*this.millisecond()}),I(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),I(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),I(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),I(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),I(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),C("millisecond","ms"),F("millisecond",16),ue("S",K,Z),ue("SS",K,z),ue("SSS",K,$),hn="SSSS";hn.length<=9;hn+="S")ue(hn,ne);function cn(e,t){t[we]=D(1e3*("0."+e))}for(hn="S";hn.length<=9;hn+="S")ce(hn,cn);var fn=Te("Milliseconds",!1);I("z",0,0,"zoneAbbr"),I("zz",0,0,"zoneName");var mn=M.prototype;function _n(e){return e}mn.add=Jt,mn.calendar=function(e,t){var n=e||bt(),s=Gt(n,this).startOf("day"),i=c.calendarFormat(this,s)||"sameElse",r=t&&(b(t[i])?t[i].call(this,n):t[i]);return this.format(r||this.localeData().calendar(i,this,bt(n)))},mn.clone=function(){return new M(this)},mn.diff=function(e,t,n){var s,i,r;if(!this.isValid())return NaN;if(!(s=Gt(e,this)).isValid())return NaN;switch(i=6e4*(s.utcOffset()-this.utcOffset()),t=H(t)){case"year":r=Qt(this,s)/12;break;case"month":r=Qt(this,s);break;case"quarter":r=Qt(this,s)/3;break;case"second":r=(this-s)/1e3;break;case"minute":r=(this-s)/6e4;break;case"hour":r=(this-s)/36e5;break;case"day":r=(this-s-i)/864e5;break;case"week":r=(this-s-i)/6048e5;break;default:r=this-s}return n?r:S(r)},mn.endOf=function(e){var t;if(void 0===(e=H(e))||"millisecond"===e||!this.isValid())return this;var n=this._isUTC?rn:sn;switch(e){case"year":t=n(this.year()+1,0,1)-1;break;case"quarter":t=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=n(this.year(),this.month()+1,1)-1;break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=36e5-nn(t+(this._isUTC?0:6e4*this.utcOffset()),36e5)-1;break;case"minute":t=this._d.valueOf(),t+=6e4-nn(t,6e4)-1;break;case"second":t=this._d.valueOf(),t+=1e3-nn(t,1e3)-1;break}return this._d.setTime(t),c.updateOffset(this,!0),this},mn.format=function(e){e||(e=this.isUtc()?c.defaultFormatUtc:c.defaultFormat);var t=A(this,e);return this.localeData().postformat(t)},mn.from=function(e,t){return this.isValid()&&(k(e)&&e.isValid()||bt(e).isValid())?jt({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},mn.fromNow=function(e){return this.from(bt(),e)},mn.to=function(e,t){return this.isValid()&&(k(e)&&e.isValid()||bt(e).isValid())?jt({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},mn.toNow=function(e){return this.to(bt(),e)},mn.get=function(e){return b(this[e=H(e)])?this[e]():this},mn.invalidAt=function(){return g(this).overflow},mn.isAfter=function(e,t){var n=k(e)?e:bt(e);return!(!this.isValid()||!n.isValid())&&("millisecond"===(t=H(t)||"millisecond")?this.valueOf()>n.valueOf():n.valueOf()<this.clone().startOf(t).valueOf())},mn.isBefore=function(e,t){var n=k(e)?e:bt(e);return!(!this.isValid()||!n.isValid())&&("millisecond"===(t=H(t)||"millisecond")?this.valueOf()<n.valueOf():this.clone().endOf(t).valueOf()<n.valueOf())},mn.isBetween=function(e,t,n,s){var i=k(e)?e:bt(e),r=k(t)?t:bt(t);return!!(this.isValid()&&i.isValid()&&r.isValid())&&("("===(s=s||"()")[0]?this.isAfter(i,n):!this.isBefore(i,n))&&(")"===s[1]?this.isBefore(r,n):!this.isAfter(r,n))},mn.isSame=function(e,t){var n,s=k(e)?e:bt(e);return!(!this.isValid()||!s.isValid())&&("millisecond"===(t=H(t)||"millisecond")?this.valueOf()===s.valueOf():(n=s.valueOf(),this.clone().startOf(t).valueOf()<=n&&n<=this.clone().endOf(t).valueOf()))},mn.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)},mn.isSameOrBefore=function(e,t){return this.isSame(e,t)||this.isBefore(e,t)},mn.isValid=function(){return v(this)},mn.lang=Kt,mn.locale=Xt,mn.localeData=en,mn.max=Pt,mn.min=xt,mn.parsingFlags=function(){return _({},g(this))},mn.set=function(e,t){if("object"==typeof e)for(var n=function(e){var t=[];for(var n in e)t.push({unit:n,priority:U[n]});return t.sort(function(e,t){return e.priority-t.priority}),t}(e=R(e)),s=0;s<n.length;s++)this[n[s].unit](e[n[s].unit]);else if(b(this[e=H(e)]))return this[e](t);return this},mn.startOf=function(e){var t;if(void 0===(e=H(e))||"millisecond"===e||!this.isValid())return this;var n=this._isUTC?rn:sn;switch(e){case"year":t=n(this.year(),0,1);break;case"quarter":t=n(this.year(),this.month()-this.month()%3,1);break;case"month":t=n(this.year(),this.month(),1);break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=n(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=nn(t+(this._isUTC?0:6e4*this.utcOffset()),36e5);break;case"minute":t=this._d.valueOf(),t-=nn(t,6e4);break;case"second":t=this._d.valueOf(),t-=nn(t,1e3);break}return this._d.setTime(t),c.updateOffset(this,!0),this},mn.subtract=Bt,mn.toArray=function(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]},mn.toObject=function(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}},mn.toDate=function(){return new Date(this.valueOf())},mn.toISOString=function(e){if(!this.isValid())return null;var t=!0!==e,n=t?this.clone().utc():this;return n.year()<0||9999<n.year()?A(n,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):b(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",A(n,"Z")):A(n,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")},mn.inspect=function(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e="moment",t="";this.isLocal()||(e=0===this.utcOffset()?"moment.utc":"moment.parseZone",t="Z");var n="["+e+'("]',s=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",i=t+'[")]';return this.format(n+s+"-MM-DD[T]HH:mm:ss.SSS"+i)},mn.toJSON=function(){return this.isValid()?this.toISOString():null},mn.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},mn.unix=function(){return Math.floor(this.valueOf()/1e3)},mn.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},mn.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},mn.year=Oe,mn.isLeapYear=function(){return De(this.year())},mn.weekYear=function(e){return on.call(this,e,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)},mn.isoWeekYear=function(e){return on.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)},mn.quarter=mn.quarters=function(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)},mn.month=Ue,mn.daysInMonth=function(){return Pe(this.year(),this.month())},mn.week=mn.weeks=function(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")},mn.isoWeek=mn.isoWeeks=function(e){var t=Ie(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")},mn.weeksInYear=function(){var e=this.localeData()._week;return Ae(this.year(),e.dow,e.doy)},mn.isoWeeksInYear=function(){return Ae(this.year(),1,4)},mn.date=un,mn.day=mn.days=function(e){if(!this.isValid())return null!=e?this:NaN;var t,n,s=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=e?(t=e,n=this.localeData(),e="string"!=typeof t?t:isNaN(t)?"number"==typeof(t=n.weekdaysParse(t))?t:null:parseInt(t,10),this.add(e-s,"d")):s},mn.weekday=function(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")},mn.isoWeekday=function(e){if(!this.isValid())return null!=e?this:NaN;if(null==e)return this.day()||7;var t,n,s=(t=e,n=this.localeData(),"string"==typeof t?n.weekdaysParse(t)%7||7:isNaN(t)?null:t);return this.day(this.day()%7?s:s-7)},mn.dayOfYear=function(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")},mn.hour=mn.hours=nt,mn.minute=mn.minutes=ln,mn.second=mn.seconds=dn,mn.millisecond=mn.milliseconds=fn,mn.utcOffset=function(e,t,n){var s,i=this._offset||0;if(!this.isValid())return null!=e?this:NaN;if(null==e)return this._isUTC?i:Vt(this);if("string"==typeof e){if(null===(e=Nt(re,e)))return this}else Math.abs(e)<16&&!n&&(e*=60);return!this._isUTC&&t&&(s=Vt(this)),this._offset=e,this._isUTC=!0,null!=s&&this.add(s,"m"),i!==e&&(!t||this._changeInProgress?qt(this,jt(e-i,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,c.updateOffset(this,!0),this._changeInProgress=null)),this},mn.utc=function(e){return this.utcOffset(0,e)},mn.local=function(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(Vt(this),"m")),this},mn.parseZone=function(){if(null!=this._tzm)this.utcOffset(this._tzm,!1,!0);else if("string"==typeof this._i){var e=Nt(ie,this._i);null!=e?this.utcOffset(e):this.utcOffset(0,!0)}return this},mn.hasAlignedHourOffset=function(e){return!!this.isValid()&&(e=e?bt(e).utcOffset():0,(this.utcOffset()-e)%60==0)},mn.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},mn.isLocal=function(){return!!this.isValid()&&!this._isUTC},mn.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},mn.isUtc=Et,mn.isUTC=Et,mn.zoneAbbr=function(){return this._isUTC?"UTC":""},mn.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},mn.dates=n("dates accessor is deprecated. Use date instead.",un),mn.months=n("months accessor is deprecated. Use month instead",Ue),mn.years=n("years accessor is deprecated. Use year instead",Oe),mn.zone=n("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}),mn.isDSTShifted=n("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!l(this._isDSTShifted))return this._isDSTShifted;var e={};if(w(e,this),(e=Ot(e))._a){var t=e._isUTC?y(e._a):bt(e._a);this._isDSTShifted=this.isValid()&&0<a(e._a,t.toArray())}else this._isDSTShifted=!1;return this._isDSTShifted});var yn=P.prototype;function gn(e,t,n,s){var i=ht(),r=y().set(s,t);return i[n](r,e)}function vn(e,t,n){if(h(e)&&(t=e,e=void 0),e=e||"",null!=t)return gn(e,t,n,"month");var s,i=[];for(s=0;s<12;s++)i[s]=gn(e,s,n,"month");return i}function pn(e,t,n,s){t=("boolean"==typeof e?h(t)&&(n=t,t=void 0):(t=e,e=!1,h(n=t)&&(n=t,t=void 0)),t||"");var i,r=ht(),a=e?r._week.dow:0;if(null!=n)return gn(t,(n+a)%7,s,"day");var o=[];for(i=0;i<7;i++)o[i]=gn(t,(i+a)%7,s,"day");return o}yn.calendar=function(e,t,n){var s=this._calendar[e]||this._calendar.sameElse;return b(s)?s.call(t,n):s},yn.longDateFormat=function(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.replace(/MMMM|MM|DD|dddd/g,function(e){return e.slice(1)}),this._longDateFormat[e])},yn.invalidDate=function(){return this._invalidDate},yn.ordinal=function(e){return this._ordinal.replace("%d",e)},yn.preparse=_n,yn.postformat=_n,yn.relativeTime=function(e,t,n,s){var i=this._relativeTime[n];return b(i)?i(e,t,n,s):i.replace(/%d/i,e)},yn.pastFuture=function(e,t){var n=this._relativeTime[0<e?"future":"past"];return b(n)?n(t):n.replace(/%s/i,t)},yn.set=function(e){var t,n;for(n in e)b(t=e[n])?this[n]=t:this["_"+n]=t;this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},yn.months=function(e,t){return e?o(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||We).test(t)?"format":"standalone"][e.month()]:o(this._months)?this._months:this._months.standalone},yn.monthsShort=function(e,t){return e?o(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[We.test(t)?"format":"standalone"][e.month()]:o(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},yn.monthsParse=function(e,t,n){var s,i,r;if(this._monthsParseExact)return function(e,t,n){var s,i,r,a=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],s=0;s<12;++s)r=y([2e3,s]),this._shortMonthsParse[s]=this.monthsShort(r,"").toLocaleLowerCase(),this._longMonthsParse[s]=this.months(r,"").toLocaleLowerCase();return n?"MMM"===t?-1!==(i=Ye.call(this._shortMonthsParse,a))?i:null:-1!==(i=Ye.call(this._longMonthsParse,a))?i:null:"MMM"===t?-1!==(i=Ye.call(this._shortMonthsParse,a))?i:-1!==(i=Ye.call(this._longMonthsParse,a))?i:null:-1!==(i=Ye.call(this._longMonthsParse,a))?i:-1!==(i=Ye.call(this._shortMonthsParse,a))?i:null}.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),s=0;s<12;s++){if(i=y([2e3,s]),n&&!this._longMonthsParse[s]&&(this._longMonthsParse[s]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[s]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[s]||(r="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[s]=new RegExp(r.replace(".",""),"i")),n&&"MMMM"===t&&this._longMonthsParse[s].test(e))return s;if(n&&"MMM"===t&&this._shortMonthsParse[s].test(e))return s;if(!n&&this._monthsParse[s].test(e))return s}},yn.monthsRegex=function(e){return this._monthsParseExact?(m(this,"_monthsRegex")||Ne.call(this),e?this._monthsStrictRegex:this._monthsRegex):(m(this,"_monthsRegex")||(this._monthsRegex=Le),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)},yn.monthsShortRegex=function(e){return this._monthsParseExact?(m(this,"_monthsRegex")||Ne.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(m(this,"_monthsShortRegex")||(this._monthsShortRegex=Fe),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)},yn.week=function(e){return Ie(e,this._week.dow,this._week.doy).week},yn.firstDayOfYear=function(){return this._week.doy},yn.firstDayOfWeek=function(){return this._week.dow},yn.weekdays=function(e,t){var n=o(this._weekdays)?this._weekdays:this._weekdays[e&&!0!==e&&this._weekdays.isFormat.test(t)?"format":"standalone"];return!0===e?je(n,this._week.dow):e?n[e.day()]:n},yn.weekdaysMin=function(e){return!0===e?je(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin},yn.weekdaysShort=function(e){return!0===e?je(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort},yn.weekdaysParse=function(e,t,n){var s,i,r;if(this._weekdaysParseExact)return function(e,t,n){var s,i,r,a=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],s=0;s<7;++s)r=y([2e3,1]).day(s),this._minWeekdaysParse[s]=this.weekdaysMin(r,"").toLocaleLowerCase(),this._shortWeekdaysParse[s]=this.weekdaysShort(r,"").toLocaleLowerCase(),this._weekdaysParse[s]=this.weekdays(r,"").toLocaleLowerCase();return n?"dddd"===t?-1!==(i=Ye.call(this._weekdaysParse,a))?i:null:"ddd"===t?-1!==(i=Ye.call(this._shortWeekdaysParse,a))?i:null:-1!==(i=Ye.call(this._minWeekdaysParse,a))?i:null:"dddd"===t?-1!==(i=Ye.call(this._weekdaysParse,a))?i:-1!==(i=Ye.call(this._shortWeekdaysParse,a))?i:-1!==(i=Ye.call(this._minWeekdaysParse,a))?i:null:"ddd"===t?-1!==(i=Ye.call(this._shortWeekdaysParse,a))?i:-1!==(i=Ye.call(this._weekdaysParse,a))?i:-1!==(i=Ye.call(this._minWeekdaysParse,a))?i:null:-1!==(i=Ye.call(this._minWeekdaysParse,a))?i:-1!==(i=Ye.call(this._weekdaysParse,a))?i:-1!==(i=Ye.call(this._shortWeekdaysParse,a))?i:null}.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),s=0;s<7;s++){if(i=y([2e3,1]).day(s),n&&!this._fullWeekdaysParse[s]&&(this._fullWeekdaysParse[s]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[s]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[s]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[s]||(r="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[s]=new RegExp(r.replace(".",""),"i")),n&&"dddd"===t&&this._fullWeekdaysParse[s].test(e))return s;if(n&&"ddd"===t&&this._shortWeekdaysParse[s].test(e))return s;if(n&&"dd"===t&&this._minWeekdaysParse[s].test(e))return s;if(!n&&this._weekdaysParse[s].test(e))return s}},yn.weekdaysRegex=function(e){return this._weekdaysParseExact?(m(this,"_weekdaysRegex")||Qe.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(m(this,"_weekdaysRegex")||(this._weekdaysRegex=qe),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)},yn.weekdaysShortRegex=function(e){return this._weekdaysParseExact?(m(this,"_weekdaysRegex")||Qe.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(m(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Je),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},yn.weekdaysMinRegex=function(e){return this._weekdaysParseExact?(m(this,"_weekdaysRegex")||Qe.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(m(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Be),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},yn.isPM=function(e){return"p"===(e+"").toLowerCase().charAt(0)},yn.meridiem=function(e,t,n){return 11<e?n?"pm":"PM":n?"am":"AM"},ut("en",{dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1===D(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")}}),c.lang=n("moment.lang is deprecated. Use moment.locale instead.",ut),c.langData=n("moment.langData is deprecated. Use moment.localeData instead.",ht);var wn=Math.abs;function Mn(e,t,n,s){var i=jt(t,n);return e._milliseconds+=s*i._milliseconds,e._days+=s*i._days,e._months+=s*i._months,e._bubble()}function kn(e){return e<0?Math.floor(e):Math.ceil(e)}function Sn(e){return 4800*e/146097}function Dn(e){return 146097*e/4800}function Yn(e){return function(){return this.as(e)}}var On=Yn("ms"),Tn=Yn("s"),bn=Yn("m"),xn=Yn("h"),Pn=Yn("d"),Wn=Yn("w"),Cn=Yn("M"),Hn=Yn("Q"),Rn=Yn("y");function Un(e){return function(){return this.isValid()?this._data[e]:NaN}}var Fn=Un("milliseconds"),Ln=Un("seconds"),Nn=Un("minutes"),Gn=Un("hours"),Vn=Un("days"),En=Un("months"),In=Un("years");var An=Math.round,jn={ss:44,s:45,m:45,h:22,d:26,M:11};var Zn=Math.abs;function zn(e){return(0<e)-(e<0)||+e}function $n(){if(!this.isValid())return this.localeData().invalidDate();var e,t,n=Zn(this._milliseconds)/1e3,s=Zn(this._days),i=Zn(this._months);t=S((e=S(n/60))/60),n%=60,e%=60;var r=S(i/12),a=i%=12,o=s,u=t,l=e,h=n?n.toFixed(3).replace(/\.?0+$/,""):"",d=this.asSeconds();if(!d)return"P0D";var c=d<0?"-":"",f=zn(this._months)!==zn(d)?"-":"",m=zn(this._days)!==zn(d)?"-":"",_=zn(this._milliseconds)!==zn(d)?"-":"";return c+"P"+(r?f+r+"Y":"")+(a?f+a+"M":"")+(o?m+o+"D":"")+(u||l||h?"T":"")+(u?_+u+"H":"")+(l?_+l+"M":"")+(h?_+h+"S":"")}var qn=Ht.prototype;return qn.isValid=function(){return this._isValid},qn.abs=function(){var e=this._data;return this._milliseconds=wn(this._milliseconds),this._days=wn(this._days),this._months=wn(this._months),e.milliseconds=wn(e.milliseconds),e.seconds=wn(e.seconds),e.minutes=wn(e.minutes),e.hours=wn(e.hours),e.months=wn(e.months),e.years=wn(e.years),this},qn.add=function(e,t){return Mn(this,e,t,1)},qn.subtract=function(e,t){return Mn(this,e,t,-1)},qn.as=function(e){if(!this.isValid())return NaN;var t,n,s=this._milliseconds;if("month"===(e=H(e))||"quarter"===e||"year"===e)switch(t=this._days+s/864e5,n=this._months+Sn(t),e){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(t=this._days+Math.round(Dn(this._months)),e){case"week":return t/7+s/6048e5;case"day":return t+s/864e5;case"hour":return 24*t+s/36e5;case"minute":return 1440*t+s/6e4;case"second":return 86400*t+s/1e3;case"millisecond":return Math.floor(864e5*t)+s;default:throw new Error("Unknown unit "+e)}},qn.asMilliseconds=On,qn.asSeconds=Tn,qn.asMinutes=bn,qn.asHours=xn,qn.asDays=Pn,qn.asWeeks=Wn,qn.asMonths=Cn,qn.asQuarters=Hn,qn.asYears=Rn,qn.valueOf=function(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*D(this._months/12):NaN},qn._bubble=function(){var e,t,n,s,i,r=this._milliseconds,a=this._days,o=this._months,u=this._data;return 0<=r&&0<=a&&0<=o||r<=0&&a<=0&&o<=0||(r+=864e5*kn(Dn(o)+a),o=a=0),u.milliseconds=r%1e3,e=S(r/1e3),u.seconds=e%60,t=S(e/60),u.minutes=t%60,n=S(t/60),u.hours=n%24,o+=i=S(Sn(a+=S(n/24))),a-=kn(Dn(i)),s=S(o/12),o%=12,u.days=a,u.months=o,u.years=s,this},qn.clone=function(){return jt(this)},qn.get=function(e){return e=H(e),this.isValid()?this[e+"s"]():NaN},qn.milliseconds=Fn,qn.seconds=Ln,qn.minutes=Nn,qn.hours=Gn,qn.days=Vn,qn.weeks=function(){return S(this.days()/7)},qn.months=En,qn.years=In,qn.humanize=function(e){if(!this.isValid())return this.localeData().invalidDate();var t,n,s,i,r,a,o,u,l,h,d,c=this.localeData(),f=(n=!e,s=c,i=jt(t=this).abs(),r=An(i.as("s")),a=An(i.as("m")),o=An(i.as("h")),u=An(i.as("d")),l=An(i.as("M")),h=An(i.as("y")),(d=r<=jn.ss&&["s",r]||r<jn.s&&["ss",r]||a<=1&&["m"]||a<jn.m&&["mm",a]||o<=1&&["h"]||o<jn.h&&["hh",o]||u<=1&&["d"]||u<jn.d&&["dd",u]||l<=1&&["M"]||l<jn.M&&["MM",l]||h<=1&&["y"]||["yy",h])[2]=n,d[3]=0<+t,d[4]=s,function(e,t,n,s,i){return i.relativeTime(t||1,!!n,e,s)}.apply(null,d));return e&&(f=c.pastFuture(+this,f)),c.postformat(f)},qn.toISOString=$n,qn.toString=$n,qn.toJSON=$n,qn.locale=Xt,qn.localeData=en,qn.toIsoString=n("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",$n),qn.lang=Kt,I("X",0,0,"unix"),I("x",0,0,"valueOf"),ue("x",se),ue("X",/[+-]?\d+(\.\d{1,3})?/),ce("X",function(e,t,n){n._d=new Date(1e3*parseFloat(e,10))}),ce("x",function(e,t,n){n._d=new Date(D(e))}),c.version="2.24.0",e=bt,c.fn=mn,c.min=function(){return Wt("isBefore",[].slice.call(arguments,0))},c.max=function(){return Wt("isAfter",[].slice.call(arguments,0))},c.now=function(){return Date.now?Date.now():+new Date},c.utc=y,c.unix=function(e){return bt(1e3*e)},c.months=function(e,t){return vn(e,t,"months")},c.isDate=d,c.locale=ut,c.invalid=p,c.duration=jt,c.isMoment=k,c.weekdays=function(e,t,n){return pn(e,t,n,"weekdays")},c.parseZone=function(){return bt.apply(null,arguments).parseZone()},c.localeData=ht,c.isDuration=Rt,c.monthsShort=function(e,t){return vn(e,t,"monthsShort")},c.weekdaysMin=function(e,t,n){return pn(e,t,n,"weekdaysMin")},c.defineLocale=lt,c.updateLocale=function(e,t){if(null!=t){var n,s,i=st;null!=(s=ot(e))&&(i=s._config),(n=new P(t=x(i,t))).parentLocale=it[e],it[e]=n,ut(e)}else null!=it[e]&&(null!=it[e].parentLocale?it[e]=it[e].parentLocale:null!=it[e]&&delete it[e]);return it[e]},c.locales=function(){return s(it)},c.weekdaysShort=function(e,t,n){return pn(e,t,n,"weekdaysShort")},c.normalizeUnits=H,c.relativeTimeRounding=function(e){return void 0===e?An:"function"==typeof e&&(An=e,!0)},c.relativeTimeThreshold=function(e,t){return void 0!==jn[e]&&(void 0===t?jn[e]:(jn[e]=t,"s"===e&&(jn.ss=t-1),!0))},c.calendarFormat=function(e,t){var n=e.diff(t,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"},c.prototype=mn,c.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},c});;
/*!
 * Toastify js 1.9.0
 * https://github.com/apvarun/toastify-js
 * @license MIT licensed
 *
 * Copyright (C) 2018 Varun A P
 */
(function(root, factory) {
  if (typeof module === "object" && module.exports) {
    module.exports = factory();
  } else {
    root.Toastify = factory();
  }
})(this, function(global) {
  // Object initialization
  var Toastify = function(options) {
      // Returning a new init object
      return new Toastify.lib.init(options);
    },
    // Library version
    version = "1.9.0";

  // Defining the prototype of the object
  Toastify.lib = Toastify.prototype = {
    toastify: version,

    constructor: Toastify,

    // Initializing the object with required parameters
    init: function(options) {
      // Verifying and validating the input object
      if (!options) {
        options = {};
      }

      // Creating the options object
      this.options = {};

      this.toastElement = null;

      // Validating the options
      this.options.text = options.text || "Hi there!"; // Display message
      this.options.node = options.node // Display content as node
      this.options.duration = options.duration === 0 ? 0 : options.duration || 3000; // Display duration
      this.options.selector = options.selector; // Parent selector
      this.options.callback = options.callback || function() {}; // Callback after display
      this.options.destination = options.destination; // On-click destination
      this.options.newWindow = options.newWindow || false; // Open destination in new window
      this.options.close = options.close || false; // Show toast close icon
      this.options.gravity = options.gravity === "bottom" ? "toastify-bottom" : "toastify-top"; // toast position - top or bottom
      this.options.positionLeft = options.positionLeft || false; // toast position - left or right
      this.options.position = options.position || ''; // toast position - left or right
      this.options.backgroundColor = options.backgroundColor; // toast background color
      this.options.avatar = options.avatar || ""; // img element src - url or a path
      this.options.className = options.className || ""; // additional class names for the toast
      this.options.stopOnFocus = options.stopOnFocus === undefined? true: options.stopOnFocus; // stop timeout on focus
      this.options.onClick = options.onClick; // Callback after click

      const normalOffset = { x: 0, y: 0 };

      this.options.offset = options.offset || normalOffset // toast offset

      // Returning the current object for chaining functions
      return this;
    },

    // Building the DOM element
    buildToast: function() {
      // Validating if the options are defined
      if (!this.options) {
        throw "Toastify is not initialized";
      }

      // Creating the DOM object
      var divElement = document.createElement("div");
      divElement.className = "toastify on " + this.options.className;

      // Positioning toast to left or right or center
      if (!!this.options.position) {
        divElement.className += " toastify-" + this.options.position;
      } else {
        // To be depreciated in further versions
        if (this.options.positionLeft === true) {
          divElement.className += " toastify-left";
          console.warn('Property `positionLeft` will be depreciated in further versions. Please use `position` instead.')
        } else {
          // Default position
          divElement.className += " toastify-right";
        }
      }

      // Assigning gravity of element
      divElement.className += " " + this.options.gravity;

      if (this.options.backgroundColor) {
        divElement.style.background = this.options.backgroundColor;
      }

      // Adding the toast message/node
      if (this.options.node && this.options.node.nodeType === Node.ELEMENT_NODE) {
        // If we have a valid node, we insert it
        divElement.appendChild(this.options.node)
      } else {
        divElement.innerHTML = this.options.text;

        if (this.options.avatar !== "") {
          var avatarElement = document.createElement("img");
          avatarElement.src = this.options.avatar;

          avatarElement.className = "toastify-avatar";

          if (this.options.position == "left" || this.options.positionLeft === true) {
            // Adding close icon on the left of content
            divElement.appendChild(avatarElement);
          } else {
            // Adding close icon on the right of content
            divElement.insertAdjacentElement("beforeend", avatarElement);
          }
        }
      }

      // Adding a close icon to the toast
      if (this.options.close === true) {
        // Create a span for close element
        var closeElement = document.createElement("span");
        closeElement.innerHTML = "&#10006;";

        closeElement.className = "toast-close";

        // Triggering the removal of toast from DOM on close click
        closeElement.addEventListener(
          "click",
          function(event) {
            event.stopPropagation();
            this.removeElement(this.toastElement);
            window.clearTimeout(this.toastElement.timeOutValue);
          }.bind(this)
        );

        //Calculating screen width
        var width = window.innerWidth > 0 ? window.innerWidth : screen.width;

        // Adding the close icon to the toast element
        // Display on the right if screen width is less than or equal to 360px
        if ((this.options.position == "left" || this.options.positionLeft === true) && width > 360) {
          // Adding close icon on the left of content
          divElement.insertAdjacentElement("afterbegin", closeElement);
        } else {
          // Adding close icon on the right of content
          divElement.appendChild(closeElement);
        }
      }

      // Clear timeout while toast is focused
      if (this.options.stopOnFocus && this.options.duration > 0) {
        const self = this;
        // stop countdown
        divElement.addEventListener(
          "mouseover",
          function(event) {
            window.clearTimeout(divElement.timeOutValue);
          }
        )
        // add back the timeout
        divElement.addEventListener(
          "mouseleave",
          function() {
            divElement.timeOutValue = window.setTimeout(
              function() {
                // Remove the toast from DOM
                self.removeElement(divElement);
              },
              self.options.duration
            )
          }
        )
      }
      
      // Adding an on-click destination path
      if (typeof this.options.destination !== "undefined") {
        divElement.addEventListener(
          "click",
          function(event) {
            event.stopPropagation();
            if (this.options.newWindow === true) {
              window.open(this.options.destination, "_blank");
            } else {
              window.location = this.options.destination;
            }
          }.bind(this)
        );
      }

      if (typeof this.options.onClick === "function" && typeof this.options.destination === "undefined") {
        divElement.addEventListener(
          "click",
          function(event) {
            event.stopPropagation();
            this.options.onClick();            
          }.bind(this)
        );
      }

      // Adding offset
      if(typeof this.options.offset === "object") {

        var x = getAxisOffsetAValue("x", this.options);
        var y = getAxisOffsetAValue("y", this.options);
        
        const xOffset = this.options.position == "left" ? x : `-${x}`;
        const yOffset = this.options.gravity == "toastify-top" ? y : `-${y}`;

        divElement.style.transform = `translate(${xOffset}, ${yOffset})`;

      }

      // Returning the generated element
      return divElement;
    },

    // Displaying the toast
    showToast: function() {
      // Creating the DOM object for the toast
      this.toastElement = this.buildToast();

      // Getting the root element to with the toast needs to be added
      var rootElement;
      if (typeof this.options.selector === "undefined") {
        rootElement = document.body;
      } else {
        rootElement = document.getElementById(this.options.selector);
      }

      // Validating if root element is present in DOM
      if (!rootElement) {
        throw "Root element is not defined";
      }

      // Adding the DOM element
      rootElement.insertBefore(this.toastElement, rootElement.firstChild);

      // Repositioning the toasts in case multiple toasts are present
      Toastify.reposition();

      if (this.options.duration > 0) {
        this.toastElement.timeOutValue = window.setTimeout(
          function() {
            // Remove the toast from DOM
            this.removeElement(this.toastElement);
          }.bind(this),
          this.options.duration
        ); // Binding `this` for function invocation
      }

      // Supporting function chaining
      return this;
    },

    hideToast: function() {
      if (this.toastElement.timeOutValue) {
        clearTimeout(this.toastElement.timeOutValue);
      }
      this.removeElement(this.toastElement);
    },

    // Removing the element from the DOM
    removeElement: function(toastElement) {
      // Hiding the element
      // toastElement.classList.remove("on");
      toastElement.className = toastElement.className.replace(" on", "");

      // Removing the element from DOM after transition end
      window.setTimeout(
        function() {
          // remove options node if any
          if (this.options.node && this.options.node.parentNode) {
            this.options.node.parentNode.removeChild(this.options.node);
          }

          // Remove the elemenf from the DOM, only when the parent node was not removed before.
          if (toastElement.parentNode) {
            toastElement.parentNode.removeChild(toastElement);
          }

          // Calling the callback function
          this.options.callback.call(toastElement);

          // Repositioning the toasts again
          Toastify.reposition();
        }.bind(this),
        400
      ); // Binding `this` for function invocation
    },
  };

  // Positioning the toasts on the DOM
  Toastify.reposition = function() {

    // Top margins with gravity
    var topLeftOffsetSize = {
      top: 15,
      bottom: 15,
    };
    var topRightOffsetSize = {
      top: 15,
      bottom: 15,
    };
    var offsetSize = {
      top: 15,
      bottom: 15,
    };

    // Get all toast messages on the DOM
    var allToasts = document.getElementsByClassName("toastify");

    var classUsed;

    // Modifying the position of each toast element
    for (var i = 0; i < allToasts.length; i++) {
      // Getting the applied gravity
      if (containsClass(allToasts[i], "toastify-top") === true) {
        classUsed = "toastify-top";
      } else {
        classUsed = "toastify-bottom";
      }

      var height = allToasts[i].offsetHeight;
      classUsed = classUsed.substr(9, classUsed.length-1)
      // Spacing between toasts
      var offset = 15;

      var width = window.innerWidth > 0 ? window.innerWidth : screen.width;

      // Show toast in center if screen with less than or qual to 360px
      if (width <= 360) {
        // Setting the position
        allToasts[i].style[classUsed] = offsetSize[classUsed] + "px";

        offsetSize[classUsed] += height + offset;
      } else {
        if (containsClass(allToasts[i], "toastify-left") === true) {
          // Setting the position
          allToasts[i].style[classUsed] = topLeftOffsetSize[classUsed] + "px";

          topLeftOffsetSize[classUsed] += height + offset;
        } else {
          // Setting the position
          allToasts[i].style[classUsed] = topRightOffsetSize[classUsed] + "px";

          topRightOffsetSize[classUsed] += height + offset;
        }
      }
    }

    // Supporting function chaining
    return this;
  };

  // Helper function to get offset.
  function getAxisOffsetAValue(axis, options) {

    if(options.offset[axis]) {
      if(isNaN(options.offset[axis])) {
        return options.offset[axis];
      }
      else {
        return options.offset[axis] + 'px';
      }
    }

    return '0px';

  }

  function containsClass(elem, yourClass) {
    if (!elem || typeof yourClass !== "string") {
      return false;
    } else if (
      elem.className &&
      elem.className
        .trim()
        .split(/\s+/gi)
        .indexOf(yourClass) > -1
    ) {
      return true;
    } else {
      return false;
    }
  }

  // Setting up the prototype for the init object
  Toastify.lib.init.prototype = Toastify.lib;

  // Returning the Toastify function to be assigned to the window object/module
  return Toastify;
});
;
/*! lazysizes - v5.2.2 */

!function(e){var t=function(u,D,f){"use strict";var k,H;if(function(){var e;var t={lazyClass:"lazyload",loadedClass:"lazyloaded",loadingClass:"lazyloading",preloadClass:"lazypreload",errorClass:"lazyerror",autosizesClass:"lazyautosizes",fastLoadedClass:"ls-is-cached",iframeLoadMode:0,srcAttr:"data-src",srcsetAttr:"data-srcset",sizesAttr:"data-sizes",minSize:40,customMedia:{},init:true,expFactor:1.5,hFac:.8,loadMode:2,loadHidden:true,ricTimeout:0,throttleDelay:125};H=u.lazySizesConfig||u.lazysizesConfig||{};for(e in t){if(!(e in H)){H[e]=t[e]}}}(),!D||!D.getElementsByClassName){return{init:function(){},cfg:H,noSupport:true}}var O=D.documentElement,i=u.HTMLPictureElement,P="addEventListener",$="getAttribute",q=u[P].bind(u),I=u.setTimeout,U=u.requestAnimationFrame||I,o=u.requestIdleCallback,j=/^picture$/i,r=["load","error","lazyincluded","_lazyloaded"],a={},G=Array.prototype.forEach,J=function(e,t){if(!a[t]){a[t]=new RegExp("(\\s|^)"+t+"(\\s|$)")}return a[t].test(e[$]("class")||"")&&a[t]},K=function(e,t){if(!J(e,t)){e.setAttribute("class",(e[$]("class")||"").trim()+" "+t)}},Q=function(e,t){var a;if(a=J(e,t)){e.setAttribute("class",(e[$]("class")||"").replace(a," "))}},V=function(t,a,e){var i=e?P:"removeEventListener";if(e){V(t,a)}r.forEach(function(e){t[i](e,a)})},X=function(e,t,a,i,r){var n=D.createEvent("Event");if(!a){a={}}a.instance=k;n.initEvent(t,!i,!r);n.detail=a;e.dispatchEvent(n);return n},Y=function(e,t){var a;if(!i&&(a=u.picturefill||H.pf)){if(t&&t.src&&!e[$]("srcset")){e.setAttribute("srcset",t.src)}a({reevaluate:true,elements:[e]})}else if(t&&t.src){e.src=t.src}},Z=function(e,t){return(getComputedStyle(e,null)||{})[t]},s=function(e,t,a){a=a||e.offsetWidth;while(a<H.minSize&&t&&!e._lazysizesWidth){a=t.offsetWidth;t=t.parentNode}return a},ee=function(){var a,i;var t=[];var r=[];var n=t;var s=function(){var e=n;n=t.length?r:t;a=true;i=false;while(e.length){e.shift()()}a=false};var e=function(e,t){if(a&&!t){e.apply(this,arguments)}else{n.push(e);if(!i){i=true;(D.hidden?I:U)(s)}}};e._lsFlush=s;return e}(),te=function(a,e){return e?function(){ee(a)}:function(){var e=this;var t=arguments;ee(function(){a.apply(e,t)})}},ae=function(e){var a;var i=0;var r=H.throttleDelay;var n=H.ricTimeout;var t=function(){a=false;i=f.now();e()};var s=o&&n>49?function(){o(t,{timeout:n});if(n!==H.ricTimeout){n=H.ricTimeout}}:te(function(){I(t)},true);return function(e){var t;if(e=e===true){n=33}if(a){return}a=true;t=r-(f.now()-i);if(t<0){t=0}if(e||t<9){s()}else{I(s,t)}}},ie=function(e){var t,a;var i=99;var r=function(){t=null;e()};var n=function(){var e=f.now()-a;if(e<i){I(n,i-e)}else{(o||r)(r)}};return function(){a=f.now();if(!t){t=I(n,i)}}},e=function(){var v,m,c,h,e;var y,z,g,p,C,b,A;var n=/^img$/i;var d=/^iframe$/i;var E="onscroll"in u&&!/(gle|ing)bot/.test(navigator.userAgent);var _=0;var w=0;var M=0;var N=-1;var L=function(e){M--;if(!e||M<0||!e.target){M=0}};var x=function(e){if(A==null){A=Z(D.body,"visibility")=="hidden"}return A||!(Z(e.parentNode,"visibility")=="hidden"&&Z(e,"visibility")=="hidden")};var W=function(e,t){var a;var i=e;var r=x(e);g-=t;b+=t;p-=t;C+=t;while(r&&(i=i.offsetParent)&&i!=D.body&&i!=O){r=(Z(i,"opacity")||1)>0;if(r&&Z(i,"overflow")!="visible"){a=i.getBoundingClientRect();r=C>a.left&&p<a.right&&b>a.top-1&&g<a.bottom+1}}return r};var t=function(){var e,t,a,i,r,n,s,o,l,u,f,c;var d=k.elements;if((h=H.loadMode)&&M<8&&(e=d.length)){t=0;N++;for(;t<e;t++){if(!d[t]||d[t]._lazyRace){continue}if(!E||k.prematureUnveil&&k.prematureUnveil(d[t])){R(d[t]);continue}if(!(o=d[t][$]("data-expand"))||!(n=o*1)){n=w}if(!u){u=!H.expand||H.expand<1?O.clientHeight>500&&O.clientWidth>500?500:370:H.expand;k._defEx=u;f=u*H.expFactor;c=H.hFac;A=null;if(w<f&&M<1&&N>2&&h>2&&!D.hidden){w=f;N=0}else if(h>1&&N>1&&M<6){w=u}else{w=_}}if(l!==n){y=innerWidth+n*c;z=innerHeight+n;s=n*-1;l=n}a=d[t].getBoundingClientRect();if((b=a.bottom)>=s&&(g=a.top)<=z&&(C=a.right)>=s*c&&(p=a.left)<=y&&(b||C||p||g)&&(H.loadHidden||x(d[t]))&&(m&&M<3&&!o&&(h<3||N<4)||W(d[t],n))){R(d[t]);r=true;if(M>9){break}}else if(!r&&m&&!i&&M<4&&N<4&&h>2&&(v[0]||H.preloadAfterLoad)&&(v[0]||!o&&(b||C||p||g||d[t][$](H.sizesAttr)!="auto"))){i=v[0]||d[t]}}if(i&&!r){R(i)}}};var a=ae(t);var S=function(e){var t=e.target;if(t._lazyCache){delete t._lazyCache;return}L(e);K(t,H.loadedClass);Q(t,H.loadingClass);V(t,B);X(t,"lazyloaded")};var i=te(S);var B=function(e){i({target:e.target})};var T=function(e,t){var a=e.getAttribute("data-load-mode")||H.iframeLoadMode;if(a==0){e.contentWindow.location.replace(t)}else if(a==1){e.src=t}};var F=function(e){var t;var a=e[$](H.srcsetAttr);if(t=H.customMedia[e[$]("data-media")||e[$]("media")]){e.setAttribute("media",t)}if(a){e.setAttribute("srcset",a)}};var s=te(function(t,e,a,i,r){var n,s,o,l,u,f;if(!(u=X(t,"lazybeforeunveil",e)).defaultPrevented){if(i){if(a){K(t,H.autosizesClass)}else{t.setAttribute("sizes",i)}}s=t[$](H.srcsetAttr);n=t[$](H.srcAttr);if(r){o=t.parentNode;l=o&&j.test(o.nodeName||"")}f=e.firesLoad||"src"in t&&(s||n||l);u={target:t};K(t,H.loadingClass);if(f){clearTimeout(c);c=I(L,2500);V(t,B,true)}if(l){G.call(o.getElementsByTagName("source"),F)}if(s){t.setAttribute("srcset",s)}else if(n&&!l){if(d.test(t.nodeName)){T(t,n)}else{t.src=n}}if(r&&(s||l)){Y(t,{src:n})}}if(t._lazyRace){delete t._lazyRace}Q(t,H.lazyClass);ee(function(){var e=t.complete&&t.naturalWidth>1;if(!f||e){if(e){K(t,H.fastLoadedClass)}S(u);t._lazyCache=true;I(function(){if("_lazyCache"in t){delete t._lazyCache}},9)}if(t.loading=="lazy"){M--}},true)});var R=function(e){if(e._lazyRace){return}var t;var a=n.test(e.nodeName);var i=a&&(e[$](H.sizesAttr)||e[$]("sizes"));var r=i=="auto";if((r||!m)&&a&&(e[$]("src")||e.srcset)&&!e.complete&&!J(e,H.errorClass)&&J(e,H.lazyClass)){return}t=X(e,"lazyunveilread").detail;if(r){re.updateElem(e,true,e.offsetWidth)}e._lazyRace=true;M++;s(e,t,r,i,a)};var r=ie(function(){H.loadMode=3;a()});var o=function(){if(H.loadMode==3){H.loadMode=2}r()};var l=function(){if(m){return}if(f.now()-e<999){I(l,999);return}m=true;H.loadMode=3;a();q("scroll",o,true)};return{_:function(){e=f.now();k.elements=D.getElementsByClassName(H.lazyClass);v=D.getElementsByClassName(H.lazyClass+" "+H.preloadClass);q("scroll",a,true);q("resize",a,true);q("pageshow",function(e){if(e.persisted){var t=D.querySelectorAll("."+H.loadingClass);if(t.length&&t.forEach){U(function(){t.forEach(function(e){if(e.complete){R(e)}})})}}});if(u.MutationObserver){new MutationObserver(a).observe(O,{childList:true,subtree:true,attributes:true})}else{O[P]("DOMNodeInserted",a,true);O[P]("DOMAttrModified",a,true);setInterval(a,999)}q("hashchange",a,true);["focus","mouseover","click","load","transitionend","animationend"].forEach(function(e){D[P](e,a,true)});if(/d$|^c/.test(D.readyState)){l()}else{q("load",l);D[P]("DOMContentLoaded",a);I(l,2e4)}if(k.elements.length){t();ee._lsFlush()}else{a()}},checkElems:a,unveil:R,_aLSL:o}}(),re=function(){var a;var n=te(function(e,t,a,i){var r,n,s;e._lazysizesWidth=i;i+="px";e.setAttribute("sizes",i);if(j.test(t.nodeName||"")){r=t.getElementsByTagName("source");for(n=0,s=r.length;n<s;n++){r[n].setAttribute("sizes",i)}}if(!a.detail.dataAttr){Y(e,a.detail)}});var i=function(e,t,a){var i;var r=e.parentNode;if(r){a=s(e,r,a);i=X(e,"lazybeforesizes",{width:a,dataAttr:!!t});if(!i.defaultPrevented){a=i.detail.width;if(a&&a!==e._lazysizesWidth){n(e,r,i,a)}}}};var e=function(){var e;var t=a.length;if(t){e=0;for(;e<t;e++){i(a[e])}}};var t=ie(e);return{_:function(){a=D.getElementsByClassName(H.autosizesClass);q("resize",t)},checkElems:t,updateElem:i}}(),t=function(){if(!t.i&&D.getElementsByClassName){t.i=true;re._();e._()}};return I(function(){H.init&&t()}),k={cfg:H,autoSizer:re,loader:e,init:t,uP:Y,aC:K,rC:Q,hC:J,fire:X,gW:s,rAF:ee}}(e,e.document,Date);e.lazySizes=t,"object"==typeof module&&module.exports&&(module.exports=t)}("undefined"!=typeof window?window:{});;
