"use strict";(self.webpackChunkgulp_template=self.webpackChunkgulp_template||[]).push([[4313],{883:function(e,t,n){n.d(t,{A:function(){return l}});var i=n(3016);function o(e,t,n,i,o,s,l){try{var r=e[s](l),a=r.value}catch(e){return void n(e)}r.done?t(a):Promise.resolve(a).then(i,o)}function s(e){return function(){var t=this,n=arguments;return new Promise(function(i,s){var l=e.apply(t,n);function r(e){o(l,i,s,r,a,"next",e)}function a(e){o(l,i,s,r,a,"throw",e)}r(void 0)})}}function l(e,t,n=!0){e&&e.addEventListener("submit",function(o){return s(function*(){o.preventDefault();const s=this.querySelectorAll(".js-input-base[data-validations]:not(.novalidate)"),l=this.querySelectorAll(".js-select[data-validations]:not(.novalidate)"),r=Array.from(l).map(e=>(e.selectedOptions[0].classList.add(".js-select-option"),e.selectedOptions[0].dataset.validations=e.dataset.validations,e.selectedOptions[0])),a=(0,i.MG)([...s,...r]);if(n&&a)if(e.classList.contains("js-registration-form")){let n=new FormData(e),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 t&&t(),function(e){const t=e.querySelectorAll('[name="UF_INN"]');let n="";for(const e of t)e.value?n=e.value:e.value=n;e.submit()}(e);else{const t=e.querySelector('[name="REGISTER[EMAIL]"]').closest(".input-base");t.classList.add("error"),t.querySelector(".input-base__error").textContent=o.message,t.style.marginBottom="2.8rem",t.scrollIntoView({block:"center",behavior:"smooth"})}}else e.classList.contains("js-buy-cards-form")?(document.addEventListener("capchaVerified",()=>{ym(25098083,"reachGoal","oplata_cards"),this.submit()}),window.smartCaptcha.reset(),window.smartCaptcha.execute()):("function"==typeof t&&t(),this.submit())}).call(this)})}},2785:function(e,t,n){function i(e,t){const n=Math.abs(e)%100,i=e%10;return n>10&&n<20?t[2]:i>1&&i<5?t[1]:1==i?t[0]:t[2]}n.d(t,{t:function(){return c},k:function(){return u}});var o=n(3016);let s=[];function l(e){const t=new DataTransfer;for(const n of e)t.items.add(n);return t.files}function r(e,t,n){const i=function(e){const t=document.createElement("template"),n=`\n
\n `;for(let i=0;i{const s=i.querySelector(".js-file-name"),l=i.querySelector(".js-delete-file");s.innerText=function(e){return e.length>13?`${e.substring(0,6)}...${e.substring(e.length-6)}`:e}(t.files[o].name),l.addEventListener("click",function(){a.call(this,e,t,n)})}),e.append(...i))}function a(e,t,n){const o=e.closest(".js-file-input-container"),r=e.querySelectorAll(".js-file"),a=this.closest(".js-file");if(r.length&&a){const c=Array.from(r).findIndex(e=>a===e);-1!==c&&(s.splice(c,1),t.files=l(s),e.removeChild(a),o.classList.contains("error")&&o.classList.remove("error"),s.length?n.innerText=`${s.length} ${i(s.length,["файл","файла","файлов"])} ${i(s.length,["выбран","выбраны","выбраны"])}`:n.innerText=n.dataset.placeholder)}}function c(){const e=document.querySelectorAll(".js-file-input-container");s=[],e.length&&e.forEach(e=>{const t=e.querySelector(".js-file-input-info"),n=e.querySelector(".js-files-container");t.innerText=t.dataset.placeholder,n.innerHTML=""})}function u(){const e=document.querySelectorAll(".js-file-input-container"),t=document.querySelector(".js-language-radio:checked")?document.querySelector(".js-language-radio:checked").value:"RU";e.length&&e.forEach(e=>{const n=e.querySelector(".js-files-container"),a=e.querySelector(".js-file-input"),c=e.querySelector(".js-file-input-info");a&&c&&a.addEventListener("change",u=>{const d=s.length;u.target.files.length&&(u.target.hasAttribute("multiple")||(s=[],n.firstChild&&n.removeChild(n.firstChild)),s.push(...u.target.files));const f=function(e,t){const n={files:t||[],maxWeight:10},i={maxWeight:(0,o.tJ)(n),maxCount:(0,o.X5)(n)},s=document.querySelector(".js-language-radio:checked")?document.querySelector(".js-language-radio:checked").value:"RU";return i.maxWeight?!!i.maxCount||((0,o.Nh)(e,"filesMaxCount",".input-file-base",s),i.maxCount):((0,o.Nh)(e,"fileMaxWeight",".input-file-base",s),i.maxWeight)}(u.target,s);if(f?e.classList.contains("error")&&e.classList.remove("error"):(s=s.slice(0,d),u.target.value=""),s.length){const e="RU"===t?["файл","файла","файлов"]:["file","files","files"],n="RU"===t?["выбран","выбраны","выбраны"]:["selected","selected","selected"];c.innerText=`${s.length} ${i(s.length,e)} ${i(s.length,n)}`}else c.innerText=c.dataset.placeholder;r(n,a,c),u.target.files=l(s)})})}},3016:function(e,t,n){n.d(t,{MG:function(){return p}});const i=e=>!isNaN(Number(e.trim())),o=e=>11===String(e).replace(/[^\d]/g,"").substring(0,11).length,s=e=>new RegExp(/^(\+?\d)\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{2})[- ]?(\d{2})$/).test(e),l=e=>i(e)&&12===String(e.trim()).length,r=e=>new RegExp(/^[^@]+@[\w\-]+(\.\w+)+\w$/).test(e)||0===e.trim().length,a=e=>new RegExp(/^[^@]+@[\w\-]+(\.\w+)*\.ru$/).test(e)||0===e.trim().length,c=e=>i(e)&&6===String(e).length,u=e=>{let t=!0;for(let n=0;n10){t=!1;break}return t},d=e=>e.files.length<=10,f=(e,t,n=".input-base",i="RU")=>{const o=e.closest(n);if(o){const e=o.querySelector(`${n}__error`);o.classList.add(g),e&&(e.innerText=m[t].text[i])}},h=e=>{const t=e.closest(".input-base-captcha")||e.closest(".input-base")||e.closest(".input-file-base")||e.closest(".js-select-wrapper"),n=document.querySelector(".js-navigation");if(t&&n){const e=t.getBoundingClientRect();document.querySelector('.dialog:not([aria-hidden="true"])')?document.querySelector('.dialog:not([aria-hidden="true"]) .dialog-wrapper').scrollTo({top:t.offsetTop-30,behavior:"smooth"}):window.scrollTo({top:e.top+window.pageYOffset-n.clientHeight-60,behavior:"smooth"})}},m={required:{text:{RU:"Поле должно быть заполнено",EN:"Field must be filled"},action:e=>0!==String(e).length},requiredFiles:{text:{RU:"Поле должно быть заполнено",EN:"Field must be filled"},action:e=>e.files&&e.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:e=>i(e)&&(10===String(e.trim()).length||12===String(e.trim()).length)},innIP:{text:{RU:"ИНН должен состоять из 12 цифр",EN:"TIN must be 12 digits"},action:l},kpp:{text:{RU:"КПП должен состоять из 9 цифр",EN:"PPC must consist of 9 digits"},action:e=>i(e)&&9===String(e.trim()).length||0===String(e.trim()).length},email:{text:{RU:"Формат почты: name@domain.ru",EN:"Mail format: name@domain.ru"},action:r},emailWithRuDomain:{text:{RU:"Допустимы только адреса в домене .ru",EN:"Only addresses in 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:e=>{const t=e.replace(/\s/g,"");return 15===t.length&&i(t)||0===t.length}},cost:{text:{RU:"Поле должно состоять только из цифр",EN:"The field must contain only numbers"},action:e=>{const t=e.replace(/\s/g,"");return i(t)||0===t.length}},password:{text:{RU:"Пароль должен содержать не менее 8 символов",EN:"Password must contain at least 8 characters"},action:e=>e.length>7||0===e.length},confirmPassword:{text:{RU:"Пароли должны совпадать",EN:"Passwords must match"},action:({oldPassword:e,newPassword:t})=>e===t},korCheck:{text:{RU:"Корреспондентский счет должен состоять из 11 цифр",EN:"Correspondent account must be 11 digits"},action:e=>i(e)&&11===String(e.trim()).length||0===String(e.trim()).length},payCheck:{text:{RU:"Расчетный счет должен состоять из 14 цифр",EN:"Account must be 14 digits long"},action:e=>i(e)&&14===String(e.trim()).length||0===String(e.trim()).length},bik:{text:{RU:"БИК должен состоять из 12 цифр",EN:"BIC must be 12 digits"},action:e=>i(e)&&12===String(e.trim()).length||0===String(e.trim()).length},phoneOrEmail:{text:{RU:"Не корректно заполнен email или телефон",EN:"Incorrectly filled email or phone"},action:e=>s(e)||r(e)||0===String(e.trim()).length},phoneOrEmailWithRuDomain:{text:{RU:"Не корректно заполнен email (допустимы адреса в домене .ru) или телефон",EN:"Incorrectly filled email (only addresses in domain . ru) or phone"},action:e=>s(e)||r(e)&&a(e)||0===String(e.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:u},filesMaxCount:{text:{RU:"Можно загрузить не более 10 файлов",EN:"You can upload a maximum of 10 files"},action:d},doNotConfirmPhone:{text:{RU:"Номер должен быть подтвержден",EN:"Number must be confirmed"},action:e=>!1},nominalMin1000:{text:{RU:"Номинал карты не может быть менее 1000",EN:"The denomination of the card cannot be less than 1000"},action:e=>e>=1e3}},g="error";function p(e){let t=!0,n=null;if(e.length){const i=document.querySelectorAll(".js-language-radio");let o="RU";if(0!==i.length){const e=Array.from(i).find(e=>e.checked);o=e.value}e.forEach(e=>{const i=e.dataset.validations.split(",");for(let n of i){let i=".input-base",l=e.classList.contains("js-file-input")?{files:e.files,maxWeight:10}:e.value;if(e.classList.contains("js-file-input")&&(i=".input-file-base"),e.classList.contains(".js-select-option")&&(i=".select-wrapper"),"confirmPassword"===n){const t=e.closest(".js-form-container");if(t){var s;const n=(null===(s=t.querySelector(".js-input-password"))||void 0===s?void 0:s.value)||null;n&&(l={oldPassword:n,newPassword:e.value})}}if(!m[n].action(l)){t&&(t=!1),f(e,n,i,o);break}}t||n||(n=e)})}return n&&h(n),t}n.d(t,["LF",0,s,"M2",0,c,"Nh",0,f,"X5",0,d,"bB",0,l,"lZ",0,o,"tJ",0,u])},7214:function(e,t,n){var i=n(883),o=n(2785);window.addEventListener("DOMContentLoaded",()=>{const e=document.querySelector(".js-request-form");if(e){const t=e.querySelectorAll(".js-type-radio"),n=e.querySelectorAll(".js-blanks"),o=e.querySelectorAll(".js-disabled-field");t.length&&(n.length&&t.forEach(e=>{e.addEventListener("change",()=>{n.forEach(e=>{e.classList.toggle("hidden")})})}),o.length&&t.forEach(e=>{e.addEventListener("change",()=>{o.forEach(e=>{e.toggleAttribute("disabled"),e.disabled?e.removeAttribute("data-validations"):e.dataset.validations="required"})})})),(0,i.A)(e)}(0,o.k)()})}},function(e){e(e.s=7214)}]);