{"version":3,"sources":["webpack://cyt-item-availability-notification/webpack/runtime/compat","webpack://cyt-item-availability-notification/./resources/js/src/components/itemAvailabilityNotification.component.vue?6b89","webpack://cyt-item-availability-notification/./resources/js/src/components/itemAvailabilityNotification.component.vue","webpack://cyt-item-availability-notification/./node_modules/vue-loader/lib/runtime/componentNormalizer.js","webpack://cyt-item-availability-notification/resources/js/src/components/itemAvailabilityNotification.component.vue","webpack://cyt-item-availability-notification/./resources/js/src/app.js"],"names":["jsonpScriptSrc","original_jsonpScriptSrc","__loadPluginChunk","Error","newSrc","apply","this","arguments","e","console","error","render","_vm","_h","$createElement","_c","_self","componentLoading","_e","directives","name","rawName","value","isVisible","expression","staticClass","on","submit","$event","preventDefault","_t","_v","attrs","for","_uid","_s","$translate","mailValue","type","autocomplete","id","disabled","isLoading","domProps","input","target","composing","hasPrivacyHint","requirePrivacyCheck","privacyAccepted","checked","Array","isArray","_i","change","$$a","$$el","$$c","$$i","concat","slice","hasRecaptchaKey","honeypot","tabindex","submitDisabled","_withStripped","component","scriptExports","staticRenderFns","functionalTemplate","injectStyles","scopeId","moduleIdentifier","shadowMode","hook","options","_compiled","functional","_injectStyles","originalRender","h","context","call","existing","beforeCreate","exports","data","inject","itemId","default","props","mail","String","required","visibility","comparison","Boolean","$store","watch","$nextTick","computed","methods","__file","Vue","ItemAvailabilityNotification"],"mappings":"yBAIA,GAA8B,mBAAnBA,eAA+B,CACxC,IAAIC,EAA0BD,eAkB9BA,eAjBA,WACE,IACE,GAAiC,mBAAtBE,kBACT,MAAM,IAAIC,MAAM,8JAElB,IAAIC,EAASF,kBAAkBD,EAAwBI,MAAMC,KAAMC,YACnE,IAAKH,GAA4B,iBAAXA,EACpB,MAAM,IAAID,MAAM,uIAElB,OAAOC,EACP,MAAOI,GAIP,OAFEC,QAAQC,MAAMF,GAETP,EAAwBI,MAAMC,KAAMC,aCpBjD,IAAII,EAAS,WACX,IAAIC,EAAMN,KACNO,EAAKD,EAAIE,eACTC,EAAKH,EAA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,sCAkCM,OAhCN,uBACQ,EAAR,qBACA,6CACY,OAAZ,mBACA,wCACA,CAAc,OAAd,aACA,UACA,EACgB,EAAhB,GAGgB,QAKJ,OAAZ,wCACY,EACZ,+CACA,2CACA,eACgB,EAAhB,iBAGgB,OAAhB,sCACgB,aAOhB,GAGI,eAAJ,GACA,iEACQ,OAAR,uBFjTE1F,GA4BFuD,EAAUS,QAAQ2B,OAAS,yEAC3B,MAAepC,E,QGlCXqC,IAAIrC,UAAU,qCAAsCsC,G","file":"client.min.js","sourcesContent":["\n// WebpackRequireFrom - monkey-patching\n\n\nif (typeof jsonpScriptSrc === 'function') {\n  var original_jsonpScriptSrc = jsonpScriptSrc;\n  function patchJsonpScriptSrc () {\n    try {\n      if (typeof __loadPluginChunk !== \"function\") {\n        throw new Error(\"WebpackRequireFrom: '__loadPluginChunk' is not a function or not available at runtime. See https://github.com/agoldis/webpack-require-from#troubleshooting\");\n      }\n      var newSrc = __loadPluginChunk(original_jsonpScriptSrc.apply(this, arguments));\n      if (!newSrc || typeof newSrc !== 'string') {\n        throw new Error(\"WebpackRequireFrom: '__loadPluginChunk' does not return string. See https://github.com/agoldis/webpack-require-from#troubleshooting\");\n      }\n      return newSrc;\n    } catch (e) {\n      if (!false) {\n        console.error(e);\n      }\n      return original_jsonpScriptSrc.apply(this, arguments);\n    }\n  }\n  jsonpScriptSrc = patchJsonpScriptSrc\n}","var render = function() {\n  var _vm = this\n  var _h = _vm.$createElement\n  var _c = _vm._self._c || _h\n  return !_vm.componentLoading\n    ? _c(\"div\", [\n        _c(\n          \"form\",\n          {\n            directives: [\n              {\n                name: \"show\",\n                rawName: \"v-show\",\n                value: _vm.isVisible,\n                expression: \"isVisible\"\n              }\n            ],\n            staticClass: \"cyt-availability-notification\",\n            on: {\n              submit: function($event) {\n                $event.preventDefault()\n                return _vm.submit($event)\n              }\n            }\n          },\n          [\n            _vm._t(\"before\"),\n            _vm._v(\" \"),\n            _c(\n              \"div\",\n              {\n                staticClass: \"input input-unit\",\n                attrs: { \"data-validate\": \"mail\" }\n              },\n              [\n                _c(\"label\", { attrs: { for: \"mail_\" + _vm._uid } }, [\n                  _vm._v(\n                    _vm._s(\n                      _vm.$translate(\n                        \"cytItemAvailabilityNotification::Template.mailInputLabel\"\n                      )\n                    )\n                  )\n                ]),\n                _vm._v(\" \"),\n                _c(\"input\", {\n                  directives: [\n                    {\n                      name: \"model\",\n                      rawName: \"v-model\",\n                      value: _vm.mailValue,\n                      expression: \"mailValue\"\n                    }\n                  ],\n                  attrs: {\n                    type: \"email\",\n                    autocomplete: \"email\",\n                    id: \"mail_\" + _vm._uid,\n                    disabled: _vm.isLoading\n                  },\n                  domProps: { value: _vm.mailValue },\n                  on: {\n                    input: function($event) {\n                      if ($event.target.composing) {\n                        return\n                      }\n                      _vm.mailValue = $event.target.value\n                    }\n                  }\n                })\n              ]\n            ),\n            _vm._v(\" \"),\n            _c(\n              \"div\",\n              {\n                directives: [\n                  {\n                    name: \"show\",\n                    rawName: \"v-show\",\n                    value: _vm.hasPrivacyHint && _vm.requirePrivacyCheck,\n                    expression: \"hasPrivacyHint && requirePrivacyCheck\"\n                  }\n                ],\n                staticClass: \"form-check small mb-3\"\n              },\n              [\n                _c(\"input\", {\n                  directives: [\n                    {\n                      name: \"show\",\n                      rawName: \"v-show\",\n                      value: _vm.requirePrivacyCheck,\n                      expression: \"requirePrivacyCheck\"\n                    },\n                    {\n                      name: \"model\",\n                      rawName: \"v-model\",\n                      value: _vm.privacyAccepted,\n                      expression: \"privacyAccepted\"\n                    }\n                  ],\n                  staticClass: \"form-check-input\",\n                  attrs: {\n                    type: \"checkbox\",\n                    id: \"cyt_privacy_check_\" + _vm._uid\n                  },\n                  domProps: {\n                    checked: Array.isArray(_vm.privacyAccepted)\n                      ? _vm._i(_vm.privacyAccepted, null) > -1\n                      : _vm.privacyAccepted\n                  },\n                  on: {\n                    change: function($event) {\n                      var $$a = _vm.privacyAccepted,\n                        $$el = $event.target,\n                        $$c = $$el.checked ? true : false\n                      if (Array.isArray($$a)) {\n                        var $$v = null,\n                          $$i = _vm._i($$a, $$v)\n                        if ($$el.checked) {\n                          $$i < 0 && (_vm.privacyAccepted = $$a.concat([$$v]))\n                        } else {\n                          $$i > -1 &&\n                            (_vm.privacyAccepted = $$a\n                              .slice(0, $$i)\n                              .concat($$a.slice($$i + 1)))\n                        }\n                      } else {\n                        _vm.privacyAccepted = $$c\n                      }\n                    }\n                  }\n                }),\n                _vm._v(\" \"),\n                _c(\n                  \"label\",\n                  {\n                    staticClass: \"form-check-label\",\n                    attrs: { for: \"cyt_privacy_check_\" + _vm._uid }\n                  },\n                  [_vm._t(\"privacyhint\")],\n                  2\n                )\n              ]\n            ),\n            _vm._v(\" \"),\n            _c(\n              \"div\",\n              {\n                directives: [\n                  {\n                    name: \"show\",\n                    rawName: \"v-show\",\n                    value: _vm.hasPrivacyHint && !_vm.requirePrivacyCheck,\n                    expression: \"hasPrivacyHint && !requirePrivacyCheck\"\n                  }\n                ],\n                staticClass: \"privacy-hint small mb-3\"\n              },\n              [_vm._t(\"privacyhint\")],\n              2\n            ),\n            _vm._v(\" \"),\n            _vm.hasRecaptchaKey ? _c(\"div\", [_c(\"recaptcha\")], 1) : _vm._e(),\n            _vm._v(\" \"),\n            _c(\"input\", {\n              directives: [\n                {\n                  name: \"model\",\n                  rawName: \"v-model\",\n                  value: _vm.honeypot,\n                  expression: \"honeypot\"\n                }\n              ],\n              staticClass: \"honey\",\n              attrs: {\n                type: \"text\",\n                name: \"username\",\n                autocomplete: \"new-password\",\n                tabindex: \"-1\"\n              },\n              domProps: { value: _vm.honeypot },\n              on: {\n                input: function($event) {\n                  if ($event.target.composing) {\n                    return\n                  }\n                  _vm.honeypot = $event.target.value\n                }\n              }\n            }),\n            _vm._v(\" \"),\n            _c(\n              \"button\",\n              {\n                staticClass: \"btn btn-primary btn-appearance\",\n                attrs: { type: \"submit\", disabled: _vm.submitDisabled }\n              },\n              [\n                _vm._v(\n                  \"\\n      \" +\n                    _vm._s(\n                      _vm.$translate(\n                        \"cytItemAvailabilityNotification::Template.submitLabel\"\n                      )\n                    ) +\n                    \"\\n    \"\n                )\n              ]\n            ),\n            _vm._v(\" \"),\n            _vm._t(\"after\")\n          ],\n          2\n        )\n      ])\n    : _vm._e()\n}\nvar staticRenderFns = []\nrender._withStripped = true\n\nexport { render, staticRenderFns }","import { render, staticRenderFns } from \"./itemAvailabilityNotification.component.vue?vue&type=template&id=42d306f0&\"\nimport script from \"./itemAvailabilityNotification.component.vue?vue&type=script&lang=js&\"\nexport * from \"./itemAvailabilityNotification.component.vue?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n  script,\n  render,\n  staticRenderFns,\n  false,\n  null,\n  null,\n  null\n  \n)\n\n/* hot reload */\nif (module.hot) {\n  var api = require(\"/Users/ihhu/workspace/cyt/item-availability-notification/node_modules/vue-hot-reload-api/dist/index.js\")\n  api.install(require('vue'))\n  if (api.compatible) {\n    module.hot.accept()\n    if (!api.isRecorded('42d306f0')) {\n      api.createRecord('42d306f0', component.options)\n    } else {\n      api.reload('42d306f0', component.options)\n    }\n    module.hot.accept(\"./itemAvailabilityNotification.component.vue?vue&type=template&id=42d306f0&\", function () {\n      api.rerender('42d306f0', {\n        render: render,\n        staticRenderFns: staticRenderFns\n      })\n    })\n  }\n}\ncomponent.options.__file = \"resources/js/src/components/itemAvailabilityNotification.component.vue\"\nexport default component.exports","/* globals __VUE_SSR_CONTEXT__ */\n\n// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).\n// This module is a runtime utility for cleaner component module output and will\n// be included in the final webpack user bundle.\n\nexport default function normalizeComponent (\n  scriptExports,\n  render,\n  staticRenderFns,\n  functionalTemplate,\n  injectStyles,\n  scopeId,\n  moduleIdentifier, /* server only */\n  shadowMode /* vue-cli only */\n) {\n  // Vue.extend constructor export interop\n  var options = typeof scriptExports === 'function'\n    ? scriptExports.options\n    : scriptExports\n\n  // render functions\n  if (render) {\n    options.render = render\n    options.staticRenderFns = staticRenderFns\n    options._compiled = true\n  }\n\n  // functional template\n  if (functionalTemplate) {\n    options.functional = true\n  }\n\n  // scopedId\n  if (scopeId) {\n    options._scopeId = 'data-v-' + scopeId\n  }\n\n  var hook\n  if (moduleIdentifier) { // server build\n    hook = function (context) {\n      // 2.3 injection\n      context =\n        context || // cached call\n        (this.$vnode && this.$vnode.ssrContext) || // stateful\n        (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n      // 2.2 with runInNewContext: true\n      if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n        context = __VUE_SSR_CONTEXT__\n      }\n      // inject component styles\n      if (injectStyles) {\n        injectStyles.call(this, context)\n      }\n      // register component module identifier for async chunk inferrence\n      if (context && context._registeredComponents) {\n        context._registeredComponents.add(moduleIdentifier)\n      }\n    }\n    // used by ssr in case component is cached and beforeCreate\n    // never gets called\n    options._ssrRegister = hook\n  } else if (injectStyles) {\n    hook = shadowMode\n      ? function () {\n        injectStyles.call(\n          this,\n          (options.functional ? this.parent : this).$root.$options.shadowRoot\n        )\n      }\n      : injectStyles\n  }\n\n  if (hook) {\n    if (options.functional) {\n      // for template-only hot-reload because in that case the render fn doesn't\n      // go through the normalizer\n      options._injectStyles = hook\n      // register for functional component in vue file\n      var originalRender = options.render\n      options.render = function renderWithStyleInjection (h, context) {\n        hook.call(context)\n        return originalRender(h, context)\n      }\n    } else {\n      // inject component registration as beforeCreate hook\n      var existing = options.beforeCreate\n      options.beforeCreate = existing\n        ? [].concat(existing, hook)\n        : [hook]\n    }\n  }\n\n  return {\n    exports: scriptExports,\n    options: options\n  }\n}\n","<template>\n  <div v-if=\"!componentLoading\">\n    <form class=\"cyt-availability-notification\" @submit.prevent=\"submit($event)\" v-show=\"isVisible\">\n      <slot name=\"before\"></slot>\n\n      <div class=\"input input-unit\" data-validate=\"mail\">\n        <label :for=\"'mail_' + _uid\">{{\n          $translate(\"cytItemAvailabilityNotification::Template.mailInputLabel\")\n          }}</label>\n        <input type=\"email\" autocomplete=\"email\" :id=\"'mail_' + _uid\" v-model=\"mailValue\" :disabled=\"isLoading\">\n      </div>\n\n      <div class=\"form-check small mb-3\" v-show=\"hasPrivacyHint && requirePrivacyCheck\">\n        <input class=\"form-check-input\" v-show=\"requirePrivacyCheck\" type=\"checkbox\" v-model=\"privacyAccepted\"\n          :id=\"'cyt_privacy_check_' + _uid\">\n\n        <label class=\"form-check-label\" :for=\"'cyt_privacy_check_' + _uid\">\n          <slot name=\"privacyhint\"></slot>\n        </label>\n      </div>\n\n      <div class=\"privacy-hint small mb-3\" v-show=\"hasPrivacyHint && !requirePrivacyCheck\">\n        <slot name=\"privacyhint\"></slot>\n      </div>\n\n      <div v-if=\"hasRecaptchaKey\">\n        <recaptcha></recaptcha>\n      </div>\n\n      <input class=\"honey\" type=\"text\" name=\"username\" autocomplete=\"new-password\" tabindex=\"-1\" v-model=\"honeypot\">\n\n      <button type=\"submit\" class=\"btn btn-primary btn-appearance\" :disabled=\"submitDisabled\">\n        {{ $translate(\"cytItemAvailabilityNotification::Template.submitLabel\") }}\n      </button>\n\n      <slot name=\"after\"></slot>\n    </form>\n  </div>\n</template>\n\n<script>\nexport default {\n  data() {\n    return {\n      mailValue: \"\",\n      isLoading: false,\n      privacyAccepted: false,\n      componentLoading: true,\n      honeypot: \"\",\n    }\n  },\n\n  inject: {\n    itemId: {\n      default: null\n    }\n  },\n\n  props: {\n    mail: {\n      type: String,\n      default: \"\",\n      required: false\n    },\n\n    visibility: {\n      type: Array,\n      default: ['availability', 'gte', 5, false]\n    },\n\n    comparison: {\n      type: Array,\n      default: ['availability', 'lt', 5]\n    },\n\n    requirePrivacyCheck: {\n      type: Boolean,\n      default: false,\n      required: false\n    }\n  },\n\n  mounted() {\n    this.mailValue = this.mail || \"\";\n    this.$store.watch(\n        (state) => {\n          return state.user.userData;\n        },\n        (userData) => {\n          if (!this.mailValue && userData && userData.email) {\n            this.mailValue = userData.email;\n          }\n        }\n    )\n  },\n\n  created () {\n    this.$nextTick(() => {\n      this.componentLoading = false;\n    });\n  },\n\n  computed:\n      {\n        variation() {\n          const currentVariation = this.$store.getters[`${this.itemId}/currentItemVariation`];\n          return currentVariation && currentVariation.variation ? currentVariation : null;\n        },\n\n        availability() {\n          const currentVariation = this.variation;\n          return !!currentVariation\n              ? currentVariation.variation.availability.id\n              : 0;\n        },\n\n        article() {\n          const currentVariation = this.$store.getters[`${this.itemId}/currentItemVariation`];\n          return currentVariation.item.id ? currentVariation.item.id : null;\n        },\n\n        name() {\n          const currentVariation = this.$store.getters[`${this.itemId}/currentItemVariation`];\n          return currentVariation.texts.name1 ? currentVariation.texts.name1 : null;\n        },\n\n        image() {\n          const currentVariation = this.$store.getters[`${this.itemId}/currentItemVariation`];\n          return currentVariation.images.all[0].urlPreview ? currentVariation.images.all[0].urlPreview : null;\n        },\n\n\n        stock() {\n          const currentVariation = this.variation;\n          return (!!currentVariation && !!currentVariation.stock)\n              ? currentVariation.stock.net\n              : 0;\n        },\n\n        submitDisabled() {\n          return this.isLoading || (this.requirePrivacyCheck && this.hasPrivacyHint && !this.privacyAccepted);\n        },\n\n        hasPrivacyHint() {\n          return !!this.$slots.privacyhint;\n        },\n\n        hasRecaptchaKey() {\n          return !!App.config.global.googleRecaptchaApiKey;\n        },\n\n        isVisible() {\n          if (App.isShopBuilder) {\n            return true;\n          }\n\n          const variationCount = this.$store.state.items.hasOwnProperty(this.itemId) ? this.$store.state.items[this.itemId].variationSelect.variations.length : 0;\n          if (this.visibility[3] // component is configured to not be displayed for main variations\n              && variationCount > 1 // and current item has different variations (the main variation itself is also take in count)\n              && (!this.variation.variation.mainVariationId || this.variation.variation.mainVariationId === this.variation.variation.id) // and current variation is the main variation\n          ) {\n            // do not display the form for main variation if configured\n            return false;\n          }\n\n          const stockLimitation = parseInt(this.variation.variation.stockLimitation)\n          if (this.visibility[0] === 'stock' && (stockLimitation === 0 || stockLimitation === 2)) {\n            // do not display form if variation is not limited on stock.\n            return false;\n          }\n\n          const currentValue = this.getCurrentValueForCondition(this.visibility);\n          const expectedValue = this.getComparisonValue(this.visibility);\n          switch (this.visibility[1]) {\n            case 'lte':\n              return currentValue <= expectedValue;\n            case 'lt':\n              return currentValue < expectedValue;\n            case 'gte':\n              return currentValue >= expectedValue;\n            case 'gt':\n              return currentValue > expectedValue;\n            case 'eq':\n            default:\n              return currentValue === expectedValue;\n          }\n        }\n      },\n\n  methods:\n      {\n        isValid() {\n          const mailRegEx = new RegExp(/^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/);\n          return mailRegEx.test(this.mailValue);\n        },\n\n        getCurrentValueForCondition(condition) {\n          if (condition[0] === 'availability') {\n            return this.availability;\n          } else {\n            return this.stock;\n          }\n        },\n\n        getComparisonValue(condition) {\n          return condition[2] === null ? this.getCurrentValueForCondition(condition) : condition[2];\n        },\n\n        submit(event) {\n          if (this.submitDisabled) {\n            return;\n          }\n\n          if (!!this.variation && this.isValid() && !this.isLoading) {\n\n            const recaptchaEl = event.target.querySelector(\"[data-recaptcha]\");\n\n            if (App.config.global.googleRecaptchaApiKey && (!window.grecaptcha || !recaptchaEl)) {\n              window.CeresNotification && window.CeresNotification.error(this.$translate(\"cytItemAvailabilityNotification::Template.subscriptionReCaptchaFailed\"));\n              return;\n            }\n\n            this.isLoading = true;\n\n            this.executeReCaptcha(event.target)\n              .then((recaptchaResponse) => {\n                $.ajax(\n                  \"/rest/cyt/item_availability\",\n                  {\n                    method: \"POST\",\n                    dataType: \"json\",\n                    data: {\n                      variationId: this.variation.variation.id,\n                      articleId: this.article,\n                      name: this.name,\n                      image: this.image,\n                      mail: this.mailValue,\n                      comparisonField: this.comparison[0],\n                      comparisonType: this.comparison[1],\n                      comparisonValue: this.getComparisonValue(this.comparison),\n                      recaptchaToken: recaptchaResponse,\n                      honeypot: this.honeypot\n                    }\n                  })\n                  .done((response) => {\n                    this.isLoading = false;\n                    this.mailValue = \"\";\n                    this.privacyAccepted = false;\n                    this.resetRecaptcha(recaptchaEl);\n                    window.CeresNotification && window.CeresNotification.success(\n                      this.$translate(\"cytItemAvailabilityNotification::Template.subscriptionSucceed\")\n                    );\n                  })\n                  .fail((err) => {\n                    this.isLoading = false;\n                    this.resetRecaptcha(recaptchaEl);\n                    window.CeresNotification && window.CeresNotification.error(\n                      this.$translate(\"cytItemAvailabilityNotification::Template.subscriptionFailed\")\n                    );\n                  });\n              })\n              .catch((error) => {\n                window.CeresNotification && window.CeresNotification.error(\n                  this.$translate(\"cytItemAvailabilityNotification::Template.subscriptionReCaptchaFailed\")\n                );\n              });\n          } else {\n            window.CeresNotification && window.CeresNotification.error(\n                this.$translate(\"cytItemAvailabilityNotification::Template.invalidMail\")\n            );\n          }\n        },\n\n        executeReCaptcha(form) {\n          let response = Promise.resolve(null);\n          const recaptchaElement = form.querySelector(\"[data-recaptcha]\");\n\n          if (window.grecaptcha && recaptchaElement) {\n            response = new Promise((resolve, reject) => {\n              if (App.config.global.googleRecaptchaVersion === 3) {\n                window.grecaptcha.execute(\n                  App.config.global.googleRecaptchaApiKey,\n                  { action: \"homepage\" }\n                ).then(response => {\n                  if (response) {\n                    resolve(response);\n                  }\n                  else {\n                    reject();\n                  }\n                });\n              }\n              else {\n                window.grecaptcha.execute(recaptchaElement.dataset.recaptcha);\n                recaptchaElement\n                  .querySelector(\"[name=\\\"g-recaptcha-response\\\"]\")\n                  .addEventListener(\"recaptcha-response\", (evt) => {\n                    if (evt.target.value) {\n                      resolve(evt.target.value);\n                    }\n                    else {\n                      window.grecaptcha.reset(recaptchaElement.dataset.recaptcha);\n                      reject();\n                    }\n                  });\n              }\n            });\n          }\n\n          return response;\n        },\n\n        resetRecaptcha(recaptchaEl) {\n          if (App.config.global.googleRecaptchaVersion === 2 && window.grecaptcha) {\n            window.grecaptcha.reset(recaptchaEl);\n          }\n        }\n      }\n}\n</script>\n","import ItemAvailabilityNotification from \"./components/itemAvailabilityNotification.component.vue\";\n\nexport function createApp()\n{\n    Vue.component(\"cyt-item-availability-notification\", ItemAvailabilityNotification);\n}\n"],"sourceRoot":""}