import{getContext as e,store as o}from"@wordpress/interactivity";const{state:t}=o("twentig/modal",{state:{video:"",iframe:"",lightboxClassNames:"",get isVideoPlaying(){return""!==t.video},get isIframePlaying(){return""!==t.iframe}},actions:{openVideoModal:o=>{o.preventDefault();const{videoSrc:i,iframeSrc:a,lightboxClassNames:s}=e();t.video=i,t.iframe=a,t.lightboxClassNames=s;const d=document.getElementById("tw-modal-video");d&&d.showModal()},closeVideoModal:e=>{if(e?.target?.closest("iframe, video"))return;const o=document.getElementById("tw-modal-video");o&&o.close()},onCloseVideoModal(){t.video="",t.iframe="",t.lightboxClassNames=""}}});