{ "version": 3, "sources": ["../../../node_modules/jquery-ujs/src/rails.js", "../../../node_modules/sticky-kit/dist/sticky-kit.js", "../../../node_modules/js-cookie/src/js.cookie.js", "../../../node_modules/waypoints/lib/jquery.waypoints.js", "../../../node_modules/bootstrap/js/modal.js", "../../javascript/extensions/array-join-sentence.js", "../../javascript/extensions/index.js", "../../javascript/models/accordion.js", "../../javascript/models/algolia-source.js", "../../javascript/models/beer-autocomplete-suggestion.js", "../../javascript/models/beer-metadata.js", "../../javascript/models/browser.js", "../../javascript/models/menu-sections.js", "../../javascript/models/servings.js", "../../javascript/models/script-inserter.js", "../../javascript/models/stripe-loader.js", "../../javascript/models/tv-menu-loader.js", "../../javascript/models/index.js", "../../javascript/shared/checklists.js", "../../javascript/shared/dom.js", "../../javascript/shared/input-focuser.js", "../../javascript/shared/messages.js", "../../javascript/shared/modals.js", "../../javascript/shared/on-premise-tracker.js", "../../javascript/shared/shared.js", "../../javascript/shared/index.js", "../../javascript/application-shared.js"], "sourcesContent": ["(function($, undefined) {\n\n/**\n * Unobtrusive scripting adapter for jQuery\n * https://github.com/rails/jquery-ujs\n *\n * Requires jQuery 1.8.0 or later.\n *\n * Released under the MIT license\n *\n */\n\n // Cut down on the number of issues from people inadvertently including jquery_ujs twice\n // by detecting and raising an error when it happens.\n 'use strict';\n\n if ( $.rails !== undefined ) {\n $.error('jquery-ujs has already been loaded!');\n }\n\n // Shorthand to make it a little easier to call public rails functions from within rails.js\n var rails;\n var $document = $(document);\n\n $.rails = rails = {\n // Link elements bound by jquery-ujs\n linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]',\n\n // Button elements bound by jquery-ujs\n buttonClickSelector: 'button[data-remote]:not([form]):not(form button), button[data-confirm]:not([form]):not(form button)',\n\n // Select elements bound by jquery-ujs\n inputChangeSelector: 'select[data-remote], input[data-remote], textarea[data-remote]',\n\n // Form elements bound by jquery-ujs\n formSubmitSelector: 'form',\n\n // Form input elements bound by jquery-ujs\n formInputClickSelector: 'form input[type=submit], form input[type=image], form button[type=submit], form button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])',\n\n // Form input elements disabled during form submission\n disableSelector: 'input[data-disable-with]:enabled, button[data-disable-with]:enabled, textarea[data-disable-with]:enabled, input[data-disable]:enabled, button[data-disable]:enabled, textarea[data-disable]:enabled',\n\n // Form input elements re-enabled after form submission\n enableSelector: 'input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled, input[data-disable]:disabled, button[data-disable]:disabled, textarea[data-disable]:disabled',\n\n // Form required input elements\n requiredInputSelector: 'input[name][required]:not([disabled]), textarea[name][required]:not([disabled])',\n\n // Form file input elements\n fileInputSelector: 'input[name][type=file]:not([disabled])',\n\n // Link onClick disable selector with possible reenable after remote submission\n linkDisableSelector: 'a[data-disable-with], a[data-disable]',\n\n // Button onClick disable selector with possible reenable after remote submission\n buttonDisableSelector: 'button[data-remote][data-disable-with], button[data-remote][data-disable]',\n\n // Up-to-date Cross-Site Request Forgery token\n csrfToken: function() {\n return $('meta[name=csrf-token]').attr('content');\n },\n\n // URL param that must contain the CSRF token\n csrfParam: function() {\n return $('meta[name=csrf-param]').attr('content');\n },\n\n // Make sure that every Ajax request sends the CSRF token\n CSRFProtection: function(xhr) {\n var token = rails.csrfToken();\n if (token) xhr.setRequestHeader('X-CSRF-Token', token);\n },\n\n // Make sure that all forms have actual up-to-date tokens (cached forms contain old ones)\n refreshCSRFTokens: function(){\n $('form input[name=\"' + rails.csrfParam() + '\"]').val(rails.csrfToken());\n },\n\n // Triggers an event on an element and returns false if the event result is false\n fire: function(obj, name, data) {\n var event = $.Event(name);\n obj.trigger(event, data);\n return event.result !== false;\n },\n\n // Default confirm dialog, may be overridden with custom confirm dialog in $.rails.confirm\n confirm: function(message) {\n return confirm(message);\n },\n\n // Default ajax function, may be overridden with custom function in $.rails.ajax\n ajax: function(options) {\n return $.ajax(options);\n },\n\n // Default way to get an element's href. May be overridden at $.rails.href.\n href: function(element) {\n return element[0].href;\n },\n\n // Checks \"data-remote\" if true to handle the request through a XHR request.\n isRemote: function(element) {\n return element.data('remote') !== undefined && element.data('remote') !== false;\n },\n\n // Submits \"remote\" forms and links with ajax\n handleRemote: function(element) {\n var method, url, data, withCredentials, dataType, options;\n\n if (rails.fire(element, 'ajax:before')) {\n withCredentials = element.data('with-credentials') || null;\n dataType = element.data('type') || ($.ajaxSettings && $.ajaxSettings.dataType);\n\n if (element.is('form')) {\n method = element.data('ujs:submit-button-formmethod') || element.attr('method');\n url = element.data('ujs:submit-button-formaction') || element.attr('action');\n data = $(element[0]).serializeArray();\n // memoized value from clicked submit button\n var button = element.data('ujs:submit-button');\n if (button) {\n data.push(button);\n element.data('ujs:submit-button', null);\n }\n element.data('ujs:submit-button-formmethod', null);\n element.data('ujs:submit-button-formaction', null);\n } else if (element.is(rails.inputChangeSelector)) {\n method = element.data('method');\n url = element.data('url');\n data = element.serialize();\n if (element.data('params')) data = data + '&' + element.data('params');\n } else if (element.is(rails.buttonClickSelector)) {\n method = element.data('method') || 'get';\n url = element.data('url');\n data = element.serialize();\n if (element.data('params')) data = data + '&' + element.data('params');\n } else {\n method = element.data('method');\n url = rails.href(element);\n data = element.data('params') || null;\n }\n\n options = {\n type: method || 'GET', data: data, dataType: dataType,\n // stopping the \"ajax:beforeSend\" event will cancel the ajax request\n beforeSend: function(xhr, settings) {\n if (settings.dataType === undefined) {\n xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script);\n }\n if (rails.fire(element, 'ajax:beforeSend', [xhr, settings])) {\n element.trigger('ajax:send', xhr);\n } else {\n return false;\n }\n },\n success: function(data, status, xhr) {\n element.trigger('ajax:success', [data, status, xhr]);\n },\n complete: function(xhr, status) {\n element.trigger('ajax:complete', [xhr, status]);\n },\n error: function(xhr, status, error) {\n element.trigger('ajax:error', [xhr, status, error]);\n },\n crossDomain: rails.isCrossDomain(url)\n };\n\n // There is no withCredentials for IE6-8 when\n // \"Enable native XMLHTTP support\" is disabled\n if (withCredentials) {\n options.xhrFields = {\n withCredentials: withCredentials\n };\n }\n\n // Only pass url to `ajax` options if not blank\n if (url) { options.url = url; }\n\n return rails.ajax(options);\n } else {\n return false;\n }\n },\n\n // Determines if the request is a cross domain request.\n isCrossDomain: function(url) {\n var originAnchor = document.createElement('a');\n originAnchor.href = location.href;\n var urlAnchor = document.createElement('a');\n\n try {\n urlAnchor.href = url;\n // This is a workaround to a IE bug.\n urlAnchor.href = urlAnchor.href;\n\n // If URL protocol is false or is a string containing a single colon\n // *and* host are false, assume it is not a cross-domain request\n // (should only be the case for IE7 and IE compatibility mode).\n // Otherwise, evaluate protocol and host of the URL against the origin\n // protocol and host.\n return !(((!urlAnchor.protocol || urlAnchor.protocol === ':') && !urlAnchor.host) ||\n (originAnchor.protocol + '//' + originAnchor.host ===\n urlAnchor.protocol + '//' + urlAnchor.host));\n } catch (e) {\n // If there is an error parsing the URL, assume it is crossDomain.\n return true;\n }\n },\n\n // Handles \"data-method\" on links such as:\n // Delete\n handleMethod: function(link) {\n var href = rails.href(link),\n method = link.data('method'),\n target = link.attr('target'),\n csrfToken = rails.csrfToken(),\n csrfParam = rails.csrfParam(),\n form = $('
'),\n metadataInput = '';\n\n if (csrfParam !== undefined && csrfToken !== undefined && !rails.isCrossDomain(href)) {\n metadataInput += '';\n }\n\n if (target) { form.attr('target', target); }\n\n form.hide().append(metadataInput).appendTo('body');\n form.submit();\n },\n\n // Helper function that returns form elements that match the specified CSS selector\n // If form is actually a \"form\" element this will return associated elements outside the from that have\n // the html form attribute set\n formElements: function(form, selector) {\n return form.is('form') ? $(form[0].elements).filter(selector) : form.find(selector);\n },\n\n /* Disables form elements:\n - Caches element value in 'ujs:enable-with' data store\n - Replaces element text with value of 'data-disable-with' attribute\n - Sets disabled property to true\n */\n disableFormElements: function(form) {\n rails.formElements(form, rails.disableSelector).each(function() {\n rails.disableFormElement($(this));\n });\n },\n\n disableFormElement: function(element) {\n var method, replacement;\n\n method = element.is('button') ? 'html' : 'val';\n replacement = element.data('disable-with');\n\n if (replacement !== undefined) {\n element.data('ujs:enable-with', element[method]());\n element[method](replacement);\n }\n\n element.prop('disabled', true);\n element.data('ujs:disabled', true);\n },\n\n /* Re-enables disabled form elements:\n - Replaces element text with cached value from 'ujs:enable-with' data store (created in `disableFormElements`)\n - Sets disabled property to false\n */\n enableFormElements: function(form) {\n rails.formElements(form, rails.enableSelector).each(function() {\n rails.enableFormElement($(this));\n });\n },\n\n enableFormElement: function(element) {\n var method = element.is('button') ? 'html' : 'val';\n if (element.data('ujs:enable-with') !== undefined) {\n element[method](element.data('ujs:enable-with'));\n element.removeData('ujs:enable-with'); // clean up cache\n }\n element.prop('disabled', false);\n element.removeData('ujs:disabled');\n },\n\n /* For 'data-confirm' attribute:\n - Fires `confirm` event\n - Shows the confirmation dialog\n - Fires the `confirm:complete` event\n\n Returns `true` if no function stops the chain and user chose yes; `false` otherwise.\n Attaching a handler to the element's `confirm` event that returns a `falsy` value cancels the confirmation dialog.\n Attaching a handler to the element's `confirm:complete` event that returns a `falsy` value makes this function\n return false. The `confirm:complete` event is fired whether or not the user answered true or false to the dialog.\n */\n allowAction: function(element) {\n var message = element.data('confirm'),\n answer = false, callback;\n if (!message) { return true; }\n\n if (rails.fire(element, 'confirm')) {\n try {\n answer = rails.confirm(message);\n } catch (e) {\n (console.error || console.log).call(console, e.stack || e);\n }\n callback = rails.fire(element, 'confirm:complete', [answer]);\n }\n return answer && callback;\n },\n\n // Helper function which checks for blank inputs in a form that match the specified CSS selector\n blankInputs: function(form, specifiedSelector, nonBlank) {\n var foundInputs = $(),\n input,\n valueToCheck,\n radiosForNameWithNoneSelected,\n radioName,\n selector = specifiedSelector || 'input,textarea',\n requiredInputs = form.find(selector),\n checkedRadioButtonNames = {};\n\n requiredInputs.each(function() {\n input = $(this);\n if (input.is('input[type=radio]')) {\n\n // Don't count unchecked required radio as blank if other radio with same name is checked,\n // regardless of whether same-name radio input has required attribute or not. The spec\n // states https://www.w3.org/TR/html5/forms.html#the-required-attribute\n radioName = input.attr('name');\n\n // Skip if we've already seen the radio with this name.\n if (!checkedRadioButtonNames[radioName]) {\n\n // If none checked\n if (form.find('input[type=radio]:checked[name=\"' + radioName + '\"]').length === 0) {\n radiosForNameWithNoneSelected = form.find(\n 'input[type=radio][name=\"' + radioName + '\"]');\n foundInputs = foundInputs.add(radiosForNameWithNoneSelected);\n }\n\n // We only need to check each name once.\n checkedRadioButtonNames[radioName] = radioName;\n }\n } else {\n valueToCheck = input.is('input[type=checkbox],input[type=radio]') ? input.is(':checked') : !!input.val();\n if (valueToCheck === nonBlank) {\n foundInputs = foundInputs.add(input);\n }\n }\n });\n return foundInputs.length ? foundInputs : false;\n },\n\n // Helper function which checks for non-blank inputs in a form that match the specified CSS selector\n nonBlankInputs: function(form, specifiedSelector) {\n return rails.blankInputs(form, specifiedSelector, true); // true specifies nonBlank\n },\n\n // Helper function, needed to provide consistent behavior in IE\n stopEverything: function(e) {\n $(e.target).trigger('ujs:everythingStopped');\n e.stopImmediatePropagation();\n return false;\n },\n\n // Replace element's html with the 'data-disable-with' after storing original html\n // and prevent clicking on it\n disableElement: function(element) {\n var replacement = element.data('disable-with');\n\n if (replacement !== undefined) {\n element.data('ujs:enable-with', element.html()); // store enabled state\n element.html(replacement);\n }\n\n element.bind('click.railsDisable', function(e) { // prevent further clicking\n return rails.stopEverything(e);\n });\n element.data('ujs:disabled', true);\n },\n\n // Restore element to its original state which was disabled by 'disableElement' above\n enableElement: function(element) {\n if (element.data('ujs:enable-with') !== undefined) {\n element.html(element.data('ujs:enable-with')); // set to old enabled state\n element.removeData('ujs:enable-with'); // clean up cache\n }\n element.unbind('click.railsDisable'); // enable element\n element.removeData('ujs:disabled');\n }\n };\n\n if (rails.fire($document, 'rails:attachBindings')) {\n\n $.ajaxPrefilter(function(options, originalOptions, xhr){ if ( !options.crossDomain ) { rails.CSRFProtection(xhr); }});\n\n // This event works the same as the load event, except that it fires every\n // time the page is loaded.\n //\n // See https://github.com/rails/jquery-ujs/issues/357\n // See https://developer.mozilla.org/en-US/docs/Using_Firefox_1.5_caching\n $(window).on('pageshow.rails', function () {\n $($.rails.enableSelector).each(function () {\n var element = $(this);\n\n if (element.data('ujs:disabled')) {\n $.rails.enableFormElement(element);\n }\n });\n\n $($.rails.linkDisableSelector).each(function () {\n var element = $(this);\n\n if (element.data('ujs:disabled')) {\n $.rails.enableElement(element);\n }\n });\n });\n\n $document.on('ajax:complete', rails.linkDisableSelector, function() {\n rails.enableElement($(this));\n });\n\n $document.on('ajax:complete', rails.buttonDisableSelector, function() {\n rails.enableFormElement($(this));\n });\n\n $document.on('click.rails', rails.linkClickSelector, function(e) {\n var link = $(this), method = link.data('method'), data = link.data('params'), metaClick = e.metaKey || e.ctrlKey;\n if (!rails.allowAction(link)) return rails.stopEverything(e);\n\n if (!metaClick && link.is(rails.linkDisableSelector)) rails.disableElement(link);\n\n if (rails.isRemote(link)) {\n if (metaClick && (!method || method === 'GET') && !data) { return true; }\n\n var handleRemote = rails.handleRemote(link);\n // Response from rails.handleRemote() will either be false or a deferred object promise.\n if (handleRemote === false) {\n rails.enableElement(link);\n } else {\n handleRemote.fail( function() { rails.enableElement(link); } );\n }\n return false;\n\n } else if (method) {\n rails.handleMethod(link);\n return false;\n }\n });\n\n $document.on('click.rails', rails.buttonClickSelector, function(e) {\n var button = $(this);\n\n if (!rails.allowAction(button) || !rails.isRemote(button)) return rails.stopEverything(e);\n\n if (button.is(rails.buttonDisableSelector)) rails.disableFormElement(button);\n\n var handleRemote = rails.handleRemote(button);\n // Response from rails.handleRemote() will either be false or a deferred object promise.\n if (handleRemote === false) {\n rails.enableFormElement(button);\n } else {\n handleRemote.fail( function() { rails.enableFormElement(button); } );\n }\n return false;\n });\n\n $document.on('change.rails', rails.inputChangeSelector, function(e) {\n var link = $(this);\n if (!rails.allowAction(link) || !rails.isRemote(link)) return rails.stopEverything(e);\n\n rails.handleRemote(link);\n return false;\n });\n\n $document.on('submit.rails', rails.formSubmitSelector, function(e) {\n var form = $(this),\n remote = rails.isRemote(form),\n blankRequiredInputs,\n nonBlankFileInputs;\n\n if (!rails.allowAction(form)) return rails.stopEverything(e);\n\n // Skip other logic when required values are missing or file upload is present\n if (form.attr('novalidate') === undefined) {\n if (form.data('ujs:formnovalidate-button') === undefined) {\n blankRequiredInputs = rails.blankInputs(form, rails.requiredInputSelector, false);\n if (blankRequiredInputs && rails.fire(form, 'ajax:aborted:required', [blankRequiredInputs])) {\n return rails.stopEverything(e);\n }\n } else {\n // Clear the formnovalidate in case the next button click is not on a formnovalidate button\n // Not strictly necessary to do here, since it is also reset on each button click, but just to be certain\n form.data('ujs:formnovalidate-button', undefined);\n }\n }\n\n if (remote) {\n nonBlankFileInputs = rails.nonBlankInputs(form, rails.fileInputSelector);\n if (nonBlankFileInputs) {\n // Slight timeout so that the submit button gets properly serialized\n // (make it easy for event handler to serialize form without disabled values)\n setTimeout(function(){ rails.disableFormElements(form); }, 13);\n var aborted = rails.fire(form, 'ajax:aborted:file', [nonBlankFileInputs]);\n\n // Re-enable form elements if event bindings return false (canceling normal form submission)\n if (!aborted) { setTimeout(function(){ rails.enableFormElements(form); }, 13); }\n\n return aborted;\n }\n\n rails.handleRemote(form);\n return false;\n\n } else {\n // Slight timeout so that the submit button gets properly serialized\n setTimeout(function(){ rails.disableFormElements(form); }, 13);\n }\n });\n\n $document.on('click.rails', rails.formInputClickSelector, function(event) {\n var button = $(this);\n\n if (!rails.allowAction(button)) return rails.stopEverything(event);\n\n // Register the pressed submit button\n var name = button.attr('name'),\n data = name ? {name:name, value:button.val()} : null;\n\n var form = button.closest('form');\n if (form.length === 0) {\n form = $('#' + button.attr('form'));\n }\n form.data('ujs:submit-button', data);\n\n // Save attributes from button\n form.data('ujs:formnovalidate-button', button.attr('formnovalidate'));\n form.data('ujs:submit-button-formaction', button.attr('formaction'));\n form.data('ujs:submit-button-formmethod', button.attr('formmethod'));\n });\n\n $document.on('ajax:send.rails', rails.formSubmitSelector, function(event) {\n if (this === event.target) rails.disableFormElements($(this));\n });\n\n $document.on('ajax:complete.rails', rails.formSubmitSelector, function(event) {\n if (this === event.target) rails.enableFormElements($(this));\n });\n\n $(function(){\n rails.refreshCSRFTokens();\n });\n }\n\n})( jQuery );\n", "// Generated by CoffeeScript 1.6.2\n/**\n@license Sticky-kit v1.1.3 | WTFPL | Leaf Corcoran 2015 | http://leafo.net\n*/\n\n\n(function() {\n var $, win;\n\n $ = this.jQuery || window.jQuery;\n\n win = $(window);\n\n $.fn.stick_in_parent = function(opts) {\n var doc, elm, enable_bottoming, inner_scrolling, manual_spacer, offset_top, outer_width, parent_selector, recalc_every, sticky_class, _fn, _i, _len;\n\n if (opts == null) {\n opts = {};\n }\n sticky_class = opts.sticky_class, inner_scrolling = opts.inner_scrolling, recalc_every = opts.recalc_every, parent_selector = opts.parent, offset_top = opts.offset_top, manual_spacer = opts.spacer, enable_bottoming = opts.bottoming;\n if (offset_top == null) {\n offset_top = 0;\n }\n if (parent_selector == null) {\n parent_selector = void 0;\n }\n if (inner_scrolling == null) {\n inner_scrolling = true;\n }\n if (sticky_class == null) {\n sticky_class = \"is_stuck\";\n }\n doc = $(document);\n if (enable_bottoming == null) {\n enable_bottoming = true;\n }\n outer_width = function(el) {\n var computed, w, _el;\n\n if (window.getComputedStyle) {\n _el = el[0];\n computed = window.getComputedStyle(el[0]);\n w = parseFloat(computed.getPropertyValue(\"width\")) + parseFloat(computed.getPropertyValue(\"margin-left\")) + parseFloat(computed.getPropertyValue(\"margin-right\"));\n if (computed.getPropertyValue(\"box-sizing\") !== \"border-box\") {\n w += parseFloat(computed.getPropertyValue(\"border-left-width\")) + parseFloat(computed.getPropertyValue(\"border-right-width\")) + parseFloat(computed.getPropertyValue(\"padding-left\")) + parseFloat(computed.getPropertyValue(\"padding-right\"));\n }\n return w;\n } else {\n return el.outerWidth(true);\n }\n };\n _fn = function(elm, padding_bottom, parent_top, parent_height, top, height, el_float, detached) {\n var bottomed, detach, fixed, last_pos, last_scroll_height, offset, parent, recalc, recalc_and_tick, recalc_counter, spacer, tick;\n\n if (elm.data(\"sticky_kit\")) {\n return;\n }\n elm.data(\"sticky_kit\", true);\n last_scroll_height = doc.height();\n parent = elm.parent();\n if (parent_selector != null) {\n parent = parent.closest(parent_selector);\n }\n if (!parent.length) {\n throw \"failed to find stick parent\";\n }\n fixed = false;\n bottomed = false;\n spacer = manual_spacer != null ? manual_spacer && elm.closest(manual_spacer) : $(\"\");\n if (spacer) {\n spacer.css('position', elm.css('position'));\n }\n recalc = function() {\n var border_top, padding_top, restore;\n\n if (detached) {\n return;\n }\n last_scroll_height = doc.height();\n border_top = parseInt(parent.css(\"border-top-width\"), 10);\n padding_top = parseInt(parent.css(\"padding-top\"), 10);\n padding_bottom = parseInt(parent.css(\"padding-bottom\"), 10);\n parent_top = parent.offset().top + border_top + padding_top;\n parent_height = parent.height();\n if (fixed) {\n fixed = false;\n bottomed = false;\n if (manual_spacer == null) {\n elm.insertAfter(spacer);\n spacer.detach();\n }\n elm.css({\n position: \"\",\n top: \"\",\n width: \"\",\n bottom: \"\"\n }).removeClass(sticky_class);\n restore = true;\n }\n top = elm.offset().top - (parseInt(elm.css(\"margin-top\"), 10) || 0) - offset_top;\n height = elm.outerHeight(true);\n el_float = elm.css(\"float\");\n if (spacer) {\n spacer.css({\n width: outer_width(elm),\n height: height,\n display: elm.css(\"display\"),\n \"vertical-align\": elm.css(\"vertical-align\"),\n \"float\": el_float\n });\n }\n if (restore) {\n return tick();\n }\n };\n recalc();\n if (height === parent_height) {\n return;\n }\n last_pos = void 0;\n offset = offset_top;\n recalc_counter = recalc_every;\n tick = function() {\n var css, delta, recalced, scroll, will_bottom, win_height;\n\n if (detached) {\n return;\n }\n recalced = false;\n if (recalc_counter != null) {\n recalc_counter -= 1;\n if (recalc_counter <= 0) {\n recalc_counter = recalc_every;\n recalc();\n recalced = true;\n }\n }\n if (!recalced && doc.height() !== last_scroll_height) {\n recalc();\n recalced = true;\n }\n scroll = win.scrollTop();\n if (last_pos != null) {\n delta = scroll - last_pos;\n }\n last_pos = scroll;\n if (fixed) {\n if (enable_bottoming) {\n will_bottom = scroll + height + offset > parent_height + parent_top;\n if (bottomed && !will_bottom) {\n bottomed = false;\n elm.css({\n position: \"fixed\",\n bottom: \"\",\n top: offset\n }).trigger(\"sticky_kit:unbottom\");\n }\n }\n if (scroll < top) {\n fixed = false;\n offset = offset_top;\n if (manual_spacer == null) {\n if (el_float === \"left\" || el_float === \"right\") {\n elm.insertAfter(spacer);\n }\n spacer.detach();\n }\n css = {\n position: \"\",\n width: \"\",\n top: \"\"\n };\n elm.css(css).removeClass(sticky_class).trigger(\"sticky_kit:unstick\");\n }\n if (inner_scrolling) {\n win_height = win.height();\n if (height + offset_top > win_height) {\n if (!bottomed) {\n offset -= delta;\n offset = Math.max(win_height - height, offset);\n offset = Math.min(offset_top, offset);\n if (fixed) {\n elm.css({\n top: offset + \"px\"\n });\n }\n }\n }\n }\n } else {\n if (scroll > top) {\n fixed = true;\n css = {\n position: \"fixed\",\n top: offset\n };\n css.width = elm.css(\"box-sizing\") === \"border-box\" ? elm.outerWidth() + \"px\" : elm.width() + \"px\";\n elm.css(css).addClass(sticky_class);\n if (manual_spacer == null) {\n elm.after(spacer);\n if (el_float === \"left\" || el_float === \"right\") {\n spacer.append(elm);\n }\n }\n elm.trigger(\"sticky_kit:stick\");\n }\n }\n if (fixed && enable_bottoming) {\n if (will_bottom == null) {\n will_bottom = scroll + height + offset > parent_height + parent_top;\n }\n if (!bottomed && will_bottom) {\n bottomed = true;\n if (parent.css(\"position\") === \"static\") {\n parent.css({\n position: \"relative\"\n });\n }\n return elm.css({\n position: \"absolute\",\n bottom: padding_bottom,\n top: \"auto\"\n }).trigger(\"sticky_kit:bottom\");\n }\n }\n };\n recalc_and_tick = function() {\n recalc();\n return tick();\n };\n detach = function() {\n detached = true;\n win.off(\"touchmove\", tick);\n win.off(\"scroll\", tick);\n win.off(\"resize\", recalc_and_tick);\n $(document.body).off(\"sticky_kit:recalc\", recalc_and_tick);\n elm.off(\"sticky_kit:detach\", detach);\n elm.removeData(\"sticky_kit\");\n elm.css({\n position: \"\",\n bottom: \"\",\n top: \"\",\n width: \"\"\n });\n parent.position(\"position\", \"\");\n if (fixed) {\n if (manual_spacer == null) {\n if (el_float === \"left\" || el_float === \"right\") {\n elm.insertAfter(spacer);\n }\n spacer.remove();\n }\n return elm.removeClass(sticky_class);\n }\n };\n win.on(\"touchmove\", tick);\n win.on(\"scroll\", tick);\n win.on(\"resize\", recalc_and_tick);\n $(document.body).on(\"sticky_kit:recalc\", recalc_and_tick);\n elm.on(\"sticky_kit:detach\", detach);\n return setTimeout(tick, 0);\n };\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n elm = this[_i];\n _fn($(elm));\n }\n return this;\n };\n\n}).call(this);\n", "/*!\n * JavaScript Cookie v2.2.0\n * https://github.com/js-cookie/js-cookie\n *\n * Copyright 2006, 2015 Klaus Hartl & Fagner Brack\n * Released under the MIT license\n */\n;(function (factory) {\n\tvar registeredInModuleLoader = false;\n\tif (typeof define === 'function' && define.amd) {\n\t\tdefine(factory);\n\t\tregisteredInModuleLoader = true;\n\t}\n\tif (typeof exports === 'object') {\n\t\tmodule.exports = factory();\n\t\tregisteredInModuleLoader = true;\n\t}\n\tif (!registeredInModuleLoader) {\n\t\tvar OldCookies = window.Cookies;\n\t\tvar api = window.Cookies = factory();\n\t\tapi.noConflict = function () {\n\t\t\twindow.Cookies = OldCookies;\n\t\t\treturn api;\n\t\t};\n\t}\n}(function () {\n\tfunction extend () {\n\t\tvar i = 0;\n\t\tvar result = {};\n\t\tfor (; i < arguments.length; i++) {\n\t\t\tvar attributes = arguments[ i ];\n\t\t\tfor (var key in attributes) {\n\t\t\t\tresult[key] = attributes[key];\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\tfunction init (converter) {\n\t\tfunction api (key, value, attributes) {\n\t\t\tvar result;\n\t\t\tif (typeof document === 'undefined') {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Write\n\n\t\t\tif (arguments.length > 1) {\n\t\t\t\tattributes = extend({\n\t\t\t\t\tpath: '/'\n\t\t\t\t}, api.defaults, attributes);\n\n\t\t\t\tif (typeof attributes.expires === 'number') {\n\t\t\t\t\tvar expires = new Date();\n\t\t\t\t\texpires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5);\n\t\t\t\t\tattributes.expires = expires;\n\t\t\t\t}\n\n\t\t\t\t// We're using \"expires\" because \"max-age\" is not supported by IE\n\t\t\t\tattributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';\n\n\t\t\t\ttry {\n\t\t\t\t\tresult = JSON.stringify(value);\n\t\t\t\t\tif (/^[\\{\\[]/.test(result)) {\n\t\t\t\t\t\tvalue = result;\n\t\t\t\t\t}\n\t\t\t\t} catch (e) {}\n\n\t\t\t\tif (!converter.write) {\n\t\t\t\t\tvalue = encodeURIComponent(String(value))\n\t\t\t\t\t\t.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);\n\t\t\t\t} else {\n\t\t\t\t\tvalue = converter.write(value, key);\n\t\t\t\t}\n\n\t\t\t\tkey = encodeURIComponent(String(key));\n\t\t\t\tkey = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);\n\t\t\t\tkey = key.replace(/[\\(\\)]/g, escape);\n\n\t\t\t\tvar stringifiedAttributes = '';\n\n\t\t\t\tfor (var attributeName in attributes) {\n\t\t\t\t\tif (!attributes[attributeName]) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tstringifiedAttributes += '; ' + attributeName;\n\t\t\t\t\tif (attributes[attributeName] === true) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tstringifiedAttributes += '=' + attributes[attributeName];\n\t\t\t\t}\n\t\t\t\treturn (document.cookie = key + '=' + value + stringifiedAttributes);\n\t\t\t}\n\n\t\t\t// Read\n\n\t\t\tif (!key) {\n\t\t\t\tresult = {};\n\t\t\t}\n\n\t\t\t// To prevent the for loop in the first place assign an empty array\n\t\t\t// in case there are no cookies at all. Also prevents odd result when\n\t\t\t// calling \"get()\"\n\t\t\tvar cookies = document.cookie ? document.cookie.split('; ') : [];\n\t\t\tvar rdecode = /(%[0-9A-Z]{2})+/g;\n\t\t\tvar i = 0;\n\n\t\t\tfor (; i < cookies.length; i++) {\n\t\t\t\tvar parts = cookies[i].split('=');\n\t\t\t\tvar cookie = parts.slice(1).join('=');\n\n\t\t\t\tif (!this.json && cookie.charAt(0) === '\"') {\n\t\t\t\t\tcookie = cookie.slice(1, -1);\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tvar name = parts[0].replace(rdecode, decodeURIComponent);\n\t\t\t\t\tcookie = converter.read ?\n\t\t\t\t\t\tconverter.read(cookie, name) : converter(cookie, name) ||\n\t\t\t\t\t\tcookie.replace(rdecode, decodeURIComponent);\n\n\t\t\t\t\tif (this.json) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tcookie = JSON.parse(cookie);\n\t\t\t\t\t\t} catch (e) {}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (key === name) {\n\t\t\t\t\t\tresult = cookie;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!key) {\n\t\t\t\t\t\tresult[name] = cookie;\n\t\t\t\t\t}\n\t\t\t\t} catch (e) {}\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}\n\n\t\tapi.set = api;\n\t\tapi.get = function (key) {\n\t\t\treturn api.call(api, key);\n\t\t};\n\t\tapi.getJSON = function () {\n\t\t\treturn api.apply({\n\t\t\t\tjson: true\n\t\t\t}, [].slice.call(arguments));\n\t\t};\n\t\tapi.defaults = {};\n\n\t\tapi.remove = function (key, attributes) {\n\t\t\tapi(key, '', extend(attributes, {\n\t\t\t\texpires: -1\n\t\t\t}));\n\t\t};\n\n\t\tapi.withConverter = init;\n\n\t\treturn api;\n\t}\n\n\treturn init(function () {});\n}));\n", "/*!\nWaypoints - 4.0.1\nCopyright \u00A9 2011-2016 Caleb Troughton\nLicensed under the MIT license.\nhttps://github.com/imakewebthings/waypoints/blob/master/licenses.txt\n*/\n(function() {\n 'use strict'\n\n var keyCounter = 0\n var allWaypoints = {}\n\n /* http://imakewebthings.com/waypoints/api/waypoint */\n function Waypoint(options) {\n if (!options) {\n throw new Error('No options passed to Waypoint constructor')\n }\n if (!options.element) {\n throw new Error('No element option passed to Waypoint constructor')\n }\n if (!options.handler) {\n throw new Error('No handler option passed to Waypoint constructor')\n }\n\n this.key = 'waypoint-' + keyCounter\n this.options = Waypoint.Adapter.extend({}, Waypoint.defaults, options)\n this.element = this.options.element\n this.adapter = new Waypoint.Adapter(this.element)\n this.callback = options.handler\n this.axis = this.options.horizontal ? 'horizontal' : 'vertical'\n this.enabled = this.options.enabled\n this.triggerPoint = null\n this.group = Waypoint.Group.findOrCreate({\n name: this.options.group,\n axis: this.axis\n })\n this.context = Waypoint.Context.findOrCreateByElement(this.options.context)\n\n if (Waypoint.offsetAliases[this.options.offset]) {\n this.options.offset = Waypoint.offsetAliases[this.options.offset]\n }\n this.group.add(this)\n this.context.add(this)\n allWaypoints[this.key] = this\n keyCounter += 1\n }\n\n /* Private */\n Waypoint.prototype.queueTrigger = function(direction) {\n this.group.queueTrigger(this, direction)\n }\n\n /* Private */\n Waypoint.prototype.trigger = function(args) {\n if (!this.enabled) {\n return\n }\n if (this.callback) {\n this.callback.apply(this, args)\n }\n }\n\n /* Public */\n /* http://imakewebthings.com/waypoints/api/destroy */\n Waypoint.prototype.destroy = function() {\n this.context.remove(this)\n this.group.remove(this)\n delete allWaypoints[this.key]\n }\n\n /* Public */\n /* http://imakewebthings.com/waypoints/api/disable */\n Waypoint.prototype.disable = function() {\n this.enabled = false\n return this\n }\n\n /* Public */\n /* http://imakewebthings.com/waypoints/api/enable */\n Waypoint.prototype.enable = function() {\n this.context.refresh()\n this.enabled = true\n return this\n }\n\n /* Public */\n /* http://imakewebthings.com/waypoints/api/next */\n Waypoint.prototype.next = function() {\n return this.group.next(this)\n }\n\n /* Public */\n /* http://imakewebthings.com/waypoints/api/previous */\n Waypoint.prototype.previous = function() {\n return this.group.previous(this)\n }\n\n /* Private */\n Waypoint.invokeAll = function(method) {\n var allWaypointsArray = []\n for (var waypointKey in allWaypoints) {\n allWaypointsArray.push(allWaypoints[waypointKey])\n }\n for (var i = 0, end = allWaypointsArray.length; i < end; i++) {\n allWaypointsArray[i][method]()\n }\n }\n\n /* Public */\n /* http://imakewebthings.com/waypoints/api/destroy-all */\n Waypoint.destroyAll = function() {\n Waypoint.invokeAll('destroy')\n }\n\n /* Public */\n /* http://imakewebthings.com/waypoints/api/disable-all */\n Waypoint.disableAll = function() {\n Waypoint.invokeAll('disable')\n }\n\n /* Public */\n /* http://imakewebthings.com/waypoints/api/enable-all */\n Waypoint.enableAll = function() {\n Waypoint.Context.refreshAll()\n for (var waypointKey in allWaypoints) {\n allWaypoints[waypointKey].enabled = true\n }\n return this\n }\n\n /* Public */\n /* http://imakewebthings.com/waypoints/api/refresh-all */\n Waypoint.refreshAll = function() {\n Waypoint.Context.refreshAll()\n }\n\n /* Public */\n /* http://imakewebthings.com/waypoints/api/viewport-height */\n Waypoint.viewportHeight = function() {\n return window.innerHeight || document.documentElement.clientHeight\n }\n\n /* Public */\n /* http://imakewebthings.com/waypoints/api/viewport-width */\n Waypoint.viewportWidth = function() {\n return document.documentElement.clientWidth\n }\n\n Waypoint.adapters = []\n\n Waypoint.defaults = {\n context: window,\n continuous: true,\n enabled: true,\n group: 'default',\n horizontal: false,\n offset: 0\n }\n\n Waypoint.offsetAliases = {\n 'bottom-in-view': function() {\n return this.context.innerHeight() - this.adapter.outerHeight()\n },\n 'right-in-view': function() {\n return this.context.innerWidth() - this.adapter.outerWidth()\n }\n }\n\n window.Waypoint = Waypoint\n}())\n;(function() {\n 'use strict'\n\n function requestAnimationFrameShim(callback) {\n window.setTimeout(callback, 1000 / 60)\n }\n\n var keyCounter = 0\n var contexts = {}\n var Waypoint = window.Waypoint\n var oldWindowLoad = window.onload\n\n /* http://imakewebthings.com/waypoints/api/context */\n function Context(element) {\n this.element = element\n this.Adapter = Waypoint.Adapter\n this.adapter = new this.Adapter(element)\n this.key = 'waypoint-context-' + keyCounter\n this.didScroll = false\n this.didResize = false\n this.oldScroll = {\n x: this.adapter.scrollLeft(),\n y: this.adapter.scrollTop()\n }\n this.waypoints = {\n vertical: {},\n horizontal: {}\n }\n\n element.waypointContextKey = this.key\n contexts[element.waypointContextKey] = this\n keyCounter += 1\n if (!Waypoint.windowContext) {\n Waypoint.windowContext = true\n Waypoint.windowContext = new Context(window)\n }\n\n this.createThrottledScrollHandler()\n this.createThrottledResizeHandler()\n }\n\n /* Private */\n Context.prototype.add = function(waypoint) {\n var axis = waypoint.options.horizontal ? 'horizontal' : 'vertical'\n this.waypoints[axis][waypoint.key] = waypoint\n this.refresh()\n }\n\n /* Private */\n Context.prototype.checkEmpty = function() {\n var horizontalEmpty = this.Adapter.isEmptyObject(this.waypoints.horizontal)\n var verticalEmpty = this.Adapter.isEmptyObject(this.waypoints.vertical)\n var isWindow = this.element == this.element.window\n if (horizontalEmpty && verticalEmpty && !isWindow) {\n this.adapter.off('.waypoints')\n delete contexts[this.key]\n }\n }\n\n /* Private */\n Context.prototype.createThrottledResizeHandler = function() {\n var self = this\n\n function resizeHandler() {\n self.handleResize()\n self.didResize = false\n }\n\n this.adapter.on('resize.waypoints', function() {\n if (!self.didResize) {\n self.didResize = true\n Waypoint.requestAnimationFrame(resizeHandler)\n }\n })\n }\n\n /* Private */\n Context.prototype.createThrottledScrollHandler = function() {\n var self = this\n function scrollHandler() {\n self.handleScroll()\n self.didScroll = false\n }\n\n this.adapter.on('scroll.waypoints', function() {\n if (!self.didScroll || Waypoint.isTouch) {\n self.didScroll = true\n Waypoint.requestAnimationFrame(scrollHandler)\n }\n })\n }\n\n /* Private */\n Context.prototype.handleResize = function() {\n Waypoint.Context.refreshAll()\n }\n\n /* Private */\n Context.prototype.handleScroll = function() {\n var triggeredGroups = {}\n var axes = {\n horizontal: {\n newScroll: this.adapter.scrollLeft(),\n oldScroll: this.oldScroll.x,\n forward: 'right',\n backward: 'left'\n },\n vertical: {\n newScroll: this.adapter.scrollTop(),\n oldScroll: this.oldScroll.y,\n forward: 'down',\n backward: 'up'\n }\n }\n\n for (var axisKey in axes) {\n var axis = axes[axisKey]\n var isForward = axis.newScroll > axis.oldScroll\n var direction = isForward ? axis.forward : axis.backward\n\n for (var waypointKey in this.waypoints[axisKey]) {\n var waypoint = this.waypoints[axisKey][waypointKey]\n if (waypoint.triggerPoint === null) {\n continue\n }\n var wasBeforeTriggerPoint = axis.oldScroll < waypoint.triggerPoint\n var nowAfterTriggerPoint = axis.newScroll >= waypoint.triggerPoint\n var crossedForward = wasBeforeTriggerPoint && nowAfterTriggerPoint\n var crossedBackward = !wasBeforeTriggerPoint && !nowAfterTriggerPoint\n if (crossedForward || crossedBackward) {\n waypoint.queueTrigger(direction)\n triggeredGroups[waypoint.group.id] = waypoint.group\n }\n }\n }\n\n for (var groupKey in triggeredGroups) {\n triggeredGroups[groupKey].flushTriggers()\n }\n\n this.oldScroll = {\n x: axes.horizontal.newScroll,\n y: axes.vertical.newScroll\n }\n }\n\n /* Private */\n Context.prototype.innerHeight = function() {\n /*eslint-disable eqeqeq */\n if (this.element == this.element.window) {\n return Waypoint.viewportHeight()\n }\n /*eslint-enable eqeqeq */\n return this.adapter.innerHeight()\n }\n\n /* Private */\n Context.prototype.remove = function(waypoint) {\n delete this.waypoints[waypoint.axis][waypoint.key]\n this.checkEmpty()\n }\n\n /* Private */\n Context.prototype.innerWidth = function() {\n /*eslint-disable eqeqeq */\n if (this.element == this.element.window) {\n return Waypoint.viewportWidth()\n }\n /*eslint-enable eqeqeq */\n return this.adapter.innerWidth()\n }\n\n /* Public */\n /* http://imakewebthings.com/waypoints/api/context-destroy */\n Context.prototype.destroy = function() {\n var allWaypoints = []\n for (var axis in this.waypoints) {\n for (var waypointKey in this.waypoints[axis]) {\n allWaypoints.push(this.waypoints[axis][waypointKey])\n }\n }\n for (var i = 0, end = allWaypoints.length; i < end; i++) {\n allWaypoints[i].destroy()\n }\n }\n\n /* Public */\n /* http://imakewebthings.com/waypoints/api/context-refresh */\n Context.prototype.refresh = function() {\n /*eslint-disable eqeqeq */\n var isWindow = this.element == this.element.window\n /*eslint-enable eqeqeq */\n var contextOffset = isWindow ? undefined : this.adapter.offset()\n var triggeredGroups = {}\n var axes\n\n this.handleScroll()\n axes = {\n horizontal: {\n contextOffset: isWindow ? 0 : contextOffset.left,\n contextScroll: isWindow ? 0 : this.oldScroll.x,\n contextDimension: this.innerWidth(),\n oldScroll: this.oldScroll.x,\n forward: 'right',\n backward: 'left',\n offsetProp: 'left'\n },\n vertical: {\n contextOffset: isWindow ? 0 : contextOffset.top,\n contextScroll: isWindow ? 0 : this.oldScroll.y,\n contextDimension: this.innerHeight(),\n oldScroll: this.oldScroll.y,\n forward: 'down',\n backward: 'up',\n offsetProp: 'top'\n }\n }\n\n for (var axisKey in axes) {\n var axis = axes[axisKey]\n for (var waypointKey in this.waypoints[axisKey]) {\n var waypoint = this.waypoints[axisKey][waypointKey]\n var adjustment = waypoint.options.offset\n var oldTriggerPoint = waypoint.triggerPoint\n var elementOffset = 0\n var freshWaypoint = oldTriggerPoint == null\n var contextModifier, wasBeforeScroll, nowAfterScroll\n var triggeredBackward, triggeredForward\n\n if (waypoint.element !== waypoint.element.window) {\n elementOffset = waypoint.adapter.offset()[axis.offsetProp]\n }\n\n if (typeof adjustment === 'function') {\n adjustment = adjustment.apply(waypoint)\n }\n else if (typeof adjustment === 'string') {\n adjustment = parseFloat(adjustment)\n if (waypoint.options.offset.indexOf('%') > - 1) {\n adjustment = Math.ceil(axis.contextDimension * adjustment / 100)\n }\n }\n\n contextModifier = axis.contextScroll - axis.contextOffset\n waypoint.triggerPoint = Math.floor(elementOffset + contextModifier - adjustment)\n wasBeforeScroll = oldTriggerPoint < axis.oldScroll\n nowAfterScroll = waypoint.triggerPoint >= axis.oldScroll\n triggeredBackward = wasBeforeScroll && nowAfterScroll\n triggeredForward = !wasBeforeScroll && !nowAfterScroll\n\n if (!freshWaypoint && triggeredBackward) {\n waypoint.queueTrigger(axis.backward)\n triggeredGroups[waypoint.group.id] = waypoint.group\n }\n else if (!freshWaypoint && triggeredForward) {\n waypoint.queueTrigger(axis.forward)\n triggeredGroups[waypoint.group.id] = waypoint.group\n }\n else if (freshWaypoint && axis.oldScroll >= waypoint.triggerPoint) {\n waypoint.queueTrigger(axis.forward)\n triggeredGroups[waypoint.group.id] = waypoint.group\n }\n }\n }\n\n Waypoint.requestAnimationFrame(function() {\n for (var groupKey in triggeredGroups) {\n triggeredGroups[groupKey].flushTriggers()\n }\n })\n\n return this\n }\n\n /* Private */\n Context.findOrCreateByElement = function(element) {\n return Context.findByElement(element) || new Context(element)\n }\n\n /* Private */\n Context.refreshAll = function() {\n for (var contextId in contexts) {\n contexts[contextId].refresh()\n }\n }\n\n /* Public */\n /* http://imakewebthings.com/waypoints/api/context-find-by-element */\n Context.findByElement = function(element) {\n return contexts[element.waypointContextKey]\n }\n\n window.onload = function() {\n if (oldWindowLoad) {\n oldWindowLoad()\n }\n Context.refreshAll()\n }\n\n\n Waypoint.requestAnimationFrame = function(callback) {\n var requestFn = window.requestAnimationFrame ||\n window.mozRequestAnimationFrame ||\n window.webkitRequestAnimationFrame ||\n requestAnimationFrameShim\n requestFn.call(window, callback)\n }\n Waypoint.Context = Context\n}())\n;(function() {\n 'use strict'\n\n function byTriggerPoint(a, b) {\n return a.triggerPoint - b.triggerPoint\n }\n\n function byReverseTriggerPoint(a, b) {\n return b.triggerPoint - a.triggerPoint\n }\n\n var groups = {\n vertical: {},\n horizontal: {}\n }\n var Waypoint = window.Waypoint\n\n /* http://imakewebthings.com/waypoints/api/group */\n function Group(options) {\n this.name = options.name\n this.axis = options.axis\n this.id = this.name + '-' + this.axis\n this.waypoints = []\n this.clearTriggerQueues()\n groups[this.axis][this.name] = this\n }\n\n /* Private */\n Group.prototype.add = function(waypoint) {\n this.waypoints.push(waypoint)\n }\n\n /* Private */\n Group.prototype.clearTriggerQueues = function() {\n this.triggerQueues = {\n up: [],\n down: [],\n left: [],\n right: []\n }\n }\n\n /* Private */\n Group.prototype.flushTriggers = function() {\n for (var direction in this.triggerQueues) {\n var waypoints = this.triggerQueues[direction]\n var reverse = direction === 'up' || direction === 'left'\n waypoints.sort(reverse ? byReverseTriggerPoint : byTriggerPoint)\n for (var i = 0, end = waypoints.length; i < end; i += 1) {\n var waypoint = waypoints[i]\n if (waypoint.options.continuous || i === waypoints.length - 1) {\n waypoint.trigger([direction])\n }\n }\n }\n this.clearTriggerQueues()\n }\n\n /* Private */\n Group.prototype.next = function(waypoint) {\n this.waypoints.sort(byTriggerPoint)\n var index = Waypoint.Adapter.inArray(waypoint, this.waypoints)\n var isLast = index === this.waypoints.length - 1\n return isLast ? null : this.waypoints[index + 1]\n }\n\n /* Private */\n Group.prototype.previous = function(waypoint) {\n this.waypoints.sort(byTriggerPoint)\n var index = Waypoint.Adapter.inArray(waypoint, this.waypoints)\n return index ? this.waypoints[index - 1] : null\n }\n\n /* Private */\n Group.prototype.queueTrigger = function(waypoint, direction) {\n this.triggerQueues[direction].push(waypoint)\n }\n\n /* Private */\n Group.prototype.remove = function(waypoint) {\n var index = Waypoint.Adapter.inArray(waypoint, this.waypoints)\n if (index > -1) {\n this.waypoints.splice(index, 1)\n }\n }\n\n /* Public */\n /* http://imakewebthings.com/waypoints/api/first */\n Group.prototype.first = function() {\n return this.waypoints[0]\n }\n\n /* Public */\n /* http://imakewebthings.com/waypoints/api/last */\n Group.prototype.last = function() {\n return this.waypoints[this.waypoints.length - 1]\n }\n\n /* Private */\n Group.findOrCreate = function(options) {\n return groups[options.axis][options.name] || new Group(options)\n }\n\n Waypoint.Group = Group\n}())\n;(function() {\n 'use strict'\n\n var $ = window.jQuery\n var Waypoint = window.Waypoint\n\n function JQueryAdapter(element) {\n this.$element = $(element)\n }\n\n $.each([\n 'innerHeight',\n 'innerWidth',\n 'off',\n 'offset',\n 'on',\n 'outerHeight',\n 'outerWidth',\n 'scrollLeft',\n 'scrollTop'\n ], function(i, method) {\n JQueryAdapter.prototype[method] = function() {\n var args = Array.prototype.slice.call(arguments)\n return this.$element[method].apply(this.$element, args)\n }\n })\n\n $.each([\n 'extend',\n 'inArray',\n 'isEmptyObject'\n ], function(i, method) {\n JQueryAdapter[method] = $[method]\n })\n\n Waypoint.adapters.push({\n name: 'jquery',\n Adapter: JQueryAdapter\n })\n Waypoint.Adapter = JQueryAdapter\n}())\n;(function() {\n 'use strict'\n\n var Waypoint = window.Waypoint\n\n function createExtension(framework) {\n return function() {\n var waypoints = []\n var overrides = arguments[0]\n\n if (framework.isFunction(arguments[0])) {\n overrides = framework.extend({}, arguments[1])\n overrides.handler = arguments[0]\n }\n\n this.each(function() {\n var options = framework.extend({}, overrides, {\n element: this\n })\n if (typeof options.context === 'string') {\n options.context = framework(this).closest(options.context)[0]\n }\n waypoints.push(new Waypoint(options))\n })\n\n return waypoints\n }\n }\n\n if (window.jQuery) {\n window.jQuery.fn.waypoint = createExtension(window.jQuery)\n }\n if (window.Zepto) {\n window.Zepto.fn.waypoint = createExtension(window.Zepto)\n }\n}())\n;", "/* ========================================================================\n * Bootstrap: modal.js v3.4.1\n * https://getbootstrap.com/docs/3.4/javascript/#modals\n * ========================================================================\n * Copyright 2011-2019 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n\n+function ($) {\n 'use strict';\n\n // MODAL CLASS DEFINITION\n // ======================\n\n var Modal = function (element, options) {\n this.options = options\n this.$body = $(document.body)\n this.$element = $(element)\n this.$dialog = this.$element.find('.modal-dialog')\n this.$backdrop = null\n this.isShown = null\n this.originalBodyPad = null\n this.scrollbarWidth = 0\n this.ignoreBackdropClick = false\n this.fixedContent = '.navbar-fixed-top, .navbar-fixed-bottom'\n\n if (this.options.remote) {\n this.$element\n .find('.modal-content')\n .load(this.options.remote, $.proxy(function () {\n this.$element.trigger('loaded.bs.modal')\n }, this))\n }\n }\n\n Modal.VERSION = '3.4.1'\n\n Modal.TRANSITION_DURATION = 300\n Modal.BACKDROP_TRANSITION_DURATION = 150\n\n Modal.DEFAULTS = {\n backdrop: true,\n keyboard: true,\n show: true\n }\n\n Modal.prototype.toggle = function (_relatedTarget) {\n return this.isShown ? this.hide() : this.show(_relatedTarget)\n }\n\n Modal.prototype.show = function (_relatedTarget) {\n var that = this\n var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })\n\n this.$element.trigger(e)\n\n if (this.isShown || e.isDefaultPrevented()) return\n\n this.isShown = true\n\n this.checkScrollbar()\n this.setScrollbar()\n this.$body.addClass('modal-open')\n\n this.escape()\n this.resize()\n\n this.$element.on('click.dismiss.bs.modal', '[data-dismiss=\"modal\"]', $.proxy(this.hide, this))\n\n this.$dialog.on('mousedown.dismiss.bs.modal', function () {\n that.$element.one('mouseup.dismiss.bs.modal', function (e) {\n if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true\n })\n })\n\n this.backdrop(function () {\n var transition = $.support.transition && that.$element.hasClass('fade')\n\n if (!that.$element.parent().length) {\n that.$element.appendTo(that.$body) // don't move modals dom position\n }\n\n that.$element\n .show()\n .scrollTop(0)\n\n that.adjustDialog()\n\n if (transition) {\n that.$element[0].offsetWidth // force reflow\n }\n\n that.$element.addClass('in')\n\n that.enforceFocus()\n\n var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })\n\n transition ?\n that.$dialog // wait for modal to slide in\n .one('bsTransitionEnd', function () {\n that.$element.trigger('focus').trigger(e)\n })\n .emulateTransitionEnd(Modal.TRANSITION_DURATION) :\n that.$element.trigger('focus').trigger(e)\n })\n }\n\n Modal.prototype.hide = function (e) {\n if (e) e.preventDefault()\n\n e = $.Event('hide.bs.modal')\n\n this.$element.trigger(e)\n\n if (!this.isShown || e.isDefaultPrevented()) return\n\n this.isShown = false\n\n this.escape()\n this.resize()\n\n $(document).off('focusin.bs.modal')\n\n this.$element\n .removeClass('in')\n .off('click.dismiss.bs.modal')\n .off('mouseup.dismiss.bs.modal')\n\n this.$dialog.off('mousedown.dismiss.bs.modal')\n\n $.support.transition && this.$element.hasClass('fade') ?\n this.$element\n .one('bsTransitionEnd', $.proxy(this.hideModal, this))\n .emulateTransitionEnd(Modal.TRANSITION_DURATION) :\n this.hideModal()\n }\n\n Modal.prototype.enforceFocus = function () {\n $(document)\n .off('focusin.bs.modal') // guard against infinite focus loop\n .on('focusin.bs.modal', $.proxy(function (e) {\n if (document !== e.target &&\n this.$element[0] !== e.target &&\n !this.$element.has(e.target).length) {\n this.$element.trigger('focus')\n }\n }, this))\n }\n\n Modal.prototype.escape = function () {\n if (this.isShown && this.options.keyboard) {\n this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) {\n e.which == 27 && this.hide()\n }, this))\n } else if (!this.isShown) {\n this.$element.off('keydown.dismiss.bs.modal')\n }\n }\n\n Modal.prototype.resize = function () {\n if (this.isShown) {\n $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this))\n } else {\n $(window).off('resize.bs.modal')\n }\n }\n\n Modal.prototype.hideModal = function () {\n var that = this\n this.$element.hide()\n this.backdrop(function () {\n that.$body.removeClass('modal-open')\n that.resetAdjustments()\n that.resetScrollbar()\n that.$element.trigger('hidden.bs.modal')\n })\n }\n\n Modal.prototype.removeBackdrop = function () {\n this.$backdrop && this.$backdrop.remove()\n this.$backdrop = null\n }\n\n Modal.prototype.backdrop = function (callback) {\n var that = this\n var animate = this.$element.hasClass('fade') ? 'fade' : ''\n\n if (this.isShown && this.options.backdrop) {\n var doAnimate = $.support.transition && animate\n\n this.$backdrop = $(document.createElement('div'))\n .addClass('modal-backdrop ' + animate)\n .appendTo(this.$body)\n\n this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {\n if (this.ignoreBackdropClick) {\n this.ignoreBackdropClick = false\n return\n }\n if (e.target !== e.currentTarget) return\n this.options.backdrop == 'static'\n ? this.$element[0].focus()\n : this.hide()\n }, this))\n\n if (doAnimate) this.$backdrop[0].offsetWidth // force reflow\n\n this.$backdrop.addClass('in')\n\n if (!callback) return\n\n doAnimate ?\n this.$backdrop\n .one('bsTransitionEnd', callback)\n .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :\n callback()\n\n } else if (!this.isShown && this.$backdrop) {\n this.$backdrop.removeClass('in')\n\n var callbackRemove = function () {\n that.removeBackdrop()\n callback && callback()\n }\n $.support.transition && this.$element.hasClass('fade') ?\n this.$backdrop\n .one('bsTransitionEnd', callbackRemove)\n .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :\n callbackRemove()\n\n } else if (callback) {\n callback()\n }\n }\n\n // these following methods are used to handle overflowing modals\n\n Modal.prototype.handleUpdate = function () {\n this.adjustDialog()\n }\n\n Modal.prototype.adjustDialog = function () {\n var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight\n\n this.$element.css({\n paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '',\n paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : ''\n })\n }\n\n Modal.prototype.resetAdjustments = function () {\n this.$element.css({\n paddingLeft: '',\n paddingRight: ''\n })\n }\n\n Modal.prototype.checkScrollbar = function () {\n var fullWindowWidth = window.innerWidth\n if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8\n var documentElementRect = document.documentElement.getBoundingClientRect()\n fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left)\n }\n this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth\n this.scrollbarWidth = this.measureScrollbar()\n }\n\n Modal.prototype.setScrollbar = function () {\n var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)\n this.originalBodyPad = document.body.style.paddingRight || ''\n var scrollbarWidth = this.scrollbarWidth\n if (this.bodyIsOverflowing) {\n this.$body.css('padding-right', bodyPad + scrollbarWidth)\n $(this.fixedContent).each(function (index, element) {\n var actualPadding = element.style.paddingRight\n var calculatedPadding = $(element).css('padding-right')\n $(element)\n .data('padding-right', actualPadding)\n .css('padding-right', parseFloat(calculatedPadding) + scrollbarWidth + 'px')\n })\n }\n }\n\n Modal.prototype.resetScrollbar = function () {\n this.$body.css('padding-right', this.originalBodyPad)\n $(this.fixedContent).each(function (index, element) {\n var padding = $(element).data('padding-right')\n $(element).removeData('padding-right')\n element.style.paddingRight = padding ? padding : ''\n })\n }\n\n Modal.prototype.measureScrollbar = function () { // thx walsh\n var scrollDiv = document.createElement('div')\n scrollDiv.className = 'modal-scrollbar-measure'\n this.$body.append(scrollDiv)\n var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth\n this.$body[0].removeChild(scrollDiv)\n return scrollbarWidth\n }\n\n\n // MODAL PLUGIN DEFINITION\n // =======================\n\n function Plugin(option, _relatedTarget) {\n return this.each(function () {\n var $this = $(this)\n var data = $this.data('bs.modal')\n var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)\n\n if (!data) $this.data('bs.modal', (data = new Modal(this, options)))\n if (typeof option == 'string') data[option](_relatedTarget)\n else if (options.show) data.show(_relatedTarget)\n })\n }\n\n var old = $.fn.modal\n\n $.fn.modal = Plugin\n $.fn.modal.Constructor = Modal\n\n\n // MODAL NO CONFLICT\n // =================\n\n $.fn.modal.noConflict = function () {\n $.fn.modal = old\n return this\n }\n\n\n // MODAL DATA-API\n // ==============\n\n $(document).on('click.bs.modal.data-api', '[data-toggle=\"modal\"]', function (e) {\n var $this = $(this)\n var href = $this.attr('href')\n var target = $this.attr('data-target') ||\n (href && href.replace(/.*(?=#[^\\s]+$)/, '')) // strip for ie7\n\n var $target = $(document).find(target)\n var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())\n\n if ($this.is('a')) e.preventDefault()\n\n $target.one('show.bs.modal', function (showEvent) {\n if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown\n $target.one('hidden.bs.modal', function () {\n $this.is(':visible') && $this.trigger('focus')\n })\n })\n Plugin.call($target, option, this)\n })\n\n}(jQuery);\n", "Object.defineProperty(Array.prototype, 'joinSentence', {\n enumerable: false,\n value: function(oxford_comma) {\n var lastWord = ''\n if (this.length > 1) {\n lastWord = ' and ' + this.pop()\n if (oxford_comma && this.length > 1) {\n lastWord = ',' + lastWord\n }\n }\n return this.join(', ') + lastWord\n }\n})\n", "require(\"../extensions/array-join-sentence\")\n", "class Accordion {\n static async import() {\n await import(\"../vendor/accordion-imports.js\")\n }\n}\n\nexport default Accordion\n", "class AlgoliaSource {\n static async importLibraries() {\n var algoliasearch = await import(\"algoliasearch\")\n var autocomplete = await import(\"../vendor/autocomplete.jquery.js\")\n\n return [algoliasearch.default, autocomplete.default]\n }\n\n constructor(algoliasearch, indexName, filters) {\n const client = algoliasearch(process.env.ALGOLIA_APPLICATION_ID,\n process.env.ALGOLIA_API_KEY_SEARCH)\n this.index = client.initIndex(`${indexName}_${process.env.SEARCH_ENV}`)\n this.source = $.fn.autocomplete.sources.hits(this.index, {\n hitsPerPage: 10,\n filters: filters,\n })\n }\n}\n\nexport default AlgoliaSource\n", "class BeerAutocompleteSuggestion {\n constructor(template) {\n this.template = template\n }\n\n build(hit) {\n const suggestion = this.template.cloneNode(true)\n suggestion.classList.remove(\"hidden\")\n\n if (hit.cssClass) {\n suggestion.classList.add(hit.cssClass)\n }\n\n suggestion.querySelector(\"[data-ref='name']\").textContent = hit.name\n\n const meta = new BeerMetadata(hit).toString()\n suggestion.querySelector(\"[data-ref='meta']\").textContent = meta\n\n return suggestion\n }\n}\n\nexport default BeerAutocompleteSuggestion\n", "class BeerMetadata {\n constructor(hit) {\n this.hit = hit\n }\n\n toString() {\n const abv = this.hit.abv ? `${this.hit.abv}%` : null\n const meta = [this.hit.style, abv, this.hit.brewery_location]\n return meta.filter(Boolean).join(\" \\u00B7 \")\n }\n}\n\nexport default BeerMetadata\n", "export default class Browser {\n static isIE() {\n return /MSIE \\d|Trident.*rv:/.test(navigator.userAgent)\n }\n}\n", "export default class MenuSections {\n static showNewSectionModal(productType) {\n $(\"#new-menu-section\").modal()\n $(\"#new-menu-section #menu_section_name\").focus()\n\n if (productType) {\n $(\"#menu_section_product_type\").val(productType)\n }\n }\n}\n", "export default class Servings {\n constructor(productType, isEdit) {\n this.productType = productType\n\n if (isEdit === true || isEdit === \"true\") {\n this.formSelector = `#product_type_${productType}.edit`\n } else {\n this.formSelector = `#product_type_${productType}`\n }\n }\n\n static showEditForm() {\n document.querySelector(\"#add-serving-form\").classList.add(\"hidden\")\n document.querySelector(\"#edit-serving-form\").classList.remove(\"hidden\")\n }\n\n static hideEditForm() {\n document.querySelector(\"#edit-serving-form\").classList.add(\"hidden\")\n document.querySelector(\"#add-serving-form\").classList.remove(\"hidden\")\n }\n\n static scrollToTopOfForm() {\n const mweb = document.body.classList.contains(\"mweb\")\n const offset = mweb ? 48 : 16\n\n $(\"html, body\").animate({\n scrollTop: $(\"#serving-forms\").offset().top - offset\n }, \"normal\");\n }\n\n static updateTapNumbers() {\n const sortables = document.querySelectorAll(\"[data-controller~='sortable']\")\n sortables.forEach(sortable => {\n const controller = Stimulus.application\n .getControllerForElementAndIdentifier(sortable, \"sortable\")\n controller.savePositions(true)\n })\n }\n\n populateBeer(id, name, style_id, abv) {\n const form = document.querySelector(this.formSelector)\n window.Stimulus.application\n .getControllerForElementAndIdentifier(form, \"beer-autocomplete\")\n .populate(id, name, style_id, abv)\n }\n\n focusInputAfterBeerName() {\n const inputs = document.querySelector(`${this.formSelector} form`).elements\n const containerInput = inputs[\"servings[0][serving_type]\"]\n\n setTimeout(() => {\n if (containerInput) {\n containerInput.focus()\n } else {\n inputs[\"serving_price\"].focus()\n }\n }, 100)\n }\n\n showMissingBeerError() {\n this.clearJavaScriptMessages()\n\n document.querySelector(`${this.formSelector} .missing-beer-error`)\n .classList.remove(\"hidden\")\n }\n\n showNewBeerConfirmation(message) {\n this.clearJavaScriptMessages()\n\n const element = document.querySelector(`${this.formSelector} .new-beer-confirmation`)\n element.innerText = message\n element.classList.remove(\"hidden\")\n }\n\n clearJavaScriptMessages() {\n document.querySelector(`${this.formSelector} .missing-beer-error`)\n .classList.add(\"hidden\")\n\n document.querySelector(`${this.formSelector} .new-beer-confirmation`)\n .classList.add(\"hidden\")\n }\n\n showTab() {\n window.location.hash = this.productType\n }\n}\n", "export default class ScriptInserter {\n static insert(id, src, callback) {\n const existingScript = document.getElementById(id)\n if (existingScript) {\n callback()\n } else {\n const script = document.createElement(\"script\")\n script.src = src\n script.id = id\n script.onload = callback\n\n document.body.appendChild(script)\n }\n }\n}\n", "export default class StripeLoader {\n load() {\n if (document.getElementById('card-element') == null) { return }\n\n var stripe = Stripe($('meta[name=\"stripe-key\"]').attr('content'));\n var elements = stripe.elements();\n\n window.card = elements.create('card', {\n 'style': {\n 'base': {\n 'fontFamily': '\\'Helvetica Neue\\', Roboto, Helvetica, Arial, sans-serif',\n 'fontSize': '14px',\n },\n 'invalid': {\n 'color': '#D32548',\n },\n }\n });\n window.card.mount('#card-element');\n\n window.card.addEventListener('change', function(event) {\n var displayError = document.getElementById('card-errors');\n if (event.error) {\n displayError.textContent = event.error.message;\n } else {\n displayError.textContent = '';\n }\n });\n\n function stripeTokenHandler(token, form) {\n var $form = $(form);\n $(\".stripe-card-token\").val(token.id);\n\n if (form == \".card-token-remote\") {\n window.has_token = true;\n $.rails.fire($form, \"submit\")\n } else {\n $form.get(0).submit();\n }\n }\n\n function createToken(form) {\n var $form = $(form);\n var $original_label = $form.find(\"button[type='submit']\").data('original-label');\n\n stripe.createToken(card).then(function(result) {\n if (result.error) {\n var errorElement = document.getElementById('card-errors');\n errorElement.textContent = result.error.message;\n\n $form.find(\"button[type='submit']\").text($original_label);\n $form.find(\"button[type='submit']\").prop('disabled', false);\n } else {\n stripeTokenHandler(result.token, form);\n }\n });\n };\n\n function stripePaymentMethodHandler(result) {\n var $form = $('.new-payment-method');\n var $disabled_label = $form.find(\"button[type='submit']\").data('disable-with');\n\n if (result.error) {\n // Show error in payment form\n var errorElement = document.getElementById('card-errors');\n errorElement.textContent = result.error.message;\n\n $form.find(\"button[type='submit']\").text($original_label);\n $form.find(\"button[type='submit']\").prop('disabled', false);\n } else {\n $(\".new-stripe-payment-method\").val(result.paymentMethod.id);\n window.has_payment_method = true;\n $.rails.fire($form, \"submit\")\n }\n }\n\n $(\"body\").on(\"submit\", \".card-token\", function(e) {\n var $form = $(this);\n var $disabled_label = $form.find(\"button[type='submit']\").data('disable-with');\n\n $form.find(\"button[type='submit']\").text($disabled_label);\n $form.find(\"button[type='submit']\").prop('disabled', true);\n\n e.preventDefault();\n createToken(\".card-token\");\n });\n\n window.has_token = false;\n $(\"body\").on(\"ajax:beforeSend\", \".card-token-remote\", function(event, xhr) {\n if (window.has_token == false) {\n xhr.abort();\n\n var $form = $('.card-token-remote');\n var $disabled_label = $form.find(\"button[type='submit']\").data('disable-with');\n\n $form.find(\"button[type='submit']\").text($disabled_label);\n $form.find(\"button[type='submit']\").prop('disabled', true);\n\n createToken(\".card-token-remote\");\n }\n });\n\n window.has_payment_method = false;\n $(\"body\").on(\"ajax:beforeSend\", \".new-payment-method\", function(event, xhr) {\n if (window.has_payment_method == false) {\n xhr.abort();\n\n var $form = $('.new-payment-method');\n var $disabled_label = $form.find(\"button[type='submit']\").data('disable-with');\n\n $form.find(\"button[type='submit']\").text($disabled_label);\n $form.find(\"button[type='submit']\").prop('disabled', true);\n\n stripe.createPaymentMethod({\n type: 'card',\n card: window.card,\n billing_details: {\n },\n }).then(stripePaymentMethodHandler);\n }\n });\n\n $('.payment-method-remote').on('click', '.use-new-card', function() {\n $(\".use-new-payment-method-val\").val(true);\n $('.payment-method-remote').addClass('new-payment-method');\n $('.cards-on-file').addClass(\"hidden\");\n $('.card-form').removeClass(\"hidden\");\n $('#card-element').focus();\n return false;\n });\n\n $('.payment-method-remote').on('click', '.use-cards-on-file', function() {\n $(\".use-new-payment-method-val\").val(false);\n $('.payment-method-remote').removeClass('new-payment-method');\n $('.card-form').addClass(\"hidden\");\n $('.cards-on-file').removeClass(\"hidden\");\n return false;\n });\n\n document.querySelectorAll(\".payment_method_type_radio\").forEach(radio => {\n radio.addEventListener('change', (e) => {\n if (e.target.value == \"1\") {\n // show credit card, hide ACH\n $(\".credit-card\").removeClass(\"hidden\");\n if ($(\".card-on-file\").length == 0) { $('.pro-sign-up').addClass(\"card-token\"); }\n $(\".ach-payment\").addClass(\"hidden\");\n } else {\n // show ACH, hide credit card\n $(\".ach-payment\").removeClass(\"hidden\");\n $(\".credit-card\").addClass(\"hidden\");\n $('.pro-sign-up').removeClass(\"card-token\");\n }\n })\n })\n\n }\n}\n", "export default class TvMenuLoader {\n constructor(refreshRate, nextUrl, specialRefreshRate) {\n this.nextUrl = nextUrl\n this.refreshRate = refreshRate\n this.specialRefreshRate = specialRefreshRate\n this.setupInterval()\n this.screens = {}\n this.setupClearScreenInterval()\n }\n\n clearScreens() {\n this.screens = {}\n window.location = this.nextUrl\n }\n\n setupInterval(onSpecial) {\n if (onSpecial && this.specialRefreshRate) {\n this.interval = setInterval(this.refresh.bind(this), this.specialRefreshRate)\n } else if (this.refreshRate) {\n this.interval = setInterval(this.refresh.bind(this), this.refreshRate)\n }\n }\n\n setupClearScreenInterval() {\n if (this.clearScreenInterval) {\n clearInterval(this.clearScreenInterval)\n }\n\n const threeHours = 3 * 60 * 60 * 1000\n this.clearScreenInterval = setInterval(this.clearScreens.bind(this), threeHours)\n }\n\n success(data, textStatus, jqXHR) {\n const onSpecial = jqXHR.getResponseHeader(\"on-special\") === \"true\"\n this.setupInterval(onSpecial)\n\n const nextUrl = jqXHR.getResponseHeader(\"menu-next-url\")\n this.screens[this.nextUrl] = {\n html: data,\n nextUrl: nextUrl,\n onSpecial: onSpecial\n }\n this.nextUrl = nextUrl\n\n $(\".tv-container\").html(data)\n $(\"#drift-widget-container\").css(\"display\", \"none\")\n }\n\n error(data, textStatus, jqXHR) {\n this.setupInterval()\n\n $.ajax({\n method: 'POST',\n url: '/api/internal/logs',\n data: {\n message: \"TV Menu Error: \" + data.statusText\n }\n })\n }\n\n refresh() {\n clearInterval(this.interval)\n\n const screen = this.screens[this.nextUrl]\n if (screen) {\n $(\".tv-container\").html(screen.html)\n this.setupInterval(screen.onSpecial)\n this.nextUrl = screen.nextUrl\n } else {\n $.ajax({\n url: this.nextUrl,\n dataType: \"html\",\n data: {\n html: true\n },\n success: this.success.bind(this),\n error: this.error.bind(this)\n })\n }\n }\n}\n", "import Accordion from \"./accordion\"\nimport AlgoliaSource from \"./algolia-source\"\nimport BeerAutocompleteSuggestion from \"./beer-autocomplete-suggestion\"\nimport BeerMetadata from \"./beer-metadata\"\nimport Browser from \"./browser\"\nimport Debouncer from \"./debouncer\"\nimport MenuSections from \"./menu-sections\"\nimport Servings from \"./servings\"\nimport ScriptInserter from \"./script-inserter\"\nimport StripeLoader from \"./stripe-loader\"\nimport TvMenuLoader from \"./tv-menu-loader\"\n\nwindow.Accordion = Accordion\nwindow.AlgoliaSource = AlgoliaSource\nwindow.BeerAutocompleteSuggestion = BeerAutocompleteSuggestion\nwindow.BeerMetadata = BeerMetadata\nwindow.Browser = Browser\nwindow.Debouncer = Debouncer\nwindow.MenuSections = MenuSections\nwindow.Servings = Servings\nwindow.ScriptInserter = ScriptInserter\nwindow.StripeLoader = StripeLoader\nwindow.TvMenuLoader = TvMenuLoader\n", "BeerMenus.Checklists = {\n highlightServingForm: function() {\n const $input = $(\".aa-input\").first()\n $input.focus()\n $input.removeClass(\"shake-vertical\")\n\n setTimeout(() => {\n $input.addClass(\"shake-vertical\")\n }, 100)\n },\n\n showAddressModal: function(barID) {\n $.ajax(`/places/${barID}/addresses/new.js`)\n },\n\n showFacebookModal: function() {\n $(\"#syndicate-promo-facebook\").modal()\n },\n\n showTwitterModal: function() {\n $(\"#syndicate-promo-twitter\").modal()\n },\n\n showPrintMenuModal: function(barID) {\n $.ajax(`/places/${barID}/print_menus/new_or_last.js`)\n },\n\n showUpdateMenuMessageModal: function(partial) {\n $(`#update-menu-message-${partial}`).modal()\n },\n\n spotlight: function(hash) {\n import(\"driver.js\").then((driver) => {\n window.BeerMenus.driver = window.BeerMenus.driver || new driver.default()\n\n const element = document.querySelector(`meta[name=\"${hash}-element\"]`)\n const position = document.querySelector(`meta[name=\"${hash}-position\"]`)\n const highlight = {\n element: (element && element.content) || \"#pro-tools\",\n popover: {\n showButtons: false,\n position: (position && position.content) || \"bottom\",\n title: document.getElementById(`${hash}-title`).innerHTML,\n description: document.getElementById(`${hash}-description`).innerHTML,\n }\n }\n\n const tab = document.querySelector(`meta[name=\"${hash}-tab\"]`)\n if (tab) {\n window.location.hash = tab.content\n }\n\n setTimeout(() => {\n $(\".modal\").modal(\"hide\") // Close any open modal.\n window.BeerMenus.driver.highlight(highlight)\n }, 1) // Tick so tabs-controller has time to select tab.\n })\n },\n\n closeDriver: function() {\n // Close driver immediately, without animation.\n window.BeerMenus.driver && window.BeerMenus.driver.reset(true)\n }\n}\n", "BeerMenus.DOM = {\n insertHTML: function(html, element) {\n element.insertAdjacentHTML(\"beforeend\", html)\n }\n}\n", "BeerMenus.InputFocuser = {\n focus: function(selector) {\n this.focusNode(document.querySelector(selector))\n },\n\n focusNode: function(node) {\n node.focus()\n\n setTimeout(function() {\n // Set the cursor at the end of the input.\n node.selectionStart = node.selectionEnd = node.value.length\n }, 0) // Tick to defer until the stack is clear.\n }\n}\n", "BeerMenus.Messages = {\n setNotice: function(message) {\n this._setMessage(message, \"success\", \"check\")\n },\n\n setError: function(message) {\n this._setMessage(message, \"alert\", \"alert\")\n },\n\n clear: function() {\n $(\"#global-messages\").html(\"\")\n },\n\n // private\n\n _setMessage: function(message, cssClass, iconClass) {\n this.clear()\n\n $(\"#global-messages\").append(\n $(\"