{"version":3,"file":"js/redesign-application-5becff474a7ab882b2bd.js","sources":["webpack:///webpack/bootstrap","webpack:///./app/javascript/img sync ^\\.\\/.*$","webpack:///./app/javascript/img/advice-bg.png","webpack:///./app/javascript/img/avatar.png","webpack:///./app/javascript/img/bgicon.svg","webpack:///./app/javascript/img/bgicon_secondary.svg","webpack:///./app/javascript/img/cat.png","webpack:///./app/javascript/img/dog.png","webpack:///./app/javascript/img/draft.png","webpack:///./app/javascript/img/filetypes/doc.svg","webpack:///./app/javascript/img/filetypes/img.svg","webpack:///./app/javascript/img/filetypes/pdf.svg","webpack:///./app/javascript/img/filetypes/xls.svg","webpack:///./app/javascript/img/fullscreen.png","webpack:///./app/javascript/img/hero-list-venue.jpg","webpack:///./app/javascript/img/hero_bg.jpg","webpack:///./app/javascript/img/hero_bg_new.jpg","webpack:///./app/javascript/img/hero_bg_workspace.jpg","webpack:///./app/javascript/img/img_placeholder.png","webpack:///./app/javascript/img/img_placeholder.svg","webpack:///./app/javascript/img/info_window_close.png","webpack:///./app/javascript/img/list-cards-bg.svg","webpack:///./app/javascript/img/list-venues-icons.png","webpack:///./app/javascript/img/logo.png","webpack:///./app/javascript/img/logo.svg","webpack:///./app/javascript/img/logo_blue.png","webpack:///./app/javascript/img/logo_og.png","webpack:///./app/javascript/img/main.svg","webpack:///./app/javascript/img/map-expand.svg","webpack:///./app/javascript/img/mappin-active.svg","webpack:///./app/javascript/img/mappin.svg","webpack:///./app/javascript/img/muuchit_for_non_profits.jpg","webpack:///./app/javascript/img/muuchit_for_providers.jpg","webpack:///./app/javascript/img/muuchit_for_renters.jpg","webpack:///./app/javascript/img/muuchit_promotion_video.jpg","webpack:///./app/javascript/img/no-avatar.svg","webpack:///./app/javascript/img/people/person_1.jpg","webpack:///./app/javascript/img/pet-rescue.png","webpack:///./app/javascript/img/play_btn.png","webpack:///./app/javascript/img/play_btn_white.png","webpack:///./app/javascript/img/play_white.svg","webpack:///./app/javascript/img/powered_by_stripe.svg","webpack:///./app/javascript/img/primary-bottom.svg","webpack:///./app/javascript/img/primary-desktop.svg","webpack:///./app/javascript/img/primary-left.svg","webpack:///./app/javascript/img/primary.svg","webpack:///./app/javascript/img/primary_small.svg","webpack:///./app/javascript/img/residence-slide.jpg","webpack:///./app/javascript/img/secondary.svg","webpack:///./app/javascript/img/secondary_white.svg","webpack:///./app/javascript/img/steps-actions-bg.png","webpack:///./app/javascript/img/stripe_connect_account.png","webpack:///./app/javascript/img/test.jpg","webpack:///./app/javascript/img/white-logo.svg","webpack:///./app/javascript/media sync ^\\.\\/.*$","webpack:///./app/javascript/media/Event-Planning-Checklist.pdf","webpack:///./app/javascript/media/Vendor-Proposal-Template-Muuchit.pdf","webpack:///./app/javascript/packs/_constants.js","webpack:///./app/javascript/packs/app.js","webpack:///./app/javascript/packs/components/ValidationForm.js","webpack:///./app/javascript/packs/components/accordion.js","webpack:///./app/javascript/packs/components/additionalFilters.js","webpack:///./app/javascript/packs/components/addressAutocomplete.js","webpack:///./app/javascript/packs/components/benefitingShowMission.js","webpack:///./app/javascript/packs/components/bodyHiddenPosition.js","webpack:///./app/javascript/packs/components/bookingCountdown.js","webpack:///./app/javascript/packs/components/checkSelectFilled.js","webpack:///./app/javascript/packs/components/checkViewport.js","webpack:///./app/javascript/packs/components/checkboxToggle.js","webpack:///./app/javascript/packs/components/clickFunc.js","webpack:///./app/javascript/packs/components/copyLink.js","webpack:///./app/javascript/packs/components/copyToClipBoard.js","webpack:///./app/javascript/packs/components/counter.js","webpack:///./app/javascript/packs/components/customSelect.js","webpack:///./app/javascript/packs/components/customSelectTabs.js","webpack:///./app/javascript/packs/components/datepicker/calculateBookingPrice.js","webpack:///./app/javascript/packs/components/datepicker/createAvailableHoursArray.js","webpack:///./app/javascript/packs/components/datepicker/createDateRange.js","webpack:///./app/javascript/packs/components/datepicker/datePicker.js","webpack:///./app/javascript/packs/components/datepicker/datePickerBooking.js","webpack:///./app/javascript/packs/components/datepicker/datePickerBookingToggle.js","webpack:///./app/javascript/packs/components/datepicker/formatDate.js","webpack:///./app/javascript/packs/components/datepicker/formatTime.js","webpack:///./app/javascript/packs/components/datepicker/getDayAvailableHours.js","webpack:///./app/javascript/packs/components/datepicker/selectors.js","webpack:///./app/javascript/packs/components/datepicker/updateFormFields.js","webpack:///./app/javascript/packs/components/datepicker/updateSelect.js","webpack:///./app/javascript/packs/components/downloadPdf.js","webpack:///./app/javascript/packs/components/emailSubscription.js","webpack:///./app/javascript/packs/components/expander.js","webpack:///./app/javascript/packs/components/feedback.js","webpack:///./app/javascript/packs/components/filteringDropDown.js","webpack:///./app/javascript/packs/components/fixedHeader.js","webpack:///./app/javascript/packs/components/fixedHeaderOnScroll.js","webpack:///./app/javascript/packs/components/forbidAllCaps.js","webpack:///./app/javascript/packs/components/getElemSize.js","webpack:///./app/javascript/packs/components/infoModal.js","webpack:///./app/javascript/packs/components/initMap.js","webpack:///./app/javascript/packs/components/initStripe.js","webpack:///./app/javascript/packs/components/initVideos.js","webpack:///./app/javascript/packs/components/inputDropdown.js","webpack:///./app/javascript/packs/components/isUpperCase.js","webpack:///./app/javascript/packs/components/lazyLoading.js","webpack:///./app/javascript/packs/components/loading.js","webpack:///./app/javascript/packs/components/mailchimp.js","webpack:///./app/javascript/packs/components/mainSearch.js","webpack:///./app/javascript/packs/components/mapZoomBtns.js","webpack:///./app/javascript/packs/components/mask.js","webpack:///./app/javascript/packs/components/numberWithCommas.js","webpack:///./app/javascript/packs/components/onlyNumbers.js","webpack:///./app/javascript/packs/components/passwordInput.js","webpack:///./app/javascript/packs/components/payments.js","webpack:///./app/javascript/packs/components/popup.js","webpack:///./app/javascript/packs/components/reCAPTCHA.js","webpack:///./app/javascript/packs/components/redirectTo.js","webpack:///./app/javascript/packs/components/reinitVideoPopup.js","webpack:///./app/javascript/packs/components/scrollTo.js","webpack:///./app/javascript/packs/components/setTextareaHeight.js","webpack:///./app/javascript/packs/components/sharePopup.js","webpack:///./app/javascript/packs/components/showFilters.js","webpack:///./app/javascript/packs/components/showMore.js","webpack:///./app/javascript/packs/components/showMoreReviews.js","webpack:///./app/javascript/packs/components/slider.js","webpack:///./app/javascript/packs/components/storeMessageContent.js","webpack:///./app/javascript/packs/components/submitFormStatus.js","webpack:///./app/javascript/packs/components/submitSearchChatForm.js","webpack:///./app/javascript/packs/components/tabs.js","webpack:///./app/javascript/packs/components/textareaCounter.js","webpack:///./app/javascript/packs/components/timeZoneDetector.js","webpack:///./app/javascript/packs/components/toggleContent.js","webpack:///./app/javascript/packs/components/toggleMapSwitch.js","webpack:///./app/javascript/packs/components/togglePayout.js","webpack:///./app/javascript/packs/components/toggleWishList.js","webpack:///./app/javascript/packs/components/validateBenefiting.js","webpack:///./app/javascript/packs/components/validateBooking.js","webpack:///./app/javascript/packs/components/validateDonation.js","webpack:///./app/javascript/packs/components/validateEmptyMessage.js","webpack:///./app/javascript/packs/components/video.js","webpack:///./app/javascript/packs/components/viewportHeight.js","webpack:///./app/javascript/packs/envVariables.js.erb","webpack:///./app/javascript/packs/lib/detectTouch.js","webpack:///./app/javascript/packs/lib/infoBoxMap.js","webpack:///./app/javascript/packs/redesign-application.js","webpack:///./app/javascript/redesign-stylesheets/app.sass","webpack:///./node_modules/debounce/index.js","webpack:///./node_modules/flatpickr/dist/flatpickr.js","webpack:///./node_modules/imask/dist/imask.esm.js","webpack:///./node_modules/jquery-validation/dist/jquery.validate.js","webpack:///./node_modules/jquery/dist/jquery.js","webpack:///./node_modules/js-cookie/src/js.cookie.js","webpack:///./node_modules/lodash/lodash.js","webpack:///./node_modules/moment-range/dist/moment-range.js","webpack:///./node_modules/moment/locale sync ^\\.\\/.*$","webpack:///./node_modules/moment/locale/af.js","webpack:///./node_modules/moment/locale/ar-dz.js","webpack:///./node_modules/moment/locale/ar-kw.js","webpack:///./node_modules/moment/locale/ar-ly.js","webpack:///./node_modules/moment/locale/ar-ma.js","webpack:///./node_modules/moment/locale/ar-sa.js","webpack:///./node_modules/moment/locale/ar-tn.js","webpack:///./node_modules/moment/locale/ar.js","webpack:///./node_modules/moment/locale/az.js","webpack:///./node_modules/moment/locale/be.js","webpack:///./node_modules/moment/locale/bg.js","webpack:///./node_modules/moment/locale/bm.js","webpack:///./node_modules/moment/locale/bn.js","webpack:///./node_modules/moment/locale/bo.js","webpack:///./node_modules/moment/locale/br.js","webpack:///./node_modules/moment/locale/bs.js","webpack:///./node_modules/moment/locale/ca.js","webpack:///./node_modules/moment/locale/cs.js","webpack:///./node_modules/moment/locale/cv.js","webpack:///./node_modules/moment/locale/cy.js","webpack:///./node_modules/moment/locale/da.js","webpack:///./node_modules/moment/locale/de-at.js","webpack:///./node_modules/moment/locale/de-ch.js","webpack:///./node_modules/moment/locale/de.js","webpack:///./node_modules/moment/locale/dv.js","webpack:///./node_modules/moment/locale/el.js","webpack:///./node_modules/moment/locale/en-au.js","webpack:///./node_modules/moment/locale/en-ca.js","webpack:///./node_modules/moment/locale/en-gb.js","webpack:///./node_modules/moment/locale/en-ie.js","webpack:///./node_modules/moment/locale/en-il.js","webpack:///./node_modules/moment/locale/en-in.js","webpack:///./node_modules/moment/locale/en-nz.js","webpack:///./node_modules/moment/locale/en-sg.js","webpack:///./node_modules/moment/locale/eo.js","webpack:///./node_modules/moment/locale/es-do.js","webpack:///./node_modules/moment/locale/es-us.js","webpack:///./node_modules/moment/locale/es.js","webpack:///./node_modules/moment/locale/et.js","webpack:///./node_modules/moment/locale/eu.js","webpack:///./node_modules/moment/locale/fa.js","webpack:///./node_modules/moment/locale/fi.js","webpack:///./node_modules/moment/locale/fil.js","webpack:///./node_modules/moment/locale/fo.js","webpack:///./node_modules/moment/locale/fr-ca.js","webpack:///./node_modules/moment/locale/fr-ch.js","webpack:///./node_modules/moment/locale/fr.js","webpack:///./node_modules/moment/locale/fy.js","webpack:///./node_modules/moment/locale/ga.js","webpack:///./node_modules/moment/locale/gd.js","webpack:///./node_modules/moment/locale/gl.js","webpack:///./node_modules/moment/locale/gom-deva.js","webpack:///./node_modules/moment/locale/gom-latn.js","webpack:///./node_modules/moment/locale/gu.js","webpack:///./node_modules/moment/locale/he.js","webpack:///./node_modules/moment/locale/hi.js","webpack:///./node_modules/moment/locale/hr.js","webpack:///./node_modules/moment/locale/hu.js","webpack:///./node_modules/moment/locale/hy-am.js","webpack:///./node_modules/moment/locale/id.js","webpack:///./node_modules/moment/locale/is.js","webpack:///./node_modules/moment/locale/it-ch.js","webpack:///./node_modules/moment/locale/it.js","webpack:///./node_modules/moment/locale/ja.js","webpack:///./node_modules/moment/locale/jv.js","webpack:///./node_modules/moment/locale/ka.js","webpack:///./node_modules/moment/locale/kk.js","webpack:///./node_modules/moment/locale/km.js","webpack:///./node_modules/moment/locale/kn.js","webpack:///./node_modules/moment/locale/ko.js","webpack:///./node_modules/moment/locale/ku.js","webpack:///./node_modules/moment/locale/ky.js","webpack:///./node_modules/moment/locale/lb.js","webpack:///./node_modules/moment/locale/lo.js","webpack:///./node_modules/moment/locale/lt.js","webpack:///./node_modules/moment/locale/lv.js","webpack:///./node_modules/moment/locale/me.js","webpack:///./node_modules/moment/locale/mi.js","webpack:///./node_modules/moment/locale/mk.js","webpack:///./node_modules/moment/locale/ml.js","webpack:///./node_modules/moment/locale/mn.js","webpack:///./node_modules/moment/locale/mr.js","webpack:///./node_modules/moment/locale/ms-my.js","webpack:///./node_modules/moment/locale/ms.js","webpack:///./node_modules/moment/locale/mt.js","webpack:///./node_modules/moment/locale/my.js","webpack:///./node_modules/moment/locale/nb.js","webpack:///./node_modules/moment/locale/ne.js","webpack:///./node_modules/moment/locale/nl-be.js","webpack:///./node_modules/moment/locale/nl.js","webpack:///./node_modules/moment/locale/nn.js","webpack:///./node_modules/moment/locale/oc-lnc.js","webpack:///./node_modules/moment/locale/pa-in.js","webpack:///./node_modules/moment/locale/pl.js","webpack:///./node_modules/moment/locale/pt-br.js","webpack:///./node_modules/moment/locale/pt.js","webpack:///./node_modules/moment/locale/ro.js","webpack:///./node_modules/moment/locale/ru.js","webpack:///./node_modules/moment/locale/sd.js","webpack:///./node_modules/moment/locale/se.js","webpack:///./node_modules/moment/locale/si.js","webpack:///./node_modules/moment/locale/sk.js","webpack:///./node_modules/moment/locale/sl.js","webpack:///./node_modules/moment/locale/sq.js","webpack:///./node_modules/moment/locale/sr-cyrl.js","webpack:///./node_modules/moment/locale/sr.js","webpack:///./node_modules/moment/locale/ss.js","webpack:///./node_modules/moment/locale/sv.js","webpack:///./node_modules/moment/locale/sw.js","webpack:///./node_modules/moment/locale/ta.js","webpack:///./node_modules/moment/locale/te.js","webpack:///./node_modules/moment/locale/tet.js","webpack:///./node_modules/moment/locale/tg.js","webpack:///./node_modules/moment/locale/th.js","webpack:///./node_modules/moment/locale/tl-ph.js","webpack:///./node_modules/moment/locale/tlh.js","webpack:///./node_modules/moment/locale/tr.js","webpack:///./node_modules/moment/locale/tzl.js","webpack:///./node_modules/moment/locale/tzm-latn.js","webpack:///./node_modules/moment/locale/tzm.js","webpack:///./node_modules/moment/locale/ug-cn.js","webpack:///./node_modules/moment/locale/uk.js","webpack:///./node_modules/moment/locale/ur.js","webpack:///./node_modules/moment/locale/uz-latn.js","webpack:///./node_modules/moment/locale/uz.js","webpack:///./node_modules/moment/locale/vi.js","webpack:///./node_modules/moment/locale/x-pseudo.js","webpack:///./node_modules/moment/locale/yo.js","webpack:///./node_modules/moment/locale/zh-cn.js","webpack:///./node_modules/moment/locale/zh-hk.js","webpack:///./node_modules/moment/locale/zh-mo.js","webpack:///./node_modules/moment/locale/zh-tw.js","webpack:///./node_modules/moment/moment.js","webpack:///./node_modules/pubsub-js/src/pubsub.js","webpack:///./node_modules/slick-carousel/slick/slick.js","webpack:///./node_modules/tinymce/skins/ui/oxide/skin.css","webpack:///./node_modules/uppy/dist/uppy.min.css","webpack:///./node_modules/vanilla-lazyload/dist/lazyload.min.js","webpack:///(webpack)/buildin/amd-options.js","webpack:///(webpack)/buildin/global.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/redesign-application.js\");\n","var map = {\n\t\"./advice-bg\": \"./app/javascript/img/advice-bg.png\",\n\t\"./advice-bg.png\": \"./app/javascript/img/advice-bg.png\",\n\t\"./avatar\": \"./app/javascript/img/avatar.png\",\n\t\"./avatar.png\": \"./app/javascript/img/avatar.png\",\n\t\"./bgicon\": \"./app/javascript/img/bgicon.svg\",\n\t\"./bgicon.svg\": \"./app/javascript/img/bgicon.svg\",\n\t\"./bgicon_secondary\": \"./app/javascript/img/bgicon_secondary.svg\",\n\t\"./bgicon_secondary.svg\": \"./app/javascript/img/bgicon_secondary.svg\",\n\t\"./cat\": \"./app/javascript/img/cat.png\",\n\t\"./cat.png\": \"./app/javascript/img/cat.png\",\n\t\"./dog\": \"./app/javascript/img/dog.png\",\n\t\"./dog.png\": \"./app/javascript/img/dog.png\",\n\t\"./draft\": \"./app/javascript/img/draft.png\",\n\t\"./draft.png\": \"./app/javascript/img/draft.png\",\n\t\"./filetypes/doc\": \"./app/javascript/img/filetypes/doc.svg\",\n\t\"./filetypes/doc.svg\": \"./app/javascript/img/filetypes/doc.svg\",\n\t\"./filetypes/img\": \"./app/javascript/img/filetypes/img.svg\",\n\t\"./filetypes/img.svg\": \"./app/javascript/img/filetypes/img.svg\",\n\t\"./filetypes/pdf\": \"./app/javascript/img/filetypes/pdf.svg\",\n\t\"./filetypes/pdf.svg\": \"./app/javascript/img/filetypes/pdf.svg\",\n\t\"./filetypes/xls\": \"./app/javascript/img/filetypes/xls.svg\",\n\t\"./filetypes/xls.svg\": \"./app/javascript/img/filetypes/xls.svg\",\n\t\"./fullscreen\": \"./app/javascript/img/fullscreen.png\",\n\t\"./fullscreen.png\": \"./app/javascript/img/fullscreen.png\",\n\t\"./hero-list-venue\": \"./app/javascript/img/hero-list-venue.jpg\",\n\t\"./hero-list-venue.jpg\": \"./app/javascript/img/hero-list-venue.jpg\",\n\t\"./hero_bg\": \"./app/javascript/img/hero_bg.jpg\",\n\t\"./hero_bg.jpg\": \"./app/javascript/img/hero_bg.jpg\",\n\t\"./hero_bg_new\": \"./app/javascript/img/hero_bg_new.jpg\",\n\t\"./hero_bg_new.jpg\": \"./app/javascript/img/hero_bg_new.jpg\",\n\t\"./hero_bg_workspace\": \"./app/javascript/img/hero_bg_workspace.jpg\",\n\t\"./hero_bg_workspace.jpg\": \"./app/javascript/img/hero_bg_workspace.jpg\",\n\t\"./img_placeholder\": \"./app/javascript/img/img_placeholder.png\",\n\t\"./img_placeholder.png\": \"./app/javascript/img/img_placeholder.png\",\n\t\"./img_placeholder.svg\": \"./app/javascript/img/img_placeholder.svg\",\n\t\"./info_window_close\": \"./app/javascript/img/info_window_close.png\",\n\t\"./info_window_close.png\": \"./app/javascript/img/info_window_close.png\",\n\t\"./list-cards-bg\": \"./app/javascript/img/list-cards-bg.svg\",\n\t\"./list-cards-bg.svg\": \"./app/javascript/img/list-cards-bg.svg\",\n\t\"./list-venues-icons\": \"./app/javascript/img/list-venues-icons.png\",\n\t\"./list-venues-icons.png\": \"./app/javascript/img/list-venues-icons.png\",\n\t\"./logo\": \"./app/javascript/img/logo.png\",\n\t\"./logo.png\": \"./app/javascript/img/logo.png\",\n\t\"./logo.svg\": \"./app/javascript/img/logo.svg\",\n\t\"./logo_blue\": \"./app/javascript/img/logo_blue.png\",\n\t\"./logo_blue.png\": \"./app/javascript/img/logo_blue.png\",\n\t\"./logo_og\": \"./app/javascript/img/logo_og.png\",\n\t\"./logo_og.png\": \"./app/javascript/img/logo_og.png\",\n\t\"./main\": \"./app/javascript/img/main.svg\",\n\t\"./main.svg\": \"./app/javascript/img/main.svg\",\n\t\"./map-expand\": \"./app/javascript/img/map-expand.svg\",\n\t\"./map-expand.svg\": \"./app/javascript/img/map-expand.svg\",\n\t\"./mappin\": \"./app/javascript/img/mappin.svg\",\n\t\"./mappin-active\": \"./app/javascript/img/mappin-active.svg\",\n\t\"./mappin-active.svg\": \"./app/javascript/img/mappin-active.svg\",\n\t\"./mappin.svg\": \"./app/javascript/img/mappin.svg\",\n\t\"./muuchit_for_non_profits\": \"./app/javascript/img/muuchit_for_non_profits.jpg\",\n\t\"./muuchit_for_non_profits.jpg\": \"./app/javascript/img/muuchit_for_non_profits.jpg\",\n\t\"./muuchit_for_providers\": \"./app/javascript/img/muuchit_for_providers.jpg\",\n\t\"./muuchit_for_providers.jpg\": \"./app/javascript/img/muuchit_for_providers.jpg\",\n\t\"./muuchit_for_renters\": \"./app/javascript/img/muuchit_for_renters.jpg\",\n\t\"./muuchit_for_renters.jpg\": \"./app/javascript/img/muuchit_for_renters.jpg\",\n\t\"./muuchit_promotion_video\": \"./app/javascript/img/muuchit_promotion_video.jpg\",\n\t\"./muuchit_promotion_video.jpg\": \"./app/javascript/img/muuchit_promotion_video.jpg\",\n\t\"./no-avatar\": \"./app/javascript/img/no-avatar.svg\",\n\t\"./no-avatar.svg\": \"./app/javascript/img/no-avatar.svg\",\n\t\"./people/person_1\": \"./app/javascript/img/people/person_1.jpg\",\n\t\"./people/person_1.jpg\": \"./app/javascript/img/people/person_1.jpg\",\n\t\"./pet-rescue\": \"./app/javascript/img/pet-rescue.png\",\n\t\"./pet-rescue.png\": \"./app/javascript/img/pet-rescue.png\",\n\t\"./play_btn\": \"./app/javascript/img/play_btn.png\",\n\t\"./play_btn.png\": \"./app/javascript/img/play_btn.png\",\n\t\"./play_btn_white\": \"./app/javascript/img/play_btn_white.png\",\n\t\"./play_btn_white.png\": \"./app/javascript/img/play_btn_white.png\",\n\t\"./play_white\": \"./app/javascript/img/play_white.svg\",\n\t\"./play_white.svg\": \"./app/javascript/img/play_white.svg\",\n\t\"./powered_by_stripe\": \"./app/javascript/img/powered_by_stripe.svg\",\n\t\"./powered_by_stripe.svg\": \"./app/javascript/img/powered_by_stripe.svg\",\n\t\"./primary\": \"./app/javascript/img/primary.svg\",\n\t\"./primary-bottom\": \"./app/javascript/img/primary-bottom.svg\",\n\t\"./primary-bottom.svg\": \"./app/javascript/img/primary-bottom.svg\",\n\t\"./primary-desktop\": \"./app/javascript/img/primary-desktop.svg\",\n\t\"./primary-desktop.svg\": \"./app/javascript/img/primary-desktop.svg\",\n\t\"./primary-left\": \"./app/javascript/img/primary-left.svg\",\n\t\"./primary-left.svg\": \"./app/javascript/img/primary-left.svg\",\n\t\"./primary.svg\": \"./app/javascript/img/primary.svg\",\n\t\"./primary_small\": \"./app/javascript/img/primary_small.svg\",\n\t\"./primary_small.svg\": \"./app/javascript/img/primary_small.svg\",\n\t\"./residence-slide\": \"./app/javascript/img/residence-slide.jpg\",\n\t\"./residence-slide.jpg\": \"./app/javascript/img/residence-slide.jpg\",\n\t\"./secondary\": \"./app/javascript/img/secondary.svg\",\n\t\"./secondary.svg\": \"./app/javascript/img/secondary.svg\",\n\t\"./secondary_white\": \"./app/javascript/img/secondary_white.svg\",\n\t\"./secondary_white.svg\": \"./app/javascript/img/secondary_white.svg\",\n\t\"./steps-actions-bg\": \"./app/javascript/img/steps-actions-bg.png\",\n\t\"./steps-actions-bg.png\": \"./app/javascript/img/steps-actions-bg.png\",\n\t\"./stripe_connect_account\": \"./app/javascript/img/stripe_connect_account.png\",\n\t\"./stripe_connect_account.png\": \"./app/javascript/img/stripe_connect_account.png\",\n\t\"./test\": \"./app/javascript/img/test.jpg\",\n\t\"./test.jpg\": \"./app/javascript/img/test.jpg\",\n\t\"./white-logo\": \"./app/javascript/img/white-logo.svg\",\n\t\"./white-logo.svg\": \"./app/javascript/img/white-logo.svg\"\n};\n\n\nfunction webpackContext(req) {\n\tvar id = webpackContextResolve(req);\n\treturn __webpack_require__(id);\n}\nfunction webpackContextResolve(req) {\n\tif(!__webpack_require__.o(map, req)) {\n\t\tvar e = new Error(\"Cannot find module '\" + req + \"'\");\n\t\te.code = 'MODULE_NOT_FOUND';\n\t\tthrow e;\n\t}\n\treturn map[req];\n}\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = \"./app/javascript/img sync recursive ^\\\\.\\\\/.*$\";","module.exports = \"data:image/png;base64,ZXhwb3J0IGRlZmF1bHQgX193ZWJwYWNrX3B1YmxpY19wYXRoX18gKyAibWVkaWEvaW1nL2FkdmljZS1iZy1hMWMwMzcwZDUwNmQ5MDc2NzFjMTgzYmRlYmNlMTFkNC5wbmciOw==\"","module.exports = \"data:image/png;base64,ZXhwb3J0IGRlZmF1bHQgX193ZWJwYWNrX3B1YmxpY19wYXRoX18gKyAibWVkaWEvaW1nL2F2YXRhci01ZjRmMzU4MTJjMDU4MGQxOWIwZWY5NDcyM2YzZDk2Yy5wbmciOw==\"","export default __webpack_public_path__ + \"media/img/bgicon-40a8afd3ae58f7011aee4b8b55fcdf84.svg\";","export default __webpack_public_path__ + \"media/img/bgicon_secondary-7c9361ec6e58957da00e5a6acce7503e.svg\";","module.exports = \"data:image/png;base64,ZXhwb3J0IGRlZmF1bHQgX193ZWJwYWNrX3B1YmxpY19wYXRoX18gKyAibWVkaWEvaW1nL2NhdC0zMWE2ZTNjNmQ5M2FkMjM5NWYyZWZmMjg1Njg5NzU0MC5wbmciOw==\"","module.exports = \"data:image/png;base64,ZXhwb3J0IGRlZmF1bHQgX193ZWJwYWNrX3B1YmxpY19wYXRoX18gKyAibWVkaWEvaW1nL2RvZy01MDFkZDNhNThhNWVjYjM1MTk5MTNhNTkwNGU2OTU5Yy5wbmciOw==\"","module.exports = \"data:image/png;base64,ZXhwb3J0IGRlZmF1bHQgX193ZWJwYWNrX3B1YmxpY19wYXRoX18gKyAibWVkaWEvaW1nL2RyYWZ0LWY2YjkwZmY1NWE5ODkzMGVjYmQ5YTlhZGRmYzUwYWZjLnBuZyI7\"","export default __webpack_public_path__ + \"media/img/filetypes/doc-b773a715a0274cc68eff9e29b36facf7.svg\";","export default __webpack_public_path__ + \"media/img/filetypes/img-93f006a3f7dbad2025e49412fbb94e8b.svg\";","export default __webpack_public_path__ + \"media/img/filetypes/pdf-96b612ffd3de402279cf1eef891a948f.svg\";","export default __webpack_public_path__ + \"media/img/filetypes/xls-4ce81e61a135feb8a067ca65c4f18f2b.svg\";","module.exports = \"data:image/png;base64,ZXhwb3J0IGRlZmF1bHQgX193ZWJwYWNrX3B1YmxpY19wYXRoX18gKyAibWVkaWEvaW1nL2Z1bGxzY3JlZW4tNTFlYWQ2Y2Y1NGI5MGE4MzcyZjZhY2MxYmYwMTBlNjMucG5nIjs=\"","module.exports = \"data:image/jpeg;base64,ZXhwb3J0IGRlZmF1bHQgX193ZWJwYWNrX3B1YmxpY19wYXRoX18gKyAibWVkaWEvaW1nL2hlcm8tbGlzdC12ZW51ZS02Yzg2ODFjNDM1ZGJjMjg4NTc4NzY0MjE0NWY5MTIyYi5qcGciOw==\"","module.exports = \"data:image/jpeg;base64,ZXhwb3J0IGRlZmF1bHQgX193ZWJwYWNrX3B1YmxpY19wYXRoX18gKyAibWVkaWEvaW1nL2hlcm9fYmctMzI0MDI3NzY2NTI1YzZlYWJmZDIwZWQxNzI4ZTBjODkuanBnIjs=\"","module.exports = \"data:image/jpeg;base64,ZXhwb3J0IGRlZmF1bHQgX193ZWJwYWNrX3B1YmxpY19wYXRoX18gKyAibWVkaWEvaW1nL2hlcm9fYmdfbmV3LTMyNDAyNzc2NjUyNWM2ZWFiZmQyMGVkMTcyOGUwYzg5LmpwZyI7\"","module.exports = \"data:image/jpeg;base64,ZXhwb3J0IGRlZmF1bHQgX193ZWJwYWNrX3B1YmxpY19wYXRoX18gKyAibWVkaWEvaW1nL2hlcm9fYmdfd29ya3NwYWNlLTI5MjFhY2I0ZDBhZjE0ZWUxMDM0ZGJiMDEyMDJlNjg2LmpwZyI7\"","module.exports = \"data:image/png;base64,ZXhwb3J0IGRlZmF1bHQgX193ZWJwYWNrX3B1YmxpY19wYXRoX18gKyAibWVkaWEvaW1nL2ltZ19wbGFjZWhvbGRlci0wNDFlZTFhODg3NzRhYzBjYzJlMjMwY2NmNjdlNTA5NS5wbmciOw==\"","export default __webpack_public_path__ + \"media/img/img_placeholder-0887a1e4d4e89155ba1fcb8f17d432ae.svg\";","module.exports = \"data:image/png;base64,ZXhwb3J0IGRlZmF1bHQgX193ZWJwYWNrX3B1YmxpY19wYXRoX18gKyAibWVkaWEvaW1nL2luZm9fd2luZG93X2Nsb3NlLTc5Mjc1MGRhMTE1ZDZhZGZhMTRkOGIzODQwYzczMWQ4LnBuZyI7\"","export default __webpack_public_path__ + \"media/img/list-cards-bg-cae19afb0c2a5e299488ddb0d3fe884a.svg\";","module.exports = \"data:image/png;base64,ZXhwb3J0IGRlZmF1bHQgX193ZWJwYWNrX3B1YmxpY19wYXRoX18gKyAibWVkaWEvaW1nL2xpc3QtdmVudWVzLWljb25zLThjODA3N2FlZDM4NzI4NDBlZGJiMTg0NzE0NjM4Njk5LnBuZyI7\"","module.exports = \"data:image/png;base64,ZXhwb3J0IGRlZmF1bHQgX193ZWJwYWNrX3B1YmxpY19wYXRoX18gKyAibWVkaWEvaW1nL2xvZ28tOGUzMGZmOWE4OWMxMDUzODZkZTkyNjhmMTMwNWNjZTYucG5nIjs=\"","export default __webpack_public_path__ + \"media/img/logo-8a4a5b892c145376c40db3deb2a68f52.svg\";","module.exports = \"data:image/png;base64,ZXhwb3J0IGRlZmF1bHQgX193ZWJwYWNrX3B1YmxpY19wYXRoX18gKyAibWVkaWEvaW1nL2xvZ29fYmx1ZS03NWY2MzFiODVlYzk5NjJmZTI4MTY3ZDAyMzI3OGY1Ni5wbmciOw==\"","module.exports = \"data:image/png;base64,ZXhwb3J0IGRlZmF1bHQgX193ZWJwYWNrX3B1YmxpY19wYXRoX18gKyAibWVkaWEvaW1nL2xvZ29fb2ctMzRiNDEyYjFhMGVkMmE2MzIxNjcwYzU5NmNjY2I5ZjYucG5nIjs=\"","export default __webpack_public_path__ + \"media/img/main-88368679bdefd6429bb990526bd17159.svg\";","export default __webpack_public_path__ + \"media/img/map-expand-c4d7f6a26609401ea6bf2d58a3b833ed.svg\";","export default __webpack_public_path__ + \"media/img/mappin-active-913b70519bc651f7dd36ee03d2c9f96c.svg\";","export default __webpack_public_path__ + \"media/img/mappin-36b1b6625bfd0ab69bb6f1df75d46bc0.svg\";","module.exports = \"data:image/jpeg;base64,ZXhwb3J0IGRlZmF1bHQgX193ZWJwYWNrX3B1YmxpY19wYXRoX18gKyAibWVkaWEvaW1nL211dWNoaXRfZm9yX25vbl9wcm9maXRzLTNjZTI4MWNiYWVmM2E1ZTAzZmJiMmI0MWFhNjQ4YTJkLmpwZyI7\"","module.exports = \"data:image/jpeg;base64,ZXhwb3J0IGRlZmF1bHQgX193ZWJwYWNrX3B1YmxpY19wYXRoX18gKyAibWVkaWEvaW1nL211dWNoaXRfZm9yX3Byb3ZpZGVycy1jNzMxODAxYWY5YjIwNGY3YmQ5Zjk1OGY3MDEyMjExZC5qcGciOw==\"","module.exports = \"data:image/jpeg;base64,ZXhwb3J0IGRlZmF1bHQgX193ZWJwYWNrX3B1YmxpY19wYXRoX18gKyAibWVkaWEvaW1nL211dWNoaXRfZm9yX3JlbnRlcnMtZjg4NDU4ZTgzZTllODFjNDA2YjljOWNhNTk1NTBmY2EuanBnIjs=\"","module.exports = \"data:image/jpeg;base64,ZXhwb3J0IGRlZmF1bHQgX193ZWJwYWNrX3B1YmxpY19wYXRoX18gKyAibWVkaWEvaW1nL211dWNoaXRfcHJvbW90aW9uX3ZpZGVvLTE4ZTRiNDE5YjU1MTI2ODRmMTUyOGQ4OWZjZjAwODgxLmpwZyI7\"","export default __webpack_public_path__ + \"media/img/no-avatar-e162209d0cee22b57388bec5dce35ade.svg\";","module.exports = \"data:image/jpeg;base64,ZXhwb3J0IGRlZmF1bHQgX193ZWJwYWNrX3B1YmxpY19wYXRoX18gKyAibWVkaWEvaW1nL3Blb3BsZS9wZXJzb25fMS0yYTIzNTcxNWZmZmIzZDMwYTA0MzUzNWM4ZGU2Yjc1Yi5qcGciOw==\"","module.exports = \"data:image/png;base64,ZXhwb3J0IGRlZmF1bHQgX193ZWJwYWNrX3B1YmxpY19wYXRoX18gKyAibWVkaWEvaW1nL3BldC1yZXNjdWUtOWRiMmJhZDg2N2M2NThiYzdkOGJmYWRiZDY3ZTNkZjkucG5nIjs=\"","module.exports = \"data:image/png;base64,ZXhwb3J0IGRlZmF1bHQgX193ZWJwYWNrX3B1YmxpY19wYXRoX18gKyAibWVkaWEvaW1nL3BsYXlfYnRuLWViMTI5ODY0MjkwZGNhMWRkNjQ1ZjBiMmVjODI1NTAxLnBuZyI7\"","module.exports = \"data:image/png;base64,ZXhwb3J0IGRlZmF1bHQgX193ZWJwYWNrX3B1YmxpY19wYXRoX18gKyAibWVkaWEvaW1nL3BsYXlfYnRuX3doaXRlLTlmZGQxMmYwZmVjNmNkYTlmNDNmOThkYmM2OGFlNDJmLnBuZyI7\"","export default __webpack_public_path__ + \"media/img/play_white-cb7768adc0be423ce2c95bb537e5d639.svg\";","export default __webpack_public_path__ + \"media/img/powered_by_stripe-7f1e4e15e8f5e21e8401d17c6aab4414.svg\";","export default __webpack_public_path__ + \"media/img/primary-bottom-73fc22acbc1770e6569d5461c866558b.svg\";","export default __webpack_public_path__ + \"media/img/primary-desktop-22e8a1ef75cabe3187cafc4295626989.svg\";","export default __webpack_public_path__ + \"media/img/primary-left-58f0abdf1a40a975c669322621df0c46.svg\";","export default __webpack_public_path__ + \"media/img/primary-c7e334e7f245350fc2fa5dd5fe7ce6a3.svg\";","export default __webpack_public_path__ + \"media/img/primary_small-f56b38ccbca264016d45778125fa6647.svg\";","module.exports = \"data:image/jpeg;base64,ZXhwb3J0IGRlZmF1bHQgX193ZWJwYWNrX3B1YmxpY19wYXRoX18gKyAibWVkaWEvaW1nL3Jlc2lkZW5jZS1zbGlkZS0xNzFlZjYwMWE4MWQ1NGVlM2EyMTgxN2Q3ODBhNWRkYi5qcGciOw==\"","export default __webpack_public_path__ + \"media/img/secondary-3cfb477a97972bc454e01e0dadd2c15b.svg\";","export default __webpack_public_path__ + \"media/img/secondary_white-ec877c742ce16eec5a524384251e7a91.svg\";","module.exports = \"data:image/png;base64,ZXhwb3J0IGRlZmF1bHQgX193ZWJwYWNrX3B1YmxpY19wYXRoX18gKyAibWVkaWEvaW1nL3N0ZXBzLWFjdGlvbnMtYmctOTkyOTY1ZmE4YWFiYjBiNWRiMGU2OTQ0ZDdmYmI5YzkucG5nIjs=\"","module.exports = \"data:image/png;base64,ZXhwb3J0IGRlZmF1bHQgX193ZWJwYWNrX3B1YmxpY19wYXRoX18gKyAibWVkaWEvaW1nL3N0cmlwZV9jb25uZWN0X2FjY291bnQtNjU4ZmMzZmRhNGY1NGFiMjg4ZjZhNDQyNWFkM2I5YzQucG5nIjs=\"","module.exports = \"data:image/jpeg;base64,ZXhwb3J0IGRlZmF1bHQgX193ZWJwYWNrX3B1YmxpY19wYXRoX18gKyAibWVkaWEvaW1nL3Rlc3QtNTg3NjdhMDg5ZTcwN2ZjNjQyZDJkMjIzNmI2MmViOGMuanBnIjs=\"","export default __webpack_public_path__ + \"media/img/white-logo-58a31bfcbc668fd0153750e4794b6206.svg\";","var map = {\n\t\"./Event-Planning-Checklist\": \"./app/javascript/media/Event-Planning-Checklist.pdf\",\n\t\"./Event-Planning-Checklist.pdf\": \"./app/javascript/media/Event-Planning-Checklist.pdf\",\n\t\"./Vendor-Proposal-Template-Muuchit\": \"./app/javascript/media/Vendor-Proposal-Template-Muuchit.pdf\",\n\t\"./Vendor-Proposal-Template-Muuchit.pdf\": \"./app/javascript/media/Vendor-Proposal-Template-Muuchit.pdf\"\n};\n\n\nfunction webpackContext(req) {\n\tvar id = webpackContextResolve(req);\n\treturn __webpack_require__(id);\n}\nfunction webpackContextResolve(req) {\n\tif(!__webpack_require__.o(map, req)) {\n\t\tvar e = new Error(\"Cannot find module '\" + req + \"'\");\n\t\te.code = 'MODULE_NOT_FOUND';\n\t\tthrow e;\n\t}\n\treturn map[req];\n}\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = \"./app/javascript/media sync recursive ^\\\\.\\\\/.*$\";","module.exports = \"data:application/pdf;base64,ZXhwb3J0IGRlZmF1bHQgX193ZWJwYWNrX3B1YmxpY19wYXRoX18gKyAibWVkaWEvbWVkaWEvRXZlbnQtUGxhbm5pbmctQ2hlY2tsaXN0LWQyYTk2M2I2M2ViMmFhMWZkMDZkN2ViYzJlYmZjZTZjLnBkZiI7\"","module.exports = \"data:application/pdf;base64,ZXhwb3J0IGRlZmF1bHQgX193ZWJwYWNrX3B1YmxpY19wYXRoX18gKyAibWVkaWEvbWVkaWEvVmVuZG9yLVByb3Bvc2FsLVRlbXBsYXRlLU11dWNoaXQtYWIxMmY3MmU0OWUxYzA3MGY4MzJlNDc0OGNjMTY3YTUucGRmIjs=\"","export const {\n DOC,\n BODY,\n WINDOW,\n\n ISACTIVE,\n ISOPEN,\n ISHIDDEN,\n ISFIXED,\n ISERROR\n} = {\n WINDOW: $(window),\n DOC: $(document),\n BODY: $('body'),\n\n ISACTIVE: 'is-active',\n ISHIDDEN: 'is-hidden',\n ISOPEN: 'is-open',\n ISFIXED: 'is-fixed',\n ISERROR: 'is-error'\n};\n","// v1 scripts\nimport { accordion } from './components/accordion.js';\nimport { counter } from './components/counter.js';\nimport { downloadPdf } from './components/downloadPdf';\nimport { forbidAllCaps } from './components/forbidAllCaps';\nimport { loading } from './components/loading.js';\nimport { onlyNumbers } from './components/onlyNumbers.js';\nimport { setTextareaHeight } from './components/setTextareaHeight.js';\nimport { sharePopup } from './components/sharePopup.js';\nimport { showMore } from './components/showMore.js';\nimport { storeMessageContent } from './components/storeMessageContent';\nimport { submitFormStatus } from './components/submitFormStatus.js';\nimport { submitSearchChatForm } from './components/submitSearchChatForm.js';\nimport { timeZoneDetector } from './components/timeZoneDetector';\nimport { togglePayout } from './components/togglePayout.js';\nimport { validateEmptyMessage } from './components/validateEmptyMessage.js';\nimport { viewportHeight } from './components/viewportHeight.js';\n\n// v2 scripts\nimport './components/customSelect.js';\nimport './components/customSelectTabs.js';\nimport { additionalFilters } from './components/additionalFilters.js';\nimport { addressAutocomplete } from './components/addressAutocomplete.js';\nimport { benefitingShowMission } from './components/benefitingShowMission';\nimport { bookingCountdown } from './components/bookingCountdown';\nimport { calculateBookingPrice } from './components/datepicker/calculateBookingPrice.js';\nimport { checkboxToggle } from './components/checkboxToggle.js';\nimport { checkSelectFilled } from './components/checkSelectFilled.js';\nimport { clickFunctions } from './components/clickFunc.js';\nimport { copyLink } from './components/copyLink.js';\nimport { datePicker } from './components/datepicker/datePicker.js';\nimport { datePickerBooking } from './components/datepicker/datePickerBooking.js';\nimport { datePickerBookingToggle } from './components/datepicker/datePickerBookingToggle.js';\nimport { emailSubscription } from './components/emailSubscription.js';\nimport { expander } from './components/expander.js';\nimport { feedback } from './components/feedback';\nimport { filteringDropDown } from './components/filteringDropDown.js';\nimport { fixedHeaderOnScroll } from './components/fixedHeaderOnScroll.js';\nimport { infoModal } from './components/infoModal.js';\nimport { initMap } from './components/initMap.js';\nimport { initStripe } from './components/initStripe';\nimport { initVideos } from './components/initVideos.js';\nimport { inputDropdown } from './components/inputDropdown.js';\nimport { mailchimp } from './components/mailchimp.js';\nimport { mainSearch } from './components/mainSearch.js';\nimport { mask } from './components/mask';\nimport { passwordInput } from './components/passwordInput.js';\nimport { payments } from './components/payments.js';\nimport { popups } from './components/popup.js';\nimport { reCAPTCHA } from './components/reCAPTCHA.js';\nimport { reinitVideoPopup } from './components/reinitVideoPopup.js';\nimport { showFilters } from './components/showFilters.js';\nimport { showMoreReviews } from './components/showMoreReviews.js';\nimport { sliders } from './components/slider.js';\nimport { tabs } from './components/tabs.js';\nimport { textareaCounter } from './components/textareaCounter.js';\nimport { toggleContent } from './components/toggleContent.js';\nimport { toggleMapSwitch } from './components/toggleMapSwitch.js';\nimport { toggleWishList } from './components/toggleWishList.js';\nimport { validateBenefiting } from './components/validateBenefiting';\nimport { ValidationForm } from './components/ValidationForm.js';\nimport { video } from './components/video.js';\n\n$(document).ready(() => {\n $(function() {\n// v1 scripts\n accordion();\n counter();\n downloadPdf();\n forbidAllCaps();\n loading();\n onlyNumbers();\n setTextareaHeight();\n sharePopup();\n showMore();\n storeMessageContent();\n submitFormStatus();\n submitSearchChatForm();\n timeZoneDetector();\n togglePayout();\n validateEmptyMessage();\n viewportHeight();\n\n// v2 scripts\n additionalFilters();\n addressAutocomplete();\n benefitingShowMission();\n bookingCountdown();\n calculateBookingPrice();\n checkboxToggle();\n checkSelectFilled();\n clickFunctions();\n copyLink();\n datePicker();\n datePickerBooking();\n datePickerBookingToggle();\n emailSubscription();\n expander();\n feedback();\n filteringDropDown();\n fixedHeaderOnScroll();\n infoModal();\n initStripe();\n initVideos();\n inputDropdown();\n mailchimp();\n mainSearch();\n mask();\n passwordInput();\n payments();\n popups();\n reinitVideoPopup();\n showFilters();\n showMoreReviews();\n sliders();\n tabs();\n textareaCounter();\n toggleContent();\n toggleMapSwitch();\n toggleWishList();\n validateBenefiting();\n ValidationForm();\n video();\n });\n});\n\nwindow.reCAPTCHA = reCAPTCHA;\n","export const ValidationForm = () => {\n const target = $('.js-validator-email');\n\n if (target.length) {\n $.validator.addMethod('emailExt', value => {\n const patternEmail = /^[A-z0-9._%+-]+@[A-z0-9.-]+\\.[A-z]{2,4}$/.test(value);\n return patternEmail;\n }, 'Please enter valid E-mail');\n $('.js-validation').each((i, el) => {\n $(el).validate({\n errorElement: 'div',\n errorPlacement: (error, element) => {\n if (element.is(':checkbox')) {\n error.insertAfter(element.parent()).addClass('error-checkbox');\n } else {\n error.insertAfter(element);\n }\n },\n });\n });\n\n target.rules('add', {\n emailExt: true,\n });\n }\n};\n","import { ISOPEN } from '../_constants';\n\nexport function accordion() {\n let accordionToggle = $('.js-toggle-accordion');\n let accordions = $(accordionToggle).closest('.js-accordions').find('.js-accordion-item');\n\n $(accordionToggle).on('click', function() {\n var currentItem = $(this).closest('.js-accordion-item');\n var currentContent = $(this).closest('.js-accordion-item').find('.js-accordion-content');\n $(accordions).find('.js-accordion-content').not(currentContent).slideUp();\n $(accordions).not(currentItem).removeClass(ISOPEN);\n $(currentItem).toggleClass(ISOPEN);\n $(currentContent).slideToggle();\n return false;\n });\n}\n","export function additionalFilters() {\n let additionalFilter = $('.js-additional-filter');\n\n if (additionalFilter.length > 0) {\n let showFiltersBtn = $('.js-additional-filters-btn');\n\n showFiltersBtn.on('click', () => {\n if (additionalFilter.hasClass('hidden')) {\n additionalFilter.removeClass('hidden');\n showFiltersBtn.text('Hide Filters');\n } else {\n additionalFilter.addClass('hidden');\n showFiltersBtn.text('Show Filters');\n }\n });\n\n let locationInput = $('.js-filter-location');\n let radiusInput = $('.js-filter-radius');\n\n const isRadiusDisabled = () => {\n if (locationInput.val().length === 0) {\n radiusInput.val('');\n locationInput.addClass('active').attr('placeholder', 'Please fill this field').focus();\n }\n };\n\n radiusInput.on('input', () => {\n isRadiusDisabled();\n });\n\n locationInput.on('input', () => {\n locationInput.removeClass('active').attr('placeholder', 'Fort Lauderdale, FL');\n })\n }\n}\n","export function addressAutocomplete() {\n let autocomplete = $('.js-geocomplete');\n\n if (autocomplete.length > 0) {\n autocomplete.each(function () {\n let $this = $(this)\n\n let latInput = $this.parent().find('.js-geocomplete-lat');\n let lngInput = $this.parent().find('.js-geocomplete-lng');\n let cityInput = $this.parent().find('.js-geocomplete-city');\n let stateInput = $this.parent().find('.js-geocomplete-state');\n let searchBox = new google.maps.places.SearchBox(this);\n\n $this.on('click', () => {\n if (latInput.val().length > 0 && lngInput.val().length > 0 || $this.val().length > 0) {\n $this.val('')\n latInput.val('')\n lngInput.val('')\n cityInput.val('')\n stateInput.val('')\n }\n });\n\n autocomplete.on('keyup', e => {\n if(e.which === 13) {\n if (latInput.val().length === 0 && lngInput.val().length === 0) {\n e.preventDefault()\n } else {\n autocomplete.closest('form').submit()\n }\n }\n });\n\n searchBox.addListener('places_changed', function () {\n\n let placesResult = searchBox.getPlaces();\n\n if (placesResult.length === 0) return;\n\n let typesResult = []\n let places = placesResult[0]\n\n latInput.val(places.geometry.location.lat());\n lngInput.val(places.geometry.location.lng());\n\n // create array of types as key and places.address_components index as value\n places.address_components.map((item, index) => {\n typesResult[item.types[0]] = index\n })\n\n // set values to state or/and city\n if (places.types[0] === 'administrative_area_level_1') {\n stateInput.val(places.address_components[typesResult['administrative_area_level_1']].short_name)\n } else if (places.types[0] === 'locality') {\n cityInput.val(places.address_components[typesResult['locality']].long_name)\n } else {\n stateInput.val('')\n cityInput.val('')\n }\n });\n });\n }\n}\n","export function benefitingShowMission() {\n let missionEl = $('.js-benefiting-mission');\n\n if (missionEl.length) {\n let missions = missionEl.data('missions');\n\n $('.js-select').on('custom-select:change', function () {\n missionEl.html(missions[+$(this).find('option:selected').val()])\n });\n }\n}\n","import { BODY, WINDOW, ISHIDDEN } from '../_constants';\n\nexport function addBodyHidden() {\n sessionStorage.scrollTop = WINDOW.scrollTop();\n BODY.addClass(ISHIDDEN);\n BODY.css('top', - sessionStorage.scrollTop + 'px' );\n}\n\nexport function removeBodyHidden() {\n let bodyFromTop = parseInt(BODY.css('top'), 10) * -1;\n\n WINDOW.scrollTop(bodyFromTop);\n BODY.css('top', 0);\n}\n","import Cookies from 'js-cookie';\nimport { env } from '../envVariables.js.erb';\n\nexport const bookingCountdown = () => {\n const countdownEl = $('.js-countdown');\n\n if (countdownEl.length > 0) {\n const countdownTime = env.INITIAL_BOOKING_EXPIRATION_TIME_IN_MINUTES > 9\n ? env.INITIAL_BOOKING_EXPIRATION_TIME_IN_MINUTES\n : '0' + env.INITIAL_BOOKING_EXPIRATION_TIME_IN_MINUTES;\n const targetMinutes = countdownEl.find('.js-countdown-minutes');\n const targetSeconds = countdownEl.find('.js-countdown-seconds');\n const choicePopup = $('[data-popup=\"checkout\"]');\n const newBookingPopup = $('[data-popup=\"cancel-booking\"]');\n const resetTimerBtn = choicePopup.find('.js-countdown-reset-timer');\n const cancelBookingBtn = $('.js-cancel-booking');\n const deleteBookingPath = cancelBookingBtn.data('delete-booking-path');\n const redirectBookingPath = cancelBookingBtn.data('redirect');\n const bookingId = +resetTimerBtn.data('booking-id');\n const extendBookingPath = resetTimerBtn.data('extend-booking-path');\n let isExtended = resetTimerBtn.data('is-extended');\n const cookieTimerStarted = 'timer-start-time-for-id-' + bookingId;\n\n function showChoicePopup() {\n choicePopup.show()\n }\n\n function showNewBookingPopup() {\n printNumber(0, targetSeconds);\n choicePopup.remove();\n newBookingPopup.show()\n }\n\n function printNumber(time, targetElement) {\n targetElement.text(time > 9 ? time : '0' + time);\n }\n\n // Update the count down every 1 second\n function Counter() {\n let counter = setInterval(() => {\n\n // check if we have first visit time written to Cookies\n if (!Cookies.get(cookieTimerStarted)) {\n Cookies.set(cookieTimerStarted, Date.now(), { expires: 1 });\n }\n\n const timerStarted = Cookies.get(cookieTimerStarted);\n let countdownTimerTime = Date.parse('1970-01-01T00:' + countdownTime + ':00Z');\n let countdownDateTime = +timerStarted + +countdownTimerTime;\n let now = Date.now();\n\n if (now < countdownDateTime) {\n\n // Find the remaining milliseconds between now an the count down date\n let remainingMilliseconds = countdownDateTime - now;\n\n // Time calculations for minutes and seconds\n let minutes = Math.floor((remainingMilliseconds % (1000 * 60 * 60)) / (1000 * 60));\n let seconds = Math.floor((remainingMilliseconds % (1000 * 60)) / 1000);\n\n printNumber(minutes, targetMinutes);\n printNumber(seconds, targetSeconds);\n\n if (minutes === 0 && seconds === 0) {\n showNewBookingPopup();\n deleteBooking();\n } else if (minutes < 3 && !isExtended) {\n showChoicePopup();\n } else if (minutes < 5) {\n countdownEl.addClass('warning');\n } else {\n countdownEl.removeClass('warning');\n }\n\n // If the count down is finished, delete the button\n if (remainingMilliseconds < 0) {\n clearInterval(counter);\n }\n\n } else {\n clearInterval(counter);\n showNewBookingPopup();\n }\n }, 1000);\n }\n\n resetTimerBtn.on('click', e => {\n e.preventDefault();\n\n if (!isExtended) {\n $.ajax({\n type: 'put',\n url: extendBookingPath,\n contentType: \"text/plain\",\n data: {\n id: bookingId\n },\n success: () => {\n Cookies.remove(cookieTimerStarted);\n Counter();\n isExtended = true;\n choicePopup.fadeOut(200);\n },\n error: () => {\n console.log('=====', 'error');\n },\n })\n }\n });\n\n cancelBookingBtn.on('click', e => {\n e.preventDefault();\n\n $.ajax({\n type: 'delete',\n url: deleteBookingPath,\n contentType: \"text/plain\",\n data: {\n id: bookingId\n },\n success: () => {\n window.location.href = redirectBookingPath;\n },\n error: () => {\n console.log('=====', 'error');\n },\n })\n });\n\n function deleteBooking() {\n $.ajax({\n type: 'delete',\n url: deleteBookingPath,\n contentType: \"text/plain\",\n data: {\n id: bookingId\n },\n success: () => {\n console.log('-----', 'success');\n },\n error: () => {\n console.log('=====', 'error');\n },\n })\n }\n\n Counter();\n }\n};\n","import { ISACTIVE } from '../_constants';\n\nexport function checkSelectFilled() {\n// let mainBlock = $('.js-booking-request');\n//\n// let datepickerInputs = $('.js-datepicker-value').find('input');\n// let dropdowns = mainBlock.find('.custom-select__list');\n// let requestTimeToggle = $('.js-toggle-time-selects');\n//\n//\n// dropdowns.on('click', function() {\n// let selectsBlock = $(this).closest(mainBlock);\n// checkSelected(selectsBlock);\n// });\n// datepickerInputs.on('change', function() {\n// let selectsBlock = $(this).closest(mainBlock);\n// checkSelected(selectsBlock);\n// });\n//\n// requestTimeToggle.on('click', function() {\n// let btnAttr = $(this).attr('data-select-time-target');\n// requestTimeToggle.addClass(ISACTIVE);\n// $(this).removeClass(ISACTIVE);\n// let selectsBlock = $(this).closest(mainBlock).find('.js-check-select-values');\n// let thisBlock = $(this).closest(mainBlock);\n// selectsBlock.each(function() {\n// let selectBlocksAttr = $(this).attr('data-select-time');\n// if(selectBlocksAttr === btnAttr) {\n// selectsBlock.removeClass(ISACTIVE);\n// $(this).addClass(ISACTIVE);\n// }\n// });\n// checkSelected(thisBlock);\n// });\n// }\n//\n// function checkSelected(thisBlock) {\n//\n// let requestBtn = $('.js-request-btn');\n// let pricingBlock = $('.js-show-cost');\n// let selects = $(thisBlock).find('.js-check-select-values.is-active').find('select');\n//\n// let datepickers = $(thisBlock).find('.js-check-select-values.is-active').find('.js-datepicker-value');\n// let selectedArr = [];\n// selects.each(function() {\n// let allSelected = $(this).find('option:selected').attr('selected');\n// if(allSelected !== undefined) {\n// selectedArr.push(allSelected);\n// }\n// });\n//\n// datepickers.each(function() {\n// let dateInputs = $(this).find('input').eq(0).val();\n// if(dateInputs.length !== 0) {\n// selectedArr.push(dateInputs);\n// }\n// });\n//\n//\n// if(selectedArr.length === (selects.length + datepickers.length)) {\n// requestBtn.removeClass('is-disabled');\n// requestBtn.prop('disabled', false);\n// pricingBlock.addClass('is-shown');\n// } else {\n// requestBtn.addClass('is-disabled');\n// requestBtn.prop('disabled', true);\n// pricingBlock.removeClass('is-shown');\n// }\n}\n\n","\nexport function isElementInViewport(el) {\n if (typeof jQuery === 'function' && el instanceof jQuery) {\n el = el[0];\n }\n if(el.length > 0) {\n var rect = el.getBoundingClientRect();\n return (\n rect.top >= 0 &&\n rect.left >= 0 &&\n rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && /*or $(window).height() */\n rect.right <= (window.innerWidth || document.documentElement.clientWidth) /*or $(window).width() */\n );\n }\n}\n","export function checkboxToggle() {\n\n function toggleCheckBox(el) {\n let checkbox = $(el).closest('.checkbox').find('input[type=checkbox]');\n let input_value = $(el).val()\n if(input_value.length > 0) {\n $(checkbox).prop('checked', true);\n $(checkbox).prop('value', input_value);\n } else {\n $(checkbox).prop('checked', false);\n }\n }\n\n const checkboxes = [].slice.call(document.querySelectorAll('.js-checkbox-input'));\n \n checkboxes.forEach(function(el) {\n\n el.addEventListener('input', function() {\n toggleCheckBox(el);\n }, false);\n \n });\n}\n","import { ISOPEN, BODY, ISHIDDEN } from '../_constants';\nimport { addBodyHidden, removeBodyHidden } from './bodyHiddenPosition.js';\n\nexport function clickFunctions() {\n let burger = $('.js-burger');\n let nav = $('.js-nav');\n let sidebar = $('.js-sidebar');\n\n $(burger).on('click', function() {\n if($(this).hasClass(ISOPEN)) {\n $(this).removeClass(ISOPEN);\n $(nav).removeClass(ISOPEN);\n $(sidebar).removeClass(ISOPEN);\n BODY.removeClass(ISHIDDEN);\n $(nav).slideUp(300);\n removeBodyHidden();\n } else {\n $(this).addClass(ISOPEN);\n $(sidebar).addClass(ISOPEN);\n $(nav).addClass(ISOPEN);\n $(nav).slideDown(300);\n addBodyHidden();\n }\n });\n\n let scrollTimeout;\n const throttle = 500;\n $(window).on('resize', function() {\n if (!scrollTimeout) {\n scrollTimeout = setTimeout(function() {\n if(burger.hasClass(ISOPEN)) {\n if (window.matchMedia('(min-width: 767px)').matches) {\n BODY.removeClass(ISHIDDEN);\n } else {\n BODY.addClass(ISHIDDEN);\n }\n }\n scrollTimeout = null;\n }, throttle);\n }\n });\n\n}\n","import { ISOPEN } from '../_constants';\nimport { copyToClipboard } from './copyToClipBoard.js';\n\nexport function copyLink() {\n let openCopyBtn = $('.js-copy-btn-open');\n let copyBlock = $('.js-copy-link');\n let copyLinkMessage = $('.js-copy-link-message');\n let copyText = copyBlock.find('.js-copy-text');\n let copyLink = copyBlock.find('.js-copy-text-btn');\n\n openCopyBtn.on('click', function(e) {\n e.preventDefault();\n copyBlock.addClass(ISOPEN);\n });\n copyLink.on('click', function(e) {\n e.preventDefault(); \n copyToClipboard(copyText[0]);\n copyLinkMessage.css('display', 'block');\n\n setTimeout(function () {\n copyLinkMessage.css('display', 'none');\n }, 5000);\n\n });\n \n}\n","export function copyToClipboard(selector) {\n if (document.selection) { \n var range = document.body.createTextRange();\n range.moveToElementText(selector);\n range.select().createTextRange();\n document.execCommand('copy'); \n\n } else if (window.getSelection) {\n var range = document.createRange();\n range.selectNode(selector);\n window.getSelection().removeAllRanges();\n window.getSelection().addRange(range);\n document.execCommand('copy');\n }}\n","export function counter() {\n let counters = $('.js-counter');\n let increment = $(counters).find('.js-counter-increment');\n let decrement = $(counters).find('.js-counter-decrement');\n var timer = 1;\n var timerInterval;\n let amountInput = counters.find('.js-counter-amount-input');\n let allowedMinHour = +counters.data('allowed-min-hour');\n let errorBlock = $('.js-counter-error');\n\n if (amountInput.val()) {\n $('.js-counter-amount').text(amountInput.val())\n } else {\n amountInput.val(0);\n $('.js-counter-amount').text(0);\n }\n\n /***** increment *****/\n $(increment).on('click', function() {\n let amountBlock = $(this).siblings('.js-counter-amount');\n incrementCounter(amountBlock);\n });\n\n $(increment).on('mousedown', function() {\n let amountBlock = $(this).siblings('.js-counter-amount');\n timerInterval = setInterval(function() {\n incrementCounter(amountBlock);\n }, 300);\n });\n\n $(increment).on('mouseup', function() {\n clearInterval(timerInterval);\n timer = 1;\n });\n /*******************/\n\n\n /***** decrement *****/\n $(decrement).on('click', function() {\n let amountBlock = $(this).siblings('.js-counter-amount');\n decrementCounter(amountBlock);\n });\n\n $(decrement).on('mousedown', function() {\n let amountBlock = $(this).siblings('.js-counter-amount');\n timerInterval = setInterval(function() {\n decrementCounter(amountBlock);\n }, 300);\n });\n\n $(decrement).on('mouseup', function() {\n clearInterval(timerInterval);\n timer = 0;\n });\n /*******************/\n\n $(document).on('mouseup', function() {\n clearInterval(timerInterval);\n timer = 1;\n });\n\n function incrementCounter(el) {\n $('.counter__wrapper .field__error-message').css('display', 'none');\n let amount = parseInt($(el).text());\n if(amount >= 0) {\n if (amount === allowedMinHour) {\n errorBlock.html('Minimal Rental Hours cannot be more than minimum venue availability hours noted in previous screen');\n return;\n }\n amount += 1;\n $(el).text(amount);\n amountInput.val(amount);\n errorBlock.html('');\n } else {\n return;\n }\n }\n function decrementCounter(el) {\n let amount = parseInt($(el).text());\n if(amount > 0) {\n if (amount === 1) {\n return;\n }\n amount -= 1;\n $(el).text(amount);\n amountInput.val(amount);\n errorBlock.html('');\n } else {\n return;\n }\n }\n}\n","import { BODY } from '../_constants';\nexport default class Select {\n constructor(config) {\n this.elem = $(config);\n this.options = this.elem.find('option');\n this.init();\n }\n init() {\n this._createWrapper();\n this._createElement();\n this._show();\n this._hide();\n this._placeholder();\n this._change();\n this._icon();\n // this._setLabel();\n }\n _createWrapper() {\n if (!this._parent.hasClass(Select.classes.wrapper)) {\n this.elem.wrap(`
`);\n }\n }\n get _parent() {\n return this.elem.closest(`.${Select.classes.wrapper}`);\n }\n get _fieldText() {\n return this._parent.find(`.${Select.classes.text}`);\n }\n // generate elements for custom select\n _createElement() {\n let selectedArray = [];\n this._parent.append(``);\n this._parent.find(`.${Select.classes.field}`).append(``);\n this._parent.append(``);\n this._parent.find(`.${Select.classes.dropdown}`).append(`
`);\n this.options.each((i, elem) => {\n let optionLabel = $(elem).html();\n let value = $(elem).val();\n this._parent.find(`.${Select.classes.list}`).append(`
${optionLabel}
`);\n\n if (elem.getAttribute('selected')) {\n this._parent.find(`.${Select.classes.list} li`).eq(i).addClass(Select.classes.active);\n selectedArray.push(1);\n }\n\n if (elem.disabled) {\n this._parent.find(`.${Select.classes.list} li`).eq(i).addClass(Select.classes.disabled);\n }\n\n });\n\n if (selectedArray.length === 0) {\n this._parent.find(`.${Select.classes.list} li`).eq(0).addClass(Select.classes.active);\n this.options.eq(0).attr('selected', true);\n }\n }\n get _children() {\n return this._parent.find('li');\n }\n get _field() {\n return this._parent.find(`.${Select.classes.field}`);\n }\n // show dropdown\n _show() {\n this._field.on('click', () => {\n if(!this._parent.hasClass(Select.classes.open)) {\n $(`.${Select.classes.wrapper}`).removeClass(Select.classes.open);\n this._parent.addClass(Select.classes.open);\n } else {\n this._parent.removeClass(Select.classes.open);\n }\n });\n }\n // close dropdown\n _hide() {\n BODY.click((e) => {\n if (!$(e.target).closest(`.${Select.classes.wrapper}`).length) {\n $(`.${Select.classes.wrapper}`).removeClass(Select.classes.open);\n }\n });\n }\n // generate text for select input field\n _placeholder() {\n let selectedArray = [];\n this.options.each((i, elem) => {\n if (elem.getAttribute('selected')) {\n this._parent.find(`.${Select.classes.text}`).text(this.options.eq(i).text()).addClass('is-placeholder');\n selectedArray.push(1);\n }\n });\n\n if (selectedArray.length === 0) {\n this._parent.find(`.${Select.classes.text}`).text(this.options.eq(0).text()).addClass('is-placeholder');\n }\n }\n // change attributes after clicked option\n _change() {\n this._children.on('click', (e) => {\n let that = $(e.currentTarget);\n let text = that.text();\n let data_value = that.data('value');\n let index = that.index();\n if (!that.hasClass('disabled')) {\n that.addClass(Select.classes.active).siblings().removeClass(Select.classes.active);\n this.options.eq(index)\n .attr('selected', true)\n .val(data_value)\n .siblings()\n .removeAttr('selected')\n .trigger('custom-select:change')\n this._fieldText.html(text);\n this._fieldText.removeClass('is-placeholder');\n this._parent.removeClass(Select.classes.open);\n if(index === 0) {\n this._parent.find(`.${Select.classes.text}`).addClass('is-placeholder');\n } else {\n this._parent.find(`.${Select.classes.text}`).removeClass('is-placeholder');\n }\n }\n });\n }\n _icon() {\n if(this.elem.data('icon')) {\n let iconName = this.elem.data('icon');\n let iconHtml = ``;\n this._parent.find(`.${Select.classes.field}`).append(iconHtml);\n }\n }\n _setLabel() {\n let arrSearch = window.location.search.split('?');\n var params = [];\n\n if (arrSearch[1]) {\n let arrParams = arrSearch[1].split('&');\n\n $.each(arrParams, function(index, param){\n let keyValue = param.split('=')\n params.push({selectId: keyValue[0], value: keyValue[1]});\n });\n }\n\n let options = $(this.elem).find('option');\n if (params.length) {\n options.each(function () {\n for (let i = 0; i < params.length; i++) {\n let id = $(this).closest('.js-select').attr('id');\n let value = this.value;\n let text = this.text;\n\n if (value === params[i].value && id === params[i].selectId) {\n $(this)\n .attr('selected', true)\n .val(value)\n .text(text)\n .siblings()\n .removeAttr('selected')\n $(this).closest('.js-select')\n .siblings(`.${Select.classes.field}`)\n .find(`.${Select.classes.text}`)\n .html(text);\n let listItem = $(this).closest(`.${Select.classes.wrapper}`).find('li');\n listItem.each(function () {\n if ($(this).text() === text) {\n $(this).addClass(Select.classes.active).siblings().removeClass(Select.classes.active);\n }\n });\n }\n }\n });\n }\n }\n}\nSelect.classes = {\n wrapper: 'custom-select',\n field: 'custom-select__field',\n text: 'custom-select__text',\n dropdown: 'custom-select__dropdown',\n list: 'custom-select__list',\n active: 'is-active',\n open: 'is-open',\n disabled: 'disabled'\n};\n$.fn.customSelect = function() {\n this.each((i, el) => new Select($(el)));\n return this;\n};\n\n$('.js-select').customSelect();\n","import { BODY } from '../_constants';\nclass SelectTabs {\n constructor(config) {\n this.elem = $(config);\n this.options = this.elem.find('option');\n this.init();\n }\n init() {\n this._createWrapper();\n this._createElement();\n this._change();\n }\n _createWrapper() {\n this.elem.wrap(``);\n }\n get _parent() {\n return this.elem.closest(`.${SelectTabs.classes.wrapper}`);\n }\n \n // generate elements for custom select\n _createElement() {\n let self = this;\n this._parent.append(`
`);\n this.options.each((i, elem) => {\n let optionValue = $(elem).html();\n this._parent.find(`.${SelectTabs.classes.list}`).append(`
${optionValue}
`);\n this._parent.find(`.${SelectTabs.classes.list} li`).eq(Math.floor(self.options.length/2)).addClass(SelectTabs.classes.active);\n });\n }\n get _children() {\n return this._parent.find('li');\n }\n \n // change attributes after clicked option\n _change() {\n this._children.on('click', (e) => {\n let that = $(e.currentTarget);\n let index = that.index();\n that.addClass(SelectTabs.classes.active).siblings().removeClass(SelectTabs.classes.active);\n this.options.eq(index)\n .attr('selected', true)\n .siblings()\n .removeAttr('selected');\n });\n }\n \n}\nSelectTabs.classes = {\n wrapper: 'custom-select-tabs',\n dropdown: 'custom-select-tabs__dropdown',\n list: 'custom-select-tabs__list',\n active: 'is-active'\n};\n$.fn.customSelectTabs = function() {\n this.each((i, el) => new SelectTabs($(el)));\n return this;\n};\n\n$('.js-select-tabs').customSelectTabs();\n","import { createDateRange } from './createDateRange';\nimport { dataDaysWithMultipleRanges } from './selectors';\n\nexport function calculateBookingPrice() {\n let priceWrap = $('.js-price-wrap');\n let priceDesc = priceWrap.find('.js-price-desc');\n let priceSumEl = priceWrap.find('.js-price-sum');\n let priceDiscountWrap = priceWrap.find('.js-price-discount-wrap');\n let priceDiscountEl = priceWrap.find('.js-price-discount');\n let pricePersonalDiscountWrap = priceWrap.find('.js-price-personal-discount-wrap');\n let pricePersonalDiscountEl = priceWrap.find('.js-price-personal-discount');\n let priceCleaningWrap = priceWrap.find('.js-price-cleaning-wrap');\n let priceCleaningEl = priceWrap.find('.js-price-cleaning');\n let priceTotalEl = priceWrap.find('.js-price-total');\n let submitBtn = $('.js-request-btn');\n\n let datepickerDataInput = $('input.datepicker-data');\n let dataDisabledDates = datepickerDataInput.data('disabled-dates') ? datepickerDataInput.data('disabled-dates') : [new Date()];\n let dataDisabledDaysOfWeek = datepickerDataInput.data('disabled-days') ? datepickerDataInput.data('disabled-days') : [];\n\n// vars for getting selected data\n let bookingForm = $('.js-booking-form');\n let bookingFormStartDate = bookingForm.find('.js-form-start-date');\n let bookingFormEndDate = bookingForm.find('.js-form-end-date');\n let bookingFormFromTime = bookingForm.find('.js-form-from-time');\n let bookingFormToTime = bookingForm.find('.js-form-to-time');\n let bookingFormType = bookingForm.find('.js-form-type');\n\n// initial venue numbers\n let discountPercent = +bookingForm.data('discount') || 0;\n let personalDiscountPercent = +bookingForm.data('private-discount') || 0;\n let fullDayRate = +bookingForm.data('full-day-rate') || 0;\n let fullDayRateWizard = +bookingForm.data('full-day-rate-wizard') || 0;\n let hourlyRate = +bookingForm.data('hourly-rate');\n let hourlyRateWizard = +bookingForm.data('hourly-rate-wizard');\n let cleaningFee = +bookingForm.data('cleaning-fee') || 0;\n\n let startDate, endDate, fromTime, toTime, type;\n\n if (discountPercent === 0) {\n priceDiscountWrap.css('display', 'none');\n }\n if (personalDiscountPercent === 0) {\n pricePersonalDiscountWrap.css('display', 'none');\n }\n if (cleaningFee === 0) {\n priceCleaningWrap.css('display', 'none');\n }\n if (fullDayRate !== 0) {\n $('.js-toggle-time-selects').css('display', 'block');\n }\n\n bookingForm.on('hidden-input-change', function () {\n startDate = bookingFormStartDate.val();\n endDate = bookingFormEndDate.val();\n fromTime = bookingFormFromTime.val();\n toTime = bookingFormToTime.val();\n type = bookingFormType.val();\n\n if (startDate.length && endDate.length && fromTime.length && toTime.length && type.length) {\n calculatePrice();\n priceWrap.addClass('is-shown');\n submitBtn.removeClass('is-disabled').attr('disabled', false);\n } else {\n priceWrap.removeClass('is-shown');\n submitBtn.addClass('is-disabled').attr('disabled', true);\n }\n });\n\n function calculatePrice() {\n let priceSum, discount, personalDiscount, priceTotal;\n\n// calculations for single day\n if (type === 'single') {\n let hoursCount = +toTime - +fromTime;\n hoursCount = hoursCount < 0 ? 0 : hoursCount;\n priceSum = hoursCount * hourlyRate;\n discount = discountPercent * hoursCount * hourlyRateWizard / 100;\n personalDiscount = personalDiscountPercent * hoursCount * hourlyRateWizard / 100;\n priceTotal = priceSum - discount - personalDiscount + cleaningFee;\n\n priceDesc.html(`$${(hourlyRate / 100).toFixed(2)}/hr x ${hoursCount} hour${hoursCount > 1 ? 's' : ''}:`);\n } else {\n let datesArray = createDateRange(startDate, endDate);\n let woDisabledDates = [];\n\n // remove disabled days\n for (let i = 0; i < datesArray.length; i++) {\n if (dataDisabledDates.indexOf(datesArray[i]) === -1 && dataDaysWithMultipleRanges.indexOf(new Date(datesArray[i]).getDay()) === -1) {\n woDisabledDates.push(new Date(datesArray[i]).getUTCDay());\n }\n }\n\n // create array of day indexes to count actual selected number of dates\n let countDaysArray = woDisabledDates;\n for (let i = 0; i < dataDisabledDaysOfWeek.length; i++) {\n countDaysArray = countDaysArray.filter((e) => { return e !== dataDisabledDaysOfWeek[i] })\n }\n\n let daysCount = countDaysArray.length;\n\n priceDesc.html(`$${(fullDayRate / 100).toFixed(2)}/day x ${daysCount} day${daysCount > 1 ? 's' : ''}:`);\n priceSum = fullDayRate * daysCount;\n discount = discountPercent * daysCount * fullDayRateWizard / 100;\n personalDiscount = personalDiscountPercent * daysCount * fullDayRateWizard / 100;\n priceTotal = priceSum - discount - personalDiscount + cleaningFee;\n }\n\n priceSumEl.html(`$${(priceSum / 100).toFixed(2)}`);\n priceDiscountEl.html(`- $${(discount / 100).toFixed(2)}`);\n pricePersonalDiscountEl.html(`- $${(personalDiscount / 100).toFixed(2)}`);\n priceCleaningEl.html(`$${(cleaningFee / 100).toFixed(2)}`);\n priceTotalEl.html(`$${(priceTotal / 100).toFixed(2)}`);\n }\n}","import formatTime from './formatTime';\n\nexport default function createAvailableHoursArray(availables, type, selectedFrom = null, selectedTo = null, range = null) {\n let availablesArrayFrom = [];\n let availablesArrayTo = [];\n let bookingForm = $('.js-booking-form');\n let minHours = +bookingForm.data('min-hours');\n\n availables.map(({ from, to }, index) => {\n availablesArrayFrom[index] = [];\n availablesArrayTo[index] = [];\n\n if (type === 'from-to') {\n let hourFrom = selectedFrom || availables[index].from;\n let hourTo = selectedTo || availables[index].to;\n\n if (range === null) {\n for (let i = from; i <= to; i++) {\n availablesArrayFrom[index].push([i, formatTime(i), !(i + minHours <= hourTo), index]);\n availablesArrayTo[index].push([i, formatTime(i), !(hourFrom + minHours <= i), index])\n }\n } else {\n for (let i = from; i <= to; i++) {\n if (range === index) {\n availablesArrayFrom[index].push([i, formatTime(i), !(i + minHours <= hourTo), index]);\n availablesArrayTo[index].push([i, formatTime(i), !(hourFrom + minHours <= i), index])\n }\n }\n }\n } else {\n if (index === 0) {\n availablesArrayFrom[index].push([from, formatTime(from), false, index])\n availablesArrayTo[index].push([to, formatTime(to), false, index])\n }\n }\n });\n\n return { from: availablesArrayFrom, to: availablesArrayTo }\n}","import Moment from 'moment';\nimport { extendMoment } from 'moment-range';\n\nexport function createDateRange(startDate, endDate) {\n const moment = extendMoment(Moment);\n let range = moment().range(startDate, endDate);\n\n return Array.from(range.by('days')).map(m => m.format('YYYY-MM-DD'));\n}","import flatpickr from 'flatpickr';\nimport moment from 'moment';\n\nexport function datePicker() {\n let currentDate = new Date();\n let endDate = new Date(currentDate.getFullYear() + 2, currentDate.getMonth(), currentDate.getDate());\n let targetInput = $('.js-dates-input');\n let bookedDaysInput = $('.js-booked-dates-input');\n let selectedDates = targetInput.val() ? JSON.parse(targetInput.val()) : [];\n let bookedDays = bookedDaysInput.val() ? JSON.parse(bookedDaysInput.val()) : [];\n\n flatpickr('.js-datepicker', {\n altInput: true,\n inline: true,\n clickOpens: false,\n closeOnSelect: false,\n ignoredFocusElements: [document.body],\n mode: 'multiple',\n minDate: currentDate,\n maxDate: endDate,\n dateFormat: \"Y-m-d\",\n defaultDate: selectedDates,\n disable: bookedDays,\n monthSelectorType: 'static',\n onChange: (e) => {getSelectedDates(e)},\n onDayCreate: (dObj, dStr, fp, dayElem) => {\n if (bookedDays.indexOf(moment(dayElem.getAttribute(\"aria-label\")).format('YYYY-MM-DD')) > -1) {\n dayElem.classList.add('booked')\n }\n }\n });\n\n function formatDate(date) {\n let month, day;\n month = date.getMonth() + 1;\n day = date.getDate();\n\n return date.getFullYear() + '-' + (month > '9' ? month : '0' + month) + '-' + (day > '9' ? day : '0' + day);\n }\n\n // generate selected dates array for multiple choice\n function getSelectedDates(e) {\n selectedDates = e.map((date) => {\n return formatDate(date);\n });\n selectedDates.sort();\n targetInput.val(JSON.stringify(selectedDates));\n }\n}\n","import flatpickr from 'flatpickr';\n\nimport formatDate from './formatDate';\nimport getDayAvailableHours from './getDayAvailableHours';\nimport createAvailableHoursArray from './createAvailableHoursArray';\nimport updateSelect from './updateSelect';\nimport { datesArray } from './getDayAvailableHours';\n\nimport {\n bookingFormStartDate,\n bookingFormEndDate,\n bookingFormType,\n bookingFormFromTime,\n bookingFormToTime,\n currentDate,\n endDate,\n datepickerRow,\n dataDisabledDates,\n dataDaysWithMultipleRanges,\n dataDisabledDaysOfWeek,\n datepickerDataInput\n} from './selectors';\n\nexport function datePickerBooking() {\n function updateHoursInputs(select, targetInput) {\n select.on('custom-select:change', function () {\n let selectedValue = $(this).find('option[selected=\"selected\"]').val();\n targetInput.val(selectedValue).trigger('hidden-input-change');\n });\n }\n\n updateHoursInputs($('.js-select-start-time'), bookingFormFromTime);\n updateHoursInputs($('.js-select-end-time'), bookingFormToTime);\n\n// START TODO needs to be refactored\n let selectsToUpdate = $('.booking-request__row[data-type=\"row-from-to\"]');\n let fromSelect = selectsToUpdate.find('.js-select-start-time');\n let toSelect = selectsToUpdate.find('.js-select-end-time');\n let currentSelectedDate = '';\n\n fromSelect.on('custom-select:change', function () {\n let $this = $(this);\n let to = +$this.children().last().val();\n\n if (+$this.find('option:selected').val().length) {\n let availablesArray = createAvailableHoursArray(datesArray, 'from-to', +$this.find('option:selected').val(), to, +$this.find('option:selected').data('range'));\n updateSelect(toSelect, availablesArray.to);\n\n let optionToBeSelected = toSelect.parent().find(`.custom-select__list li[data-value=\"${+bookingFormToTime.val()}\"]`);\n\n toSelect.parent().find('.custom-select__list li').removeClass('is-active');\n optionToBeSelected.addClass('is-active');\n toSelect.parent().find('.custom-select__text').text(optionToBeSelected.text());\n toSelect.children().removeAttr('selected');\n toSelect.find(`option[value=\"${+bookingFormToTime.val()}\"]`).attr('selected', true);\n }\n });\n\n toSelect.on('custom-select:change', function () {\n let $this = $(this);\n let from = +$this.children().first().val();\n\n if (+$this.find('option:selected').val().length) {\n let availablesArray = createAvailableHoursArray(datesArray, 'from-to', from, +$this.find('option:selected').val(), +$this.find('option:selected').data('range'));\n updateSelect(fromSelect, availablesArray.from);\n\n let optionToBeSelected = fromSelect.parent().find(`.custom-select__list li[data-value=\"${+bookingFormFromTime.val()}\"]`);\n\n fromSelect.parent().find('.custom-select__list li').removeClass('is-active');\n optionToBeSelected.addClass('is-active');\n fromSelect.parent().find('.custom-select__text').text(optionToBeSelected.text());\n fromSelect.children().removeAttr('selected');\n fromSelect.find(`option[value=\"${+bookingFormToTime.val()}\"]`).attr('selected', true);\n }\n });\n\n// END TODO needs to be refactored\n\n let datepickers = [];\n\n// booking card datepicker\n datepickerRow.each(function () {\n let $this = $(this);\n let bookingCard = this.querySelector('.js-datepicker-booking');\n let selectFrom = $this.find('.js-select-start-time');\n let selectTo = $this.find('.js-select-end-time');\n let datepickerType = bookingCard.dataset.type;\n\n datepickers[datepickerType] = initDatepicker(bookingCard, selectFrom, selectTo);\n });\n\n $(window).scroll(function () {\n Object.keys(datepickers).forEach(item => {\n datepickers[item].close();\n });\n });\n\n function initDatepicker(datepickerTarget, selectFrom, selectTo) {\n let datepickerType = datepickerTarget.dataset.type;\n let isTodayAvailable = datepickerDataInput.data('current-day-available');\n let currentDay = datepickerDataInput.data('current-day');\n let flatpickrItem = flatpickr(datepickerTarget, {\n mode: 'single',\n disable: [\n function (date) {\n return (dataDisabledDates.indexOf(formatDate(date)) !== -1 || dataDisabledDaysOfWeek.indexOf(date.getDay()) !== -1)\n ||\n (datepickerType !== 'from-to' && dataDaysWithMultipleRanges.indexOf(date.getDay()) !== -1)\n ||\n (isTodayAvailable === false && currentDay === formatDate(date))\n }\n ],\n minDate: currentDate,\n maxDate: endDate,\n format: 'd-m-Y',\n altFormat: 'm/d/Y',\n altInput: true,\n onOpen: function (selectedDates, dateStr, instance) {\n $(instance.calendarContainer).addClass('flatpickr-booking');\n },\n onChange: (date) => {\n if (date.length) {\n updateDependentDatepicker(date, selectFrom, selectTo, datepickerType);\n $('.js-not-available').css('display', 'none');\n $('.js-reset-hours').on('click', () => {\n updateDependentDatepicker(date, selectFrom, selectTo, datepickerType);\n bookingFormStartDate.val('').trigger('hidden-input-change');\n bookingFormEndDate.val('').trigger('hidden-input-change');\n bookingFormFromTime.val('').trigger('hidden-input-change');\n bookingFormToTime.val('').trigger('hidden-input-change');\n bookingFormType.val('').trigger('hidden-input-change');\n })\n }\n }\n });\n return flatpickrItem;\n }\n\n function updateDependentDatepicker(date, selectFrom, selectTo, datepickerType) {\n if (datepickerType === 'from') {\n datepickers['to'].set('minDate', new Date(date));\n } else if (datepickerType === 'to') {\n datepickers['from'].set('maxDate', new Date(date));\n }\n\n getDayAvailableHours(date, selectFrom, selectTo, datepickerType);\n }\n}\n","let chooseBlock = $('.js-check-select-values');\nlet bookingForm = $('.js-booking-form');\nlet bookingFormStartDate = bookingForm.find('.js-form-start-date');\nlet bookingFormEndDate = bookingForm.find('.js-form-end-date');\nlet bookingFormFromTime = bookingForm.find('.js-form-from-time');\nlet bookingFormToTime = bookingForm.find('.js-form-to-time');\nlet bookingFormType = bookingForm.find('.js-form-type');\n\nlet bookingRowFromTo = $('.booking-request__row[data-type=\"row-from-to\"]');\nlet bookingRowFrom = $('.booking-request__row[data-type=\"row-from\"]');\nlet bookingRowTo = $('.booking-request__row[data-type=\"row-to\"]');\n\nexport function datePickerBookingToggle() {\n $('.js-toggle-time-selects').on('click', function () {\n let $this = $(this);\n let startDate, endDate, fromTime, toTime;\n let type;\n chooseBlock.toggleClass('is-active');\n\n if ($this.data('select-time-target') === 'multiple') {\n startDate = bookingRowFrom.find('.js-datepicker-booking').val();\n endDate = bookingRowTo.find('.js-datepicker-booking').val();\n fromTime = bookingRowFrom.find('.js-select-start-time option[selected=\"selected\"]').val();\n toTime = bookingRowTo.find('.js-select-end-time option[selected=\"selected\"]').val();\n type = 'multiple';\n } else {\n startDate = bookingRowFromTo.find('.js-datepicker-booking').val();\n endDate = startDate;\n fromTime = bookingRowFromTo.find('.js-select-start-time option[selected=\"selected\"]').val();\n toTime = bookingRowFromTo.find('.js-select-end-time option[selected=\"selected\"]').val();\n type = 'single';\n }\n\n bookingFormStartDate.val(startDate ? startDate : '').trigger('hidden-input-change');\n bookingFormEndDate.val(endDate ? endDate : '').trigger('hidden-input-change');\n bookingFormFromTime.val(fromTime ? fromTime : '').trigger('hidden-input-change');\n bookingFormToTime.val(toTime ? toTime : '').trigger('hidden-input-change');\n bookingFormType.val(type).trigger('hidden-input-change');\n });\n}","export default function formatDate(date) {\n let month, day;\n month = date.getMonth() + 1;\n day = date.getDate();\n\n return date.getFullYear() + '-' + (month > '9' ? month : '0' + month) + '-' + (day > '9' ? day : '0' + day);\n}","export default function formatTime(timeString) {\n let hour = timeString;\n let dayFormat;\n\n if (+hour < 24) {\n dayFormat = +hour < 12 ? ' a.m.' : ' p.m.';\n } else {\n dayFormat = ' a.m.';\n }\n hour = +hour % 12 || 12;\n\n return hour + ':00 ' + dayFormat;\n}","import formatDate from \"./formatDate\";\nimport updateSelect from \"./updateSelect\";\nimport createAvailableHoursArray from \"./createAvailableHoursArray\";\nimport updateFormFields from \"./updateFormFields\";\nimport {\n datepickerDataInput,\n} from './selectors';\nlet availablesArray = [];\n\nexport const datesArray = [];\n\nexport default function getDayAvailableHours(date, selectFromBlock, selectToBlock, type) {\n let requestPath = datepickerDataInput.data('request-path');\n let currentDateStr = datepickerDataInput.data('current-day');\n let currentHour = +datepickerDataInput.data('current-hour');\n let selectedDate = formatDate(date[0]);\n\n datesArray.length = 0;\n\n $.ajax({\n url: requestPath,\n method: 'POST',\n data: {date: selectedDate},\n success: function (event) {\n\n datesArray.push(...event)\n\n availablesArray = createAvailableHoursArray(datesArray, type);\n\n let timeFrom;\n if (selectedDate === currentDateStr && currentHour > availablesArray.from[0][0][0]) {\n timeFrom = currentHour + 1\n } else {\n timeFrom = availablesArray.from[0][0][0]\n }\n\n if (selectFromBlock.length) {\n updateSelect(selectFromBlock, availablesArray.from, timeFrom);\n if (type === 'from') selectFromBlock.parent().find('.custom-select__list li').last().click();\n }\n if (selectToBlock.length) {\n updateSelect(selectToBlock, availablesArray.to, timeFrom);\n if (type === 'to') selectToBlock.parent().find('.custom-select__list li').last().click();\n }\n\n updateFormFields(type, formatDate(date[0]), timeFrom, datesArray[0][1]);\n $('.js-reset-hours').removeClass('hidden')\n },\n error: function (e, data) {\n console.log('=====', 'e', e);\n console.log('=====', 'data', data);\n }\n });\n}\n","export const currentDate = new Date();\nexport const endDate = new Date(currentDate.getFullYear() + 2, currentDate.getMonth(), currentDate.getDate());\nexport const datepickerRow = $('.booking-request__row');\n\nexport const datepickerDataInput = $('input.datepicker-data');\nexport const dataDisabledDates = datepickerDataInput.data('disabled-dates') ? datepickerDataInput.data('disabled-dates') : [new Date()];\nexport const dataDaysWithMultipleRanges = datepickerDataInput.data('multiple-ranges-days') ? datepickerDataInput.data('multiple-ranges-days') : [];\nexport const dataDisabledDaysOfWeek = datepickerDataInput.data('disabled-days') ? datepickerDataInput.data('disabled-days') : [];\n\n// vars for sending data to backend\n export const bookingForm = $('.js-booking-form');\n export const bookingFormStartDate = bookingForm.find('.js-form-start-date');\n export const bookingFormEndDate = bookingForm.find('.js-form-end-date');\n export const bookingFormFromTime = bookingForm.find('.js-form-from-time');\n export const bookingFormToTime = bookingForm.find('.js-form-to-time');\n export const bookingFormType = bookingForm.find('.js-form-type');","import {\n bookingFormStartDate,\n bookingFormEndDate,\n bookingFormFromTime,\n bookingFormToTime,\n bookingFormType,\n bookingForm\n} from './selectors';\n\n// generate selected dates array for multiple choice\nexport default function updateFormFields(type, date, from, to) {\n let calendarType = 'multiple';\n if (type === 'from-to') {\n bookingFormStartDate.val(date);\n bookingFormEndDate.val(date);\n calendarType = 'single';\n } else if (type === 'from') {\n bookingFormStartDate.val(date);\n } else if (type === 'to') {\n bookingFormEndDate.val(date);\n }\n bookingFormStartDate.trigger('hidden-input-change');\n bookingFormEndDate.trigger('hidden-input-change');\n // bookingFormFromTime.val(from).trigger('hidden-input-change');\n // bookingFormToTime.val(to).trigger('hidden-input-change');\n bookingFormType.val(calendarType).trigger('hidden-input-change');\n bookingForm.data('type', type);\n}","import { isArray } from 'lodash';\nimport Select from '../customSelect';\n\nexport default function updateSelect(element, optionList, timeFrom = 0) {\n\n let options = optionList.map((hours, index) => {\n if (_.isArray(hours)) {\n return hours.map(item => (\n timeFrom <= item[0]\n ? ``\n : null\n ))\n } else {\n timeFrom <= item[0]\n ? ``\n : null\n }\n });\n\n element.parent().find('.custom-select__field').remove();\n element.parent().find('.custom-select__dropdown').remove();\n\n options.unshift(\"\");\n element.html(options.flat().join(''));\n new Select(element);\n}\n","import { redirectTo } from './redirectTo';\n\nexport const downloadPdf = () => {\n const redirectEl = $('[data-redirect]');\n const redirectUrl = redirectEl.data('redirect-url');\n const redirectDelay = +redirectEl.data('redirect-delay');\n const successMessageEl = $(redirectEl.data('success-element'));\n\n redirectEl.on('click', () => {\n redirectEl.addClass('hidden');\n successMessageEl.removeClass('hidden');\n redirectTo(redirectUrl, redirectDelay)\n })\n}","import { env } from '../envVariables.js.erb';\n\nexport function emailSubscription() {\n $('.js-subscription-form').each((index, item) => {\n let form = $(item);\n let subscriptionForm = form.find('.js-email-subscription-form');\n let email = form.find('input');\n let errorBlock = form.find('.js-subscription-error');\n let successBlock = form.find('.js-subscription-success');\n let loadingBlock = form.find('.js-subscription-loading');\n\n subscriptionForm.on('submit', function (e) {\n e.preventDefault();\n\n if (validateEmail()) {\n loadingBlock.css('display', 'block');\n subscriptionForm.find('.recaptcha').removeClass('hidden')\n }\n });\n\n $('.js-recaptcha').on('captcha-change', () => {\n $.ajax({\n type: \"POST\",\n url: '/email_subscriptions',\n data: {email: email.val()},\n complete: function (data) {\n loadingBlock.css('display', 'none');\n subscriptionForm.css('display', 'none');\n successBlock.css('display', 'block');\n },\n dataType: 'JSON'\n });\n });\n\n function validateEmail() {\n let filter = /^([a-zA-Z0-9_\\.\\-\\+])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,4})+$/;\n\n if (!filter.test(email.val())) {\n errorBlock.text('Please provide a valid email address');\n email.focus();\n return false\n } else {\n errorBlock.text('');\n return true\n }\n }\n })\n}","import { ISOPEN } from '../_constants';\n\nexport function expander() {\n $('.js-expander-head').on('click', function() {\n $(this).parent().find('.js-expander-content').slideToggle();\n $(this).parent().toggleClass(ISOPEN);\n });\n}\n","export const feedback = () => {\n const form = $('.js-feedback-form');\n const requiredFields = $('.js-feedback-required');\n const submitBtn = $('.js-feedback-submit');\n let errorsArray = [];\n\n if (form.length > 0) {\n function validateFeedbackForm() {\n errorsArray = [];\n requiredFields.each((index, input) => {\n if ($(input).val().length === 0 ) {\n const errorMessage = $(input).hasClass('js-recaptcha') ? 'Please prove that you are not a Robot' : 'Can\\'t be blank';\n\n $(input).closest('.field')\n .addClass('is-error')\n .find('.js-feedback-error').text(errorMessage);\n\n errorsArray.push('1')\n } else {\n if ($(input).hasClass('js-feedback-email')) {\n validateEmail($(input));\n } else {\n $(input).closest('.field')\n .removeClass('is-error')\n .find('.js-feedback-error').text('');\n }\n }\n });\n }\n\n submitBtn.on('click', e => {\n e.preventDefault();\n\n validateFeedbackForm();\n if (errorsArray.length === 0) form.submit()\n });\n\n requiredFields.each((index, item) => {\n $(item).on('input captcha-change', () => validateFeedbackForm())\n });\n\n function validateEmail(input) {\n errorsArray = [];\n let filter = /^([a-zA-Z0-9_\\.\\-\\+])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,4})+$/;\n\n if (!filter.test(input.val())) {\n input.closest('.field').addClass('is-error').find('.js-feedback-error').text('Please provide a valid email address');\n errorsArray.push('1')\n } else {\n input.closest('.field').removeClass('is-error').find('.js-feedback-error').text('');\n }\n }\n }\n};","export function filteringDropDown() {\n $('.js-listing-filter, .js-booking-filter, .js-review-filter').parent().find('.custom-select__list li').on('click', function () {\n $(this).closest('form').submit();\n });\n}\n","import { WINDOW, ISFIXED } from '../_constants';\nimport { getElemHeight } from './getElemSize.js';\n\nexport function fixedHeader() { \n let popupVisible = $('.js-popup').is(':visible');\n if (WINDOW.scrollTop() > getElemHeight('.js-header') || popupVisible) {\n $('.js-header').addClass(ISFIXED);\n } else {\n $('.js-header').removeClass(ISFIXED);\n } \n}\n","\nimport debounce from 'debounce';\nimport { fixedHeader } from './fixedHeader.js';\n\nexport function fixedHeaderOnScroll() {\n window.onscroll = debounce(fixedHeader, 25);\n}\n\n// var scrollTimeout;\n// var throttle = 50;\n\n// $(window).on('scroll', function() {\n// if (!scrollTimeout) {\n// scrollTimeout = setTimeout(function() {\n// fixedHeader();\n// scrollTimeout = null;\n// }, throttle);\n// }\n// });\n","import { isUpperCase } from './isUpperCase.js';\n\n// in case 4 capitalized letters in a row\n// it replaces them with lower case\nexport function forbidAllCaps() {\n if($('.venue-registration').length) {\n $(\"input[type='text'], textarea\").each(function(){\n let input = $(this);\n\n input.keyup(function() {\n let value = $(this).val();\n let words = value.split(\" \");\n\n $.each(words, function(_i,v){\n if (isUpperCase(v)) {\n let newWord = v.toLowerCase();\n let newValue = input.val().replace(v, newWord)\n\n input.val(newValue)\n }\n });\n })\n })\n }\n}\n","export function getElemHeight(elem) {\n return $(elem).outerHeight();\n};\n\nexport function getElemWidth(elem) {\n return $(elem).outerWidth();\n};","export function infoModal() {\n let infoBlock = $('.js-info-modal');\n let closeInfoModal = $('.js-close-info-modal');\n\n closeInfoModal.on('click', function() {\n $(this).closest('.js-info-modal').hide();\n });\n\n infoBlock.each(function() {\n const $this = $(this);\n\n if ($this.hasClass('alert') || $this.hasClass('notice' )) {\n const hideBlock = () => {\n $this.hide(400);\n };\n setTimeout(hideBlock, 7000);\n }\n });\n}\n","import { ZoomControl } from './mapZoomBtns.js';\nimport { ISOPEN } from '../_constants';\nimport isTouchDevice from '../lib/detectTouch.js';\nimport { env } from '../envVariables.js.erb';\n\nclass Map {\n constructor(config, mainMap) {\n this.elem = $(config);\n this.mapMain = mainMap;\n this._initMap()\n }\n\n _initMap() {\n let self = this;\n\n if(this.mapMain) {\n self._searchMap();\n } else {\n let mapWrapper = self.elem,\n mapInitBlock = mapWrapper.find('.js-map-init'),\n zoomValue = parseInt(mapInitBlock.attr('data-zoom')),\n coords = mapInitBlock.attr('coords').split(','),\n latitude = parseFloat(coords[0]),\n longtitude = parseFloat(coords[1]),\n iconSrc = mapWrapper.find('.js-active-pin').attr('src'),\n data = $('#listings_data').data('listing');\n\n let icon = {\n url: iconSrc, // url\n scaledSize: new google.maps.Size(40, 40), // scaled size\n origin: new google.maps.Point(0,0), // origin\n anchor: new google.maps.Point(20, 40) // anchor\n };\n\n let map = new google.maps.Map(mapInitBlock[0], {\n zoom: zoomValue,\n center: {lat: latitude, lng: longtitude},\n mapTypeControl: false,\n zoomControl: false,\n fullscreenControl: false\n });\n\n let marker = new google.maps.Marker({\n position: { lat: latitude, lng: longtitude },\n map: map,\n icon: icon\n });\n\n let zoomInButton = $(mapWrapper).find('.js-map-zoomin');\n let zoomOutButton = $(mapWrapper).find('.js-map-zoomout');\n\n ZoomControl(map, zoomInButton[0], zoomOutButton[0]);\n }\n }\n\n _searchMap() {\n let self = this;\n let mainMapSearch = $('#js-main-map');\n let mapWrapper = $(mainMapSearch).closest('.js-map');\n let zoomValue = parseInt($(mainMapSearch).attr('data-zoom'));\n let data = $('#listings_data').data('listing');\n let map = new google.maps.Map(document.getElementById('js-main-map'), {\n zoom: zoomValue,\n center: {lat: data[0].latitude, lng: data[0].longitude},\n mapTypeControl: false,\n zoomControl: false,\n fullscreenControl: false\n // disableDefaultUI: true\n });\n\n let zoomInButton = $(mapWrapper).find('.js-map-zoomin');\n let zoomOutButton = $(mapWrapper).find('.js-map-zoomout');\n\n ZoomControl(map, zoomInButton[0], zoomOutButton[0]);\n\n self._fullscreen(mapWrapper);\n\n let mapData = mainMapSearch[0].getAttribute('data-json');\n\n self._setMarkers(data, map, mapWrapper);\n }\n\n _setMarkers(items, map, mapWrapper) {\n let self = this;\n let mainMapBlock = mapWrapper;\n\n let inactivePin = $(mainMapBlock).find('.js-inactive-pin');\n const INACTIVEPIN = $(inactivePin).attr('src');\n\n let activePin = $(mainMapBlock).find('.js-active-pin');\n let ACTIVEPIN = $(activePin).attr('src');\n\n let closePopupBtn = $(mainMapBlock).find('.js-close-map-popup');\n let closePopupBtnSrc = $(closePopupBtn).attr('src');\n\n let bounds = new google.maps.LatLngBounds();\n\n if (INACTIVEPIN) {\n var icon = {\n url: INACTIVEPIN\n };\n }\n\n let InfoBox = require('../lib/infoBoxMap.js');\n if (window.matchMedia('(max-width: 599px)').matches) {\n var infoBoxMobPosXAxis = -150;\n } else {\n var infoBoxMobPosXAxis = 0;\n }\n\n var myOptions = {\n content: ''\n , disableAutoPan: false\n , maxWidth: 0\n , pixelOffset: new google.maps.Size(-150, infoBoxMobPosXAxis)\n , zIndex: null\n , boxStyle: {\n backgroundColor: '#fff'\n }\n , closeBoxMargin: ''\n , closeBoxURL: closePopupBtnSrc\n , infoBoxClearance: new google.maps.Size(1, 1)\n , isHidden: false\n , pane: 'floatPane'\n , enableEventPropagation: false\n };\n let infoBoxCustom = new InfoBox(myOptions);\n let markerArray = [];\n\n for (let i = 0; i < items.length; i++) {\n let latitude = parseFloat(items[i].offset_latitude);\n let longtitude = parseFloat(items[i].offset_longitude);\n\n let marker = new google.maps.Marker({\n position: { lat: latitude, lng: longtitude },\n map: map,\n icon: icon,\n id: i\n });\n\n bounds.extend(marker.position);\n\n markerArray.push(marker);\n\n var clicked;\n\n let residenceCards = document.querySelectorAll('.js-residence-card-map');\n residenceCards = [...residenceCards];\n\n for (let i = 0; i < residenceCards.length; i++) {\n residenceCards[i].addEventListener('mouseover', function () {\n let infoOpen = infoBoxCustom.content_.length;\n let cardId = parseInt(residenceCards[i].getAttribute('data-card-id'), 10);\n if (cardId === marker.id && infoOpen === 0) {\n marker.setIcon(ACTIVEPIN);\n }\n });\n\n residenceCards[i].addEventListener('mouseleave', function () {\n let cardId = parseInt(residenceCards[i].getAttribute('data-card-id'), 10);\n let infoOpen = infoBoxCustom.content_.length;\n if (cardId === marker.id && infoOpen === 0) {\n for (let j = 0; j < markerArray.length; j++) {\n markerArray[j].setIcon(INACTIVEPIN);\n }\n }\n });\n }\n\n google.maps.event.addListener(marker, 'mouseover', function () {\n if (!clicked) {\n marker.setIcon(ACTIVEPIN);\n if (residenceCards[i]) {\n let cardId = parseInt(residenceCards[i].getAttribute('data-card-id'), 10);\n if (cardId === marker.id) {\n $(residenceCards[i]).addClass('is-marker-hovered');\n } else {\n $(residenceCards[i]).removeClass('is-marker-hovered');\n }\n }\n }\n });\n\n google.maps.event.addListener(marker, 'mouseout', function () {\n if (!clicked) {\n marker.setIcon(INACTIVEPIN);\n if (residenceCards[i]) {\n $(residenceCards[i]).removeClass('is-marker-hovered');\n }\n }\n });\n\n google.maps.event.addListener(marker, 'click', function () {\n clicked = true;\n if (isTouchDevice()) {\n for (let h = 0; h < markerArray.length; h++) {\n if (residenceCards[h]) {\n $(residenceCards[h]).removeClass('is-marker-hovered');\n }\n $(residenceCards[i]).addClass('is-marker-hovered');\n }\n }\n\n function printFilledRate(vPoints) {\n let str = '';\n for (let k = 0; k < vPoints; k++) {\n str += '';\n }\n return str;\n }\n\n function printEmptyRate(vPoints) {\n let str = '';\n for (let k = 0; k < 5 - vPoints; k++) {\n str += '';\n }\n return str;\n }\n\n var contentBox =\n ''+\n '
'+\n '';\n if (infoBoxCustom) {\n infoBoxCustom.close();\n for (let j = 0; j < markerArray.length; j++) {\n markerArray[j].setIcon(INACTIVEPIN);\n }\n }\n infoBoxCustom.setContent(contentBox);\n infoBoxCustom.open(map, marker);\n map.panTo(marker.getPosition());\n marker.setIcon(ACTIVEPIN);\n });\n\n google.maps.event.addListener(infoBoxCustom,\n 'closeclick',\n function () {\n clicked = false;\n for (let j = 0; j < markerArray.length; j++) {\n markerArray[j].setIcon(INACTIVEPIN);\n }\n if (residenceCards[i]) {\n $(residenceCards[i]).removeClass('is-marker-hovered');\n }\n infoBoxCustom.setContent('');\n });\n }\n\n map.fitBounds(bounds);\n }\n\n _fullscreen(mapWrapper) {\n let mapFullscreen = $(mapWrapper).find('.js-map-fullscreen');\n let mapFullscreenCloseBtn = $(mapWrapper).find('.js-map-fullscreen-close');\n let mapMainWrapper = $(mapWrapper).closest('.js-map-main-wrapper');\n\n let mapFullscreenWrapper = $(mapMainWrapper).find('.js-map-fullscreen-wrapper');\n let mapFullscreenExpandBtn = $(mapMainWrapper).find('.js-map-fullscreen');\n let mapFullscreenClose = $(mapMainWrapper).find('.js-map-fullscreen-close');\n\n function toggleMapExpanding(btn, el) {\n if ($(mapFullscreenWrapper).hasClass(ISOPEN)) {\n $(mapFullscreenWrapper).removeClass(ISOPEN);\n $(btn).removeClass(ISOPEN);\n $(el).removeClass(ISOPEN);\n } else {\n $(mapFullscreenWrapper).addClass(ISOPEN);\n $(btn).addClass(ISOPEN);\n $(el).addClass(ISOPEN);\n }\n }\n\n $(mapFullscreen).on('click', function() {\n toggleMapExpanding(mapFullscreenClose, this);\n });\n\n $(mapFullscreenCloseBtn).on('click', function() {\n toggleMapExpanding(mapFullscreenExpandBtn, this);\n });\n }\n\n _getUrl(jsonName) {\n return window.location.protocol + '//' + window.location.host + `/data/${jsonName}.json`;\n }\n}\n\n$.fn.maps = function(main) {\n this.each((i, el) => new Map($(el), main));\n return this;\n};\n\n/*** search map ***/\n$('#js-main-map').maps(true);\n/*****************/\n\n$('.js-map-common').maps();\n","import {env} from '../envVariables.js.erb';\nimport {validateBooking} from './validateBooking.js';\n\nexport function initStripe() {\n if (document.querySelector('.js-stripe-payment-form')) {\n let stripe = Stripe(env.STRIPE_PUBLISHABLE_KEY);\n let elements = stripe.elements();\n let displayErrorEl = document.querySelector('.payment__error-message');\n let paymentForm = document.getElementById('payment-form');\n let cardholderInputWrap = document.querySelector('.js-cardholder-name');\n let cardholderInput = document.getElementById('cardholder-name');\n let submitBtn = document.querySelector('.js-stripe-submit');\n let validationResult;\n\n // Style the payment element\n let style = {\n base: {\n fontSize: \"16px\"\n }\n };\n\n let classes = {\n invalid: 'is-error',\n };\n\n // Create an instance of stripe Elements\n let cardNumber = elements.create('cardNumber', {style: style, classes: classes});\n cardNumber.mount('#stripe-card-number');\n\n let cardCvc = elements.create('cardCvc', {style: style, classes: classes});\n cardCvc.mount('#stripe-cvc');\n\n let cardExpiry = elements.create('cardExpiry', {style: style, classes: classes});\n cardExpiry.mount('#stripe-exp-date');\n\n handleErrors(cardNumber);\n handleErrors(cardCvc);\n handleErrors(cardExpiry);\n\n // Listen for errors\n function handleErrors(component) {\n component.addEventListener('change', function (event) {\n\n if (event.error) {\n displayErrorEl.textContent = event.error.message;\n displayErrorEl.style.display = 'block';\n } else {\n displayErrorEl.textContent = '';\n displayErrorEl.style.display = 'none';\n }\n });\n }\n\n function validateCardholderInput() {\n if (cardholderInput.value === '') {\n cardholderInputWrap.classList.add('is-error');\n displayErrorEl.textContent = 'Please enter Cardholder Name';\n displayErrorEl.style.display = 'block';\n } else {\n cardholderInputWrap.classList.remove('is-error');\n displayErrorEl.textContent = '';\n displayErrorEl.style.display = 'none';\n }\n }\n\n cardholderInput.addEventListener('input', () => {\n validateCardholderInput();\n });\n\n // Create a token\n submitBtn.addEventListener('click', function (event) {\n event.preventDefault();\n\n validationResult = validateBooking();\n\n validateCardholderInput();\n if (cardholderInput.value === '') {\n return;\n }\n\n var submit_btn = document.querySelector('.js-stripe-submit');\n var cardDetails = {name: cardholderInput.value};\n\n if (validationResult) {\n stripe.createToken(cardNumber, cardDetails).then(function (result) {\n if (result.error) {\n displayErrorEl.textContent = result.error.message;\n displayErrorEl.style.display = 'block';\n submit_btn.classList.remove(\"disabled\");\n } else {\n // Reset errors\n displayErrorEl.textContent = '';\n displayErrorEl.style.display = 'none';\n submit_btn.classList.add(\"is-disabled\");\n // Send the token to the server\n stripeTokenHandler(result.token);\n }\n });\n }\n });\n\n // Submit the token\n function stripeTokenHandler(token) {\n // Insert the token ID into the form so it gets submitted to the server\n var hiddenInput = document.createElement('input');\n hiddenInput.setAttribute('type', 'hidden');\n hiddenInput.setAttribute('name', 'stripeToken');\n hiddenInput.setAttribute('value', token.id);\n paymentForm.appendChild(hiddenInput);\n\n // Submit the form\n paymentForm.submit();\n }\n }\n}\n","export function initVideos() {\n let videos = document.querySelectorAll('.js-video');\n let popupVideosLink = document.querySelectorAll('.js-popup-video');\n\n videos = [...videos];\n popupVideosLink = [...popupVideosLink];\n\n for(let i=0; i\\n' +\n ' \\n' +\n ' \\n' +\n ' \\n' +\n ' \\n' +\n ' \\n' +\n ' \\n' +\n ' \\n' +\n ' \\n' +\n ' \\n' +\n ' \\n' +\n ' \\n' +\n ' \\n' +\n ' \\n' +\n ' \\n' +\n ' \\n' +\n ' \\n' +\n ' \\n' +\n ' \\n' +\n ' \\n' +\n ' \\n' +\n ' \\n' +\n ' \\n' +\n ' \\n' +\n ' \\n' +\n '';\n\n $('[data-loading=\"true\"]').on('submit', function () {\n $('.out').append(`
${loadingSvg}
`)\n });\n }\n}\n","import Cookies from 'js-cookie';\nimport { env } from '../envVariables.js.erb';\n\nexport function mailchimp() {\n let mailchimpPopup = $('.js-popup-mailchimp');\n\n if (mailchimpPopup.length) {\n let popupDelay = 20000;\n let animationDuration = 200;\n let closeBtn = $('.js-close-mailchimp');\n\n let form = $('.js-mailchimp-form');\n let email = $('.js-mailchimp-email');\n let firstName = $('.js-mailchimp-first-name');\n let submitBtn = $('.js-mailchimp-submit');\n let errorBlock = $('.js-mailchimp-error');\n let successBlock = $('.js-mailchimp-success');\n let loadingBlock = $('.js-mailchimp-loading');\n let recaptcha = $('.js-recaptcha');\n\n if (!Cookies.get('rejected')) {\n setTimeout(() => {\n mailchimpPopup.fadeIn(animationDuration);\n }, popupDelay);\n }\n\n closeBtn.on('click', function () {\n $(this).parents('.js-popup').fadeOut(animationDuration);\n Cookies.set('rejected', true, { expires: 5 });\n })\n\n submitBtn.on('click', function (e) {\n e.preventDefault();\n\n if (validateEmail()) {\n loadingBlock.css('display', 'block');\n $.ajax({\n type: \"POST\",\n url: '/email_subscriptions',\n data: {email: email.val(), first_name: firstName.val(), token: recaptcha.val()},\n complete: function (data) {\n if (data.status === 401 || data.responseText === 'unauthorized') {\n errorBlock.text('Please prove that you are not a bot');\n recaptcha.val('');\n }\n\n else if (data.status === 201 || data.responseText === 'ok' || data.status === 400 || data.responseText === 'failed') {\n loadingBlock.css('display', 'none');\n form.css('display', 'none');\n successBlock.css('display', 'block');\n Cookies.set('addedEmail', true, { expires: ( 3650 )});\n setTimeout(() => {\n mailchimpPopup.fadeOut(animationDuration);\n }, 6000);\n }\n },\n\n dataType: 'JSON'\n });\n }\n });\n\n function validateEmail() {\n let filter = /^([a-zA-Z0-9_\\.\\-\\+])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,4})+$/;\n\n if (!filter.test(email.val())) {\n errorBlock.text('Please provide a valid email address');\n email.focus();\n return false\n } else {\n errorBlock.text('');\n return true\n }\n }\n }\n}\n","export function mainSearch() {\n $('#event_list a').on('click', function() {\n const text = $(this).text();\n const id = $(this).data('id');\n\n $('#search_event_text').val(text);\n $('#search_event_id').val(id);\n\n // close dropdown\n $(document).trigger('click');\n\n return false;\n });\n}\n","export function ZoomControl(map, zoomInButton, zoomOutButton) {\n\n // Setup the click event listener - zoomIn\n google.maps.event.addDomListener(zoomInButton, 'click', function() {\n map.setZoom(map.getZoom() + 1);\n });\n\n // Setup the click event listener - zoomOut\n google.maps.event.addDomListener(zoomOutButton, 'click', function() {\n map.setZoom(map.getZoom() - 1);\n });\n\n}\n","import IMask from 'imask';\nimport {env} from \"../envVariables.js.erb\";\n\nexport const mask = () => {\n const maskEl = document.querySelectorAll('.js-mask-phone');\n const mask = env.TWILIO_PHONE_MASK;\n const submitBtn = $('.js-profile-submit');\n const form = $('.js-profile-form');\n\n const validateNumber = (number = '', errorEl) => {\n console.log('=====', 'validateNumber')\n if (number.length > 0 && number.length < 10) {\n errorEl.text(`The number is invalid. Number must comply with the following mask \\\"${mask}\\\"`);\n return false\n } else {\n errorEl.text('');\n return true\n }\n };\n\n if (maskEl.length) {\n const maskOptions = {\n mask\n };\n\n maskEl.forEach(item => {\n const el = $(item);\n const mask = IMask(item, maskOptions);\n const errorEl = el.closest('.field').find('.js-phone-error');\n\n submitBtn.on('click', () => {\n const unmaskedValue = mask._unmaskedValue;\n el.data('unmasked-value', unmaskedValue);\n validateNumber(unmaskedValue, errorEl)\n })\n });\n\n submitBtn.on('click', e => {\n e.preventDefault();\n\n const validationArray = [];\n\n maskEl.forEach(item => {\n const el = $(item);\n const unmaskedValue = el.data('unmasked-value') || '';\n const errorEl = el.closest('.field').find('.js-phone-error');\n const isValid = validateNumber(unmaskedValue, errorEl);\n if (!isValid) validationArray.push(0);\n el.val(unmaskedValue);\n });\n\n if (validationArray.length === 0) form.submit();\n });\n }\n};\n","export function numberWithCommas(x) {\n return x.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',');\n};\n","export function onlyNumbers() {\n $('input[type=\"number\"]').each(function () {\n let $this = $(this);\n\n $this.on('input', function (e) {\n e.target.value = e.target.value.replace(/[^0-9]/g, '');\n });\n\n $this.on('keypress', function () {\n return event.charCode >= 48 && event.charCode <= 57\n });\n })\n}","export function passwordInput() {\n let inputWrapper = $('.js-form-password');\n let passToggleBtn = $('.js-form-password').find('.js-toggle-password');\n let inputPass = $(inputWrapper).find('input[type=\"password\"]');\n\n $(inputPass).on('input change', function() {\n let valueLength = this.value.length;\n let toggleBtn = $(this).closest('.js-form-password').find('.js-toggle-password');\n if(valueLength >= 1) {\n $(toggleBtn).show();\n } else {\n $(toggleBtn).hide();\n }\n });\n\n $(passToggleBtn).on('click', function(e) {\n e.preventDefault();\n let input = $(this).closest('.js-form-password').find('input');\n if (input[0].type === 'password') {\n input[0].type = 'text';\n $(this).text('Hide').removeClass('btn_primary').addClass('btn_secondary');\n } else {\n input[0].type = 'password';\n $(this).text('Show').removeClass('btn_secondary').addClass('btn_primary');\n }\n });\n}\n","export function payments() {\n\n let paymentPaypal = $('.js-payment-paypal');\n let paymentCard = $('.js-payment-card');\n let paymentMethods = $('.js-payment-methods');\n\n $('.js-payment-method-paypal').on( 'click', function() {\n if ($('.js-payment-method-paypal input[type=radio]').is(':checked')) {\n paymentMethods.hide();\n paymentPaypal.show();\n } \n });\n $('.js-payment-method-card').on( 'click', function() {\n if ($('.js-payment-method-card input[type=radio]').is(':checked')) {\n paymentMethods.hide();\n paymentCard.show();\n } \n });\n\n\n $('.js-payment-paypal-change').on( 'click', function() {\n paymentPaypal.hide();\n paymentCard.show();\n });\n\n $('.js-payment-card-change').on( 'click', function() {\n paymentCard.hide();\n paymentPaypal.show();\n });\n\n};\n","import PubSub from 'pubsub-js';\nimport { BODY, ISFIXED, ISHIDDEN } from '../_constants';\nimport { addBodyHidden, removeBodyHidden } from './bodyHiddenPosition.js';\n\nexport function popups() {\n\n let bodyHiddenStatus = 0;\n $('.js-popup-link').on('click', function(e) {\n if (!$(this).hasClass('phone-verification')) {\n e.preventDefault();\n }\n\n let $this = $(this),\n attr = $this.attr('data-popup');\n let target = $(`.js-popup[data-popup=\"${attr}\"]`);\n\n if ($this.hasClass('js-popup-gallery-link')) {\n PubSub.publish('open-popup-gallery', $this);\n }\n\n $('.js-popup').fadeOut(200);\n target.fadeIn(300);\n\n if(!target.hasClass('is-scrollable')) {\n addBodyHidden();\n }\n });\n\n $('.js-popup-overlay, .js-close-popup').on('click', function(e) {\n e.stopPropagation();\n\n let parent = $(this).parents('.js-popup');\n parent.fadeOut(200);\n\n let videosFrame = $('.js-video-in-popup').closest('iframe');\n if(videosFrame !== null && videosFrame !== undefined) {\n $(videosFrame).remove();\n }\n if (parent.attr('data-popup') === 'popup-gallery') {\n PubSub.publish('close-popup-gallery');\n }\n\n if (bodyHiddenStatus === 1) {\n bodyHiddenStatus = 0;\n } else {\n BODY.removeClass(ISHIDDEN);\n if(!parent.hasClass('is-scrollable')) {\n removeBodyHidden();\n }\n $('.js-header').removeClass(ISFIXED);\n }\n });\n\n $('.js-popup-content').on('click', function(e) {\n e.stopPropagation();\n });\n\n}\n","import { env } from '../envVariables.js.erb';\n\nexport const reCAPTCHA = () => {\n $('.js-recaptcha').val(env.RECAPTCHA_SITE_KEY).trigger('captcha-change')\n};\n","export const redirectTo = (redirectUrl = window.location.pathname, redirectDelay = 3000) => {\n setTimeout(() => {\n window.location.pathname = redirectUrl\n }, redirectDelay)\n};\n","export function reinitVideoPopup() {\n\n var target = document.querySelectorAll('.video');\n target = [...target];\n\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(mutation) {\n // console.log(mutation);\n let ifvideoPopupChanged = mutation.target.children[0].className === 'js-video-in-popup';\n\n if(ifvideoPopupChanged && mutation.removedNodes.length) {\n let ifNotIframe = $(mutation.removedNodes[0]).prop('tagName') === 'IFRAME';\n if(!ifNotIframe) {\n let removedNode = mutation.removedNodes[0];\n $(mutation.target).append(removedNode); \n $(mutation.target).closest('iframe').remove();\n }\n }\n }); \n });\n \n // configuration\n var config = { attributes: true, childList: true, characterData: true };\n \n for(let i=0; i 0 || !!navigator.userAgent.match(/Trident.*rv\\:11\\./)) {\n textareaElement.style.height = Math.max(minHeight, textareaElement.scrollHeight + diff) + 'px';\n } else {\n textareaElement.style.height = 0;\n textareaElement.style.height = Math.max(minHeight, textareaElement.scrollHeight + diff) + 'px';\n }; \n \n let parentAccordionItem = textareaElement.closest('[data-accordion-item]');\n if (parentAccordionItem && parentAccordionItem.classList.contains('is-active') && parentAccordionItem.style.maxHeight !== 'none') {\n parentAccordionItem.style.maxHeight = 'none';\n };\n let textareaPlaceholder = $(textareaElement).is('[v-center]');\n if(textareaPlaceholder) {\n $(textareaElement).addClass('is-center');\n }\n };\n \n const textAreas = [].slice.call(document.querySelectorAll('textarea[data-adaptheight]'));\n \n textAreas.forEach(function(el) {\n \n let minHeight = el.scrollHeight;\n \n el.addEventListener('input', function() {\n adjustHeight(el, minHeight);\n }, false);\n \n el.addEventListener('focus', function() {\n let parent = el.parentNode;\n parent.classList.add('has-focus');\n });\n \n el.addEventListener('blur', function() {\n let parent = el.parentNode;\n parent.classList.remove('has-focus');\n });\n \n\n var scrollTimeout;\n var throttle = 50;\n\n WINDOW.on('resize', function() {\n if (!scrollTimeout) {\n scrollTimeout = setTimeout(function() {\n adjustHeight(el, minHeight);\n scrollTimeout = null;\n }, throttle);\n }\n });\n\n $(document).ready(() => {\n adjustHeight(el, minHeight);\n });\n \n });\n};\n\n","export function sharePopup() {\n let socialBtn = $('.js-open-social-popup');\n\n if (socialBtn.length) {\n socialBtn.each(function () {\n let $this = $(this);\n $this.on('click', function (e) {\n e.preventDefault();\n window.open($this.attr(\"href\"), '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600')\n });\n });\n }\n}\n","export function showFilters() {\n let toggleFiltersBtn = $('.js-show-filters');\n\n if (toggleFiltersBtn.length) {\n let filtersEl = $('.js-show-filters-target');\n\n toggleFiltersBtn.on('click', function () {\n if (filtersEl.hasClass('opened')) {\n toggleFiltersBtn.text('Show Filters');\n } else {\n toggleFiltersBtn.text('Hide Filters');\n }\n filtersEl.toggleClass('closed opened')\n });\n }\n}\n","export function showMore() {\n let textBlocks = $('.js-show-all-text');\n let toggleBtn = $('.js-show-more-btn');\n\n var scrollTimeout;\n var throttle = 250;\n $(window).on('resize', function() {\n if (!scrollTimeout) {\n scrollTimeout = setTimeout(function() {\n textBlocks.each(function() {\n if (this.scrollHeight > $(this).innerHeight()) {\n $(this).find('.js-show-more-btn').show();\n } else {\n $(this).find('.js-show-more-btn').hide();\n }\n });\n scrollTimeout = null;\n }, throttle);\n }\n });\n\n textBlocks.each(function() {\n if (this.scrollHeight > $(this).innerHeight()) {\n $(this).find('.js-show-more-btn').show();\n } else {\n $(this).find('.js-show-more-btn').hide();\n }\n });\n \n toggleBtn.on('click', function(e) {\n e.preventDefault();\n let textBlock = $(this).closest('.js-show-all-text');\n var linkText = $(this).text().toUpperCase(); \n if(!textBlock.hasClass('is-open')) {\n linkText = 'show less';\n textBlock.addClass('is-open');\n $(this).addClass('is-open');\n } else {\n linkText = 'show more';\n textBlock.removeClass('is-open');\n $(this).removeClass('is-open');\n };\n \n $(this).text(linkText); \n\n });\n}\n","export function showMoreReviews() {\n const showMoreBtn = $('.js-review-show-more');\n const reviewWrappers = $('.js-review-more');\n const buttonTextShow = showMoreBtn.text();\n const buttonTextHide = showMoreBtn.data('hide-text');\n\n showMoreBtn.on('click', function(e) {\n e.preventDefault();\n\n if(showMoreBtn.hasClass('is-open')) {\n showMoreBtn.removeClass('is-open').text(buttonTextShow);\n reviewWrappers.addClass('hidden');\n } else {\n showMoreBtn.addClass('is-open').text(buttonTextHide);\n reviewWrappers.removeClass('hidden');\n }\n });\n}\n","import slick from 'slick-carousel';\nimport debounce from 'debounce';\nimport { isElementInViewport } from './checkViewport';\nimport PubSub from 'pubsub-js';\nimport { BODY, ISHIDDEN } from '../_constants';\nimport { addBodyHidden, removeBodyHidden } from './bodyHiddenPosition.js';\nimport { myLazyLoad } from './lazyLoading.js';\n\nexport function sliders() {\n\n\n // custom common arrow btns\n let commonNextArrow = `
\n
`;\n let commonPrevArrow = `
\n \n
`;\n\n\n // slider in popular venue section\n let sliderVenue = $('.js-venue-slider');\n\n $(sliderVenue).slick({\n arrows: false,\n dots: true,\n infinite: true,\n slidesToShow: 3,\n slidesToScroll: 1,\n autoplay: false,\n autoplaySpeed: 3000,\n responsive: [{\n breakpoint: 1200,\n settings: {\n slidesToShow: 2\n }\n },\n {\n breakpoint: 1023,\n settings: {\n slidesToShow: 2,\n rows: 2\n }\n },\n {\n breakpoint: 599,\n settings: {\n slidesToShow: 2,\n autoplay: false,\n rows: 2\n }\n }\n ]\n });\n\n $('.js-booking-slider-for').slick({\n slidesToShow: 1,\n slidesToScroll: 1,\n arrows: false,\n fade: true,\n asNavFor: '.js-booking-slider-nav',\n responsive: [{\n breakpoint: 991,\n settings: {\n arrows: true,\n nextArrow: commonNextArrow,\n prevArrow: commonPrevArrow\n }\n }]\n });\n $('.js-booking-slider-nav').slick({\n slidesToShow: 4,\n slidesToScroll: 1,\n asNavFor: '.js-booking-slider-for',\n dots: false,\n prevArrow: commonPrevArrow,\n nextArrow: commonNextArrow,\n centerMode: false,\n infinite: true,\n focusOnSelect: true\n });\n\n\n // slider in booking similar\n let bookingSimilarSlider = $('.js-booking-similar-slider');\n\n $(bookingSimilarSlider).slick({\n arrows: false,\n dots: true,\n infinite: true,\n slidesToShow: 3,\n slidesToScroll: 1,\n autoplay: false,\n autoplaySpeed: 3000,\n swipe: false,\n responsive: [{\n breakpoint: 1023,\n settings: {\n slidesToShow: 2,\n rows: 1\n }\n },\n {\n breakpoint: 599,\n settings: {\n slidesToShow: 1,\n autoplay: false,\n rows: 1\n }\n }\n ]\n });\n\n\n // slider in lp-reasons section\n let sliderReasonsLP = $('.js-advantages-slider');\n\n reinitAutoplay(sliderReasonsLP);\n\n $(sliderReasonsLP).on('destroy', function(ev, slick) {\n reinitSlider(this, slick.options);\n }).slick({\n mobileFirst: true,\n arrows: false,\n dots: true,\n infinite: true,\n slidesToShow: 1,\n slidesToScroll: 1,\n adaptiveHeight: true,\n autoplay: false,\n autoplaySpeed: 2500,\n responsive: [{\n breakpoint: 599,\n settings: 'unslick'\n }]\n });\n\n\n // slider in reasons-video section\n let sliderReasonsVideoLP = $('.js-review-videos-mob-slider');\n reinitAutoplay(sliderReasonsVideoLP);\n $(sliderReasonsVideoLP).on('destroy', function(ev, slick) {\n let popupLink = $(this).find('.js-popup-link');\n reinitSlider(this, slick.options, popupLink);\n }).slick({\n mobileFirst: true,\n arrows: false,\n dots: true,\n infinite: true,\n slidesToShow: 1,\n slidesToScroll: 1,\n adaptiveHeight: true,\n autoplay: false,\n autoplaySpeed: 2500,\n responsive: [{\n breakpoint: 599,\n settings: 'unslick'\n }]\n });\n\n\n // slider in steps\n let steps = $('.js-steps-slider');\n\n reinitAutoplay(steps);\n $(steps).on('destroy', function(ev, slick) {\n reinitSlider(this, slick.options);\n }).slick({\n mobileFirst: true,\n arrows: false,\n dots: true,\n infinite: true,\n slidesToShow: 1,\n slidesToScroll: 1,\n adaptiveHeight: true,\n autoplay: false,\n autoplaySpeed: 2500,\n responsive: [{\n breakpoint: 767,\n settings: 'unslick'\n }]\n });\n\n\n // slider in reasons-video section\n let cards = $('.js-cards-slider');\n reinitAutoplay(cards);\n $(cards).on('destroy', function(ev, slick) {\n reinitSlider(this, slick.options);\n }).slick({\n mobileFirst: true,\n arrows: false,\n dots: true,\n infinite: true,\n slidesToShow: 1,\n slidesToScroll: 1,\n autoplay: false,\n responsive: [{\n breakpoint: 767,\n settings: 'unslick'\n }]\n });\n\n // slider in dashboard first time menu\n let chooseCardsDashboard = $('.js-choose-card-slider');\n $(chooseCardsDashboard).on('destroy', function(ev, slick) {\n reinitSlider(this, slick.options);\n }).slick({\n mobileFirst: true,\n arrows: false,\n dots: true,\n infinite: true,\n slidesToShow: 1,\n slidesToScroll: 1,\n autoplay: false,\n responsive: [{\n breakpoint: 767,\n settings: 'unslick'\n }]\n });\n\n\n // slider residence-cards\n let residenceCards = $('.js-residence-card-slider');\n\n $(residenceCards).slick({\n arrows: false,\n dots: false,\n infinite: true,\n slidesToShow: 1,\n slidesToScroll: 1,\n autoplay: false\n // nextArrow: commonNextArrow,\n // prevArrow: commonPrevArrow\n });\n\n\n\n\n // slider in booking\n let sliderHeroBooking = $('.js-hero-booking-slider');\n\n $(sliderHeroBooking).slick({\n arrows: false,\n dots: false,\n infinite: true,\n slidesToShow: 1,\n slidesToScroll: 1,\n autoplay: false,\n autoplaySpeed: 3000,\n });\n\n // slider in popup\n let openGalleryPopupBtn = $('.js-open-gallery-popup');\n\n $(openGalleryPopupBtn).on('click', function(e) {\n e.preventDefault();\n myLazyLoad.loadAll();\n let popupSlider = $('.js-popup-gallery-slider');\n let popupSliderThumbs = $('.js-popup-gallery-thumbnails');\n let activeSlide = parseInt(sliderHeroBooking.find('.slick-active').attr('data-slick-index'));\n let popupSliderCounter = $('.js-popup-gallery-counter');\n\n function initNewSlider({ newClass, wrapEl, slider, closeBtn }) {\n let newSlider = sliderHeroBooking\n .find('.slick-slide')\n .not('.slick-cloned')\n .find('.slider-slide')\n .clone()\n .addClass(newClass)\n .wrap(wrapEl)\n .parent();\n if(closeBtn) {\n newSlider.find('.popup__close').removeClass('is-hidden');\n }\n slider.html(newSlider);\n }\n\n initNewSlider({\n newClass: 'popup-slide__inner',\n wrapEl: '',\n slider: popupSlider,\n closeBtn: true\n });\n initNewSlider({\n newClass: 'slide-thumb__inner',\n wrapEl: '',\n slider: popupSliderThumbs\n });\n\n\n popupSlider.on('init reInit afterChange', function(event, slick, currentSlide, nextSlide) {\n //currentSlide is undefined on init -- set it to 0 in this case (currentSlide is 0 based)\n var i = (currentSlide ? currentSlide : 0) + 1;\n popupSliderCounter.text(i + '/' + slick.slideCount);\n });\n\n\n\n popupSlider.slick({\n initialSlide: activeSlide,\n asNavFor: popupSliderThumbs,\n slidesToShow: 1,\n slidesToScroll: 1,\n prevArrow: commonPrevArrow,\n nextArrow: commonNextArrow,\n });\n\n popupSliderThumbs.slick({\n asNavFor: popupSlider,\n initialSlide: 0,\n slidesToShow: 4,\n slidesToScroll: 1,\n focusOnSelect: true,\n centerMode: true,\n infinite: true\n });\n\n let bodyHiddenStatus = 0;\n $('.js-popup-overlay, .js-close-popup').on('click', function(e) {\n e.stopPropagation();\n\n $(popupSlider).slick('unslick');\n $(popupSliderThumbs).slick('unslick');\n\n let parent = $(this).parents('.js-popup');\n parent.fadeOut(200);\n if (parent.attr('data-popup') === 'popup-gallery') {\n PubSub.publish('close-popup-gallery');\n };\n\n if (bodyHiddenStatus === 1) {\n bodyHiddenStatus = 0;\n } else {\n BODY.removeClass(ISHIDDEN);\n removeBodyHidden();\n };\n });\n\n });\n\n\n\n // for arrows outside slider wrapper\n function sliderArrows(slider, block) {\n for(let i=0; i .btn')\n\n submitBtn.on('click', function() {\n sessionStorage.setItem('message', $('#message_content').val());\n })\n\n if (sessionStorage.getItem('message')){\n $('#message_content').val(sessionStorage.getItem('message'))\n }\n\n if (document.referrer.includes('/messages/') && window.location.href.includes('/listings/')) {\n sessionStorage.clear();\n }\n}\n","// TODO refactore or remove it\nexport function submitFormStatus() {\n $('#status').on('change', function(){\n $('form').submit();\n })\n}","export function submitSearchChatForm() {\n $('#search').keypress(function(e){\n if(e.which == 13){\n $('form[name=search_form]').submit();\n }\n });\n}","export function tabs() {\n const tab = document.querySelectorAll('.js-tab');\n\n for (let i = 0; i < tab.length; i++) {\n tab[i].addEventListener('click', function(e) {\n e.preventDefault();\n\n let tabData = this.dataset.targetTab;\n let target = document.querySelector('[data-tab=\"' + tabData + '\"]');\n\n let tabTargetItemElse = document.querySelectorAll(\n '.js-tabs-item:not([data-tab=\"' + tabData + '\"])'\n );\n tabTargetItemElse = [...tabTargetItemElse];\n\n let tabElse = document.querySelectorAll(\n '.js-tab:not([data-target-tab=\"' + tabData + '\"])'\n );\n tabElse = [...tabElse];\n\n for (let j = 0; j < tabTargetItemElse.length; j++) {\n tabTargetItemElse[j].classList.remove('is-active');\n }\n for (let j = 0; j < tabElse.length; j++) {\n tabElse[j].classList.remove('is-active');\n }\n this.classList.add('is-active');\n target.classList.add('is-active');\n });\n }\n}\n","import { numberWithCommas } from './numberWithCommas.js';\n\nexport function textareaCounter() {\n let counters = $('.js-textarea-counter');\n if (counters.length > 0) {\n let textarea = counters.closest('.js-textarea').find('textarea, input');\n let textareaCountAmount = +textarea.data('max-count');\n $(counters).text(numberWithCommas((textareaCountAmount - $(textarea).val().length)));\n $(textarea).on('input', function() {\n $(counters).text(numberWithCommas((textareaCountAmount - $(this).val().length)));\n });\n }\n}\n","export function timeZoneDetector() {\n if ($('#user_time_zone').length) {\n $('#user_time_zone').val(jstz.determine().name())\n }\n}\n","export function toggleContent() {\n $('.js-toggle').each(function () {\n let $this = $(this);\n let buttonInitialText = $this.text();\n let buttonAlternativeText = $this.data('alternative-text');\n\n $this.click(function (e) {\n e.preventDefault();\n let target = $this.parent().find('.js-toggle-target');\n\n if (target.hasClass('is-open')) {\n target.removeClass('is-open');\n $this.text(buttonInitialText).removeClass('is-open');\n } else {\n target.addClass('is-open');\n $this.text(buttonAlternativeText).addClass('is-open');\n }\n });\n });\n}","export function toggleMapSwitch() {\n let toggleBtn = $('.js-toggle-map');\n if(toggleBtn.length) {\n $(toggleBtn).on('click', function() {\n let href = $(this).data('map-href');\n if(href) {\n window.location.href = href;\n } \n });\n }\n}\n","export function togglePayout() {\n let toggleBtn = $('.js-payout-delete-toggle');\n toggleBtn.on('click', function() {\n toggleBtn.css('display', 'none');\n $('.js-payout-delete-form').css('display', 'block');\n });\n}\n","export function toggleWishList() {\n $('.like-btn').on('click', function(){\n var like_btn = $(this);\n var listing_id = like_btn.attr('data-listing-id');\n if(like_btn.hasClass('is-active')){\n $.ajax({\n type: \"POST\",\n url: '/remove_from_favorite_list',\n data: { listing_id: listing_id },\n complete: function(data){\n if (data.status == 201){\n like_btn.removeClass('is-active')\n }\n }\n });\n }else{\n $.ajax({\n type: \"POST\",\n url: '/add_to_favorite_list',\n data: { listing_id: listing_id },\n complete: function(data){\n if (data.status == 201){\n like_btn.addClass('is-active')\n }\n }\n });\n }\n\n })\n}\n","import { validateDonation } from './validateDonation.js'\n\nexport function validateBenefiting() {\n let validationSource = $('.js-validation-source');\n\n if ($('.js-benefiting-organization').length) {\n let validationTarget = $('.js-validate-benefiting');\n let userId = +validationSource.data('user-id');\n let select = $('.js-select');\n let inputTarget = $('.js-validation-target');\n\n select.on('custom-select:change', function () {\n if (+select.find('option:selected').val() === userId) {\n validationTarget.addClass('hidden');\n inputTarget.val(inputTarget.attr('min'));\n } else {\n validateDonation();\n validationTarget.removeClass('hidden');\n }\n });\n }\n}","import { scrollTo } from './scrollTo.js'\n\nexport function validateBooking() {\n let eventTypeInput = $('.js-select');\n let peopleInput = $('.js-requested-people');\n let messageInput = $('.js-booking-message');\n let errorMsg = 'This field is required';\n let errorMsgMaxPeople = 'Please enter number less than ';\n let eventTypeInputWrapper = eventTypeInput.closest('.select');\n let peopleInputWrapper = peopleInput.closest('.field_secondary');\n let messageInputWrapper = messageInput.closest('.user-description__textarea');\n let preventMultipleScroll = [];\n\n function validateField(element, wrapper) {\n if (!element.val().length) {\n if (!wrapper.hasClass('is-error')) {\n wrapper.addClass('is-error').append(`
${errorMsg}
`);\n }\n if (!preventMultipleScroll.length) {\n scrollTo(wrapper, 400);\n }\n preventMultipleScroll.push('1');\n } else if (+element.val() > +element.attr('max')) {\n if (!wrapper.hasClass('is-error')) {\n wrapper.addClass('is-error').append(`
${errorMsgMaxPeople + element.attr('max')}
`);\n }\n if (!preventMultipleScroll.length) {\n scrollTo(wrapper, 400);\n }\n preventMultipleScroll.push('1');\n } else {\n wrapper.removeClass('is-error').find('.js-validation-error').remove();\n }\n }\n\n validateField(eventTypeInput, eventTypeInputWrapper);\n validateField(peopleInput, peopleInputWrapper);\n validateField(messageInput, messageInputWrapper);\n\n peopleInput.on('input', function () {\n validateField(peopleInput, peopleInputWrapper);\n });\n\n messageInput.on('input', function () {\n validateField(messageInput, messageInputWrapper);\n });\n\n eventTypeInput.on('custom-select:change', function () {\n validateField(eventTypeInput, eventTypeInputWrapper);\n });\n\n if (preventMultipleScroll.length) {\n return false\n } else {\n return true\n }\n}","export function validateDonation() {\n let donationEl = $('.js-validate_donation');\n\n let minDonationValue = +donationEl.data('min-donation');\n let nextBtn = $('.js-next-button');\n let inputEl = $('.js-validation-target');\n\n nextBtn.on('click', function (e) {\n e.preventDefault();\n\n if (inputEl.val() < minDonationValue) {\n let errorMessage = `Must be greater than or equal to ${minDonationValue}`;\n\n if ($('.js-donation-error').length) {\n $('.js-donation-error').text(errorMessage);\n } else {\n donationEl.append(`
${errorMessage}
`);\n }\n donationEl.addClass('is-error')\n } else {\n $('.js-donation-error').remove();\n donationEl.removeClass('is-error');\n $('form').submit();\n }\n });\n}\n","export const validateEmptyMessage = () => {\n let submit = document.querySelector('.js-message-submit');\n let errorBlock = $('.js-counter-error');\n\n if (submit) {\n submit.onclick = e => {\n if (document.querySelector('.js-message-input').value.length < 1 && document.querySelector('.js-file-upload-result').value.length < 1) {\n $('.counter__error').addClass('has-error');\n errorBlock.html('Message can not be blank.');\n e.preventDefault()\n }\n }\n }\n}\n","export function video() {\n var tag = document.createElement('script');\n tag.src = 'https://www.youtube.com/iframe_api';\n var firstScriptTag = document.getElementsByTagName('script')[0];\n firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);\n\n function callPlayer(frame_id, func, args) {\n if (window.jQuery && frame_id instanceof jQuery)\n frame_id = frame_id.get(0).id;\n var iframe = document.getElementById(frame_id);\n if (iframe && iframe.tagName.toUpperCase() !== 'IFRAME') {\n iframe = iframe.getElementsByTagName('iframe')[0];\n }\n\n // When the player is not ready yet, add the event to a queue\n // Each frame_id is associated with an own queue.\n // Each queue has three possible states:\n // undefined = uninitialised / array = queue / 0 = ready\n if (!callPlayer.queue)\n callPlayer.queue = {};\n var queue = callPlayer.queue[frame_id],\n domReady = document.readyState === 'complete';\n\n if (domReady && !iframe) {\n // DOM is ready and iframe does not exist. Log a message\n window.console &&\n console.log('callPlayer: Frame not found; id=' + frame_id);\n if (queue)\n clearInterval(queue.poller);\n } else if (func === 'listening') {\n // Sending the \"listener\" message to the frame, to request status updates\n if (iframe && iframe.contentWindow) {\n func = '{\"event\":\"listening\",\"id\":' + JSON.stringify('' + frame_id) + '}';\n iframe.contentWindow.postMessage(func, '*');\n }\n } else if (!domReady || iframe && (!iframe.contentWindow || queue && !queue.ready) ||\n (!queue || !queue.ready) && typeof func === 'function'\n ) {\n if (!queue)\n queue = callPlayer.queue[frame_id] = [];\n queue.push([func, args]);\n if (!('poller' in queue)) {\n // keep polling until the document and frame is ready\n queue.poller = setInterval(\n function() {\n callPlayer(frame_id, 'listening');\n },\n 250\n );\n // Add a global \"message\" event listener, to catch status updates:\n messageEvent(\n 1,\n function runOnceReady(e) {\n if (!iframe) {\n iframe = document.getElementById(frame_id);\n if (!iframe)\n return;\n if (iframe.tagName.toUpperCase() !== 'IFRAME') {\n iframe = iframe.getElementsByTagName('iframe')[0];\n if (!iframe)\n return;\n }\n }\n if (e.source === iframe.contentWindow) {\n // Assume that the player is ready if we receive a\n // message from the iframe\n clearInterval(queue.poller);\n queue.ready = true;\n messageEvent(0, runOnceReady);\n // .. and release the queue:\n while (tmp = queue.shift()) {\n callPlayer(frame_id, tmp[0], tmp[1]);\n }\n }\n },\n false\n );\n }\n } else if (iframe && iframe.contentWindow) {\n // When a function is supplied, just call it (like \"onYouTubePlayerReady\")\n if (func.call)\n return func();\n // Frame exists, send message\n iframe.contentWindow.postMessage(\n JSON.stringify({\n 'event': 'command',\n 'func': func,\n 'args': args || [],\n 'id': frame_id\n }),\n '*'\n );\n }\n /* IE8 does not support addEventListener... */\n function messageEvent(add, listener) {\n var w3 = add ? window.addEventListener : window.removeEventListener;\n w3\n ?\n w3('message', listener, !1) :\n (add ? window.attachEvent : window.detachEvent)('onmessage', listener);\n }\n }\n\n function onYouTubeIframeAPIReady() {\n $('.js-video').each(function(index, el) {\n let id = $(this).attr('id');\n let video = $(this).data('video'); \n \n let player = new YT.Player(id, {\n height: '100%',\n width: '100%',\n videoId: video,\n // youtube video id\n playerVars: {\n 'autoplay': 0,\n 'rel': 0,\n 'showinfo': 0,\n 'loop': 1,\n 'controls': 1\n },\n events: {\n 'onStateChange': onPlayerStateChange,\n 'onReady': onPlayerReady\n }\n });\n });\n\n $('.js-video-in-popup').each(function(index, el) {\n $('body').on('click', '.js-autoplay-video', function(event) {\n event.preventDefault();\n \n let id = $(this).closest('.js-popup-video').data('video-id'); \n let video = $(this).closest('.js-popup-video').data('popup-video'); \n\n let popupVideo = $('.js-video-in-popup'); \n popupVideo[0].setAttribute('data-video', video);\n popupVideo[0].setAttribute('id', id);\n \n \n let player = new YT.Player(id, {\n height: '100%',\n width: '100%',\n videoId: video,\n // youtube video id\n playerVars: {\n 'autoplay': 1,\n 'rel': 0,\n 'showinfo': 0,\n 'loop': 1,\n 'controls': 1\n },\n events: {\n 'onStateChange': onPlayerStateChange,\n 'onReady': onPlayerReady\n }\n }); \n });\n });\n }\n\n function onPlayerStateChange(event) {\n if (event.data === YT.PlayerState.ENDED) {\n $(event.target.a).next().fadeIn('normal');\n $(event.target.a).parent().find('.js-start-video').show();\n $(event.target.a).parent().find('.js-video-bg').show();\n }\n if (event.data === 2) {\n $(event.target.a).next().fadeIn('normal');\n $(event.target.a).parent().find('.js-start-video').show();\n $(event.target.a).parent().find('.js-video-bg').show();\n }\n }\n\n function onPlayerReady() {\n $('body').on('click', '.js-start-video', function(event) {\n event.preventDefault();\n $(this).closest('.video').find('.js-start-video').hide();\n $(this).closest('.video').find('.js-video-bg').hide();\n let idd = $(this).parent().find('.js-video').attr('id');\n \n $(`#${idd}`).show();\n callPlayer(idd, 'playVideo');\n $(this).closest('.video').removeClass('is-preview');\n });\n\n }\n\n window.onload = () => {\n onYouTubeIframeAPIReady();\n\n const p = document.getElementById('player');\n $(p).hide();\n $('.video').addClass('is-bg');\n };\n}\n","export function viewportHeight() {\n function calcVH() {\n var vH = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);\n let el = document.getElementById('messenger');\n if(el) {\n el.setAttribute('style', 'height:' + vH + 'px;');\n }\n }\n calcVH();\n window.addEventListener('onorientationchange', calcVH, true);\n var scrollTimeout;\n var throttle = 200;\n $(window).on('resize', function() {\n if (!scrollTimeout) {\n scrollTimeout = setTimeout(function() {\n calcVH();\n scrollTimeout = null;\n }, throttle);\n }\n });\n\n \n}\n","export const env = {\n STRIPE_PUBLISHABLE_KEY: \"pk_live_0I7uVZYmtBOjJ6zFtSVE0sIr\",\n MUUCHIT_UPLIFT_FEE_PERCENT: \"15\",\n MUUCHIT_ADMIN_EMAIL: \"hello@muuchit.com\",\n GOOGLE_MAPS_API_KEY: \"AIzaSyCk4TQAtoZg9HFhMWmUykTyvHMvakkg2c4\",\n RECAPTCHA_SITE_KEY: \"6Lf7ZpoUAAAAAOlJ_fJB8um5di5jpn47sD0Sn8tZ\",\n INITIAL_BOOKING_EXPIRATION_TIME_IN_MINUTES: \"15\",\n TWILIO_PHONE_MASK: \"000-000-0000\"\n}\n","export default function isTouchDevice() {\n return 'ontouchstart' in window \n || navigator.maxTouchPoints;\n };","/**\n * @name InfoBox\n * @version 1.1.19 [April 6, 2018]\n * @author Gary Little (inspired by proof-of-concept code from Pamela Fox of Google)\n * @copyright Copyright 2010 Gary Little [gary at luxcentral.com]\n * @fileoverview InfoBox extends the Google Maps JavaScript API V3 OverlayView class.\n *
\n * An InfoBox behaves like a google.maps.InfoWindow, but it supports several\n * additional properties for advanced styling. An InfoBox can also be used as a map label.\n *
\n * An InfoBox also fires the same events as a google.maps.InfoWindow.\n */\n\n/*!\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*jslint browser:true */\n/*global google */\n\n/**\n * @name InfoBoxOptions\n * @class This class represents the optional parameter passed to the {@link InfoBox} constructor.\n * @property {string|Node} content The content of the InfoBox (plain text or an HTML DOM node).\n * @property {boolean} [disableAutoPan=false] Disable auto-pan on open.\n * @property {number} maxWidth The maximum width (in pixels) of the InfoBox. Set to 0 if no maximum.\n * @property {Size} pixelOffset The offset (in pixels) from the top left corner of the InfoBox\n * (or the bottom left corner if the alignBottom property is true)\n * to the map pixel corresponding to position.\n * @property {LatLng} position The geographic location at which to display the InfoBox.\n * @property {number} zIndex The CSS z-index style value for the InfoBox.\n * Note: This value overrides a zIndex setting specified in the boxStyle property.\n * @property {string} [boxClass=\"infoBox\"] The name of the CSS class defining the styles for the InfoBox container.\n * @property {Object} [boxStyle] An object literal whose properties define specific CSS\n * style values to be applied to the InfoBox. Style values defined here override those that may\n * be defined in the boxClass style sheet. If this property is changed after the\n * InfoBox has been created, all previously set styles (except those defined in the style sheet)\n * are removed from the InfoBox before the new style values are applied.\n * @property {string} closeBoxMargin The CSS margin style value for the close box.\n * The default is \"2px\" (a 2-pixel margin on all sides).\n * @property {string} closeBoxTitle The tool tip for the close box. The default is \" Close \".\n * @property {string} closeBoxURL The URL of the image representing the close box.\n * Note: The default is the URL for Google's standard close box.\n * Set this property to \"\" if no close box is required.\n * @property {Size} infoBoxClearance Minimum offset (in pixels) from the InfoBox to the\n * map edge after an auto-pan.\n * @property {boolean} [isHidden=false] Hide the InfoBox on open.\n * [Deprecated in favor of the visible property.]\n * @property {boolean} [visible=true] Show the InfoBox on open.\n * @property {boolean} alignBottom Align the bottom left corner of the InfoBox to the position\n * location (default is false which means that the top left corner of the InfoBox is aligned).\n * @property {string} pane The pane where the InfoBox is to appear (default is \"floatPane\").\n * Set the pane to \"mapPane\" if the InfoBox is being used as a map label.\n * Valid pane names are the property names for the google.maps.MapPanes object.\n * @property {boolean} enableEventPropagation Propagate mousedown, mousemove, mouseover, mouseout,\n * mouseup, click, dblclick, touchstart, touchend, touchmove, and contextmenu events in the InfoBox\n * (default is false to mimic the behavior of a google.maps.InfoWindow). Set\n * this property to true if the InfoBox is being used as a map label.\n */\n\n/**\n * Creates an InfoBox with the options specified in {@link InfoBoxOptions}.\n * Call InfoBox.open to add the box to the map.\n * @constructor\n * @param {InfoBoxOptions} [optOpts]\n */\nfunction InfoBox(optOpts) {\n optOpts = optOpts || {};\n \n google.maps.OverlayView.apply(this, arguments);\n \n // Standard options (in common with google.maps.InfoWindow):\n //\n this.content_ = optOpts.content || '';\n this.disableAutoPan_ = optOpts.disableAutoPan || false;\n this.maxWidth_ = optOpts.maxWidth || 0;\n this.pixelOffset_ = optOpts.pixelOffset || new google.maps.Size(0, 0);\n this.position_ = optOpts.position || new google.maps.LatLng(0, 0);\n this.zIndex_ = optOpts.zIndex || null;\n \n // Additional options (unique to InfoBox):\n //\n this.boxClass_ = optOpts.boxClass || 'infoBox';\n this.boxStyle_ = optOpts.boxStyle || {};\n this.closeBoxMargin_ = optOpts.closeBoxMargin || '2px';\n this.closeBoxURL_ = optOpts.closeBoxURL || '//www.google.com/intl/en_us/mapfiles/close.gif';\n if (optOpts.closeBoxURL === '') {\n this.closeBoxURL_ = '';\n }\n this.closeBoxTitle_ = optOpts.closeBoxTitle || ' Close ';\n this.infoBoxClearance_ = optOpts.infoBoxClearance || new google.maps.Size(1, 1);\n \n if (typeof optOpts.visible === 'undefined') {\n if (typeof optOpts.isHidden === 'undefined') {\n optOpts.visible = true;\n } else {\n optOpts.visible = !optOpts.isHidden;\n }\n }\n this.isHidden_ = !optOpts.visible;\n \n this.alignBottom_ = optOpts.alignBottom || false;\n this.pane_ = optOpts.pane || 'floatPane';\n this.enableEventPropagation_ = optOpts.enableEventPropagation || false;\n \n this.div_ = null;\n this.closeListener_ = null;\n this.moveListener_ = null;\n this.contextListener_ = null;\n this.eventListeners_ = null;\n this.fixedWidthSet_ = null;\n}\n \n/* InfoBox extends OverlayView in the Google Maps API v3.\n */\nInfoBox.prototype = new google.maps.OverlayView();\n \n/**\n * Creates the DIV representing the InfoBox.\n * @private\n */\nInfoBox.prototype.createInfoBoxDiv_ = function() {\n \n var i;\n var events;\n var bw;\n var me = this;\n \n // This handler prevents an event in the InfoBox from being passed on to the map.\n //\n var cancelHandler = function(e) {\n e.cancelBubble = true;\n if (e.stopPropagation) {\n e.stopPropagation();\n }\n };\n \n // This handler ignores the current event in the InfoBox and conditionally prevents\n // the event from being passed on to the map. It is used for the contextmenu event.\n //\n var ignoreHandler = function(e) {\n \n e.returnValue = false;\n \n if (e.preventDefault) {\n \n e.preventDefault();\n }\n \n if (!me.enableEventPropagation_) {\n \n cancelHandler(e);\n }\n };\n \n if (!this.div_) {\n \n this.div_ = document.createElement('div');\n \n this.setBoxStyle_();\n \n if (typeof this.content_.nodeType === 'undefined') {\n this.div_.innerHTML = this.getCloseBoxImg_() + this.content_;\n } else {\n this.div_.innerHTML = this.getCloseBoxImg_();\n this.div_.appendChild(this.content_);\n }\n \n // Add the InfoBox DIV to the DOM\n this.getPanes()[this.pane_].appendChild(this.div_);\n \n this.addClickHandler_();\n \n if (this.div_.style.width) {\n \n this.fixedWidthSet_ = true;\n \n } else {\n \n if (this.maxWidth_ !== 0 && this.div_.offsetWidth > this.maxWidth_) {\n \n this.div_.style.width = this.maxWidth_;\n this.div_.style.overflow = 'auto';\n this.fixedWidthSet_ = true;\n \n } else { // The following code is needed to overcome problems with MSIE\n \n bw = this.getBoxWidths_();\n \n this.div_.style.width = (this.div_.offsetWidth - bw.left - bw.right) + 'px';\n this.fixedWidthSet_ = false;\n }\n }\n \n this.panBox_(this.disableAutoPan_);\n \n if (!this.enableEventPropagation_) {\n \n this.eventListeners_ = [];\n \n // Cancel event propagation.\n //\n // Note: mousemove not included (to resolve Issue 152)\n events = ['mousedown', 'mouseover', 'mouseout', 'mouseup',\n 'click', 'dblclick', 'touchstart', 'touchend', 'touchmove'];\n \n for (i = 0; i < events.length; i++) {\n \n this.eventListeners_.push(google.maps.event.addDomListener(this.div_, events[i], cancelHandler));\n }\n \n // Workaround for Google bug that causes the cursor to change to a pointer\n // when the mouse moves over a marker underneath InfoBox.\n this.eventListeners_.push(google.maps.event.addDomListener(this.div_, 'mouseover', function(e) {\n this.style.cursor = 'default';\n }));\n }\n \n this.contextListener_ = google.maps.event.addDomListener(this.div_, 'contextmenu', ignoreHandler);\n \n /**\n * This event is fired when the DIV containing the InfoBox's content is attached to the DOM.\n * @name InfoBox#domready\n * @event\n */\n google.maps.event.trigger(this, 'domready');\n }\n};\n \n/**\n * Returns the HTML tag for the close box.\n * @private\n */\nInfoBox.prototype.getCloseBoxImg_ = function() {\n \n var img = '';\n \n if (this.closeBoxURL_ !== '') {\n \n img = '\";\n }\n \n return img;\n};\n \n/**\n * Adds the click handler to the InfoBox close box.\n * @private\n */\nInfoBox.prototype.addClickHandler_ = function() {\n \n var closeBox;\n \n if (this.closeBoxURL_ !== '') {\n \n closeBox = this.div_.firstChild;\n this.closeListener_ = google.maps.event.addDomListener(closeBox, 'click', this.getCloseClickHandler_());\n \n } else {\n \n this.closeListener_ = null;\n }\n};\n \n/**\n * Returns the function to call when the user clicks the close box of an InfoBox.\n * @private\n */\nInfoBox.prototype.getCloseClickHandler_ = function() {\n \n var me = this;\n \n return function(e) {\n \n // 1.0.3 fix: Always prevent propagation of a close box click to the map:\n e.cancelBubble = true;\n \n if (e.stopPropagation) {\n \n e.stopPropagation();\n }\n \n /**\n * This event is fired when the InfoBox's close box is clicked.\n * @name InfoBox#closeclick\n * @event\n */\n google.maps.event.trigger(me, 'closeclick');\n \n me.close();\n };\n};\n \n/**\n * Pans the map so that the InfoBox appears entirely within the map's visible area.\n * @private\n */\nInfoBox.prototype.panBox_ = function(disablePan) {\n \n var map;\n var bounds;\n var xOffset = 0, yOffset = 0;\n \n if (!disablePan) {\n \n map = this.getMap();\n \n if (map instanceof google.maps.Map) { // Only pan if attached to map, not panorama\n \n if (!map.getBounds().contains(this.position_)) {\n // Marker not in visible area of map, so set center\n // of map to the marker position first.\n map.setCenter(this.position_);\n }\n \n var iwOffsetX = this.pixelOffset_.width;\n var iwOffsetY = this.pixelOffset_.height;\n var iwWidth = this.div_.offsetWidth;\n var iwHeight = this.div_.offsetHeight;\n var padX = this.infoBoxClearance_.width;\n var padY = this.infoBoxClearance_.height;\n \n if (map.panToBounds.length === 2) {\n // Using projection.fromLatLngToContainerPixel to compute the infowindow position\n // does not work correctly anymore for JS Maps API v3.32 and above if there is a\n // previous synchronous call that causes the map to animate (e.g. setCenter when\n // the position is not within bounds). Hence, we are using panToBounds with\n // padding instead, which works synchronously.\n var padding = {left: 0, right: 0, top: 0, bottom: 0};\n padding.left = -iwOffsetX + padX;\n padding.right = iwOffsetX + iwWidth + padX;\n if (this.alignBottom_) {\n padding.top = -iwOffsetY + padY + iwHeight;\n padding.bottom = iwOffsetY + padY;\n } else {\n padding.top = -iwOffsetY + padY;\n padding.bottom = iwOffsetY + iwHeight + padY;\n }\n map.panToBounds(new google.maps.LatLngBounds(this.position_), padding);\n } else {\n var mapDiv = map.getDiv();\n var mapWidth = mapDiv.offsetWidth;\n var mapHeight = mapDiv.offsetHeight;\n var pixPosition = this.getProjection().fromLatLngToContainerPixel(this.position_);\n \n if (pixPosition.x < (-iwOffsetX + padX)) {\n xOffset = pixPosition.x + iwOffsetX - padX;\n } else if ((pixPosition.x + iwWidth + iwOffsetX + padX) > mapWidth) {\n xOffset = pixPosition.x + iwWidth + iwOffsetX + padX - mapWidth;\n }\n if (this.alignBottom_) {\n if (pixPosition.y < (-iwOffsetY + padY + iwHeight)) {\n yOffset = pixPosition.y + iwOffsetY - padY - iwHeight;\n } else if ((pixPosition.y + iwOffsetY + padY) > mapHeight) {\n yOffset = pixPosition.y + iwOffsetY + padY - mapHeight;\n }\n } else {\n if (pixPosition.y < (-iwOffsetY + padY)) {\n yOffset = pixPosition.y + iwOffsetY - padY;\n } else if ((pixPosition.y + iwHeight + iwOffsetY + padY) > mapHeight) {\n yOffset = pixPosition.y + iwHeight + iwOffsetY + padY - mapHeight;\n }\n }\n \n if (!(xOffset === 0 && yOffset === 0)) {\n \n // Move the map to the shifted center.\n //\n var c = map.getCenter();\n map.panBy(xOffset, yOffset);\n }\n }\n }\n }\n};\n \n/**\n * Sets the style of the InfoBox by setting the style sheet and applying\n * other specific styles requested.\n * @private\n */\nInfoBox.prototype.setBoxStyle_ = function() {\n \n var i, boxStyle;\n \n if (this.div_) {\n \n // Apply style values from the style sheet defined in the boxClass parameter:\n this.div_.className = this.boxClass_;\n \n // Clear existing inline style values:\n this.div_.style.cssText = '';\n \n // Apply style values defined in the boxStyle parameter:\n boxStyle = this.boxStyle_;\n for (i in boxStyle) {\n \n if (boxStyle.hasOwnProperty(i)) {\n \n this.div_.style[i] = boxStyle[i];\n }\n }\n \n // Fix for iOS disappearing InfoBox problem.\n // See http://stackoverflow.com/questions/9229535/google-maps-markers-disappear-at-certain-zoom-level-only-on-iphone-ipad\n // Required: use \"matrix\" technique to specify transforms in order to avoid this bug.\n if ((typeof this.div_.style.WebkitTransform === 'undefined') || (this.div_.style.WebkitTransform.indexOf('translateZ') === -1 && this.div_.style.WebkitTransform.indexOf('matrix') === -1)) {\n \n this.div_.style.WebkitTransform = 'translateZ(0)';\n }\n \n // Fix up opacity style for benefit of MSIE:\n //\n if (typeof this.div_.style.opacity !== 'undefined' && this.div_.style.opacity !== '') {\n // See http://www.quirksmode.org/css/opacity.html\n this.div_.style.MsFilter = '\"progid:DXImageTransform.Microsoft.Alpha(Opacity=' + (this.div_.style.opacity * 100) + ')\"';\n this.div_.style.filter = 'alpha(opacity=' + (this.div_.style.opacity * 100) + ')';\n }\n \n // Apply required styles:\n //\n this.div_.style.position = 'absolute';\n this.div_.style.visibility = 'hidden';\n if (this.zIndex_ !== null) {\n \n this.div_.style.zIndex = this.zIndex_;\n }\n }\n};\n \n/**\n * Get the widths of the borders of the InfoBox.\n * @private\n * @return {Object} widths object (top, bottom left, right)\n */\nInfoBox.prototype.getBoxWidths_ = function() {\n \n var computedStyle;\n var bw = {top: 0, bottom: 0, left: 0, right: 0};\n var box = this.div_;\n \n if (document.defaultView && document.defaultView.getComputedStyle) {\n \n computedStyle = box.ownerDocument.defaultView.getComputedStyle(box, '');\n \n if (computedStyle) {\n \n // The computed styles are always in pixel units (good!)\n bw.top = parseInt(computedStyle.borderTopWidth, 10) || 0;\n bw.bottom = parseInt(computedStyle.borderBottomWidth, 10) || 0;\n bw.left = parseInt(computedStyle.borderLeftWidth, 10) || 0;\n bw.right = parseInt(computedStyle.borderRightWidth, 10) || 0;\n }\n \n } else if (document.documentElement.currentStyle) { // MSIE\n \n if (box.currentStyle) {\n \n // The current styles may not be in pixel units, but assume they are (bad!)\n bw.top = parseInt(box.currentStyle.borderTopWidth, 10) || 0;\n bw.bottom = parseInt(box.currentStyle.borderBottomWidth, 10) || 0;\n bw.left = parseInt(box.currentStyle.borderLeftWidth, 10) || 0;\n bw.right = parseInt(box.currentStyle.borderRightWidth, 10) || 0;\n }\n }\n \n return bw;\n};\n \n/**\n * Invoked when close is called. Do not call it directly.\n */\nInfoBox.prototype.onRemove = function() {\n \n if (this.div_) {\n \n this.div_.parentNode.removeChild(this.div_);\n this.div_ = null;\n }\n};\n \n/**\n * Draws the InfoBox based on the current map projection and zoom level.\n */\nInfoBox.prototype.draw = function() {\n \n this.createInfoBoxDiv_();\n \n var pixPosition = this.getProjection().fromLatLngToDivPixel(this.position_);\n \n this.div_.style.left = (pixPosition.x + this.pixelOffset_.width) + 'px';\n \n if (this.alignBottom_) {\n this.div_.style.bottom = -(pixPosition.y + this.pixelOffset_.height) + 'px';\n } else {\n this.div_.style.top = (pixPosition.y + this.pixelOffset_.height) + 'px';\n }\n \n if (this.isHidden_) {\n \n this.div_.style.visibility = 'hidden';\n \n } else {\n \n this.div_.style.visibility = 'visible';\n }\n};\n \n/**\n * Sets the options for the InfoBox. Note that changes to the maxWidth,\n * closeBoxMargin, closeBoxTitle, closeBoxURL, and\n * enableEventPropagation properties have no affect until the current\n * InfoBox is closed and a new one is opened.\n * @param {InfoBoxOptions} optOpts\n */\nInfoBox.prototype.setOptions = function(optOpts) {\n if (typeof optOpts.boxClass !== 'undefined') { // Must be first\n \n this.boxClass_ = optOpts.boxClass;\n this.setBoxStyle_();\n }\n if (typeof optOpts.boxStyle !== 'undefined') { // Must be second\n \n this.boxStyle_ = optOpts.boxStyle;\n this.setBoxStyle_();\n }\n if (typeof optOpts.content !== 'undefined') {\n \n this.setContent(optOpts.content);\n }\n if (typeof optOpts.disableAutoPan !== 'undefined') {\n \n this.disableAutoPan_ = optOpts.disableAutoPan;\n }\n if (typeof optOpts.maxWidth !== 'undefined') {\n \n this.maxWidth_ = optOpts.maxWidth;\n }\n if (typeof optOpts.pixelOffset !== 'undefined') {\n \n this.pixelOffset_ = optOpts.pixelOffset;\n }\n if (typeof optOpts.alignBottom !== 'undefined') {\n \n this.alignBottom_ = optOpts.alignBottom;\n }\n if (typeof optOpts.position !== 'undefined') {\n \n this.setPosition(optOpts.position);\n }\n if (typeof optOpts.zIndex !== 'undefined') {\n \n this.setZIndex(optOpts.zIndex);\n }\n if (typeof optOpts.closeBoxMargin !== 'undefined') {\n \n this.closeBoxMargin_ = optOpts.closeBoxMargin;\n }\n if (typeof optOpts.closeBoxURL !== 'undefined') {\n \n this.closeBoxURL_ = optOpts.closeBoxURL;\n }\n if (typeof optOpts.closeBoxTitle !== 'undefined') {\n \n this.closeBoxTitle_ = optOpts.closeBoxTitle;\n }\n if (typeof optOpts.infoBoxClearance !== 'undefined') {\n \n this.infoBoxClearance_ = optOpts.infoBoxClearance;\n }\n if (typeof optOpts.isHidden !== 'undefined') {\n \n this.isHidden_ = optOpts.isHidden;\n }\n if (typeof optOpts.visible !== 'undefined') {\n \n this.isHidden_ = !optOpts.visible;\n }\n if (typeof optOpts.enableEventPropagation !== 'undefined') {\n \n this.enableEventPropagation_ = optOpts.enableEventPropagation;\n }\n \n if (this.div_) {\n \n this.draw();\n }\n};\n \n/**\n * Sets the content of the InfoBox.\n * The content can be plain text or an HTML DOM node.\n * @param {string|Node} content\n */\nInfoBox.prototype.setContent = function(content) {\n this.content_ = content;\n \n if (this.div_) {\n \n if (this.closeListener_) {\n \n google.maps.event.removeListener(this.closeListener_);\n this.closeListener_ = null;\n }\n \n // Odd code required to make things work with MSIE.\n //\n if (!this.fixedWidthSet_) {\n \n this.div_.style.width = '';\n }\n \n if (typeof content.nodeType === 'undefined') {\n this.div_.innerHTML = this.getCloseBoxImg_() + content;\n } else {\n this.div_.innerHTML = this.getCloseBoxImg_();\n this.div_.appendChild(content);\n }\n \n // Perverse code required to make things work with MSIE.\n // (Ensures the close box does, in fact, float to the right.)\n //\n if (!this.fixedWidthSet_) {\n this.div_.style.width = this.div_.offsetWidth + 'px';\n if (typeof content.nodeType === 'undefined') {\n this.div_.innerHTML = this.getCloseBoxImg_() + content;\n } else {\n this.div_.innerHTML = this.getCloseBoxImg_();\n this.div_.appendChild(content);\n }\n }\n \n this.addClickHandler_();\n }\n \n /**\n * This event is fired when the content of the InfoBox changes.\n * @name InfoBox#content_changed\n * @event\n */\n google.maps.event.trigger(this, 'content_changed');\n};\n \n/**\n * Sets the geographic location of the InfoBox.\n * @param {LatLng} latlng\n */\nInfoBox.prototype.setPosition = function(latlng) {\n \n this.position_ = latlng;\n \n if (this.div_) {\n \n this.draw();\n }\n \n /**\n * This event is fired when the position of the InfoBox changes.\n * @name InfoBox#position_changed\n * @event\n */\n google.maps.event.trigger(this, 'position_changed');\n};\n \n/**\n * Sets the zIndex style for the InfoBox.\n * @param {number} index\n */\nInfoBox.prototype.setZIndex = function(index) {\n \n this.zIndex_ = index;\n \n if (this.div_) {\n \n this.div_.style.zIndex = index;\n }\n \n /**\n * This event is fired when the zIndex of the InfoBox changes.\n * @name InfoBox#zindex_changed\n * @event\n */\n google.maps.event.trigger(this, 'zindex_changed');\n};\n \n/**\n * Sets the visibility of the InfoBox.\n * @param {boolean} isVisible\n */\nInfoBox.prototype.setVisible = function(isVisible) {\n \n this.isHidden_ = !isVisible;\n if (this.div_) {\n this.div_.style.visibility = (this.isHidden_ ? 'hidden' : 'visible');\n }\n};\n \n/**\n * Returns the content of the InfoBox.\n * @returns {string}\n */\nInfoBox.prototype.getContent = function() {\n \n return this.content_;\n};\n \n/**\n * Returns the geographic location of the InfoBox.\n * @returns {LatLng}\n */\nInfoBox.prototype.getPosition = function() {\n \n return this.position_;\n};\n \n/**\n * Returns the zIndex for the InfoBox.\n * @returns {number}\n */\nInfoBox.prototype.getZIndex = function() {\n \n return this.zIndex_;\n};\n \n/**\n * Returns a flag indicating whether the InfoBox is visible.\n * @returns {boolean}\n */\nInfoBox.prototype.getVisible = function() {\n \n var isVisible;\n \n if ((typeof this.getMap() === 'undefined') || (this.getMap() === null)) {\n isVisible = false;\n } else {\n isVisible = !this.isHidden_;\n }\n return isVisible;\n};\n \n/**\n * Returns the width of the InfoBox in pixels.\n * @returns {number}\n */\nInfoBox.prototype.getWidth = function() {\n var width = null;\n \n if (this.div_) {\n width = this.div_.offsetWidth;\n }\n \n return width;\n};\n \n/**\n * Returns the height of the InfoBox in pixels.\n * @returns {number}\n */\nInfoBox.prototype.getHeight = function() {\n var height = null;\n \n if (this.div_) {\n height = this.div_.offsetHeight;\n }\n \n return height;\n};\n \n/**\n * Shows the InfoBox. [Deprecated; use setVisible instead.]\n */\nInfoBox.prototype.show = function() {\n \n this.isHidden_ = false;\n if (this.div_) {\n this.div_.style.visibility = 'visible';\n }\n};\n \n/**\n * Hides the InfoBox. [Deprecated; use setVisible instead.]\n */\nInfoBox.prototype.hide = function() {\n \n this.isHidden_ = true;\n if (this.div_) {\n this.div_.style.visibility = 'hidden';\n }\n};\n \n/**\n * Adds the InfoBox to the specified map or Street View panorama. If anchor\n * (usually a google.maps.Marker) is specified, the position\n * of the InfoBox is set to the position of the anchor. If the\n * anchor is dragged to a new location, the InfoBox moves as well.\n * @param {Map|StreetViewPanorama} map\n * @param {MVCObject} [anchor]\n */\nInfoBox.prototype.open = function(map, anchor) {\n \n var me = this;\n \n if (anchor) {\n \n this.setPosition(anchor.getPosition()); // BUG FIX 2/17/2018: needed for v3.32\n this.moveListener_ = google.maps.event.addListener(anchor, 'position_changed', function() {\n me.setPosition(this.getPosition());\n });\n }\n \n this.setMap(map);\n \n if (this.div_) {\n \n this.panBox_(this.disableAutoPan_); // BUG FIX 2/17/2018: add missing parameter\n }\n};\n \n/**\n * Removes the InfoBox from the map.\n */\nInfoBox.prototype.close = function() {\n \n var i;\n \n if (this.closeListener_) {\n \n google.maps.event.removeListener(this.closeListener_);\n this.closeListener_ = null;\n }\n \n if (this.eventListeners_) {\n \n for (i = 0; i < this.eventListeners_.length; i++) {\n \n google.maps.event.removeListener(this.eventListeners_[i]);\n }\n this.eventListeners_ = null;\n }\n \n if (this.moveListener_) {\n \n google.maps.event.removeListener(this.moveListener_);\n this.moveListener_ = null;\n }\n \n if (this.contextListener_) {\n \n google.maps.event.removeListener(this.contextListener_);\n this.contextListener_ = null;\n }\n \n this.setMap(null);\n};\n\n\nmodule.exports = InfoBox;\n","// add all images to manifest.js from app/packs/img folder\nconst img = require.context('../img', true);\nconst media = require.context('../media', true);\n\nimport \"./envVariables.js.erb\"\nimport \"../redesign-stylesheets/app\"\nimport 'uppy/dist/uppy.min.css'\nimport 'tinymce/skins/ui/oxide/skin.css'\nimport 'jquery-validation'\nimport \"./app\"\n","// extracted by mini-css-extract-plugin","/**\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. The function also has a property 'clear' \n * that is a function which will clear the timer to prevent previously scheduled executions. \n *\n * @source underscore.js\n * @see http://unscriptable.com/2009/03/20/debouncing-javascript-methods/\n * @param {Function} function to wrap\n * @param {Number} timeout in ms (`100`)\n * @param {Boolean} whether to execute at the beginning (`false`)\n * @api public\n */\nfunction debounce(func, wait, immediate) {\n var timeout, args, context, timestamp, result;\n if (null == wait) wait = 100;\n\n function later() {\n var last = Date.now() - timestamp;\n\n if (last < wait && last >= 0) {\n timeout = setTimeout(later, wait - last);\n } else {\n timeout = null;\n\n if (!immediate) {\n result = func.apply(context, args);\n context = args = null;\n }\n }\n }\n\n ;\n\n var debounced = function debounced() {\n context = this;\n args = arguments;\n timestamp = Date.now();\n var callNow = immediate && !timeout;\n if (!timeout) timeout = setTimeout(later, wait);\n\n if (callNow) {\n result = func.apply(context, args);\n context = args = null;\n }\n\n return result;\n };\n\n debounced.clear = function () {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n }\n };\n\n debounced.flush = function () {\n if (timeout) {\n result = func.apply(context, args);\n context = args = null;\n clearTimeout(timeout);\n timeout = null;\n }\n };\n\n return debounced;\n}\n\n; // Adds compatibility for ES modules\n\ndebounce.debounce = debounce;\nmodule.exports = debounce;","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n/* flatpickr v4.6.3, @license MIT */\n(function (global, factory) {\n (typeof exports === \"undefined\" ? \"undefined\" : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = global || self, global.flatpickr = factory());\n})(this, function () {\n 'use strict';\n /*! *****************************************************************************\r\n Copyright (c) Microsoft Corporation. All rights reserved.\r\n Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\n this file except in compliance with the License. You may obtain a copy of the\r\n License at http://www.apache.org/licenses/LICENSE-2.0\r\n THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\n WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\n MERCHANTABLITY OR NON-INFRINGEMENT.\r\n See the Apache Version 2.0 License for specific language governing permissions\r\n and limitations under the License.\r\n ***************************************************************************** */\n\n var _assign = function __assign() {\n _assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n }\n\n return t;\n };\n\n return _assign.apply(this, arguments);\n };\n\n var HOOKS = [\"onChange\", \"onClose\", \"onDayCreate\", \"onDestroy\", \"onKeyDown\", \"onMonthChange\", \"onOpen\", \"onParseConfig\", \"onReady\", \"onValueUpdate\", \"onYearChange\", \"onPreCalendarPosition\"];\n var defaults = {\n _disable: [],\n _enable: [],\n allowInput: false,\n altFormat: \"F j, Y\",\n altInput: false,\n altInputClass: \"form-control input\",\n animate: (typeof window === \"undefined\" ? \"undefined\" : _typeof(window)) === \"object\" && window.navigator.userAgent.indexOf(\"MSIE\") === -1,\n ariaDateFormat: \"F j, Y\",\n clickOpens: true,\n closeOnSelect: true,\n conjunction: \", \",\n dateFormat: \"Y-m-d\",\n defaultHour: 12,\n defaultMinute: 0,\n defaultSeconds: 0,\n disable: [],\n disableMobile: false,\n enable: [],\n enableSeconds: false,\n enableTime: false,\n errorHandler: function errorHandler(err) {\n return typeof console !== \"undefined\" && console.warn(err);\n },\n getWeek: function getWeek(givenDate) {\n var date = new Date(givenDate.getTime());\n date.setHours(0, 0, 0, 0); // Thursday in current week decides the year.\n\n date.setDate(date.getDate() + 3 - (date.getDay() + 6) % 7); // January 4 is always in week 1.\n\n var week1 = new Date(date.getFullYear(), 0, 4); // Adjust to Thursday in week 1 and count number of weeks from date to week1.\n\n return 1 + Math.round(((date.getTime() - week1.getTime()) / 86400000 - 3 + (week1.getDay() + 6) % 7) / 7);\n },\n hourIncrement: 1,\n ignoredFocusElements: [],\n inline: false,\n locale: \"default\",\n minuteIncrement: 5,\n mode: \"single\",\n monthSelectorType: \"dropdown\",\n nextArrow: \"\",\n noCalendar: false,\n now: new Date(),\n onChange: [],\n onClose: [],\n onDayCreate: [],\n onDestroy: [],\n onKeyDown: [],\n onMonthChange: [],\n onOpen: [],\n onParseConfig: [],\n onReady: [],\n onValueUpdate: [],\n onYearChange: [],\n onPreCalendarPosition: [],\n plugins: [],\n position: \"auto\",\n positionElement: undefined,\n prevArrow: \"\",\n shorthandCurrentMonth: false,\n showMonths: 1,\n \"static\": false,\n time_24hr: false,\n weekNumbers: false,\n wrap: false\n };\n var english = {\n weekdays: {\n shorthand: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n longhand: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"]\n },\n months: {\n shorthand: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"],\n longhand: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"]\n },\n daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],\n firstDayOfWeek: 0,\n ordinal: function ordinal(nth) {\n var s = nth % 100;\n if (s > 3 && s < 21) return \"th\";\n\n switch (s % 10) {\n case 1:\n return \"st\";\n\n case 2:\n return \"nd\";\n\n case 3:\n return \"rd\";\n\n default:\n return \"th\";\n }\n },\n rangeSeparator: \" to \",\n weekAbbreviation: \"Wk\",\n scrollTitle: \"Scroll to increment\",\n toggleTitle: \"Click to toggle\",\n amPM: [\"AM\", \"PM\"],\n yearAriaLabel: \"Year\",\n hourAriaLabel: \"Hour\",\n minuteAriaLabel: \"Minute\",\n time_24hr: false\n };\n\n var pad = function pad(number) {\n return (\"0\" + number).slice(-2);\n };\n\n var _int = function _int(bool) {\n return bool === true ? 1 : 0;\n };\n /* istanbul ignore next */\n\n\n function debounce(func, wait, immediate) {\n if (immediate === void 0) {\n immediate = false;\n }\n\n var timeout;\n return function () {\n var context = this,\n args = arguments;\n timeout !== null && clearTimeout(timeout);\n timeout = window.setTimeout(function () {\n timeout = null;\n if (!immediate) func.apply(context, args);\n }, wait);\n if (immediate && !timeout) func.apply(context, args);\n };\n }\n\n var arrayify = function arrayify(obj) {\n return obj instanceof Array ? obj : [obj];\n };\n\n function toggleClass(elem, className, bool) {\n if (bool === true) return elem.classList.add(className);\n elem.classList.remove(className);\n }\n\n function createElement(tag, className, content) {\n var e = window.document.createElement(tag);\n className = className || \"\";\n content = content || \"\";\n e.className = className;\n if (content !== undefined) e.textContent = content;\n return e;\n }\n\n function clearNode(node) {\n while (node.firstChild) {\n node.removeChild(node.firstChild);\n }\n }\n\n function findParent(node, condition) {\n if (condition(node)) return node;else if (node.parentNode) return findParent(node.parentNode, condition);\n return undefined; // nothing found\n }\n\n function createNumberInput(inputClassName, opts) {\n var wrapper = createElement(\"div\", \"numInputWrapper\"),\n numInput = createElement(\"input\", \"numInput \" + inputClassName),\n arrowUp = createElement(\"span\", \"arrowUp\"),\n arrowDown = createElement(\"span\", \"arrowDown\");\n\n if (navigator.userAgent.indexOf(\"MSIE 9.0\") === -1) {\n numInput.type = \"number\";\n } else {\n numInput.type = \"text\";\n numInput.pattern = \"\\\\d*\";\n }\n\n if (opts !== undefined) for (var key in opts) {\n numInput.setAttribute(key, opts[key]);\n }\n wrapper.appendChild(numInput);\n wrapper.appendChild(arrowUp);\n wrapper.appendChild(arrowDown);\n return wrapper;\n }\n\n function getEventTarget(event) {\n if (typeof event.composedPath === \"function\") {\n var path = event.composedPath();\n return path[0];\n }\n\n return event.target;\n }\n\n var doNothing = function doNothing() {\n return undefined;\n };\n\n var monthToStr = function monthToStr(monthNumber, shorthand, locale) {\n return locale.months[shorthand ? \"shorthand\" : \"longhand\"][monthNumber];\n };\n\n var revFormat = {\n D: doNothing,\n F: function F(dateObj, monthName, locale) {\n dateObj.setMonth(locale.months.longhand.indexOf(monthName));\n },\n G: function G(dateObj, hour) {\n dateObj.setHours(parseFloat(hour));\n },\n H: function H(dateObj, hour) {\n dateObj.setHours(parseFloat(hour));\n },\n J: function J(dateObj, day) {\n dateObj.setDate(parseFloat(day));\n },\n K: function K(dateObj, amPM, locale) {\n dateObj.setHours(dateObj.getHours() % 12 + 12 * _int(new RegExp(locale.amPM[1], \"i\").test(amPM)));\n },\n M: function M(dateObj, shortMonth, locale) {\n dateObj.setMonth(locale.months.shorthand.indexOf(shortMonth));\n },\n S: function S(dateObj, seconds) {\n dateObj.setSeconds(parseFloat(seconds));\n },\n U: function U(_, unixSeconds) {\n return new Date(parseFloat(unixSeconds) * 1000);\n },\n W: function W(dateObj, weekNum, locale) {\n var weekNumber = parseInt(weekNum);\n var date = new Date(dateObj.getFullYear(), 0, 2 + (weekNumber - 1) * 7, 0, 0, 0, 0);\n date.setDate(date.getDate() - date.getDay() + locale.firstDayOfWeek);\n return date;\n },\n Y: function Y(dateObj, year) {\n dateObj.setFullYear(parseFloat(year));\n },\n Z: function Z(_, ISODate) {\n return new Date(ISODate);\n },\n d: function d(dateObj, day) {\n dateObj.setDate(parseFloat(day));\n },\n h: function h(dateObj, hour) {\n dateObj.setHours(parseFloat(hour));\n },\n i: function i(dateObj, minutes) {\n dateObj.setMinutes(parseFloat(minutes));\n },\n j: function j(dateObj, day) {\n dateObj.setDate(parseFloat(day));\n },\n l: doNothing,\n m: function m(dateObj, month) {\n dateObj.setMonth(parseFloat(month) - 1);\n },\n n: function n(dateObj, month) {\n dateObj.setMonth(parseFloat(month) - 1);\n },\n s: function s(dateObj, seconds) {\n dateObj.setSeconds(parseFloat(seconds));\n },\n u: function u(_, unixMillSeconds) {\n return new Date(parseFloat(unixMillSeconds));\n },\n w: doNothing,\n y: function y(dateObj, year) {\n dateObj.setFullYear(2000 + parseFloat(year));\n }\n };\n var tokenRegex = {\n D: \"(\\\\w+)\",\n F: \"(\\\\w+)\",\n G: \"(\\\\d\\\\d|\\\\d)\",\n H: \"(\\\\d\\\\d|\\\\d)\",\n J: \"(\\\\d\\\\d|\\\\d)\\\\w+\",\n K: \"\",\n M: \"(\\\\w+)\",\n S: \"(\\\\d\\\\d|\\\\d)\",\n U: \"(.+)\",\n W: \"(\\\\d\\\\d|\\\\d)\",\n Y: \"(\\\\d{4})\",\n Z: \"(.+)\",\n d: \"(\\\\d\\\\d|\\\\d)\",\n h: \"(\\\\d\\\\d|\\\\d)\",\n i: \"(\\\\d\\\\d|\\\\d)\",\n j: \"(\\\\d\\\\d|\\\\d)\",\n l: \"(\\\\w+)\",\n m: \"(\\\\d\\\\d|\\\\d)\",\n n: \"(\\\\d\\\\d|\\\\d)\",\n s: \"(\\\\d\\\\d|\\\\d)\",\n u: \"(.+)\",\n w: \"(\\\\d\\\\d|\\\\d)\",\n y: \"(\\\\d{2})\"\n };\n var formats = {\n // get the date in UTC\n Z: function Z(date) {\n return date.toISOString();\n },\n // weekday name, short, e.g. Thu\n D: function D(date, locale, options) {\n return locale.weekdays.shorthand[formats.w(date, locale, options)];\n },\n // full month name e.g. January\n F: function F(date, locale, options) {\n return monthToStr(formats.n(date, locale, options) - 1, false, locale);\n },\n // padded hour 1-12\n G: function G(date, locale, options) {\n return pad(formats.h(date, locale, options));\n },\n // hours with leading zero e.g. 03\n H: function H(date) {\n return pad(date.getHours());\n },\n // day (1-30) with ordinal suffix e.g. 1st, 2nd\n J: function J(date, locale) {\n return locale.ordinal !== undefined ? date.getDate() + locale.ordinal(date.getDate()) : date.getDate();\n },\n // AM/PM\n K: function K(date, locale) {\n return locale.amPM[_int(date.getHours() > 11)];\n },\n // shorthand month e.g. Jan, Sep, Oct, etc\n M: function M(date, locale) {\n return monthToStr(date.getMonth(), true, locale);\n },\n // seconds 00-59\n S: function S(date) {\n return pad(date.getSeconds());\n },\n // unix timestamp\n U: function U(date) {\n return date.getTime() / 1000;\n },\n W: function W(date, _, options) {\n return options.getWeek(date);\n },\n // full year e.g. 2016\n Y: function Y(date) {\n return date.getFullYear();\n },\n // day in month, padded (01-30)\n d: function d(date) {\n return pad(date.getDate());\n },\n // hour from 1-12 (am/pm)\n h: function h(date) {\n return date.getHours() % 12 ? date.getHours() % 12 : 12;\n },\n // minutes, padded with leading zero e.g. 09\n i: function i(date) {\n return pad(date.getMinutes());\n },\n // day in month (1-30)\n j: function j(date) {\n return date.getDate();\n },\n // weekday name, full, e.g. Thursday\n l: function l(date, locale) {\n return locale.weekdays.longhand[date.getDay()];\n },\n // padded month number (01-12)\n m: function m(date) {\n return pad(date.getMonth() + 1);\n },\n // the month number (1-12)\n n: function n(date) {\n return date.getMonth() + 1;\n },\n // seconds 0-59\n s: function s(date) {\n return date.getSeconds();\n },\n // Unix Milliseconds\n u: function u(date) {\n return date.getTime();\n },\n // number of the day of the week\n w: function w(date) {\n return date.getDay();\n },\n // last two digits of year e.g. 16 for 2016\n y: function y(date) {\n return String(date.getFullYear()).substring(2);\n }\n };\n\n var createDateFormatter = function createDateFormatter(_a) {\n var _b = _a.config,\n config = _b === void 0 ? defaults : _b,\n _c = _a.l10n,\n l10n = _c === void 0 ? english : _c;\n return function (dateObj, frmt, overrideLocale) {\n var locale = overrideLocale || l10n;\n\n if (config.formatDate !== undefined) {\n return config.formatDate(dateObj, frmt, locale);\n }\n\n return frmt.split(\"\").map(function (c, i, arr) {\n return formats[c] && arr[i - 1] !== \"\\\\\" ? formats[c](dateObj, locale, config) : c !== \"\\\\\" ? c : \"\";\n }).join(\"\");\n };\n };\n\n var createDateParser = function createDateParser(_a) {\n var _b = _a.config,\n config = _b === void 0 ? defaults : _b,\n _c = _a.l10n,\n l10n = _c === void 0 ? english : _c;\n return function (date, givenFormat, timeless, customLocale) {\n if (date !== 0 && !date) return undefined;\n var locale = customLocale || l10n;\n var parsedDate;\n var dateOrig = date;\n if (date instanceof Date) parsedDate = new Date(date.getTime());else if (typeof date !== \"string\" && date.toFixed !== undefined // timestamp\n ) // create a copy\n parsedDate = new Date(date);else if (typeof date === \"string\") {\n // date string\n var format = givenFormat || (config || defaults).dateFormat;\n var datestr = String(date).trim();\n\n if (datestr === \"today\") {\n parsedDate = new Date();\n timeless = true;\n } else if (/Z$/.test(datestr) || /GMT$/.test(datestr) // datestrings w/ timezone\n ) parsedDate = new Date(date);else if (config && config.parseDate) parsedDate = config.parseDate(date, format);else {\n parsedDate = !config || !config.noCalendar ? new Date(new Date().getFullYear(), 0, 1, 0, 0, 0, 0) : new Date(new Date().setHours(0, 0, 0, 0));\n var matched = void 0,\n ops = [];\n\n for (var i = 0, matchIndex = 0, regexStr = \"\"; i < format.length; i++) {\n var token_1 = format[i];\n var isBackSlash = token_1 === \"\\\\\";\n var escaped = format[i - 1] === \"\\\\\" || isBackSlash;\n\n if (tokenRegex[token_1] && !escaped) {\n regexStr += tokenRegex[token_1];\n var match = new RegExp(regexStr).exec(date);\n\n if (match && (matched = true)) {\n ops[token_1 !== \"Y\" ? \"push\" : \"unshift\"]({\n fn: revFormat[token_1],\n val: match[++matchIndex]\n });\n }\n } else if (!isBackSlash) regexStr += \".\"; // don't really care\n\n\n ops.forEach(function (_a) {\n var fn = _a.fn,\n val = _a.val;\n return parsedDate = fn(parsedDate, val, locale) || parsedDate;\n });\n }\n\n parsedDate = matched ? parsedDate : undefined;\n }\n }\n /* istanbul ignore next */\n\n if (!(parsedDate instanceof Date && !isNaN(parsedDate.getTime()))) {\n config.errorHandler(new Error(\"Invalid date provided: \" + dateOrig));\n return undefined;\n }\n\n if (timeless === true) parsedDate.setHours(0, 0, 0, 0);\n return parsedDate;\n };\n };\n /**\n * Compute the difference in dates, measured in ms\n */\n\n\n function compareDates(date1, date2, timeless) {\n if (timeless === void 0) {\n timeless = true;\n }\n\n if (timeless !== false) {\n return new Date(date1.getTime()).setHours(0, 0, 0, 0) - new Date(date2.getTime()).setHours(0, 0, 0, 0);\n }\n\n return date1.getTime() - date2.getTime();\n }\n\n var isBetween = function isBetween(ts, ts1, ts2) {\n return ts > Math.min(ts1, ts2) && ts < Math.max(ts1, ts2);\n };\n\n var duration = {\n DAY: 86400000\n };\n\n if (typeof Object.assign !== \"function\") {\n Object.assign = function (target) {\n var args = [];\n\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n\n if (!target) {\n throw TypeError(\"Cannot convert undefined or null to object\");\n }\n\n var _loop_1 = function _loop_1(source) {\n if (source) {\n Object.keys(source).forEach(function (key) {\n return target[key] = source[key];\n });\n }\n };\n\n for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {\n var source = args_1[_a];\n\n _loop_1(source);\n }\n\n return target;\n };\n }\n\n var DEBOUNCED_CHANGE_MS = 300;\n\n function FlatpickrInstance(element, instanceConfig) {\n var self = {\n config: _assign({}, defaults, flatpickr.defaultConfig),\n l10n: english\n };\n self.parseDate = createDateParser({\n config: self.config,\n l10n: self.l10n\n });\n self._handlers = [];\n self.pluginElements = [];\n self.loadedPlugins = [];\n self._bind = bind;\n self._setHoursFromDate = setHoursFromDate;\n self._positionCalendar = positionCalendar;\n self.changeMonth = changeMonth;\n self.changeYear = changeYear;\n self.clear = clear;\n self.close = close;\n self._createElement = createElement;\n self.destroy = destroy;\n self.isEnabled = isEnabled;\n self.jumpToDate = jumpToDate;\n self.open = open;\n self.redraw = redraw;\n self.set = set;\n self.setDate = setDate;\n self.toggle = toggle;\n\n function setupHelperFunctions() {\n self.utils = {\n getDaysInMonth: function getDaysInMonth(month, yr) {\n if (month === void 0) {\n month = self.currentMonth;\n }\n\n if (yr === void 0) {\n yr = self.currentYear;\n }\n\n if (month === 1 && (yr % 4 === 0 && yr % 100 !== 0 || yr % 400 === 0)) return 29;\n return self.l10n.daysInMonth[month];\n }\n };\n }\n\n function init() {\n self.element = self.input = element;\n self.isOpen = false;\n parseConfig();\n setupLocale();\n setupInputs();\n setupDates();\n setupHelperFunctions();\n if (!self.isMobile) build();\n bindEvents();\n\n if (self.selectedDates.length || self.config.noCalendar) {\n if (self.config.enableTime) {\n setHoursFromDate(self.config.noCalendar ? self.latestSelectedDateObj || self.config.minDate : undefined);\n }\n\n updateValue(false);\n }\n\n setCalendarWidth();\n self.showTimeInput = self.selectedDates.length > 0 || self.config.noCalendar;\n var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n /* TODO: investigate this further\n Currently, there is weird positioning behavior in safari causing pages\n to scroll up. https://github.com/chmln/flatpickr/issues/563\n However, most browsers are not Safari and positioning is expensive when used\n in scale. https://github.com/chmln/flatpickr/issues/1096\n */\n\n if (!self.isMobile && isSafari) {\n positionCalendar();\n }\n\n triggerEvent(\"onReady\");\n }\n\n function bindToInstance(fn) {\n return fn.bind(self);\n }\n\n function setCalendarWidth() {\n var config = self.config;\n if (config.weekNumbers === false && config.showMonths === 1) return;else if (config.noCalendar !== true) {\n window.requestAnimationFrame(function () {\n if (self.calendarContainer !== undefined) {\n self.calendarContainer.style.visibility = \"hidden\";\n self.calendarContainer.style.display = \"block\";\n }\n\n if (self.daysContainer !== undefined) {\n var daysWidth = (self.days.offsetWidth + 1) * config.showMonths;\n self.daysContainer.style.width = daysWidth + \"px\";\n self.calendarContainer.style.width = daysWidth + (self.weekWrapper !== undefined ? self.weekWrapper.offsetWidth : 0) + \"px\";\n self.calendarContainer.style.removeProperty(\"visibility\");\n self.calendarContainer.style.removeProperty(\"display\");\n }\n });\n }\n }\n /**\n * The handler for all events targeting the time inputs\n */\n\n\n function updateTime(e) {\n if (self.selectedDates.length === 0) {\n setDefaultTime();\n }\n\n if (e !== undefined && e.type !== \"blur\") {\n timeWrapper(e);\n }\n\n var prevValue = self._input.value;\n setHoursFromInputs();\n updateValue();\n\n if (self._input.value !== prevValue) {\n self._debouncedChange();\n }\n }\n\n function ampm2military(hour, amPM) {\n return hour % 12 + 12 * _int(amPM === self.l10n.amPM[1]);\n }\n\n function military2ampm(hour) {\n switch (hour % 24) {\n case 0:\n case 12:\n return 12;\n\n default:\n return hour % 12;\n }\n }\n /**\n * Syncs the selected date object time with user's time input\n */\n\n\n function setHoursFromInputs() {\n if (self.hourElement === undefined || self.minuteElement === undefined) return;\n var hours = (parseInt(self.hourElement.value.slice(-2), 10) || 0) % 24,\n minutes = (parseInt(self.minuteElement.value, 10) || 0) % 60,\n seconds = self.secondElement !== undefined ? (parseInt(self.secondElement.value, 10) || 0) % 60 : 0;\n\n if (self.amPM !== undefined) {\n hours = ampm2military(hours, self.amPM.textContent);\n }\n\n var limitMinHours = self.config.minTime !== undefined || self.config.minDate && self.minDateHasTime && self.latestSelectedDateObj && compareDates(self.latestSelectedDateObj, self.config.minDate, true) === 0;\n var limitMaxHours = self.config.maxTime !== undefined || self.config.maxDate && self.maxDateHasTime && self.latestSelectedDateObj && compareDates(self.latestSelectedDateObj, self.config.maxDate, true) === 0;\n\n if (limitMaxHours) {\n var maxTime = self.config.maxTime !== undefined ? self.config.maxTime : self.config.maxDate;\n hours = Math.min(hours, maxTime.getHours());\n if (hours === maxTime.getHours()) minutes = Math.min(minutes, maxTime.getMinutes());\n if (minutes === maxTime.getMinutes()) seconds = Math.min(seconds, maxTime.getSeconds());\n }\n\n if (limitMinHours) {\n var minTime = self.config.minTime !== undefined ? self.config.minTime : self.config.minDate;\n hours = Math.max(hours, minTime.getHours());\n if (hours === minTime.getHours()) minutes = Math.max(minutes, minTime.getMinutes());\n if (minutes === minTime.getMinutes()) seconds = Math.max(seconds, minTime.getSeconds());\n }\n\n setHours(hours, minutes, seconds);\n }\n /**\n * Syncs time input values with a date\n */\n\n\n function setHoursFromDate(dateObj) {\n var date = dateObj || self.latestSelectedDateObj;\n if (date) setHours(date.getHours(), date.getMinutes(), date.getSeconds());\n }\n\n function setDefaultHours() {\n var hours = self.config.defaultHour;\n var minutes = self.config.defaultMinute;\n var seconds = self.config.defaultSeconds;\n\n if (self.config.minDate !== undefined) {\n var minHr = self.config.minDate.getHours();\n var minMinutes = self.config.minDate.getMinutes();\n hours = Math.max(hours, minHr);\n if (hours === minHr) minutes = Math.max(minMinutes, minutes);\n if (hours === minHr && minutes === minMinutes) seconds = self.config.minDate.getSeconds();\n }\n\n if (self.config.maxDate !== undefined) {\n var maxHr = self.config.maxDate.getHours();\n var maxMinutes = self.config.maxDate.getMinutes();\n hours = Math.min(hours, maxHr);\n if (hours === maxHr) minutes = Math.min(maxMinutes, minutes);\n if (hours === maxHr && minutes === maxMinutes) seconds = self.config.maxDate.getSeconds();\n }\n\n setHours(hours, minutes, seconds);\n }\n /**\n * Sets the hours, minutes, and optionally seconds\n * of the latest selected date object and the\n * corresponding time inputs\n * @param {Number} hours the hour. whether its military\n * or am-pm gets inferred from config\n * @param {Number} minutes the minutes\n * @param {Number} seconds the seconds (optional)\n */\n\n\n function setHours(hours, minutes, seconds) {\n if (self.latestSelectedDateObj !== undefined) {\n self.latestSelectedDateObj.setHours(hours % 24, minutes, seconds || 0, 0);\n }\n\n if (!self.hourElement || !self.minuteElement || self.isMobile) return;\n self.hourElement.value = pad(!self.config.time_24hr ? (12 + hours) % 12 + 12 * _int(hours % 12 === 0) : hours);\n self.minuteElement.value = pad(minutes);\n if (self.amPM !== undefined) self.amPM.textContent = self.l10n.amPM[_int(hours >= 12)];\n if (self.secondElement !== undefined) self.secondElement.value = pad(seconds);\n }\n /**\n * Handles the year input and incrementing events\n * @param {Event} event the keyup or increment event\n */\n\n\n function onYearInput(event) {\n var year = parseInt(event.target.value) + (event.delta || 0);\n\n if (year / 1000 > 1 || event.key === \"Enter\" && !/[^\\d]/.test(year.toString())) {\n changeYear(year);\n }\n }\n /**\n * Essentially addEventListener + tracking\n * @param {Element} element the element to addEventListener to\n * @param {String} event the event name\n * @param {Function} handler the event handler\n */\n\n\n function bind(element, event, handler, options) {\n if (event instanceof Array) return event.forEach(function (ev) {\n return bind(element, ev, handler, options);\n });\n if (element instanceof Array) return element.forEach(function (el) {\n return bind(el, event, handler, options);\n });\n element.addEventListener(event, handler, options);\n\n self._handlers.push({\n element: element,\n event: event,\n handler: handler,\n options: options\n });\n }\n /**\n * A mousedown handler which mimics click.\n * Minimizes latency, since we don't need to wait for mouseup in most cases.\n * Also, avoids handling right clicks.\n *\n * @param {Function} handler the event handler\n */\n\n\n function onClick(handler) {\n return function (evt) {\n evt.which === 1 && handler(evt);\n };\n }\n\n function triggerChange() {\n triggerEvent(\"onChange\");\n }\n /**\n * Adds all the necessary event listeners\n */\n\n\n function bindEvents() {\n if (self.config.wrap) {\n [\"open\", \"close\", \"toggle\", \"clear\"].forEach(function (evt) {\n Array.prototype.forEach.call(self.element.querySelectorAll(\"[data-\" + evt + \"]\"), function (el) {\n return bind(el, \"click\", self[evt]);\n });\n });\n }\n\n if (self.isMobile) {\n setupMobile();\n return;\n }\n\n var debouncedResize = debounce(onResize, 50);\n self._debouncedChange = debounce(triggerChange, DEBOUNCED_CHANGE_MS);\n if (self.daysContainer && !/iPhone|iPad|iPod/i.test(navigator.userAgent)) bind(self.daysContainer, \"mouseover\", function (e) {\n if (self.config.mode === \"range\") onMouseOver(e.target);\n });\n bind(window.document.body, \"keydown\", onKeyDown);\n if (!self.config.inline && !self.config[\"static\"]) bind(window, \"resize\", debouncedResize);\n if (window.ontouchstart !== undefined) bind(window.document, \"touchstart\", documentClick);else bind(window.document, \"mousedown\", onClick(documentClick));\n bind(window.document, \"focus\", documentClick, {\n capture: true\n });\n\n if (self.config.clickOpens === true) {\n bind(self._input, \"focus\", self.open);\n bind(self._input, \"mousedown\", onClick(self.open));\n }\n\n if (self.daysContainer !== undefined) {\n bind(self.monthNav, \"mousedown\", onClick(onMonthNavClick));\n bind(self.monthNav, [\"keyup\", \"increment\"], onYearInput);\n bind(self.daysContainer, \"mousedown\", onClick(selectDate));\n }\n\n if (self.timeContainer !== undefined && self.minuteElement !== undefined && self.hourElement !== undefined) {\n var selText = function selText(e) {\n return e.target.select();\n };\n\n bind(self.timeContainer, [\"increment\"], updateTime);\n bind(self.timeContainer, \"blur\", updateTime, {\n capture: true\n });\n bind(self.timeContainer, \"mousedown\", onClick(timeIncrement));\n bind([self.hourElement, self.minuteElement], [\"focus\", \"click\"], selText);\n if (self.secondElement !== undefined) bind(self.secondElement, \"focus\", function () {\n return self.secondElement && self.secondElement.select();\n });\n\n if (self.amPM !== undefined) {\n bind(self.amPM, \"mousedown\", onClick(function (e) {\n updateTime(e);\n triggerChange();\n }));\n }\n }\n }\n /**\n * Set the calendar view to a particular date.\n * @param {Date} jumpDate the date to set the view to\n * @param {boolean} triggerChange if change events should be triggered\n */\n\n\n function jumpToDate(jumpDate, triggerChange) {\n var jumpTo = jumpDate !== undefined ? self.parseDate(jumpDate) : self.latestSelectedDateObj || (self.config.minDate && self.config.minDate > self.now ? self.config.minDate : self.config.maxDate && self.config.maxDate < self.now ? self.config.maxDate : self.now);\n var oldYear = self.currentYear;\n var oldMonth = self.currentMonth;\n\n try {\n if (jumpTo !== undefined) {\n self.currentYear = jumpTo.getFullYear();\n self.currentMonth = jumpTo.getMonth();\n }\n } catch (e) {\n /* istanbul ignore next */\n e.message = \"Invalid date supplied: \" + jumpTo;\n self.config.errorHandler(e);\n }\n\n if (triggerChange && self.currentYear !== oldYear) {\n triggerEvent(\"onYearChange\");\n buildMonthSwitch();\n }\n\n if (triggerChange && (self.currentYear !== oldYear || self.currentMonth !== oldMonth)) {\n triggerEvent(\"onMonthChange\");\n }\n\n self.redraw();\n }\n /**\n * The up/down arrow handler for time inputs\n * @param {Event} e the click event\n */\n\n\n function timeIncrement(e) {\n if (~e.target.className.indexOf(\"arrow\")) incrementNumInput(e, e.target.classList.contains(\"arrowUp\") ? 1 : -1);\n }\n /**\n * Increments/decrements the value of input associ-\n * ated with the up/down arrow by dispatching an\n * \"increment\" event on the input.\n *\n * @param {Event} e the click event\n * @param {Number} delta the diff (usually 1 or -1)\n * @param {Element} inputElem the input element\n */\n\n\n function incrementNumInput(e, delta, inputElem) {\n var target = e && e.target;\n var input = inputElem || target && target.parentNode && target.parentNode.firstChild;\n var event = createEvent(\"increment\");\n event.delta = delta;\n input && input.dispatchEvent(event);\n }\n\n function build() {\n var fragment = window.document.createDocumentFragment();\n self.calendarContainer = createElement(\"div\", \"flatpickr-calendar\");\n self.calendarContainer.tabIndex = -1;\n\n if (!self.config.noCalendar) {\n fragment.appendChild(buildMonthNav());\n self.innerContainer = createElement(\"div\", \"flatpickr-innerContainer\");\n\n if (self.config.weekNumbers) {\n var _a = buildWeeks(),\n weekWrapper = _a.weekWrapper,\n weekNumbers = _a.weekNumbers;\n\n self.innerContainer.appendChild(weekWrapper);\n self.weekNumbers = weekNumbers;\n self.weekWrapper = weekWrapper;\n }\n\n self.rContainer = createElement(\"div\", \"flatpickr-rContainer\");\n self.rContainer.appendChild(buildWeekdays());\n\n if (!self.daysContainer) {\n self.daysContainer = createElement(\"div\", \"flatpickr-days\");\n self.daysContainer.tabIndex = -1;\n }\n\n buildDays();\n self.rContainer.appendChild(self.daysContainer);\n self.innerContainer.appendChild(self.rContainer);\n fragment.appendChild(self.innerContainer);\n }\n\n if (self.config.enableTime) {\n fragment.appendChild(buildTime());\n }\n\n toggleClass(self.calendarContainer, \"rangeMode\", self.config.mode === \"range\");\n toggleClass(self.calendarContainer, \"animate\", self.config.animate === true);\n toggleClass(self.calendarContainer, \"multiMonth\", self.config.showMonths > 1);\n self.calendarContainer.appendChild(fragment);\n var customAppend = self.config.appendTo !== undefined && self.config.appendTo.nodeType !== undefined;\n\n if (self.config.inline || self.config[\"static\"]) {\n self.calendarContainer.classList.add(self.config.inline ? \"inline\" : \"static\");\n\n if (self.config.inline) {\n if (!customAppend && self.element.parentNode) self.element.parentNode.insertBefore(self.calendarContainer, self._input.nextSibling);else if (self.config.appendTo !== undefined) self.config.appendTo.appendChild(self.calendarContainer);\n }\n\n if (self.config[\"static\"]) {\n var wrapper = createElement(\"div\", \"flatpickr-wrapper\");\n if (self.element.parentNode) self.element.parentNode.insertBefore(wrapper, self.element);\n wrapper.appendChild(self.element);\n if (self.altInput) wrapper.appendChild(self.altInput);\n wrapper.appendChild(self.calendarContainer);\n }\n }\n\n if (!self.config[\"static\"] && !self.config.inline) (self.config.appendTo !== undefined ? self.config.appendTo : window.document.body).appendChild(self.calendarContainer);\n }\n\n function createDay(className, date, dayNumber, i) {\n var dateIsEnabled = isEnabled(date, true),\n dayElement = createElement(\"span\", \"flatpickr-day \" + className, date.getDate().toString());\n dayElement.dateObj = date;\n dayElement.$i = i;\n dayElement.setAttribute(\"aria-label\", self.formatDate(date, self.config.ariaDateFormat));\n\n if (className.indexOf(\"hidden\") === -1 && compareDates(date, self.now) === 0) {\n self.todayDateElem = dayElement;\n dayElement.classList.add(\"today\");\n dayElement.setAttribute(\"aria-current\", \"date\");\n }\n\n if (dateIsEnabled) {\n dayElement.tabIndex = -1;\n\n if (isDateSelected(date)) {\n dayElement.classList.add(\"selected\");\n self.selectedDateElem = dayElement;\n\n if (self.config.mode === \"range\") {\n toggleClass(dayElement, \"startRange\", self.selectedDates[0] && compareDates(date, self.selectedDates[0], true) === 0);\n toggleClass(dayElement, \"endRange\", self.selectedDates[1] && compareDates(date, self.selectedDates[1], true) === 0);\n if (className === \"nextMonthDay\") dayElement.classList.add(\"inRange\");\n }\n }\n } else {\n dayElement.classList.add(\"flatpickr-disabled\");\n }\n\n if (self.config.mode === \"range\") {\n if (isDateInRange(date) && !isDateSelected(date)) dayElement.classList.add(\"inRange\");\n }\n\n if (self.weekNumbers && self.config.showMonths === 1 && className !== \"prevMonthDay\" && dayNumber % 7 === 1) {\n self.weekNumbers.insertAdjacentHTML(\"beforeend\", \"\" + self.config.getWeek(date) + \"\");\n }\n\n triggerEvent(\"onDayCreate\", dayElement);\n return dayElement;\n }\n\n function focusOnDayElem(targetNode) {\n targetNode.focus();\n if (self.config.mode === \"range\") onMouseOver(targetNode);\n }\n\n function getFirstAvailableDay(delta) {\n var startMonth = delta > 0 ? 0 : self.config.showMonths - 1;\n var endMonth = delta > 0 ? self.config.showMonths : -1;\n\n for (var m = startMonth; m != endMonth; m += delta) {\n var month = self.daysContainer.children[m];\n var startIndex = delta > 0 ? 0 : month.children.length - 1;\n var endIndex = delta > 0 ? month.children.length : -1;\n\n for (var i = startIndex; i != endIndex; i += delta) {\n var c = month.children[i];\n if (c.className.indexOf(\"hidden\") === -1 && isEnabled(c.dateObj)) return c;\n }\n }\n\n return undefined;\n }\n\n function getNextAvailableDay(current, delta) {\n var givenMonth = current.className.indexOf(\"Month\") === -1 ? current.dateObj.getMonth() : self.currentMonth;\n var endMonth = delta > 0 ? self.config.showMonths : -1;\n var loopDelta = delta > 0 ? 1 : -1;\n\n for (var m = givenMonth - self.currentMonth; m != endMonth; m += loopDelta) {\n var month = self.daysContainer.children[m];\n var startIndex = givenMonth - self.currentMonth === m ? current.$i + delta : delta < 0 ? month.children.length - 1 : 0;\n var numMonthDays = month.children.length;\n\n for (var i = startIndex; i >= 0 && i < numMonthDays && i != (delta > 0 ? numMonthDays : -1); i += loopDelta) {\n var c = month.children[i];\n if (c.className.indexOf(\"hidden\") === -1 && isEnabled(c.dateObj) && Math.abs(current.$i - i) >= Math.abs(delta)) return focusOnDayElem(c);\n }\n }\n\n self.changeMonth(loopDelta);\n focusOnDay(getFirstAvailableDay(loopDelta), 0);\n return undefined;\n }\n\n function focusOnDay(current, offset) {\n var dayFocused = isInView(document.activeElement || document.body);\n var startElem = current !== undefined ? current : dayFocused ? document.activeElement : self.selectedDateElem !== undefined && isInView(self.selectedDateElem) ? self.selectedDateElem : self.todayDateElem !== undefined && isInView(self.todayDateElem) ? self.todayDateElem : getFirstAvailableDay(offset > 0 ? 1 : -1);\n if (startElem === undefined) return self._input.focus();\n if (!dayFocused) return focusOnDayElem(startElem);\n getNextAvailableDay(startElem, offset);\n }\n\n function buildMonthDays(year, month) {\n var firstOfMonth = (new Date(year, month, 1).getDay() - self.l10n.firstDayOfWeek + 7) % 7;\n var prevMonthDays = self.utils.getDaysInMonth((month - 1 + 12) % 12);\n var daysInMonth = self.utils.getDaysInMonth(month),\n days = window.document.createDocumentFragment(),\n isMultiMonth = self.config.showMonths > 1,\n prevMonthDayClass = isMultiMonth ? \"prevMonthDay hidden\" : \"prevMonthDay\",\n nextMonthDayClass = isMultiMonth ? \"nextMonthDay hidden\" : \"nextMonthDay\";\n var dayNumber = prevMonthDays + 1 - firstOfMonth,\n dayIndex = 0; // prepend days from the ending of previous month\n\n for (; dayNumber <= prevMonthDays; dayNumber++, dayIndex++) {\n days.appendChild(createDay(prevMonthDayClass, new Date(year, month - 1, dayNumber), dayNumber, dayIndex));\n } // Start at 1 since there is no 0th day\n\n\n for (dayNumber = 1; dayNumber <= daysInMonth; dayNumber++, dayIndex++) {\n days.appendChild(createDay(\"\", new Date(year, month, dayNumber), dayNumber, dayIndex));\n } // append days from the next month\n\n\n for (var dayNum = daysInMonth + 1; dayNum <= 42 - firstOfMonth && (self.config.showMonths === 1 || dayIndex % 7 !== 0); dayNum++, dayIndex++) {\n days.appendChild(createDay(nextMonthDayClass, new Date(year, month + 1, dayNum % daysInMonth), dayNum, dayIndex));\n } //updateNavigationCurrentMonth();\n\n\n var dayContainer = createElement(\"div\", \"dayContainer\");\n dayContainer.appendChild(days);\n return dayContainer;\n }\n\n function buildDays() {\n if (self.daysContainer === undefined) {\n return;\n }\n\n clearNode(self.daysContainer); // TODO: week numbers for each month\n\n if (self.weekNumbers) clearNode(self.weekNumbers);\n var frag = document.createDocumentFragment();\n\n for (var i = 0; i < self.config.showMonths; i++) {\n var d = new Date(self.currentYear, self.currentMonth, 1);\n d.setMonth(self.currentMonth + i);\n frag.appendChild(buildMonthDays(d.getFullYear(), d.getMonth()));\n }\n\n self.daysContainer.appendChild(frag);\n self.days = self.daysContainer.firstChild;\n\n if (self.config.mode === \"range\" && self.selectedDates.length === 1) {\n onMouseOver();\n }\n }\n\n function buildMonthSwitch() {\n if (self.config.showMonths > 1 || self.config.monthSelectorType !== \"dropdown\") return;\n\n var shouldBuildMonth = function shouldBuildMonth(month) {\n if (self.config.minDate !== undefined && self.currentYear === self.config.minDate.getFullYear() && month < self.config.minDate.getMonth()) {\n return false;\n }\n\n return !(self.config.maxDate !== undefined && self.currentYear === self.config.maxDate.getFullYear() && month > self.config.maxDate.getMonth());\n };\n\n self.monthsDropdownContainer.tabIndex = -1;\n self.monthsDropdownContainer.innerHTML = \"\";\n\n for (var i = 0; i < 12; i++) {\n if (!shouldBuildMonth(i)) continue;\n var month = createElement(\"option\", \"flatpickr-monthDropdown-month\");\n month.value = new Date(self.currentYear, i).getMonth().toString();\n month.textContent = monthToStr(i, self.config.shorthandCurrentMonth, self.l10n);\n month.tabIndex = -1;\n\n if (self.currentMonth === i) {\n month.selected = true;\n }\n\n self.monthsDropdownContainer.appendChild(month);\n }\n }\n\n function buildMonth() {\n var container = createElement(\"div\", \"flatpickr-month\");\n var monthNavFragment = window.document.createDocumentFragment();\n var monthElement;\n\n if (self.config.showMonths > 1 || self.config.monthSelectorType === \"static\") {\n monthElement = createElement(\"span\", \"cur-month\");\n } else {\n self.monthsDropdownContainer = createElement(\"select\", \"flatpickr-monthDropdown-months\");\n bind(self.monthsDropdownContainer, \"change\", function (e) {\n var target = e.target;\n var selectedMonth = parseInt(target.value, 10);\n self.changeMonth(selectedMonth - self.currentMonth);\n triggerEvent(\"onMonthChange\");\n });\n buildMonthSwitch();\n monthElement = self.monthsDropdownContainer;\n }\n\n var yearInput = createNumberInput(\"cur-year\", {\n tabindex: \"-1\"\n });\n var yearElement = yearInput.getElementsByTagName(\"input\")[0];\n yearElement.setAttribute(\"aria-label\", self.l10n.yearAriaLabel);\n\n if (self.config.minDate) {\n yearElement.setAttribute(\"min\", self.config.minDate.getFullYear().toString());\n }\n\n if (self.config.maxDate) {\n yearElement.setAttribute(\"max\", self.config.maxDate.getFullYear().toString());\n yearElement.disabled = !!self.config.minDate && self.config.minDate.getFullYear() === self.config.maxDate.getFullYear();\n }\n\n var currentMonth = createElement(\"div\", \"flatpickr-current-month\");\n currentMonth.appendChild(monthElement);\n currentMonth.appendChild(yearInput);\n monthNavFragment.appendChild(currentMonth);\n container.appendChild(monthNavFragment);\n return {\n container: container,\n yearElement: yearElement,\n monthElement: monthElement\n };\n }\n\n function buildMonths() {\n clearNode(self.monthNav);\n self.monthNav.appendChild(self.prevMonthNav);\n\n if (self.config.showMonths) {\n self.yearElements = [];\n self.monthElements = [];\n }\n\n for (var m = self.config.showMonths; m--;) {\n var month = buildMonth();\n self.yearElements.push(month.yearElement);\n self.monthElements.push(month.monthElement);\n self.monthNav.appendChild(month.container);\n }\n\n self.monthNav.appendChild(self.nextMonthNav);\n }\n\n function buildMonthNav() {\n self.monthNav = createElement(\"div\", \"flatpickr-months\");\n self.yearElements = [];\n self.monthElements = [];\n self.prevMonthNav = createElement(\"span\", \"flatpickr-prev-month\");\n self.prevMonthNav.innerHTML = self.config.prevArrow;\n self.nextMonthNav = createElement(\"span\", \"flatpickr-next-month\");\n self.nextMonthNav.innerHTML = self.config.nextArrow;\n buildMonths();\n Object.defineProperty(self, \"_hidePrevMonthArrow\", {\n get: function get() {\n return self.__hidePrevMonthArrow;\n },\n set: function set(bool) {\n if (self.__hidePrevMonthArrow !== bool) {\n toggleClass(self.prevMonthNav, \"flatpickr-disabled\", bool);\n self.__hidePrevMonthArrow = bool;\n }\n }\n });\n Object.defineProperty(self, \"_hideNextMonthArrow\", {\n get: function get() {\n return self.__hideNextMonthArrow;\n },\n set: function set(bool) {\n if (self.__hideNextMonthArrow !== bool) {\n toggleClass(self.nextMonthNav, \"flatpickr-disabled\", bool);\n self.__hideNextMonthArrow = bool;\n }\n }\n });\n self.currentYearElement = self.yearElements[0];\n updateNavigationCurrentMonth();\n return self.monthNav;\n }\n\n function buildTime() {\n self.calendarContainer.classList.add(\"hasTime\");\n if (self.config.noCalendar) self.calendarContainer.classList.add(\"noCalendar\");\n self.timeContainer = createElement(\"div\", \"flatpickr-time\");\n self.timeContainer.tabIndex = -1;\n var separator = createElement(\"span\", \"flatpickr-time-separator\", \":\");\n var hourInput = createNumberInput(\"flatpickr-hour\", {\n \"aria-label\": self.l10n.hourAriaLabel\n });\n self.hourElement = hourInput.getElementsByTagName(\"input\")[0];\n var minuteInput = createNumberInput(\"flatpickr-minute\", {\n \"aria-label\": self.l10n.minuteAriaLabel\n });\n self.minuteElement = minuteInput.getElementsByTagName(\"input\")[0];\n self.hourElement.tabIndex = self.minuteElement.tabIndex = -1;\n self.hourElement.value = pad(self.latestSelectedDateObj ? self.latestSelectedDateObj.getHours() : self.config.time_24hr ? self.config.defaultHour : military2ampm(self.config.defaultHour));\n self.minuteElement.value = pad(self.latestSelectedDateObj ? self.latestSelectedDateObj.getMinutes() : self.config.defaultMinute);\n self.hourElement.setAttribute(\"step\", self.config.hourIncrement.toString());\n self.minuteElement.setAttribute(\"step\", self.config.minuteIncrement.toString());\n self.hourElement.setAttribute(\"min\", self.config.time_24hr ? \"0\" : \"1\");\n self.hourElement.setAttribute(\"max\", self.config.time_24hr ? \"23\" : \"12\");\n self.minuteElement.setAttribute(\"min\", \"0\");\n self.minuteElement.setAttribute(\"max\", \"59\");\n self.timeContainer.appendChild(hourInput);\n self.timeContainer.appendChild(separator);\n self.timeContainer.appendChild(minuteInput);\n if (self.config.time_24hr) self.timeContainer.classList.add(\"time24hr\");\n\n if (self.config.enableSeconds) {\n self.timeContainer.classList.add(\"hasSeconds\");\n var secondInput = createNumberInput(\"flatpickr-second\");\n self.secondElement = secondInput.getElementsByTagName(\"input\")[0];\n self.secondElement.value = pad(self.latestSelectedDateObj ? self.latestSelectedDateObj.getSeconds() : self.config.defaultSeconds);\n self.secondElement.setAttribute(\"step\", self.minuteElement.getAttribute(\"step\"));\n self.secondElement.setAttribute(\"min\", \"0\");\n self.secondElement.setAttribute(\"max\", \"59\");\n self.timeContainer.appendChild(createElement(\"span\", \"flatpickr-time-separator\", \":\"));\n self.timeContainer.appendChild(secondInput);\n }\n\n if (!self.config.time_24hr) {\n // add self.amPM if appropriate\n self.amPM = createElement(\"span\", \"flatpickr-am-pm\", self.l10n.amPM[_int((self.latestSelectedDateObj ? self.hourElement.value : self.config.defaultHour) > 11)]);\n self.amPM.title = self.l10n.toggleTitle;\n self.amPM.tabIndex = -1;\n self.timeContainer.appendChild(self.amPM);\n }\n\n return self.timeContainer;\n }\n\n function buildWeekdays() {\n if (!self.weekdayContainer) self.weekdayContainer = createElement(\"div\", \"flatpickr-weekdays\");else clearNode(self.weekdayContainer);\n\n for (var i = self.config.showMonths; i--;) {\n var container = createElement(\"div\", \"flatpickr-weekdaycontainer\");\n self.weekdayContainer.appendChild(container);\n }\n\n updateWeekdays();\n return self.weekdayContainer;\n }\n\n function updateWeekdays() {\n if (!self.weekdayContainer) {\n return;\n }\n\n var firstDayOfWeek = self.l10n.firstDayOfWeek;\n var weekdays = self.l10n.weekdays.shorthand.slice();\n\n if (firstDayOfWeek > 0 && firstDayOfWeek < weekdays.length) {\n weekdays = weekdays.splice(firstDayOfWeek, weekdays.length).concat(weekdays.splice(0, firstDayOfWeek));\n }\n\n for (var i = self.config.showMonths; i--;) {\n self.weekdayContainer.children[i].innerHTML = \"\\n \\n \" + weekdays.join(\"\") + \"\\n \\n \";\n }\n }\n /* istanbul ignore next */\n\n\n function buildWeeks() {\n self.calendarContainer.classList.add(\"hasWeeks\");\n var weekWrapper = createElement(\"div\", \"flatpickr-weekwrapper\");\n weekWrapper.appendChild(createElement(\"span\", \"flatpickr-weekday\", self.l10n.weekAbbreviation));\n var weekNumbers = createElement(\"div\", \"flatpickr-weeks\");\n weekWrapper.appendChild(weekNumbers);\n return {\n weekWrapper: weekWrapper,\n weekNumbers: weekNumbers\n };\n }\n\n function changeMonth(value, isOffset) {\n if (isOffset === void 0) {\n isOffset = true;\n }\n\n var delta = isOffset ? value : value - self.currentMonth;\n if (delta < 0 && self._hidePrevMonthArrow === true || delta > 0 && self._hideNextMonthArrow === true) return;\n self.currentMonth += delta;\n\n if (self.currentMonth < 0 || self.currentMonth > 11) {\n self.currentYear += self.currentMonth > 11 ? 1 : -1;\n self.currentMonth = (self.currentMonth + 12) % 12;\n triggerEvent(\"onYearChange\");\n buildMonthSwitch();\n }\n\n buildDays();\n triggerEvent(\"onMonthChange\");\n updateNavigationCurrentMonth();\n }\n\n function clear(triggerChangeEvent, toInitial) {\n if (triggerChangeEvent === void 0) {\n triggerChangeEvent = true;\n }\n\n if (toInitial === void 0) {\n toInitial = true;\n }\n\n self.input.value = \"\";\n if (self.altInput !== undefined) self.altInput.value = \"\";\n if (self.mobileInput !== undefined) self.mobileInput.value = \"\";\n self.selectedDates = [];\n self.latestSelectedDateObj = undefined;\n\n if (toInitial === true) {\n self.currentYear = self._initialDate.getFullYear();\n self.currentMonth = self._initialDate.getMonth();\n }\n\n self.showTimeInput = false;\n\n if (self.config.enableTime === true) {\n setDefaultHours();\n }\n\n self.redraw();\n if (triggerChangeEvent) // triggerChangeEvent is true (default) or an Event\n triggerEvent(\"onChange\");\n }\n\n function close() {\n self.isOpen = false;\n\n if (!self.isMobile) {\n if (self.calendarContainer !== undefined) {\n self.calendarContainer.classList.remove(\"open\");\n }\n\n if (self._input !== undefined) {\n self._input.classList.remove(\"active\");\n }\n }\n\n triggerEvent(\"onClose\");\n }\n\n function destroy() {\n if (self.config !== undefined) triggerEvent(\"onDestroy\");\n\n for (var i = self._handlers.length; i--;) {\n var h = self._handlers[i];\n h.element.removeEventListener(h.event, h.handler, h.options);\n }\n\n self._handlers = [];\n\n if (self.mobileInput) {\n if (self.mobileInput.parentNode) self.mobileInput.parentNode.removeChild(self.mobileInput);\n self.mobileInput = undefined;\n } else if (self.calendarContainer && self.calendarContainer.parentNode) {\n if (self.config[\"static\"] && self.calendarContainer.parentNode) {\n var wrapper = self.calendarContainer.parentNode;\n wrapper.lastChild && wrapper.removeChild(wrapper.lastChild);\n\n if (wrapper.parentNode) {\n while (wrapper.firstChild) {\n wrapper.parentNode.insertBefore(wrapper.firstChild, wrapper);\n }\n\n wrapper.parentNode.removeChild(wrapper);\n }\n } else self.calendarContainer.parentNode.removeChild(self.calendarContainer);\n }\n\n if (self.altInput) {\n self.input.type = \"text\";\n if (self.altInput.parentNode) self.altInput.parentNode.removeChild(self.altInput);\n delete self.altInput;\n }\n\n if (self.input) {\n self.input.type = self.input._type;\n self.input.classList.remove(\"flatpickr-input\");\n self.input.removeAttribute(\"readonly\");\n self.input.value = \"\";\n }\n\n [\"_showTimeInput\", \"latestSelectedDateObj\", \"_hideNextMonthArrow\", \"_hidePrevMonthArrow\", \"__hideNextMonthArrow\", \"__hidePrevMonthArrow\", \"isMobile\", \"isOpen\", \"selectedDateElem\", \"minDateHasTime\", \"maxDateHasTime\", \"days\", \"daysContainer\", \"_input\", \"_positionElement\", \"innerContainer\", \"rContainer\", \"monthNav\", \"todayDateElem\", \"calendarContainer\", \"weekdayContainer\", \"prevMonthNav\", \"nextMonthNav\", \"monthsDropdownContainer\", \"currentMonthElement\", \"currentYearElement\", \"navigationCurrentMonth\", \"selectedDateElem\", \"config\"].forEach(function (k) {\n try {\n delete self[k];\n } catch (_) {}\n });\n }\n\n function isCalendarElem(elem) {\n if (self.config.appendTo && self.config.appendTo.contains(elem)) return true;\n return self.calendarContainer.contains(elem);\n }\n\n function documentClick(e) {\n if (self.isOpen && !self.config.inline) {\n var eventTarget_1 = getEventTarget(e);\n var isCalendarElement = isCalendarElem(eventTarget_1);\n var isInput = eventTarget_1 === self.input || eventTarget_1 === self.altInput || self.element.contains(eventTarget_1) || // web components\n // e.path is not present in all browsers. circumventing typechecks\n e.path && e.path.indexOf && (~e.path.indexOf(self.input) || ~e.path.indexOf(self.altInput));\n var lostFocus = e.type === \"blur\" ? isInput && e.relatedTarget && !isCalendarElem(e.relatedTarget) : !isInput && !isCalendarElement && !isCalendarElem(e.relatedTarget);\n var isIgnored = !self.config.ignoredFocusElements.some(function (elem) {\n return elem.contains(eventTarget_1);\n });\n\n if (lostFocus && isIgnored) {\n if (self.timeContainer !== undefined && self.minuteElement !== undefined && self.hourElement !== undefined) {\n updateTime();\n }\n\n self.close();\n\n if (self.config.mode === \"range\" && self.selectedDates.length === 1) {\n self.clear(false);\n self.redraw();\n }\n }\n }\n }\n\n function changeYear(newYear) {\n if (!newYear || self.config.minDate && newYear < self.config.minDate.getFullYear() || self.config.maxDate && newYear > self.config.maxDate.getFullYear()) return;\n var newYearNum = newYear,\n isNewYear = self.currentYear !== newYearNum;\n self.currentYear = newYearNum || self.currentYear;\n\n if (self.config.maxDate && self.currentYear === self.config.maxDate.getFullYear()) {\n self.currentMonth = Math.min(self.config.maxDate.getMonth(), self.currentMonth);\n } else if (self.config.minDate && self.currentYear === self.config.minDate.getFullYear()) {\n self.currentMonth = Math.max(self.config.minDate.getMonth(), self.currentMonth);\n }\n\n if (isNewYear) {\n self.redraw();\n triggerEvent(\"onYearChange\");\n buildMonthSwitch();\n }\n }\n\n function isEnabled(date, timeless) {\n if (timeless === void 0) {\n timeless = true;\n }\n\n var dateToCheck = self.parseDate(date, undefined, timeless); // timeless\n\n if (self.config.minDate && dateToCheck && compareDates(dateToCheck, self.config.minDate, timeless !== undefined ? timeless : !self.minDateHasTime) < 0 || self.config.maxDate && dateToCheck && compareDates(dateToCheck, self.config.maxDate, timeless !== undefined ? timeless : !self.maxDateHasTime) > 0) return false;\n if (self.config.enable.length === 0 && self.config.disable.length === 0) return true;\n if (dateToCheck === undefined) return false;\n var bool = self.config.enable.length > 0,\n array = bool ? self.config.enable : self.config.disable;\n\n for (var i = 0, d = void 0; i < array.length; i++) {\n d = array[i];\n if (typeof d === \"function\" && d(dateToCheck) // disabled by function\n ) return bool;else if (d instanceof Date && dateToCheck !== undefined && d.getTime() === dateToCheck.getTime()) // disabled by date\n return bool;else if (typeof d === \"string\" && dateToCheck !== undefined) {\n // disabled by date string\n var parsed = self.parseDate(d, undefined, true);\n return parsed && parsed.getTime() === dateToCheck.getTime() ? bool : !bool;\n } else if ( // disabled by range\n _typeof(d) === \"object\" && dateToCheck !== undefined && d.from && d.to && dateToCheck.getTime() >= d.from.getTime() && dateToCheck.getTime() <= d.to.getTime()) return bool;\n }\n\n return !bool;\n }\n\n function isInView(elem) {\n if (self.daysContainer !== undefined) return elem.className.indexOf(\"hidden\") === -1 && self.daysContainer.contains(elem);\n return false;\n }\n\n function onKeyDown(e) {\n // e.key e.keyCode\n // \"Backspace\" 8\n // \"Tab\" 9\n // \"Enter\" 13\n // \"Escape\" (IE \"Esc\") 27\n // \"ArrowLeft\" (IE \"Left\") 37\n // \"ArrowUp\" (IE \"Up\") 38\n // \"ArrowRight\" (IE \"Right\") 39\n // \"ArrowDown\" (IE \"Down\") 40\n // \"Delete\" (IE \"Del\") 46\n var isInput = e.target === self._input;\n var allowInput = self.config.allowInput;\n var allowKeydown = self.isOpen && (!allowInput || !isInput);\n var allowInlineKeydown = self.config.inline && isInput && !allowInput;\n\n if (e.keyCode === 13 && isInput) {\n if (allowInput) {\n self.setDate(self._input.value, true, e.target === self.altInput ? self.config.altFormat : self.config.dateFormat);\n return e.target.blur();\n } else {\n self.open();\n }\n } else if (isCalendarElem(e.target) || allowKeydown || allowInlineKeydown) {\n var isTimeObj = !!self.timeContainer && self.timeContainer.contains(e.target);\n\n switch (e.keyCode) {\n case 13:\n if (isTimeObj) {\n e.preventDefault();\n updateTime();\n focusAndClose();\n } else selectDate(e);\n\n break;\n\n case 27:\n // escape\n e.preventDefault();\n focusAndClose();\n break;\n\n case 8:\n case 46:\n if (isInput && !self.config.allowInput) {\n e.preventDefault();\n self.clear();\n }\n\n break;\n\n case 37:\n case 39:\n if (!isTimeObj && !isInput) {\n e.preventDefault();\n\n if (self.daysContainer !== undefined && (allowInput === false || document.activeElement && isInView(document.activeElement))) {\n var delta_1 = e.keyCode === 39 ? 1 : -1;\n if (!e.ctrlKey) focusOnDay(undefined, delta_1);else {\n e.stopPropagation();\n changeMonth(delta_1);\n focusOnDay(getFirstAvailableDay(1), 0);\n }\n }\n } else if (self.hourElement) self.hourElement.focus();\n\n break;\n\n case 38:\n case 40:\n e.preventDefault();\n var delta = e.keyCode === 40 ? 1 : -1;\n\n if (self.daysContainer && e.target.$i !== undefined || e.target === self.input || e.target === self.altInput) {\n if (e.ctrlKey) {\n e.stopPropagation();\n changeYear(self.currentYear - delta);\n focusOnDay(getFirstAvailableDay(1), 0);\n } else if (!isTimeObj) focusOnDay(undefined, delta * 7);\n } else if (e.target === self.currentYearElement) {\n changeYear(self.currentYear - delta);\n } else if (self.config.enableTime) {\n if (!isTimeObj && self.hourElement) self.hourElement.focus();\n updateTime(e);\n\n self._debouncedChange();\n }\n\n break;\n\n case 9:\n if (isTimeObj) {\n var elems = [self.hourElement, self.minuteElement, self.secondElement, self.amPM].concat(self.pluginElements).filter(function (x) {\n return x;\n });\n var i = elems.indexOf(e.target);\n\n if (i !== -1) {\n var target = elems[i + (e.shiftKey ? -1 : 1)];\n e.preventDefault();\n\n (target || self._input).focus();\n }\n } else if (!self.config.noCalendar && self.daysContainer && self.daysContainer.contains(e.target) && e.shiftKey) {\n e.preventDefault();\n\n self._input.focus();\n }\n\n break;\n\n default:\n break;\n }\n }\n\n if (self.amPM !== undefined && e.target === self.amPM) {\n switch (e.key) {\n case self.l10n.amPM[0].charAt(0):\n case self.l10n.amPM[0].charAt(0).toLowerCase():\n self.amPM.textContent = self.l10n.amPM[0];\n setHoursFromInputs();\n updateValue();\n break;\n\n case self.l10n.amPM[1].charAt(0):\n case self.l10n.amPM[1].charAt(0).toLowerCase():\n self.amPM.textContent = self.l10n.amPM[1];\n setHoursFromInputs();\n updateValue();\n break;\n }\n }\n\n if (isInput || isCalendarElem(e.target)) {\n triggerEvent(\"onKeyDown\", e);\n }\n }\n\n function onMouseOver(elem) {\n if (self.selectedDates.length !== 1 || elem && (!elem.classList.contains(\"flatpickr-day\") || elem.classList.contains(\"flatpickr-disabled\"))) return;\n var hoverDate = elem ? elem.dateObj.getTime() : self.days.firstElementChild.dateObj.getTime(),\n initialDate = self.parseDate(self.selectedDates[0], undefined, true).getTime(),\n rangeStartDate = Math.min(hoverDate, self.selectedDates[0].getTime()),\n rangeEndDate = Math.max(hoverDate, self.selectedDates[0].getTime());\n var containsDisabled = false;\n var minRange = 0,\n maxRange = 0;\n\n for (var t = rangeStartDate; t < rangeEndDate; t += duration.DAY) {\n if (!isEnabled(new Date(t), true)) {\n containsDisabled = containsDisabled || t > rangeStartDate && t < rangeEndDate;\n if (t < initialDate && (!minRange || t > minRange)) minRange = t;else if (t > initialDate && (!maxRange || t < maxRange)) maxRange = t;\n }\n }\n\n for (var m = 0; m < self.config.showMonths; m++) {\n var month = self.daysContainer.children[m];\n\n var _loop_1 = function _loop_1(i, l) {\n var dayElem = month.children[i],\n date = dayElem.dateObj;\n var timestamp = date.getTime();\n var outOfRange = minRange > 0 && timestamp < minRange || maxRange > 0 && timestamp > maxRange;\n\n if (outOfRange) {\n dayElem.classList.add(\"notAllowed\");\n [\"inRange\", \"startRange\", \"endRange\"].forEach(function (c) {\n dayElem.classList.remove(c);\n });\n return \"continue\";\n } else if (containsDisabled && !outOfRange) return \"continue\";\n\n [\"startRange\", \"inRange\", \"endRange\", \"notAllowed\"].forEach(function (c) {\n dayElem.classList.remove(c);\n });\n\n if (elem !== undefined) {\n elem.classList.add(hoverDate <= self.selectedDates[0].getTime() ? \"startRange\" : \"endRange\");\n if (initialDate < hoverDate && timestamp === initialDate) dayElem.classList.add(\"startRange\");else if (initialDate > hoverDate && timestamp === initialDate) dayElem.classList.add(\"endRange\");\n if (timestamp >= minRange && (maxRange === 0 || timestamp <= maxRange) && isBetween(timestamp, initialDate, hoverDate)) dayElem.classList.add(\"inRange\");\n }\n };\n\n for (var i = 0, l = month.children.length; i < l; i++) {\n _loop_1(i, l);\n }\n }\n }\n\n function onResize() {\n if (self.isOpen && !self.config[\"static\"] && !self.config.inline) positionCalendar();\n }\n\n function setDefaultTime() {\n self.setDate(self.config.minDate !== undefined ? new Date(self.config.minDate.getTime()) : new Date(), true);\n setDefaultHours();\n updateValue();\n }\n\n function open(e, positionElement) {\n if (positionElement === void 0) {\n positionElement = self._positionElement;\n }\n\n if (self.isMobile === true) {\n if (e) {\n e.preventDefault();\n e.target && e.target.blur();\n }\n\n if (self.mobileInput !== undefined) {\n self.mobileInput.focus();\n self.mobileInput.click();\n }\n\n triggerEvent(\"onOpen\");\n return;\n }\n\n if (self._input.disabled || self.config.inline) return;\n var wasOpen = self.isOpen;\n self.isOpen = true;\n\n if (!wasOpen) {\n self.calendarContainer.classList.add(\"open\");\n\n self._input.classList.add(\"active\");\n\n triggerEvent(\"onOpen\");\n positionCalendar(positionElement);\n }\n\n if (self.config.enableTime === true && self.config.noCalendar === true) {\n if (self.selectedDates.length === 0) {\n setDefaultTime();\n }\n\n if (self.config.allowInput === false && (e === undefined || !self.timeContainer.contains(e.relatedTarget))) {\n setTimeout(function () {\n return self.hourElement.select();\n }, 50);\n }\n }\n }\n\n function minMaxDateSetter(type) {\n return function (date) {\n var dateObj = self.config[\"_\" + type + \"Date\"] = self.parseDate(date, self.config.dateFormat);\n var inverseDateObj = self.config[\"_\" + (type === \"min\" ? \"max\" : \"min\") + \"Date\"];\n\n if (dateObj !== undefined) {\n self[type === \"min\" ? \"minDateHasTime\" : \"maxDateHasTime\"] = dateObj.getHours() > 0 || dateObj.getMinutes() > 0 || dateObj.getSeconds() > 0;\n }\n\n if (self.selectedDates) {\n self.selectedDates = self.selectedDates.filter(function (d) {\n return isEnabled(d);\n });\n if (!self.selectedDates.length && type === \"min\") setHoursFromDate(dateObj);\n updateValue();\n }\n\n if (self.daysContainer) {\n redraw();\n if (dateObj !== undefined) self.currentYearElement[type] = dateObj.getFullYear().toString();else self.currentYearElement.removeAttribute(type);\n self.currentYearElement.disabled = !!inverseDateObj && dateObj !== undefined && inverseDateObj.getFullYear() === dateObj.getFullYear();\n }\n };\n }\n\n function parseConfig() {\n var boolOpts = [\"wrap\", \"weekNumbers\", \"allowInput\", \"clickOpens\", \"time_24hr\", \"enableTime\", \"noCalendar\", \"altInput\", \"shorthandCurrentMonth\", \"inline\", \"static\", \"enableSeconds\", \"disableMobile\"];\n\n var userConfig = _assign({}, instanceConfig, JSON.parse(JSON.stringify(element.dataset || {})));\n\n var formats = {};\n self.config.parseDate = userConfig.parseDate;\n self.config.formatDate = userConfig.formatDate;\n Object.defineProperty(self.config, \"enable\", {\n get: function get() {\n return self.config._enable;\n },\n set: function set(dates) {\n self.config._enable = parseDateRules(dates);\n }\n });\n Object.defineProperty(self.config, \"disable\", {\n get: function get() {\n return self.config._disable;\n },\n set: function set(dates) {\n self.config._disable = parseDateRules(dates);\n }\n });\n var timeMode = userConfig.mode === \"time\";\n\n if (!userConfig.dateFormat && (userConfig.enableTime || timeMode)) {\n var defaultDateFormat = flatpickr.defaultConfig.dateFormat || defaults.dateFormat;\n formats.dateFormat = userConfig.noCalendar || timeMode ? \"H:i\" + (userConfig.enableSeconds ? \":S\" : \"\") : defaultDateFormat + \" H:i\" + (userConfig.enableSeconds ? \":S\" : \"\");\n }\n\n if (userConfig.altInput && (userConfig.enableTime || timeMode) && !userConfig.altFormat) {\n var defaultAltFormat = flatpickr.defaultConfig.altFormat || defaults.altFormat;\n formats.altFormat = userConfig.noCalendar || timeMode ? \"h:i\" + (userConfig.enableSeconds ? \":S K\" : \" K\") : defaultAltFormat + (\" h:i\" + (userConfig.enableSeconds ? \":S\" : \"\") + \" K\");\n }\n\n if (!userConfig.altInputClass) {\n self.config.altInputClass = self.input.className + \" \" + self.config.altInputClass;\n }\n\n Object.defineProperty(self.config, \"minDate\", {\n get: function get() {\n return self.config._minDate;\n },\n set: minMaxDateSetter(\"min\")\n });\n Object.defineProperty(self.config, \"maxDate\", {\n get: function get() {\n return self.config._maxDate;\n },\n set: minMaxDateSetter(\"max\")\n });\n\n var minMaxTimeSetter = function minMaxTimeSetter(type) {\n return function (val) {\n self.config[type === \"min\" ? \"_minTime\" : \"_maxTime\"] = self.parseDate(val, \"H:i:S\");\n };\n };\n\n Object.defineProperty(self.config, \"minTime\", {\n get: function get() {\n return self.config._minTime;\n },\n set: minMaxTimeSetter(\"min\")\n });\n Object.defineProperty(self.config, \"maxTime\", {\n get: function get() {\n return self.config._maxTime;\n },\n set: minMaxTimeSetter(\"max\")\n });\n\n if (userConfig.mode === \"time\") {\n self.config.noCalendar = true;\n self.config.enableTime = true;\n }\n\n Object.assign(self.config, formats, userConfig);\n\n for (var i = 0; i < boolOpts.length; i++) {\n self.config[boolOpts[i]] = self.config[boolOpts[i]] === true || self.config[boolOpts[i]] === \"true\";\n }\n\n HOOKS.filter(function (hook) {\n return self.config[hook] !== undefined;\n }).forEach(function (hook) {\n self.config[hook] = arrayify(self.config[hook] || []).map(bindToInstance);\n });\n self.isMobile = !self.config.disableMobile && !self.config.inline && self.config.mode === \"single\" && !self.config.disable.length && !self.config.enable.length && !self.config.weekNumbers && /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);\n\n for (var i = 0; i < self.config.plugins.length; i++) {\n var pluginConf = self.config.plugins[i](self) || {};\n\n for (var key in pluginConf) {\n if (HOOKS.indexOf(key) > -1) {\n self.config[key] = arrayify(pluginConf[key]).map(bindToInstance).concat(self.config[key]);\n } else if (typeof userConfig[key] === \"undefined\") self.config[key] = pluginConf[key];\n }\n }\n\n triggerEvent(\"onParseConfig\");\n }\n\n function setupLocale() {\n if (_typeof(self.config.locale) !== \"object\" && typeof flatpickr.l10ns[self.config.locale] === \"undefined\") self.config.errorHandler(new Error(\"flatpickr: invalid locale \" + self.config.locale));\n self.l10n = _assign({}, flatpickr.l10ns[\"default\"], _typeof(self.config.locale) === \"object\" ? self.config.locale : self.config.locale !== \"default\" ? flatpickr.l10ns[self.config.locale] : undefined);\n tokenRegex.K = \"(\" + self.l10n.amPM[0] + \"|\" + self.l10n.amPM[1] + \"|\" + self.l10n.amPM[0].toLowerCase() + \"|\" + self.l10n.amPM[1].toLowerCase() + \")\";\n\n var userConfig = _assign({}, instanceConfig, JSON.parse(JSON.stringify(element.dataset || {})));\n\n if (userConfig.time_24hr === undefined && flatpickr.defaultConfig.time_24hr === undefined) {\n self.config.time_24hr = self.l10n.time_24hr;\n }\n\n self.formatDate = createDateFormatter(self);\n self.parseDate = createDateParser({\n config: self.config,\n l10n: self.l10n\n });\n }\n\n function positionCalendar(customPositionElement) {\n if (self.calendarContainer === undefined) return;\n triggerEvent(\"onPreCalendarPosition\");\n var positionElement = customPositionElement || self._positionElement;\n var calendarHeight = Array.prototype.reduce.call(self.calendarContainer.children, function (acc, child) {\n return acc + child.offsetHeight;\n }, 0),\n calendarWidth = self.calendarContainer.offsetWidth,\n configPos = self.config.position.split(\" \"),\n configPosVertical = configPos[0],\n configPosHorizontal = configPos.length > 1 ? configPos[1] : null,\n inputBounds = positionElement.getBoundingClientRect(),\n distanceFromBottom = window.innerHeight - inputBounds.bottom,\n showOnTop = configPosVertical === \"above\" || configPosVertical !== \"below\" && distanceFromBottom < calendarHeight && inputBounds.top > calendarHeight;\n var top = window.pageYOffset + inputBounds.top + (!showOnTop ? positionElement.offsetHeight + 2 : -calendarHeight - 2);\n toggleClass(self.calendarContainer, \"arrowTop\", !showOnTop);\n toggleClass(self.calendarContainer, \"arrowBottom\", showOnTop);\n if (self.config.inline) return;\n var left = window.pageXOffset + inputBounds.left - (configPosHorizontal != null && configPosHorizontal === \"center\" ? (calendarWidth - inputBounds.width) / 2 : 0);\n var right = window.document.body.offsetWidth - (window.pageXOffset + inputBounds.right);\n var rightMost = left + calendarWidth > window.document.body.offsetWidth;\n var centerMost = right + calendarWidth > window.document.body.offsetWidth;\n toggleClass(self.calendarContainer, \"rightMost\", rightMost);\n if (self.config[\"static\"]) return;\n self.calendarContainer.style.top = top + \"px\";\n\n if (!rightMost) {\n self.calendarContainer.style.left = left + \"px\";\n self.calendarContainer.style.right = \"auto\";\n } else if (!centerMost) {\n self.calendarContainer.style.left = \"auto\";\n self.calendarContainer.style.right = right + \"px\";\n } else {\n var doc = document.styleSheets[0]; // some testing environments don't have css support\n\n if (doc === undefined) return;\n var bodyWidth = window.document.body.offsetWidth;\n var centerLeft = Math.max(0, bodyWidth / 2 - calendarWidth / 2);\n var centerBefore = \".flatpickr-calendar.centerMost:before\";\n var centerAfter = \".flatpickr-calendar.centerMost:after\";\n var centerIndex = doc.cssRules.length;\n var centerStyle = \"{left:\" + inputBounds.left + \"px;right:auto;}\";\n toggleClass(self.calendarContainer, \"rightMost\", false);\n toggleClass(self.calendarContainer, \"centerMost\", true);\n doc.insertRule(centerBefore + \",\" + centerAfter + centerStyle, centerIndex);\n self.calendarContainer.style.left = centerLeft + \"px\";\n self.calendarContainer.style.right = \"auto\";\n }\n }\n\n function redraw() {\n if (self.config.noCalendar || self.isMobile) return;\n updateNavigationCurrentMonth();\n buildDays();\n }\n\n function focusAndClose() {\n self._input.focus();\n\n if (window.navigator.userAgent.indexOf(\"MSIE\") !== -1 || navigator.msMaxTouchPoints !== undefined) {\n // hack - bugs in the way IE handles focus keeps the calendar open\n setTimeout(self.close, 0);\n } else {\n self.close();\n }\n }\n\n function selectDate(e) {\n e.preventDefault();\n e.stopPropagation();\n\n var isSelectable = function isSelectable(day) {\n return day.classList && day.classList.contains(\"flatpickr-day\") && !day.classList.contains(\"flatpickr-disabled\") && !day.classList.contains(\"notAllowed\");\n };\n\n var t = findParent(e.target, isSelectable);\n if (t === undefined) return;\n var target = t;\n var selectedDate = self.latestSelectedDateObj = new Date(target.dateObj.getTime());\n var shouldChangeMonth = (selectedDate.getMonth() < self.currentMonth || selectedDate.getMonth() > self.currentMonth + self.config.showMonths - 1) && self.config.mode !== \"range\";\n self.selectedDateElem = target;\n if (self.config.mode === \"single\") self.selectedDates = [selectedDate];else if (self.config.mode === \"multiple\") {\n var selectedIndex = isDateSelected(selectedDate);\n if (selectedIndex) self.selectedDates.splice(parseInt(selectedIndex), 1);else self.selectedDates.push(selectedDate);\n } else if (self.config.mode === \"range\") {\n if (self.selectedDates.length === 2) {\n self.clear(false, false);\n }\n\n self.latestSelectedDateObj = selectedDate;\n self.selectedDates.push(selectedDate); // unless selecting same date twice, sort ascendingly\n\n if (compareDates(selectedDate, self.selectedDates[0], true) !== 0) self.selectedDates.sort(function (a, b) {\n return a.getTime() - b.getTime();\n });\n }\n setHoursFromInputs();\n\n if (shouldChangeMonth) {\n var isNewYear = self.currentYear !== selectedDate.getFullYear();\n self.currentYear = selectedDate.getFullYear();\n self.currentMonth = selectedDate.getMonth();\n\n if (isNewYear) {\n triggerEvent(\"onYearChange\");\n buildMonthSwitch();\n }\n\n triggerEvent(\"onMonthChange\");\n }\n\n updateNavigationCurrentMonth();\n buildDays();\n updateValue();\n if (self.config.enableTime) setTimeout(function () {\n return self.showTimeInput = true;\n }, 50); // maintain focus\n\n if (!shouldChangeMonth && self.config.mode !== \"range\" && self.config.showMonths === 1) focusOnDayElem(target);else if (self.selectedDateElem !== undefined && self.hourElement === undefined) {\n self.selectedDateElem && self.selectedDateElem.focus();\n }\n if (self.hourElement !== undefined) self.hourElement !== undefined && self.hourElement.focus();\n\n if (self.config.closeOnSelect) {\n var single = self.config.mode === \"single\" && !self.config.enableTime;\n var range = self.config.mode === \"range\" && self.selectedDates.length === 2 && !self.config.enableTime;\n\n if (single || range) {\n focusAndClose();\n }\n }\n\n triggerChange();\n }\n\n var CALLBACKS = {\n locale: [setupLocale, updateWeekdays],\n showMonths: [buildMonths, setCalendarWidth, buildWeekdays],\n minDate: [jumpToDate],\n maxDate: [jumpToDate]\n };\n\n function set(option, value) {\n if (option !== null && _typeof(option) === \"object\") {\n Object.assign(self.config, option);\n\n for (var key in option) {\n if (CALLBACKS[key] !== undefined) CALLBACKS[key].forEach(function (x) {\n return x();\n });\n }\n } else {\n self.config[option] = value;\n if (CALLBACKS[option] !== undefined) CALLBACKS[option].forEach(function (x) {\n return x();\n });else if (HOOKS.indexOf(option) > -1) self.config[option] = arrayify(value);\n }\n\n self.redraw();\n updateValue(false);\n }\n\n function setSelectedDate(inputDate, format) {\n var dates = [];\n if (inputDate instanceof Array) dates = inputDate.map(function (d) {\n return self.parseDate(d, format);\n });else if (inputDate instanceof Date || typeof inputDate === \"number\") dates = [self.parseDate(inputDate, format)];else if (typeof inputDate === \"string\") {\n switch (self.config.mode) {\n case \"single\":\n case \"time\":\n dates = [self.parseDate(inputDate, format)];\n break;\n\n case \"multiple\":\n dates = inputDate.split(self.config.conjunction).map(function (date) {\n return self.parseDate(date, format);\n });\n break;\n\n case \"range\":\n dates = inputDate.split(self.l10n.rangeSeparator).map(function (date) {\n return self.parseDate(date, format);\n });\n break;\n\n default:\n break;\n }\n } else self.config.errorHandler(new Error(\"Invalid date supplied: \" + JSON.stringify(inputDate)));\n self.selectedDates = dates.filter(function (d) {\n return d instanceof Date && isEnabled(d, false);\n });\n if (self.config.mode === \"range\") self.selectedDates.sort(function (a, b) {\n return a.getTime() - b.getTime();\n });\n }\n\n function setDate(date, triggerChange, format) {\n if (triggerChange === void 0) {\n triggerChange = false;\n }\n\n if (format === void 0) {\n format = self.config.dateFormat;\n }\n\n if (date !== 0 && !date || date instanceof Array && date.length === 0) return self.clear(triggerChange);\n setSelectedDate(date, format);\n self.showTimeInput = self.selectedDates.length > 0;\n self.latestSelectedDateObj = self.selectedDates[self.selectedDates.length - 1];\n self.redraw();\n jumpToDate();\n setHoursFromDate();\n\n if (self.selectedDates.length === 0) {\n self.clear(false);\n }\n\n updateValue(triggerChange);\n if (triggerChange) triggerEvent(\"onChange\");\n }\n\n function parseDateRules(arr) {\n return arr.slice().map(function (rule) {\n if (typeof rule === \"string\" || typeof rule === \"number\" || rule instanceof Date) {\n return self.parseDate(rule, undefined, true);\n } else if (rule && _typeof(rule) === \"object\" && rule.from && rule.to) return {\n from: self.parseDate(rule.from, undefined),\n to: self.parseDate(rule.to, undefined)\n };\n\n return rule;\n }).filter(function (x) {\n return x;\n }); // remove falsy values\n }\n\n function setupDates() {\n self.selectedDates = [];\n self.now = self.parseDate(self.config.now) || new Date(); // Workaround IE11 setting placeholder as the input's value\n\n var preloadedDate = self.config.defaultDate || ((self.input.nodeName === \"INPUT\" || self.input.nodeName === \"TEXTAREA\") && self.input.placeholder && self.input.value === self.input.placeholder ? null : self.input.value);\n if (preloadedDate) setSelectedDate(preloadedDate, self.config.dateFormat);\n self._initialDate = self.selectedDates.length > 0 ? self.selectedDates[0] : self.config.minDate && self.config.minDate.getTime() > self.now.getTime() ? self.config.minDate : self.config.maxDate && self.config.maxDate.getTime() < self.now.getTime() ? self.config.maxDate : self.now;\n self.currentYear = self._initialDate.getFullYear();\n self.currentMonth = self._initialDate.getMonth();\n if (self.selectedDates.length > 0) self.latestSelectedDateObj = self.selectedDates[0];\n if (self.config.minTime !== undefined) self.config.minTime = self.parseDate(self.config.minTime, \"H:i\");\n if (self.config.maxTime !== undefined) self.config.maxTime = self.parseDate(self.config.maxTime, \"H:i\");\n self.minDateHasTime = !!self.config.minDate && (self.config.minDate.getHours() > 0 || self.config.minDate.getMinutes() > 0 || self.config.minDate.getSeconds() > 0);\n self.maxDateHasTime = !!self.config.maxDate && (self.config.maxDate.getHours() > 0 || self.config.maxDate.getMinutes() > 0 || self.config.maxDate.getSeconds() > 0);\n Object.defineProperty(self, \"showTimeInput\", {\n get: function get() {\n return self._showTimeInput;\n },\n set: function set(bool) {\n self._showTimeInput = bool;\n if (self.calendarContainer) toggleClass(self.calendarContainer, \"showTimeInput\", bool);\n self.isOpen && positionCalendar();\n }\n });\n }\n\n function setupInputs() {\n self.input = self.config.wrap ? element.querySelector(\"[data-input]\") : element;\n /* istanbul ignore next */\n\n if (!self.input) {\n self.config.errorHandler(new Error(\"Invalid input element specified\"));\n return;\n } // hack: store previous type to restore it after destroy()\n\n\n self.input._type = self.input.type;\n self.input.type = \"text\";\n self.input.classList.add(\"flatpickr-input\");\n self._input = self.input;\n\n if (self.config.altInput) {\n // replicate self.element\n self.altInput = createElement(self.input.nodeName, self.config.altInputClass);\n self._input = self.altInput;\n self.altInput.placeholder = self.input.placeholder;\n self.altInput.disabled = self.input.disabled;\n self.altInput.required = self.input.required;\n self.altInput.tabIndex = self.input.tabIndex;\n self.altInput.type = \"text\";\n self.input.setAttribute(\"type\", \"hidden\");\n if (!self.config[\"static\"] && self.input.parentNode) self.input.parentNode.insertBefore(self.altInput, self.input.nextSibling);\n }\n\n if (!self.config.allowInput) self._input.setAttribute(\"readonly\", \"readonly\");\n self._positionElement = self.config.positionElement || self._input;\n }\n\n function setupMobile() {\n var inputType = self.config.enableTime ? self.config.noCalendar ? \"time\" : \"datetime-local\" : \"date\";\n self.mobileInput = createElement(\"input\", self.input.className + \" flatpickr-mobile\");\n self.mobileInput.step = self.input.getAttribute(\"step\") || \"any\";\n self.mobileInput.tabIndex = 1;\n self.mobileInput.type = inputType;\n self.mobileInput.disabled = self.input.disabled;\n self.mobileInput.required = self.input.required;\n self.mobileInput.placeholder = self.input.placeholder;\n self.mobileFormatStr = inputType === \"datetime-local\" ? \"Y-m-d\\\\TH:i:S\" : inputType === \"date\" ? \"Y-m-d\" : \"H:i:S\";\n\n if (self.selectedDates.length > 0) {\n self.mobileInput.defaultValue = self.mobileInput.value = self.formatDate(self.selectedDates[0], self.mobileFormatStr);\n }\n\n if (self.config.minDate) self.mobileInput.min = self.formatDate(self.config.minDate, \"Y-m-d\");\n if (self.config.maxDate) self.mobileInput.max = self.formatDate(self.config.maxDate, \"Y-m-d\");\n self.input.type = \"hidden\";\n if (self.altInput !== undefined) self.altInput.type = \"hidden\";\n\n try {\n if (self.input.parentNode) self.input.parentNode.insertBefore(self.mobileInput, self.input.nextSibling);\n } catch (_a) {}\n\n bind(self.mobileInput, \"change\", function (e) {\n self.setDate(e.target.value, false, self.mobileFormatStr);\n triggerEvent(\"onChange\");\n triggerEvent(\"onClose\");\n });\n }\n\n function toggle(e) {\n if (self.isOpen === true) return self.close();\n self.open(e);\n }\n\n function triggerEvent(event, data) {\n // If the instance has been destroyed already, all hooks have been removed\n if (self.config === undefined) return;\n var hooks = self.config[event];\n\n if (hooks !== undefined && hooks.length > 0) {\n for (var i = 0; hooks[i] && i < hooks.length; i++) {\n hooks[i](self.selectedDates, self.input.value, self, data);\n }\n }\n\n if (event === \"onChange\") {\n self.input.dispatchEvent(createEvent(\"change\")); // many front-end frameworks bind to the input event\n\n self.input.dispatchEvent(createEvent(\"input\"));\n }\n }\n\n function createEvent(name) {\n var e = document.createEvent(\"Event\");\n e.initEvent(name, true, true);\n return e;\n }\n\n function isDateSelected(date) {\n for (var i = 0; i < self.selectedDates.length; i++) {\n if (compareDates(self.selectedDates[i], date) === 0) return \"\" + i;\n }\n\n return false;\n }\n\n function isDateInRange(date) {\n if (self.config.mode !== \"range\" || self.selectedDates.length < 2) return false;\n return compareDates(date, self.selectedDates[0]) >= 0 && compareDates(date, self.selectedDates[1]) <= 0;\n }\n\n function updateNavigationCurrentMonth() {\n if (self.config.noCalendar || self.isMobile || !self.monthNav) return;\n self.yearElements.forEach(function (yearElement, i) {\n var d = new Date(self.currentYear, self.currentMonth, 1);\n d.setMonth(self.currentMonth + i);\n\n if (self.config.showMonths > 1 || self.config.monthSelectorType === \"static\") {\n self.monthElements[i].textContent = monthToStr(d.getMonth(), self.config.shorthandCurrentMonth, self.l10n) + \" \";\n } else {\n self.monthsDropdownContainer.value = d.getMonth().toString();\n }\n\n yearElement.value = d.getFullYear().toString();\n });\n self._hidePrevMonthArrow = self.config.minDate !== undefined && (self.currentYear === self.config.minDate.getFullYear() ? self.currentMonth <= self.config.minDate.getMonth() : self.currentYear < self.config.minDate.getFullYear());\n self._hideNextMonthArrow = self.config.maxDate !== undefined && (self.currentYear === self.config.maxDate.getFullYear() ? self.currentMonth + 1 > self.config.maxDate.getMonth() : self.currentYear > self.config.maxDate.getFullYear());\n }\n\n function getDateStr(format) {\n return self.selectedDates.map(function (dObj) {\n return self.formatDate(dObj, format);\n }).filter(function (d, i, arr) {\n return self.config.mode !== \"range\" || self.config.enableTime || arr.indexOf(d) === i;\n }).join(self.config.mode !== \"range\" ? self.config.conjunction : self.l10n.rangeSeparator);\n }\n /**\n * Updates the values of inputs associated with the calendar\n */\n\n\n function updateValue(triggerChange) {\n if (triggerChange === void 0) {\n triggerChange = true;\n }\n\n if (self.mobileInput !== undefined && self.mobileFormatStr) {\n self.mobileInput.value = self.latestSelectedDateObj !== undefined ? self.formatDate(self.latestSelectedDateObj, self.mobileFormatStr) : \"\";\n }\n\n self.input.value = getDateStr(self.config.dateFormat);\n\n if (self.altInput !== undefined) {\n self.altInput.value = getDateStr(self.config.altFormat);\n }\n\n if (triggerChange !== false) triggerEvent(\"onValueUpdate\");\n }\n\n function onMonthNavClick(e) {\n var isPrevMonth = self.prevMonthNav.contains(e.target);\n var isNextMonth = self.nextMonthNav.contains(e.target);\n\n if (isPrevMonth || isNextMonth) {\n changeMonth(isPrevMonth ? -1 : 1);\n } else if (self.yearElements.indexOf(e.target) >= 0) {\n e.target.select();\n } else if (e.target.classList.contains(\"arrowUp\")) {\n self.changeYear(self.currentYear + 1);\n } else if (e.target.classList.contains(\"arrowDown\")) {\n self.changeYear(self.currentYear - 1);\n }\n }\n\n function timeWrapper(e) {\n e.preventDefault();\n var isKeyDown = e.type === \"keydown\",\n input = e.target;\n\n if (self.amPM !== undefined && e.target === self.amPM) {\n self.amPM.textContent = self.l10n.amPM[_int(self.amPM.textContent === self.l10n.amPM[0])];\n }\n\n var min = parseFloat(input.getAttribute(\"min\")),\n max = parseFloat(input.getAttribute(\"max\")),\n step = parseFloat(input.getAttribute(\"step\")),\n curValue = parseInt(input.value, 10),\n delta = e.delta || (isKeyDown ? e.which === 38 ? 1 : -1 : 0);\n var newValue = curValue + step * delta;\n\n if (typeof input.value !== \"undefined\" && input.value.length === 2) {\n var isHourElem = input === self.hourElement,\n isMinuteElem = input === self.minuteElement;\n\n if (newValue < min) {\n newValue = max + newValue + _int(!isHourElem) + (_int(isHourElem) && _int(!self.amPM));\n if (isMinuteElem) incrementNumInput(undefined, -1, self.hourElement);\n } else if (newValue > max) {\n newValue = input === self.hourElement ? newValue - max - _int(!self.amPM) : min;\n if (isMinuteElem) incrementNumInput(undefined, 1, self.hourElement);\n }\n\n if (self.amPM && isHourElem && (step === 1 ? newValue + curValue === 23 : Math.abs(newValue - curValue) > step)) {\n self.amPM.textContent = self.l10n.amPM[_int(self.amPM.textContent === self.l10n.amPM[0])];\n }\n\n input.value = pad(newValue);\n }\n }\n\n init();\n return self;\n }\n /* istanbul ignore next */\n\n\n function _flatpickr(nodeList, config) {\n // static list\n var nodes = Array.prototype.slice.call(nodeList).filter(function (x) {\n return x instanceof HTMLElement;\n });\n var instances = [];\n\n for (var i = 0; i < nodes.length; i++) {\n var node = nodes[i];\n\n try {\n if (node.getAttribute(\"data-fp-omit\") !== null) continue;\n\n if (node._flatpickr !== undefined) {\n node._flatpickr.destroy();\n\n node._flatpickr = undefined;\n }\n\n node._flatpickr = FlatpickrInstance(node, config || {});\n instances.push(node._flatpickr);\n } catch (e) {\n console.error(e);\n }\n }\n\n return instances.length === 1 ? instances[0] : instances;\n }\n /* istanbul ignore next */\n\n\n if (typeof HTMLElement !== \"undefined\" && typeof HTMLCollection !== \"undefined\" && typeof NodeList !== \"undefined\") {\n // browser env\n HTMLCollection.prototype.flatpickr = NodeList.prototype.flatpickr = function (config) {\n return _flatpickr(this, config);\n };\n\n HTMLElement.prototype.flatpickr = function (config) {\n return _flatpickr([this], config);\n };\n }\n /* istanbul ignore next */\n\n\n var flatpickr = function flatpickr(selector, config) {\n if (typeof selector === \"string\") {\n return _flatpickr(window.document.querySelectorAll(selector), config);\n } else if (selector instanceof Node) {\n return _flatpickr([selector], config);\n } else {\n return _flatpickr(selector, config);\n }\n };\n /* istanbul ignore next */\n\n\n flatpickr.defaultConfig = {};\n flatpickr.l10ns = {\n en: _assign({}, english),\n \"default\": _assign({}, english)\n };\n\n flatpickr.localize = function (l10n) {\n flatpickr.l10ns[\"default\"] = _assign({}, flatpickr.l10ns[\"default\"], l10n);\n };\n\n flatpickr.setDefaults = function (config) {\n flatpickr.defaultConfig = _assign({}, flatpickr.defaultConfig, config);\n };\n\n flatpickr.parseDate = createDateParser({});\n flatpickr.formatDate = createDateFormatter({});\n flatpickr.compareDates = compareDates;\n /* istanbul ignore next */\n\n if (typeof jQuery !== \"undefined\" && typeof jQuery.fn !== \"undefined\") {\n jQuery.fn.flatpickr = function (config) {\n return _flatpickr(this, config);\n };\n } // eslint-disable-next-line @typescript-eslint/camelcase\n\n\n Date.prototype.fp_incr = function (days) {\n return new Date(this.getFullYear(), this.getMonth(), this.getDate() + (typeof days === \"string\" ? parseInt(days, 10) : days));\n };\n\n if (typeof window !== \"undefined\") {\n window.flatpickr = flatpickr;\n }\n\n return flatpickr;\n});","function _typeof2(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof2(obj); }\n\nfunction _typeof(obj) {\n if (typeof Symbol === \"function\" && _typeof2(Symbol.iterator) === \"symbol\") {\n _typeof = function _typeof(obj) {\n return _typeof2(obj);\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : _typeof2(obj);\n };\n }\n\n return _typeof(obj);\n}\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) _setPrototypeOf(subClass, superClass);\n}\n\nfunction _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nfunction _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n\n var target = _objectWithoutPropertiesLoose(source, excluded);\n\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (_typeof2(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return _assertThisInitialized(self);\n}\n\nfunction _superPropBase(object, property) {\n while (!Object.prototype.hasOwnProperty.call(object, property)) {\n object = _getPrototypeOf(object);\n if (object === null) break;\n }\n\n return object;\n}\n\nfunction _get(target, property, receiver) {\n if (typeof Reflect !== \"undefined\" && Reflect.get) {\n _get = Reflect.get;\n } else {\n _get = function _get(target, property, receiver) {\n var base = _superPropBase(target, property);\n\n if (!base) return;\n var desc = Object.getOwnPropertyDescriptor(base, property);\n\n if (desc.get) {\n return desc.get.call(receiver);\n }\n\n return desc.value;\n };\n }\n\n return _get(target, property, receiver || target);\n}\n\nfunction set(target, property, value, receiver) {\n if (typeof Reflect !== \"undefined\" && Reflect.set) {\n set = Reflect.set;\n } else {\n set = function set(target, property, value, receiver) {\n var base = _superPropBase(target, property);\n\n var desc;\n\n if (base) {\n desc = Object.getOwnPropertyDescriptor(base, property);\n\n if (desc.set) {\n desc.set.call(receiver, value);\n return true;\n } else if (!desc.writable) {\n return false;\n }\n }\n\n desc = Object.getOwnPropertyDescriptor(receiver, property);\n\n if (desc) {\n if (!desc.writable) {\n return false;\n }\n\n desc.value = value;\n Object.defineProperty(receiver, property, desc);\n } else {\n _defineProperty(receiver, property, value);\n }\n\n return true;\n };\n }\n\n return set(target, property, value, receiver);\n}\n\nfunction _set(target, property, value, receiver, isStrict) {\n var s = set(target, property, value, receiver || target);\n\n if (!s && isStrict) {\n throw new Error('failed to set property');\n }\n\n return value;\n}\n\nfunction _slicedToArray(arr, i) {\n return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();\n}\n\nfunction _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nfunction _iterableToArrayLimit(arr, i) {\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nfunction _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");\n}\n/** Checks if value is string */\n\n\nfunction isString(str) {\n return typeof str === 'string' || str instanceof String;\n}\n/**\r\n Direction\r\n @prop {string} NONE\r\n @prop {string} LEFT\r\n @prop {string} FORCE_LEFT\r\n @prop {string} RIGHT\r\n @prop {string} FORCE_RIGHT\r\n*/\n\n\nvar DIRECTION = {\n NONE: 'NONE',\n LEFT: 'LEFT',\n FORCE_LEFT: 'FORCE_LEFT',\n RIGHT: 'RIGHT',\n FORCE_RIGHT: 'FORCE_RIGHT'\n /**\r\n Direction\r\n @enum {string}\r\n */\n\n};\n/** */\n\nfunction forceDirection(direction) {\n switch (direction) {\n case DIRECTION.LEFT:\n return DIRECTION.FORCE_LEFT;\n\n case DIRECTION.RIGHT:\n return DIRECTION.FORCE_RIGHT;\n\n default:\n return direction;\n }\n}\n/** Escapes regular expression control chars */\n\n\nfunction escapeRegExp(str) {\n return str.replace(/([.*+?^=!:${}()|[\\]/\\\\])/g, '\\\\$1');\n} // cloned from https://github.com/epoberezkin/fast-deep-equal with small changes\n\n\nfunction objectIncludes(b, a) {\n if (a === b) return true;\n var arrA = Array.isArray(a),\n arrB = Array.isArray(b),\n i;\n\n if (arrA && arrB) {\n if (a.length != b.length) return false;\n\n for (i = 0; i < a.length; i++) {\n if (!objectIncludes(a[i], b[i])) return false;\n }\n\n return true;\n }\n\n if (arrA != arrB) return false;\n\n if (a && b && _typeof(a) === 'object' && _typeof(b) === 'object') {\n var dateA = a instanceof Date,\n dateB = b instanceof Date;\n if (dateA && dateB) return a.getTime() == b.getTime();\n if (dateA != dateB) return false;\n var regexpA = a instanceof RegExp,\n regexpB = b instanceof RegExp;\n if (regexpA && regexpB) return a.toString() == b.toString();\n if (regexpA != regexpB) return false;\n var keys = Object.keys(a); // if (keys.length !== Object.keys(b).length) return false;\n\n for (i = 0; i < keys.length; i++) {\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\n }\n\n for (i = 0; i < keys.length; i++) {\n if (!objectIncludes(b[keys[i]], a[keys[i]])) return false;\n }\n\n return true;\n } else if (a && b && typeof a === 'function' && typeof b === 'function') {\n return a.toString() === b.toString();\n }\n\n return false;\n}\n/* eslint-disable no-undef */\n\n\nvar g = typeof window !== 'undefined' && window || typeof global !== 'undefined' && global.global === global && global || typeof self !== 'undefined' && self.self === self && self || {};\n/* eslint-enable no-undef */\n\n/** Selection range */\n\n/** Provides details of changing input */\n\nvar ActionDetails = /*#__PURE__*/function () {\n /** Current input value */\n\n /** Current cursor position */\n\n /** Old input value */\n\n /** Old selection */\n function ActionDetails(value, cursorPos, oldValue, oldSelection) {\n _classCallCheck(this, ActionDetails);\n\n this.value = value;\n this.cursorPos = cursorPos;\n this.oldValue = oldValue;\n this.oldSelection = oldSelection; // double check if left part was changed (autofilling, other non-standard input triggers)\n\n while (this.value.slice(0, this.startChangePos) !== this.oldValue.slice(0, this.startChangePos)) {\n --this.oldSelection.start;\n }\n }\n /**\r\n Start changing position\r\n @readonly\r\n */\n\n\n _createClass(ActionDetails, [{\n key: \"startChangePos\",\n get: function get() {\n return Math.min(this.cursorPos, this.oldSelection.start);\n }\n /**\r\n Inserted symbols count\r\n @readonly\r\n */\n\n }, {\n key: \"insertedCount\",\n get: function get() {\n return this.cursorPos - this.startChangePos;\n }\n /**\r\n Inserted symbols\r\n @readonly\r\n */\n\n }, {\n key: \"inserted\",\n get: function get() {\n return this.value.substr(this.startChangePos, this.insertedCount);\n }\n /**\r\n Removed symbols count\r\n @readonly\r\n */\n\n }, {\n key: \"removedCount\",\n get: function get() {\n // Math.max for opposite operation\n return Math.max(this.oldSelection.end - this.startChangePos || // for Delete\n this.oldValue.length - this.value.length, 0);\n }\n /**\r\n Removed symbols\r\n @readonly\r\n */\n\n }, {\n key: \"removed\",\n get: function get() {\n return this.oldValue.substr(this.startChangePos, this.removedCount);\n }\n /**\r\n Unchanged head symbols\r\n @readonly\r\n */\n\n }, {\n key: \"head\",\n get: function get() {\n return this.value.substring(0, this.startChangePos);\n }\n /**\r\n Unchanged tail symbols\r\n @readonly\r\n */\n\n }, {\n key: \"tail\",\n get: function get() {\n return this.value.substring(this.startChangePos + this.insertedCount);\n }\n /**\r\n Remove direction\r\n @readonly\r\n */\n\n }, {\n key: \"removeDirection\",\n get: function get() {\n if (!this.removedCount || this.insertedCount) return DIRECTION.NONE; // align right if delete at right or if range removed (event with backspace)\n\n return this.oldSelection.end === this.cursorPos || this.oldSelection.start === this.cursorPos ? DIRECTION.RIGHT : DIRECTION.LEFT;\n }\n }]);\n\n return ActionDetails;\n}();\n/**\r\n Provides details of changing model value\r\n @param {Object} [details]\r\n @param {string} [details.inserted] - Inserted symbols\r\n @param {boolean} [details.skip] - Can skip chars\r\n @param {number} [details.removeCount] - Removed symbols count\r\n @param {number} [details.tailShift] - Additional offset if any changes occurred before tail\r\n*/\n\n\nvar ChangeDetails = /*#__PURE__*/function () {\n /** Inserted symbols */\n\n /** Can skip chars */\n\n /** Additional offset if any changes occurred before tail */\n\n /** Raw inserted is used by dynamic mask */\n function ChangeDetails(details) {\n _classCallCheck(this, ChangeDetails);\n\n Object.assign(this, {\n inserted: '',\n rawInserted: '',\n skip: false,\n tailShift: 0\n }, details);\n }\n /**\r\n Aggregate changes\r\n @returns {ChangeDetails} `this`\r\n */\n\n\n _createClass(ChangeDetails, [{\n key: \"aggregate\",\n value: function aggregate(details) {\n this.rawInserted += details.rawInserted;\n this.skip = this.skip || details.skip;\n this.inserted += details.inserted;\n this.tailShift += details.tailShift;\n return this;\n }\n /** Total offset considering all changes */\n\n }, {\n key: \"offset\",\n get: function get() {\n return this.tailShift + this.inserted.length;\n }\n }]);\n\n return ChangeDetails;\n}();\n/** Provides details of continuous extracted tail */\n\n\nvar ContinuousTailDetails = /*#__PURE__*/function () {\n /** Tail value as string */\n\n /** Tail start position */\n\n /** Start position */\n function ContinuousTailDetails() {\n var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n var from = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var stop = arguments.length > 2 ? arguments[2] : undefined;\n\n _classCallCheck(this, ContinuousTailDetails);\n\n this.value = value;\n this.from = from;\n this.stop = stop;\n }\n\n _createClass(ContinuousTailDetails, [{\n key: \"toString\",\n value: function toString() {\n return this.value;\n }\n }, {\n key: \"extend\",\n value: function extend(tail) {\n this.value += String(tail);\n }\n }, {\n key: \"appendTo\",\n value: function appendTo(masked) {\n return masked.append(this.toString(), {\n tail: true\n }).aggregate(masked._appendPlaceholder());\n }\n }, {\n key: \"shiftBefore\",\n value: function shiftBefore(pos) {\n if (this.from >= pos || !this.value.length) return '';\n var shiftChar = this.value[0];\n this.value = this.value.slice(1);\n return shiftChar;\n }\n }, {\n key: \"state\",\n get: function get() {\n return {\n value: this.value,\n from: this.from,\n stop: this.stop\n };\n },\n set: function set(state) {\n Object.assign(this, state);\n }\n }]);\n\n return ContinuousTailDetails;\n}();\n/** Provides common masking stuff */\n\n\nvar Masked = /*#__PURE__*/function () {\n // $Shape; TODO after fix https://github.com/facebook/flow/issues/4773\n\n /** @type {Mask} */\n\n /** */\n // $FlowFixMe no ideas\n\n /** Transforms value before mask processing */\n\n /** Validates if value is acceptable */\n\n /** Does additional processing in the end of editing */\n\n /** Enable characters overwriting */\n\n /** */\n function Masked(opts) {\n _classCallCheck(this, Masked);\n\n this._value = '';\n\n this._update(opts);\n\n this.isInitialized = true;\n }\n /** Sets and applies new options */\n\n\n _createClass(Masked, [{\n key: \"updateOptions\",\n value: function updateOptions(opts) {\n if (!Object.keys(opts).length) return;\n this.withValueRefresh(this._update.bind(this, opts));\n }\n /**\r\n Sets new options\r\n @protected\r\n */\n\n }, {\n key: \"_update\",\n value: function _update(opts) {\n Object.assign(this, opts);\n }\n /** Mask state */\n\n }, {\n key: \"reset\",\n\n /** Resets value */\n value: function reset() {\n this._value = '';\n }\n /** */\n\n }, {\n key: \"resolve\",\n\n /** Resolve new value */\n value: function resolve(value) {\n this.reset();\n this.append(value, {\n input: true\n }, '');\n this.doCommit();\n return this.value;\n }\n /** */\n\n }, {\n key: \"nearestInputPos\",\n\n /** Finds nearest input position in direction */\n value: function nearestInputPos(cursorPos, direction) {\n return cursorPos;\n }\n /** Extracts value in range considering flags */\n\n }, {\n key: \"extractInput\",\n value: function extractInput() {\n var fromPos = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var toPos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.value.length;\n return this.value.slice(fromPos, toPos);\n }\n /** Extracts tail in range */\n\n }, {\n key: \"extractTail\",\n value: function extractTail() {\n var fromPos = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var toPos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.value.length;\n return new ContinuousTailDetails(this.extractInput(fromPos, toPos), fromPos);\n }\n /** Appends tail */\n // $FlowFixMe no ideas\n\n }, {\n key: \"appendTail\",\n value: function appendTail(tail) {\n if (isString(tail)) tail = new ContinuousTailDetails(String(tail));\n return tail.appendTo(this);\n }\n /** Appends char */\n\n }, {\n key: \"_appendCharRaw\",\n value: function _appendCharRaw(ch) {\n var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n ch = this.doPrepare(ch, flags);\n if (!ch) return new ChangeDetails();\n this._value += ch;\n return new ChangeDetails({\n inserted: ch,\n rawInserted: ch\n });\n }\n /** Appends char */\n\n }, {\n key: \"_appendChar\",\n value: function _appendChar(ch) {\n var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var checkTail = arguments.length > 2 ? arguments[2] : undefined;\n var consistentState = this.state;\n\n var details = this._appendCharRaw(ch, flags);\n\n if (details.inserted) {\n var consistentTail;\n var appended = this.doValidate(flags) !== false;\n\n if (appended && checkTail != null) {\n // validation ok, check tail\n var beforeTailState = this.state;\n\n if (this.overwrite) {\n consistentTail = checkTail.state;\n checkTail.shiftBefore(this.value.length);\n }\n\n var tailDetails = this.appendTail(checkTail);\n appended = tailDetails.rawInserted === checkTail.toString(); // if ok, rollback state after tail\n\n if (appended && tailDetails.inserted) this.state = beforeTailState;\n } // revert all if something went wrong\n\n\n if (!appended) {\n details.rawInserted = details.inserted = '';\n this.state = consistentState;\n if (checkTail && consistentTail) checkTail.state = consistentTail;\n }\n }\n\n return details;\n }\n /** Appends optional placeholder at end */\n\n }, {\n key: \"_appendPlaceholder\",\n value: function _appendPlaceholder() {\n return new ChangeDetails();\n }\n /** Appends symbols considering flags */\n // $FlowFixMe no ideas\n\n }, {\n key: \"append\",\n value: function append(str, flags, tail) {\n if (!isString(str)) throw new Error('value should be string');\n var details = new ChangeDetails();\n var checkTail = isString(tail) ? new ContinuousTailDetails(String(tail)) : tail;\n if (flags.tail) flags._beforeTailState = this.state;\n\n for (var ci = 0; ci < str.length; ++ci) {\n details.aggregate(this._appendChar(str[ci], flags, checkTail));\n } // append tail but aggregate only tailShift\n\n\n if (checkTail != null) {\n details.tailShift += this.appendTail(checkTail).tailShift; // TODO it's a good idea to clear state after appending ends\n // but it causes bugs when one append calls another (when dynamic dispatch set rawInputValue)\n // this._resetBeforeTailState();\n }\n\n return details;\n }\n /** */\n\n }, {\n key: \"remove\",\n value: function remove() {\n var fromPos = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var toPos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.value.length;\n this._value = this.value.slice(0, fromPos) + this.value.slice(toPos);\n return new ChangeDetails();\n }\n /** Calls function and reapplies current value */\n\n }, {\n key: \"withValueRefresh\",\n value: function withValueRefresh(fn) {\n if (this._refreshing || !this.isInitialized) return fn();\n this._refreshing = true;\n var unmasked = this.unmaskedValue;\n var value = this.value;\n var ret = fn(); // try to update with raw value first to keep fixed chars\n\n if (this.resolve(value) !== value) {\n // or fallback to unmasked\n this.unmaskedValue = unmasked;\n }\n\n delete this._refreshing;\n return ret;\n }\n /**\r\n Prepares string before mask processing\r\n @protected\r\n */\n\n }, {\n key: \"doPrepare\",\n value: function doPrepare(str) {\n var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return this.prepare ? this.prepare(str, this, flags) : str;\n }\n /**\r\n Validates if value is acceptable\r\n @protected\r\n */\n\n }, {\n key: \"doValidate\",\n value: function doValidate(flags) {\n return (!this.validate || this.validate(this.value, this, flags)) && (!this.parent || this.parent.doValidate(flags));\n }\n /**\r\n Does additional processing in the end of editing\r\n @protected\r\n */\n\n }, {\n key: \"doCommit\",\n value: function doCommit() {\n if (this.commit) this.commit(this.value, this);\n }\n /** */\n\n }, {\n key: \"splice\",\n value: function splice(start, deleteCount, inserted, removeDirection) {\n var tailPos = start + deleteCount;\n var tail = this.extractTail(tailPos);\n var startChangePos = this.nearestInputPos(start, removeDirection);\n var changeDetails = new ChangeDetails({\n tailShift: startChangePos - start // adjust tailShift if start was aligned\n\n }).aggregate(this.remove(startChangePos)).aggregate(this.append(inserted, {\n input: true\n }, tail));\n return changeDetails;\n }\n }, {\n key: \"state\",\n get: function get() {\n return {\n _value: this.value\n };\n },\n set: function set(state) {\n this._value = state._value;\n }\n }, {\n key: \"value\",\n get: function get() {\n return this._value;\n },\n set: function set(value) {\n this.resolve(value);\n }\n }, {\n key: \"unmaskedValue\",\n get: function get() {\n return this.value;\n },\n set: function set(value) {\n this.reset();\n this.append(value, {}, '');\n this.doCommit();\n }\n /** */\n\n }, {\n key: \"typedValue\",\n get: function get() {\n return this.unmaskedValue;\n },\n set: function set(value) {\n this.unmaskedValue = value;\n }\n /** Value that includes raw user input */\n\n }, {\n key: \"rawInputValue\",\n get: function get() {\n return this.extractInput(0, this.value.length, {\n raw: true\n });\n },\n set: function set(value) {\n this.reset();\n this.append(value, {\n raw: true\n }, '');\n this.doCommit();\n }\n /** */\n\n }, {\n key: \"isComplete\",\n get: function get() {\n return true;\n }\n }]);\n\n return Masked;\n}();\n/** Get Masked class by mask type */\n\n\nfunction maskedClass(mask) {\n if (mask == null) {\n throw new Error('mask property should be defined');\n }\n\n if (mask instanceof RegExp) return g.IMask.MaskedRegExp;\n if (isString(mask)) return g.IMask.MaskedPattern;\n if (mask instanceof Date || mask === Date) return g.IMask.MaskedDate;\n if (mask instanceof Number || typeof mask === 'number' || mask === Number) return g.IMask.MaskedNumber;\n if (Array.isArray(mask) || mask === Array) return g.IMask.MaskedDynamic; // $FlowFixMe\n\n if (mask.prototype instanceof g.IMask.Masked) return mask; // $FlowFixMe\n\n if (mask instanceof Function) return g.IMask.MaskedFunction;\n console.warn('Mask not found for mask', mask); // eslint-disable-line no-console\n\n return g.IMask.Masked;\n}\n/** Creates new {@link Masked} depending on mask type */\n\n\nfunction createMask(opts) {\n opts = Object.assign({}, opts);\n var mask = opts.mask;\n if (mask instanceof g.IMask.Masked) return mask;\n var MaskedClass = maskedClass(mask);\n return new MaskedClass(opts);\n}\n\nvar DEFAULT_INPUT_DEFINITIONS = {\n '0': /\\d/,\n 'a': /[\\u0041-\\u005A\\u0061-\\u007A\\u00AA\\u00B5\\u00BA\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0\\u08A2-\\u08AC\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0977\\u0979-\\u097F\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C33\\u0C35-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191C\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2183\\u2184\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005\\u3006\\u3031-\\u3035\\u303B\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA697\\uA6A0-\\uA6E5\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA793\\uA7A0-\\uA7AA\\uA7F8-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA80-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]/,\n // http://stackoverflow.com/a/22075070\n '*': /./\n};\n/** */\n\nvar PatternInputDefinition = /*#__PURE__*/function () {\n /** */\n\n /** */\n\n /** */\n\n /** */\n\n /** */\n\n /** */\n function PatternInputDefinition(opts) {\n _classCallCheck(this, PatternInputDefinition);\n\n var mask = opts.mask,\n blockOpts = _objectWithoutProperties(opts, [\"mask\"]);\n\n this.masked = createMask({\n mask: mask\n });\n Object.assign(this, blockOpts);\n }\n\n _createClass(PatternInputDefinition, [{\n key: \"reset\",\n value: function reset() {\n this._isFilled = false;\n this.masked.reset();\n }\n }, {\n key: \"remove\",\n value: function remove() {\n var fromPos = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var toPos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.value.length;\n\n if (fromPos === 0 && toPos >= 1) {\n this._isFilled = false;\n return this.masked.remove(fromPos, toPos);\n }\n\n return new ChangeDetails();\n }\n }, {\n key: \"_appendChar\",\n value: function _appendChar(str) {\n var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n if (this._isFilled) return new ChangeDetails();\n var state = this.masked.state; // simulate input\n\n var details = this.masked._appendChar(str, flags);\n\n if (details.inserted && this.doValidate(flags) === false) {\n details.inserted = details.rawInserted = '';\n this.masked.state = state;\n }\n\n if (!details.inserted && !this.isOptional && !this.lazy && !flags.input) {\n details.inserted = this.placeholderChar;\n }\n\n details.skip = !details.inserted && !this.isOptional;\n this._isFilled = Boolean(details.inserted);\n return details;\n }\n }, {\n key: \"append\",\n value: function append() {\n var _this$masked;\n\n return (_this$masked = this.masked).append.apply(_this$masked, arguments);\n }\n }, {\n key: \"_appendPlaceholder\",\n value: function _appendPlaceholder() {\n var details = new ChangeDetails();\n if (this._isFilled || this.isOptional) return details;\n this._isFilled = true;\n details.inserted = this.placeholderChar;\n return details;\n }\n }, {\n key: \"extractTail\",\n value: function extractTail() {\n var _this$masked2;\n\n return (_this$masked2 = this.masked).extractTail.apply(_this$masked2, arguments);\n }\n }, {\n key: \"appendTail\",\n value: function appendTail() {\n var _this$masked3;\n\n return (_this$masked3 = this.masked).appendTail.apply(_this$masked3, arguments);\n }\n }, {\n key: \"extractInput\",\n value: function extractInput() {\n var fromPos = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var toPos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.value.length;\n var flags = arguments.length > 2 ? arguments[2] : undefined;\n return this.masked.extractInput(fromPos, toPos, flags);\n }\n }, {\n key: \"nearestInputPos\",\n value: function nearestInputPos(cursorPos) {\n var direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DIRECTION.NONE;\n var minPos = 0;\n var maxPos = this.value.length;\n var boundPos = Math.min(Math.max(cursorPos, minPos), maxPos);\n\n switch (direction) {\n case DIRECTION.LEFT:\n case DIRECTION.FORCE_LEFT:\n return this.isComplete ? boundPos : minPos;\n\n case DIRECTION.RIGHT:\n case DIRECTION.FORCE_RIGHT:\n return this.isComplete ? boundPos : maxPos;\n\n case DIRECTION.NONE:\n default:\n return boundPos;\n }\n }\n }, {\n key: \"doValidate\",\n value: function doValidate() {\n var _this$masked4, _this$parent;\n\n return (_this$masked4 = this.masked).doValidate.apply(_this$masked4, arguments) && (!this.parent || (_this$parent = this.parent).doValidate.apply(_this$parent, arguments));\n }\n }, {\n key: \"doCommit\",\n value: function doCommit() {\n this.masked.doCommit();\n }\n }, {\n key: \"value\",\n get: function get() {\n return this.masked.value || (this._isFilled && !this.isOptional ? this.placeholderChar : '');\n }\n }, {\n key: \"unmaskedValue\",\n get: function get() {\n return this.masked.unmaskedValue;\n }\n }, {\n key: \"isComplete\",\n get: function get() {\n return Boolean(this.masked.value) || this.isOptional;\n }\n }, {\n key: \"state\",\n get: function get() {\n return {\n masked: this.masked.state,\n _isFilled: this._isFilled\n };\n },\n set: function set(state) {\n this.masked.state = state.masked;\n this._isFilled = state._isFilled;\n }\n }]);\n\n return PatternInputDefinition;\n}();\n\nvar PatternFixedDefinition = /*#__PURE__*/function () {\n /** */\n\n /** */\n\n /** */\n\n /** */\n function PatternFixedDefinition(opts) {\n _classCallCheck(this, PatternFixedDefinition);\n\n Object.assign(this, opts);\n this._value = '';\n }\n\n _createClass(PatternFixedDefinition, [{\n key: \"reset\",\n value: function reset() {\n this._isRawInput = false;\n this._value = '';\n }\n }, {\n key: \"remove\",\n value: function remove() {\n var fromPos = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var toPos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this._value.length;\n this._value = this._value.slice(0, fromPos) + this._value.slice(toPos);\n if (!this._value) this._isRawInput = false;\n return new ChangeDetails();\n }\n }, {\n key: \"nearestInputPos\",\n value: function nearestInputPos(cursorPos) {\n var direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DIRECTION.NONE;\n var minPos = 0;\n var maxPos = this._value.length;\n\n switch (direction) {\n case DIRECTION.LEFT:\n case DIRECTION.FORCE_LEFT:\n return minPos;\n\n case DIRECTION.NONE:\n case DIRECTION.RIGHT:\n case DIRECTION.FORCE_RIGHT:\n default:\n return maxPos;\n }\n }\n }, {\n key: \"extractInput\",\n value: function extractInput() {\n var fromPos = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var toPos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this._value.length;\n var flags = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n return flags.raw && this._isRawInput && this._value.slice(fromPos, toPos) || '';\n }\n }, {\n key: \"_appendChar\",\n value: function _appendChar(str) {\n var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var details = new ChangeDetails();\n if (this._value) return details;\n var appended = this[\"char\"] === str[0];\n var isResolved = appended && (this.isUnmasking || flags.input || flags.raw) && !flags.tail;\n if (isResolved) details.rawInserted = this[\"char\"];\n this._value = details.inserted = this[\"char\"];\n this._isRawInput = isResolved && (flags.raw || flags.input);\n return details;\n }\n }, {\n key: \"_appendPlaceholder\",\n value: function _appendPlaceholder() {\n var details = new ChangeDetails();\n if (this._value) return details;\n this._value = details.inserted = this[\"char\"];\n return details;\n }\n }, {\n key: \"extractTail\",\n value: function extractTail() {\n var toPos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.value.length;\n return new ContinuousTailDetails('');\n } // $FlowFixMe no ideas\n\n }, {\n key: \"appendTail\",\n value: function appendTail(tail) {\n if (isString(tail)) tail = new ContinuousTailDetails(String(tail));\n return tail.appendTo(this);\n }\n }, {\n key: \"append\",\n value: function append(str, flags, tail) {\n var details = this._appendChar(str, flags);\n\n if (tail != null) {\n details.tailShift += this.appendTail(tail).tailShift;\n }\n\n return details;\n }\n }, {\n key: \"doCommit\",\n value: function doCommit() {}\n }, {\n key: \"value\",\n get: function get() {\n return this._value;\n }\n }, {\n key: \"unmaskedValue\",\n get: function get() {\n return this.isUnmasking ? this.value : '';\n }\n }, {\n key: \"isComplete\",\n get: function get() {\n return true;\n }\n }, {\n key: \"state\",\n get: function get() {\n return {\n _value: this._value,\n _isRawInput: this._isRawInput\n };\n },\n set: function set(state) {\n Object.assign(this, state);\n }\n }]);\n\n return PatternFixedDefinition;\n}();\n\nvar ChunksTailDetails = /*#__PURE__*/function () {\n /** */\n function ChunksTailDetails() {\n var chunks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var from = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n\n _classCallCheck(this, ChunksTailDetails);\n\n this.chunks = chunks;\n this.from = from;\n }\n\n _createClass(ChunksTailDetails, [{\n key: \"toString\",\n value: function toString() {\n return this.chunks.map(String).join('');\n } // $FlowFixMe no ideas\n\n }, {\n key: \"extend\",\n value: function extend(tailChunk) {\n if (!String(tailChunk)) return;\n if (isString(tailChunk)) tailChunk = new ContinuousTailDetails(String(tailChunk));\n var lastChunk = this.chunks[this.chunks.length - 1];\n var extendLast = lastChunk && ( // if stops are same or tail has no stop\n lastChunk.stop === tailChunk.stop || tailChunk.stop == null) && // if tail chunk goes just after last chunk\n tailChunk.from === lastChunk.from + lastChunk.toString().length;\n\n if (tailChunk instanceof ContinuousTailDetails) {\n // check the ability to extend previous chunk\n if (extendLast) {\n // extend previous chunk\n lastChunk.extend(tailChunk.toString());\n } else {\n // append new chunk\n this.chunks.push(tailChunk);\n }\n } else if (tailChunk instanceof ChunksTailDetails) {\n if (tailChunk.stop == null) {\n // unwrap floating chunks to parent, keeping `from` pos\n var firstTailChunk;\n\n while (tailChunk.chunks.length && tailChunk.chunks[0].stop == null) {\n firstTailChunk = tailChunk.chunks.shift();\n firstTailChunk.from += tailChunk.from;\n this.extend(firstTailChunk);\n }\n } // if tail chunk still has value\n\n\n if (tailChunk.toString()) {\n // if chunks contains stops, then popup stop to container\n tailChunk.stop = tailChunk.blockIndex;\n this.chunks.push(tailChunk);\n }\n }\n }\n }, {\n key: \"appendTo\",\n value: function appendTo(masked) {\n if (!(masked instanceof g.IMask.MaskedPattern)) {\n var tail = new ContinuousTailDetails(this.toString());\n return tail.appendTo(masked);\n }\n\n var details = new ChangeDetails();\n\n for (var ci = 0; ci < this.chunks.length && !details.skip; ++ci) {\n var chunk = this.chunks[ci];\n\n var lastBlockIter = masked._mapPosToBlock(masked.value.length);\n\n var stop = chunk.stop;\n var chunkBlock = void 0;\n\n if (stop && ( // if block not found or stop is behind lastBlock\n !lastBlockIter || lastBlockIter.index <= stop)) {\n if (chunk instanceof ChunksTailDetails || // for continuous block also check if stop is exist\n masked._stops.indexOf(stop) >= 0) {\n details.aggregate(masked._appendPlaceholder(stop));\n }\n\n chunkBlock = chunk instanceof ChunksTailDetails && masked._blocks[stop];\n }\n\n if (chunkBlock) {\n var tailDetails = chunkBlock.appendTail(chunk);\n tailDetails.skip = false; // always ignore skip, it will be set on last\n\n details.aggregate(tailDetails);\n masked._value += tailDetails.inserted; // get not inserted chars\n\n var remainChars = chunk.toString().slice(tailDetails.rawInserted.length);\n if (remainChars) details.aggregate(masked.append(remainChars, {\n tail: true\n }));\n } else {\n details.aggregate(masked.append(chunk.toString(), {\n tail: true\n }));\n }\n }\n\n return details;\n }\n }, {\n key: \"shiftBefore\",\n value: function shiftBefore(pos) {\n if (this.from >= pos || !this.chunks.length) return '';\n var chunkShiftPos = pos - this.from;\n var ci = 0;\n\n while (ci < this.chunks.length) {\n var chunk = this.chunks[ci];\n var shiftChar = chunk.shiftBefore(chunkShiftPos);\n\n if (chunk.toString()) {\n // chunk still contains value\n // but not shifted - means no more available chars to shift\n if (!shiftChar) break;\n ++ci;\n } else {\n // clean if chunk has no value\n this.chunks.splice(ci, 1);\n }\n\n if (shiftChar) return shiftChar;\n }\n\n return '';\n }\n }, {\n key: \"state\",\n get: function get() {\n return {\n chunks: this.chunks.map(function (c) {\n return c.state;\n }),\n from: this.from,\n stop: this.stop,\n blockIndex: this.blockIndex\n };\n },\n set: function set(state) {\n var chunks = state.chunks,\n props = _objectWithoutProperties(state, [\"chunks\"]);\n\n Object.assign(this, props);\n this.chunks = chunks.map(function (cstate) {\n var chunk = \"chunks\" in cstate ? new ChunksTailDetails() : new ContinuousTailDetails(); // $FlowFixMe already checked above\n\n chunk.state = cstate;\n return chunk;\n });\n }\n }]);\n\n return ChunksTailDetails;\n}();\n/**\r\n Pattern mask\r\n @param {Object} opts\r\n @param {Object} opts.blocks\r\n @param {Object} opts.definitions\r\n @param {string} opts.placeholderChar\r\n @param {boolean} opts.lazy\r\n*/\n\n\nvar MaskedPattern = /*#__PURE__*/function (_Masked) {\n _inherits(MaskedPattern, _Masked);\n /** */\n\n /** */\n\n /** Single char for empty input */\n\n /** Show placeholder only when needed */\n\n\n function MaskedPattern() {\n var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n _classCallCheck(this, MaskedPattern); // TODO type $Shape={} does not work\n\n\n opts.definitions = Object.assign({}, DEFAULT_INPUT_DEFINITIONS, opts.definitions);\n return _possibleConstructorReturn(this, _getPrototypeOf(MaskedPattern).call(this, Object.assign({}, MaskedPattern.DEFAULTS, {}, opts)));\n }\n /**\r\n @override\r\n @param {Object} opts\r\n */\n\n\n _createClass(MaskedPattern, [{\n key: \"_update\",\n value: function _update() {\n var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n opts.definitions = Object.assign({}, this.definitions, opts.definitions);\n\n _get(_getPrototypeOf(MaskedPattern.prototype), \"_update\", this).call(this, opts);\n\n this._rebuildMask();\n }\n /** */\n\n }, {\n key: \"_rebuildMask\",\n value: function _rebuildMask() {\n var _this = this;\n\n var defs = this.definitions;\n this._blocks = [];\n this._stops = [];\n this._maskedBlocks = {};\n var pattern = this.mask;\n if (!pattern || !defs) return;\n var unmaskingBlock = false;\n var optionalBlock = false;\n\n for (var i = 0; i < pattern.length; ++i) {\n if (this.blocks) {\n var _ret = function () {\n var p = pattern.slice(i);\n var bNames = Object.keys(_this.blocks).filter(function (bName) {\n return p.indexOf(bName) === 0;\n }); // order by key length\n\n bNames.sort(function (a, b) {\n return b.length - a.length;\n }); // use block name with max length\n\n var bName = bNames[0];\n\n if (bName) {\n var maskedBlock = createMask(Object.assign({\n parent: _this,\n lazy: _this.lazy,\n placeholderChar: _this.placeholderChar,\n overwrite: _this.overwrite\n }, _this.blocks[bName]));\n\n if (maskedBlock) {\n _this._blocks.push(maskedBlock); // store block index\n\n\n if (!_this._maskedBlocks[bName]) _this._maskedBlocks[bName] = [];\n\n _this._maskedBlocks[bName].push(_this._blocks.length - 1);\n }\n\n i += bName.length - 1;\n return \"continue\";\n }\n }();\n\n if (_ret === \"continue\") continue;\n }\n\n var _char = pattern[i];\n\n var _isInput = (_char in defs);\n\n if (_char === MaskedPattern.STOP_CHAR) {\n this._stops.push(this._blocks.length);\n\n continue;\n }\n\n if (_char === '{' || _char === '}') {\n unmaskingBlock = !unmaskingBlock;\n continue;\n }\n\n if (_char === '[' || _char === ']') {\n optionalBlock = !optionalBlock;\n continue;\n }\n\n if (_char === MaskedPattern.ESCAPE_CHAR) {\n ++i;\n _char = pattern[i];\n if (!_char) break;\n _isInput = false;\n }\n\n var def = _isInput ? new PatternInputDefinition({\n parent: this,\n lazy: this.lazy,\n placeholderChar: this.placeholderChar,\n mask: defs[_char],\n isOptional: optionalBlock\n }) : new PatternFixedDefinition({\n \"char\": _char,\n isUnmasking: unmaskingBlock\n });\n\n this._blocks.push(def);\n }\n }\n /**\r\n @override\r\n */\n\n }, {\n key: \"reset\",\n\n /**\r\n @override\r\n */\n value: function reset() {\n _get(_getPrototypeOf(MaskedPattern.prototype), \"reset\", this).call(this);\n\n this._blocks.forEach(function (b) {\n return b.reset();\n });\n }\n /**\r\n @override\r\n */\n\n }, {\n key: \"doCommit\",\n\n /**\r\n @override\r\n */\n value: function doCommit() {\n this._blocks.forEach(function (b) {\n return b.doCommit();\n });\n\n _get(_getPrototypeOf(MaskedPattern.prototype), \"doCommit\", this).call(this);\n }\n /**\r\n @override\r\n */\n\n }, {\n key: \"appendTail\",\n\n /**\r\n @override\r\n */\n value: function appendTail(tail) {\n return _get(_getPrototypeOf(MaskedPattern.prototype), \"appendTail\", this).call(this, tail).aggregate(this._appendPlaceholder());\n }\n /**\r\n @override\r\n */\n\n }, {\n key: \"_appendCharRaw\",\n value: function _appendCharRaw(ch) {\n var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n ch = this.doPrepare(ch, flags);\n\n var blockIter = this._mapPosToBlock(this.value.length);\n\n var details = new ChangeDetails();\n if (!blockIter) return details;\n\n for (var bi = blockIter.index;; ++bi) {\n var _block = this._blocks[bi];\n if (!_block) break;\n\n var blockDetails = _block._appendChar(ch, flags);\n\n var skip = blockDetails.skip;\n details.aggregate(blockDetails);\n if (skip || blockDetails.rawInserted) break; // go next char\n }\n\n return details;\n }\n /**\r\n @override\r\n */\n\n }, {\n key: \"extractTail\",\n value: function extractTail() {\n var _this2 = this;\n\n var fromPos = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var toPos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.value.length;\n var chunkTail = new ChunksTailDetails();\n if (fromPos === toPos) return chunkTail;\n\n this._forEachBlocksInRange(fromPos, toPos, function (b, bi, bFromPos, bToPos) {\n var blockChunk = b.extractTail(bFromPos, bToPos);\n blockChunk.stop = _this2._findStopBefore(bi);\n blockChunk.from = _this2._blockStartPos(bi);\n if (blockChunk instanceof ChunksTailDetails) blockChunk.blockIndex = bi;\n chunkTail.extend(blockChunk);\n });\n\n return chunkTail;\n }\n /**\r\n @override\r\n */\n\n }, {\n key: \"extractInput\",\n value: function extractInput() {\n var fromPos = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var toPos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.value.length;\n var flags = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n if (fromPos === toPos) return '';\n var input = '';\n\n this._forEachBlocksInRange(fromPos, toPos, function (b, _, fromPos, toPos) {\n input += b.extractInput(fromPos, toPos, flags);\n });\n\n return input;\n }\n }, {\n key: \"_findStopBefore\",\n value: function _findStopBefore(blockIndex) {\n var stopBefore;\n\n for (var si = 0; si < this._stops.length; ++si) {\n var stop = this._stops[si];\n if (stop <= blockIndex) stopBefore = stop;else break;\n }\n\n return stopBefore;\n }\n /** Appends placeholder depending on laziness */\n\n }, {\n key: \"_appendPlaceholder\",\n value: function _appendPlaceholder(toBlockIndex) {\n var _this3 = this;\n\n var details = new ChangeDetails();\n if (this.lazy && toBlockIndex == null) return details;\n\n var startBlockIter = this._mapPosToBlock(this.value.length);\n\n if (!startBlockIter) return details;\n var startBlockIndex = startBlockIter.index;\n var endBlockIndex = toBlockIndex != null ? toBlockIndex : this._blocks.length;\n\n this._blocks.slice(startBlockIndex, endBlockIndex).forEach(function (b) {\n if (!b.lazy || toBlockIndex != null) {\n // $FlowFixMe `_blocks` may not be present\n var args = b._blocks != null ? [b._blocks.length] : [];\n\n var bDetails = b._appendPlaceholder.apply(b, args);\n\n _this3._value += bDetails.inserted;\n details.aggregate(bDetails);\n }\n });\n\n return details;\n }\n /** Finds block in pos */\n\n }, {\n key: \"_mapPosToBlock\",\n value: function _mapPosToBlock(pos) {\n var accVal = '';\n\n for (var bi = 0; bi < this._blocks.length; ++bi) {\n var _block2 = this._blocks[bi];\n var blockStartPos = accVal.length;\n accVal += _block2.value;\n\n if (pos <= accVal.length) {\n return {\n index: bi,\n offset: pos - blockStartPos\n };\n }\n }\n }\n /** */\n\n }, {\n key: \"_blockStartPos\",\n value: function _blockStartPos(blockIndex) {\n return this._blocks.slice(0, blockIndex).reduce(function (pos, b) {\n return pos += b.value.length;\n }, 0);\n }\n /** */\n\n }, {\n key: \"_forEachBlocksInRange\",\n value: function _forEachBlocksInRange(fromPos) {\n var toPos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.value.length;\n var fn = arguments.length > 2 ? arguments[2] : undefined;\n\n var fromBlockIter = this._mapPosToBlock(fromPos);\n\n if (fromBlockIter) {\n var toBlockIter = this._mapPosToBlock(toPos); // process first block\n\n\n var isSameBlock = toBlockIter && fromBlockIter.index === toBlockIter.index;\n var fromBlockStartPos = fromBlockIter.offset;\n var fromBlockEndPos = toBlockIter && isSameBlock ? toBlockIter.offset : this._blocks[fromBlockIter.index].value.length;\n fn(this._blocks[fromBlockIter.index], fromBlockIter.index, fromBlockStartPos, fromBlockEndPos);\n\n if (toBlockIter && !isSameBlock) {\n // process intermediate blocks\n for (var bi = fromBlockIter.index + 1; bi < toBlockIter.index; ++bi) {\n fn(this._blocks[bi], bi, 0, this._blocks[bi].value.length);\n } // process last block\n\n\n fn(this._blocks[toBlockIter.index], toBlockIter.index, 0, toBlockIter.offset);\n }\n }\n }\n /**\r\n @override\r\n */\n\n }, {\n key: \"remove\",\n value: function remove() {\n var fromPos = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var toPos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.value.length;\n\n var removeDetails = _get(_getPrototypeOf(MaskedPattern.prototype), \"remove\", this).call(this, fromPos, toPos);\n\n this._forEachBlocksInRange(fromPos, toPos, function (b, _, bFromPos, bToPos) {\n removeDetails.aggregate(b.remove(bFromPos, bToPos));\n });\n\n return removeDetails;\n }\n /**\r\n @override\r\n */\n\n }, {\n key: \"nearestInputPos\",\n value: function nearestInputPos(cursorPos) {\n var direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DIRECTION.NONE; // TODO refactor - extract alignblock\n\n var beginBlockData = this._mapPosToBlock(cursorPos) || {\n index: 0,\n offset: 0\n };\n var beginBlockOffset = beginBlockData.offset,\n beginBlockIndex = beginBlockData.index;\n var beginBlock = this._blocks[beginBlockIndex];\n if (!beginBlock) return cursorPos;\n var beginBlockCursorPos = beginBlockOffset; // if position inside block - try to adjust it\n\n if (beginBlockCursorPos !== 0 && beginBlockCursorPos < beginBlock.value.length) {\n beginBlockCursorPos = beginBlock.nearestInputPos(beginBlockOffset, forceDirection(direction));\n }\n\n var cursorAtRight = beginBlockCursorPos === beginBlock.value.length;\n var cursorAtLeft = beginBlockCursorPos === 0; // cursor is INSIDE first block (not at bounds)\n\n if (!cursorAtLeft && !cursorAtRight) return this._blockStartPos(beginBlockIndex) + beginBlockCursorPos;\n var searchBlockIndex = cursorAtRight ? beginBlockIndex + 1 : beginBlockIndex;\n\n if (direction === DIRECTION.NONE) {\n // NONE direction used to calculate start input position if no chars were removed\n // FOR NONE:\n // -\n // input|any\n // ->\n // any|input\n // <-\n // filled-input|any\n // check if first block at left is input\n if (searchBlockIndex > 0) {\n var blockIndexAtLeft = searchBlockIndex - 1;\n var blockAtLeft = this._blocks[blockIndexAtLeft];\n var blockInputPos = blockAtLeft.nearestInputPos(0, DIRECTION.NONE); // is input\n\n if (!blockAtLeft.value.length || blockInputPos !== blockAtLeft.value.length) {\n return this._blockStartPos(searchBlockIndex);\n }\n } // ->\n\n\n var firstInputAtRight = searchBlockIndex;\n\n for (var bi = firstInputAtRight; bi < this._blocks.length; ++bi) {\n var blockAtRight = this._blocks[bi];\n\n var _blockInputPos = blockAtRight.nearestInputPos(0, DIRECTION.NONE);\n\n if (!blockAtRight.value.length || _blockInputPos !== blockAtRight.value.length) {\n return this._blockStartPos(bi) + _blockInputPos;\n }\n } // <-\n // find first non-fixed symbol\n\n\n for (var _bi = searchBlockIndex - 1; _bi >= 0; --_bi) {\n var _block3 = this._blocks[_bi];\n\n var _blockInputPos2 = _block3.nearestInputPos(0, DIRECTION.NONE); // is input\n\n\n if (!_block3.value.length || _blockInputPos2 !== _block3.value.length) {\n return this._blockStartPos(_bi) + _block3.value.length;\n }\n }\n\n return cursorPos;\n }\n\n if (direction === DIRECTION.LEFT || direction === DIRECTION.FORCE_LEFT) {\n // -\n // any|filled-input\n // <-\n // any|first not empty is not-len-aligned\n // not-0-aligned|any\n // ->\n // any|not-len-aligned or end\n // check if first block at right is filled input\n var firstFilledBlockIndexAtRight;\n\n for (var _bi2 = searchBlockIndex; _bi2 < this._blocks.length; ++_bi2) {\n if (this._blocks[_bi2].value) {\n firstFilledBlockIndexAtRight = _bi2;\n break;\n }\n }\n\n if (firstFilledBlockIndexAtRight != null) {\n var filledBlock = this._blocks[firstFilledBlockIndexAtRight];\n\n var _blockInputPos3 = filledBlock.nearestInputPos(0, DIRECTION.RIGHT);\n\n if (_blockInputPos3 === 0 && filledBlock.unmaskedValue.length) {\n // filled block is input\n return this._blockStartPos(firstFilledBlockIndexAtRight) + _blockInputPos3;\n }\n } // <-\n // find this vars\n\n\n var firstFilledInputBlockIndex = -1;\n var firstEmptyInputBlockIndex; // TODO consider nested empty inputs\n\n for (var _bi3 = searchBlockIndex - 1; _bi3 >= 0; --_bi3) {\n var _block4 = this._blocks[_bi3];\n\n var _blockInputPos4 = _block4.nearestInputPos(_block4.value.length, DIRECTION.FORCE_LEFT);\n\n if (!_block4.value || _blockInputPos4 !== 0) firstEmptyInputBlockIndex = _bi3;\n\n if (_blockInputPos4 !== 0) {\n if (_blockInputPos4 !== _block4.value.length) {\n // aligned inside block - return immediately\n return this._blockStartPos(_bi3) + _blockInputPos4;\n } else {\n // found filled\n firstFilledInputBlockIndex = _bi3;\n break;\n }\n }\n }\n\n if (direction === DIRECTION.LEFT) {\n // try find first empty input before start searching position only when not forced\n for (var _bi4 = firstFilledInputBlockIndex + 1; _bi4 <= Math.min(searchBlockIndex, this._blocks.length - 1); ++_bi4) {\n var _block5 = this._blocks[_bi4];\n\n var _blockInputPos5 = _block5.nearestInputPos(0, DIRECTION.NONE);\n\n var blockAlignedPos = this._blockStartPos(_bi4) + _blockInputPos5;\n\n if (blockAlignedPos > cursorPos) break; // if block is not lazy input\n\n if (_blockInputPos5 !== _block5.value.length) return blockAlignedPos;\n }\n } // process overflow\n\n\n if (firstFilledInputBlockIndex >= 0) {\n return this._blockStartPos(firstFilledInputBlockIndex) + this._blocks[firstFilledInputBlockIndex].value.length;\n } // for lazy if has aligned left inside fixed and has came to the start - use start position\n\n\n if (direction === DIRECTION.FORCE_LEFT || this.lazy && !this.extractInput() && !isInput(this._blocks[searchBlockIndex])) {\n return 0;\n }\n\n if (firstEmptyInputBlockIndex != null) {\n return this._blockStartPos(firstEmptyInputBlockIndex);\n } // find first input\n\n\n for (var _bi5 = searchBlockIndex; _bi5 < this._blocks.length; ++_bi5) {\n var _block6 = this._blocks[_bi5];\n\n var _blockInputPos6 = _block6.nearestInputPos(0, DIRECTION.NONE); // is input\n\n\n if (!_block6.value.length || _blockInputPos6 !== _block6.value.length) {\n return this._blockStartPos(_bi5) + _blockInputPos6;\n }\n }\n\n return 0;\n }\n\n if (direction === DIRECTION.RIGHT || direction === DIRECTION.FORCE_RIGHT) {\n // ->\n // any|not-len-aligned and filled\n // any|not-len-aligned\n // <-\n // not-0-aligned or start|any\n var firstInputBlockAlignedIndex;\n var firstInputBlockAlignedPos;\n\n for (var _bi6 = searchBlockIndex; _bi6 < this._blocks.length; ++_bi6) {\n var _block7 = this._blocks[_bi6];\n\n var _blockInputPos7 = _block7.nearestInputPos(0, DIRECTION.NONE);\n\n if (_blockInputPos7 !== _block7.value.length) {\n firstInputBlockAlignedPos = this._blockStartPos(_bi6) + _blockInputPos7;\n firstInputBlockAlignedIndex = _bi6;\n break;\n }\n }\n\n if (firstInputBlockAlignedIndex != null && firstInputBlockAlignedPos != null) {\n for (var _bi7 = firstInputBlockAlignedIndex; _bi7 < this._blocks.length; ++_bi7) {\n var _block8 = this._blocks[_bi7];\n\n var _blockInputPos8 = _block8.nearestInputPos(0, DIRECTION.FORCE_RIGHT);\n\n if (_blockInputPos8 !== _block8.value.length) {\n return this._blockStartPos(_bi7) + _blockInputPos8;\n }\n }\n\n return direction === DIRECTION.FORCE_RIGHT ? this.value.length : firstInputBlockAlignedPos;\n }\n\n for (var _bi8 = Math.min(searchBlockIndex, this._blocks.length - 1); _bi8 >= 0; --_bi8) {\n var _block9 = this._blocks[_bi8];\n\n var _blockInputPos9 = _block9.nearestInputPos(_block9.value.length, DIRECTION.LEFT);\n\n if (_blockInputPos9 !== 0) {\n var alignedPos = this._blockStartPos(_bi8) + _blockInputPos9;\n\n if (alignedPos >= cursorPos) return alignedPos;\n break;\n }\n }\n }\n\n return cursorPos;\n }\n /** Get block by name */\n\n }, {\n key: \"maskedBlock\",\n value: function maskedBlock(name) {\n return this.maskedBlocks(name)[0];\n }\n /** Get all blocks by name */\n\n }, {\n key: \"maskedBlocks\",\n value: function maskedBlocks(name) {\n var _this4 = this;\n\n var indices = this._maskedBlocks[name];\n if (!indices) return [];\n return indices.map(function (gi) {\n return _this4._blocks[gi];\n });\n }\n }, {\n key: \"state\",\n get: function get() {\n return Object.assign({}, _get(_getPrototypeOf(MaskedPattern.prototype), \"state\", this), {\n _blocks: this._blocks.map(function (b) {\n return b.state;\n })\n });\n },\n set: function set(state) {\n var _blocks = state._blocks,\n maskedState = _objectWithoutProperties(state, [\"_blocks\"]);\n\n this._blocks.forEach(function (b, bi) {\n return b.state = _blocks[bi];\n });\n\n _set(_getPrototypeOf(MaskedPattern.prototype), \"state\", maskedState, this, true);\n }\n }, {\n key: \"isComplete\",\n get: function get() {\n return this._blocks.every(function (b) {\n return b.isComplete;\n });\n }\n }, {\n key: \"unmaskedValue\",\n get: function get() {\n return this._blocks.reduce(function (str, b) {\n return str += b.unmaskedValue;\n }, '');\n },\n set: function set(unmaskedValue) {\n _set(_getPrototypeOf(MaskedPattern.prototype), \"unmaskedValue\", unmaskedValue, this, true);\n }\n /**\r\n @override\r\n */\n\n }, {\n key: \"value\",\n get: function get() {\n // TODO return _value when not in change?\n return this._blocks.reduce(function (str, b) {\n return str += b.value;\n }, '');\n },\n set: function set(value) {\n _set(_getPrototypeOf(MaskedPattern.prototype), \"value\", value, this, true);\n }\n }]);\n\n return MaskedPattern;\n}(Masked);\n\nMaskedPattern.DEFAULTS = {\n lazy: true,\n placeholderChar: '_'\n};\nMaskedPattern.STOP_CHAR = '`';\nMaskedPattern.ESCAPE_CHAR = '\\\\';\nMaskedPattern.InputDefinition = PatternInputDefinition;\nMaskedPattern.FixedDefinition = PatternFixedDefinition;\n\nfunction isInput(block) {\n if (!block) return false;\n var value = block.value;\n return !value || block.nearestInputPos(0, DIRECTION.NONE) !== value.length;\n}\n/** Pattern which accepts ranges */\n\n\nvar MaskedRange = /*#__PURE__*/function (_MaskedPattern) {\n _inherits(MaskedRange, _MaskedPattern);\n\n function MaskedRange() {\n _classCallCheck(this, MaskedRange);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(MaskedRange).apply(this, arguments));\n }\n\n _createClass(MaskedRange, [{\n key: \"_update\",\n\n /**\r\n @override\r\n */\n value: function _update(opts) {\n // TODO type\n opts = Object.assign({\n to: this.to || 0,\n from: this.from || 0\n }, opts);\n var maxLength = String(opts.to).length;\n if (opts.maxLength != null) maxLength = Math.max(maxLength, opts.maxLength);\n opts.maxLength = maxLength;\n var fromStr = String(opts.from).padStart(maxLength, '0');\n var toStr = String(opts.to).padStart(maxLength, '0');\n var sameCharsCount = 0;\n\n while (sameCharsCount < toStr.length && toStr[sameCharsCount] === fromStr[sameCharsCount]) {\n ++sameCharsCount;\n }\n\n opts.mask = toStr.slice(0, sameCharsCount).replace(/0/g, '\\\\0') + '0'.repeat(maxLength - sameCharsCount);\n\n _get(_getPrototypeOf(MaskedRange.prototype), \"_update\", this).call(this, opts);\n }\n /**\r\n @override\r\n */\n\n }, {\n key: \"boundaries\",\n value: function boundaries(str) {\n var minstr = '';\n var maxstr = '';\n\n var _ref = str.match(/^(\\D*)(\\d*)(\\D*)/) || [],\n _ref2 = _slicedToArray(_ref, 3),\n placeholder = _ref2[1],\n num = _ref2[2];\n\n if (num) {\n minstr = '0'.repeat(placeholder.length) + num;\n maxstr = '9'.repeat(placeholder.length) + num;\n }\n\n minstr = minstr.padEnd(this.maxLength, '0');\n maxstr = maxstr.padEnd(this.maxLength, '9');\n return [minstr, maxstr];\n }\n /**\r\n @override\r\n */\n\n }, {\n key: \"doPrepare\",\n value: function doPrepare(str) {\n var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n str = _get(_getPrototypeOf(MaskedRange.prototype), \"doPrepare\", this).call(this, str, flags).replace(/\\D/g, '');\n if (!this.autofix) return str;\n var fromStr = String(this.from).padStart(this.maxLength, '0');\n var toStr = String(this.to).padStart(this.maxLength, '0');\n var val = this.value;\n var prepStr = '';\n\n for (var ci = 0; ci < str.length; ++ci) {\n var nextVal = val + prepStr + str[ci];\n\n var _this$boundaries = this.boundaries(nextVal),\n _this$boundaries2 = _slicedToArray(_this$boundaries, 2),\n minstr = _this$boundaries2[0],\n maxstr = _this$boundaries2[1];\n\n if (Number(maxstr) < this.from) prepStr += fromStr[nextVal.length - 1];else if (Number(minstr) > this.to) prepStr += toStr[nextVal.length - 1];else prepStr += str[ci];\n }\n\n return prepStr;\n }\n /**\r\n @override\r\n */\n\n }, {\n key: \"doValidate\",\n value: function doValidate() {\n var _get2;\n\n var str = this.value;\n var firstNonZero = str.search(/[^0]/);\n if (firstNonZero === -1 && str.length <= this._matchFrom) return true;\n\n var _this$boundaries3 = this.boundaries(str),\n _this$boundaries4 = _slicedToArray(_this$boundaries3, 2),\n minstr = _this$boundaries4[0],\n maxstr = _this$boundaries4[1];\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return this.from <= Number(maxstr) && Number(minstr) <= this.to && (_get2 = _get(_getPrototypeOf(MaskedRange.prototype), \"doValidate\", this)).call.apply(_get2, [this].concat(args));\n }\n }, {\n key: \"_matchFrom\",\n\n /**\r\n Optionally sets max length of pattern.\r\n Used when pattern length is longer then `to` param length. Pads zeros at start in this case.\r\n */\n\n /** Min bound */\n\n /** Max bound */\n\n /** */\n get: function get() {\n return this.maxLength - String(this.from).length;\n }\n }, {\n key: \"isComplete\",\n get: function get() {\n return _get(_getPrototypeOf(MaskedRange.prototype), \"isComplete\", this) && Boolean(this.value);\n }\n }]);\n\n return MaskedRange;\n}(MaskedPattern);\n/** Date mask */\n\n\nvar MaskedDate = /*#__PURE__*/function (_MaskedPattern) {\n _inherits(MaskedDate, _MaskedPattern);\n /** Parse string to Date */\n\n /** Format Date to string */\n\n /** Pattern mask for date according to {@link MaskedDate#format} */\n\n /** Start date */\n\n /** End date */\n\n /** */\n\n /**\r\n @param {Object} opts\r\n */\n\n\n function MaskedDate(opts) {\n _classCallCheck(this, MaskedDate);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(MaskedDate).call(this, Object.assign({}, MaskedDate.DEFAULTS, {}, opts)));\n }\n /**\r\n @override\r\n */\n\n\n _createClass(MaskedDate, [{\n key: \"_update\",\n value: function _update(opts) {\n if (opts.mask === Date) delete opts.mask;\n if (opts.pattern) opts.mask = opts.pattern;\n var blocks = opts.blocks;\n opts.blocks = Object.assign({}, MaskedDate.GET_DEFAULT_BLOCKS()); // adjust year block\n\n if (opts.min) opts.blocks.Y.from = opts.min.getFullYear();\n if (opts.max) opts.blocks.Y.to = opts.max.getFullYear();\n\n if (opts.min && opts.max && opts.blocks.Y.from === opts.blocks.Y.to) {\n opts.blocks.m.from = opts.min.getMonth() + 1;\n opts.blocks.m.to = opts.max.getMonth() + 1;\n\n if (opts.blocks.m.from === opts.blocks.m.to) {\n opts.blocks.d.from = opts.min.getDate();\n opts.blocks.d.to = opts.max.getDate();\n }\n }\n\n Object.assign(opts.blocks, blocks); // add autofix\n\n Object.keys(opts.blocks).forEach(function (bk) {\n var b = opts.blocks[bk];\n if (!('autofix' in b)) b.autofix = opts.autofix;\n });\n\n _get(_getPrototypeOf(MaskedDate.prototype), \"_update\", this).call(this, opts);\n }\n /**\r\n @override\r\n */\n\n }, {\n key: \"doValidate\",\n value: function doValidate() {\n var _get2;\n\n var date = this.date;\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return (_get2 = _get(_getPrototypeOf(MaskedDate.prototype), \"doValidate\", this)).call.apply(_get2, [this].concat(args)) && (!this.isComplete || this.isDateExist(this.value) && date != null && (this.min == null || this.min <= date) && (this.max == null || date <= this.max));\n }\n /** Checks if date is exists */\n\n }, {\n key: \"isDateExist\",\n value: function isDateExist(str) {\n return this.format(this.parse(str)) === str;\n }\n /** Parsed Date */\n\n }, {\n key: \"date\",\n get: function get() {\n return this.isComplete ? this.parse(this.value) : null;\n },\n set: function set(date) {\n this.value = this.format(date);\n }\n /**\r\n @override\r\n */\n\n }, {\n key: \"typedValue\",\n get: function get() {\n return this.date;\n },\n set: function set(value) {\n this.date = value;\n }\n }]);\n\n return MaskedDate;\n}(MaskedPattern);\n\nMaskedDate.DEFAULTS = {\n pattern: 'd{.}`m{.}`Y',\n format: function format(date) {\n var day = String(date.getDate()).padStart(2, '0');\n var month = String(date.getMonth() + 1).padStart(2, '0');\n var year = date.getFullYear();\n return [day, month, year].join('.');\n },\n parse: function parse(str) {\n var _str$split = str.split('.'),\n _str$split2 = _slicedToArray(_str$split, 3),\n day = _str$split2[0],\n month = _str$split2[1],\n year = _str$split2[2];\n\n return new Date(year, month - 1, day);\n }\n};\n\nMaskedDate.GET_DEFAULT_BLOCKS = function () {\n return {\n d: {\n mask: MaskedRange,\n from: 1,\n to: 31,\n maxLength: 2\n },\n m: {\n mask: MaskedRange,\n from: 1,\n to: 12,\n maxLength: 2\n },\n Y: {\n mask: MaskedRange,\n from: 1900,\n to: 9999\n }\n };\n};\n/**\r\n Generic element API to use with mask\r\n @interface\r\n*/\n\n\nvar MaskElement = /*#__PURE__*/function () {\n function MaskElement() {\n _classCallCheck(this, MaskElement);\n }\n\n _createClass(MaskElement, [{\n key: \"select\",\n\n /** Safely sets element selection */\n value: function select(start, end) {\n if (start == null || end == null || start === this.selectionStart && end === this.selectionEnd) return;\n\n try {\n this._unsafeSelect(start, end);\n } catch (e) {}\n }\n /** Should be overriden in subclasses */\n\n }, {\n key: \"_unsafeSelect\",\n value: function _unsafeSelect(start, end) {}\n /** Should be overriden in subclasses */\n\n }, {\n key: \"bindEvents\",\n\n /** Should be overriden in subclasses */\n value: function bindEvents(handlers) {}\n /** Should be overriden in subclasses */\n\n }, {\n key: \"unbindEvents\",\n value: function unbindEvents() {}\n }, {\n key: \"selectionStart\",\n\n /** */\n\n /** */\n\n /** */\n\n /** Safely returns selection start */\n get: function get() {\n var start;\n\n try {\n start = this._unsafeSelectionStart;\n } catch (e) {}\n\n return start != null ? start : this.value.length;\n }\n /** Safely returns selection end */\n\n }, {\n key: \"selectionEnd\",\n get: function get() {\n var end;\n\n try {\n end = this._unsafeSelectionEnd;\n } catch (e) {}\n\n return end != null ? end : this.value.length;\n }\n }, {\n key: \"isActive\",\n get: function get() {\n return false;\n }\n }]);\n\n return MaskElement;\n}();\n/** Bridge between HTMLElement and {@link Masked} */\n\n\nvar HTMLMaskElement = /*#__PURE__*/function (_MaskElement) {\n _inherits(HTMLMaskElement, _MaskElement);\n /** Mapping between HTMLElement events and mask internal events */\n\n /** HTMLElement to use mask on */\n\n /**\r\n @param {HTMLInputElement|HTMLTextAreaElement} input\r\n */\n\n\n function HTMLMaskElement(input) {\n var _this;\n\n _classCallCheck(this, HTMLMaskElement);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(HTMLMaskElement).call(this));\n _this.input = input;\n _this._handlers = {};\n return _this;\n }\n /**\r\n Is element in focus\r\n @readonly\r\n */\n\n\n _createClass(HTMLMaskElement, [{\n key: \"_unsafeSelect\",\n\n /**\r\n Sets HTMLElement selection\r\n @override\r\n */\n value: function _unsafeSelect(start, end) {\n this.input.setSelectionRange(start, end);\n }\n /**\r\n HTMLElement value\r\n @override\r\n */\n\n }, {\n key: \"bindEvents\",\n\n /**\r\n Binds HTMLElement events to mask internal events\r\n @override\r\n */\n value: function bindEvents(handlers) {\n var _this2 = this;\n\n Object.keys(handlers).forEach(function (event) {\n return _this2._toggleEventHandler(HTMLMaskElement.EVENTS_MAP[event], handlers[event]);\n });\n }\n /**\r\n Unbinds HTMLElement events to mask internal events\r\n @override\r\n */\n\n }, {\n key: \"unbindEvents\",\n value: function unbindEvents() {\n var _this3 = this;\n\n Object.keys(this._handlers).forEach(function (event) {\n return _this3._toggleEventHandler(event);\n });\n }\n /** */\n\n }, {\n key: \"_toggleEventHandler\",\n value: function _toggleEventHandler(event, handler) {\n if (this._handlers[event]) {\n this.input.removeEventListener(event, this._handlers[event]);\n delete this._handlers[event];\n }\n\n if (handler) {\n this.input.addEventListener(event, handler);\n this._handlers[event] = handler;\n }\n }\n }, {\n key: \"isActive\",\n get: function get() {\n return this.input === document.activeElement;\n }\n /**\r\n Returns HTMLElement selection start\r\n @override\r\n */\n\n }, {\n key: \"_unsafeSelectionStart\",\n get: function get() {\n return this.input.selectionStart;\n }\n /**\r\n Returns HTMLElement selection end\r\n @override\r\n */\n\n }, {\n key: \"_unsafeSelectionEnd\",\n get: function get() {\n return this.input.selectionEnd;\n }\n }, {\n key: \"value\",\n get: function get() {\n return this.input.value;\n },\n set: function set(value) {\n this.input.value = value;\n }\n }]);\n\n return HTMLMaskElement;\n}(MaskElement);\n\nHTMLMaskElement.EVENTS_MAP = {\n selectionChange: 'keydown',\n input: 'input',\n drop: 'drop',\n click: 'click',\n focus: 'focus',\n commit: 'blur'\n};\n/** Listens to element events and controls changes between element and {@link Masked} */\n\nvar InputMask = /*#__PURE__*/function () {\n /**\r\n View element\r\n @readonly\r\n */\n\n /**\r\n Internal {@link Masked} model\r\n @readonly\r\n */\n\n /**\r\n @param {MaskElement|HTMLInputElement|HTMLTextAreaElement} el\r\n @param {Object} opts\r\n */\n function InputMask(el, opts) {\n _classCallCheck(this, InputMask);\n\n this.el = el instanceof MaskElement ? el : new HTMLMaskElement(el);\n this.masked = createMask(opts);\n this._listeners = {};\n this._value = '';\n this._unmaskedValue = '';\n this._saveSelection = this._saveSelection.bind(this);\n this._onInput = this._onInput.bind(this);\n this._onChange = this._onChange.bind(this);\n this._onDrop = this._onDrop.bind(this);\n this._onFocus = this._onFocus.bind(this);\n this.alignCursor = this.alignCursor.bind(this);\n this.alignCursorFriendly = this.alignCursorFriendly.bind(this);\n\n this._bindEvents(); // refresh\n\n\n this.updateValue();\n\n this._onChange();\n }\n /** Read or update mask */\n\n\n _createClass(InputMask, [{\n key: \"maskEquals\",\n value: function maskEquals(mask) {\n return mask == null || mask === this.masked.mask || mask === Date && this.masked instanceof MaskedDate;\n }\n }, {\n key: \"_bindEvents\",\n\n /**\r\n Starts listening to element events\r\n @protected\r\n */\n value: function _bindEvents() {\n this.el.bindEvents({\n selectionChange: this._saveSelection,\n input: this._onInput,\n drop: this._onDrop,\n click: this.alignCursorFriendly,\n focus: this._onFocus,\n commit: this._onChange\n });\n }\n /**\r\n Stops listening to element events\r\n @protected\r\n */\n\n }, {\n key: \"_unbindEvents\",\n value: function _unbindEvents() {\n this.el.unbindEvents();\n }\n /**\r\n Fires custom event\r\n @protected\r\n */\n\n }, {\n key: \"_fireEvent\",\n value: function _fireEvent(ev) {\n var listeners = this._listeners[ev];\n if (!listeners) return;\n listeners.forEach(function (l) {\n return l();\n });\n }\n /**\r\n Current selection start\r\n @readonly\r\n */\n\n }, {\n key: \"_saveSelection\",\n\n /**\r\n Stores current selection\r\n @protected\r\n */\n value: function _saveSelection()\n /* ev */\n {\n if (this.value !== this.el.value) {\n console.warn('Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly.'); // eslint-disable-line no-console\n }\n\n this._selection = {\n start: this.selectionStart,\n end: this.cursorPos\n };\n }\n /** Syncronizes model value from view */\n\n }, {\n key: \"updateValue\",\n value: function updateValue() {\n this.masked.value = this.el.value;\n this._value = this.masked.value;\n }\n /** Syncronizes view from model value, fires change events */\n\n }, {\n key: \"updateControl\",\n value: function updateControl() {\n var newUnmaskedValue = this.masked.unmaskedValue;\n var newValue = this.masked.value;\n var isChanged = this.unmaskedValue !== newUnmaskedValue || this.value !== newValue;\n this._unmaskedValue = newUnmaskedValue;\n this._value = newValue;\n if (this.el.value !== newValue) this.el.value = newValue;\n if (isChanged) this._fireChangeEvents();\n }\n /** Updates options with deep equal check, recreates @{link Masked} model if mask type changes */\n\n }, {\n key: \"updateOptions\",\n value: function updateOptions(opts) {\n var mask = opts.mask,\n restOpts = _objectWithoutProperties(opts, [\"mask\"]);\n\n var updateMask = !this.maskEquals(mask);\n var updateOpts = !objectIncludes(this.masked, restOpts);\n if (updateMask) this.mask = mask;\n if (updateOpts) this.masked.updateOptions(restOpts);\n if (updateMask || updateOpts) this.updateControl();\n }\n /** Updates cursor */\n\n }, {\n key: \"updateCursor\",\n value: function updateCursor(cursorPos) {\n if (cursorPos == null) return;\n this.cursorPos = cursorPos; // also queue change cursor for mobile browsers\n\n this._delayUpdateCursor(cursorPos);\n }\n /**\r\n Delays cursor update to support mobile browsers\r\n @private\r\n */\n\n }, {\n key: \"_delayUpdateCursor\",\n value: function _delayUpdateCursor(cursorPos) {\n var _this = this;\n\n this._abortUpdateCursor();\n\n this._changingCursorPos = cursorPos;\n this._cursorChanging = setTimeout(function () {\n if (!_this.el) return; // if was destroyed\n\n _this.cursorPos = _this._changingCursorPos;\n\n _this._abortUpdateCursor();\n }, 10);\n }\n /**\r\n Fires custom events\r\n @protected\r\n */\n\n }, {\n key: \"_fireChangeEvents\",\n value: function _fireChangeEvents() {\n this._fireEvent('accept');\n\n if (this.masked.isComplete) this._fireEvent('complete');\n }\n /**\r\n Aborts delayed cursor update\r\n @private\r\n */\n\n }, {\n key: \"_abortUpdateCursor\",\n value: function _abortUpdateCursor() {\n if (this._cursorChanging) {\n clearTimeout(this._cursorChanging);\n delete this._cursorChanging;\n }\n }\n /** Aligns cursor to nearest available position */\n\n }, {\n key: \"alignCursor\",\n value: function alignCursor() {\n this.cursorPos = this.masked.nearestInputPos(this.cursorPos, DIRECTION.LEFT);\n }\n /** Aligns cursor only if selection is empty */\n\n }, {\n key: \"alignCursorFriendly\",\n value: function alignCursorFriendly() {\n if (this.selectionStart !== this.cursorPos) return; // skip if range is selected\n\n this.alignCursor();\n }\n /** Adds listener on custom event */\n\n }, {\n key: \"on\",\n value: function on(ev, handler) {\n if (!this._listeners[ev]) this._listeners[ev] = [];\n\n this._listeners[ev].push(handler);\n\n return this;\n }\n /** Removes custom event listener */\n\n }, {\n key: \"off\",\n value: function off(ev, handler) {\n if (!this._listeners[ev]) return this;\n\n if (!handler) {\n delete this._listeners[ev];\n return this;\n }\n\n var hIndex = this._listeners[ev].indexOf(handler);\n\n if (hIndex >= 0) this._listeners[ev].splice(hIndex, 1);\n return this;\n }\n /** Handles view input event */\n\n }, {\n key: \"_onInput\",\n value: function _onInput() {\n this._abortUpdateCursor(); // fix strange IE behavior\n\n\n if (!this._selection) return this.updateValue();\n var details = new ActionDetails( // new state\n this.el.value, this.cursorPos, // old state\n this.value, this._selection);\n var oldRawValue = this.masked.rawInputValue;\n var offset = this.masked.splice(details.startChangePos, details.removed.length, details.inserted, details.removeDirection).offset; // force align in remove direction only if no input chars were removed\n // otherwise we still need to align with NONE (to get out from fixed symbols for instance)\n\n var removeDirection = oldRawValue === this.masked.rawInputValue ? details.removeDirection : DIRECTION.NONE;\n var cursorPos = this.masked.nearestInputPos(details.startChangePos + offset, removeDirection);\n this.updateControl();\n this.updateCursor(cursorPos);\n }\n /** Handles view change event and commits model value */\n\n }, {\n key: \"_onChange\",\n value: function _onChange() {\n if (this.value !== this.el.value) {\n this.updateValue();\n }\n\n this.masked.doCommit();\n this.updateControl();\n\n this._saveSelection();\n }\n /** Handles view drop event, prevents by default */\n\n }, {\n key: \"_onDrop\",\n value: function _onDrop(ev) {\n ev.preventDefault();\n ev.stopPropagation();\n }\n /** Restore last selection on focus */\n\n }, {\n key: \"_onFocus\",\n value: function _onFocus(ev) {\n if (this.selectionStart !== this.cursorPos) return; // skip if range is selected\n\n if (this._selection) this.cursorPos = this._selection.end;\n this.alignCursorFriendly();\n }\n /** Unbind view events and removes element reference */\n\n }, {\n key: \"destroy\",\n value: function destroy() {\n this._unbindEvents(); // $FlowFixMe why not do so?\n\n\n this._listeners.length = 0;\n delete this.el;\n }\n }, {\n key: \"mask\",\n get: function get() {\n return this.masked.mask;\n },\n set: function set(mask) {\n if (this.maskEquals(mask)) return;\n\n if (this.masked.constructor === maskedClass(mask)) {\n this.masked.updateOptions({\n mask: mask\n });\n return;\n }\n\n var masked = createMask({\n mask: mask\n });\n masked.unmaskedValue = this.masked.unmaskedValue;\n this.masked = masked;\n }\n /** Raw value */\n\n }, {\n key: \"value\",\n get: function get() {\n return this._value;\n },\n set: function set(str) {\n this.masked.value = str;\n this.updateControl();\n this.alignCursor();\n }\n /** Unmasked value */\n\n }, {\n key: \"unmaskedValue\",\n get: function get() {\n return this._unmaskedValue;\n },\n set: function set(str) {\n this.masked.unmaskedValue = str;\n this.updateControl();\n this.alignCursor();\n }\n /** Typed unmasked value */\n\n }, {\n key: \"typedValue\",\n get: function get() {\n return this.masked.typedValue;\n },\n set: function set(val) {\n this.masked.typedValue = val;\n this.updateControl();\n this.alignCursor();\n }\n }, {\n key: \"selectionStart\",\n get: function get() {\n return this._cursorChanging ? this._changingCursorPos : this.el.selectionStart;\n }\n /** Current cursor position */\n\n }, {\n key: \"cursorPos\",\n get: function get() {\n return this._cursorChanging ? this._changingCursorPos : this.el.selectionEnd;\n },\n set: function set(pos) {\n if (!this.el.isActive) return;\n this.el.select(pos, pos);\n\n this._saveSelection();\n }\n }]);\n\n return InputMask;\n}();\n/** Pattern which validates enum values */\n\n\nvar MaskedEnum = /*#__PURE__*/function (_MaskedPattern) {\n _inherits(MaskedEnum, _MaskedPattern);\n\n function MaskedEnum() {\n _classCallCheck(this, MaskedEnum);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(MaskedEnum).apply(this, arguments));\n }\n\n _createClass(MaskedEnum, [{\n key: \"_update\",\n\n /**\r\n @override\r\n @param {Object} opts\r\n */\n value: function _update(opts) {\n // TODO type\n if (opts[\"enum\"]) opts.mask = '*'.repeat(opts[\"enum\"][0].length);\n\n _get(_getPrototypeOf(MaskedEnum.prototype), \"_update\", this).call(this, opts);\n }\n /**\r\n @override\r\n */\n\n }, {\n key: \"doValidate\",\n value: function doValidate() {\n var _this = this,\n _get2;\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return this[\"enum\"].some(function (e) {\n return e.indexOf(_this.unmaskedValue) >= 0;\n }) && (_get2 = _get(_getPrototypeOf(MaskedEnum.prototype), \"doValidate\", this)).call.apply(_get2, [this].concat(args));\n }\n }]);\n\n return MaskedEnum;\n}(MaskedPattern);\n/**\r\n Number mask\r\n @param {Object} opts\r\n @param {string} opts.radix - Single char\r\n @param {string} opts.thousandsSeparator - Single char\r\n @param {Array} opts.mapToRadix - Array of single chars\r\n @param {number} opts.min\r\n @param {number} opts.max\r\n @param {number} opts.scale - Digits after point\r\n @param {boolean} opts.signed - Allow negative\r\n @param {boolean} opts.normalizeZeros - Flag to remove leading and trailing zeros in the end of editing\r\n @param {boolean} opts.padFractionalZeros - Flag to pad trailing zeros after point in the end of editing\r\n*/\n\n\nvar MaskedNumber = /*#__PURE__*/function (_Masked) {\n _inherits(MaskedNumber, _Masked);\n /** Single char */\n\n /** Single char */\n\n /** Array of single chars */\n\n /** */\n\n /** */\n\n /** Digits after point */\n\n /** */\n\n /** Flag to remove leading and trailing zeros in the end of editing */\n\n /** Flag to pad trailing zeros after point in the end of editing */\n\n\n function MaskedNumber(opts) {\n _classCallCheck(this, MaskedNumber);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(MaskedNumber).call(this, Object.assign({}, MaskedNumber.DEFAULTS, {}, opts)));\n }\n /**\r\n @override\r\n */\n\n\n _createClass(MaskedNumber, [{\n key: \"_update\",\n value: function _update(opts) {\n _get(_getPrototypeOf(MaskedNumber.prototype), \"_update\", this).call(this, opts);\n\n this._updateRegExps();\n }\n /** */\n\n }, {\n key: \"_updateRegExps\",\n value: function _updateRegExps() {\n // use different regexp to process user input (more strict, input suffix) and tail shifting\n var start = '^' + (this.allowNegative ? '[+|\\\\-]?' : '');\n var midInput = '(0|([1-9]+\\\\d*))?';\n var mid = '\\\\d*';\n var end = (this.scale ? '(' + escapeRegExp(this.radix) + '\\\\d{0,' + this.scale + '})?' : '') + '$';\n this._numberRegExpInput = new RegExp(start + midInput + end);\n this._numberRegExp = new RegExp(start + mid + end);\n this._mapToRadixRegExp = new RegExp('[' + this.mapToRadix.map(escapeRegExp).join('') + ']', 'g');\n this._thousandsSeparatorRegExp = new RegExp(escapeRegExp(this.thousandsSeparator), 'g');\n }\n /** */\n\n }, {\n key: \"_removeThousandsSeparators\",\n value: function _removeThousandsSeparators(value) {\n return value.replace(this._thousandsSeparatorRegExp, '');\n }\n /** */\n\n }, {\n key: \"_insertThousandsSeparators\",\n value: function _insertThousandsSeparators(value) {\n // https://stackoverflow.com/questions/2901102/how-to-print-a-number-with-commas-as-thousands-separators-in-javascript\n var parts = value.split(this.radix);\n parts[0] = parts[0].replace(/\\B(?=(\\d{3})+(?!\\d))/g, this.thousandsSeparator);\n return parts.join(this.radix);\n }\n /**\r\n @override\r\n */\n\n }, {\n key: \"doPrepare\",\n value: function doPrepare(str) {\n var _get2;\n\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n return (_get2 = _get(_getPrototypeOf(MaskedNumber.prototype), \"doPrepare\", this)).call.apply(_get2, [this, this._removeThousandsSeparators(str.replace(this._mapToRadixRegExp, this.radix))].concat(args));\n }\n /** */\n\n }, {\n key: \"_separatorsCount\",\n value: function _separatorsCount(to) {\n var extendOnSeparators = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var count = 0;\n\n for (var pos = 0; pos < to; ++pos) {\n if (this._value.indexOf(this.thousandsSeparator, pos) === pos) {\n ++count;\n if (extendOnSeparators) to += this.thousandsSeparator.length;\n }\n }\n\n return count;\n }\n /** */\n\n }, {\n key: \"_separatorsCountFromSlice\",\n value: function _separatorsCountFromSlice() {\n var slice = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._value;\n return this._separatorsCount(this._removeThousandsSeparators(slice).length, true);\n }\n /**\r\n @override\r\n */\n\n }, {\n key: \"extractInput\",\n value: function extractInput() {\n var fromPos = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var toPos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.value.length;\n var flags = arguments.length > 2 ? arguments[2] : undefined;\n\n var _this$_adjustRangeWit = this._adjustRangeWithSeparators(fromPos, toPos);\n\n var _this$_adjustRangeWit2 = _slicedToArray(_this$_adjustRangeWit, 2);\n\n fromPos = _this$_adjustRangeWit2[0];\n toPos = _this$_adjustRangeWit2[1];\n return this._removeThousandsSeparators(_get(_getPrototypeOf(MaskedNumber.prototype), \"extractInput\", this).call(this, fromPos, toPos, flags));\n }\n /**\r\n @override\r\n */\n\n }, {\n key: \"_appendCharRaw\",\n value: function _appendCharRaw(ch) {\n var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n if (!this.thousandsSeparator) return _get(_getPrototypeOf(MaskedNumber.prototype), \"_appendCharRaw\", this).call(this, ch, flags);\n var prevBeforeTailValue = flags.tail && flags._beforeTailState ? flags._beforeTailState._value : this._value;\n\n var prevBeforeTailSeparatorsCount = this._separatorsCountFromSlice(prevBeforeTailValue);\n\n this._value = this._removeThousandsSeparators(this.value);\n\n var appendDetails = _get(_getPrototypeOf(MaskedNumber.prototype), \"_appendCharRaw\", this).call(this, ch, flags);\n\n this._value = this._insertThousandsSeparators(this._value);\n var beforeTailValue = flags.tail && flags._beforeTailState ? flags._beforeTailState._value : this._value;\n\n var beforeTailSeparatorsCount = this._separatorsCountFromSlice(beforeTailValue);\n\n appendDetails.tailShift += (beforeTailSeparatorsCount - prevBeforeTailSeparatorsCount) * this.thousandsSeparator.length;\n return appendDetails;\n }\n /** */\n\n }, {\n key: \"_findSeparatorAround\",\n value: function _findSeparatorAround(pos) {\n if (this.thousandsSeparator) {\n var searchFrom = pos - this.thousandsSeparator.length + 1;\n var separatorPos = this.value.indexOf(this.thousandsSeparator, searchFrom);\n if (separatorPos <= pos) return separatorPos;\n }\n\n return -1;\n }\n }, {\n key: \"_adjustRangeWithSeparators\",\n value: function _adjustRangeWithSeparators(from, to) {\n var separatorAroundFromPos = this._findSeparatorAround(from);\n\n if (separatorAroundFromPos >= 0) from = separatorAroundFromPos;\n\n var separatorAroundToPos = this._findSeparatorAround(to);\n\n if (separatorAroundToPos >= 0) to = separatorAroundToPos + this.thousandsSeparator.length;\n return [from, to];\n }\n /**\r\n @override\r\n */\n\n }, {\n key: \"remove\",\n value: function remove() {\n var fromPos = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var toPos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.value.length;\n\n var _this$_adjustRangeWit3 = this._adjustRangeWithSeparators(fromPos, toPos);\n\n var _this$_adjustRangeWit4 = _slicedToArray(_this$_adjustRangeWit3, 2);\n\n fromPos = _this$_adjustRangeWit4[0];\n toPos = _this$_adjustRangeWit4[1];\n var valueBeforePos = this.value.slice(0, fromPos);\n var valueAfterPos = this.value.slice(toPos);\n\n var prevBeforeTailSeparatorsCount = this._separatorsCount(valueBeforePos.length);\n\n this._value = this._insertThousandsSeparators(this._removeThousandsSeparators(valueBeforePos + valueAfterPos));\n\n var beforeTailSeparatorsCount = this._separatorsCountFromSlice(valueBeforePos);\n\n return new ChangeDetails({\n tailShift: (beforeTailSeparatorsCount - prevBeforeTailSeparatorsCount) * this.thousandsSeparator.length\n });\n }\n /**\r\n @override\r\n */\n\n }, {\n key: \"nearestInputPos\",\n value: function nearestInputPos(cursorPos, direction) {\n if (!this.thousandsSeparator) return cursorPos;\n\n switch (direction) {\n case DIRECTION.NONE:\n case DIRECTION.LEFT:\n case DIRECTION.FORCE_LEFT:\n {\n var separatorAtLeftPos = this._findSeparatorAround(cursorPos - 1);\n\n if (separatorAtLeftPos >= 0) {\n var separatorAtLeftEndPos = separatorAtLeftPos + this.thousandsSeparator.length;\n\n if (cursorPos < separatorAtLeftEndPos || this.value.length <= separatorAtLeftEndPos || direction === DIRECTION.FORCE_LEFT) {\n return separatorAtLeftPos;\n }\n }\n\n break;\n }\n\n case DIRECTION.RIGHT:\n case DIRECTION.FORCE_RIGHT:\n {\n var separatorAtRightPos = this._findSeparatorAround(cursorPos);\n\n if (separatorAtRightPos >= 0) {\n return separatorAtRightPos + this.thousandsSeparator.length;\n }\n }\n }\n\n return cursorPos;\n }\n /**\r\n @override\r\n */\n\n }, {\n key: \"doValidate\",\n value: function doValidate(flags) {\n var regexp = flags.input ? this._numberRegExpInput : this._numberRegExp; // validate as string\n\n var valid = regexp.test(this._removeThousandsSeparators(this.value));\n\n if (valid) {\n // validate as number\n var number = this.number;\n valid = valid && !isNaN(number) && ( // check min bound for negative values\n this.min == null || this.min >= 0 || this.min <= this.number) && ( // check max bound for positive values\n this.max == null || this.max <= 0 || this.number <= this.max);\n }\n\n return valid && _get(_getPrototypeOf(MaskedNumber.prototype), \"doValidate\", this).call(this, flags);\n }\n /**\r\n @override\r\n */\n\n }, {\n key: \"doCommit\",\n value: function doCommit() {\n if (this.value) {\n var number = this.number;\n var validnum = number; // check bounds\n\n if (this.min != null) validnum = Math.max(validnum, this.min);\n if (this.max != null) validnum = Math.min(validnum, this.max);\n if (validnum !== number) this.unmaskedValue = String(validnum);\n var formatted = this.value;\n if (this.normalizeZeros) formatted = this._normalizeZeros(formatted);\n if (this.padFractionalZeros) formatted = this._padFractionalZeros(formatted);\n this._value = formatted;\n }\n\n _get(_getPrototypeOf(MaskedNumber.prototype), \"doCommit\", this).call(this);\n }\n /** */\n\n }, {\n key: \"_normalizeZeros\",\n value: function _normalizeZeros(value) {\n var parts = this._removeThousandsSeparators(value).split(this.radix); // remove leading zeros\n\n\n parts[0] = parts[0].replace(/^(\\D*)(0*)(\\d*)/, function (match, sign, zeros, num) {\n return sign + num;\n }); // add leading zero\n\n if (value.length && !/\\d$/.test(parts[0])) parts[0] = parts[0] + '0';\n\n if (parts.length > 1) {\n parts[1] = parts[1].replace(/0*$/, ''); // remove trailing zeros\n\n if (!parts[1].length) parts.length = 1; // remove fractional\n }\n\n return this._insertThousandsSeparators(parts.join(this.radix));\n }\n /** */\n\n }, {\n key: \"_padFractionalZeros\",\n value: function _padFractionalZeros(value) {\n if (!value) return value;\n var parts = value.split(this.radix);\n if (parts.length < 2) parts.push('');\n parts[1] = parts[1].padEnd(this.scale, '0');\n return parts.join(this.radix);\n }\n /**\r\n @override\r\n */\n\n }, {\n key: \"unmaskedValue\",\n get: function get() {\n return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix, '.');\n },\n set: function set(unmaskedValue) {\n _set(_getPrototypeOf(MaskedNumber.prototype), \"unmaskedValue\", unmaskedValue.replace('.', this.radix), this, true);\n }\n /** Parsed Number */\n\n }, {\n key: \"number\",\n get: function get() {\n return Number(this.unmaskedValue);\n },\n set: function set(number) {\n this.unmaskedValue = String(number);\n }\n /**\r\n @override\r\n */\n\n }, {\n key: \"typedValue\",\n get: function get() {\n return this.number;\n },\n set: function set(value) {\n this.number = value;\n }\n /**\r\n Is negative allowed\r\n @readonly\r\n */\n\n }, {\n key: \"allowNegative\",\n get: function get() {\n return this.signed || this.min != null && this.min < 0 || this.max != null && this.max < 0;\n }\n }]);\n\n return MaskedNumber;\n}(Masked);\n\nMaskedNumber.DEFAULTS = {\n radix: ',',\n thousandsSeparator: '',\n mapToRadix: ['.'],\n scale: 2,\n signed: false,\n normalizeZeros: true,\n padFractionalZeros: false\n};\n/** Masking by RegExp */\n\nvar MaskedRegExp = /*#__PURE__*/function (_Masked) {\n _inherits(MaskedRegExp, _Masked);\n\n function MaskedRegExp() {\n _classCallCheck(this, MaskedRegExp);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(MaskedRegExp).apply(this, arguments));\n }\n\n _createClass(MaskedRegExp, [{\n key: \"_update\",\n\n /**\r\n @override\r\n @param {Object} opts\r\n */\n value: function _update(opts) {\n if (opts.mask) opts.validate = function (value) {\n return value.search(opts.mask) >= 0;\n };\n\n _get(_getPrototypeOf(MaskedRegExp.prototype), \"_update\", this).call(this, opts);\n }\n }]);\n\n return MaskedRegExp;\n}(Masked);\n/** Masking by custom Function */\n\n\nvar MaskedFunction = /*#__PURE__*/function (_Masked) {\n _inherits(MaskedFunction, _Masked);\n\n function MaskedFunction() {\n _classCallCheck(this, MaskedFunction);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(MaskedFunction).apply(this, arguments));\n }\n\n _createClass(MaskedFunction, [{\n key: \"_update\",\n\n /**\r\n @override\r\n @param {Object} opts\r\n */\n value: function _update(opts) {\n if (opts.mask) opts.validate = opts.mask;\n\n _get(_getPrototypeOf(MaskedFunction.prototype), \"_update\", this).call(this, opts);\n }\n }]);\n\n return MaskedFunction;\n}(Masked);\n/** Dynamic mask for choosing apropriate mask in run-time */\n\n\nvar MaskedDynamic = /*#__PURE__*/function (_Masked) {\n _inherits(MaskedDynamic, _Masked);\n /** Currently chosen mask */\n\n /** Compliled {@link Masked} options */\n\n /** Chooses {@link Masked} depending on input value */\n\n /**\r\n @param {Object} opts\r\n */\n\n\n function MaskedDynamic(opts) {\n var _this;\n\n _classCallCheck(this, MaskedDynamic);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(MaskedDynamic).call(this, Object.assign({}, MaskedDynamic.DEFAULTS, {}, opts)));\n _this.currentMask = null;\n return _this;\n }\n /**\r\n @override\r\n */\n\n\n _createClass(MaskedDynamic, [{\n key: \"_update\",\n value: function _update(opts) {\n _get(_getPrototypeOf(MaskedDynamic.prototype), \"_update\", this).call(this, opts);\n\n if ('mask' in opts) {\n // mask could be totally dynamic with only `dispatch` option\n this.compiledMasks = Array.isArray(opts.mask) ? opts.mask.map(function (m) {\n return createMask(m);\n }) : [];\n }\n }\n /**\r\n @override\r\n */\n\n }, {\n key: \"_appendCharRaw\",\n value: function _appendCharRaw() {\n var details = this._applyDispatch.apply(this, arguments);\n\n if (this.currentMask) {\n var _this$currentMask;\n\n details.aggregate((_this$currentMask = this.currentMask)._appendChar.apply(_this$currentMask, arguments));\n }\n\n return details;\n }\n }, {\n key: \"_applyDispatch\",\n value: function _applyDispatch() {\n var appended = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var prevValueBeforeTail = flags.tail && flags._beforeTailState != null ? flags._beforeTailState._value : this.value;\n var inputValue = this.rawInputValue;\n var insertValue = flags.tail && flags._beforeTailState != null ? // $FlowFixMe - tired to fight with type system\n flags._beforeTailState._rawInputValue : inputValue;\n var tailValue = inputValue.slice(insertValue.length);\n var prevMask = this.currentMask;\n var details = new ChangeDetails();\n var prevMaskState = prevMask && prevMask.state; // clone flags to prevent overwriting `_beforeTailState`\n\n this.currentMask = this.doDispatch(appended, Object.assign({}, flags)); // restore state after dispatch\n\n if (this.currentMask) {\n if (this.currentMask !== prevMask) {\n // if mask changed reapply input\n this.currentMask.reset(); // $FlowFixMe - it's ok, we don't change current mask above\n\n var d = this.currentMask.append(insertValue, {\n raw: true\n });\n details.tailShift = d.inserted.length - prevValueBeforeTail.length;\n\n if (tailValue) {\n // $FlowFixMe - it's ok, we don't change current mask above\n details.tailShift += this.currentMask.append(tailValue, {\n raw: true,\n tail: true\n }).tailShift;\n }\n } else {\n // Dispatch can do something bad with state, so\n // restore prev mask state\n this.currentMask.state = prevMaskState;\n }\n }\n\n return details;\n }\n }, {\n key: \"_appendPlaceholder\",\n value: function _appendPlaceholder() {\n var details = this._applyDispatch.apply(this, arguments);\n\n if (this.currentMask) {\n details.aggregate(this.currentMask._appendPlaceholder());\n }\n\n return details;\n }\n /**\r\n @override\r\n */\n\n }, {\n key: \"doDispatch\",\n value: function doDispatch(appended) {\n var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return this.dispatch(appended, this, flags);\n }\n /**\r\n @override\r\n */\n\n }, {\n key: \"doValidate\",\n value: function doValidate() {\n var _get2, _this$currentMask2;\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return (_get2 = _get(_getPrototypeOf(MaskedDynamic.prototype), \"doValidate\", this)).call.apply(_get2, [this].concat(args)) && (!this.currentMask || (_this$currentMask2 = this.currentMask).doValidate.apply(_this$currentMask2, args));\n }\n /**\r\n @override\r\n */\n\n }, {\n key: \"reset\",\n value: function reset() {\n if (this.currentMask) this.currentMask.reset();\n this.compiledMasks.forEach(function (m) {\n return m.reset();\n });\n }\n /**\r\n @override\r\n */\n\n }, {\n key: \"remove\",\n\n /**\r\n @override\r\n */\n value: function remove() {\n var details = new ChangeDetails();\n\n if (this.currentMask) {\n var _this$currentMask3;\n\n details.aggregate((_this$currentMask3 = this.currentMask).remove.apply(_this$currentMask3, arguments)) // update with dispatch\n .aggregate(this._applyDispatch());\n }\n\n return details;\n }\n /**\r\n @override\r\n */\n\n }, {\n key: \"extractInput\",\n\n /**\r\n @override\r\n */\n value: function extractInput() {\n var _this$currentMask4;\n\n return this.currentMask ? (_this$currentMask4 = this.currentMask).extractInput.apply(_this$currentMask4, arguments) : '';\n }\n /**\r\n @override\r\n */\n\n }, {\n key: \"extractTail\",\n value: function extractTail() {\n var _this$currentMask5, _get3;\n\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n return this.currentMask ? (_this$currentMask5 = this.currentMask).extractTail.apply(_this$currentMask5, args) : (_get3 = _get(_getPrototypeOf(MaskedDynamic.prototype), \"extractTail\", this)).call.apply(_get3, [this].concat(args));\n }\n /**\r\n @override\r\n */\n\n }, {\n key: \"doCommit\",\n value: function doCommit() {\n if (this.currentMask) this.currentMask.doCommit();\n\n _get(_getPrototypeOf(MaskedDynamic.prototype), \"doCommit\", this).call(this);\n }\n /**\r\n @override\r\n */\n\n }, {\n key: \"nearestInputPos\",\n value: function nearestInputPos() {\n var _this$currentMask6, _get4;\n\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n\n return this.currentMask ? (_this$currentMask6 = this.currentMask).nearestInputPos.apply(_this$currentMask6, args) : (_get4 = _get(_getPrototypeOf(MaskedDynamic.prototype), \"nearestInputPos\", this)).call.apply(_get4, [this].concat(args));\n }\n }, {\n key: \"value\",\n get: function get() {\n return this.currentMask ? this.currentMask.value : '';\n },\n set: function set(value) {\n _set(_getPrototypeOf(MaskedDynamic.prototype), \"value\", value, this, true);\n }\n /**\r\n @override\r\n */\n\n }, {\n key: \"unmaskedValue\",\n get: function get() {\n return this.currentMask ? this.currentMask.unmaskedValue : '';\n },\n set: function set(unmaskedValue) {\n _set(_getPrototypeOf(MaskedDynamic.prototype), \"unmaskedValue\", unmaskedValue, this, true);\n }\n /**\r\n @override\r\n */\n\n }, {\n key: \"typedValue\",\n get: function get() {\n return this.currentMask ? this.currentMask.typedValue : '';\n } // probably typedValue should not be used with dynamic\n ,\n set: function set(value) {\n var unmaskedValue = String(value); // double check it\n\n if (this.currentMask) {\n this.currentMask.typedValue = value;\n unmaskedValue = this.currentMask.unmaskedValue;\n }\n\n this.unmaskedValue = unmaskedValue;\n }\n /**\r\n @override\r\n */\n\n }, {\n key: \"isComplete\",\n get: function get() {\n return !!this.currentMask && this.currentMask.isComplete;\n }\n }, {\n key: \"state\",\n get: function get() {\n return Object.assign({}, _get(_getPrototypeOf(MaskedDynamic.prototype), \"state\", this), {\n _rawInputValue: this.rawInputValue,\n compiledMasks: this.compiledMasks.map(function (m) {\n return m.state;\n }),\n currentMaskRef: this.currentMask,\n currentMask: this.currentMask && this.currentMask.state\n });\n },\n set: function set(state) {\n var compiledMasks = state.compiledMasks,\n currentMaskRef = state.currentMaskRef,\n currentMask = state.currentMask,\n maskedState = _objectWithoutProperties(state, [\"compiledMasks\", \"currentMaskRef\", \"currentMask\"]);\n\n this.compiledMasks.forEach(function (m, mi) {\n return m.state = compiledMasks[mi];\n });\n\n if (currentMaskRef != null) {\n this.currentMask = currentMaskRef;\n this.currentMask.state = currentMask;\n }\n\n _set(_getPrototypeOf(MaskedDynamic.prototype), \"state\", maskedState, this, true);\n }\n }, {\n key: \"overwrite\",\n get: function get() {\n return this.currentMask ? this.currentMask.overwrite : _get(_getPrototypeOf(MaskedDynamic.prototype), \"overwrite\", this);\n },\n set: function set(overwrite) {\n console.warn('\"overwrite\" option is not available in dynamic mask, use this option in siblings');\n }\n }]);\n\n return MaskedDynamic;\n}(Masked);\n\nMaskedDynamic.DEFAULTS = {\n dispatch: function dispatch(appended, masked, flags) {\n if (!masked.compiledMasks.length) return;\n var inputValue = masked.rawInputValue; // simulate input\n\n var inputs = masked.compiledMasks.map(function (m, index) {\n m.reset();\n m.append(inputValue, {\n raw: true\n });\n m.append(appended, flags);\n var weight = m.rawInputValue.length;\n return {\n weight: weight,\n index: index\n };\n }); // pop masks with longer values first\n\n inputs.sort(function (i1, i2) {\n return i2.weight - i1.weight;\n });\n return masked.compiledMasks[inputs[0].index];\n }\n};\n/**\r\n * Applies mask on element.\r\n * @constructor\r\n * @param {HTMLInputElement|HTMLTextAreaElement|MaskElement} el - Element to apply mask\r\n * @param {Object} opts - Custom mask options\r\n * @return {InputMask}\r\n */\n\nfunction IMask(el) {\n var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; // currently available only for input-like elements\n\n return new InputMask(el, opts);\n}\n/** {@link InputMask} */\n\n\nIMask.InputMask = InputMask;\n/** {@link Masked} */\n\nIMask.Masked = Masked;\n/** {@link MaskedPattern} */\n\nIMask.MaskedPattern = MaskedPattern;\n/** {@link MaskedEnum} */\n\nIMask.MaskedEnum = MaskedEnum;\n/** {@link MaskedRange} */\n\nIMask.MaskedRange = MaskedRange;\n/** {@link MaskedNumber} */\n\nIMask.MaskedNumber = MaskedNumber;\n/** {@link MaskedDate} */\n\nIMask.MaskedDate = MaskedDate;\n/** {@link MaskedRegExp} */\n\nIMask.MaskedRegExp = MaskedRegExp;\n/** {@link MaskedFunction} */\n\nIMask.MaskedFunction = MaskedFunction;\n/** {@link MaskedDynamic} */\n\nIMask.MaskedDynamic = MaskedDynamic;\n/** {@link createMask} */\n\nIMask.createMask = createMask;\n/** {@link MaskElement} */\n\nIMask.MaskElement = MaskElement;\n/** {@link HTMLMaskElement} */\n\nIMask.HTMLMaskElement = HTMLMaskElement;\ng.IMask = IMask;\nexport default IMask;\nexport { HTMLMaskElement, InputMask, MaskElement, Masked, MaskedDate, MaskedDynamic, MaskedEnum, MaskedFunction, MaskedNumber, MaskedPattern, MaskedRange, MaskedRegExp, createMask };","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n/*!\r\n * jQuery Validation Plugin v1.19.2\r\n *\r\n * https://jqueryvalidation.org/\r\n *\r\n * Copyright (c) 2020 Jörn Zaefferer\r\n * Released under the MIT license\r\n */\n(function (factory) {\n if (typeof define === \"function\" && define.amd) {\n define([\"jquery\"], factory);\n } else if ((typeof module === \"undefined\" ? \"undefined\" : _typeof(module)) === \"object\" && module.exports) {\n module.exports = factory(require(\"jquery\"));\n } else {\n factory(jQuery);\n }\n})(function ($) {\n $.extend($.fn, {\n // https://jqueryvalidation.org/validate/\n validate: function validate(options) {\n // If nothing is selected, return nothing; can't chain anyway\n if (!this.length) {\n if (options && options.debug && window.console) {\n console.warn(\"Nothing selected, can't validate, returning nothing.\");\n }\n\n return;\n } // Check if a validator for this form was already created\n\n\n var validator = $.data(this[0], \"validator\");\n\n if (validator) {\n return validator;\n } // Add novalidate tag if HTML5.\n\n\n this.attr(\"novalidate\", \"novalidate\");\n validator = new $.validator(options, this[0]);\n $.data(this[0], \"validator\", validator);\n\n if (validator.settings.onsubmit) {\n this.on(\"click.validate\", \":submit\", function (event) {\n // Track the used submit button to properly handle scripted\n // submits later.\n validator.submitButton = event.currentTarget; // Allow suppressing validation by adding a cancel class to the submit button\n\n if ($(this).hasClass(\"cancel\")) {\n validator.cancelSubmit = true;\n } // Allow suppressing validation by adding the html5 formnovalidate attribute to the submit button\n\n\n if ($(this).attr(\"formnovalidate\") !== undefined) {\n validator.cancelSubmit = true;\n }\n }); // Validate the form on submit\n\n this.on(\"submit.validate\", function (event) {\n if (validator.settings.debug) {\n // Prevent form submit to be able to see console output\n event.preventDefault();\n }\n\n function handle() {\n var hidden, result; // Insert a hidden input as a replacement for the missing submit button\n // The hidden input is inserted in two cases:\n // - A user defined a `submitHandler`\n // - There was a pending request due to `remote` method and `stopRequest()`\n // was called to submit the form in case it's valid\n\n if (validator.submitButton && (validator.settings.submitHandler || validator.formSubmitted)) {\n hidden = $(\"\").attr(\"name\", validator.submitButton.name).val($(validator.submitButton).val()).appendTo(validator.currentForm);\n }\n\n if (validator.settings.submitHandler && !validator.settings.debug) {\n result = validator.settings.submitHandler.call(validator, validator.currentForm, event);\n\n if (hidden) {\n // And clean up afterwards; thanks to no-block-scope, hidden can be referenced\n hidden.remove();\n }\n\n if (result !== undefined) {\n return result;\n }\n\n return false;\n }\n\n return true;\n } // Prevent submit for invalid forms or custom submit handlers\n\n\n if (validator.cancelSubmit) {\n validator.cancelSubmit = false;\n return handle();\n }\n\n if (validator.form()) {\n if (validator.pendingRequest) {\n validator.formSubmitted = true;\n return false;\n }\n\n return handle();\n } else {\n validator.focusInvalid();\n return false;\n }\n });\n }\n\n return validator;\n },\n // https://jqueryvalidation.org/valid/\n valid: function valid() {\n var valid, validator, errorList;\n\n if ($(this[0]).is(\"form\")) {\n valid = this.validate().form();\n } else {\n errorList = [];\n valid = true;\n validator = $(this[0].form).validate();\n this.each(function () {\n valid = validator.element(this) && valid;\n\n if (!valid) {\n errorList = errorList.concat(validator.errorList);\n }\n });\n validator.errorList = errorList;\n }\n\n return valid;\n },\n // https://jqueryvalidation.org/rules/\n rules: function rules(command, argument) {\n var element = this[0],\n isContentEditable = typeof this.attr(\"contenteditable\") !== \"undefined\" && this.attr(\"contenteditable\") !== \"false\",\n settings,\n staticRules,\n existingRules,\n data,\n param,\n filtered; // If nothing is selected, return empty object; can't chain anyway\n\n if (element == null) {\n return;\n }\n\n if (!element.form && isContentEditable) {\n element.form = this.closest(\"form\")[0];\n element.name = this.attr(\"name\");\n }\n\n if (element.form == null) {\n return;\n }\n\n if (command) {\n settings = $.data(element.form, \"validator\").settings;\n staticRules = settings.rules;\n existingRules = $.validator.staticRules(element);\n\n switch (command) {\n case \"add\":\n $.extend(existingRules, $.validator.normalizeRule(argument)); // Remove messages from rules, but allow them to be set separately\n\n delete existingRules.messages;\n staticRules[element.name] = existingRules;\n\n if (argument.messages) {\n settings.messages[element.name] = $.extend(settings.messages[element.name], argument.messages);\n }\n\n break;\n\n case \"remove\":\n if (!argument) {\n delete staticRules[element.name];\n return existingRules;\n }\n\n filtered = {};\n $.each(argument.split(/\\s/), function (index, method) {\n filtered[method] = existingRules[method];\n delete existingRules[method];\n });\n return filtered;\n }\n }\n\n data = $.validator.normalizeRules($.extend({}, $.validator.classRules(element), $.validator.attributeRules(element), $.validator.dataRules(element), $.validator.staticRules(element)), element); // Make sure required is at front\n\n if (data.required) {\n param = data.required;\n delete data.required;\n data = $.extend({\n required: param\n }, data);\n } // Make sure remote is at back\n\n\n if (data.remote) {\n param = data.remote;\n delete data.remote;\n data = $.extend(data, {\n remote: param\n });\n }\n\n return data;\n }\n }); // JQuery trim is deprecated, provide a trim method based on String.prototype.trim\n\n var trim = function trim(str) {\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trim#Polyfill\n return str.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, \"\");\n }; // Custom selectors\n\n\n $.extend($.expr.pseudos || $.expr[\":\"], {\n // '|| $.expr[ \":\" ]' here enables backwards compatibility to jQuery 1.7. Can be removed when dropping jQ 1.7.x support\n // https://jqueryvalidation.org/blank-selector/\n blank: function blank(a) {\n return !trim(\"\" + $(a).val());\n },\n // https://jqueryvalidation.org/filled-selector/\n filled: function filled(a) {\n var val = $(a).val();\n return val !== null && !!trim(\"\" + val);\n },\n // https://jqueryvalidation.org/unchecked-selector/\n unchecked: function unchecked(a) {\n return !$(a).prop(\"checked\");\n }\n }); // Constructor for validator\n\n $.validator = function (options, form) {\n this.settings = $.extend(true, {}, $.validator.defaults, options);\n this.currentForm = form;\n this.init();\n }; // https://jqueryvalidation.org/jQuery.validator.format/\n\n\n $.validator.format = function (source, params) {\n if (arguments.length === 1) {\n return function () {\n var args = $.makeArray(arguments);\n args.unshift(source);\n return $.validator.format.apply(this, args);\n };\n }\n\n if (params === undefined) {\n return source;\n }\n\n if (arguments.length > 2 && params.constructor !== Array) {\n params = $.makeArray(arguments).slice(1);\n }\n\n if (params.constructor !== Array) {\n params = [params];\n }\n\n $.each(params, function (i, n) {\n source = source.replace(new RegExp(\"\\\\{\" + i + \"\\\\}\", \"g\"), function () {\n return n;\n });\n });\n return source;\n };\n\n $.extend($.validator, {\n defaults: {\n messages: {},\n groups: {},\n rules: {},\n errorClass: \"error\",\n pendingClass: \"pending\",\n validClass: \"valid\",\n errorElement: \"label\",\n focusCleanup: false,\n focusInvalid: true,\n errorContainer: $([]),\n errorLabelContainer: $([]),\n onsubmit: true,\n ignore: \":hidden\",\n ignoreTitle: false,\n onfocusin: function onfocusin(element) {\n this.lastActive = element; // Hide error label and remove error class on focus if enabled\n\n if (this.settings.focusCleanup) {\n if (this.settings.unhighlight) {\n this.settings.unhighlight.call(this, element, this.settings.errorClass, this.settings.validClass);\n }\n\n this.hideThese(this.errorsFor(element));\n }\n },\n onfocusout: function onfocusout(element) {\n if (!this.checkable(element) && (element.name in this.submitted || !this.optional(element))) {\n this.element(element);\n }\n },\n onkeyup: function onkeyup(element, event) {\n // Avoid revalidate the field when pressing one of the following keys\n // Shift => 16\n // Ctrl => 17\n // Alt => 18\n // Caps lock => 20\n // End => 35\n // Home => 36\n // Left arrow => 37\n // Up arrow => 38\n // Right arrow => 39\n // Down arrow => 40\n // Insert => 45\n // Num lock => 144\n // AltGr key => 225\n var excludedKeys = [16, 17, 18, 20, 35, 36, 37, 38, 39, 40, 45, 144, 225];\n\n if (event.which === 9 && this.elementValue(element) === \"\" || $.inArray(event.keyCode, excludedKeys) !== -1) {\n return;\n } else if (element.name in this.submitted || element.name in this.invalid) {\n this.element(element);\n }\n },\n onclick: function onclick(element) {\n // Click on selects, radiobuttons and checkboxes\n if (element.name in this.submitted) {\n this.element(element); // Or option elements, check parent select in that case\n } else if (element.parentNode.name in this.submitted) {\n this.element(element.parentNode);\n }\n },\n highlight: function highlight(element, errorClass, validClass) {\n if (element.type === \"radio\") {\n this.findByName(element.name).addClass(errorClass).removeClass(validClass);\n } else {\n $(element).addClass(errorClass).removeClass(validClass);\n }\n },\n unhighlight: function unhighlight(element, errorClass, validClass) {\n if (element.type === \"radio\") {\n this.findByName(element.name).removeClass(errorClass).addClass(validClass);\n } else {\n $(element).removeClass(errorClass).addClass(validClass);\n }\n }\n },\n // https://jqueryvalidation.org/jQuery.validator.setDefaults/\n setDefaults: function setDefaults(settings) {\n $.extend($.validator.defaults, settings);\n },\n messages: {\n required: \"This field is required.\",\n remote: \"Please fix this field.\",\n email: \"Please enter a valid email address.\",\n url: \"Please enter a valid URL.\",\n date: \"Please enter a valid date.\",\n dateISO: \"Please enter a valid date (ISO).\",\n number: \"Please enter a valid number.\",\n digits: \"Please enter only digits.\",\n equalTo: \"Please enter the same value again.\",\n maxlength: $.validator.format(\"Please enter no more than {0} characters.\"),\n minlength: $.validator.format(\"Please enter at least {0} characters.\"),\n rangelength: $.validator.format(\"Please enter a value between {0} and {1} characters long.\"),\n range: $.validator.format(\"Please enter a value between {0} and {1}.\"),\n max: $.validator.format(\"Please enter a value less than or equal to {0}.\"),\n min: $.validator.format(\"Please enter a value greater than or equal to {0}.\"),\n step: $.validator.format(\"Please enter a multiple of {0}.\")\n },\n autoCreateRanges: false,\n prototype: {\n init: function init() {\n this.labelContainer = $(this.settings.errorLabelContainer);\n this.errorContext = this.labelContainer.length && this.labelContainer || $(this.currentForm);\n this.containers = $(this.settings.errorContainer).add(this.settings.errorLabelContainer);\n this.submitted = {};\n this.valueCache = {};\n this.pendingRequest = 0;\n this.pending = {};\n this.invalid = {};\n this.reset();\n var currentForm = this.currentForm,\n groups = this.groups = {},\n rules;\n $.each(this.settings.groups, function (key, value) {\n if (typeof value === \"string\") {\n value = value.split(/\\s/);\n }\n\n $.each(value, function (index, name) {\n groups[name] = key;\n });\n });\n rules = this.settings.rules;\n $.each(rules, function (key, value) {\n rules[key] = $.validator.normalizeRule(value);\n });\n\n function delegate(event) {\n var isContentEditable = typeof $(this).attr(\"contenteditable\") !== \"undefined\" && $(this).attr(\"contenteditable\") !== \"false\"; // Set form expando on contenteditable\n\n if (!this.form && isContentEditable) {\n this.form = $(this).closest(\"form\")[0];\n this.name = $(this).attr(\"name\");\n } // Ignore the element if it belongs to another form. This will happen mainly\n // when setting the `form` attribute of an input to the id of another form.\n\n\n if (currentForm !== this.form) {\n return;\n }\n\n var validator = $.data(this.form, \"validator\"),\n eventType = \"on\" + event.type.replace(/^validate/, \"\"),\n settings = validator.settings;\n\n if (settings[eventType] && !$(this).is(settings.ignore)) {\n settings[eventType].call(validator, this, event);\n }\n }\n\n $(this.currentForm).on(\"focusin.validate focusout.validate keyup.validate\", \":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], \" + \"[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], \" + \"[type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], \" + \"[type='radio'], [type='checkbox'], [contenteditable], [type='button']\", delegate) // Support: Chrome, oldIE\n // \"select\" is provided as event.target when clicking a option\n .on(\"click.validate\", \"select, option, [type='radio'], [type='checkbox']\", delegate);\n\n if (this.settings.invalidHandler) {\n $(this.currentForm).on(\"invalid-form.validate\", this.settings.invalidHandler);\n }\n },\n // https://jqueryvalidation.org/Validator.form/\n form: function form() {\n this.checkForm();\n $.extend(this.submitted, this.errorMap);\n this.invalid = $.extend({}, this.errorMap);\n\n if (!this.valid()) {\n $(this.currentForm).triggerHandler(\"invalid-form\", [this]);\n }\n\n this.showErrors();\n return this.valid();\n },\n checkForm: function checkForm() {\n this.prepareForm();\n\n for (var i = 0, elements = this.currentElements = this.elements(); elements[i]; i++) {\n this.check(elements[i]);\n }\n\n return this.valid();\n },\n // https://jqueryvalidation.org/Validator.element/\n element: function element(_element) {\n var cleanElement = this.clean(_element),\n checkElement = this.validationTargetFor(cleanElement),\n v = this,\n result = true,\n rs,\n group;\n\n if (checkElement === undefined) {\n delete this.invalid[cleanElement.name];\n } else {\n this.prepareElement(checkElement);\n this.currentElements = $(checkElement); // If this element is grouped, then validate all group elements already\n // containing a value\n\n group = this.groups[checkElement.name];\n\n if (group) {\n $.each(this.groups, function (name, testgroup) {\n if (testgroup === group && name !== checkElement.name) {\n cleanElement = v.validationTargetFor(v.clean(v.findByName(name)));\n\n if (cleanElement && cleanElement.name in v.invalid) {\n v.currentElements.push(cleanElement);\n result = v.check(cleanElement) && result;\n }\n }\n });\n }\n\n rs = this.check(checkElement) !== false;\n result = result && rs;\n\n if (rs) {\n this.invalid[checkElement.name] = false;\n } else {\n this.invalid[checkElement.name] = true;\n }\n\n if (!this.numberOfInvalids()) {\n // Hide error containers on last error\n this.toHide = this.toHide.add(this.containers);\n }\n\n this.showErrors(); // Add aria-invalid status for screen readers\n\n $(_element).attr(\"aria-invalid\", !rs);\n }\n\n return result;\n },\n // https://jqueryvalidation.org/Validator.showErrors/\n showErrors: function showErrors(errors) {\n if (errors) {\n var validator = this; // Add items to error list and map\n\n $.extend(this.errorMap, errors);\n this.errorList = $.map(this.errorMap, function (message, name) {\n return {\n message: message,\n element: validator.findByName(name)[0]\n };\n }); // Remove items from success list\n\n this.successList = $.grep(this.successList, function (element) {\n return !(element.name in errors);\n });\n }\n\n if (this.settings.showErrors) {\n this.settings.showErrors.call(this, this.errorMap, this.errorList);\n } else {\n this.defaultShowErrors();\n }\n },\n // https://jqueryvalidation.org/Validator.resetForm/\n resetForm: function resetForm() {\n if ($.fn.resetForm) {\n $(this.currentForm).resetForm();\n }\n\n this.invalid = {};\n this.submitted = {};\n this.prepareForm();\n this.hideErrors();\n var elements = this.elements().removeData(\"previousValue\").removeAttr(\"aria-invalid\");\n this.resetElements(elements);\n },\n resetElements: function resetElements(elements) {\n var i;\n\n if (this.settings.unhighlight) {\n for (i = 0; elements[i]; i++) {\n this.settings.unhighlight.call(this, elements[i], this.settings.errorClass, \"\");\n this.findByName(elements[i].name).removeClass(this.settings.validClass);\n }\n } else {\n elements.removeClass(this.settings.errorClass).removeClass(this.settings.validClass);\n }\n },\n numberOfInvalids: function numberOfInvalids() {\n return this.objectLength(this.invalid);\n },\n objectLength: function objectLength(obj) {\n /* jshint unused: false */\n var count = 0,\n i;\n\n for (i in obj) {\n // This check allows counting elements with empty error\n // message as invalid elements\n if (obj[i] !== undefined && obj[i] !== null && obj[i] !== false) {\n count++;\n }\n }\n\n return count;\n },\n hideErrors: function hideErrors() {\n this.hideThese(this.toHide);\n },\n hideThese: function hideThese(errors) {\n errors.not(this.containers).text(\"\");\n this.addWrapper(errors).hide();\n },\n valid: function valid() {\n return this.size() === 0;\n },\n size: function size() {\n return this.errorList.length;\n },\n focusInvalid: function focusInvalid() {\n if (this.settings.focusInvalid) {\n try {\n $(this.findLastActive() || this.errorList.length && this.errorList[0].element || []).filter(\":visible\").trigger(\"focus\") // Manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find\n .trigger(\"focusin\");\n } catch (e) {// Ignore IE throwing errors when focusing hidden elements\n }\n }\n },\n findLastActive: function findLastActive() {\n var lastActive = this.lastActive;\n return lastActive && $.grep(this.errorList, function (n) {\n return n.element.name === lastActive.name;\n }).length === 1 && lastActive;\n },\n elements: function elements() {\n var validator = this,\n rulesCache = {}; // Select all valid inputs inside the form (no submit or reset buttons)\n\n return $(this.currentForm).find(\"input, select, textarea, [contenteditable]\").not(\":submit, :reset, :image, :disabled\").not(this.settings.ignore).filter(function () {\n var name = this.name || $(this).attr(\"name\"); // For contenteditable\n\n var isContentEditable = typeof $(this).attr(\"contenteditable\") !== \"undefined\" && $(this).attr(\"contenteditable\") !== \"false\";\n\n if (!name && validator.settings.debug && window.console) {\n console.error(\"%o has no name assigned\", this);\n } // Set form expando on contenteditable\n\n\n if (isContentEditable) {\n this.form = $(this).closest(\"form\")[0];\n this.name = name;\n } // Ignore elements that belong to other/nested forms\n\n\n if (this.form !== validator.currentForm) {\n return false;\n } // Select only the first element for each name, and only those with rules specified\n\n\n if (name in rulesCache || !validator.objectLength($(this).rules())) {\n return false;\n }\n\n rulesCache[name] = true;\n return true;\n });\n },\n clean: function clean(selector) {\n return $(selector)[0];\n },\n errors: function errors() {\n var errorClass = this.settings.errorClass.split(\" \").join(\".\");\n return $(this.settings.errorElement + \".\" + errorClass, this.errorContext);\n },\n resetInternals: function resetInternals() {\n this.successList = [];\n this.errorList = [];\n this.errorMap = {};\n this.toShow = $([]);\n this.toHide = $([]);\n },\n reset: function reset() {\n this.resetInternals();\n this.currentElements = $([]);\n },\n prepareForm: function prepareForm() {\n this.reset();\n this.toHide = this.errors().add(this.containers);\n },\n prepareElement: function prepareElement(element) {\n this.reset();\n this.toHide = this.errorsFor(element);\n },\n elementValue: function elementValue(element) {\n var $element = $(element),\n type = element.type,\n isContentEditable = typeof $element.attr(\"contenteditable\") !== \"undefined\" && $element.attr(\"contenteditable\") !== \"false\",\n val,\n idx;\n\n if (type === \"radio\" || type === \"checkbox\") {\n return this.findByName(element.name).filter(\":checked\").val();\n } else if (type === \"number\" && typeof element.validity !== \"undefined\") {\n return element.validity.badInput ? \"NaN\" : $element.val();\n }\n\n if (isContentEditable) {\n val = $element.text();\n } else {\n val = $element.val();\n }\n\n if (type === \"file\") {\n // Modern browser (chrome & safari)\n if (val.substr(0, 12) === \"C:\\\\fakepath\\\\\") {\n return val.substr(12);\n } // Legacy browsers\n // Unix-based path\n\n\n idx = val.lastIndexOf(\"/\");\n\n if (idx >= 0) {\n return val.substr(idx + 1);\n } // Windows-based path\n\n\n idx = val.lastIndexOf(\"\\\\\");\n\n if (idx >= 0) {\n return val.substr(idx + 1);\n } // Just the file name\n\n\n return val;\n }\n\n if (typeof val === \"string\") {\n return val.replace(/\\r/g, \"\");\n }\n\n return val;\n },\n check: function check(element) {\n element = this.validationTargetFor(this.clean(element));\n var rules = $(element).rules(),\n rulesCount = $.map(rules, function (n, i) {\n return i;\n }).length,\n dependencyMismatch = false,\n val = this.elementValue(element),\n result,\n method,\n rule,\n normalizer; // Prioritize the local normalizer defined for this element over the global one\n // if the former exists, otherwise user the global one in case it exists.\n\n if (typeof rules.normalizer === \"function\") {\n normalizer = rules.normalizer;\n } else if (typeof this.settings.normalizer === \"function\") {\n normalizer = this.settings.normalizer;\n } // If normalizer is defined, then call it to retreive the changed value instead\n // of using the real one.\n // Note that `this` in the normalizer is `element`.\n\n\n if (normalizer) {\n val = normalizer.call(element, val); // Delete the normalizer from rules to avoid treating it as a pre-defined method.\n\n delete rules.normalizer;\n }\n\n for (method in rules) {\n rule = {\n method: method,\n parameters: rules[method]\n };\n\n try {\n result = $.validator.methods[method].call(this, val, element, rule.parameters); // If a method indicates that the field is optional and therefore valid,\n // don't mark it as valid when there are no other rules\n\n if (result === \"dependency-mismatch\" && rulesCount === 1) {\n dependencyMismatch = true;\n continue;\n }\n\n dependencyMismatch = false;\n\n if (result === \"pending\") {\n this.toHide = this.toHide.not(this.errorsFor(element));\n return;\n }\n\n if (!result) {\n this.formatAndAdd(element, rule);\n return false;\n }\n } catch (e) {\n if (this.settings.debug && window.console) {\n console.log(\"Exception occurred when checking element \" + element.id + \", check the '\" + rule.method + \"' method.\", e);\n }\n\n if (e instanceof TypeError) {\n e.message += \". Exception occurred when checking element \" + element.id + \", check the '\" + rule.method + \"' method.\";\n }\n\n throw e;\n }\n }\n\n if (dependencyMismatch) {\n return;\n }\n\n if (this.objectLength(rules)) {\n this.successList.push(element);\n }\n\n return true;\n },\n // Return the custom message for the given element and validation method\n // specified in the element's HTML5 data attribute\n // return the generic message if present and no method specific message is present\n customDataMessage: function customDataMessage(element, method) {\n return $(element).data(\"msg\" + method.charAt(0).toUpperCase() + method.substring(1).toLowerCase()) || $(element).data(\"msg\");\n },\n // Return the custom message for the given element name and validation method\n customMessage: function customMessage(name, method) {\n var m = this.settings.messages[name];\n return m && (m.constructor === String ? m : m[method]);\n },\n // Return the first defined argument, allowing empty strings\n findDefined: function findDefined() {\n for (var i = 0; i < arguments.length; i++) {\n if (arguments[i] !== undefined) {\n return arguments[i];\n }\n }\n\n return undefined;\n },\n // The second parameter 'rule' used to be a string, and extended to an object literal\n // of the following form:\n // rule = {\n // method: \"method name\",\n // parameters: \"the given method parameters\"\n // }\n //\n // The old behavior still supported, kept to maintain backward compatibility with\n // old code, and will be removed in the next major release.\n defaultMessage: function defaultMessage(element, rule) {\n if (typeof rule === \"string\") {\n rule = {\n method: rule\n };\n }\n\n var message = this.findDefined(this.customMessage(element.name, rule.method), this.customDataMessage(element, rule.method), // 'title' is never undefined, so handle empty string as undefined\n !this.settings.ignoreTitle && element.title || undefined, $.validator.messages[rule.method], \"Warning: No message defined for \" + element.name + \"\"),\n theregex = /\\$?\\{(\\d+)\\}/g;\n\n if (typeof message === \"function\") {\n message = message.call(this, rule.parameters, element);\n } else if (theregex.test(message)) {\n message = $.validator.format(message.replace(theregex, \"{$1}\"), rule.parameters);\n }\n\n return message;\n },\n formatAndAdd: function formatAndAdd(element, rule) {\n var message = this.defaultMessage(element, rule);\n this.errorList.push({\n message: message,\n element: element,\n method: rule.method\n });\n this.errorMap[element.name] = message;\n this.submitted[element.name] = message;\n },\n addWrapper: function addWrapper(toToggle) {\n if (this.settings.wrapper) {\n toToggle = toToggle.add(toToggle.parent(this.settings.wrapper));\n }\n\n return toToggle;\n },\n defaultShowErrors: function defaultShowErrors() {\n var i, elements, error;\n\n for (i = 0; this.errorList[i]; i++) {\n error = this.errorList[i];\n\n if (this.settings.highlight) {\n this.settings.highlight.call(this, error.element, this.settings.errorClass, this.settings.validClass);\n }\n\n this.showLabel(error.element, error.message);\n }\n\n if (this.errorList.length) {\n this.toShow = this.toShow.add(this.containers);\n }\n\n if (this.settings.success) {\n for (i = 0; this.successList[i]; i++) {\n this.showLabel(this.successList[i]);\n }\n }\n\n if (this.settings.unhighlight) {\n for (i = 0, elements = this.validElements(); elements[i]; i++) {\n this.settings.unhighlight.call(this, elements[i], this.settings.errorClass, this.settings.validClass);\n }\n }\n\n this.toHide = this.toHide.not(this.toShow);\n this.hideErrors();\n this.addWrapper(this.toShow).show();\n },\n validElements: function validElements() {\n return this.currentElements.not(this.invalidElements());\n },\n invalidElements: function invalidElements() {\n return $(this.errorList).map(function () {\n return this.element;\n });\n },\n showLabel: function showLabel(element, message) {\n var place,\n group,\n errorID,\n v,\n error = this.errorsFor(element),\n elementID = this.idOrName(element),\n describedBy = $(element).attr(\"aria-describedby\");\n\n if (error.length) {\n // Refresh error/success class\n error.removeClass(this.settings.validClass).addClass(this.settings.errorClass); // Replace message on existing label\n\n error.html(message);\n } else {\n // Create error element\n error = $(\"<\" + this.settings.errorElement + \">\").attr(\"id\", elementID + \"-error\").addClass(this.settings.errorClass).html(message || \"\"); // Maintain reference to the element to be placed into the DOM\n\n place = error;\n\n if (this.settings.wrapper) {\n // Make sure the element is visible, even in IE\n // actually showing the wrapped element is handled elsewhere\n place = error.hide().show().wrap(\"<\" + this.settings.wrapper + \"/>\").parent();\n }\n\n if (this.labelContainer.length) {\n this.labelContainer.append(place);\n } else if (this.settings.errorPlacement) {\n this.settings.errorPlacement.call(this, place, $(element));\n } else {\n place.insertAfter(element);\n } // Link error back to the element\n\n\n if (error.is(\"label\")) {\n // If the error is a label, then associate using 'for'\n error.attr(\"for\", elementID); // If the element is not a child of an associated label, then it's necessary\n // to explicitly apply aria-describedby\n } else if (error.parents(\"label[for='\" + this.escapeCssMeta(elementID) + \"']\").length === 0) {\n errorID = error.attr(\"id\"); // Respect existing non-error aria-describedby\n\n if (!describedBy) {\n describedBy = errorID;\n } else if (!describedBy.match(new RegExp(\"\\\\b\" + this.escapeCssMeta(errorID) + \"\\\\b\"))) {\n // Add to end of list if not already present\n describedBy += \" \" + errorID;\n }\n\n $(element).attr(\"aria-describedby\", describedBy); // If this element is grouped, then assign to all elements in the same group\n\n group = this.groups[element.name];\n\n if (group) {\n v = this;\n $.each(v.groups, function (name, testgroup) {\n if (testgroup === group) {\n $(\"[name='\" + v.escapeCssMeta(name) + \"']\", v.currentForm).attr(\"aria-describedby\", error.attr(\"id\"));\n }\n });\n }\n }\n }\n\n if (!message && this.settings.success) {\n error.text(\"\");\n\n if (typeof this.settings.success === \"string\") {\n error.addClass(this.settings.success);\n } else {\n this.settings.success(error, element);\n }\n }\n\n this.toShow = this.toShow.add(error);\n },\n errorsFor: function errorsFor(element) {\n var name = this.escapeCssMeta(this.idOrName(element)),\n describer = $(element).attr(\"aria-describedby\"),\n selector = \"label[for='\" + name + \"'], label[for='\" + name + \"'] *\"; // 'aria-describedby' should directly reference the error element\n\n if (describer) {\n selector = selector + \", #\" + this.escapeCssMeta(describer).replace(/\\s+/g, \", #\");\n }\n\n return this.errors().filter(selector);\n },\n // See https://api.jquery.com/category/selectors/, for CSS\n // meta-characters that should be escaped in order to be used with JQuery\n // as a literal part of a name/id or any selector.\n escapeCssMeta: function escapeCssMeta(string) {\n return string.replace(/([\\\\!\"#$%&'()*+,./:;<=>?@\\[\\]^`{|}~])/g, \"\\\\$1\");\n },\n idOrName: function idOrName(element) {\n return this.groups[element.name] || (this.checkable(element) ? element.name : element.id || element.name);\n },\n validationTargetFor: function validationTargetFor(element) {\n // If radio/checkbox, validate first element in group instead\n if (this.checkable(element)) {\n element = this.findByName(element.name);\n } // Always apply ignore filter\n\n\n return $(element).not(this.settings.ignore)[0];\n },\n checkable: function checkable(element) {\n return /radio|checkbox/i.test(element.type);\n },\n findByName: function findByName(name) {\n return $(this.currentForm).find(\"[name='\" + this.escapeCssMeta(name) + \"']\");\n },\n getLength: function getLength(value, element) {\n switch (element.nodeName.toLowerCase()) {\n case \"select\":\n return $(\"option:selected\", element).length;\n\n case \"input\":\n if (this.checkable(element)) {\n return this.findByName(element.name).filter(\":checked\").length;\n }\n\n }\n\n return value.length;\n },\n depend: function depend(param, element) {\n return this.dependTypes[_typeof(param)] ? this.dependTypes[_typeof(param)](param, element) : true;\n },\n dependTypes: {\n \"boolean\": function boolean(param) {\n return param;\n },\n \"string\": function string(param, element) {\n return !!$(param, element.form).length;\n },\n \"function\": function _function(param, element) {\n return param(element);\n }\n },\n optional: function optional(element) {\n var val = this.elementValue(element);\n return !$.validator.methods.required.call(this, val, element) && \"dependency-mismatch\";\n },\n startRequest: function startRequest(element) {\n if (!this.pending[element.name]) {\n this.pendingRequest++;\n $(element).addClass(this.settings.pendingClass);\n this.pending[element.name] = true;\n }\n },\n stopRequest: function stopRequest(element, valid) {\n this.pendingRequest--; // Sometimes synchronization fails, make sure pendingRequest is never < 0\n\n if (this.pendingRequest < 0) {\n this.pendingRequest = 0;\n }\n\n delete this.pending[element.name];\n $(element).removeClass(this.settings.pendingClass);\n\n if (valid && this.pendingRequest === 0 && this.formSubmitted && this.form()) {\n $(this.currentForm).submit(); // Remove the hidden input that was used as a replacement for the\n // missing submit button. The hidden input is added by `handle()`\n // to ensure that the value of the used submit button is passed on\n // for scripted submits triggered by this method\n\n if (this.submitButton) {\n $(\"input:hidden[name='\" + this.submitButton.name + \"']\", this.currentForm).remove();\n }\n\n this.formSubmitted = false;\n } else if (!valid && this.pendingRequest === 0 && this.formSubmitted) {\n $(this.currentForm).triggerHandler(\"invalid-form\", [this]);\n this.formSubmitted = false;\n }\n },\n previousValue: function previousValue(element, method) {\n method = typeof method === \"string\" && method || \"remote\";\n return $.data(element, \"previousValue\") || $.data(element, \"previousValue\", {\n old: null,\n valid: true,\n message: this.defaultMessage(element, {\n method: method\n })\n });\n },\n // Cleans up all forms and elements, removes validator-specific events\n destroy: function destroy() {\n this.resetForm();\n $(this.currentForm).off(\".validate\").removeData(\"validator\").find(\".validate-equalTo-blur\").off(\".validate-equalTo\").removeClass(\"validate-equalTo-blur\").find(\".validate-lessThan-blur\").off(\".validate-lessThan\").removeClass(\"validate-lessThan-blur\").find(\".validate-lessThanEqual-blur\").off(\".validate-lessThanEqual\").removeClass(\"validate-lessThanEqual-blur\").find(\".validate-greaterThanEqual-blur\").off(\".validate-greaterThanEqual\").removeClass(\"validate-greaterThanEqual-blur\").find(\".validate-greaterThan-blur\").off(\".validate-greaterThan\").removeClass(\"validate-greaterThan-blur\");\n }\n },\n classRuleSettings: {\n required: {\n required: true\n },\n email: {\n email: true\n },\n url: {\n url: true\n },\n date: {\n date: true\n },\n dateISO: {\n dateISO: true\n },\n number: {\n number: true\n },\n digits: {\n digits: true\n },\n creditcard: {\n creditcard: true\n }\n },\n addClassRules: function addClassRules(className, rules) {\n if (className.constructor === String) {\n this.classRuleSettings[className] = rules;\n } else {\n $.extend(this.classRuleSettings, className);\n }\n },\n classRules: function classRules(element) {\n var rules = {},\n classes = $(element).attr(\"class\");\n\n if (classes) {\n $.each(classes.split(\" \"), function () {\n if (this in $.validator.classRuleSettings) {\n $.extend(rules, $.validator.classRuleSettings[this]);\n }\n });\n }\n\n return rules;\n },\n normalizeAttributeRule: function normalizeAttributeRule(rules, type, method, value) {\n // Convert the value to a number for number inputs, and for text for backwards compability\n // allows type=\"date\" and others to be compared as strings\n if (/min|max|step/.test(method) && (type === null || /number|range|text/.test(type))) {\n value = Number(value); // Support Opera Mini, which returns NaN for undefined minlength\n\n if (isNaN(value)) {\n value = undefined;\n }\n }\n\n if (value || value === 0) {\n rules[method] = value;\n } else if (type === method && type !== \"range\") {\n // Exception: the jquery validate 'range' method\n // does not test for the html5 'range' type\n rules[method] = true;\n }\n },\n attributeRules: function attributeRules(element) {\n var rules = {},\n $element = $(element),\n type = element.getAttribute(\"type\"),\n method,\n value;\n\n for (method in $.validator.methods) {\n // Support for in both html5 and older browsers\n if (method === \"required\") {\n value = element.getAttribute(method); // Some browsers return an empty string for the required attribute\n // and non-HTML5 browsers might have required=\"\" markup\n\n if (value === \"\") {\n value = true;\n } // Force non-HTML5 browsers to return bool\n\n\n value = !!value;\n } else {\n value = $element.attr(method);\n }\n\n this.normalizeAttributeRule(rules, type, method, value);\n } // 'maxlength' may be returned as -1, 2147483647 ( IE ) and 524288 ( safari ) for text inputs\n\n\n if (rules.maxlength && /-1|2147483647|524288/.test(rules.maxlength)) {\n delete rules.maxlength;\n }\n\n return rules;\n },\n dataRules: function dataRules(element) {\n var rules = {},\n $element = $(element),\n type = element.getAttribute(\"type\"),\n method,\n value;\n\n for (method in $.validator.methods) {\n value = $element.data(\"rule\" + method.charAt(0).toUpperCase() + method.substring(1).toLowerCase()); // Cast empty attributes like `data-rule-required` to `true`\n\n if (value === \"\") {\n value = true;\n }\n\n this.normalizeAttributeRule(rules, type, method, value);\n }\n\n return rules;\n },\n staticRules: function staticRules(element) {\n var rules = {},\n validator = $.data(element.form, \"validator\");\n\n if (validator.settings.rules) {\n rules = $.validator.normalizeRule(validator.settings.rules[element.name]) || {};\n }\n\n return rules;\n },\n normalizeRules: function normalizeRules(rules, element) {\n // Handle dependency check\n $.each(rules, function (prop, val) {\n // Ignore rule when param is explicitly false, eg. required:false\n if (val === false) {\n delete rules[prop];\n return;\n }\n\n if (val.param || val.depends) {\n var keepRule = true;\n\n switch (_typeof(val.depends)) {\n case \"string\":\n keepRule = !!$(val.depends, element.form).length;\n break;\n\n case \"function\":\n keepRule = val.depends.call(element, element);\n break;\n }\n\n if (keepRule) {\n rules[prop] = val.param !== undefined ? val.param : true;\n } else {\n $.data(element.form, \"validator\").resetElements($(element));\n delete rules[prop];\n }\n }\n }); // Evaluate parameters\n\n $.each(rules, function (rule, parameter) {\n rules[rule] = $.isFunction(parameter) && rule !== \"normalizer\" ? parameter(element) : parameter;\n }); // Clean number parameters\n\n $.each([\"minlength\", \"maxlength\"], function () {\n if (rules[this]) {\n rules[this] = Number(rules[this]);\n }\n });\n $.each([\"rangelength\", \"range\"], function () {\n var parts;\n\n if (rules[this]) {\n if ($.isArray(rules[this])) {\n rules[this] = [Number(rules[this][0]), Number(rules[this][1])];\n } else if (typeof rules[this] === \"string\") {\n parts = rules[this].replace(/[\\[\\]]/g, \"\").split(/[\\s,]+/);\n rules[this] = [Number(parts[0]), Number(parts[1])];\n }\n }\n });\n\n if ($.validator.autoCreateRanges) {\n // Auto-create ranges\n if (rules.min != null && rules.max != null) {\n rules.range = [rules.min, rules.max];\n delete rules.min;\n delete rules.max;\n }\n\n if (rules.minlength != null && rules.maxlength != null) {\n rules.rangelength = [rules.minlength, rules.maxlength];\n delete rules.minlength;\n delete rules.maxlength;\n }\n }\n\n return rules;\n },\n // Converts a simple string to a {string: true} rule, e.g., \"required\" to {required:true}\n normalizeRule: function normalizeRule(data) {\n if (typeof data === \"string\") {\n var transformed = {};\n $.each(data.split(/\\s/), function () {\n transformed[this] = true;\n });\n data = transformed;\n }\n\n return data;\n },\n // https://jqueryvalidation.org/jQuery.validator.addMethod/\n addMethod: function addMethod(name, method, message) {\n $.validator.methods[name] = method;\n $.validator.messages[name] = message !== undefined ? message : $.validator.messages[name];\n\n if (method.length < 3) {\n $.validator.addClassRules(name, $.validator.normalizeRule(name));\n }\n },\n // https://jqueryvalidation.org/jQuery.validator.methods/\n methods: {\n // https://jqueryvalidation.org/required-method/\n required: function required(value, element, param) {\n // Check if dependency is met\n if (!this.depend(param, element)) {\n return \"dependency-mismatch\";\n }\n\n if (element.nodeName.toLowerCase() === \"select\") {\n // Could be an array for select-multiple or a string, both are fine this way\n var val = $(element).val();\n return val && val.length > 0;\n }\n\n if (this.checkable(element)) {\n return this.getLength(value, element) > 0;\n }\n\n return value !== undefined && value !== null && value.length > 0;\n },\n // https://jqueryvalidation.org/email-method/\n email: function email(value, element) {\n // From https://html.spec.whatwg.org/multipage/forms.html#valid-e-mail-address\n // Retrieved 2014-01-14\n // If you have a problem with this implementation, report a bug against the above spec\n // Or use custom methods to implement your own email validation\n return this.optional(element) || /^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(value);\n },\n // https://jqueryvalidation.org/url-method/\n url: function url(value, element) {\n // Copyright (c) 2010-2013 Diego Perini, MIT licensed\n // https://gist.github.com/dperini/729294\n // see also https://mathiasbynens.be/demo/url-regex\n // modified to allow protocol-relative URLs\n return this.optional(element) || /^(?:(?:(?:https?|ftp):)?\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?!(?:10|127)(?:\\.\\d{1,3}){3})(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})).?)(?::\\d{2,5})?(?:[/?#]\\S*)?$/i.test(value);\n },\n // https://jqueryvalidation.org/date-method/\n date: function () {\n var called = false;\n return function (value, element) {\n if (!called) {\n called = true;\n\n if (this.settings.debug && window.console) {\n console.warn(\"The `date` method is deprecated and will be removed in version '2.0.0'.\\n\" + \"Please don't use it, since it relies on the Date constructor, which\\n\" + \"behaves very differently across browsers and locales. Use `dateISO`\\n\" + \"instead or one of the locale specific methods in `localizations/`\\n\" + \"and `additional-methods.js`.\");\n }\n }\n\n return this.optional(element) || !/Invalid|NaN/.test(new Date(value).toString());\n };\n }(),\n // https://jqueryvalidation.org/dateISO-method/\n dateISO: function dateISO(value, element) {\n return this.optional(element) || /^\\d{4}[\\/\\-](0?[1-9]|1[012])[\\/\\-](0?[1-9]|[12][0-9]|3[01])$/.test(value);\n },\n // https://jqueryvalidation.org/number-method/\n number: function number(value, element) {\n return this.optional(element) || /^(?:-?\\d+|-?\\d{1,3}(?:,\\d{3})+)?(?:\\.\\d+)?$/.test(value);\n },\n // https://jqueryvalidation.org/digits-method/\n digits: function digits(value, element) {\n return this.optional(element) || /^\\d+$/.test(value);\n },\n // https://jqueryvalidation.org/minlength-method/\n minlength: function minlength(value, element, param) {\n var length = $.isArray(value) ? value.length : this.getLength(value, element);\n return this.optional(element) || length >= param;\n },\n // https://jqueryvalidation.org/maxlength-method/\n maxlength: function maxlength(value, element, param) {\n var length = $.isArray(value) ? value.length : this.getLength(value, element);\n return this.optional(element) || length <= param;\n },\n // https://jqueryvalidation.org/rangelength-method/\n rangelength: function rangelength(value, element, param) {\n var length = $.isArray(value) ? value.length : this.getLength(value, element);\n return this.optional(element) || length >= param[0] && length <= param[1];\n },\n // https://jqueryvalidation.org/min-method/\n min: function min(value, element, param) {\n return this.optional(element) || value >= param;\n },\n // https://jqueryvalidation.org/max-method/\n max: function max(value, element, param) {\n return this.optional(element) || value <= param;\n },\n // https://jqueryvalidation.org/range-method/\n range: function range(value, element, param) {\n return this.optional(element) || value >= param[0] && value <= param[1];\n },\n // https://jqueryvalidation.org/step-method/\n step: function step(value, element, param) {\n var type = $(element).attr(\"type\"),\n errorMessage = \"Step attribute on input type \" + type + \" is not supported.\",\n supportedTypes = [\"text\", \"number\", \"range\"],\n re = new RegExp(\"\\\\b\" + type + \"\\\\b\"),\n notSupported = type && !re.test(supportedTypes.join()),\n decimalPlaces = function decimalPlaces(num) {\n var match = (\"\" + num).match(/(?:\\.(\\d+))?$/);\n\n if (!match) {\n return 0;\n } // Number of digits right of decimal point.\n\n\n return match[1] ? match[1].length : 0;\n },\n toInt = function toInt(num) {\n return Math.round(num * Math.pow(10, decimals));\n },\n valid = true,\n decimals; // Works only for text, number and range input types\n // TODO find a way to support input types date, datetime, datetime-local, month, time and week\n\n\n if (notSupported) {\n throw new Error(errorMessage);\n }\n\n decimals = decimalPlaces(param); // Value can't have too many decimals\n\n if (decimalPlaces(value) > decimals || toInt(value) % toInt(param) !== 0) {\n valid = false;\n }\n\n return this.optional(element) || valid;\n },\n // https://jqueryvalidation.org/equalTo-method/\n equalTo: function equalTo(value, element, param) {\n // Bind to the blur event of the target in order to revalidate whenever the target field is updated\n var target = $(param);\n\n if (this.settings.onfocusout && target.not(\".validate-equalTo-blur\").length) {\n target.addClass(\"validate-equalTo-blur\").on(\"blur.validate-equalTo\", function () {\n $(element).valid();\n });\n }\n\n return value === target.val();\n },\n // https://jqueryvalidation.org/remote-method/\n remote: function remote(value, element, param, method) {\n if (this.optional(element)) {\n return \"dependency-mismatch\";\n }\n\n method = typeof method === \"string\" && method || \"remote\";\n var previous = this.previousValue(element, method),\n validator,\n data,\n optionDataString;\n\n if (!this.settings.messages[element.name]) {\n this.settings.messages[element.name] = {};\n }\n\n previous.originalMessage = previous.originalMessage || this.settings.messages[element.name][method];\n this.settings.messages[element.name][method] = previous.message;\n param = typeof param === \"string\" && {\n url: param\n } || param;\n optionDataString = $.param($.extend({\n data: value\n }, param.data));\n\n if (previous.old === optionDataString) {\n return previous.valid;\n }\n\n previous.old = optionDataString;\n validator = this;\n this.startRequest(element);\n data = {};\n data[element.name] = value;\n $.ajax($.extend(true, {\n mode: \"abort\",\n port: \"validate\" + element.name,\n dataType: \"json\",\n data: data,\n context: validator.currentForm,\n success: function success(response) {\n var valid = response === true || response === \"true\",\n errors,\n message,\n submitted;\n validator.settings.messages[element.name][method] = previous.originalMessage;\n\n if (valid) {\n submitted = validator.formSubmitted;\n validator.resetInternals();\n validator.toHide = validator.errorsFor(element);\n validator.formSubmitted = submitted;\n validator.successList.push(element);\n validator.invalid[element.name] = false;\n validator.showErrors();\n } else {\n errors = {};\n message = response || validator.defaultMessage(element, {\n method: method,\n parameters: value\n });\n errors[element.name] = previous.message = message;\n validator.invalid[element.name] = true;\n validator.showErrors(errors);\n }\n\n previous.valid = valid;\n validator.stopRequest(element, valid);\n }\n }, param));\n return \"pending\";\n }\n }\n }); // Ajax mode: abort\n // usage: $.ajax({ mode: \"abort\"[, port: \"uniqueport\"]});\n // if mode:\"abort\" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort()\n\n var pendingRequests = {},\n ajax; // Use a prefilter if available (1.5+)\n\n if ($.ajaxPrefilter) {\n $.ajaxPrefilter(function (settings, _, xhr) {\n var port = settings.port;\n\n if (settings.mode === \"abort\") {\n if (pendingRequests[port]) {\n pendingRequests[port].abort();\n }\n\n pendingRequests[port] = xhr;\n }\n });\n } else {\n // Proxy ajax\n ajax = $.ajax;\n\n $.ajax = function (settings) {\n var mode = (\"mode\" in settings ? settings : $.ajaxSettings).mode,\n port = (\"port\" in settings ? settings : $.ajaxSettings).port;\n\n if (mode === \"abort\") {\n if (pendingRequests[port]) {\n pendingRequests[port].abort();\n }\n\n pendingRequests[port] = ajax.apply(this, arguments);\n return pendingRequests[port];\n }\n\n return ajax.apply(this, arguments);\n };\n }\n\n return $;\n});","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n/*!\n * jQuery JavaScript Library v3.5.1\n * https://jquery.com/\n *\n * Includes Sizzle.js\n * https://sizzlejs.com/\n *\n * Copyright JS Foundation and other contributors\n * Released under the MIT license\n * https://jquery.org/license\n *\n * Date: 2020-05-04T22:49Z\n */\n(function (global, factory) {\n \"use strict\";\n\n if ((typeof module === \"undefined\" ? \"undefined\" : _typeof(module)) === \"object\" && _typeof(module.exports) === \"object\") {\n // For CommonJS and CommonJS-like environments where a proper `window`\n // is present, execute the factory and get jQuery.\n // For environments that do not have a `window` with a `document`\n // (such as Node.js), expose a factory as module.exports.\n // This accentuates the need for the creation of a real `window`.\n // e.g. var jQuery = require(\"jquery\")(window);\n // See ticket #14549 for more info.\n module.exports = global.document ? factory(global, true) : function (w) {\n if (!w.document) {\n throw new Error(\"jQuery requires a window with a document\");\n }\n\n return factory(w);\n };\n } else {\n factory(global);\n } // Pass this if window is not defined yet\n\n})(typeof window !== \"undefined\" ? window : this, function (window, noGlobal) {\n // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1\n // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode\n // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common\n // enough that all such attempts are guarded in a try block.\n \"use strict\";\n\n var arr = [];\n var getProto = Object.getPrototypeOf;\n var _slice = arr.slice;\n var flat = arr.flat ? function (array) {\n return arr.flat.call(array);\n } : function (array) {\n return arr.concat.apply([], array);\n };\n var push = arr.push;\n var indexOf = arr.indexOf;\n var class2type = {};\n var toString = class2type.toString;\n var hasOwn = class2type.hasOwnProperty;\n var fnToString = hasOwn.toString;\n var ObjectFunctionString = fnToString.call(Object);\n var support = {};\n\n var isFunction = function isFunction(obj) {\n // Support: Chrome <=57, Firefox <=52\n // In some browsers, typeof returns \"function\" for HTML