(()=>{"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:g,GkitPanelBody:r,GkitResponsive:l,GkitBoxControl:p,GkitBackgrounGroup:c,GkitProUpgradeNotice:u}=window.gutenkit.components,{useDeviceType:y,useHasProActive:w,useDeviceList:k,generatePageSettingsCssText:B}=window.gutenkit.helpers,b=(0,i.select)("core/editor").getCurrentPostType(),[m,x]=(0,o.useEntityProp)("postType",b,"meta"),S=y(),_=w(),v=k(),h=(0,d.useMemo)((()=>((e,t)=>{const{parseCSS:n,fillBackgroundGenerator:s,getBoxValue:i}=window.gutenkit.helpers;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:j}=(0,i.dispatch)("core/editor"),C=P();return(0,d.useEffect)((()=>{if(h?.rawCSS){const e=B(h,v);m.postBodyCss!==e&&x({...m,postBodyCss:e});const t={css:e,__unstableType:"gutenkit-page-settings-styles",isGlobalStyles:!0},n=C?.styles?.findIndex((e=>e.__unstableType===t.__unstableType&&e.isGlobalStyles===t.isGlobalStyles));if(-1!==n){const e=[...C.styles];e[n]=t,j({...C,styles:e})}else j({...C,styles:[...C.styles,t]})}}),[h?.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)(g,{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)(r,{title:(0,n.__)("Body Style","gutenkit-blocks-addon"),initialOpen:!0,children:[(0,a.jsx)(l,{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)(l,{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})})}})})();