import*as e from"@wordpress/interactivity";var t={d:(e,n)=>{for(var l in n)t.o(n,l)&&!t.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:n[l]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const n=(l={getContext:()=>e.getContext,getElement:()=>e.getElement,store:()=>e.store},o={},t.d(o,l),o);var l,o,__=wp.i18n.__,r=(0,n.store)("presto-player/popup",{state:{activePopupId:null,screenReaderText:"",triggerRef:null,inertElements:[],get overlayEnabled(){var e=(0,n.getContext)();return(null==u?void 0:u.activePopupId)===(null==e?void 0:e.id)},get roleAttribute(){return null!=u&&u.overlayEnabled?"dialog":null},get ariaModal(){return null!=u&&u.overlayEnabled?"true":null}},actions:{showPopup:function(){var e=(0,n.getContext)(),t=(0,n.getElement)().ref;u.activePopupId=null==e?void 0:e.id,document.querySelectorAll("body > :not(.presto-popup__overlay)").forEach(function(e){var t;null!=e&&e.hasAttribute("inert")||(null==e||e.setAttribute("inert",""),null==u||null===(t=u.inertElements)||void 0===t||t.push(e))}),u.triggerRef=t},hidePopup:function(){u.activePopupId=null,((null==u?void 0:u.inertElements)||[]).forEach(function(e){null==e||e.removeAttribute("inert")}),u.inertElements=[],setTimeout(function(){var e;null==u||null===(e=u.triggerRef)||void 0===e||e.focus()},0),u.screenReaderText=""}},callbacks:{setOverlayFocus:function(){if(null!=u&&u.overlayEnabled){var e=(0,n.getElement)().ref;setTimeout(function(){null==e||e.focus()},0),u.screenReaderText=__("Presto Popup dialog opened.","presto-player")}},handleKeydown:function(e){"Enter"!==(null==e?void 0:e.key)||null!=u&&u.overlayEnabled||i.showPopup(),"Escape"===(null==e?void 0:e.key)&&null!=u&&u.overlayEnabled&&i.hidePopup()},updatePopupList:function(){var e=(0,n.getContext)();e.popupList=null!=u&&u.overlayEnabled?[null==e?void 0:e.id]:[]}}}),u=r.state,i=r.actions;