"use strict";(self.webpackChunkgulp_template=self.webpackChunkgulp_template||[]).push([[5278],{5456:function(t,e,n){var i=n(883),o=n(5836);window.addEventListener("DOMContentLoaded",(()=>{const t=document.querySelector(".js-buy-cards-form");if(new o.A("#datepicker",{timepicker:!0,weekends:[6,0],autoClose:!1}),t){const e=t.querySelectorAll(".js-cost-radio"),n=t.querySelector(".js-cost-input");e.length&&n&&(e.forEach((t=>{t.checked&&(n.value=t.value,n.dispatchEvent(new Event("input"))),t.addEventListener("change",(function(){n.value=this.value,n.dispatchEvent(new Event("input"))}))})),n.addEventListener("input",(function(){e.forEach((t=>{Number(t.value)===Number(this.value)?t.checked=!0:t.checked=!1}))})))}(0,i.A)(t)}))},883:function(t,e,n){n.d(e,{A:function(){return r}});var i=n(3016);function o(t,e,n,i,o,s,r){try{var a=t[s](r),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(i,o)}function s(t){return function(){var e=this,n=arguments;return new Promise((function(i,s){var r=t.apply(e,n);function a(t){o(r,i,s,a,c,"next",t)}function c(t){o(r,i,s,a,c,"throw",t)}a(void 0)}))}}function r(t,e,n=!0){t&&t.addEventListener("submit",function(){var o=s((function*(o){o.preventDefault();const s=this.querySelectorAll(".js-input-base[data-validations]:not(.novalidate)"),r=this.querySelectorAll(".js-select[data-validations]:not(.novalidate)"),a=Array.from(r).map((t=>(t.selectedOptions[0].classList.add(".js-select-option"),t.selectedOptions[0].dataset.validations=t.dataset.validations,t.selectedOptions[0]))),c=(0,i.MG)([...s,...a]);if(n&&c)if(t.classList.contains("js-registration-form")){let n=new FormData(t),i=yield fetch("/local/templates/stenova/ajax/checkEmail.php",{method:"POST",body:JSON.stringify({EMAIL:n.get("REGISTER[EMAIL]")})}),o=yield i.json();if(o.success)"function"==typeof e&&e(),function(t){const e=t.querySelectorAll('[name="UF_INN"]');let n="";for(const t of e)t.value?n=t.value:t.value=n;t.submit()}(t);else{const e=t.querySelector('[name="REGISTER[EMAIL]"]').closest(".input-base");e.classList.add("error"),e.querySelector(".input-base__error").textContent=o.message,e.style.marginBottom="2.8rem",e.scrollIntoView({block:"center",behavior:"smooth"})}}else t.classList.contains("js-buy-cards-form")?(document.addEventListener("capchaVerified",(()=>{ym(25098083,"reachGoal","oplata_cards"),this.submit()})),window.smartCaptcha.reset(),window.smartCaptcha.execute()):("function"==typeof e&&e(),this.submit())}));return function(t){return o.apply(this,arguments)}}())}},3016:function(t,e,n){n.d(e,{LF:function(){return s},M2:function(){return c},MG:function(){return g},Nh:function(){return d},X5:function(){return u},bB:function(){return r},lZ:function(){return o},tJ:function(){return l}});const i=t=>!isNaN(Number(t.trim())),o=t=>11===String(t).replace(/[^\d]/g,"").substring(0,11).length,s=t=>new RegExp(/^(\+?\d)\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{2})[- ]?(\d{2})$/).test(t),r=t=>i(t)&&12===String(t.trim()).length,a=t=>new RegExp(/^[^@]+@[\w\-]+(\.\w+)+\w$/).test(t)||0===t.trim().length,c=t=>i(t)&&6===String(t).length,l=t=>{let e=!0;for(let n=0;n10){e=!1;break}return e},u=t=>t.files.length<=10,d=(t,e,n=".input-base",i="RU")=>{const o=t.closest(n);if(o){const t=o.querySelector(`${n}__error`);o.classList.add(h),t&&(t.innerText=f[e].text[i])}},m=t=>{const e=t.closest(".input-base-captcha")||t.closest(".input-base")||t.closest(".input-file-base")||t.closest(".js-select-wrapper"),n=document.querySelector(".js-navigation");if(e&&n){const t=e.getBoundingClientRect();document.querySelector('.dialog:not([aria-hidden="true"])')?document.querySelector('.dialog:not([aria-hidden="true"]) .dialog-wrapper').scrollTo({top:e.offsetTop-30,behavior:"smooth"}):window.scrollTo({top:t.top+window.pageYOffset-n.clientHeight-60,behavior:"smooth"})}},f={required:{text:{RU:"Поле должно быть заполнено",EN:"Field must be filled"},action:t=>0!==String(t).length},requiredFiles:{text:{RU:"Поле должно быть заполнено",EN:"Field must be filled"},action:t=>t.files&&t.files.length},phone:{text:{RU:"Номер телефона должен состоять из 11 цифр",EN:"Phone number must be 11 digits"},action:o},inn:{text:{RU:"ИНН должен состоять из 10 или 12 цифр",EN:"TIN must be 10 or 12 digits"},action:t=>i(t)&&(10===String(t.trim()).length||12===String(t.trim()).length)},innIP:{text:{RU:"ИНН должен состоять из 12 цифр",EN:"TIN must be 12 digits"},action:r},kpp:{text:{RU:"КПП должен состоять из 9 цифр",EN:"PPC must consist of 9 digits"},action:t=>i(t)&&9===String(t.trim()).length||0===String(t.trim()).length},email:{text:{RU:"Формат почты: name@domain.ru",EN:"Mail format: name@domain.ru"},action:a},onlyNumbers:{text:{RU:"Поле должно содержать только цифры",EN:"The field must contain only numbers"},action:i},cardNumber:{text:{RU:"Номер карты должен состоять из 15 цифр",EN:"Card number must be 15 digits"},action:t=>{const e=t.replace(/\s/g,"");return 15===e.length&&i(e)||0===e.length}},cost:{text:{RU:"Поле должно состоять только из цифр",EN:"The field must contain only numbers"},action:t=>{const e=t.replace(/\s/g,"");return i(e)||0===e.length}},password:{text:{RU:"Пароль должен содержать не менее 8 символов",EN:"Password must contain at least 8 characters"},action:t=>t.length>7||0===t.length},confirmPassword:{text:{RU:"Пароли должны совпадать",EN:"Passwords must match"},action:({oldPassword:t,newPassword:e})=>t===e},korCheck:{text:{RU:"Корреспондентский счет должен состоять из 11 цифр",EN:"Correspondent account must be 11 digits"},action:t=>i(t)&&11===String(t.trim()).length||0===String(t.trim()).length},payCheck:{text:{RU:"Расчетный счет должен состоять из 14 цифр",EN:"Account must be 14 digits long"},action:t=>i(t)&&14===String(t.trim()).length||0===String(t.trim()).length},bik:{text:{RU:"БИК должен состоять из 12 цифр",EN:"BIC must be 12 digits"},action:t=>i(t)&&12===String(t.trim()).length||0===String(t.trim()).length},phoneOrEmail:{text:{RU:"Не корректно заполнен email или телефон",EN:"Incorrectly filled email or phone"},action:t=>s(t)||a(t)||0===String(t.trim()).length},confirmCode:{text:{RU:"Код должен состоять из 6 цифр",EN:"Code must be 6 digits"},action:c},fileMaxWeight:{text:{RU:"Вес одного файла должен быть не более 10 Мбайт",EN:"The weight of one file should be no more than 10 MB"},action:l},filesMaxCount:{text:{RU:"Можно загрузить не более 10 файлов",EN:"You can upload a maximum of 10 files"},action:u},doNotConfirmPhone:{text:{RU:"Номер должен быть подтвержден",EN:"Number must be confirmed"},action:t=>!1},nominalMin1000:{text:{RU:"Номинал карты не может быть менее 1000",EN:"The denomination of the card cannot be less than 1000"},action:t=>t>=1e3}},h="error";function g(t){let e=!0,n=null;if(t.length){const i=document.querySelectorAll(".js-language-radio");let o="RU";if(0!==i.length){const t=Array.from(i).find((t=>t.checked));o=t.value}t.forEach((t=>{const i=t.dataset.validations.split(",");for(let n of i){let i=".input-base",r=t.classList.contains("js-file-input")?{files:t.files,maxWeight:10}:t.value;if(t.classList.contains("js-file-input")&&(i=".input-file-base"),t.classList.contains(".js-select-option")&&(i=".select-wrapper"),"confirmPassword"===n){const e=t.closest(".js-form-container");if(e){var s;const n=(null===(s=e.querySelector(".js-input-password"))||void 0===s?void 0:s.value)||null;n&&(r={oldPassword:n,newPassword:t.value})}}if(!f[n].action(r)){e&&(e=!1),d(t,n,i,o);break}}e||n||(n=t)}))}return n&&m(n),e}}},function(t){t.O(0,[8096],(function(){return t(t.s=5456)})),t.O()}]);