1if(!customElements.get("cart-note")){class CartNote extends HTMLElement{constructor(){super(),this.disclosure=this.closest("details"),this.disclosure&&this.disclosure.matches(".cart-note-disclosure")&&(this.cartNoteToggle=this.disclosure.querySelector(".js-show-note"),this.summary=this.disclosure.querySelector("summary"),this.popup=this.disclosure.querySelector(".cart-drawer-popup__content"),this.textarea=this.disclosure.querySelector("#cart-note"),this.closeButtons=this.disclosure.querySelectorAll(".js-close"),this.lastFocused=null),this.fetchRequestOpts={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"}},this.init()}init(){this.debouncedHandleNoteChange=debounce(this.handleNoteChange.bind(this),300),this.addEventListener("input",this.debouncedHandleNoteChange),this.disclosure&&(this.disclosure.addEventListener("toggle",()=>{this.disclosure.open&&(this.lastFocused=document.activeElement,setTimeout(()=>{(this.textarea||this.popup)?.focus?.()},0))}),this.closeButtons?.length&&this.closeButtons.forEach(btn=>{btn.addEventListener("click",()=>this.closeNote())}),this.disclosure.addEventListener("keydown",e=>{if(this.disclosure.open){if(e.key==="Escape"){e.preventDefault(),this.closeNote();return}e.key==="Tab"&&this.trapFocus(e)}}))}closeNote(){this.disclosure&&(this.disclosure.open=!1,setTimeout(()=>
1{(this.cartNoteToggle||this.summary||this.lastFocused)?.focus?.()},0))}trapFocus(e){if(!this.popup)return;const focusables=this.popup.querySelectorAll('a[href], button:not([disabled]), textarea, input, select, [tabindex]:not([tabindex="-1"])');if(!focusables.length)return;const first=focusables[0],last=focusables[focusables.length-1];e.shiftKey&&document.activeElement===first?(e.preventDefault(),last.focus()):!e.shiftKey&&document.activeElement===last&&(e.preventDefault(),first.focus())}handleNoteChange(evt){if(this.cartNoteToggle){const label=evt.target.value?theme.strings.editCartNote:theme.strings.addCartNote;this.cartNoteToggle.textContent!==label&&(this.cartNoteToggle.textContent=label)}this.fetchRequestOpts.body=JSON.stringify({note:evt.target.value}),fetch(theme.routes.cartUpdate,this.fetchRequestOpts)}}customElements.define("cart-note",CartNote)} 2//# sourceMappingURL=/cdn/shop/t/62/assets/cart-note.js.map?v=53122554953391031521772000283
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.