1import{c as ct}from"./chunk-HZYMTJAC.js";import{c as st}from"./chunk-HQWCMVBA.js";import{c as it}from"./chunk-ULKMX75Z.js";import{a as L,b as A,e as E,i as rt,j as ot}from"./chunk-G5JMVVN3.js";import"./chunk-AUJUHNEY.js";import{C as et,R as _}from"./chunk-QO4X32Q5.js";import"./chunk-DZGLL7NB.js";import{$d as m,Cd as u,Dd as V,Ed as I,F as p,Fd as X,L as g,M as q,P as J,S as H,ab as l,ea as a,ee as Z,ff as y,ha as N,hf as B,i as z,ja as $,m as C,me as x,na as b,oa as f,oe as tt,qa as d,ra as K,s as h,t as P,we as O,xd as R,yd as Q}from"./chunk-7OF2HBWK.js";import"./chunk-GON3DZPO.js";var at="[Wish List] Create Wish List",It="[Wish List] Create Wish List Fail",S="[Wish List] Create Wish List Success",dt="[Wish List] Load Wish List",W="[Wish List] Load Wish List Success",mt="[Wish List] Load Wish List Fail",v=class{constructor(r){this.payload=r,this.type=at}},G=class extends m.EntitySuccessAction{constructor(r){super(L,r.cartId),this.payload=r,this.type=S}},k=class extends m.EntityFailAction{constructor(r){super(L,r.cartId,r.error),this.payload=r,this.type=It}},Y=class extends m.EntityLoadAction{constructor(r){super(L,r.cartId),this.payload=r,this.type=dt}},T=class extends m.EntitySuccessAction{constructor(r){super(L,r.cartId),this.payload=r,this.type=W}},F=class extends m.EntityFailAction{constructor(r){super(L,r.cartId,r.error),this.payload=r,this.type=mt}};function Lt(t){return`wishlist${t}`}var nt=(()=>{class t{constructor(e,i,o,M){this.store=e,this.userAccountFacade=i,this.multiCartFacade=o,this.userIdService=M}createWishList(e,i,o){this.store.dispatch(new v({userId:e,name:i,description:o}))}getWishList(){return P([this.getWishListId(),this.userAccountFacade.get(),this.userIdService.getUserId()]).pipe(H(),N(([e,i,o])=>{!e&&o!==Z&&i?.customerId&&this.loadWishList(o,i.customerId)}),p(([e])=>!!e),a(([e])=>this.multiCartFacade.getCart(e)))}loadWishList(e,i){this.store.dispatch(new Y({userId:e,cartId:Lt(i)}))}addEntry(e){this.getWishListIdWithUserId().subscribe(([i,o])=>this.multiCartFacade.addEntry(o,i,e,1))}removeEntry(e){this.getWishListIdWithUserId().subscribe(([i,o])=>this.multiCartFacade.removeEntry(o,i,e.entryNumber))}getWishListLoading(){return this.getWishListId().pipe(a(e=>this.multiCartFacade.isStable(e).pipe(h(i=>!i))))}getWishListId(){return this.multiCartFacade.getCartIdByType(_.WISH_LIST)}getWishListIdWithUserId(){return this.getWishListId().pipe(H(),$(this.userIdService.getUserId(),this.userAccountFacade.get()),N(([e,i,o])=>{!e&&o?.customerId&&this.loadWishList(i,o.customerId)}),p(([e])=>!!e),h(([e,i])=>[e,i]),J(1))}static{this.\u0275fac=function(i){return new(i||t)(d(R),d(it),d(et),d(B))}}static{this.\u0275prov=b({token:t,factory:t.\u0275fac})}}return t})(),ft=[nt,{provide:st,useExisting:nt}],lt=(()=>{class t{constructor(e,i,o,M){this.actions$=e,this.cartConnector=i,this.userIdService=o,this.store=M,this.logger=K(tt),this.createWishList$=u(()=>this.actions$.pipe(I(at),h(s=>s.payload),a(s=>this.cartConnector.create(s.userId).pipe(a(n=>this.cartConnector.save(s.userId,n.code??"",s.name,s.description).pipe(a(c=>[new G({cart:c,cartId:E(c,s.userId)})]),g(c=>C([new k({cartId:n.code??"",error:y(c,this.logger)})])))))))),this.loadWishList$=u(()=>this.actions$.pipe(I(dt),h(s=>s.payload),q(s=>{let{userId:n,cartId:c}=s;return this.cartConnector.loadAll(n).pipe(a(w=>{let U=c,D=w.find(pt=>pt.name===U),j=[];return j.push(D?new T({cart:D,cartId:E(D,n)}):new v({userId:n,name:U})),j.push(new A.RemoveCart({cartId:U})),j}),g(w=>C([new F({cartId:c,error:y(w,this.logger)})])))}))),this.resetWishList$=u(()=>this.actions$.pipe(I(O.LANGUAGE_CHANGE,O.CURRENCY_CHANGE),$(this.userIdService.getUserId(),this.store.pipe(p(s=>!!s.cart),Q(ot.getCartIdByTypeFactory(_.WISH_LIST)))),a(([,s,n])=>n?this.cartConnector.load(s,n).pipe(a(c=>[new T({cart:c??{},cartId:E(c,s)})]),g(c=>C([new F({cartId:n,error:y(c,this.logger)})]))):z))),this.setWishListId$=u(()=>this.actions$.pipe(I(S,W),h(s=>{switch(s.type){case S:case W:return new A.SetCartTypeIndex({cartType:_.WISH_LIST,cartId:s.meta.entityId})}}),p(x))),this.setWishListData$=u(()=>this.actions$.pipe(I(S,W),h(s=>{switch(s.type){case S:case W:return new A.SetCartData({cart:s.payload.cart,cartId:s.payload.cartId})}}),p(x)))}static{this.\u0275fac=function(i){return new(i||t)(d(V),d(rt),d(B),d(R))}}static{this.\u0275prov=b({token:t,factory:t.\u0275fac})}}return t})(),St=[lt],Wt=(()=>{class t{static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275mod=l({type:t})}
1static{this.\u0275inj=f({imports:[X.forFeature(St)]})}}return t})(),ht=(()=>{class t{static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275mod=l({type:t})}static{this.\u0275inj=f({providers:[...ft],imports:[Wt]})}}return t})();var Ot=(()=>{class t{static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275mod=l({type:t})}static{this.\u0275inj=f({imports:[ct,ht]})}}return t})();export{Ot as WishListModule};
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.