1import{Component}from"@theme/component";import{onAnimationEnd}from"@theme/utilities";import{ThemeEvents}from"@theme/events";class CartIcon extends Component{requiredRefs=["cartBubble","cartBubbleText","cartBubbleCount"];get currentCartCount(){return parseInt(this.refs.cartBubbleCount.textContent??"0",10)}set currentCartCount(value){this.refs.cartBubbleCount.textContent=value<100?String(value):""}connectedCallback(){super.connectedCallback(),document.addEventListener(ThemeEvents.cartUpdate,this.onCartUpdate),window.addEventListener("pageshow",this.onPageShow),this.ensureCartBubbleIsCorrect()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener(ThemeEvents.cartUpdate,this.onCartUpdate),window.removeEventListener("pageshow",this.onPageShow)}onPageShow=event=>{event.persisted&&this.ensureCartBubbleIsCorrect()};onCartUpdate=async event=>{const itemCount=event.detail.data?.itemCount??0,comingFromProductForm=event.detail.data?.source==="product-form-component";this.renderCartBubble(itemCount,comingFromProductForm)};renderCartBubble=async(itemCount,comingFromProductForm,animate=!0)=>{this.refs.cartBubbleCount.classList.toggle("hidden",itemCount===0),this.refs.cartBubble.classList.toggle("visually-hidden",itemCount===0),this.currentCartCount=comingFromProductForm?this.currentCartCount+itemCount:itemCount,this.classList.toggle("header-actions__cart-icon--has-cart",itemCount>0),sessionStorage.setItem("cart-count",JSON.stringify({value:String(this.currentCartCount),timestamp:Date.now()})),!(!animate||itemCount===0)&&(await new Promise(resolve=>requestAnimationFrame(resolve)),this.refs.cartBubble.classList.add("cart-bubble--animating"),await onAnimationEnd(this.refs.cartBubbleText),this.refs.cartBubble.classList.remove("cart-bubble--animating"))};ensureCartBubbleIsCorrect=()=>{if(!this.refs.cartBubbleCount)return;const sessionStorageCount=sessionStorage.getItem("cart-count");if(sessionStorageCount===null)return;const visibleCount=this.refs.cartBubbleCount.textContent;try{const{value,timestamp}=JSON.parse(sessionStorageCount);if(value===visibleCount)return;if(Date.now()-timestamp<1e4){const count=parseInt(value,10);count>=0&&this.renderCartBubble(count,!1,!1)}}catch{}}}customElements.get("cart-icon")||customElements.define("cart-icon",CartIcon); 2//# sourceMappingURL=/cdn/shop/t/7/assets/cart-icon.js.map?v=157241182139685326961780201864
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.