import*as e from"@wordpress/interactivity";var t,r,o={d:function(e,t){for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},c=(t={getElement:function(){return e.getElement},store:function(){return e.store}},r={},o.d(r,t),r);const{actions:a}=(0,c.store)("surecart/product-quick-view"),{state:n,actions:s}=(0,c.store)("surecart/checkout"),{__}=wp.i18n,{state:l,actions:i}=(0,c.store)("surecart/cart",{state:{get ariaLabel(){return l.label+" "+__("Review your cart.","surecart")},get dialog(){let e=document?.querySelector(".sc-cart-drawer")||null;if(!e){const{ref:t}=(0,c.getElement)();e=t.parentElement.querySelector("dialog")||t.closest("dialog")||null}if(e instanceof HTMLDialogElement!=0)return e}},actions:{open(){l.dialog?.showModal(),l.label=__("Cart opened.","surecart"),s.fetch(),i.processCartViewEvent(n?.checkout),a?.close?.()},processCartViewEvent:function*(e){const{processCartViewEvent:t}=yield import("@surecart/checkout-events");t(n?.checkout)},close:()=>{l.dialog?.close(),l.label=__("Cart closed.","surecart")},toggle:e=>{e?.key&&" "!==e?.key&&"Enter"!==e?.key||(e?.preventDefault(),l?.dialog?.open?i.close():i.open())},closeOverlay:e=>{e.target===e.currentTarget&&e.currentTarget.close()}}});addEventListener("scToggleCart",i.toggle);