{"version":3,"file":"js/application-c44e1ee8190e6223936a.js","sources":["webpack:///webpack/bootstrap","webpack:///./app/javascript/images/avatars.jpg","webpack:///./app/javascript/images/bg-store-hero.jpg","webpack:///./app/javascript/images/default-bg-primary.jpg","webpack:///./app/javascript/images/default-bg-secondary.jpg","webpack:///./app/javascript/images/icons/checkmark.svg","webpack:///./app/javascript/images/icons/down-arrow.svg","webpack:///./app/javascript/images/icons/down-chevron.svg","webpack:///./app/javascript/images/icons/down-triangle.svg","webpack:///./app/javascript/images/icons/download.svg","webpack:///./app/javascript/images/icons/facebook.svg","webpack:///./app/javascript/images/icons/instagram.svg","webpack:///./app/javascript/images/icons/menu.svg","webpack:///./app/javascript/images/icons/twitter.svg","webpack:///./app/javascript/images/icons/white/facebook.svg","webpack:///./app/javascript/images/icons/white/instagram.svg","webpack:///./app/javascript/images/icons/white/twitter.svg","webpack:///./app/javascript/images/icons/white/url.svg","webpack:///./app/javascript/images/icons/x.svg","webpack:///./app/javascript/images/logos/no2plastic-with-fade.svg","webpack:///./app/javascript/images/metrics/plastics-all.svg","webpack:///./app/javascript/images/metrics/plastics-bags-white.svg","webpack:///./app/javascript/images/metrics/plastics-bags.svg","webpack:///./app/javascript/images/metrics/plastics-bottles-white.svg","webpack:///./app/javascript/images/metrics/plastics-bottles.svg","webpack:///./app/javascript/images/metrics/plastics-cutlery-white.svg","webpack:///./app/javascript/images/metrics/plastics-cutlery.svg","webpack:///./app/javascript/images/metrics/plastics-straws-white.svg","webpack:///./app/javascript/images/metrics/plastics-straws.svg","webpack:///./app/javascript/images/no-bags-white.svg","webpack:///./app/javascript/images/no-bags.svg","webpack:///./app/javascript/images/no-bottles-white.svg","webpack:///./app/javascript/images/no-bottles.svg","webpack:///./app/javascript/images/no-straws-white.svg","webpack:///./app/javascript/images/no-straws.svg","webpack:///./app/javascript/images/schools/intro-bottle.png","webpack:///./app/javascript/images/schools/pdf-preview.png","webpack:///./app/javascript/javascripts/animate-metrics.js","webpack:///./app/javascript/javascripts/form-utils.js","webpack:///./app/javascript/javascripts/jquery-init.js","webpack:///./app/javascript/javascripts/manage-signup-callout-height.js","webpack:///./app/javascript/javascripts/navigation.js","webpack:///./app/javascript/javascripts/payments.js","webpack:///./app/javascript/javascripts/resources.js","webpack:///./app/javascript/javascripts/schools.js","webpack:///./app/javascript/javascripts/submit-pledge-form.js","webpack:///./app/javascript/javascripts/validations.js","webpack:///./app/javascript/javascripts/vendor/jquery.autocomplete.js","webpack:///./app/javascript/packs/application.js","webpack:///./app/javascript/stylesheets/application.scss?90b0","webpack:///./node_modules/@babel/runtime/regenerator/index.js","webpack:///./node_modules/clipboard/dist/clipboard.js","webpack:///./node_modules/jquery/dist/jquery.js","webpack:///./node_modules/regenerator-runtime/runtime.js","webpack:///./node_modules/validate.js/validate.js","webpack:///(webpack)/buildin/amd-define.js","webpack:///(webpack)/buildin/module.js"],"sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/packs/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./app/javascript/packs/application.js\");\n","module.exports = __webpack_public_path__ + \"media/images/avatars-068307e9c10c873d88e2af54bdd3f0bd.jpg\";","module.exports = __webpack_public_path__ + \"media/images/bg-store-hero-91e8359fb4093ea9a1e2592e59be0d2c.jpg\";","module.exports = __webpack_public_path__ + \"media/images/default-bg-primary-08f461aa5a11cfda7c44751a9ae9a661.jpg\";","module.exports = __webpack_public_path__ + \"media/images/default-bg-secondary-285c3330e22c3c178303357c446189d6.jpg\";","module.exports = __webpack_public_path__ + \"media/images/icons/checkmark-4c89b0d7c5d54241c7efc308d04fdae7.svg\";","module.exports = __webpack_public_path__ + \"media/images/icons/down-arrow-9375d78a1d8508892c8141538ccb7f1c.svg\";","module.exports = __webpack_public_path__ + \"media/images/icons/down-chevron-66a3b44e48874332395acbc49cfc8912.svg\";","module.exports = __webpack_public_path__ + \"media/images/icons/down-triangle-0697f9bfdfa4510e58a102b547a808d2.svg\";","module.exports = __webpack_public_path__ + \"media/images/icons/download-657c3013b6ad6abd65a19fe5d27df4f5.svg\";","module.exports = __webpack_public_path__ + \"media/images/icons/facebook-acfa9d2b1310d2ed70ae622dadbc284d.svg\";","module.exports = __webpack_public_path__ + \"media/images/icons/instagram-bad963685064ccb24faf1d60f09f290c.svg\";","module.exports = __webpack_public_path__ + \"media/images/icons/menu-fa38652d4a5d20ff80fabc9f67bac656.svg\";","module.exports = __webpack_public_path__ + \"media/images/icons/twitter-202c6b274f6dc252de1aa3ac1ee5fe4d.svg\";","module.exports = __webpack_public_path__ + \"media/images/icons/white/facebook-db3ffc238135f02c0f27ca7e84da51b9.svg\";","module.exports = __webpack_public_path__ + \"media/images/icons/white/instagram-3e2b4f5b77ee4d02027fbdbb2211dc88.svg\";","module.exports = __webpack_public_path__ + \"media/images/icons/white/twitter-5140cab4efd9047fa444faedc887c743.svg\";","module.exports = __webpack_public_path__ + \"media/images/icons/white/url-3848848a80f5bc7121301b926fc63942.svg\";","module.exports = __webpack_public_path__ + \"media/images/icons/x-4f1395563628889f661130bdc24ed4e1.svg\";","module.exports = __webpack_public_path__ + \"media/images/logos/no2plastic-with-fade-4303479e1ffadce48429925752e1cb83.svg\";","module.exports = __webpack_public_path__ + \"media/images/metrics/plastics-all-d64f9dac052f7fbcd537329cc75e6ca8.svg\";","module.exports = __webpack_public_path__ + \"media/images/metrics/plastics-bags-white-a4b3e419dce756d0baa08592ec5f76a4.svg\";","module.exports = __webpack_public_path__ + \"media/images/metrics/plastics-bags-2a41e241f8c351456c6e2f252a1fc8ed.svg\";","module.exports = __webpack_public_path__ + \"media/images/metrics/plastics-bottles-white-bae21ecd9c0d6975aef7967f892207aa.svg\";","module.exports = __webpack_public_path__ + \"media/images/metrics/plastics-bottles-44c9bbd77773cbc7337b9ce75837e3ab.svg\";","module.exports = __webpack_public_path__ + \"media/images/metrics/plastics-cutlery-white-a834eddeda960166af84b95253b137b5.svg\";","module.exports = __webpack_public_path__ + \"media/images/metrics/plastics-cutlery-448a9876ee2409a3de63b9eeed487754.svg\";","module.exports = __webpack_public_path__ + \"media/images/metrics/plastics-straws-white-6d1e8d6e9f869fcb1bf3953cb2d437bb.svg\";","module.exports = __webpack_public_path__ + \"media/images/metrics/plastics-straws-6fc6ba9db0e5e7c4137f8e213260125b.svg\";","module.exports = __webpack_public_path__ + \"media/images/no-bags-white-a4b3e419dce756d0baa08592ec5f76a4.svg\";","module.exports = __webpack_public_path__ + \"media/images/no-bags-2a41e241f8c351456c6e2f252a1fc8ed.svg\";","module.exports = __webpack_public_path__ + \"media/images/no-bottles-white-79595e132c66f682ddddcc48cc92c915.svg\";","module.exports = __webpack_public_path__ + \"media/images/no-bottles-8d4d3d4538f9021a92d1318908d5f796.svg\";","module.exports = __webpack_public_path__ + \"media/images/no-straws-white-46300db2d6ddb80b44af95fe39e4646b.svg\";","module.exports = __webpack_public_path__ + \"media/images/no-straws-c56126a060bb4b1134a8710f2e9d81df.svg\";","module.exports = __webpack_public_path__ + \"media/images/schools/intro-bottle-1b41a82938521fab02f338be13010cc4.png\";","module.exports = __webpack_public_path__ + \"media/images/schools/pdf-preview-cbe257a3ba282c2ee16c72c18e256530.png\";","import $ from 'jquery';\n\nvar START_DELTA = 100;\n\n$(function() {\n const counterElements = $('.metric .count');\n\n counterElements.each((index, element) => {\n var count = parseInt(\n $(element)\n .text()\n .replace(',', ''),\n 10,\n );\n var countStart = count - START_DELTA;\n if (countStart < 0) {\n countStart = 0;\n }\n var i = setInterval(function() {\n $(element).text(countStart.toLocaleString('en-GB'));\n if (countStart >= count) {\n clearInterval(i);\n }\n countStart += 1;\n }, 30);\n });\n});\n","import $ from 'jquery';\n\nexport function getFormData($form, keys = []) {\n const formData = {};\n $form.serializeArray().map(({ name, value }) => {\n if (keys.includes(name)) {\n if (name === 'amount') {\n formData[name] = isNaN(parseInt(value, 10)) ? value : parseInt(value, 10);\n } else {\n formData[name] = value;\n }\n } else {\n formData[name] = value;\n }\n });\n return formData;\n}\n\nexport function clearErrors($formFields) {\n $formFields.each(function(index) {\n $(this)\n .parent()\n .removeClass('has-error')\n .find('.error')\n .remove();\n });\n}\n\nexport function addErrorsToFields($formFields, formErrors) {\n // Always clear existing errors before attempting a validation\n clearErrors($formFields);\n\n $formFields.each(function(index) {\n const fieldName = $(this).attr('name');\n if (Object.keys(formErrors).includes(fieldName)) {\n const errorMarkup = `
${formErrors[fieldName][0]}
`;\n $(this)\n .parent()\n .addClass('has-error')\n .append(errorMarkup);\n }\n });\n}\n\n// After a the container's height changes we manually call this to re-center it vertically.\n// The container's\nexport function centerDonationForm() {\n const containerHeight = window.innerWidth < 850 ? 650 : 800;\n\n if ($('.flip-container').hasClass('active')) {\n const $donateFormBack = $('#donate-form-back');\n const donateFormBackHeight = $donateFormBack.height();\n $('#donate-form-back').css('marginTop', (containerHeight - donateFormBackHeight) / 2);\n } else {\n const $donateForm = $('#donate-form');\n const donateFormHeight = $donateForm.height();\n $('#donate-form').css('marginTop', (containerHeight - donateFormHeight) / 2);\n }\n}\n","import $ from 'jquery';\n\n$.ajaxSetup({\n headers: {\n 'X-CSRF-Token': $('meta[name=\"csrf-token\"]').attr('content'),\n },\n});\n","import $ from \"jquery\";\nimport { centerDonationForm } from \"./form-utils\";\n\nvar resizeTimer;\n\nexport function setHeight(thanks = false) {\n var additionalHeight = 100;\n var pledge = $(\".the-pledge\");\n var isAmbassadorPledge = !!$(\".is_ambassador_pledge\").length;\n var pledgeThanks = $(\".the-pledge-thanks\");\n var elem = $(\".flip-container\").hasClass(\"active\") ? pledgeThanks : pledge;\n if (isAmbassadorPledge) additionalHeight = 250;\n\n $(\".signup-callout\").css({ height: elem.height() + additionalHeight });\n\n centerDonationForm();\n}\n\n$(window).on(\"resize\", function(e) {\n clearTimeout(resizeTimer);\n resizeTimer = setTimeout(setHeight, 50);\n});\n\n// When running this on page load, wait until all the assets are done loading. If we don't do\n// this the height will not be correct.\n$(window).on(\"load\", function() {\n setHeight();\n});\n","import $ from 'jquery';\n\n// Returns a function, that, as long as it continues to be invoked, will not\n// be triggered. The function will be called after it stops being called for\n// N milliseconds. If `immediate` is passed, trigger the function on the\n// leading edge, instead of the trailing.\nfunction debounce(func, wait, immediate) {\n var timeout;\n return function() {\n var context = this,\n args = arguments;\n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}\n\nconst navigationWrapWidth = 700;\n\nconst hideNavigation = function() {\n $('.main-navigation, .close, .first-row, .header').removeClass('is-visible');\n};\n\nconst resetNavigation = debounce(function() {\n const width = $(window).width();\n if (width > navigationWrapWidth) {\n hideNavigation();\n $('body, html').removeClass('stop-scrolling');\n }\n}, 50);\n\n$(function() {\n // Toggle the navigation if there's a click on the hamburger or close icons\n $('.hamburger, .close').on('click', function() {\n $('.main-navigation, .hamburger, .close, .first-row, .header').toggleClass('is-visible');\n $('body, html').toggleClass('stop-scrolling');\n });\n\n // Because some of the links are anchors, potentially linking within the current page,\n // we need to manually hide the navigation as there won't always be a page reload.\n $('.main-navigation .navigation-link').on('click', function() {\n // Only for mobile\n if ($(window).width() > navigationWrapWidth) return;\n\n hideNavigation();\n $('.hamburger').addClass('is-visible');\n $('body, html').removeClass('stop-scrolling');\n });\n\n $(window).resize(resetNavigation);\n});\n","import $ from 'jquery';\nimport validate from 'validate.js';\nimport { stepOneValidation, allStepValidation } from './validations';\nimport { centerDonationForm, getFormData, addErrorsToFields, clearErrors } from './form-utils';\n\n// Inform the customer that there was an error e.g. card could not be charged\nfunction addErrorsToForm(message) {\n const errorElement = $('#card-errors');\n errorElement.text(message);\n}\n\n// Initialize Stripe / Stripe Elements\nconst stripe = Stripe(stripePublishableKey);\nconst elements = stripe.elements({\n fonts: [{ cssSrc: 'https://fonts.googleapis.com/css?family=Montserrat:200,400,500,700,800' }],\n});\n\n// Styles for Stripe Elements\nconst style = {\n base: {\n fontSize: '16px',\n color: '#929292',\n fontFamily: 'Montserrat',\n fontWeight: 500,\n },\n};\n\nconst formErrors = {};\n\n$(function() {\n // Don't execute the donations code unless we're on the donations page\n if (!$('.donations-controller').length) return;\n\n centerDonationForm();\n const $form = $('#payment-form');\n const $submitButton = $form.find('.submit');\n const $formFields = $form.find('input');\n\n // Create an instance of the card Element.\n const card = elements.create('card', { style });\n\n // Add an instance of the card Element into the `card-element`