{"version":3,"sources":["../assets/js/src/floating-label.js","../assets/js/src/expansion-panel.js","../assets/js/src/util.js","../assets/js/src/nav-drawer.js","../node_modules/ripplet.js/es/ripplet.js","../node_modules/pickadate/lib/picker.js","../assets/js/src/pickdate.js","../node_modules/pickadate/lib/picker.date.js","../assets/js/src/ripplet.js","../assets/js/src/selection-control-focus.js","../assets/js/src/tab-switch.js"],"sourcesContent":["import $ from 'jquery'\n\n/*\n * Floating label plugin moves inline label to float above the field\n * when a user engages with the assosciated text input field\n */\n\nconst FloatingLabel = (($) => {\n // constants >>>\n const DATA_KEY = 'md.floatinglabel'\n const EVENT_KEY = `.${DATA_KEY}`\n const NAME = 'floatinglabel'\n const NO_CONFLICT = $.fn[NAME]\n\n const ClassName = {\n IS_FOCUSED : 'is-focused',\n HAS_VALUE : 'has-value'\n }\n\n const Event = {\n CHANGE : `change${EVENT_KEY}`,\n FOCUSIN : `focusin${EVENT_KEY}`,\n FOCUSOUT : `focusout${EVENT_KEY}`\n }\n\n const Selector = {\n DATA_PARENT : '.floating-label',\n DATA_TOGGLE : '.floating-label .custom-select, .floating-label .form-control'\n }\n // <<< constants\n\n class FloatingLabel {\n constructor(element) {\n this._element = element\n this._parent = $(element).closest(Selector.DATA_PARENT)[0]\n }\n\n change() {\n if ($(this._element).val() ||\n $(this._element).is('select') &&\n $('option:first-child', $(this._element)).html().replace(' ', '') !== '') {\n $(this._parent).addClass(ClassName.HAS_VALUE)\n } else {\n $(this._parent).removeClass(ClassName.HAS_VALUE)\n }\n }\n\n focusin() {\n $(this._parent).addClass(ClassName.IS_FOCUSED)\n }\n\n focusout() {\n $(this._parent).removeClass(ClassName.IS_FOCUSED)\n }\n\n static _jQueryInterface(event) {\n return this.each(function () {\n const _event = event ? event : 'change'\n\n let data = $(this).data(DATA_KEY)\n\n if (!data) {\n data = new FloatingLabel(this)\n\n $(this).data(DATA_KEY, data)\n }\n\n if (typeof _event === 'string') {\n if (typeof data[_event] === 'undefined') {\n throw new Error(`No method named \"${_event}\"`)\n }\n\n data[_event]()\n }\n })\n }\n }\n\n $(document).on(`${Event.CHANGE} ${Event.FOCUSIN} ${Event.FOCUSOUT}`, Selector.DATA_TOGGLE, function (event) {\n FloatingLabel._jQueryInterface.call($(this), event.type)\n })\n\n $.fn[NAME] = FloatingLabel._jQueryInterface\n $.fn[NAME].Constructor = FloatingLabel\n $.fn[NAME].noConflict = function () {\n $.fn[NAME] = NO_CONFLICT\n\n return FloatingLabel._jQueryInterface\n }\n\n return FloatingLabel\n})($)\n\nexport default FloatingLabel\n","import $ from 'jquery'\n\n/*\n * Expansion panel plugins expands a collapsed panel in full upon selecting\n */\n\nconst ExpansionPanel = (($) => {\n // constants >>>\n const DATA_KEY = 'bs.collapse'\n const EVENT_KEY = `.${DATA_KEY}`\n\n const ClassName = {\n SHOW : 'show',\n SHOW_PREDECESSOR : 'show-predecessor'\n }\n\n const Event = {\n HIDE : `hide${EVENT_KEY}`,\n SHOW : `show${EVENT_KEY}`\n }\n\n const Selector = {\n PANEL : '.expansion-panel',\n PANEL_BODY : '.expansion-panel .collapse'\n }\n // <<< constants\n\n $(document).on(`${Event.HIDE}`, Selector.PANEL_BODY, function () {\n const target = $(this).closest(Selector.PANEL)\n\n target.removeClass(ClassName.SHOW)\n\n const predecessor = target.prev(Selector.PANEL)\n\n if (predecessor.length) {\n predecessor.removeClass(ClassName.SHOW_PREDECESSOR)\n }\n }).on(`${Event.SHOW}`, Selector.PANEL_BODY, function () {\n const target = $(this).closest(Selector.PANEL)\n\n target.addClass(ClassName.SHOW)\n\n const predecessor = target.prev(Selector.PANEL)\n\n if (predecessor.length) {\n predecessor.addClass(ClassName.SHOW_PREDECESSOR)\n }\n })\n})($)\n\nexport default ExpansionPanel\n","import $ from 'jquery'\n\n/*\n * Global util js\n * Based on Bootstrap's (v4.1.X) `util.js`\n */\n\nconst Util = (($) => {\n const MAX_UID = 1000000\n const MILLISECONDS_MULTIPLIER = 1000\n const TRANSITION_END = 'transitionend'\n\n function getSpecialTransitionEndEvent() {\n return {\n bindType : TRANSITION_END,\n delegateType : TRANSITION_END,\n handle(event) {\n if ($(event.target).is(this)) {\n return event.handleObj.handler.apply(this, arguments) // eslint-disable-line prefer-rest-params\n }\n return undefined // eslint-disable-line no-undefined\n }\n }\n }\n\n function setTransitionEndSupport() {\n $.fn.emulateTransitionEnd = transitionEndEmulator\n $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent()\n }\n\n function toType(obj) {\n return {}.toString.call(obj).match(/\\s([a-z]+)/i)[1].toLowerCase()\n }\n\n function transitionEndEmulator(duration) {\n let called = false\n\n $(this).one(Util.TRANSITION_END, () => {\n called = true\n })\n\n setTimeout(() => {\n if (!called) {\n Util.triggerTransitionEnd(this)\n }\n }, duration)\n\n return this\n }\n\n const Util = {\n\n TRANSITION_END: 'mdTransitionEnd',\n\n getSelectorFromElement(element) {\n let selector = element.getAttribute('data-target')\n\n if (!selector || selector === '#') {\n selector = element.getAttribute('href') || ''\n }\n\n try {\n const $selector = $(document).find(selector)\n\n return $selector.length > 0 ? selector : null\n } catch (err) {\n return null\n }\n },\n\n getTransitionDurationFromElement(element) {\n if (!element) {\n return 0\n }\n\n let transitionDuration = $(element).css('transition-duration')\n\n if (!transitionDuration) {\n return 0\n }\n\n transitionDuration = transitionDuration.split(',')[0]\n\n return parseFloat(transitionDuration) * MILLISECONDS_MULTIPLIER\n },\n\n getUID(prefix) {\n do {\n // eslint-disable-next-line no-bitwise\n prefix += ~~(Math.random() * MAX_UID)\n } while (document.getElementById(prefix))\n return prefix\n },\n\n isElement(obj) {\n return (obj[0] || obj).nodeType\n },\n\n reflow(element) {\n return element.offsetHeight\n },\n\n supportsTransitionEnd() {\n return Boolean(TRANSITION_END)\n },\n\n triggerTransitionEnd(element) {\n $(element).trigger(TRANSITION_END)\n },\n\n typeCheckConfig(componentName, config, configTypes) {\n for (const property in configTypes) {\n if (Object.prototype.hasOwnProperty.call(configTypes, property)) {\n const expectedTypes = configTypes[property]\n const value = config[property]\n const valueType = value && Util.isElement(value) ? 'element' : toType(value)\n\n if (!new RegExp(expectedTypes).test(valueType)) {\n throw new Error(\n `${componentName.toUpperCase()}: ` +\n `Option \"${property}\" provided type \"${valueType}\" ` +\n `but expected type \"${expectedTypes}\".`)\n }\n }\n }\n }\n }\n\n setTransitionEndSupport()\n\n return Util\n})($)\n\nexport default Util\n","import $ from 'jquery'\nimport Util from './util'\n\n/*\n * Navigation drawer plguin\n * Based on Bootstrap's (v4.1.X) `modal.js`\n */\n\nconst NavDrawer = (($) => {\n // constants >>>\n const DATA_API_KEY = '.data-api'\n const DATA_KEY = 'md.navdrawer'\n const ESCAPE_KEYCODE = 27\n const EVENT_KEY = `.${DATA_KEY}`\n const NAME = 'navdrawer'\n const NO_CONFLICT = $.fn[NAME]\n\n const ClassName = {\n BACKDROP : 'navdrawer-backdrop',\n OPEN : 'navdrawer-open',\n SHOW : 'show'\n }\n\n const Default = {\n breakpoint : '',\n keyboard : true,\n show : true,\n type : 'default'\n }\n\n const DefaultType = {\n keyboard : 'boolean',\n show : 'boolean',\n type : 'string'\n }\n\n const Event = {\n CLICK_DATA_API : `click${EVENT_KEY}${DATA_API_KEY}`,\n CLICK_DISMISS : `click.dismiss${EVENT_KEY}`,\n FOCUSIN : `focusin${EVENT_KEY}`,\n HIDDEN : `hidden${EVENT_KEY}`,\n HIDE : `hide${EVENT_KEY}`,\n KEYDOWN_DISMISS : `keydown.dismiss${EVENT_KEY}`,\n MOUSEDOWN_DISMISS : `mousedown.dismiss${EVENT_KEY}`,\n MOUSEUP_DISMISS : `mouseup.dismiss${EVENT_KEY}`,\n SHOW : `show${EVENT_KEY}`,\n SHOWN : `shown${EVENT_KEY}`\n }\n\n const Selector = {\n CONTENT : '.navdrawer-content',\n DATA_DISMISS : '[data-dismiss=\"navdrawer\"]',\n DATA_TOGGLE : '[data-toggle=\"navdrawer\"]'\n }\n // <<< constants\n\n class NavDrawer {\n constructor(element, config) {\n this._backdrop = null\n this._config = this._getConfig(config)\n this._content = $(element).find(Selector.CONTENT)[0]\n this._element = element\n this._ignoreBackdropClick = false\n this._isShown = false\n this._typeBreakpoint = this._config.breakpoint === '' ? '' : `-${this._config.breakpoint}`\n }\n\n hide(event) {\n if (event) {\n event.preventDefault()\n }\n\n if (this._isTransitioning || !this._isShown) {\n return\n }\n\n const hideEvent = $.Event(Event.HIDE)\n\n $(this._element).trigger(hideEvent)\n\n if (!this._isShown || hideEvent.isDefaultPrevented()) {\n return\n }\n\n this._isShown = false\n\n this._isTransitioning = true\n\n this._setEscapeEvent()\n\n $(document).off(Event.FOCUSIN)\n\n $(document.body).removeClass(`${ClassName.OPEN}-${this._config.type}${this._typeBreakpoint}`)\n\n $(this._element).removeClass(ClassName.SHOW)\n\n $(this._element).off(Event.CLICK_DISMISS)\n\n $(this._content).off(Event.MOUSEDOWN_DISMISS)\n\n const transitionDuration = Util.getTransitionDurationFromElement(this._content)\n\n $(this._content)\n .one(Util.TRANSITION_END, (event) => this._hideNavdrawer(event))\n .emulateTransitionEnd(transitionDuration)\n\n this._showBackdrop()\n }\n\n show(relatedTarget) {\n if (this._isTransitioning || this._isShown) {\n return\n }\n\n this._isTransitioning = true\n\n const showEvent = $.Event(Event.SHOW, {\n relatedTarget\n })\n\n $(this._element).trigger(showEvent)\n\n if (this._isShown || showEvent.isDefaultPrevented()) {\n return\n }\n\n this._isShown = true\n\n this._setEscapeEvent()\n\n $(this._element).addClass(`${NAME}-${this._config.type}${this._typeBreakpoint}`)\n\n $(this._element).on(Event.CLICK_DISMISS, Selector.DATA_DISMISS, (event) => this.hide(event))\n\n $(this._content).on(Event.MOUSEDOWN_DISMISS, () => {\n $(this._element).one(Event.MOUSEUP_DISMISS, (event) => {\n if ($(event.target).is(this._element)) {\n this._ignoreBackdropClick = true\n }\n })\n })\n\n this._showBackdrop()\n this._showElement(relatedTarget)\n }\n\n toggle(relatedTarget) {\n return this._isShown ? this.hide() : this.show(relatedTarget)\n }\n\n _enforceFocus() {\n $(document)\n .off(Event.FOCUSIN)\n .on(Event.FOCUSIN, (event) => {\n if (document !== event.target &&\n this._element !== event.target &&\n $(this._element).has(event.target).length === 0) {\n this._element.focus()\n }\n })\n }\n\n _getConfig(config) {\n config = {\n ...Default,\n ...config\n }\n\n Util.typeCheckConfig(NAME, config, DefaultType)\n\n return config\n }\n\n _hideNavdrawer() {\n this._element.style.display = 'none'\n\n this._element.setAttribute('aria-hidden', true)\n\n this._isTransitioning = false\n\n $(this._element).trigger(Event.HIDDEN)\n }\n\n _removeBackdrop() {\n if (this._backdrop) {\n $(this._backdrop).remove()\n this._backdrop = null\n }\n }\n\n _setEscapeEvent() {\n if (this._isShown && this._config.keyboard) {\n $(this._element).on(Event.KEYDOWN_DISMISS, (event) => {\n if (event.which === ESCAPE_KEYCODE) {\n event.preventDefault()\n\n this.hide()\n }\n })\n } else if (!this._isShown) {\n $(this._element).off(Event.KEYDOWN_DISMISS)\n }\n }\n\n _showBackdrop() {\n if (this._isShown) {\n this._backdrop = document.createElement('div')\n\n $(this._backdrop)\n .addClass(ClassName.BACKDROP)\n .addClass(`${ClassName.BACKDROP}-${this._config.type}${this._typeBreakpoint}`)\n .appendTo(document.body)\n\n $(this._element).on(Event.CLICK_DISMISS, (event) => {\n if (this._ignoreBackdropClick) {\n this._ignoreBackdropClick = false\n\n return\n }\n\n if (event.target !== event.currentTarget) {\n return\n }\n\n this.hide()\n })\n\n Util.reflow(this._backdrop)\n\n $(this._backdrop).addClass(ClassName.SHOW)\n } else if (!this._isShown && this._backdrop) {\n $(this._backdrop).removeClass(ClassName.SHOW)\n\n this._removeBackdrop()\n }\n }\n\n _showElement(relatedTarget) {\n if (!this._element.parentNode ||\n this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {\n document.body.appendChild(this._element)\n }\n\n this._element.style.display = 'block'\n\n this._element.removeAttribute('aria-hidden')\n\n Util.reflow(this._element)\n\n $(document.body).addClass(`${ClassName.OPEN}-${this._config.type}${this._typeBreakpoint}`)\n\n $(this._element).addClass(ClassName.SHOW)\n\n this._enforceFocus()\n\n const shownEvent = $.Event(Event.SHOWN, {\n relatedTarget\n })\n\n const transitionComplete = () => {\n this._element.focus()\n\n this._isTransitioning = false\n\n $(this._element).trigger(shownEvent)\n }\n\n const transitionDuration = Util.getTransitionDurationFromElement(this._content)\n\n $(this._content)\n .one(Util.TRANSITION_END, transitionComplete)\n .emulateTransitionEnd(transitionDuration)\n }\n\n static get Default() {\n return Default\n }\n\n static _jQueryInterface(config, relatedTarget) {\n return this.each(function () {\n const _config = {\n ...Default,\n ...$(this).data(),\n ...typeof config === 'object' && config ? config : {}\n }\n\n let data = $(this).data(DATA_KEY)\n\n if (!data) {\n data = new NavDrawer(this, _config)\n\n $(this).data(DATA_KEY, data)\n }\n\n if (typeof config === 'string') {\n if (typeof data[config] === 'undefined') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config](relatedTarget)\n } else if (_config.show) {\n data.show(relatedTarget)\n }\n })\n }\n }\n\n $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {\n const selector = Util.getSelectorFromElement(this)\n\n let target\n\n if (selector) {\n target = $(selector)[0]\n }\n\n const config = $(target).data(DATA_KEY) ? 'toggle' : {\n ...$(target).data(),\n ...$(this).data()\n }\n\n if (this.tagName === 'A' || this.tagName === 'AREA') {\n event.preventDefault()\n }\n\n const $target = $(target).one(Event.SHOW, (showEvent) => {\n if (showEvent.isDefaultPrevented()) {\n return\n }\n\n $target.one(Event.HIDDEN, () => {\n if ($(this).is(':visible')) {\n this.focus()\n }\n })\n })\n\n NavDrawer._jQueryInterface.call($(target), config, this)\n })\n\n $.fn[NAME] = NavDrawer._jQueryInterface\n $.fn[NAME].Constructor = NavDrawer\n $.fn[NAME].noConflict = function () {\n $.fn[NAME] = NO_CONFLICT\n\n return NavDrawer._jQueryInterface\n }\n\n return NavDrawer\n})($)\n\nexport default NavDrawer\n","export var defaultOptions = {\n className: '',\n color: 'currentcolor',\n opacity: .1,\n spreadingDuration: '.4s',\n spreadingDelay: '0s',\n spreadingTimingFunction: 'linear',\n clearing: true,\n clearingDuration: '1s',\n clearingDelay: '0s',\n clearingTimingFunction: 'ease-in-out',\n centered: false,\n appendTo: 'body',\n};\nvar target2container2ripplet = new Map();\nvar copyStyles = function (destination, source, properties) {\n for (var _i = 0, properties_1 = properties; _i < properties_1.length; _i++) {\n var property = properties_1[_i];\n destination[property] = source[property];\n }\n};\nfunction ripplet(_a, _options) {\n var currentTarget = _a.currentTarget, clientX = _a.clientX, clientY = _a.clientY;\n if (!(currentTarget instanceof Element)) {\n return;\n }\n var options = _options\n ? Object.keys(defaultOptions).reduce(function (merged, field) { return (merged[field] = _options.hasOwnProperty(field) ? _options[field] : defaultOptions[field], merged); }, {})\n : defaultOptions;\n var targetRect = currentTarget.getBoundingClientRect();\n if (options.centered && options.centered !== 'false') {\n clientX = targetRect.left + targetRect.width * .5;\n clientY = targetRect.top + targetRect.height * .5;\n }\n else if (typeof clientX !== 'number' || typeof clientY !== 'number') {\n return;\n }\n var targetStyle = getComputedStyle(currentTarget);\n var documentElement = document.documentElement, body = document.body;\n var containerElement = document.createElement('div');\n var appendToParent = options.appendTo === 'parent';\n var removingElement = containerElement;\n {\n var containerStyle = containerElement.style;\n if (targetStyle.position === 'fixed' || (targetStyle.position === 'absolute' && appendToParent)) {\n if (appendToParent) {\n currentTarget.parentElement.insertBefore(containerElement, currentTarget);\n }\n else {\n body.appendChild(containerElement);\n }\n copyStyles(containerStyle, targetStyle, ['position', 'left', 'top', 'right', 'bottom', 'marginLeft', 'marginTop', 'marginRight', 'marginBottom']);\n }\n else if (appendToParent) {\n var parentStyle = getComputedStyle(currentTarget.parentElement);\n if (parentStyle.display === 'flex' || parentStyle.display === 'inline-flex') {\n currentTarget.parentElement.insertBefore(containerElement, currentTarget);\n containerStyle.position = 'absolute';\n containerStyle.left = currentTarget.offsetLeft + \"px\";\n containerStyle.top = currentTarget.offsetTop + \"px\";\n }\n else {\n var containerContainer = removingElement\n = currentTarget.parentElement.insertBefore(document.createElement('div'), currentTarget);\n var containerContainerStyle = containerContainer.style;\n containerContainerStyle.display = 'inline-block';\n containerContainerStyle.position = 'relative';\n containerContainerStyle.width = containerContainerStyle.height\n = '0';\n containerContainerStyle.cssFloat = targetStyle.cssFloat;\n var containerContainerRect = containerContainer.getBoundingClientRect(); // this may be a slow operation...\n containerContainer.appendChild(containerElement);\n containerStyle.position = 'absolute';\n containerStyle.top = targetRect.top - containerContainerRect.top + \"px\";\n containerStyle.left = targetRect.left - containerContainerRect.left + \"px\";\n }\n }\n else {\n body.appendChild(containerElement);\n containerStyle.position = 'absolute';\n containerStyle.left = targetRect.left + documentElement.scrollLeft + body.scrollLeft + \"px\";\n containerStyle.top = targetRect.top + documentElement.scrollTop + body.scrollTop + \"px\";\n }\n containerStyle.overflow = 'hidden';\n containerStyle.pointerEvents = 'none';\n containerStyle.width = targetRect.width + \"px\";\n containerStyle.height = targetRect.height + \"px\";\n containerStyle.zIndex = (+targetStyle.zIndex || 0) + 1;\n containerStyle.opacity = options.opacity;\n copyStyles(containerStyle, targetStyle, ['borderTopLeftRadius', 'borderTopRightRadius', 'borderBottomLeftRadius', 'borderBottomRightRadius', 'webkitClipPath', 'clipPath']);\n }\n {\n var distanceX = Math.max(clientX - targetRect.left, targetRect.right - clientX);\n var distanceY = Math.max(clientY - targetRect.top, targetRect.bottom - clientY);\n var radius = Math.sqrt(distanceX * distanceX + distanceY * distanceY);\n var rippletElement = containerElement.appendChild(document.createElement('div'));\n var rippletStyle = rippletElement.style;\n rippletElement.className = options.className;\n rippletStyle.backgroundColor = /^currentcolor$/i.test(options.color) ? targetStyle.color : options.color;\n rippletStyle.width = rippletStyle.height\n = radius * 2 + \"px\";\n if (getComputedStyle(appendToParent ? currentTarget.parentElement : body).direction === 'rtl') {\n rippletStyle.marginRight = targetRect.right - clientX - radius + \"px\";\n }\n else {\n rippletStyle.marginLeft = clientX - targetRect.left - radius + \"px\";\n }\n rippletStyle.marginTop = clientY - targetRect.top - radius + \"px\";\n rippletStyle.borderRadius = '50%';\n rippletStyle.transition =\n \"transform \" + options.spreadingDuration + \" \" + options.spreadingTimingFunction + \" \" + options.spreadingDelay + \",opacity \" + options.clearingDuration + \" \" + options.clearingTimingFunction + \" \" + options.clearingDelay;\n rippletStyle.transform = 'scale(0)';\n // reflect styles by force layout\n // tslint:disable-next-line:no-unused-expression\n rippletElement.offsetTop;\n rippletStyle.transform = '';\n rippletElement.addEventListener('transitionend', function (event) {\n if (event.propertyName === 'opacity' && removingElement.parentElement) {\n removingElement.parentElement.removeChild(removingElement);\n }\n });\n if (options.clearing && options.clearing !== 'false') {\n rippletStyle.opacity = '0';\n }\n else {\n var container2ripplet = target2container2ripplet.get(currentTarget);\n if (!container2ripplet) {\n target2container2ripplet.set(currentTarget, container2ripplet = new Map());\n }\n container2ripplet.set(containerElement, rippletElement);\n }\n }\n return containerElement;\n}\nripplet.clear = function (targetElement, rippletContainerElement) {\n if (targetElement) {\n var container2ripplet = target2container2ripplet.get(targetElement);\n if (container2ripplet) {\n if (rippletContainerElement) {\n var rippletElement = container2ripplet.get(rippletContainerElement);\n rippletElement && (rippletElement.style.opacity = '0');\n container2ripplet.delete(rippletContainerElement);\n container2ripplet.size === 0 && target2container2ripplet.delete(targetElement);\n }\n else {\n container2ripplet.forEach(function (r) { return r.style.opacity = '0'; });\n target2container2ripplet.delete(targetElement);\n }\n }\n }\n else {\n target2container2ripplet.forEach(function (container2ripplet) { return container2ripplet.forEach(function (r) { return r.style.opacity = '0'; }); });\n target2container2ripplet.clear();\n }\n};\nripplet.defaultOptions = defaultOptions;\nripplet._ripplets = target2container2ripplet;\nexport default ripplet;\n","/*!\n * pickadate.js v3.6.4, 2019/05/25\n * By Amsul, http://amsul.ca\n * Hosted on http://amsul.github.io/pickadate.js\n * Licensed under MIT\n */\n\n(function ( factory ) {\n\n // AMD.\n if ( typeof define == 'function' && define.amd )\n define( 'picker', ['jquery'], factory )\n\n // Node.js/browserify.\n else if ( typeof exports == 'object' )\n module.exports = factory( require('jquery') )\n\n // Browser globals.\n else if ( typeof window == 'object' )\n window.Picker = factory( jQuery )\n \n else this.Picker = factory( jQuery )\n\n}(function( $ ) {\n\nvar $window = $( window )\nvar $document = $( document )\nvar $html = $( document.documentElement )\nvar supportsTransitions = document.documentElement.style.transition != null\n\n\n/**\n * The picker constructor that creates a blank picker.\n */\nfunction PickerConstructor( ELEMENT, NAME, COMPONENT, OPTIONS ) {\n\n // If there’s no element, return the picker constructor.\n if ( !ELEMENT ) return PickerConstructor\n\n\n var\n IS_DEFAULT_THEME = false,\n\n\n // The state of the picker.\n STATE = {\n id: ELEMENT.id || 'P' + Math.abs( ~~(Math.random() * new Date()) ),\n handlingOpen: false,\n },\n\n\n // Merge the defaults and options passed.\n SETTINGS = COMPONENT ? $.extend( true, {}, COMPONENT.defaults, OPTIONS ) : OPTIONS || {},\n\n\n // Merge the default classes with the settings classes.\n CLASSES = $.extend( {}, PickerConstructor.klasses(), SETTINGS.klass ),\n\n\n // The element node wrapper into a jQuery object.\n $ELEMENT = $( ELEMENT ),\n\n\n // Pseudo picker constructor.\n PickerInstance = function() {\n return this.start()\n },\n\n\n // The picker prototype.\n P = PickerInstance.prototype = {\n\n constructor: PickerInstance,\n\n $node: $ELEMENT,\n\n\n /**\n * Initialize everything\n */\n start: function() {\n\n // If it’s already started, do nothing.\n if ( STATE && STATE.start ) return P\n\n\n // Update the picker states.\n STATE.methods = {}\n STATE.start = true\n STATE.open = false\n STATE.type = ELEMENT.type\n\n\n // Confirm focus state, convert into text input to remove UA stylings,\n // and set as readonly to prevent keyboard popup.\n ELEMENT.autofocus = ELEMENT == getActiveElement()\n ELEMENT.readOnly = !SETTINGS.editable\n ELEMENT.id = ELEMENT.id || STATE.id\n if ( ELEMENT.type != 'text' ) {\n ELEMENT.type = 'text'\n }\n\n\n // Create a new picker component with the settings.\n P.component = new COMPONENT(P, SETTINGS)\n\n\n // Create the picker root and then prepare it.\n P.$root = $( '
' )\n prepareElementRoot()\n\n\n // Create the picker holder and then prepare it.\n P.$holder = $( createWrappedComponent() ).appendTo( P.$root )\n prepareElementHolder()\n\n\n // If there’s a format for the hidden input element, create the element.\n if ( SETTINGS.formatSubmit ) {\n prepareElementHidden()\n }\n\n\n // Prepare the input element.\n prepareElement()\n\n\n // Insert the hidden input as specified in the settings.\n if ( SETTINGS.containerHidden ) $( SETTINGS.containerHidden ).append( P._hidden )\n else $ELEMENT.after( P._hidden )\n\n\n // Insert the root as specified in the settings.\n if ( SETTINGS.container ) $( SETTINGS.container ).append( P.$root )\n else $ELEMENT.after( P.$root )\n\n\n // Bind the default component and settings events.\n P.on({\n start: P.component.onStart,\n render: P.component.onRender,\n stop: P.component.onStop,\n open: P.component.onOpen,\n close: P.component.onClose,\n set: P.component.onSet\n }).on({\n start: SETTINGS.onStart,\n render: SETTINGS.onRender,\n stop: SETTINGS.onStop,\n open: SETTINGS.onOpen,\n close: SETTINGS.onClose,\n set: SETTINGS.onSet\n })\n\n\n // Once we’re all set, check the theme in use.\n IS_DEFAULT_THEME = isUsingDefaultTheme( P.$holder[0] )\n\n\n // If the element has autofocus, open the picker.\n if ( ELEMENT.autofocus ) {\n P.open()\n }\n\n\n // Trigger queued the “start” and “render” events.\n return P.trigger( 'start' ).trigger( 'render' )\n }, //start\n\n\n /**\n * Render a new picker\n */\n render: function( entireComponent ) {\n\n // Insert a new component holder in the root or box.\n if ( entireComponent ) {\n P.$holder = $( createWrappedComponent() )\n prepareElementHolder()\n P.$root.html( P.$holder )\n }\n else P.$root.find( '.' + CLASSES.box ).html( P.component.nodes( STATE.open ) )\n\n // Trigger the queued “render” events.\n return P.trigger( 'render' )\n }, //render\n\n\n /**\n * Destroy everything\n */\n stop: function() {\n\n // If it’s already stopped, do nothing.\n if ( !STATE.start ) return P\n\n // Then close the picker.\n P.close()\n\n // Remove the hidden field.\n if ( P._hidden ) {\n P._hidden.parentNode.removeChild( P._hidden )\n }\n\n // Remove the root.\n P.$root.remove()\n\n // Remove the input class, remove the stored data, and unbind\n // the events (after a tick for IE - see `P.close`).\n $ELEMENT.removeClass( CLASSES.input ).removeData( NAME )\n setTimeout( function() {\n $ELEMENT.off( '.' + STATE.id )\n }, 0)\n\n // Restore the element state\n ELEMENT.type = STATE.type\n ELEMENT.readOnly = false\n\n // Trigger the queued “stop” events.\n P.trigger( 'stop' )\n\n // Reset the picker states.\n STATE.methods = {}\n STATE.start = false\n\n return P\n }, //stop\n\n\n /**\n * Open up the picker\n */\n open: function( dontGiveFocus ) {\n\n // If it’s already open, do nothing.\n if ( STATE.open ) return P\n\n // Add the “active” class.\n $ELEMENT.addClass( CLASSES.active )\n aria( ELEMENT, 'expanded', true )\n\n // * A Firefox bug, when `html` has `overflow:hidden`, results in\n // killing transitions :(. So add the “opened” state on the next tick.\n // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=625289\n setTimeout( function() {\n\n // Add the “opened” class to the picker root.\n P.$root.addClass( CLASSES.opened )\n aria( P.$root[0], 'hidden', false )\n\n }, 0 )\n\n // If we have to give focus, bind the element and doc events.\n if ( dontGiveFocus !== false ) {\n\n // Set it as open.\n STATE.open = true\n\n // Prevent the page from scrolling.\n if ( IS_DEFAULT_THEME ) {\n $('body').\n css( 'overflow', 'hidden' ).\n css( 'padding-right', '+=' + getScrollbarWidth() )\n }\n\n // Pass focus to the root element’s jQuery object.\n focusPickerOnceOpened()\n\n // Bind the document events.\n $document.on( 'click.' + STATE.id + ' focusin.' + STATE.id, function( event ) {\n // If the picker is currently midway through processing\n // the opening sequence of events then don't handle clicks\n // on any part of the DOM. This is caused by a bug in Chrome 73\n // where a click event is being generated with the incorrect\n // path in it.\n // In short, if someone does a click that finishes after the\n // new element is created then the path contains only the\n // parent element and not the input element itself.\n if (STATE.handlingOpen) {\n return;\n }\n\n var target = getRealEventTarget( event, ELEMENT )\n\n // If the target of the event is not the element, close the picker picker.\n // * Don’t worry about clicks or focusins on the root because those don’t bubble up.\n // Also, for Firefox, a click on an `option` element bubbles up directly\n // to the doc. So make sure the target wasn't the doc.\n // * In Firefox stopPropagation() doesn’t prevent right-click events from bubbling,\n // which causes the picker to unexpectedly close when right-clicking it. So make\n // sure the event wasn’t a right-click.\n // * In Chrome 62 and up, password autofill causes a simulated focusin event which\n // closes the picker.\n if ( ! event.isSimulated && target != ELEMENT && target != document && event.which != 3 ) {\n\n // If the target was the holder that covers the screen,\n // keep the element focused to maintain tabindex.\n P.close( target === P.$holder[0] )\n }\n\n }).on( 'keydown.' + STATE.id, function( event ) {\n\n var\n // Get the keycode.\n keycode = event.keyCode,\n\n // Translate that to a selection change.\n keycodeToMove = P.component.key[ keycode ],\n\n // Grab the target.\n target = getRealEventTarget( event, ELEMENT )\n\n\n // On escape, close the picker and give focus.\n if ( keycode == 27 ) {\n P.close( true )\n }\n\n\n // Check if there is a key movement or “enter” keypress on the element.\n else if ( target == P.$holder[0] && ( keycodeToMove || keycode == 13 ) ) {\n\n // Prevent the default action to stop page movement.\n event.preventDefault()\n\n // Trigger the key movement action.\n if ( keycodeToMove ) {\n PickerConstructor._.trigger( P.component.key.go, P, [ PickerConstructor._.trigger( keycodeToMove ) ] )\n }\n\n // On “enter”, if the highlighted item isn’t disabled, set the value and close.\n else if ( !P.$root.find( '.' + CLASSES.highlighted ).hasClass( CLASSES.disabled ) ) {\n P.set( 'select', P.component.item.highlight )\n if ( SETTINGS.closeOnSelect ) {\n P.close( true )\n }\n }\n }\n\n\n // If the target is within the root and “enter” is pressed,\n // prevent the default action and trigger a click on the target instead.\n else if ( $.contains( P.$root[0], target ) && keycode == 13 ) {\n event.preventDefault()\n target.click()\n }\n })\n }\n\n // Trigger the queued “open” events.\n return P.trigger( 'open' )\n }, //open\n\n\n /**\n * Close the picker\n */\n close: function( giveFocus ) {\n\n // If we need to give focus, do it before changing states.\n if ( giveFocus ) {\n if ( SETTINGS.editable ) {\n ELEMENT.focus()\n }\n else {\n // ....ah yes! It would’ve been incomplete without a crazy workaround for IE :|\n // The focus is triggered *after* the close has completed - causing it\n // to open again. So unbind and rebind the event at the next tick.\n P.$holder.off( 'focus.toOpen' ).focus()\n setTimeout( function() {\n P.$holder.on( 'focus.toOpen', handleFocusToOpenEvent )\n }, 0 )\n }\n }\n\n // Remove the “active” class.\n $ELEMENT.removeClass( CLASSES.active )\n aria( ELEMENT, 'expanded', false )\n\n // * A Firefox bug, when `html` has `overflow:hidden`, results in\n // killing transitions :(. So remove the “opened” state on the next tick.\n // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=625289\n setTimeout( function() {\n\n // Remove the “opened” and “focused” class from the picker root.\n P.$root.removeClass( CLASSES.opened + ' ' + CLASSES.focused )\n aria( P.$root[0], 'hidden', true )\n\n }, 0 )\n\n // If it’s already closed, do nothing more.\n if ( !STATE.open ) return P\n\n // Set it as closed.\n STATE.open = false\n\n // Allow the page to scroll.\n if ( IS_DEFAULT_THEME ) {\n $('body').\n css( 'overflow', '' ).\n css( 'padding-right', '-=' + getScrollbarWidth() )\n }\n\n // Unbind the document events.\n $document.off( '.' + STATE.id )\n\n // Trigger the queued “close” events.\n return P.trigger( 'close' )\n }, //close\n\n\n /**\n * Clear the values\n */\n clear: function( options ) {\n return P.set( 'clear', null, options )\n }, //clear\n\n\n /**\n * Set something\n */\n set: function( thing, value, options ) {\n\n var thingItem, thingValue,\n thingIsObject = $.isPlainObject( thing ),\n thingObject = thingIsObject ? thing : {}\n\n // Make sure we have usable options.\n options = thingIsObject && $.isPlainObject( value ) ? value : options || {}\n\n if ( thing ) {\n\n // If the thing isn’t an object, make it one.\n if ( !thingIsObject ) {\n thingObject[ thing ] = value\n }\n\n // Go through the things of items to set.\n for ( thingItem in thingObject ) {\n\n // Grab the value of the thing.\n thingValue = thingObject[ thingItem ]\n\n // First, if the item exists and there’s a value, set it.\n if ( thingItem in P.component.item ) {\n if ( thingValue === undefined ) thingValue = null\n P.component.set( thingItem, thingValue, options )\n }\n\n // Then, check to update the element value and broadcast a change.\n if ( ( thingItem == 'select' || thingItem == 'clear' ) && SETTINGS.updateInput ) {\n $ELEMENT.\n val( thingItem == 'clear' ? '' : P.get( thingItem, SETTINGS.format ) ).\n trigger( 'change' )\n }\n }\n\n // Render a new picker.\n P.render()\n }\n\n // When the method isn’t muted, trigger queued “set” events and pass the `thingObject`.\n return options.muted ? P : P.trigger( 'set', thingObject )\n }, //set\n\n\n /**\n * Get something\n */\n get: function( thing, format ) {\n\n // Make sure there’s something to get.\n thing = thing || 'value'\n\n // If a picker state exists, return that.\n if ( STATE[ thing ] != null ) {\n return STATE[ thing ]\n }\n\n // Return the submission value, if that.\n if ( thing == 'valueSubmit' ) {\n if ( P._hidden ) {\n return P._hidden.value\n }\n thing = 'value'\n }\n\n // Return the value, if that.\n if ( thing == 'value' ) {\n return ELEMENT.value\n }\n\n // Check if a component item exists, return that.\n if ( thing in P.component.item ) {\n if ( typeof format == 'string' ) {\n var thingValue = P.component.get( thing )\n return thingValue ?\n PickerConstructor._.trigger(\n P.component.formats.toString,\n P.component,\n [ format, thingValue ]\n ) : ''\n }\n return P.component.get( thing )\n }\n }, //get\n\n\n\n /**\n * Bind events on the things.\n */\n on: function( thing, method, internal ) {\n\n var thingName, thingMethod,\n thingIsObject = $.isPlainObject( thing ),\n thingObject = thingIsObject ? thing : {}\n\n if ( thing ) {\n\n // If the thing isn’t an object, make it one.\n if ( !thingIsObject ) {\n thingObject[ thing ] = method\n }\n\n // Go through the things to bind to.\n for ( thingName in thingObject ) {\n\n // Grab the method of the thing.\n thingMethod = thingObject[ thingName ]\n\n // If it was an internal binding, prefix it.\n if ( internal ) {\n thingName = '_' + thingName\n }\n\n // Make sure the thing methods collection exists.\n STATE.methods[ thingName ] = STATE.methods[ thingName ] || []\n\n // Add the method to the relative method collection.\n STATE.methods[ thingName ].push( thingMethod )\n }\n }\n\n return P\n }, //on\n\n\n\n /**\n * Unbind events on the things.\n */\n off: function() {\n var i, thingName,\n names = arguments;\n for ( i = 0, namesCount = names.length; i < namesCount; i += 1 ) {\n thingName = names[i]\n if ( thingName in STATE.methods ) {\n delete STATE.methods[thingName]\n }\n }\n return P\n },\n\n\n /**\n * Fire off method events.\n */\n trigger: function( name, data ) {\n var _trigger = function( name ) {\n var methodList = STATE.methods[ name ]\n if ( methodList ) {\n methodList.map( function( method ) {\n PickerConstructor._.trigger( method, P, [ data ] )\n })\n }\n }\n _trigger( '_' + name )\n _trigger( name )\n return P\n } //trigger\n } //PickerInstance.prototype\n\n\n /**\n * Wrap the picker holder components together.\n */\n function createWrappedComponent() {\n\n // Create a picker wrapper holder\n return PickerConstructor._.node( 'div',\n\n // Create a picker wrapper node\n PickerConstructor._.node( 'div',\n\n // Create a picker frame\n PickerConstructor._.node( 'div',\n\n // Create a picker box node\n PickerConstructor._.node( 'div',\n\n // Create the components nodes.\n P.component.nodes( STATE.open ),\n\n // The picker box class\n CLASSES.box\n ),\n\n // Picker wrap class\n CLASSES.wrap\n ),\n\n // Picker frame class\n CLASSES.frame\n ),\n\n // Picker holder class\n CLASSES.holder,\n\n 'tabindex=\"-1\"'\n ) //endreturn\n } //createWrappedComponent\n\n /**\n * Prepare the input element with all bindings.\n */\n function prepareElement() {\n\n $ELEMENT.\n\n // Store the picker data by component name.\n data(NAME, P).\n\n // Add the “input” class name.\n addClass(CLASSES.input).\n\n // If there’s a `data-value`, update the value of the element.\n val( $ELEMENT.data('value') ?\n P.get('select', SETTINGS.format) :\n ELEMENT.value\n ).\n\n // On focus/click, open the picker.\n on( 'focus.' + STATE.id + ' click.' + STATE.id,\n function(event) {\n event.preventDefault()\n P.open()\n }\n )\n\n // Mousedown handler to capture when the user starts interacting\n // with the picker. This is used in working around a bug in Chrome 73.\n .on('mousedown', function() {\n STATE.handlingOpen = true;\n var handler = function() {\n // By default mouseup events are fired before a click event.\n // By using a timeout we can force the mouseup to be handled\n // after the corresponding click event is handled.\n setTimeout(function() {\n $(document).off('mouseup', handler);\n STATE.handlingOpen = false;\n }, 0);\n };\n $(document).on('mouseup', handler);\n });\n\n\n // Only bind keydown events if the element isn’t editable.\n if ( !SETTINGS.editable ) {\n\n $ELEMENT.\n\n // Handle keyboard event based on the picker being opened or not.\n on( 'keydown.' + STATE.id, handleKeydownEvent )\n }\n\n\n // Update the aria attributes.\n aria(ELEMENT, {\n haspopup: true,\n expanded: false,\n readonly: false,\n owns: ELEMENT.id + '_root'\n })\n }\n\n\n /**\n * Prepare the root picker element with all bindings.\n */\n function prepareElementRoot() {\n aria( P.$root[0], 'hidden', true )\n }\n\n\n /**\n * Prepare the holder picker element with all bindings.\n */\n function prepareElementHolder() {\n\n P.$holder.\n\n on({\n\n // For iOS8.\n keydown: handleKeydownEvent,\n\n 'focus.toOpen': handleFocusToOpenEvent,\n\n blur: function() {\n // Remove the “target” class.\n $ELEMENT.removeClass( CLASSES.target )\n },\n\n // When something within the holder is focused, stop from bubbling\n // to the doc and remove the “focused” state from the root.\n focusin: function( event ) {\n P.$root.removeClass( CLASSES.focused )\n event.stopPropagation()\n },\n\n // When something within the holder is clicked, stop it\n // from bubbling to the doc.\n 'mousedown click': function( event ) {\n\n var target = getRealEventTarget( event, ELEMENT )\n\n // Make sure the target isn’t the root holder so it can bubble up.\n if ( target != P.$holder[0] ) {\n\n event.stopPropagation()\n\n // * For mousedown events, cancel the default action in order to\n // prevent cases where focus is shifted onto external elements\n // when using things like jQuery mobile or MagnificPopup (ref: #249 & #120).\n // Also, for Firefox, don’t prevent action on the `option` element.\n if ( event.type == 'mousedown' && !$( target ).is( 'input, select, textarea, button, option' )) {\n\n event.preventDefault()\n\n // Re-focus onto the holder so that users can click away\n // from elements focused within the picker.\n P.$holder.eq(0).focus()\n }\n }\n }\n\n }).\n\n // If there’s a click on an actionable element, carry out the actions.\n on( 'click', '[data-pick], [data-nav], [data-clear], [data-close]', function() {\n\n var $target = $( this ),\n targetData = $target.data(),\n targetDisabled = $target.hasClass( CLASSES.navDisabled ) || $target.hasClass( CLASSES.disabled ),\n\n // * For IE, non-focusable elements can be active elements as well\n // (http://stackoverflow.com/a/2684561).\n activeElement = getActiveElement()\n activeElement = activeElement && ( (activeElement.type || activeElement.href ) ? activeElement : null);\n\n // If it’s disabled or nothing inside is actively focused, re-focus the element.\n if ( targetDisabled || activeElement && !$.contains( P.$root[0], activeElement ) ) {\n P.$holder.eq(0).focus()\n }\n\n // If something is superficially changed, update the `highlight` based on the `nav`.\n if ( !targetDisabled && targetData.nav ) {\n P.set( 'highlight', P.component.item.highlight, { nav: targetData.nav } )\n }\n\n // If something is picked, set `select` then close with focus.\n else if ( !targetDisabled && 'pick' in targetData ) {\n P.set( 'select', targetData.pick )\n if ( SETTINGS.closeOnSelect ) {\n P.close( true )\n }\n }\n\n // If a “clear” button is pressed, empty the values and close with focus.\n else if ( targetData.clear ) {\n P.clear()\n if ( SETTINGS.closeOnClear ) {\n P.close( true )\n }\n }\n\n else if ( targetData.close ) {\n P.close( true )\n }\n\n }) //P.$holder\n\n }\n\n\n /**\n * Prepare the hidden input element along with all bindings.\n */\n function prepareElementHidden() {\n\n var name\n\n if ( SETTINGS.hiddenName === true ) {\n name = ELEMENT.name\n ELEMENT.name = ''\n }\n else {\n name = [\n typeof SETTINGS.hiddenPrefix == 'string' ? SETTINGS.hiddenPrefix : '',\n typeof SETTINGS.hiddenSuffix == 'string' ? SETTINGS.hiddenSuffix : '_submit'\n ]\n name = name[0] + ELEMENT.name + name[1]\n }\n\n P._hidden = $(\n ''\n )[0]\n\n $ELEMENT.\n\n // If the value changes, update the hidden input with the correct format.\n on('change.' + STATE.id, function() {\n P._hidden.value = ELEMENT.value ?\n P.get('select', SETTINGS.formatSubmit) :\n ''\n })\n }\n\n\n // Wait for transitions to end before focusing the holder. Otherwise, while\n // using the `container` option, the view jumps to the container.\n function focusPickerOnceOpened() {\n\n if (IS_DEFAULT_THEME && supportsTransitions) {\n P.$holder.find('.' + CLASSES.frame).one('transitionend', function() {\n P.$holder.eq(0).focus()\n })\n }\n else {\n setTimeout(function() {\n P.$holder.eq(0).focus()\n }, 0)\n }\n }\n\n\n function handleFocusToOpenEvent(event) {\n\n // Stop the event from propagating to the doc.\n event.stopPropagation()\n\n // Add the “target” class.\n $ELEMENT.addClass( CLASSES.target )\n\n // Add the “focused” class to the root.\n P.$root.addClass( CLASSES.focused )\n\n // And then finally open the picker.\n P.open()\n }\n\n\n // For iOS8.\n function handleKeydownEvent( event ) {\n\n var keycode = event.keyCode,\n\n // Check if one of the delete keys was pressed.\n isKeycodeDelete = /^(8|46)$/.test(keycode)\n\n // For some reason IE clears the input value on “escape”.\n if ( keycode == 27 ) {\n P.close( true )\n return false\n }\n\n // Check if `space` or `delete` was pressed or the picker is closed with a key movement.\n if ( keycode == 32 || isKeycodeDelete || !STATE.open && P.component.key[keycode] ) {\n\n // Prevent it from moving the page and bubbling to doc.\n event.preventDefault()\n event.stopPropagation()\n\n // If `delete` was pressed, clear the values and close the picker.\n // Otherwise open the picker.\n if ( isKeycodeDelete ) { P.clear().close() }\n else { P.open() }\n }\n }\n\n\n // Return a new picker instance.\n return new PickerInstance()\n} //PickerConstructor\n\n\n\n/**\n * The default classes and prefix to use for the HTML classes.\n */\nPickerConstructor.klasses = function( prefix ) {\n prefix = prefix || 'picker'\n return {\n\n picker: prefix,\n opened: prefix + '--opened',\n focused: prefix + '--focused',\n\n input: prefix + '__input',\n active: prefix + '__input--active',\n target: prefix + '__input--target',\n\n holder: prefix + '__holder',\n\n frame: prefix + '__frame',\n wrap: prefix + '__wrap',\n\n box: prefix + '__box'\n }\n} //PickerConstructor.klasses\n\n\n\n/**\n * Check if the default theme is being used.\n */\nfunction isUsingDefaultTheme( element ) {\n\n var theme,\n prop = 'position'\n\n // For IE.\n if ( element.currentStyle ) {\n theme = element.currentStyle[prop]\n }\n\n // For normal browsers.\n else if ( window.getComputedStyle ) {\n theme = getComputedStyle( element )[prop]\n }\n\n return theme == 'fixed'\n}\n\n\n\n/**\n * Get the width of the browser’s scrollbar.\n * Taken from: https://github.com/VodkaBears/Remodal/blob/master/src/jquery.remodal.js\n */\nfunction getScrollbarWidth() {\n\n if ( $html.height() <= $window.height() ) {\n return 0\n }\n\n var $outer = $( '' ).\n appendTo( 'body' )\n\n // Get the width without scrollbars.\n var widthWithoutScroll = $outer[0].offsetWidth\n\n // Force adding scrollbars.\n $outer.css( 'overflow', 'scroll' )\n\n // Add the inner div.\n var $inner = $( '' ).appendTo( $outer )\n\n // Get the width with scrollbars.\n var widthWithScroll = $inner[0].offsetWidth\n\n // Remove the divs.\n $outer.remove()\n\n // Return the difference between the widths.\n return widthWithoutScroll - widthWithScroll\n}\n\n\n\n/**\n * Get the target element from the event.\n * If ELEMENT is supplied and present in the event path (ELEMENT is ancestor of the target),\n * returns ELEMENT instead\n */\nfunction getRealEventTarget( event, ELEMENT ) {\n\n var path = []\n\n if ( event.path ) {\n path = event.path\n }\n\n if ( event.originalEvent && event.originalEvent.path ) {\n path = event.originalEvent.path\n }\n\n if ( path && path.length > 0 ) {\n if ( ELEMENT && path.indexOf( ELEMENT ) >= 0 ) {\n return ELEMENT\n } else {\n return path[0]\n }\n }\n\n return event.target\n}\n\n/**\n * PickerConstructor helper methods.\n */\nPickerConstructor._ = {\n\n /**\n * Create a group of nodes. Expects:\n * `\n {\n min: {Integer},\n max: {Integer},\n i: {Integer},\n node: {String},\n item: {Function}\n }\n * `\n */\n group: function( groupObject ) {\n\n var\n // Scope for the looped object\n loopObjectScope,\n\n // Create the nodes list\n nodesList = '',\n\n // The counter starts from the `min`\n counter = PickerConstructor._.trigger( groupObject.min, groupObject )\n\n\n // Loop from the `min` to `max`, incrementing by `i`\n for ( ; counter <= PickerConstructor._.trigger( groupObject.max, groupObject, [ counter ] ); counter += groupObject.i ) {\n\n // Trigger the `item` function within scope of the object\n loopObjectScope = PickerConstructor._.trigger( groupObject.item, groupObject, [ counter ] )\n\n // Splice the subgroup and create nodes out of the sub nodes\n nodesList += PickerConstructor._.node(\n groupObject.node,\n loopObjectScope[ 0 ], // the node\n loopObjectScope[ 1 ], // the classes\n loopObjectScope[ 2 ] // the attributes\n )\n }\n\n // Return the list of nodes\n return nodesList\n }, //group\n\n\n /**\n * Create a dom node string\n */\n node: function( wrapper, item, klass, attribute ) {\n\n // If the item is false-y, just return an empty string\n if ( !item ) return ''\n\n // If the item is an array, do a join\n item = $.isArray( item ) ? item.join( '' ) : item\n\n // Check for the class\n klass = klass ? ' class=\"' + klass + '\"' : ''\n\n // Check for any attributes\n attribute = attribute ? ' ' + attribute : ''\n\n // Return the wrapped item\n return '<' + wrapper + klass + attribute + '>' + item + '' + wrapper + '>'\n }, //node\n\n\n /**\n * Lead numbers below 10 with a zero.\n */\n lead: function( number ) {\n return ( number < 10 ? '0': '' ) + number\n },\n\n\n /**\n * Trigger a function otherwise return the value.\n */\n trigger: function( callback, scope, args ) {\n return typeof callback == 'function' ? callback.apply( scope, args || [] ) : callback\n },\n\n\n /**\n * If the second character is a digit, length is 2 otherwise 1.\n */\n digits: function( string ) {\n return ( /\\d/ ).test( string[ 1 ] ) ? 2 : 1\n },\n\n\n /**\n * Tell if something is a date object.\n */\n isDate: function( value ) {\n return {}.toString.call( value ).indexOf( 'Date' ) > -1 && this.isInteger( value.getDate() )\n },\n\n\n /**\n * Tell if something is an integer.\n */\n isInteger: function( value ) {\n return {}.toString.call( value ).indexOf( 'Number' ) > -1 && value % 1 === 0\n },\n\n\n /**\n * Create ARIA attribute strings.\n */\n ariaAttr: ariaAttr\n} //PickerConstructor._\n\n\n\n/**\n * Extend the picker with a component and defaults.\n */\nPickerConstructor.extend = function( name, Component ) {\n\n // Extend jQuery.\n $.fn[ name ] = function( options, action ) {\n\n // Grab the component data.\n var componentData = this.data( name )\n\n // If the picker is requested, return the data object.\n if ( options == 'picker' ) {\n return componentData\n }\n\n // If the component data exists and `options` is a string, carry out the action.\n if ( componentData && typeof options == 'string' ) {\n return PickerConstructor._.trigger( componentData[ options ], componentData, [ action ] )\n }\n\n // Otherwise go through each matched element and if the component\n // doesn’t exist, create a new picker using `this` element\n // and merging the defaults and options with a deep copy.\n return this.each( function() {\n var $this = $( this )\n if ( !$this.data( name ) ) {\n new PickerConstructor( this, name, Component, options )\n }\n })\n }\n\n // Set the defaults.\n $.fn[ name ].defaults = Component.defaults\n} //PickerConstructor.extend\n\n\n\nfunction aria(element, attribute, value) {\n if ( $.isPlainObject(attribute) ) {\n for ( var key in attribute ) {\n ariaSet(element, key, attribute[key])\n }\n }\n else {\n ariaSet(element, attribute, value)\n }\n}\nfunction ariaSet(element, attribute, value) {\n element.setAttribute(\n (attribute == 'role' ? '' : 'aria-') + attribute,\n value\n )\n}\nfunction ariaAttr(attribute, data) {\n if ( !$.isPlainObject(attribute) ) {\n attribute = { attribute: data }\n }\n data = ''\n for ( var key in attribute ) {\n var attr = (key == 'role' ? '' : 'aria-') + key,\n attrVal = attribute[key]\n data += attrVal == null ? '' : attr + '=\"' + attribute[key] + '\"'\n }\n return data\n}\n\n// IE8 bug throws an error for activeElements within iframes.\nfunction getActiveElement() {\n try {\n return document.activeElement\n } catch ( err ) { }\n}\n\n\n\n// Expose the picker constructor.\nreturn PickerConstructor\n\n\n}));\n","import '../../../node_modules/pickadate/lib/picker.date.js'\nimport $ from 'jquery'\nimport Util from './util'\n\n/*\n * Date picker plugin extends `pickadate.js` by Amsul\n */\n\nconst PickDate = (($) => {\n // constants >>>\n const DATA_KEY = 'md.pickdate'\n const NAME = 'pickdate'\n const NO_CONFLICT = $.fn[NAME]\n\n const Default = {\n cancel : 'Cancel',\n closeOnCancel : true,\n closeOnSelect : false,\n container : '',\n containerHidden : '',\n disable : [],\n firstDay : 0,\n format : 'd/m/yyyy',\n formatSubmit : '',\n hiddenName : false,\n hiddenPrefix : '',\n hiddenSuffix : '',\n klass : {\n // button\n buttonClear : 'btn btn-flat-primary picker-button-clear',\n buttonClose : 'btn btn-flat-primary picker-button-close',\n buttonToday : 'btn btn-flat-primary picker-button-today',\n\n // day\n day : 'picker-day',\n disabled : 'picker-day-disabled',\n highlighted : 'picker-day-highlighted',\n infocus : 'picker-day-infocus',\n now : 'picker-day-today',\n outfocus : 'picker-day-outfocus',\n selected : 'picker-day-selected',\n weekdays : 'picker-weekday',\n\n // element\n box : 'picker-box',\n footer : 'picker-footer',\n frame : 'picker-frame',\n header : 'picker-header',\n holder : 'picker-holder',\n table : 'picker-table',\n wrap : 'picker-wrap',\n\n // input element\n active : 'picker-input-active',\n input : 'picker-input',\n\n // month and year nav\n month : 'picker-month',\n navDisabled : 'picker-nav-disabled',\n navNext : 'material-icons picker-nav-next',\n navPrev : 'material-icons picker-nav-prev',\n selectMonth : 'picker-select-month',\n selectYear : 'picker-select-year',\n year : 'picker-year',\n\n // root picker\n focused : 'picker-focused',\n opened : 'picker-opened',\n picker : 'picker'\n },\n labelMonthNext : 'Next month',\n labelMonthPrev : 'Previous month',\n labelMonthSelect : 'Choose a month',\n labelYearSelect : 'Choose a year',\n max : false,\n min : false,\n monthsFull : ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],\n monthsShort : ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],\n ok : 'OK',\n onClose : () => {\n // Do nothing\n },\n onOpen : () => {\n // Do nothing\n },\n onRender : () => {\n // Do nothing\n },\n onSet : () => {\n // Do nothing\n },\n onStart : () => {\n // Do nothing\n },\n onStop : () => {\n // Do nothing\n },\n selectMonths : false,\n selectYears : false,\n today : '',\n weekdaysFull : ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],\n weekdaysShort : ['S', 'M', 'T', 'W', 'T', 'F', 'S']\n }\n\n const DefaultType = {\n cancel : 'string',\n closeOnCancel : 'boolean',\n closeOnSelect : 'boolean',\n container : 'string',\n containerHidden : 'string',\n disable : 'array',\n firstDay : 'number',\n format : 'string',\n formatSubmit : 'string',\n hiddenName : 'boolean',\n hiddenPrefix : 'string',\n hiddenSuffix : 'string',\n klass : 'object',\n labelMonthNext : 'string',\n labelMonthPrev : 'string',\n labelMonthSelect : 'string',\n labelYearSelect : 'string',\n max : 'boolean || date',\n min : 'boolean || date',\n monthsFull : 'array',\n monthsShort : 'array',\n ok : 'string',\n onClose : 'function',\n onOpen : 'function',\n onRender : 'function',\n onSet : 'function',\n onStart : 'function',\n onStop : 'function',\n selectMonths : 'boolean',\n selectYears : 'boolean || number',\n today : 'string',\n weekdaysFull : 'array',\n weekdaysShort : 'array'\n }\n\n class PickDate {\n constructor(element, config) {\n this._config = this._getConfig(config)\n this._element = element\n }\n\n display(datepickerApi, datepickerRoot, datepickerValue) {\n $('.picker-date-display', datepickerRoot).remove()\n\n $('.picker-wrap', datepickerRoot).prepend(`