var NineYi;(function(n){var t;(function(n){var t;(function(n){var t=function(){function n(n,t,i,r){this.WebApiFactory=r;this.config=n;this.$q=t;this.$http=i}return n.prototype.GetShopSalePageTermListByKeyword=function(n){var t=this.$q.defer(),i=this.config.webapiUrl+"/Search/GetShopSalePageTermListByKeyword?keyword="+encodeURIComponent(n),r={keyword:encodeURIComponent(n)};return this.$http.get(i,r).then(function(n){t.resolve(n.data)}).catch(t.reject),t.promise},n.prototype.GetShopHotKeywordList=function(n){var t=this.$q.defer(),i=this.WebApiFactory.getWebApiUrl("/SearchV2/GetShopHotKeywordList?shopId="+n),r={shopId:n};return this.$http.get(i,r).then(function(n){t.resolve(n.data)}).catch(t.reject),t.promise},n.prototype.GetShopPayTypeAndShippingTypeList=function(n){var t=this.$q.defer(),i=this.WebApiFactory.getWebApiUrl("/SearchV2/GetShopPayTypeAndShippingTypeList?shopId="+n),r={shopId:n};return this.$http.get(i,r).then(function(n){t.resolve(n.data)}).catch(t.reject),t.promise},n.prototype.GetShopCategoryListBySearch=function(n,t,i,r,u,f,e,o){var h=this.$q.defer(),s=this.config.webapiUrl+"/SearchV2/GetShopCategoryListBySearch?shopId="+n+"&keyword="+encodeURIComponent(t),c={shopId:n,keyword:encodeURIComponent(t),minPrice:i,maxPrice:r,shippingType:u,payType:f,scoreThreshold:e};return s+="&minPrice="+(i?i:""),s+="&maxPrice="+(r?r:""),s+="&shippingType="+(u?u:""),s+="&payType="+(f?f:""),s+="&scoreThreshold="+(!isNaN(e)&&typeof e=="number"?e:this.config.scoreThreshold),s+="&isResearch="+!!o,this.$http.get(s,c).then(function(n){h.resolve(n.data)}).catch(h.reject),h.promise},n.prototype.GetShopSalePageBySearch=function(n,t,i,r,u,f,e,o,s,h,c,l,a,v){var p=this.$q.defer(),y=this.config.webapiUrl+"/SearchV2/GetShopSalePageBySearch?shopId="+n+"&keyword="+encodeURIComponent(t),w={shopId:n,keyword:encodeURIComponent(t),minPrice:i,maxPrice:r,shippingType:u,payType:f,order:e,startIndex:o,maxCount:s,displayScore:h,shopCategoryId:c,scoreThreshold:l};return y+="&minPrice="+(!isNaN(i)&&typeof i=="number"?i:""),y+="&maxPrice="+(!isNaN(r)&&typeof r=="number"?r:""),y+="&shippingType="+(u?u:""),y+="&payType="+(f?f:""),y+="&order="+(e?e:""),y+="&startIndex="+(o?o:0),y+="&maxCount="+(s?s:""),y+="&displayScore="+(h?h:""),y+="&shopCategoryId="+(c?c:""),y+="&scoreThreshold="+(!isNaN(l)&&typeof l=="number"?l:this.config.scoreThreshold),y+="&isResearch="+!!a,y+="&locationId="+(v||0),this.$http.get(y,w).then(function(n){p.resolve(n.data)}).catch(p.reject),p.promise},n.$inject=["Mall.Config","$q","$http","WebApiFactory"],n}();n.SearchService=t;angular.module("NineYi.Mall.Services").service("SearchService",t)})(t=n.Services||(n.Services={}))})(t=n.Mall||(n.Mall={}))})(NineYi||(NineYi={})),function(n){var t;(function(n){var t;(function(){angular.module("NineYi.Mall.Directives").directive("nsPagination",["$window","$log",function(n){return{restrict:"E",templateUrl:"/V2/TypeScripts/Components/ns-pagination/paginationDirective.html",scope:{ChangePage:"&nsChangePage",CurrentIndex:"=?nsCurrentIndex",TotalCount:"=?nsTotalCount",EachPageCount:"=?nsEachPageCount",DisplayPages:"=?nsDisplayPages"},link:function(t){function i(){var t=n.scrollY||n.pageYOffset;n.scrollTo(0,-t)}t.$watch(function(){return t.TotalCount},function(n){t.TotalCount=n;t.InitPage()});t.InitPage=function(){typeof t.TotalCount=="number"&&typeof t.EachPageCount=="number"&&(t.PageList=[],t.PageSize=Math.ceil(t.TotalCount/t.EachPageCount),t.CountPages(t.CurrentIndex))};t.CountPages=function(n){var f=n+1,e=Math.ceil((t.DisplayPages+1)/2),i=f-e,u,r;for(f<e||t.PageSize<t.DisplayPages?i=0:i>t.PageSize-t.DisplayPages&&(i=t.PageSize-t.DisplayPages),t.PageList=[],u=1,r=i+1;u<=t.DisplayPages&&r<=t.PageSize;u++,r++)t.PageList.push(r)};t.ClickPage=function(n){n<0||n>t.PageSize-1||(t.CurrentIndex=n,t.CountPages(t.CurrentIndex),t.ChangePage({value:n}),i())}}}}])})(t=n.Directives||(n.Directives={}))})(t=n.Mall||(n.Mall={}))}(NineYi||(NineYi={})),function(n){var t;(function(n){var t;(function(n){var t=function(){function n(n,t,i,r,u,f){var e=this;this.$window=n;this.$timeout=t;this.ShopId=i;this.value=r;this.HotSaleRankingService=u;this.GoogleAnalyticsUtility=f;this.restrict="E";this.scope={gaCategory:"@?nsGaCategory",gaLabel:"@?nsGaLabel"};this.templateUrl="/V2/TypeScripts/Components/ns-hot-sale-ranking/hotSaleRanking.html";this.link=function(t,i){function h(n,t){n&&(n.style.transform="translate3d( "+t+"px, 0, 0)",n.style["-webkit-transform"]="translate3d( "+t+"px, 0, 0)",n.style["-moz-transform"]="translate3d( "+t+"px, 0, 0)",n.style["-ms-transform"]="translate3d( "+t+"px, 0, 0)")}function c(n,t){n&&(n.style.transition="transform "+t)}t.shopId=e.ShopId;t.DisplayCount=4;t.MaxCount=16;t.CurrentIndex=0;var u,o,s,r;e.HotSaleRankingService.GetHotSaleRankingList(e.ShopId,t.MaxCount).then(function(n){t.HotSaleRankingList=n});t.$on("onRepeatEnd",function(){t.InitSetting()});t.InitSetting=function(){u=i[0].querySelector("#ranking-ul");o=i[0].querySelector("#ranking-ul li");s=o.getBoundingClientRect().width*t.DisplayCount;r=0};t.HrefTo=function(i){n.location.href=i;t.gaCategory&&t.gaCategory!==""&&t.gaLabel&&t.gaLabel!==""&&f.TrackEvent(t.gaCategory,"click",t.gaLabel)};t.Scroll=function(n){var i=n?-1:1;if(n){if(t.CurrentIndex+t.DisplayCount>=t.HotSaleRankingList.length)return}else if(t.CurrentIndex<=0)return;t.CurrentIndex=t.CurrentIndex+-1*i*t.DisplayCount;r=r+i*s;c(u,"0.8s");h(u,r)}}}return n.factory=function(){var t=function(t,i,r,u,f,e){return new n(t,i,r,u,f,e)};return t.$inject=["$window","$timeout","ShopId","Mall.Value","HotSaleRankingService","GoogleAnalyticsUtility"],t},n}();n.HotSaleRankingDirective=t;angular.module("NineYi.Mall.Directives").directive("nsHotSaleRanking",t.factory())})(t=n.Directives||(n.Directives={}))})(t=n.Mall||(n.Mall={}))}(NineYi||(NineYi={})),function(n){var t;(function(t){var i;(function(t){var i=function(){function t(t,i,r,u,f,e,o,s,h,c,l,a,v,y,p,w,b,k,d,g,nt,tt,it,rt,ut,ft,et,ot,st,ht){var ct=this;this.DeviceValue=t;this.config=i;this.$scope=r;this.$log=u;this.$window=f;this.$timeout=e;this.$location=o;this.$translate=s;this.$filter=h;this.$q=c;this.ShopId=l;this.TraceSalePageListService=a;this.FavoriteUtility=v;this.SearchService=y;this.UrlUtility=p;this.LoadingBarUtility=w;this.ShoppingCartUtility=b;this.GoogleAnalyticsUtility=k;this.GoogleAnalyticsEcommerceUtility=d;this.AdobeAnalyticsUtility=g;this.FreezeBodyUtility=nt;this.FacebookUtility=tt;this.GoogleTagManagerDataLayerUtility=it;this.OfficialShopProfile=rt;this.CurrencyFormat=ut;this.market=ft;this.cookieUtility=et;this.GoogleAdwordsUtility=ot;this.RetailStoreService=st;this.SoldOutType=ht;this.ShopCategoryList=[];this.SalePageBySearchList=[];this.CheckedPayTypeList=[];this.CheckedShippingTypeList=[];this.displayWay="";this.orderList=[];this.selectItem=null;this.shopCategoryName="";this.priceTagName="";this.showOrderList=!1;this.showHalfPage=!1;this.showNoResultView=undefined;this.currentPageIndex=0;this.inputKeyword="";this.submitKeyword="";this.order="";this.startIndex=0;this.shopCategoryId="";this.shippingType="";this.payType="";this.maxCount=50;this.displayScore=!1;this.isResearch=!0;this.isPriceRange=!0;this.isFirstPageLoad=!0;this.paginationSeenPages=[];this.isUseAccurateComparison=null;this.SoldOutTypeEnum=n.WebStore.Frontend.BE.ShopDefault.ShopDefaultSoldOutTypeDefEnum;this.checkIsDefaultUseAccurateComparison=function(){var t=window.nineyi&&window.nineyi.env||undefined,n=t==="Dev"||t==="QA";return n&&ct.market==="TW"&&ct.ShopId===225||!n&&ct.market==="TW"&&ct.ShopId===2131||!n&&ct.market==="TW"&&ct.ShopId===40259};this.replaceDoubleQuotes=function(n){return n&&n.replace(/['"]+/g,"")};this.IsMobile=this.OfficialShopProfile.BrowserMode===n.WebStore.Frontend.BE.Device.DeviceModeEnum.Mobile;this.isTouchDevice=this.DeviceValue.isTouchDevice;this.displayWay=this.IsMobile?"small":"cabinet";this.$translate.onReady(function(){ct.orderList=[{name:ct.$translate.instant("frontend.typescripts.search.relativity"),orderBy:"Correlation"},{name:ct.$translate.instant("frontend.typescripts.search.new_product"),orderBy:"Newest"},{name:ct.$translate.instant("frontend.typescripts.search.prices_low_to_high"),orderBy:"PriceLowToHigh"},{name:ct.$translate.instant("frontend.typescripts.search.prices_high_to_low"),orderBy:"PriceHighToLow"}];ct.selectItem=ct.orderList[0];ct.InitSearch()});this.displayPages=this.IsMobile?3:5;this.LoadingBarUtility.EnableLoadingBar();this.$window.addEventListener("pageshow",function(n){n.persisted&&ct.$window.location.reload()});this.currentRate=this.CurrencyFormat.Rate||1;r.$watch(this.inputKeyword,function(n,t){n!=t&&(this.submitKeyword=n)})}return t.prototype.InitSearch=function(){var n=this.UrlUtility.GetEscapeQueryString("q"),t;this.isDefaultUseAccurateComparison=this.checkIsDefaultUseAccurateComparison();this.inputKeyword=this.replaceDoubleQuotes(n);this.submitKeyword=n;this.order=this.UrlUtility.GetHashstring("order")||this.selectItem.orderBy;this.startIndex=this.UrlUtility.GetHashstring("startIndex")?parseInt(this.UrlUtility.GetHashstring("startIndex")):this.startIndex;this.maxCount=this.UrlUtility.GetHashstring("maxCount")?parseInt(this.UrlUtility.GetHashstring("maxCount")):this.maxCount;this.shopCategoryId=this.UrlUtility.GetHashstring("shopCategoryId")||"";this.shopCategoryName=this.UrlUtility.GetHashstring("shopCategoryName")||this.$translate.instant("frontend.typescripts.search.category");this.minPrice=this.tempMinPrice=parseInt(this.UrlUtility.GetHashstring("minPrice"))||null;this.maxPrice=this.tempMaxPrice=parseInt(this.UrlUtility.GetHashstring("maxPrice"))||null;this.shippingType=this.UrlUtility.GetHashstring("shippingType")||"";this.payType=this.UrlUtility.GetHashstring("payType")||"";this.displayScore=this.UrlUtility.GetQuerystring("d")==="t";t=parseFloat(this.UrlUtility.GetQuerystring("s"));this.scoreThreshold=isNaN(t)?this.config.scoreThreshold:t;this.InitPriceTag();this.InitOrderSetting();this.IsMobile||(this.GetShopCategoryListBySearch(),this.GetShopPayTypeAndShippingTypeList());this.DoSearch();this.FacebookUtility.TrackSearchEvent(this.submitKeyword);this.GoogleAdwordsUtility.viewSearchResult();n.length>2&&n.charAt(0)==='"'&&n.charAt(n.length-1)==='"'&&(this.isUseAccurateComparison=!0)},t.prototype.HistroyPushState=function(){var t={order:this.order,shopCategoryId:this.shopCategoryId,shopCategoryName:this.shopCategoryName,minPrice:this.minPrice,maxPrice:this.maxPrice,shippingType:this.shippingType,payType:this.payType,startIndex:this.startIndex},n=this.UrlUtility.JsonToQueryString(t),i=document.getElementsByTagName("title")[0].innerHTML;n=n.replace("?","");this.$location.path("/f");this.$location.replace();this.$location.hash(n)},t.prototype.ClearAllTag=function(){this.shopCategoryId="";this.shopCategoryName=this.$translate.instant("frontend.typescripts.search.category");this.ClearFilterTag();this.HistroyPushState();this.isResearch=!0;this.GetShopCategoryListBySearch();this.DoSearch();this.TrackEvent("搜尋-進階篩選","全部清除進階篩選","")},t.prototype.ClearFilterTag=function(){this.minPrice=this.tempMinPrice=null;this.maxPrice=this.tempMaxPrice=null;this.priceTagName="";this.payType="";this.shippingType="";this.CheckedPayTypeList=[];this.CheckedShippingTypeList=[];this.startIndex=0;this.isUseAccurateComparison=null;this.inputKeyword=this.replaceDoubleQuotes(this.inputKeyword);this.submitKeyword=this.inputKeyword;_.each(this.ShippingTypeList,function(n){n.checked=n.tempChecked=!1});_.each(this.PayTypeList,function(n){n.checked=n.tempChecked=!1})},t.prototype.clickLevel1=function(n){n.SubShopCategories&&n.SubShopCategories.length>0?n.selected=!n.selected:this.SearchByCategory(n)},t.prototype.SearchByCategory=function(n,t){n&&(this.selectedCategoryEntity=n);n?(this.shopCategoryId=t?"":n.Id.toString(),this.shopCategoryName=t?"":n.Name,this.IsMobile||(t?this.TrackEvent("搜尋-進階篩選","清除進階篩選-分類",this.shopCategoryId):this.TrackEvent("搜尋-進階篩選","進階篩選-分類",this.shopCategoryId))):(this.shopCategoryId="",this.shopCategoryName=this.$translate.instant("frontend.typescripts.search.category"),this.TrackEvent("搜尋-進階篩選","進階篩選-分類",""));this.startIndex=0;this.isResearch=!1;this.HistroyPushState();this.DoSearch();this.IsMobile&&this.CloseHalfPage()},t.prototype.SearchByPriceRange=function(n){if(n?(this.minPrice=this.tempMinPrice=null,this.maxPrice=this.tempMaxPrice=null,this.priceTagName="",this.TrackEvent("搜尋-進階篩選","清除進階篩選-價格(PC)","")):(this.minPrice=this.tempMinPrice,this.maxPrice=this.tempMaxPrice,this.InitPriceTag(),this.TrackEvent("搜尋-進階篩選","進階篩選-價格(PC)",(this.tempMinPrice===null?"":this.tempMinPrice)+"~"+(this.tempMaxPrice===null?"":this.tempMaxPrice))),this.minPrice||this.maxPrice){var t=this.minPrice+" - "+this.maxPrice;this.AdobeAnalyticsUtility.ApplyFilter("Price range",t)}this.startIndex=0;this.isResearch=!1;this.HistroyPushState();this.GetShopCategoryListBySearch();this.DoSearch()},t.prototype.InitPriceTag=function(){if(this.maxPrice||this.minPrice){var n=this.$filter("preferredCurrency")(this.minPrice||0,1),t=this.maxPrice?this.$filter("preferredCurrency")(this.maxPrice,1):this.$translate.instant("frontend.typescripts.search.not_limited");this.priceTagName=this.$translate.instant("frontend.typescripts.search.price",{val0:n,val1:t})}else this.priceTagName=""},t.prototype.InitOrderSetting=function(){this.order==="correlation"?this.selectItem=this.orderList[0]:this.order==="Newest"?this.selectItem=this.orderList[1]:this.order==="PriceLowToHigh"?this.selectItem=this.orderList[2]:this.order==="PriceHighToLow"&&(this.selectItem=this.orderList[3])},t.prototype.ChangeOrderWay=function(n){this.order=n;this.isResearch=!1;this.HistroyPushState();this.DoSearch();this.IsMobile||this.TrackEvent("搜尋-商品結果","click","切換排序")},t.prototype.ChangeDisplayWay=function(n){this.displayWay=n;this.TrackEvent("搜尋-商品結果","click","切換顯示方式")},t.prototype.SearchByPayType=function(n,t){var i=this;n.checked=n.tempChecked=t;n.checked?(this.CheckedPayTypeList.push(n.TypeDef),this.TrackEvent("搜尋-進階篩選","進階篩選-付款方式(PC)",n.TypeDefDesc),this.AdobeAnalyticsUtility.ApplyFilter("Pay type",this.CheckedPayTypeList.join(", "))):(_.each(this.CheckedPayTypeList,function(t,r){t===n.TypeDef&&i.CheckedPayTypeList.splice(r,1)}),this.TrackEvent("搜尋-進階篩選","清除進階篩選-付款方式(PC)",n.TypeDefDesc));this.startIndex=0;this.payType=this.CheckedPayTypeList.join(",");this.isResearch=!1;this.HistroyPushState();this.GetShopCategoryListBySearch();this.DoSearch()},t.prototype.SearchByShippingType=function(n,t){var i=this;n.checked=n.tempChecked=t;n.checked?(this.CheckedShippingTypeList.push(n.TypeDef),this.TrackEvent("搜尋-進階篩選","進階篩選-運送方式(PC)",n.TypeDefDesc),this.AdobeAnalyticsUtility.ApplyFilter("Shipping type",this.CheckedShippingTypeList.join(", "))):(_.each(this.CheckedShippingTypeList,function(t,r){t===n.TypeDef&&i.CheckedShippingTypeList.splice(r,1)}),this.TrackEvent("搜尋-進階篩選","清除進階篩選-運送方式(PC)",n.TypeDefDesc));this.shippingType=this.CheckedShippingTypeList.join(",");this.startIndex=0;this.isResearch=!1;this.HistroyPushState();this.GetShopCategoryListBySearch();this.DoSearch()},t.prototype.ChangePage=function(n){this.startIndex=n*this.maxCount;this.isResearch=!1;this.HistroyPushState();this.DoSearch();this.TrackEvent("搜尋-商品結果","click","換頁")},t.prototype.OpenHalfPage=function(n){this.showHalfPage=!0;this.openHalfPageType=n;switch(n){case"category":this.halfPageTitle=this.$translate.instant("frontend.typescripts.search.category");this.halfPageUrl="/V2/TypeScripts/Modules/Search/categoryMenu.html";this.ShopCategoryList&&this.ShopCategoryList.length!==0||this.GetShopCategoryListBySearch();this.TrackEvent("搜尋-進階篩選","進階篩選-分類","");break;case"order":this.halfPageTitle=this.$translate.instant("frontend.typescripts.search.sort");this.halfPageUrl="/V2/TypeScripts/Modules/Search/orderList.html";this.TrackEvent("搜尋-商品結果","click","切換排序");break;case"filter":this.halfPageTitle=this.$translate.instant("frontend.typescripts.search.filter");this.halfPageUrl="/V2/TypeScripts/Modules/Search/filterList.html";this.PayTypeList&&this.ShippingTypeList||this.GetShopPayTypeAndShippingTypeList();this.TrackEvent("搜尋-進階篩選","click","進階篩選(Mobile)");break;default:this.halfPageTitle=this.$translate.instant("frontend.typescripts.search.category");this.halfPageUrl="/V2/TypeScripts/Modules/Search/categoryMenu.html";this.ShopCategoryList&&this.ShopCategoryList.length!==0||this.GetShopCategoryListBySearch();this.TrackEvent("搜尋-進階篩選","進階篩選-分類","")}},t.prototype.CloseHalfPage=function(){this.showHalfPage=!1},t.prototype.ResetSearchCondition=function(){this.openHalfPageType==="filter"&&(_.each(this.PayTypeList,function(n){n.tempChecked=n.checked}),_.each(this.ShippingTypeList,function(n){n.tempChecked=n.checked}),this.tempMinPrice=this.minPrice,this.tempMaxPrice=this.maxPrice)},t.prototype.SubmitFilterList=function(){var n=this,t;this.CheckedPayTypeList=[];_.each(this.PayTypeList,function(t){t.checked=t.tempChecked;t.checked&&n.CheckedPayTypeList.push(t.TypeDef)});this.payType=this.CheckedPayTypeList.join(",");this.CheckedPayTypeList.length&&this.AdobeAnalyticsUtility.ApplyFilter("Pay type",this.CheckedPayTypeList.join(", "));this.CheckedShippingTypeList=[];_.each(this.ShippingTypeList,function(t){t.checked=t.tempChecked;t.checked&&n.CheckedShippingTypeList.push(t.TypeDef)});this.shippingType=this.CheckedShippingTypeList.join(",");this.CheckedShippingTypeList.length&&this.AdobeAnalyticsUtility.ApplyFilter("Shipping type",this.CheckedShippingTypeList.join(", "));(this.tempMinPrice||this.tempMaxPrice)&&(t=this.tempMinPrice+" - "+this.tempMaxPrice,this.AdobeAnalyticsUtility.ApplyFilter("Price range",t));this.minPrice=this.tempMinPrice;this.maxPrice=this.tempMaxPrice;this.startIndex=0;this.isResearch=!1;this.HistroyPushState();this.GetShopCategoryListBySearch();this.DoSearch()},t.prototype.GetShopPayTypeAndShippingTypeList=function(){var n=this;this.SearchService.GetShopPayTypeAndShippingTypeList(this.ShopId).then(function(t){n.ShippingTypeList=t.Data.ShippingTypeList;n.CheckedShippingTypeList=[];_.each(n.ShippingTypeList,function(t){t.checked=t.tempChecked=n.shippingType.indexOf(t.TypeDef)!==-1;t.checked&&n.CheckedShippingTypeList.push(t.TypeDef)});n.PayTypeList=t.Data.PayTypeList;n.CheckedPayTypeList=[];_.each(n.PayTypeList,function(t){t.checked=t.tempChecked=n.payType.indexOf(t.TypeDef)!==-1;t.checked&&n.CheckedPayTypeList.push(t.TypeDef)})})},t.prototype.GetShopCategoryListBySearch=function(){var n=this,t=this.ConvertToDefaultCurrency(this.minPrice),i=this.ConvertToDefaultCurrency(this.maxPrice);this.SearchService.GetShopCategoryListBySearch(this.ShopId,this.submitKeyword,t,i,this.shippingType,this.payType,this.scoreThreshold,this.isResearch).then(function(t){n.ShopCategoryList=t.Data.ShopCategories})},t.prototype.DoSearch=function(){var t=this,n;this.LoadingBarUtility.ShowLoadingBar();angular.element(document.getElementsByClassName("section-board")[0]).removeClass("fad-in").addClass("fad-out");n=[this.TraceSalePageListService.GetTraceSalePageIds(this.ShopId)];this.market==="PX"&&n.push(this.RetailStoreService.GetHadSelectedService());this.$q.all(n).then(function(n){t.TraceSalePageIdsList=n[0].data.data;var i=n[1],r=null;i&&i.ReturnCode==="API0001"&&i.Data&&(r=i.Data.LocationId);t.GetShopSalePageBySearch(r)})},t.prototype.GetShopSalePageBySearch=function(n){var t=this,i,r;n===void 0&&(n=0);this.currentPageIndex=Math.floor(this.startIndex/this.maxCount);i=this.ConvertToDefaultCurrency(this.minPrice);r=this.ConvertToDefaultCurrency(this.maxPrice);this.SearchService.GetShopSalePageBySearch(this.ShopId,this.submitKeyword,i,r,this.shippingType,this.payType,this.order,this.startIndex,this.maxCount,this.displayScore,this.shopCategoryId,this.scoreThreshold,this.isResearch,n).then(function(n){t.SalePageBySearchList=n.Data.SalePageList||[];t.SalePageBySearchList.length!==0||t.minPrice||t.maxPrice||t.payType!==""||t.shippingType!==""?t.showNoResultView="":(t.showNoResultView="search-no-result",t.TrackEvent("搜尋-無結果","click",t.submitKeyword));t.TotalSize=n.Data.TotalSize;n.Data.PriceRange&&t.isPriceRange&&(t.MinPriceRange=n.Data.PriceRange.Min,t.MaxPriceRange=n.Data.PriceRange.Max,t.isPriceRange=!1);n.Data.CurrentScoreThreshold&&(t.scoreThreshold=parseFloat(n.Data.CurrentScoreThreshold));t.isFirstPageLoad?(t.isFirstPageLoad=!1,t.AdobeAnalyticsUtility.StoreSearchResult("Search Result","Search",{searchTerm:t.submitKeyword,totalResultsCount:t.TotalSize},t.SalePageBySearchList)):!t.isFirstPageLoad&&t.paginationSeenPages.indexOf(t.currentPageIndex)<0&&t.AdobeAnalyticsUtility.LoadMoreProducts(t.SalePageBySearchList);t.paginationSeenPages.indexOf(t.currentPageIndex)<0&&t.paginationSeenPages.push(t.currentPageIndex);t.SetGoogleTagManagerDataLayerSearch();t.LoadingBarUtility.HideLoadingBar();angular.element(document.getElementsByClassName("section-board")[0]).removeClass("fad-out").addClass("fad-in")})},t.prototype.AddToCart=function(n,t,i,r){var u=this;this.AdobeAnalyticsUtility.trackQuickView({id:n,name:t,price:i});this.ShoppingCartUtility.AddToCart(n,this.ShopId,null,r,"搜尋結果頁").then(function(n){if(n){u.ShoppingCartUtility.AddToCartResult(n,750,!1);return}u.ShoppingCartUtility.AddToCartResult(u.$translate.instant("frontend.typescripts.components.success_add"),750,!0)})},t.prototype.SetIsFav=function(n){var t=this;n.IsFav?(n.disappearingLove=!0,this.FavoriteUtility.Remove(n.Id).then(function(){n.IsFav=!n.IsFav;t.TrackEvent("搜尋-商品結果","移除收藏",n.Id.toString())})):(n.disappearingLove=!1,this.FavoriteUtility.Add(n.Id).then(function(){n.IsFav=!n.IsFav}),this.TrackEvent("搜尋-商品結果","收藏商品",n.Id.toString()))},t.prototype.TrackEvent=function(n,t,i,r){this.GoogleAnalyticsUtility.TrackEvent(n,t,i,r)},t.prototype.TrackProductEvent=function(n){n<6?this.TrackEvent("搜尋-商品結果","click","商品點擊(前6筆)"):this.TrackEvent("搜尋-商品結果","click","商品點擊(其他)");this.AdobeAnalyticsUtility.SearchSuggestionClick({searchTerm:this.submitKeyword,searchSuggestionName:this.SalePageBySearchList[n].Title})},t.prototype.SetGoogleTagManagerDataLayerSearch=function(){var n=[],t=[];this.SalePageBySearchList.length>0?(n.push(this.submitKeyword),this.SalePageBySearchList.map(function(n){t.push(n.Id.toString())}),this.GoogleTagManagerDataLayerUtility.SearchSubmit(n,t)):this.GoogleTagManagerDataLayerUtility.SearchSubmit(n,t)},t.prototype.ConvertToDefaultCurrency=function(n){return n?+(n/this.currentRate).toFixed(2):null},t.prototype.toggleAccurateComparison=function(){this.inputKeyword=this.replaceDoubleQuotes(this.inputKeyword);this.submitKeyword=this.isUseAccurateComparison?'"'+this.inputKeyword+'"':this.replaceDoubleQuotes(this.inputKeyword)},t.$inject=["DeviceValue","Mall.Config","$scope","$log","$window","$timeout","$location","$translate","$filter","$q","ShopId","TraceSalePageListService","FavoriteUtility","SearchService","UrlUtility","LoadingBarUtility","ShoppingCartUtility","GoogleAnalyticsUtility","GoogleAnalyticsEcommerceUtility","AdobeAnalyticsUtility","FreezeBodyUtility","FacebookUtility","GoogleTagManagerDataLayerUtility","OfficialShopProfile","CurrencyFormat","Market","CookieUtility","GoogleAdwordsUtility","RetailStoreService","SoldOutType"],t}();t.SearchIndexController=i;angular.module("NineYi.Mall.Controllers").controller("SearchIndexController",i)})(i=t.Controllers||(t.Controllers={}))})(t=n.Mall||(n.Mall={}))}(NineYi||(NineYi={})),function(n){var t;(function(n){var t;(function(n){var t=function(){function n(n,t,i){this.config=n;this.$q=t;this.$http=i}return n.prototype.GetHadSelectedService=function(){var t=this.config.webapiUrl+"/Retailstore/HadSelectedService",n=this.$q.defer();return this.$http.get(t).then(function(t){n.resolve(t.data)}).catch(function(t){n.reject(t.data)}),n.promise},n.$inject=["Mall.Config","$q","$http"],n}();n.RetailStoreService=t;angular.module("NineYi.Mall.Services").service("RetailStoreService",t)})(t=n.Services||(n.Services={}))})(t=n.Mall||(n.Mall={}))}(NineYi||(NineYi={}))