"use strict";(self.webpackChunkmenuverse=self.webpackChunkmenuverse||[]).push([[211],{85(e,n,s){s.r(n),s.d(n,{default:()=>v});var t=s(715),i=s(363),r=s(997),o=s(427),l=s(582),a=s(143),d=s(87),u=s(723),c=s(790);const m="menuverse_panel";function v({panelId:e,onClose:n}){const[s,i,r]=(0,l.useEntityBlockEditor)("postType",m,{id:e}),[v,_]=(0,l.useEntityProp)("postType",m,"title",e),[p,h]=(0,l.useEntityProp)("postType",m,"meta",e),{saveEditedEntityRecord:y}=(0,a.useDispatch)("core"),[x,j]=(0,d.useState)(!1),{record:g,isResolving:k,isDirty:b}=(0,a.useSelect)(n=>{const s=n("core");return{record:s.getEntityRecord("postType",m,e),isResolving:!s.hasFinishedResolution("getEntityRecord",["postType",m,e]),isDirty:s.hasEditsForEntityRecord("postType",m,e)}},[e]);if((0,d.useEffect)(()=>{if(!b)return;const e=e=>{e.preventDefault(),e.returnValue=""};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[b]),k||!g)return(0,c.jsx)("div",{className:"menuverse-admin__panel-editor is-loading",children:(0,c.jsx)(o.Spinner,{})});const B=p&&p._menuverse_panel||{},C=e=>h({...p,_menuverse_panel:{...B,...e}});return(0,c.jsxs)("div",{className:"menuverse-admin__panel-editor",children:[(0,c.jsxs)("header",{className:"menuverse-admin__panel-editor-bar",children:[(0,c.jsx)(o.Button,{variant:"tertiary",onClick:n,children:(0,u.__)("← Back to panels","menuverse")}),(0,c.jsx)(o.Button,{variant:"primary",isBusy:x,disabled:x||!b,onClick:async()=>{j(!0);try{await y("postType",m,e)}finally{j(!1)}},children:b?(0,u.__)("Save panel","menuverse"):(0,u.__)("Saved","menuverse")})]}),(0,c.jsx)("div",{className:"menuverse-admin__panel-editor-body",children:(0,c.jsxs)("div",{className:"menuverse-admin__panel-editor-canvas",children:[(0,c.jsx)(o.TextControl,{__nextHasNoMarginBottom:!0,label:(0,u.__)("Panel name","menuverse"),help:(0,u.__)("Only you see this. It is how the panel is listed when you attach it to a menu item.","menuverse"),value:v||"",onChange:_}),(0,c.jsx)(t.BlockEditorProvider,{value:s,onInput:i,onChange:r,settings:{hasFixedToolbar:!0},children:(0,c.jsxs)("div",{className:"menuverse-admin__panel-editor-columns",children:[(0,c.jsx)("div",{className:"menuverse-admin__panel-editor-content",children:(0,c.jsx)(t.BlockTools,{children:(0,c.jsx)(t.WritingFlow,{children:(0,c.jsx)(t.ObserveTyping,{children:(0,c.jsx)(t.BlockList,{})})})})}),(0,c.jsxs)("aside",{className:"menuverse-admin__panel-editor-inspector",children:[(0,c.jsx)("h3",{children:(0,u.__)("Layout","menuverse")}),(0,c.jsx)(o.RangeControl,{__nextHasNoMarginBottom:!0,label:(0,u.__)("Columns","menuverse"),help:(0,u.__)("Top level blocks flow into this many columns on desktop, and stack on mobile.","menuverse"),min:1,max:6,value:B.columns||3,onChange:e=>C({columns:e})}),(0,c.jsx)(o.SelectControl,{__nextHasNoMarginBottom:!0,label:(0,u.__)("Width","menuverse"),value:B.width||"inherit",options:[{value:"inherit",label:(0,u.__)("Use the module setting","menuverse")},{value:"contained",label:(0,u.__)("Contained","menuverse")},{value:"full",label:(0,u.__)("Full width","menuverse")}],onChange:e=>C({width:e})}),(0,c.jsx)("h3",{children:(0,u.__)("Block","menuverse")}),(0,c.jsx)(t.BlockInspector,{})]})]})})]})})]})}(0,r.getBlockTypes)().length||(0,i.registerCoreBlocks)()}}]);