const{Button:c,Popover:u,RadioControl:d}=wp.components,{useSelect:p,useDispatch:b}=wp.data,{useState:f,useRef:y}=wp.element,{__:o}=wp.i18n,m=()=>{const{editPost:n}=b("core/editor"),e=p(i=>i("core/editor").getEditedPostAttribute("status")==="publish",[]),t=i=>{n({status:i==="public"?"publish":"private"})},[a,r]=f(!1),l=y(null),s=()=>{r(i=>!i)};return React.createElement("div",null,React.createElement(c,{ref:l,variant:"tertiary",onClick:s,style:{display:"flex",justifyContent:"center",gap:0,alignItems:"center",padding:"4px 12px",backgroundColor:e?"rgba(2, 184, 13, 0.1)":"rgba(196, 144, 0, 0.1)",borderColor:e?"rgba(2, 184, 13, 0.3)":"rgba(196, 144, 0, 0.3)",color:e?"#02b80d":"#c49000",transition:"all 0.2s ease",fontWeight:"400"}},o(e?"Public":"Private","fluent-player")),a&&React.createElement(u,{placement:"bottom-end",shift:!0,anchor:l.current,resize:!1,onFocusOutside:s,className:"fp-media-visibility-dropdown"},React.createElement("div",{style:{padding:"2em",width:"230px",maxWidth:"100vw",overflow:"auto",display:"grid",gap:"15px"}},React.createElement(d,{label:o("Visibility","fluent-player"),selected:e?"public":"private",options:[{label:o("Make it Public","fluent-player"),value:"public"},{label:o("Make it Private","fluent-player"),value:"private"}],onChange:t}),React.createElement("p",{style:{margin:0,fontSize:"12px",fontStyle:"normal",color:"rgb(117, 117, 117)"}},o("Media visibility control","fluent-player")))))},{createRoot:g}=wp.element,{useSelect:v}=wp.data,E=["fluent_player_media","fluent_playlist"],S=()=>{const n=v(e=>{const t=e("core/editor");return t?t.getCurrentPostType():null},[]);return E.includes(n)?React.createElement(m,null):null};(function(n){const e=document.createElement("div");e.classList.add("fluent-player-edit-root");const t=document.getElementById("editor");if(!t)return;g(e).render(React.createElement(S,null));const r=n.data.subscribe(function(){setTimeout(function(){if(document.querySelector(".fluent-player-edit-root"))r();else{const l=t.querySelector(".edit-post-header__settings")||t.querySelector(".editor-header__settings");l instanceof HTMLElement&&(l.prepend(e),r())}},1)});document.querySelector(".fluent-player-edit-root")&&r()})(wp);
