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)}},n=(t={getElement:function(){return e.getElement},store:function(){return e.store}},r={},o.d(r,t),r);const{__}=wp.i18n,{state:a,actions:l}=(0,n.store)("surecart/sidebar",{state:{get dialog(){let e=document?.querySelector(".sc-sidebar-drawer")||null;if(!e){const{ref:t}=(0,n.getElement)();e=t.parentElement.querySelector("dialog")||t.closest("dialog")||null}if(e instanceof HTMLDialogElement!=0)return e},get ariaLabelDesktop(){return __(a?.open?"Close sidebar":"Open sidebar","surecart")},ariaLabelMobile:__("Open sidebar","surecart")},actions:{open:function*(){a.dialog?.showModal(),a.ariaLabelMobile=__("Close sidebar","surecart")},close:()=>{a.dialog?.close(),a.ariaLabelMobile=__("Open sidebar","surecart")},closeDesktop:()=>{a.open=!1},openDesktop:()=>{a.open=!0},toggleDesktop:e=>{e?.key&&" "!==e?.key&&"Enter"!==e?.key||(e?.preventDefault(),a.open=!a.open)},toggleMobile:e=>{e?.key&&" "!==e?.key&&"Enter"!==e?.key||(e?.preventDefault(),a?.dialog?.open?l.close():l.open())},closeOverlay:e=>{e.target===e.currentTarget&&e.currentTarget.close()}}});