(()=>{"use strict";const e=window.wp.plugins,t=window.React,{Button:o,Dropdown:s,PanelRow:n}=wp.components,{PluginPostStatusInfo:r}=wp.editPost,{Component:p}=wp.element,{sprintf:i,__}=wp.i18n;class a extends p{constructor(e){super(...arguments),this.state={currentPostType:window.ptsBlockEditor.currentPostType}}render(){return(0,t.createElement)("fieldset",{key:"post-type-switcher-selector",className:"editor-post-type__dialog-fieldset"},(0,t.createElement)("legend",{className:"editor-post-type__dialog-legend"},__("Post Type","post-type-switcher")),window.ptsBlockEditor.availablePostTypes.map((({value:e,label:o})=>(0,t.createElement)("div",{key:e,className:"editor-post-type__choice"},(0,t.createElement)("input",{type:"radio",className:"editor-post-type__dialog-radio",name:"editor-post-type__setting",value:e,onChange:()=>{const t=this.state.currentPostType;this.setState({currentPostType:e});const o=i(__("Are you sure you want to change this from a '%s' to a '%s'?","post-type-switcher"),t,e);window.confirm(o)?window.location.href=window.ptsBlockEditor.changeUrl+"&pts_post_type="+e:this.setState({currentPostType:t})},checked:e===this.state.currentPostType,id:`editor-post-type-switcher-${e}`}),(0,t.createElement)("label",{htmlFor:`editor-post-type-switcher-${e}`,className:"editor-post-type__dialog-label"},o)))))}}(0,e.registerPlugin)("post-type-switcher",{render:()=>(0,t.createElement)(r,null,(0,t.createElement)("div",{className:"edit-post-post-type"},(0,t.createElement)("span",null,__("Post Type","post-type-switcher")),(0,t.createElement)(s,{position:"bottom left",contentClassName:"edit-post-post-type__dialog",renderToggle:({isOpen:e,onToggle:s})=>(0,t.createElement)(o,{type:"button","aria-expanded":e,className:"edit-post-post-type__toggle is-tertiary",onClick:s},window.ptsBlockEditor.currentPostTypeLabel),renderContent:()=>(0,t.createElement)(a,null)})))})})();