(()=>{"use strict";const e=window.wp.plugins,t=window.wp.editor,n=window.wp.i18n,s=window.wp.components,i=window.wp.data,o=window.wp.coreData,d=window.wp.element,a=(new Set(["px","em","rem","%","vh","vw"]),window.ReactJSXRuntime);(0,e.registerPlugin)("gkit-page-settings",{render:()=>{const{gutenkitLogo:e}=window.gutenkit.editorIcon,{GkitTabs:r,GkitPanelBody:l,GkitResponsive:g,GkitBoxControl:p,GkitBackgrounGroup:c,GkitProUpgradeNotice:u}=window.GkitComponents,{useDeviceType:y,useHasProActive:w,useDeviceList:k,generatePageSettingsCssText:B}=window.GkitHelpers,b=(0,i.select)("core/editor").getCurrentPostType(),[m,x]=(0,o.useEntityProp)("postType",b,"meta"),S=y(),_=w(),v=k(),G=(0,d.useMemo)(()=>((e,t)=>{const{parseCSS:n,fillBackgroundGenerator:s,getBoxValue:i}=window.GkitHelpers;return n([[],t=>[{selector:"body.editor-styles-wrapper, body.gutenkit",...i(e?.postBodyMargin?.[t],"margin"),...i(e?.postBodyPadding?.[t],"padding"),...s(e?.postBodyBackground,t)}]],t)})(m,v),[m,v]),{getEditorSettings:P}=(0,i.select)("core/editor"),{updateEditorSettings:C}=(0,i.dispatch)("core/editor"),h=P();return(0,d.useEffect)(()=>{if(G?.rawCSS){const e=B(G,v);m.postBodyCss!==e&&x({...m,postBodyCss:e});const t={css:e,__unstableType:"gutenkit-page-settings-styles",isGlobalStyles:!0},n=h?.styles?.findIndex(e=>e.__unstableType===t.__unstableType&&e.isGlobalStyles===t.isGlobalStyles);if(-1!==n){const e=[...h.styles];e[n]=t,C({...h,styles:e})}else C({...h,styles:[...h.styles,t]})}},[G?.rawCSS]),"popupkit-campaigns"!==b&&(0,a.jsx)(t.PluginSidebar,{name:"gkit-page-settings",title:(0,n.__)("GutenKit Page Settings","gutenkit-blocks-addon"),icon:e,children:(0,a.jsx)(r,{type:"top-level",tabs:[{name:"page-settings-style",title:"Style"},{name:"page-settings-advanced",title:"Advanced"}],children:e=>"page-settings-style"===e.name?(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)(l,{title:(0,n.__)("Body Style","gutenkit-blocks-addon"),initialOpen:!0,children:[(0,a.jsx)(g,{children:(0,a.jsx)(p,{label:(0,n.__)("Margin","gutenkit-blocks-addon"),values:m.postBodyMargin[S]||{},onChange:e=>x({postBodyMargin:{...m.postBodyMargin,[S]:e}})})}),(0,a.jsx)(g,{children:(0,a.jsx)(p,{label:(0,n.__)("Padding","gutenkit-blocks-addon"),values:m.postBodyPadding[S]||{},onChange:e=>x({postBodyPadding:{...m.postBodyPadding,[S]:e}})})}),(0,a.jsx)(s.__experimentalDivider,{}),(0,a.jsx)(c,{label:(0,n.__)("Background","gutenkit-blocks-addon"),onChange:e=>{const t={...e,gradient:e?.gradient||""};return x({postBodyBackground:t})},value:m.postBodyBackground,exclude:{video:!0},isSupportDynamicContent:!1})]})}):"page-settings-advanced"===e.name?(0,a.jsx)(a.Fragment,{children:!_&&(0,a.jsx)(u,{})}):void 0})})}})})();