(()=>{"use strict";var e={n:t=>{var o=t&&t.__esModule?()=>t.default:()=>t;return e.d(o,{a:o}),o},d:(t,o)=>{for(var s in o)e.o(o,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:o[s]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.i18n,o=window.wp.plugins,s=window.wp.editor,n=window.wp.data,r=window.wp.element,i=window.wp.components,d=window.wp.apiFetch;var l=e.n(d);const a=window.ReactJSXRuntime;function p(){const e=window.modernFields?.onboardingDone??!0,[o,s]=(0,r.useState)(!e);if(!o)return null;const n=()=>{s(!1),l()({path:"/modern-fields/v1/settings",method:"POST",data:{modern_fields_onboarding_done:!0}})};return(0,a.jsx)(i.Modal,{title:(0,t.__)("Let's create your first field group","modern-fields"),onRequestClose:n,className:"mf-onboarding-modal",size:"medium",children:(0,a.jsxs)(i.__experimentalVStack,{spacing:4,children:[(0,a.jsx)(i.__experimentalText,{variant:"neutral",children:(0,t.__)("With Modern Fields, every field is a block. Just click the + button to get started. Every block with a blue background is a field!","modern-fields")}),(0,a.jsx)("video",{className:"mf-onboarding-modal__video",src:`${window.modernFields?.pluginUrl}assets/video/onboarding.mp4`,autoPlay:!0,loop:!0,muted:!0,playsInline:!0,style:{borderRadius:"10px"}}),(0,a.jsx)("div",{className:"mf-onboarding-modal__footer",children:(0,a.jsx)(i.Button,{variant:"primary",onClick:n,children:(0,t.__)("Add my first field","modern-fields")})})]})})}function c(){const{removeEditorPanel:e}=(0,n.useDispatch)(s.store);(0,r.useEffect)(()=>{e("post-excerpt")},[e]);const{postType:o,excerpt:d,status:l}=(0,n.useSelect)(e=>{const{getCurrentPostType:t,getCurrentPost:o}=e("core/editor"),s=o();return{postType:t(),excerpt:s?.excerpt||"",status:s?.status||"draft"}},[]),{editPost:c}=(0,n.useDispatch)("core/editor");if("mf_field_group"!==o)return null;const[u,m]=(0,r.useState)("publish"===l),[f,_]=(0,r.useState)(d);return(0,r.useEffect)(()=>{m("publish"===l)},[l]),(0,r.useEffect)(()=>{_(d)},[d]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(p,{}),(0,a.jsxs)(s.PluginPostStatusInfo,{name:"mf-field-group-options",title:(0,t.__)("Field Group Options","modern-fields"),className:"mf-field-group-options-panel",children:[(0,a.jsx)("style",{children:".editor-post-summary .editor-post-panel__row:first-of-type {display: none; }"}),(0,a.jsxs)(i.__experimentalVStack,{spacing:4,style:{width:"100%"},children:[(0,a.jsxs)(i.__experimentalHStack,{children:[(0,a.jsx)("div",{className:"editor-post-panel__row-label",children:(0,t.__)("Enabled","modern-fields")}),(0,a.jsx)("div",{className:"editor-post-panel__row-control",style:{padding:"6px 12px"},children:(0,a.jsx)(i.ToggleControl,{checked:u,onChange:e=>{m(e),c({status:e?"publish":"draft"})},__nextHasNoMarginBottom:!0})})]}),(0,a.jsx)(i.TextareaControl,{label:(0,t.__)("Description","modern-fields"),help:(0,t.__)("Describe the purpose of the field group. Displayed in the group list.","modern-fields"),value:f,rows:3,onChange:e=>{_(e),c({excerpt:e})},__nextHasNoMarginBottom:!0})]})]})]})}(0,o.registerPlugin)("mf-field-group-editor",{render:()=>(0,a.jsx)(c,{})})})();