/*!
 * JavaScript Cookie v2.2.0
 * https://github.com/js-cookie/js-cookie
 *
 * Copyright 2006, 2015 Klaus Hartl & Fagner Brack
 * Released under the MIT license
 */
;(function (factory) {
	var registeredInModuleLoader = false;
	if (typeof define === 'function' && define.amd) {
		define(factory);
		registeredInModuleLoader = true;
	}
	if (typeof exports === 'object') {
		module.exports = factory();
		registeredInModuleLoader = true;
	}
	if (!registeredInModuleLoader) {
		var OldCookies = window.Cookies;
		var api = window.Cookies = factory();
		api.noConflict = function () {
			window.Cookies = OldCookies;
			return api;
		};
	}
}(function () {
	function extend () {
		var i = 0;
		var result = {};
		for (; i < arguments.length; i++) {
			var attributes = arguments[ i ];
			for (var key in attributes) {
				result[key] = attributes[key];
			}
		}
		return result;
	}

	function init (converter) {
		function api (key, value, attributes) {
			var result;
			if (typeof document === 'undefined') {
				return;
			}

			// Write

			if (arguments.length > 1) {
				attributes = extend({
					path: '/'
				}, api.defaults, attributes);

				if (typeof attributes.expires === 'number') {
					var expires = new Date();
					expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5);
					attributes.expires = expires;
				}

				// We're using "expires" because "max-age" is not supported by IE
				attributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';

				try {
					result = JSON.stringify(value);
					if (/^[\{\[]/.test(result)) {
						value = result;
					}
				} catch (e) {}

				if (!converter.write) {
					value = encodeURIComponent(String(value))
						.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
				} else {
					value = converter.write(value, key);
				}

				key = encodeURIComponent(String(key));
				key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);
				key = key.replace(/[\(\)]/g, escape);

				var stringifiedAttributes = '';

				for (var attributeName in attributes) {
					if (!attributes[attributeName]) {
						continue;
					}
					stringifiedAttributes += '; ' + attributeName;
					if (attributes[attributeName] === true) {
						continue;
					}
					stringifiedAttributes += '=' + attributes[attributeName];
				}
				return (document.cookie = key + '=' + value + stringifiedAttributes);
			}

			// Read

			if (!key) {
				result = {};
			}

			// To prevent the for loop in the first place assign an empty array
			// in case there are no cookies at all. Also prevents odd result when
			// calling "get()"
			var cookies = document.cookie ? document.cookie.split('; ') : [];
			var rdecode = /(%[0-9A-Z]{2})+/g;
			var i = 0;

			for (; i < cookies.length; i++) {
				var parts = cookies[i].split('=');
				var cookie = parts.slice(1).join('=');

				if (!this.json && cookie.charAt(0) === '"') {
					cookie = cookie.slice(1, -1);
				}

				try {
					var name = parts[0].replace(rdecode, decodeURIComponent);
					cookie = converter.read ?
						converter.read(cookie, name) : converter(cookie, name) ||
						cookie.replace(rdecode, decodeURIComponent);

					if (this.json) {
						try {
							cookie = JSON.parse(cookie);
						} catch (e) {}
					}

					if (key === name) {
						result = cookie;
						break;
					}

					if (!key) {
						result[name] = cookie;
					}
				} catch (e) {}
			}

			return result;
		}

		api.set = api;
		api.get = function (key) {
			return api.call(api, key);
		};
		api.getJSON = function () {
			return api.apply({
				json: true
			}, [].slice.call(arguments));
		};
		api.defaults = {};

		api.remove = function (key, attributes) {
			api(key, '', extend(attributes, {
				expires: -1
			}));
		};

		api.withConverter = init;

		return api;
	}

	return init(function () {});
}));
(function() {
  $(function() {
    if (Cookies.get('cookiebar') === void 0) {
      return $('#btn-cookie').click(function(e) {
        e.preventDefault();
        $('#cookie').hide();
        $('.fixed-bottom').animate({
          bottom: 0
        }, 100);
        return Cookies.set('cookiebar', 'clicked', {
          expires: 30 * 13
        });
      });
    } else {
      return $('#cookie').hide();
    }
  });

}).call(this);
if (typeof String.prototype.includes !== 'function') {
  String.prototype.includes = function (str) {
    var returnValue = false;

    if (this.indexOf(str) !== -1) {
      returnValue = true;
    }

    return returnValue;
  }
};
(function(global) {
  /**
   * Polyfill URLSearchParams
   *
   * Inspired from : https://github.com/WebReflection/url-search-params/blob/master/src/url-search-params.js
   */

  var checkIfIteratorIsSupported = function() {
    try {
      return !!Symbol.iterator;
    } catch (error) {
      return false;
    }
  };


  var iteratorSupported = checkIfIteratorIsSupported();

  var createIterator = function(items) {
    var iterator = {
      next: function() {
        var value = items.shift();
        return { done: value === void 0, value: value };
      }
    };

    if (iteratorSupported) {
      iterator[Symbol.iterator] = function() {
        return iterator;
      };
    }

    return iterator;
  };

  /**
   * Search param name and values shold be encoded according to https://url.spec.whatwg.org/#urlencoded-serializing
   * encodeURIComponent() produces the same result except encoding spaces as `%20` instead of `+`.
   */
  var serializeParam = function(value) {
    return encodeURIComponent(value).replace(/%20/g, '+');
  };

  var deserializeParam = function(value) {
    return decodeURIComponent(String(value).replace(/\+/g, ' '));
  };

  var polyfillURLSearchParams = function() {

    var URLSearchParams = function(searchString) {
      Object.defineProperty(this, '_entries', { writable: true, value: {} });
      var typeofSearchString = typeof searchString;

      if (typeofSearchString === 'undefined') {
        // do nothing
      } else if (typeofSearchString === 'string') {
        if (searchString !== '') {
          this._fromString(searchString);
        }
      } else if (searchString instanceof URLSearchParams) {
        var _this = this;
        searchString.forEach(function(value, name) {
          _this.append(name, value);
        });
      } else if ((searchString !== null) && (typeofSearchString === 'object')) {
        if (Object.prototype.toString.call(searchString) === '[object Array]') {
          for (var i = 0; i < searchString.length; i++) {
            var entry = searchString[i];
            if ((Object.prototype.toString.call(entry) === '[object Array]') || (entry.length !== 2)) {
              this.append(entry[0], entry[1]);
            } else {
              throw new TypeError('Expected [string, any] as entry at index ' + i + ' of URLSearchParams\'s input');
            }
          }
        } else {
          for (var key in searchString) {
            if (searchString.hasOwnProperty(key)) {
              this.append(key, searchString[key]);
            }
          }
        }
      } else {
        throw new TypeError('Unsupported input\'s type for URLSearchParams');
      }
    };

    var proto = URLSearchParams.prototype;

    proto.append = function(name, value) {
      if (name in this._entries) {
        this._entries[name].push(String(value));
      } else {
        this._entries[name] = [String(value)];
      }
    };

    proto.delete = function(name) {
      delete this._entries[name];
    };

    proto.get = function(name) {
      return (name in this._entries) ? this._entries[name][0] : null;
    };

    proto.getAll = function(name) {
      return (name in this._entries) ? this._entries[name].slice(0) : [];
    };

    proto.has = function(name) {
      return (name in this._entries);
    };

    proto.set = function(name, value) {
      this._entries[name] = [String(value)];
    };

    proto.forEach = function(callback, thisArg) {
      var entries;
      for (var name in this._entries) {
        if (this._entries.hasOwnProperty(name)) {
          entries = this._entries[name];
          for (var i = 0; i < entries.length; i++) {
            callback.call(thisArg, entries[i], name, this);
          }
        }
      }
    };

    proto.keys = function() {
      var items = [];
      this.forEach(function(value, name) {
        items.push(name);
      });
      return createIterator(items);
    };

    proto.values = function() {
      var items = [];
      this.forEach(function(value) {
        items.push(value);
      });
      return createIterator(items);
    };

    proto.entries = function() {
      var items = [];
      this.forEach(function(value, name) {
        items.push([name, value]);
      });
      return createIterator(items);
    };

    if (iteratorSupported) {
      proto[Symbol.iterator] = proto.entries;
    }

    proto.toString = function() {
      var searchArray = [];
      this.forEach(function(value, name) {
        searchArray.push(serializeParam(name) + '=' + serializeParam(value));
      });
      return searchArray.join('&');
    };


    global.URLSearchParams = URLSearchParams;
  };

  var checkIfURLSearchParamsSupported = function() {
    try {
      var URLSearchParams = global.URLSearchParams;

      return (
        (new URLSearchParams('?a=1').toString() === 'a=1') &&
        (typeof URLSearchParams.prototype.set === 'function') &&
        (typeof URLSearchParams.prototype.entries === 'function')
      );
    } catch (e) {
      return false;
    }
  };

  if (!checkIfURLSearchParamsSupported()) {
    polyfillURLSearchParams();
  }

  var proto = global.URLSearchParams.prototype;

  if (typeof proto.sort !== 'function') {
    proto.sort = function() {
      var _this = this;
      var items = [];
      this.forEach(function(value, name) {
        items.push([name, value]);
        if (!_this._entries) {
          _this.delete(name);
        }
      });
      items.sort(function(a, b) {
        if (a[0] < b[0]) {
          return -1;
        } else if (a[0] > b[0]) {
          return +1;
        } else {
          return 0;
        }
      });
      if (_this._entries) { // force reset because IE keeps keys index
        _this._entries = {};
      }
      for (var i = 0; i < items.length; i++) {
        this.append(items[i][0], items[i][1]);
      }
    };
  }

  if (typeof proto._fromString !== 'function') {
    Object.defineProperty(proto, '_fromString', {
      enumerable: false,
      configurable: false,
      writable: false,
      value: function(searchString) {
        if (this._entries) {
          this._entries = {};
        } else {
          var keys = [];
          this.forEach(function(value, name) {
            keys.push(name);
          });
          for (var i = 0; i < keys.length; i++) {
            this.delete(keys[i]);
          }
        }

        searchString = searchString.replace(/^\?/, '');
        var attributes = searchString.split('&');
        var attribute;
        for (var i = 0; i < attributes.length; i++) {
          attribute = attributes[i].split('=');
          this.append(
            deserializeParam(attribute[0]),
            (attribute.length > 1) ? deserializeParam(attribute[1]) : ''
          );
        }
      }
    });
  }

  // HTMLAnchorElement

})(
  (typeof global !== 'undefined') ? global
    : ((typeof window !== 'undefined') ? window
    : ((typeof self !== 'undefined') ? self : this))
);

(function(global) {
  /**
   * Polyfill URL
   *
   * Inspired from : https://github.com/arv/DOM-URL-Polyfill/blob/master/src/url.js
   */

  var checkIfURLIsSupported = function() {
    try {
      var u = new global.URL('b', 'http://a');
      u.pathname = 'c d';
      return (u.href === 'http://a/c%20d') && u.searchParams;
    } catch (e) {
      return false;
    }
  };


  var polyfillURL = function() {
    var _URL = global.URL;

    var URL = function(url, base) {
      if (typeof url !== 'string') url = String(url);
      if (base && typeof base !== 'string') base = String(base);

      // Only create another document if the base is different from current location.
      var doc = document, baseElement;
      if (base && (global.location === void 0 || base !== global.location.href)) {
        base = base.toLowerCase();
        doc = document.implementation.createHTMLDocument('');
        baseElement = doc.createElement('base');
        baseElement.href = base;
        doc.head.appendChild(baseElement);
        try {
          if (baseElement.href.indexOf(base) !== 0) throw new Error(baseElement.href);
        } catch (err) {
          throw new Error('URL unable to set base ' + base + ' due to ' + err);
        }
      }

      var anchorElement = doc.createElement('a');
      anchorElement.href = url;
      if (baseElement) {
        doc.body.appendChild(anchorElement);
        anchorElement.href = anchorElement.href; // force href to refresh
      }

      var inputElement = doc.createElement('input');
      inputElement.type = 'url';
      inputElement.value = url;

      if (anchorElement.protocol === ':' || !/:/.test(anchorElement.href) || (!inputElement.checkValidity() && !base)) {
        throw new TypeError('Invalid URL');
      }

      Object.defineProperty(this, '_anchorElement', {
        value: anchorElement
      });


      // create a linked searchParams which reflect its changes on URL
      var searchParams = new global.URLSearchParams(this.search);
      var enableSearchUpdate = true;
      var enableSearchParamsUpdate = true;
      var _this = this;
      ['append', 'delete', 'set'].forEach(function(methodName) {
        var method = searchParams[methodName];
        searchParams[methodName] = function() {
          method.apply(searchParams, arguments);
          if (enableSearchUpdate) {
            enableSearchParamsUpdate = false;
            _this.search = searchParams.toString();
            enableSearchParamsUpdate = true;
          }
        };
      });

      Object.defineProperty(this, 'searchParams', {
        value: searchParams,
        enumerable: true
      });

      var search = void 0;
      Object.defineProperty(this, '_updateSearchParams', {
        enumerable: false,
        configurable: false,
        writable: false,
        value: function() {
          if (this.search !== search) {
            search = this.search;
            if (enableSearchParamsUpdate) {
              enableSearchUpdate = false;
              this.searchParams._fromString(this.search);
              enableSearchUpdate = true;
            }
          }
        }
      });
    };

    var proto = URL.prototype;

    var linkURLWithAnchorAttribute = function(attributeName) {
      Object.defineProperty(proto, attributeName, {
        get: function() {
          return this._anchorElement[attributeName];
        },
        set: function(value) {
          this._anchorElement[attributeName] = value;
        },
        enumerable: true
      });
    };

    ['hash', 'host', 'hostname', 'port', 'protocol']
      .forEach(function(attributeName) {
        linkURLWithAnchorAttribute(attributeName);
      });

    Object.defineProperty(proto, 'search', {
      get: function() {
        return this._anchorElement['search'];
      },
      set: function(value) {
        this._anchorElement['search'] = value;
        this._updateSearchParams();
      },
      enumerable: true
    });

    Object.defineProperties(proto, {

      'toString': {
        get: function() {
          var _this = this;
          return function() {
            return _this.href;
          };
        }
      },

      'href': {
        get: function() {
          return this._anchorElement.href.replace(/\?$/, '');
        },
        set: function(value) {
          this._anchorElement.href = value;
          this._updateSearchParams();
        },
        enumerable: true
      },

      'pathname': {
        get: function() {
          return this._anchorElement.pathname.replace(/(^\/?)/, '/');
        },
        set: function(value) {
          this._anchorElement.pathname = value;
        },
        enumerable: true
      },

      'origin': {
        get: function() {
          // get expected port from protocol
          var expectedPort = { 'http:': 80, 'https:': 443, 'ftp:': 21 }[this._anchorElement.protocol];
          // add port to origin if, expected port is different than actual port
          // and it is not empty f.e http://foo:8080
          // 8080 != 80 && 8080 != ''
          var addPortToOrigin = this._anchorElement.port != expectedPort &&
            this._anchorElement.port !== '';

          return this._anchorElement.protocol +
            '//' +
            this._anchorElement.hostname +
            (addPortToOrigin ? (':' + this._anchorElement.port) : '');
        },
        enumerable: true
      },

      'password': { // TODO
        get: function() {
          return '';
        },
        set: function(value) {
        },
        enumerable: true
      },

      'username': { // TODO
        get: function() {
          return '';
        },
        set: function(value) {
        },
        enumerable: true
      },
    });

    URL.createObjectURL = function(blob) {
      return _URL.createObjectURL.apply(_URL, arguments);
    };

    URL.revokeObjectURL = function(url) {
      return _URL.revokeObjectURL.apply(_URL, arguments);
    };

    global.URL = URL;

  };

  if (!checkIfURLIsSupported()) {
    polyfillURL();
  }

  if ((global.location !== void 0) && !('origin' in global.location)) {
    var getOrigin = function() {
      return global.location.protocol + '//' + global.location.hostname + (global.location.port ? (':' + global.location.port) : '');
    };

    try {
      Object.defineProperty(global.location, 'origin', {
        get: getOrigin,
        enumerable: true
      });
    } catch (e) {
      setInterval(function() {
        global.location.origin = getOrigin();
      }, 100);
    }
  }

})(
  (typeof global !== 'undefined') ? global
    : ((typeof window !== 'undefined') ? window
    : ((typeof self !== 'undefined') ? self : this))
);
(function() {
  this.submitValidation = function(scroll, lookup_base, remodal) {
    var $field_error, valid;
    if (scroll == null) {
      scroll = true;
    }
    if (lookup_base == null) {
      lookup_base = $('body');
    }
    if (remodal == null) {
      remodal = false;
    }
    valid = true;
    if ($('#resume-input').val() !== void 0 && !$('#resume-input').data('is-optional')) {
      widgetDropdownValidation();
    }
    if (lookup_base.find('.field.error').length > 0) {
      valid = false;
      $field_error = lookup_base.find('.field.error:first');
      if (scroll) {
        $('body').scrollTo($field_error, '500', {
          offset: $('.header').height() * -1
        });
      }
    }
    if (remodal && valid) {
      if (lookup_base.find('#replace').length > 0 && $('[data-remodal-id=confirm_replace_cv]').length > 0) {
        $('[data-remodal-id=confirm_replace_cv]').remodal().open();
        return false;
      } else {
        return true;
      }
    } else {
      formSubmitFailure(valid, $('#post-apply-register'));
      formSubmitFailure(valid, $('#user-registration'));
      formSubmitFailure(valid, $('#signup_and_apply_form'));
      formSubmitFailure(valid, $('#new_registration_form'));
      return valid;
    }
  };

  this.displayError = function(elem, message) {
    if (message == null) {
      message = I18n.t('js.field_error');
    }
    elem.parent().removeClass('valid').addClass('error');
    if ($('.btn-validation').length > 0) {
      $('.btn-validation').removeClass('btn-primary');
    }
    if ($('.error-validation-info').length > 0) {
      displayErrorInfo(elem, message);
    } else {
      if (elem.parent().find('#error-message').length === 0) {
        elem.parent().append("<span id='error-message' class='small-font red block'>" + message + "</span>");
      }
      if (message && elem.parent().find('#error-message').length > 0) {
        elem.parent().find('#error-message').text(message);
      }
    }
    return false;
  };

  this.displayErrorMutliParent = function(elem, message) {
    if (message == null) {
      message = I18n.t('js.field_error');
    }
    elem.parent().parent().removeClass('valid').addClass('error');
    if (elem.parent().parent().find('#error-message').length === 0) {
      elem.parent().parent().append("<span id='error-message' class='small-font red block'>" + message + "</span>");
    }
    if (message && elem.parent().parent().find('#error-message').length > 0) {
      elem.parent().parent().find('#error-message').text(message);
    }
    return false;
  };

  this.displayValideMultiParent = function(elem) {
    elem.parent().parent().removeClass('error').addClass('valid');
    elem.parent().parent().find('#error-message').remove();
    return true;
  };

  this.displayValide = function(elem) {
    elem.parent().removeClass('error').addClass('valid');
    if ($('.error-validation-info').length > 0) {
      this.displayValideInfo(elem);
    } else {
      elem.parent().find('#error-message').remove();
    }
    if ($('.btn-validation').length > 0) {
      $('.btn-validation').addClass('btn-primary');
    }
    return true;
  };

  this.formSubmitFailure = function(valid, ele) {
    if (ele.length > 0) {
      if (!valid) {
        return window.dataLayer.push({
          "event": "registrationSubmitFailure"
        });
      }
    }
  };

}).call(this);
(function() {
  this.selectDisable = function(elem, message) {
    var $select;
    $select = $(elem).find('select');
    $(elem).css({
      'position': 'relative'
    });
    if ($select.val() === null) {
      $(elem).append("<span class='placeholder'>" + message + "</span>");
      return $select.prop('disabled', 'disabled');
    }
  };

  this.selectValidation = function(select) {
    if (select.val() !== null && select.val() !== "") {
      return displayValide(select);
    } else {
      return displayError(select);
    }
  };

  this.isTnJoinElem = function(elem) {
    if ($('.talentnetwork-new-member-form').length > 0 && elem.length > 0) {
      return true;
    } else {
      return false;
    }
  };

  this.isTnPhoneRevalidation = function(countryCode, phoneElem) {
    if (isPhone(countryCode, phoneElem.val())) {
      return displayValide(phoneElem);
    } else {
      return displayError(phoneElem, I18n.t('js.phone_error', {
        country_name: countryCode
      }));
    }
  };

  this.multipleSelectValidation = function(select) {
    if (select.val().length === 1 && select.val()[0] === "") {
      return displayError(select);
    } else {
      return displayValide(select);
    }
  };

  this.isEmail = function(email) {
    var regex;
    if ($('#talentnetwork-new-member').length) {
      return isTnJoinEmail(email);
    } else {
      regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
      return regex.test(email);
    }
  };

  this.isPositiveNumnber = function(number) {
    if (number.val() < 0) {
      return displayError(number, I18n.t('js.invalid_number'));
    } else {
      return displayValide(number);
    }
  };

  this.isTnJoinEmail = function(email) {
    var tn_join_regex;
    tn_join_regex = /^[-a-zA-Z0-9~!$%^&_=+#}{\'?]+(\.[-a-zA-Z0-9~!$%^&=+#}{\'?]+)*@[-A-Za-z0-9\'+]+([.][-A-Za-z0-9_\'+]+)*[.][A-Za-z]{2,}$/;
    return tn_join_regex.test(email);
  };

  this.isEmailValidation = function(email) {
    if (isEmail(email.val()) || (email.val() === '' && email.attr('skip_empty_validation') === 'true')) {
      return displayValide(email);
    } else {
      return displayError(email, I18n.t('js.email_error'));
    }
  };

  this.datesValidation = function(startDate, endDate, isChecked) {
    if ((new Date(formatDateSlashed(endDate)) < new Date(formatDateSlashed(startDate))) && !isChecked) {
      return displayError(endDate, I18n.t('js.end_date_error'));
    } else {
      return displayValide(endDate);
    }
  };

  this.dateIsNotValid = function(input) {
    var date_regex, date_str, new_date_regex;
    date_regex = /^\d{2}\/\d{4}$/;
    new_date_regex = /^(0[1-9]|1[0-2])\/\d{4}$/;
    date_str = input.val();
    if (date_str.length === 0) {
      return false;
    }
    if (!new_date_regex.test(date_str)) {
      displayError(input, I18n.t('js.date_field_error_msg'));
      return true;
    } else {
      return false;
    }
  };

  this.isPhone = function(countryCode, phone) {
    var $validPhoneNumberPattern, PLUS_CHARS_, STAR_SIGN_, VALID_DIGITS_, VALID_PUNCTUATION;
    PLUS_CHARS_ = '+';
    VALID_PUNCTUATION = '-x ().\\[\\]/~';
    STAR_SIGN_ = '*';
    VALID_DIGITS_ = '0-9';
    $validPhoneNumberPattern;
    $validPhoneNumberPattern = new RegExp('^[' + PLUS_CHARS_ + ']*(?:[' + VALID_PUNCTUATION + STAR_SIGN_ + ']*[' + VALID_DIGITS_ + ']){3,}[' + VALID_PUNCTUATION + STAR_SIGN_ + VALID_DIGITS_ + ']*$');
    switch (countryCode) {
      case 'US':
        $validPhoneNumberPattern = /^[\+]*[1]?[-\s\.]?\(?[([0-9]{3}]?\)?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4}$/;
        break;
      default:
        $validPhoneNumberPattern;
    }
    return $validPhoneNumberPattern.test(phone);
  };

  this.isPhoneValidation = function(phone) {
    var $country_code, phoneFieldTxt, validNumber;
    phoneFieldTxt = phone.val();
    if (phoneFieldTxt !== void 0) {
      validNumber = phoneFieldTxt.replace(/[^0-9-+. ()]/gi, '');
      phone.val(validNumber);
      if (isTnJoinElem($('[country_bindable="true"].required'))) {
        phone.attr('country_code', $('[country_bindable="true"].required').val());
      }
      if (isPhone(phone.attr('country_code'), validNumber)) {
        return displayValide(phone);
      } else {
        $country_code = phone.attr('country_code') !== "" || phone.attr('country_code') !== void 0 ? phone.attr('country_code').toUpperCase() : '';
        return displayError(phone, I18n.t('js.phone_error', {
          country_name: $country_code
        }));
      }
    }
  };

  this.isntPresent = function(input) {
    return input.val() === void 0 || input.val() === null;
  };

  this.isEmpty = function(input) {
    return isntPresent(input) || input.val().trim() === "";
  };

  this.isEmptyMultiParent = function(input) {
    return $(input).parent().hasClass('has-items');
  };

  this.isEmptyValidation = function(input) {
    if (isEmpty(input)) {
      return displayError(input);
    } else {
      return displayValide(input);
    }
  };

  this.isNoValidation = function(input) {
    if (isEmpty(input)) {
      return displayValide(input);
    }
  };

  this.isTooLongValidation = function(input, size, message) {
    if (input.val().length > size) {
      return displayError(input, message);
    } else {
      return displayValide(input);
    }
  };

  this.isTooLongAndEmptyValidation = function(input, size, message) {
    if (input.length > 0 && input.val() !== "" && input.val().length <= size) {
      return displayValide(input);
    } else {
      if (input.length > 0 && input.val().length > size) {
        return displayError(input, message);
      } else {
        if (input.length > 0) {
          return displayError(input);
        }
      }
    }
  };

  this.twoDatesValidation = function() {
    return $('.two_dates_validation').each(function() {
      var $this, current_job, date_regex, end_date, end_date_month, first_date_array, last_date_array, max_allowed_date, min_allowed_date, new_date_regex, start_date, start_date_month;
      $this = $(this);
      date_regex = /^\d{2}\/\d{4}$/;
      new_date_regex = /^(0[1-9]|1[0-2])\/\d{4}$/;
      current_job = $this.find('.is_current_position').is(':checked');
      if ((new_date_regex.test($this.find('.date_end').val()) || current_job) && new_date_regex.test($this.find('.date_start').val())) {
        first_date_array = $this.find('.date_start').val().split('/');
        last_date_array = current_job ? ['01', '1965'] : $this.find('.date_end').val().split('/');
        first_date_array.splice(1, 0, '01');
        last_date_array.splice(1, 0, '01');
        start_date_month = moment(first_date_array.join('/')).format('MMMM YYYY');
        start_date = new Date(start_date_month).valueOf();
        end_date_month = moment(last_date_array.join('/')).format('MMMM YYYY');
        end_date = new Date(end_date_month).valueOf();
      } else if (date_regex.test($this.find('.date_end').val()) && date_regex.test($this.find('.date_start').val())) {
        start_date = new Date($this.find('.date_start').val().split('/')[1]).valueOf();
        end_date = new Date($this.find('.date_end').val().split('/')[1]).valueOf();
      } else if (isValidDate(formatDateSlashed($this.find('.date_start'))) && isValidDate(formatDateSlashed($this.find('.date_end')))) {
        start_date = new Date(formatDateSlashed($this.find('.date_start')));
        end_date = new Date(formatDateSlashed($this.find('.date_end')));
      } else {
        start_date = new Date($this.find('.date_start').next('input').val()).valueOf();
        end_date = new Date($this.find('.date_end').next('input').val()).valueOf();
      }
      min_allowed_date = new Date(1965, 1, 1).valueOf();
      max_allowed_date = new Date().valueOf();
      if (!isNaN(start_date)) {
        if (start_date < min_allowed_date) {
          displayError($this.find('.date_start'), I18n.t('js.min_date_error'));
        } else if (end_date > max_allowed_date) {
          displayError($this.find('.date_end'), I18n.t('js.max_date_error_msg'));
        } else if (start_date <= end_date || current_job) {
          displayValide($this.find('.date_start'));
        } else if (start_date > end_date) {
          displayError($this.find('.date_start'), I18n.t('js.date_error'));
        }
      }
      if (start_date !== '' && end_date !== '') {
        if (start_date < end_date || current_job) {
          return displayValide($this.find('.date_start'));
        } else if (end_date > max_allowed_date) {
          return displayError($this.find('.date_end'), I18n.t('js.date_field_error_msg'));
        }
      }
    });
  };

  this.datesInProcessing = function() {
    var results;
    results = [];
    $('.two_dates_validation').each(function() {
      var $this, end_date, start_date;
      $this = $(this);
      start_date = new Date($this.find('.date_start').next('input').val()).valueOf();
      end_date = new Date($this.find('.date_end').next('input').val()).valueOf();
      return results.push(start_date < end_date);
    });
    return results.includes(false);
  };

  this.isValidDate = function(dateString) {
    var parseDate;
    parseDate = new Date(dateString);
    return (parseDate instanceof Date && !isNaN(parseDate)) || false;
  };

  this.formatDateSlashed = function(date) {
    var formattedDate;
    if (date.attr('data-format') === 'dd/mm/yyyy') {
      formattedDate = moment(date.val(), 'DD/MM/YYYY').format('YYYY-MM-DD');
    } else if (date.attr('data-format') === 'mm/yyyy') {
      formattedDate = moment(date.val(), 'MM/YYYY').format('YYYY-MM-DD');
    } else {
      date.val();
    }
    return formattedDate;
  };

  this.isCheckedValidation = function(input) {
    if (!input.is(":checked")) {
      return displayError(input);
    } else {
      return displayValide(input);
    }
  };

  this.isMultipleCheckedValidation = function(input_name) {
    if ($("input[name*=" + input_name + "]").is(':checked')) {
      return displayValide($("input[name*=" + input_name + "]"));
    } else {
      return displayError($("input[name*=" + input_name + "]"));
    }
  };

  this.badValidationSubmit = function(input) {
    input.parent().addClass('error');
    return false;
  };

  this.setLabelForState = function(country, show_asterisk) {
    var container, text;
    if (show_asterisk == null) {
      show_asterisk = true;
    }
    container = '<span class="red">*</span>';
    text = I18n.t('js.state');
    if (!show_asterisk) {
      container = '';
    }
    if (country === 'GB') {
      text = I18n.t('js.county');
    }
    return $("label[for='state']").html(container + text);
  };

  this.updateStatesList = function(country, triggerStateChange) {
    if (triggerStateChange == null) {
      triggerStateChange = false;
    }
    return $.ajax({
      url: '/states/by_country/' + country.toLowerCase(),
      method: 'GET',
      dataType: 'json',
      error: function(xhr, status, error) {
        console.error('AJAX Error: ' + status + error);
      },
      success: function(response) {
        var i, original_state, states;
        states = response;
        original_state = $('#state').val();
        $('#state').val('');
        $('#state').empty();
        if (states.length === 0) {
          $("#state").parent().parent().addClass('dn-i');
          return $('#state-recap').empty();
        } else {
          $("#state").parent().parent().removeClass('dn-i');
          i = 0;
          while (i < states.length) {
            $('#state').append('<option value="' + states[i][1] + '"' + (states[i][1] === original_state ? ' selected' : '') + '>' + states[i][0] + '</option>');
            i++;
          }
          if (triggerStateChange) {
            $('#state').change();
          }
        }
      }
    });
  };

  this.toggleCity = function(country, triggerCityChange) {
    var original_city;
    if (triggerCityChange == null) {
      triggerCityChange = false;
    }
    if ($('[name="toggle_city"]').length) {
      original_city = $('#city').val();
      if (country === 'SG') {
        $('#city').val('Singapore');
        $("#city").parent().parent().addClass('dn-i');
      } else {
        if (original_city === 'Singapore') {
          $('#city').val('');
        } else {
          $('#city').val(original_city);
        }
        $("#city").parent().parent().removeClass('dn-i');
      }
      if ($('#city').is(':visible') && $("label[for='city']").find('span.red').length) {
        isEmptyValidation($('#city'));
      }
      if (triggerCityChange) {
        return $('#city').keyup();
      }
    }
  };

  $("#create_job_alert_modal").on('click', function() {
    $('[data-remodal-id=modal]').remodal().open();
    return $('.remodal-overlay, .remodal-wrapper').unbind('click.remodal');
  });

  $("#close_create_job,.create-job-close").on('click', function() {
    return $('[data-remodal-id=modal]').remodal().close();
  });

  $(window).bind('load', function() {
    var images;
    if ($("img").length > 0) {
      images = $('img:not([alt])');
      return $(images).each(function(image) {
        return $(this).attr('alt', ' ');
      });
    }
  });

  this.addProfileItem = function(id, item, text, url) {
    if (url == null) {
      url = "/myprofile/actions/add_resume_item";
    }
    $(id).html(I18n.t('js.spin_icon'));
    return $.ajax({
      url: url,
      type: 'GET',
      data: {
        item: item
      },
      success: function() {
        $(id).text(I18n.t(text));
        if ($('.profile-redesign').length > 0) {
          $(id).prepend('<i aria-hidden="true" class="plus-icon"></i>');
          return $(id).removeClass('space-spin');
        }
      }
    });
  };

  this.resetView = function(elemId) {
    return document.getElementById(elemId).reset();
  };

  this.profileExpUSCleaner = function(sectionClassName, identifierClassName, deleteBtnClassName) {
    return $(sectionClassName).each(function() {
      var deleteBtn, identifierName;
      identifierName = $(this).find(identifierClassName);
      deleteBtn = $(this).find(deleteBtnClassName);
      if (identifierName.val() === '') {
        return deleteBtn.trigger("click");
      }
    });
  };

  this.dateYearHasError = function(parentElem, yearPickerElem, mainContainer) {
    var hasError;
    hasError = false;
    $(yearPickerElem).each(function(i, obj) {
      var dateYear;
      dateYear = obj.value;
      if (!yearIsValid(dateYear)) {
        hasError = true;
        if ($(mainContainer).find("#error-" + obj.id).length === 0) {
          return parentElem.append("<span id='error-" + obj.id + "' class='small-font red block'>" + (I18n.t('js.date_year_error_msg')) + "</span>");
        }
      } else {
        return $("#error-" + obj.id).remove();
      }
    });
    return hasError;
  };

  this.displayErrorInfo = function(elem, message) {
    if (message == null) {
      message = I18n.t('js.field_error');
    }
    if (elem.parent().find('#error-message-' + elem[0].id).length === 0) {
      if (elem[0].id === 'resume-input') {
        elem.closest('.resume-upload').find('#upload_file').attr('aria-describedby', 'error-message-' + elem[0].id);
        elem.closest('.resume-upload').find('#upload-resume-icon').attr('aria-describedby', 'error-message-' + elem[0].id);
        elem.closest('.resume-upload').find('#upload-btn').attr('aria-describedby', 'error-message-' + elem[0].id);
      }
      elem.attr('aria-describedby', 'error-message-' + elem[0].id);
      if (elem[0].id === 'resume-input') {
        elem.append("<span id='error-message-" + elem[0].id + "' class='small-font red block'>" + message + "</span>");
      } else {
        elem.parent().append("<span id='error-message-" + elem[0].id + "' class='small-font red block'>" + message + "</span>");
      }
    }
    if (message && elem.parent().find('#error-message-' + elem[0].id).length > 0) {
      return elem.parent().find('#error-message-' + elem[0].id).text(message);
    }
  };

  this.displayValideInfo = function(elem) {
    elem.parent().find('.small-font.red').remove();
    return elem.removeAttr('aria-describedby');
  };

  $.prototype.disableFocus = function(flag, tabindex) {
    if (flag == null) {
      flag = true;
    }
    if (tabindex == null) {
      tabindex = '-1';
    }
    return this.each(function() {
      if ($(this).is('a')) {
        if (flag) {
          $(this).attr('tabindex', tabindex);
        } else {
          $(this).removeAttr('tabindex');
        }
      }
      if ($(this).is('input')) {
        if (flag) {
          $(this).attr('disabled', 'disabled');
        } else {
          $(this).removeAttr('disabled');
        }
      }
      if (!$(this).is('input') && !$(this).is('a') && tabindex !== '-1') {
        if (flag) {
          return $(this).attr('tabindex', tabindex);
        } else {
          return $(this).removeAttr('tabindex');
        }
      }
    });
  };

  this.yearIsValid = function(dateYear) {
    if (dateYear.length === 0) {
      return true;
    }
    if (dateYear.length > 4 || dateYear.length < 4 || isNaN(dateYear)) {
      return false;
    }
    if (new Date(dateYear, '1').getFullYear() > (new Date).getFullYear()) {
      return false;
    }
    return true;
  };

  this.maxDateExceeded = function(dateStr) {
    var date, new_date_regex;
    new_date_regex = /^(0[1-9]|1[0-2])\/\d{4}$/;
    if (dateStr.length === 0) {
      return false;
    }
    if (new_date_regex.test(dateStr) === false) {
      return false;
    }
    date = dateStr.split('/');
    if (new Date(date[1], date[0] - '1') > (new Date)) {
      return true;
    }
  };

  this.toggleClassBorder = function(currentElement) {
    var currentId;
    currentId = $(currentElement).text().split(" ").pop().replace(/(\r\n|\n|\r)/gm, "");
    $("." + currentId + "-edit-us").find("." + currentId + "-us").last().removeClass('border-bottom-edit-us').addClass('no-border');
    if ($("." + currentId + "-us").length < 1 && !($("." + currentId + "-edit-us").find('.btn-remove-me').parent('.remove-me-content').css('display') === 'block')) {
      return $("." + currentId + "-edit-us").find('.btn-add-another').addClass('no-left-space');
    }
  };

  this.toggleAddAnotherRemove = function(event, currentElement) {
    var currentSectionName, currentUsDataSection, parentUsDataSection, parentVar;
    parentVar = $(currentElement).parents('.resume-section-us');
    currentSectionName = $(parentVar).find('.btn-add-another').text().split(" ").pop().replace(/(\r\n|\n|\r)/gm, "");
    parentUsDataSection = $(currentElement).parents("." + currentSectionName + "-us").attr('data-section-id');
    currentUsDataSection = $(parentVar).find("." + currentSectionName + "-us:last").attr('data-section-id');
    if (currentUsDataSection === parentUsDataSection) {
      if (event.target.value) {
        return toggleAddAnotherSelfRemove($(parentVar).find('.btn-add-another'));
      } else {
        return toggleAddAnotherSelf($(parentVar).find('.btn-add-another'));
      }
    }
  };

  this.toggleAddAnotherSelf = function(currentElement) {
    $(currentElement).addClass('no-left-space');
    return $(currentElement).parent().addClass('mt20');
  };

  this.toggleAddAnotherSelfRemove = function(currentElement) {
    $(currentElement).removeClass('no-left-space');
    return $(currentElement).parent().removeClass('mt20');
  };

  this.toggleAddAnother = function(currentElement) {
    var parentVar;
    parentVar = $(currentElement).parent().parent();
    if ($(parentVar).find('.btn-remove-me:not(.btn-add-another)').length < 1 || $(parentVar).find('.btn-remove-me').parent('.remove-me-content').hasClass('dn')) {
      $(parentVar).find('.btn-add-another').addClass('no-left-space');
      $(parentVar).find('.btn-add-another').parent().addClass('mt20');
    }
    if ($(currentElement).is(":button")) {
      $(currentElement).removeClass('dn-i');
      if (!$(currentElement).find('i').hasClass('close-icon')) {
        $(currentElement).find('i').find('svg').remove();
        return $(currentElement).find('i').addClass('close-icon');
      } else {
        $(parentVar).find('.continue-btn').trigger("click");
        return $(currentElement).find('i').html(I18n.t('js.edit_icon')).removeClass('close-icon');
      }
    }
  };

  this.toggleCancelButton = function(currentElement) {
    return $(currentElement).parents('.border-top-radius').find('.edit-button i').html(I18n.t('js.edit_icon')).removeClass('close-icon');
  };

  this.slideAddAnotherButton = function(currentElement) {
    var currentParent, currentSectionName, parentWrapper;
    currentSectionName = $(currentElement).text().split(" ").pop().replace(/(\r\n|\n|\r)/gm, "");
    currentParent = $(currentElement).parents("." + currentSectionName + "-us");
    parentWrapper = currentParent.parent();
    if ($(parentWrapper).find("." + currentSectionName + "-us").length > 1) {
      if ($(currentParent).prev().find('.remove-me-content').hasClass('dn')) {
        return toggleAddAnotherSelf($("." + currentSectionName + "-edit-us").find('.btn-add-another'));
      }
    } else {
      if ($(parentWrapper).prev().find('.remove-me-content').hasClass('dn')) {
        return toggleAddAnotherSelf($("." + currentSectionName + "-edit-us").find('.btn-add-another'));
      }
    }
  };

  this.initDatePickerProfileUS_MM_YYYY = function(selector) {
    if (selector.length) {
      return selector.each(function() {
        var autoDate;
        autoDate = $(this).val() !== '' ? moment($(this).attr('data-value')).format('MM-DD-YYYY') : '';
        return $(this).datepicker({
          language: 'en',
          minDate: new Date(1965, 0, 1),
          maxDate: new Date(),
          minView: "months",
          view: "years",
          autoClose: true,
          dateFormat: $(this).attr('data-format'),
          hiddenSuffix: '',
          updateInput: true,
          toggleSelected: false,
          onSelect: function(formattedDate, date, inst) {
            twoDatesValidation();
            experienceSubmitValidationUS();
            return experienceSubmitValidationUSModal();
          }
        }).data('datepicker').selectDate(autoDate);
      });
    }
  };

  this.isKeyup = function(evtt) {
    return evtt.type === 'keyup';
  };

  this.eventsValidations = function(evtt, input, isValidFieldFunc, isSubmitAvailable) {
    if (evtt.type === 'keyup') {
      if ($(input).attr('type') === 'email' || $(input).attr('name') === 'email') {
        if (isEmail($(input).val())) {
          isValidFieldFunc($(input));
        }
      } else {
        isValidFieldFunc($(input));
      }
    }
    if (evtt.type === 'blur' || evtt.type === 'focusout' || evtt.type === 'change') {
      isValidFieldFunc($(input));
    }
    if ($.isFunction(isSubmitAvailable)) {
      return isSubmitAvailable();
    }
  };

  this.elementValidation = function(evtt, input, isValidFieldFunc) {
    if (evtt.type === 'keyup') {
      if (!isEmpty($(input))) {
        if ($(input).attr('type') === 'email' || $(input).attr('name') === 'email') {
          if (isEmail($(input).val())) {
            return isValidFieldFunc($(input));
          } else {
            return false;
          }
        } else {
          return isValidFieldFunc($(input));
        }
      } else {
        return false;
      }
    }
    if (evtt.type === 'blur' || evtt.type === 'focusout' || evtt.type === 'change') {
      return isValidFieldFunc($(input));
    }
  };

  this.enableDisableFormButton = function(id, buttonState) {
    return $(id).attr('disabled', buttonState);
  };

}).call(this);
(function() {
  this.isPasswordLight = function(input) {
    var $visual_validation, count, longer, message, regex, space_valid;
    count = 0;
    longer = false;
    $visual_validation = $('#password_validate');
    if (input.val().length >= 8 && input.val().length <= 15) {
      longer = true;
    } else if (input.val().length > 15) {
      message = I18n.t('js.max_char');
    }
    regex = /[A-Z]+/;
    if (regex.test(input.val())) {
      count++;
    }
    space_valid = false;
    regex = /^\S*$/;
    if (regex.test(input.val())) {
      space_valid = true;
    } else {
      space_valid = false;
      message = I18n.t('js.spaces');
    }
    regex = /[^\w\s]/;
    if (regex.test(input.val())) {
      $('#symbol-val').addClass('valid');
      count++;
    }
    if (count < 0) {
      count = 0;
    }
    if (longer && count >= 2 && space_valid) {
      $visual_validation.removeClass('bad ok strong').addClass('strong').text(I18n.t('js.strong'));
      return displayValide(input);
    } else if (longer && count >= 1 && space_valid) {
      $visual_validation.removeClass('bad ok strong').addClass('ok').text(I18n.t('js.__ok'));
      return displayError(input, message);
    } else {
      $visual_validation.removeClass('bad ok strong').addClass('bad').text(I18n.t('js._bad'));
      return displayError(input, message);
    }
  };

  this.isPassword = function(input) {
    var $visual_validation, count, longer, message, regex, valid;
    count = 0;
    longer = false;
    $visual_validation = $('#password_validate');
    if (input.val().length >= 8 && input.val().length <= 15) {
      $('#longer-val').addClass('valid');
      longer = true;
    } else if (input.val().length > 15) {
      message = I18n.t('js.max_char');
    } else {
      $('#longer-val').removeClass('valid');
    }
    regex = /[A-Z]+/;
    if (regex.test(input.val())) {
      $('#upper-val').addClass('valid');
      count++;
    } else {
      $('#upper-val').removeClass('valid');
    }
    regex = /[a-z]+/;
    if (regex.test(input.val())) {
      $('#lower-val').addClass('valid');
      count++;
    } else {
      $('#lower-val').removeClass('valid');
    }
    valid = false;
    regex = /^\S*$/;
    if (regex.test(input.val())) {
      valid = true;
    } else {
      valid = false;
      message = I18n.t('js.spaces');
    }
    regex = /[0-9]+/;
    if (regex.test(input.val())) {
      $('#number-val').addClass('valid');
      count++;
    } else {
      $('#number-val').removeClass('valid');
    }
    regex = /[^\w\s]/;
    if (regex.test(input.val())) {
      $('#symbol-val').addClass('valid');
      count++;
    } else {
      $('#symbol-val').removeClass('valid');
    }
    if (count < 0) {
      count = 0;
    }
    if (longer && count >= 4 && valid) {
      $visual_validation.removeClass('bad ok strong').addClass('strong').text(I18n.t('js.strong'));
      return displayValide(input);
    } else {
      $visual_validation.removeClass('bad ok strong').addClass('bad').text(I18n.t('js._bad'));
      return displayError(input, message);
    }
  };

  this.differentPassword = function(input, oldpassword) {
    if (input.val() === "") {
      return displayError(input);
    } else if (input.val() === oldpassword.val()) {
      return displayError(input, I18n.t('js.same_new_password'));
    } else {
      return isPassword(input);
    }
  };

  this.confirmPassword = function(input, password) {
    if (input.val() === password.val()) {
      displayValide(input);
    } else {
      displayError(input, I18n.t('js.confirm_password_different'));
    }
    if (input.val() === "") {
      return displayError(input);
    }
  };

  this.isPasswordValidation = function(password) {
    isPassword(password);
    if (password.is(":focus")) {
      $('#password_filter').fadeIn();
    }
    password.on("focus", function() {
      return $('#password_filter').fadeIn();
    });
    if (!password.parent().hasClass('password')) {
      return password.on("blur", function() {
        return $('#password_filter').fadeOut();
      });
    }
  };

  $(function() {
    return $(document).on('click', '#password-visibility', function() {
      var $passField;
      $passField = $(this).closest('.field').find('input');
      if ($passField.attr('type') === 'password') {
        $passField.attr('type', 'text');
        $(this).find('.vision-icon').toggleClass('dn-i');
        return $(this).find('.vision-off-icon').toggleClass('dn-i');
      } else {
        $passField.attr('type', 'password');
        $(this).find('.vision-icon').toggleClass('dn-i');
        return $(this).find('.vision-off-icon').toggleClass('dn-i');
      }
    });
  });

}).call(this);
(function() {
  this.removeUploadFile = function() {
    $('#upload_file').parent().parent().removeClass('valid error').addClass('widget-hidden');
    $('#upload_file').parent().find('span.text').text('Upload a file');
    $('#upload_file').val('');
    return $('#widget-btn').removeClass('widget-hidden');
  };

  this.removeCreateCV = function() {
    $('#create-cv').removeClass('valid error').addClass('widget-hidden');
    $('.collapse').find('.collapse-display-me').fadeOut();
    return $('#widget-btn').removeClass('widget-hidden');
  };

  this.removeDropbox = function() {
    $('#dropbox-text').html('Select from Dropbox');
    $('#dropbox_upload').parent().removeClass('valid error').addClass('widget-hidden');
    $('#dropbox_cv').val('');
    return $('#widget-btn').removeClass('widget-hidden');
  };

  this.removeGoogleDrive = function() {
    $('#google-drive-text').html('Select from Google Drive');
    $('#google_drive_upload').parent().removeClass('valid error').addClass('widget-hidden');
    $('#google_drive_file_id').val('');
    return $('#widget-btn').removeClass('widget-hidden');
  };

  this.removeAllWidget = function() {
    removeUploadFile();
    removeCreateCV();
    removeDropbox();
    removeGoogleDrive();
    $('.widget').removeClass('widget-hidden valid error');
    $('.widget-bloc').removeClass('valid error');
    $('.widget-bloc').parent().removeClass('valid error');
    $('.widget-bloc').parent().find('#error-message').remove();
    return $('#cv_file_name').val('');
  };

  this.resumeUploadValidation = function() {
    return $('.widget').each(function() {
      var $elem, $input, $text;
      $input = $(this).find('input');
      $text = $(this).find('span.text');
      $elem = $(this);
      return $input.on("change", function() {
        var $ext, $val;
        $val = $input.val().split('\\').pop();
        if ($input.val !== "") {
          $ext = getExtension($val).toLowerCase();
          if ($ext === 'pdf' || $ext === 'doc' || $ext === 'docx' || $ext === 'txt' || $ext === 'rtf') {
            $elem.removeClass("error").addClass("valid");
            $text.html($val);
            displayValide($('.widget-bloc'));
          } else {
            $elem.removeClass('valid').addClass("error");
            $text.html('We only accept file format of .doc, .docx, .pdf, .txt or .rtf');
            $input.val('');
            displayError($('.widget-bloc'));
          }
          if ($input.get(0).files[0].size / 1000 > SettingControlValues.ResumeMaxUploadFileSize) {
            $elem.removeClass('valid').addClass("error");
            $text.html('The file size is too big. (' + $input.get(0).files[0].size / 1000 + 'kb)');
            $input.val('');
            displayError($('.widget-bloc'));
          } else {
            $elem.removeClass("error").addClass("valid");
            $text.html($val);
            $('#cv_file_name').val($val);
            displayValide($('.widget-bloc'));
            dataLayer.push({
              "event": "data-gtm",
              "gtm_action": "resumev2-file-picker",
              "gtm_label": "native_file_upload"
            });
            true;
          }
          removeCreateCV();
          removeDropbox();
          return removeGoogleDrive();
        }
      });
    });
  };

  this.widgetValidation = function() {
    if (typeof $('#apply_resume').val() === 'undefined') {
      if ($('#cv_file_name').val() === "" && $('#new_cv').val() === "") {
        return displayError($('.widget-bloc'));
      } else {
        return displayValide($('.widget-bloc'));
      }
    }
  };

  this.widgetDropdownValidation = function() {
    if (isEmpty($('#cv_file_name')) && $('#ai_resume_builder').val() !== 'true') {
      $('#cv_file_name').val('');
      $('.fake-input').addClass('js-dropdown-trigger');
      $('.dropdown-trash-trigger.fa.fa-trash').removeClass('dropdown-trash-trigger fa-trash').addClass('fa-upload').attr('aria-label', I18n.t('js.upload_resume'));
      return displayError($('#resume-input'));
    }
  };

}).call(this);
(function() {
  this.auto_form_validation = function(required) {
    if (required.attr('type') === 'text' || required.attr('type') === 'password' || required.attr('type') === 'number') {
      if (required.attr('type') === 'password' && required.hasClass('required-new-password')) {
        return isPasswordValidation(required);
      } else if (required.attr('data-max') && required.attr('data-message')) {
        return isTooLongAndEmptyValidation(required, required.data('max'), required.data('message'));
      } else if (required.attr('input_use') === 'phone_num_field' && required.attr('country_code')) {
        return isPhoneValidation(required);
      } else {
        return isEmptyValidation(required);
      }
    } else if (required.attr('type') === 'email') {
      return isEmailValidation(required);
    } else if (required.prop('type') === 'select-one') {
      return selectValidation(required);
    } else if (required.prop('type') === 'select-multiple') {
      return multipleSelectValidation(required);
    } else if (required.attr('type') === 'checkbox') {
      return isCheckedValidation(required);
    } else if (required.attr('type') === 'radio') {
      return isMultipleCheckedValidation(required.attr('name'));
    }
  };

  this.init_auto_form_validation = function() {
    return $('form.form, form.form-material').each(function() {
      var $this, required;
      $this = $(this);
      if ($this.find('.required').length) {
        required = $this.find('.required');
        required.each(function() {
          return $(this).on("keyup blur change", function(e) {
            if ($.isFunction(eventsValidations)) {
              return eventsValidations(e, this, auto_form_validation, false);
            } else {
              return auto_form_validation($(this));
            }
          });
        });
        return $this.on("submit", function() {
          required.each(function() {
            auto_form_validation($(this));
            return true;
          });
          if ($this.hasClass('no-scroll')) {
            return submitValidation(false, $this);
          } else {
            return submitValidation(true, $this);
          }
        });
      }
    });
  };

  $(function() {
    return init_auto_form_validation();
  });

}).call(this);
(function() {
  this.stepValidate = function(step) {
    $("#step-by-step-button-" + step).removeClass('btn-disabled').addClass('btn-clear-blue').removeAttr('disabled');
    return $("#step-" + step).addClass('step-validate');
  };

  this.lastStepValidate = function() {
    $('#resume-form-submit-button').removeClass('btn-disabled').addClass('btn-linear-green').removeAttr('disabled');
    return $('#download-resume-builder').removeClass('dn-i');
  };

  this.stepValidateButtonTrigger = function(step) {
    return $("#step-by-step-button-" + step).click(function(e) {
      e.preventDefault();
      $("#step-" + step).removeClass('active').addClass('recap').find('.step-content').slideUp();
      $("#step-" + step).find('.step-content-recap').slideDown();
      setTimeout(function() {
        return $('html,body').animate({
          scrollTop: $("#step-" + (step + 1)).offset().top - 66
        }, 'slow');
      }, 500);
      $("#step-" + (step + 1)).addClass('active').removeClass('recap').find('.step-content').slideDown();
      $("#step-" + (step + 1)).find('.step-content-recap').slideUp();
      if (step === 3 && $('#resume_name').val() !== "" && (!isEmpty($('#password')) || isntPresent($('#password')))) {
        return lastStepValidate();
      } else if (step === 4 && (!isEmpty($('#password')) || isntPresent($('#password')))) {
        return lastStepValidate();
      } else {
        return lastStepNotValidate();
      }
    });
  };

  this.stepNotValidate = function(step) {
    $("#step-by-step-button-" + step).addClass('btn-disabled').removeClass('btn-clear-blue').attr('disabled', 'disabled');
    $('#download-resume-builder').addClass('dn-i');
    return $("#step-" + step).removeClass('step-validate');
  };

  this.lastStepNotValidate = function() {
    return $('#resume-form-submit-button').addClass('btn-disabled').removeClass('btn-linear-green').attr('disabled', 'disabled');
  };

  this.setMaxSection = function(word, number) {
    if ($("." + word).length >= number) {
      return $("#add-" + word).hide();
    } else {
      return $("#add-" + word).show();
    }
  };

  this.setMaxSectionAll = function() {
    setMaxSection('work_experience', 10);
    return setMaxSection('education', 5);
  };

  $(function() {
    $('.step-edit').click(function(e) {
      var $id, id;
      e.preventDefault();
      id = $(this).parent().attr('id').replace('step-', '');
      $id = $("#" + ($(this).parent().attr('id')));
      lastStepNotValidate();
      if (id === 3 && $('#resume_name').val() !== "" && (!isEmpty($('#password')) || isntPresent($('#password')))) {
        lastStepValidate();
      } else if (id === 4 && !$('.ai-skills-content').hasClass('active') && (!isEmpty($('#password')) || isntPresent($('#password')))) {
        lastStepValidate();
      } else {
        lastStepNotValidate();
      }
      $('.step-by-step.step-validate').addClass('recap');
      $('.step-by-step, #step-4').removeClass('active').find('.step-content').slideUp();
      $('.step-by-step.step-validate').find('.step-content-recap').slideDown();
      $id.removeClass('recap').addClass('active').find('.step-content').slideDown();
      return $id.find('.step-content-recap').slideUp(function() {
        return $('body').scrollTo($id, '500', {
          offset: -80
        });
      });
    });
    return $('.step-edit-preview').click(function(e) {
      e.preventDefault();
      $('#resume-upload-us h2').html('Build a Resume');
      $('#resume-upload-us h2').next('small-font').html("Complete 3 simple steps to have a resume to apply to jobs!");
      $('#form-resume-content').slideDown();
      return $('#preview-content').slideUp();
    });
  });

}).call(this);
(function() {
  this.triggerSubMenuMobile = function() {
    var $sousmenu;
    $sousmenu = $('ul.sous-menu, .sous-menu');
    $sousmenu.bind("click").unbind('mouseenter').unbind('mouseleave');
    $sousmenu.find('.sous-menu-links').on('click', function(e) {
      e.preventDefault();
      e.stopPropagation();
      $sousmenu.find('.sous-menu-links > ul').hide();
      return $(this).parent().find('ul').first().toggle();
    });
    $sousmenu.find('.sous-menu-links a').click(function(e) {
      e.preventDefault();
      return window.location = $(this).attr('href');
    });
    return $('.menu').click(function() {
      return $sousmenu.find('.sous-menu-links > ul').hide();
    });
  };

  this.triggerSubMenuDesktop = function(e) {
    var leaveMenu;
    if ($("#my-resume-link").hasClass('active')) {
      $("#my-profile-link").removeClass('active').removeAttr('aria-current');
    }
    leaveMenu = null;
    return $('ul.sous-menu, .sous-menu').each(function() {
      var $ul;
      $ul = $(this).find('ul');
      $ul.hide();
      $(this).unbind("click").bind('hover');
      $(this).mouseenter(function() {
        $('ul.sous-menu ul, .sous-menu ul').hide();
        $ul.show();
        return clearTimeout(leaveMenu);
      });
      $(this).mouseleave(function() {
        return leaveMenu = setTimeout(function() {
          return $ul.stop().hide();
        }, 300);
      });
      $(document).on('keydown', function(e) {
        if (e.keyCode === 27) {
          $ul.hide();
          return $(':focus').parents('.sous-menu-links').find('button').focus();
        }
      });
      return $('.header-us .menu .sous-menu .sous-menu-links ul li').on('keydown', function(e) {
        var current, currentAnchor;
        current = $(this).find(':focus');
        current.attr('tabindex', '0');
        if (current !== null) {
          currentAnchor = current.parent('li').parent('.sous-menu-links ul').find('a');
          if (e.which === 40) {
            currentAnchor.attr('tabindex', '-1');
            current.parent('li').next('li').find('a').focus().attr('tabindex', '0');
            e.preventDefault();
            current = null;
          }
          if (e.which === 38) {
            currentAnchor.attr('tabindex', '-1');
            current.parent('li').prev('li').find('a').focus().attr('tabindex', '0');
            e.preventDefault();
            current = null;
          }
        }
        if (e.keyCode === 9) {
          return $ul.hide();
        }
      });
    });
  };

  this.triggerSubMenu = function() {
    if (isMobile.any || $(window).width() <= 1029) {
      return triggerSubMenuMobile();
    } else {
      return triggerSubMenuDesktop();
    }
  };

  this.removeSitePusherTransform = function() {
    if ($('.new-oc-page').length > 0) {
      return $('.site-container .site-pusher').css({
        'transform': ''
      });
    }
  };

  this.triggerDropdownMenu = function() {
    var isClId;
    isClId = $('.salary-rebrand-menus');
    if (isClId.length > 0 && !isClId.is(':visible')) {
      return $('.sous-menu-links.page-active button').trigger('click');
    }
  };

  $(function() {
    $('#hamburger').click(function(e) {
      e.preventDefault();
      $('body').toggleClass('with-sidebar');
      $('#site-content').addClass('hidden');
      $('.header-logo').addClass('hidden');
      if (isMobile.any || $(window).width() <= 1029) {
        $('.header-welcome .close-menu').focus();
      }
      removeSitePusherTransform();
      return triggerDropdownMenu();
    });
    $('#site-cache, .close-menu').click(function(e) {
      e.preventDefault();
      $('body').removeClass('with-sidebar');
      $('#site-content').removeClass('hidden');
      return $('.header-logo').removeClass('hidden');
    });
    $('header button[aria-controls]:not(#sign-in-link)').click(function(e) {
      var ariaControls, displaySubMenu, expanded, target;
      target = $(e.target);
      ariaControls = target.attr('aria-controls');
      expanded = target.attr('aria-expanded') !== 'true';
      target.attr('aria-expanded', expanded);
      displaySubMenu = expanded ? 'block' : 'none';
      $("#" + ariaControls).css('display', displaySubMenu);
      return $(target).parents('.sous-menu-links').find('ul li:first-of-type a').focus().attr({
        'tabindex': '0'
      });
    });
    $('header button[aria-controls]:not(#sign-in-link)').hover(function(e) {
      return $(e.target).attr('aria-expanded', true);
    }, function(e) {
      return $(e.target).attr('aria-expanded', false);
    });
    triggerSubMenu();
    return $('.sous-menu a').keydown(function(e) {
      switch (e.which) {
        case 36:
          e.preventDefault();
          $(this).closest('.sous-menu').find('a:first').focus();
          break;
        case 35:
          e.preventDefault();
          $(this).closest('.sous-menu').find('a:last').focus();
      }
    });
  });

}).call(this);
(function() {
  $(function() {
    var $skipLink;
    $skipLink = $('.skip-link');
    if ($skipLink.length) {
      $('body').focus();
      return $skipLink.click(function(e) {
        var $searchInput, targetElement, targetSelector;
        targetSelector = $(e.target).attr('target');
        targetElement = $(targetSelector);
        $(window).scrollTop(targetElement.offset().top);
        targetElement.focus();
        $searchInput = targetElement.find(':input:enabled:visible:first');
        if ($searchInput.length > 0) {
          return $searchInput.focus();
        }
      });
    }
  });

}).call(this);
(function() {
  $(function() {
    window.onpageshow = function(event) {
      return $('.re-enable-at-load').attr('disabled', false);
    };
    $("form.form").on("submit", function(e) {
      if (!$(this).data('remote') && !$(this).find('.error').length) {
        $(this).find(":submit").attr('disabled', true);
        return $(this).find(":submit").addClass('re-enable-at-load');
      }
    });
    return $('.btn').keypress(function(e) {
      if (e.keyCode === 13 && $(this).hasClass('btn-disabled')) {
        return e.preventDefault();
      }
    });
  });

}).call(this);
(function() {
  $(function() {
    var w;
    $('.collapse, .job-filter').each(function() {
      var $click, $content, $display;
      $click = $(this).find(".widget-text, .job-filter-title, .plus-button, .collapse-btn");
      $display = $(this).find('.collapse-display-me');
      $content = $(this).find('.job-filter-content');
      $display.hide();
      return $click.click(function() {
        $display.fadeToggle();
        $content.slideToggle().parent().toggleClass('close');
        if ($click.hasClass('plus-button')) {
          $click.toggleClass('fa-rotate-90');
        }
        if ($click.hasClass('collapse-fadeout')) {
          return $click.hide();
        }
      });
    });
    $(document).on('click', '.flash-message', function() {
      var $inTenMinutes;
      if (!$(this).hasClass('do-not-remove-from-dom')) {
        $(this).slideUp('fast', function() {
          return $(this).remove();
        });
        if ($(this).hasClass('maintenance')) {
          $inTenMinutes = 1 / 144;
          return Cookies.set('has_seen_maintenance_banner', 'true', {
            expires: $inTenMinutes
          });
        }
      }
    });
    $(document).on('click', '.display-filters, #cancel-jobs-filter', function() {
      if ($('#job-search-form').length) {
        $('.trigger-mobile-form-collapse').removeClass('dn-i').addClass('show-mobile');
        $('#job-search-form').addClass('form-collapse');
        if ($('#jobs-filters-content').hasClass('display') && $('#job-search-form').hasClass('form-collapse')) {
          return $('#jobs-filters-content').removeClass('display');
        } else {
          return $('#jobs-filters-content').addClass('display');
        }
      } else {
        return $('#jobs-filters-content').toggleClass('display');
      }
    });
    $('p[class^="FAQs-Q"]').each(function() {
      return $(this).click(function() {
        $(this).toggleClass('toggle');
        return $(this).next('p').toggle();
      });
    });
    $('#btn-widget-options').click(function(e) {
      e.preventDefault();
      removeAllWidget();
      $(this).parent().addClass('widget-hidden');
      if ($('#register_and_apply').length > 0) {
        return $("#parsed-bloc").html("");
      }
    });
    $('#jobs-filter-button').click(function() {
      $('#jobs-filter-button').hide();
      return $('#jobs-filter').show();
    });
    $('#filter-more-cities').click(function(e) {
      var text;
      e.preventDefault();
      text = $(this).text();
      if (text === I18n.t('js.view_more')) {
        text = I18n.t('js.view_less');
      } else {
        text = I18n.t('js.view_more');
        $('body').scrollTo('#filter-cities', '500', {
          offset: -66
        });
      }
      $(this).text(text);
      return $('#filter-cities li:nth-child(n+16)').slideToggle();
    });
    $('#filter-more-categories').click(function(e) {
      var text;
      e.preventDefault();
      text = $(this).text();
      if (text === I18n.t('js.view_more')) {
        text = I18n.t('js.view_less');
      } else {
        text = I18n.t('js.view_more');
        $('body').scrollTo('#filter-categories', '500', {
          offset: -66
        });
      }
      $(this).text(text);
      return $('#filter-categories li:nth-child(n+11)').slideToggle();
    });
    $('#filter-more-states').click(function(e) {
      var text;
      e.preventDefault();
      text = $(this).text();
      if (text === I18n.t('js.view_more')) {
        text = I18n.t('js.view_less');
      } else {
        text = I18n.t('js.view_more');
        $('body').scrollTo('#filter-states', '500', {
          offset: -66
        });
      }
      $(this).text(text);
      return $('#filter-states li:nth-child(n+16)').slideToggle();
    });
    $('#cancel-jobs-filter').click(function(e) {
      e.preventDefault();
      $('#jobs-filter-button').show();
      return $('#jobs-filter').hide();
    });
    $('#job-alert-jrp-button').click(function(e) {
      e.preventDefault();
      return $('#job-alert-jrp').toggleClass("dn");
    });
    $('#display-filter').click(function(e) {
      e.preventDefault();
      return $('#filter').slideToggle().addClass('display');
    });
    w = $(window).width();
    $(window).resize(function() {
      if ($(window).width() !== w) {
        w = $(window).width();
        if ($(window).width() <= 1000) {
          $('.job-filter').find('.job-filter-content').hide();
          $('#jobs-filter-button').show();
          $('#jobs-filter').hide();
        } else {
          $('.job-filter').find('.job-filter-content').show();
          $('#jobs-filter-button').hide();
          $('#jobs-filter').show();
        }
        return $('.close').removeClass('close');
      }
    });
    $('.see-more, .top-bloc .p-text').click(function() {
      var h;
      $('.top-bloc .p-text').toggleClass('see-you');
      h = $('.top-bloc .p-text').height();
      if ($('.top-bloc .p-text').hasClass('see-you')) {
        $('.top-align').css('margin-top', "-" + (h + 135) + "px");
        return $('.see-more').html("<i class='fa fa-angle-up'></i> " + I18n.t('js.see_less') + " <i class='fa fa-angle-up'></i>");
      } else {
        $('.top-align').css('margin-top', "-343px");
        return $('.see-more').html("<i class='fa fa-angle-down'></i> " + I18n.t('js.see_more') + " <i class='fa fa-angle-down'></i>");
      }
    });
    $('#new_resume_button').click(function(e) {
      e.preventDefault();
      $('#new_resume_button').fadeOut();
      $('#updload_prefilled').fadeOut(function() {
        $('#updload_prefilled').addClass('hide-field');
        return $('#upload_widget').removeClass('dn').hide().fadeIn();
      });
      $('#apply_resume').remove();
      return $('#cv_file_name').val('');
    });
    $('.message-to-close').each(function() {
      var $close, $that;
      $that = $(this);
      $close = $(this).find('.btn-close');
      return $close.click(function(e) {
        e.preventDefault();
        return $that.hide();
      });
    });
    if (isMobile.any || $(window).width() <= 1029) {
      $('.footer-us .footer-title button').click(function() {
        var expanded;
        expanded = $(this).attr('aria-expanded') !== 'true';
        $(this).attr('aria-expanded', expanded);
        $(this).toggleClass('rotate');
        return $(this).parent().next('.footer-collapse').slideToggle();
      });
    }
    $(document).on('click', '.btn-display-panel', function(e) {
      e.preventDefault();
      $('.panel').toggleClass('panel-display');
      return $(window).scrollTo(0, {
        duration: 50
      });
    });
    $(document).on('click', '.js-dropdown-trigger.cover-letter', function(e) {
      e.preventDefault();
      e.stopPropagation();
      $('.cover-letter-dropdown').toggle();
      if ($('.cover-letter-dropdown').css('display', 'block')) {
        return $('#upload-cover-letter-icon').attr('aria-expanded', 'true');
      } else {
        return $('#upload-cover-letter-icon').attr('aria-expanded', 'false');
      }
    });
    if ($('.cover-letter-dropdown').length) {
      $(document).click(function() {
        $('.cover-letter-dropdown').hide();
        return $('#upload-cover-letter-icon').attr('aria-expanded', 'false');
      });
    }
    $(document).on('click', '.js-dropdown-trigger:not(.cover-letter)', function(e) {
      e.preventDefault();
      e.stopPropagation();
      $('.dropdown').toggle();
      if ($('.dropdown').css('display', 'block')) {
        return $('#upload-resume-icon').attr('aria-expanded', 'true');
      } else {
        return $('#upload-resume-icon').attr('aria-expanded', 'false');
      }
    });
    if ($('.dropdown').length) {
      $(document).click(function() {
        $('.dropdown').hide();
        return $('#upload-resume-icon').attr('aria-expanded', 'false');
      });
    }
    $(document).on('click', '#registered-resumes', function(e) {
      e.preventDefault();
      e.stopPropagation();
      if ($(this).attr('data-url') !== '') {
        return location.href = $(this).attr('data-url');
      } else {
        return $('.registered-resumes-dropdown').show();
      }
    });
    if ($('.registered-resumes-dropdown').length) {
      $(document).click(function() {
        return $('.registered-resumes-dropdown').hide();
      });
    }
    $('.accordion-body').each(function() {
      $(this).hide();
      return $(this).addClass('hidden');
    });
    return $('.accordion-parent').each(function() {
      return $(this).click(function() {
        var $panel;
        $panel = $(this).find('.accordion-body');
        if ($panel.hasClass('hidden')) {
          $panel.removeClass('hidden');
          return $panel.show();
        } else {
          $panel.hide();
          return $panel.addClass('hidden');
        }
      });
    });
  });

  window.REMODAL_GLOBALS = {
    DEFAULTS: {
      hashTracking: false
    }
  };

}).call(this);
/*
 *  Remodal - v1.1.1
 *  Responsive, lightweight, fast, synchronized with CSS animations, fully customizable modal window plugin with declarative configuration and hash tracking.
 *  http://vodkabears.github.io/remodal/
 *
 *  Made by Ilya Makarov
 *  Under MIT License
 */

!(function(root, factory) {
  if (typeof define === 'function' && define.amd) {
    define(['jquery'], function($) {
      return factory(root, $);
    });
  } else if (typeof exports === 'object') {
    factory(root, require('jquery'));
  } else {
    factory(root, root.jQuery || root.Zepto);
  }
})(this, function(global, $) {

  'use strict';

  /**
   * Name of the plugin
   * @private
   * @const
   * @type {String}
   */
  var PLUGIN_NAME = 'remodal';

  /**
   * Namespace for CSS and events
   * @private
   * @const
   * @type {String}
   */
  var NAMESPACE = global.REMODAL_GLOBALS && global.REMODAL_GLOBALS.NAMESPACE || PLUGIN_NAME;

  /**
   * Animationstart event with vendor prefixes
   * @private
   * @const
   * @type {String}
   */
  var ANIMATIONSTART_EVENTS = $.map(
    ['animationstart', 'webkitAnimationStart', 'MSAnimationStart', 'oAnimationStart'],

    function(eventName) {
      return eventName + '.' + NAMESPACE;
    }

  ).join(' ');

  /**
   * Animationend event with vendor prefixes
   * @private
   * @const
   * @type {String}
   */
  var ANIMATIONEND_EVENTS = $.map(
    ['animationend', 'webkitAnimationEnd', 'MSAnimationEnd', 'oAnimationEnd'],

    function(eventName) {
      return eventName + '.' + NAMESPACE;
    }

  ).join(' ');

  /**
   * Default settings
   * @private
   * @const
   * @type {Object}
   */
  var DEFAULTS = $.extend({
    hashTracking: true,
    closeOnConfirm: true,
    closeOnCancel: true,
    closeOnEscape: true,
    closeOnOutsideClick: true,
    modifier: '',
    appendTo: null
  }, global.REMODAL_GLOBALS && global.REMODAL_GLOBALS.DEFAULTS);

  /**
   * States of the Remodal
   * @private
   * @const
   * @enum {String}
   */
  var STATES = {
    CLOSING: 'closing',
    CLOSED: 'closed',
    OPENING: 'opening',
    OPENED: 'opened'
  };

  /**
   * Reasons of the state change.
   * @private
   * @const
   * @enum {String}
   */
  var STATE_CHANGE_REASONS = {
    CONFIRMATION: 'confirmation',
    CANCELLATION: 'cancellation'
  };

  /**
   * Is animation supported?
   * @private
   * @const
   * @type {Boolean}
   */
  var IS_ANIMATION = (function() {
    var style = document.createElement('div').style;

    return style.animationName !== undefined ||
      style.WebkitAnimationName !== undefined ||
      style.MozAnimationName !== undefined ||
      style.msAnimationName !== undefined ||
      style.OAnimationName !== undefined;
  })();

  /**
   * Is iOS?
   * @private
   * @const
   * @type {Boolean}
   */
  var IS_IOS = /iPad|iPhone|iPod/.test(navigator.platform);

  /**
   * Current modal
   * @private
   * @type {Remodal}
   */
  var current;

  /**
   * Scrollbar position
   * @private
   * @type {Number}
   */
  var scrollTop;

  /**
   * Returns an animation duration
   * @private
   * @param {jQuery} $elem
   * @returns {Number}
   */
  function getAnimationDuration($elem) {
    if (
      IS_ANIMATION &&
      $elem.css('animation-name') === 'none' &&
      $elem.css('-webkit-animation-name') === 'none' &&
      $elem.css('-moz-animation-name') === 'none' &&
      $elem.css('-o-animation-name') === 'none' &&
      $elem.css('-ms-animation-name') === 'none'
    ) {
      return 0;
    }

    var duration = $elem.css('animation-duration') ||
      $elem.css('-webkit-animation-duration') ||
      $elem.css('-moz-animation-duration') ||
      $elem.css('-o-animation-duration') ||
      $elem.css('-ms-animation-duration') ||
      '0s';

    var delay = $elem.css('animation-delay') ||
      $elem.css('-webkit-animation-delay') ||
      $elem.css('-moz-animation-delay') ||
      $elem.css('-o-animation-delay') ||
      $elem.css('-ms-animation-delay') ||
      '0s';

    var iterationCount = $elem.css('animation-iteration-count') ||
      $elem.css('-webkit-animation-iteration-count') ||
      $elem.css('-moz-animation-iteration-count') ||
      $elem.css('-o-animation-iteration-count') ||
      $elem.css('-ms-animation-iteration-count') ||
      '1';

    var max;
    var len;
    var num;
    var i;

    duration = duration.split(', ');
    delay = delay.split(', ');
    iterationCount = iterationCount.split(', ');

    // The 'duration' size is the same as the 'delay' size
    for (i = 0, len = duration.length, max = Number.NEGATIVE_INFINITY; i < len; i++) {
      num = parseFloat(duration[i]) * parseInt(iterationCount[i], 10) + parseFloat(delay[i]);

      if (num > max) {
        max = num;
      }
    }

    return max;
  }

  /**
   * Returns a scrollbar width
   * @private
   * @returns {Number}
   */
  function getScrollbarWidth() {
    if ($(document).height() <= $(window).height()) {
      return 0;
    }

    var outer = document.createElement('div');
    var inner = document.createElement('div');
    var widthNoScroll;
    var widthWithScroll;

    outer.style.visibility = 'hidden';
    outer.style.width = '100px';
    document.body.appendChild(outer);

    widthNoScroll = outer.offsetWidth;

    // Force scrollbars
    outer.style.overflow = 'scroll';

    // Add inner div
    inner.style.width = '100%';
    outer.appendChild(inner);

    widthWithScroll = inner.offsetWidth;

    // Remove divs
    outer.parentNode.removeChild(outer);

    return widthNoScroll - widthWithScroll;
  }

  /**
   * Locks the screen
   * @private
   */
  function lockScreen() {
    if (IS_IOS) {
      return;
    }

    var $html = $('html');
    var lockedClass = namespacify('is-locked');
    var paddingRight;
    var $body;

    if (!$html.hasClass(lockedClass)) {
      $body = $(document.body);

      // Zepto does not support '-=', '+=' in the `css` method
      // paddingRight = parseInt($body.css('padding-right'), 10) + getScrollbarWidth();

      // $body.css('padding-right', paddingRight + 'px');
      $html.addClass(lockedClass);
    }
  }

  /**
   * Unlocks the screen
   * @private
   */
  function unlockScreen() {
    if (IS_IOS) {
      return;
    }

    var $html = $('html');
    var lockedClass = namespacify('is-locked');
    var paddingRight;
    var $body;

    if ($html.hasClass(lockedClass)) {
      $body = $(document.body);

      // Zepto does not support '-=', '+=' in the `css` method
      // paddingRight = parseInt($body.css('padding-right'), 10) - getScrollbarWidth();

      // $body.css('padding-right', paddingRight + 'px');
      $html.removeClass(lockedClass);
    }
  }

  /**
   * Sets a state for an instance
   * @private
   * @param {Remodal} instance
   * @param {STATES} state
   * @param {Boolean} isSilent If true, Remodal does not trigger events
   * @param {String} Reason of a state change.
   */
  function setState(instance, state, isSilent, reason) {

    var newState = namespacify('is', state);
    var allStates = [namespacify('is', STATES.CLOSING),
                     namespacify('is', STATES.OPENING),
                     namespacify('is', STATES.CLOSED),
                     namespacify('is', STATES.OPENED)].join(' ');

    instance.$bg
      .removeClass(allStates)
      .addClass(newState);

    instance.$overlay
      .removeClass(allStates)
      .addClass(newState);

    instance.$wrapper
      .removeClass(allStates)
      .addClass(newState);

    instance.$modal
      .removeClass(allStates)
      .addClass(newState);

    instance.state = state;
    !isSilent && instance.$modal.trigger({
      type: state,
      reason: reason
    }, [{ reason: reason }]);
  }

  /**
   * Synchronizes with the animation
   * @param {Function} doBeforeAnimation
   * @param {Function} doAfterAnimation
   * @param {Remodal} instance
   */
  function syncWithAnimation(doBeforeAnimation, doAfterAnimation, instance) {
    var runningAnimationsCount = 0;

    var handleAnimationStart = function(e) {
      if (e.target !== this) {
        return;
      }

      runningAnimationsCount++;
    };

    var handleAnimationEnd = function(e) {
      if (e.target !== this) {
        return;
      }

      if (--runningAnimationsCount === 0) {

        // Remove event listeners
        $.each(['$bg', '$overlay', '$wrapper', '$modal'], function(index, elemName) {
          instance[elemName].off(ANIMATIONSTART_EVENTS + ' ' + ANIMATIONEND_EVENTS);
        });

        doAfterAnimation();
      }
    };

    $.each(['$bg', '$overlay', '$wrapper', '$modal'], function(index, elemName) {
      instance[elemName]
        .on(ANIMATIONSTART_EVENTS, handleAnimationStart)
        .on(ANIMATIONEND_EVENTS, handleAnimationEnd);
    });

    doBeforeAnimation();

    // If the animation is not supported by a browser or its duration is 0
    if (
      getAnimationDuration(instance.$bg) === 0 &&
      getAnimationDuration(instance.$overlay) === 0 &&
      getAnimationDuration(instance.$wrapper) === 0 &&
      getAnimationDuration(instance.$modal) === 0
    ) {

      // Remove event listeners
      $.each(['$bg', '$overlay', '$wrapper', '$modal'], function(index, elemName) {
        instance[elemName].off(ANIMATIONSTART_EVENTS + ' ' + ANIMATIONEND_EVENTS);
      });

      doAfterAnimation();
    }
  }

  /**
   * Closes immediately
   * @private
   * @param {Remodal} instance
   */
  function halt(instance) {
    if (instance.state === STATES.CLOSED) {
      return;
    }

    $.each(['$bg', '$overlay', '$wrapper', '$modal'], function(index, elemName) {
      instance[elemName].off(ANIMATIONSTART_EVENTS + ' ' + ANIMATIONEND_EVENTS);
    });

    instance.$bg.removeClass(instance.settings.modifier);
    instance.$overlay.removeClass(instance.settings.modifier).hide();
    instance.$wrapper.hide();
    unlockScreen();
    setState(instance, STATES.CLOSED, true);
  }

  /**
   * Parses a string with options
   * @private
   * @param str
   * @returns {Object}
   */
  function parseOptions(str) {
    var obj = {};
    var arr;
    var len;
    var val;
    var i;

    // Remove spaces before and after delimiters
    str = str.replace(/\s*:\s*/g, ':').replace(/\s*,\s*/g, ',');

    // Parse a string
    arr = str.split(',');
    for (i = 0, len = arr.length; i < len; i++) {
      arr[i] = arr[i].split(':');
      val = arr[i][1];

      // Convert a string value if it is like a boolean
      if (typeof val === 'string' || val instanceof String) {
        val = val === 'true' || (val === 'false' ? false : val);
      }

      // Convert a string value if it is like a number
      if (typeof val === 'string' || val instanceof String) {
        val = !isNaN(val) ? +val : val;
      }

      obj[arr[i][0]] = val;
    }

    return obj;
  }

  /**
   * Generates a string separated by dashes and prefixed with NAMESPACE
   * @private
   * @param {...String}
   * @returns {String}
   */
  function namespacify() {
    var result = NAMESPACE;

    for (var i = 0; i < arguments.length; ++i) {
      result += '-' + arguments[i];
    }

    return result;
  }

  /**
   * Handles the hashchange event
   * @private
   * @listens hashchange
   */
  function handleHashChangeEvent() {
    var id = location.hash.replace('#', '');
    var instance;
    var $elem;

    if (!id) {

      // Check if we have currently opened modal and animation was completed
      if (current && current.state === STATES.OPENED && current.settings.hashTracking) {
        current.close();
      }
    } else {

      // Catch syntax error if your hash is bad
      try {
        $elem = $(
          '[data-' + PLUGIN_NAME + '-id="' + id + '"]'
        );
      } catch (err) {}

      if ($elem && $elem.length) {
        instance = $[PLUGIN_NAME].lookup[$elem.data(PLUGIN_NAME)];

        if (instance && instance.settings.hashTracking) {
          instance.open();
        }
      }

    }
  }

  /**
   * Remodal constructor
   * @constructor
   * @param {jQuery} $modal
   * @param {Object} options
   */
  function Remodal($modal, options) {
    var $body = $(document.body);
    var $appendTo = $body;
    var remodal = this;

    remodal.settings = $.extend({}, DEFAULTS, options);
    remodal.index = $[PLUGIN_NAME].lookup.push(remodal) - 1;
    remodal.state = STATES.CLOSED;

    remodal.$overlay = $('.' + namespacify('overlay'));

    if (remodal.settings.appendTo !== null && remodal.settings.appendTo.length) {
      $appendTo = $(remodal.settings.appendTo);
    }

    if (!remodal.$overlay.length) {
      remodal.$overlay = $('<div>').addClass(namespacify('overlay') + ' ' + namespacify('is', STATES.CLOSED)).hide();
      $appendTo.append(remodal.$overlay);
    }

    remodal.$bg = $('.' + namespacify('bg')).addClass(namespacify('is', STATES.CLOSED));

    remodal.$modal = $modal
      .addClass(
        NAMESPACE + ' ' +
        namespacify('is-initialized') + ' ' +
        remodal.settings.modifier + ' ' +
        namespacify('is', STATES.CLOSED))
      .attr('tabindex', '-1');

    remodal.$wrapper = $('<div>')
      .addClass(
        namespacify('wrapper') + ' ' +
        remodal.settings.modifier + ' ' +
        namespacify('is', STATES.CLOSED))
      .hide()
      .append(remodal.$modal);
    $appendTo.append(remodal.$wrapper);

    // Add the event listener for the close button
    remodal.$wrapper.on('click.' + NAMESPACE, '[data-' + PLUGIN_NAME + '-action="close"]', function(e) {
      e.preventDefault();

      remodal.close();
    });

    // Add the event listener for the cancel button
    remodal.$wrapper.on('click.' + NAMESPACE, '[data-' + PLUGIN_NAME + '-action="cancel"]', function(e) {
      e.preventDefault();

      remodal.$modal.trigger(STATE_CHANGE_REASONS.CANCELLATION);

      if (remodal.settings.closeOnCancel) {
        remodal.close(STATE_CHANGE_REASONS.CANCELLATION);
      }
    });

    // Add the event listener for the confirm button
    remodal.$wrapper.on('click.' + NAMESPACE, '[data-' + PLUGIN_NAME + '-action="confirm"]', function(e) {
      e.preventDefault();

      remodal.$modal.trigger(STATE_CHANGE_REASONS.CONFIRMATION);

      if (remodal.settings.closeOnConfirm) {
        remodal.close(STATE_CHANGE_REASONS.CONFIRMATION);
      }
    });

    // Add the event listener for the overlay
    remodal.$wrapper.on('click.' + NAMESPACE, function(e) {
      var $target = $(e.target);

      if (!$target.hasClass(namespacify('wrapper'))) {
        return;
      }

      if (remodal.settings.closeOnOutsideClick) {
        remodal.close();
      }
    });
  }

  /**
   * Opens a modal window
   * @public
   */
  Remodal.prototype.open = function() {
    var remodal = this;
    var id;

    // Check if the animation was completed
    if (remodal.state === STATES.OPENING || remodal.state === STATES.CLOSING) {
      return;
    }

    id = remodal.$modal.attr('data-' + PLUGIN_NAME + '-id');

    if (id && remodal.settings.hashTracking) {
      scrollTop = $(window).scrollTop();
      location.hash = id;
    }

    if (current && current !== remodal) {
      halt(current);
    }

    current = remodal;
    lockScreen();
    remodal.$bg.addClass(remodal.settings.modifier);
    remodal.$overlay.addClass(remodal.settings.modifier).show();
    remodal.$wrapper.show().scrollTop(0);
    remodal.$modal.focus();

    syncWithAnimation(
      function() {
        setState(remodal, STATES.OPENING);
      },

      function() {
        setState(remodal, STATES.OPENED);
      },

      remodal);
  };

  /**
   * Closes a modal window
   * @public
   * @param {String} reason
   */
  Remodal.prototype.close = function(reason) {
    var remodal = this;

    // Check if the animation was completed
    if (remodal.state === STATES.OPENING || remodal.state === STATES.CLOSING || remodal.state === STATES.CLOSED) {
      return;
    }

    if (
      remodal.settings.hashTracking &&
      remodal.$modal.attr('data-' + PLUGIN_NAME + '-id') === location.hash.substr(1)
    ) {
      location.hash = '';
      $(window).scrollTop(scrollTop);
    }

    syncWithAnimation(
      function() {
        setState(remodal, STATES.CLOSING, false, reason);
      },

      function() {
        remodal.$bg.removeClass(remodal.settings.modifier);
        remodal.$overlay.removeClass(remodal.settings.modifier).hide();
        remodal.$wrapper.hide();
        unlockScreen();

        setState(remodal, STATES.CLOSED, false, reason);
      },

      remodal);
  };

  /**
   * Returns a current state of a modal
   * @public
   * @returns {STATES}
   */
  Remodal.prototype.getState = function() {
    return this.state;
  };

  /**
   * Destroys a modal
   * @public
   */
  Remodal.prototype.destroy = function() {
    var lookup = $[PLUGIN_NAME].lookup;
    var instanceCount;

    halt(this);
    this.$wrapper.remove();

    delete lookup[this.index];
    instanceCount = $.grep(lookup, function(instance) {
      return !!instance;
    }).length;

    if (instanceCount === 0) {
      this.$overlay.remove();
      this.$bg.removeClass(
        namespacify('is', STATES.CLOSING) + ' ' +
        namespacify('is', STATES.OPENING) + ' ' +
        namespacify('is', STATES.CLOSED) + ' ' +
        namespacify('is', STATES.OPENED));
    }
  };

  /**
   * Special plugin object for instances
   * @public
   * @type {Object}
   */
  $[PLUGIN_NAME] = {
    lookup: []
  };

  /**
   * Plugin constructor
   * @constructor
   * @param {Object} options
   * @returns {JQuery}
   */
  $.fn[PLUGIN_NAME] = function(opts) {
    var instance;
    var $elem;

    this.each(function(index, elem) {
      $elem = $(elem);

      if ($elem.data(PLUGIN_NAME) == null) {
        instance = new Remodal($elem, opts);
        $elem.data(PLUGIN_NAME, instance.index);

        if (
          instance.settings.hashTracking &&
          $elem.attr('data-' + PLUGIN_NAME + '-id') === location.hash.substr(1)
        ) {
          instance.open();
        }
      } else {
        instance = $[PLUGIN_NAME].lookup[$elem.data(PLUGIN_NAME)];
      }
    });

    return instance;
  };

  $(document).ready(function() {

    // data-remodal-target opens a modal window with the special Id
    $(document).on('click', '[data-' + PLUGIN_NAME + '-target]', function(e) {
      e.preventDefault();

      var elem = e.currentTarget;
      var id = elem.getAttribute('data-' + PLUGIN_NAME + '-target');
      var $target = $('[data-' + PLUGIN_NAME + '-id="' + id + '"]');

      $[PLUGIN_NAME].lookup[$target.data(PLUGIN_NAME)].open();
    });

    // Auto initialization of modal windows
    // They should have the 'remodal' class attribute
    // Also you can write the `data-remodal-options` attribute to pass params into the modal
    $(document).find('.' + NAMESPACE).each(function(i, container) {
      var $container = $(container);
      var options = $container.data(PLUGIN_NAME + '-options');

      if (!options) {
        options = {};
      } else if (typeof options === 'string' || options instanceof String) {
        options = parseOptions(options);
      }

      $container[PLUGIN_NAME](options);
    });

    // Handles the keydown event
    $(document).on('keydown.' + NAMESPACE, function(e) {
      if (current && current.settings.closeOnEscape && current.state === STATES.OPENED && e.keyCode === 27) {
        current.close();
      }
    });

    // Handles the hashchange event
    $(window).on('hashchange.' + NAMESPACE, handleHashChangeEvent);
  });
});
/**
 * Copyright (c) 2007-2015 Ariel Flesler - aflesler ○ gmail • com | http://flesler.blogspot.com
 * Licensed under MIT
 * @author Ariel Flesler
 * @version 2.1.3
 */
;(function(f){"use strict";"function"===typeof define&&define.amd?define(["jquery"],f):"undefined"!==typeof module&&module.exports?module.exports=f(require("jquery")):f(jQuery)})(function($){"use strict";function n(a){return!a.nodeName||-1!==$.inArray(a.nodeName.toLowerCase(),["iframe","#document","html","body"])}function h(a){return $.isFunction(a)||$.isPlainObject(a)?a:{top:a,left:a}}var p=$.scrollTo=function(a,d,b){return $(window).scrollTo(a,d,b)};p.defaults={axis:"xy",duration:0,limit:!0};$.fn.scrollTo=function(a,d,b){"object"=== typeof d&&(b=d,d=0);"function"===typeof b&&(b={onAfter:b});"max"===a&&(a=9E9);b=$.extend({},p.defaults,b);d=d||b.duration;var u=b.queue&&1<b.axis.length;u&&(d/=2);b.offset=h(b.offset);b.over=h(b.over);return this.each(function(){function k(a){var k=$.extend({},b,{queue:!0,duration:d,complete:a&&function(){a.call(q,e,b)}});r.animate(f,k)}if(null!==a){var l=n(this),q=l?this.contentWindow||window:this,r=$(q),e=a,f={},t;switch(typeof e){case "number":case "string":if(/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(e)){e= h(e);break}e=l?$(e):$(e,q);case "object":if(e.length===0)return;if(e.is||e.style)t=(e=$(e)).offset()}var v=$.isFunction(b.offset)&&b.offset(q,e)||b.offset;$.each(b.axis.split(""),function(a,c){var d="x"===c?"Left":"Top",m=d.toLowerCase(),g="scroll"+d,h=r[g](),n=p.max(q,c);t?(f[g]=t[m]+(l?0:h-r.offset()[m]),b.margin&&(f[g]-=parseInt(e.css("margin"+d),10)||0,f[g]-=parseInt(e.css("border"+d+"Width"),10)||0),f[g]+=v[m]||0,b.over[m]&&(f[g]+=e["x"===c?"width":"height"]()*b.over[m])):(d=e[m],f[g]=d.slice&& "%"===d.slice(-1)?parseFloat(d)/100*n:d);b.limit&&/^\d+$/.test(f[g])&&(f[g]=0>=f[g]?0:Math.min(f[g],n));!a&&1<b.axis.length&&(h===f[g]?f={}:u&&(k(b.onAfterFirst),f={}))});k(b.onAfter)}})};p.max=function(a,d){var b="x"===d?"Width":"Height",h="scroll"+b;if(!n(a))return a[h]-$(a)[b.toLowerCase()]();var b="client"+b,k=a.ownerDocument||a.document,l=k.documentElement,k=k.body;return Math.max(l[h],k[h])-Math.min(l[b],k[b])};$.Tween.propHooks.scrollLeft=$.Tween.propHooks.scrollTop={get:function(a){return $(a.elem)[a.prop]()}, set:function(a){var d=this.get(a);if(a.options.interrupt&&a._last&&a._last!==d)return $(a.elem).stop();var b=Math.round(a.now);d!==b&&($(a.elem)[a.prop](b),a._last=this.get(a))}};return p});
var lazyImages = Array.prototype.slice.call(document.querySelectorAll("img.lazy"));
var active = false;

var isImgVisible = function (lazyImage) {
  return lazyImage.getBoundingClientRect().top <= (window.innerHeight) &&
    lazyImage.getBoundingClientRect().bottom >= 0 &&
    getComputedStyle(lazyImage).display !== "none" &&
    $(lazyImage).is(':visible')
};

var lazyLoad = function () {
  lazyImages = Array.prototype.slice.call(document.querySelectorAll("img.lazy"));
  if (!active) {
    active = true;

    setTimeout(function () {
      lazyImages.forEach(function (lazyImage) {
        if (isImgVisible(lazyImage)) {
          lazyImage.src = lazyImage.dataset.src;
          lazyImage.classList.remove("lazy");

          lazyImages = lazyImages.filter(function (image) {
            return image !== lazyImage;
          });

          if (lazyImages.length === 0) {
            window.removeEventListener("scroll", lazyLoad);
            window.removeEventListener("resize", lazyLoad);
            window.removeEventListener("orientationchange", lazyLoad);
            window.removeEventListener("DOMContentLoaded", lazyLoad);
          }
        }
      });

      active = false;
    }, 200);
  }
};

document.addEventListener("DOMContentLoaded", function (event) {
  lazyLoadFixedElement();
});

function lazyLoadFixedElement() {
  (function () {
    var activeEle = $('.campaign-enabled').length > 0 ? 'campaign-enabled' : 'fix-elem-parent';
    var divs = document.getElementsByClassName(activeEle);
    if (divs.length > 0) {
      for (var i = 0; i < divs.length; i++) {
        divs[i].addEventListener('scroll', lazyLoad, true);
      }
    }
  })();
}
window.addEventListener("scroll", lazyLoad);
window.addEventListener("resize", lazyLoad);
window.addEventListener("orientationchange", lazyLoad);
window.addEventListener("DOMContentLoaded", lazyLoad);
$(function () {
  $('#reveal .tab').on('click', function () {
    $('#reveal .tab.active, #reveal .tab-content.active').removeClass('active');
    $('#reveal .reveal-body').removeClass('collapse');
    $('#reveal').removeClass('collapse');
    $(this).addClass('active');
    $($(this).data('target')).addClass('active');
    Cookies.remove('reveal_size');
  });

  $('#copy_ab_test').on('click', function(event) {
    event.preventDefault();
    var copied_link = $(this).attr('href');
    navigator.clipboard.writeText(copied_link).then(function() {
        $('.copied-ab').css('display', 'inline');
    }).catch(function(error) {
        console.error('Failed to copy text: ', error);
    });
  });

  $('#reveal .minimize').on('click', function() {
    $('#reveal').removeClass('maximized');

    if (!$('#reveal').hasClass('collapse')) {
      Cookies.set('reveal_size', 'collapse');
    }
    else {
      Cookies.remove('reveal_size');
    }

    $('#reveal .reveal-body').toggleClass('collapse');
    $('#reveal').toggleClass('collapse');
  });

  $('#reveal .close').on('click', function() {
    $('#reveal').remove();
    Cookies.remove('reveal');
  });

  $('#reveal .maximize').on('click', function () {
    if (!$('#reveal').hasClass('maximized')) {
      Cookies.set('reveal_size', 'maximized');
    }
    else {
      Cookies.remove('reveal_size');
    }

    $('#reveal').toggleClass('maximized');

    if ($('#reveal').hasClass('maximized')) {
      $('#reveal').removeClass('collapse');
      $('#reveal .reveal-body').removeClass('collapse');
    }
  });
});
/*!
 * 
 *   typed.js - A JavaScript Typing Animation Library
 *   Author: Matt Boldt <me@mattboldt.com>
 *   Version: v2.0.6
 *   Url: https://github.com/mattboldt/typed.js
 *   License(s): MIT
 * 
 */
(function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Typed=e():t.Typed=e()})(this,function(){return function(t){function e(n){if(s[n])return s[n].exports;var i=s[n]={exports:{},id:n,loaded:!1};return t[n].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var s={};return e.m=t,e.c=s,e.p="",e(0)}([function(t,e,s){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var s=0;s<e.length;s++){var n=e[s];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,s,n){return s&&t(e.prototype,s),n&&t(e,n),e}}(),r=s(1),o=s(3),a=function(){function t(e,s){n(this,t),r.initializer.load(this,s,e),this.begin()}return i(t,[{key:"toggle",value:function(){this.pause.status?this.start():this.stop()}},{key:"stop",value:function(){this.typingComplete||this.pause.status||(this.toggleBlinking(!0),this.pause.status=!0,this.options.onStop(this.arrayPos,this))}},{key:"start",value:function(){this.typingComplete||this.pause.status&&(this.pause.status=!1,this.pause.typewrite?this.typewrite(this.pause.curString,this.pause.curStrPos):this.backspace(this.pause.curString,this.pause.curStrPos),this.options.onStart(this.arrayPos,this))}},{key:"destroy",value:function(){this.reset(!1),this.options.onDestroy(this)}},{key:"reset",value:function(){var t=arguments.length<=0||void 0===arguments[0]||arguments[0];clearInterval(this.timeout),this.replaceText(""),this.cursor&&this.cursor.parentNode&&(this.cursor.parentNode.removeChild(this.cursor),this.cursor=null),this.strPos=0,this.arrayPos=0,this.curLoop=0,t&&(this.insertCursor(),this.options.onReset(this),this.begin())}},{key:"begin",value:function(){var t=this;this.typingComplete=!1,this.shuffleStringsIfNeeded(this),this.insertCursor(),this.bindInputFocusEvents&&this.bindFocusEvents(),this.timeout=setTimeout(function(){t.currentElContent&&0!==t.currentElContent.length?t.backspace(t.currentElContent,t.currentElContent.length):t.typewrite(t.strings[t.sequence[t.arrayPos]],t.strPos)},this.startDelay)}},{key:"typewrite",value:function(t,e){var s=this;this.fadeOut&&this.el.classList.contains(this.fadeOutClass)&&(this.el.classList.remove(this.fadeOutClass),this.cursor&&this.cursor.classList.remove(this.fadeOutClass));var n=this.humanizer(this.typeSpeed),i=1;return this.pause.status===!0?void this.setPauseStatus(t,e,!0):void(this.timeout=setTimeout(function(){e=o.htmlParser.typeHtmlChars(t,e,s);var n=0,r=t.substr(e);if("^"===r.charAt(0)&&/^\^\d+/.test(r)){var a=1;r=/\d+/.exec(r)[0],a+=r.length,n=parseInt(r),s.temporaryPause=!0,s.options.onTypingPaused(s.arrayPos,s),t=t.substring(0,e)+t.substring(e+a),s.toggleBlinking(!0)}if("`"===r.charAt(0)){for(;"`"!==t.substr(e+i).charAt(0)&&(i++,!(e+i>t.length)););var u=t.substring(0,e),l=t.substring(u.length+1,e+i),c=t.substring(e+i+1);t=u+l+c,i--}s.timeout=setTimeout(function(){s.toggleBlinking(!1),e===t.length?s.doneTyping(t,e):s.keepTyping(t,e,i),s.temporaryPause&&(s.temporaryPause=!1,s.options.onTypingResumed(s.arrayPos,s))},n)},n))}},{key:"keepTyping",value:function(t,e,s){0===e&&(this.toggleBlinking(!1),this.options.preStringTyped(this.arrayPos,this)),e+=s;var n=t.substr(0,e);this.replaceText(n),this.typewrite(t,e)}},{key:"doneTyping",value:function(t,e){var s=this;this.options.onStringTyped(this.arrayPos,this),this.toggleBlinking(!0),this.arrayPos===this.strings.length-1&&(this.complete(),this.loop===!1||this.curLoop===this.loopCount)||(this.timeout=setTimeout(function(){s.backspace(t,e)},this.backDelay))}},{key:"backspace",value:function(t,e){var s=this;if(this.pause.status===!0)return void this.setPauseStatus(t,e,!0);if(this.fadeOut)return this.initFadeOut();this.toggleBlinking(!1);var n=this.humanizer(this.backSpeed);this.timeout=setTimeout(function(){e=o.htmlParser.backSpaceHtmlChars(t,e,s);var n=t.substr(0,e);if(s.replaceText(n),s.smartBackspace){var i=s.strings[s.arrayPos+1];i&&n===i.substr(0,e)?s.stopNum=e:s.stopNum=0}e>s.stopNum?(e--,s.backspace(t,e)):e<=s.stopNum&&(s.arrayPos++,s.arrayPos===s.strings.length?(s.arrayPos=0,s.options.onLastStringBackspaced(),s.shuffleStringsIfNeeded(),s.begin()):s.typewrite(s.strings[s.sequence[s.arrayPos]],e))},n)}},{key:"complete",value:function(){this.options.onComplete(this),this.loop?this.curLoop++:this.typingComplete=!0}},{key:"setPauseStatus",value:function(t,e,s){this.pause.typewrite=s,this.pause.curString=t,this.pause.curStrPos=e}},{key:"toggleBlinking",value:function(t){if(this.cursor&&!this.pause.status&&this.cursorBlinking!==t){this.cursorBlinking=t;var e=t?"infinite":0;this.cursor.style.animationIterationCount=e}}},{key:"humanizer",value:function(t){return Math.round(Math.random()*t/2)+t}},{key:"shuffleStringsIfNeeded",value:function(){this.shuffle&&(this.sequence=this.sequence.sort(function(){return Math.random()-.5}))}},{key:"initFadeOut",value:function(){var t=this;return this.el.className+=" "+this.fadeOutClass,this.cursor&&(this.cursor.className+=" "+this.fadeOutClass),setTimeout(function(){t.arrayPos++,t.replaceText(""),t.strings.length>t.arrayPos?t.typewrite(t.strings[t.sequence[t.arrayPos]],0):(t.typewrite(t.strings[0],0),t.arrayPos=0)},this.fadeOutDelay)}},{key:"replaceText",value:function(t){this.attr?this.el.setAttribute(this.attr,t):this.isInput?this.el.value=t:"html"===this.contentType?this.el.innerHTML=t:this.el.textContent=t}},{key:"bindFocusEvents",value:function(){var t=this;this.isInput&&(this.el.addEventListener("focus",function(e){t.stop()}),this.el.addEventListener("blur",function(e){t.el.value&&0!==t.el.value.length||t.start()}))}},{key:"insertCursor",value:function(){this.showCursor&&(this.cursor||(this.cursor=document.createElement("span"),this.cursor.className="typed-cursor",this.cursor.innerHTML=this.cursorChar,this.el.parentNode&&this.el.parentNode.insertBefore(this.cursor,this.el.nextSibling)))}}]),t}();e["default"]=a,t.exports=e["default"]},function(t,e,s){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var s=arguments[e];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(t[n]=s[n])}return t},o=function(){function t(t,e){for(var s=0;s<e.length;s++){var n=e[s];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,s,n){return s&&t(e.prototype,s),n&&t(e,n),e}}(),a=s(2),u=n(a),l=function(){function t(){i(this,t)}return o(t,[{key:"load",value:function(t,e,s){if("string"==typeof s?t.el=document.querySelector(s):t.el=s,t.options=r({},u["default"],e),t.isInput="input"===t.el.tagName.toLowerCase(),t.attr=t.options.attr,t.bindInputFocusEvents=t.options.bindInputFocusEvents,t.showCursor=!t.isInput&&t.options.showCursor,t.cursorChar=t.options.cursorChar,t.cursorBlinking=!0,t.elContent=t.attr?t.el.getAttribute(t.attr):t.el.textContent,t.contentType=t.options.contentType,t.typeSpeed=t.options.typeSpeed,t.startDelay=t.options.startDelay,t.backSpeed=t.options.backSpeed,t.smartBackspace=t.options.smartBackspace,t.backDelay=t.options.backDelay,t.fadeOut=t.options.fadeOut,t.fadeOutClass=t.options.fadeOutClass,t.fadeOutDelay=t.options.fadeOutDelay,t.isPaused=!1,t.strings=t.options.strings.map(function(t){return t.trim()}),"string"==typeof t.options.stringsElement?t.stringsElement=document.querySelector(t.options.stringsElement):t.stringsElement=t.options.stringsElement,t.stringsElement){t.strings=[],t.stringsElement.style.display="none";var n=Array.prototype.slice.apply(t.stringsElement.children),i=n.length;if(i)for(var o=0;o<i;o+=1){var a=n[o];t.strings.push(a.innerHTML.trim())}}t.strPos=0,t.arrayPos=0,t.stopNum=0,t.loop=t.options.loop,t.loopCount=t.options.loopCount,t.curLoop=0,t.shuffle=t.options.shuffle,t.sequence=[],t.pause={status:!1,typewrite:!0,curString:"",curStrPos:0},t.typingComplete=!1;for(var o in t.strings)t.sequence[o]=o;t.currentElContent=this.getCurrentElContent(t),t.autoInsertCss=t.options.autoInsertCss,this.appendAnimationCss(t)}},{key:"getCurrentElContent",value:function(t){var e="";return e=t.attr?t.el.getAttribute(t.attr):t.isInput?t.el.value:"html"===t.contentType?t.el.innerHTML:t.el.textContent}},{key:"appendAnimationCss",value:function(t){if(t.autoInsertCss&&t.showCursor&&t.fadeOut){var e=document.createElement("style");e.type="text/css";var s="";t.showCursor&&(s+="\n        .typed-cursor{\n          opacity: 1;\n          animation: typedjsBlink 0.7s infinite;\n          -webkit-animation: typedjsBlink 0.7s infinite;\n                  animation: typedjsBlink 0.7s infinite;\n        }\n        @keyframes typedjsBlink{\n          50% { opacity: 0.0; }\n        }\n        @-webkit-keyframes typedjsBlink{\n          0% { opacity: 1; }\n          50% { opacity: 0.0; }\n          100% { opacity: 1; }\n        }\n      "),t.fadeOut&&(s+="\n        .typed-fade-out{\n          opacity: 0;\n          transition: opacity .25s;\n          -webkit-animation: 0;\n                  animation: 0;\n        }\n      "),0!==e.length&&(e.innerHTML=s,document.body.appendChild(e))}}}]),t}();e["default"]=l;var c=new l;e.initializer=c},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s={strings:["These are the default values...","You know what you should do?","Use your own!","Have a great day!"],stringsElement:null,typeSpeed:0,startDelay:0,backSpeed:0,smartBackspace:!0,shuffle:!1,backDelay:700,fadeOut:!1,fadeOutClass:"typed-fade-out",fadeOutDelay:500,loop:!1,loopCount:1/0,showCursor:!0,cursorChar:"|",autoInsertCss:!0,attr:null,bindInputFocusEvents:!1,contentType:"html",onComplete:function(t){},preStringTyped:function(t,e){},onStringTyped:function(t,e){},onLastStringBackspaced:function(t){},onTypingPaused:function(t,e){},onTypingResumed:function(t,e){},onReset:function(t){},onStop:function(t,e){},onStart:function(t,e){},onDestroy:function(t){}};e["default"]=s,t.exports=e["default"]},function(t,e){"use strict";function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){for(var s=0;s<e.length;s++){var n=e[s];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,s,n){return s&&t(e.prototype,s),n&&t(e,n),e}}(),i=function(){function t(){s(this,t)}return n(t,[{key:"typeHtmlChars",value:function(t,e,s){if("html"!==s.contentType)return e;var n=t.substr(e).charAt(0);if("<"===n||"&"===n){var i="";for(i="<"===n?">":";";t.substr(e+1).charAt(0)!==i&&(e++,!(e+1>t.length)););e++}return e}},{key:"backSpaceHtmlChars",value:function(t,e,s){if("html"!==s.contentType)return e;var n=t.substr(e).charAt(0);if(">"===n||";"===n){var i="";for(i=">"===n?"<":"&";t.substr(e-1).charAt(0)!==i&&(e--,!(e<0)););e--}return e}}]),t}();e["default"]=i;var r=new i;e.htmlParser=r}])});


var typed;

typed = function() {
  return $.each($('.typed-js'), function(key, value) {
    var typed2;
    return typed2 = new Typed(this, {
      strings: $(this).data('typed-js-values'),
      typeSpeed: 140,
      backSpeed: 40,
      backDelay: 2000,
      cursorChar: '',
      loop: true
    });
  });
};

$(function() {
  return typed();
});

$(function() {
  return $('.load-more').on('click', function(e) {
    $(this).siblings('.facet-list-wrapper').addClass('show');
    e.preventDefault();
    $(this).siblings('.facet-list-wrapper').find('a:nth-of-type(6)').focus();
    return $(this).hide();
  });
});
$(function() {
  if ($('.trending-job-searches')) {
    $('.trending-job-searches').find('.treding-job-wrapper').each(function(index, element){ 
      var h3 = $(element).find('h3.pb')
      var link = $(element).find('.facet-list-wrapper p a:first-of-type');
      link.attr('aria-label', link.text() + ', in ' + h3.text());
    });
  }
});
(function() {
  $(function() {
    var list_fix;
    list_fix = function() {
      if ($('ul.list').length > 0) {
        return $('ul.list li').each(function() {
          var title;
          title = $(this).find('a.list-title');
          if ($(this).innerWidth() === title.width() + 16) {
            return title.css({
              'padding-top': '8px'
            });
          } else {
            return title.css({
              'padding-top': '16px'
            });
          }
        });
      }
    };
    if ($(window).width() < 1029) {
      list_fix();
    } else {
      $('ul.list li a.list-title').css({
        'padding-top': '0'
      });
    }
    return $(window).resize(function() {
      if ($(window).width() < 1029) {
        return list_fix();
      } else {
        return $('ul.list li a.list-title').css({
          'padding-top': '0'
        });
      }
    });
  });

}).call(this);
(function() {
  $(function() {
    if ($('.col-flexible').length) {
      return $('.col-flexible').each(function() {
        var $cols, $parent, height, marginR, width;
        $parent = $(this);
        $cols = $parent.find('.col');
        height = 0;
        marginR = 2;
        width = (100 - (($cols.length - 1) * marginR)) / $cols.length + '%';
        $cols.css('width', width);
        $parent.find(".col:nth-child(" + $cols.length + "n)").css('margin-right', 0);
        $cols.each(function() {
          if ($(this).height() > height) {
            return height = $(this).height();
          }
        });
        if ($parent.find('a.block').length) {
          height = height + 30;
        }
        return $cols.css('height', height + 'px');
      });
    }
  });

}).call(this);
$(document).ready(function() {

  $(document).on('click', '.easy-apply-modal-link', function (e) {
    e.preventDefault();

    $('#easy_apply_hybrid').remodal().open();
  });

  $(document).on('opened', '[data-remodal-id=easy_apply_hybrid]', function () {
    modalFocusTrap('[data-remodal-id=easy_apply_hybrid]');
  });

  $(document).on('click', '#documents_contact_pref_only, #profile_contact_pref_only', function (e) {
    e.preventDefault();

    $('[data-remodal-id=profile_resume_new_modal]').remodal().open();
  });

  $(document).on('confirmation', '#save_remodal', function () {
        $('#save_remodal').remodal().destroy();
    });

    if($('[data-remodal-id=anon_reco_job_alert_modal]').length > 0 && !isMobile.phone && !isMobile.tablet && Cookies.get('jrp_popup') == undefined){
      setTimeout(function(){
        $('[data-remodal-id=anon_reco_job_alert_modal]').remodal().open();
      }, 5000);
      Cookies.set('jrp_popup', 'showed', { expires: 1 });
    }

    if($('[data-remodal-id=anon_reco_job_skin_alert_modal]').length > 0){
        $('[data-remodal-id=anon_reco_job_skin_alert_modal]').remodal().open();
    }

    if($('[data-remodal-id=anon_reco_job_alert_modal_reco]').length > 0){
        $('[data-remodal-id=anon_reco_job_alert_modal_reco]').remodal().open();
    }

    if($('[data-remodal-id=bulk_apply_success]').length > 0){
        $('[data-remodal-id=bulk_apply_success]').remodal().open();
    }

  if($('[data-remodal-id=jdp_job_alert_modal]').length > 0 && !isMobile.phone && !isMobile.tablet && Cookies.get('jdp_popup') == undefined){
    setTimeout(function(){
       $('[data-remodal-id=jdp_job_alert_modal]').remodal().open();
       window.location.hash = "";
    }, 5000);

    // Open modal only two times per session
    if(Cookies.get('jdp_popup_first_time') !== undefined)
      Cookies.set('jdp_popup', 'showed');

    Cookies.set('jdp_popup_first_time', 'showed');
  }

  $(document).on('confirmation', '#confirm_replace_cv', function () {
    $('#form_new_cv').submit()
  });

  $(document).on('click', '.cbes-info', function (event) {
    if(!isDesktop()) {
      $('[data-remodal-id=cbes_tooltip_modal]').remodal().open();
    }
  });

  $(document).on('closing', '#update_temp_password_modal', function (event) {
    // Show modal only once per day
    Cookies.set('update_temp_password_modal', 'shown', { expires: 1 });
    window.dataLayer.push({"event": "data-gtm", "gtm_action": "update-temp-password-modal", "gtm_label": "modal-cancel"});
  });
});
$(document).on('click', '#sign-in-link', function (event) {
  event.preventDefault();

  $(event.target).attr('aria-expanded', true)

  $('[data-remodal-id=sign_in_modal]').remodal().open();
  initFormMaterial();
});

$(document).on('closed', '#sign-in-modal.remodal', function (e) {
  $('#sign-in-link').attr('aria-expanded', false)
});

$(document).on('click', '#save-job-index', function (event) {
  event.preventDefault();
  sessionStorage.setItem("jobId", event.currentTarget.dataset.jobid);
  $('[data-remodal-id=sign_in_modal]').remodal().open();
  initFormMaterial();
});

$(document).on('click', '#tn-site-settings-link', function (event) {
  event.preventDefault();

  $(event.target).attr('aria-expanded', true)

  $('[data-remodal-id=site-settings-modal]').remodal().open();
});

$(document).on('closed', '#site-settings-modal.remodal', function (e) {
  $('#tn-site-settings-link').attr('aria-expanded', false)
});
$(document).ready( function() {
  var did = sessionStorage.getItem("jobId");
  if (did) {
    $.ajax({
      type: "POST",
      url: "savedjob/create/" + did,
      async: true,
      success: function () {
        sessionStorage.removeItem('jobId');
      }
    })
  }
});
$(document).ready(function () {
  $( document ).ajaxComplete(function() {
    if($('.tn-flash-message').length > 0){
      setTimeout(function(){
        $('.tn-flash-message').fadeOut();
      }, 3000);
    }
  });
});

(function() {
  var saveFavJobsAPICall;

  $(document).ready(function() {
    $(document).on('click', '.data-results-save-job', function() {
      var _self, callMethod, requested_url;
      _self = $(this);
      requested_url = _self.attr('data-saved-jobdid');
      if (SSO_logged_in && _self.is('[data-saved-jobdid]')) {
        callMethod = 'POST';
        if (_self.hasClass('saved')) {
          callMethod = 'DELETE';
        }
        return saveFavJobsAPICall(requested_url, callMethod);
      } else {
        if (_self.is('[data-saved-jobdid]')) {
          return location.href = requested_url;
        }
      }
    });
    return $(document).on('click', 'button.data-results-save-job', function() {
      return $(this).html(I18n.t('js.spin_icon'));
    });
  });

  saveFavJobsAPICall = function(urldata, callType) {
    return $.ajax({
      url: urldata,
      type: callType,
      async: true
    });
  };

  this.removeSavedJobFlashMessage = function() {
    if ($(".saved-job-flash-message").length > 0) {
      return $(".saved-job-flash-message").remove();
    }
  };

  this.hideSavedJobFlashMessage = function() {
    return setTimeout(function() {
      return $(".saved-job-flash-message").slideUp("slow", function() {
        return $(".saved-job-flash-message").remove();
      });
    }, 3000);
  };

}).call(this);
(function() {
  $(function() {
    if ($('.job-alert').length > 0) {
      $('#email').on("blur", function() {
        return isEmailValidation($(this));
      });
      $('#submit-anon-saved-search').on("click", function(e) {
        var email_field;
        email_field = $('#email_job_alert');
        if (isEmail(email_field.val())) {
          Cookies.set('jdp_popup', 'showed');
        }
        return isEmailValidation(email_field);
      });
      $('#submit-anon-saved-search-widget').on("click", function(e) {
        var email_field;
        email_field = $('#email_job_alert_widget');
        if (isEmail(email_field.val())) {
          Cookies.set('jdp_popup', 'showed');
        }
        return isEmailValidation(email_field);
      });
      return $('#submit-anon-saved-search-advice').on("click", function(e) {
        var email_field;
        email_field = $('#email_job_alert_advice');
        if (isEmail(email_field.val())) {
          Cookies.set('jdp_popup', 'showed');
        }
        return isEmailValidation(email_field);
      });
    }
  });

}).call(this);
(function() {
  $(function() {
    if ($('#job-alert-sign-up').length > 0) {
      $('#submit-job-alert-sign-up').click(function() {
        isEmailValidation($('#email'));
        isEmptyValidation($('#keywords'));
        return submitValidation();
      });
      $('#email').bind('blur keyup', function(e) {
        return eventsValidations(e, this, isEmptyValidation, false);
      });
      return $('#keywords').bind('blur keyup', function(e) {
        return eventsValidations(e, this, isEmptyValidation, false);
      });
    }
  });

}).call(this);
(function() {
  this.requirements_validation = function() {
    return $('input[name="have_requi"]').on("change", function() {
      isCheckedValidation($(this));
      if ($(this).val() === 'yes') {
        $('#external-submit').attr('disabled', false);
        return $('.continue-btn').attr('disabled', false);
      } else {
        $('#external-submit').attr('disabled', true);
        return $('.continue-btn').attr('disabled', true);
      }
    });
  };

  this.externalEmailValidation = function() {
    var $visibleModal;
    $visibleModal = $('.remodal').not(":hidden");
    isOkExternalFields();
    $visibleModal.find('#fake-captcha-id, #us_eligible').bind("change", isOkExternalFields);
    return $visibleModal.find('#externalemail').bind("blur keyup", function(e) {
      var $currentForm;
      $currentForm = $(this).closest('.form-material');
      if ($(this).val()) {
        if (isEmail($(this).val())) {
          isEmailValidation($(this));
          isOkExternalFields();
        } else {
          $currentForm.find('#external-submit').attr('disabled', true);
        }
        if (e.type === 'blur' && !isEmail($(this).val())) {
          isEmailValidation($(this));
          return isOkExternalFields();
        }
      } else if (e.type === 'blur') {
        isEmptyValidation($(this));
        return $currentForm.find('#external-submit').attr('disabled', true);
      }
    });
  };

  this.isOkExternalFields = function() {
    var $visibleModal;
    $visibleModal = $('.remodal').not(":hidden");
    if (isEmail($visibleModal.find('#externalemail').val()) && $visibleModal.find('#fake-captcha-id').is(':checked') && $visibleModal.find('#us_eligible').is(':checked')) {
      return $visibleModal.find('#external-submit').attr('disabled', false);
    } else {
      return $visibleModal.find('#external-submit').attr('disabled', true);
    }
  };

}).call(this);
(function() {
  $(function() {
    $('.breadcrumbs a').on('click', function(e) {
      dataLayer.push({
        "event": "data-gtm",
        "gtm_action": "breadcrumbs",
        "gtm_label": "click"
      });
      return true;
    });
    $('.header-logo, .sf-mini-logo').on('click', function() {
      dataLayer.push({
        "event": "data-gtm",
        "gtm_action": "header",
        "gtm_label": "logo"
      });
      return true;
    });
    $('#my-profile-link').on('click', function() {
      dataLayer.push({
        "event": "data-gtm",
        "gtm_action": "header",
        "gtm_label": "mycb"
      });
      return true;
    });
    $('#find-jobs-link').on('click', function() {
      dataLayer.push({
        "event": "data-gtm",
        "gtm_action": "header",
        "gtm_label": "jobsearch"
      });
      return true;
    });
    $('#cv-upload-link').on('click', function() {
      dataLayer.push({
        "event": "data-gtm",
        "gtm_action": "header",
        "gtm_label": "add-resume"
      });
      return true;
    });
    $('#reco-link').on('click', function() {
      dataLayer.push({
        "event": "data-gtm",
        "gtm_action": "header",
        "gtm_label": "recommendations"
      });
      return true;
    });
    $('#browse-link').on('click', function() {
      dataLayer.push({
        "event": "data-gtm",
        "gtm_action": "header",
        "gtm_label": "browse-jobs"
      });
      return true;
    });
    $('#blog-link').on('click', function() {
      dataLayer.push({
        "event": "data-gtm",
        "gtm_action": "header",
        "gtm_label": "b2c-blog"
      });
      return true;
    });
    $('#logout-link').on('click', function() {
      dataLayer.push({
        "event": "data-gtm",
        "gtm_action": "header",
        "gtm_label": "sign-out"
      });
      return true;
    });
    $('#signin-link').on('click', function() {
      dataLayer.push({
        "event": "data-gtm",
        "gtm_action": "header",
        "gtm_label": "sign-in"
      });
      return true;
    });
    $('#employers-link').on('click', function() {
      dataLayer.push({
        "event": "data-gtm",
        "gtm_action": "header",
        "gtm_label": "b2b-portal"
      });
      return true;
    });
    $('#employers-sign-in').on('click', function() {
      dataLayer.push({
        "event": "data-gtm",
        "gtm_action": "header",
        "gtm_label": "sign-in"
      });
      return true;
    });
    $('#search-cv-link').on('click', function() {
      dataLayer.push({
        "event": "data-gtm",
        "gtm_action": "header",
        "gtm_label": "b2b-ecommerce-cvsearch"
      });
      return true;
    });
    $('#post-link').on('click', function() {
      dataLayer.push({
        "event": "data-gtm",
        "gtm_action": "header",
        "gtm_label": "b2b-ecommerce-postjobs"
      });
      return true;
    });
    $('#cookie-policy').on('click', function() {
      dataLayer.push({
        "event": "data-gtm",
        "gtm_action": "header",
        "gtm_label": "cookie-policy"
      });
      return true;
    });
    $('#btn-cookie').on('click', function() {
      dataLayer.push({
        "event": "data-gtm",
        "gtm_action": "header",
        "gtm_label": "cookie-close"
      });
      return true;
    });
    $('.browse-jobs-link').on('click', function() {
      dataLayer.push({
        "event": "data-gtm",
        "gtm_action": "footer",
        "gtm_label": "browse-jobs-category"
      });
      return true;
    });
    $('#employers-site-link').on('click', function() {
      dataLayer.push({
        "event": "data-gtm",
        "gtm_action": "footer",
        "gtm_label": "b2b-portal"
      });
      return true;
    });
    $('#footer-post-link').on('click', function() {
      dataLayer.push({
        "event": "data-gtm",
        "gtm_action": "footer",
        "gtm_label": "b2b-ecommerce-postjobs"
      });
      return true;
    });
    $('#footer-search-cv-link').on('click', function() {
      dataLayer.push({
        "event": "data-gtm",
        "gtm_action": "footer",
        "gtm_label": "b2b-ecommerce-cvsearch"
      });
      return true;
    });
    $('#terms-link').on('click', function() {
      dataLayer.push({
        "event": "data-gtm",
        "gtm_action": "footer",
        "gtm_label": "terms"
      });
      return true;
    });
    $('#privacy-link').on('click', function() {
      dataLayer.push({
        "event": "data-gtm",
        "gtm_action": "footer",
        "gtm_label": "privacy-policy"
      });
      return true;
    });
    $('#about-link').on('click', function() {
      dataLayer.push({
        "event": "data-gtm",
        "gtm_action": "footer",
        "gtm_label": "about-us"
      });
      return true;
    });
    $('#work-link').on('click', function() {
      dataLayer.push({
        "event": "data-gtm",
        "gtm_action": "footer",
        "gtm_label": "work-at-careerbuilder"
      });
      return true;
    });
    $('#fb-link').on('click', function() {
      dataLayer.push({
        "event": "data-gtm",
        "gtm_action": "footer",
        "gtm_label": "facebook"
      });
      return true;
    });
    $('#ld-link').on('click', function() {
      dataLayer.push({
        "event": "data-gtm",
        "gtm_action": "footer",
        "gtm_label": "linkedin"
      });
      return true;
    });
    $('#upload-cv').on('click', function(e) {
      dataLayer.push({
        "event": "data-gtm",
        "gtm_action": "homev2",
        "gtm_label": "upload_cv_link"
      });
      return true;
    });
    $('#home #sbmt').on('click', function(e) {
      if ($("#Keywords").val() !== "" && $('#Location').val() === "") {
        dataLayer.push({
          "event": "data-gtm",
          "gtm_action": "homev2",
          "gtm_label": "search job submit with keywords"
        });
        return true;
      } else if ($('#Location').val() !== "" && $("#Keywords").val() === "") {
        dataLayer.push({
          "event": "data-gtm",
          "gtm_action": "homev2",
          "gtm_label": "search job submit with location"
        });
        return true;
      } else if ($("#Keywords").val() !== "" && $('#Location').val() !== "") {
        dataLayer.push({
          "event": "data-gtm",
          "gtm_action": "homev2",
          "gtm_label": "search job submit with keywords and location"
        });
        return true;
      } else if ($('#Location').val() === "" && $("#Keywords").val() === "") {
        dataLayer.push({
          "event": "data-gtm",
          "gtm_action": "homev2",
          "gtm_label": "search job submit with no criteria"
        });
        return true;
      }
    });
    $('#jobs #sbmt').on('click', function(e) {
      if ($('.job').length === 0) {
        dataLayer.push({
          "event": "data-gtm",
          "gtm_action": "jobsv2",
          "gtm_label": "No results"
        });
        true;
      }
      if ($("#Keywords").val() !== "" && $('#Location').val() === "") {
        dataLayer.push({
          "event": "data-gtm",
          "gtm_action": "jobsv2",
          "gtm_label": "search job submit with keywords"
        });
        return true;
      } else if ($('#Location').val() !== "" && $("#Keywords").val() === "") {
        dataLayer.push({
          "event": "data-gtm",
          "gtm_action": "jobsv2",
          "gtm_label": "search job submit with location"
        });
        return true;
      } else if ($("#Keywords").val() !== "" && $('#Location').val() !== "") {
        dataLayer.push({
          "event": "data-gtm",
          "gtm_action": "jobsv2",
          "gtm_label": "search job submit with keywords and location"
        });
        return true;
      } else if ($('#Location').val() === "" && $("#Keywords").val() === "") {
        dataLayer.push({
          "event": "data-gtm",
          "gtm_action": "jobsv2",
          "gtm_label": "search job submit with no criteria"
        });
        return true;
      }
    });
    $('#jdp .btn-primary').on('click', function() {
      dataLayer.push({
        "event": "data-gtm",
        "gtm_action": "jdpv2",
        "gtm_label": "apply button"
      });
      return true;
    });
    $('#save_remodal .btn-primary').on('click', function() {
      dataLayer.push({
        'event': 'save_jobs_success'
      });
      return true;
    });
    $('#similar-jobs a').one('click', function() {
      var position;
      position = $(this).data('similar-jobs-position');
      dataLayer.push({
        "event": "data-gtm",
        "gtm_action": "jdp-similar-jobs",
        "gtm_label": "job-title-click-sidebar-" + position
      });
      return true;
    });
    $('#registered-apply #add-resume').on('click', function() {
      dataLayer.push({
        "event": "data-gtm",
        "gtm_action": "registered-apply",
        "gtm_label": "add resume"
      });
      return true;
    });
    $('#registered-apply-no-cv #add-resume').on('click', function() {
      dataLayer.push({
        "event": "data-gtm",
        "gtm_action": "registered-apply-no-cv",
        "gtm_label": "add resume"
      });
      return true;
    });
    if ($('#home .flash-message.success').text() === I18n.t('js.account_removed')) {
      dataLayer.push({
        "event": "data-gtm",
        "gtm_action": "delete-account",
        "gtm_label": "success"
      });
    }
    if ($('#reco .flash-message.error').length > 0) {
      dataLayer.push({
        "event": "data-gtm",
        "gtm_action": "recommended-jobs",
        "gtm_label": "expired jobs"
      });
    } else if ($('#reco .flash-message.success').length > 0) {
      dataLayer.push({
        "event": "data-gtm",
        "gtm_action": "recommended-jobs",
        "gtm_label": "after apply"
      });
    } else if ($('#reco').length > 0) {
      dataLayer.push({
        "event": "data-gtm",
        "gtm_action": "recommended-jobs",
        "gtm_label": "regular"
      });
    }
    $('#resume-upload #submit-upload-review').on('click', function() {
      if ($('#resume-upload #review').prop('checked')) {
        dataLayer.push({
          "event": "data-gtm",
          "gtm_action": "upload-resume",
          "gtm_label": "submit with free review"
        });
        return true;
      }
    });
    $('#resume-upload #submit-upload').on('click', function() {
      dataLayer.push({
        "event": "data-gtm",
        "gtm_action": "upload-resume",
        "gtm_label": "submit without free review"
      });
      return true;
    });
    $('#register-modal-form #submit-upload').on('click', function() {
      dataLayer.push({
        "event": "external",
        "gtm_action": "apply-now-click",
        "gtm_label": "external-apply-with-registration-submit"
      });
      return true;
    });
    $('#register-modal-form .upload-file').on('click', function() {
      dataLayer.push({
        "event": "resumev2-file-picker",
        "gtm_action": "page-interaction",
        "gtm_label": "textfield"
      });
      return true;
    });
    return $('#external-apply-without-registration-submit').on('click', function() {
      dataLayer.push({
        "event": "external",
        "gtm_action": "apply-now-click",
        "gtm_label": "external-apply-without-registration-submit"
      });
      return true;
    });
  });

}).call(this);
/*
 * easy-autocomplete
 * jQuery plugin for autocompletion
 * 
 * @author Łukasz Pawełczak (http://github.com/pawelczak)
 * @version 1.3.5
 * Copyright  License: 
 */

var EasyAutocomplete=function(t){return t.main=function(e,n){var i,a=new t.Constans,o=new t.Configuration(n),r=new t.Logger,s=new t.Template(n.template),c=new t.ListBuilderService(o,t.proccess),u=o.equals,l=e,f="",d=[],g=-1;function m(){var t;function e(t,e){return o.get("highlightPhrase")&&""!==e?function(t,e){var n=(i=e,i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"));var i;return(t+"").replace(new RegExp("("+n+")","gi"),"<b>$1</b>")}(t,e):t}l.parent().hasClass(a.getValue("WRAPPER_CSS_CLASS"))&&(l.next("."+a.getValue("CONTAINER_CLASS")).remove(),l.unwrap()),function(){var t=$("<div>"),e=a.getValue("WRAPPER_CSS_CLASS");o.get("theme")&&""!==o.get("theme")&&(e+=" eac-"+o.get("theme"));o.get("cssClasses")&&""!==o.get("cssClasses")&&(e+=" "+o.get("cssClasses"));""!==s.getTemplateClass()&&(e+=" "+s.getTemplateClass());t.addClass(e),l.wrap(t),!0===o.get("adjustWidth")&&(n=l.outerWidth(),l.parent().css("width",n));var n}(),(t=$("<div>").addClass(a.getValue("CONTAINER_CLASS"))).attr("id",p()).prepend($("<ul>")),t.on("show.eac",function(){switch(o.get("list").showAnimation.type){case"slide":var e=o.get("list").showAnimation.time,n=o.get("list").showAnimation.callback;t.find("ul").slideDown(e,n);break;case"fade":var e=o.get("list").showAnimation.time,n=o.get("list").showAnimation.callback;t.find("ul").fadeIn(e);break;default:t.find("ul").show()}o.get("list").onShowListEvent()}).on("hide.eac",function(){switch(o.get("list").hideAnimation.type){case"slide":var e=o.get("list").hideAnimation.time,n=o.get("list").hideAnimation.callback;t.find("ul").slideUp(e,n);break;case"fade":var e=o.get("list").hideAnimation.time,n=o.get("list").hideAnimation.callback;t.find("ul").fadeOut(e,n);break;default:t.find("ul").hide()}o.get("list").onHideListEvent()}).on("selectElement.eac",function(){t.find("ul li:not('.eac-category')").removeClass("selected"),t.find("ul li:not('.eac-category')").eq(g).addClass("selected"),o.get("list").onSelectItemEvent()}).on("loadElements.eac",function(n,i,a){var r="",c=t.find("ul");c.empty().detach(),d=[];for(var u=0,f=0,m=i.length;f<m;f+=1){var p=i[f].data;if(0!==p.length){void 0!==i[f].header&&i[f].header.length>0&&c.append("<li class='eac-category' >"+i[f].header+"</li>");for(var h=0,v=p.length;h<v&&u<i[f].maxListSize;h+=1)r=$("<li><div class='eac-item'></div></li>"),function(){var t=h,n=u,c=i[f].getValue(p[t]);r.find(" > div").on("click",function(){l.val(c).trigger("change"),g=n,y(n),o.get("list").onClickEvent(),o.get("list").onChooseEvent()}).mouseover(function(){g=n,y(n),o.get("list").onMouseOverEvent()}).mouseout(function(){o.get("list").onMouseOutEvent()}).html(s.build(e(c,a),p[t]))}(),c.append(r),d.push(p[h]),u+=1}}t.append(c),o.get("list").onLoadEvent()}),l.after(t),f=$("#"+p()),o.get("placeholder")&&l.attr("placeholder",o.get("placeholder"))}function p(){var t=l.attr("id");return t=a.getValue("CONTAINER_ID")+t}function h(){f.trigger("show.eac")}function v(){f.trigger("hide.eac")}function y(t){f.trigger("selectElement.eac",t)}function E(t,e){f.trigger("loadElements.eac",[t,e])}t.consts=a,this.getConstants=function(){return a},this.getConfiguration=function(){return o},this.getContainer=function(){return f},this.getSelectedItemIndex=function(){return g},this.getItems=function(){return d},this.getItemData=function(t){return d.length<t||void 0===d[t]?-1:d[t]},this.getSelectedItemData=function(){return this.getItemData(g)},this.build=function(){m()},this.init=function(){!function(){if(0===l.length)return void r.error("Input field doesn't exist.");if(!o.checkDataUrlProperties())return void r.error("One of options variables 'data' or 'url' must be defined.");if(!o.checkRequiredProperties())return void r.error("Will not work without mentioned properties.");m(),function(){function t(){l.off("keyup").keyup(function(t){switch(t.keyCode){case 27:v(),l.trigger("blur");break;case 38:t.preventDefault(),d.length>0&&g>0&&(g-=1,l.val(o.get("getValue")(d[g])),y(g));break;case 40:t.preventDefault(),d.length>0&&g<d.length-1&&(g+=1,l.val(o.get("getValue")(d[g])),y(g));break;default:if(t.keyCode>40||8===t.keyCode){var e=l.val();!0!==o.get("list").hideOnEmptyPhrase||8!==t.keyCode||""!==e?o.get("requestDelay")>0?(void 0!==i&&clearTimeout(i),i=setTimeout(function(){n(e)},o.get("requestDelay"))):n(e):v()}}function n(t){if(!(t.length<o.get("minCharNumber"))){if("list-required"!==o.get("data")){var e=o.get("data"),n=c.init(e);n=c.updateCategories(n,e),E(n=c.processData(n,t),t),l.parent().find("li:not('.eac-category')").length>0?h():v()}var i=function(){var t={},e=o.get("ajaxSettings")||{};for(var n in e)t[n]=e[n];return t}();void 0!==i.url&&""!==i.url||(i.url=o.get("url")),void 0!==i.dataType&&""!==i.dataType||(i.dataType=o.get("dataType")),void 0!==i.url&&"list-required"!==i.url&&(i.url=i.url(t),i.data=o.get("preparePostData")(i.data,t),$.ajax(i).done(function(e){var n=c.init(e);n=c.updateCategories(n,e),n=c.convertXml(n),function(t,e){return!1===o.get("matchResponseProperty")||("string"==typeof o.get("matchResponseProperty")?e[o.get("matchResponseProperty")]===t:"function"!=typeof o.get("matchResponseProperty")||o.get("matchResponseProperty")(e)===t)}(t,e)&&E(n=c.processData(n,t),t),c.checkIfDataExists(n)&&l.parent().find("li:not('.eac-category')").length>0?h():v(),o.get("ajaxCallback")()}).fail(function(){r.warning("Fail to load response data")}).always(function(){}))}}})}!function(){u("autocompleteOff",!0)&&l.attr("autocomplete","off");l.focusout(function(){var t,e=l.val();o.get("list").match.caseSensitive||(e=e.toLowerCase());for(var n=0,i=d.length;n<i;n+=1)if(t=o.get("getValue")(d[n]),o.get("list").match.caseSensitive||(t=t.toLowerCase()),t===e)return void y(g=n)}),t(),l.on("keydown",function(t){var e=(t=t||window.event).keyCode;if(38===e)return suppressKeypress=!0,!1}).keydown(function(t){13===t.keyCode&&g>-1&&(l.val(o.get("getValue")(d[g])),o.get("list").onKeyEnterEvent(),o.get("list").onChooseEvent(),g=-1,v(),t.preventDefault())}),l.off("keypress"),l.focus(function(){""!==l.val()&&d.length>0&&(g=-1,h())}),l.blur(function(){setTimeout(function(){g=-1,v()},250)})}()}()}()}},t.eacHandles=[],t.getHandle=function(e){return t.eacHandles[e]},t.inputHasId=function(t){return void 0!==$(t).attr("id")&&$(t).attr("id").length>0},t.assignRandomId=function(e){var n="";do{n="eac-"+Math.floor(1e4*Math.random())}while(0!==$("#"+n).length);elementId=t.consts.getValue("CONTAINER_ID")+n,$(e).attr("id",n)},t.setHandle=function(e,n){t.eacHandles[n]=e},t}((EasyAutocomplete=function(t){return t.Template=function(t){var e={basic:{type:"basic",method:function(t){return t},cssClass:""},description:{type:"description",fields:{description:"description"},method:function(t){return t+" - description"},cssClass:"eac-description"},iconLeft:{type:"iconLeft",fields:{icon:""},method:function(t){return t},cssClass:"eac-icon-left"},iconRight:{type:"iconRight",fields:{iconSrc:""},method:function(t){return t},cssClass:"eac-icon-right"},links:{type:"links",fields:{link:""},method:function(t){return t},cssClass:""},custom:{type:"custom",method:function(){},cssClass:""}};this.getTemplateClass=function(t){var n,i=function(){return""};return t&&t.type&&t.type&&e[t.type]?(n=e[t.type].cssClass,function(){return n}):i}(t),this.build=function(t){return t&&t.type&&t.type&&e[t.type]?(a=(n=t).fields,"description"===n.type?(i=e.description.method,"string"==typeof a.description?i=function(t,e){return t+" - <span>"+e[a.description]+"</span>"}:"function"==typeof a.description&&(i=function(t,e){return t+" - <span>"+a.description(e)+"</span>"}),i):"iconRight"===n.type?("string"==typeof a.iconSrc?i=function(t,e){return t+"<img class='eac-icon' src='"+e[a.iconSrc]+"' />"}:"function"==typeof a.iconSrc&&(i=function(t,e){return t+"<img class='eac-icon' src='"+a.iconSrc(e)+"' />"}),i):"iconLeft"===n.type?("string"==typeof a.iconSrc?i=function(t,e){return"<img class='eac-icon' src='"+e[a.iconSrc]+"' />"+t}:"function"==typeof a.iconSrc&&(i=function(t,e){return"<img class='eac-icon' src='"+a.iconSrc(e)+"' />"+t}),i):"links"===n.type?("string"==typeof a.link?i=function(t,e){return"<a href='"+e[a.link]+"' >"+t+"</a>"}:"function"==typeof a.link&&(i=function(t,e){return"<a href='"+a.link(e)+"' >"+t+"</a>"}),i):"custom"===n.type?n.method:e.basic.method):e.basic.method;var n,i,a}(t)},t}((EasyAutocomplete=function(t){return t.proccess=function(e,n,i){t.proccess.match=o;var a=n.data;return a=function(t){e.get("list").sort.enabled&&t.sort(e.get("list").sort.method);return t}(a=function(t){void 0!==n.maxNumberOfElements&&t.length>n.maxNumberOfElements&&(t=t.slice(0,n.maxNumberOfElements));return t}(a=function(t,n){var i=[];if(e.get("list").match.enabled)for(var a=0,r=t.length;a<r;a+=1)o(e.get("getValue")(t[a]),n)&&i.push(t[a]);else i=t;return i}(a,i)));function o(t,n){return e.get("list").match.caseSensitive||("string"==typeof t&&(t=t.toLowerCase()),n=n.toLowerCase()),!!e.get("list").match.method(t,n)}},t}((EasyAutocomplete=function(t){return t.ListBuilderService=function(t,e){function n(e,n){var i={};if(i="XML"===t.get("dataType").toUpperCase()?function(){var i,a={};void 0!==e.xmlElementName&&(a.xmlElementName=e.xmlElementName);void 0!==e.listLocation?i=e.listLocation:void 0!==t.get("listLocation")&&(i=t.get("listLocation"));void 0!==i?"string"==typeof i?a.data=$(n).find(i):"function"==typeof i&&(a.data=i(n)):a.data=n;return a}():function(){var t={};void 0!==e.listLocation?"string"==typeof e.listLocation?t.data=n[e.listLocation]:"function"==typeof e.listLocation&&(t.data=e.listLocation(n)):t.data=n;return t}(),void 0!==e.header&&(i.header=e.header),void 0!==e.maxNumberOfElements&&(i.maxNumberOfElements=e.maxNumberOfElements),void 0!==t.get("list").maxNumberOfElements&&(i.maxListSize=t.get("list").maxNumberOfElements),void 0!==e.getValue)if("string"==typeof e.getValue){var a=e.getValue;i.getValue=function(t){return t[a]}}else"function"==typeof e.getValue&&(i.getValue=e.getValue);else i.getValue=t.get("getValue");return i}function i(e){var n=[];return void 0===e.xmlElementName&&(e.xmlElementName=t.get("xmlElementName")),$(e.data).find(e.xmlElementName).each(function(){n.push(this)}),n}this.init=function(e){var n=[],i={};return i.data=t.get("listLocation")(e),i.getValue=t.get("getValue"),i.maxListSize=t.get("list").maxNumberOfElements,n.push(i),n},this.updateCategories=function(e,i){if(t.get("categoriesAssigned")){e=[];for(var a=0;a<t.get("categories").length;a+=1){var o=n(t.get("categories")[a],i);e.push(o)}}return e},this.convertXml=function(e){if("XML"===t.get("dataType").toUpperCase())for(var n=0;n<e.length;n+=1)e[n].data=i(e[n]);return e},this.processData=function(n,i){for(var a=0,o=n.length;a<o;a+=1)n[a].data=e(t,n[a],i);return n},this.checkIfDataExists=function(t){for(var e=0,n=t.length;e<n;e+=1)if(void 0!==t[e].data&&t[e].data instanceof Array&&t[e].data.length>0)return!0;return!1}},t}((EasyAutocomplete=function(t){return t.Constans=function(){var t={CONTAINER_CLASS:"easy-autocomplete-container",CONTAINER_ID:"eac-container-",WRAPPER_CSS_CLASS:"easy-autocomplete"};this.getValue=function(e){return t[e]}},t}((EasyAutocomplete=function(t){return t.Logger=function(){this.error=function(t){console.log("ERROR: "+t)},this.warning=function(t){console.log("WARNING: "+t)}},t}((EasyAutocomplete=function(t){return t.Configuration=function(t){var e={data:"list-required",url:"list-required",dataType:"json",listLocation:function(t){return t},xmlElementName:"",getValue:function(t){return t},autocompleteOff:!0,placeholder:!1,ajaxCallback:function(){},matchResponseProperty:!1,list:{sort:{enabled:!1,method:function(t,n){return(t=e.getValue(t))<(n=e.getValue(n))?-1:t>n?1:0}},maxNumberOfElements:6,hideOnEmptyPhrase:!0,match:{enabled:!1,caseSensitive:!1,method:function(t,e){return t.search(e)>-1}},showAnimation:{type:"normal",time:400,callback:function(){}},hideAnimation:{type:"normal",time:400,callback:function(){}},onClickEvent:function(){},onSelectItemEvent:function(){},onLoadEvent:function(){},onChooseEvent:function(){},onKeyEnterEvent:function(){},onMouseOverEvent:function(){},onMouseOutEvent:function(){},onShowListEvent:function(){},onHideListEvent:function(){}},highlightPhrase:!0,theme:"",cssClasses:"",minCharNumber:0,requestDelay:0,adjustWidth:!0,ajaxSettings:{},preparePostData:function(t,e){return t},loggerEnabled:!0,template:"",categoriesAssigned:!1,categories:[{maxNumberOfElements:4}]},n=["ajaxSettings","template"];function i(t,i){!function e(i,a){for(var o in a)void 0===i[o]&&t.log("Property '"+o+"' does not exist in EasyAutocomplete options API."),"object"==typeof i[o]&&-1===$.inArray(o,n)&&e(i[o],a[o])}(e,i)}this.get=function(t){return e[t]},this.equals=function(t,n){return!(!function(t){return void 0!==e[t]&&null!==e[t]}(t)||e[t]!==n)},this.checkDataUrlProperties=function(){return"list-required"!==e.url||"list-required"!==e.data},this.checkRequiredProperties=function(){for(var t in e)if("required"===e[t])return logger.error("Option "+t+" must be defined"),!1;return!0},this.printPropertiesThatDoesntExist=function(t,e){i(t,e)},function(){"xml"===t.dataType&&(t.getValue||(t.getValue=function(t){return $(t).text()}),t.list||(t.list={}),t.list.sort||(t.list.sort={}),t.list.sort.method=function(e,n){return e=t.getValue(e),n=t.getValue(n),e<n?-1:e>n?1:0},t.list.match||(t.list.match={}),t.list.match.method=function(t,e){return t.search(e)>-1});if(void 0!==t.categories&&t.categories instanceof Array){for(var n=[],i=0,a=t.categories.length;i<a;i+=1){var o=t.categories[i];for(var r in e.categories[0])void 0===o[r]&&(o[r]=e.categories[0][r]);n.push(o)}t.categories=n}}(),function(){e=function t(e,n){var i=e||{};for(var a in e)void 0!==n[a]&&null!==n[a]&&("object"!=typeof n[a]||n[a]instanceof Array?i[a]=n[a]:t(e[a],n[a]));void 0!==n.data&&null!==n.data&&"object"==typeof n.data&&(i.data=n.data);return i}(e,t)}(),!0===e.loggerEnabled&&i(console,t),void 0!==t.ajaxSettings&&"object"==typeof t.ajaxSettings?e.ajaxSettings=t.ajaxSettings:e.ajaxSettings={},function(){if("list-required"!==e.url&&"function"!=typeof e.url){var n=e.url;e.url=function(){return n}}if(void 0!==e.ajaxSettings.url&&"function"!=typeof e.ajaxSettings.url){var n=e.ajaxSettings.url;e.ajaxSettings.url=function(){return n}}if("string"==typeof e.listLocation){var i=e.listLocation;"XML"===e.dataType.toUpperCase()?e.listLocation=function(t){return $(t).find(i)}:e.listLocation=function(t){return t[i]}}if("string"==typeof e.getValue){var a=e.getValue;e.getValue=function(t){return t[a]}}void 0!==t.categories&&(e.categoriesAssigned=!0)}()},t}(EasyAutocomplete||{}))||{}))||{}))||{}))||{}))||{}))||{});!function(t){t.fn.easyAutocomplete=function(e){return this.each(function(){var n=t(this),i=new EasyAutocomplete.main(n,e);EasyAutocomplete.inputHasId(n)||EasyAutocomplete.assignRandomId(n),i.init(),EasyAutocomplete.setHandle(i,n.attr("id"))})},t.fn.getSelectedItemIndex=function(){var e=t(this).attr("id");return void 0!==e?EasyAutocomplete.getHandle(e).getSelectedItemIndex():-1},t.fn.getItems=function(){var e=t(this).attr("id");return void 0!==e?EasyAutocomplete.getHandle(e).getItems():-1},t.fn.getItemData=function(e){var n=t(this).attr("id");return void 0!==n&&e>-1?EasyAutocomplete.getHandle(n).getItemData(e):-1},t.fn.getSelectedItemData=function(){var e=t(this).attr("id");return void 0!==e?EasyAutocomplete.getHandle(e).getSelectedItemData():-1}}(jQuery);
(function ($) {

  function checkInputPhraseMatchResponse(config, inputPhrase, data) {
    if (config.get("matchResponseProperty") !== false) {
      if (typeof config.get("matchResponseProperty") === "string") {
        return (data[config.get("matchResponseProperty")] === inputPhrase);
      }

      if (typeof config.get("matchResponseProperty") === "function") {
        return (config.get("matchResponseProperty")(data) === inputPhrase);
      }

      return true;
    } else {
      return true;
    }
  }

  $.fn.updateOptions = function (options) {
    var data = options.data.map(function (d) {
      return options.getValue ? d[options.getValue] : d;
    });

    var inputId = $(this).attr("id"),
        $container = $("#eac-container-" + inputId),
        config = EasyAutocomplete.getHandle(inputId).getConfiguration(),
        inputPhrase = $(this).val(),
        listBuilderService = new EasyAutocomplete.ListBuilderService(config, EasyAutocomplete.proccess),
        listBuilders = listBuilderService.init(data);

    listBuilders = listBuilderService.updateCategories(listBuilders, data);

    listBuilders = listBuilderService.convertXml(listBuilders);
    if (checkInputPhraseMatchResponse(config, inputPhrase, data)) {
      listBuilders = listBuilderService.processData(listBuilders, inputPhrase);
      $container.trigger("loadElements.eac", [listBuilders, inputPhrase]);
      $container.trigger("show.eac");
    }

  };
})(jQuery);
var SettingControlValues = (function () {
  var hostSite = 'RM';
  var countryCode = 'US';
  var resumeMaxUploadFileSize = 1000;
  var resumeFileExtensions = '.docx, .doc, .rtf, .txt, .pdf';
  var androidAppStoreUrl = 'false';
  var iosAppStoreUrl = 'false';
  var employerTypeSetting = 'false';
  var enableGlobalDesign = 'true';
  var enableAjaxIpathUpdate = 'true';
  var RECAPTCHA_SITE_KEY_V3 = '6LcMC9UZAAAAAN29EstJi5rw1deP_ear54w5aCvJ';
  var enableVisitotTracking = 'true';
  var enableSigninGoogleOneTap = 'false';
  var enableValidateLocation = 'false';
  var useCustomGoogleAdsSize = 'false';
  var colabAutoCompleteCaroteneApiVersion = 'v3_1';
  var enableEmptyDefaultLocationForColab = 'false';
  var enableWorkFromHomeFilterV2 = 'true';
  var enableDefaultJobAppliedCount = 'false';
  var enableFastJdpUrlForJrp = 'false';
  var enableCompanySearchOnJrp = 'false';
  var enableOnlyUsedJSForJdpJrpPage = 'false';

  return {
    HostSite: hostSite,
    CountryCode: countryCode,
    ResumeMaxUploadFileSize: resumeMaxUploadFileSize,
    ResumeFileExtensions: resumeFileExtensions,
    AndroidAppStoreUrl: encodeURI(androidAppStoreUrl),
    IosAppStoreUrl: encodeURI(iosAppStoreUrl),
    EmployerTypeSetting: employerTypeSetting,
    EnableGlobalDesign: enableGlobalDesign,
    EnableAjaxIpathUpdate: enableAjaxIpathUpdate,
    RECAPTCHA_SITE_KEY_V3: RECAPTCHA_SITE_KEY_V3,
    EnableVisitorTracking: enableVisitotTracking,
    EnableSigninWithGoogleOneTap: enableSigninGoogleOneTap,
    EnableValidateEnteredLocation: enableValidateLocation,
    UseCustomGoogleAdsSize: useCustomGoogleAdsSize,
    ColabAutoCompleteCaroteneApiVersion: colabAutoCompleteCaroteneApiVersion,
    EnableEmptyDefaultLocationForColab: enableEmptyDefaultLocationForColab,
    EnableWorkFromHomeFilterV2: enableWorkFromHomeFilterV2,
    EnableDefaultJobAppliedCount: enableDefaultJobAppliedCount,
    EnableFastJdpUrlForJrp: enableFastJdpUrlForJrp,
    EnableCompanySearchOnJrp: enableCompanySearchOnJrp,
    EnableOnlyUsedJSForJdpJrpPage: enableOnlyUsedJSForJdpJrpPage
  }
}());

$(document).ready(function () {
  $("#Location, #desired_location_msg").easyAutocomplete({
    url: function(phrase) {
      if(phrase != undefined && phrase != ''){
        actionProgress('#Location', true);
      }
      return "/autocomplete/location/?term=" + phrase;
    },
    list: {
      match: {
        enabled: true
      },
      onClickEvent: function () {
        jobAlertMatched();
      },
      onLoadEvent: function(e) {
        actionProgressRemove('#Location', true);
        showAcHint('#eac-container-Location');
      },
      onShowListEvent: function() {
        showAcHint('#eac-container-Keywords');
        showAcHint('#eac-container-Location');
        accessibilityImprovement('#Location')
      },
      onHideListEvent: function() {
        hideAcHint('#eac-container-Location');
        $('#Location').parents('.autocomplete-accessibility').attr('aria-expanded', 'false')
      },
      onMouseOverEvent: function() {
        accessibilityImprovement('#Location')
      },
      onSelectItemEvent: function() {
        accessibilityImprovement('#Location')
      }
    },
    requestDelay: 400
  });

  if ($(".search-job #Keywords").data("enable-autocomplete-for-search-engine")) {
    $(".search-job #Keywords").easyAutocomplete({
      url: function(phrase) {
        return "/autocomplete/jrp_search/" + phrase;
      },
      requestDelay: 400
    });
  }
  
  if ($('#job-search-form #Keywords, #desired_keywords_msg, #job-alert-keyword #Keywords').data('enable-keywords-autocomplete')) {
    $('#job-search-form #Keywords, #desired_keywords_msg, #job-alert-keyword #Keywords').easyAutocomplete({
      url: function(phrase) {
        if(phrase != undefined && phrase != ''){
          actionProgress('#Keywords', true);
        }
        return '/autocomplete/keywords/carotene_and_skills/' + phrase;
      },
      getValue: "keyword",
      requestDelay: 400,
      categories: categoriesListData(),
      list: {
        maxNumberOfElements: (SettingControlValues.EnableCompanySearchOnJrp == 'true' && Cookies.get('company_search_ab_test') == 'true') ? 9 : 6,
        onClickEvent: function () {
          console.log('JUst testing Location is selected here...');
          jobAlertMatched();
        },
        onLoadEvent: function() { 
          actionProgressRemove('#Keywords', true);
          showAcHint('#eac-container-Keywords');
        },
        onShowListEvent: function() {
          showAcHint('#eac-container-Keywords');
          accessibilityImprovement('#Keywords')
        },
        onHideListEvent: function() {
          hideAcHint('#eac-container-Keywords');
        },
        onMouseOverEvent: function() {
          accessibilityImprovement('#Keywords, #desired_keywords_msg')
        },
        onSelectItemEvent: function() {
          companySearch();
          accessibilityImprovement('#Keywords, #desired_keywords_msg')
        },
        onHideListEvent: function() {
          $('#Keywords, #desired_keywords_msg').parents('.autocomplete-accessibility').attr('aria-expanded', 'false')
        }
      }
    });
  }

  var geo_ok;
  $('#geolocation').click(function (e) {
    e.preventDefault();
    navigator.geolocation.getCurrentPosition(function (pos) {
      var lat = pos.coords.latitude;
      var lng = pos.coords.longitude;

      $.get("/geoloc/by_geo_point", { lat: lat, lon: lng }, function(data) {
          $('#Location').val(data);
        }, 'text'
      );

      geo_ok = true;
      // tracking-marker
      dataLayer.push({"event": "data-gtm", "gtm_action": "job_search", "gtm_label": "geolocation"});
    });
  });

  if(SettingControlValues.EnableValidateEnteredLocation == 'true') {
    $('#sbmt').click(function (e) {
      e.preventDefault();
      $.ajax({
        url: '/validate_search_location',
        method: 'GET',
        data: { 'location': $('#Location').val() },
        success: function(result) {
          if (result.valid_location){
            $("#sbmt").unbind('click').click();
          }else {
            randomId = (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
            var headingMessage = '<div class="error-message-list"><div class="mt10">' + I18n.t('js.flash_message.message_heading') + '</div> <ul><li>' + I18n.t('js.flash_message.zip_code_message') + '</li><li>' + I18n.t('js.flash_message.city_state_spell_check')+ '</li><li>' + I18n.t('js.flash_message.not_use_abbreviations') +'</li></ul></div>'
            flashContent = '<div id="flash' + randomId + '" class="flash-message flash-fixed error"><span class="b">' + $('#Location').val() + " "+ I18n.t('js.flash_message.not_found')+ "<br>" + '</span>' + headingMessage + '</div>';
            if ($(".flash-message.error").length == 0 ){
              $('.site-content').prepend(flashContent);
             }
          }
        },
        error: function(error) {
          console.log('Validate search by location error ' + error );
        }
      });
    });
  }

  $('#Location').on('change', function () {
    if (geo_ok) {
      // tracking-marker
      dataLayer.push({"event": "data-gtm", "gtm_action": "job_search", "gtm_label": "input changed after geolocation"});
      geo_ok = false;
    }
  });

  $('#job-search-form #Keywords, #desired_keywords_msg, #job-alert-keyword #Keywords, #Location, #desired_location_msg').on('input', function (e) {
    if($(this).val().length > 0){
      actionProgress(this, true);
    }
  });
  
});

function accessibilityImprovement(currentEle) {
  var $searchBox = $(currentEle);
  var $searchBoxParent = $(currentEle).parents('.autocomplete-accessibility')
  var $listContainerList = $(currentEle).parents('.autocomplete-accessibility').find('.easy-autocomplete-container ul');
  $listContainerList.attr('role', 'listbox');
  if ($($searchBox).length && $listContainerList.css('display', 'block')) {
    $($searchBoxParent).attr('aria-expanded', 'true')
    var $list = $listContainerList.find('li:not(.eac-category)');
    if ($list) {
      $($list).each(function(index, el) {
        $(el).attr('id', 'list-items-' + `${$($searchBox).attr('id').toLowerCase()}` + '-' + `${index}`).attr('role', 'option').attr('aria-label', $(el).text());
        $(el).find('.eac-item').attr('aria-hidden', true)
      });
      if ($($listContainerList).find('li.selected').length) {
        var $currentlistItemId = $($listContainerList).find('li.selected').attr('id');
        $($searchBox).attr('aria-activedescendant', $currentlistItemId);
      }
    }
  }
}

function showAcHint(acSelector) {
  var foundResultsCount = $(acSelector + ' ul li').not('.eac-category').length;
  $('#ac-text-hint').attr('aria-live', 'assertive');
  acHintText = $('#ac-text-hint').html();
  $('#ac-text-hint').html(acHintText && acHintText.replace(/[0-9]*/, foundResultsCount));
}

function hideAcHint(acSelector) {
  $('#ac-text-hint').attr('aria-live', 'off');
}

function categoriesListData(){
  if (Cookies.get('company_search_ab_test') == 'true' && SettingControlValues.EnableCompanySearchOnJrp == 'true'){
  list = [{
      listLocation: 'titles',
      maxNumberOfElements: 3,
      header: I18n.t('js.autocomplete_keywords_titles')
    }, 
    {
      listLocation: 'companies',
      maxNumberOfElements: 3,
      header: I18n.t('js.autocomplete_keywords_companies')
    },
    {
      listLocation: 'skills',
      maxNumberOfElements: 3,
      header: I18n.t('js.autocomplete_keywords_skills')
    }]
  }
  else{
  list = [{
      listLocation: 'titles',
      maxNumberOfElements: 5,
      header: I18n.t('js.autocomplete_keywords_titles')
    }, 
    {
      listLocation: 'skills',
      maxNumberOfElements: 5,
      header: I18n.t('js.autocomplete_keywords_skills')
    }]
  }
  return list;
}

function companySearch(){
  var selectedData = $('#Keywords, #desired_keywords_msg').getSelectedItemData();
  $('#company_request').val('did' in selectedData);
  $('#company_name').val(selectedData.did ? selectedData.keyword : '');
  $('#company_id').val(selectedData.did);
}

function actionProgress(currEle, isParent = false) {
  if (isParent){
    $(currEle).parent().addClass('action-progress');
  }
  else{
    $(currEle).addClass('action-progress');
  }
}

function actionProgressRemove(currEle, isParent = false){
  if (isParent){
    $(currEle).parent().removeClass('action-progress');
  }
  else{
    $(currEle).removeClass('action-progress');
  }
};
/*1.1.0*/var Mailcheck={domainThreshold:4,topLevelThreshold:3,defaultDomains:"yahoo.com google.com hotmail.com gmail.com me.com aol.com mac.com live.com comcast.net googlemail.com msn.com hotmail.co.uk yahoo.co.uk facebook.com verizon.net sbcglobal.net att.net gmx.com mail.com outlook.com icloud.com".split(" "),defaultTopLevelDomains:"co.jp co.uk com net org info edu gov mil ca".split(" "),run:function(a){a.domains=a.domains||Mailcheck.defaultDomains;a.topLevelDomains=a.topLevelDomains||Mailcheck.defaultTopLevelDomains;
a.distanceFunction=a.distanceFunction||Mailcheck.sift3Distance;var b=function(a){return a},c=a.suggested||b,b=a.empty||b;return(a=Mailcheck.suggest(Mailcheck.encodeEmail(a.email),a.domains,a.topLevelDomains,a.distanceFunction))?c(a):b()},suggest:function(a,b,c,d){a=a.toLowerCase();a=this.splitEmail(a);if(b=this.findClosestDomain(a.domain,b,d,this.domainThreshold)){if(b!=a.domain)return{address:a.address,domain:b,full:a.address+"@"+b}}else if(c=this.findClosestDomain(a.topLevelDomain,c,d,this.topLevelThreshold),
a.domain&&c&&c!=a.topLevelDomain)return d=a.domain,b=d.substring(0,d.lastIndexOf(a.topLevelDomain))+c,{address:a.address,domain:b,full:a.address+"@"+b};return!1},findClosestDomain:function(a,b,c,d){d=d||this.topLevelThreshold;var e,g=99,f=null;if(!a||!b)return!1;c||(c=this.sift3Distance);for(var h=0;h<b.length;h++){if(a===b[h])return a;e=c(a,b[h]);e<g&&(g=e,f=b[h])}return g<=d&&null!==f?f:!1},sift3Distance:function(a,b){if(null==a||0===a.length)return null==b||0===b.length?0:b.length;if(null==b||
0===b.length)return a.length;for(var c=0,d=0,e=0,g=0;c+d<a.length&&c+e<b.length;){if(a.charAt(c+d)==b.charAt(c+e))g++;else for(var f=e=d=0;5>f;f++){if(c+f<a.length&&a.charAt(c+f)==b.charAt(c)){d=f;break}if(c+f<b.length&&a.charAt(c)==b.charAt(c+f)){e=f;break}}c++}return(a.length+b.length)/2-g},splitEmail:function(a){a=a.trim().split("@");if(2>a.length)return!1;for(var b=0;b<a.length;b++)if(""===a[b])return!1;var c=a.pop(),d=c.split("."),e="";if(0==d.length)return!1;if(1==d.length)e=d[0];else{for(b=
1;b<d.length;b++)e+=d[b]+".";2<=d.length&&(e=e.substring(0,e.length-1))}return{topLevelDomain:e,domain:c,address:a.join("@")}},encodeEmail:function(a){a=encodeURI(a);return a=a.replace("%20"," ").replace("%25","%").replace("%5E","^").replace("%60","`").replace("%7B","{").replace("%7C","|").replace("%7D","}")}};"undefined"!==typeof module&&module.exports&&(module.exports=Mailcheck);
"undefined"!==typeof window&&window.jQuery&&function(a){a.fn.mailcheck=function(a){var c=this;if(a.suggested){var d=a.suggested;a.suggested=function(a){d(c,a)}}if(a.empty){var e=a.empty;a.empty=function(){e.call(null,c)}}a.email=this.val();Mailcheck.run(a)}}(jQuery);
(function() {
  $(function() {
    $('input[type=email]').on('blur', function() {
      var input;
      input = $(this);
      input.mailcheck({
        suggested: function(element, suggestion) {
          var suggestion_html, suggestion_text;
          input.next('.suggestion').remove();
          suggestion_text = I18n.t('js.suggested_email', {
            email: suggestion.full
          });
          suggestion_html = "<div class=\"suggestion\">" + suggestion_text + "</div>";
          $(suggestion_html).insertAfter(input);
        },
        empty: function(element) {}
      });
    });
    return $(document).on("click", ".suggestion", function(e) {
      var suggestion;
      e.preventDefault();
      suggestion = $(this);
      suggestion.prev().val(suggestion.find("a").html());
      return suggestion.remove();
    });
  });

}).call(this);
(function() {
  this.TargetDisabler = {
    initialize: function() {
      this.disableTarget($('[data-disable-target]'));
      return $('[data-disable-target]').on('click', this.handleClick);
    },
    disableTarget: function($element) {
      var $target, target;
      target = $element.data('disableTarget');
      $target = $("[" + target + "]");
      if ($element.prop('checked')) {
        $("input[" + target + "]").val('');
        displayValide($target);
        $target.prop("disabled", true);
      } else {
        $target.prop("disabled", false);
      }
      if ($('#resume-upload, #unregistered-apply, #register, #register_and_apply').length > 0) {
        return post_back_validation_resume_post();
      }
    },
    handleClick: function() {
      var $element;
      $element = $(this);
      return TargetDisabler.disableTarget($element);
    }
  };

  $(function() {
    return TargetDisabler.initialize();
  });

}).call(this);
// Sync auth status with the new OneIAM platform, if enable_oneiam is true
(function () {
  function loadOneiamJs() {
    return $.getScript(oneiam_issuer + '/assets/oneiam-1.0.0.min.js');
  }

  function initOneiam() {
    return new Oneiam({
      issuer: oneiam_issuer,
      clientId: oneiam_client_id,
      cookieName: 'c_oneiam_ss'
    });
  }

  function syncAuthStatus(oneiam) {
    return oneiam.synchronize({ /* debug: true */ });
  }

  $(document).ready(function () {
    if (oneiam_enabled) {
      loadOneiamJs().then(initOneiam).then(syncAuthStatus);
    }
  });
})();

// Sync auth status with Matrix, if enable_oneiam is false
(function(){
  function cbInitialize() {
    CBAuth.init({
      clientId: SSO_client_id,
      environment: 'production'
    }).then(function () {
      handleLoginState(CBAuth.getSessionStatus());
    }).catch(function (error) {
      console.log(error);
    });
  };

  function handleLoginState(loggedInState) {
    switch (loggedInState) {
      case 'logged_in':
        if(!SSO_logged_in) {
          updateLoginStatus();
        }
        else {
          $.post("/sso-token-check", { id_token: CBAuth.getIDToken() })
            .fail(function(data, textStatus, xhr){
              // user did not match
              if(data.status == 401){
                updateLoginStatus();
              }
            });
        }
        break;
      case 'known':
      case 'unknown':
        if(SSO_logged_in) {
          updateLogoutStatus();
        }
        break;
    }
  }

  function updateLoginStatus(){
    location.assign(SSO_auth_url);
  }

  function updateLogoutStatus(){
    $.ajax({
      url: '/user/logout',
      type: 'GET',
      complete: function(data){
        location.reload(true);
      }
    });
  }

  function checkLoginStatus(){
    $.getScript("//secure.icbdr.com/share/hybrid/cb-auth-2.0.1.min.js").then(cbInitialize);
  }

  $(document).ready(function(){
    if(SSO_page_disabled){
      return;
    }

    checkLoginStatus();
  });

})();
(function() {
  window.onload = function() {
    if (SettingControlValues.EnableGlobalDesign === 'true' && SettingControlValues.EnableAjaxIpathUpdate === 'true') {
      $(document).on('click', 'a', function(e) {
        var _self;
        _self = $(this);
        if (_self.attr('data-ipath')) {
          Cookies.set('client_side_ipath', _self.attr('data-ipath'));
          return updateReqIpath(_self.attr('data-ipath'));
        }
      });
      $(document).on('mousedown', 'a', function(e) {
        var _self;
        _self = $(this);
        if (jQuery.isClickEventRequestingNewTab(e) && _self.attr('data-ipath')) {
          return updateReqIpath(_self.attr('data-ipath'));
        }
      });
      return $(document).on('contextmenu', 'a', function(e) {
        var _self;
        _self = $(this);
        if (_self.attr('data-ipath')) {
          return updateReqIpath(_self.attr('data-ipath'));
        }
      });
    }
  };

  this.updateReqIpath = function(reqIpath, url, evtName) {
    var reqURL;
    if (evtName == null) {
      evtName = 'default';
    }
    reqURL = url;
    return $.ajax({
      type: 'POST',
      url: '/update_req_ipath',
      headers: {
        'X-CSRF-Token': $.rails.csrfToken()
      },
      data: {
        'ipath': reqIpath
      }
    });
  };

  jQuery.isClickEventRequestingNewTab = function(clickEvent) {
    return clickEvent.metaKey || clickEvent.ctrlKey || clickEvent.which === 2;
  };

}).call(this);
function updateCompanyService(companies, _this, url) {
    loader();
    var data;
    var uid = _this.attr('name').split('_')[2];
    var attr = _this.context.id.split('_')[1];

    $.each(companies, function (key, company_data) {
        delete company_data['createddt'];
        delete company_data['modifieddt'];
        if (company_data['uid'] == uid) {
            data = company_data;
        }
    });

    data['push'] = $('#rm_push_' + uid)['0'].checked;
    data['email'] = $('#rm_email_' + uid)['0'].checked;
    data['sms'] = $('#rm_sms_' + uid)['0'].checked;
    
    $.ajax({
        url: url,
        type: 'post',
        data: { data: data }
    })
}

function loader() {
    $('[data-remodal-id=spinner-modal]').remodal().open();
};
$(document).ready(function () {
  var resumeDID; 
 

  $('.edit_resume_title_save').attr("disabled", true)

  if ($('.resume-list-item').size() > 2) {
    $('.upload_resume_btn').addClass('btn-disabled')
  }
  else {
    $('.upload_resume_btn').removeClass('btn-disabled')
  }

  $(document).on('click','.edit_resume_title', function (e) {
    resumeDID = $(this).attr('id')
    $('.resume_title_field').bind('keyup', function () {
      if ($(this).val() != '') { 
        $('.edit_resume_title_save').removeAttr("disabled").removeClass('btn-disabled')
      } else {
        $('.edit_resume_title_save').attr("disabled", true).addClass('btn-disabled')
      }
    });
    $('[data-remodal-id=edit-resume-title]').remodal().open()
    $('#hidden_resumeDID').val(resumeDID)
    $('.remodal-overlay, .remodal-wrapper').unbind('click.remodal')
  })

  $(document).on('click','.edit-resume-title-modal-cancel', function (e) { 
    $('[data-remodal-id=edit-resume-title]').remodal().close()
  })
  
  $(document).on('click', '.edit_resume_title_save', function (e) {
    $('[data-remodal-id=edit-resume-title]').remodal().close()
    $($($('span#resume_title_' + resumeDID))[0]).text($('.resume_title_field').val())
  })
  $(document).on('click', '.dropdown-features-wrapper .btn-dropdown-feature', function() {
    var offsetLeft = $(this).offset().left - $(this).parents('.content').offset().left;
    var index = $(this).attr('id').slice(-1)
    $('.dropdown-features-wrapper').find(".dropdown-list").addClass('dn');
    $('.dropdown-features-wrapper.dropdown-bottom').find(`#resume-feature-${index}`).removeClass('dn');
    $('.dropdown-features-wrapper.dropdown-bottom').find(`#resume-feature-${index}`).parent('.dropdown-features-wrapper.dropdown-bottom').css({left: offsetLeft})
    $('.dropdown-features-wrapper').mouseleave(function() {
      setTimeout(function () {
        $('.dropdown-features-wrapper').find('.dropdown-list').addClass('dn');
      }, 200);
    });
  });
})

;
// add all the elements inside modal which you want to make focusable
function modalFocusTrap(modal_id) {
  const  focusableElements =
    'button, [href], input:not([type="hidden"]), [tabindex]:not([tabindex="-1"])';
  const modal = document.querySelector(modal_id); // select the modal by it's id
  const firstFocusableElement = modal.querySelectorAll(focusableElements)[0]; // get first element to be focused inside modal
  const focusableContent = modal.querySelectorAll(focusableElements);
  const lastFocusableElement = focusableContent[focusableContent.length - 1]; // get last element to be focused inside modal


  document.addEventListener('keydown', function(e) {
  let isTabPressed = e.key === 'Tab' || e.keyCode === 9;

  if (!isTabPressed) {
    return;
  }

  if (e.shiftKey) { // if shift key pressed for shift + tab combination
    if (document.activeElement === firstFocusableElement) {
      lastFocusableElement.focus(); // add focus for the last focusable element
      e.preventDefault();
    }
  } else { // if tab key is pressed
    if (document.activeElement === lastFocusableElement) { // if focused has reached to last focusable element then focus first focusable element after pressing tab
      firstFocusableElement.focus(); // add focus for the first focusable element
      e.preventDefault();
    }
  }
  });

  firstFocusableElement.focus();
}

$("#hide-fixed-top").click(function() {
  modalFocusTrap('#external-apply-hybrid');
});

function keyboardTrapFocus(element) {
  var focusableElement = element[0]
  var focusableEls = focusableElement.querySelectorAll('a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input[type="text"]:not([disabled]), input[type="radio"]:not([disabled]), input[type="checkbox"]:not([disabled]), select:not([disabled])');
  var firstFocusableEl = focusableEls[0];
  var lastFocusableEl = focusableEls[focusableEls.length - 1];
  var KEYCODE_TAB = 9;

  focusableElement.addEventListener('keydown', function(e) {
    var isTabPressed = (e.key === 'Tab' || e.keyCode === KEYCODE_TAB);

    if (!isTabPressed) {
      return;
    }

    if ( e.shiftKey ) {
      if (document.activeElement === firstFocusableEl) {
          lastFocusableEl.focus();
          e.preventDefault();
      }
    } else {
      if (document.activeElement === lastFocusableEl) {
          firstFocusableEl.focus();
          e.preventDefault();
      }
    }
  });
};
/**
 * Selectize (v0.15.2)
 * https://selectize.dev
 *
 * Copyright (c) 2013-2015 Brian Reavis & contributors
 * Copyright (c) 2020-2022 Selectize Team & contributors
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
 * file except in compliance with the License. You may obtain a copy of the License at:
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
 * ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 *
 * @author Brian Reavis <brian@thirdroute.com>
 * @author Ris Adams <selectize@risadams.com>
 */
(function (root, factory) {
  if (typeof define === 'function' && define.amd) {
    define(['jquery'], factory);
  } else if (typeof module === 'object' && typeof module.exports === 'object') {
    module.exports = factory(require('jquery'));
  } else {
    root.Selectize = factory(root.jQuery);
  }
}(this, function ($) {
  'use strict';
var highlight=function(t,e){var r,a;if("string"!=typeof e||e.length)return r="string"==typeof e?new RegExp(e,"i"):e,a=function(t){var e=0;if(3===t.nodeType){var n,i,o=t.data.search(r);0<=o&&0<t.data.length&&(i=t.data.match(r),(n=document.createElement("span")).className="highlight",(o=t.splitText(o)).splitText(i[0].length),i=o.cloneNode(!0),n.appendChild(i),o.parentNode.replaceChild(n,o),e=1)}else if(1===t.nodeType&&t.childNodes&&!/(script|style)/i.test(t.tagName)&&("highlight"!==t.className||"SPAN"!==t.tagName))for(var s=0;s<t.childNodes.length;++s)s+=a(t.childNodes[s]);return e},t.each(function(){a(this)})},MicroEvent=($.fn.removeHighlight=function(){return this.find("span.highlight").each(function(){this.parentNode.firstChild.nodeName;var t=this.parentNode;t.replaceChild(this.firstChild,this),t.normalize()}).end()},function(){}),MicroPlugin=(MicroEvent.prototype={on:function(t,e){this._events=this._events||{},this._events[t]=this._events[t]||[],this._events[t].push(e)},off:function(t,e){var n=arguments.length;return 0===n?delete this._events:1===n?delete this._events[t]:(this._events=this._events||{},void(t in this._events!=!1&&this._events[t].splice(this._events[t].indexOf(e),1)))},trigger:function(t){var e=this._events=this._events||{};if(t in e!=!1)for(var n=0;n<e[t].length;n++)e[t][n].apply(this,Array.prototype.slice.call(arguments,1))}},MicroEvent.mixin=function(t){for(var e=["on","off","trigger"],n=0;n<e.length;n++)t.prototype[e[n]]=MicroEvent.prototype[e[n]]},{}),utils=(MicroPlugin.mixin=function(o){o.plugins={},o.prototype.initializePlugins=function(t){var e,n,i,o=this,s=[];if(o.plugins={names:[],settings:{},requested:{},loaded:{}},utils.isArray(t))for(e=0,n=t.length;e<n;e++)"string"==typeof t[e]?s.push(t[e]):(o.plugins.settings[t[e].name]=t[e].options,s.push(t[e].name));else if(t)for(i in t)t.hasOwnProperty(i)&&(o.plugins.settings[i]=t[i],s.push(i));for(;s.length;)o.require(s.shift())},o.prototype.loadPlugin=function(t){var e=this,n=e.plugins,i=o.plugins[t];if(!o.plugins.hasOwnProperty(t))throw new Error('Unable to find "'+t+'" plugin');n.requested[t]=!0,n.loaded[t]=i.fn.apply(e,[e.plugins.settings[t]||{}]),n.names.push(t)},o.prototype.require=function(t){var e=this,n=e.plugins;if(!e.plugins.loaded.hasOwnProperty(t)){if(n.requested[t])throw new Error('Plugin has circular dependency ("'+t+'")');e.loadPlugin(t)}return n.loaded[t]},o.define=function(t,e){o.plugins[t]={name:t,fn:e}}},{isArray:Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}}),Sifter=function(t,e){this.items=t,this.settings=e||{diacritics:!0}},cmp=(Sifter.prototype.tokenize=function(t,e){if(!(t=trim(String(t||"").toLowerCase()))||!t.length)return[];for(var n,i,o=[],s=t.split(/ +/),r=0,a=s.length;r<a;r++){if(n=escape_regex(s[r]),this.settings.diacritics)for(i in DIACRITICS)DIACRITICS.hasOwnProperty(i)&&(n=n.replace(new RegExp(i,"g"),DIACRITICS[i]));e&&(n="\\b"+n),o.push({string:s[r],regex:new RegExp(n,"i")})}return o},Sifter.prototype.iterator=function(t,e){var n=is_array(t)?Array.prototype.forEach||function(t){for(var e=0,n=this.length;e<n;e++)t(this[e],e,this)}:function(t){for(var e in this)this.hasOwnProperty(e)&&t(this[e],e,this)};n.apply(t,[e])},Sifter.prototype.getScoreFunction=function(t,e){function o(t,e){var n;return!t||-1===(n=(t=String(t||"")).search(e.regex))?0:(e=e.string.length/t.length,0===n&&(e+=.5),e)}var s,r=(t=this.prepareSearch(t,e)).tokens,a=t.options.fields,l=r.length,p=t.options.nesting,c=(s=a.length)?1===s?function(t,e){return o(getattr(e,a[0],p),t)}:function(t,e){for(var n=0,i=0;n<s;n++)i+=o(getattr(e,a[n],p),t);return i/s}:function(){return 0};return l?1===l?function(t){return c(r[0],t)}:"and"===t.options.conjunction?function(t){for(var e,n=0,i=0;n<l;n++){if((e=c(r[n],t))<=0)return 0;i+=e}return i/l}:function(t){for(var e=0,n=0;e<l;e++)n+=c(r[e],t);return n/l}:function(){return 0}},Sifter.prototype.getSortFunction=function(t,n){var e,i,o,s,r,a,l,p=this,c=!(t=p.prepareSearch(t,n)).query&&n.sort_empty||n.sort,u=function(t,e){return"$score"===t?e.score:getattr(p.items[e.id],t,n.nesting)},d=[];if(c)for(e=0,i=c.length;e<i;e++)!t.query&&"$score"===c[e].field||d.push(c[e]);if(t.query){for(l=!0,e=0,i=d.length;e<i;e++)if("$score"===d[e].field){l=!1;break}l&&d.unshift({field:"$score",direction:"desc"})}else for(e=0,i=d.length;e<i;e++)if("$score"===d[e].field){d.splice(e,1);break}for(a=[],e=0,i=d.length;e<i;e++)a.push("desc"===d[e].direction?-1:1);return(s=d.length)?1===s?(o=d[0].field,r=a[0],function(t,e){return r*cmp(u(o,t),u(o,e))}):function(t,e){for(var n,i=0;i<s;i++)if(n=d[i].field,n=a[i]*cmp(u(n,t),u(n,e)))return n;return 0}:null},Sifter.prototype.prepareSearch=function(t,e){var n,i,o;return"object"==typeof t?t:(n=(e=extend({},e)).fields,i=e.sort,o=e.sort_empty,n&&!is_array(n)&&(e.fields=[n]),i&&!is_array(i)&&(e.sort=[i]),o&&!is_array(o)&&(e.sort_empty=[o]),{options:e,query:String(t||"").toLowerCase(),tokens:this.tokenize(t,e.respect_word_boundaries),total:0,items:[]})},Sifter.prototype.search=function(t,n){var i,o,e=this,s=this.prepareSearch(t,n);return n=s.options,t=s.query,o=n.score||e.getScoreFunction(s),t.length?e.iterator(e.items,function(t,e){i=o(t),(!1===n.filter||0<i)&&s.items.push({score:i,id:e})}):e.iterator(e.items,function(t,e){s.items.push({score:1,id:e})}),(t=e.getSortFunction(s,n))&&s.items.sort(t),s.total=s.items.length,"number"==typeof n.limit&&(s.items=s.items.slice(0,n.limit)),s},function(t,e){return"number"==typeof t&&"number"==typeof e?e<t?1:t<e?-1:0:(t=asciifold(String(t||"")),(e=asciifold(String(e||"")))<t?1:t<e?-1:0)}),extend=function(t,e){for(var n,i,o=1,s=arguments.length;o<s;o++)if(i=arguments[o])for(n in i)i.hasOwnProperty(n)&&(t[n]=i[n]);return t},getattr=function(t,e,n){if(t&&e){if(!n)return t[e];for(var i=e.split(".");i.length&&(t=t[i.shift()]););return t}},trim=function(t){return(t+"").replace(/^\s+|\s+$|/g,"")},escape_regex=function(t){return(t+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")},is_array=Array.isArray||"undefined"!=typeof $&&$.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},DIACRITICS={a:"[aḀḁĂăÂâǍǎȺⱥȦȧẠạÄäÀàÁáĀāÃãÅåąĄÃąĄ]",b:"[b␢βΒB฿𐌁ᛒ]",c:"[cĆćĈĉČčĊċC̄c̄ÇçḈḉȻȼƇƈɕᴄＣｃ]",d:"[dĎďḊḋḐḑḌḍḒḓḎḏĐđD̦d̦ƉɖƊɗƋƌᵭᶁᶑȡᴅＤｄð]",e:"[eÉéÈèÊêḘḙĚěĔĕẼẽḚḛẺẻĖėËëĒēȨȩĘęᶒɆɇȄȅẾếỀềỄễỂểḜḝḖḗḔḕȆȇẸẹỆệⱸᴇＥｅɘǝƏƐε]",f:"[fƑƒḞḟ]",g:"[gɢ₲ǤǥĜĝĞğĢģƓɠĠġ]",h:"[hĤĥĦħḨḩẖẖḤḥḢḣɦʰǶƕ]",i:"[iÍíÌìĬĭÎîǏǐÏïḮḯĨĩĮįĪīỈỉȈȉȊȋỊịḬḭƗɨɨ̆ᵻᶖİiIıɪＩｉ]",j:"[jȷĴĵɈɉʝɟʲ]",k:"[kƘƙꝀꝁḰḱǨǩḲḳḴḵκϰ₭]",l:"[lŁłĽľĻļĹĺḶḷḸḹḼḽḺḻĿŀȽƚⱠⱡⱢɫɬᶅɭȴʟＬｌ]",n:"[nŃńǸǹŇňÑñṄṅŅņṆṇṊṋṈṉN̈n̈ƝɲȠƞᵰᶇɳȵɴＮｎŊŋ]",o:"[oØøÖöÓóÒòÔôǑǒŐőŎŏȮȯỌọƟɵƠơỎỏŌōÕõǪǫȌȍՕօ]",p:"[pṔṕṖṗⱣᵽƤƥᵱ]",q:"[qꝖꝗʠɊɋꝘꝙq̃]",r:"[rŔŕɌɍŘřŖŗṘṙȐȑȒȓṚṛⱤɽ]",s:"[sŚśṠṡṢṣꞨꞩŜŝŠšŞşȘșS̈s̈]",t:"[tŤťṪṫŢţṬṭƮʈȚțṰṱṮṯƬƭ]",u:"[uŬŭɄʉỤụÜüÚúÙùÛûǓǔŰűŬŭƯưỦủŪūŨũŲųȔȕ∪]",v:"[vṼṽṾṿƲʋꝞꝟⱱʋ]",w:"[wẂẃẀẁŴŵẄẅẆẇẈẉ]",x:"[xẌẍẊẋχ]",y:"[yÝýỲỳŶŷŸÿỸỹẎẏỴỵɎɏƳƴ]",z:"[zŹźẐẑŽžŻżẒẓẔẕƵƶ]"},asciifold=function(){var t,e,n,i,o="",s={};for(n in DIACRITICS)if(DIACRITICS.hasOwnProperty(n))for(o+=i=DIACRITICS[n].substring(2,DIACRITICS[n].length-1),t=0,e=i.length;t<e;t++)s[i.charAt(t)]=n;var r=new RegExp("["+o+"]","g");return function(t){return t.replace(r,function(t){return s[t]}).toLowerCase()}}();function uaDetect(t,e){return navigator.userAgentData?t===navigator.userAgentData.platform:e.test(navigator.userAgent)}var IS_MAC=uaDetect("macOS",/Mac/),KEY_A=65,KEY_COMMA=188,KEY_RETURN=13,KEY_ESC=27,KEY_LEFT=37,KEY_UP=38,KEY_P=80,KEY_RIGHT=39,KEY_DOWN=40,KEY_N=78,KEY_BACKSPACE=8,KEY_DELETE=46,KEY_SHIFT=16,KEY_CMD=IS_MAC?91:17,KEY_CTRL=IS_MAC?18:17,KEY_TAB=9,TAG_SELECT=1,TAG_INPUT=2,SUPPORTS_VALIDITY_API=!uaDetect("Android",/android/i)&&!!document.createElement("input").validity,isset=function(t){return void 0!==t},hash_key=function(t){return null==t?null:"boolean"==typeof t?t?"1":"0":t+""},escape_html=function(t){return(t+"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")},escape_replace=function(t){return(t+"").replace(/\$/g,"$$$$")},hook={before:function(t,e,n){var i=t[e];t[e]=function(){return n.apply(t,arguments),i.apply(t,arguments)}},after:function(e,t,n){var i=e[t];e[t]=function(){var t=i.apply(e,arguments);return n.apply(e,arguments),t}}},once=function(t){var e=!1;return function(){e||(e=!0,t.apply(this,arguments))}},debounce=function(n,i){var o;return function(){var t=this,e=arguments;window.clearTimeout(o),o=window.setTimeout(function(){n.apply(t,e)},i)}},debounce_events=function(e,n,t){var i,o=e.trigger,s={};for(i in e.trigger=function(){var t=arguments[0];if(-1===n.indexOf(t))return o.apply(e,arguments);s[t]=arguments},t.apply(e,[]),e.trigger=o,s)s.hasOwnProperty(i)&&o.apply(e,s[i])},watchChildEvent=function(n,t,e,i){n.on(t,e,function(t){for(var e=t.target;e&&e.parentNode!==n[0];)e=e.parentNode;return t.currentTarget=e,i.apply(this,[t])})},getInputSelection=function(t){var e,n,i={};return void 0===t?console.warn("WARN getInputSelection cannot locate input control"):"selectionStart"in t?(i.start=t.selectionStart,i.length=t.selectionEnd-i.start):document.selection&&(t.focus(),e=document.selection.createRange(),n=document.selection.createRange().text.length,e.moveStart("character",-t.value.length),i.start=e.text.length-n,i.length=n),i},transferStyles=function(t,e,n){var i,o,s={};if(n)for(i=0,o=n.length;i<o;i++)s[n[i]]=t.css(n[i]);else s=t.css();e.css(s)},measureString=function(t,e){return t?(Selectize.$testInput||(Selectize.$testInput=$("<span />").css({position:"absolute",width:"auto",padding:0,whiteSpace:"pre"}),$("<div />").css({position:"absolute",width:0,height:0,overflow:"hidden"}).append(Selectize.$testInput).appendTo("body")),Selectize.$testInput.text(t),transferStyles(e,Selectize.$testInput,["letterSpacing","fontSize","fontFamily","fontWeight","textTransform"]),Selectize.$testInput.width()):0},autoGrow=function(s){function t(t,e){var n,i,o;e=e||{},(t=t||window.event||{}).metaKey||t.altKey||!e.force&&!1===s.data("grow")||(e=s.val(),t.type&&"keydown"===t.type.toLowerCase()&&(n=48<=(i=t.keyCode)&&i<=57||65<=i&&i<=90||96<=i&&i<=111||186<=i&&i<=222||32===i,i===KEY_DELETE||i===KEY_BACKSPACE?(o=getInputSelection(s[0])).length?e=e.substring(0,o.start)+e.substring(o.start+o.length):i===KEY_BACKSPACE&&o.start?e=e.substring(0,o.start-1)+e.substring(o.start+1):i===KEY_DELETE&&void 0!==o.start&&(e=e.substring(0,o.start)+e.substring(o.start+1)):n&&(i=t.shiftKey,o=String.fromCharCode(t.keyCode),e+=o=i?o.toUpperCase():o.toLowerCase())),t=(n=s.attr("placeholder"))?measureString(n,s)+4:0,(i=Math.max(measureString(e,s),t)+4)===r)||(r=i,s.width(i),s.triggerHandler("resize"))}var r=null;s.on("keydown keyup update blur",t),t()},domToString=function(t){var e=document.createElement("div");return e.appendChild(t.cloneNode(!0)),e.innerHTML},logError=function(t,e){e=e||{};console.error("Selectize: "+t),e.explanation&&(console.group&&console.group(),console.error(e.explanation),console.group)&&console.groupEnd()},isJSON=function(t){try{JSON.parse(str)}catch(t){return!1}return!0},Selectize=function(t,e){var n,i,o=this,s=t[0],r=(s.selectize=o,window.getComputedStyle&&window.getComputedStyle(s,null));if(r=(r?r.getPropertyValue("direction"):s.currentStyle&&s.currentStyle.direction)||t.parents("[dir]:first").attr("dir")||"",$.extend(o,{order:0,settings:e,$input:t,tabIndex:t.attr("tabindex")||"",tagType:"select"===s.tagName.toLowerCase()?TAG_SELECT:TAG_INPUT,rtl:/rtl/i.test(r),eventNS:".selectize"+ ++Selectize.count,highlightedValue:null,isBlurring:!1,isOpen:!1,isDisabled:!1,isRequired:t.is("[required]"),isInvalid:!1,isLocked:!1,isFocused:!1,isInputHidden:!1,isSetup:!1,isShiftDown:!1,isCmdDown:!1,isCtrlDown:!1,ignoreFocus:!1,ignoreBlur:!1,ignoreHover:!1,hasOptions:!1,currentResults:null,lastValue:"",lastValidValue:"",lastOpenTarget:!1,caretPos:0,loading:0,loadedSearches:{},isDropdownClosing:!1,$activeOption:null,$activeItems:[],optgroups:{},options:{},userOptions:{},items:[],renderCache:{},onSearchChange:null===e.loadThrottle?o.onSearchChange:debounce(o.onSearchChange,e.loadThrottle)}),o.sifter=new Sifter(this.options,{diacritics:e.diacritics}),o.settings.options){for(n=0,i=o.settings.options.length;n<i;n++)o.registerOption(o.settings.options[n]);delete o.settings.options}if(o.settings.optgroups){for(n=0,i=o.settings.optgroups.length;n<i;n++)o.registerOptionGroup(o.settings.optgroups[n]);delete o.settings.optgroups}o.settings.mode=o.settings.mode||(1===o.settings.maxItems?"single":"multi"),"boolean"!=typeof o.settings.hideSelected&&(o.settings.hideSelected="multi"===o.settings.mode),o.initializePlugins(o.settings.plugins),o.setupCallbacks(),o.setupTemplates(),o.setup()};MicroEvent.mixin(Selectize),MicroPlugin.mixin(Selectize),$.extend(Selectize.prototype,{setup:function(){var e=this,t=e.settings,n=e.eventNS,i=$(window),o=$(document),s=e.$input,r=e.settings.mode,a=s.attr("class")||"",l=$("<div>").addClass(t.wrapperClass).addClass(a+" selectize-control").addClass(r),p=$("<div>").addClass(t.inputClass+" selectize-input items").appendTo(l),c=$('<input type="select-one" autocomplete="new-password" autofill="no" />').appendTo(p).attr("tabindex",s.is(":disabled")?"-1":e.tabIndex),u=$(t.dropdownParent||l),r=$("<div>").addClass(t.dropdownClass).addClass(r+" selectize-dropdown").hide().appendTo(u),u=$("<div>").addClass(t.dropdownContentClass+" selectize-dropdown-content").attr("tabindex","-1").appendTo(r),d=((d=s.attr("id"))&&(c.attr("id",d+"-selectized"),$("label[for='"+d+"']").attr("for",d+"-selectized")),e.settings.copyClassesToDropdown&&r.addClass(a),l.css({width:s[0].style.width}),e.plugins.names.length&&(d="plugin-"+e.plugins.names.join(" plugin-"),l.addClass(d),r.addClass(d)),(null===t.maxItems||1<t.maxItems)&&e.tagType===TAG_SELECT&&s.attr("multiple","multiple"),e.settings.placeholder&&c.attr("placeholder",t.placeholder),e.settings.search||(c.attr("readonly",!0),c.attr("inputmode","none"),p.css("cursor","pointer")),!e.settings.splitOn&&e.settings.delimiter&&(a=e.settings.delimiter.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),e.settings.splitOn=new RegExp("\\s*"+a+"+\\s*")),s.attr("autocorrect")&&c.attr("autocorrect",s.attr("autocorrect")),s.attr("autocapitalize")&&c.attr("autocapitalize",s.attr("autocapitalize")),s.is("input")&&(c[0].type=s[0].type),e.$wrapper=l,e.$control=p,e.$control_input=c,e.$dropdown=r,e.$dropdown_content=u,r.on("mouseenter mousedown mouseup click","[data-disabled]>[data-selectable]",function(t){t.stopImmediatePropagation()}),r.on("mouseenter","[data-selectable]",function(){return e.onOptionHover.apply(e,arguments)}),r.on("mouseup click","[data-selectable]",function(){return e.onOptionSelect.apply(e,arguments)}),watchChildEvent(p,"mouseup","*:not(input)",function(){return e.onItemSelect.apply(e,arguments)}),autoGrow(c),p.on({mousedown:function(){return e.onMouseDown.apply(e,arguments)},click:function(){return e.onClick.apply(e,arguments)}}),c.on({mousedown:function(t){""===e.$control_input.val()&&!e.settings.openOnFocus||t.stopPropagation()},keydown:function(){return e.onKeyDown.apply(e,arguments)},keypress:function(){return e.onKeyPress.apply(e,arguments)},input:function(){return e.onInput.apply(e,arguments)},resize:function(){e.positionDropdown.apply(e,[])},focus:function(){return e.ignoreBlur=!1,e.onFocus.apply(e,arguments)},paste:function(){return e.onPaste.apply(e,arguments)}}),o.on("keydown"+n,function(t){e.isCmdDown=t[IS_MAC?"metaKey":"ctrlKey"],e.isCtrlDown=t[IS_MAC?"altKey":"ctrlKey"],e.isShiftDown=t.shiftKey}),o.on("keyup"+n,function(t){t.keyCode===KEY_CTRL&&(e.isCtrlDown=!1),t.keyCode===KEY_SHIFT&&(e.isShiftDown=!1),t.keyCode===KEY_CMD&&(e.isCmdDown=!1)}),o.on("mousedown"+n,function(t){if(e.isFocused){if(t.target===e.$dropdown[0]||t.target.parentNode===e.$dropdown[0])return!1;e.$dropdown.has(t.target).length||t.target===e.$control[0]||e.blur(t.target)}}),i.on(["scroll"+n,"resize"+n].join(" "),function(){e.isOpen&&e.positionDropdown.apply(e,arguments)}),i.on("mousemove"+n,function(){e.ignoreHover=e.settings.ignoreHover}),$("<div></div>")),a=s.children().detach();s.replaceWith(d),d.replaceWith(s),this.revertSettings={$children:a,tabindex:s.attr("tabindex")},s.attr("tabindex",-1).hide().after(e.$wrapper),Array.isArray(t.items)&&(e.lastValidValue=t.items,e.setValue(t.items),delete t.items),SUPPORTS_VALIDITY_API&&s.on("invalid"+n,function(t){t.preventDefault(),e.isInvalid=!0,e.refreshState()}),e.updateOriginalInput(),e.refreshItems(),e.refreshState(),e.updatePlaceholder(),e.isSetup=!0,s.is(":disabled")&&e.disable(),e.on("change",this.onChange),s.data("selectize",e),s.addClass("selectized"),e.trigger("initialize"),!0===t.preload&&e.onSearchChange("")},setupTemplates:function(){var t=this,i=t.settings.labelField,o=t.settings.valueField,n=t.settings.optgroupLabelField;t.settings.render=$.extend({},{optgroup:function(t){return'<div class="optgroup">'+t.html+"</div>"},optgroup_header:function(t,e){return'<div class="optgroup-header">'+e(t[n])+"</div>"},option:function(t,e){var n=t.classes?" "+t.classes:"";return n+=""===t[o]?" selectize-dropdown-emptyoptionlabel":"","<div"+(t.styles?' style="'+t.styles+'"':"")+' class="option'+n+'">'+e(t[i])+"</div>"},item:function(t,e){return'<div class="item">'+e(t[i])+"</div>"},option_create:function(t,e){return'<div class="create">Add <strong>'+e(t.input)+"</strong>&#x2026;</div>"}},t.settings.render)},setupCallbacks:function(){var t,e,n={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur",dropdown_item_activate:"onDropdownItemActivate",dropdown_item_deactivate:"onDropdownItemDeactivate"};for(t in n)n.hasOwnProperty(t)&&(e=this.settings[n[t]])&&this.on(t,e)},onClick:function(t){this.isDropdownClosing||this.isFocused&&this.isOpen||(this.focus(),t.preventDefault())},onMouseDown:function(t){var e=this,n=t.isDefaultPrevented();$(t.target);if(e.isFocused||n||window.setTimeout(function(){e.focus()},0),t.target!==e.$control_input[0]||""===e.$control_input.val())return"single"===e.settings.mode?e.isOpen?e.close():e.open():(n||e.setActiveItem(null),e.settings.openOnFocus||(e.isOpen&&t.target===e.lastOpenTarget?(e.close(),e.lastOpenTarget=!1):(e.isOpen||(e.refreshOptions(),e.open()),e.lastOpenTarget=t.target))),!1},onChange:function(){""!==this.getValue()&&(this.lastValidValue=this.getValue()),this.$input.trigger("input"),this.$input.trigger("change")},onPaste:function(t){var o=this;o.isFull()||o.isInputHidden||o.isLocked?t.preventDefault():o.settings.splitOn&&setTimeout(function(){var t=o.$control_input.val();if(t.match(o.settings.splitOn))for(var e=t.trim().split(o.settings.splitOn),n=0,i=e.length;n<i;n++)o.createItem(e[n])},0)},onKeyPress:function(t){var e;return this.isLocked?t&&t.preventDefault():(e=String.fromCharCode(t.keyCode||t.which),this.settings.create&&"multi"===this.settings.mode&&e===this.settings.delimiter?(this.createItem(),t.preventDefault(),!1):void 0)},onKeyDown:function(t){t.target,this.$control_input[0];var e,n=this;if(n.isLocked)t.keyCode!==KEY_TAB&&t.preventDefault();else{switch(t.keyCode){case KEY_A:if(n.isCmdDown)return void n.selectAll();break;case KEY_ESC:return void(n.isOpen&&(t.preventDefault(),t.stopPropagation(),n.close()));case KEY_N:if(!t.ctrlKey||t.altKey)break;case KEY_DOWN:return!n.isOpen&&n.hasOptions?n.open():n.$activeOption&&(n.ignoreHover=!0,(e=n.getAdjacentOption(n.$activeOption,1)).length)&&n.setActiveOption(e,!0,!0),void t.preventDefault();case KEY_P:if(!t.ctrlKey||t.altKey)break;case KEY_UP:return n.$activeOption&&(n.ignoreHover=!0,(e=n.getAdjacentOption(n.$activeOption,-1)).length)&&n.setActiveOption(e,!0,!0),void t.preventDefault();case KEY_RETURN:return void(n.isOpen&&n.$activeOption&&(n.onOptionSelect({currentTarget:n.$activeOption}),t.preventDefault()));case KEY_LEFT:return void n.advanceSelection(-1,t);case KEY_RIGHT:return void n.advanceSelection(1,t);case KEY_TAB:return n.settings.selectOnTab&&n.isOpen&&n.$activeOption&&(n.onOptionSelect({currentTarget:n.$activeOption}),n.isFull()||t.preventDefault()),void(n.settings.create&&n.createItem()&&n.settings.showAddOptionOnCreate&&t.preventDefault());case KEY_BACKSPACE:case KEY_DELETE:return void n.deleteSelection(t)}!n.isFull()&&!n.isInputHidden||(IS_MAC?t.metaKey:t.ctrlKey)||t.preventDefault()}},onInput:function(t){var e=this,n=e.$control_input.val()||"";e.lastValue!==n&&(e.lastValue=n,e.onSearchChange(n),e.refreshOptions(),e.trigger("type",n))},onSearchChange:function(e){var n=this,i=n.settings.load;i&&!n.loadedSearches.hasOwnProperty(e)&&(n.loadedSearches[e]=!0,n.load(function(t){i.apply(n,[e,t])}))},onFocus:function(t){var e=this,n=e.isFocused;if(e.isDisabled)return e.blur(),t&&t.preventDefault(),!1;e.ignoreFocus||(e.isFocused=!0,"focus"===e.settings.preload&&e.onSearchChange(""),n||e.trigger("focus"),e.$activeItems.length||(e.showInput(),e.setActiveItem(null),e.refreshOptions(!!e.settings.openOnFocus)),e.refreshState())},onBlur:function(t,e){var n,i=this;i.isFocused&&(i.isFocused=!1,i.ignoreFocus||(n=function(){i.close(),i.setTextboxValue(""),i.setActiveItem(null),i.setActiveOption(null),i.setCaret(i.items.length),i.refreshState(),e&&e.focus&&e.focus(),i.isBlurring=!1,i.ignoreFocus=!1,i.trigger("blur")},i.isBlurring=!0,i.ignoreFocus=!0,i.settings.create&&i.settings.createOnBlur?i.createItem(null,!1,n):n()))},onOptionHover:function(t){this.ignoreHover||this.setActiveOption(t.currentTarget,!1)},onOptionSelect:function(t){var e,n=this;t.preventDefault&&(t.preventDefault(),t.stopPropagation()),(e=$(t.currentTarget)).hasClass("create")?n.createItem(null,function(){n.settings.closeAfterSelect&&n.close()}):void 0!==(e=e.attr("data-value"))&&(n.lastQuery=null,n.setTextboxValue(""),n.addItem(e),n.settings.closeAfterSelect?n.close():!n.settings.hideSelected&&t.type&&/mouse/.test(t.type)&&n.setActiveOption(n.getOption(e)))},onItemSelect:function(t){this.isLocked||"multi"===this.settings.mode&&(t.preventDefault(),this.setActiveItem(t.currentTarget,t))},load:function(t){var e=this,n=e.$wrapper.addClass(e.settings.loadingClass);e.loading++,t.apply(e,[function(t){e.loading=Math.max(e.loading-1,0),t&&t.length&&(e.addOption(t),e.refreshOptions(e.isFocused&&!e.isInputHidden)),e.loading||n.removeClass(e.settings.loadingClass),e.trigger("load",t)}])},getTextboxValue:function(){return this.$control_input.val()},setTextboxValue:function(t){var e=this.$control_input;e.val()!==t&&(e.val(t).triggerHandler("update"),this.lastValue=t)},getValue:function(){return this.tagType===TAG_SELECT&&this.$input.attr("multiple")?this.items:this.items.join(this.settings.delimiter)},setValue:function(t,e){(Array.isArray(t)?t:[t]).join("")!==this.items.join("")&&debounce_events(this,e?[]:["change"],function(){this.clear(e),this.addItems(t,e)})},setMaxItems:function(t){this.settings.maxItems=t=0===t?null:t,this.settings.mode=this.settings.mode||(1===this.settings.maxItems?"single":"multi"),this.refreshState()},setActiveItem:function(t,e){var n,i,o,s,r,a,l=this;if("single"!==l.settings.mode)if((t=$(t)).length){if("mousedown"===(n=e&&e.type.toLowerCase())&&l.isShiftDown&&l.$activeItems.length){for(a=l.$control.children(".active:last"),a=Array.prototype.indexOf.apply(l.$control[0].childNodes,[a[0]]),(o=Array.prototype.indexOf.apply(l.$control[0].childNodes,[t[0]]))<a&&(r=a,a=o,o=r),i=a;i<=o;i++)s=l.$control[0].childNodes[i],-1===l.$activeItems.indexOf(s)&&($(s).addClass("active"),l.$activeItems.push(s));e.preventDefault()}else"mousedown"===n&&l.isCtrlDown||"keydown"===n&&this.isShiftDown?t.hasClass("active")?(r=l.$activeItems.indexOf(t[0]),l.$activeItems.splice(r,1),t.removeClass("active")):l.$activeItems.push(t.addClass("active")[0]):($(l.$activeItems).removeClass("active"),l.$activeItems=[t.addClass("active")[0]]);l.hideInput(),this.isFocused||l.focus()}else $(l.$activeItems).removeClass("active"),l.$activeItems=[],l.isFocused&&l.showInput()},setActiveOption:function(t,e,n){var i,o,s,r,a=this;a.$activeOption&&(a.$activeOption.removeClass("active"),a.trigger("dropdown_item_deactivate",a.$activeOption.attr("data-value"))),a.$activeOption=null,(t=$(t)).length&&(a.$activeOption=t.addClass("active"),a.isOpen&&a.trigger("dropdown_item_activate",a.$activeOption.attr("data-value")),!e&&isset(e)||(t=a.$dropdown_content.height(),i=a.$activeOption.outerHeight(!0),e=a.$dropdown_content.scrollTop()||0,r=(s=o=a.$activeOption.offset().top-a.$dropdown_content.offset().top+e)-t+i,t+e<o+i?a.$dropdown_content.stop().animate({scrollTop:r},n?a.settings.scrollDuration:0):o<e&&a.$dropdown_content.stop().animate({scrollTop:s},n?a.settings.scrollDuration:0)))},selectAll:function(){var t=this;"single"!==t.settings.mode&&(t.$activeItems=Array.prototype.slice.apply(t.$control.children(":not(input)").addClass("active")),t.$activeItems.length&&(t.hideInput(),t.close()),t.focus())},hideInput:function(){this.setTextboxValue(""),this.$control_input.css({opacity:0,position:"absolute",left:this.rtl?1e4:0}),this.isInputHidden=!0},showInput:function(){this.$control_input.css({opacity:1,position:"relative",left:0}),this.isInputHidden=!1},focus:function(){var t=this;return t.isDisabled||(t.ignoreFocus=!0,t.$control_input[0].focus(),window.setTimeout(function(){t.ignoreFocus=!1,t.onFocus()},0)),t},blur:function(t){return this.$control_input[0].blur(),this.onBlur(null,t),this},getScoreFunction:function(t){return this.sifter.getScoreFunction(t,this.getSearchOptions())},getSearchOptions:function(){var t=this.settings,e=t.sortField;return{fields:t.searchField,conjunction:t.searchConjunction,sort:e="string"==typeof e?[{field:e}]:e,nesting:t.nesting,filter:t.filter,respect_word_boundaries:t.respect_word_boundaries}},search:function(t){var e,n,i,o=this,s=o.settings,r=this.getSearchOptions();if(s.score&&"function"!=typeof(i=o.settings.score.apply(this,[t])))throw new Error('Selectize "score" setting must be a function that returns a function');if(t!==o.lastQuery?(s.normalize&&(t=t.normalize("NFD").replace(/[\u0300-\u036f]/g,"")),o.lastQuery=t,n=o.sifter.search(t,$.extend(r,{score:i})),o.currentResults=n):n=$.extend(!0,{},o.currentResults),s.hideSelected)for(e=n.items.length-1;0<=e;e--)-1!==o.items.indexOf(hash_key(n.items[e].id))&&n.items.splice(e,1);return n},refreshOptions:function(t){void 0===t&&(t=!0);var e,n,i,o,s,r,a,l,p,c,u,d,h,g=this,f=g.$control_input.val().trim(),v=g.search(f),m=g.$dropdown_content,y=g.$activeOption&&hash_key(g.$activeOption.attr("data-value")),w=v.items.length;for("number"==typeof g.settings.maxOptions&&(w=Math.min(w,g.settings.maxOptions)),o={},s=[],e=0;e<w;e++)for(r=g.options[v.items[e].id],a=g.render("option",r),O=r[g.settings.optgroupField]||"",n=0,i=(l=Array.isArray(O)?O:[O])&&l.length;n<i;n++){var C,O=l[n];g.optgroups.hasOwnProperty(O)||"function"!=typeof g.settings.optionGroupRegister||(C=g.settings.optionGroupRegister.apply(g,[O]))&&g.registerOptionGroup(C),g.optgroups.hasOwnProperty(O)||(O=""),o.hasOwnProperty(O)||(o[O]=document.createDocumentFragment(),s.push(O)),o[O].appendChild(a)}for(this.settings.lockOptgroupOrder&&s.sort(function(t,e){return(g.optgroups[t]&&g.optgroups[t].$order||0)-(g.optgroups[e]&&g.optgroups[e].$order||0)}),p=document.createDocumentFragment(),e=0,w=s.length;e<w;e++)g.optgroups.hasOwnProperty(O=s[e])&&o[O].childNodes.length?((c=document.createDocumentFragment()).appendChild(g.render("optgroup_header",g.optgroups[O])),c.appendChild(o[O]),p.appendChild(g.render("optgroup",$.extend({},g.optgroups[O],{html:domToString(c),dom:c})))):p.appendChild(o[O]);if(m.html(p),g.settings.highlight&&(m.removeHighlight(),v.query.length)&&v.tokens.length)for(e=0,w=v.tokens.length;e<w;e++)highlight(m,v.tokens[e].regex);if(!g.settings.hideSelected)for(g.$dropdown.find(".selected").removeClass("selected"),e=0,w=g.items.length;e<w;e++)g.getOption(g.items[e]).addClass("selected");"auto"!==g.settings.dropdownSize.sizeType&&g.isOpen&&g.setupDropdownHeight(),(u=g.canCreate(f))&&g.settings.showAddOptionOnCreate&&(m.prepend(g.render("option_create",{input:f})),h=$(m[0].childNodes[0])),g.hasOptions=0<v.items.length||u&&g.settings.showAddOptionOnCreate||g.settings.setFirstOptionActive,g.hasOptions?(0<v.items.length?(f=y&&g.getOption(y),""!==v.query&&g.settings.setFirstOptionActive?d=m.find("[data-selectable]:first"):""!==v.query&&f&&f.length?d=f:"single"===g.settings.mode&&g.items.length&&(d=g.getOption(g.items[0])),d&&d.length||(d=h&&!g.settings.addPrecedence?g.getAdjacentOption(h,1):m.find("[data-selectable]:first"))):d=h,g.setActiveOption(d),t&&!g.isOpen&&g.open()):(g.setActiveOption(null),t&&g.isOpen&&g.close())},addOption:function(t){var e,n,i,o=this;if(Array.isArray(t))for(e=0,n=t.length;e<n;e++)o.addOption(t[e]);else(i=o.registerOption(t))&&(o.userOptions[i]=!0,o.lastQuery=null,o.trigger("option_add",i,t))},registerOption:function(t){var e=hash_key(t[this.settings.valueField]);return null!=e&&!this.options.hasOwnProperty(e)&&(t.$order=t.$order||++this.order,this.options[e]=t,e)},registerOptionGroup:function(t){var e=hash_key(t[this.settings.optgroupValueField]);return!!e&&(t.$order=t.$order||++this.order,this.optgroups[e]=t,e)},addOptionGroup:function(t,e){e[this.settings.optgroupValueField]=t,(t=this.registerOptionGroup(e))&&this.trigger("optgroup_add",t,e)},removeOptionGroup:function(t){this.optgroups.hasOwnProperty(t)&&(delete this.optgroups[t],this.renderCache={},this.trigger("optgroup_remove",t))},clearOptionGroups:function(){this.optgroups={},this.renderCache={},this.trigger("optgroup_clear")},updateOption:function(t,e){var n,i,o,s=this;if(t=hash_key(t),n=hash_key(e[s.settings.valueField]),null!==t&&s.options.hasOwnProperty(t)){if("string"!=typeof n)throw new Error("Value must be set in option data");o=s.options[t].$order,n!==t&&(delete s.options[t],-1!==(i=s.items.indexOf(t)))&&s.items.splice(i,1,n),e.$order=e.$order||o,s.options[n]=e,i=s.renderCache.item,o=s.renderCache.option,i&&(delete i[t],delete i[n]),o&&(delete o[t],delete o[n]),-1!==s.items.indexOf(n)&&(i=s.getItem(t),o=$(s.render("item",e)),i.hasClass("active")&&o.addClass("active"),i.replaceWith(o)),s.lastQuery=null,s.isOpen&&s.refreshOptions(!1)}},removeOption:function(t,e){var n=this,i=(t=hash_key(t),n.renderCache.item),o=n.renderCache.option;i&&delete i[t],o&&delete o[t],delete n.userOptions[t],delete n.options[t],n.lastQuery=null,n.trigger("option_remove",t),n.removeItem(t,e)},clearOptions:function(t){var n=this,i=(n.loadedSearches={},n.userOptions={},n.renderCache={},n.options);$.each(n.options,function(t,e){-1==n.items.indexOf(t)&&delete i[t]}),n.options=n.sifter.items=i,n.lastQuery=null,n.trigger("option_clear"),n.clear(t)},getOption:function(t){return this.getElementWithValue(t,this.$dropdown_content.find("[data-selectable]"))},getFirstOption:function(){var t=this.$dropdown.find("[data-selectable]");return 0<t.length?t.eq(0):$()},getAdjacentOption:function(t,e){var n=this.$dropdown.find("[data-selectable]"),t=n.index(t)+e;return 0<=t&&t<n.length?n.eq(t):$()},getElementWithValue:function(t,e){if(null!=(t=hash_key(t)))for(var n=0,i=e.length;n<i;n++)if(e[n].getAttribute("data-value")===t)return $(e[n]);return $()},getElementWithTextContent:function(t,e,n){if(null!=(t=hash_key(t)))for(var i=0,o=n.length;i<o;i++){var s=n[i].textContent;if(1==e&&(s=null!==s?s.toLowerCase():null,t=t.toLowerCase()),s===t)return $(n[i])}return $()},getItem:function(t){return this.getElementWithValue(t,this.$control.children())},getFirstItemMatchedByTextContent:function(t,e){return this.getElementWithTextContent(t,e=null!==e&&!0===e,this.$dropdown_content.find("[data-selectable]"))},addItems:function(t,e){this.buffer=document.createDocumentFragment();for(var n=this.$control[0].childNodes,i=0;i<n.length;i++)this.buffer.appendChild(n[i]);for(var o=Array.isArray(t)?t:[t],i=0,s=o.length;i<s;i++)this.isPending=i<s-1,this.addItem(o[i],e);t=this.$control[0];t.insertBefore(this.buffer,t.firstChild),this.buffer=null},addItem:function(s,r){debounce_events(this,r?[]:["change"],function(){var t,e,n,i=this,o=i.settings.mode;s=hash_key(s),-1!==i.items.indexOf(s)?"single"===o&&i.close():i.options.hasOwnProperty(s)&&("single"===o&&i.clear(r),"multi"===o&&i.isFull()||(t=$(i.render("item",i.options[s])),n=i.isFull(),i.items.splice(i.caretPos,0,s),i.insertAtCaret(t),i.isPending&&(n||!i.isFull())||i.refreshState(),i.isSetup&&(n=i.$dropdown_content.find("[data-selectable]"),i.isPending||(e=i.getOption(s),e=i.getAdjacentOption(e,1).attr("data-value"),i.refreshOptions(i.isFocused&&"single"!==o),e&&i.setActiveOption(i.getOption(e))),!n.length||i.isFull()?i.close():i.isPending||i.positionDropdown(),i.updatePlaceholder(),i.trigger("item_add",s,t),i.isPending||i.updateOriginalInput({silent:r}))))})},removeItem:function(t,e){var n,i,o=this,s=t instanceof $?t:o.getItem(t);t=hash_key(s.attr("data-value")),-1!==(n=o.items.indexOf(t))&&(o.trigger("item_before_remove",t,s),s.remove(),s.hasClass("active")&&(s.removeClass("active"),i=o.$activeItems.indexOf(s[0]),o.$activeItems.splice(i,1),s.removeClass("active")),o.items.splice(n,1),o.lastQuery=null,!o.settings.persist&&o.userOptions.hasOwnProperty(t)&&o.removeOption(t,e),n<o.caretPos&&o.setCaret(o.caretPos-1),o.refreshState(),o.updatePlaceholder(),o.updateOriginalInput({silent:e}),o.positionDropdown(),o.trigger("item_remove",t,s))},createItem:function(t,n){var i=this,o=i.caretPos,s=(t=t||(i.$control_input.val()||"").trim(),arguments[arguments.length-1]);if("function"!=typeof s&&(s=function(){}),"boolean"!=typeof n&&(n=!0),!i.canCreate(t))return s(),!1;i.lock();var e="function"==typeof i.settings.create?this.settings.create:function(t){var e={},t=e[i.settings.labelField]=t;if(!i.settings.formatValueToKey||"function"!=typeof i.settings.formatValueToKey||null!=(t=i.settings.formatValueToKey.apply(this,[t]))&&"object"!=typeof t&&"function"!=typeof t)return e[i.settings.valueField]=t,e;throw new Error('Selectize "formatValueToKey" setting must be a function that returns a value other than object or function.')},r=once(function(t){var e;return i.unlock(),!t||"object"!=typeof t||"string"!=typeof(e=hash_key(t[i.settings.valueField]))?s():(i.setTextboxValue(""),i.addOption(t),i.setCaret(o),i.addItem(e),i.refreshOptions(n&&"single"!==i.settings.mode),void s(t))}),e=e.apply(this,[t,r]);return void 0!==e&&r(e),!0},refreshItems:function(t){this.lastQuery=null,this.isSetup&&this.addItem(this.items,t),this.refreshState(),this.updateOriginalInput({silent:t})},refreshState:function(){this.refreshValidityState(),this.refreshClasses()},refreshValidityState:function(){if(!this.isRequired)return!1;var t=!this.items.length;this.isInvalid=t,this.$control_input.prop("required",t),this.$input.prop("required",!t)},refreshClasses:function(){var t=this,e=t.isFull(),n=t.isLocked;t.$wrapper.toggleClass("rtl",t.rtl),t.$control.toggleClass("focus",t.isFocused).toggleClass("disabled",t.isDisabled).toggleClass("required",t.isRequired).toggleClass("invalid",t.isInvalid).toggleClass("locked",n).toggleClass("full",e).toggleClass("not-full",!e).toggleClass("input-active",t.isFocused&&!t.isInputHidden).toggleClass("dropdown-active",t.isOpen).toggleClass("has-options",!$.isEmptyObject(t.options)).toggleClass("has-items",0<t.items.length),t.$control_input.data("grow",!e&&!n)},isFull:function(){return null!==this.settings.maxItems&&this.items.length>=this.settings.maxItems},updateOriginalInput:function(t){var e,n,i,o,s,r,a=this;t=t||{},a.tagType===TAG_SELECT?(o=a.$input.find("option"),e=[],n=[],i=[],r=[],o.get().forEach(function(t){e.push(t.value)}),a.items.forEach(function(t){s=a.options[t][a.settings.labelField]||"",r.push(t),-1==e.indexOf(t)&&n.push('<option value="'+escape_html(t)+'" selected="selected">'+escape_html(s)+"</option>")}),i=e.filter(function(t){return r.indexOf(t)<0}).map(function(t){return'option[value="'+t+'"]'}),e.length-i.length+n.length!==0||a.$input.attr("multiple")||n.push('<option value="" selected="selected"></option>'),a.$input.find(i.join(", ")).remove(),a.$input.append(n.join(""))):(a.$input.val(a.getValue()),a.$input.attr("value",a.$input.val())),a.isSetup&&!t.silent&&a.trigger("change",a.$input.val())},updatePlaceholder:function(){var t;this.settings.placeholder&&(t=this.$control_input,this.items.length?t.removeAttr("placeholder"):t.attr("placeholder",this.settings.placeholder),t.triggerHandler("update",{force:!0}))},open:function(){var t=this;t.isLocked||t.isOpen||"multi"===t.settings.mode&&t.isFull()||(t.focus(),t.isOpen=!0,t.refreshState(),t.$dropdown.css({visibility:"hidden",display:"block"}),t.setupDropdownHeight(),t.positionDropdown(),t.$dropdown.css({visibility:"visible"}),t.trigger("dropdown_open",t.$dropdown))},close:function(){var t=this,e=t.isOpen;"single"===t.settings.mode&&t.items.length&&(t.hideInput(),t.isBlurring)&&t.$control_input[0].blur(),t.isOpen=!1,t.$dropdown.hide(),t.setActiveOption(null),t.refreshState(),e&&t.trigger("dropdown_close",t.$dropdown)},positionDropdown:function(){var t=this.$control,e="body"===this.settings.dropdownParent?t.offset():t.position(),t=(e.top+=t.outerHeight(!0),t[0].getBoundingClientRect().width);this.settings.minWidth&&this.settings.minWidth>t&&(t=this.settings.minWidth),this.$dropdown.css({width:t,top:e.top,left:e.left})},setupDropdownHeight:function(){if("object"==typeof this.settings.dropdownSize&&"auto"!==this.settings.dropdownSize.sizeType){var t=this.settings.dropdownSize.sizeValue;if("numberItems"===this.settings.dropdownSize.sizeType){for(var e=this.$dropdown_content.find("*").not(".optgroup, .highlight").not(this.settings.ignoreOnDropwdownHeight),n=0,i=0,o=0,s=0,r=0;r<t;r++){var a=$(e[r]);if(0===a.length)break;n+=a.outerHeight(!0),void 0===a.data("selectable")&&(a.hasClass("optgroup-header")&&(a=window.getComputedStyle(a.parent()[0],":before"))&&(i=a.marginTop?Number(a.marginTop.replace(/\W*(\w)\w*/g,"$1")):0,o=a.marginBottom?Number(a.marginBottom.replace(/\W*(\w)\w*/g,"$1")):0,s=a.borderTopWidth?Number(a.borderTopWidth.replace(/\W*(\w)\w*/g,"$1")):0),t++)}t=n+(this.$dropdown_content.css("padding-top")?Number(this.$dropdown_content.css("padding-top").replace(/\W*(\w)\w*/g,"$1")):0)+(this.$dropdown_content.css("padding-bottom")?Number(this.$dropdown_content.css("padding-bottom").replace(/\W*(\w)\w*/g,"$1")):0)+i+o+s+"px"}else if("fixedHeight"!==this.settings.dropdownSize.sizeType)return void console.warn('Selectize.js - Value of "sizeType" must be "fixedHeight" or "numberItems');this.$dropdown_content.css({height:t,maxHeight:"none"})}},clear:function(t){var e=this;e.items.length&&(e.$control.children(":not(input)").remove(),e.items=[],e.lastQuery=null,e.setCaret(0),e.setActiveItem(null),e.updatePlaceholder(),e.updateOriginalInput({silent:t}),e.refreshState(),e.showInput(),e.trigger("clear"))},insertAtCaret:function(t){var e=Math.min(this.caretPos,this.items.length),t=t[0],n=this.buffer||this.$control[0];0===e?n.insertBefore(t,n.firstChild):n.insertBefore(t,n.childNodes[e]),this.setCaret(e+1)},deleteSelection:function(t){var e,n,i,o,s,r=this,a=t&&t.keyCode===KEY_BACKSPACE?-1:1,l=getInputSelection(r.$control_input[0]);if(r.$activeOption&&!r.settings.hideSelected&&(o=("string"==typeof r.settings.deselectBehavior&&"top"===r.settings.deselectBehavior?r.getFirstOption():r.getAdjacentOption(r.$activeOption,-1)).attr("data-value")),i=[],r.$activeItems.length){for(s=r.$control.children(".active:"+(0<a?"last":"first")),s=r.$control.children(":not(input)").index(s),0<a&&s++,e=0,n=r.$activeItems.length;e<n;e++)i.push($(r.$activeItems[e]).attr("data-value"));t&&(t.preventDefault(),t.stopPropagation())}else(r.isFocused||"single"===r.settings.mode)&&r.items.length&&(a<0&&0===l.start&&0===l.length?i.push(r.items[r.caretPos-1]):0<a&&l.start===r.$control_input.val().length&&i.push(r.items[r.caretPos]));if(!i.length||"function"==typeof r.settings.onDelete&&!1===r.settings.onDelete.apply(r,[i]))return!1;for(void 0!==s&&r.setCaret(s);i.length;)r.removeItem(i.pop());return r.showInput(),r.positionDropdown(),r.refreshOptions(!0),o&&(t=r.getOption(o)).length&&r.setActiveOption(t),!0},advanceSelection:function(t,e){var n,i,o,s=this;0!==t&&(s.rtl&&(t*=-1),n=0<t?"last":"first",o=getInputSelection(s.$control_input[0]),s.isFocused&&!s.isInputHidden?(i=s.$control_input.val().length,(t<0?0!==o.start||0!==o.length:o.start!==i)||i||s.advanceCaret(t,e)):(o=s.$control.children(".active:"+n)).length&&(i=s.$control.children(":not(input)").index(o),s.setActiveItem(null),s.setCaret(0<t?i+1:i)))},advanceCaret:function(t,e){var n,i=this;0!==t&&(i.isShiftDown?(n=i.$control_input[0<t?"next":"prev"]()).length&&(i.hideInput(),i.setActiveItem(n),e)&&e.preventDefault():i.setCaret(i.caretPos+t))},setCaret:function(t){var e=this;if(t="single"===e.settings.mode?e.items.length:Math.max(0,Math.min(e.items.length,t)),!e.isPending)for(var n,i=e.$control.children(":not(input)"),o=0,s=i.length;o<s;o++)n=$(i[o]).detach(),o<t?e.$control_input.before(n):e.$control.append(n);e.caretPos=t},lock:function(){this.close(),this.isLocked=!0,this.refreshState()},unlock:function(){this.isLocked=!1,this.refreshState()},disable:function(){this.$input.prop("disabled",!0),this.$control_input.prop("disabled",!0).prop("tabindex",-1),this.isDisabled=!0,this.lock()},enable:function(){var t=this;t.$input.prop("disabled",!1),t.$control_input.prop("disabled",!1).prop("tabindex",t.tabIndex),t.isDisabled=!1,t.unlock()},destroy:function(){var t=this,e=t.eventNS,n=t.revertSettings;t.trigger("destroy"),t.off(),t.$wrapper.remove(),t.$dropdown.remove(),t.$input.html("").append(n.$children).removeAttr("tabindex").removeClass("selectized").attr({tabindex:n.tabindex}).show(),t.$control_input.removeData("grow"),t.$input.removeData("selectize"),0==--Selectize.count&&Selectize.$testInput&&(Selectize.$testInput.remove(),Selectize.$testInput=void 0),$(window).off(e),$(document).off(e),$(document.body).off(e),delete t.$input[0].selectize},render:function(t,e){var n,i,o="",s=!1,r=this;return(s="option"!==t&&"item"!==t?s:!!(n=hash_key(e[r.settings.valueField])))&&(isset(r.renderCache[t])||(r.renderCache[t]={}),r.renderCache[t].hasOwnProperty(n))?r.renderCache[t][n]:(o=$(r.settings.render[t].apply(this,[e,escape_html])),"option"===t||"option_create"===t?e[r.settings.disabledField]||o.attr("data-selectable",""):"optgroup"===t&&(i=e[r.settings.optgroupValueField]||"",o.attr("data-group",i),e[r.settings.disabledField])&&o.attr("data-disabled",""),"option"!==t&&"item"!==t||o.attr("data-value",n||""),s&&(r.renderCache[t][n]=o[0]),o[0])},clearCache:function(t){void 0===t?this.renderCache={}:delete this.renderCache[t]},canCreate:function(t){var e;return!!this.settings.create&&(e=this.settings.createFilter,t.length)&&("function"!=typeof e||e.apply(this,[t]))&&("string"!=typeof e||new RegExp(e).test(t))&&(!(e instanceof RegExp)||e.test(t))}}),Selectize.count=0,Selectize.defaults={options:[],optgroups:[],plugins:[],delimiter:",",splitOn:null,persist:!0,diacritics:!0,create:!1,showAddOptionOnCreate:!0,createOnBlur:!1,createFilter:null,highlight:!0,openOnFocus:!0,maxOptions:1e3,maxItems:null,hideSelected:null,addPrecedence:!1,selectOnTab:!0,preload:!1,allowEmptyOption:!1,showEmptyOptionInDropdown:!1,emptyOptionLabel:"--",setFirstOptionActive:!1,closeAfterSelect:!1,closeDropdownThreshold:250,scrollDuration:60,deselectBehavior:"previous",loadThrottle:300,loadingClass:"loading",dataAttr:"data-data",optgroupField:"optgroup",valueField:"value",labelField:"text",disabledField:"disabled",optgroupLabelField:"label",optgroupValueField:"value",lockOptgroupOrder:!1,sortField:"$order",searchField:["text"],searchConjunction:"and",respect_word_boundaries:!0,mode:null,wrapperClass:"",inputClass:"",dropdownClass:"",dropdownContentClass:"",dropdownParent:null,copyClassesToDropdown:!0,dropdownSize:{sizeType:"auto",sizeValue:"auto"},normalize:!1,ignoreOnDropwdownHeight:"img, i",search:!0,render:{}},$.fn.selectize=function(c){function u(t,o){function e(t,e){t=$(t);var n,i=hash_key(t.val());(i||v.allowEmptyOption)&&(l.hasOwnProperty(i)?e&&((n=l[i][O])?Array.isArray(n)?n.push(e):l[i][O]=[n,e]:l[i][O]=e):((n=p(t)||{})[y]=n[y]||t.text(),n[w]=n[w]||i,n[C]=n[C]||t.prop("disabled"),n[O]=n[O]||e,n.styles=t.attr("style")||"",n.classes=t.attr("class")||"",l[i]=n,a.push(n),t.is(":selected")&&o.items.push(i)))}var n,i,s,r,a=o.options,l={},p=function(t){var e=m&&t.attr(m),t=t.data(),n={};return"string"==typeof e&&e.length&&(isJSON(e)?Object.assign(n,JSON.parse(e)):n[e]=e),Object.assign(n,t),n||null};for(o.maxItems=t.attr("multiple")?null:1,n=0,i=(r=t.children()).length;n<i;n++)if("optgroup"===(s=r[n].tagName.toLowerCase())){g=h=d=u=c=void 0;var c,u,d,h,g,f=r[n];for((d=(f=$(f)).attr("label"))&&((h=p(f)||{})[_]=d,h[b]=d,h[C]=f.prop("disabled"),o.optgroups.push(h)),c=0,u=(g=$("option",f)).length;c<u;c++)e(g[c],d)}else"option"===s&&e(r[n])}var d=$.fn.selectize.defaults,v=$.extend({},d,c),m=v.dataAttr,y=v.labelField,w=v.valueField,C=v.disabledField,O=v.optgroupField,_=v.optgroupLabelField,b=v.optgroupValueField;return this.each(function(){if(!this.selectize){var t=$(this),e=this.tagName.toLowerCase(),n=t.attr("placeholder")||t.attr("data-placeholder"),i=(n||v.allowEmptyOption||(n=t.children('option[value=""]').text()),v.allowEmptyOption&&v.showEmptyOptionInDropdown&&!t.children('option[value=""]').length&&(l=t.html(),i=escape_html(v.emptyOptionLabel||"--"),t.html('<option value="">'+i+"</option>"+l)),{placeholder:n,options:[],optgroups:[],items:[]});if("select"===e)u(t,i);else{var o,s,r,a,l=t,p=i,n=l.attr(m);if(n)for(p.options=JSON.parse(n),o=0,s=p.options.length;o<s;o++)p.items.push(p.options[o][w]);else{n=(l.val()||"").trim();if(v.allowEmptyOption||n.length){for(o=0,s=(r=n.split(v.delimiter)).length;o<s;o++)(a={})[y]=r[o],a[w]=r[o],p.options.push(a);p.items=r}}}new Selectize(t,$.extend(!0,{},d,i,c)).settings_user=c}})},$.fn.selectize.defaults=Selectize.defaults,$.fn.selectize.support={validity:SUPPORTS_VALIDITY_API},Selectize.define("auto_position",function(){const o={top:"top",bottom:"bottom"};this.positionDropdown=function(){var t=this.$control,e="body"===this.settings.dropdownParent?t.offset():t.position(),n=(e.top+=t.outerHeight(!0),this.$dropdown.prop("scrollHeight")+5),n=this.$control.get(0).getBoundingClientRect().top+n+this.$wrapper.height()>window.innerHeight?o.top:o.bottom,i={width:t.outerWidth(),left:e.left};n===o.top?(n={bottom:e.top,top:"unset"},"body"===this.settings.dropdownParent&&(n.top=e.top-this.$dropdown.outerHeight(!0)-t.outerHeight(!0),n.bottom="unset"),Object.assign(i,n),this.$dropdown.addClass("selectize-position-top"),this.$control.addClass("selectize-position-top")):(Object.assign(i,{top:e.top,bottom:"unset"}),this.$dropdown.removeClass("selectize-position-top"),this.$control.removeClass("selectize-position-top")),this.$dropdown.css(i)}}),Selectize.define("auto_select_on_type",function(t){var n,i=this;i.onBlur=(n=i.onBlur,function(t){var e=i.getFirstItemMatchedByTextContent(i.lastValue,!0);return void 0!==e.attr("data-value")&&i.getValue()!==e.attr("data-value")&&i.setValue(e.attr("data-value")),n.apply(this,arguments)})}),Selectize.define("autofill_disable",function(t){var e,n=this;n.setup=(e=n.setup,function(){e.apply(n,arguments),n.$control_input.attr({autocomplete:"new-password",autofill:"no"})})}),Selectize.define("clear_button",function(e){var t,n=this;e=$.extend({title:"Clear",className:"clear",label:"×",html:function(t){return'<a class="'+t.className+'" title="'+t.title+'"> '+t.label+"</a>"}},e),n.setup=(t=n.setup,function(){t.apply(n,arguments),n.$button_clear=$(e.html(e)),"single"===n.settings.mode&&n.$wrapper.addClass("single"),n.$wrapper.append(n.$button_clear),""!==n.getValue()&&0!==n.getValue().length||n.$wrapper.find("."+e.className).css("display","none"),n.on("change",function(){""===n.getValue()||0===n.getValue().length?n.$wrapper.find("."+e.className).css("display","none"):n.$wrapper.find("."+e.className).css("display","")}),n.$wrapper.on("click","."+e.className,function(t){t.preventDefault(),t.stopImmediatePropagation(),t.stopPropagation(),n.isLocked||(n.clear(),n.$wrapper.find("."+e.className).css("display","none"))})})}),Selectize.define("drag_drop",function(t){if(!$.fn.sortable)throw new Error('The "drag_drop" plugin requires jQuery UI "sortable".');var i,e,n,o;"multi"===this.settings.mode&&((i=this).lock=(e=i.lock,function(){var t=i.$control.data("sortable");return t&&t.disable(),e.apply(i,arguments)}),i.unlock=(n=i.unlock,function(){var t=i.$control.data("sortable");return t&&t.enable(),n.apply(i,arguments)}),i.setup=(o=i.setup,function(){o.apply(this,arguments);var n=i.$control.sortable({items:"[data-value]",forcePlaceholderSize:!0,disabled:i.isLocked,start:function(t,e){e.placeholder.css("width",e.helper.css("width")),n.addClass("dragging")},stop:function(){n.removeClass("dragging");var t=i.$activeItems?i.$activeItems.slice():null,e=[];n.children("[data-value]").each(function(){e.push($(this).attr("data-value"))}),i.isFocused=!1,i.setValue(e),i.isFocused=!0,i.setActiveItem(t),i.positionDropdown()}})}))}),Selectize.define("dropdown_header",function(t){var e,n=this;t=$.extend({title:"Untitled",headerClass:"selectize-dropdown-header",titleRowClass:"selectize-dropdown-header-title",labelClass:"selectize-dropdown-header-label",closeClass:"selectize-dropdown-header-close",html:function(t){return'<div class="'+t.headerClass+'"><div class="'+t.titleRowClass+'"><span class="'+t.labelClass+'">'+t.title+'</span><a href="javascript:void(0)" class="'+t.closeClass+'">&#xd7;</a></div></div>'}},t),n.setup=(e=n.setup,function(){e.apply(n,arguments),n.$dropdown_header=$(t.html(t)),n.$dropdown.prepend(n.$dropdown_header),n.$dropdown_header.find("."+t.closeClass).on("click",function(){n.close()})})}),Selectize.define("optgroup_columns",function(r){function t(){var t,e,n,i,o=$("[data-group]",a.$dropdown_content),s=o.length;if(s&&a.$dropdown_content.width()){if(r.equalizeHeight){for(t=e=0;t<s;t++)e=Math.max(e,o.eq(t).height());o.css({height:e})}r.equalizeWidth&&(i=a.$dropdown_content.innerWidth()-l(),n=Math.round(i/s),o.css({width:n}),1<s)&&(i=i-n*(s-1),o.eq(s-1).css({width:i}))}}var i,a=this,l=(r=$.extend({equalizeWidth:!0,equalizeHeight:!0},r),this.getAdjacentOption=function(t,e){var n=t.closest("[data-group]").find("[data-selectable]"),t=n.index(t)+e;return 0<=t&&t<n.length?n.eq(t):$()},this.onKeyDown=(i=a.onKeyDown,function(t){var e,n;if(!this.isOpen||t.keyCode!==KEY_LEFT&&t.keyCode!==KEY_RIGHT)return i.apply(this,arguments);a.ignoreHover=!0,e=(n=this.$activeOption.closest("[data-group]")).find("[data-selectable]").index(this.$activeOption),(n=(n=(n=t.keyCode===KEY_LEFT?n.prev("[data-group]"):n.next("[data-group]")).find("[data-selectable]")).eq(Math.min(n.length-1,e))).length&&this.setActiveOption(n)}),function(){var t,e=l.width,n=document;return void 0===e&&((t=n.createElement("div")).innerHTML='<div style="width:50px;height:50px;position:absolute;left:-50px;top:-50px;overflow:auto;"><div style="width:1px;height:100px;"></div></div>',t=t.firstChild,n.body.appendChild(t),e=l.width=t.offsetWidth-t.clientWidth,n.body.removeChild(t)),e});(r.equalizeHeight||r.equalizeWidth)&&(hook.after(this,"positionDropdown",t),hook.after(this,"refreshOptions",t))}),Selectize.define("remove_button",function(t){var s,e,n,i,r;"single"!==this.settings.mode&&(t=$.extend({label:"&#xd7;",title:"Remove",className:"remove",append:!0},t),i=s=this,r='<a href="javascript:void(0)" class="'+(e=t).className+'" tabindex="-1" title="'+escape_html(e.title)+'">'+e.label+"</a>",s.setup=(n=i.setup,function(){var o;e.append&&(o=i.settings.render.item,i.settings.render.item=function(t){return e=o.apply(s,arguments),n=r,i=e.search(/(<\/[^>]+>\s*)$/),e.substring(0,i)+n+e.substring(i);var e,n,i}),n.apply(s,arguments),s.$control.on("click","."+e.className,function(t){if(t.preventDefault(),!i.isLocked)return t=$(t.currentTarget).parent(),i.setActiveItem(t),i.deleteSelection()&&i.setCaret(i.items.length),!1})}))}),Selectize.define("restore_on_backspace",function(n){var i,t=this;n.text=n.text||function(t){return t[this.settings.labelField]},this.onKeyDown=(i=t.onKeyDown,function(t){var e;if(!(t.keyCode===KEY_BACKSPACE&&""===this.$control_input.val()&&!this.$activeItems.length&&0<=(e=this.caretPos-1)&&e<this.items.length))return i.apply(this,arguments);e=this.options[this.items[e]],this.deleteSelection(t)&&(this.setTextboxValue(n.text.apply(this,[e])),this.refreshOptions(!0)),t.preventDefault()})}),Selectize.define("select_on_focus",function(t){var n,e,i=this;i.on("focus",(n=i.onFocus,function(t){var e=i.getItem(i.getValue()).text();return i.clear(),i.setTextboxValue(e),i.$control_input.select(),setTimeout(function(){i.settings.selectOnTab&&i.setActiveOption(i.getFirstItemMatchedByTextContent(e)),i.settings.score=null},0),n.apply(this,arguments)})),i.onBlur=(e=i.onBlur,function(t){return""===i.getValue()&&i.lastValidValue!==i.getValue()&&i.setValue(i.lastValidValue),setTimeout(function(){i.settings.score=function(){return function(){return 1}}},0),e.apply(this,arguments)}),i.settings.score=function(){return function(){return 1}}}),Selectize.define("tag_limit",function(o){const t=this;o.tagLimit=o.tagLimit,this.onBlur=function(){const i=t.onBlur;return function(t){if(i.apply(this,t),t){var t=this.$control,e=t.find(".item");const n=o.tagLimit;void 0===n||e.length<=n||(e.toArray().forEach(function(t,e){e<n||$(t).hide()}),t.append("<span><b>"+(e.length-n)+"</b></span>"))}}}(),this.onFocus=function(){const e=t.onFocus;return function(t){e.apply(this,t),t&&((t=this.$control).find(".item").show(),t.find("span").remove())}}()});
  return Selectize;
}));
(function() {
  $(function() {
    $(document).on("click", '.detect-location', function(e) {
      return hitLocation($(this), e);
    });
    return $(document).on("keypress", '.detect-location', function(e) {
      var key;
      key = e.which;
      if (key === 13) {
        return hitLocation($(this), e);
      }
    });
  });

  this.hitLocation = function(current, e) {
    var geoPoints;
    e.preventDefault();
    geoPoints = '';
    if ($(current).hasClass('span-location')) {
      $(current).html(I18n.t('js.spin_icon'));
    }
    if (navigator.geolocation) {
      return getRequestLocation();
    } else {
      $.rails.enableElement($('.detect-location'));
      $('.location-find').append('<p class="small-font error-msg">' + I18n.t('js.detect_location.support_msg') + '</p>');
      return locationSpinner('.detect-location');
    }
  };

  this.getRequestLocation = function() {
    return navigator.geolocation.getCurrentPosition(successCallback, errorCallbackHighAccuracy, {
      maximumAge: 600000,
      timeout: 25000,
      enableHighAccuracy: true
    });
  };

  this.successCallback = function(position) {
    var geoPoints;
    geoPoints = position.coords.latitude + ", " + position.coords.longitude;
    return loadCurrentLoaction(geoPoints);
  };

  this.errorCallbackHighAccuracy = function(error) {
    checkAccessLocation();
    return setTimeout(function(e) {
      if ($('.location-find').find('.error-msg').length > 0) {
        $('.location-find').find('.error-msg').remove();
        return locationSpinner('.detect-location');
      }
    }, 5000);
  };

  this.checkAccessLocation = function(state) {
    $.rails.enableElement($('.detect-location'));
    if ($('.location-find').find('.error-msg').length > 0) {
      $('.location-find').find('.error-msg').remove();
    }
    return $('.location-find').append('<p class="small-font red error-msg">' + I18n.t('js.detect_location.enable_loc') + '</p>');
  };

  this.loadCurrentLoaction = function(geoPoints) {
    if ($('.location-find').find('.error-msg').length > 0) {
      $('.location-find').find('.error-msg').remove();
    }
    return $.ajax({
      url: "/jobs_current_location/?geo_point=" + geoPoints
    }).done(function(res) {
      var $detectLocation;
      $detectLocation = $('.detect-location');
      $('input[name="location"]').val(res.address_location);
      $('input[name="location"]').attr('auto-detect', true);
      $.rails.enableElement($detectLocation);
      return locationSpinner($detectLocation);
    });
  };

  this.locationSpinner = function(detectLocation) {
    if ($(detectLocation).hasClass('span-location')) {
      return $(detectLocation).html(I18n.t('js.location_icon'));
    }
  };

}).call(this);
const pageTitle = $('title').html();
const defaultFavicon = $('#favicon_data').attr('href');
const unreadMsgFavicon = $('#favicon_data').data('unread');
window.dataLayer = window.dataLayer || [];

function authenticateFirebase() {
  firebase.auth().signInWithCustomToken(window.uuid)
    .then(function(){
      watchUnreadMessageCount();
    })
    .catch(function (error) {
      console.log("Firebase Auth Error: ", JSON.stringify(error));
      return;
    });
}

function watchUnreadMessageCount(maxShown) {
  var maxShown = maxShown || 99;
  firebase.database().ref('users').child(window.uid).child('unread_message_count').on('value', function (snapshot) {
    const unreadMessageCount = Math.min(snapshot.val() || 0, maxShown);
    updateBrowserTab(unreadMessageCount);
    pushToDataLayer(unreadMessageCount);
    $('.menu-us ul.sous-menu span.notificationCount, .main-message-menu span.notificationCount').each(function () {
      $(this).children().text(unreadMessageCount);
      if (unreadMessageCount > 0) {
        $(this).removeClass('dn-i');
        $(this).removeAttr('aria-hidden')
        $(this).attr('aria-label', ', '+ unreadMessageCount + " " + I18n.t('js.unread_messages'))
      } else {
        $(this).addClass('dn-i');
      }
    });
  });
}

function updateBrowserTab(unreadMessageCount) {
  if (unreadMessageCount > 0) {
    $('title').html("(" + unreadMessageCount + " " + I18n.t('js.unread_messages') + ")   " + pageTitle);
    $('#favicon_data').attr('href', unreadMsgFavicon);
  } else {
    $('title').html(pageTitle);
    $('#favicon_data').attr('href', defaultFavicon);
  }
}

function pushToDataLayer(unreadMessageCount) {
  window.dataLayer.push({
    'event': 'messagecenter_notification',
    'messagecenter_count': unreadMessageCount
  });
}

$(document).ready(function () {
  if (window.firebaseConfig) {
    firebase.initializeApp(window.firebaseConfig);
    if (window.uuid) {
      authenticateFirebase();
    }
  }
});
function pushOneTapEvents(oneTapEnable, loggedIn, lightRegistration) {
  if (oneTapEnable === "true" && loggedIn === "false" && lightRegistration === "true") {
    window.dataLayer.push({ 'one_tap_available': true });

    oneTap = $('#g_id_onload');
    if (oneTap.children().length == 1) {
      window.dataLayer.push({ 'event': 'one_tap_visible' });
    }
  }
  else {
    window.dataLayer.push({ 'one_tap_available': false });
  }
};
(function() {
  $(function() {
    if ($('#site-content .cortex').length) {
      $('#site-content .cortex a[name="OLE_LINK2"]').remove();
      return $('#site-content .cortex a[name="OLE_LINK1"]').attr('href', '#');
    }
  });

}).call(this);
$(document).ready(function () {
  $('#company_list').easyAutocomplete({
    url: function(phrase) {
      if (phrase != '') {
        return "/autocomplete/company_list/?term=" + phrase;
      }
    },
    list: {
      maxNumberOfElements: 10,
      sort: {
        enabled: true
      },
      onClickEvent: function() {
        setCompanyUrl()
      },
      onLoadEvent: function() {
        if($('#company_list').getItemData(0).did == ''){
          $('.eac-item').addClass('disabled');
          return;
        }
        $('#job-search-form')[0].setAttribute('action', '')
        $('#popular_companies_list').addClass('hide-mobile hide-me')
        $('#popular_companies_ul').html('')
        hideCompanyError();
      },
      onShowListEvent: function() {
      },
      onHideListEvent: function() {
        hideAcHint('#eac-container-companies');
      },
      onChooseEvent: function() {
        setCompanyUrl()
      }
    },
    getValue: 'company_name',
    requestDelay: 400
  });

  $('#company_page_sbmt').on('click', function(e) {
    $('#company_list').val($.trim($('#company_list').val()));
    if ($('#company_list').val() == '') {
      e.preventDefault();
      return;
    }
    
    $('#eac-container-company_list').children().html('')

    if ($('#job-search-form').attr('action') == '') {
      e.preventDefault();
      $('#popular_companies_ul').html('');
      companyHttpRequest();
    }
  });

  function companyHttpRequest() {
    $.ajax({
      url: '/autocomplete/company_list',
      type: 'GET',
      data: { term: $.trim($('#company_list').val())},
      dataType: 'json',
      success: function (data){
        if (data[0] != undefined) {
          if (data.length > 1) {
            company_list = true
            for (i = 0, l = data.length; i < l; i++) {
              if ($('#company_list').val().toLowerCase() == data[i]['company_name'].toLowerCase()) {
                $('#job-search-form')[0].setAttribute('action', companyUrl(data[i]['company_name'], data[i]['did']));
                company_list = false
                break;
              }
              url = companyUrl(data[i]['company_name'], data[i]['did']);
              $('#popular_companies_ul').append("<li><a href=" + encodeURI(url) + ">" + data[i]['company_name'] + "</a></li>");
            }
            if (company_list) {
              showPopularCompanies()
            }
          }
          else {
            $('#job-search-form')[0].setAttribute('action', companyUrl(data[0]['company_name'], data[0]['did']));
            $('#company_page_sbmt').click();
          }
        } else {
          showCompanyError();
          $('.invalid_company').html($('.invalid_company').data('text') + $('#company_list').val())
        }
      }
    });
  }

  function hideAcHint(acSelector) {
    $('#ac-text-hint').attr('aria-live', 'off');
  }

  function showPopularCompanies() {
    $('#popular_companies_list').removeClass('hide-mobile hide-me')
    $('#popular_companies').html($('#popular_companies').attr('data-text') + $('#company_list').val())
    hideCompanyError();
  }

  function setCompanyUrl() {
    company_did = $('#company_list').getSelectedItemData().did;
    company_name = $('#company_list').getSelectedItemData().company_name;
    $('#company_did').val(company_did);
    if (company_did != '') {
      $('#job-search-form')[0].setAttribute('action', companyUrl(company_name, company_did));
    }
  }

  function mobileView() {
    return document.body.clientWidth > 768 ? false : true;
  }

  function showCompanyError() {
    if(mobileView()){
      $('#company-error-mobile').removeClass('hide-me')
    }else{
      $('#company-error-desktop').removeClass('hide-me')
    }
  }

  function hideCompanyError() {
    $('.company_error').addClass('hide-me');
  }

  function reportWindowSize() {
    if (!$('#company-error-desktop')[0].classList.contains('hide-me') || !$('#company-error-mobile')[0].classList.contains('hide-me')){
      hideCompanyError();
      showCompanyError();
    }
  }

  function companyUrl(companyName, companyDID) {
    return '/company/' + companyName.replace(/\//g, '-') + '/' + companyDID
  }

  if($('#company-pages')[0]){
    window.addEventListener('resize', reportWindowSize);
  }

  $("#view-more-top-companies").on("click",function(e) {
    e.preventDefault();
    $(".company-logos a.img.dn-i").slice(0, 6).removeClass('dn-i');
    if($(".company-logos a.img.dn-i").length == 0) {
      $(this).addClass('dn-i');
    }
  });

});
(function() {
  $(function() {
    var AUTOCOMPLETE_CAROTENE_API_PATH, AUTOCOMPLETE_CAROTENE_DETAILS_API_PATH, AUTOCOMPLETE_LOCATION_API_PATH, CAROTENE_API_VERSION, DEFAULT_LOCATION, autosuggestionLocations, caroteneHttpRequest, validateLocation;
    window.salary = {};
    window.salary.salary_canonical_url = $('.salary-container').attr('data-salary-canonical-url');
    AUTOCOMPLETE_CAROTENE_API_PATH = '/autocomplete/carotene';
    AUTOCOMPLETE_CAROTENE_DETAILS_API_PATH = '/autocomplete/role';
    AUTOCOMPLETE_LOCATION_API_PATH = '/autocomplete/location';
    CAROTENE_API_VERSION = SettingControlValues.ColabAutoCompleteCaroteneApiVersion;
    DEFAULT_LOCATION = SettingControlValues.EnableEmptyDefaultLocationForColab === 'true' ? '' : SettingControlValues.CountryCode.toLowerCase();
    autosuggestionLocations = [];
    addMoreSkills();
    $(document).on('click', '.add-more-skills', addMoreSkills);
    $(document).on('change', '.salary-toggle-slide input.slide-checkbox', function() {
      var spinner, types;
      $('.salary-toggle-slide .spin-icon').remove();
      spinner = I18n.t('js.spin_icon');
      if ($(this).is(':checkbox')) {
        if ($(this).is(':checked')) {
          types = 'hour';
          $(document).find('.hourly-side').append(spinner);
        } else {
          types = 'year';
          $(document).find('.annual-side').prepend(spinner);
        }
      } else {
        types = $(this).val().toLowerCase();
        $(this).next().append(spinner);
      }
      if ($('.salary-toggle-slide input.slide-checkbox').length > 0) {
        if ($('.salary-calc-container .salary_chart_section').length > 0) {
          return getSalaryDetailsCall(types, false);
        } else {
          return getSalaryDetails(window.salary.salary_canonical_url, types);
        }
      }
    });
    $('.educational-part').owlCarousel({
      loop: false,
      margin: 10,
      autoWidth: true,
      nav: true,
      navText: ['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="black" width="18px" height="18px"><path d="M0 0h24v24H0z" fill="none"/><path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"/></svg>', '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="black" width="18px" height="18px"><path d="M0 0h24v24H0z" fill="none"/><path d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"/></svg>'],
      dots: false,
      itemsTablet: false,
      itemsMobile: false,
      mouseDrag: false,
      responsive: {
        0: {
          items: 2
        },
        600: {
          items: 3
        },
        1000: {
          items: 4,
          touchDrag: true
        }
      }
    });
    $('.educational-part.owl-carousel .owl-nav button').css({
      'top': -($('.educational-block').height() / 2.5)
    });
    countLines();
    roleAutocomplete('.salary-container.new-ux #keywords', AUTOCOMPLETE_CAROTENE_API_PATH, CAROTENE_API_VERSION, '.salary-container.new-ux #keywords');
    $('.salary-container.new-ux #location-searched').easyAutocomplete({
      url: function(phrase) {
        if (phrase !== '') {
          return AUTOCOMPLETE_LOCATION_API_PATH + "/?skip_wfh=true&colab=true&term=" + phrase;
        }
      },
      list: {
        match: {
          enabled: true
        },
        maxNumberOfElements: 6,
        onLoadEvent: function() {
          var i, loc;
          i = 0;
          autosuggestionLocations = [];
          while (i < 6) {
            loc = $('.salary-container.new-ux #location-searched').getItemData(i);
            if (loc !== 'undefined' && loc !== -1) {
              autosuggestionLocations.push(loc.toLowerCase().split(', ').join(','));
            }
            i++;
          }
        }
      },
      requestDelay: 400
    });
    $('.salary-container.new-ux #role-search-sbmt').on('click', function(e) {
      e.preventDefault();
      $('.salary-container.new-ux #keywords').val($.trim($('.salary-container.new-ux #keywords').val()));
      if ($('.salary-container.new-ux #keywords').val() === '') {
        return;
      }
      $('.salary-container.new-ux #eac-container-keywords').children().html('');
      return caroteneHttpRequest();
    });
    caroteneHttpRequest = function() {
      var location, locationValid;
      location = $('.salary-container.new-ux #location-searched').val();
      locationValid = validateLocation(location);
      return $.ajax({
        url: AUTOCOMPLETE_CAROTENE_DETAILS_API_PATH,
        type: 'GET',
        dataType: 'json',
        data: {
          term: $('.salary-container.new-ux #keywords').val(),
          carotene_id: $('.salary-container.new-ux #carotene_id').val(),
          location: location.toLowerCase() === DEFAULT_LOCATION.toLowerCase() ? '' : location,
          location_valid: locationValid,
          carotene_api_version: CAROTENE_API_VERSION,
          fuzzy: true,
          salary_page: true
        },
        success: function(data) {
          if (data['not_found_message']) {
            showCommunityError();
            $('.missing_community').html(data['not_found_message']);
            return appendMatchingRoles(data['matched_carotene_roles']);
          } else if (data['url']) {
            return window.location = data['url'];
          }
        }
      });
    };
    return validateLocation = function(locationInput) {
      var isBrowserAutoDetected, isLocationFromAutosuggest, isLocationFromURL, location;
      location = locationInput.toLowerCase().split(', ').join(',');
      isBrowserAutoDetected = $('#role-location').attr('auto-detect') === 'true';
      isLocationFromAutosuggest = autosuggestionLocations.length && autosuggestionLocations.includes(location);
      isLocationFromURL = decodeURIComponent(window.location.href).indexOf(location.replace(' ', '-')) !== -1;
      return location === '' || isLocationFromAutosuggest || location === DEFAULT_LOCATION || isBrowserAutoDetected || isLocationFromURL;
    };
  });

  this.addMoreSkills = function() {
    $('.salary-page-skills .bubble-link.dn-i').slice(0, 9).fadeIn("slow", function() {
      $(this).removeClass('dn-i').next().fadeIn('fast').css('display', 'inline-block').removeClass('dn-i');
      $('.add-more-skills').html($('.salary-page-skills .bubble-link.dn-i').length + (" " + (I18n.t('js.more'))));
      if ($('.salary-page-skills .bubble-link.dn-i').length < 1) {
        return $('.add-more-skills').hide();
      }
    }).css('display', 'inline-block');
    if ($('.salary-page-skills .bubble-link.dn-i').length < 1) {
      return $('.add-more-skills').hide();
    }
  };

  this.countLines = function(eles) {
    if ($('.salary-articles').length) {
      return $('.salary-articles').each(function() {
        var divHeight, el, lineHeight, lines;
        el = $(this);
        divHeight = el.height();
        lineHeight = parseInt(el.css('line-height'));
        lines = Math.floor(divHeight / lineHeight);
        if (lines <= 2) {
          return el.after('<br />');
        }
      });
    }
  };

  this.getSalaryDetails = function(url, types) {
    return $.ajax({
      url: window.salary.salary_canonical_url,
      type: 'GET',
      dataType: 'script',
      data: {
        type: types,
        use_salary_api: $('#oc').length > 0,
        postal_code: $('#oc').data('postalCode'),
        cbsa_code: $('#oc').data('cbsaCode'),
        carotene_id: $('#oc').data('caroteneId'),
        role: $('#oc').data('role'),
        location: $('#oc').data('location')
      }
    });
  };

}).call(this);
(function() {
  $(function() {
    return $('.flash-message span').focus();
  });

  this.manageFlashMessageForAQA = function() {
    var flashMessage;
    if ($('.flash-message').length > 0 && !$('.flash-message').hasClass('maintenance') && !$('.flash-message').hasClass('complete-registration-banner')) {
      $('.flash-message').parent().addClass('flash-message-parent');
      flashMessage = $('.flash-message').clone().attr('tabindex', '0');
      $('.flash-message').remove();
      $('.flash-message-parent').prepend(flashMessage);
      $('.flash-message span').focus().attr({
        'tabindex': '-1'
      });
      return setTimeout(function() {
        return $('.flash-message span').attr({
          'tabindex': '-1',
          'aria-hidden': 'true'
        });
      }, 1000);
    }
  };

  if (SettingControlValues.EnableGlobalDesign === 'true') {
    $(window).load(function() {
      return manageFlashMessageForAQA();
    });
  }

}).call(this);
$(document).ready(function() {
  const CAREER_PATH_SELECTOR = '.career-path-roles-container .data-results-content';
  const ROLE_DESCRIPTION_SELECTOR = '.role-description-text';
  const LOAD_MORE_SELECTOR = '.career-path-roles-container button.load-more-btn';
  const SEE_LESS_SELECTOR = '.career-path-roles-container button.see-less-btn';
  const ROLE_DESCRIPTION_MIN_HEIGHT = 35;

  const noRoleModal = $('[data-remodal-id=next-job-no-role-found]');

  setTimeout(setRolesDescriptionHeight);

  function setRolesDescriptionHeight() {
    const rolesDescriptions = document.querySelectorAll(ROLE_DESCRIPTION_SELECTOR);

    if(rolesDescriptions == undefined || rolesDescriptions.length == 0) {
      return;
    }

    rolesDescriptions.forEach(function(roleDescription) {
      if(roleDescription.offsetHeight > ROLE_DESCRIPTION_MIN_HEIGHT) {
        shrinkRoleDescription(roleDescription);
      }
      else {
        hideElement(roleDescription.parentElement.querySelector(LOAD_MORE_SELECTOR));
      }
    })
  }

  function shrinkRoleDescription(el) {
    el.setAttribute('style', 'height: ' + ROLE_DESCRIPTION_MIN_HEIGHT + 'px; overflow: hidden;');
  }

  function expandRoleDescription(el) {
    el.removeAttribute('style');
  }

  function hideElement(el) {
    el.classList.add('dn-i');
  }

  function showElement(el) {
    el.classList.remove('dn-i');
  }

  function stopPropagationDefault(e) {
    e.stopPropagation();
    e.preventDefault();
  }

  if(document.querySelector(LOAD_MORE_SELECTOR)) {
    document.querySelectorAll(LOAD_MORE_SELECTOR).forEach(function(loadMoreBtn){
      loadMoreBtn.addEventListener('click', function(e) {
        stopPropagationDefault(e);
        hideElement(loadMoreBtn);
        expandRoleDescription(loadMoreBtn.parentElement.parentElement.querySelector(ROLE_DESCRIPTION_SELECTOR));
        showElement(loadMoreBtn.parentElement.querySelector(SEE_LESS_SELECTOR));
      });
    })
  }

  if(document.querySelector(SEE_LESS_SELECTOR)) {
    document.querySelectorAll(SEE_LESS_SELECTOR).forEach(function(showLessBtn){
      showLessBtn.addEventListener('click', function(e) {
        stopPropagationDefault(e);
        hideElement(showLessBtn);
        shrinkRoleDescription(showLessBtn.parentElement.parentElement.querySelector(ROLE_DESCRIPTION_SELECTOR));
        showElement(showLessBtn.parentElement.querySelector(LOAD_MORE_SELECTOR));
      });
    })
  }

  $(CAREER_PATH_SELECTOR).on('click', function(e) {
    if($(e.target).is('a') || $(e.target).is('button')) {
      return;
    }

    stopPropagationDefault(e);

    const roleData = $(this).data();
    
    if(roleData.hasRole != undefined || $.trim(roleData.ocRoleLink) != '') {
      window.open(roleData.ocRoleLink, '_self');
    } else {
      openNoRoleModal(roleData.roleTitle);
    }
  });

  function openNoRoleModal(roleTitle) {
    const descriptionEl = noRoleModal.find('.description');
    const { description } = descriptionEl.data();

    descriptionEl.text(description.replace('<role>', roleTitle));
    noRoleModal.data('entityTitle', roleTitle);
    noRoleModal.data('entityId', '');
    noRoleModal.remodal().open();
  }
});
/**
 * 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);

$(document).ready(function() {
  const AUTOCOMPLETE_CAROTENE_API_PATH = '/autocomplete/carotene';
  const AUTOCOMPLETE_CAROTENE_DETAILS_API_PATH= '/autocomplete/role';
  const AUTOCOMPLETE_LOCATION_API_PATH = '/autocomplete/location';
  const USER_DEMAND_API_PATH = '/colab_user_demand';

  const CAROTENE_API_VERSION = SettingControlValues.ColabAutoCompleteCaroteneApiVersion;
  const DEFAULT_LOCATION = SettingControlValues.EnableEmptyDefaultLocationForColab == 'true' ? '' : SettingControlValues.CountryCode.toLowerCase();

  const owl = $("#oc-data .educational-part");
  const noRoleModal = $('[data-remodal-id=no-role-found]');
  var autosuggestionLocations = [];

  hideCommunityErrorClickOutside();

  owl.owlCarousel({
    loop:false,
    nav:false,
    margin:15,
    mouseDrag: true,
    slideTransition: 'linear',
    navSpeed: 9000,
    autoWidth: true,
    autoHeight: true,
    stagePadding: 0,
    pagination: false,
    dots: false,
    itemsTablet: true,
    itemsMobile : true,
    responsive:{
      0:{
        items: 1
      },
      375:{
        items: 3
      },
      768:{
        items: 6
      },
      1200:{
        items: 6
      }
    }
  });

  owl.on('mousewheel', '.owl-stage', function (e) {
    if (e.originalEvent.deltaY>0) {
      owl.trigger('next.owl');
    } else {
      owl.trigger('prev.owl');
    }
    e.preventDefault();
  });

  $(document).on('click', '.new-oc-page #notify_flash_messages', function(e){
    e.preventDefault();
    $(e.currentTarget).addClass('hide-me');
  });

  $('.sous-menu-links').on('click',function(evt){
      if(isMobile.any) {
        $(this).toggleClass('sous-menu-on');
        checkSauceMenu();
      }
  });

  function checkSauceMenu(){
    var menuPopup = $('.sub-menu-links.salary-rebrand-menus');
    var menuPatternBox = $('.menu-pattern-box');
    if(menuPopup.is(':visible')){
      menuPatternBox.show();
    }else{
      menuPatternBox.hide();
    }
  }

  roleAutocomplete('#oc-search-form #Keywords', AUTOCOMPLETE_CAROTENE_API_PATH, CAROTENE_API_VERSION, '.new-oc-page #Keywords');

  $('#oc-search-form #role-location').easyAutocomplete({
    url: function(phrase) {
      if (phrase != '') {
        return AUTOCOMPLETE_LOCATION_API_PATH + "/?skip_wfh=true&colab=true&term=" + phrase;
      }
    },
    list: {
      match: { enabled: true },
      maxNumberOfElements: 6,
      onClickEvent: function() {
      },
      onLoadEvent: function() {
        hideAllErrors();
        autosuggestionLocations = [];

        for(let i=0; i<6; i++){
          let loc = $('#oc-search-form #role-location').getItemData(i);
          if(loc != 'undefined' && loc != -1){
            autosuggestionLocations.push(
              prepareLocation(loc)
            );
          }
        }
      },
      onShowListEvent: function() {
      },
      onHideListEvent: function() {
      }
    },
    requestDelay: 400
  });

  $('.new-oc-page #role-search-sbmt').on('click', function(e) {
    e.preventDefault();
    $('#Keywords').val($.trim($('#Keywords').val()));
    if ($('#Keywords').val() == '') {
      return;
    }
    hideAllErrors();
    $('#eac-container-Keywords').children().html('')
    caroteneHttpRequest();
  });

  $('.new-oc-page #notify_email_submit').on('click', function(e) {
    const btnEl = $(e.currentTarget);
    const submitText = btnEl.text();
    const email = $('.new-oc-page #notify_email').val();
    const entityTitle = $('#oc-search-form input[name="role"]').val();
    const data = {
      entityTitle: entityTitle,
      email: email
    }
    const successCallback = function() {
      btnEl.prop('disabled', false);
      btnEl.html(submitText)

      $('.new-oc-page #notify_flash_messages').attr('tabindex', '0');
      $('.new-oc-page #notify_flash_messages').attr('role', 'status');
      $('.new-oc-page #notify_flash_messages').removeClass('hide-me');
      $('.new-oc-page #notify_flash_messages').focus();

      $('#community_error').addClass('hide-me');
    }

    const errorCallback = function() {
      btnEl.prop('disabled', false);
      btnEl.html(submitText)
    };

    if($(this).closest('#guest_notify_email').find('.error #error-message').length == 0 && isEmptyValidation($('#notify_email'))){
      btnEl.prop('disabled', true);
      btnEl.html("<i class='fa fa-refresh fa-spin'></i>");
      userDemandHttpRequest(data, successCallback, errorCallback);
    }
  });

  function caroteneHttpRequest() {
    hideCommunityError();
    let location = $('#role-location').val();
    let locationValid = validateLocation(location);

    $.ajax({
      url: AUTOCOMPLETE_CAROTENE_DETAILS_API_PATH,
      type: 'GET',
      data: {
        term: $('.new-oc-page #Keywords').val(),
        carotene_id: $('#carotene_id').val(),
        location: location,
        location_valid: locationValid,
        carotene_api_version: CAROTENE_API_VERSION,
        fuzzy: true
      },
      dataType: 'json',
      success: function (data){
        if (data['not_found_message']) {
          showCommunityError();
          $('.missing_community').html(data['not_found_message']);
          appendMatchingRoles(data['matched_carotene_roles']);
        } else if (data['not_matched_message']){
          $('#guest_notify_email').removeClass('hide-me');
          $('#community_error').removeClass('hide-me');
          $('.invalid_community').html(data['not_matched_message']);
          appendMatchingRoles(data['matched_carotene_roles']);
        } else{
          window.location = data['url']
        }
      }
    });
  }

  function validateLocation(locationInput) {
    const location = prepareLocation(locationInput);
    const isBrowserAutoDetected = $('#role-location').attr('auto-detect') == 'true';
    const isLocationFromAutosuggest = autosuggestionLocations.length &&
      autosuggestionLocations.includes(location);
    const isLocationFromURL = decodeURIComponent(window.location.href).indexOf(location.replace(' ', '-')) != -1;

    return location == '' ||
      isLocationFromAutosuggest ||
      location == DEFAULT_LOCATION ||
      location == 'united states' ||
      isBrowserAutoDetected ||
      isLocationFromURL;
  }

  function prepareLocation(location) {
    return location.toLowerCase().split(', ').join(',');
  }

  function showCommunityError() {
    $('.missing_community_error').removeClass('hide-me')
  }

  function hideCommunityError() {
    $('.missing_community_error').addClass('hide-me');
  }

  function hideAllErrors(){
    $('.error-block').addClass('hide-me');
  }

  if(noRoleModal.length) {
    noRoleModal.remodal().open();
    noRoleModal.on('closed', noRoleModal.data(), redirectToOChomepage);
  }

  function redirectToOChomepage(e) {
    window.open(e.data.ocHomepagePath, '_self');
  }

  $('.skills-btn').on('click', function(){
    $(this).parents('.skills-section').find('.skills-wrapper').toggleClass('dn');
    $(this).find('i').toggleClass('rotate180');
  });
  $('.oc-page-col .skills-section:first-of-type').find('.skills-wrapper').removeClass('dn');
  $('.oc-page-col .skills-section:first-of-type').find('.skills-btn i').addClass('rotate180')

  if (isMobile.any) {
    var currentTab = $("#oc-tabs .owl-stage-outer .owl-item .item .tab.active").not('#summary_tab');
    if (currentTab.length) {
      var documentOffset = $(document).width();
      var currentOffsetLeft = currentTab.offset().left;
      var enabledOffset = currentOffsetLeft - documentOffset/2;
      $("#oc-tabs .owl-stage-outer .owl-stage").css({"transform": "translate3d("+ '-' + enabledOffset + "px, 0px, 0px)"});
    }
  }

  $('.sbm-user-demand').on('click', function(e){
    const btnEl = $(e.currentTarget);
    const submitText = btnEl.text();
    const modalEl = btnEl.parents('.remodal');
    const data = modalEl.data();
    const emailEl = modalEl.find('input[type="email"]');
    data.email = emailEl.val();

    const successCallback = function() {
      if (data.redirectToOcHomepage) {
        window.location = data.ocHomepagePath;
      } else {
        modalEl.remodal().close();
        btnEl.prop('disabled', false);
        btnEl.html(submitText)
        $('.new-oc-page #notify_flash_messages').removeClass('hide-me');
      }
    }

    const errorCallback = function() {
      btnEl.prop('disabled', false);
      btnEl.html(submitText)
    };

    if(modalEl.find('.error #error-message').length == 0 && isEmptyValidation(emailEl)){
      hideAllErrors();
      btnEl.prop('disabled', true);
      btnEl.html("<i class='fa fa-refresh fa-spin'></i>");
      userDemandHttpRequest(data, successCallback, errorCallback);
    }
  })

  function userDemandHttpRequest(data, successCallback ,errorCallback) {
    $.ajax({
      url: USER_DEMAND_API_PATH,
      type: 'POST',
      data: data,
      dataType: 'json',
      success: successCallback,
      error: errorCallback
    });
  }

  if($('#oc-search-form').length){
    $('.header').addClass('role-page');
  }

  function hideCommunityErrorClickOutside() {
    $(document).on('click', function(e) {
      var missingCommunityError = $(".missing_community_error");
      if (!$(e.target).closest(missingCommunityError).length) {
        missingCommunityError.addClass("hide-me");
      }
    });
  }
  $('.owl-tab').owlCarousel( {
    loop: false,
    margin: 3.3,
    autoWidth: true,
    nav: true,
    navText: ['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="black" width="18px" height="18px"><path d="M0 0h24v24H0z" fill="none"/><path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"/></svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="black" width="18px" height="18px"><path d="M0 0h24v24H0z" fill="none"/><path d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"/></svg>'],
    dots: false,
    itemsTablet: false,
    itemsMobile : false,
    responsive:{
      0: {
        items: 2
      },
      600: {
        items:3
      },
      1000: {
        items:4
      }
    }
  }).on('translate.owl.carousel', function(e) {
    if($(this).closest('.owl-carousel').hasClass('js-nav-tabs')) {
      setTimeout(function(){
        if(owlCarouselSlideIssue()){
          $('.owl-carousel').trigger('stop.owl.autoplay').trigger('refresh.owl.carousel');
        }
      }, 300);
    }
  }).on('click', '.owl-item', function(e) {
    if($(this).closest('.owl-carousel').hasClass('js-nav-tabs')){
      if(owlCarouselSlideIssue()) {
        $('.owl-carousel').trigger('to.owl.carousel', $(this).index() - 2);
      }
      $(this).closest('.owl-stage').find('button[role="tab"]').removeClass('active');
      $(this).find('button[role="tab"]').addClass('active');
      getTabsJobsTitles($(this).find('button[role="tab"]').attr('data-tab'));
    }
  });

  if ($('.js-nav-tabs')) {
    // enabling default active tab
    $('.js-nav-tabs').find('.owl-stage-outer .owl-stage .owl-item:first-child .item button').addClass('active');
  }
});

function owlCarouselSlideIssue($this, slideChangedFound) {
  var rgxForVal = /[\d|\+]+/g;
  var slStage = document.querySelector('.js-nav-tabs .owl-stage');
  var slideMoved = parseInt(slStage.style.transform.match(rgxForVal)[1]);
  var stageParent = $(slStage).parent();
  var sliderVisibleVal = $(slStage).width() - slideMoved;
  if (sliderVisibleVal <= (stageParent.width() - 50)) {
    return true
  }else {
    return false
  }
}

function appendMatchingRoles(roles) {
  var ulEl = document.querySelector('#community-error-desktop .fuzzy_matching_roles .fuzzy-box');
  var closeMatchesEl = document.querySelector('#community-error-desktop .close_matches');
  ulEl.innerHTML = '';
  roles.length ? closeMatchesEl.classList.remove('dn') : closeMatchesEl.classList.add('dn');
  roles.forEach(function(role, index, ary) {
    ulEl.appendChild(roleLinkList(role, index, ary.length))
  });
}

function roleLinkList(role, index, totalCount) {
  var listEl = document.createElement('li');
  var linkEl = document.createElement('a')
  listEl.setAttribute('aria-posinset', index+1);
  listEl.setAttribute('aria-setsize', totalCount);
  listEl.classList.add('bubble-link', 'small-font');
  listEl.appendChild(linkEl);
  linkEl.setAttribute('href', role['url']);
  linkEl.classList.add('link-title', 'black');
  linkEl.textContent = role['suggestion'];
  return listEl;
}

function showCommunityError() {
  $('.missing_community_error').removeClass('hide-me')
}

function hideCommunityError() {
  $('.missing_community_error').addClass('hide-me');
}

function roleAutocomplete(eleSelector, baseUrl, caroteneVersion, elCaroteneId) {
  $(eleSelector).easyAutocomplete({
    url: function(phrase) {
      if (phrase != '') {
        return baseUrl + "/?carotene_api_version=" + caroteneVersion +"&query=" + phrase;
      }
    },
    list: {
      maxNumberOfElements: 6,
      onClickEvent: function() {
        setCaroteneId(elCaroteneId);
      },
      onLoadEvent: function() {
        showAcHint('#eac-container-Keywords');
      },
      onShowListEvent: function() {
        showAcHint('#eac-container-Keywords');
      },
      onHideListEvent: function() {
        hideAcHint('#eac-container-Keywords');
      }
    },
    getValue: 'suggestion',
    requestDelay: 400
  });
}

function setCaroteneId(elSelector) {
  carotene_id = $(elSelector).getSelectedItemData().id;
  $('#carotene_id').val(carotene_id);
}

function getTabsJobsTitles(tabid) {
  $('.roles-box .titles-list.list').addClass('dn');
  $('.loading-more-jobs').removeClass('dn')
  if(tabid == '.')
    selectedTab = 'dot'
  else{
    selectedTab = tabid
  }
  var isExistId = $('#list-' + selectedTab);
  if(isExistId.length) {
    isExistId.removeClass('dn');
    $('.loading-more-jobs').addClass('dn')
  }else{
    $.ajax({
      url: 'jobs_by_letter',
      type: 'GET',
      data: {
        job_title_letter: tabid
      },
      success: function (data){
        $('.titles-list').addClass('dn');
        $('.roles-box').append(data);
        $('.loading-more-jobs').addClass('dn')
      }
    });
  }
}
$('.privacy-wrapper .toggle-title').on('click', function(){
  $(this).parent('.toggle-parent').find('.toggle-body').toggleClass('dn')
  $(this).find('.fa').toggleClass('fa-angle-down').toggleClass('fa-angle-up')
});
$('.privacy-wrapper #back-cb').on('click', function(){
  if(document.referrer == ''){
    location.href = '/'
  } else {
    location.href = document.referrer
  }
})
$('.authenticate-btn button').on('click', function(){
  if ($(this).attr('aria-expanded') == 'true') {
    $('.authenticate-btn #user-list-sub-menu').removeClass('dn');
    $('.authenticate-btn #user-list-sub-menu').addClass('display');
  } else{
    $('.authenticate-btn #user-list-sub-menu').removeClass('display');
    $('.authenticate-btn #user-list-sub-menu').addClass('dn');
  }
});
$(document).ready(function () {
  const AUTOCOMPLETE_CAROTENE_API_PATH = '/autocomplete/carotene';
  const AUTOCOMPLETE_CAROTENE_DETAILS_API_PATH = '/autocomplete/role';
  const USER_DEMAND_API_PATH = '/colab_user_demand';
  const CAROTENE_API_VERSION = SettingControlValues.ColabAutoCompleteCaroteneApiVersion;

  if ($('#oc-homepage').length) {
    roleAutocomplete('#job_titles_list', AUTOCOMPLETE_CAROTENE_API_PATH, CAROTENE_API_VERSION, '#job_titles_list');

    $('#notify_submit').on('click', function(e) {
      const btnEl = $(e.currentTarget);
      const submitText = btnEl.text();
      const email = $('#notify_email').val();
      const entityTitle = $('#job_titles_list').val();
      const data = {
        entityTitle: entityTitle,
        email: email
      }
      const successCallback = function() {
        btnEl.prop('disabled', false);
        btnEl.html(submitText);
        $('#notify_flash_messages').removeClass('hide-me');
        $('#community_error').addClass('hide-me');
      }

      const errorCallback = function() {
        btnEl.prop('disabled', false);
        btnEl.html(submitText);
      };

      if($(this).closest('#guest_notify_email').find('.error #error-message').length == 0 && isEmptyValidation($('#notify_email'))){
        btnEl.prop('disabled', true);
        btnEl.html("<i class='fa fa-refresh fa-spin'></i>");
        userDemandHttpRequest(data, successCallback, errorCallback);
      }
    });

    $('#community_page_sbmt').on('click', function(e) {
      $('#job_titles_list').val($.trim($('#job_titles_list').val()));
      $('#community_error').addClass('hide-me');
      $('#notify_flash_messages').addClass('hide-me');
      if ($('#job_titles_list').val() == '') {
        e.preventDefault();
        $('.missing_community').html($('.missing_community').data('missingCommunityName'));
        showCommunityError()
        return
      }

      $('#eac-container-job_titles_list').children().html('')

      if ($('#job-titles-search-form').attr('action') == '') {
        e.preventDefault();
        caroteneHttpRequest()
      }
    });

    $('#oc-homepage #notify_flash_messages').on('click', function(e){
      e.preventDefault();
      $('#notify_flash_messages').addClass('hide-me');
    });

    function caroteneHttpRequest() {
      hideCommunityError();
      $.ajax({
        url: AUTOCOMPLETE_CAROTENE_DETAILS_API_PATH,
        type: 'GET',
        data: {
          term: $('#job_titles_list').val(),
          carotene_id: $('#carotene_id').val(),
          carotene_api_version: CAROTENE_API_VERSION,
          fuzzy: true
        },
        dataType: 'json',
        success: function (data){
          if (data['not_found_message']) {
            showCommunityError();
            appendMatchingRoles(data['matched_carotene_roles'])
            $('.missing_community').html(data['not_found_message']);
          }
          else if (data['not_matched_message']){
            appendMatchingRoles(data['matched_carotene_roles'])
            $('#guest_notify_email').removeClass('hide-me');
            $('#community_error').removeClass('hide-me');
            $('.invalid_community').html(data['not_matched_message']);
          }else{
            window.location = data['url']
          }
        }
      });
    }

    function userDemandHttpRequest(data, successCallback ,errorCallback) {
      $.ajax({
        url: USER_DEMAND_API_PATH,
        type: 'POST',
        data: data,
        dataType: 'json',
        success: successCallback,
        error: errorCallback
      });
    }

    function mobileView() {
      return document.body.clientWidth > 768 ? false : true;
    }

    function reportWindowSize() {
      if (!$('#community-error-desktop')[0].classList.contains('hide-me') || !$('#community-error-mobile')[0].classList.contains('hide-me')){
        hideCommunityError();
        showCommunityError();
      }
    }

    if($('#oc-homepage')[0]){
      window.addEventListener('resize', reportWindowSize);
    }
  }

  $('#notify_email').bind("blur keyup", function(){
    isEmailValidation($(this))
  });

  $('.homepage-section .card-container').owlCarousel({
    loop: false,
    margin: 30,
    nav: false,
    responsiveClass: true,
    responsive: {
      0: {
        items: 1,
        dots: false,
        stagePadding: 45
      },
      600: {
        items: 2,
        dots: false,
        stagePadding: 45
      },
      1000: {
        items: 3,
        dots: true,
        stagePadding: 5
      }
    }
  });

});
$(document).ready(function() {
  const LOAD_MORE_SELECTOR = '#oc_resume-tab .role-activity button.load-more-btn';
  const SEE_LESS_SELECTOR = '#oc_resume-tab .role-activity button.see-less-btn';
  const LIST_SELECTOR = '#oc_resume-tab .role-activity ul.role-activity-list li';
  const ITEM_LIMIT = 6;

  init();

  $(LOAD_MORE_SELECTOR).on('click', function(){
    showEvent();
  });

  $(SEE_LESS_SELECTOR).on('click', function(){
    hideEvent();
  });

  function init(){
    hideReadMore();
    hideSeeLess();
    hideEvent();
  }

  function hideEvent(){
    hideSeeLess();
    $(LIST_SELECTOR).each(function(index, value){
      if(index >= ITEM_LIMIT ){
        $(this).addClass('dn-i');
      }
    });
    if($(LIST_SELECTOR).length > ITEM_LIMIT ) {
      showReadMore();
    }
  }

  function showEvent(){
    $(LIST_SELECTOR).removeClass('dn-i');
    hideReadMore();
    showSeeLess();
  }

  function hideReadMore(){
    $(LOAD_MORE_SELECTOR).addClass('dn-i');
  }
  function hideSeeLess(){
    $(SEE_LESS_SELECTOR).addClass('dn-i');
  }
  function showReadMore(){
    $(LOAD_MORE_SELECTOR).removeClass('dn-i');
  }
  function showSeeLess(){
    $(SEE_LESS_SELECTOR).removeClass('dn-i');
  }

});
$(document).ready(function() {
  const LOAD_MORE_SELECTOR = '#oc-summary-tab button.load-more-btn';
  const SEE_LESS_SELECTOR = '#oc-summary-tab button.see-less-btn';
  const SUMMARY_EL_SELECTOR = '#oc-summary-tab .summary-description-text';
  const wrapperInputEl = document.querySelector('#wrapper-input');
  const locationInputElMain = document.querySelector('#job_titles_list');
  const sInputEl = locationInputElMain != null;
  const locationInputEl = document.querySelector(sInputEl ? '#job_titles_list' : '#role-location');
  const SUMMARY_MIN_HEIGHT = 84;
  setTimeout(setSummaryHeight);

  function setSummaryHeight() {
    const summaryTEl = document.querySelector(SUMMARY_EL_SELECTOR);
    if(summaryTEl && summaryTEl.clientHeight > SUMMARY_MIN_HEIGHT) {
      shrinkSummaryTEl(summaryTEl);
    }
    else {
      hideElement(LOAD_MORE_SELECTOR);
    }
  }

  function shrinkSummaryTEl(el) {
    el.setAttribute('style', 'height: ' + SUMMARY_MIN_HEIGHT + 'px; overflow: hidden;');
  }

  function expandSummaryTEl(el) {
    el.removeAttribute('style');
  }

  function hideElement(selector) {
    if(document.querySelector(selector)) {
      document.querySelector(selector).classList.add('dn-i');
    }
  }

  function showElement(selector) {
    if(document.querySelector(selector)) {
      document.querySelector(selector).classList.remove('dn-i');
    }
  }

  function stopPropagationDefault(e) {
    e.stopPropagation();
    e.preventDefault();
  }


  if(document.querySelector(LOAD_MORE_SELECTOR)) {
    document.querySelector(LOAD_MORE_SELECTOR).addEventListener('click', function(e) {
      stopPropagationDefault(e);
      hideElement(LOAD_MORE_SELECTOR);
      expandSummaryTEl(document.querySelector(SUMMARY_EL_SELECTOR));
      showElement(SEE_LESS_SELECTOR);
    });
  }

  if(document.querySelector(SEE_LESS_SELECTOR)) {
    document.querySelector(SEE_LESS_SELECTOR).addEventListener('click', function(e) {
      stopPropagationDefault(e);
      hideElement(SEE_LESS_SELECTOR);
      shrinkSummaryTEl(document.querySelector(SUMMARY_EL_SELECTOR));
      showElement(LOAD_MORE_SELECTOR);
    });
  }

  document.querySelectorAll('a.location-field-link').forEach(function(el) {
    el.addEventListener('click', handleLocationLinkCLick);
  });

  function handleLocationLinkCLick(e) {
    stopPropagationDefault(e);

    const location = e.target.text.trim();
    if(!sInputEl){
      locationInputEl.value = location;
      wrapperInputEl.click();
    }
    $(document).scrollTo(0, 500);
    locationInputEl.focus({preventScroll:true});
  }
});
$(document).ready(function() {
	$('.new-oc-page .load-more-skills').on('click', function(e){
    const maxItems = $(e.currentTarget).data('max-items')
    const btnText = $(e.currentTarget).text().replace(/[0-9 ]/g, '');

    $(this).siblings('li.dn-i').slice(0, maxItems).removeClass('dn-i');
    if($(this).siblings('li.dn-i').length) {
      $(this).text($(this).siblings('li.dn-i').length + " " + btnText);
    } else {
      $(this).addClass('dn-i');
    }
  });
});
$(document).ready(function() {
  const tabsEl = document.getElementById('oc-tabs');
  const searchEl = document.getElementById('oc-filters');
  const sitePusherEl = document.querySelector('.site-pusher');
  const pageContentEl = document.getElementById('col-fixed');
  const siteContent = document.getElementById('site-content');

  const originalTabsOffset = tabsEl && tabsEl.offsetTop;
  const minOCMobilePageWidth = 1000;
  const ocStickyTabsClass = 'sticky-tabs';

  function configureStickyStyles() {
    if(window.innerWidth <= minOCMobilePageWidth) {
      sitePusherEl.style.transform = 'unset';
      searchEl.style.position = 'inherit';
      pageContentEl.style.marginTop = '-70px';
    } else {
      searchEl.style.position = 'fixed';
      pageContentEl.style.marginTop = 0;
    }
  }

  function scrollOCPage() {
    if(siteContent.classList.contains('hidden')){
      return;
    }
    configureStickyStyles();

    const appStoreBannerEl = document.getElementById('app-store-banner');
    const appStoreBannerHeight = isMobile.apple.phone && appStoreBannerEl ? appStoreBannerEl.offsetHeight : 0;

    const ocSearchOffset = searchEl.offsetTop + searchEl.offsetHeight;
    const ocMobileTabsOffset = originalTabsOffset + ocSearchOffset - appStoreBannerHeight;
    const tabsOffset = window.innerWidth <= minOCMobilePageWidth ? ocMobileTabsOffset : originalTabsOffset;

    if (window.pageYOffset >= tabsOffset) {
      tabsEl.classList.add(ocStickyTabsClass);
      if(appStoreBannerHeight) {
        tabsEl.setAttribute('style', 'top: ' + appStoreBannerHeight + 'px !important');
      }

    } else {
      tabsEl.classList.remove(ocStickyTabsClass);
      tabsEl.style.top = 0;
    }
  }

  if(tabsEl) {
    window.onscroll = scrollOCPage;
  }
});
$(document).ready(function() {
  const topHiringCompanySelector = '.new-oc-page .companies-list-container .data-results-content';

  $(document).on('click', topHiringCompanySelector, function(e){
    if($(e.target).is('a')) {
      return;
    }

    stopPropagationDefault(e);

    const companyData = $(this).data();
    window.location = companyData.companyLink
  });

  function stopPropagationDefault(e) {
    e.stopPropagation();
    e.preventDefault();
  }

});
(function() {
  var ajaxGetCityStateByZip, selectOptionChange;

  selectOptionChange = function(target, code) {
    var _target, _targetOpt;
    _target = $(target);
    _targetOpt = _target.find("option");
    _targetOpt.removeAttr('selected');
    return $.each(_targetOpt, function() {
      if ($(this).val() === code) {
        $(this).prop("selected", "true");
        $(this).parent().val(code);
        return $(this).trigger('change');
      }
    });
  };

  ajaxGetCityStateByZip = function(postalcode_value, country_value, city_ele_target, state_ele_target) {
    return $.ajax({
      url: '/get_city_state_by_zip',
      type: 'POST',
      data: {
        postalcode: postalcode_value,
        country: country_value
      },
      success: function(data) {
        if (data.city !== '') {
          $(city_ele_target).val(data.city);
          $(city_ele_target).trigger('change');
        }
        if (data.state !== '' && data.state !== $(state_ele_target).val()) {
          return selectOptionChange(state_ele_target, data.state);
        }
      }
    });
  };

  $(function() {
    if ($('.get-city-from-zip').length && $('.get-city-from-zip').val() !== '') {
      ajaxGetCityStateByZip($('.get-city-from-zip').val(), $('#user_country').val(), '#city', '#state');
    }
    return $(document).on('blur input', '.get-city-from-zip', function(event, selection) {
      if ($('.get-city-from-zip').length && $('.get-city-from-zip').val() !== '') {
        return ajaxGetCityStateByZip($(this).val(), $('#user_country').val(), '#city', '#state');
      }
    });
  });

  this.isWorkFromHomeFilterV2Enabled = function() {
    return SettingControlValues.EnableWorkFromHomeFilterV2 === 'true' || SettingControlValues.EnableWorkFromHomeFilterV2 === true;
  };

}).call(this);
$(document).ready(function() {
  $('.language-link a').on('click', function(e) {
    e.preventDefault();
    var url = $(this).attr('href');

    $.ajax({
      url: url,
      type: 'HEAD'
    }).done(function (data, textStatus, xhr) {
      if (xhr.getResponseHeader('X-Page-Configuration-Blank') === 'true') {
        window.location.href = '/';
      } else {
        window.location.href = url;
      }
    }).fail(function () {
      window.location.href = '/';
    });
  });
});





















































