1import{D as S}from"./main-BCFY9a9_.js";import{u as c,i as p,n as r,e as I}from"./fluorescent-dom.es-Cu7dY8l0.js";import{c as T}from"./focus-trap.esm-DYjLEhSG.js";import{e as $,d as B}from"./bodyScrollLock.esm-CT-oBNdc.js";import{r as b}from"./index-8UqU5rlX.js";import{d as f,c as k}from"./cart-Dp1qr_mc.js";import{c as s}from"./evx.es-D_-Lbk8t.js";import{m as E}from"./xhr-DPgtqhaK.js";import{C as W,Q as w,a as H}from"./cross-sells-DzeRVNAg.js";import{u as l}from"./update-inner-html-D7dYCKPv.js";import{f as g}from"./free-shipping-bar-Cuykr-k8.js";import{d as M}from"./delay-offset-DYAL33nW.js";import{s as R}from"./shouldAnimate-BMbjctYf.js";import"./storage-CVUx8WVm.js";import"./slide-anim.module-Bf7WzVkr.js";import"./carousel-CyF55yaY.js";import"./formatMoney-B2ZV-IOA.js";const U={animationItem:".animation--quick-cart-items > *, .animation--quick-cart-footer"},y={animationRevealed:"animation--quick-cart-revealed"},L=t=>{n();function e(){c(t,y.animationRevealed)}function a(){p(t,y.animationRevealed)}function n(){M(t,[U.animationItem])}return{open:e,close:a,setup:n}},i={cartWrapper:".quick-cart__wrapper",innerContainer:".quick-cart__container",overlay:".quick-cart__overlay",closeButton:".quick-cart__close-icon",footer:".quick-cart__footer",items:".quick-cart__items",cartError:".quick-cart__item-error",form:".quick-cart__form",cartCount:".quick-cart__heading sup",subtotal:".quick-cart__footer-subtotal span",quantityInput:".quick-cart .quantity-input__input",quantityItem:"[data-input-item]",discounts:".quick-cart__item-discounts",freeShippingBar:"[data-free-shipping-bar]",crossSells:"[data-cross-sells]"},o={active:"active",hidden:"hidden",updatingQuantity:"has-quantity-update",removed:"is-removed"};var v;const q=(v=window.flu.states)==null?void 0:v.useCustomEvents;b("quick-cart",{onLoad(){this.cartWrapper=r(i.cartWrapper,this.container),this.cartTrap=T(this.container,{allowOutsideClick:!0}),this.events=[s("quick-cart:open",()=>this.openQuickCart()),s("quick-cart:updated",()=>this.refreshQuickCart()),s("quick-cart:error",(e,{key:a,errorMessage:n})=>{this.handleErrorMessage(a,n)}),s("quick-cart:scrollup",()=>this.scrollUpQuickCart()),s(["quantity-update:subtract","quantity-update:add"],(e,{key:a})=>{this.handleQuantityUpdate(a)}),s("quantity-update:remove",(e,{key:a})=>{this.handleItemRemoval(a)}),I(document,"apps:product-added-to-cart",()=>{this.refreshQuickCart()})],this.quantityButtons=w(this.container),this.cartNoteToggle=H(this.container),R(this.container)&&(this.animateQuickCart=L(this.container)),this.delegate=new S(this.container),this.delegate.on("click",i.overlay,()=>this.close()),this.delegate.on("click",i.closeButton,()=>this.close()),this.delegate.on("change",i.quantityInput,e=>this.handleQuantityInputChange(e));const t=r(i.freeShippingBar,this.container);t&&g(t),this._initCrossSells()},openQuickCart(){var t;c(this.cartWrapper,o.active),this.cartTrap.activate(),this.adjustItemPadding(),(t=this.animateQuickCart)==null||t.open(),document.body.setAttribute("data-fluorescent-overlay-open","true"),B(this.container,{allowTouchMove:e=>{for(;e&&e!==document.body;){if(e.getAttribute("data-scroll-lock-ignore")!==null)return!0;e=e.parentNode}},reserveScrollBarGap:!0}),q&&k.get().then(e=>{f("quick-cart:open",{cart:e})})},refreshQuickCart(){const t=`${theme.routes.cart.base}?section_id=${this.id}`;E("GET",t).then(e=>{var m,h;let a=document.createElement("div");a.innerHTML=e;const n=r(i.innerContainer,a),C=!!r(i.items,this.container),_=!!r(i.items,a),d=r(i.freeShippingBar,a);if((m=this.crossSells)==null||m.unload(),d&&g(d),_&&C){l(`${i.cartWrapper} ${i.items}`,a),this.adjustItemPadding(),l(`${i.cartWrapper} ${i.cartCount}`,a),l(`${i.cartWrapper} ${i.subtotal}`,a),l(`${i.cartWrapper} ${i.discounts}`,a);const u=r(i.form,this.container),Q=u.scrollTop||0;u.scrollTop=Q,(h=this.animateQuickCart)==null||h.setup()}else{const u=r(i.innerContainer,this.container);u.innerHTML=n.innerHTML}this._initCrossSells()})},handleErrorMessage(t){const e=r(`[data-key="${t}"]`,this.container);p(r(i.cartError,e),o.hidden),p(e,o.updatingQuantity)},handleQuantityUpdate(t){const e=r(`[data-key="${t}"]`,this.container);c(e,o.updatingQuantity)},handleItemRemoval(t){const e=r(`[data-key="${t}"]`,this.container);c(e,o.removed),c(e,o.updatingQuantity)},handleQuantityInputChange({target:t}){const e=t.closest(i.quantityItem),{key:a}=e.dataset;
1k.updateItem(a,t.value),this.handleQuantityUpdate(a)},_initCrossSells(){const t=r(i.crossSells,this.container);t&&(this.crossSells=W(t))},scrollUpQuickCart(){const t=r(i.form,this.container),e=0;t&&setTimeout(()=>{t.scrollTop=e},300)},adjustItemPadding(){const t=r(i.items,this.container);if(!t)return;const e=r(i.footer,this.container);t.style.paddingBottom=`${e.clientHeight}px`},close(){p(this.cartWrapper,o.active),setTimeout(()=>{var t;(t=this.animateQuickCart)==null||t.close(),this.cartTrap.deactivate(),document.body.setAttribute("data-fluorescent-overlay-open","false"),$(this.container)},500),q&&f("quick-cart:close")},onSelect(){this.openQuickCart()},onDeselect(){this.close()},onUnload(){this.delegate.off(),this.events.forEach(t=>t()),this.quantityButtons.unload(),this.cartNoteToggle.unload()}});
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.