{"version":3,"names":[],"mappings":"","sources":["offices.bundle.js"],"sourcesContent":["(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i>> 0;\n\n\t\t\t\tif (typeof callback !== 'function') {\n\t\t\t\t\t\tthrow new TypeError(callback + ' is not a function');\n\t\t\t\t}\n\n\t\t\t\tif (arguments.length > 1) {\n\t\t\t\t\t\tT = thisArg;\n\t\t\t\t}\n\n\t\t\t\tA = new Array(len);\n\n\t\t\t\tk = 0;\n\n\t\t\t\twhile (k < len) {\n\n\t\t\t\t\t\tvar kValue, mappedValue;\n\n\t\t\t\t\t\tif (k in O) {\n\t\t\t\t\t\t\t\tkValue = O[k];\n\t\t\t\t\t\t\t\tmappedValue = callback.call(T, kValue, k, O);\n\n\t\t\t\t\t\t\t\tA[k] = mappedValue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tk++;\n\t\t\t\t}\n\n\t\t\t\treturn A;\n\t\t};\n}\n\n/*********************/\n/* Private Functions */\n/*********************/\nfunction extend(out) {\n\t\tout = out || {};\n\t\tfor (var i = 1; i < arguments.length; i++) {\n\t\t\t\tif (!arguments[i]) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tfor (var key in arguments[i]) {\n\t\t\t\t\t\tif (arguments[i].hasOwnProperty(key) && arguments[i][key] !== undefined) {\n\t\t\t\t\t\t\t\tout[key] = arguments[i][key];\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t}\n\t\treturn out;\n}\n\nfunction cleanSelector(selector) {\n\t\treturn selector.replace(/\\W/g, '');\n}\n\nfunction matchSelector(elem, selector) {\n\t\tif ($) {\n\t\t\t\treturn $(elem).is(selector);\n\t\t} else if (typeof selector === 'string') {\n\t\t\t\treturn elementMatchesSelector.call(elem, selector);\n\t\t} else if ((typeof selector === 'undefined' ? 'undefined' : _typeof(selector)) === 'object' && selector.length) {\n\t\t\t\treturn selector.indexOf(elem) >= 0;\n\t\t} else if ((typeof selector === 'undefined' ? 'undefined' : _typeof(selector)) === 'object' && selector.nodeType === 1) {\n\t\t\t\treturn elem === selector;\n\t\t}\n\t\treturn false;\n}\n\nfunction generateId() {\n\t\tvar id;\n\t\twhile (true) {\n\t\t\t\tid = ID_POOL_PREFIX + String(++_idPool);\n\t\t\t\tif (!_modals[id]) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t}\n\t\treturn id;\n}\n\nfunction getModalId(elem) {\n\t\tvar hasClass = false;\n\t\tvar elemClasses = elem && elem.className && elem.className.split(' ') || [];\n\n\t\tfor (var id in _modals) {\n\t\t\t\tvar triggerSelectors = _modals[id].triggerSelectors.map(function (selector) {\n\t\t\t\t\t\treturn selector.substring(1);\n\t\t\t\t});\n\n\t\t\t\tvar dismissSelectors = _modals[id].dismissSelectors.map(function (selector) {\n\t\t\t\t\t\treturn selector.substring(1);\n\t\t\t\t});\n\n\t\t\t\tif (!_modals[id].disable) {\n\t\t\t\t\t\tfor (var i = 0, len = elemClasses.length; i < len; i++) {\n\t\t\t\t\t\t\t\thasClass = triggerSelectors.indexOf(elemClasses[i]) === 0 || dismissSelectors.indexOf(elemClasses[i]) === 0;\n\t\t\t\t\t\t\t\tif (hasClass) {\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn id;\n\t\t\t\t}\n\t\t}\n}\n\nfunction hideModal(modalId) {\n\t\tvar modal = _modals[modalId];\n\t\tvar modalRoot;\n\n\t\tif (!modal) {\n\t\t\t\treturn;\n\t\t}\n\n\t\tmodalRoot = modal.root;\n\n\t\tmodalRoot.setAttribute('data-modal', 'false');\n\t\tmodalRoot.setAttribute('aria-hidden', 'false');\n\t\tmodal.modalSelector[0].setAttribute('data-visible', 'false');\n\t\tmodal.modalSelector[0].setAttribute('aria-hidden', 'true');\n}\n\nfunction setEmailLink(modal, email) {\n\t\tvar button = $(modal.modalSelector[0]).find(\".js-modalButton-agree\");\n\t\tvar fullEmail = \"javascript:window.location.href='\" + email + \"';\";\n\n\t\tdocument.getElementById(\"js-modal-agree-id\").setAttribute(\"onClick\", fullEmail);\n}\n\nfunction onModalActivatorPress(evt) {\n\n\t\tvar target = this;\n\t\tvar modalId = getModalId(target);\n\t\tvar modal = _modals[modalId];\n\t\tvar modalRoot;\n\t\tvar modalData;\n\n\t\tif (!modal) {\n\t\t\t\treturn;\n\t\t}\n\n\t\tmodalRoot = modal.root;\n\t\tmodalData = modalRoot && modalRoot.getAttribute('data-modal');\n\n\t\tif (modalData && modalData === 'true') {\n\t\t\t\treturn;\n\t\t}\n\n\t\tevt.preventDefault();\n\t\tevt.stopPropagation();\n\n\t\tvar email = $(this).attr(\"href\");\n\t\tsetEmailLink(modal, email);\n\n\t\tmodalRoot.setAttribute('data-modal', 'true');\n\t\tmodalRoot.setAttribute('aria-hidden', 'true');\n\t\tmodal.modalSelector[0].setAttribute('data-email', target.getAttribute('href'));\n\t\tmodal.modalSelector[0].setAttribute('data-visible', 'true');\n\t\tmodal.modalSelector[0].setAttribute('aria-hidden', 'false');\n}\n\nfunction onModalDismissorPress(evt) {\n\t\tvar target = this;\n\t\tvar modalId = getModalId(target);\n\n\t\tevt.preventDefault();\n\t\tevt.stopPropagation();\n\n\t\thideModal(modalId);\n}\n\n/****************/\n/* Modal Object */\n/****************/\nvar Modal = {\n\t\tinit: function init(config) {\n\t\t\t\tvar options = extend({}, GlobalConfig, config);\n\t\t\t\tvar triggerSelectors = options.triggerSelectors || [];\n\t\t\t\tvar dismissSelectors = options.dismissSelectors || [];\n\n\t\t\t\ttriggerSelectors = triggerSelectors.join(', ');\n\t\t\t\tdismissSelectors = dismissSelectors.join(', ');\n\n\t\t\t\t$(document).on('click', triggerSelectors, onModalActivatorPress);\n\t\t\t\t$(document).on('click', dismissSelectors, onModalDismissorPress);\n\t\t},\n\n\t\tset: function set() {\n\t\t\t\tvar modalId, config;\n\n\t\t\t\tif (_typeof(arguments[0]) === 'object') {\n\t\t\t\t\t\tconfig = arguments[0];\n\t\t\t\t} else if (typeof arguments[0] === 'string' && _typeof(arguments[1]) === 'object') {\n\t\t\t\t\t\tmodalId = arguments[0];\n\t\t\t\t\t\tconfig = arguments[1];\n\t\t\t\t\t\tif (!_modals[modalId]) {\n\t\t\t\t\t\t\t\tthrow new Error('Section \"' + modalId + '\" doesn\\'t exist!');\n\t\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tfor (var key in config) {\n\t\t\t\t\t\tif (GlobalConfig[key] !== undefined) {\n\t\t\t\t\t\t\t\tif (modalId) {\n\t\t\t\t\t\t\t\t\t\t_modals[modalId][key] = config[key];\n\t\t\t\t\t\t\t\t} else if (config[key] !== undefined) {\n\t\t\t\t\t\t\t\t\t\tGlobalConfig[key] = config[key];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (modalId) {\n\t\t\t\t\t\t// remove \"undefined\" items\n\t\t\t\t\t\t_modals[modalId] = extend({}, _modals[modalId]);\n\t\t\t\t}\n\t\t},\n\n\t\tadd: function add() {\n\t\t\t\tvar modalId;\n\t\t\t\tvar config = {};\n\n\t\t\t\tif (_typeof(arguments[0]) === 'object') {\n\t\t\t\t\t\tconfig = arguments[0];\n\t\t\t\t} else if (typeof arguments[0] === 'string' && _typeof(arguments[1]) === 'object') {\n\t\t\t\t\t\tmodalId = arguments[0];\n\t\t\t\t\t\tconfig = arguments[1];\n\t\t\t\t}\n\n\t\t\t\tif (!modalId) {\n\t\t\t\t\t\tmodalId = typeof config.id === 'string' ? config.id : generateId();\n\t\t\t\t}\n\n\t\t\t\tif (_modals[modalId]) {\n\t\t\t\t\t\tthrow new Error('Modal \"' + modalId + '\" already exists!');\n\t\t\t\t}\n\n\t\t\t\t_modals[modalId] = {};\n\n\t\t\t\tModal.set(modalId, config);\n\t\t},\n\n\t\tdestroy: function destroy() {\n\t\t\t\twindow.removeEventListener('keyup', onKeyUp);\n\t\t\t\tModal.clear();\n\t\t\t\t_idPool = 0;\n\t\t\t\t_ready = false;\n\t\t},\n\n\t\tclear: function clear() {\n\t\t\t\t_modals = {};\n\t\t\t\t_modalCount = 0;\n\t\t\t\t_defaultModalId = '';\n\t\t\t\t_lastModalId = '';\n\t\t}\n\n};\n\nwindow.Modal = Modal;\n\n/*********************/\n/* jQuery Interface */\n/*********************/\nif ($) {\n\t\t$.Modal = function () {\n\t\t\t\tModal.init();\n\n\t\t\t\tif (arguments.length > 0) {\n\t\t\t\t\t\tif ($.isPlainObject(arguments[0])) {\n\t\t\t\t\t\t\t\treturn Modal.add(arguments[0]);\n\t\t\t\t\t\t} else if ($.type(arguments[0]) === 'string' && $.isFunction(Modal[arguments[0]])) {\n\t\t\t\t\t\t\t\treturn Modal[arguments[0]].apply(Modal, [].slice.call(arguments, 1));\n\t\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn $.extend({}, Modal);\n\t\t};\n\n\t\t$.fn.Modal = function () {\n\t\t\t\tvar config;\n\n\t\t\t\tif ($.isPlainObject(arguments[0])) {\n\t\t\t\t\t\tconfig = arguments[0];\n\t\t\t\t} else {\n\t\t\t\t\t\tconfig = {\n\t\t\t\t\t\t\t\tmodalSelector: arguments[0]\n\t\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tconfig.modalSelector = this;\n\t\t\t\tconfig.root = config.root || document.body;\n\n\t\t\t\tif (config.id) {\n\t\t\t\t\t\tModal.remove(config.id);\n\t\t\t\t}\n\n\t\t\t\tModal.add(config);\n\t\t\t\tModal.init(config);\n\n\t\t\t\treturn this;\n\t\t};\n}\n\n},{}],2:[function(require,module,exports){\n'use strict';\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar GlobalConfig = {\n context: '.js-locationsListing',\n selector: 'noscript',\n imageClass: 'location-image location-image--thumb lazy-loaded',\n dataSource: 'data-src'\n};\n\nvar _ready = false;\nvar _images = [];\nvar _imageCount = 0;\n\nvar LazyImageLoader = {\n init: function init(elem) {\n var context;\n if (!elem || elem.length === 0) {\n return;\n }\n\n if (!_ready) {\n if (typeof elem === 'string') {\n elem = document.querySelectorAll(elem);\n }\n\n context = elem;\n\n if (!context) {\n return;\n }\n\n for (var i = 0, len = context.length; i < len; i++) {\n _images = context[i].querySelectorAll(GlobalConfig.selector);\n }\n\n _ready = true;\n }\n },\n set: function set() {\n var sectionId, config;\n\n if (_typeof(arguments[0]) === 'object') {\n config = arguments[0];\n } else if (typeof arguments[0] === 'string' && _typeof(arguments[1]) === 'object') {\n sectionId = arguments[0];\n config = arguments[1];\n if (!_sections[sectionId]) {\n throw new Error('Section \"' + sectionId + '\" doesn\\'t exist!');\n }\n } else {\n return;\n }\n\n for (var key in config) {\n if (GlobalConfig[key] !== undefined) {\n if (sectionId) {\n _sections[sectionId][key] = config[key];\n } else if (config[key] !== undefined) {\n GlobalConfig[key] = config[key];\n }\n }\n }\n\n if (sectionId) {\n // remove \"undefined\" items\n _sections[sectionId] = extend({}, _sections[sectionId]);\n }\n },\n add: function add() {\n var sectionId;\n var config = {};\n\n if (_typeof(arguments[0]) === 'object') {\n config = arguments[0];\n } else if (typeof arguments[0] === 'string' && _typeof(arguments[1]) === 'object') {\n sectionId = arguments[0];\n config = arguments[1];\n }\n\n LazyImageLoader.set(config);\n },\n loadImages: function loadImages() {\n [].forEach.call(_images, function (image) {\n var img = new Image();\n var src = image.getAttribute('data-src');\n var imgAlt = image.getAttribute('data-alt');\n\n img.setAttribute('data-src', '');\n img.setAttribute('class', '');\n img.setAttribute('alt', imgAlt);\n img.setAttribute('item-prop', 'image');\n image.parentNode.insertBefore(img, image);\n img.onload = function () {\n img.removeAttribute('data-src');\n };\n img.src = src;\n });\n }\n};\n\nwindow.LazyImageLoader = LazyImageLoader;\n\n/*********************/\n/* jQuery Interface */\n/*********************/\nif ($) {\n $.LazyImageLoader = function () {\n if (arguments.length > 0) {\n if ($.isPlainObject(arguments[0])) {\n return LazyImageLoader.add(arguments[0]);\n } else if ($.type(arguments[0]) === 'string' && $.isFunction(LazyImageLoader[arguments[0]])) {\n return LazyImageLoader[arguments[0]].apply(LazyImageLoader, [].slice.call(arguments, 1));\n }\n }\n\n return $.extend({}, LazyImageLoader);\n };\n\n $.fn.LazyImageLoader = function () {\n var config;\n\n if ($.isPlainObject(arguments[0])) {\n config = arguments[0];\n } else {\n config = {\n id: arguments[0]\n };\n }\n\n config.selector = this;\n\n LazyImageLoader.init(config.selector);\n\n if (config.id) {\n LazyImageLoader.remove(config.id);\n }\n LazyImageLoader.add(config);\n LazyImageLoader.loadImages();\n\n return this;\n };\n};\n\n},{}],3:[function(require,module,exports){\n'use strict';\n\nrequire('./features/lazyload-images');\nrequire('./features/email-disclaimer-modal');\n\nvar lazy = $('.js-locationsListing').LazyImageLoader();\nvar modal = $('.js-disclaimerModal').Modal({\n\ttriggerSelectors: ['.js-disclaimerModal-trigger'],\n\tdismissSelectors: ['.js-modalClose', '.js-modalButton-agree', '.js-modalButton-cancel']\n});\n\n// why aren't we setting the active nav item server-side?\n$('.offices-link').find('.site-nav__link').toggleClass('active-nav', $('.js-locationsListing').length > 0);\n\n},{\"./features/email-disclaimer-modal\":1,\"./features/lazyload-images\":2}]},{},[3]);\n"],"file":"offices.bundle.js"}