(function(window){"use strict";var site=window.$ite={window:window,doc:window.document,body:window.document.body,params:{debug:false,trusted:false,sid:0,vid:0,aid:0,lang:"en",domain:""},utils:{onLoad:function(callback){document.addEventListener("DOMContentLoaded",callback)},loadScript:function(src,options){options=options||{};if(!src){return}var script=document.createElement('script');script.src=src;script.type='text/javascript';script.async=true;document.head.appendChild(script);if(options["onload"]){script.onload=options["onload"]}if(options["onerror"]){script.onerror=options["onerror"]}site.debug("Load script "+src)},addEvent:function(elem,evType,fn){if(elem.addEventListener){elem.addEventListener(evType,fn,false)}else if(elem.attachEvent){elem.attachEvent('on'+evType,fn)}}},start:function(params){this.params=params;if(!!site.window["site_debug"]||window.document.location.search.indexOf("profiling=")!==-1){this.params["debug"]=true}site.debug("Init site");for(var k in site){if(typeof site[k]==="object"&&site[k]["start"]&&typeof site[k]["start"]==="function"){try{site[k].start.call(site[k])}catch(e){site.error("Site start error:",e)}}}},hasParam:function(name){return!!this.params[name]},getParam:function(name){return this.params[name]||null},debug:function(){if(!!this.params["debug"]){var args=Array.from(arguments);args.unshift("<>");window.console.log.apply(site.window,args)}},error:function(){var args=Array.from(arguments);args.unshift("<>");window.console.error.apply(site.window,args)}}})(window);(function(site){"use strict";let STATUS_NOT_LOADED=0;let STATUS_LOADING=1;let STATUS_LOADED=2;let captcha=site.captcha={STATUS_NOT_LOADED:STATUS_NOT_LOADED,STATUS_LOADING:STATUS_LOADING,STATUS_LOADED:STATUS_LOADED,scripts:{recaptcha:"https://www.google.com/recaptcha/api.js?onload=onReCaptchaLoad&render=explicit",smart_captcha:'https://smartcaptcha.yandexcloud.net/captcha.js?onload=onSmartCaptchaLoad&render=onload',jquery:"/g/libs/jquery/3.2.1/jquery.min.js"},status:{recaptcha:0,smart_captcha:0},type:{recaptcha:'recaptcha',smart_captcha:'smart_captcha'},token_name:{recaptcha:'g-recaptcha-response',smart_captcha:'smart-token'},queue:{recaptcha:[],smart_captcha:[]},submit:false,ajax:window.XMLHttpRequest.prototype.send,ajax_force:false,ajax_data:[],count:0,badge:'badge-captcha',badge_attr_id:'captcha-widget-id',jquery_version:'',reData:null,isRendered:false,initEvents:['click','focus','touchstart','touchmove','scroll'],ajax_manipulate_enabled:false,addCaptcha:function(type,info){if(captcha.status[type]===STATUS_LOADED){try{let $container=$(info.container),data={sitekey:info.sitekey,type:info.type,size:info.rsize,theme:info.theme,invisible:info.invisible},submit=false,form=$container.parents('form:first'),_form=form.get(0),sbmt=_form.submit,btns=form.find('button, [type=submit]'),is_anketa=form.find('[name^="d\["]').length,is_anketa2_api=false,is_post=form.attr('method')&&form.attr('method').toLowerCase()==='post',is_mosaic=form.hasClass('mosaic-form__form')||form.closest('[data-do-tt_form]').length||form.closest('[data-do-form]').length,action=form.attr('action')?form.attr('action'):'',is_product=action.indexOf('action=add')!==-1,is_maliver=action.indexOf('cp.maliver.ru')!==-1,is_init=form.data('captcha-init')===1,is_cart=action.indexOf('mode=cart')!==-1,click=false,events_status={},event_storage={},badge,el,unsubscribe,onSubmit=function(token){if(token){form.find('[name="'+captcha.token_name[type]+'"]').html(token)}if(!click&&(is_post||is_anketa||is_anketa2_api)){site.debug('submit event');if(!captcha.ajax_force){submit=true;try{site.debug('form submit for event');form.submit()}catch(e){site.debug('form js submit - no event',e);_form.submit()}}else{if(captcha.ajax_data[1][0].indexOf('&'+captcha.token_name[type]+'=&')!==-1){captcha.ajax_data[1][0]=captcha.ajax_data[1][0].replace('&'+captcha.token_name[type]+'=&','&'+captcha.token_name[type]+'='+token+'&',)}if(captcha.ajax_data[1][0].indexOf('&'+captcha.token_name[type]+'=&')===-1&&captcha.ajax_data[1][0].endsWith('&'+captcha.token_name[type]+'=')===true){captcha.ajax_data[1][0]+=token}if(captcha.ajax_data[1][0].indexOf('&'+captcha.token_name[type]+'=&')===-1&&captcha.ajax_data[1][0].indexOf('&'+captcha.token_name[type]+'=')===-1){captcha.ajax_data[1][0]+='&'+captcha.token_name[type]+'='+token}captcha.ajax_force=false;site.debug('ajax apply in submit event');captcha.ajax.apply(captcha.ajax_data[0],captcha.ajax_data[1]);captcha.ajax_data=[]}}else if(click){click=false;site.debug('click event in submit');btns.each(function(k,_el){if(el===_el){$._data(_el).events.click.splice(0,$._data(_el).events.click.length);$._data(_el).events.click.push(...event_storage[k]);events_status[k]='on';$(el).trigger('click');events_manipulate()}})}if(type===captcha.type.recaptcha){getBadge().css('visibility','hidden')}else if(type===captcha.type.smart_captcha){$('.SmartCaptcha-Shield').css('visibility','hidden');unsubscribe();window.smartCaptcha.reset(getBadge().data(captcha.badge_attr_id))}},onClick=function(){if(!click){el=this;click=true;site.debug('click event execute captcha');execute(type);return false}},onFocusin=function(){if(type===captcha.type.recaptcha){getBadge().css('visibility','visible')}else if(type===captcha.type.smart_captcha){$('.SmartCaptcha-Shield').css('visibility','visible')}},onFocusout=function(){if(type===captcha.type.recaptcha){getBadge().css('visibility','hidden')}else if(type===captcha.type.smart_captcha){$('.SmartCaptcha-Shield').css('visibility','hidden')}},events_manipulate=function(){btns.each(function(k,el){if(typeof $._data(el).events.click!='undefined'){if(typeof events_status[k]=='undefined'||events_status[k]==='on'){$._data(el).events.click.forEach(function(data,i){if(typeof event_storage[k]=='undefined'){event_storage[k]=[]}event_storage[k][i]=$._data(el).events.click[i]});$._data(el).events.click.splice(0,$._data(el).events.click.length);$(el).on('click',onClick);events_status[k]='off'}}})},getBadge=function(){if(typeof badge=='undefined'){badge=$('#'+captcha.badge)}return badge},execute=function(type){if(type===captcha.type.recaptcha){if(!captcha.isRendered){captcha.handleReCaptchaCLick()}grecaptcha.execute(getBadge().data(captcha.badge_attr_id)).then(function(token){onSubmit(token)})}else if(type===captcha.type.smart_captcha){if(!captcha.isRendered){captcha.handleSmartCaptchaCLick()}unsubscribe=window.smartCaptcha.subscribe(getBadge().data(captcha.badge_attr_id),'success',function(token){onSubmit(token)});window.smartCaptcha.execute(getBadge().data(captcha.badge_attr_id))}};if($container.parents('[data-uri]:first').length&&$container.parents('[data-uri]:first').attr('data-uri').indexOf('method=form2/')!==-1||form.attr('data-s3-anketa-id')&&info.name==='_cn'){is_anketa2_api=true}$container.empty();if(!is_product&&!is_cart&&!is_init&&!is_maliver&&(is_post||(is_anketa||is_anketa2_api)&&!is_mosaic)){site.debug("Draw captcha in container",info.container);if(info.name==='captcha-page'){data['callback']=onSubmit;if(type===captcha.type.recaptcha){data['size']=4;$container.data(captcha.badge_attr_id,grecaptcha.render(info.container,data))}else if(type===captcha.type.smart_captcha){data['invisible']=false;$container.data(captcha.badge_attr_id,window.smartCaptcha.render(info.container,data))}}else{_form.submit=function(){if(!submit){site.debug('js submit execute captcha');execute(type)}else{sbmt.apply(_form)}};if(captcha.getJqueryVersion()<10700){form.find('input,textarea,select').focus(onFocusin);form.find('input,textarea,select').blur(onFocusout);form.submit(function(){if(!submit){site.debug('old jquery submit execute captcha');execute(type);return false}site.debug('old jquery submit success')})}else{form.find('input,textarea,select').on('focusin',onFocusin);form.find('input,textarea,select').on('focusout',onFocusout);form.on('submit',function(){if(!submit){site.debug('jquery submit execute captcha');execute(type);return false}site.debug('jquery submit success')});if(!is_post&&is_anketa){events_manipulate()}}$container.remove()}form.append('');form.data('captcha-init',1)}else if(!is_mosaic){$container.remove()}}catch(e){site.error(type+" error: ",e)}}else{captcha.queue[type].push(info)}},checker:function(type){$('[data-captcha='+type+']').each(function(k,container){let $container=$(container);if($container.parents('form:first').length===0){site.debug("Not find parent form for ",$container);$container.remove()}else{site.debug("Init "+type+" by default for ",$container);captcha.addCaptcha(type,{sitekey:$container.attr("data-sitekey"),type:$container.attr("data-type"),rsize:$container.attr("data-rsize"),theme:$container.attr("data-theme"),lang:$container.attr("data-lang"),name:$container.attr("data-name"),invisible:$container.attr("data-invisible"),container:container})}$container.removeAttr("data-captcha")});if(captcha.queue[type].length&&site.doc.querySelector('[data-name=captcha-page]')&&captcha.status[type]===STATUS_NOT_LOADED){site.doc.querySelector('[data-name=captcha-page]').click()}},start:function(){if(!site.window["$"]){let s=document.createElement("script");s.src=captcha.scripts.jquery;s.async=true;s.onload=function(){captcha.load()};document.getElementsByTagName("head")[0].appendChild(s)}else{captcha.load()}},handleReCaptchaCLick:function(){if(captcha.queue.recaptcha.length&&captcha.status.recaptcha===STATUS_NOT_LOADED){site.utils.loadScript(captcha.scripts.recaptcha+"&hl="+site.getParam("lang"),{onerror:function(e){site.error("ReCaptcha load error: ",e)}});captcha.status.recaptcha=STATUS_LOADING}},handleSmartCaptchaCLick:function(){if(captcha.queue.smart_captcha.length&&captcha.status.smart_captcha===STATUS_NOT_LOADED){site.utils.loadScript(captcha.scripts.smart_captcha+"&hl="+site.getParam("lang"),{onerror:function(e){site.error("SmartCaptcha load error: ",e)}});captcha.status.smart_captcha=STATUS_LOADING}},load:function(){let count_recaptcha=$('[data-captcha='+captcha.type.recaptcha+']').length;let count_smart_captcha=$('[data-captcha='+captcha.type.smart_captcha+']').length;let type=captcha.type.recaptcha;if(count_smart_captcha&&!count_recaptcha){type=captcha.type.smart_captcha}captcha.ajax_manipulate(type);setInterval(function(){try{captcha.checker(type)}catch(e){site.error("Captcha checker:",e)}},300);if(type===captcha.type.recaptcha){captcha.initEvents.forEach(event=>{site.doc.addEventListener(event,captcha.handleReCaptchaCLick,true)})}else if(type===captcha.type.smart_captcha){captcha.initEvents.forEach(event=>{site.doc.addEventListener(event,captcha.handleSmartCaptchaCLick,true)})}},ajax_manipulate:function(type){if(captcha.ajax_manipulate_enabled){return}window.XMLHttpRequest.prototype.send=function(){try{if(!arguments[0]){site.debug('ajax get');captcha.ajax.apply(this,[].slice.call(arguments))}else{let params=arguments[0],is_captcha=params.indexOf(captcha.token_name[type]+'=')!==-1,error=false;if(is_captcha){params.split('&').forEach(function(v){if(v.indexOf(captcha.token_name[type]+'=')!==-1){v=v.split('=');if(v.length>1&&v[1]<1||v.length===1||/[а-яА-ЯЁё]/.test(decodeURI(v[1]))){error=true}}});if(error&&!captcha.ajax_force){captcha.ajax_force=true;captcha.ajax_data=[this,arguments];site.debug('ajax stop post - captcha error')}else{captcha.ajax_data=[];captcha.ajax_force=false;site.debug('ajax post, no captcha error');captcha.ajax.apply(this,[].slice.call(arguments))}}else{site.debug('ajax post, no captcha');captcha.ajax.apply(this,[].slice.call(arguments))}}}catch(e){site.debug('ajax manipulate error, send',e);captcha.ajax.apply(this,[].slice.call(arguments))}};captcha.ajax_manipulate_enabled=true},init:function(type){let is_type_ok=false;if(type===captcha.type.recaptcha){captcha.reData={sitekey:captcha.queue[type][0].sitekey,type:captcha.queue[type][0].type,size:captcha.queue[type][0].rsize,theme:captcha.queue[type][0].theme};is_type_ok=true}else if(type===captcha.type[type]){captcha.smartData={sitekey:captcha.queue[type][0].sitekey,invisible:captcha.queue[type][0].invisible,shieldPosition:'bottom-right'};is_type_ok=true}if(is_type_ok){$('body').append(`
`);if(type===captcha.type.recaptcha){$('#'+captcha.badge).css('visibility','hidden')}if(!captcha.isRendered){captcha.render(type)}}},render:function(type){if(type===captcha.type.recaptcha){$(`#${captcha.badge}`).data(captcha.badge_attr_id,grecaptcha.render(captcha.badge,captcha.reData));captcha.isRendered=true}else if(type===captcha.type.smart_captcha){$(`#${captcha.badge}`).data(captcha.badge_attr_id,window.smartCaptcha.render(captcha.badge,captcha.smartData));let interval=setInterval(function(){let shield=$('.SmartCaptcha-Shield');if(shield.length){shield.css('visibility','hidden');clearTimeout(interval)}},10);captcha.isRendered=true}},getJqueryVersion:function(){if(captcha.jquery_version===''){let tmp=jQuery.fn.jquery.split('.');tmp.forEach(function(val){if(val.length===1){captcha.jquery_version=captcha.jquery_version.concat(0)}captcha.jquery_version=captcha.jquery_version.concat(val)});captcha.jquery_version=parseInt(captcha.jquery_version)}return captcha.jquery_version},checkJqueryVersion:function(compare,version){}};site.window.onReCaptchaLoad=function(){site.window.dispatchEvent(new Event('ReCaptchaLoaded'));captcha.status.recaptcha=STATUS_LOADED;site.debug("Recaptcha loaded");captcha.initEvents.forEach(event=>{site.doc.removeEventListener(event,captcha.handleReCaptchaCLick)});captcha.init(captcha.type.recaptcha);captcha.queue.recaptcha.forEach(function(info){captcha.addCaptcha(captcha.type.recaptcha,info)});site.captcha.queue.recaptcha=[]};site.window.onSmartCaptchaLoad=function(){site.window.dispatchEvent(new Event('SmartCaptchaLoaded'));captcha.status.smart_captcha=STATUS_LOADED;site.debug("Smart Captcha loaded");captcha.initEvents.forEach(event=>{site.doc.removeEventListener(event,captcha.handleSmartCaptchaCLick)});captcha.init(captcha.type.smart_captcha);captcha.queue.smart_captcha.forEach(function(info){captcha.addCaptcha(captcha.type.smart_captcha,info)});site.captcha.queue.smart_captcha=[]}})(window.$ite);(function(site){"use strict";site.hotkeys={start:function(){if(site.getParam("trusted")){site.utils.addEvent(window.document,"keydown",function(e){if(e['altKey']&&e.keyCode===80){if(location.search.indexOf("profiling")===-1){if(location.search.indexOf("?")===-1){location.search+="?profiling="+Math.round(Math.random()*100000)}else{location.search+="&profiling="+Math.round(Math.random()*100000)}}}if(e['altKey']&&e.keyCode===79&&site.hasParam("domain")&&site.hasParam("vid")&&site.hasParam("aid")){site.window.open(window.atob("aHR0cDovLw==")+site.getParam("domain")+window.atob("L215L3MzL2RhdGEvbWVudS9kZWZhdWx0LnBocD9tY2E9")+site.getParam("aid")+window.atob("Jm1jcz0xJnZlcl9pZD0=")+site.getParam("vid"))}})}}}})(window.$ite);(function(site){"use strict";var feedback=site.feedback={factory:null,start:function(){site.utils.loadScript("/shared/feedback/feedback.factory.js",{onload:function(){feedback.factory=site.window.FeedbackFactory;site.feedback.factoryStart()}})},factoryStart:function(){feedback.factory.setOption('sources','/shared/feedback');feedback.factory.setOption('url',site.window.atob('L215L3MzL2ZlZWRiYWNrL3JlcG9ydC5waHA='));feedback.factory.setData('instance_id',site.getParam('aid'));feedback.factory.addScript(site.window.atob("aHR0cHM6Ly9jYWJpbmV0Lm1lZ2Fncm91cC5ydS9jbGllbnQuanNvbnA/Y2FsbGJhY2s9")+"setFeedbackUserId")}};site.window.setFeedbackUserId=function(data){if(data.id){feedback.factory.setData('user_id',data.id)}}})(window.$ite);