1void 0===window.JItemAction&&(JItemAction=function(node,config){node="object"==typeof node&&node&&node instanceof Node?node:null,config="object"==typeof config&&config?config:{},this.node=node;var _private={inited:!1};let _config=JSON.stringify(config);Object.defineProperties(this,{inited:{get:function(){return _private.inited},set:function(value){value&&(_private.inited=!0)}},config:{get:function(){return JSON.parse(_config)}}}),this.init()},JItemAction.prototype={constructor:JItemAction,busy:!1,parentNode:null,prevState:null,get class(){return this.constructor.name},get action(){return""},get requestUrl(){return arAsproOptions.SITE_DIR+"ajax/item.php"},get valid(){return this.node&&this.action},get state(){return this.valid&&BX.hasClass(this.node,"active")},set state(value){if(this.valid&&value!=this.state){value?(BX.addClass(this.node,"active"),this.parentNode&&BX.addClass(this.parentNode,"active")):(BX.removeClass(this.node,"active"),this.parentNode&&BX.removeClass(this.parentNode,"active"));let title=this.getStateTitle(value);this.node.setAttribute("title",title);let button=this.node.querySelector(".info-buttons__item-text");button&&button.setAttribute("title",title),BX.hasClass(this.node,"btn")&&(this.node.textContent=title)}},get data(){let data={};if(this.valid){let mainNode=this.node.closest(".js-popup-block");if(mainNode){let dataNode=mainNode.querySelector("[data-item]");if(dataNode&&(data="function"==typeof jQuery?jQuery(dataNode).data("item"):BX.data(dataNode,"item"),void 0!==data&&"object"!=typeof data&&data))try{data=JSON.parse(data.toString())}catch(e){data={}}}}return"object"==typeof data&&data?data:{}},init:function(){this.inited||(this.inited=!0,this.valid&&(this.node.itemAction=this,this.parentNode=this.node.parentElement,this.bindEvents()))},bindEvents:function(){this.valid&&"function"==typeof this.handlers.onClickNode&&BX.bind(this.node,"click",BX.proxy(this.handlers.onClickNode,this))},unbindEvents:function(){this.valid&&"function"==typeof this.handlers.onClickNode&&BX.unbind(this.node,"click",BX.proxy(this.handlers.onClickNode,this))},fireEvent:function(event){if(this.valid&&!this.busy&&"object"==typeof event&&event){let eventType=event.type;eventType&&"click"===eventType&&BX.proxy(this.handlers.onClickNode,this)(event)}},isStateChanged:function(){return null!==this.prevState&&this.prevState!=this.state},getStateTitle:function(state){return this.valid?state?this.node.getAttribute("data-title_added")||"":this.node.getAttribute("data-title")||"":""},getStateGoalCode:function(state){return"goal_"+this.action+(state?"_add":"_remove")},showStateNotice:function(state){if(this.valid&&"function"==typeof JNoticeSurface){let surface=JNoticeSurface.get(),actionCapitalize,noticeFunc="onAdd2"+this.action.replace(/^\w/,c=>c.toUpperCase());noticeFunc&&"function"==typeof surface[noticeFunc]&&surface[noticeFunc]([this.node],state)}},updateState:function(){this.valid&&!this.busy&&(this.busy=!0,this.node.blur(),this.prevState=this.state,this.sendRequest())},collectRequestData:async function(){let data=new FormData;data.set("is_ajax_post","Y"),data.set("sessid",BX.bitrix_sessid()),data.set("lang",BX.message("LANGUAGE_ID")),data.set("action",this.action),data.set("state",this.state?1:0),data.set("SITE_ID",BX.message("SITE_ID"));let dataItem=this.data;return dataItem&&(data.set("ID",dataItem.ID),data.set("IBLOCK_ID",dataItem.IBLOCK_ID)),data},makeRequestConfig:async function(){return this.collectRequestData().then(BX.proxy((function(data){let config;return{url:this.requestUrl,data:data,method:"POST",dataType:"json",async:!0,processData:!0,preparePost:!1,scriptsRunFirst:!0,emulateOnload:!0,start:!0,cache:!1}}),this)).catch((function(error){throw error}))},sendRequest:function(){this.valid&&this.makeRequestConfig().then(BX.proxy((function(config){config.onsuccess=BX.proxy((function(response){"function"==typeof this.onRequestSuccess&&this.onRequestSuccess(response),"function"==typeof this.onRequestComplete&&this.onRequestComplete(config)}),this),config.onfailure=BX.proxy((function(){"function"==typeof this.onRequestFailure&&this.onRequestFailure(xhr),"function"==typeof this.onRequestComplete&&this.onRequestComplete(config)}
1),this);let xhr=BX.ajax(config)}),this)).catch(BX.proxy((function(error){setTimeout(BX.proxy((function(){this.isStateChanged()&&(this.state=this.prevState,this.prevState=null),this.parentNode&&BX.removeClass(this.parentNode,"loadings"),this.busy=!1}),this),0)}),this))},onRequestComplete:function(config){setTimeout(BX.proxy((function(){this.parentNode&&BX.removeClass(this.parentNode,"loadings"),this.busy=!1}),this),0)},onRequestSuccess:function(response){let data="object"==typeof response&&response?response:{};if(data.success){if(this.action){let actionUpper=this.action.toUpperCase();"object"!=typeof arAsproCounters&&(arAsproCounters={}),"object"!=typeof arAsproCounters[actionUpper]&&(arAsproCounters[actionUpper]={}),"items"in data&&(arAsproCounters[actionUpper].ITEMS=data.items),"count"in data&&(arAsproCounters[actionUpper].COUNT=data.count),"title"in data&&(arAsproCounters[actionUpper].TITLE=data.title),this.class&&"function"==typeof window[this.class]&&"function"==typeof window[this.class].markBadges&&window[this.class].markBadges();let state=this.state;this.class&&"function"==typeof window[this.class]&&"function"==typeof window[this.class].markItems&&window[this.class].markItems(),this.isStateChanged()&&(this.showStateNotice(state),BX.onCustomEvent("onCounterGoals",[{goal:this.getStateGoalCode(state),params:{id:this.node.getAttribute("data-id")}}]))}}else if(console.error(data.error),this.isStateChanged()&&(this.state=this.prevState),"function"==typeof JNoticeSurface){let surface;JNoticeSurface.get().onResultError(data)}},onRequestFailure:function(xhr){if(this.isStateChanged()&&(this.state=this.prevState),"function"==typeof JNoticeSurface){let surface;JNoticeSurface.get().onRequestError(xhr)}},handlers:{onClickNode:function(event){if(this.valid&&!this.busy){event||(event=window.event);let target=event.target||event.srcElement;void 0!==target&&target&&(this.busy=!0,this.node.blur(),this.prevState=this.state,this.state=!this.state,this.sendRequest())}}}},JItemAction.factory=function(node,config){if("object"==typeof node&&node&&node instanceof Node){if(node.itemAction instanceof JItemAction)return node.itemAction;{let action=(node.getAttribute("data-action")||"").trim();if(action){let actionCapitalize,className="JItemAction"+action.replace(/^\w/,c=>c.toUpperCase());if("function"==typeof window[className])return new window[className](node,config)}}}return new window.JItemAction(node,config)},JItemActionCompare=function(node,config){JItemAction.apply(this,arguments)},JItemActionCompare.prototype=Object.create(JItemAction.prototype),JItemActionCompare.prototype.constructor=JItemActionCompare,Object.defineProperties(JItemActionCompare.prototype,{action:{get:()=>"compare"}}),JItemActionCompare.markItems=function(){if("object"==typeof arAsproCounters&&arAsproCounters&&"object"==typeof arAsproCounters.COMPARE&&arAsproCounters.COMPARE&&"object"==typeof arAsproCounters.COMPARE.ITEMS){let blocks=Array.prototype.slice.call(document.querySelectorAll('.js-item-action.active[data-action="compare"]'));if(blocks.length){let list=Object.values(arAsproCounters.COMPARE.ITEMS);for(let y in blocks){let id=BX.data(blocks[y],"id");if(id&&-1==list.indexOf(id)){let itemAction;(blocks[y].itemAction instanceof JItemAction?blocks[y].itemAction:new this(blocks[y])).state=!1}}}if(arAsproCounters.COMPARE.ITEMS)for(let i in arAsproCounters.COMPARE.ITEMS){let id=arAsproCounters.COMPARE.ITEMS[i],blocks=Array.prototype.slice.call(document.querySelectorAll('.js-item-action[data-action="compare"][data-id="'+id+'"]:not(.active)'));if(blocks.length)for(let y in blocks){let itemAction;(blocks[y].itemAction instanceof JItemAction?blocks[y].itemAction:new this(blocks[y])).state=!0}}}},JItemActionCompare.markBadges=function(){if("object"==typeof arAsproCounters&&arAsproCounters&&"object"==typeof arAsproCounters.COMPARE&&arAsproCounters.COMPARE&&void 0!==arAsproCounters.COMPARE.COUNT){let blocks=Array.prototype.slice.call(document.querySelectorAll(".js-compare-block"));if(blocks.length)if(arAsproCounters.COMPARE.COUNT>0)for(let i in blocks)BX.addClass(blocks[i],"icon-block-with-counter--count");else for(let i in blocks)BX.removeClass(blocks[i],"icon-block-with-counter--count");if(blocks=Array.prototype.slice.call(document.querySelectorAll(".js-compare-block .count")),blocks.length)for(let i in blocks)blocks[i].textContent=arAsproCounters.COMPARE.COUNT}},JItemActionFavorite=function(node,config){JItemAction.apply(this,arguments)},JItemActionFavorite.prototype=Object.create(JItemAction.prototype),JItemActionFavorite.prototype.constructor=JItemActionFavorite,Object.defineProperties(JItemActionFavorite.prototype,{action:{get:()=>"favorite"}}),JItemActionFavorite.prototype.getStateGoalCode=function(state){return"goal_wish"+(state?"_add":"_remove")},JItemActionFavorite.markBadges=function(){if("object"==typeof arAsproCounters&&arAsproCounters&&"object"==typeof arAsproCounters.FAVORITE&&arAsproCounters.FAVORITE&&void 0!==arAsproCounters.FAVORITE.COUNT){let blocks=Array.prototype.slice.call(document.querySelectorAll(".js-favorite-block"));if(blocks.length)if(arAsproCounters.FAVORITE.COUNT>0)for(let i in blocks)BX.addClass(blocks[i],"icon-block-with-counter--count");else for(let i in blocks)BX.removeClass(blocks[i],"icon-block-with-counter--count");if(blocks=Array.prototype.slice.call(document.querySelectorAll(".js-favorite-block .count")),blocks.length)for(let i in blocks)blocks[i].textContent=arAsproCounters.FAVORITE.COUNT}},JItemActionFavorite.markItems=function(){if("object"==typeof arAsproCounters&&arAsproCounters&&"object"==typeof arAsproCounters.FAVORITE&&arAsproCounters.FAVORITE&&"object"==typeof arAsproCounters.FAVORITE.ITEMS&&arAsproCounters.FAVORITE.ITEMS){let blocks=Array.prototype.slice.call(document.querySelectorAll('.js-item-action.active[data-action="favorite"]'));if(blocks.length){let list=Object.values(arAsproCounters.FAVORITE.ITEMS);for(let y in blocks){let id=BX.data(blocks[y],"id");if(id&&-1==list.indexOf(id)){let itemAction;(blocks[y].itemAction instanceof JItemAction?blocks[y].itemAction:new this(blocks[y])).state=!1}}}if(arAsproCounters.FAVORITE.ITEMS)for(let i in arAsproCounters.FAVORITE.ITEMS){let id=arAsproCounters.FAVORITE.ITEMS[i],blocks=Array.prototype.slice.call(document.querySelectorAll('.js-item-action[data-action="favorite"][data-id="'+id+'"]:not(.active)'));if(blocks.length)for(let y in blocks){let itemAction;(blocks[y].itemAction instanceof JItemAction?blocks[y].itemAction:new this(blocks[y])).state=!0}}}},JItemActionSubscribe=function(node,config){JItemAction.apply(this,arguments)},JItemActionSubscribe.prototype=Object.create(JItemAction.prototype),JItemActionSubscribe.prototype.constructor=JItemActionSubscribe,Object.defineProperties(JItemActionSubscribe.prototype,{action:{get:()=>"subscribe"}}),JItemActionSubscribe.markItems=function(){if("object"==typeof arAsproCounters&&arAsproCounters&&"object"==typeof arAsproCounters.SUBSCRIBE&&arAsproCounters.SUBSCRIBE&&"object"==typeof arAsproCounters.SUBSCRIBE.ITEMS){let blocks=Array.prototype.slice.call(document.querySelectorAll('.js-item-action.active[data-action="subscribe"]'));if(blocks.length){let list=Object.values(arAsproCounters.SUBSCRIBE.ITEMS);for(let y in blocks){let id=BX.data(blocks[y],"id");if(id&&-1==list.indexOf(id)){let itemAction;(blocks[y].itemAction instanceof JItemAction?blocks[y].itemAction:new this(blocks[y])).state=!1}}}if(arAsproCounters.SUBSCRIBE.ITEMS)for(let i in arAsproCounters.SUBSCRIBE.ITEMS){let id=arAsproCounters.SUBSCRIBE.ITEMS[i],blocks=Array.prototype.slice.call(document.querySelectorAll('.js-item-action[data-action="subscribe"][data-id="'+id+'"]:not(.active)'));if(blocks.length)for(let y in blocks){let itemAction;(blocks[y].itemAction instanceof JItemAction?blocks[y].itemAction:new this(blocks[y])).state=!0}}}},JItemActionBasket=function(node,config){JItemAction.apply(this,arguments)},JItemActionBasket.prototype=Object.create(JItemAction.prototype),JItemActionBasket.prototype.constructor=JItemActionBasket,JItemActionBasket.prototype.basketPropsNode=null,Object.defineProperties(JItemActionBasket.prototype,{action:{get:()=>"basket"},state:{get(){return this.valid&&BX.hasClass(this.node,"active")},set(value){if(this.valid&&value!=this.state){value?(BX.addClass(this.node,"active"),this.parentNode&&BX.addClass(this.parentNode,"active")):(BX.removeClass(this.node,"active"),this.parentNode&&BX.removeClass(this.parentNode,"active"));let title=this.getStateTitle(value);this.node.setAttribute("title",title);let button=this.node.querySelector(".info-buttons__item-text");button&&button.setAttribute("title",title),BX.hasClass(this.node,"btn")&&(this.node.textContent=title)}}}
1,quantity:{get(){if(this.valid){let buyBlock=this.node.closest(".buy_block");if(buyBlock){let input=buyBlock.querySelector(".in_cart .counter__count");if(input)return input.value}}return 1},set(value){if(this.valid){this.node.setAttribute("data-quantity",value);let buyBlock=this.node.closest(".buy_block");if(buyBlock){let input=buyBlock.querySelector(".in_cart .counter__count");input&&(input.value=value)}}}},ratio:{get(){let ratio=1;return this.valid&&(ratio=this.node.getAttribute("data-ratio")||1),ratio<=0&&(ratio=1),ratio}}}),JItemActionBasket.prototype.resetQuantity=function(){this.valid&&(this.quantity=this.ratio)},JItemActionBasket.prototype.getBasketPropsNode=function(){let basketPropsNode=null;if(this.valid){let bakset_div=this.node.getAttribute("data-bakset_div")||"";bakset_div&&(basketPropsNode=BX(bakset_div)),!basketPropsNode&&"Y"!==this.node.getAttribute("data-offers")&&this.node.closest(".grid-list__item")&&(basketPropsNode=this.node.closest(".grid-list__item").querySelector(".basket_props_block"))}return basketPropsNode},JItemActionBasket.prototype.showStateNotice=function(state){if(this.valid&&"function"==typeof JNoticeSurface){let noticeFunc="",surface=JNoticeSurface.get();state&&(noticeFunc="onAdd2Cart"),noticeFunc&&"function"==typeof surface[noticeFunc]&&surface[noticeFunc]([this.node])}},JItemActionBasket.prototype.collectRequestData=async function(){return JItemAction.prototype.collectRequestData.call(this,arguments).then(BX.proxy((function(data){if(data.set("quantity",this.quantity),this.valid){let offers="Y"===this.node.getAttribute("data-offers")?"Y":"N";data.set("offers",offers);let add_props="Y"===this.node.getAttribute("data-add_props")?"Y":"N";data.set("add_props",add_props);let part_props="Y"===this.node.getAttribute("data-part_props")?"Y":"N";data.set("part_props",part_props);let props=this.node.getAttribute("data-props")||"";try{props=props.length?props.split(";"):[]}catch(e){props=[]}data.set("props",JSON.stringify(props));let ridItem=document.querySelector(".rid_item"),rid=ridItem?ridItem.getAttribute("rid"):this.node.getAttribute("rid")||!1;data.set("rid",rid);let foundValues=!1,basketPropsNode=this.getBasketPropsNode();if(basketPropsNode){let propCollection=basketPropsNode.getElementsByTagName("select");if(propCollection&&propCollection.length)for(i=0;i<propCollection.length;i++)if(!propCollection[i].disabled)switch(propCollection[i].type.toLowerCase()){case"select-one":data.set(propCollection[i].name,propCollection[i].value),foundValues=!0}if(propCollection=basketPropsNode.getElementsByTagName("input"),propCollection&&propCollection.length)for(i=0;i<propCollection.length;i++)if(!propCollection[i].disabled)switch(propCollection[i].type.toLowerCase()){case"hidden":data.set(propCollection[i].name,propCollection[i].value),foundValues=!0;break;case"radio":propCollection[i].checked&&(data.set(propCollection[i].name,propCollection[i].value),foundValues=!0)}}if(foundValues||data.set("prop[0]",0),this.isStateChanged()){let empty_props;if("N"===("Y"===this.node.getAttribute("data-empty_props")?"Y":"N"))return this.showBasketPropsForm().then(BX.proxy((function(extData){if("object"==typeof extData&&extData&&extData instanceof FormData)for(let key of extData.keys())data.set(key,extData.get(key));return data}),this)).catch((function(error){throw error}))}}return data}),this))},JItemActionBasket.prototype.showBasketPropsForm=async function(){let that=this;return new Promise(BX.proxy((function(resolve,reject){let trigger=BX.create({tag:"div",attrs:{"data-event":"jqm","data-name":"message","data-param-form_id":"message","data-param-message_title":encodeURIComponent(BX.message("ADD_BASKET_PROPS_TITLE")),"data-param-message_button_title":encodeURIComponent(BX.message("ADD_BASKET_PROPS_BUTTON_TITLE"))}});BX.append(trigger,document.body),$(trigger).jqmEx(BX.proxy((function(name,hash,_this){let popup=hash.w[0],popupBody=popup.querySelector(".form-body"),popupButton=popup.querySelector('.form-footer input[type="submit"]'),basketPropsNode=this.getBasketPropsNode();basketPropsNode&&popupBody&&(popupBody.innerHTML=basketPropsNode.innerHTML),BX.bind(popupButton,"click",BX.proxy((function(){let extData=new FormData,propCollection=popup.getElementsByTagName("select");if(propCollection&&propCollection.length)for(i=0;i<propCollection.length;i++)if(!propCollection[i].disabled)switch(propCollection[i].type.toLowerCase()){case"select-one":extData.set(propCollection[i].name,propCollection[i].value)}if(propCollection=popup.getElementsByTagName("input"),propCollection&&propCollection.length)for(i=0;i<propCollection.length;i++)if(!propCollection[i].disabled)switch(propCollection[i].type.toLowerCase()){case"hidden":extData.set(propCollection[i].name,propCollection[i].value);break;case"radio":propCollection[i].checked&&extData.set(propCollection[i].name,propCollection[i].value)}resolve(extData);let closer=popup.querySelector(".jqmClose");if(closer)BX.fireEvent(closer,"click");else{let overlay=popup.parentElement.querySelector(".jqmOverlay");overlay?BX.fireEvent(overlay,"click"):popup.innerHTML=""}}),this))}),that),BX.proxy((function(name,hash,_this){this.valid&&this.busy&&reject()}),that)),BX.fireEvent(trigger,"click"),trigger.remove()})),that)},JItemActionBasket.prototype.onRequestSuccess=function(response){JItemAction.prototype.onRequestSuccess.call(this,response);let blocks=Array.prototype.slice.call(document.querySelectorAll(".basket-dropdown"));if(blocks.length)for(let i in blocks)BX.removeClass(blocks[i],"loaded")},JItemActionBasket.markBadges=function(){if("object"==typeof arAsproCounters&&arAsproCounters&&"object"==typeof arAsproCounters.BASKET&&arAsproCounters.BASKET&&void 0!==arAsproCounters.BASKET.COUNT){let blocks=Array.prototype.slice.call(document.querySelectorAll(".js-basket-block"));if(blocks.length){if(arAsproCounters.BASKET.COUNT>0)for(let i in blocks){let title;BX.addClass(blocks[i],"icon-block-with-counter--count"),BX.removeClass(blocks[i],"header-cart__inner--empty"),blocks[i].closest("a")&&blocks[i].closest("a").setAttribute("title",arAsproCounters.BASKET.TITLE)}else for(let i in blocks)BX.removeClass(blocks[i],"icon-block-with-counter--count"),BX.addClass(blocks[i],"header-cart__inner--empty");for(let i in blocks){let title=blocks[i].closest("a");title&&title.setAttribute("title",arAsproCounters.BASKET.TITLE)}}if(blocks=Array.prototype.slice.call(document.querySelectorAll(".js-basket-block .count")),blocks.length)for(let i in blocks)blocks[i].textContent=arAsproCounters.BASKET.COUNT}},JItemActionBasket.markItems=function(){if("object"==typeof arAsproCounters&&arAsproCounters&&"object"==typeof arAsproCounters.BASKET&&arAsproCounters.BASKET&&"object"==typeof arAsproCounters.BASKET.ITEMS&&arAsproCounters.BASKET.ITEMS){let blocks=Array.prototype.slice.call(document.querySelectorAll('.js-item-action.active[data-action="basket"]'));if(blocks.length){let list=Object.keys(arAsproCounters.BASKET.ITEMS);for(let y in blocks){let id=BX.data(blocks[y],"id");if(id&&-1==list.indexOf(id)){let itemAction=blocks[y].itemAction instanceof JItemAction?blocks[y].itemAction:new this(blocks[y]);itemAction.state=!1,itemAction.resetQuantity()}}}if(arAsproCounters.BASKET.ITEMS)for(let i in arAsproCounters.BASKET.ITEMS){let id=i,quantity=arAsproCounters.BASKET.ITEMS[i];if(blocks=Array.prototype.slice.call(document.querySelectorAll('.js-item-action[data-action="basket"][data-id="'+id+'"].active')),blocks.length)for(let y in blocks){let itemAction;(blocks[y].itemAction instanceof JItemAction?blocks[y].itemAction:new this(blocks[y])).quantity=quantity}if(blocks=Array.prototype.slice.call(document.querySelectorAll('.js-item-action[data-action="basket"][data-id="'+id+'"]:not(.active)')),blocks.length)for(let y in blocks){let itemAction=blocks[y].itemAction instanceof JItemAction?blocks[y].itemAction:new this(blocks[y]);itemAction.state=!0,itemAction.quantity=quantity}}}},funcDefined("reloadCounters")||(reloadCounters=function(){BX.ajax({url:arAsproOptions.SITE_DIR+"ajax/actualBasket.php",data:{action:"reload",sessid:BX.bitrix_sessid()},method:"POST",dataType:"html",async:!0,processData:!0,preparePost:!0,scriptsRunFirst:!0,emulateOnload:!0,start:!0,cache:!1,success:function(data){BX.onCustomEvent("onReloadCounters",[{data:data}])}})}),BX.bindDelegate(document,"click",{class:"js-item-action"},(function(event){event||(event=window.event),BX.PreventDefault(event);let target=event.target||event.srcElement;void 0!==target&&target&&(target.closest(".opt_action")||JItemAction.factory(this).fireEvent(event))})),BX.addCustomEvent("onCompleteAction",(function(eventdata){try{"ajaxContentLoaded"===eventdata.action&&(JItemActionBasket.markItems(),JItemActionCompare.markItems(),JItemActionFavorite.markItems(),JItemActionSubscribe.markItems())}catch(e){console.error(e)}})),readyDOM((function(){JItemActionBasket.markItems(),JItemActionCompare.markItems(),JItemActionFavorite.markItems(),JItemActionSubscribe.markItems()}))); 2//# sourceMappingURL=item-action.min.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.