1import{a as he}from"./chunk-OTUXRGWR.js";import{a as xe}from"./chunk-I5ZPH5CA.js";import{c as ve}from"./chunk-Y4USWBOI.js";import{a as de}from"./chunk-UJD7X752.js";import{a as fe}from"./chunk-QE4SGSMS.js";import"./chunk-722K2R47.js";import"./chunk-6CGZU3LR.js";import"./chunk-P6RAARJR.js";import"./chunk-LRSNC77N.js";import"./chunk-B2D3ZNIN.js";import"./chunk-ZMB7BYOX.js";import{b as ce}from"./chunk-PG356IOX.js";import"./chunk-DJLXGYOT.js";import"./chunk-QZKGI55F.js";import"./chunk-67IT4HQ6.js";import"./chunk-FMUJOZ5C.js";import"./chunk-NEZAQWLG.js";import"./chunk-A7HQZSIJ.js";import"./chunk-LPDEKHC4.js";import"./chunk-5CZSBVZS.js";import"./chunk-2QHSH4C5.js";import"./chunk-GAM63QEV.js";import{a as pe}from"./chunk-FHOHGYTL.js";import{a as _e}from"./chunk-FNMQQLVT.js";import{e as ue}from"./chunk-CG7IIIZ2.js";import{b as J}from"./chunk-OJI7DA27.js";import{b as Z,d as ee,e as te,f as M,g as ie,j as ae,k as re,n as oe,o as se,p as me,q as ge}from"./chunk-MA3UJZI3.js";import{e as le}from"./chunk-4ZBSEH5M.js";import{j as Q,k as X}from"./chunk-BLUPBYQY.js";import{a as ne}from"./chunk-QP2R5HQV.js";import"./chunk-WO4YLV4Q.js";import"./chunk-N5KHQ3PY.js";import"./chunk-RAU6IMNR.js";import{j as K,k as q,l as G,v as Y}from"./chunk-KMKRC7H4.js";import{$c as D,Fb as y,Jc as $,Mc as f,Nc as E,Oc as P,cb as U,fc as c,gc as o,ha as R,hb as r,hc as l,hd as I,ic as b,id as O,mc as F,nc as k,oa as V,pa as j,pc as H,sd as z,tb as m,ua as A,vc as N,xc as _,zb as B,zd as W}from"./chunk-WLVJBNFV.js";import"./chunk-HGJ4MBLN.js";var ye=n=>({"hidden-quantity":n}),be=n=>[n];function Ce(n,g){n&1&&b(0,"app-loading")}function Se(n,g){if(n&1&&(o(0,"div",3),y(1,Ce,1,0,"app-loading",2),l()),n&2){let e=_();r(),c("ngIf",e.loading)}}function we(n,g){n&1&&b(0,"embryo-PageTitle",12)}function Pe(n,g){n&1&&b(0,"embryo-PageTitle",13)}function Ie(n,g){if(n&1&&(o(0,"p",33)(1,"span"),f(2),I(3,"translate"),l(),o(4,"span",34),f(5),l()()),n&2){let e=_().$implicit;r(2),P(" ",O(3,2,"receipt.sku"),": "),r(3),E(e==null?null:e.sku)}}function Oe(n,g){if(n&1&&(o(0,"p",33)(1,"span"),f(2),I(3,"translate"),l(),o(4,"span",34),f(5),l()()),n&2){let e=_().$implicit;r(2),P(" ",O(3,2,"receipt.barcode"),": "),r(3),E(e==null?null:e.barcode)}}function Me(n,g){if(n&1&&(o(0,"div",35),b(1,"app-product-price",36),l()),n&2){let e=_().$implicit;c("ngClass",D(6,ye,!(e!=null&&e.in_stock)||!(e!=null&&e.active)||(e==null?null:e.soft_deleted))),r(),c("price",(e==null?null:e.price)??null)("discountPrice",(e==null?null:e.discount_price)??null)("inStock",(e==null?null:e.in_stock)??!0)("paymentDiscountNameEn",(e==null?null:e.payment_methods_discount_name_en)??null)("paymentDiscountNameAr",(e==null?null:e.payment_methods_discount_name_ar)??null)}}function Le(n,g){n&1&&b(0,"app-loading")}function Fe(n,g){if(n&1){let e=H();o(0,"div",14)(1,"div",15)(2,"div",16)(3,"a",17),b(4,"img",18),l(),o(5,"div",19),b(6,"app-product-labels",20),l()()(),o(7,"div",21)(8,"div",22)(9,"div",23)(10,"a")(11,"h5",24),f(12),l(),y(13,Ie,6,4,"p",25)(14,Oe,6,4,"p",25),l()(),o(15,"div",26),F(16),o(17,"button",27),N("click",function(){let a=V(e).$implicit,s=_(2);return j(s.redirectToProductFun(a))}),o(18,"span"),f(19),I(20,"translate"),l()(),k(),l(),o(21,"div",26),y(22,Me,2,8,"div",28),l(),o(23,"div",29)(24,"div",30)(25,"a",31),N("click",function(){let a=V(e),s=a.$implicit,u=a.index,p=_(2);return j(s.loading?null:p.openConfirmationPopup(s,u))}),y(26,Le,1,0,"app-loading",2),o(27,"mat-icon",32),f(28," close "),l()()()()()()()}if(n&2){let e=g.$implicit,t=_(2);r(4),c("src",e==null?null:e.image,U),r(),$("chip-ar",t.lang()=="ar"),r(),c("product",e),r(6),P(" ",t.lang()=="en"?e==null?null:e.name_en:e==null?null:e.name_ar," "),r(),c("ngIf",(t.environmentVariables==null?null:t.environmentVariables.SHOW_SKU_PRODUCT_DETAILS)===!0||(t.environmentVariables==null?null:t.environmentVariables.SHOW_SKU_PRODUCT_DETAILS)===null),r(),c("ngIf",(t.environmentVariables==null?null:t.environmentVariables.SHOW_BARCODE_PRODUCT_DETAILS)===!0&&(e==null?null:e.barcode)),r(5),P(" ",O(20,10,"productDetails.viewDetails")," "),r(3),c("ngIf",(e==null?null:e.price)&&(t.environmentVariables==null?null:t.environmentVariables.GUEST_CAN_VIEW_PRICES)),r(4),c("ngIf",e.loading)}}function ke(n,g){if(n&1&&(o(0,"div",4),F(1),y(2,we,1,0,"embryo-PageTitle",5)(3,Pe,1,0,"embryo-PageTitle",6),k(),o(4,"div",7)(5,"div",8)(6,"div",9)(7,"div",10),y(8,Fe,29,12,"div",11),l()()()()()),n&2){let e=_();r(2),c("ngIf",e.lang()=="en"),r(),c("ngIf",e.lang()=="ar"),r(5),c("ngForOf",e.favoritesList)}}function Ee(n,g){if(n&1&&(F(0),o(1,"div",37)(2,"div",38)(3,"mat-icon",39),f(4," favorite "),l()(),o(5,"h4"),f(6),I(7,"translate"),l(),o(8,"a",40),f(9),I(10,"translate"),l()(),k()),n&2){let e=_();r(6),E(O(7,3,"checkout.favoritesEmpty")),r(2),c("routerLink",D(7,be,"/"+e.lang()+"/")),r(),P(" ",O(10,5,"cart.goForShopping"))}}var lt=(()=>{class n{embryoService;translate;checkoutService;toastrService;userLoginServies;router;HomeService;confgServ;metaService;slugNameService;marketingService;toast;storage;windowService;cdRef;loading=!1;favoritesList=[];languageService=R(ge);lang=this.languageService.currentLanguage;destroyRef=R(A);isAuthUser;cartList;environmentVariables;redirectToProduct=!1;loadingFav=!0;isRemoving=!1;_hasFiredViewItemList=!1;constructor(e,t,a,s,u,p,C,S,i,v,x,w,d,L,h){this.embryoService=e,this.translate=t,this.checkoutService=a,this.toastrService=s,this.userLoginServies=u,this.router=p,this.HomeService=C,this.confgServ=S,this.metaService=i,this.slugNameService=v,this.marketingService=x,this.toast=w,this.storage=d,this.windowService=L,this.cdRef=h,this.cartList=[],this.confgServ.getenvConfig().pipe(M(this.destroyRef)).subscribe(T=>{this.environmentVariables=T,this.redirectToProduct=this.environmentVariables?.PRODUCT_TYPE=="main"}),z(()=>{let T=this.lang();this.environmentVariables&&(T=="en"?this.metaService.setTitle(`Favorites - ${this.environmentVariables?.APP_NAME}`):this.metaService.setTitle(`\u0627\u0644\u0645\u0641\u0636\u0644\u0647 - ${this.environmentVariables?.APP_NAME_AR}`))})}ngOnInit(){this.HomeService.isInitLoading.pipe(M(this.destroyRef)).subscribe(t=>{this.loading=!!t});let e=this.storage.getLocal("auth_user_crocs",null);this.isAuthUser=e||null,this.getFavorites(),this.getCartData()}ngOnDestroy(){this.marketingService.resetViewItemListDedup()}getFavorites(){this.loadingFav=!0,this.embryoService.favouritesListSub.pipe(M(this.destroyRef)).subscribe(e=>{e.length>0?this.loadingFav=!1:setTimeout(()=>{this.loadingFav=!1,this.cdRef.detectChanges()},2e3),this.favoritesList=e,this.favoritesList.forEach(t=>{t.routingName=encodeURIComponent((t.name||"").replace(/\s/g,"-")),t.slug_name=this.getProductName(t)}),!this._hasFiredViewItemList&&this.favoritesList.length>0&&(this._hasFiredViewItemList=!0,this.fireWishlistViewItemList()),this.cdRef.detectChanges()})}fireWishlistViewItemList(){let e=this.lang(),t=e==="en"?this.environmentVariables?.localization?.currency_code_en:this.environmentVariables?.localization?.currency_code_ar,a=this.windowService.getWindow()?.location?.origin||"",s="wishlist",u="Wishlist",p=this.favoritesList.map(i=>{let v=i?.price||0,x=i?.discount_price?i.discount_price:v,w=[i?.category?.id,...i?.category?.sub_categories?.map(h=>
1h.id)||[]].filter(Boolean),d=e==="en"?[i?.category?.name,...i?.category?.sub_categories?.map(h=>h.name)||[]].filter(Boolean):[i?.category?.name_ar||i?.category?.name,...i?.category?.sub_categories?.map(h=>h.name_ar||h.name)||[]].filter(Boolean),L=e==="en"?i?.slug:i?.slug_ar||i?.slug;return this.marketingService.stripNullish({item_id:i?.sku!=null?String(i.sku):null,item_name:(e==="en"?i?.name_en:i?.name_ar)||i?.name||null,item_brand:i?.details?.brand?.name||i?.brand?.name||null,item_category:e==="en"?i?.category?.name||null:i?.category?.name_ar||i?.category?.name||null,item_category2:e==="en"?i?.category?.sub_categories?.[0]?.name||null:i?.category?.sub_categories?.[0]?.name_ar||i?.category?.sub_categories?.[0]?.name||null,item_category3:e==="en"?i?.category?.sub_categories?.[1]?.name||null:i?.category?.sub_categories?.[1]?.name_ar||i?.category?.sub_categories?.[1]?.name||null,category_id:i?.category?.id!=null?String(i.category.id):null,all_category_ids:w.length?w.join(", "):null,all_categories:d.length?d.join(", "):null,price:typeof x=="number"?Number(x.toFixed(2)):null,shelf_price:typeof v=="number"?Number(v.toFixed(2)):null,discount:i?.discount_price?Number((v-x).toFixed(2)):0,currency:t||null,item_availability:i?.in_stock?"available":"unavailable",item_image_link:i?.image||null,item_link:L?`${a}/${e}/${L}`:null,item_list_id:s,item_list_name:u,coupon:this.marketingService.resolveProductCoupon(i,e),is_rx_medication:i?.need_prescription===1})}),C=this.marketingService.stripNullish({currency:t||null,item_list_id:s,item_list_name:u,items:p}),S=[e,s,this.favoritesList.map(i=>i?.sku??i?.id??"").join(",")].join("|");this.marketingService.dataLayerViewItemListEvent({ecommerce:C},S)}getCartData(){this.embryoService.productCartSub.pipe(M(this.destroyRef)).subscribe(e=>{Array.isArray(e)&&(this.cartList=e)})}openConfirmationPopup(e,t=null){this.unFavourite(e,t)}unFavourite(e,t=null){if(this.isRemoving)return;this.isRemoving=!0,e.loading=!0,this.cdRef.detectChanges();let a=t||this.favoritesList.findIndex(s=>s.id===e.id);this.isAuthUser?this.HomeService.removeFromFavList(e.id).pipe(M(this.destroyRef)).subscribe({next:s=>{if(e.loading=!1,s.code===200){let p=this.lang()==="en"?this.environmentVariables?.localization?.currency_code_en:this.environmentVariables?.localization?.currency_code_ar;this.marketingService.dataLayerProductListEvent("remove_from_wishlist",p,[e]),this.favoritesList.splice(a,1),this.embryoService.favouritesListSub.next(this.favoritesList),this.removeMsg()}this.isRemoving=!1,this.cdRef.detectChanges()},error:()=>{e.loading=!1,this.isRemoving=!1,this.cdRef.detectChanges()}}):(e.loading=!1,this.favoritesList.splice(a,1),this.embryoService.favouritesListSub.next(this.favoritesList),this.removeMsg(),this.isRemoving=!1,this.cdRef.detectChanges())}removeMsg(){let e=this.lang()==="en"?"Product removed from wishlist":"\u0644\u0642\u062F \u0642\u0645\u062A \u0628\u0627\u0632\u0627\u0644\u0629 \u0647\u0630\u0627 \u0627\u0644\u0645\u0646\u062A\u062C \u0645\u0646 \u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0645\u0641\u0636\u0644\u0629";this.toast.error(e)}getNameRouting(e){if(!e?.active)this.router.navigate(["/"+this.lang()+"/not-available"]);else{let t=encodeURIComponent(e.name||"").replace(/\s/g,"-"),a=e.parent_id||e.id;this.router.navigate(["/"+this.lang()+"/products",e?.slug])}}getProductName(e){return this.slugNameService.getProductName(e)}fireSelectItem(e){let t=this.lang(),a=t==="en"?this.environmentVariables?.localization?.currency_code_en:this.environmentVariables?.localization?.currency_code_ar,s=t==="en"?e?.slug:e?.slug_ar||e?.slug,u=e?.price||0,p=e?.discount_price?e.discount_price:u,C={item_id:e?.sku||null,item_name:(t==="en"?e?.name_en:e?.name_ar)||e?.name||null,item_brand:e?.brand?.name||e?.details?.brand?.name||null,item_category:t==="en"?e?.category?.name||null:e?.category?.name_ar||e?.category?.name||null,price:Number(p.toFixed(2)),shelf_price:Number(u.toFixed(2)),discount:e?.discount_price?Number((u-p).toFixed(2)):0,item_availability:e?.in_stock?"available":"unavailable",is_rx_medication:e?.need_prescription===1,item_image_link:e?.image||null,item_link:s?`${this.windowService.getWindow()?.location?.origin||""}/${t}/${s}`:null,category_id:e?.category?.id!=null?String(e.category.id):null,coupon:this.marketingService.resolveProductCoupon(e,t)},S=t==="en"?e?.category?.sub_categories?.[0]?.name:e?.category?.sub_categories?.[0]?.name_ar||e?.category?.sub_categories?.[0]?.name;S&&(C.item_category2=S);let i=t==="en"?e?.category?.sub_categories?.[1]?.name:e?.category?.sub_categories?.[1]?.name_ar||e?.category?.sub_categories?.[1]?.name;i&&(C.item_category3=i);let v=Object.fromEntries(Object.entries(C).filter(([w,d])=>d!=null)),x=Object.fromEntries(Object.entries({currency:a||null}).filter(([w,d])=>d!=null));x.items=[v],this.marketingService.dataLayerDynamicEvent("select_item",{ecommerce:x})}redirectToProductFun(e){let t=e?.parent_id||e?.id;if(this.fireSelectItem(e),e?.slug)this.router.navigate(["/"+this.lang()+"/products",e?.slug]);else{let a=(e.name_en||"").replace(/[^\w\s]/gi,"-").replace(/ /g,"-");this.router.navigate(["/"+this.lang()+"/products",e?.slug])}}static \u0275fac=function(t){return new(t||n)(m(me),m(Z),m(ae),m(ie),m(ue),m(Q),m(_e),m(le),m(ve),m(de),m(se),m(re),m(ne),m(oe),m(W))};static \u0275cmp=B({type:n,selectors:[["app-favorites"]],decls:3,vars:3,consts:[["class","position-absolute",4,"ngIf"],["class","inner-container bg-white cart-page",4,"ngIf"],[4,"ngIf"],[1,"position-absolute"],[1,"inner-container","bg-white","cart-page"],["heading","Here\u2019s what\u2019s in your favorites","subHeading","",4,"ngIf"],["heading","\u0645\u0643\u0648\u0646\u0627\u062A \u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0645\u0641\u0636\u0644\u0629","subHeading","",4,"ngIf"],[1,"container","section-gap"],[1,"cart-wrapper"],[1,"cart-shop-list","mb-5","text-center","card-shadow"],[1,"position-relative"],["class","fx-layout-row-wrap fx-layout-align-start-center cart-item",4,"ngFor","ngForOf"],["heading","Here\u2019s what\u2019s in your favorites","subHeading",""],["heading","\u0645\u0643\u0648\u0646\u0627\u062A \u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0645\u0641\u0636\u0644\u0629","subHeading",""],[1,"fx-layout-row-wrap","fx-layout-align-start-center","cart
1-item"],[1,"fx-flex-xs-100","fx-flex-sm-100","fx-flex-md-10","fx-flex-lg-20","fx-flex-xl-20","cart-product-image"],[1,"cart-item-thumb"],[1,"p-link",2,"outline","none"],["loading","lazy","width","626","height","800","onError","this.src='./assets/images/placeholder200.jpg';","default","./assets/images/placeholder200.jpg","loading","lazy","alt","cart image","title","cart image",3,"src"],[1,"chip-container","d-flex","flex-column"],[3,"product"],[1,"fx-flex-xs-100","fx-flex-sm-100","fx-flex-md-90","fx-flex-lg-80","fx-flex-xl-80"],[1,"fx-layout-row-wrap","fx-layout-align-center-center","cart-product-info"],[1,"fx-flex-xs-100","fx-flex-sm-40","fx-flex-md-30","fx-flex-lg-40","fx-flex-xl-40"],[2,"cursor","pointer","outline","none","margin-bottom","0px"],["style","margin-bottom: 0px",4,"ngIf"],[1,"fx-flex-xs-50","fx-flex-sm-40","fx-flex-md-30","fx-flex-lg-20","fx-flex-xl-20"],["mat-raised-button","",1,"blueButton","w-150px","px-2",2,"outline","none !important","height","36px",3,"click"],["class","cart-item-price",3,"ngClass",4,"ngIf"],[1,"close-sm","fx-flex-xs-100","fx-flex-sm-100","fx-flex-md-20","fx-flex-lg-20","fx-flex-xl-20"],[1,"cart-item-price"],["href","javascript:void(0)",1,"accent-color","remove-cart",3,"click"],[1,"material-icons"],[2,"margin-bottom","0px"],[1,"sku-code"],[1,"cart-item-price",3,"ngClass"],["size","sm",3,"price","discountPrice","inStock","paymentDiscountNameEn","paymentDiscountNameAr"],[1,"section-gap-lg","text-center","cartEmpty"],[1,"mb-4"],["alt","favorites-empty",1,"material-icons","fav-icon"],["href","javascript:void(0)",1,"primary-color",3,"routerLink"]],template:function(t,a){t&1&&y(0,Se,2,1,"div",0)(1,ke,9,3,"div",1)(2,Ee,11,9,"ng-container",2),t&2&&(c("ngIf",a.loading),r(),c("ngIf",(a.favoritesList==null?null:a.favoritesList.length)&&!a.loading),r(),c("ngIf",!(a.favoritesList!=null&&a.favoritesList.length)&&!a.loading&&!a.loadingFav))},dependencies:[G,pe,he,q,X,ce,K,J,Y,te,xe,fe,ee],styles:['@charset "UTF-8";.fav-icon[_ngcontent-%COMP%]{font-size:120px;color:var(--brand-color);width:fit-content;height:fit-content}.hidden-quantity[_ngcontent-%COMP%]{display:none!important}.remove-cart[_ngcontent-%COMP%]{color:var(--brand-color)!important}.chip-container[_ngcontent-%COMP%]{position:absolute;top:5px;left:10px;z-index:9}.chip-container.chip-ar[_ngcontent-%COMP%]{right:10px;left:auto}.blueButton[_ngcontent-%COMP%]{background-color:var(--brand-color);color:#fff;height:30px!important;line-height:26px}.blueButton.w-150px[_ngcontent-%COMP%]{width:160px}.blueButton.w-50px[_ngcontent-%COMP%]{width:50px;font-size:20px;height:30px!important}.blueButton.w-50px[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{height:30px;line-height:26px;display:block;width:100%;text-align:center}.blueButton[_ngcontent-%COMP%]:hover{background-color:#e0e0e0;color:#000}.fx-layout-row-wrap[_ngcontent-%COMP%]{display:flex!important;flex-wrap:wrap!important}.fx-layout-row-wrap[_ngcontent-%COMP%] .fx-flex-xs-100[_ngcontent-%COMP%]{flex:0 0 100%!important;max-width:100%!important;min-width:0!important}@media(min-width:960px){.fx-layout-row-wrap[_ngcontent-%COMP%] .fx-flex-md-10[_ngcontent-%COMP%], .fx-layout-row-wrap[_ngcontent-%COMP%] .fx-flex-lg-20[_ngcontent-%COMP%], .fx-layout-row-wrap[_ngcontent-%COMP%] .fx-flex-xl-20[_ngcontent-%COMP%]{flex:0 0 calc(20% - .8rem)!important;max-width:calc(20% - .8rem)!important;min-width:0!important}.fx-layout-row-wrap[_ngcontent-%COMP%] .fx-flex-md-90[_ngcontent-%COMP%], .fx-layout-row-wrap[_ngcontent-%COMP%] .fx-flex-lg-80[_ngcontent-%COMP%], .fx-layout-row-wrap[_ngcontent-%COMP%] .fx-flex-xl-80[_ngcontent-%COMP%]{flex:0 0 calc(80% - .2rem)!important;max-width:calc(80% - .2rem)!important;min-width:0!important}.fx-layout-row-wrap[_ngcontent-%COMP%] .fx-flex-md-30[_ngcontent-%COMP%], .fx-layout-row-wrap[_ngcontent-%COMP%] .fx-flex-lg-40[_ngcontent-%COMP%], .fx-layout-row-wrap[_ngcontent-%COMP%] .fx-flex-xl-40[_ngcontent-%COMP%]{flex:0 0 calc(40% - .5rem)!important;max-width:calc(40% - .5rem)!important;min-width:0!important}.fx-layout-row-wrap[_ngcontent-%COMP%] .fx-flex-md-20[_ngcontent-%COMP%], .fx-layout-row-wrap[_ngcontent-%COMP%] .fx-flex-lg-20[_ngcontent-%COMP%], .fx-layout-row-wrap[_ngcontent-%COMP%] .fx-flex-xl-20[_ngcontent-%COMP%]{flex:0 0 calc(20% - .5rem)!important;max-width:calc(20% - .5rem)!important;min-width:0!important}}@media(max-width:599px){.fx-layout-row-wrap[_ngcontent-%COMP%]{flex-direction:column!important;margin-bottom:15px!important}}@media(max-width:767px){.fx-layout-row-wrap[_ngcontent-%COMP%] .fx-flex-xs-50[_ngcontent-%COMP%]{max-width:none!important}}']})}return n})();export{lt as FavoritesComponent};
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.