var newTag=$("#product-newTag").val(),windowWidth=$(window).width(),productNewListManager={$element:$(".product-list-new"),currentIndex:0,isArabic:"rtl"===$("html").attr("dir"),init:function(){var a=this;window.handleECommercePrice(this.$element,window.isWestEuPriceMode?!0:!1).always(function(){a.handleProductsListStyle($(".pro-tab-contain.clicked"),0==a.$element.find(".products-tab").length)});this.eventRegis();this.gtmHandler();window.utils.judgmentIsEnlarge()},isMob:document.documentElement.clientWidth/ document.documentElement.clientHeight<=660/758&&1025>=windowWidth?!0:!1,initSwiper:function(a){function b(e,g,f){var h=window.digitalData.page.pageInfo.pageNameForGTM;f=$(f).parents(".sync-new-product-component");f=$($(".productNew-list_swiper .syn-item-title",f)[e]).data("txtnameforga")||"";if("CN"==honorConfig.siteCode){var k={actionCode:"switch_product",eventType:"2",content:{event_name:"switch_product",list_name:h,product_name:f,position:"proListNewProduct"+(e+1),button_name:g}};window.sendDapData&& window.sendDapData(k)}window.dataLayer.push({event:"switch_product",list_name:h,product_name:f,position:"proListNewProduct"+(e+1),button_name:g});YandexCommon.track("switch_product",{list_name:h,product_name:f,position:"proListNewProduct"+(e+1),button_name:g})}var c=a.find(".productNew-list_swiper:eq(0)"),d=$(".swiper-slide.productNew-slide:visible",c);1=windowWidth?1:3;d.length>e?(this.params.slidesPerGroup=e,this.$el.removeClass("swiper-no-swiping")):this.$el.addClass("swiper-no-swiping");this.update()},touchEnd:function(e){this._activeIndex!=this.activeIndex&&(this._activeIndex=this.activeIndex,$(e.target).is(".swiper-button-next")||$(e.target).is(".swiper-button-prev")||("next"==this.swipeDirection?b(this.activeIndex,"Left swiper",this.$el): b(this.activeIndex,"Right swiper",this.$el)))}}}):(a.find(".productNew-progressWrapper").hide(),a.find(".productNew-list_swiper .productNew-wrapper").addClass("mb-Empty"))},proNewMatchHeight:function(a){a.find(".productNew-textWrapper").css("justify-content","flex-start");a.find(".productNew-textWrapper .syn-item-title").matchHeight({property:"height"});a.find(".productNew-textWrapper .productNew-textWrapper-a").matchHeight({property:"height"});a.find(".productNew-textWrapper .productNew-ai-Slogan").matchHeight({property:"height"}); a.find(".productNew-textWrapper .productNew-Slogan").matchHeight({property:"height"});a.find(".productNew-textWrapper .energy-label-wrapper").matchHeight({property:"height"});a.find(".productNew-textWrapper .new-home-banner-content-subtitle").matchHeight({property:"height"});a.find(".productNew-textWrapper .desolate-advertise").matchHeight({property:"height"});a.find(".productNew-textWrapper .ec-price-container").matchHeight({property:"height"});a.find(".productNew-textWrapper .home-banner-content-price").matchHeight({property:"height"}); a.find(".productNew-textWrapper .new-home-banner-content-subtitle,.productNew-textWrapper .home-banner-content-price,.productNew-textWrapper .desolate-advertise").each(function(b){0==$(this).height()&&$(this).addClass("prd-list-margin-Empty")});a.find(".productNew-textWrapper .price-content").matchHeight({property:"height"});a.find(".productNew-textWrapper .item_operation-btn-learn").matchHeight({property:"height"});a.find(".productNew-textWrapper").css("justify-content","")},initImageSwitch:function(a){function b(){c.find(".image").eq(d).css({opacity:"0"}); d=(d+1)%c.find(".image").length;c.find(".image").eq(d).css({opacity:"1"})}var c=a.find(".img_wrap.image_active"),d=0,e;a.on("mouseleave",function(){c.find(".image").css("opacity","");clearInterval(e)});a.on("mouseenter",function(){d=0;e=setInterval(b,1E3)})},eventRegis:function(){var a=this;this.$element.on("click",".pro-tab-contain",function(){var b=$(".products-tab .content-tab .pro-tab-contain").index(this);if(b!=a.currentIndex){a.currentIndex=b;var c=$(this);c.addClass("clicked").attr("aria-selected", !0);c.siblings().removeClass("clicked").attr("aria-selected",!1);var d=$(".new-products-list .new-product-list").eq(b);d=$(d);d.removeClass("hide-visit");d.siblings().addClass("hide-visit");d=a.$element.find(".new-products-list .new-product-list").width();var e=a.isArabic?"right":"left";a.$element.find(".new-products-list .new-product-list").css(e,-d*b+"px");a.handleProductsListStyle(c)}});this.$element.find(".new-product-list").each(function(){$(this).find(".productNew-textWrapper-a:visible").first().on("keydown", function(b){b.shiftKey&&9===b.keyCode&&(b.preventDefault(),$(".main-content button.pro-tab-contain.clicked").focus())})})},gtmHandler:function(){this.$element.on("click",".productNew-slide .product-img_group, .productNew-slide .syn-item-title, .productNew-slide .productNew-learn-btn",function(a){var b=$(this);a=$.trim(b.data("txtnameforga"));var c=b.closest(".productNew-slide"),d=c.data("position");c=$.trim(c.find(".syn-item-title").data("txtnameforga"));b=b.closest(".new-product-list").attr("data-tab-name"); if(""==a||""==c)a="Image";if("CN"==honorConfig.siteCode){var e={actionCode:"select_product",eventType:"2",content:{event_name:"select_product",list_name:b,product_name:c,position:d,button_name:a}};window.sendDapData&&window.sendDapData(e)}window.dataLayer.push({event:"select_product",list_name:b,product_name:c,position:d,button_name:a});YandexCommon.track("select_product",{list_name:b,product_name:c,position:d,button_name:a})});this.$element.on("click",".productNew-item_buyBtn",function(a){var b= $(this);a=$.trim(b.data("txtnameforga"));var c=b.closest(".productNew-slide"),d=c.data("position");c=$.trim(c.find(".syn-item-title").data("txtnameforga"));b=b.parents(".products-list-new").find(".main-content .pro-tab-contain.clicked").find(".pro-tab").attr("data-tab-name");"New"==b&&(b=$("#product-newTag").val().trim());if("CN"==honorConfig.siteCode){var e={actionCode:"buy",eventType:"2",content:{event_name:"buy",product_name:c,position:b+"_All Products_"+d,button_name:a}};window.sendDapData&&window.sendDapData(e)}window.dataLayer.push({event:"buy", button_name:a,position:b+"_All Products_"+d,product_name:c});YandexCommon.track("buy",{button_name:a,position:b+"_All Products_"+d,product_name:c})});this.$element.on("click",".productNew-list_view_more",function(a){"CN"==honorConfig.siteCode&&window.sendDapData({actionCode:"products_viewmore",content:{event_name:"products_viewmore",list_name:$(this).attr("data-list-name"),button_name:"view_more"}});var b=$(this).attr("data-list-name");window.dataLayer.push({event:"products_viewmore",list_name:b, button_name:"view_more"});YandexCommon.track("products_viewmore",{list_name:b,button_name:"view_more"});b="_self";0===a.button&&a.ctrlKey&&(b="_blank");a=$(this).attr("href");window.open(a,b)});this.$element.on("click",".pro-tab-contain",function(){var a=$(this).children(":first-child").attr("data-tab-name");"new"==a.toLowerCase()&&(a=newTag);var b=$("#newListMainTitle").val();"CN"==honorConfig.siteCode&&window.sendDapData({actionCode:"switch_tab",content:{event_name:"switch_tab",list_name:b,button_name:a}}); window.dataLayer.push({event:"switch_tab",list_name:b,button_name:a});YandexCommon.track("switch_tab",{list_name:b,button_name:a})})},handleProductsListStyle:function(a,b){var c=this;a=a.children(".pro-tab").data("tab-name");a=c.$element.find(".new-product-list[data-tab-name\x3d'"+a+"']");b&&(a=c.$element.find(".new-product-list:eq(0)"));"true"!=a.data("initialed")&&(750>=windowWidth?c.initSwiper(a):a.find(".product-card-large").each(function(){c.initImageSwitch($(this))}),b=a.find(".productNew-list_swiper"), c.calcCardHeight(b),c.proNewMatchHeight(b),c.handleEmptyElement(a),c.calcCardHeight(b),a.data("initialed","true"))},calcCardHeight:function(a){var b=a.find(".productNew-slide"),c=a.siblings(".pc-left-product");0a&&(a=parseInt($(b.eq(0)).css("marginBottom")),b.css("min-height",(c-a)/2+"px")));b.matchHeight({property:"height"})},handleEmptyElement:function(a){a.find(".mb-first-product .productNew-textWrapper .mkt-price-container, .mb-first-product .productNew-textWrapper .new-home-banner-content-subtitle, .mb-first-product .productNew-item_ksp, .mb-first-product .new-home-banner-content-subtitle").each(function(b){0== $(this).height()&&$(this).addClass("prd-list-margin-Empty")});a.find(" .productNew-list_swiper .price-content, .productNew-list_swiper .productNew-slide .home-banner-content-price, .productNew-list_swiper .productNew-textWrapper .syn-item-title, .productNew-list_swiper .productNew-textWrapper .ec-price-container, .productNew-list_swiper .productNew-textWrapper .productNew-item_price_wrap, .productNew-list_swiper .productNew-textWrapper .new-home-banner-content-subtitle, .productNew-list_swiper .productNew-slide .productNew-textWrapper-a, .productNew-list_swiper .mkt-price-container, .productNew-list_swiper .desolate-advertise").each(function(b){0== $(this).height()&&$(this).addClass("prd-list-margin-Empty")});a.find(".productNew-list_swiper .productNew-textWrapper .productNew-item_ksp").each(function(b){0==$(this).height()&&$(this).addClass("prd-list-margin-Empty")})}};$(function(){0<$(".products-list-new").length&&(productNewListManager.init(),$(window).resize(_.debounce(function(){window.utils.judgmentIsEnlarge()},300)))});