1import{a as Ae,b as X,c as Fe}from"./chunk-LUDPQU7F.js";import{a as ze}from"./chunk-I3SEYS3T.js";import{E as W,F as Y,G as Be,Ya as K,a as _e,b as Ee,ga as J,ua as je,x as De}from"./chunk-NGBJFWLN.js";import"./chunk-QHEMPVMO.js";import{S as Ve,m as Ie}from"./chunk-ZXTQ5JKD.js";import{E as ye,F as Me,J as B,K as Oe,Q as Te,b as Ce,i as xe,k as be,r as Pe}from"./chunk-N4XVFUBV.js";import{f as G,l as ge,m as D}from"./chunk-F2VH75IA.js";import"./chunk-YL5EN2ND.js";import"./chunk-LU7SHRLU.js";import"./chunk-RU6CMUDW.js";import"./chunk-5FYK4FI5.js";import{c as ue}from"./chunk-I7AE3TTC.js";import{a as fe}from"./chunk-LB65UPQQ.js";import"./chunk-JVPQEGKT.js";import{b as P}from"./chunk-JVOMRKZK.js";import{c as he}from"./chunk-4M5HJDIV.js";import"./chunk-6WFRNLAU.js";import"./chunk-R4ZM4GAV.js";import{E as we,c as Se,g as ve,l as ke,q as Le}from"./chunk-IFLMM6HN.js";import"./chunk-NE32SHGM.js";import{E as Q,u as me,v as U}from"./chunk-ZGBGIOV6.js";import{$c as H,Ab as ce,Ad as pe,Bb as r,Bc as j,Dc as S,F as ne,G as ee,Gb as F,Ic as h,Kc as c,Nb as g,Pa as p,Qa as m,Ub as E,Uc as w,Wc as y,Yb as de,Zc as v,_ as re,_b as I,_c as V,a as R,ad as T,b as N,ba as oe,da as se,fa as ae,ha as A,kc as k,lc as C,n as ie,nc as x,qc as M,rc as O,rd as z,sc as f,tc as a,uc as o,va as $,vc as d,wb as q,wd as u,xb as le,xd as _}from"./chunk-YD4KC2VH.js";function Ze(t,l){if(t&1){let e=S();a(0,"div",12)(1,"button",13),h("click",function(i){p(e);let s=c();return m(s.onDuplicate(i))}),d(2,"i",14)(3,"span",15),o(),a(4,"button",16),h("click",function(i){p(e);let s=c();return m(s.onDelete(i))}),d(5,"i",17)(6,"span",18),o()()}}var Ne=(()=>{class t{constructor(){this.shouldDisplayVolume=!1,this.cardClicked=new F,this.shareClicked=new F,this.deleteClicked=new F,this.duplicateClicked=new F,this.menuOpen=!1}get isEmpty(){return!this.shareList?.shareListProducts?.length}onShareClick(e){if(this.isEmpty){e.show(),setTimeout(()=>e.hide(),2500);return}this.shareClicked.emit()}toggleMenu(e){e.stopPropagation(),this.menuOpen=!this.menuOpen}closeMenu(){this.menuOpen=!1}onDuplicate(e){e.stopPropagation(),this.menuOpen=!1,this.duplicateClicked.emit()}onDelete(e){e.stopPropagation(),this.menuOpen=!1,this.deleteClicked.emit()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=E({type:t,selectors:[["share-list-card"]],hostBindings:function(n,i){n&1&&h("click",function(){return i.closeMenu()},ce)},inputs:{shareList:"shareList",shouldDisplayVolume:"shouldDisplayVolume"},outputs:{cardClicked:"cardClicked",shareClicked:"shareClicked",deleteClicked:"deleteClicked",duplicateClicked:"duplicateClicked"},decls:15,vars:12,consts:[["shareTip","bs-tooltip"],[1,"sl-rowitem"],[1,"sl-rowmain",3,"click"],[3,"shareList","shouldDisplayVolume"],[1,"sl-row-actions",3,"click"],["translate","cart.share.list.edit",1,"button","button-tertiary","button-small",3,"click"],["triggers","",1,"button","button-primary","button-small","sl-card-share-btn",3,"click","tooltip"],["aria-hidden","true",1,"fa-solid","fa-link","margin-right-8"],["translate","cart.share.list.share.link"],[1,"sl-menu-wrap"],[1,"sl-iconghost",3,"click"],["aria-hidden","true",1,"fa-solid","fa-ellipsis"],[1,"sl-menu"],[1,"sl-menu-item",3,"click"],["aria-hidden","true",1,"fa-solid","fa-copy"],["translate","cart.share.list.duplicate.list"],[1,"sl-menu-item","danger",3,"click"],["aria-hidden","true",1,"fa-solid","fa-trash-can"],["translate","cart.share.list.delete.list"]],template:function(n,i){if(n&1){let s=S();a(0,"div",1)(1,"div",2),h("click",function(){return p(s),m(i.cardClicked.emit())}),d(2,"share-list-summary",3),o(),a(3,"div",4),h("click",function(L){return p(s),m(L.stopPropagation())}),a(4,"button",5),h("click",function(){return p(s),m(i.cardClicked.emit())}),o(),a(5,"button",6,0),u(7,"translate"),h("click",function(){p(s);let L=w(6);return m(i.onShareClick(L))}),d(8,"i",7)(9,"span",8),o(),a(10,"div",9)(11,"button",10),u(12,"translate"),h("click",function(L){return p(s),m(i.toggleMenu(L))}),d(13,"i",11),o(),C(14,Ze,7,0,"div",12),o()()()}n&2&&(r(2),f("shareList",i.shareList)("shouldDisplayVolume",i.shouldDisplayVolume),r(3),y("is-disabled",i.isEmpty),f("tooltip",_(7,8,"cart.share.list.share.disabled.tooltip")),k("aria-disabled",i.isEmpty),r(6),k("aria-label",_(12,10,"cart.share.list.more")),r(3),x(i.menuOpen?14:-1))},dependencies:[Q,K,J,D,Be,B],styles:[`[_nghost-%COMP%]{display:block;background:#fff;transition:background .14s}.sl-rowitem[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:18px;padding:20px 24px}.sl-rowmain[_ngcontent-%COMP%]{flex:1;min-width:0;cursor:pointer}.sl-row-actions[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:14px;flex:none}.sl-card-share-btn[_ngcontent-%COMP%]{min-width:auto}.sl-card-share-btn.is-disabled[_ngcontent-%COMP%]{opacity:.32;cursor:not-allowed}.sl-card-share-btn.is-disabled[_ngcontent-%COMP%]:hover, .sl-card-share-btn.is-disabled[_ngcontent-%COMP%]:focus-visible{background-color:#1d1d1d!important}.sl-menu-wrap[_ngcontent-%COMP%]{position:relative}.sl-iconghost[_ngcontent-%COMP%]{background:transparent;border:0;cursor:pointer;width:36px;height:36px;border-radius:999px;display:inline-flex;align-items:center;justify-content:center;color:#a29e9b;transition:background .14s,color .14s}.sl-iconghost[_ngcontent-%COMP%]:hover{background:#f2efed;color:#3f3e3d}.sl-menu[_ngcontent-%COMP%]{position:absolute;top:44px;right:0;width:max-content;background:#fff;border-radius:12px;box-shadow:0 24px 48px -12px #0a0d122e;border:1px solid #DEDAD7;padding:6px;z-index:40}.sl-menu-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:10px;width:100%;text-align:left;padding:10px 12px;border:0;background:transparent;cursor:pointer;font-size:14px;font-weight:500;color:#1d1d1d;border-radius:8px;white-space:nowrap;transition:background .12s}.sl-menu-item[_ngcontent-%COMP%]:hover{background:#f2efed}.sl-menu-item.danger[_ngcontent-%COMP%]{color:#e2062c}@media only screen and (max-width: 767px){.sl-rowitem[_ngcontent-%COMP%]{flex-wrap:wrap;gap:14px;padding:16px;position:relative}.sl-menu-wrap[_ngcontent-%COMP%]{position:absolute;top:8px;right:8px}.sl-rowmain[_ngcontent-%COMP%]{flex:1 1 100%}.sl-row-actions[_ngcontent-%COMP%]{width:100%;justify-content:flex-end;flex-wrap:nowrap;gap:12px}.sl-row-actions[_ngcontent-%COMP%] .button[_ngcontent-%COMP%]{min-width:auto}.sl-card-share-btn[_ngcontent-%COMP%]{flex:0 1 auto;min-width:0}} 2/*# sourceMappingURL=share-list-card.component-7NCUYO7G.css.map */`]})}}return t})();var Z=t=>({$implicit:t}),te=(t,l)=>l.usanaId;function rt(t,l){t&1&&(a(0,"div",14),d(1,"i",16),o())}function ot(t,l){t&1&&j(0)}function st(t,l){if(t&1&&I(0,ot,1,0,"ng-container",17),t&2){let e=l.$implicit;c(3);let n=w(21);f("ngTemplateOutlet",n)("ngTemplateOutletContext",z(2,Z,e))}}function at(t,l){if(t&1&&M(0,st,1,4,"ng-container",null,te),t&2){let e=c(2);O(e.searchResults)}}function lt(t,l){t&1&&d(0,"div",15)}function ct(t,l){if(t&1&&(a(0,"div",13),v(1),u(2,"translate"),o(),C(3,rt,2,0,"div",14)(4,at,2,0)(5,lt,1,0,"div",15)),t&2){let e=c();r(),T(" ",_(2,3,"cart.share.list.search.results")," (",e.searchResults.length,") "),r(2),x(e.isSearching?3:e.searchResults.length>0?4:5)}}function dt(t,l){t&1&&j(0)}function pt(t,l){if(t&1&&I(0,dt,1,0,"ng-container",17),t&2){let e=c(2),n=w(21);f("ngTemplateOutlet",n)("ngTemplateOutletContext",z(2,Z,e.pinnedProduct))}}function mt(t,l){t&1&&j(0)}function ht(t,l){if(t&1&&I(0,mt,1,0,"ng-container",17),t&2){let e=l.$implicit;c(3);let n=w(21);f("ngTemplateOutlet",n)("ngTemplateOutletContext",z(2,Z,e))}}function ut(t,l){if(t&1&&(d(0,"div",18),M(1,ht,1,4,"ng-container",null,te)),t&2){let e=c(2);r(),O(e.displayFeatured)}}function _t(t,l){t&1&&j(0)}function ft(t,l){if(t&1&&I(0,_t,1,0,"ng-container",17),t&2){let e=l.$implicit;c(3);let n=w(21);f("ngTemplateOutlet",n)("ngTemplateOutletContext",z(2,Z,e))}}function gt(t,l){if(t&1&&(d(0,"div",19),M(1,ft,1,4,"ng-container",null,te)),t&2){let e=c(2);r(),O(e.restProducts)}}function Ct(t,l){if(t&1&&(C(0,pt,1,4,"ng-container"),C(1,ut,3,0),C(2,gt,3,0)),t&2){let e=c();x(e.pinnedProduct?0:-1),r(),x(e.displayFeatured.length>0?1:-1),r(),x(e.restProducts.length>0?2:-1)}}function xt(t,l){if(t&1&&(a(0,"span",28),v(1),u(2,"translate"),o()),t&2){let e=c().$implicit;r(),T("",e.price.volume," ",_(2,2,"cart.share.list.vp"))}}function bt(t,l){t&1&&d(0,"i",30)(1,"span",31)}function St(t,l){t&1&&d(0,"i",32)(1,"span",33)}function vt(t,l){if(t&1){let e=S();a(0,"div",20),h("click",function(){let i=p(e).$implicit,s=c();return m(s.toggle(i))}),a(1,"div",21)(2,"div",22),d(3,"img",23),o(),a(4,"div",24),d(5,"div",25),a(6,"div",26)(7,"span",27),v(8),u(9,"usanacurrency"),u(10,"async"),o(),C(11,xt,3,4,"span",28),o()()(),a(12,"button",29),u(13,"translate"),h("click",function(i){let s=p(e).$implicit,b=c();return i.stopPropagation(),m(b.toggle(s))}),C(14,bt,2,0)(15,St,2,0),o()()}if(t&2){let e=l.$implicit,n=c();
2y("in",n.isInList(e.usanaId)),r(3),f("src",n.imageUrl(e),le),r(2),f("innerHTML",e.productDescription.fullDisplayName,q),r(3),V(_(10,12,_(9,10,e.price.price))),r(3),x(e.price.volume?11:-1),r(),y("button-selected",n.isInList(e.usanaId)),k("aria-label",_(13,14,n.isInList(e.usanaId)?"cart.share.list.remove.from.list":"cart.share.list.add.to.list")),r(2),x(n.isInList(e.usanaId)?14:15)}}var $e=(()=>{class t{constructor(e,n,i,s,b,L){this.bsModalRef=e,this.gqlShareListService=n,this.shareListCacheService=i,this.quickSearchService=s,this.landingService=b,this.productService=L,this.listName="",this.shopMode=P.SHOP,this.searchControl=new ke(""),this.searchResults=[],this.featuredProducts=[],this.displayFeatured=[],this.restProducts=[],this.allProducts=[],this.isSearching=!1,this.inList=new Map,this.productCount=0,this.subscriptions=new ie}ngOnInit(){this.landingService.getLandingFeaturedProducts().subscribe(e=>{this.featuredProducts=e?.featuredProducts??[],this.recomputeRest()},()=>this.featuredProducts=[]),this.productService.getAllProducts().subscribe(e=>{this.allProducts=e??[],this.recomputeRest()},()=>this.allProducts=[]),this.subscriptions.add(this.shareListCacheService.shareListsSubject.subscribe(e=>{let n=(e??[]).find(i=>i.shareListId===this.shareListId);this.currentList=n,this.inList=new Map,(n?.shareListProducts??[]).forEach(i=>{this.inList.set(i.usanaId,i.shareListProductId)}),this.productCount=n?.shareListProducts?.length??0,n?.listName&&(this.listName=n.listName)})),this.subscriptions.add(this.searchControl.valueChanges.pipe(oe(250),ae(),$(e=>!e||e.length<1?(this.searchResults=[],this.isSearching=!1,ee([])):(this.isSearching=!0,this.quickSearchService.doQuickSearch(e,P.QUICKSEARCH_RESULT_LIMIT,this.warehouse,this.shopMode).pipe(re(()=>ee([])))))).subscribe(e=>{this.isSearching=!1,this.searchResults=e??[]}))}ngOnDestroy(){this.subscriptions.unsubscribe()}get isSearchActive(){return!!this.searchControl.value&&this.searchControl.value.length>0}recomputeRest(){let e=this.pinnedProduct?.usanaId;this.displayFeatured=this.featuredProducts.filter(i=>i.usanaId!==e);let n=new Set(this.featuredProducts.map(i=>i.usanaId));this.restProducts=this.allProducts.filter(i=>i.usanaId!==e&&!n.has(i.usanaId))}imageUrl(e){return xe.getImageRelativeUrl(e?.productImages??[],"productImage","SM",0)}onNameSaved(e){let n=N(R({},this.currentList??{shareListId:this.shareListId}),{listName:e});this.currentList=n,this.listName=e,this.gqlShareListService.updateShareList(n).subscribe()}isInList(e){return this.inList.has(e)}toggle(e){let n=this.inList.get(e.usanaId);n!=null?this.gqlShareListService.removeShareListProduct(n).subscribe():this.gqlShareListService.adjQuantityToShareList(this.shareListId,e.usanaId,1).subscribe()}close(){this.bsModalRef.hide()}static{this.\u0275fac=function(n){return new(n||t)(g(ye),g(Y),g(W),g(je),g(ze),g(Ve))}}static{this.\u0275cmp=E({type:t,selectors:[["share-list-product-picker"]],decls:22,vars:14,consts:[["pickRow",""],[1,"modal-header","picker-head"],[3,"save","name","fontSize"],["type","button",1,"modal-close-icon",3,"click"],["aria-hidden","true",1,"fa-solid","fa-xmark"],[1,"picker-searchbar"],[1,"picker-searchwrap"],["aria-hidden","true",1,"fa-solid","fa-magnifying-glass","picker-search-ico"],["type","text","autocomplete","off",1,"picker-search",3,"formControl","placeholder"],[1,"picker-list"],[1,"picker-foot"],[1,"picker-foot-count"],["translate","cart.done",1,"button","button-primary","picker-done-btn",3,"click"],[1,"picker-subhead"],[1,"picker-loading"],["translate","cart.quicksearch.no.results",1,"picker-empty"],["aria-hidden","true",1,"fa-solid","fa-spinner","fa-spin"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],["translate","cart.share.list.featured",1,"picker-subhead"],["translate","cart.share.list.all.products",1,"picker-subhead"],[1,"picker-row",3,"click"],[1,"picker-row-main"],[1,"picker-row-thumb"],["alt","","loading","lazy",3,"src"],[1,"picker-row-info"],[1,"picker-row-name",3,"innerHTML"],[1,"picker-row-meta"],[1,"picker-row-price"],[1,"picker-row-vp"],[1,"button","button-primary","picker-add",3,"click"],["aria-hidden","true",1,"fa-solid","fa-check","margin-right-4"],["translate","cart.share.list.added"],["aria-hidden","true",1,"fa-solid","fa-plus","margin-right-4"],["translate","cart.share.list.add"]],template:function(n,i){if
2(n&1){let s=S();a(0,"div",1)(1,"share-list-name-edit",2),h("save",function(L){return p(s),m(i.onNameSaved(L))}),o(),a(2,"button",3),u(3,"translate"),h("click",function(){return p(s),m(i.close())}),d(4,"i",4),o()(),a(5,"div",5)(6,"div",6),d(7,"i",7)(8,"input",8),u(9,"translate"),o()(),a(10,"div",9),C(11,ct,6,5)(12,Ct,3,3),o(),a(13,"div",10)(14,"span",11)(15,"b"),v(16),o(),v(17),u(18,"translate"),o(),a(19,"button",12),h("click",function(){return p(s),m(i.close())}),o()(),I(20,vt,16,16,"ng-template",null,0,pe)}n&2&&(r(),f("name",i.listName)("fontSize",20),r(),k("aria-label",_(3,8,"cart.button.close")),r(6),f("formControl",i.searchControl)("placeholder",_(9,10,"cart.quicksearch.placeholder")),r(3),x(i.isSearchActive?11:12),r(5),V(i.productCount),r(),H(" ",_(18,12,i.productCount===1?"cart.share.list.product.singular":"cart.share.list.product.plural")," "))},dependencies:[Q,me,we,Se,ve,Le,D,X,U,B,G],styles:[`[_nghost-%COMP%]{display:flex;flex-direction:column;max-height:min(76vh,680px)}.picker-head[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:20px 24px;background:#fff;border-bottom:1px solid #DEDAD7;flex:none}.picker-searchbar[_ngcontent-%COMP%]{padding:20px 24px 14px;flex:none}.picker-searchwrap[_ngcontent-%COMP%]{position:relative}.picker-search-ico[_ngcontent-%COMP%]{position:absolute;left:16px;top:50%;transform:translateY(-50%);color:#a29e9b;pointer-events:none}.picker-search[_ngcontent-%COMP%]{width:100%;height:44px;padding:0 16px 0 44px;border-radius:8px;border:1px solid #CAC6C3;background:#fff;font-size:.95rem;color:#1d1d1d;outline:none;transition:box-shadow .16s,border-color .16s}.picker-search[_ngcontent-%COMP%]::placeholder{color:#a29e9b}.picker-search[_ngcontent-%COMP%]:hover{border-color:#b6b2af}.picker-search[_ngcontent-%COMP%]:focus{border-color:#334bd7;box-shadow:0 0 0 4px #334bd72e}.picker-list[_ngcontent-%COMP%]{overflow-y:scroll;flex:1;min-height:0;padding:0 12px 12px;scrollbar-gutter:stable;scrollbar-width:thin;scrollbar-color:#B6B2AF #F2EFED}.picker-list[_ngcontent-%COMP%]::-webkit-scrollbar{width:10px}.picker-list[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:#f2efed;border-radius:999px;margin:4px 0}.picker-list[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:#b6b2af;border-radius:999px;border:2px solid #F2EFED}.picker-list[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover{background:#a29e9b}.picker-subhead[_ngcontent-%COMP%]{position:sticky;top:0;z-index:1;background:#fff;padding:12px 12px 8px;font-size:13px;font-weight:700;letter-spacing:.1em;text-transform:uppercase;color:#5f5c5a}.picker-loading[_ngcontent-%COMP%], .picker-empty[_ngcontent-%COMP%]{text-align:center;color:#5f5c5a;padding:40px 24px}.picker-loading[_ngcontent-%COMP%]{font-size:1.5rem;color:#334bd7}.picker-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:14px;padding:9px 12px;border-radius:10px;cursor:pointer;transition:background .14s}.picker-row[_ngcontent-%COMP%]:hover{background:#f2efed}.picker-row-main[_ngcontent-%COMP%]{display:flex;align-items:center;gap:14px;flex:1;min-width:0}.picker-row-thumb[_ngcontent-%COMP%]{width:46px;height:46px;flex:none;border-radius:10px;overflow:hidden;background:#f2efed}.picker-row-thumb[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:cover;display:block}.picker-row-info[_ngcontent-%COMP%]{flex:1;min-width:0}.picker-row-name[_ngcontent-%COMP%]{font-weight:700;font-size:13px;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#1d1d1d}.picker-row-meta[_ngcontent-%COMP%]{display:flex;align-items:baseline;gap:8px;margin-top:3px}.picker-row-price[_ngcontent-%COMP%]{font-weight:700;font-size:13px;color:#1d1d1d}.picker-row-vp[_ngcontent-%COMP%]{font-size:13px;color:#5f5c5a;white-space:nowrap}.picker-add[_ngcontent-%COMP%]{flex:none;min-width:96px;transition:background .16s,color .16s,box-shadow .16s}.picker-foot[_ngcontent-%COMP%]{padding:18px 24px;border-top:1px solid #DEDAD7;display:flex;align-items:center;justify-content:space-between;flex:none}.picker-foot-count[_ngcontent-%COMP%]{font-size:13px;color:#5f5c5a}.picker-foot-count[_ngcontent-%COMP%] b[_ngcontent-%COMP%]{color:#1d1d1d}.picker-done-btn[_ngcontent-%COMP%]{min-width:auto}@media only screen and (max-width: 767px){.picker-head[_ngcontent-%COMP%], .picker-searchbar[_ngcontent-%COMP%]{padding-left:16px;padding-right:16px}.picker-foot[_ngcontent-%COMP%]{padding:14px 16px}.picker-row[_ngcontent-%COMP%]{flex-wrap:wrap;row-gap:10px}.picker-row-main[_ngcontent-%COMP%]{flex:1 1 100%}
2.picker-row-name[_ngcontent-%COMP%]{white-space:normal}.picker-add[_ngcontent-%COMP%]{margin-left:auto}} 3/*# sourceMappingURL=share-list-product-picker.component-CHZIE3JX.css.map */`]})}}return t})();var kt=(t,l)=>l.shareListId,Lt=(t,l)=>l.shareListProductId;function wt(t,l){if(t&1&&d(0,"general-error",3),t&2){let e=c();f("generalErrorClass","tab-notification red")("titleTag",e.sponsorErrorTag)("bodyTag","cart.shareable.sponsor.validation.error.body")}}function Pt(t,l){if(t&1){let e=S();a(0,"share-list-card",15),h("cardClicked",function(){let i=p(e).$implicit,s=c(3);return m(s.setActiveList(i,!0))})("shareClicked",function(){let i=p(e).$implicit,s=c(3);return m(s.openShareModal(i))})("duplicateClicked",function(){let i=p(e).$implicit,s=c(3);return m(s.duplicateList(i))})("deleteClicked",function(){let i=p(e).$implicit,s=c(3);return m(s.deleteListFromCard(i))}),o()}if(t&2){let e=l.$implicit,n=c(3);f("shareList",e)("shouldDisplayVolume",n.shouldDisplayVolume)}}function yt(t,l){if(t&1){let e=S();a(0,"div",8)(1,"span",9),v(2),u(3,"translate"),o(),a(4,"button",10),h("click",function(){p(e);let i=c(2);return m(i.createNewList())}),d(5,"i",11)(6,"span",12),o()(),a(7,"div",13),M(8,Pt,1,2,"share-list-card",14,kt),o()}if(t&2){let e=c(2);r(2),T(" ",e.shareLists.length," ",_(3,3,e.shareLists.length===1?"cart.share.list.singular":"cart.share.list.plural")," "),r(2),f("disabled",e.isBusy),r(4),O(e.shareLists)}}function Mt(t,l){if(t&1){let e=S();a(0,"div",7)(1,"div",16),d(2,"i",17),o(),d(3,"div",18)(4,"div",19),a(5,"button",20),h("click",function(){p(e);let i=c(2);return m(i.createNewList())}),d(6,"i",11)(7,"span",12),o()()}if(t&2){let e=c(2);r(5),f("disabled",e.isBusy)}}function Ot(t,l){if(t&1&&(a(0,"div",4)(1,"div"),d(2,"h1",5),o()(),d(3,"p",6),C(4,yt,10,5)(5,Mt,8,1,"div",7)),t&2){let e=c();r(4),x((e.shareLists==null?null:e.shareLists.length)>0?4:5)}}function Tt(t,l){if(t&1){let e=S();a(0,"button",46,0),u(2,"translate"),h("click",function(){p(e);let i=w(1),s=c(2);return m(s.onShareLinkClick(i))}),d(3,"i",47)(4,"span",48),o()}if(t&2){let e=c(2);y("is-disabled",e.isListEmpty),f("tooltip",_(2,4,"cart.share.list.share.disabled.tooltip")),k("aria-disabled",e.isListEmpty)}}function Et(t,l){t&1&&(a(0,"div",36)(1,"div",16),d(2,"i",49),o(),d(3,"div",50)(4,"div",51),o())}function It(t,l){t&1&&d(0,"div",52)}function Vt(t,l){if(t&1&&(a(0,"span",59),v(1),u(2,"translate"),o()),t&2){let e=c().$implicit;r(),T("",e.product.price.volume," ",_(2,2,"cart.share.list.vp"))}}function Dt(t,l){if(t&1){let e=S();C(0,It,1,0,"div",52),a(1,"div",53)(2,"div",54),d(3,"product-image",55),o(),a(4,"div",56),d(5,"div",57),a(6,"div",58),v(7),u(8,"usanacurrency"),u(9,"async"),C(10,Vt,3,4,"span",59),o()(),a(11,"div",60)(12,"div",61)(13,"button",62),u(14,"translate"),h("click",function(){let i=p(e).$implicit,s=c(2);return m(s.decrement(i))}),d(15,"i",63),o(),a(16,"span",64),v(17),o(),a(18,"button",65),u(19,"translate"),h("click",function(){let i=p(e).$implicit,s=c(2);return m(s.increment(i))}),d(20,"i",66),o()(),a(21,"button",67),u(22,"translate"),h("click",function(){let i=p(e).$implicit,s=c(2);return m(s.remove(i))}),d(23,"i",68),o()()()}if(t&2){let e=l.$implicit,n=l.$index,i=c(2);x(n>0?0:-1),r(3),f("images",e.product.productImages),r(2),f("innerHTML",e.product.productDescription.fullDisplayName,q),r(2),H(" ",_(9,12,_(8,10,e.product.price.price))," "),r(3),x(i.shouldDisplayVolume&&e.product.price.volume?10:-1),r(3),f("disabled",e.quantity<=1),k("aria-label",_(14,14,"cart.remove.one.label")),r(4),V(e.quantity),r(),k("aria-label",_(19,16,"cart.add.one.label")),r(3),k("aria-label",_(22,18,"cart.remove.label"))}}function Bt(t,l){if(t&1&&(a(0,"span",44),v(1),u(2,"translate"),o()),t&2){let e=c(2);r(),T("",e.shareList.totalVolume," ",_(2,2,"cart.share.list.vp"))}}function At(t,l){if(t&1){let e=S();a(0,"div",45)(1,"button",46,1),u(3,"translate"),h("click",function(){p(e);let i=w(2),s=c(2);return m(s.onShareLinkClick(i))}),d(4,"i",47)(5,"span",48),o()()}if(t&2){let e=c(2);r(),y("is-disabled",e.isListEmpty),f("tooltip",_(3,4,"cart.share.list.share.disabled.tooltip")),k("aria-disabled",e.isListEmpty)}}function Ft(t,l){if(t&1){let e=S();a(0,"div",4)(1,"div",21)(2,"button",22),h("click",function(){p(e);let i=c();return m(i.backToList())}),d(3,"span",23),o(),d(4,"i",24),a(5,"share-list-name-edit",25),h("save",function(i){p(e);let s=c();return m(s.onNameSaved(i))}),o()(),a(6,"div",26)(7,"button",27),h("click",function(){p(e);let i=c();
3return m(i.deleteShareList())}),d(8,"i",28)(9,"span",29),o(),C(10,Tt,5,6,"button",30),o()(),a(11,"div",31)(12,"div",32)(13,"button",33),h("click",function(){p(e);let i=c();return m(i.openPickerModal())}),d(14,"i",11)(15,"span",34),o()(),a(16,"div",35),C(17,Et,5,0,"div",36),M(18,Dt,24,20,null,null,Lt),o(),a(20,"div",37)(21,"span",38),d(22,"i",39)(23,"span",40),o(),a(24,"div",41),d(25,"span",42),a(26,"span",43),v(27),u(28,"usanacurrency"),u(29,"async"),o(),C(30,Bt,3,4,"span",44),o()()(),C(31,At,6,6,"div",45)}if(t&2){let e=c();r(5),f("name",e.shareList.listName)("fontSize",16)("maxWidth",260),r(2),f("disabled",e.isBusy),r(3),x(e.showUrlShareables?10:-1),r(7),x(e.shareList.shareListProducts.length===0?17:-1),r(),O(e.shareList.shareListProducts),r(9),V(_(29,11,_(28,9,e.shareList.totalPrice))),r(3),x(e.shouldDisplayVolume?30:-1),r(),x(e.showUrlShareables?31:-1)}}var mn=(()=>{class t extends _e{constructor(e,n,i,s,b,L,qe,He,Ue,Qe,Ge,We,Ye){super(n,e),this.userService=n,this.sessionService=i,this.gqlShareListService=s,this.shareListCacheService=b,this.shareListService=L,this.confirmDialogService=qe,this.markupService=He,this.analyticsService=Ue,this.customerCacheService=Qe,this.bsModalService=Ge,this.translateService=We,this.route=Ye,this.viewMode="list",this.isBusy=!0}ngOnInit(){this.shareListsSubscription=this.shareListCacheService.shareListsSubject.subscribe(e=>{e?.length===0?this.shareListService.createNewList([]).subscribe():e?.length>0?(this.isBusy=!1,this.autoSelectList(e)):this.shareLists=null}),this.shareListsSubscription.add(this.customerCacheService.customerSubject.watch().subscribe(e=>{Ce.validShareablesSponsor(e)||(this.sponsorErrorTag=e.sponsorshipStatus.messages?.length>0?"cart.shareable."+e.sponsorshipStatus.messages[0]:"cart.shareable.sponsor.validation.error.title")})),this.sessionService.getCurrentWarehouse().then(e=>{this.currentWarehouse=e}),this.shareListsSubscription.add(this.userService.getShopUser().subscribe(e=>{this.shouldDisplayVolume=e?.config?.shouldDisplayVolume??!1})),this.shareListsSubscription.add(this.route.queryParams.subscribe(e=>{let n=e[P.SHARE_LIST_STATE_PARAM];if(n&&this.shareLists?.length>0){let i=this.shareLists.find(s=>s.shareListId===+n);i&&this.setActiveList(i,!0)}})),this.setPageTitle()}ngOnDestroy(){this.shareListsSubscription.unsubscribe()}createNewList(){this.isBusy||(this.isBusy=!0,this.shareListService.createNewList([]).pipe(se(1),A(()=>this.isBusy=!1)).subscribe(e=>{this.analyticsService.createShareListEvent("shareList"),this.setActiveList(e,!0),this.openPickerModal()}))}onNameSaved(e){this.shareList=N(R({},this.shareList),{listName:e}),this.gqlShareListService.updateShareList(this.shareList).subscribe()}increment(e){this.adjQuantity(e.usanaId,1)}
3decrement(e){this.adjQuantity(e.usanaId,-1)}adjQuantity(e,n){this.gqlShareListService.adjQuantityToShareList(this.shareList.shareListId,e,n).subscribe()}remove(e){this.gqlShareListService.removeShareListProduct(e.shareListProductId).subscribe()}duplicateList(e){if(this.isBusy)return;this.isBusy=!0;let n=(e.shareListProducts??[]).map((i,s)=>({usanaId:i.usanaId,quantity:i.quantity,productOrder:s+1}));ne(this.translateService.translate("cart.share.list.copy.suffix")).pipe($(i=>{let s={listName:`${e.listName} ${i}`.trim(),shareListProducts:n};return this.gqlShareListService.createShareList(s)}),A(()=>this.isBusy=!1)).subscribe(()=>{this.analyticsService.createShareListEvent("shareList"),window.scrollTo({top:0,behavior:"smooth"})})}deleteListFromCard(e){let n=()=>{this.isBusy=!0,this.gqlShareListService.deleteShareList(e.shareListId).pipe(A(()=>this.isBusy=!1)).subscribe(()=>{this.analyticsService.deleteShareListEvent("shareList",e.shareListId)})};this.isBusy||this.confirmDialogService.open("md",{title:"cart.shareable.delete.confirm.title"},[{body:"cart.shareable.confirm.body.text",translate:!0}],{confirmAction:n,name:"cart.share.list.delete.list"},{show:!0})}deleteShareList(){let e=()=>{this.isBusy=!0,this.gqlShareListService.deleteShareList(this.shareList.shareListId).pipe(A(()=>this.isBusy=!1)).subscribe(()=>{this.analyticsService.deleteShareListEvent("shareList",this.shareList.shareListId),this.backToList()})};this.isBusy||this.confirmDialogService.open("md",{title:"cart.shareable.delete.confirm.title"},[{body:"cart.shareable.confirm.body.text",translate:!0}],{confirmAction:e},{show:!0})}autoSelectList(e){if(e?.length>0){let n=[...e].sort((s,b)=>b.shareListId-s.shareListId),i=this.shareList&&this.shareLists?this.shareLists.findIndex(s=>s.shareListId===this.shareList.shareListId):0;this.shareLists=n,this.shareList?this.shareLists[i]?.shareListId===this.shareList?.shareListId?this.setActiveList(this.shareLists[i]):i>=1&&this.shareLists[i-1]?this.setActiveList(this.shareLists[i-1]):this.setActiveList(this.shareLists[0]):this.setActiveList(this.shareLists[0])}}setActiveList(e,n=!1){this.shareList=e,this.shareOptions={shareType:P.SHARE_TYPE_SHARE_LIST,shareId:e.shareListId.toString(),shareFrom:P.SHARE_LIST_STATE},n&&(this.viewMode="detail",window.scrollTo({top:0}))}backToList(){this.viewMode="list"}get isListEmpty(){return!this.shareList?.shareListProducts?.length}onShareLinkClick(e){if(this.isListEmpty){e.show(),setTimeout(()=>e.hide(),2500);return}this.openShareModal(this.shareList)}openShareModal(e){this.bsModalService.show(Fe,{initialState:{shareList:e,shareOptions:{shareType:P.SHARE_TYPE_SHARE_LIST,shareId:e.shareListId.toString(),shareFrom:P.SHARE_LIST_STATE}},class:"modal-md"})}openPickerModal(){this.bsModalService.show($e,{initialState:{shareListId:this.shareList.shareListId,warehouse:this.currentWarehouse?.warehouse,listName:this.shareList.listName},class:"modal-lg"})}setPageTitle(){this.markupService.setTitleFromTranslationTag("cart.share.lists.header")}static{this.\u0275fac=function(n){return new(n||t)(g(ue),g(fe),g(Te),g(Y),g(W),g(Ae),g(Oe),g(Ee),g(be),g(Pe),g(Me),g(ge),g(he))}}static{this.\u0275cmp=E({type:t,selectors:[["share-list"]],features:[de],decls:4,vars:3,consts:[["topShareTip","bs-tooltip"],["bottomShareTip","bs-tooltip"],[1,"sl-wrap","sl-page"],[3,"generalErrorClass","titleTag","bodyTag"],[1,"sl-pagehead"],["translate","cart.share.lists.header",1,"sl-h1"],["translate","cart.share.list.page.description",1,"sl-page-desc"],[1,"sl-empty-card"],[1,"sl-toolbar"],[1,"sl-toolbar-count"],[1,"button","button-secondary","sl-newlist-btn",3,"click","disabled"],["aria-hidden","true",1,"fa-solid","fa-plus","margin-right-8"],["translate","cart.share.list.new.list"],[1,"sl-list"],[3,"shareList","shouldDisplayVolume"],[3,"cardClicked","shareClicked","duplicateClicked","deleteClicked","shareList","shouldDisplayVolume"],[1,"sl-empty-icon"],["aria-hidden","true",1,"fa-solid","fa-gift"],["translate","cart.share.list.empty.title",1,"sl-empty-title"],["translate","cart.share.list.empty.subtitle",1,"sl-empty-sub"],[1,"button","button-primary",3,"click","disabled"],[1,"sl
3-crumb"],[1,"button","button-link",3,"click"],["translate","cart.share.lists.header"],["aria-hidden","true",1,"fa-solid","fa-chevron-right","sl-crumb-sep"],[3,"save","name","fontSize","maxWidth"],[1,"sl-detail-actions"],[1,"sl-link-danger",3,"click","disabled"],["aria-hidden","true",1,"fa-solid","fa-trash-can","margin-right-4"],["translate","cart.share.list.delete.list"],["triggers","",1,"button","button-primary","button-small","sl-share-btn",3,"is-disabled","tooltip"],[1,"sl-card"],[1,"sl-card-top"],[1,"button","button-secondary","button-small","sl-addbtn",3,"click"],["translate","cart.share.list.add.products"],[1,"sl-lines"],[1,"sl-line-empty"],[1,"sl-totalbar"],[1,"sl-disclaimer"],["aria-hidden","true",1,"fa-solid","fa-info-circle","margin-right-4"],["translate","cart.share.list.price.disclaimer"],[1,"sl-total-group"],["translate","cart.autoorder.total",1,"sl-total-label"],[1,"sl-total-price"],[1,"sl-total-vp"],[1,"sl-bottom-link"],["triggers","",1,"button","button-primary","button-small","sl-share-btn",3,"click","tooltip"],["aria-hidden","true",1,"fa-solid","fa-link","margin-right-8"],["translate","cart.share.list.share.link"],["aria-hidden","true",1,"fa-solid","fa-box-open"],["translate","cart.share.list.detail.empty.title",1,"sl-empty-title"],["translate","cart.share.list.detail.empty.subtitle",1,"sl-empty-sub"],[1,"sl-line-div"],[1,"sl-line"],[1,"sl-line-thumb"],["imageClass","medium-thumbnail","imageType","productImage","imageSize","SM",3,"images"],[1,"sl-line-info"],[1,"sl-line-name",3,"innerHTML"],[1,"sl-line-price"],[1,"sl-line-vp"],[1,"sl-line-controls"],[1,"sl
3-stepper"],[3,"click","disabled"],["aria-hidden","true",1,"fa-solid","fa-minus"],[1,"sl-stepper-val"],[3,"click"],["aria-hidden","true",1,"fa-solid","fa-plus"],[1,"sl-rm",3,"click"],["aria-hidden","true",1,"fa-solid","fa-xmark"]],template:function(n,i){n&1&&(a(0,"div",2),C(1,wt,1,3,"general-error",3),C(2,Ot,6,1),C(3,Ft,32,13),o()),n&2&&(r(),x(i.sponsorErrorTag?1:-1),r(),x(i.viewMode==="list"?2:-1),r(),x(i.viewMode==="detail"&&i.shareList?3:-1))},dependencies:[K,Ie,De,J,D,Ne,X,U,B,G],styles:[`[_nghost-%COMP%]{display:block;background:#f2efed;min-height:calc(100vh - 110px)}.sl-wrap[_ngcontent-%COMP%]{width:min(1180px,100% - 48px);margin:0 auto}.sl-page[_ngcontent-%COMP%]{padding:40px 0 96px}.sl-pagehead[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:22px;flex-wrap:wrap}.sl-h1[_ngcontent-%COMP%]{font-size:36px;line-height:42px;font-weight:700;letter-spacing:-.02em;margin:0;color:#1d1d1d;overflow-wrap:anywhere}.sl-page-desc[_ngcontent-%COMP%]{color:#5f5c5a;max-width:560px;margin:-8px 0 24px;font-size:1rem;line-height:1.5;overflow-wrap:anywhere}.sl-toolbar[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:12px}.sl-toolbar-count[_ngcontent-%COMP%]{font-size:.95rem;color:#5f5c5a}.sl-toolbar-count[_ngcontent-%COMP%] b[_ngcontent-%COMP%]{color:#1d1d1d}.sl-newlist-btn[_ngcontent-%COMP%]{min-width:auto}.sl-list[_ngcontent-%COMP%]{background:#fff;border:1px solid #DEDAD7;border-radius:16px;box-shadow:0 1px 2px #0a0d120d}.sl-list[_ngcontent-%COMP%] share-list-card[_ngcontent-%COMP%]:first-of-type{border-top-left-radius:16px;border-top-right-radius:16px}.sl-list[_ngcontent-%COMP%] share-list-card[_ngcontent-%COMP%]:last-of-type{border-bottom-left-radius:16px;border-bottom-right-radius:16px}.sl-list[_ngcontent-%COMP%] share-list-card[_ngcontent-%COMP%] + share-list-card[_ngcontent-%COMP%]{border-top:1px solid #DEDAD7}.sl-empty-card[_ngcontent-%COMP%]{background:#fff;border:1px solid #DEDAD7;border-radius:16px;box-shadow:0 1px 2px #0a0d120d;padding:64px 24px;text-align:center;color:#5f5c5a}.sl-empty-icon[_ngcontent-%COMP%]{width:60px;height:60px;border-radius:999px;background:#f2efed;display:flex;align-items:center;justify-content:center;margin:0 auto 16px;font-size:26px;color:#5f5c5a}.sl-empty-title[_ngcontent-%COMP%]{font-weight:700;color:#1d1d1d;font-size:18px}.sl-empty-sub[_ngcontent-%COMP%]{margin:6px 0 18px;font-size:14px}.sl-crumb[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;font-size:14px;color:#5f5c5a;flex-wrap:wrap}.sl-crumb-sep[_ngcontent-%COMP%]{font-size:11px;color:#b6b2af}.sl-detail-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:16px}.sl-link-danger[_ngcontent-%COMP%]{background:0;border:0;padding:0;cursor:pointer;font-weight:600;font-size:15px;color:#e2062c;display:inline-flex;align-items:center}.sl-link-danger[_ngcontent-%COMP%]:hover{color:#bc0625}.sl-link-danger[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.sl-share-btn[_ngcontent-%COMP%]{min-width:auto}.sl-share-btn.is-disabled[_ngcontent-%COMP%]{opacity:.32;cursor:not-allowed}.sl-share-btn.is-disabled[_ngcontent-%COMP%]:hover, .sl-share-btn.is-disabled[_ngcontent-%COMP%]:focus-visible{background-color:#1d1d1d!important}.sl-card[_ngcontent-%COMP%]{background:#fff;border:1px solid #DEDAD7;border-radius:16px;box-shadow:0 1px 2px #0a0d120d;overflow:hidden}.sl-card-top[_ngcontent-%COMP%]{padding:24px 24px 8px}.sl-addbtn[_ngcontent-%COMP%]{min-width:auto}.sl-lines[_ngcontent-%COMP%]{padding:0 16px}.sl-line[_ngcontent-%COMP%]{display:flex;align-items:center;gap:18px;padding:18px 8px}.sl-line-div[_ngcontent-%COMP%]{height:1px;background:#dedad7}.sl-line-thumb[_ngcontent-%COMP%]{display:flex;flex:none;border-radius:10px;overflow:hidden;background:#f2efed}.sl-line-info[_ngcontent-%COMP%]{flex:1;min-width:0}.sl-line-name[_ngcontent-%COMP%]{font-weight:500;font-size:16px;line-height:21px;color:#1d1d1d}.sl-line-price[_ngcontent-%COMP%]{font-weight:700;font-size:15px;letter-spacing:-.01em;margin-top:4px;color:#1d1d1d}.sl-line-vp[_ngcontent-%COMP%]{margin-left:8px;font-weight:400;font-size:13px;color:#5f5c5a}.sl-line-empty[_ngcontent-%COMP%]{text-align:center;padding:48px 24px;color:#5f5c5a}
3.sl-line-controls[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px;flex:none}.sl-stepper[_ngcontent-%COMP%]{display:inline-flex;align-items:center;border:1px solid #DEDAD7;background:#fff;border-radius:9999px;flex:none}.sl-stepper[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{width:34px;height:32px;border:0;background:transparent;border-radius:9999px;cursor:pointer;display:flex;align-items:center;justify-content:center;color:#1d1d1d;transition:background .14s}.sl-stepper[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:hover:not(:disabled){background:#f2efed}.sl-stepper[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:disabled{opacity:.4;cursor:not-allowed}.sl-stepper-val[_ngcontent-%COMP%]{min-width:30px;text-align:center;font-size:14px;font-weight:600;color:#1d1d1d}.sl-rm[_ngcontent-%COMP%]{background:transparent;border:1px solid #CAC6C3;cursor:pointer;color:#5f5c5a;width:32px;height:32px;border-radius:999px;display:flex;align-items:center;justify-content:center;transition:background .14s,color .14s,border-color .14s;flex:none}.sl-rm[_ngcontent-%COMP%]:hover{background:#f2efed;color:#1d1d1d;border-color:#b6b2af}.sl-totalbar[_ngcontent-%COMP%]{background:#dedad7;padding:18px 24px;display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap}.sl-total-group[_ngcontent-%COMP%]{display:flex;align-items:center;gap:16px;flex-wrap:wrap}.sl-total-label[_ngcontent-%COMP%]{font-size:14px;color:#1d1d1d}.sl-total-price[_ngcontent-%COMP%]{font-weight:700;font-size:22px;letter-spacing:-.01em;color:#1d1d1d}.sl-total-vp[_ngcontent-%COMP%]{font-size:14px;font-weight:700;color:#1d1d1d}.sl-disclaimer[_ngcontent-%COMP%]{display:inline-flex;align-items:center;font-size:13px;color:#5f5c5a}.sl-bottom-link[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;padding:16px 0}@media only screen and (max-width: 767px){.sl-wrap[_ngcontent-%COMP%]{width:calc(100% - 32px)}.sl-line[_ngcontent-%COMP%]{flex-wrap:wrap;column-gap:12px;row-gap:12px;padding:14px 4px}.sl-line-info[_ngcontent-%COMP%]{flex:1 1 auto}.sl-line-controls[_ngcontent-%COMP%]{width:100%;justify-content:flex-end}} 4/*# sourceMappingURL=share-list.component-GXPXY55J.css.map */`]})}}return t})();export{mn as ShareListComponent}; 5//# sourceMappingURL=chunk-MMXQK6EX.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.