WordPress/wp-includes/js/dist/edit-post.min.js

7 lines
125 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*! This file is auto-generated */
!function(){var e={4403:function(e,t){var n;
/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/!function(){"use strict";var o={}.hasOwnProperty;function a(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var r=typeof n;if("string"===r||"number"===r)e.push(n);else if(Array.isArray(n)){if(n.length){var s=a.apply(null,n);s&&e.push(s)}}else if("object"===r){if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]")){e.push(n.toString());continue}for(var l in n)o.call(n,l)&&n[l]&&e.push(l)}}}return e.join(" ")}e.exports?(a.default=a,e.exports=a):void 0===(n=function(){return a}.apply(t,[]))||(e.exports=n)}()}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var r=t[o]={exports:{}};return e[o](r,r.exports,n),r.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};!function(){"use strict";n.r(o),n.d(o,{PluginBlockSettingsMenuItem:function(){return Qa},PluginDocumentSettingPanel:function(){return ga},PluginMoreMenuItem:function(){return Xa},PluginPostPublishPanel:function(){return Ca},PluginPostStatusInfo:function(){return Fo},PluginPrePublishPanel:function(){return Ma},PluginSidebar:function(){return ha},PluginSidebarMoreMenuItem:function(){return Ja},__experimentalFullscreenModeClose:function(){return zn},__experimentalMainDashboardButton:function(){return so},initializeEditor:function(){return er},reinitializeEditor:function(){return tr},store:function(){return rn}});var e={};n.r(e),n.d(e,{closeModal:function(){return Z},disableComplementaryArea:function(){return H},enableComplementaryArea:function(){return R},openModal:function(){return q},pinItem:function(){return G},setDefaultComplementaryArea:function(){return O},setFeatureDefaults:function(){return W},setFeatureValue:function(){return $},toggleFeature:function(){return U},unpinItem:function(){return z}});var t={};n.r(t),n.d(t,{getActiveComplementaryArea:function(){return j},isComplementaryAreaLoading:function(){return K},isFeatureActive:function(){return Q},isItemPinned:function(){return Y},isModalActive:function(){return X}});var a={};n.r(a),n.d(a,{__experimentalSetPreviewDeviceType:function(){return gt},__unstableCreateTemplate:function(){return ft},__unstableSwitchToTemplateMode:function(){return Et},closeGeneralSidebar:function(){return Ke},closeModal:function(){return Qe},closePublishSidebar:function(){return Je},hideBlockTypes:function(){return ct},initializeMetaBoxes:function(){return yt},metaBoxUpdatesFailure:function(){return pt},metaBoxUpdatesSuccess:function(){return mt},openGeneralSidebar:function(){return je},openModal:function(){return Ye},openPublishSidebar:function(){return Xe},removeEditorPanel:function(){return ot},requestMetaBoxUpdates:function(){return ut},setAvailableMetaBoxesPerLocation:function(){return dt},setIsEditingTemplate:function(){return bt},setIsInserterOpened:function(){return ht},setIsListViewOpened:function(){return _t},showBlockTypes:function(){return it},switchEditorMode:function(){return rt},toggleDistractionFree:function(){return wt},toggleEditorPanelEnabled:function(){return tt},toggleEditorPanelOpened:function(){return nt},toggleFeature:function(){return at},togglePinnedPluginItem:function(){return st},togglePublishSidebar:function(){return et},updatePreferredStyleVariations:function(){return lt}});var r={};n.r(r),n.d(r,{__experimentalGetInsertionPoint:function(){return Jt},__experimentalGetPreviewDeviceType:function(){return Qt},areMetaBoxesInitialized:function(){return nn},getActiveGeneralSidebarName:function(){return At},getActiveMetaBoxLocations:function(){return $t},getAllMetaBoxes:function(){return jt},getEditedPostTemplate:function(){return on},getEditorMode:function(){return Mt},getHiddenBlockTypes:function(){return Vt},getMetaBoxesPerLocation:function(){return Zt},getPreference:function(){return Lt},getPreferences:function(){return Dt},hasMetaBoxes:function(){return Kt},isEditingTemplate:function(){return tn},isEditorPanelEnabled:function(){return Rt},isEditorPanelOpened:function(){return Ht},isEditorPanelRemoved:function(){return Ot},isEditorSidebarOpened:function(){return It},isFeatureActive:function(){return zt},isInserterOpened:function(){return Xt},isListViewOpened:function(){return en},isMetaBoxLocationActive:function(){return qt},isMetaBoxLocationVisible:function(){return Wt},isModalActive:function(){return Gt},isPluginItemPinned:function(){return Ut},isPluginSidebarOpened:function(){return Nt},isPublishSidebarOpened:function(){return Ft},isSavingMetaBoxes:function(){return Yt}});var s=window.wp.element,l=window.wp.blocks,i=window.wp.blockLibrary,c=window.wp.deprecated,d=n.n(c),u=window.wp.data,m=window.wp.hooks,p=window.wp.preferences,g=window.wp.widgets,h=window.wp.mediaUtils;(0,m.addFilter)("editor.MediaUpload","core/edit-post/replace-media-upload",(()=>h.MediaUpload));var _=window.wp.components,b=window.wp.blockEditor,E=window.wp.i18n,f=window.wp.compose;const v=(0,f.compose)((0,u.withSelect)(((e,t)=>{if((0,l.hasBlockSupport)(t.name,"multiple",!0))return{};const n=e(b.store).getBlocks().find((({name:e})=>t.name===e));return{originalBlockClientId:n&&n.clientId!==t.clientId&&n.clientId}})),(0,u.withDispatch)(((e,{originalBlockClientId:t})=>({selectFirst:()=>e(b.store).selectBlock(t)})))),y=(0,f.createHigherOrderComponent)((e=>v((({originalBlockClientId:t,selectFirst:n,...o})=>{if(!t)return(0,s.createElement)(e,{...o});const a=(0,l.getBlockType)(o.name),r=function(e){const t=(0,l.findTransform)((0,l.getBlockTransforms)("to",e),(({type:e,blocks:t})=>"block"===e&&1===t.length));if(!t)return null;return(0,l.getBlockType)(t.blocks[0])}(o.name);return[(0,s.createElement)("div",{key:"invalid-preview",style:{minHeight:"60px"}},(0,s.createElement)(e,{key:"block-edit",...o})),(0,s.createElement)(b.Warning,{key:"multiple-use-warning",actions:[(0,s.createElement)(_.Button,{key:"find-original",variant:"secondary",onClick:n},(0,E.__)("Find original")),(0,s.createElement)(_.Button,{key:"remove",variant:"secondary",onClick:()=>o.onReplace([])},(0,E.__)("Remove")),r&&(0,s.createElement)(_.Button,{key:"transform",variant:"secondary",onClick:()=>o.onReplace((0,l.createBlock)(r.name,o.attributes))},(0,E.__)("Transform into:")," ",r.title)]},(0,s.createElement)("strong",null,a?.title,": "),(0,E.__)("This block can only be used once."))]}))),"withMultipleValidation");(0,m.addFilter)("editor.BlockEdit","core/edit-post/validate-multiple-use/with-multiple-validation",y);var w=window.wp.coreData,S=window.wp.editor,k=window.wp.primitives;var P=(0,s.createElement)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(k.Path,{d:"M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z"})),C=window.wp.plugins,T=window.wp.url,x=window.wp.notices;function B(){const{createNotice:e}=(0,u.useDispatch)(x.store),{getEditedPostAttribute:t}=(0,u.useSelect)(S.store);const n=(0,f.useCopyToClipboard)((function(){return t("content")}),(function(){e("info",(0,E.__)("All content copied."),{isDismissible:!0,type:"snackbar"})}));return(0,s.createElement)(_.MenuItem,{ref:n},(0,E.__)("Copy all blocks"))}var M=window.wp.keycodes,I=n(4403),N=n.n(I);var A=(0,s.createElement)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(k.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"}));var D=(0,s.createElement)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(k.Path,{d:"M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z"}));var L=(0,s.createElement)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(k.Path,{fillRule:"evenodd",d:"M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z",clipRule:"evenodd"})),V=window.wp.viewport;var F=(0,s.createElement)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(k.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"}));const O=(e,t)=>({type:"SET_DEFAULT_COMPLEMENTARY_AREA",scope:e,area:t}),R=(e,t)=>({registry:n,dispatch:o})=>{if(!t)return;n.select(p.store).get(e,"isComplementaryAreaVisible")||n.dispatch(p.store).set(e,"isComplementaryAreaVisible",!0),o({type:"ENABLE_COMPLEMENTARY_AREA",scope:e,area:t})},H=e=>({registry:t})=>{t.select(p.store).get(e,"isComplementaryAreaVisible")&&t.dispatch(p.store).set(e,"isComplementaryAreaVisible",!1)},G=(e,t)=>({registry:n})=>{if(!t)return;const o=n.select(p.store).get(e,"pinnedItems");!0!==o?.[t]&&n.dispatch(p.store).set(e,"pinnedItems",{...o,[t]:!0})},z=(e,t)=>({registry:n})=>{if(!t)return;const o=n.select(p.store).get(e,"pinnedItems");n.dispatch(p.store).set(e,"pinnedItems",{...o,[t]:!1})};function U(e,t){return function({registry:n}){d()("dispatch( 'core/interface' ).toggleFeature",{since:"6.0",alternative:"dispatch( 'core/preferences' ).toggle"}),n.dispatch(p.store).toggle(e,t)}}function $(e,t,n){return function({registry:o}){d()("dispatch( 'core/interface' ).setFeatureValue",{since:"6.0",alternative:"dispatch( 'core/preferences' ).set"}),o.dispatch(p.store).set(e,t,!!n)}}function W(e,t){return function({registry:n}){d()("dispatch( 'core/interface' ).setFeatureDefaults",{since:"6.0",alternative:"dispatch( 'core/preferences' ).setDefaults"}),n.dispatch(p.store).setDefaults(e,t)}}function q(e){return{type:"OPEN_MODAL",name:e}}function Z(){return{type:"CLOSE_MODAL"}}const j=(0,u.createRegistrySelector)((e=>(t,n)=>{const o=e(p.store).get(n,"isComplementaryAreaVisible");if(void 0!==o)return!1===o?null:t?.complementaryAreas?.[n]})),K=(0,u.createRegistrySelector)((e=>(t,n)=>{const o=e(p.store).get(n,"isComplementaryAreaVisible"),a=t?.complementaryAreas?.[n];return o&&void 0===a})),Y=(0,u.createRegistrySelector)((e=>(t,n,o)=>{var a;const r=e(p.store).get(n,"pinnedItems");return null===(a=r?.[o])||void 0===a||a})),Q=(0,u.createRegistrySelector)((e=>(t,n,o)=>(d()("select( 'core/interface' ).isFeatureActive( scope, featureName )",{since:"6.0",alternative:"select( 'core/preferences' ).get( scope, featureName )"}),!!e(p.store).get(n,o))));function X(e,t){return e.activeModal===t}var J=(0,u.combineReducers)({complementaryAreas:function(e={},t){switch(t.type){case"SET_DEFAULT_COMPLEMENTARY_AREA":{const{scope:n,area:o}=t;return e[n]?e:{...e,[n]:o}}case"ENABLE_COMPLEMENTARY_AREA":{const{scope:n,area:o}=t;return{...e,[n]:o}}}return e},activeModal:function(e=null,t){switch(t.type){case"OPEN_MODAL":return t.name;case"CLOSE_MODAL":return null}return e}});const ee=(0,u.createReduxStore)("core/interface",{reducer:J,actions:e,selectors:t});(0,u.register)(ee);var te=(0,C.withPluginContext)(((e,t)=>({icon:t.icon||e.icon,identifier:t.identifier||`${e.name}/${t.name}`})));var ne=te((function({as:e=_.Button,scope:t,identifier:n,icon:o,selectedIcon:a,name:r,...l}){const i=e,c=(0,u.useSelect)((e=>e(ee).getActiveComplementaryArea(t)===n),[n,t]),{enableComplementaryArea:d,disableComplementaryArea:m}=(0,u.useDispatch)(ee);return(0,s.createElement)(i,{icon:a&&c?a:o,"aria-controls":n.replace("/",":"),onClick:()=>{c?m(t):d(t,n)},...l})}));var oe=({smallScreenTitle:e,children:t,className:n,toggleButtonProps:o})=>{const a=(0,s.createElement)(ne,{icon:F,...o});return(0,s.createElement)(s.Fragment,null,(0,s.createElement)("div",{className:"components-panel__header interface-complementary-area-header__small"},e&&(0,s.createElement)("span",{className:"interface-complementary-area-header__small-title"},e),a),(0,s.createElement)("div",{className:N()("components-panel__header","interface-complementary-area-header",n),tabIndex:-1},t,a))};const ae=()=>{};function re({name:e,as:t=_.Button,onClick:n,...o}){return(0,s.createElement)(_.Fill,{name:e},(({onClick:e})=>(0,s.createElement)(t,{onClick:n||e?(...t)=>{(n||ae)(...t),(e||ae)(...t)}:void 0,...o})))}re.Slot=function({name:e,as:t=_.ButtonGroup,fillProps:n={},bubblesVirtually:o,...a}){return(0,s.createElement)(_.Slot,{name:e,bubblesVirtually:o,fillProps:n},(e=>{if(!s.Children.toArray(e).length)return null;const n=[];s.Children.forEach(e,(({props:{__unstableExplicitMenuItem:e,__unstableTarget:t}})=>{t&&e&&n.push(t)}));const o=s.Children.map(e,(e=>!e.props.__unstableExplicitMenuItem&&n.includes(e.props.__unstableTarget)?null:e));return(0,s.createElement)(t,{...a},o)}))};var se=re;const le=({__unstableExplicitMenuItem:e,__unstableTarget:t,...n})=>(0,s.createElement)(_.MenuItem,{...n});function ie({scope:e,target:t,__unstableExplicitMenuItem:n,...o}){return(0,s.createElement)(ne,{as:o=>(0,s.createElement)(se,{__unstableExplicitMenuItem:n,__unstableTarget:`${e}/${t}`,as:le,name:`${e}/plugin-more-menu`,...o}),role:"menuitemcheckbox",selectedIcon:A,name:t,scope:e,...o})}function ce({scope:e,...t}){return(0,s.createElement)(_.Fill,{name:`PinnedItems/${e}`,...t})}ce.Slot=function({scope:e,className:t,...n}){return(0,s.createElement)(_.Slot,{name:`PinnedItems/${e}`,...n},(e=>e?.length>0&&(0,s.createElement)("div",{className:N()(t,"interface-pinned-items")},e)))};var de=ce;function ue({scope:e,children:t,className:n,id:o}){return(0,s.createElement)(_.Fill,{name:`ComplementaryArea/${e}`},(0,s.createElement)("div",{id:o,className:n},t))}const me=te((function({children:e,className:t,closeLabel:n=(0,E.__)("Close plugin"),identifier:o,header:a,headerClassName:r,icon:l,isPinnable:i=!0,panelClassName:c,scope:d,name:m,smallScreenTitle:p,title:g,toggleShortcut:h,isActiveByDefault:b,showIconLabels:f=!1}){const{isLoading:v,isActive:y,isPinned:w,activeArea:S,isSmall:k,isLarge:P}=(0,u.useSelect)((e=>{const{getActiveComplementaryArea:t,isComplementaryAreaLoading:n,isItemPinned:a}=e(ee),r=t(d);return{isLoading:n(d),isActive:r===o,isPinned:a(d,o),activeArea:r,isSmall:e(V.store).isViewportMatch("< medium"),isLarge:e(V.store).isViewportMatch("large")}}),[o,d]);!function(e,t,n,o,a){const r=(0,s.useRef)(!1),l=(0,s.useRef)(!1),{enableComplementaryArea:i,disableComplementaryArea:c}=(0,u.useDispatch)(ee);(0,s.useEffect)((()=>{o&&a&&!r.current?(c(e),l.current=!0):l.current&&!a&&r.current?(l.current=!1,i(e,t)):l.current&&n&&n!==t&&(l.current=!1),a!==r.current&&(r.current=a)}),[o,a,e,t,n,c,i])}(d,o,S,y,k);const{enableComplementaryArea:C,disableComplementaryArea:T,pinItem:x,unpinItem:B}=(0,u.useDispatch)(ee);return(0,s.useEffect)((()=>{b&&void 0===S&&!k?C(d,o):void 0===S&&k&&T(d,o)}),[S,b,d,o,k,C,T]),(0,s.createElement)(s.Fragment,null,i&&(0,s.createElement)(de,{scope:d},w&&(0,s.createElement)(ne,{scope:d,identifier:o,isPressed:y&&(!f||P),"aria-expanded":y,"aria-disabled":v,label:g,icon:f?A:l,showTooltip:!f,variant:f?"tertiary":void 0})),m&&i&&(0,s.createElement)(ie,{target:m,scope:d,icon:l},g),y&&(0,s.createElement)(ue,{className:N()("interface-complementary-area",t),scope:d,id:o.replace("/",":")},(0,s.createElement)(oe,{className:r,closeLabel:n,onClose:()=>T(d),smallScreenTitle:p,toggleButtonProps:{label:n,shortcut:h,scope:d,identifier:o}},a||(0,s.createElement)(s.Fragment,null,(0,s.createElement)("strong",null,g),i&&(0,s.createElement)(_.Button,{className:"interface-complementary-area__pin-unpin-item",icon:w?D:L,label:w?(0,E.__)("Unpin from toolbar"):(0,E.__)("Pin to toolbar"),onClick:()=>(w?B:x)(d,o),isPressed:w,"aria-expanded":w}))),(0,s.createElement)(_.Panel,{className:c},e)))}));me.Slot=function({scope:e,...t}){return(0,s.createElement)(_.Slot,{name:`ComplementaryArea/${e}`,...t})};var pe=me;var ge=({isActive:e})=>((0,s.useEffect)((()=>{let e=!1;return document.body.classList.contains("sticky-menu")&&(e=!0,document.body.classList.remove("sticky-menu")),()=>{e&&document.body.classList.add("sticky-menu")}}),[]),(0,s.useEffect)((()=>(e?document.body.classList.add("is-fullscreen-mode"):document.body.classList.remove("is-fullscreen-mode"),()=>{e&&document.body.classList.remove("is-fullscreen-mode")})),[e]),null);function he({children:e,className:t,ariaLabel:n,as:o="div",...a}){return(0,s.createElement)(o,{className:N()("interface-navigable-region",t),"aria-label":n,role:"region",tabIndex:"-1",...a},e)}const _e={hidden:{opacity:0},hover:{opacity:1,transition:{type:"tween",delay:.2,delayChildren:.2}},distractionFreeInactive:{opacity:1,transition:{delay:0}}};var be=(0,s.forwardRef)((function({isDistractionFree:e,footer:t,header:n,editorNotices:o,sidebar:a,secondarySidebar:r,notices:l,content:i,contentProps:c,actions:d,labels:u,className:m,enableRegionNavigation:p=!0,shortcuts:g},h){const b=(0,_.__unstableUseNavigateRegions)(g);!function(e){(0,s.useEffect)((()=>{const t=document&&document.querySelector(`html:not(.${e})`);if(t)return t.classList.toggle(e),()=>{t.classList.toggle(e)}}),[e])}("interface-interface-skeleton__html-container");const v={...{header:(0,E.__)("Header"),body:(0,E.__)("Content"),secondarySidebar:(0,E.__)("Block Library"),sidebar:(0,E.__)("Settings"),actions:(0,E.__)("Publish"),footer:(0,E.__)("Footer")},...u};return(0,s.createElement)("div",{...p?b:{},ref:(0,f.useMergeRefs)([h,p?b.ref:void 0]),className:N()(m,"interface-interface-skeleton",b.className,!!t&&"has-footer")},(0,s.createElement)("div",{className:"interface-interface-skeleton__editor"},!!n&&(0,s.createElement)(he,{as:_.__unstableMotion.div,className:"interface-interface-skeleton__header","aria-label":v.header,initial:e?"hidden":"distractionFreeInactive",whileHover:e?"hover":"distractionFreeInactive",animate:e?"hidden":"distractionFreeInactive",variants:_e,transition:e?{type:"tween",delay:.8}:void 0},n),e&&(0,s.createElement)("div",{className:"interface-interface-skeleton__header"},o),(0,s.createElement)("div",{className:"interface-interface-skeleton__body"},!!r&&(0,s.createElement)(he,{className:"interface-interface-skeleton__secondary-sidebar",ariaLabel:v.secondarySidebar},r),!!l&&(0,s.createElement)("div",{className:"interface-interface-skeleton__notices"},l),(0,s.createElement)(he,{className:"interface-interface-skeleton__content",ariaLabel:v.body,...c},i),!!a&&(0,s.createElement)(he,{className:"interface-interface-skeleton__sidebar",ariaLabel:v.sidebar},a),!!d&&(0,s.createElement)(he,{className:"interface-interface-skeleton__actions",ariaLabel:v.actions},d))),!!t&&(0,s.createElement)(he,{className:"interface-interface-skeleton__footer",ariaLabel:v.footer},t))}));var Ee=(0,s.createElement)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(k.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"}));function fe({as:e=_.DropdownMenu,className:t,label:n=(0,E.__)("Options"),popoverProps:o,toggleProps:a,children:r}){return(0,s.createElement)(e,{className:N()("interface-more-menu-dropdown",t),icon:Ee,label:n,popoverProps:{placement:"bottom-end",...o,className:N()("interface-more-menu-dropdown__content",o?.className)},toggleProps:{tooltipPosition:"bottom",...a}},(e=>r(e)))}function ve({closeModal:e,children:t}){return(0,s.createElement)(_.Modal,{className:"interface-preferences-modal",title:(0,E.__)("Preferences"),onRequestClose:e},t)}var ye=(0,s.forwardRef)((function({icon:e,size:t=24,...n},o){return(0,s.cloneElement)(e,{width:t,height:t,...n,ref:o})}));var we=(0,s.createElement)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(k.Path,{d:"M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"}));var Se=(0,s.createElement)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(k.Path,{d:"M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"}));const ke="preferences-menu";function Pe({sections:e}){const t=(0,f.useViewportMatch)("medium"),[n,o]=(0,s.useState)(ke),{tabs:a,sectionsContentMap:r}=(0,s.useMemo)((()=>{let t={tabs:[],sectionsContentMap:{}};return e.length&&(t=e.reduce(((e,{name:t,tabLabel:n,content:o})=>(e.tabs.push({name:t,title:n}),e.sectionsContentMap[t]=o,e)),{tabs:[],sectionsContentMap:{}})),t}),[e]),l=(0,s.useCallback)((e=>r[e.name]||null),[r]);let i;return i=t?(0,s.createElement)(_.TabPanel,{className:"interface-preferences__tabs",tabs:a,initialTabName:n!==ke?n:void 0,onSelect:o,orientation:"vertical"},l):(0,s.createElement)(_.__experimentalNavigatorProvider,{initialPath:"/",className:"interface-preferences__provider"},(0,s.createElement)(_.__experimentalNavigatorScreen,{path:"/"},(0,s.createElement)(_.Card,{isBorderless:!0,size:"small"},(0,s.createElement)(_.CardBody,null,(0,s.createElement)(_.__experimentalItemGroup,null,a.map((e=>(0,s.createElement)(_.__experimentalNavigatorButton,{key:e.name,path:e.name,as:_.__experimentalItem,isAction:!0},(0,s.createElement)(_.__experimentalHStack,{justify:"space-between"},(0,s.createElement)(_.FlexItem,null,(0,s.createElement)(_.__experimentalTruncate,null,e.title)),(0,s.createElement)(_.FlexItem,null,(0,s.createElement)(ye,{icon:(0,E.isRTL)()?we:Se})))))))))),e.length&&e.map((e=>(0,s.createElement)(_.__experimentalNavigatorScreen,{key:`${e.name}-menu`,path:e.name},(0,s.createElement)(_.Card,{isBorderless:!0,size:"large"},(0,s.createElement)(_.CardHeader,{isBorderless:!1,justify:"left",size:"small",gap:"6"},(0,s.createElement)(_.__experimentalNavigatorBackButton,{icon:(0,E.isRTL)()?Se:we,"aria-label":(0,E.__)("Navigate to the previous view")}),(0,s.createElement)(_.__experimentalText,{size:"16"},e.tabLabel)),(0,s.createElement)(_.CardBody,null,e.content)))))),i}var Ce=({description:e,title:t,children:n})=>(0,s.createElement)("fieldset",{className:"interface-preferences-modal__section"},(0,s.createElement)("legend",{className:"interface-preferences-modal__section-legend"},(0,s.createElement)("h2",{className:"interface-preferences-modal__section-title"},t),e&&(0,s.createElement)("p",{className:"interface-preferences-modal__section-description"},e)),n);var Te=function({help:e,label:t,isChecked:n,onChange:o,children:a}){return(0,s.createElement)("div",{className:"interface-preferences-modal__option"},(0,s.createElement)(_.ToggleControl,{__nextHasNoMarginBottom:!0,help:e,label:t,checked:n,onChange:o}),a)},xe=window.wp.keyboardShortcuts;const Be=[{keyCombination:{modifier:"primary",character:"b"},description:(0,E.__)("Make the selected text bold.")},{keyCombination:{modifier:"primary",character:"i"},description:(0,E.__)("Make the selected text italic.")},{keyCombination:{modifier:"primary",character:"k"},description:(0,E.__)("Convert the selected text into a link.")},{keyCombination:{modifier:"primaryShift",character:"k"},description:(0,E.__)("Remove a link.")},{keyCombination:{character:"[["},description:(0,E.__)("Insert a link to a post or page.")},{keyCombination:{modifier:"primary",character:"u"},description:(0,E.__)("Underline the selected text.")},{keyCombination:{modifier:"access",character:"d"},description:(0,E.__)("Strikethrough the selected text.")},{keyCombination:{modifier:"access",character:"x"},description:(0,E.__)("Make the selected text inline code.")},{keyCombination:{modifier:"access",character:"0"},description:(0,E.__)("Convert the current heading to a paragraph.")},{keyCombination:{modifier:"access",character:"1-6"},description:(0,E.__)("Convert the current paragraph or heading to a heading of level 1 to 6.")}];function Me({keyCombination:e,forceAriaLabel:t}){const n=e.modifier?M.displayShortcutList[e.modifier](e.character):e.character,o=e.modifier?M.shortcutAriaLabel[e.modifier](e.character):e.character;return(0,s.createElement)("kbd",{className:"edit-post-keyboard-shortcut-help-modal__shortcut-key-combination","aria-label":t||o},(Array.isArray(n)?n:[n]).map(((e,t)=>"+"===e?(0,s.createElement)(s.Fragment,{key:t},e):(0,s.createElement)("kbd",{key:t,className:"edit-post-keyboard-shortcut-help-modal__shortcut-key"},e))))}var Ie=function({description:e,keyCombination:t,aliases:n=[],ariaLabel:o}){return(0,s.createElement)(s.Fragment,null,(0,s.createElement)("div",{className:"edit-post-keyboard-shortcut-help-modal__shortcut-description"},e),(0,s.createElement)("div",{className:"edit-post-keyboard-shortcut-help-modal__shortcut-term"},(0,s.createElement)(Me,{keyCombination:t,forceAriaLabel:o}),n.map(((e,t)=>(0,s.createElement)(Me,{keyCombination:e,forceAriaLabel:o,key:t})))))};var Ne=function({name:e}){const{keyCombination:t,description:n,aliases:o}=(0,u.useSelect)((t=>{const{getShortcutKeyCombination:n,getShortcutDescription:o,getShortcutAliases:a}=t(xe.store);return{keyCombination:n(e),aliases:a(e),description:o(e)}}),[e]);return t?(0,s.createElement)(Ie,{keyCombination:t,description:n,aliases:o}):null};const Ae="edit-post/keyboard-shortcut-help",De=({shortcuts:e})=>(0,s.createElement)("ul",{className:"edit-post-keyboard-shortcut-help-modal__shortcut-list",role:"list"},e.map(((e,t)=>(0,s.createElement)("li",{className:"edit-post-keyboard-shortcut-help-modal__shortcut",key:t},"string"==typeof e?(0,s.createElement)(Ne,{name:e}):(0,s.createElement)(Ie,{...e}))))),Le=({title:e,shortcuts:t,className:n})=>(0,s.createElement)("section",{className:N()("edit-post-keyboard-shortcut-help-modal__section",n)},!!e&&(0,s.createElement)("h2",{className:"edit-post-keyboard-shortcut-help-modal__section-title"},e),(0,s.createElement)(De,{shortcuts:t})),Ve=({title:e,categoryName:t,additionalShortcuts:n=[]})=>{const o=(0,u.useSelect)((e=>e(xe.store).getCategoryShortcuts(t)),[t]);return(0,s.createElement)(Le,{title:e,shortcuts:o.concat(n)})};var Fe=(0,f.compose)([(0,u.withSelect)((e=>({isModalActive:e(ee).isModalActive(Ae)}))),(0,u.withDispatch)(((e,{isModalActive:t})=>{const{openModal:n,closeModal:o}=e(ee);return{toggleModal:()=>t?o():n(Ae)}}))])((function({isModalActive:e,toggleModal:t}){return(0,xe.useShortcut)("core/edit-post/keyboard-shortcuts",t),e?(0,s.createElement)(_.Modal,{className:"edit-post-keyboard-shortcut-help-modal",title:(0,E.__)("Keyboard shortcuts"),closeButtonLabel:(0,E.__)("Close"),onRequestClose:t},(0,s.createElement)(Le,{className:"edit-post-keyboard-shortcut-help-modal__main-shortcuts",shortcuts:["core/edit-post/keyboard-shortcuts"]}),(0,s.createElement)(Ve,{title:(0,E.__)("Global shortcuts"),categoryName:"global"}),(0,s.createElement)(Ve,{title:(0,E.__)("Selection shortcuts"),categoryName:"selection"}),(0,s.createElement)(Ve,{title:(0,E.__)("Block shortcuts"),categoryName:"block",additionalShortcuts:[{keyCombination:{character:"/"},description:(0,E.__)("Change the block type after adding a new paragraph."),ariaLabel:(0,E.__)("Forward-slash")}]}),(0,s.createElement)(Le,{title:(0,E.__)("Text formatting"),shortcuts:Be})):null}));var Oe=(0,u.withDispatch)((e=>{const{openModal:t}=e(ee);return{openModal:t}}))((function({openModal:e}){return(0,s.createElement)(_.MenuItem,{onClick:()=>{e(Ae)},shortcut:M.displayShortcut.access("h")},(0,E.__)("Keyboard shortcuts"))}));const{Fill:Re,Slot:He}=(0,_.createSlotFill)("ToolsMoreMenuGroup");Re.Slot=({fillProps:e})=>(0,s.createElement)(He,{fillProps:e},(e=>e.length>0&&(0,s.createElement)(_.MenuGroup,{label:(0,E.__)("Tools")},e)));var Ge=Re;function ze(e=[],t){const n=[...e];for(const e of t){const t=n.findIndex((t=>t.id===e.id));-1!==t?n[t]=e:n.push(e)}return n}const Ue=(0,u.combineReducers)({isSaving:function(e=!1,t){switch(t.type){case"REQUEST_META_BOX_UPDATES":return!0;case"META_BOX_UPDATES_SUCCESS":case"META_BOX_UPDATES_FAILURE":return!1;default:return e}},locations:function(e={},t){if("SET_META_BOXES_PER_LOCATIONS"===t.type){const n={...e};for(const[e,o]of Object.entries(t.metaBoxesPerLocation))n[e]=ze(n[e],o);return n}return e},initialized:function(e=!1,t){return"META_BOXES_INITIALIZED"===t.type||e}});var $e=(0,u.combineReducers)({metaBoxes:Ue,publishSidebarActive:function(e=!1,t){switch(t.type){case"OPEN_PUBLISH_SIDEBAR":return!0;case"CLOSE_PUBLISH_SIDEBAR":return!1;case"TOGGLE_PUBLISH_SIDEBAR":return!e}return e},removedPanels:function(e=[],t){if("REMOVE_PANEL"===t.type)if(!e.includes(t.panelName))return[...e,t.panelName];return e},deviceType:function(e="Desktop",t){return"SET_PREVIEW_DEVICE_TYPE"===t.type?t.deviceType:e},blockInserterPanel:function(e=!1,t){switch(t.type){case"SET_IS_LIST_VIEW_OPENED":return!t.isOpen&&e;case"SET_IS_INSERTER_OPENED":return t.value}return e},listViewPanel:function(e=!1,t){switch(t.type){case"SET_IS_INSERTER_OPENED":return!t.value&&e;case"SET_IS_LIST_VIEW_OPENED":return t.isOpen}return e},isEditingTemplate:function(e=!1,t){return"SET_IS_EDITING_TEMPLATE"===t.type?t.value:e}}),We=window.wp.apiFetch,qe=n.n(We),Ze=window.wp.a11y;const je=e=>({dispatch:t,registry:n})=>{n.select(p.store).get("core/edit-post","distractionFree")&&t.toggleDistractionFree(),n.dispatch(ee).enableComplementaryArea(rn.name,e)},Ke=()=>({registry:e})=>e.dispatch(ee).disableComplementaryArea(rn.name),Ye=e=>({registry:t})=>(d()("select( 'core/edit-post' ).openModal( name )",{since:"6.3",alternative:"select( 'core/interface').openModal( name )"}),t.dispatch(ee).openModal(e)),Qe=()=>({registry:e})=>(d()("select( 'core/edit-post' ).closeModal()",{since:"6.3",alternative:"select( 'core/interface').closeModal()"}),e.dispatch(ee).closeModal());function Xe(){return{type:"OPEN_PUBLISH_SIDEBAR"}}function Je(){return{type:"CLOSE_PUBLISH_SIDEBAR"}}function et(){return{type:"TOGGLE_PUBLISH_SIDEBAR"}}const tt=e=>({registry:t})=>{var n;const o=null!==(n=t.select(p.store).get("core/edit-post","inactivePanels"))&&void 0!==n?n:[];let a;a=!!o?.includes(e)?o.filter((t=>t!==e)):[...o,e],t.dispatch(p.store).set("core/edit-post","inactivePanels",a)},nt=e=>({registry:t})=>{var n;const o=null!==(n=t.select(p.store).get("core/edit-post","openPanels"))&&void 0!==n?n:[];let a;a=!!o?.includes(e)?o.filter((t=>t!==e)):[...o,e],t.dispatch(p.store).set("core/edit-post","openPanels",a)};function ot(e){return{type:"REMOVE_PANEL",panelName:e}}const at=e=>({registry:t})=>t.dispatch(p.store).toggle("core/edit-post",e),rt=e=>({dispatch:t,registry:n})=>{n.dispatch(p.store).set("core/edit-post","editorMode",e),"visual"!==e&&n.dispatch(b.store).clearSelectedBlock(),"text"===e&&n.select(p.store).get("core/edit-post","distractionFree")&&t.toggleDistractionFree();const o="visual"===e?(0,E.__)("Visual editor selected"):(0,E.__)("Code editor selected");(0,Ze.speak)(o,"assertive")},st=e=>({registry:t})=>{const n=t.select(ee).isItemPinned("core/edit-post",e);t.dispatch(ee)[n?"unpinItem":"pinItem"]("core/edit-post",e)},lt=(e,t)=>({registry:n})=>{var o;if(!e)return;const a=null!==(o=n.select(p.store).get("core/edit-post","preferredStyleVariations"))&&void 0!==o?o:{};if(t)n.dispatch(p.store).set("core/edit-post","preferredStyleVariations",{...a,[e]:t});else{const t={...a};delete t[e],n.dispatch(p.store).set("core/edit-post","preferredStyleVariations",t)}},it=e=>({registry:t})=>{var n;const o=(null!==(n=t.select(p.store).get("core/edit-post","hiddenBlockTypes"))&&void 0!==n?n:[]).filter((t=>!(Array.isArray(e)?e:[e]).includes(t)));t.dispatch(p.store).set("core/edit-post","hiddenBlockTypes",o)},ct=e=>({registry:t})=>{var n;const o=null!==(n=t.select(p.store).get("core/edit-post","hiddenBlockTypes"))&&void 0!==n?n:[],a=new Set([...o,...Array.isArray(e)?e:[e]]);t.dispatch(p.store).set("core/edit-post","hiddenBlockTypes",[...a])};function dt(e){return{type:"SET_META_BOXES_PER_LOCATIONS",metaBoxesPerLocation:e}}const ut=()=>async({registry:e,select:t,dispatch:n})=>{n({type:"REQUEST_META_BOX_UPDATES"}),window.tinyMCE&&window.tinyMCE.triggerSave();const o=e.select(S.store).getCurrentPost(),a=[!!o.comment_status&&["comment_status",o.comment_status],!!o.ping_status&&["ping_status",o.ping_status],!!o.sticky&&["sticky",o.sticky],!!o.author&&["post_author",o.author]].filter(Boolean),r=[new window.FormData(document.querySelector(".metabox-base-form")),...t.getActiveMetaBoxLocations().map((e=>new window.FormData((e=>{const t=document.querySelector(`.edit-post-meta-boxes-area.is-${e} .metabox-location-${e}`);return t||document.querySelector("#metaboxes .metabox-location-"+e)})(e))))].reduce(((e,t)=>{for(const[n,o]of t)e.append(n,o);return e}),new window.FormData);a.forEach((([e,t])=>r.append(e,t)));try{await qe()({url:window._wpMetaBoxUrl,method:"POST",body:r,parse:!1}),n.metaBoxUpdatesSuccess()}catch{n.metaBoxUpdatesFailure()}};function mt(){return{type:"META_BOX_UPDATES_SUCCESS"}}function pt(){return{type:"META_BOX_UPDATES_FAILURE"}}function gt(e){return{type:"SET_PREVIEW_DEVICE_TYPE",deviceType:e}}function ht(e){return{type:"SET_IS_INSERTER_OPENED",value:e}}const _t=e=>({dispatch:t,registry:n})=>{n.select(p.store).get("core/edit-post","distractionFree")&&e&&t.toggleDistractionFree(),t({type:"SET_IS_LIST_VIEW_OPENED",isOpen:e})};function bt(e){return{type:"SET_IS_EDITING_TEMPLATE",value:e}}const Et=(e=!1)=>({registry:t,select:n,dispatch:o})=>{o(bt(!0));if(!n.isFeatureActive("welcomeGuideTemplate")){const n=e?(0,E.__)("Custom template created. You're in template mode now."):(0,E.__)("Editing template. Changes made here affect all posts and pages that use the template.");t.dispatch(x.store).createSuccessNotice(n,{type:"snackbar"})}},ft=e=>async({registry:t})=>{const n=await t.dispatch(w.store).saveEntityRecord("postType","wp_template",e),o=t.select(S.store).getCurrentPost();t.dispatch(w.store).editEntityRecord("postType",o.type,o.id,{template:n.slug})};let vt=!1;const yt=()=>({registry:e,select:t,dispatch:n})=>{if(!e.select(S.store).__unstableIsEditorReady())return;if(vt)return;const o=e.select(S.store).getCurrentPostType();window.postboxes.page!==o&&window.postboxes.add_postbox_toggles(o),vt=!0,(0,m.addFilter)("editor.__unstableSavePost","core/edit-post/save-metaboxes",((e,o)=>e.then((()=>{if(!o.isAutosave&&t.hasMetaBoxes())return n.requestMetaBoxUpdates()})))),n({type:"META_BOXES_INITIALIZED"})},wt=()=>({dispatch:e,registry:t})=>{const n=t.select(p.store).get("core/edit-post","distractionFree");n||t.batch((()=>{t.dispatch(p.store).set("core/edit-post","fixedToolbar",!1),e.setIsInserterOpened(!1),e.setIsListViewOpened(!1),e.closeGeneralSidebar()})),t.batch((()=>{t.dispatch(p.store).set("core/edit-post","distractionFree",!n),t.dispatch(x.store).createInfoNotice(n?(0,E.__)("Distraction free off."):(0,E.__)("Distraction free on."),{id:"core/edit-post/distraction-free-mode/notice",type:"snackbar"})}))};var St={};function kt(e){return[e]}function Pt(e,t,n){var o;if(e.length!==t.length)return!1;for(o=n;o<e.length;o++)if(e[o]!==t[o])return!1;return!0}function Ct(e,t){var n,o=t||kt;function a(){n=new WeakMap}function r(){var t,a,r,s,l,i=arguments.length;for(s=new Array(i),r=0;r<i;r++)s[r]=arguments[r];for(t=function(e){var t,o,a,r,s,l=n,i=!0;for(t=0;t<e.length;t++){if(!(s=o=e[t])||"object"!=typeof s){i=!1;break}l.has(o)?l=l.get(o):(a=new WeakMap,l.set(o,a),l=a)}return l.has(St)||((r=function(){var e={clear:function(){e.head=null}};return e}()).isUniqueByDependants=i,l.set(St,r)),l.get(St)}(l=o.apply(null,s)),t.isUniqueByDependants||(t.lastDependants&&!Pt(l,t.lastDependants,0)&&t.clear(),t.lastDependants=l),a=t.head;a;){if(Pt(a.args,s,1))return a!==t.head&&(a.prev.next=a.next,a.next&&(a.next.prev=a.prev),a.next=t.head,a.prev=null,t.head.prev=a,t.head=a),a.val;a=a.next}return a={val:e.apply(null,s)},s[0]=null,a.args=s,t.head&&(t.head.prev=a,a.next=t.head),t.head=a,a.val}return r.getDependants=o,r.clear=a,a(),r}const Tt=[],xt={},Bt={rootClientId:void 0,insertionIndex:void 0,filterValue:void 0},Mt=(0,u.createRegistrySelector)((e=>()=>{var t;return null!==(t=e(p.store).get("core/edit-post","editorMode"))&&void 0!==t?t:"visual"})),It=(0,u.createRegistrySelector)((e=>()=>{const t=e(ee).getActiveComplementaryArea("core/edit-post");return["edit-post/document","edit-post/block"].includes(t)})),Nt=(0,u.createRegistrySelector)((e=>()=>{const t=e(ee).getActiveComplementaryArea("core/edit-post");return!!t&&!["edit-post/document","edit-post/block"].includes(t)})),At=(0,u.createRegistrySelector)((e=>()=>e(ee).getActiveComplementaryArea("core/edit-post")));const Dt=(0,u.createRegistrySelector)((e=>()=>{d()("select( 'core/edit-post' ).getPreferences",{since:"6.0",alternative:"select( 'core/preferences' ).get"});const t=["hiddenBlockTypes","editorMode","preferredStyleVariations"].reduce(((t,n)=>({...t,[n]:e(p.store).get("core/edit-post",n)})),{}),n=function(e,t){var n;const o=e?.reduce(((e,t)=>({...e,[t]:{enabled:!1}})),{}),a=t?.reduce(((e,t)=>{const n=e?.[t];return{...e,[t]:{...n,opened:!0}}}),null!=o?o:{});return null!==(n=null!=a?a:o)&&void 0!==n?n:xt}(e(p.store).get("core/edit-post","inactivePanels"),e(p.store).get("core/edit-post","openPanels"));return{...t,panels:n}}));function Lt(e,t,n){d()("select( 'core/edit-post' ).getPreference",{since:"6.0",alternative:"select( 'core/preferences' ).get"});const o=Dt(e)[t];return void 0===o?n:o}const Vt=(0,u.createRegistrySelector)((e=>()=>{var t;return null!==(t=e(p.store).get("core/edit-post","hiddenBlockTypes"))&&void 0!==t?t:Tt}));function Ft(e){return e.publishSidebarActive}function Ot(e,t){return e.removedPanels.includes(t)}const Rt=(0,u.createRegistrySelector)((e=>(t,n)=>{const o=e(p.store).get("core/edit-post","inactivePanels");return!Ot(t,n)&&!o?.includes(n)})),Ht=(0,u.createRegistrySelector)((e=>(t,n)=>{const o=e(p.store).get("core/edit-post","openPanels");return!!o?.includes(n)})),Gt=(0,u.createRegistrySelector)((e=>(t,n)=>(d()("select( 'core/edit-post' ).isModalActive",{since:"6.3",alternative:"select( 'core/interface' ).isModalActive"}),!!e(ee).isModalActive(n)))),zt=(0,u.createRegistrySelector)((e=>(t,n)=>!!e(p.store).get("core/edit-post",n))),Ut=(0,u.createRegistrySelector)((e=>(t,n)=>e(ee).isItemPinned("core/edit-post",n))),$t=Ct((e=>Object.keys(e.metaBoxes.locations).filter((t=>qt(e,t)))),(e=>[e.metaBoxes.locations]));function Wt(e,t){return qt(e,t)&&Zt(e,t)?.some((({id:t})=>Rt(e,`meta-box-${t}`)))}function qt(e,t){const n=Zt(e,t);return!!n&&0!==n.length}function Zt(e,t){return e.metaBoxes.locations[t]}const jt=Ct((e=>Object.values(e.metaBoxes.locations).flat()),(e=>[e.metaBoxes.locations]));function Kt(e){return $t(e).length>0}function Yt(e){return e.metaBoxes.isSaving}function Qt(e){return e.deviceType}function Xt(e){return!!e.blockInserterPanel}function Jt(e){return"boolean"==typeof e.blockInserterPanel?Bt:e.blockInserterPanel}function en(e){return e.listViewPanel}function tn(e){return e.isEditingTemplate}function nn(e){return e.metaBoxes.initialized}const on=(0,u.createRegistrySelector)((e=>()=>{const t=e(S.store).getEditedPostAttribute("template");if(t){const n=e(w.store).getEntityRecords("postType","wp_template",{per_page:-1})?.find((e=>e.slug===t));return n?e(w.store).getEditedEntityRecord("postType","wp_template",n.id):n}const n=e(S.store).getCurrentPost();return n.link?e(w.store).__experimentalGetTemplateForLink(n.link):null})),an="core/edit-post",rn=(0,u.createReduxStore)(an,{reducer:$e,actions:a,selectors:r});function sn(){const e=(0,u.useSelect)((e=>e(rn).isEditingTemplate()),[]);return(0,s.createElement)(p.PreferenceToggleMenuItem,{scope:"core/edit-post",name:e?"welcomeGuideTemplate":"welcomeGuide",label:(0,E.__)("Welcome Guide")})}function ln(){const e=(0,u.useSelect)((e=>{const{canUser:t}=e(w.store),{getEditorSettings:n}=e(S.store),o=n().__unstableIsBlockBasedTheme,a=(0,T.addQueryArgs)("edit.php",{post_type:"wp_block"}),r=(0,T.addQueryArgs)("site-editor.php",{path:"/patterns"});return t("read","templates")&&o?r:a}),[]);return(0,s.createElement)(_.MenuItem,{role:"menuitem",href:e},(0,E.__)("Manage patterns"))}(0,u.register)(rn),(0,C.registerPlugin)("edit-post",{render(){return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Ge,null,(({onClose:e})=>(0,s.createElement)(s.Fragment,null,(0,s.createElement)(ln,null),(0,s.createElement)(Oe,{onSelect:e}),(0,s.createElement)(sn,null),(0,s.createElement)(B,null),(0,s.createElement)(_.MenuItem,{role:"menuitem",icon:P,href:(0,E.__)("https://wordpress.org/documentation/article/wordpress-block-editor/"),target:"_blank",rel:"noopener noreferrer"},(0,E.__)("Help"),(0,s.createElement)(_.VisuallyHidden,{as:"span"},(0,E.__)("(opens in a new tab)")))))))}});var cn=window.wp.commands,dn=window.wp.coreCommands;function un(){const e=(0,u.useSelect)((e=>e(S.store).getEditorSettings().richEditingEnabled),[]),{switchEditorMode:t}=(0,u.useDispatch)(rn);return(0,s.createElement)("div",{className:"edit-post-text-editor"},e&&(0,s.createElement)("div",{className:"edit-post-text-editor__toolbar"},(0,s.createElement)("h2",null,(0,E.__)("Editing code")),(0,s.createElement)(_.Button,{variant:"tertiary",onClick:()=>t("visual"),shortcut:M.displayShortcut.secondary("m")},(0,E.__)("Exit code editor"))),(0,s.createElement)("div",{className:"edit-post-text-editor__body"},(0,s.createElement)(S.PostTitle,null),(0,s.createElement)(S.PostTextEditor,null)))}var mn=window.wp.privateApis;const{lock:pn,unlock:gn}=(0,mn.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.","@wordpress/edit-post"),{LayoutStyle:hn,useLayoutClasses:_n,useLayoutStyles:bn,ExperimentalBlockCanvas:En}=gn(b.privateApis),fn=!1;function vn(e){for(let t=0;t<e.length;t++){if("core/post-content"===e[t].name)return e[t].attributes;if(e[t].innerBlocks.length){const n=vn(e[t].innerBlocks);if(n)return n}}}function yn(e){for(let t=0;t<e.length;t++)if("core/post-content"===e[t].name)return!0;return!1}function wn({styles:e}){const{deviceType:t,isWelcomeGuideVisible:n,isTemplateMode:o,postContentAttributes:a,editedPostTemplate:r={},wrapperBlockName:i,wrapperUniqueId:c,isBlockBasedTheme:d,hasV3BlocksOnly:m}=(0,u.useSelect)((e=>{const{isFeatureActive:t,isEditingTemplate:n,getEditedPostTemplate:o,__experimentalGetPreviewDeviceType:a}=e(rn),{getCurrentPostId:r,getCurrentPostType:s,getEditorSettings:i}=e(S.store),{getBlockTypes:c}=e(l.store),d=n(),u=s();let m;"wp_block"===u?m="core/block":d||(m="core/post-content");const p=i(),g=p.supportsTemplateMode,h=e(w.store).getPostType(u),_=e(w.store).canUser("create","templates");return{deviceType:a(),isWelcomeGuideVisible:t("welcomeGuide"),isTemplateMode:d,postContentAttributes:i().postContentAttributes,editedPostTemplate:h?.viewable&&g&&_?o():void 0,wrapperBlockName:m,wrapperUniqueId:r(),isBlockBasedTheme:p.__unstableIsBlockBasedTheme,hasV3BlocksOnly:c().every((e=>e.apiVersion>=3))}}),[]),{isCleanNewPost:p}=(0,u.useSelect)(S.store),g=(0,u.useSelect)((e=>e(rn).hasMetaBoxes()),[]),{hasRootPaddingAwareAlignments:h,isFocusMode:E,themeHasDisabledLayoutStyles:v,themeSupportsLayout:y}=(0,u.useSelect)((e=>{const t=e(b.store).getSettings();return{themeHasDisabledLayoutStyles:t.disableLayoutStyles,themeSupportsLayout:t.supportsLayout,isFocusMode:t.focusMode,hasRootPaddingAwareAlignments:t.__experimentalFeatures?.useRootPaddingAwareAlignments}}),[]),k={height:"100%",width:"100%",marginLeft:"auto",marginRight:"auto",display:"flex",flexFlow:"column",background:"white"},P={...k,borderRadius:"2px 2px 0 0",border:"1px solid #ddd",borderBottom:0},C=(0,b.__experimentalUseResizeCanvas)(t,o),T=(0,b.useSetting)("layout"),x="is-"+t.toLowerCase()+"-preview";let B,M=o?P:k;C&&(M=C),g||C||o||(B="40vh");const I=(0,s.useRef)(),A=(0,f.useMergeRefs)([I,(0,b.__unstableUseTypewriter)()]),D=(0,s.useMemo)((()=>o?{type:"default"}:y?{...T,type:"constrained"}:{type:"default"}),[o,y,T]),L=(0,s.useMemo)((()=>{if(!r?.content&&!r?.blocks)return a;if(r?.blocks)return vn(r?.blocks);const e="string"==typeof r?.content?r?.content:"";return vn((0,l.parse)(e))||{}}),[r?.content,r?.blocks,a]),V=(0,s.useMemo)((()=>{if(!r?.content&&!r?.blocks)return!1;if(r?.blocks)return yn(r?.blocks);const e="string"==typeof r?.content?r?.content:"";return yn((0,l.parse)(e))||!1}),[r?.content,r?.blocks]),{layout:F={},align:O=""}=L||{},R=_n(L,"core/post-content"),H=N()({"is-layout-flow":!y},y&&R,O&&`align${O}`),G=bn(L,"core/post-content",".block-editor-block-list__layout.is-root-container"),z=(0,s.useMemo)((()=>F&&("constrained"===F?.type||F?.inherit||F?.contentSize||F?.wideSize)?{...T,...F,type:"constrained"}:{...T,...F,type:"default"}),[F?.type,F?.inherit,F?.contentSize,F?.wideSize,T]),U=a?z:D,$="default"!==U?.type||V?U:D,W=(0,b.__unstableUseTypingObserver)(),q=(0,s.useRef)();(0,s.useEffect)((()=>{!n&&p()&&q?.current?.focus()}),[n,p]),e=(0,s.useMemo)((()=>[...e,{css:".edit-post-visual-editor__post-title-wrapper{margin-top:4rem}"+(B?`body{padding-bottom:${B}}`:"")}]),[e]);const Z=(m||fn&&d)&&!g||o||"Tablet"===t||"Mobile"===t;return(0,s.createElement)(b.BlockTools,{__unstableContentRef:I,className:N()("edit-post-visual-editor",{"is-template-mode":o,"has-inline-canvas":!Z})},(0,s.createElement)(_.__unstableMotion.div,{className:"edit-post-visual-editor__content-area",animate:{padding:o?"48px 48px 0":0}},(0,s.createElement)(_.__unstableMotion.div,{animate:M,initial:k,className:x},(0,s.createElement)(En,{shouldIframe:Z,contentRef:A,styles:e,height:"100%"},y&&!v&&!o&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(hn,{selector:".edit-post-visual-editor__post-title-wrapper",layout:D}),(0,s.createElement)(hn,{selector:".block-editor-block-list__layout.is-root-container",layout:$}),O&&(0,s.createElement)(hn,{css:".is-root-container.alignwide { max-width: var(--wp--style--global--wide-size); margin-left: auto; margin-right: auto;}\n\t\t.is-root-container.alignwide:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: var(--wp--style--global--wide-size);}\n\t\t.is-root-container.alignfull { max-width: none; margin-left: auto; margin-right: auto;}\n\t\t.is-root-container.alignfull:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: none;}"}),G&&(0,s.createElement)(hn,{layout:z,css:G})),!o&&(0,s.createElement)("div",{className:N()("edit-post-visual-editor__post-title-wrapper",{"is-focus-mode":E,"has-global-padding":h}),contentEditable:!1,ref:W},(0,s.createElement)(S.PostTitle,{ref:q})),(0,s.createElement)(b.__experimentalRecursionProvider,{blockName:i,uniqueId:c},(0,s.createElement)(b.BlockList,{className:o?"wp-site-blocks":`${H} wp-block-post-content`,layout:U}))))))}var Sn=function(){const{getBlockSelectionStart:e}=(0,u.useSelect)(b.store),{getEditorMode:t,isEditorSidebarOpened:n,isListViewOpened:o}=(0,u.useSelect)(rn),a=(0,u.useSelect)((e=>{const{richEditingEnabled:t,codeEditingEnabled:n}=e(S.store).getEditorSettings();return!t||!n}),[]),{switchEditorMode:r,openGeneralSidebar:i,closeGeneralSidebar:c,toggleFeature:d,setIsListViewOpened:m,toggleDistractionFree:p}=(0,u.useDispatch)(rn),{registerShortcut:g}=(0,u.useDispatch)(xe.store),{replaceBlocks:h}=(0,u.useDispatch)(b.store),{getBlockName:_,getSelectedBlockClientId:f,getBlockAttributes:v}=(0,u.useSelect)(b.store),y=(e,t)=>{e.preventDefault();const n=0===t?"core/paragraph":"core/heading",o=f();if(null===o)return;const a=_(o);if("core/paragraph"!==a&&"core/heading"!==a)return;const r=v(o),s="core/paragraph"===a?"align":"textAlign",i="core/paragraph"===n?"align":"textAlign";h(o,(0,l.createBlock)(n,{level:t,content:r.content,[i]:r[s]}))};return(0,s.useEffect)((()=>{g({name:"core/edit-post/toggle-mode",category:"global",description:(0,E.__)("Switch between visual editor and code editor."),keyCombination:{modifier:"secondary",character:"m"}}),g({name:"core/edit-post/toggle-distraction-free",category:"global",description:(0,E.__)("Toggle distraction free mode."),keyCombination:{modifier:"primaryShift",character:"\\"}}),g({name:"core/edit-post/toggle-fullscreen",category:"global",description:(0,E.__)("Toggle fullscreen mode."),keyCombination:{modifier:"secondary",character:"f"}}),g({name:"core/edit-post/toggle-list-view",category:"global",description:(0,E.__)("Open the block list view."),keyCombination:{modifier:"access",character:"o"}}),g({name:"core/edit-post/toggle-sidebar",category:"global",description:(0,E.__)("Show or hide the Settings sidebar."),keyCombination:{modifier:"primaryShift",character:","}}),g({name:"core/edit-post/next-region",category:"global",description:(0,E.__)("Navigate to the next part of the editor."),keyCombination:{modifier:"ctrl",character:"`"},aliases:[{modifier:"access",character:"n"}]}),g({name:"core/edit-post/previous-region",category:"global",description:(0,E.__)("Navigate to the previous part of the editor."),keyCombination:{modifier:"ctrlShift",character:"`"},aliases:[{modifier:"access",character:"p"},{modifier:"ctrlShift",character:"~"}]}),g({name:"core/edit-post/keyboard-shortcuts",category:"main",description:(0,E.__)("Display these keyboard shortcuts."),keyCombination:{modifier:"access",character:"h"}}),g({name:"core/edit-post/transform-heading-to-paragraph",category:"block-library",description:(0,E.__)("Transform heading to paragraph."),keyCombination:{modifier:"access",character:"0"}}),[1,2,3,4,5,6].forEach((e=>{g({name:`core/edit-post/transform-paragraph-to-heading-${e}`,category:"block-library",description:(0,E.__)("Transform paragraph to heading."),keyCombination:{modifier:"access",character:`${e}`}})}))}),[]),(0,xe.useShortcut)("core/edit-post/toggle-mode",(()=>{r("visual"===t()?"text":"visual")}),{isDisabled:a}),(0,xe.useShortcut)("core/edit-post/toggle-fullscreen",(()=>{d("fullscreenMode")})),(0,xe.useShortcut)("core/edit-post/toggle-distraction-free",(()=>{p()})),(0,xe.useShortcut)("core/edit-post/toggle-sidebar",(t=>{if(t.preventDefault(),n())c();else{const t=e()?"edit-post/block":"edit-post/document";i(t)}})),(0,xe.useShortcut)("core/edit-post/toggle-list-view",(e=>{o()||(e.preventDefault(),m(!0))})),(0,xe.useShortcut)("core/edit-post/transform-heading-to-paragraph",(e=>y(e,0))),[1,2,3,4,5,6].forEach((e=>{(0,xe.useShortcut)(`core/edit-post/transform-paragraph-to-heading-${e}`,(t=>y(t,e)))})),null};function kn({willEnable:e}){const[t,n]=(0,s.useState)(!1);return(0,s.createElement)(s.Fragment,null,(0,s.createElement)("p",{className:"edit-post-preferences-modal__custom-fields-confirmation-message"},(0,E.__)("A page reload is required for this change. Make sure your content is saved before reloading.")),(0,s.createElement)(_.Button,{className:"edit-post-preferences-modal__custom-fields-confirmation-button",variant:"secondary",isBusy:t,disabled:t,onClick:()=>{n(!0),function(){const e=document.getElementById("toggle-custom-fields-form");e.querySelector('[name="_wp_http_referer"]').setAttribute("value",(0,T.getPathAndQueryString)(window.location.href)),e.submit()}()}},e?(0,E.__)("Show & Reload Page"):(0,E.__)("Hide & Reload Page")))}var Pn=(0,u.withSelect)((e=>({areCustomFieldsEnabled:!!e(S.store).getEditorSettings().enableCustomFields})))((function({label:e,areCustomFieldsEnabled:t}){const[n,o]=(0,s.useState)(t);return(0,s.createElement)(Te,{label:e,isChecked:n,onChange:o},n!==t&&(0,s.createElement)(kn,{willEnable:n}))})),Cn=(0,f.compose)((0,u.withSelect)(((e,{panelName:t})=>{const{isEditorPanelEnabled:n,isEditorPanelRemoved:o}=e(rn);return{isRemoved:o(t),isChecked:n(t)}})),(0,f.ifCondition)((({isRemoved:e})=>!e)),(0,u.withDispatch)(((e,{panelName:t})=>({onChange:()=>e(rn).toggleEditorPanelEnabled(t)}))))(Te);const{Fill:Tn,Slot:xn}=(0,_.createSlotFill)("EnablePluginDocumentSettingPanelOption"),Bn=({label:e,panelName:t})=>(0,s.createElement)(Tn,null,(0,s.createElement)(Cn,{label:e,panelName:t}));Bn.Slot=xn;var Mn=Bn,In=(0,f.compose)((0,u.withSelect)((e=>({isChecked:e(S.store).isPublishSidebarEnabled()}))),(0,u.withDispatch)((e=>{const{enablePublishSidebar:t,disablePublishSidebar:n}=e(S.store);return{onChange:e=>e?t():n()}})),(0,V.ifViewportMatches)("medium"))(Te),Nn=(0,f.compose)((0,u.withSelect)(((e,{featureName:t})=>{const{isFeatureActive:n}=e(rn);return{isChecked:n(t)}})),(0,u.withDispatch)(((e,{featureName:t,onToggle:n=(()=>{})})=>({onChange:()=>{n(),e(rn).toggleFeature(t)}}))))(Te);var An=(0,u.withSelect)((e=>{const{getEditorSettings:t}=e(S.store),{getAllMetaBoxes:n}=e(rn);return{areCustomFieldsRegistered:void 0!==t().enableCustomFields,metaBoxes:n()}}))((function({areCustomFieldsRegistered:e,metaBoxes:t,...n}){const o=t.filter((({id:e})=>"postcustom"!==e));return e||0!==o.length?(0,s.createElement)(Ce,{...n},e&&(0,s.createElement)(Pn,{label:(0,E.__)("Custom fields")}),o.map((({id:e,title:t})=>(0,s.createElement)(Cn,{key:e,label:t,panelName:`meta-box-${e}`})))):null}));var Dn=function({blockTypes:e,value:t,onItemChange:n}){return(0,s.createElement)("ul",{className:"edit-post-block-manager__checklist"},e.map((e=>(0,s.createElement)("li",{key:e.name,className:"edit-post-block-manager__checklist-item"},(0,s.createElement)(_.CheckboxControl,{__nextHasNoMarginBottom:!0,label:e.title,checked:t.includes(e.name),onChange:(...t)=>n(e.name,...t)}),(0,s.createElement)(b.BlockIcon,{icon:e.icon})))))};var Ln=function e({title:t,blockTypes:n}){const o=(0,f.useInstanceId)(e),{defaultAllowedBlockTypes:a,hiddenBlockTypes:r}=(0,u.useSelect)((e=>{const{getEditorSettings:t}=e(S.store),{getHiddenBlockTypes:n}=e(rn);return{defaultAllowedBlockTypes:t().defaultAllowedBlockTypes,hiddenBlockTypes:n()}}),[]),l=(0,s.useMemo)((()=>!0===a?n:n.filter((({name:e})=>a?.includes(e)))),[a,n]),{showBlockTypes:i,hideBlockTypes:c}=(0,u.useDispatch)(rn),d=(0,s.useCallback)(((e,t)=>{t?i(e):c(e)}),[]),m=(0,s.useCallback)((e=>{const t=n.map((({name:e})=>e));e?i(t):c(t)}),[n]);if(!l.length)return null;const p=l.map((({name:e})=>e)).filter((e=>!r.includes(e))),g="edit-post-block-manager__category-title-"+o,h=p.length===l.length,b=!h&&p.length>0;return(0,s.createElement)("div",{role:"group","aria-labelledby":g,className:"edit-post-block-manager__category"},(0,s.createElement)(_.CheckboxControl,{__nextHasNoMarginBottom:!0,checked:h,onChange:m,className:"edit-post-block-manager__category-title",indeterminate:b,label:(0,s.createElement)("span",{id:g},t)}),(0,s.createElement)(Dn,{blockTypes:l,value:p,onItemChange:d}))};var Vn=(0,f.compose)([(0,u.withSelect)((e=>{const{getBlockTypes:t,getCategories:n,hasBlockSupport:o,isMatchingSearchTerm:a}=e(l.store),{getHiddenBlockTypes:r}=e(rn),s=t(),i=r().filter((e=>s.some((t=>t.name===e)))),c=Array.isArray(i)&&i.length;return{blockTypes:s,categories:n(),hasBlockSupport:o,isMatchingSearchTerm:a,numberOfHiddenBlocks:c}})),(0,u.withDispatch)((e=>{const{showBlockTypes:t}=e(rn);return{enableAllBlockTypes:e=>{const n=e.map((({name:e})=>e));t(n)}}}))])((function({blockTypes:e,categories:t,hasBlockSupport:n,isMatchingSearchTerm:o,numberOfHiddenBlocks:a,enableAllBlockTypes:r}){const l=(0,f.useDebounce)(Ze.speak,500),[i,c]=(0,s.useState)("");return e=e.filter((e=>n(e,"inserter",!0)&&(!i||o(e,i))&&(!e.parent||e.parent.includes("core/post-content")))),(0,s.useEffect)((()=>{if(!i)return;const t=e.length,n=(0,E.sprintf)((0,E._n)("%d result found.","%d results found.",t),t);l(n)}),[e.length,i,l]),(0,s.createElement)("div",{className:"edit-post-block-manager__content"},!!a&&(0,s.createElement)("div",{className:"edit-post-block-manager__disabled-blocks-count"},(0,E.sprintf)((0,E._n)("%d block is hidden.","%d blocks are hidden.",a),a),(0,s.createElement)(_.Button,{variant:"link",onClick:()=>r(e)},(0,E.__)("Reset"))),(0,s.createElement)(_.SearchControl,{__nextHasNoMarginBottom:!0,label:(0,E.__)("Search for a block"),placeholder:(0,E.__)("Search for a block"),value:i,onChange:e=>c(e),className:"edit-post-block-manager__search"}),(0,s.createElement)("div",{tabIndex:"0",role:"region","aria-label":(0,E.__)("Available block types"),className:"edit-post-block-manager__results"},0===e.length&&(0,s.createElement)("p",{className:"edit-post-block-manager__no-results"},(0,E.__)("No blocks found.")),t.map((t=>(0,s.createElement)(Ln,{key:t.slug,title:t.title,blockTypes:e.filter((e=>e.category===t.slug))}))),(0,s.createElement)(Ln,{title:(0,E.__)("Uncategorized"),blockTypes:e.filter((({category:e})=>!e))})))}));const Fn="edit-post/preferences";function On(){const e=(0,f.useViewportMatch)("medium"),{closeModal:t}=(0,u.useDispatch)(ee),[n,o]=(0,u.useSelect)((t=>{const{getEditorSettings:n}=t(S.store),{getEditorMode:o,isFeatureActive:a}=t(rn),r=t(ee).isModalActive(Fn),s=o(),l=n().richEditingEnabled,i=a("distractionFree");return[r,!i&&e&&l&&"visual"===s,i]}),[e]),{closeGeneralSidebar:a,setIsListViewOpened:r,setIsInserterOpened:l}=(0,u.useDispatch)(rn),{set:i}=(0,u.useDispatch)(p.store),c=()=>{i("core/edit-post","fixedToolbar",!1),l(!1),r(!1),a()},d=(0,s.useMemo)((()=>[{name:"general",tabLabel:(0,E.__)("General"),content:(0,s.createElement)(s.Fragment,null,e&&(0,s.createElement)(Ce,{title:(0,E.__)("Publishing"),description:(0,E.__)("Change options related to publishing.")},(0,s.createElement)(In,{help:(0,E.__)("Review settings, such as visibility and tags."),label:(0,E.__)("Include pre-publish checklist")})),(0,s.createElement)(Ce,{title:(0,E.__)("Appearance"),description:(0,E.__)("Customize options related to the block editor interface and editing flow.")},(0,s.createElement)(Nn,{featureName:"distractionFree",onToggle:c,help:(0,E.__)("Reduce visual distractions by hiding the toolbar and other elements to focus on writing."),label:(0,E.__)("Distraction free")}),(0,s.createElement)(Nn,{featureName:"focusMode",help:(0,E.__)("Highlights the current block and fades other content."),label:(0,E.__)("Spotlight mode")}),(0,s.createElement)(Nn,{featureName:"showIconLabels",label:(0,E.__)("Show button text labels"),help:(0,E.__)("Show text instead of icons on buttons.")}),(0,s.createElement)(Nn,{featureName:"showListViewByDefault",help:(0,E.__)("Opens the block list view sidebar by default."),label:(0,E.__)("Always open list view")}),(0,s.createElement)(Nn,{featureName:"themeStyles",help:(0,E.__)("Make the editor look like your theme."),label:(0,E.__)("Use theme styles")}),o&&(0,s.createElement)(Nn,{featureName:"showBlockBreadcrumbs",help:(0,E.__)("Shows block breadcrumbs at the bottom of the editor."),label:(0,E.__)("Display block breadcrumbs")})))},{name:"blocks",tabLabel:(0,E.__)("Blocks"),content:(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Ce,{title:(0,E.__)("Block interactions"),description:(0,E.__)("Customize how you interact with blocks in the block library and editing canvas.")},(0,s.createElement)(Nn,{featureName:"mostUsedBlocks",help:(0,E.__)("Places the most frequent blocks in the block library."),label:(0,E.__)("Show most used blocks")}),(0,s.createElement)(Nn,{featureName:"keepCaretInsideBlock",help:(0,E.__)("Aids screen readers by stopping text caret from leaving blocks."),label:(0,E.__)("Contain text cursor inside block")})),(0,s.createElement)(Ce,{title:(0,E.__)("Visible blocks"),description:(0,E.__)("Disable blocks that you don't want to appear in the inserter. They can always be toggled back on later.")},(0,s.createElement)(Vn,null)))},{name:"panels",tabLabel:(0,E.__)("Panels"),content:(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Ce,{title:(0,E.__)("Document settings"),description:(0,E.__)("Choose what displays in the panel.")},(0,s.createElement)(Mn.Slot,null),(0,s.createElement)(S.PostTaxonomies,{taxonomyWrapper:(e,t)=>(0,s.createElement)(Cn,{label:t.labels.menu_name,panelName:`taxonomy-panel-${t.slug}`})}),(0,s.createElement)(S.PostFeaturedImageCheck,null,(0,s.createElement)(Cn,{label:(0,E.__)("Featured image"),panelName:"featured-image"})),(0,s.createElement)(S.PostExcerptCheck,null,(0,s.createElement)(Cn,{label:(0,E.__)("Excerpt"),panelName:"post-excerpt"})),(0,s.createElement)(S.PostTypeSupportCheck,{supportKeys:["comments","trackbacks"]},(0,s.createElement)(Cn,{label:(0,E.__)("Discussion"),panelName:"discussion-panel"})),(0,s.createElement)(S.PageAttributesCheck,null,(0,s.createElement)(Cn,{label:(0,E.__)("Page attributes"),panelName:"page-attributes"}))),(0,s.createElement)(An,{title:(0,E.__)("Additional"),description:(0,E.__)("Add extra areas to the editor.")}))}]),[e,o]);return n?(0,s.createElement)(ve,{closeModal:t},(0,s.createElement)(Pe,{sections:d})):null}class Rn extends s.Component{constructor(){super(...arguments),this.state={historyId:null}}componentDidUpdate(e){const{postId:t,postStatus:n,postType:o,isSavingPost:a}=this.props,{historyId:r}=this.state;"trash"!==n||a?t===e.postId&&t===r||"auto-draft"===n||!t||this.setBrowserURL(t):this.setTrashURL(t,o)}setTrashURL(e,t){window.location.href=function(e,t){return(0,T.addQueryArgs)("edit.php",{trashed:1,post_type:t,ids:e})}(e,t)}setBrowserURL(e){window.history.replaceState({id:e},"Post "+e,function(e){return(0,T.addQueryArgs)("post.php",{post:e,action:"edit"})}(e)),this.setState((()=>({historyId:e})))}render(){return null}}var Hn=(0,u.withSelect)((e=>{const{getCurrentPost:t,isSavingPost:n}=e(S.store),o=t();let{id:a,status:r,type:s}=o;return["wp_template","wp_template_part"].includes(s)&&(a=o.wp_id),{postId:a,postStatus:r,postType:s,isSavingPost:n()}}))(Rn);var Gn=(0,s.createElement)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},(0,s.createElement)(k.Path,{d:"M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z"}));var zn=function({showTooltip:e,icon:t,href:n}){var o;const{isActive:a,isRequestingSiteIcon:r,postType:l,siteIconUrl:i}=(0,u.useSelect)((e=>{const{getCurrentPostType:t}=e(S.store),{isFeatureActive:n}=e(rn),{getEntityRecord:o,getPostType:a,isResolving:r}=e(w.store),s=o("root","__unstableBase",void 0)||{};return{isActive:n("fullscreenMode"),isRequestingSiteIcon:r("getEntityRecord",["root","__unstableBase",void 0]),postType:a(t()),siteIconUrl:s.site_icon_url}}),[]),c=(0,f.useReducedMotion)();if(!a||!l)return null;let d=(0,s.createElement)(_.Icon,{size:"36px",icon:Gn});const m={expand:{scale:1.25,transition:{type:"tween",duration:"0.3"}}};i&&(d=(0,s.createElement)(_.__unstableMotion.img,{variants:!c&&m,alt:(0,E.__)("Site Icon"),className:"edit-post-fullscreen-mode-close_site-icon",src:i})),r&&(d=null),t&&(d=(0,s.createElement)(_.Icon,{size:"36px",icon:t}));const p=N()({"edit-post-fullscreen-mode-close":!0,"has-icon":i});return(0,s.createElement)(_.__unstableMotion.div,{whileHover:"expand"},(0,s.createElement)(_.Button,{className:p,href:null!=n?n:(0,T.addQueryArgs)("edit.php",{post_type:l.slug}),label:null!==(o=l?.labels?.view_items)&&void 0!==o?o:(0,E.__)("Back"),showTooltip:e},d))};var Un=(0,s.createElement)(k.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(k.Path,{d:"M3 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z"}));var $n=(0,s.createElement)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(k.Path,{d:"M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"}));const{useShouldContextualToolbarShow:Wn}=gn(b.privateApis),qn=e=>{e.preventDefault()};var Zn=function({setListViewToggleElement:e}){const t=(0,s.useRef)(),{setIsInserterOpened:n,setIsListViewOpened:o}=(0,u.useDispatch)(rn),{isInserterEnabled:a,isInserterOpened:r,isTextModeEnabled:l,showIconLabels:i,isListViewOpen:c,listViewShortcut:d,hasFixedToolbar:m}=(0,u.useSelect)((e=>{const{hasInserterItems:t,getBlockRootClientId:n,getBlockSelectionEnd:o}=e(b.store),{getEditorSettings:a}=e(S.store),{getEditorMode:r,isFeatureActive:s,isListViewOpened:l}=e(rn),{getShortcutRepresentation:i}=e(xe.store),{get:c}=e(p.store);return{isInserterEnabled:"visual"===r()&&a().richEditingEnabled&&t(n(o())),isInserterOpened:e(rn).isInserterOpened(),isTextModeEnabled:"text"===r(),showIconLabels:s("showIconLabels"),isListViewOpen:l(),listViewShortcut:i("core/edit-post/toggle-list-view"),hasFixedToolbar:c("core/edit-post","fixedToolbar")}}),[]),g=(0,f.useViewportMatch)("medium"),h=(0,f.useViewportMatch)("wide"),{shouldShowContextualToolbar:v,canFocusHiddenToolbar:y,fixedToolbarCanBeFocused:w}=Wn(),k=v||y||w,P=(0,E.__)("Document tools"),C=(0,s.useCallback)((()=>o(!c)),[o,c]),T=(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_.ToolbarItem,{as:_.Button,className:"edit-post-header-toolbar__document-overview-toggle",icon:Un,disabled:l,isPressed:c,label:(0,E.__)("Document Overview"),onClick:C,shortcut:d,showTooltip:!i,variant:i?"tertiary":void 0,"aria-expanded":c,ref:e})),x=(0,s.useCallback)((()=>{r?(t.current.focus(),n(!1)):n(!0)}),[r,n]),B=(0,E._x)("Toggle block inserter","Generic label for block inserter button"),M=r?(0,E.__)("Close"):(0,E.__)("Add");return(0,s.createElement)(b.NavigableToolbar,{className:"edit-post-header-toolbar","aria-label":P,shouldUseKeyboardFocusShortcut:!k},(0,s.createElement)("div",{className:"edit-post-header-toolbar__left"},(0,s.createElement)(_.ToolbarItem,{ref:t,as:_.Button,className:"edit-post-header-toolbar__inserter-toggle",variant:"primary",isPressed:r,onMouseDown:qn,onClick:x,disabled:!a,icon:$n,label:i?M:B,showTooltip:!i,"aria-expanded":r}),(h||!i)&&(0,s.createElement)(s.Fragment,null,g&&!m&&(0,s.createElement)(_.ToolbarItem,{as:b.ToolSelector,showTooltip:!i,variant:i?"tertiary":void 0,disabled:l}),(0,s.createElement)(_.ToolbarItem,{as:S.EditorHistoryUndo,showTooltip:!i,variant:i?"tertiary":void 0}),(0,s.createElement)(_.ToolbarItem,{as:S.EditorHistoryRedo,showTooltip:!i,variant:i?"tertiary":void 0}),T)))};const jn=[{value:"visual",label:(0,E.__)("Visual editor")},{value:"text",label:(0,E.__)("Code editor")}];var Kn=function(){const{shortcut:e,isRichEditingEnabled:t,isCodeEditingEnabled:n,isEditingTemplate:o,mode:a}=(0,u.useSelect)((e=>({shortcut:e(xe.store).getShortcutRepresentation("core/edit-post/toggle-mode"),isRichEditingEnabled:e(S.store).getEditorSettings().richEditingEnabled,isCodeEditingEnabled:e(S.store).getEditorSettings().codeEditingEnabled,isEditingTemplate:e(rn).isEditingTemplate(),mode:e(rn).getEditorMode()})),[]),{switchEditorMode:r}=(0,u.useDispatch)(rn);if(o)return null;let l=a;t||"visual"!==a||(l="text"),n||"text"!==a||(l="visual");const i=jn.map((o=>(n||"text"!==o.value||(o={...o,disabled:!0}),t||"visual"!==o.value||(o={...o,disabled:!0,info:(0,E.__)("You can enable the visual editor in your profile settings.")}),o.value===l||o.disabled?o:{...o,shortcut:e})));return(0,s.createElement)(_.MenuGroup,{label:(0,E.__)("Editor")},(0,s.createElement)(_.MenuItemsChoice,{choices:i,value:l,onSelect:r}))};function Yn(){const{openModal:e}=(0,u.useDispatch)(ee);return(0,s.createElement)(_.MenuItem,{onClick:()=>{e(Fn)}},(0,E.__)("Preferences"))}var Qn=function(){const e=(0,u.useRegistry)(),t=(0,u.useSelect)((e=>e(b.store).getSettings().isDistractionFree),[]),{setIsInserterOpened:n,setIsListViewOpened:o,closeGeneralSidebar:a}=(0,u.useDispatch)(rn),{set:r}=(0,u.useDispatch)(p.store);return(0,f.useViewportMatch)("medium")?(0,s.createElement)(_.MenuGroup,{label:(0,E._x)("View","noun")},(0,s.createElement)(p.PreferenceToggleMenuItem,{scope:"core/edit-post",disabled:t,name:"fixedToolbar",label:(0,E.__)("Top toolbar"),info:(0,E.__)("Access all block and document tools in a single place"),messageActivated:(0,E.__)("Top toolbar activated"),messageDeactivated:(0,E.__)("Top toolbar deactivated")}),(0,s.createElement)(p.PreferenceToggleMenuItem,{scope:"core/edit-post",name:"focusMode",label:(0,E.__)("Spotlight mode"),info:(0,E.__)("Focus on one block at a time"),messageActivated:(0,E.__)("Spotlight mode activated"),messageDeactivated:(0,E.__)("Spotlight mode deactivated")}),(0,s.createElement)(p.PreferenceToggleMenuItem,{scope:"core/edit-post",name:"fullscreenMode",label:(0,E.__)("Fullscreen mode"),info:(0,E.__)("Show and hide admin UI"),messageActivated:(0,E.__)("Fullscreen mode activated"),messageDeactivated:(0,E.__)("Fullscreen mode deactivated"),shortcut:M.displayShortcut.secondary("f")}),(0,s.createElement)(p.PreferenceToggleMenuItem,{scope:"core/edit-post",name:"distractionFree",onToggle:()=>{e.batch((()=>{r("core/edit-post","fixedToolbar",!1),n(!1),o(!1),a()}))},label:(0,E.__)("Distraction free"),info:(0,E.__)("Write with calmness"),messageActivated:(0,E.__)("Distraction free mode activated"),messageDeactivated:(0,E.__)("Distraction free mode deactivated"),shortcut:M.displayShortcut.primaryShift("\\")})):null};var Xn=({showIconLabels:e})=>{const t=(0,f.useViewportMatch)("large");return(0,s.createElement)(fe,{toggleProps:{showTooltip:!e,...e&&{variant:"tertiary"}}},(({onClose:n})=>(0,s.createElement)(s.Fragment,null,e&&!t&&(0,s.createElement)(de.Slot,{className:e&&"show-icon-labels",scope:"core/edit-post"}),(0,s.createElement)(Qn,null),(0,s.createElement)(Kn,null),(0,s.createElement)(se.Slot,{name:"core/edit-post/plugin-more-menu",label:(0,E.__)("Plugins"),as:_.MenuGroup,fillProps:{onClick:n}}),(0,s.createElement)(Ge.Slot,{fillProps:{onClose:n}}),(0,s.createElement)(_.MenuGroup,null,(0,s.createElement)(Yn,null)))))};var Jn=(0,f.compose)((0,u.withSelect)((e=>{var t;return{hasPublishAction:null!==(t=e(S.store).getCurrentPost()?._links?.["wp:action-publish"])&&void 0!==t&&t,isBeingScheduled:e(S.store).isEditedPostBeingScheduled(),isPending:e(S.store).isCurrentPostPending(),isPublished:e(S.store).isCurrentPostPublished(),isPublishSidebarEnabled:e(S.store).isPublishSidebarEnabled(),isPublishSidebarOpened:e(rn).isPublishSidebarOpened(),isScheduled:e(S.store).isCurrentPostScheduled()}})),(0,u.withDispatch)((e=>{const{togglePublishSidebar:t}=e(rn);return{togglePublishSidebar:t}})))((function({forceIsDirty:e,hasPublishAction:t,isBeingScheduled:n,isPending:o,isPublished:a,isPublishSidebarEnabled:r,isPublishSidebarOpened:l,isScheduled:i,togglePublishSidebar:c,setEntitiesSavedStatesCallback:d}){const u="toggle",m="button",p=(0,f.useViewportMatch)("medium","<");let g;return g=a||i&&n||o&&!t&&!p?m:p||r?u:m,(0,s.createElement)(S.PostPublishButton,{forceIsDirty:e,isOpen:l,isToggle:g===u,onToggle:c,setEntitiesSavedStatesCallback:d})}));function eo(){const{hasActiveMetaboxes:e,isPostSaveable:t,isViewable:n,deviceType:o}=(0,u.useSelect)((e=>{var t;const{getEditedPostAttribute:n}=e(S.store),{getPostType:o}=e(w.store),a=o(n("type"));return{hasActiveMetaboxes:e(rn).hasMetaBoxes(),isPostSaveable:e(S.store).isEditedPostSaveable(),isViewable:null!==(t=a?.viewable)&&void 0!==t&&t,deviceType:e(rn).__experimentalGetPreviewDeviceType()}}),[]),{__experimentalSetPreviewDeviceType:a}=(0,u.useDispatch)(rn);return(0,s.createElement)(b.__experimentalPreviewOptions,{isEnabled:t,className:"edit-post-post-preview-dropdown",deviceType:o,setDeviceType:a,label:(0,E.__)("Preview")},(({onClose:t})=>n&&(0,s.createElement)(_.MenuGroup,null,(0,s.createElement)("div",{className:"edit-post-header-preview__grouping-external"},(0,s.createElement)(S.PostPreviewButton,{className:"edit-post-header-preview__button-external",role:"menuitem",forceIsAutosaveable:e,textContent:(0,s.createElement)(s.Fragment,null,(0,E.__)("Preview in new tab"),(0,s.createElement)(_.Icon,{icon:P})),onPreview:t})))))}function to(){const{permalink:e,isPublished:t,label:n}=(0,u.useSelect)((e=>{const t=e(S.store).getCurrentPostType(),n=e(w.store).getPostType(t);return{permalink:e(S.store).getPermalink(),isPublished:e(S.store).isCurrentPostPublished(),label:n?.labels.view_item}}),[]);return t&&e?(0,s.createElement)(_.Button,{icon:P,label:n||(0,E.__)("View post"),href:e,target:"_blank"}):null}const no="__experimentalMainDashboardButton",{Fill:oo,Slot:ao}=(0,_.createSlotFill)(no),ro=oo;ro.Slot=({children:e})=>{const t=(0,_.__experimentalUseSlotFills)(no);return Boolean(t&&t.length)?(0,s.createElement)(ao,{bubblesVirtually:!0}):e};var so=ro;var lo=(0,s.createElement)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(k.Path,{d:"M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z"}));var io=(0,s.createElement)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(k.Path,{d:"m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z"}));var co=(0,s.createElement)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(k.Path,{d:"M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"}));var uo=function(){const{template:e,isEditing:t}=(0,u.useSelect)((e=>{const{isEditingTemplate:t,getEditedPostTemplate:n}=e(rn),o=t();return{template:o?n():null,isEditing:o}}),[]),{clearSelectedBlock:n}=(0,u.useDispatch)(b.store),{setIsEditingTemplate:o}=(0,u.useDispatch)(rn),{open:a}=(0,u.useDispatch)(cn.store);if(!t||!e)return null;let r=(0,E.__)("Default");return e?.title?r=e.title:e&&(r=e.slug),(0,s.createElement)("div",{className:"edit-post-document-actions"},(0,s.createElement)(_.Button,{className:"edit-post-document-actions__back",onClick:()=>{n(),o(!1)},icon:(0,E.isRTL)()?lo:io},(0,E.__)("Back")),(0,s.createElement)(_.Button,{className:"edit-post-document-actions__command",onClick:()=>a()},(0,s.createElement)(_.__experimentalHStack,{className:"edit-post-document-actions__title",spacing:1,justify:"center"},(0,s.createElement)(b.BlockIcon,{icon:co}),(0,s.createElement)(_.__experimentalText,{size:"body",as:"h1"},(0,s.createElement)(_.VisuallyHidden,{as:"span"},(0,E.__)("Editing template: ")),r)),(0,s.createElement)("span",{className:"edit-post-document-actions__shortcut"},M.displayShortcut.primary("k"))))};const mo={hidden:{y:"-50px"},distractionFreeInactive:{y:0},hover:{y:0,transition:{type:"tween",delay:.2}}},po={hidden:{x:"-100%"},distractionFreeInactive:{x:0},hover:{x:0,transition:{type:"tween",delay:.2}}};var go=function({setEntitiesSavedStatesCallback:e,setListViewToggleElement:t}){const n=(0,f.useViewportMatch)("large"),{hasActiveMetaboxes:o,isPublishSidebarOpened:a,showIconLabels:r}=(0,u.useSelect)((e=>({hasActiveMetaboxes:e(rn).hasMetaBoxes(),isPublishSidebarOpened:e(rn).isPublishSidebarOpened(),showIconLabels:e(rn).isFeatureActive("showIconLabels")})),[]);return(0,s.createElement)("div",{className:"edit-post-header"},(0,s.createElement)(so.Slot,null,(0,s.createElement)(_.__unstableMotion.div,{variants:po,transition:{type:"tween",delay:.8}},(0,s.createElement)(zn,{showTooltip:!0}))),(0,s.createElement)(_.__unstableMotion.div,{variants:mo,transition:{type:"tween",delay:.8},className:"edit-post-header__toolbar"},(0,s.createElement)(Zn,{setListViewToggleElement:t}),(0,s.createElement)("div",{className:"edit-post-header__center"},(0,s.createElement)(uo,null))),(0,s.createElement)(_.__unstableMotion.div,{variants:mo,transition:{type:"tween",delay:.8},className:"edit-post-header__settings"},!a&&(0,s.createElement)(S.PostSavedState,{forceIsDirty:o,showIconLabels:r}),(0,s.createElement)(eo,null),(0,s.createElement)(S.PostPreviewButton,{forceIsAutosaveable:o}),(0,s.createElement)(to,null),(0,s.createElement)(Jn,{forceIsDirty:o,setEntitiesSavedStatesCallback:e}),(n||!r)&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(de.Slot,{scope:"core/edit-post"}),(0,s.createElement)(Xn,{showIconLabels:r})),r&&!n&&(0,s.createElement)(Xn,{showIconLabels:r})))};var ho=(0,s.createElement)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(k.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"}));function _o(){const{insertionPoint:e,showMostUsedBlocks:t}=(0,u.useSelect)((e=>{const{isFeatureActive:t,__experimentalGetInsertionPoint:n}=e(rn);return{insertionPoint:n(),showMostUsedBlocks:t("mostUsedBlocks")}}),[]),{setIsInserterOpened:n}=(0,u.useDispatch)(rn),o=(0,f.useViewportMatch)("medium","<"),a=o?"div":_.VisuallyHidden,[r,l]=(0,f.__experimentalUseDialog)({onClose:()=>n(!1),focusOnMount:null}),i=(0,s.useRef)();return(0,s.useEffect)((()=>{i.current.focusSearch()}),[]),(0,s.createElement)("div",{ref:r,...l,className:"edit-post-editor__inserter-panel"},(0,s.createElement)(a,{className:"edit-post-editor__inserter-panel-header"},(0,s.createElement)(_.Button,{icon:ho,label:(0,E.__)("Close block inserter"),onClick:()=>n(!1)})),(0,s.createElement)("div",{className:"edit-post-editor__inserter-panel-content"},(0,s.createElement)(b.__experimentalLibrary,{showMostUsedBlocks:t,showInserterHelpPanel:!0,shouldFocusBlock:o,rootClientId:e.rootClientId,__experimentalInsertionIndex:e.insertionIndex,__experimentalFilterValue:e.filterValue,ref:i})))}var bo=window.wp.dom;function Eo(){return(0,s.createElement)(_.SVG,{width:"138",height:"148",viewBox:"0 0 138 148",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(_.Rect,{width:"138",height:"148",rx:"4",fill:"#F0F6FC"}),(0,s.createElement)(_.Line,{x1:"44",y1:"28",x2:"24",y2:"28",stroke:"#DDDDDD"}),(0,s.createElement)(_.Rect,{x:"48",y:"16",width:"27",height:"23",rx:"4",fill:"#DDDDDD"}),(0,s.createElement)(_.Path,{d:"M54.7585 32V23.2727H56.6037V26.8736H60.3494V23.2727H62.1903V32H60.3494V28.3949H56.6037V32H54.7585ZM67.4574 23.2727V32H65.6122V25.0241H65.5611L63.5625 26.277V24.6406L65.723 23.2727H67.4574Z",fill:"black"}),(0,s.createElement)(_.Line,{x1:"55",y1:"59",x2:"24",y2:"59",stroke:"#DDDDDD"}),(0,s.createElement)(_.Rect,{x:"59",y:"47",width:"29",height:"23",rx:"4",fill:"#DDDDDD"}),(0,s.createElement)(_.Path,{d:"M65.7585 63V54.2727H67.6037V57.8736H71.3494V54.2727H73.1903V63H71.3494V59.3949H67.6037V63H65.7585ZM74.6605 63V61.6705L77.767 58.794C78.0313 58.5384 78.2528 58.3082 78.4318 58.1037C78.6136 57.8991 78.7514 57.6989 78.8452 57.5028C78.9389 57.304 78.9858 57.0895 78.9858 56.8594C78.9858 56.6037 78.9276 56.3835 78.8111 56.1989C78.6946 56.0114 78.5355 55.8679 78.3338 55.7685C78.1321 55.6662 77.9034 55.6151 77.6477 55.6151C77.3807 55.6151 77.1477 55.669 76.9489 55.777C76.75 55.8849 76.5966 56.0398 76.4886 56.2415C76.3807 56.4432 76.3267 56.6832 76.3267 56.9616H74.5753C74.5753 56.3906 74.7045 55.8949 74.9631 55.4744C75.2216 55.054 75.5838 54.7287 76.0497 54.4986C76.5156 54.2685 77.0526 54.1534 77.6605 54.1534C78.2855 54.1534 78.8295 54.2642 79.2926 54.4858C79.7585 54.7045 80.1207 55.0085 80.3793 55.3977C80.6378 55.7869 80.767 56.233 80.767 56.7358C80.767 57.0653 80.7017 57.3906 80.571 57.7116C80.4432 58.0327 80.2145 58.3892 79.8849 58.7812C79.5554 59.1705 79.0909 59.6378 78.4915 60.1832L77.2173 61.4318V61.4915H80.8821V63H74.6605Z",fill:"black"}),(0,s.createElement)(_.Line,{x1:"80",y1:"90",x2:"24",y2:"90",stroke:"#DDDDDD"}),(0,s.createElement)(_.Rect,{x:"84",y:"78",width:"30",height:"23",rx:"4",fill:"#F0B849"}),(0,s.createElement)(_.Path,{d:"M90.7585 94V85.2727H92.6037V88.8736H96.3494V85.2727H98.1903V94H96.3494V90.3949H92.6037V94H90.7585ZM99.5284 92.4659V91.0128L103.172 85.2727H104.425V87.2841H103.683L101.386 90.919V90.9872H106.564V92.4659H99.5284ZM103.717 94V92.0227L103.751 91.3793V85.2727H105.482V94H103.717Z",fill:"black"}),(0,s.createElement)(_.Line,{x1:"66",y1:"121",x2:"24",y2:"121",stroke:"#DDDDDD"}),(0,s.createElement)(_.Rect,{x:"70",y:"109",width:"29",height:"23",rx:"4",fill:"#DDDDDD"}),(0,s.createElement)(_.Path,{d:"M76.7585 125V116.273H78.6037V119.874H82.3494V116.273H84.1903V125H82.3494V121.395H78.6037V125H76.7585ZM88.8864 125.119C88.25 125.119 87.6832 125.01 87.1861 124.791C86.6918 124.57 86.3011 124.266 86.0142 123.879C85.7301 123.49 85.5838 123.041 85.5753 122.533H87.4332C87.4446 122.746 87.5142 122.933 87.642 123.095C87.7727 123.254 87.946 123.378 88.1619 123.466C88.3778 123.554 88.6207 123.598 88.8906 123.598C89.1719 123.598 89.4205 123.548 89.6364 123.449C89.8523 123.349 90.0213 123.212 90.1435 123.036C90.2656 122.859 90.3267 122.656 90.3267 122.426C90.3267 122.193 90.2614 121.987 90.1307 121.808C90.0028 121.626 89.8182 121.484 89.5767 121.382C89.3381 121.28 89.054 121.229 88.7244 121.229H87.9105V119.874H88.7244C89.0028 119.874 89.2486 119.825 89.4616 119.729C89.6776 119.632 89.8452 119.499 89.9645 119.328C90.0838 119.155 90.1435 118.953 90.1435 118.723C90.1435 118.504 90.0909 118.312 89.9858 118.148C89.8835 117.98 89.7386 117.849 89.5511 117.756C89.3665 117.662 89.1506 117.615 88.9034 117.615C88.6534 117.615 88.4247 117.661 88.2173 117.751C88.0099 117.839 87.8438 117.966 87.7188 118.131C87.5938 118.295 87.527 118.489 87.5185 118.71H85.75C85.7585 118.207 85.902 117.764 86.1804 117.381C86.4588 116.997 86.8338 116.697 87.3054 116.482C87.7798 116.263 88.3153 116.153 88.9119 116.153C89.5142 116.153 90.0412 116.263 90.4929 116.482C90.9446 116.7 91.2955 116.996 91.5455 117.368C91.7983 117.737 91.9233 118.152 91.9205 118.612C91.9233 119.101 91.7713 119.509 91.4645 119.835C91.1605 120.162 90.7642 120.369 90.2756 120.457V120.526C90.9176 120.608 91.4063 120.831 91.7415 121.195C92.0795 121.555 92.2472 122.007 92.2443 122.55C92.2472 123.047 92.1037 123.489 91.8139 123.875C91.527 124.261 91.1307 124.565 90.625 124.787C90.1193 125.009 89.5398 125.119 88.8864 125.119Z",fill:"black"}))}function fo(){const{headingCount:e}=(0,u.useSelect)((e=>{const{getGlobalBlockCount:t}=e(b.store);return{headingCount:t("core/heading")}}),[]);return(0,s.createElement)(s.Fragment,null,(0,s.createElement)("div",{className:"edit-post-editor__list-view-overview"},(0,s.createElement)("div",null,(0,s.createElement)(_.__experimentalText,null,(0,E.__)("Characters:")),(0,s.createElement)(_.__experimentalText,null,(0,s.createElement)(S.CharacterCount,null))),(0,s.createElement)("div",null,(0,s.createElement)(_.__experimentalText,null,(0,E.__)("Words:")),(0,s.createElement)(S.WordCount,null)),(0,s.createElement)("div",null,(0,s.createElement)(_.__experimentalText,null,(0,E.__)("Time to read:")),(0,s.createElement)(S.TimeToRead,null))),e>0?(0,s.createElement)(S.DocumentOutline,null):(0,s.createElement)("div",{className:"edit-post-editor__list-view-empty-headings"},(0,s.createElement)(Eo,null),(0,s.createElement)("p",null,(0,E.__)("Navigate the structure of your document and address issues like empty or incorrect heading levels."))))}function vo({listViewToggleElement:e}){const{setIsListViewOpened:t}=(0,u.useDispatch)(rn),n=(0,f.useFocusOnMount)("firstElement"),o=(0,s.useCallback)((()=>{t(!1),e?.focus()}),[e,t]),a=(0,s.useCallback)((e=>{e.keyCode!==M.ESCAPE||e.defaultPrevented||(e.preventDefault(),o())}),[o]),[r,l]=(0,s.useState)(null),[i,c]=(0,s.useState)("list-view"),d=(0,s.useRef)(),m=(0,s.useRef)(),p=(0,s.useRef)(),g=(0,f.useMergeRefs)([n,p,l]);const h=(0,s.useCallback)((()=>{d.current.contains(d.current.ownerDocument.activeElement)?o():function(e){const t=bo.focus.tabbable.find(m.current)[0];if("list-view"===e){const e=bo.focus.tabbable.find(p.current)[0];(d.current.contains(e)?e:t).focus()}else t.focus()}(i)}),[o,i]);return(0,xe.useShortcut)("core/edit-post/toggle-list-view",h),(0,s.createElement)("div",{className:"edit-post-editor__document-overview-panel",onKeyDown:a,ref:d},(0,s.createElement)(_.Button,{className:"edit-post-editor__document-overview-panel__close-button",icon:F,label:(0,E.__)("Close"),onClick:o}),(0,s.createElement)(_.TabPanel,{className:"edit-post-editor__document-overview-panel__tab-panel",ref:m,onSelect:e=>c(e),selectOnMove:!1,tabs:[{name:"list-view",title:(0,E._x)("List View","Post overview"),className:"edit-post-sidebar__panel-tab"},{name:"outline",title:(0,E._x)("Outline","Post overview"),className:"edit-post-sidebar__panel-tab"}]},(e=>(0,s.createElement)("div",{className:"edit-post-editor__list-view-container",ref:g},"list-view"===e.name?(0,s.createElement)("div",{className:"edit-post-editor__list-view-panel-content"},(0,s.createElement)(b.__experimentalListView,{dropZoneElement:r})):(0,s.createElement)(fo,null)))))}var yo=(0,s.createElement)(k.SVG,{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(k.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zM8.5 18.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h2.5v13zm10-.5c0 .3-.2.5-.5.5h-8v-13h8c.3 0 .5.2.5.5v12z"}));var wo=(0,s.createElement)(k.SVG,{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(k.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4 14.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h8v13zm4.5-.5c0 .3-.2.5-.5.5h-2.5v-13H18c.3 0 .5.2.5.5v12z"}));var So=({sidebarName:e})=>{const{openGeneralSidebar:t}=(0,u.useDispatch)(rn),n=()=>t("edit-post/document"),{documentLabel:o,isTemplateMode:a}=(0,u.useSelect)((e=>({documentLabel:e(S.store).getPostTypeLabel()||(0,E._x)("Document","noun"),isTemplateMode:e(rn).isEditingTemplate()})),[]),[r,l]="edit-post/document"===e?[(0,E.sprintf)((0,E.__)("%s (selected)"),o),"is-active"]:[o,""],[i,c]="edit-post/block"===e?[(0,E.__)("Block (selected)"),"is-active"]:[(0,E.__)("Block"),""],[d,m]="edit-post/document"===e?[(0,E.__)("Template (selected)"),"is-active"]:[(0,E.__)("Template"),""];return(0,s.createElement)("ul",null,!a&&(0,s.createElement)("li",null,(0,s.createElement)(_.Button,{onClick:n,className:`edit-post-sidebar__panel-tab ${l}`,"aria-label":r,"data-label":o},o)),a&&(0,s.createElement)("li",null,(0,s.createElement)(_.Button,{onClick:n,className:`edit-post-sidebar__panel-tab ${m}`,"aria-label":d,"data-label":(0,E.__)("Template")},(0,E.__)("Template"))),(0,s.createElement)("li",null,(0,s.createElement)(_.Button,{onClick:()=>t("edit-post/block"),className:`edit-post-sidebar__panel-tab ${c}`,"aria-label":i,"data-label":(0,E.__)("Block")},(0,E.__)("Block"))))};function ko({isOpen:e,onClick:t}){const n=(0,S.usePostVisibilityLabel)();return(0,s.createElement)(_.Button,{className:"edit-post-post-visibility__toggle",variant:"tertiary","aria-expanded":e,"aria-label":(0,E.sprintf)((0,E.__)("Select visibility: %s"),n),onClick:t},n)}var Po=function(){const[e,t]=(0,s.useState)(null),n=(0,s.useMemo)((()=>({anchor:e,placement:"bottom-end"})),[e]);return(0,s.createElement)(S.PostVisibilityCheck,{render:({canEdit:e})=>(0,s.createElement)(_.PanelRow,{ref:t,className:"edit-post-post-visibility"},(0,s.createElement)("span",null,(0,E.__)("Visibility")),!e&&(0,s.createElement)("span",null,(0,s.createElement)(S.PostVisibilityLabel,null)),e&&(0,s.createElement)(_.Dropdown,{contentClassName:"edit-post-post-visibility__dialog",popoverProps:n,focusOnMount:!0,renderToggle:({isOpen:e,onToggle:t})=>(0,s.createElement)(ko,{isOpen:e,onClick:t}),renderContent:({onClose:e})=>(0,s.createElement)(S.PostVisibility,{onClose:e})}))})};function Co(){return(0,s.createElement)(S.PostTrashCheck,null,(0,s.createElement)(S.PostTrash,null))}function To(){const[e,t]=(0,s.useState)(null),n=(0,s.useMemo)((()=>({anchor:e,placement:"bottom-end"})),[e]);return(0,s.createElement)(S.PostScheduleCheck,null,(0,s.createElement)(_.PanelRow,{className:"edit-post-post-schedule",ref:t},(0,s.createElement)("span",null,(0,E.__)("Publish")),(0,s.createElement)(_.Dropdown,{popoverProps:n,contentClassName:"edit-post-post-schedule__dialog",focusOnMount:!0,renderToggle:({isOpen:e,onToggle:t})=>(0,s.createElement)(xo,{isOpen:e,onClick:t}),renderContent:({onClose:e})=>(0,s.createElement)(S.PostSchedule,{onClose:e})})))}function xo({isOpen:e,onClick:t}){const n=(0,S.usePostScheduleLabel)(),o=(0,S.usePostScheduleLabel)({full:!0});return(0,s.createElement)(_.Button,{className:"edit-post-post-schedule__toggle",variant:"tertiary",label:o,showTooltip:!0,"aria-expanded":e,"aria-label":(0,E.sprintf)((0,E.__)("Change date: %s"),n),onClick:t},n)}var Bo=function(){return(0,s.createElement)(S.PostStickyCheck,null,(0,s.createElement)(_.PanelRow,null,(0,s.createElement)(S.PostSticky,null)))};var Mo=function(){return(0,s.createElement)(S.PostAuthorCheck,null,(0,s.createElement)(_.PanelRow,{className:"edit-post-post-author"},(0,s.createElement)(S.PostAuthor,null)))};var Io=function(){return(0,s.createElement)(S.PostSlugCheck,null,(0,s.createElement)(_.PanelRow,{className:"edit-post-post-slug"},(0,s.createElement)(S.PostSlug,null)))};var No=function(){return(0,s.createElement)(S.PostFormatCheck,null,(0,s.createElement)(_.PanelRow,{className:"edit-post-post-format"},(0,s.createElement)(S.PostFormat,null)))};var Ao=function(){return(0,s.createElement)(S.PostPendingStatusCheck,null,(0,s.createElement)(_.PanelRow,null,(0,s.createElement)(S.PostPendingStatus,null)))};const{Fill:Do,Slot:Lo}=(0,_.createSlotFill)("PluginPostStatusInfo"),Vo=({children:e,className:t})=>(0,s.createElement)(Do,null,(0,s.createElement)(_.PanelRow,{className:t},e));Vo.Slot=Lo;var Fo=Vo;var Oo=(0,s.createElement)(k.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(k.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M18.5 5.5V8H20V5.5H22.5V4H20V1.5H18.5V4H16V5.5H18.5ZM13.9624 4H6C4.89543 4 4 4.89543 4 6V18C4 19.1046 4.89543 20 6 20H18C19.1046 20 20 19.1046 20 18V10.0391H18.5V18C18.5 18.2761 18.2761 18.5 18 18.5H10L10 10.4917L16.4589 10.5139L16.4641 9.01389L5.5 8.97618V6C5.5 5.72386 5.72386 5.5 6 5.5H13.9624V4ZM5.5 10.4762V18C5.5 18.2761 5.72386 18.5 6 18.5H8.5L8.5 10.4865L5.5 10.4762Z"}));const Ro=(0,E.__)("Custom Template");function Ho({onClose:e}){const t=(0,u.useSelect)((e=>e(S.store).getEditorSettings().defaultBlockTemplate),[]),{__unstableCreateTemplate:n,__unstableSwitchToTemplateMode:o}=(0,u.useDispatch)(rn),[a,r]=(0,s.useState)(""),[i,c]=(0,s.useState)(!1),d=()=>{r(""),e()};return(0,s.createElement)(_.Modal,{title:(0,E.__)("Create custom template"),onRequestClose:d,className:"edit-post-post-template__create-modal"},(0,s.createElement)("form",{className:"edit-post-post-template__create-form",onSubmit:async e=>{if(e.preventDefault(),i)return;c(!0);const r=null!=t?t:(0,l.serialize)([(0,l.createBlock)("core/group",{tagName:"header",layout:{inherit:!0}},[(0,l.createBlock)("core/site-title"),(0,l.createBlock)("core/site-tagline")]),(0,l.createBlock)("core/separator"),(0,l.createBlock)("core/group",{tagName:"main"},[(0,l.createBlock)("core/group",{layout:{inherit:!0}},[(0,l.createBlock)("core/post-title")]),(0,l.createBlock)("core/post-content",{layout:{inherit:!0}})])]);await n({slug:(0,T.cleanForSlug)(a||Ro),content:r,title:a||Ro}),c(!1),d(),o(!0)}},(0,s.createElement)(_.__experimentalVStack,{spacing:"3"},(0,s.createElement)(_.TextControl,{__nextHasNoMarginBottom:!0,label:(0,E.__)("Name"),value:a,onChange:r,placeholder:Ro,disabled:i,help:(0,E.__)('Describe the template, e.g. "Post with sidebar". A custom template can be manually applied to any post or page.')}),(0,s.createElement)(_.__experimentalHStack,{justify:"right"},(0,s.createElement)(_.Button,{variant:"tertiary",onClick:d},(0,E.__)("Cancel")),(0,s.createElement)(_.Button,{variant:"primary",type:"submit",isBusy:i,"aria-disabled":i},(0,E.__)("Create"))))))}function Go({onClose:e}){var t,n;const{isPostsPage:o,availableTemplates:a,fetchedTemplates:r,selectedTemplateSlug:l,canCreate:i,canEdit:c}=(0,u.useSelect)((e=>{const{canUser:t,getEntityRecord:n,getEntityRecords:o}=e(w.store),a=e(S.store).getEditorSettings(),r=t("read","settings")?n("root","site"):void 0,s=e(S.store).getCurrentPostId()===r?.page_for_posts,l=t("create","templates");return{isPostsPage:s,availableTemplates:a.availableTemplates,fetchedTemplates:l?o("postType","wp_template",{post_type:e(S.store).getCurrentPostType(),per_page:-1}):void 0,selectedTemplateSlug:e(S.store).getEditedPostAttribute("template"),canCreate:l&&!s&&a.supportsTemplateMode,canEdit:l&&a.supportsTemplateMode&&!!e(rn).getEditedPostTemplate()}}),[]),d=(0,s.useMemo)((()=>Object.entries({...a,...Object.fromEntries((null!=r?r:[]).map((({slug:e,title:t})=>[e,t.rendered])))}).map((([e,t])=>({value:e,label:t})))),[a,r]),m=null!==(t=d.find((e=>e.value===l)))&&void 0!==t?t:d.find((e=>!e.value)),{editPost:p}=(0,u.useDispatch)(S.store),{__unstableSwitchToTemplateMode:g}=(0,u.useDispatch)(rn),[h,f]=(0,s.useState)(!1);return(0,s.createElement)("div",{className:"edit-post-post-template__form"},(0,s.createElement)(b.__experimentalInspectorPopoverHeader,{title:(0,E.__)("Template"),help:(0,E.__)("Templates define the way content is displayed when viewing your site."),actions:i?[{icon:Oo,label:(0,E.__)("Add template"),onClick:()=>f(!0)}]:[],onClose:e}),o?(0,s.createElement)(_.Notice,{className:"edit-post-post-template__notice",status:"warning",isDismissible:!1},(0,E.__)("The posts page template cannot be changed.")):(0,s.createElement)(_.SelectControl,{__nextHasNoMarginBottom:!0,hideLabelFromVision:!0,label:(0,E.__)("Template"),value:null!==(n=m?.value)&&void 0!==n?n:"",options:d,onChange:e=>p({template:e||""})}),c&&(0,s.createElement)("p",null,(0,s.createElement)(_.Button,{variant:"link",onClick:()=>g()},(0,E.__)("Edit template"))),h&&(0,s.createElement)(Ho,{onClose:()=>f(!1)}))}function zo(){const[e,t]=(0,s.useState)(null),n=(0,s.useMemo)((()=>({anchor:e,placement:"bottom-end"})),[e]);return(0,u.useSelect)((e=>{var t;const n=e(S.store).getCurrentPostType(),o=e(w.store).getPostType(n);if(!o?.viewable)return!1;const a=e(S.store).getEditorSettings();if(!!a.availableTemplates&&Object.keys(a.availableTemplates).length>0)return!0;if(!a.supportsTemplateMode)return!1;return null!==(t=e(w.store).canUser("create","templates"))&&void 0!==t&&t}),[])?(0,s.createElement)(_.PanelRow,{className:"edit-post-post-template",ref:t},(0,s.createElement)("span",null,(0,E.__)("Template")),(0,s.createElement)(_.Dropdown,{popoverProps:n,className:"edit-post-post-template__dropdown",contentClassName:"edit-post-post-template__dialog",focusOnMount:!0,renderToggle:({isOpen:e,onToggle:t})=>(0,s.createElement)(Uo,{isOpen:e,onClick:t}),renderContent:({onClose:e})=>(0,s.createElement)(Go,{onClose:e})})):null}function Uo({isOpen:e,onClick:t}){const n=(0,u.useSelect)((e=>{const t=e(S.store).getEditedPostAttribute("template"),{supportsTemplateMode:n,availableTemplates:o}=e(S.store).getEditorSettings();if(!n&&o[t])return o[t];const a=e(w.store).canUser("create","templates")&&e(rn).getEditedPostTemplate();return a?.title||a?.slug||o?.[t]}),[]);return(0,s.createElement)(_.Button,{className:"edit-post-post-template__toggle",variant:"tertiary","aria-expanded":e,"aria-label":n?(0,E.sprintf)((0,E.__)("Select template: %s"),n):(0,E.__)("Select template"),onClick:t},null!=n?n:(0,E.__)("Default template"))}function $o(){const[e,t]=(0,s.useState)(null),n=(0,s.useMemo)((()=>({anchor:e,placement:"bottom-end"})),[e]);return(0,s.createElement)(S.PostURLCheck,null,(0,s.createElement)(_.PanelRow,{className:"edit-post-post-url",ref:t},(0,s.createElement)("span",null,(0,E.__)("URL")),(0,s.createElement)(_.Dropdown,{popoverProps:n,className:"edit-post-post-url__dropdown",contentClassName:"edit-post-post-url__dialog",focusOnMount:!0,renderToggle:({isOpen:e,onToggle:t})=>(0,s.createElement)(Wo,{isOpen:e,onClick:t}),renderContent:({onClose:e})=>(0,s.createElement)(S.PostURL,{onClose:e})})))}function Wo({isOpen:e,onClick:t}){const n=(0,S.usePostURLLabel)();return(0,s.createElement)(_.Button,{className:"edit-post-post-url__toggle",variant:"tertiary","aria-expanded":e,"aria-label":(0,E.sprintf)((0,E.__)("Change URL: %s"),n),onClick:t},n)}const qo="post-status";var Zo=(0,f.compose)([(0,u.withSelect)((e=>{const{isEditorPanelRemoved:t,isEditorPanelOpened:n}=e(rn);return{isRemoved:t(qo),isOpened:n(qo)}})),(0,f.ifCondition)((({isRemoved:e})=>!e)),(0,u.withDispatch)((e=>({onTogglePanel(){return e(rn).toggleEditorPanelOpened(qo)}})))])((function({isOpened:e,onTogglePanel:t}){return(0,s.createElement)(_.PanelBody,{className:"edit-post-post-status",title:(0,E.__)("Summary"),opened:e,onToggle:t},(0,s.createElement)(Fo.Slot,null,(e=>(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Po,null),(0,s.createElement)(To,null),(0,s.createElement)(zo,null),(0,s.createElement)($o,null),(0,s.createElement)(Bo,null),(0,s.createElement)(Ao,null),(0,s.createElement)(No,null),(0,s.createElement)(Io,null),(0,s.createElement)(Mo,null),(0,s.createElement)(S.PostSyncStatus,null),e,(0,s.createElement)(_.__experimentalHStack,{style:{marginTop:"16px"},spacing:4,wrap:!0},(0,s.createElement)(S.PostSwitchToDraftButton,null),(0,s.createElement)(Co,null))))))}));var jo=function(){return(0,s.createElement)(S.PostLastRevisionCheck,null,(0,s.createElement)(_.PanelBody,{className:"edit-post-last-revision__panel"},(0,s.createElement)(S.PostLastRevision,null)))};var Ko=function({taxonomy:e,children:t}){const n=e?.slug,o=n?`taxonomy-panel-${n}`:"",{isEnabled:a,isOpened:r}=(0,u.useSelect)((e=>{const{isEditorPanelEnabled:t,isEditorPanelOpened:a}=e(rn);return{isEnabled:!!n&&t(o),isOpened:!!n&&a(o)}}),[o,n]),{toggleEditorPanelOpened:l}=(0,u.useDispatch)(rn);if(!a)return null;const i=e?.labels?.menu_name;return i?(0,s.createElement)(_.PanelBody,{title:i,opened:r,onToggle:()=>l(o)},t):null};var Yo=function(){return(0,s.createElement)(S.PostTaxonomiesCheck,null,(0,s.createElement)(S.PostTaxonomies,{taxonomyWrapper:(e,t)=>(0,s.createElement)(Ko,{taxonomy:t},e)}))};const Qo="featured-image";const Xo=(0,u.withSelect)((e=>{const{getEditedPostAttribute:t}=e(S.store),{getPostType:n}=e(w.store),{isEditorPanelEnabled:o,isEditorPanelOpened:a}=e(rn);return{postType:n(t("type")),isEnabled:o(Qo),isOpened:a(Qo)}})),Jo=(0,u.withDispatch)((e=>{const{toggleEditorPanelOpened:t}=e(rn);return{onTogglePanel:(...e)=>t(Qo,...e)}}));var ea=(0,f.compose)(Xo,Jo)((function({isEnabled:e,isOpened:t,postType:n,onTogglePanel:o}){var a;return e?(0,s.createElement)(S.PostFeaturedImageCheck,null,(0,s.createElement)(_.PanelBody,{title:null!==(a=n?.labels?.featured_image)&&void 0!==a?a:(0,E.__)("Featured image"),opened:t,onToggle:o},(0,s.createElement)(S.PostFeaturedImage,null))):null}));const ta="post-excerpt";var na=(0,f.compose)([(0,u.withSelect)((e=>({isEnabled:e(rn).isEditorPanelEnabled(ta),isOpened:e(rn).isEditorPanelOpened(ta)}))),(0,u.withDispatch)((e=>({onTogglePanel(){return e(rn).toggleEditorPanelOpened(ta)}})))])((function({isEnabled:e,isOpened:t,onTogglePanel:n}){return e?(0,s.createElement)(S.PostExcerptCheck,null,(0,s.createElement)(_.PanelBody,{title:(0,E.__)("Excerpt"),opened:t,onToggle:n},(0,s.createElement)(S.PostExcerpt,null))):null}));const oa="discussion-panel";var aa=function(){const{isEnabled:e,isOpened:t}=(0,u.useSelect)((e=>{const{isEditorPanelEnabled:t,isEditorPanelOpened:n}=e(rn);return{isEnabled:t(oa),isOpened:n(oa)}}),[]),{toggleEditorPanelOpened:n}=(0,u.useDispatch)(rn);return e?(0,s.createElement)(S.PostTypeSupportCheck,{supportKeys:["comments","trackbacks"]},(0,s.createElement)(_.PanelBody,{title:(0,E.__)("Discussion"),opened:t,onToggle:()=>n(oa)},(0,s.createElement)(S.PostTypeSupportCheck,{supportKeys:"comments"},(0,s.createElement)(_.PanelRow,null,(0,s.createElement)(S.PostComments,null))),(0,s.createElement)(S.PostTypeSupportCheck,{supportKeys:"trackbacks"},(0,s.createElement)(_.PanelRow,null,(0,s.createElement)(S.PostPingbacks,null))))):null};const ra="page-attributes";var sa=function(){var e;const{isEnabled:t,isOpened:n,postType:o}=(0,u.useSelect)((e=>{const{getEditedPostAttribute:t}=e(S.store),{isEditorPanelEnabled:n,isEditorPanelOpened:o}=e(rn),{getPostType:a}=e(w.store);return{isEnabled:n(ra),isOpened:o(ra),postType:a(t("type"))}}),[]),{toggleEditorPanelOpened:a}=(0,u.useDispatch)(rn);return t&&o?(0,s.createElement)(S.PageAttributesCheck,null,(0,s.createElement)(_.PanelBody,{title:null!==(e=o?.labels?.attributes)&&void 0!==e?e:(0,E.__)("Page attributes"),opened:n,onToggle:(...e)=>a(ra,...e)},(0,s.createElement)(S.PageAttributesParent,null),(0,s.createElement)(_.PanelRow,null,(0,s.createElement)(S.PageAttributesOrder,null)))):null};var la=function({location:e}){const t=(0,s.useRef)(null),n=(0,s.useRef)(null);(0,s.useEffect)((()=>(n.current=document.querySelector(".metabox-location-"+e),n.current&&t.current.appendChild(n.current),()=>{n.current&&document.querySelector("#metaboxes").appendChild(n.current)})),[e]);const o=(0,u.useSelect)((e=>e(rn).isSavingMetaBoxes()),[]),a=N()("edit-post-meta-boxes-area",`is-${e}`,{"is-loading":o});return(0,s.createElement)("div",{className:a},o&&(0,s.createElement)(_.Spinner,null),(0,s.createElement)("div",{className:"edit-post-meta-boxes-area__container",ref:t}),(0,s.createElement)("div",{className:"edit-post-meta-boxes-area__clear"}))};class ia extends s.Component{componentDidMount(){this.updateDOM()}componentDidUpdate(e){this.props.isVisible!==e.isVisible&&this.updateDOM()}updateDOM(){const{id:e,isVisible:t}=this.props,n=document.getElementById(e);n&&(t?n.classList.remove("is-hidden"):n.classList.add("is-hidden"))}render(){return null}}var ca=(0,u.withSelect)(((e,{id:t})=>({isVisible:e(rn).isEditorPanelEnabled(`meta-box-${t}`)})))(ia);function da({location:e}){const t=(0,u.useRegistry)(),{metaBoxes:n,areMetaBoxesInitialized:o,isEditorReady:a}=(0,u.useSelect)((t=>{const{__unstableIsEditorReady:n}=t(S.store),{getMetaBoxesPerLocation:o,areMetaBoxesInitialized:a}=t(rn);return{metaBoxes:o(e),areMetaBoxesInitialized:a(),isEditorReady:n()}}),[e]);return(0,s.useEffect)((()=>{a&&!o&&t.dispatch(rn).initializeMetaBoxes()}),[a,o]),o?(0,s.createElement)(s.Fragment,null,(null!=n?n:[]).map((({id:e})=>(0,s.createElement)(ca,{key:e,id:e}))),(0,s.createElement)(la,{location:e})):null}window.wp.warning;const{Fill:ua,Slot:ma}=(0,_.createSlotFill)("PluginDocumentSettingPanel"),pa=({name:e,className:t,title:n,icon:o,children:a})=>{const{name:r}=(0,C.usePluginContext)(),l=`${r}/${e}`,{opened:i,isEnabled:c}=(0,u.useSelect)((e=>{const{isEditorPanelOpened:t,isEditorPanelEnabled:n}=e(rn);return{opened:t(l),isEnabled:n(l)}}),[l]),{toggleEditorPanelOpened:d}=(0,u.useDispatch)(rn);return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Mn,{label:n,panelName:l}),(0,s.createElement)(ua,null,c&&(0,s.createElement)(_.PanelBody,{className:t,title:n,icon:o,opened:i,onToggle:()=>d(l)},a)))};pa.Slot=ma;var ga=pa;function ha({className:e,...t}){const{postTitle:n,shortcut:o,showIconLabels:a}=(0,u.useSelect)((e=>({postTitle:e(S.store).getEditedPostAttribute("title"),shortcut:e(xe.store).getShortcutRepresentation("core/edit-post/toggle-sidebar"),showIconLabels:e(rn).isFeatureActive("showIconLabels")})),[]);return(0,s.createElement)(pe,{panelClassName:e,className:"edit-post-sidebar",smallScreenTitle:n||(0,E.__)("(no title)"),scope:"core/edit-post",toggleShortcut:o,showIconLabels:a,...t})}var _a=function(){const e=(0,u.useSelect)((e=>{const{getEditedPostTemplate:t}=e(rn);return t()}),[]);return e?(0,s.createElement)(_.PanelBody,null,(0,s.createElement)(_.Flex,{align:"flex-start",gap:"3"},(0,s.createElement)(_.FlexItem,null,(0,s.createElement)(ye,{icon:co})),(0,s.createElement)(_.FlexBlock,null,(0,s.createElement)("h2",{className:"edit-post-template-summary__title"},e?.title||e?.slug),(0,s.createElement)("p",null,e?.description)))):null};const ba=s.Platform.select({web:!0,native:!1});var Ea=()=>{const{sidebarName:e,keyboardShortcut:t,isTemplateMode:n}=(0,u.useSelect)((e=>{let t=e(ee).getActiveComplementaryArea(rn.name);["edit-post/document","edit-post/block"].includes(t)||(e(b.store).getBlockSelectionStart()&&(t="edit-post/block"),t="edit-post/document");return{sidebarName:t,keyboardShortcut:e(xe.store).getShortcutRepresentation("core/edit-post/toggle-sidebar"),isTemplateMode:e(rn).isEditingTemplate()}}),[]);return(0,s.createElement)(ha,{identifier:e,header:(0,s.createElement)(So,{sidebarName:e}),closeLabel:(0,E.__)("Close Settings"),headerClassName:"edit-post-sidebar__panel-tabs",title:(0,E.__)("Settings"),toggleShortcut:t,icon:(0,E.isRTL)()?yo:wo,isActiveByDefault:ba},!n&&"edit-post/document"===e&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Zo,null),(0,s.createElement)(ga.Slot,null),(0,s.createElement)(jo,null),(0,s.createElement)(Yo,null),(0,s.createElement)(ea,null),(0,s.createElement)(na,null),(0,s.createElement)(aa,null),(0,s.createElement)(sa,null),(0,s.createElement)(da,{location:"side"})),n&&"edit-post/document"===e&&(0,s.createElement)(_a,null),"edit-post/block"===e&&(0,s.createElement)(b.BlockInspector,null))};function fa({nonAnimatedSrc:e,animatedSrc:t}){return(0,s.createElement)("picture",{className:"edit-post-welcome-guide__image"},(0,s.createElement)("source",{srcSet:e,media:"(prefers-reduced-motion: reduce)"}),(0,s.createElement)("img",{src:t,width:"312",height:"240",alt:""}))}function va(){const{toggleFeature:e}=(0,u.useDispatch)(rn);return(0,s.createElement)(_.Guide,{className:"edit-post-welcome-guide",contentLabel:(0,E.__)("Welcome to the block editor"),finishButtonText:(0,E.__)("Get started"),onFinish:()=>e("welcomeGuide"),pages:[{image:(0,s.createElement)(fa,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-canvas.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-canvas.gif"}),content:(0,s.createElement)(s.Fragment,null,(0,s.createElement)("h1",{className:"edit-post-welcome-guide__heading"},(0,E.__)("Welcome to the block editor")),(0,s.createElement)("p",{className:"edit-post-welcome-guide__text"},(0,E.__)("In the WordPress editor, each paragraph, image, or video is presented as a distinct “block” of content.")))},{image:(0,s.createElement)(fa,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-editor.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-editor.gif"}),content:(0,s.createElement)(s.Fragment,null,(0,s.createElement)("h1",{className:"edit-post-welcome-guide__heading"},(0,E.__)("Make each block your own")),(0,s.createElement)("p",{className:"edit-post-welcome-guide__text"},(0,E.__)("Each block comes with its own set of controls for changing things like color, width, and alignment. These will show and hide automatically when you have a block selected.")))},{image:(0,s.createElement)(fa,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-library.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-library.gif"}),content:(0,s.createElement)(s.Fragment,null,(0,s.createElement)("h1",{className:"edit-post-welcome-guide__heading"},(0,E.__)("Get to know the block library")),(0,s.createElement)("p",{className:"edit-post-welcome-guide__text"},(0,s.createInterpolateElement)((0,E.__)("All of the blocks available to you live in the block library. Youll find it wherever you see the <InserterIconImage /> icon."),{InserterIconImage:(0,s.createElement)("img",{alt:(0,E.__)("inserter"),src:"data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='18' height='18' rx='2' fill='%231E1E1E'/%3E%3Cpath d='M9.22727 4V14M4 8.77273H14' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E%0A"})})))},{image:(0,s.createElement)(fa,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.gif"}),content:(0,s.createElement)(s.Fragment,null,(0,s.createElement)("h1",{className:"edit-post-welcome-guide__heading"},(0,E.__)("Learn how to use the block editor")),(0,s.createElement)("p",{className:"edit-post-welcome-guide__text"},(0,E.__)("New to the block editor? Want to learn more about using it? "),(0,s.createElement)(_.ExternalLink,{href:(0,E.__)("https://wordpress.org/documentation/article/wordpress-block-editor/")},(0,E.__)("Here's a detailed guide."))))}]})}function ya(){const{toggleFeature:e}=(0,u.useDispatch)(rn);return(0,s.createElement)(_.Guide,{className:"edit-template-welcome-guide",contentLabel:(0,E.__)("Welcome to the template editor"),finishButtonText:(0,E.__)("Get started"),onFinish:()=>e("welcomeGuideTemplate"),pages:[{image:(0,s.createElement)(fa,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-template-editor.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-template-editor.gif"}),content:(0,s.createElement)(s.Fragment,null,(0,s.createElement)("h1",{className:"edit-post-welcome-guide__heading"},(0,E.__)("Welcome to the template editor")),(0,s.createElement)("p",{className:"edit-post-welcome-guide__text"},(0,E.__)("Templates help define the layout of the site. You can customize all aspects of your posts and pages using blocks and patterns in this editor.")))}]})}function wa(){const{isActive:e,isTemplateMode:t}=(0,u.useSelect)((e=>{const{isFeatureActive:t,isEditingTemplate:n}=e(rn),o=n();return{isActive:t(o?"welcomeGuideTemplate":"welcomeGuide"),isTemplateMode:o}}),[]);return e?t?(0,s.createElement)(ya,null):(0,s.createElement)(va,null):null}const{Fill:Sa,Slot:ka}=(0,_.createSlotFill)("PluginPostPublishPanel"),Pa=({children:e,className:t,title:n,initialOpen:o=!1,icon:a})=>{const{icon:r}=(0,C.usePluginContext)();return(0,s.createElement)(Sa,null,(0,s.createElement)(_.PanelBody,{className:t,initialOpen:o||!n,title:n,icon:null!=a?a:r},e))};Pa.Slot=ka;var Ca=Pa;const{Fill:Ta,Slot:xa}=(0,_.createSlotFill)("PluginPrePublishPanel"),Ba=({children:e,className:t,title:n,initialOpen:o=!1,icon:a})=>{const{icon:r}=(0,C.usePluginContext)();return(0,s.createElement)(Ta,null,(0,s.createElement)(_.PanelBody,{className:t,initialOpen:o||!n,title:n,icon:null!=a?a:r},e))};Ba.Slot=xa;var Ma=Ba;const{Fill:Ia,Slot:Na}=(0,_.createSlotFill)("ActionsPanel");function Aa({setEntitiesSavedStatesCallback:e,closeEntitiesSavedStates:t,isEntitiesSavedStatesOpen:n}){const{closePublishSidebar:o,togglePublishSidebar:a}=(0,u.useDispatch)(rn),{publishSidebarOpened:r,hasActiveMetaboxes:l,hasNonPostEntityChanges:i}=(0,u.useSelect)((e=>({publishSidebarOpened:e(rn).isPublishSidebarOpened(),hasActiveMetaboxes:e(rn).hasMetaBoxes(),hasNonPostEntityChanges:e(S.store).hasNonPostEntityChanges()})),[]),c=(0,s.useCallback)((()=>e(!0)),[]);let d;return d=r?(0,s.createElement)(S.PostPublishPanel,{onClose:o,forceIsDirty:l,PrePublishExtension:Ma.Slot,PostPublishExtension:Ca.Slot}):i?(0,s.createElement)("div",{className:"edit-post-layout__toggle-entities-saved-states-panel"},(0,s.createElement)(_.Button,{variant:"secondary",className:"edit-post-layout__toggle-entities-saved-states-panel-button",onClick:c,"aria-expanded":!1},(0,E.__)("Open save panel"))):(0,s.createElement)("div",{className:"edit-post-layout__toggle-publish-panel"},(0,s.createElement)(_.Button,{variant:"secondary",className:"edit-post-layout__toggle-publish-panel-button",onClick:a,"aria-expanded":!1},(0,E.__)("Open publish panel"))),(0,s.createElement)(s.Fragment,null,n&&(0,s.createElement)(S.EntitiesSavedStates,{close:t}),(0,s.createElement)(Na,{bubblesVirtually:!0}),!n&&d)}function Da({blockPatterns:e,onChoosePattern:t}){const n=(0,f.useAsyncList)(e),{resetEditorBlocks:o}=(0,u.useDispatch)(S.store);return(0,s.createElement)(b.__experimentalBlockPatternsList,{blockPatterns:e,shownPatterns:n,onClickPattern:(e,n)=>{o(n),t()}})}function La(){const[e,t]=(0,s.useState)("initial"),n=function(){const{blockPatternsWithPostContentBlockType:e,postType:t}=(0,u.useSelect)((e=>{const{getPatternsByBlockTypes:t}=e(b.store),{getCurrentPostType:n}=e(S.store);return{blockPatternsWithPostContentBlockType:t("core/post-content"),postType:n()}}),[]);return(0,s.useMemo)((()=>e.filter((e=>"page"===t&&!e.postTypes||Array.isArray(e.postTypes)&&e.postTypes.includes(t)))),[t,e])}(),o=n.length>0&&"initial"===e;return(0,s.useEffect)((()=>{o&&t("open")}),[o]),"open"!==e?null:(0,s.createElement)(_.Modal,{className:"edit-post-start-page-options__modal",title:(0,E.__)("Choose a pattern"),isFullScreen:!0,onRequestClose:()=>t("closed")},(0,s.createElement)("div",{className:"edit-post-start-page-options__modal-content"},(0,s.createElement)(Da,{blockPatterns:n,onChoosePattern:()=>t("closed")})))}function Va(){const e=(0,u.useSelect)((e=>{const{isCleanNewPost:t}=e(S.store),{isEditingTemplate:n,isFeatureActive:o}=e(rn);return!n()&&!o("welcomeGuide")&&t()}),[]);return e?(0,s.createElement)(La,null):null}const{getLayoutStyles:Fa}=gn(b.privateApis),Oa={header:(0,E.__)("Editor top bar"),body:(0,E.__)("Editor content"),sidebar:(0,E.__)("Editor settings"),actions:(0,E.__)("Editor publish"),footer:(0,E.__)("Editor footer")};var Ra=function(){(0,b.useBlockCommands)();const e=(0,f.useViewportMatch)("medium","<"),t=(0,f.useViewportMatch)("huge",">="),n=(0,f.useViewportMatch)("large"),{openGeneralSidebar:o,closeGeneralSidebar:a,setIsInserterOpened:r}=(0,u.useDispatch)(rn),{createErrorNotice:l}=(0,u.useDispatch)(x.store),{mode:i,isFullscreenActive:c,isRichEditingEnabled:d,sidebarIsOpened:m,hasActiveMetaboxes:p,hasFixedToolbar:g,previousShortcut:h,nextShortcut:v,hasBlockSelected:y,isInserterOpened:w,isListViewOpened:k,showIconLabels:P,isDistractionFree:T,showBlockBreadcrumbs:B,isTemplateMode:M,documentLabel:I}=(0,u.useSelect)((e=>{const{getEditorSettings:t,getPostTypeLabel:n}=e(S.store),o=t(),a=n();return{isTemplateMode:e(rn).isEditingTemplate(),hasFixedToolbar:e(rn).isFeatureActive("fixedToolbar"),sidebarIsOpened:!(!e(ee).getActiveComplementaryArea(rn.name)&&!e(rn).isPublishSidebarOpened()),isFullscreenActive:e(rn).isFeatureActive("fullscreenMode"),isInserterOpened:e(rn).isInserterOpened(),isListViewOpened:e(rn).isListViewOpened(),mode:e(rn).getEditorMode(),isRichEditingEnabled:o.richEditingEnabled,hasActiveMetaboxes:e(rn).hasMetaBoxes(),previousShortcut:e(xe.store).getAllShortcutKeyCombinations("core/edit-post/previous-region"),nextShortcut:e(xe.store).getAllShortcutKeyCombinations("core/edit-post/next-region"),showIconLabels:e(rn).isFeatureActive("showIconLabels"),isDistractionFree:e(rn).isFeatureActive("distractionFree"),showBlockBreadcrumbs:e(rn).isFeatureActive("showBlockBreadcrumbs"),documentLabel:a||(0,E._x)("Document","noun")}}),[]),A=function(){const{hasThemeStyleSupport:e,editorSettings:t}=(0,u.useSelect)((e=>({hasThemeStyleSupport:e(rn).isFeatureActive("themeStyles"),editorSettings:e(S.store).getEditorSettings()})),[]);return(0,s.useMemo)((()=>{var n,o;const a=null!==(n=t.styles?.filter((e=>e.__unstableType&&"theme"!==e.__unstableType)))&&void 0!==n?n:[],r=[...t.defaultEditorStyles,...a],s=e&&a.length!==(null!==(o=t.styles?.length)&&void 0!==o?o:0);return t.disableLayoutStyles||s||r.push({css:Fa({style:{},selector:"body",hasBlockGapSupport:!1,hasFallbackGapSupport:!0,fallbackGapValue:"0.5em"})}),s?t.styles:r}),[t.defaultEditorStyles,t.disableLayoutStyles,t.styles,e])}();(0,s.useEffect)((()=>{m&&!t&&r(!1)}),[m,t]),(0,s.useEffect)((()=>{w&&!t&&a()}),[w,t]);const[D,L]=(0,s.useState)(!1),[V,F]=(0,s.useState)(null),O=(0,s.useCallback)((e=>{"function"==typeof D&&D(e),L(!1)}),[D]);P?document.body.classList.add("show-icon-labels"):document.body.classList.remove("show-icon-labels");const R=N()("edit-post-layout","is-mode-"+i,{"is-sidebar-opened":m,"has-fixed-toolbar":g,"has-metaboxes":p,"is-distraction-free":T&&n,"is-entity-save-view-open":!!D}),H=k?(0,E.__)("Document Overview"):(0,E.__)("Block Library");return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(ge,{isActive:c}),(0,s.createElement)(Hn,null),(0,s.createElement)(S.UnsavedChangesWarning,null),(0,s.createElement)(S.AutosaveMonitor,null),(0,s.createElement)(S.LocalAutosaveMonitor,null),(0,s.createElement)(Sn,null),(0,s.createElement)(S.EditorKeyboardShortcutsRegister,null),(0,s.createElement)(S.EditorKeyboardShortcuts,null),(0,s.createElement)(be,{isDistractionFree:T&&n,className:R,labels:{...Oa,secondarySidebar:H},header:(0,s.createElement)(go,{setEntitiesSavedStatesCallback:L,setListViewToggleElement:F}),editorNotices:(0,s.createElement)(S.EditorNotices,null),secondarySidebar:"visual"===i&&w?(0,s.createElement)(_o,null):"visual"===i&&k?(0,s.createElement)(vo,{listViewToggleElement:V}):null,sidebar:(!e||m)&&(0,s.createElement)(s.Fragment,null,!e&&!m&&(0,s.createElement)("div",{className:"edit-post-layout__toggle-sidebar-panel"},(0,s.createElement)(_.Button,{variant:"secondary",className:"edit-post-layout__toggle-sidebar-panel-button",onClick:()=>o(y?"edit-post/block":"edit-post/document"),"aria-expanded":!1},y?(0,E.__)("Open block settings"):(0,E.__)("Open document settings"))),(0,s.createElement)(pe.Slot,{scope:"core/edit-post"})),notices:(0,s.createElement)(S.EditorSnackbars,null),content:(0,s.createElement)(s.Fragment,null,!T&&(0,s.createElement)(S.EditorNotices,null),("text"===i||!d)&&(0,s.createElement)(un,null),d&&"visual"===i&&(0,s.createElement)(wn,{styles:A}),!T&&!M&&(0,s.createElement)("div",{className:"edit-post-layout__metaboxes"},(0,s.createElement)(da,{location:"normal"}),(0,s.createElement)(da,{location:"advanced"})),e&&m&&(0,s.createElement)(_.ScrollLock,null)),footer:!T&&!e&&B&&d&&"visual"===i&&(0,s.createElement)("div",{className:"edit-post-layout__footer"},(0,s.createElement)(b.BlockBreadcrumb,{rootLabelText:I})),actions:(0,s.createElement)(Aa,{closeEntitiesSavedStates:O,isEntitiesSavedStatesOpen:D,setEntitiesSavedStatesCallback:L}),shortcuts:{previous:h,next:v}}),(0,s.createElement)(On,null),(0,s.createElement)(Fe,null),(0,s.createElement)(wa,null),(0,s.createElement)(S.PostSyncStatusModal,null),(0,s.createElement)(Va,null),(0,s.createElement)(C.PluginArea,{onError:function(e){l((0,E.sprintf)((0,E.__)('The "%s" plugin has encountered an error and cannot be rendered.'),e))}}),(0,s.createElement)(Ea,null))};const Ha=e=>{const{hasBlockSelection:t,isEditorSidebarOpened:n}=(0,u.useSelect)((e=>({hasBlockSelection:!!e(b.store).getBlockSelectionStart(),isEditorSidebarOpened:e(an).isEditorSidebarOpened()})),[e]),{openGeneralSidebar:o}=(0,u.useDispatch)(an);(0,s.useEffect)((()=>{n&&o(t?"edit-post/block":"edit-post/document")}),[t,n])},Ga=e=>{const{newPermalink:t}=(0,u.useSelect)((e=>({newPermalink:e(S.store).getCurrentPost().link})),[e]),n=(0,s.useRef)();(0,s.useEffect)((()=>{n.current=document.querySelector("#wp-admin-bar-preview a")||document.querySelector("#wp-admin-bar-view a")}),[e]),(0,s.useEffect)((()=>{t&&n.current&&n.current.setAttribute("href",t)}),[t])};function za({postId:e}){return Ha(e),Ga(e),null}var Ua=(0,s.createElement)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(k.Path,{d:"M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z"}));var $a=(0,s.createElement)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(k.Path,{d:"M20.5 16h-.7V8c0-1.1-.9-2-2-2H6.2c-1.1 0-2 .9-2 2v8h-.7c-.8 0-1.5.7-1.5 1.5h20c0-.8-.7-1.5-1.5-1.5zM5.7 8c0-.3.2-.5.5-.5h11.6c.3 0 .5.2.5.5v7.6H5.7V8z"}));var Wa=(0,s.createElement)(k.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(k.Path,{d:"M20.8 10.7l-4.3-4.3-1.1 1.1 4.3 4.3c.1.1.1.3 0 .4l-4.3 4.3 1.1 1.1 4.3-4.3c.7-.8.7-1.9 0-2.6zM4.2 11.8l4.3-4.3-1-1-4.3 4.3c-.7.7-.7 1.8 0 2.5l4.3 4.3 1.1-1.1-4.3-4.3c-.2-.1-.2-.3-.1-.4z"}));var qa=(0,s.createElement)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(k.Path,{d:"m16 15.5h-8v-1.5h8zm-7.5-2.5h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm-9-3h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2z"}),(0,s.createElement)(k.Path,{d:"m18.5 6.5h-13a.5.5 0 0 0 -.5.5v9.5a.5.5 0 0 0 .5.5h13a.5.5 0 0 0 .5-.5v-9.5a.5.5 0 0 0 -.5-.5zm-13-1.5h13a2 2 0 0 1 2 2v9.5a2 2 0 0 1 -2 2h-13a2 2 0 0 1 -2-2v-9.5a2 2 0 0 1 2-2z"}));var Za=(0,s.createElement)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(k.Path,{d:"M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}));const{ExperimentalEditorProvider:ja}=gn(S.privateApis),{useCommands:Ka}=gn(dn.privateApis);var Ya=function({postId:e,postType:t,settings:n,initialEdits:o,...a}){Ka(),function(){const{openGeneralSidebar:e,closeGeneralSidebar:t,switchEditorMode:n,setIsListViewOpened:o,toggleDistractionFree:a}=(0,u.useDispatch)(rn),{openModal:r}=(0,u.useDispatch)(ee),{editorMode:s,activeSidebar:l,isListViewOpen:i,isPublishSidebarEnabled:c,showBlockBreadcrumbs:d,isDistractionFree:m}=(0,u.useSelect)((e=>{const{getEditorMode:t,isListViewOpened:n,isFeatureActive:o}=e(rn);return{activeSidebar:e(ee).getActiveComplementaryArea(rn.name),editorMode:t(),isListViewOpen:n(),isPublishSidebarEnabled:e(S.store).isPublishSidebarEnabled(),showBlockBreadcrumbs:o("showBlockBreadcrumbs"),isDistractionFree:e(p.store).get(rn.name,"distractionFree")}}),[]),{toggle:g}=(0,u.useDispatch)(p.store),{createInfoNotice:h}=(0,u.useDispatch)(x.store),{__unstableSaveForPreview:_}=(0,u.useDispatch)(S.store),{getCurrentPostId:b}=(0,u.useSelect)(S.store);(0,cn.useCommand)({name:"core/open-settings-sidebar",label:(0,E.__)("Toggle settings sidebar"),icon:(0,E.isRTL)()?yo:wo,callback:({close:n})=>{n(),"edit-post/document"===l?t():e("edit-post/document")}}),(0,cn.useCommand)({name:"core/open-block-inspector",label:(0,E.__)("Toggle block inspector"),icon:Ua,callback:({close:n})=>{n(),"edit-post/block"===l?t():e("edit-post/block")}}),(0,cn.useCommand)({name:"core/toggle-distraction-free",label:(0,E.__)("Toggle distraction free"),callback:({close:e})=>{a(),e()}}),(0,cn.useCommand)({name:"core/toggle-spotlight-mode",label:(0,E.__)("Toggle spotlight mode"),callback:({close:e})=>{g("core/edit-post","focusMode"),e()}}),(0,cn.useCommand)({name:"core/toggle-fullscreen-mode",label:(0,E.__)("Toggle fullscreen mode"),icon:$a,callback:({close:e})=>{g("core/edit-post","fullscreenMode"),e()}}),(0,cn.useCommand)({name:"core/toggle-list-view",label:(0,E.__)("Toggle list view"),icon:Un,callback:({close:e})=>{o(!i),e()}}),(0,cn.useCommand)({name:"core/toggle-top-toolbar",label:(0,E.__)("Toggle top toolbar"),callback:({close:e})=>{g("core/edit-post","fixedToolbar"),m&&a(),e()}}),(0,cn.useCommand)({name:"core/toggle-code-editor",label:(0,E.__)("Toggle code editor"),icon:Wa,callback:({close:e})=>{n("visual"===s?"text":"visual"),e()}}),(0,cn.useCommand)({name:"core/open-preferences",label:(0,E.__)("Editor preferences"),callback:()=>{r(Fn)}}),(0,cn.useCommand)({name:"core/open-shortcut-help",label:(0,E.__)("Keyboard shortcuts"),icon:qa,callback:()=>{r(Ae)}}),(0,cn.useCommand)({name:"core/toggle-breadcrumbs",label:d?(0,E.__)("Hide block breadcrumbs"):(0,E.__)("Show block breadcrumbs"),callback:({close:e})=>{g("core/edit-post","showBlockBreadcrumbs"),e(),h(d?(0,E.__)("Breadcrumbs hidden."):(0,E.__)("Breadcrumbs visible."),{id:"core/edit-post/toggle-breadcrumbs/notice",type:"snackbar"})}}),(0,cn.useCommand)({name:"core/toggle-publish-sidebar",label:c?(0,E.__)("Disable pre-publish checklist"):(0,E.__)("Enable pre-publish checklist"),icon:Za,callback:({close:e})=>{e(),g("core/edit-post","isPublishSidebarEnabled"),h(c?(0,E.__)("Pre-publish checklist off."):(0,E.__)("Pre-publish checklist on."),{id:"core/edit-post/publish-sidebar/notice",type:"snackbar"})}}),(0,cn.useCommand)({name:"core/preview-link",label:(0,E.__)("Preview in a new tab"),icon:P,callback:async({close:e})=>{e();const t=b(),n=await _();window.open(n,`wp-preview-${t}`)}})}();const{hasFixedToolbar:r,focusMode:i,isDistractionFree:c,hasInlineToolbar:d,post:m,preferredStyleVariations:g,hiddenBlockTypes:h,blockTypes:b,keepCaretInsideBlock:f,isTemplateMode:v,template:y}=(0,u.useSelect)((n=>{var o;const{isFeatureActive:a,isEditingTemplate:r,getEditedPostTemplate:s,getHiddenBlockTypes:i}=n(rn),{getEntityRecord:c,getPostType:d,getEntityRecords:u,canUser:m}=n(w.store),{getEditorSettings:g}=n(S.store),{getBlockTypes:h}=n(l.store);let _;if(["wp_template","wp_template_part"].includes(t)){const n=u("postType",t,{wp_id:e});_=n?.[0]}else _=c("postType",t,e);const b=g().supportsTemplateMode,E=null!==(o=d(t)?.viewable)&&void 0!==o&&o,f=m("create","templates");return{hasFixedToolbar:a("fixedToolbar"),focusMode:a("focusMode"),isDistractionFree:a("distractionFree"),hasInlineToolbar:a("inlineToolbar"),preferredStyleVariations:n(p.store).get("core/edit-post","preferredStyleVariations"),hiddenBlockTypes:i(),blockTypes:h(),keepCaretInsideBlock:a("keepCaretInsideBlock"),isTemplateMode:r(),template:b&&E&&f?s():null,post:_}}),[t,e]),{updatePreferredStyleVariations:k,setIsInserterOpened:C}=(0,u.useDispatch)(rn),T=(0,s.useMemo)((()=>{const e={...n,__experimentalPreferredStyleVariations:{value:g,onChange:k},hasFixedToolbar:r,focusMode:i,isDistractionFree:c,hasInlineToolbar:d,__experimentalSetIsInserterOpened:C,keepCaretInsideBlock:f,defaultAllowedBlockTypes:n.allowedBlockTypes};if(h.length>0){const t=!0===n.allowedBlockTypes?b.map((({name:e})=>e)):n.allowedBlockTypes||[];e.allowedBlockTypes=t.filter((e=>!h.includes(e)))}return e}),[n,r,d,i,c,h,b,g,C,k,f]);return m?(0,s.createElement)(_.SlotFillProvider,null,(0,s.createElement)(ja,{settings:T,post:m,initialEdits:o,useSubRegistry:!1,__unstableTemplate:v?y:void 0,...a},(0,s.createElement)(S.ErrorBoundary,null,(0,s.createElement)(cn.CommandMenu,null),(0,s.createElement)(za,{postId:e}),(0,s.createElement)(Ra,null)),(0,s.createElement)(S.PostLockedModal,null))):null};var Qa=({allowedBlocks:e,icon:t,label:n,onClick:o,small:a,role:r})=>(0,s.createElement)(b.BlockSettingsMenuControls,null,(({selectedBlocks:l,onClose:i})=>((e,t)=>{return!Array.isArray(t)||(n=t,0===e.filter((e=>!n.includes(e))).length);var n})(l,e)?(0,s.createElement)(_.MenuItem,{onClick:(0,f.compose)(o,i),icon:t,label:a?n:void 0,role:r},!a&&n):null)),Xa=(0,f.compose)((0,C.withPluginContext)(((e,t)=>{var n;return{as:null!==(n=t.as)&&void 0!==n?n:_.MenuItem,icon:t.icon||e.icon,name:"core/edit-post/plugin-more-menu"}})))(se);function Ja(e){return(0,s.createElement)(ie,{__unstableExplicitMenuItem:!0,scope:"core/edit-post",...e})}function er(e,t,n,o,a){const r=document.getElementById(e),c=(0,s.createRoot)(r);(0,u.dispatch)(p.store).setDefaults("core/edit-post",{editorMode:"visual",fixedToolbar:!1,fullscreenMode:!0,hiddenBlockTypes:[],inactivePanels:[],isPublishSidebarEnabled:!0,openPanels:["post-status"],preferredStyleVariations:{},showBlockBreadcrumbs:!0,showIconLabels:!1,showListViewByDefault:!1,themeStyles:!0,welcomeGuide:!0,welcomeGuideTemplate:!0}),(0,u.dispatch)(l.store).reapplyBlockTypeFilters(),(0,u.select)(rn).isFeatureActive("showListViewByDefault")&&!(0,u.select)(rn).isFeatureActive("distractionFree")&&(0,u.dispatch)(rn).setIsListViewOpened(!0),(0,i.registerCoreBlocks)(),(0,g.registerLegacyWidgetBlock)({inserter:!1}),(0,g.registerWidgetGroupBlock)({inserter:!1}),(0,m.addFilter)("blockEditor.__unstableCanInsertBlockType","removeTemplatePartsFromInserter",((e,t)=>!(!(0,u.select)(rn).isEditingTemplate()&&"core/template-part"===t.name)&&e)),(0,m.addFilter)("blockEditor.__unstableCanInsertBlockType","removePostContentFromInserter",((e,t,n,{getBlockParentsByBlockName:o})=>(0,u.select)(rn).isEditingTemplate()||"core/post-content"!==t.name?e:o(n,"core/query").length>0));"Standards"!==("CSS1Compat"===document.compatMode?"Standards":"Quirks")&&console.warn("Your browser is using Quirks Mode. \nThis can cause rendering issues such as blocks overlaying meta boxes in the editor. Quirks Mode can be triggered by PHP errors or HTML code appearing before the opening <!DOCTYPE html>. Try checking the raw page source or your site's PHP error log and resolving errors there, removing any HTML before the doctype, or disabling plugins.");return-1!==window.navigator.userAgent.indexOf("iPhone")&&window.addEventListener("scroll",(e=>{const t=document.getElementsByClassName("interface-interface-skeleton__body")[0];e.target===document&&(window.scrollY>100&&(t.scrollTop=t.scrollTop+window.scrollY),document.getElementsByClassName("is-mode-visual")[0]&&window.scrollTo(0,0))})),window.addEventListener("dragover",(e=>e.preventDefault()),!1),window.addEventListener("drop",(e=>e.preventDefault()),!1),c.render((0,s.createElement)(Ya,{settings:o,postId:n,postType:t,initialEdits:a})),c}function tr(){d()("wp.editPost.reinitializeEditor",{since:"6.2",version:"6.3"})}}(),(window.wp=window.wp||{}).editPost=o}();