/*! This file is auto-generated */ !function(){var e={4403:function(e,t){var r; /*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */!function(){"use strict";var n={}.hasOwnProperty;function a(){for(var e=[],t=0;t({type:"SET_DEFAULT_COMPLEMENTARY_AREA",scope:e,area:t}),T=(e,t)=>({registry:r,dispatch:n})=>{if(!t)return;r.select(_.store).get(e,"isComplementaryAreaVisible")||r.dispatch(_.store).set(e,"isComplementaryAreaVisible",!0),n({type:"ENABLE_COMPLEMENTARY_AREA",scope:e,area:t})},L=e=>({registry:t})=>{t.select(_.store).get(e,"isComplementaryAreaVisible")&&t.dispatch(_.store).set(e,"isComplementaryAreaVisible",!1)},P=(e,t)=>({registry:r})=>{if(!t)return;const n=r.select(_.store).get(e,"pinnedItems");!0!==n?.[t]&&r.dispatch(_.store).set(e,"pinnedItems",{...n,[t]:!0})},R=(e,t)=>({registry:r})=>{if(!t)return;const n=r.select(_.store).get(e,"pinnedItems");r.dispatch(_.store).set(e,"pinnedItems",{...n,[t]:!1})};function O(e,t){return function({registry:r}){m()("dispatch( 'core/interface' ).toggleFeature",{since:"6.0",alternative:"dispatch( 'core/preferences' ).toggle"}),r.dispatch(_.store).toggle(e,t)}}function M(e,t,r){return function({registry:n}){m()("dispatch( 'core/interface' ).setFeatureValue",{since:"6.0",alternative:"dispatch( 'core/preferences' ).set"}),n.dispatch(_.store).set(e,t,!!r)}}function D(e,t){return function({registry:r}){m()("dispatch( 'core/interface' ).setFeatureDefaults",{since:"6.0",alternative:"dispatch( 'core/preferences' ).setDefaults"}),r.dispatch(_.store).setDefaults(e,t)}}function V(e){return{type:"OPEN_MODAL",name:e}}function F(){return{type:"CLOSE_MODAL"}}const G=(0,d.createRegistrySelector)((e=>(t,r)=>{const n=e(_.store).get(r,"isComplementaryAreaVisible");if(void 0!==n)return!1===n?null:t?.complementaryAreas?.[r]})),z=(0,d.createRegistrySelector)((e=>(t,r)=>{const n=e(_.store).get(r,"isComplementaryAreaVisible"),a=t?.complementaryAreas?.[r];return n&&void 0===a})),H=(0,d.createRegistrySelector)((e=>(t,r,n)=>{var a;const i=e(_.store).get(r,"pinnedItems");return null===(a=i?.[n])||void 0===a||a})),U=(0,d.createRegistrySelector)((e=>(t,r,n)=>(m()("select( 'core/interface' ).isFeatureActive( scope, featureName )",{since:"6.0",alternative:"select( 'core/preferences' ).get( scope, featureName )"}),!!e(_.store).get(r,n))));function $(e,t){return e.activeModal===t}var j=(0,d.combineReducers)({complementaryAreas:function(e={},t){switch(t.type){case"SET_DEFAULT_COMPLEMENTARY_AREA":{const{scope:r,area:n}=t;return e[r]?e:{...e,[r]:n}}case"ENABLE_COMPLEMENTARY_AREA":{const{scope:r,area:n}=t;return{...e,[r]:n}}}return e},activeModal:function(e=null,t){switch(t.type){case"OPEN_MODAL":return t.name;case"CLOSE_MODAL":return null}return e}});const Y=(0,d.createReduxStore)("core/interface",{reducer:j,actions:e,selectors:t});(0,d.register)(Y);var K=window.wp.plugins,Z=(0,K.withPluginContext)(((e,t)=>({icon:t.icon||e.icon,identifier:t.identifier||`${e.name}/${t.name}`})));var q=Z((function({as:e=S.Button,scope:t,identifier:r,icon:n,selectedIcon:a,name:i,...o}){const s=e,l=(0,d.useSelect)((e=>e(Y).getActiveComplementaryArea(t)===r),[r]),{enableComplementaryArea:u,disableComplementaryArea:m}=(0,d.useDispatch)(Y);return(0,c.createElement)(s,{icon:a&&l?a:n,onClick:()=>{l?m(t):u(t,r)},...o})}));var Q=({smallScreenTitle:e,children:t,className:r,toggleButtonProps:n})=>{const a=(0,c.createElement)(q,{icon:x,...n});return(0,c.createElement)(c.Fragment,null,(0,c.createElement)("div",{className:"components-panel__header interface-complementary-area-header__small"},e&&(0,c.createElement)("span",{className:"interface-complementary-area-header__small-title"},e),a),(0,c.createElement)("div",{className:k()("components-panel__header","interface-complementary-area-header",r),tabIndex:-1},t,a))};const J=()=>{};function X({name:e,as:t=S.Button,onClick:r,...n}){return(0,c.createElement)(S.Fill,{name:e},(({onClick:e})=>(0,c.createElement)(t,{onClick:r||e?(...t)=>{(r||J)(...t),(e||J)(...t)}:void 0,...n})))}X.Slot=function({name:e,as:t=S.ButtonGroup,fillProps:r={},bubblesVirtually:n,...a}){return(0,c.createElement)(S.Slot,{name:e,bubblesVirtually:n,fillProps:r},(e=>{if(!c.Children.toArray(e).length)return null;const r=[];c.Children.forEach(e,(({props:{__unstableExplicitMenuItem:e,__unstableTarget:t}})=>{t&&e&&r.push(t)}));const n=c.Children.map(e,(e=>!e.props.__unstableExplicitMenuItem&&r.includes(e.props.__unstableTarget)?null:e));return(0,c.createElement)(t,{...a},n)}))};var ee=X;const te=({__unstableExplicitMenuItem:e,__unstableTarget:t,...r})=>(0,c.createElement)(S.MenuItem,{...r});function re({scope:e,target:t,__unstableExplicitMenuItem:r,...n}){return(0,c.createElement)(q,{as:n=>(0,c.createElement)(ee,{__unstableExplicitMenuItem:r,__unstableTarget:`${e}/${t}`,as:te,name:`${e}/plugin-more-menu`,...n}),role:"menuitemcheckbox",selectedIcon:I,name:t,scope:e,...n})}function ne({scope:e,...t}){return(0,c.createElement)(S.Fill,{name:`PinnedItems/${e}`,...t})}ne.Slot=function({scope:e,className:t,...r}){return(0,c.createElement)(S.Slot,{name:`PinnedItems/${e}`,...r},(e=>e?.length>0&&(0,c.createElement)("div",{className:k()(t,"interface-pinned-items")},e)))};var ae=ne;function ie({scope:e,children:t,className:r}){return(0,c.createElement)(S.Fill,{name:`ComplementaryArea/${e}`},(0,c.createElement)("div",{className:r},t))}const oe=Z((function({children:e,className:t,closeLabel:r=(0,b.__)("Close plugin"),identifier:n,header:a,headerClassName:i,icon:o,isPinnable:s=!0,panelClassName:l,scope:u,name:m,smallScreenTitle:g,title:p,toggleShortcut:h,isActiveByDefault:_,showIconLabels:w=!1}){const{isLoading:f,isActive:E,isPinned:v,activeArea:y,isSmall:A,isLarge:x}=(0,d.useSelect)((e=>{const{getActiveComplementaryArea:t,isComplementaryAreaLoading:r,isItemPinned:a}=e(Y),i=t(u);return{isLoading:r(u),isActive:i===n,isPinned:a(u,n),activeArea:i,isSmall:e(N.store).isViewportMatch("< medium"),isLarge:e(N.store).isViewportMatch("large")}}),[n,u]);!function(e,t,r,n,a){const i=(0,c.useRef)(!1),o=(0,c.useRef)(!1),{enableComplementaryArea:s,disableComplementaryArea:l}=(0,d.useDispatch)(Y);(0,c.useEffect)((()=>{n&&a&&!i.current?(l(e),o.current=!0):o.current&&!a&&i.current?(o.current=!1,s(e,t)):o.current&&r&&r!==t&&(o.current=!1),a!==i.current&&(i.current=a)}),[n,a,e,t,r])}(u,n,y,E,A);const{enableComplementaryArea:W,disableComplementaryArea:T,pinItem:L,unpinItem:P}=(0,d.useDispatch)(Y);return(0,c.useEffect)((()=>{_&&void 0===y&&!A?W(u,n):void 0===y&&A&&T(u,n)}),[y,_,u,n,A]),(0,c.createElement)(c.Fragment,null,s&&(0,c.createElement)(ae,{scope:u},v&&(0,c.createElement)(q,{scope:u,identifier:n,isPressed:E&&(!w||x),"aria-expanded":E,"aria-disabled":f,label:p,icon:w?I:o,showTooltip:!w,variant:w?"tertiary":void 0})),m&&s&&(0,c.createElement)(re,{target:m,scope:u,icon:o},p),E&&(0,c.createElement)(ie,{className:k()("interface-complementary-area",t),scope:u},(0,c.createElement)(Q,{className:i,closeLabel:r,onClose:()=>T(u),smallScreenTitle:g,toggleButtonProps:{label:r,shortcut:h,scope:u,identifier:n}},a||(0,c.createElement)(c.Fragment,null,(0,c.createElement)("strong",null,p),s&&(0,c.createElement)(S.Button,{className:"interface-complementary-area__pin-unpin-item",icon:v?C:B,label:v?(0,b.__)("Unpin from toolbar"):(0,b.__)("Pin to toolbar"),onClick:()=>(v?P:L)(u,n),isPressed:v,"aria-expanded":v}))),(0,c.createElement)(S.Panel,{className:l},e)))}));oe.Slot=function({scope:e,...t}){return(0,c.createElement)(S.Slot,{name:`ComplementaryArea/${e}`,...t})};var se=oe,ce=window.wp.compose;function le({children:e,className:t,ariaLabel:r,as:n="div",...a}){return(0,c.createElement)(n,{className:k()("interface-navigable-region",t),"aria-label":r,role:"region",tabIndex:"-1",...a},e)}const de={hidden:{opacity:0},hover:{opacity:1,transition:{type:"tween",delay:.2,delayChildren:.2}},distractionFreeInactive:{opacity:1,transition:{delay:0}}};var ue=(0,c.forwardRef)((function({isDistractionFree:e,footer:t,header:r,editorNotices:n,sidebar:a,secondarySidebar:i,notices:o,content:s,actions:l,labels:d,className:u,enableRegionNavigation:m=!0,shortcuts:g},p){const h=(0,S.__unstableUseNavigateRegions)(g);!function(e){(0,c.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 _={...{header:(0,b.__)("Header"),body:(0,b.__)("Content"),secondarySidebar:(0,b.__)("Block Library"),sidebar:(0,b.__)("Settings"),actions:(0,b.__)("Publish"),footer:(0,b.__)("Footer")},...d};return(0,c.createElement)("div",{...m?h:{},ref:(0,ce.useMergeRefs)([p,m?h.ref:void 0]),className:k()(u,"interface-interface-skeleton",h.className,!!t&&"has-footer")},(0,c.createElement)("div",{className:"interface-interface-skeleton__editor"},!!r&&(0,c.createElement)(le,{as:S.__unstableMotion.div,className:"interface-interface-skeleton__header","aria-label":_.header,initial:e?"hidden":"distractionFreeInactive",whileHover:e?"hover":"distractionFreeInactive",animate:e?"hidden":"distractionFreeInactive",variants:de,transition:e?{type:"tween",delay:.8}:void 0},r),e&&(0,c.createElement)("div",{className:"interface-interface-skeleton__header"},n),(0,c.createElement)("div",{className:"interface-interface-skeleton__body"},!!i&&(0,c.createElement)(le,{className:"interface-interface-skeleton__secondary-sidebar",ariaLabel:_.secondarySidebar},i),!!o&&(0,c.createElement)("div",{className:"interface-interface-skeleton__notices"},o),(0,c.createElement)(le,{className:"interface-interface-skeleton__content",ariaLabel:_.body},s),!!a&&(0,c.createElement)(le,{className:"interface-interface-skeleton__sidebar",ariaLabel:_.sidebar},a),!!l&&(0,c.createElement)(le,{className:"interface-interface-skeleton__actions",ariaLabel:_.actions},l))),!!t&&(0,c.createElement)(le,{className:"interface-interface-skeleton__footer",ariaLabel:_.footer},t))}));var me=(0,c.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,c.createElement)(A.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"}));function ge({as:e=S.DropdownMenu,className:t,label:r=(0,b.__)("Options"),popoverProps:n,toggleProps:a,children:i}){return(0,c.createElement)(e,{className:k()("interface-more-menu-dropdown",t),icon:me,label:r,popoverProps:{placement:"bottom-end",...n,className:k()("interface-more-menu-dropdown__content",n?.className)},toggleProps:{tooltipPosition:"bottom",...a}},(e=>i(e)))}var pe=window.wp.blockEditor;function he(e){if("block"===e.id_base){const t=(0,l.parse)(e.instance.raw.content,{__unstableSkipAutop:!0});return t.length?(0,h.addWidgetIdToBlock)(t[0],e.id):(0,h.addWidgetIdToBlock)((0,l.createBlock)("core/paragraph",{},[]),e.id)}let t;return t=e._embedded.about[0].is_multi?{idBase:e.id_base,instance:e.instance}:{id:e.id},(0,h.addWidgetIdToBlock)((0,l.createBlock)("core/legacy-widget",t,[]),e.id)}function _e(e,t={}){let r;var n,a,i;"core/legacy-widget"===e.name&&(e.attributes.id||e.attributes.instance)?r={...t,id:null!==(n=e.attributes.id)&&void 0!==n?n:t.id,id_base:null!==(a=e.attributes.idBase)&&void 0!==a?a:t.id_base,instance:null!==(i=e.attributes.instance)&&void 0!==i?i:t.instance}:r={...t,id_base:"block",instance:{raw:{content:(0,l.serialize)(e)}}};return delete r.rendered,delete r.rendered_form,r}const we="root",fe="sidebar",Ee="postType",be=e=>`widget-area-${e}`,ve=()=>"widget-areas";const ye="core/edit-widgets",ke=(e,t)=>({registry:r})=>{const n=((e,t)=>({id:e,slug:e,status:"draft",type:"page",blocks:t,meta:{widgetAreaId:e}}))(e,t);return r.dispatch(p.store).receiveEntityRecords(we,Ee,n,{id:n.id},!1),n},Se=()=>async({select:e,dispatch:t,registry:r})=>{const n=e.getEditedWidgetAreas();if(n?.length)try{await t.saveWidgetAreas(n),r.dispatch(v.store).createSuccessNotice((0,b.__)("Widgets saved."),{type:"snackbar"})}catch(e){r.dispatch(v.store).createErrorNotice((0,b.sprintf)((0,b.__)("There was an error. %s"),e.message),{type:"snackbar"})}},Ae=e=>async({dispatch:t,registry:r})=>{try{for(const r of e)await t.saveWidgetArea(r.id)}finally{await r.dispatch(p.store).finishResolution("getEntityRecord",we,fe,{per_page:-1})}},Ie=e=>async({dispatch:t,select:r,registry:n})=>{const a=r.getWidgets(),i=n.select(p.store).getEditedEntityRecord(we,Ee,be(e)),o=Object.values(a).filter((({sidebar:t})=>t===e)),s=[],c=i.blocks.filter((e=>{const{id:t}=e.attributes;if("core/legacy-widget"===e.name&&t){if(s.includes(t))return!1;s.push(t)}return!0})),l=[];for(const e of o){r.getWidgetAreaForWidgetId(e.id)||l.push(e)}const d=[],u=[],m=[];for(let t=0;te("root","widget",i)))}else u.push((({saveEntityRecord:t})=>t("root","widget",{...s,sidebar:e})));d.push({block:r,position:t,clientId:r.clientId})}for(const e of l)u.push((({deleteEntityRecord:t})=>t("root","widget",e.id,{force:!0})));const g=(await n.dispatch(p.store).__experimentalBatch(u)).filter((e=>!e.hasOwnProperty("deleted"))),_=[];for(let e=0;e({registry:t})=>{t.dispatch(p.store).saveEditedEntityRecord(we,fe,e,{throwOnError:!0})};function Be(e,t){return{type:"SET_WIDGET_ID_FOR_CLIENT_ID",clientId:e,widgetId:t}}function Ne(e){return{type:"SET_WIDGET_AREAS_OPEN_STATE",widgetAreasOpenState:e}}function xe(e,t){return{type:"SET_IS_WIDGET_AREA_OPEN",clientId:e,isOpen:t}}function We(e){return{type:"SET_IS_INSERTER_OPENED",value:e}}function Te(e){return{type:"SET_IS_LIST_VIEW_OPENED",isOpen:e}}const Le=()=>({registry:e})=>{e.dispatch(Y).disableComplementaryArea(ye)},Pe=(e,t)=>async({dispatch:r,select:n,registry:a})=>{const i=a.select(pe.store).getBlockRootClientId(e),o=a.select(pe.store).getBlocks().find((({attributes:e})=>e.id===t)).clientId,s=a.select(pe.store).getBlockOrder(o).length;n.getIsWidgetAreaOpen(o)||r.setIsWidgetAreaOpen(o,!0),a.dispatch(pe.store).moveBlocksToPosition([e],i,o,s)},Re=()=>async({dispatch:e,registry:t})=>{const r={per_page:-1},n=[],a=(await t.resolveSelect(p.store).getEntityRecords(we,fe,r)).sort(((e,t)=>"wp_inactive_widgets"===e.id?1:"wp_inactive_widgets"===t.id?-1:0));for(const t of a)n.push((0,l.createBlock)("core/widget-area",{id:t.id,name:t.name})),t.widgets.length||e(ke(be(t.id),[]));const i={};n.forEach(((e,t)=>{i[e.clientId]=0===t})),e(Ne(i)),e(ke(ve(),n))},Oe=()=>async({dispatch:e,registry:t})=>{const r={per_page:-1,_embed:"about"},n=await t.resolveSelect(p.store).getEntityRecords("root","widget",r),a={};for(const e of n){const t=he(e);a[e.sidebar]=a[e.sidebar]||[],a[e.sidebar].push(t)}for(const t in a)a.hasOwnProperty(t)&&e(ke(be(t),a[t]))},Me=(0,d.createRegistrySelector)((e=>()=>{const t=e(p.store).getEntityRecords("root","widget",{per_page:-1,_embed:"about"});return t?.reduce(((e,t)=>({...e,[t.id]:t})),{})||{}})),De=(0,d.createRegistrySelector)((e=>(t,r)=>e(ye).getWidgets()[r])),Ve=(0,d.createRegistrySelector)((e=>()=>{const t={per_page:-1};return e(p.store).getEntityRecords(we,fe,t)})),Fe=(0,d.createRegistrySelector)((e=>(t,r)=>e(ye).getWidgetAreas().find((t=>e(p.store).getEditedEntityRecord(we,Ee,be(t.id)).blocks.map((e=>(0,h.getWidgetIdFromBlock)(e))).includes(r))))),Ge=(0,d.createRegistrySelector)((e=>(t,r)=>{const{getBlock:n,getBlockName:a,getBlockParents:i}=e(pe.store);return n(i(r).find((e=>"core/widget-area"===a(e))))})),ze=(0,d.createRegistrySelector)((e=>(t,r)=>{let n=e(ye).getWidgetAreas();return n?(r&&(n=n.filter((({id:e})=>r.includes(e)))),n.filter((({id:t})=>e(p.store).hasEditsForEntityRecord(we,Ee,be(t)))).map((({id:t})=>e(p.store).getEditedEntityRecord(we,fe,t)))):[]})),He=(0,d.createRegistrySelector)((e=>(t,r=null)=>{const n=[],a=e(ye).getWidgetAreas();for(const t of a){const a=e(p.store).getEditedEntityRecord(we,Ee,be(t.id));for(const e of a.blocks)"core/legacy-widget"!==e.name||r&&e.attributes?.referenceWidgetName!==r||n.push(e)}return n})),Ue=(0,d.createRegistrySelector)((e=>()=>{const t=e(ye).getWidgetAreas()?.map((({id:e})=>e));if(!t)return!1;for(const r of t){if(e(p.store).isSavingEntityRecord(we,fe,r))return!0}const r=[...Object.keys(e(ye).getWidgets()),void 0];for(const t of r){if(e(p.store).isSavingEntityRecord("root","widget",t))return!0}return!1})),$e=(e,t)=>{const{widgetAreasOpenState:r}=e;return!!r[t]};function je(e){return!!e.blockInserterPanel}function Ye(e){const{rootClientId:t,insertionIndex:r}=e.blockInserterPanel;return{rootClientId:t,insertionIndex:r}}const Ke=(0,d.createRegistrySelector)((e=>(t,r)=>{const n=e(pe.store).getBlocks(),[a]=n;return e(pe.store).canInsertBlockType(r,a.clientId)}));function Ze(e){return e.listViewPanel}const qe={reducer:E,selectors:o,resolvers:i,actions:a},Qe=(0,d.createReduxStore)(ye,qe);(0,d.register)(Qe),f().use((function(e,t){return 0===e.path?.indexOf("/wp/v2/types/widget-area")?Promise.resolve({}):t(e)}));var Je=window.wp.hooks;const Xe=(0,ce.createHigherOrderComponent)((e=>t=>{const{clientId:r,name:n}=t,{widgetAreas:a,currentWidgetAreaId:i,canInsertBlockInWidgetArea:o}=(0,d.useSelect)((e=>{if("core/widget-area"===n)return{};const t=e(Qe),a=t.getParentWidgetAreaBlock(r);return{widgetAreas:t.getWidgetAreas(),currentWidgetAreaId:a?.attributes?.id,canInsertBlockInWidgetArea:t.canInsertBlockInWidgetArea(n)}}),[r,n]),{moveBlockToWidgetArea:s}=(0,d.useDispatch)(Qe),l="core/widget-area"!==n&&a?.length>1&&o;return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(e,{...t}),l&&(0,c.createElement)(pe.BlockControls,null,(0,c.createElement)(h.MoveToWidgetArea,{widgetAreas:a,currentWidgetAreaId:i,onSelect:e=>{s(t.clientId,e)}})))}),"withMoveToWidgetAreaToolbarItem");(0,Je.addFilter)("editor.BlockEdit","core/edit-widgets/block-edit",Xe);var et=window.wp.mediaUtils;(0,Je.addFilter)("editor.MediaUpload","core/edit-widgets/replace-media-upload",(()=>et.MediaUpload));var tt=e=>{const[t,r]=(0,c.useState)(!1);return(0,c.useEffect)((()=>{const{ownerDocument:t}=e.current;function n(e){i(e)}function a(){r(!1)}function i(t){e.current.contains(t.target)?r(!0):r(!1)}return t.addEventListener("dragstart",n),t.addEventListener("dragend",a),t.addEventListener("dragenter",i),()=>{t.removeEventListener("dragstart",n),t.removeEventListener("dragend",a),t.removeEventListener("dragenter",i)}}),[]),t};function rt({id:e}){const[t,r,n]=(0,p.useEntityBlockEditor)("root","postType"),a=(0,c.useRef)(),i=tt(a),o=(0,pe.useInnerBlocksProps)({ref:a},{value:t,onInput:r,onChange:n,templateLock:!1,renderAppender:pe.InnerBlocks.ButtonBlockAppender});return(0,c.createElement)("div",{"data-widget-area-id":e,className:k()("wp-block-widget-area__inner-blocks block-editor-inner-blocks editor-styles-wrapper",{"wp-block-widget-area__highlight-drop-zone":i})},(0,c.createElement)("div",{...o}))}const nt=e=>{const[t,r]=(0,c.useState)(!1);return(0,c.useEffect)((()=>{const{ownerDocument:t}=e.current;function n(){r(!0)}function a(){r(!1)}return t.addEventListener("dragstart",n),t.addEventListener("dragend",a),()=>{t.removeEventListener("dragstart",n),t.removeEventListener("dragend",a)}}),[]),t},at={name:"core/widget-area",category:"widgets",attributes:{id:{type:"string"},name:{type:"string"}},supports:{html:!1,inserter:!1,customClassName:!1,reusable:!1,__experimentalToolbar:!1,__experimentalParentSelector:!1,__experimentalDisableBlockOverlay:!0},editorStyle:"wp-block-widget-area-editor",style:"wp-block-widget-area"},{name:it}=at,ot={title:(0,b.__)("Widget Area"),description:(0,b.__)("A widget area container."),__experimentalLabel:({name:e})=>e,edit:function({clientId:e,className:t,attributes:{id:r,name:n}}){const a=(0,d.useSelect)((t=>t(Qe).getIsWidgetAreaOpen(e)),[e]),{setIsWidgetAreaOpen:i}=(0,d.useDispatch)(Qe),o=(0,c.useRef)(),s=(0,c.useCallback)((t=>i(e,t)),[e]),l=nt(o),u=tt(o),[m,g]=(0,c.useState)(!1);return(0,c.useEffect)((()=>{l?u&&!a?(s(!0),g(!0)):!u&&a&&m&&s(!1):g(!1)}),[a,l,u,m]),(0,c.createElement)(S.Panel,{className:t,ref:o},(0,c.createElement)(S.PanelBody,{title:n,opened:a,onToggle:()=>{i(e,!a)},scrollAfterOpen:!l},(({opened:e})=>(0,c.createElement)(S.__unstableDisclosureContent,{className:"wp-block-widget-area__panel-body-content",visible:e},(0,c.createElement)(p.EntityProvider,{kind:"root",type:"postType",id:`widget-area-${r}`},(0,c.createElement)(rt,{id:r}))))))}};function st({text:e,children:t}){const r=(0,ce.useCopyToClipboard)(e);return(0,c.createElement)(S.Button,{variant:"secondary",ref:r},t)}function ct({message:e,error:t}){const r=[(0,c.createElement)(st,{key:"copy-error",text:t.stack},(0,b.__)("Copy Error"))];return(0,c.createElement)(pe.Warning,{className:"edit-widgets-error-boundary",actions:r},e)}class lt extends c.Component{constructor(){super(...arguments),this.state={error:null}}componentDidCatch(e){(0,Je.doAction)("editor.ErrorBoundary.errorLogged",e)}static getDerivedStateFromError(e){return{error:e}}render(){return this.state.error?(0,c.createElement)(ct,{message:(0,b.__)("The editor has encountered an unexpected error."),error:this.state.error}):this.props.children}}var dt=window.wp.reusableBlocks,ut=window.wp.keyboardShortcuts,mt=window.wp.keycodes;function gt(){const{redo:e,undo:t}=(0,d.useDispatch)(p.store),{saveEditedWidgetAreas:r}=(0,d.useDispatch)(Qe),{replaceBlocks:n}=(0,d.useDispatch)(pe.store),{getBlockName:a,getSelectedBlockClientId:i,getBlockAttributes:o}=(0,d.useSelect)(pe.store),s=(e,t)=>{e.preventDefault();const r=0===t?"core/paragraph":"core/heading",s=i();if(null===s)return;const c=a(s);if("core/paragraph"!==c&&"core/heading"!==c)return;const d=o(s),u="core/paragraph"===c?"align":"textAlign",m="core/paragraph"===r?"align":"textAlign";n(s,(0,l.createBlock)(r,{level:t,content:d.content,[m]:d[u]}))};return(0,ut.useShortcut)("core/edit-widgets/undo",(e=>{t(),e.preventDefault()})),(0,ut.useShortcut)("core/edit-widgets/redo",(t=>{e(),t.preventDefault()})),(0,ut.useShortcut)("core/edit-widgets/save",(e=>{e.preventDefault(),r()})),(0,ut.useShortcut)("core/edit-widgets/transform-heading-to-paragraph",(e=>s(e,0))),[1,2,3,4,5,6].forEach((e=>{(0,ut.useShortcut)(`core/edit-widgets/transform-paragraph-to-heading-${e}`,(t=>s(t,e)))})),null}gt.Register=function(){const{registerShortcut:e}=(0,d.useDispatch)(ut.store);return(0,c.useEffect)((()=>{e({name:"core/edit-widgets/undo",category:"global",description:(0,b.__)("Undo your last changes."),keyCombination:{modifier:"primary",character:"z"}}),e({name:"core/edit-widgets/redo",category:"global",description:(0,b.__)("Redo your last undo."),keyCombination:{modifier:"primaryShift",character:"z"},aliases:(0,mt.isAppleOS)()?[]:[{modifier:"primary",character:"y"}]}),e({name:"core/edit-widgets/save",category:"global",description:(0,b.__)("Save your changes."),keyCombination:{modifier:"primary",character:"s"}}),e({name:"core/edit-widgets/keyboard-shortcuts",category:"main",description:(0,b.__)("Display these keyboard shortcuts."),keyCombination:{modifier:"access",character:"h"}}),e({name:"core/edit-widgets/next-region",category:"global",description:(0,b.__)("Navigate to the next part of the editor."),keyCombination:{modifier:"ctrl",character:"`"},aliases:[{modifier:"access",character:"n"}]}),e({name:"core/edit-widgets/previous-region",category:"global",description:(0,b.__)("Navigate to the previous part of the editor."),keyCombination:{modifier:"ctrlShift",character:"`"},aliases:[{modifier:"access",character:"p"},{modifier:"ctrlShift",character:"~"}]}),e({name:"core/edit-widgets/transform-heading-to-paragraph",category:"block-library",description:(0,b.__)("Transform heading to paragraph."),keyCombination:{modifier:"access",character:"0"}}),[1,2,3,4,5,6].forEach((t=>{e({name:`core/edit-widgets/transform-paragraph-to-heading-${t}`,category:"block-library",description:(0,b.__)("Transform paragraph to heading."),keyCombination:{modifier:"access",character:`${t}`}})}))}),[e]),null};var pt=gt;var ht=()=>(0,d.useSelect)((e=>{const{getBlockSelectionEnd:t,getBlockName:r}=e(pe.store),n=t();if("core/widget-area"===r(n))return n;const{getParentWidgetAreaBlock:a}=e(Qe),i=a(n),o=i?.clientId;if(o)return o;const{getEntityRecord:s}=e(p.store),c=s(we,Ee,ve());return c?.blocks[0]?.clientId}),[]);const _t=!1;var wt=window.wp.privateApis;const{lock:ft,unlock:Et}=(0,wt.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.","@wordpress/edit-widgets"),{ExperimentalBlockEditorProvider:bt}=Et(pe.privateApis);function vt({blockEditorSettings:e,children:t,...r}){const n=(0,p.useResourcePermissions)("media"),{reusableBlocks:a,isFixedToolbarActive:i,keepCaretInsideBlock:o}=(0,d.useSelect)((e=>({widgetAreas:e(Qe).getWidgetAreas(),widgets:e(Qe).getWidgets(),reusableBlocks:_t?e(p.store).getEntityRecords("postType","wp_block"):[],isFixedToolbarActive:!!e(_.store).get("core/edit-widgets","fixedToolbar"),keepCaretInsideBlock:!!e(_.store).get("core/edit-widgets","keepCaretInsideBlock")})),[]),{setIsInserterOpened:s}=(0,d.useDispatch)(Qe),l=(0,c.useMemo)((()=>{let t;return n.canCreate&&(t=({onError:t,...r})=>{(0,et.uploadMedia)({wpAllowedMimeTypes:e.allowedMimeTypes,onError:({message:e})=>t(e),...r})}),{...e,__experimentalReusableBlocks:a,hasFixedToolbar:i,keepCaretInsideBlock:o,mediaUpload:t,templateLock:"all",__experimentalSetIsInserterOpened:s}}),[e,i,o,n.canCreate,a,s]),u=ht(),[m,g,h]=(0,p.useEntityBlockEditor)(we,Ee,{id:ve()});return(0,c.createElement)(ut.ShortcutProvider,null,(0,c.createElement)(pe.BlockEditorKeyboardShortcuts.Register,null),(0,c.createElement)(pt.Register,null),(0,c.createElement)(S.SlotFillProvider,null,(0,c.createElement)(bt,{value:m,onInput:g,onChange:h,settings:l,useSubRegistry:!1,...r},(0,c.createElement)(pe.CopyHandler,null,t),(0,c.createElement)(dt.ReusableBlocksMenuItems,{rootClientId:u}))))}var yt=(0,c.createElement)(A.SVG,{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,c.createElement)(A.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 kt=(0,c.createElement)(A.SVG,{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,c.createElement)(A.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 St=(0,c.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,c.createElement)(A.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"})),At=window.wp.url,It=window.wp.dom;function Ct({selectedWidgetAreaId:e}){const t=(0,d.useSelect)((e=>e(Qe).getWidgetAreas()),[]),r=(0,c.useMemo)((()=>e&&t?.find((t=>t.id===e))),[e,t]);let n;return n=r?"wp_inactive_widgets"===e?(0,b.__)("Blocks in this Widget Area will not be displayed in your site."):r.description:(0,b.__)("Widget Areas are global parts in your site’s layout that can accept blocks. These vary by theme, but are typically parts like your Sidebar or Footer."),(0,c.createElement)("div",{className:"edit-widgets-widget-areas"},(0,c.createElement)("div",{className:"edit-widgets-widget-areas__top-container"},(0,c.createElement)(pe.BlockIcon,{icon:St}),(0,c.createElement)("div",null,(0,c.createElement)("p",{dangerouslySetInnerHTML:{__html:(0,It.safeHTML)(n)}}),0===t?.length&&(0,c.createElement)("p",null,(0,b.__)("Your theme does not contain any Widget Areas.")),!r&&(0,c.createElement)(S.Button,{href:(0,At.addQueryArgs)("customize.php",{"autofocus[panel]":"widgets",return:window.location.pathname}),variant:"tertiary"},(0,b.__)("Manage with live preview")))))}const Bt=c.Platform.select({web:!0,native:!1}),Nt="edit-widgets/block-inspector",xt="edit-widgets/block-areas";function Wt({identifier:e,label:t,isActive:r}){const{enableComplementaryArea:n}=(0,d.useDispatch)(Y);return(0,c.createElement)(S.Button,{onClick:()=>n(Qe.name,e),className:k()("edit-widgets-sidebar__panel-tab",{"is-active":r}),"aria-label":r?(0,b.sprintf)((0,b.__)("%s (selected)"),t):t,"data-label":t},t)}function Tt(){const{enableComplementaryArea:e}=(0,d.useDispatch)(Y),{currentArea:t,hasSelectedNonAreaBlock:r,isGeneralSidebarOpen:n,selectedWidgetAreaBlock:a}=(0,d.useSelect)((e=>{const{getSelectedBlock:t,getBlock:r,getBlockParentsByBlockName:n}=e(pe.store),{getActiveComplementaryArea:a}=e(Y),i=t(),o=a(Qe.name);let s,c=o;return c||(c=i?Nt:xt),i&&(s="core/widget-area"===i.name?i:r(n(i.clientId,"core/widget-area")[0])),{currentArea:c,hasSelectedNonAreaBlock:!(!i||"core/widget-area"===i.name),isGeneralSidebarOpen:!!o,selectedWidgetAreaBlock:s}}),[]);return(0,c.useEffect)((()=>{r&&t===xt&&n&&e("core/edit-widgets",Nt),!r&&t===Nt&&n&&e("core/edit-widgets",xt)}),[r,e]),(0,c.createElement)(se,{className:"edit-widgets-sidebar",header:(0,c.createElement)("ul",null,(0,c.createElement)("li",null,(0,c.createElement)(Wt,{identifier:xt,label:a?a.attributes.name:(0,b.__)("Widget Areas"),isActive:t===xt})),(0,c.createElement)("li",null,(0,c.createElement)(Wt,{identifier:Nt,label:(0,b.__)("Block"),isActive:t===Nt}))),headerClassName:"edit-widgets-sidebar__panel-tabs",title:(0,b.__)("Settings"),closeLabel:(0,b.__)("Close Settings"),scope:"core/edit-widgets",identifier:t,icon:(0,b.isRTL)()?yt:kt,isActiveByDefault:Bt},t===xt&&(0,c.createElement)(Ct,{selectedWidgetAreaId:a?.attributes.id}),t===Nt&&(r?(0,c.createElement)(pe.BlockInspector,null):(0,c.createElement)("span",{className:"block-editor-block-inspector__no-blocks"},(0,b.__)("No block selected."))))}var Lt=(0,c.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,c.createElement)(A.Path,{d:"M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"}));var Pt=(0,c.createElement)(A.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,c.createElement)(A.Path,{d:"M3 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z"}));var Rt=function(){const{hasEditedWidgetAreaIds:e,isSaving:t}=(0,d.useSelect)((e=>{const{getEditedWidgetAreas:t,isSavingWidgetAreas:r}=e(Qe);return{hasEditedWidgetAreaIds:t()?.length>0,isSaving:r()}}),[]),{saveEditedWidgetAreas:r}=(0,d.useDispatch)(Qe);return(0,c.createElement)(S.Button,{variant:"primary",isBusy:t,"aria-disabled":t,onClick:t?void 0:r,disabled:!e},t?(0,b.__)("Saving…"):(0,b.__)("Update"))};var Ot=(0,c.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,c.createElement)(A.Path,{d:"M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z"}));var Mt=(0,c.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,c.createElement)(A.Path,{d:"M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z"}));function Dt(){const e=(0,d.useSelect)((e=>e(p.store).hasUndo()),[]),{undo:t}=(0,d.useDispatch)(p.store);return(0,c.createElement)(S.ToolbarButton,{icon:(0,b.isRTL)()?Mt:Ot,label:(0,b.__)("Undo"),shortcut:mt.displayShortcut.primary("z"),"aria-disabled":!e,onClick:e?t:void 0})}function Vt(){const e=(0,mt.isAppleOS)()?mt.displayShortcut.primaryShift("z"):mt.displayShortcut.primary("y"),t=(0,d.useSelect)((e=>e(p.store).hasRedo()),[]),{redo:r}=(0,d.useDispatch)(p.store);return(0,c.createElement)(S.ToolbarButton,{icon:(0,b.isRTL)()?Ot:Mt,label:(0,b.__)("Redo"),shortcut:e,"aria-disabled":!t,onClick:t?r:void 0})}var Ft=(0,c.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,c.createElement)(A.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"}));const Gt=[{keyCombination:{modifier:"primary",character:"b"},description:(0,b.__)("Make the selected text bold.")},{keyCombination:{modifier:"primary",character:"i"},description:(0,b.__)("Make the selected text italic.")},{keyCombination:{modifier:"primary",character:"k"},description:(0,b.__)("Convert the selected text into a link.")},{keyCombination:{modifier:"primaryShift",character:"k"},description:(0,b.__)("Remove a link.")},{keyCombination:{character:"[["},description:(0,b.__)("Insert a link to a post or page.")},{keyCombination:{modifier:"primary",character:"u"},description:(0,b.__)("Underline the selected text.")},{keyCombination:{modifier:"access",character:"d"},description:(0,b.__)("Strikethrough the selected text.")},{keyCombination:{modifier:"access",character:"x"},description:(0,b.__)("Make the selected text inline code.")},{keyCombination:{modifier:"access",character:"0"},description:(0,b.__)("Convert the current heading to a paragraph.")},{keyCombination:{modifier:"access",character:"1-6"},description:(0,b.__)("Convert the current paragraph or heading to a heading of level 1 to 6.")}];function zt({keyCombination:e,forceAriaLabel:t}){const r=e.modifier?mt.displayShortcutList[e.modifier](e.character):e.character,n=e.modifier?mt.shortcutAriaLabel[e.modifier](e.character):e.character,a=Array.isArray(r)?r:[r];return(0,c.createElement)("kbd",{className:"edit-widgets-keyboard-shortcut-help-modal__shortcut-key-combination","aria-label":t||n},a.map(((e,t)=>"+"===e?(0,c.createElement)(c.Fragment,{key:t},e):(0,c.createElement)("kbd",{key:t,className:"edit-widgets-keyboard-shortcut-help-modal__shortcut-key"},e))))}var Ht=function({description:e,keyCombination:t,aliases:r=[],ariaLabel:n}){return(0,c.createElement)(c.Fragment,null,(0,c.createElement)("div",{className:"edit-widgets-keyboard-shortcut-help-modal__shortcut-description"},e),(0,c.createElement)("div",{className:"edit-widgets-keyboard-shortcut-help-modal__shortcut-term"},(0,c.createElement)(zt,{keyCombination:t,forceAriaLabel:n}),r.map(((e,t)=>(0,c.createElement)(zt,{keyCombination:e,forceAriaLabel:n,key:t})))))};var Ut=function({name:e}){const{keyCombination:t,description:r,aliases:n}=(0,d.useSelect)((t=>{const{getShortcutKeyCombination:r,getShortcutDescription:n,getShortcutAliases:a}=t(ut.store);return{keyCombination:r(e),aliases:a(e),description:n(e)}}),[e]);return t?(0,c.createElement)(Ht,{keyCombination:t,description:r,aliases:n}):null};const $t=({shortcuts:e})=>(0,c.createElement)("ul",{className:"edit-widgets-keyboard-shortcut-help-modal__shortcut-list",role:"list"},e.map(((e,t)=>(0,c.createElement)("li",{className:"edit-widgets-keyboard-shortcut-help-modal__shortcut",key:t},"string"==typeof e?(0,c.createElement)(Ut,{name:e}):(0,c.createElement)(Ht,{...e}))))),jt=({title:e,shortcuts:t,className:r})=>(0,c.createElement)("section",{className:k()("edit-widgets-keyboard-shortcut-help-modal__section",r)},!!e&&(0,c.createElement)("h2",{className:"edit-widgets-keyboard-shortcut-help-modal__section-title"},e),(0,c.createElement)($t,{shortcuts:t})),Yt=({title:e,categoryName:t,additionalShortcuts:r=[]})=>{const n=(0,d.useSelect)((e=>e(ut.store).getCategoryShortcuts(t)),[t]);return(0,c.createElement)(jt,{title:e,shortcuts:n.concat(r)})};function Kt({isModalActive:e,toggleModal:t}){return(0,ut.useShortcut)("core/edit-widgets/keyboard-shortcuts",t,{bindGlobal:!0}),e?(0,c.createElement)(S.Modal,{className:"edit-widgets-keyboard-shortcut-help-modal",title:(0,b.__)("Keyboard shortcuts"),onRequestClose:t},(0,c.createElement)(jt,{className:"edit-widgets-keyboard-shortcut-help-modal__main-shortcuts",shortcuts:["core/edit-widgets/keyboard-shortcuts"]}),(0,c.createElement)(Yt,{title:(0,b.__)("Global shortcuts"),categoryName:"global"}),(0,c.createElement)(Yt,{title:(0,b.__)("Selection shortcuts"),categoryName:"selection"}),(0,c.createElement)(Yt,{title:(0,b.__)("Block shortcuts"),categoryName:"block",additionalShortcuts:[{keyCombination:{character:"/"},description:(0,b.__)("Change the block type after adding a new paragraph."),ariaLabel:(0,b.__)("Forward-slash")}]}),(0,c.createElement)(jt,{title:(0,b.__)("Text formatting"),shortcuts:Gt})):null}const{Fill:Zt,Slot:qt}=(0,S.createSlotFill)("EditWidgetsToolsMoreMenuGroup");Zt.Slot=({fillProps:e})=>(0,c.createElement)(qt,{fillProps:e},(e=>e.length>0&&e));var Qt=Zt;function Jt(){const[e,t]=(0,c.useState)(!1),r=()=>t(!e);(0,ut.useShortcut)("core/edit-widgets/keyboard-shortcuts",r);const n=(0,ce.useViewportMatch)("medium");return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(ge,null,(e=>(0,c.createElement)(c.Fragment,null,n&&(0,c.createElement)(S.MenuGroup,{label:(0,b._x)("View","noun")},(0,c.createElement)(_.PreferenceToggleMenuItem,{scope:"core/edit-widgets",name:"fixedToolbar",label:(0,b.__)("Top toolbar"),info:(0,b.__)("Access all block and document tools in a single place"),messageActivated:(0,b.__)("Top toolbar activated"),messageDeactivated:(0,b.__)("Top toolbar deactivated")})),(0,c.createElement)(S.MenuGroup,{label:(0,b.__)("Tools")},(0,c.createElement)(S.MenuItem,{onClick:()=>{t(!0)},shortcut:mt.displayShortcut.access("h")},(0,b.__)("Keyboard shortcuts")),(0,c.createElement)(_.PreferenceToggleMenuItem,{scope:"core/edit-widgets",name:"welcomeGuide",label:(0,b.__)("Welcome Guide")}),(0,c.createElement)(S.MenuItem,{role:"menuitem",icon:Ft,href:(0,b.__)("https://wordpress.org/documentation/article/block-based-widgets-editor/"),target:"_blank",rel:"noopener noreferrer"},(0,b.__)("Help"),(0,c.createElement)(S.VisuallyHidden,{as:"span"},(0,b.__)("(opens in a new tab)"))),(0,c.createElement)(Qt.Slot,{fillProps:{onClose:e}})),(0,c.createElement)(S.MenuGroup,{label:(0,b.__)("Preferences")},(0,c.createElement)(_.PreferenceToggleMenuItem,{scope:"core/edit-widgets",name:"keepCaretInsideBlock",label:(0,b.__)("Contain text cursor inside block"),info:(0,b.__)("Aids screen readers by stopping text caret from leaving blocks."),messageActivated:(0,b.__)("Contain text cursor inside block activated"),messageDeactivated:(0,b.__)("Contain text cursor inside block deactivated")}),(0,c.createElement)(_.PreferenceToggleMenuItem,{scope:"core/edit-widgets",name:"themeStyles",info:(0,b.__)("Make the editor look like your theme."),label:(0,b.__)("Use theme styles")}),n&&(0,c.createElement)(_.PreferenceToggleMenuItem,{scope:"core/edit-widgets",name:"showBlockBreadcrumbs",label:(0,b.__)("Display block breadcrumbs"),info:(0,b.__)("Shows block breadcrumbs at the bottom of the editor."),messageActivated:(0,b.__)("Display block breadcrumbs activated"),messageDeactivated:(0,b.__)("Display block breadcrumbs deactivated")}))))),(0,c.createElement)(Kt,{isModalActive:e,toggleModal:r}))}const{useShouldContextualToolbarShow:Xt}=Et(pe.privateApis);var er=function(){const e=(0,ce.useViewportMatch)("medium"),t=(0,c.useRef)(),r=ht(),n=(0,d.useSelect)((e=>e(Qe).getIsWidgetAreaOpen(r)),[r]),{isInserterOpen:a,isListViewOpen:i}=(0,d.useSelect)((e=>{const{isInserterOpened:t,isListViewOpened:r}=e(Qe);return{isInserterOpen:t(),isListViewOpen:r()}}),[]),{setIsWidgetAreaOpen:o,setIsInserterOpened:s,setIsListViewOpened:l}=(0,d.useDispatch)(Qe),{selectBlock:u}=(0,d.useDispatch)(pe.store),m=(0,c.useCallback)((()=>l(!i)),[l,i]),{shouldShowContextualToolbar:g,canFocusHiddenToolbar:p,fixedToolbarCanBeFocused:h}=Xt(),_=g||p||h;return(0,c.createElement)(c.Fragment,null,(0,c.createElement)("div",{className:"edit-widgets-header"},(0,c.createElement)("div",{className:"edit-widgets-header__navigable-toolbar-wrapper"},e&&(0,c.createElement)("h1",{className:"edit-widgets-header__title"},(0,b.__)("Widgets")),!e&&(0,c.createElement)(S.VisuallyHidden,{as:"h1",className:"edit-widgets-header__title"},(0,b.__)("Widgets")),(0,c.createElement)(pe.NavigableToolbar,{className:"edit-widgets-header-toolbar","aria-label":(0,b.__)("Document tools"),shouldUseKeyboardFocusShortcut:!_},(0,c.createElement)(S.ToolbarItem,{ref:t,as:S.Button,className:"edit-widgets-header-toolbar__inserter-toggle",variant:"primary",isPressed:a,onMouseDown:e=>{e.preventDefault()},onClick:()=>{a?s(!1):(n||(u(r),o(r,!0)),window.requestAnimationFrame((()=>s(!0))))},icon:Lt,label:(0,b._x)("Toggle block inserter","Generic label for block inserter button")}),e&&(0,c.createElement)(c.Fragment,null,(0,c.createElement)(Dt,null),(0,c.createElement)(Vt,null),(0,c.createElement)(S.ToolbarItem,{as:S.Button,className:"edit-widgets-header-toolbar__list-view-toggle",icon:Pt,isPressed:i,label:(0,b.__)("List View"),onClick:m})))),(0,c.createElement)("div",{className:"edit-widgets-header__actions"},(0,c.createElement)(Rt,null),(0,c.createElement)(ae.Slot,{scope:"core/edit-widgets"}),(0,c.createElement)(Jt,null))))};var tr=function(){const{removeNotice:e}=(0,d.useDispatch)(v.store),{notices:t}=(0,d.useSelect)((e=>({notices:e(v.store).getNotices()})),[]),r=t.filter((({isDismissible:e,type:t})=>e&&"default"===t)),n=t.filter((({isDismissible:e,type:t})=>!e&&"default"===t)),a=t.filter((({type:e})=>"snackbar"===e));return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(S.NoticeList,{notices:n,className:"edit-widgets-notices__pinned"}),(0,c.createElement)(S.NoticeList,{notices:r,className:"edit-widgets-notices__dismissible",onRemove:e}),(0,c.createElement)(S.SnackbarList,{notices:a,className:"edit-widgets-notices__snackbar",onRemove:e}))};function rr({blockEditorSettings:e}){const t=(0,d.useSelect)((e=>!!e(_.store).get("core/edit-widgets","themeStyles")),[]),r=(0,c.useMemo)((()=>t?e.styles:[]),[e,t]);return(0,c.createElement)("div",{className:"edit-widgets-block-editor"},(0,c.createElement)(tr,null),(0,c.createElement)(pe.BlockTools,null,(0,c.createElement)(pt,null),(0,c.createElement)(pe.__unstableEditorStyles,{styles:r}),(0,c.createElement)(pe.BlockSelectionClearer,null,(0,c.createElement)(pe.WritingFlow,null,(0,c.createElement)(pe.ObserveTyping,null,(0,c.createElement)(pe.BlockList,{className:"edit-widgets-main-block-list"}))))))}var nr=(0,c.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,c.createElement)(A.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"}));var ar=()=>{const e=(0,d.useSelect)((e=>{const{getEntityRecord:t}=e(p.store),r=t(we,Ee,ve());return r?.blocks[0]?.clientId}),[]);return(0,d.useSelect)((t=>{const{getBlockRootClientId:r,getBlockSelectionEnd:n,getBlockOrder:a,getBlockIndex:i}=t(pe.store),o=t(Qe).__experimentalGetInsertionPoint();if(o.rootClientId)return o;const s=n()||e,c=r(s);return s&&""===c?{rootClientId:s,insertionIndex:a(s).length}:{rootClientId:c,insertionIndex:i(s)+1}}),[e])};function ir(){const e=(0,ce.useViewportMatch)("medium","<"),{rootClientId:t,insertionIndex:r}=ar(),{setIsInserterOpened:n}=(0,d.useDispatch)(Qe),a=(0,c.useCallback)((()=>n(!1)),[n]),i=e?"div":S.VisuallyHidden,[o,s]=(0,ce.__experimentalUseDialog)({onClose:a,focusOnMount:null}),l=(0,c.useRef)();return(0,c.useEffect)((()=>{l.current.focusSearch()}),[]),(0,c.createElement)("div",{ref:o,...s,className:"edit-widgets-layout__inserter-panel"},(0,c.createElement)(i,{className:"edit-widgets-layout__inserter-panel-header"},(0,c.createElement)(S.Button,{icon:nr,onClick:a,label:(0,b.__)("Close block inserter")})),(0,c.createElement)("div",{className:"edit-widgets-layout__inserter-panel-content"},(0,c.createElement)(pe.__experimentalLibrary,{showInserterHelpPanel:!0,shouldFocusBlock:e,rootClientId:t,__experimentalInsertionIndex:r,ref:l})))}function or(){const{setIsListViewOpened:e}=(0,d.useDispatch)(Qe),[t,r]=(0,c.useState)(null),n=(0,ce.useFocusOnMount)("firstElement"),a=(0,ce.useFocusReturn)(),i=(0,ce.useFocusReturn)();return(0,c.createElement)("div",{className:"edit-widgets-editor__list-view-panel",onKeyDown:function(t){t.keyCode!==mt.ESCAPE||t.defaultPrevented||(t.preventDefault(),e(!1))}},(0,c.createElement)("div",{className:"edit-widgets-editor__list-view-panel-header",ref:a},(0,c.createElement)("strong",null,(0,b.__)("List View")),(0,c.createElement)(S.Button,{icon:x,label:(0,b.__)("Close"),onClick:()=>e(!1)})),(0,c.createElement)("div",{className:"edit-widgets-editor__list-view-panel-content",ref:(0,ce.useMergeRefs)([i,n,r])},(0,c.createElement)(pe.__experimentalListView,{dropZoneElement:t})))}function sr(){const{isInserterOpen:e,isListViewOpen:t}=(0,d.useSelect)((e=>{const{isInserterOpened:t,isListViewOpened:r}=e(Qe);return{isInserterOpen:t(),isListViewOpen:r()}}),[]);return e?(0,c.createElement)(ir,null):t?(0,c.createElement)(or,null):null}const cr={header:(0,b.__)("Widgets top bar"),body:(0,b.__)("Widgets and blocks"),sidebar:(0,b.__)("Widgets settings"),footer:(0,b.__)("Widgets footer")};var lr=function({blockEditorSettings:e}){const t=(0,ce.useViewportMatch)("medium","<"),r=(0,ce.useViewportMatch)("huge",">="),{setIsInserterOpened:n,setIsListViewOpened:a,closeGeneralSidebar:i}=(0,d.useDispatch)(Qe),{hasBlockBreadCrumbsEnabled:o,hasSidebarEnabled:s,isInserterOpened:l,isListViewOpened:u,previousShortcut:m,nextShortcut:g}=(0,d.useSelect)((e=>({hasSidebarEnabled:!!e(Y).getActiveComplementaryArea(Qe.name),isInserterOpened:!!e(Qe).isInserterOpened(),isListViewOpened:!!e(Qe).isListViewOpened(),hasBlockBreadCrumbsEnabled:!!e(_.store).get("core/edit-widgets","showBlockBreadcrumbs"),previousShortcut:e(ut.store).getAllShortcutKeyCombinations("core/edit-widgets/previous-region"),nextShortcut:e(ut.store).getAllShortcutKeyCombinations("core/edit-widgets/next-region")})),[]);(0,c.useEffect)((()=>{s&&!r&&(n(!1),a(!1))}),[s,r]),(0,c.useEffect)((()=>{!l&&!u||r||i()}),[l,u,r]);const p=u?(0,b.__)("List View"):(0,b.__)("Block Library"),h=u||l;return(0,c.createElement)(ue,{labels:{...cr,secondarySidebar:p},header:(0,c.createElement)(er,null),secondarySidebar:h&&(0,c.createElement)(sr,null),sidebar:s&&(0,c.createElement)(se.Slot,{scope:"core/edit-widgets"}),content:(0,c.createElement)(c.Fragment,null,(0,c.createElement)(rr,{blockEditorSettings:e})),footer:o&&!t&&(0,c.createElement)("div",{className:"edit-widgets-layout__footer"},(0,c.createElement)(pe.BlockBreadcrumb,{rootLabelText:(0,b.__)("Widgets")})),shortcuts:{previous:m,next:g}})};function dr(){const e=(0,d.useSelect)((e=>{const{getEditedWidgetAreas:t}=e(Qe),r=t();return r?.length>0}),[]);return(0,c.useEffect)((()=>{const t=t=>{if(e)return t.returnValue=(0,b.__)("You have unsaved changes. If you proceed, they will be lost."),t.returnValue};return window.addEventListener("beforeunload",t),()=>{window.removeEventListener("beforeunload",t)}}),[e]),null}function ur(){var e;const t=(0,d.useSelect)((e=>!!e(_.store).get("core/edit-widgets","welcomeGuide")),[]),{toggle:r}=(0,d.useDispatch)(_.store),n=(0,d.useSelect)((e=>e(Qe).getWidgetAreas({per_page:-1})),[]);if(!t)return null;const a=n?.every((e=>"wp_inactive_widgets"===e.id||e.widgets.every((e=>e.startsWith("block-"))))),i=null!==(e=n?.filter((e=>"wp_inactive_widgets"!==e.id)).length)&&void 0!==e?e:0;return(0,c.createElement)(S.Guide,{className:"edit-widgets-welcome-guide",contentLabel:(0,b.__)("Welcome to block Widgets"),finishButtonText:(0,b.__)("Get started"),onFinish:()=>r("core/edit-widgets","welcomeGuide"),pages:[{image:(0,c.createElement)(mr,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-canvas.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-canvas.gif"}),content:(0,c.createElement)(c.Fragment,null,(0,c.createElement)("h1",{className:"edit-widgets-welcome-guide__heading"},(0,b.__)("Welcome to block Widgets")),a?(0,c.createElement)(c.Fragment,null,(0,c.createElement)("p",{className:"edit-widgets-welcome-guide__text"},(0,b.sprintf)((0,b._n)("Your theme provides %s “block” area for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.","Your theme provides %s different “block” areas for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.",i),i))):(0,c.createElement)(c.Fragment,null,(0,c.createElement)("p",{className:"edit-widgets-welcome-guide__text"},(0,b.__)("You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.")),(0,c.createElement)("p",{className:"edit-widgets-welcome-guide__text"},(0,c.createElement)("strong",null,(0,b.__)("Want to stick with the old widgets?"))," ",(0,c.createElement)(S.ExternalLink,{href:(0,b.__)("https://wordpress.org/plugins/classic-widgets/")},(0,b.__)("Get the Classic Widgets plugin.")))))},{image:(0,c.createElement)(mr,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-editor.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-editor.gif"}),content:(0,c.createElement)(c.Fragment,null,(0,c.createElement)("h1",{className:"edit-widgets-welcome-guide__heading"},(0,b.__)("Make each block your own")),(0,c.createElement)("p",{className:"edit-widgets-welcome-guide__text"},(0,b.__)("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,c.createElement)(mr,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-library.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-library.gif"}),content:(0,c.createElement)(c.Fragment,null,(0,c.createElement)("h1",{className:"edit-widgets-welcome-guide__heading"},(0,b.__)("Get to know the block library")),(0,c.createElement)("p",{className:"edit-widgets-welcome-guide__text"},(0,c.createInterpolateElement)((0,b.__)("All of the blocks available to you live in the block library. You’ll find it wherever you see the icon."),{InserterIconImage:(0,c.createElement)("img",{className:"edit-widgets-welcome-guide__inserter-icon",alt:(0,b.__)("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,c.createElement)(mr,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.gif"}),content:(0,c.createElement)(c.Fragment,null,(0,c.createElement)("h1",{className:"edit-widgets-welcome-guide__heading"},(0,b.__)("Learn how to use the block editor")),(0,c.createElement)("p",{className:"edit-widgets-welcome-guide__text"},(0,b.__)("New to the block editor? Want to learn more about using it? "),(0,c.createElement)(S.ExternalLink,{href:(0,b.__)("https://wordpress.org/documentation/article/wordpress-block-editor/")},(0,b.__)("Here's a detailed guide."))))}]})}function mr({nonAnimatedSrc:e,animatedSrc:t}){return(0,c.createElement)("picture",{className:"edit-widgets-welcome-guide__image"},(0,c.createElement)("source",{srcSet:e,media:"(prefers-reduced-motion: reduce)"}),(0,c.createElement)("img",{src:t,width:"312",height:"240",alt:""}))}var gr=function({blockEditorSettings:e}){const{createErrorNotice:t}=(0,d.useDispatch)(v.store);return(0,c.createElement)(lt,null,(0,c.createElement)(vt,{blockEditorSettings:e},(0,c.createElement)(lr,{blockEditorSettings:e}),(0,c.createElement)(Tt,null),(0,c.createElement)(S.Popover.Slot,null),(0,c.createElement)(K.PluginArea,{onError:function(e){t((0,b.sprintf)((0,b.__)('The "%s" plugin has encountered an error and cannot be rendered.'),e))}}),(0,c.createElement)(dr,null),(0,c.createElement)(ur,null)))};const pr=["core/more","core/freeform","core/template-part",..._t?[]:["core/block"]];function hr(e,t){const r=document.getElementById(e),n=(0,c.createRoot)(r),a=(0,g.__experimentalGetCoreBlocks)().filter((e=>!(pr.includes(e.name)||e.name.startsWith("core/post")||e.name.startsWith("core/query")||e.name.startsWith("core/site")||e.name.startsWith("core/navigation"))));return(0,d.dispatch)(_.store).setDefaults("core/edit-widgets",{fixedToolbar:!1,welcomeGuide:!0,showBlockBreadcrumbs:!0,themeStyles:!0}),(0,d.dispatch)(l.store).__experimentalReapplyBlockTypeFilters(),(0,g.registerCoreBlocks)(a),(0,h.registerLegacyWidgetBlock)(),(0,h.registerLegacyWidgetVariations)(t),fr(s),(0,h.registerWidgetGroupBlock)(),t.__experimentalFetchLinkSuggestions=(e,r)=>(0,p.__experimentalFetchLinkSuggestions)(e,r,t),(0,l.setFreeformContentHandlerName)("core/html"),n.render((0,c.createElement)(gr,{blockEditorSettings:t})),n}const _r=hr;function wr(){m()("wp.editWidgets.reinitializeEditor",{since:"6.2",version:"6.3"})}const fr=e=>{if(!e)return;const{metadata:t,settings:r,name:n}=e;t&&(0,l.unstable__bootstrapServerSideBlockDefinitions)({[n]:t}),(0,l.registerBlockType)(n,r)}}(),(window.wp=window.wp||{}).editWidgets=n}();