/*! 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 i(){for(var e=[],t=0;t0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;if("SET_FEATURE_DEFAULTS"===t.type){const{scope:r,defaults:n}=t;return{...e,[r]:{...e[r],...n}}}return e}}),B=(0,d.combineReducers)({features(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;if("SET_FEATURE_VALUE"===t.type){const{scope:r,featureName:n,value:i}=t;return{...e,[r]:{...e[r],[n]:i}}}return e}}),N=(0,d.combineReducers)({singleEnableItems:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{type:t,itemType:r,scope:n,item:i}=arguments.length>1?arguments[1]:void 0;return"SET_SINGLE_ENABLE_ITEM"===t&&r&&n?{...e,[r]:{...e[r],[n]:i||null}}:e},multipleEnableItems:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{type:t,itemType:r,scope:n,item:i,isEnable:a}=arguments.length>1?arguments[1]:void 0;if("SET_MULTIPLE_ENABLE_ITEM"!==t||!r||!n||!i||(0,I.get)(e,[r,n,i])===a)return e;const o=e[r]||{},s=o[n]||{};return{...e,[r]:{...o,[n]:{...s,[i]:a||!1}}}}});var C=(0,d.combineReducers)({enableItems:N,preferenceDefaults:A,preferences:B});function x(e,t,r){return{type:"SET_SINGLE_ENABLE_ITEM",itemType:e,scope:t,item:r}}function T(e,t){return x("complementaryArea",e,t)}function W(e){return x("complementaryArea",e,void 0)}function L(e,t,r,n){return{type:"SET_MULTIPLE_ENABLE_ITEM",itemType:e,scope:t,item:r,isEnable:n}}function P(e,t){return L("pinnedItems",e,t,!0)}function R(e,t){return L("pinnedItems",e,t,!1)}function O(e,t){return function(r){let{select:n,dispatch:i}=r;const a=n.isFeatureActive(e,t);i.setFeatureValue(e,t,!a)}}function M(e,t,r){return{type:"SET_FEATURE_VALUE",scope:e,featureName:t,value:!!r}}function D(e,t){return{type:"SET_FEATURE_DEFAULTS",scope:e,defaults:t}}function F(e,t){return function(e,t,r){return(0,I.get)(e.enableItems.singleEnableItems,[t,r])}(e,"complementaryArea",t)}function V(e,t,r){return!1!==function(e,t,r,n){return(0,I.get)(e.enableItems.multipleEnableItems,[t,r,n])}(e,"pinnedItems",t,r)}function G(e,t,r){var n,i;const a=null===(n=e.preferences.features[t])||void 0===n?void 0:n[r];return!!(void 0!==a?a:null===(i=e.preferenceDefaults.features[t])||void 0===i?void 0:i[r])}const z="core/interface",U=(0,d.createReduxStore)(z,{reducer:C,actions:e,selectors:t,persist:["enableItems","preferences"],__experimentalUseThunks:!0});(0,d.registerStore)(z,{reducer:C,actions:e,selectors:t,persist:["enableItems","preferences"],__experimentalUseThunks:!0});var H=window.wp.plugins,$=(0,H.withPluginContext)(((e,t)=>({icon:t.icon||e.icon,identifier:t.identifier||`${e.name}/${t.name}`})));var j=$((function(e){let{as:t=w.Button,scope:r,identifier:n,icon:i,selectedIcon:a,...o}=e;const s=t,c=(0,d.useSelect)((e=>e(U).getActiveComplementaryArea(r)===n),[n]),{enableComplementaryArea:u,disableComplementaryArea:m}=(0,d.useDispatch)(U);return(0,l.createElement)(s,p({icon:a&&c?a:i,onClick:()=>{c?m(r):u(r,n)}},(0,I.omit)(o,["name"])))}));var K=e=>{let{smallScreenTitle:t,children:r,className:n,toggleButtonProps:i}=e;const a=(0,l.createElement)(j,p({icon:S},i));return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:"components-panel__header interface-complementary-area-header__small"},t&&(0,l.createElement)("span",{className:"interface-complementary-area-header__small-title"},t),a),(0,l.createElement)("div",{className:h()("components-panel__header","interface-complementary-area-header",n),tabIndex:-1},r,a))};function Y(e){let{name:t,as:r=w.Button,onClick:n,...i}=e;return(0,l.createElement)(w.Fill,{name:t},(e=>{let{onClick:t}=e;return(0,l.createElement)(r,p({onClick:n||t?function(){(n||I.noop)(...arguments),(t||I.noop)(...arguments)}:void 0},i))}))}Y.Slot=function(e){let{name:t,as:r=w.ButtonGroup,fillProps:n={},bubblesVirtually:i,...a}=e;return(0,l.createElement)(w.Slot,{name:t,bubblesVirtually:i,fillProps:n},(e=>{if((0,I.isEmpty)(l.Children.toArray(e)))return null;const t=[];l.Children.forEach(e,(e=>{let{props:{__unstableExplicitMenuItem:r,__unstableTarget:n}}=e;n&&r&&t.push(n)}));const n=l.Children.map(e,(e=>!e.props.__unstableExplicitMenuItem&&t.includes(e.props.__unstableTarget)?null:e));return(0,l.createElement)(r,a,n)}))};var q=Y;const Q=e=>(0,l.createElement)(w.MenuItem,(0,I.omit)(e,["__unstableExplicitMenuItem","__unstableTarget"]));function J(e){let{scope:t,target:r,__unstableExplicitMenuItem:n,...i}=e;return(0,l.createElement)(j,p({as:e=>(0,l.createElement)(q,p({__unstableExplicitMenuItem:n,__unstableTarget:`${t}/${r}`,as:Q,name:`${t}/plugin-more-menu`},e)),role:"menuitemcheckbox",selectedIcon:b,name:r,scope:t},i))}function X(e){let{scope:t,...r}=e;return(0,l.createElement)(w.Fill,p({name:`PinnedItems/${t}`},r))}X.Slot=function(e){let{scope:t,className:r,...n}=e;return(0,l.createElement)(w.Slot,p({name:`PinnedItems/${t}`},n),(e=>!(0,I.isEmpty)(e)&&(0,l.createElement)("div",{className:h()(r,"interface-pinned-items")},e)))};var Z=X;function ee(e){let{scope:t,children:r,className:n}=e;return(0,l.createElement)(w.Fill,{name:`ComplementaryArea/${t}`},(0,l.createElement)("div",{className:n},r))}const te=$((function(e){let{children:t,className:r,closeLabel:n=(0,E.__)("Close plugin"),identifier:i,header:a,headerClassName:o,icon:s,isPinnable:c=!0,panelClassName:u,scope:m,name:g,smallScreenTitle:p,title:_,toggleShortcut:f,isActiveByDefault:S,showIconLabels:I=!1}=e;const{isActive:A,isPinned:B,activeArea:N,isSmall:C,isLarge:x}=(0,d.useSelect)((e=>{const{getActiveComplementaryArea:t,isItemPinned:r}=e(U),n=t(m);return{isActive:n===i,isPinned:r(m,i),activeArea:n,isSmall:e(k.store).isViewportMatch("< medium"),isLarge:e(k.store).isViewportMatch("large")}}),[i,m]);!function(e,t,r,n,i){const a=(0,l.useRef)(!1),o=(0,l.useRef)(!1),{enableComplementaryArea:s,disableComplementaryArea:c}=(0,d.useDispatch)(U);(0,l.useEffect)((()=>{n&&i&&!a.current?(c(e),o.current=!0):o.current&&!i&&a.current?(o.current=!1,s(e,t)):o.current&&r&&r!==t&&(o.current=!1),i!==a.current&&(a.current=i)}),[n,i,e,t,r])}(m,i,N,A,C);const{enableComplementaryArea:T,disableComplementaryArea:W,pinItem:L,unpinItem:P}=(0,d.useDispatch)(U);return(0,l.useEffect)((()=>{S&&void 0===N&&!C&&T(m,i)}),[N,S,m,i,C]),(0,l.createElement)(l.Fragment,null,c&&(0,l.createElement)(Z,{scope:m},B&&(0,l.createElement)(j,{scope:m,identifier:i,isPressed:A&&(!I||x),"aria-expanded":A,label:_,icon:I?b:s,showTooltip:!I,variant:I?"tertiary":void 0})),g&&c&&(0,l.createElement)(J,{target:g,scope:m,icon:s},_),A&&(0,l.createElement)(ee,{className:h()("interface-complementary-area",r),scope:m},(0,l.createElement)(K,{className:o,closeLabel:n,onClose:()=>W(m),smallScreenTitle:p,toggleButtonProps:{label:n,shortcut:f,scope:m,identifier:i}},a||(0,l.createElement)(l.Fragment,null,(0,l.createElement)("strong",null,_),c&&(0,l.createElement)(w.Button,{className:"interface-complementary-area__pin-unpin-item",icon:B?v:y,label:B?(0,E.__)("Unpin from toolbar"):(0,E.__)("Pin to toolbar"),onClick:()=>(B?P:L)(m,i),isPressed:B,"aria-expanded":B}))),(0,l.createElement)(w.Panel,{className:u},t)))}));te.Slot=function(e){let{scope:t,...r}=e;return(0,l.createElement)(w.Slot,p({name:`ComplementaryArea/${t}`},r))};var re=te,ne=window.wp.compose;var ie=(0,l.forwardRef)((function(e,t){let{footer:r,header:n,sidebar:i,secondarySidebar:a,notices:o,content:s,drawer:c,actions:d,labels:u,className:m,shortcuts:g}=e;const _=(0,w.__unstableUseNavigateRegions)(g);!function(e){(0,l.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 f={...{drawer:(0,E.__)("Drawer"),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,l.createElement)("div",p({},_,{ref:(0,ne.useMergeRefs)([t,_.ref]),className:h()(m,"interface-interface-skeleton",_.className,!!r&&"has-footer")}),!!c&&(0,l.createElement)("div",{className:"interface-interface-skeleton__drawer",role:"region","aria-label":f.drawer,tabIndex:"-1"},c),(0,l.createElement)("div",{className:"interface-interface-skeleton__editor"},!!n&&(0,l.createElement)("div",{className:"interface-interface-skeleton__header",role:"region","aria-label":f.header,tabIndex:"-1"},n),(0,l.createElement)("div",{className:"interface-interface-skeleton__body"},!!a&&(0,l.createElement)("div",{className:"interface-interface-skeleton__secondary-sidebar",role:"region","aria-label":f.secondarySidebar,tabIndex:"-1"},a),!!o&&(0,l.createElement)("div",{className:"interface-interface-skeleton__notices"},o),(0,l.createElement)("div",{className:"interface-interface-skeleton__content",role:"region","aria-label":f.body,tabIndex:"-1"},s),!!i&&(0,l.createElement)("div",{className:"interface-interface-skeleton__sidebar",role:"region","aria-label":f.sidebar,tabIndex:"-1"},i),!!d&&(0,l.createElement)("div",{className:"interface-interface-skeleton__actions",role:"region","aria-label":f.actions,tabIndex:"-1"},d))),!!r&&(0,l.createElement)("div",{className:"interface-interface-skeleton__footer",role:"region","aria-label":f.footer,tabIndex:"-1"},r))}));var ae=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"}));function oe(e){let{as:t=w.DropdownMenu,className:r,label:n=(0,E.__)("Options"),popoverProps:i,toggleProps:a,children:o}=e;return(0,l.createElement)(t,{className:h()("interface-more-menu-dropdown",r),icon:ae,label:n,popoverProps:{position:"bottom left",...i,className:h()("interface-more-menu-dropdown__content",null==i?void 0:i.className)},toggleProps:{tooltipPosition:"bottom",...a}},(e=>o(e)))}var se=window.wp.a11y;function le(e){let{scope:t,label:r,info:n,messageActivated:i,messageDeactivated:a,shortcut:o,feature:s}=e;const c=(0,d.useSelect)((e=>e(U).isFeatureActive(t,s)),[s]),{toggleFeature:u}=(0,d.useDispatch)(U);return(0,l.createElement)(w.MenuItem,{icon:c&&b,isSelected:c,onClick:()=>{u(t,s),c?(0,se.speak)(a||(0,E.__)("Feature deactivated")):(0,se.speak)(i||(0,E.__)("Feature activated"))},role:"menuitemcheckbox",info:n,shortcut:o},r)}var ce=window.wp.apiFetch,de=r.n(ce);var ue=(0,d.combineReducers)({blockInserterPanel:function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0;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(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_IS_INSERTER_OPENED":return!t.value&&e;case"SET_IS_LIST_VIEW_OPENED":return t.isOpen}return e},widgetAreasOpenState:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const{type:r}=t;switch(r){case"SET_WIDGET_AREAS_OPEN_STATE":return t.widgetAreasOpenState;case"SET_IS_WIDGET_AREA_OPEN":{const{clientId:r,isOpen:n}=t;return{...e,[r]:n}}default:return e}}}),me=window.wp.notices,ge=window.wp.blockEditor;function pe(e){if("block"===e.id_base){const t=(0,c.parse)(e.instance.raw.content);return t.length?(0,g.addWidgetIdToBlock)(t[0],e.id):(0,g.addWidgetIdToBlock)((0,c.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,g.addWidgetIdToBlock)((0,c.createBlock)("core/legacy-widget",t,[]),e.id)}function _e(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n="core/legacy-widget"===e.name&&(e.attributes.id||e.attributes.instance);var i,a,o;n?t={...r,id:null!==(i=e.attributes.id)&&void 0!==i?i:r.id,id_base:null!==(a=e.attributes.idBase)&&void 0!==a?a:r.id_base,instance:null!==(o=e.attributes.instance)&&void 0!==o?o:r.instance}:t={...r,id_base:"block",instance:{raw:{content:(0,c.serialize)(e)}}};return delete t.rendered,delete t.rendered_form,t}const he="root",we="sidebar",Ee="postType",fe=e=>`widget-area-${e}`;const be="core/edit-widgets",ve=(e,t)=>r=>{let{registry:n}=r;const i=((e,t)=>({id:e,slug:e,status:"draft",type:"page",blocks:t,meta:{widgetAreaId:e}}))(e,t);return n.dispatch(m.store).receiveEntityRecords(he,Ee,i,{id:i.id},!1),i},ye=()=>async e=>{let{select:t,dispatch:r,registry:n}=e;const i=t.getEditedWidgetAreas();if(null!=i&&i.length)try{await r.saveWidgetAreas(i),n.dispatch(me.store).createSuccessNotice((0,E.__)("Widgets saved."),{type:"snackbar"})}catch(e){n.dispatch(me.store).createErrorNotice((0,E.sprintf)((0,E.__)("There was an error. %s"),e.message),{type:"snackbar"})}},ke=e=>async t=>{let{dispatch:r,registry:n}=t;try{for(const t of e)await r.saveWidgetArea(t.id)}finally{await n.dispatch(m.store).finishResolution("getEntityRecord",he,we,{per_page:-1})}},Se=e=>async t=>{let{dispatch:r,select:n,registry:i}=t;const a=n.getWidgets(),o=i.select(m.store).getEditedEntityRecord(he,Ee,fe(e)),s=Object.values(a).filter((t=>{let{sidebar:r}=t;return r===e})),l=[],c=o.blocks.filter((e=>{const{id:t}=e.attributes;if("core/legacy-widget"===e.name&&t){if(l.includes(t))return!1;l.push(t)}return!0})),d=[];for(const e of s){n.getWidgetAreaForWidgetId(e.id)||d.push(e)}const u=[],p=[],_=[];for(let t=0;t{let{saveEditedEntityRecord:t}=e;return t("root","widget",n)}))}else p.push((t=>{let{saveEntityRecord:r}=t;return r("root","widget",{...s,sidebar:e})}));u.push({block:r,position:t,clientId:r.clientId})}for(const e of d)p.push((t=>{let{deleteEntityRecord:r}=t;return r("root","widget",e.id,{force:!0})}));const h=(await i.dispatch(m.store).__experimentalBatch(p)).filter((e=>!e.hasOwnProperty("deleted"))),w=[];for(let e=0;et=>{let{registry:r}=t;const n=r.select(m.store).getLastEntitySaveError(he,we,e);r.dispatch(m.store).saveEditedEntityRecord(he,we,e);const i=r.select(m.store).getLastEntitySaveError(he,we,e);if(i&&n!==i)throw new Error(i)};function Ae(e,t){return{type:"SET_WIDGET_ID_FOR_CLIENT_ID",clientId:e,widgetId:t}}function Be(e){return{type:"SET_WIDGET_AREAS_OPEN_STATE",widgetAreasOpenState:e}}function Ne(e,t){return{type:"SET_IS_WIDGET_AREA_OPEN",clientId:e,isOpen:t}}function Ce(e){return{type:"SET_IS_INSERTER_OPENED",value:e}}function xe(e){return{type:"SET_IS_LIST_VIEW_OPENED",isOpen:e}}const Te=()=>e=>{let{registry:t}=e;t.dispatch(U).disableComplementaryArea(be)},We=(e,t)=>async r=>{let{dispatch:n,select:i,registry:a}=r;const o=a.select(ge.store).getBlockRootClientId([e]),s=a.select(ge.store).getBlocks().find((e=>{let{attributes:r}=e;return r.id===t})).clientId,l=a.select(ge.store).getBlockOrder(s).length;i.getIsWidgetAreaOpen(s)||n.setIsWidgetAreaOpen(s,!0),a.dispatch(ge.store).moveBlocksToPosition([e],o,s,l)},Le=()=>async e=>{let{dispatch:t,registry:r}=e;const n={per_page:-1},i=[],a=(await r.resolveSelect(m.store).getEntityRecords(he,we,n)).sort(((e,t)=>"wp_inactive_widgets"===e.id?1:"wp_inactive_widgets"===t.id?-1:0));for(const e of a)i.push((0,c.createBlock)("core/widget-area",{id:e.id,name:e.name})),e.widgets.length||t(ve(fe(e.id),[]));const o={};i.forEach(((e,t)=>{o[e.clientId]=0===t})),t(Be(o)),t(ve("widget-areas",i))},Pe=()=>async e=>{let{dispatch:t,registry:r}=e;const n={per_page:-1,_embed:"about"},i=await r.resolveSelect(m.store).getEntityRecords("root","widget",n),a={};for(const e of i){const t=pe(e);a[e.sidebar]=a[e.sidebar]||[],a[e.sidebar].push(t)}for(const e in a)a.hasOwnProperty(e)&&t(ve(fe(e),a[e]))},Re=(0,d.createRegistrySelector)((e=>()=>{const t=e(m.store).getEntityRecords("root","widget",{per_page:-1,_embed:"about"});return(0,I.keyBy)(t,"id")})),Oe=(0,d.createRegistrySelector)((e=>(t,r)=>e(be).getWidgets()[r])),Me=(0,d.createRegistrySelector)((e=>()=>{const t={per_page:-1};return e(m.store).getEntityRecords(he,we,t)})),De=(0,d.createRegistrySelector)((e=>(t,r)=>e(be).getWidgetAreas().find((t=>e(m.store).getEditedEntityRecord(he,Ee,fe(t.id)).blocks.map((e=>(0,g.getWidgetIdFromBlock)(e))).includes(r))))),Fe=(0,d.createRegistrySelector)((e=>(t,r)=>{const{getBlock:n,getBlockName:i,getBlockParents:a}=e(ge.store);return n(a(r).find((e=>"core/widget-area"===i(e))))})),Ve=(0,d.createRegistrySelector)((e=>(t,r)=>{let n=e(be).getWidgetAreas();return n?(r&&(n=n.filter((e=>{let{id:t}=e;return r.includes(t)}))),n.filter((t=>{let{id:r}=t;return e(m.store).hasEditsForEntityRecord(he,Ee,fe(r))})).map((t=>{let{id:r}=t;return e(m.store).getEditedEntityRecord(he,we,r)}))):[]})),Ge=(0,d.createRegistrySelector)((e=>function(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const n=[],i=e(be).getWidgetAreas();for(const t of i){const i=e(m.store).getEditedEntityRecord(he,Ee,fe(t.id));for(const e of i.blocks){var a;"core/legacy-widget"!==e.name||r&&(null===(a=e.attributes)||void 0===a?void 0:a.referenceWidgetName)!==r||n.push(e)}}return n})),ze=(0,d.createRegistrySelector)((e=>()=>{var t;const r=null===(t=e(be).getWidgetAreas())||void 0===t?void 0:t.map((e=>{let{id:t}=e;return t}));if(!r)return!1;for(const t of r){if(e(m.store).isSavingEntityRecord(he,we,t))return!0}const n=[...Object.keys(e(be).getWidgets()),void 0];for(const t of n){if(e(m.store).isSavingEntityRecord("root","widget",t))return!0}return!1})),Ue=(e,t)=>{const{widgetAreasOpenState:r}=e;return!!r[t]};function He(e){return!!e.blockInserterPanel}function $e(e){const{rootClientId:t,insertionIndex:r}=e.blockInserterPanel;return{rootClientId:t,insertionIndex:r}}const je=(0,d.createRegistrySelector)((e=>(t,r)=>{const n=e(ge.store).getBlocks(),[i]=n;return e(ge.store).canInsertBlockType(r,i.clientId)}));function Ke(e){return e.listViewPanel}const Ye={reducer:ue,selectors:o,resolvers:a,actions:i,__experimentalUseThunks:!0},qe=(0,d.createReduxStore)(be,Ye);(0,d.registerStore)(be,Ye),de().use((function(e,t){var r;return 0===(null===(r=e.path)||void 0===r?void 0:r.indexOf("/wp/v2/types/widget-area"))?Promise.resolve({}):t(e)}));var Qe=window.wp.hooks;const Je=(0,ne.createHigherOrderComponent)((e=>t=>{const{clientId:r,name:n}=t,{widgetAreas:i,currentWidgetAreaId:a,canInsertBlockInWidgetArea:o}=(0,d.useSelect)((e=>{var t;if("core/widget-area"===n)return{};const i=e(qe),a=i.getParentWidgetAreaBlock(r);return{widgetAreas:i.getWidgetAreas(),currentWidgetAreaId:null==a||null===(t=a.attributes)||void 0===t?void 0:t.id,canInsertBlockInWidgetArea:i.canInsertBlockInWidgetArea(n)}}),[r,n]),{moveBlockToWidgetArea:s}=(0,d.useDispatch)(qe),c=(null==i?void 0:i.length)>1,u="core/widget-area"!==n&&c&&o;return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(e,t),u&&(0,l.createElement)(ge.BlockControls,null,(0,l.createElement)(g.MoveToWidgetArea,{widgetAreas:i,currentWidgetAreaId:a,onSelect:e=>{s(t.clientId,e)}})))}),"withMoveToWidgetAreaToolbarItem");(0,Qe.addFilter)("editor.BlockEdit","core/edit-widgets/block-edit",Je);var Xe=window.wp.mediaUtils;(0,Qe.addFilter)("editor.MediaUpload","core/edit-widgets/replace-media-upload",(()=>Xe.MediaUpload));var Ze=e=>{const[t,r]=(0,l.useState)(!1);return(0,l.useEffect)((()=>{const{ownerDocument:t}=e.current;function n(e){a(e)}function i(){r(!1)}function a(t){e.current.contains(t.target)?r(!0):r(!1)}return t.addEventListener("dragstart",n),t.addEventListener("dragend",i),t.addEventListener("dragenter",a),()=>{t.removeEventListener("dragstart",n),t.removeEventListener("dragend",i),t.removeEventListener("dragenter",a)}}),[]),t};function et(e){let{id:t}=e;const[r,n,i]=(0,m.useEntityBlockEditor)("root","postType"),a=(0,l.useRef)(),o=Ze(a),s=(0,ge.useInnerBlocksProps)({ref:a},{value:r,onInput:n,onChange:i,templateLock:!1,renderAppender:ge.InnerBlocks.ButtonBlockAppender});return(0,l.createElement)("div",{"data-widget-area-id":t,className:h()("wp-block-widget-area__inner-blocks block-editor-inner-blocks editor-styles-wrapper",{"wp-block-widget-area__highlight-drop-zone":o})},(0,l.createElement)("div",s))}const tt=e=>{const[t,r]=(0,l.useState)(!1);return(0,l.useEffect)((()=>{const{ownerDocument:t}=e.current;function n(){r(!0)}function i(){r(!1)}return t.addEventListener("dragstart",n),t.addEventListener("dragend",i),()=>{t.removeEventListener("dragstart",n),t.removeEventListener("dragend",i)}}),[]),t},rt={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},editorStyle:"wp-block-widget-area-editor",style:"wp-block-widget-area"},{name:nt}=rt,it={title:(0,E.__)("Widget Area"),description:(0,E.__)("A widget area container."),__experimentalLabel:e=>{let{name:t}=e;return t},edit:function(e){let{clientId:t,className:r,attributes:{id:n,name:i}}=e;const a=(0,d.useSelect)((e=>e(qe).getIsWidgetAreaOpen(t)),[t]),{setIsWidgetAreaOpen:o}=(0,d.useDispatch)(qe),s=(0,l.useRef)(),c=(0,l.useCallback)((e=>o(t,e)),[t]),u=tt(s),g=Ze(s),[p,_]=(0,l.useState)(!1);return(0,l.useEffect)((()=>{u?g&&!a?(c(!0),_(!0)):!g&&a&&p&&c(!1):_(!1)}),[a,u,g,p]),(0,l.createElement)(w.Panel,{className:r,ref:s},(0,l.createElement)(w.PanelBody,{title:i,opened:a,onToggle:()=>{o(t,!a)},scrollAfterOpen:!u},(e=>{let{opened:t}=e;return(0,l.createElement)(w.__unstableDisclosureContent,{className:"wp-block-widget-area__panel-body-content",visible:t},(0,l.createElement)(m.EntityProvider,{kind:"root",type:"postType",id:`widget-area-${n}`},(0,l.createElement)(et,{id:n})))})))}};function at(e){let{text:t,children:r}=e;const n=(0,ne.useCopyToClipboard)(t);return(0,l.createElement)(w.Button,{variant:"secondary",ref:n},r)}class ot extends l.Component{constructor(){super(...arguments),this.reboot=this.reboot.bind(this),this.state={error:null}}componentDidCatch(e){this.setState({error:e})}reboot(){this.props.onError()}render(){const{error:e}=this.state;return e?(0,l.createElement)(ge.Warning,{className:"edit-widgets-error-boundary",actions:[(0,l.createElement)(w.Button,{key:"recovery",onClick:this.reboot,variant:"secondary"},(0,E.__)("Attempt Recovery")),(0,l.createElement)(at,{key:"copy-error",text:e.stack},(0,E.__)("Copy Error"))]},(0,E.__)("The editor has encountered an unexpected error.")):this.props.children}}var st=window.wp.reusableBlocks,lt=window.wp.keyboardShortcuts;function ct(){const{redo:e,undo:t}=(0,d.useDispatch)(m.store),{saveEditedWidgetAreas:r}=(0,d.useDispatch)(qe);return(0,lt.useShortcut)("core/edit-widgets/undo",(e=>{t(),e.preventDefault()})),(0,lt.useShortcut)("core/edit-widgets/redo",(t=>{e(),t.preventDefault()})),(0,lt.useShortcut)("core/edit-widgets/save",(e=>{e.preventDefault(),r()})),null}ct.Register=function(){const{registerShortcut:e}=(0,d.useDispatch)(lt.store);return(0,l.useEffect)((()=>{e({name:"core/edit-widgets/undo",category:"global",description:(0,E.__)("Undo your last changes."),keyCombination:{modifier:"primary",character:"z"}}),e({name:"core/edit-widgets/redo",category:"global",description:(0,E.__)("Redo your last undo."),keyCombination:{modifier:"primaryShift",character:"z"}}),e({name:"core/edit-widgets/save",category:"global",description:(0,E.__)("Save your changes."),keyCombination:{modifier:"primary",character:"s"}}),e({name:"core/edit-widgets/keyboard-shortcuts",category:"main",description:(0,E.__)("Display these keyboard shortcuts."),keyCombination:{modifier:"access",character:"h"}}),e({name:"core/edit-widgets/next-region",category:"global",description:(0,E.__)("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,E.__)("Navigate to the previous part of the editor."),keyCombination:{modifier:"ctrlShift",character:"`"},aliases:[{modifier:"access",character:"p"}]})}),[e]),null};var dt=ct;var ut=()=>(0,d.useSelect)((e=>{var t;const{getBlockSelectionEnd:r,getBlockName:n}=e(ge.store),i=r();if("core/widget-area"===n(i))return i;const{getParentWidgetAreaBlock:a}=e(qe),o=a(i),s=null==o?void 0:o.clientId;if(s)return s;const{getEntityRecord:l}=e(m.store),c=l(he,Ee,"widget-areas");return null==c||null===(t=c.blocks[0])||void 0===t?void 0:t.clientId}),[]);function mt(e){let{blockEditorSettings:t,children:r,...n}=e;const{hasUploadPermissions:i,reusableBlocks:a,isFixedToolbarActive:o,keepCaretInsideBlock:s}=(0,d.useSelect)((e=>({hasUploadPermissions:(0,I.defaultTo)(e(m.store).canUser("create","media"),!0),widgetAreas:e(qe).getWidgetAreas(),widgets:e(qe).getWidgets(),reusableBlocks:[],isFixedToolbarActive:e(U).isFeatureActive("core/edit-widgets","fixedToolbar"),keepCaretInsideBlock:e(U).isFeatureActive("core/edit-widgets","keepCaretInsideBlock")})),[]),{setIsInserterOpened:c}=(0,d.useDispatch)(qe),u=(0,l.useMemo)((()=>{let e;return i&&(e=e=>{let{onError:r,...n}=e;(0,Xe.uploadMedia)({wpAllowedMimeTypes:t.allowedMimeTypes,onError:e=>{let{message:t}=e;return r(t)},...n})}),{...t,__experimentalReusableBlocks:a,hasFixedToolbar:o,keepCaretInsideBlock:s,mediaUpload:e,templateLock:"all",__experimentalSetIsInserterOpened:c}}),[t,o,s,i,a,c]),g=ut(),[_,h,E]=(0,m.useEntityBlockEditor)(he,Ee,{id:"widget-areas"});return(0,l.createElement)(lt.ShortcutProvider,null,(0,l.createElement)(ge.BlockEditorKeyboardShortcuts.Register,null),(0,l.createElement)(dt.Register,null),(0,l.createElement)(w.SlotFillProvider,null,(0,l.createElement)(ge.BlockEditorProvider,p({value:_,onInput:h,onChange:E,settings:u,useSubRegistry:!1},n),(0,l.createElement)(ge.CopyHandler,null,r),(0,l.createElement)(st.ReusableBlocksMenuItems,{rootClientId:g}))))}var gt=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{fillRule:"evenodd",d:"M10.289 4.836A1 1 0 0111.275 4h1.306a1 1 0 01.987.836l.244 1.466c.787.26 1.503.679 2.108 1.218l1.393-.522a1 1 0 011.216.437l.653 1.13a1 1 0 01-.23 1.273l-1.148.944a6.025 6.025 0 010 2.435l1.149.946a1 1 0 01.23 1.272l-.653 1.13a1 1 0 01-1.216.437l-1.394-.522c-.605.54-1.32.958-2.108 1.218l-.244 1.466a1 1 0 01-.987.836h-1.306a1 1 0 01-.986-.836l-.244-1.466a5.995 5.995 0 01-2.108-1.218l-1.394.522a1 1 0 01-1.217-.436l-.653-1.131a1 1 0 01.23-1.272l1.149-.946a6.026 6.026 0 010-2.435l-1.148-.944a1 1 0 01-.23-1.272l.653-1.131a1 1 0 011.217-.437l1.393.522a5.994 5.994 0 012.108-1.218l.244-1.466zM14.929 12a3 3 0 11-6 0 3 3 0 016 0z",clipRule:"evenodd"}));var pt=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.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"})),_t=window.wp.url,ht=window.wp.dom;function wt(e){let{selectedWidgetAreaId:t}=e;const r=(0,d.useSelect)((e=>e(qe).getWidgetAreas()),[]),n=(0,l.useMemo)((()=>t&&(null==r?void 0:r.find((e=>e.id===t)))),[t,r]);let i;return i=n?"wp_inactive_widgets"===t?(0,E.__)("Blocks in this Widget Area will not be displayed in your site."):n.description:(0,E.__)("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,l.createElement)("div",{className:"edit-widgets-widget-areas"},(0,l.createElement)("div",{className:"edit-widgets-widget-areas__top-container"},(0,l.createElement)(ge.BlockIcon,{icon:pt}),(0,l.createElement)("div",null,(0,l.createElement)("p",{dangerouslySetInnerHTML:{__html:(0,ht.safeHTML)(i)}}),0===(null==r?void 0:r.length)&&(0,l.createElement)("p",null,(0,E.__)("Your theme does not contain any Widget Areas.")),!n&&(0,l.createElement)(w.Button,{href:(0,_t.addQueryArgs)("customize.php",{"autofocus[panel]":"widgets",return:window.location.pathname}),variant:"tertiary"},(0,E.__)("Manage with live preview")))))}const Et=l.Platform.select({web:!0,native:!1}),ft="edit-widgets/block-inspector",bt="edit-widgets/block-areas";function vt(e){let{identifier:t,label:r,isActive:n}=e;const{enableComplementaryArea:i}=(0,d.useDispatch)(U);return(0,l.createElement)(w.Button,{onClick:()=>i(qe.name,t),className:h()("edit-widgets-sidebar__panel-tab",{"is-active":n}),"aria-label":n?(0,E.sprintf)((0,E.__)("%s (selected)"),r):r,"data-label":r},r)}function yt(){const{enableComplementaryArea:e}=(0,d.useDispatch)(U),{currentArea:t,hasSelectedNonAreaBlock:r,isGeneralSidebarOpen:n,selectedWidgetAreaBlock:i}=(0,d.useSelect)((e=>{const{getSelectedBlock:t,getBlock:r,getBlockParentsByBlockName:n}=e(ge.store),{getActiveComplementaryArea:i}=e(U),a=t(),o=i(qe.name);let s,l=o;return l||(l=a?ft:bt),a&&(s="core/widget-area"===a.name?a:r(n(a.clientId,"core/widget-area")[0])),{currentArea:l,hasSelectedNonAreaBlock:!(!a||"core/widget-area"===a.name),isGeneralSidebarOpen:!!o,selectedWidgetAreaBlock:s}}),[]);return(0,l.useEffect)((()=>{r&&t===bt&&n&&e("core/edit-widgets",ft),!r&&t===ft&&n&&e("core/edit-widgets",bt)}),[r,e]),(0,l.createElement)(re,{className:"edit-widgets-sidebar",header:(0,l.createElement)("ul",null,(0,l.createElement)("li",null,(0,l.createElement)(vt,{identifier:bt,label:i?i.attributes.name:(0,E.__)("Widget Areas"),isActive:t===bt})),(0,l.createElement)("li",null,(0,l.createElement)(vt,{identifier:ft,label:(0,E.__)("Block"),isActive:t===ft}))),headerClassName:"edit-widgets-sidebar__panel-tabs",title:(0,E.__)("Settings"),closeLabel:(0,E.__)("Close settings"),scope:"core/edit-widgets",identifier:t,icon:gt,isActiveByDefault:Et},t===bt&&(0,l.createElement)(wt,{selectedWidgetAreaId:null==i?void 0:i.attributes.id}),t===ft&&(r?(0,l.createElement)(ge.BlockInspector,null):(0,l.createElement)("span",{className:"block-editor-block-inspector__no-blocks"},(0,E.__)("No block selected."))))}var kt=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"}));var St=(0,l.createElement)(f.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(f.Path,{d:"M13.8 5.2H3v1.5h10.8V5.2zm-3.6 12v1.5H21v-1.5H10.2zm7.2-6H6.6v1.5h10.8v-1.5z"}));var It=function(){const{hasEditedWidgetAreaIds:e,isSaving:t}=(0,d.useSelect)((e=>{var t;const{getEditedWidgetAreas:r,isSavingWidgetAreas:n}=e(qe);return{hasEditedWidgetAreaIds:(null===(t=r())||void 0===t?void 0:t.length)>0,isSaving:n()}}),[]),{saveEditedWidgetAreas:r}=(0,d.useDispatch)(qe);return(0,l.createElement)(w.Button,{variant:"primary",isBusy:t,"aria-disabled":t,onClick:t?void 0:r,disabled:!e},t?(0,E.__)("Saving…"):(0,E.__)("Update"))};var At=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.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 Bt=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.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"})),Nt=window.wp.keycodes;function Ct(){const e=(0,d.useSelect)((e=>e(m.store).hasUndo()),[]),{undo:t}=(0,d.useDispatch)(m.store);return(0,l.createElement)(w.ToolbarButton,{icon:(0,E.isRTL)()?Bt:At,label:(0,E.__)("Undo"),shortcut:Nt.displayShortcut.primary("z"),"aria-disabled":!e,onClick:e?t:void 0})}function xt(){const e=(0,d.useSelect)((e=>e(m.store).hasRedo()),[]),{redo:t}=(0,d.useDispatch)(m.store);return(0,l.createElement)(w.ToolbarButton,{icon:(0,E.isRTL)()?At:Bt,label:(0,E.__)("Redo"),shortcut:Nt.displayShortcut.primaryShift("z"),"aria-disabled":!e,onClick:e?t:void 0})}var Tt=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"M18.2 17c0 .7-.6 1.2-1.2 1.2H7c-.7 0-1.2-.6-1.2-1.2V7c0-.7.6-1.2 1.2-1.2h3.2V4.2H7C5.5 4.2 4.2 5.5 4.2 7v10c0 1.5 1.2 2.8 2.8 2.8h10c1.5 0 2.8-1.2 2.8-2.8v-3.6h-1.5V17zM14.9 3v1.5h3.7l-6.4 6.4 1.1 1.1 6.4-6.4v3.7h1.5V3h-6.3z"}));const Wt=[{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:{modifier:"primary",character:"u"},description:(0,E.__)("Underline the selected text.")}];function Lt(e){let{keyCombination:t,forceAriaLabel:r}=e;const n=t.modifier?Nt.displayShortcutList[t.modifier](t.character):t.character,i=t.modifier?Nt.shortcutAriaLabel[t.modifier](t.character):t.character;return(0,l.createElement)("kbd",{className:"edit-widgets-keyboard-shortcut-help-modal__shortcut-key-combination","aria-label":r||i},(0,I.castArray)(n).map(((e,t)=>"+"===e?(0,l.createElement)(l.Fragment,{key:t},e):(0,l.createElement)("kbd",{key:t,className:"edit-widgets-keyboard-shortcut-help-modal__shortcut-key"},e))))}var Pt=function(e){let{description:t,keyCombination:r,aliases:n=[],ariaLabel:i}=e;return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:"edit-widgets-keyboard-shortcut-help-modal__shortcut-description"},t),(0,l.createElement)("div",{className:"edit-widgets-keyboard-shortcut-help-modal__shortcut-term"},(0,l.createElement)(Lt,{keyCombination:r,forceAriaLabel:i}),n.map(((e,t)=>(0,l.createElement)(Lt,{keyCombination:e,forceAriaLabel:i,key:t})))))};var Rt=function(e){let{name:t}=e;const{keyCombination:r,description:n,aliases:i}=(0,d.useSelect)((e=>{const{getShortcutKeyCombination:r,getShortcutDescription:n,getShortcutAliases:i}=e(lt.store);return{keyCombination:r(t),aliases:i(t),description:n(t)}}),[t]);return r?(0,l.createElement)(Pt,{keyCombination:r,description:n,aliases:i}):null};const Ot=e=>{let{shortcuts:t}=e;return(0,l.createElement)("ul",{className:"edit-widgets-keyboard-shortcut-help-modal__shortcut-list",role:"list"},t.map(((e,t)=>(0,l.createElement)("li",{className:"edit-widgets-keyboard-shortcut-help-modal__shortcut",key:t},(0,I.isString)(e)?(0,l.createElement)(Rt,{name:e}):(0,l.createElement)(Pt,e)))))},Mt=e=>{let{title:t,shortcuts:r,className:n}=e;return(0,l.createElement)("section",{className:h()("edit-widgets-keyboard-shortcut-help-modal__section",n)},!!t&&(0,l.createElement)("h2",{className:"edit-widgets-keyboard-shortcut-help-modal__section-title"},t),(0,l.createElement)(Ot,{shortcuts:r}))},Dt=e=>{let{title:t,categoryName:r,additionalShortcuts:n=[]}=e;const i=(0,d.useSelect)((e=>e(lt.store).getCategoryShortcuts(r)),[r]);return(0,l.createElement)(Mt,{title:t,shortcuts:i.concat(n)})};function Ft(e){let{isModalActive:t,toggleModal:r}=e;return(0,lt.useShortcut)("core/edit-widgets/keyboard-shortcuts",r,{bindGlobal:!0}),t?(0,l.createElement)(w.Modal,{className:"edit-widgets-keyboard-shortcut-help-modal",title:(0,E.__)("Keyboard shortcuts"),closeLabel:(0,E.__)("Close"),onRequestClose:r},(0,l.createElement)(Mt,{className:"edit-widgets-keyboard-shortcut-help-modal__main-shortcuts",shortcuts:["core/edit-widgets/keyboard-shortcuts"]}),(0,l.createElement)(Dt,{title:(0,E.__)("Global shortcuts"),categoryName:"global"}),(0,l.createElement)(Dt,{title:(0,E.__)("Selection shortcuts"),categoryName:"selection"}),(0,l.createElement)(Dt,{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,l.createElement)(Mt,{title:(0,E.__)("Text formatting"),shortcuts:Wt})):null}function Vt(){const[e,t]=(0,l.useState)(!1),r=()=>t(!e);(0,lt.useShortcut)("core/edit-widgets/keyboard-shortcuts",r);const n=(0,ne.useViewportMatch)("medium");return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(oe,null,(()=>(0,l.createElement)(l.Fragment,null,n&&(0,l.createElement)(w.MenuGroup,{label:(0,E._x)("View","noun")},(0,l.createElement)(le,{scope:"core/edit-widgets",feature:"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,l.createElement)(w.MenuGroup,{label:(0,E.__)("Tools")},(0,l.createElement)(w.MenuItem,{onClick:()=>{t(!0)},shortcut:Nt.displayShortcut.access("h")},(0,E.__)("Keyboard shortcuts")),(0,l.createElement)(le,{scope:"core/edit-widgets",feature:"welcomeGuide",label:(0,E.__)("Welcome Guide")}),(0,l.createElement)(w.MenuItem,{role:"menuitem",icon:Tt,href:(0,E.__)("https://wordpress.org/support/article/block-based-widgets-editor/"),target:"_blank",rel:"noopener noreferrer"},(0,E.__)("Help"),(0,l.createElement)(w.VisuallyHidden,{as:"span"},(0,E.__)("(opens in a new tab)")))),(0,l.createElement)(w.MenuGroup,{label:(0,E.__)("Preferences")},(0,l.createElement)(le,{scope:"core/edit-widgets",feature:"keepCaretInsideBlock",label:(0,E.__)("Contain text cursor inside block"),info:(0,E.__)("Aids screen readers by stopping text caret from leaving blocks."),messageActivated:(0,E.__)("Contain text cursor inside block activated"),messageDeactivated:(0,E.__)("Contain text cursor inside block deactivated")}),(0,l.createElement)(le,{scope:"core/edit-widgets",feature:"themeStyles",info:(0,E.__)("Make the editor look like your theme."),label:(0,E.__)("Use theme styles")}),n&&(0,l.createElement)(le,{scope:"core/edit-widgets",feature:"showBlockBreadcrumbs",label:(0,E.__)("Display block breadcrumbs"),info:(0,E.__)("Shows block breadcrumbs at the bottom of the editor."),messageActivated:(0,E.__)("Display block breadcrumbs activated"),messageDeactivated:(0,E.__)("Display block breadcrumbs deactivated")}))))),(0,l.createElement)(Ft,{isModalActive:e,toggleModal:r}))}var Gt=function(){const e=(0,ne.useViewportMatch)("medium"),t=(0,l.useRef)(),r=ut(),n=(0,d.useSelect)((e=>e(qe).getIsWidgetAreaOpen(r)),[r]),{isInserterOpen:i,isListViewOpen:a}=(0,d.useSelect)((e=>{const{isInserterOpened:t,isListViewOpened:r}=e(qe);return{isInserterOpen:t(),isListViewOpen:r()}}),[]),{setIsWidgetAreaOpen:o,setIsInserterOpened:s,setIsListViewOpened:c}=(0,d.useDispatch)(qe),{selectBlock:u}=(0,d.useDispatch)(ge.store),m=(0,l.useCallback)((()=>c(!a)),[c,a]);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:"edit-widgets-header"},(0,l.createElement)("div",{className:"edit-widgets-header__navigable-toolbar-wrapper"},e&&(0,l.createElement)("h1",{className:"edit-widgets-header__title"},(0,E.__)("Widgets")),!e&&(0,l.createElement)(w.VisuallyHidden,{as:"h1",className:"edit-widgets-header__title"},(0,E.__)("Widgets")),(0,l.createElement)(ge.NavigableToolbar,{className:"edit-widgets-header-toolbar","aria-label":(0,E.__)("Document tools")},(0,l.createElement)(w.ToolbarItem,{ref:t,as:w.Button,className:"edit-widgets-header-toolbar__inserter-toggle",variant:"primary",isPressed:i,onMouseDown:e=>{e.preventDefault()},onClick:()=>{i?s(!1):(n||(u(r),o(r,!0)),window.requestAnimationFrame((()=>s(!0))))},icon:kt,label:(0,E._x)("Toggle block inserter","Generic label for block inserter button")}),e&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(Ct,null),(0,l.createElement)(xt,null),(0,l.createElement)(w.ToolbarItem,{as:w.Button,className:"edit-widgets-header-toolbar__list-view-toggle",icon:St,isPressed:a,label:(0,E.__)("List View"),onClick:m})))),(0,l.createElement)("div",{className:"edit-widgets-header__actions"},(0,l.createElement)(It,null),(0,l.createElement)(Z.Slot,{scope:"core/edit-widgets"}),(0,l.createElement)(Vt,null))))};var zt=function(){const{removeNotice:e}=(0,d.useDispatch)(me.store),{notices:t}=(0,d.useSelect)((e=>({notices:e(me.store).getNotices()})),[]),r=(0,I.filter)(t,{isDismissible:!0,type:"default"}),n=(0,I.filter)(t,{isDismissible:!1,type:"default"}),i=(0,I.filter)(t,{type:"snackbar"});return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(w.NoticeList,{notices:n,className:"edit-widgets-notices__pinned"}),(0,l.createElement)(w.NoticeList,{notices:r,className:"edit-widgets-notices__dismissible",onRemove:e}),(0,l.createElement)(w.SnackbarList,{notices:i,className:"edit-widgets-notices__snackbar",onRemove:e}))};function Ut(e){let{blockEditorSettings:t}=e;const r=(0,d.useSelect)((e=>e(U).isFeatureActive("core/edit-widgets","themeStyles")),[]),n=(0,l.useMemo)((()=>r?t.styles:[]),[t,r]);return(0,l.createElement)("div",{className:"edit-widgets-block-editor"},(0,l.createElement)(zt,null),(0,l.createElement)(ge.BlockTools,null,(0,l.createElement)(dt,null),(0,l.createElement)(ge.__unstableEditorStyles,{styles:n}),(0,l.createElement)(ge.BlockSelectionClearer,null,(0,l.createElement)(ge.WritingFlow,null,(0,l.createElement)(ge.ObserveTyping,null,(0,l.createElement)(ge.BlockList,{className:"edit-widgets-main-block-list"}))))))}var Ht=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.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 $t=()=>{const e=(0,d.useSelect)((e=>{var t;const{getEntityRecord:r}=e(m.store),n=r(he,Ee,"widget-areas");return null==n||null===(t=n.blocks[0])||void 0===t?void 0:t.clientId}),[]);return(0,d.useSelect)((t=>{const{getBlockRootClientId:r,getBlockSelectionEnd:n,getBlockOrder:i,getBlockIndex:a}=t(ge.store),o=t(qe).__experimentalGetInsertionPoint();if(o.rootClientId)return o;const s=n()||e,l=r(s);return s&&""===l?{rootClientId:s,insertionIndex:i(s).length}:{rootClientId:l,insertionIndex:a(s)+1}}),[e])};function jt(){const e=(0,ne.useViewportMatch)("medium","<"),{rootClientId:t,insertionIndex:r}=$t(),{setIsInserterOpened:n}=(0,d.useDispatch)(qe),i=(0,l.useCallback)((()=>()=>n(!1)),[n]),[a,o]=(0,ne.__experimentalUseDialog)({onClose:i});return(0,l.createElement)("div",p({ref:a},o,{className:"edit-widgets-layout__inserter-panel"}),(0,l.createElement)("div",{className:"edit-widgets-layout__inserter-panel-header"},(0,l.createElement)(w.Button,{icon:Ht,onClick:i})),(0,l.createElement)("div",{className:"edit-widgets-layout__inserter-panel-content"},(0,l.createElement)(ge.__experimentalLibrary,{showInserterHelpPanel:!0,shouldFocusBlock:e,rootClientId:t,__experimentalInsertionIndex:r})))}function Kt(){const{setIsListViewOpened:e}=(0,d.useDispatch)(qe),{clearSelectedBlock:t,selectBlock:r}=(0,d.useDispatch)(ge.store);const n=(0,ne.useFocusOnMount)("firstElement"),i=(0,ne.useFocusReturn)();const a=`edit-widgets-editor__list-view-panel-label-${(0,ne.useInstanceId)(Kt)}`;return(0,l.createElement)("div",{"aria-labelledby":a,className:"edit-widgets-editor__list-view-panel",onKeyDown:function(t){t.keyCode!==Nt.ESCAPE||t.defaultPrevented||(t.preventDefault(),e(!1))}},(0,l.createElement)("div",{className:"edit-widgets-editor__list-view-panel-header"},(0,l.createElement)("strong",{id:a},(0,E.__)("List view")),(0,l.createElement)(w.Button,{icon:S,label:(0,E.__)("Close list view sidebar"),onClick:()=>e(!1)})),(0,l.createElement)("div",{className:"edit-widgets-editor__list-view-panel-content",ref:(0,ne.useMergeRefs)([i,n])},(0,l.createElement)(ge.__experimentalListView,{onSelect:async function(e){await t(),r(e,-1)},showNestedBlocks:!0,__experimentalHideContainerBlockActions:!0,__experimentalFeatures:!0,__experimentalPersistentListViewFeatures:!0})))}function Yt(){const{isInserterOpen:e,isListViewOpen:t}=(0,d.useSelect)((e=>{const{isInserterOpened:t,isListViewOpened:r}=e(qe);return{isInserterOpen:t(),isListViewOpen:r()}}),[]);return e?(0,l.createElement)(jt,null):t?(0,l.createElement)(Kt,null):null}const qt={header:(0,E.__)("Widgets top bar"),body:(0,E.__)("Widgets and blocks"),sidebar:(0,E.__)("Widgets settings"),footer:(0,E.__)("Widgets footer")};var Qt=function(e){let{blockEditorSettings:t}=e;const r=(0,ne.useViewportMatch)("medium","<"),n=(0,ne.useViewportMatch)("huge",">="),{setIsInserterOpened:i,setIsListViewOpened:a,closeGeneralSidebar:o}=(0,d.useDispatch)(qe),{hasBlockBreadCrumbsEnabled:s,hasSidebarEnabled:c,isInserterOpened:u,isListViewOpened:m,previousShortcut:g,nextShortcut:p}=(0,d.useSelect)((e=>({hasSidebarEnabled:!!e(U).getActiveComplementaryArea(qe.name),isInserterOpened:!!e(qe).isInserterOpened(),isListViewOpened:!!e(qe).isListViewOpened(),hasBlockBreadCrumbsEnabled:e(U).isFeatureActive("core/edit-widgets","showBlockBreadcrumbs"),previousShortcut:e(lt.store).getAllShortcutKeyCombinations("core/edit-widgets/previous-region"),nextShortcut:e(lt.store).getAllShortcutKeyCombinations("core/edit-widgets/next-region")})),[]);(0,l.useEffect)((()=>{c&&!n&&(i(!1),a(!1))}),[c,n]),(0,l.useEffect)((()=>{!u&&!m||n||o()}),[u,m,n]);const _=m||u;return(0,l.createElement)(ie,{labels:qt,header:(0,l.createElement)(Gt,null),secondarySidebar:_&&(0,l.createElement)(Yt,null),sidebar:c&&(0,l.createElement)(re.Slot,{scope:"core/edit-widgets"}),content:(0,l.createElement)(Ut,{blockEditorSettings:t}),footer:s&&!r&&(0,l.createElement)("div",{className:"edit-widgets-layout__footer"},(0,l.createElement)(ge.BlockBreadcrumb,{rootLabelText:(0,E.__)("Widgets")})),shortcuts:{previous:g,next:p}})};function Jt(){const e=(0,d.useSelect)((e=>{const{getEditedWidgetAreas:t}=e(qe),r=t();return(null==r?void 0:r.length)>0}),[]);return(0,l.useEffect)((()=>{const t=t=>{if(e)return t.returnValue=(0,E.__)("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 Xt(){var e;const t=(0,d.useSelect)((e=>e(U).isFeatureActive("core/edit-widgets","welcomeGuide")),[]),{toggleFeature:r}=(0,d.useDispatch)(U),n=(0,d.useSelect)((e=>e(qe).getWidgetAreas({per_page:-1})),[]);if(!t)return null;const i=null==n?void 0:n.every((e=>"wp_inactive_widgets"===e.id||e.widgets.every((e=>e.startsWith("block-"))))),a=null!==(e=null==n?void 0:n.filter((e=>"wp_inactive_widgets"!==e.id)).length)&&void 0!==e?e:0;return(0,l.createElement)(w.Guide,{className:"edit-widgets-welcome-guide",contentLabel:(0,E.__)("Welcome to block Widgets"),finishButtonText:(0,E.__)("Get started"),onFinish:()=>r("core/edit-widgets","welcomeGuide"),pages:[{image:(0,l.createElement)(Zt,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-canvas.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-canvas.gif"}),content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)("h1",{className:"edit-widgets-welcome-guide__heading"},(0,E.__)("Welcome to block Widgets")),i?(0,l.createElement)(l.Fragment,null,(0,l.createElement)("p",{className:"edit-widgets-welcome-guide__text"},(0,E.sprintf)((0,E._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.",a),a))):(0,l.createElement)(l.Fragment,null,(0,l.createElement)("p",{className:"edit-widgets-welcome-guide__text"},(0,E.__)("You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.")),(0,l.createElement)("p",{className:"edit-widgets-welcome-guide__text"},(0,l.createElement)("strong",null,(0,E.__)("Want to stick with the old widgets?"))," ",(0,l.createElement)(w.ExternalLink,{href:(0,E.__)("https://wordpress.org/plugins/classic-widgets/")},(0,E.__)("Get the Classic Widgets plugin.")))))},{image:(0,l.createElement)(Zt,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-editor.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-editor.gif"}),content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)("h1",{className:"edit-widgets-welcome-guide__heading"},(0,E.__)("Make each block your own")),(0,l.createElement)("p",{className:"edit-widgets-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,l.createElement)(Zt,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-library.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-library.gif"}),content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)("h1",{className:"edit-widgets-welcome-guide__heading"},(0,E.__)("Get to know the block library")),(0,l.createElement)("p",{className:"edit-widgets-welcome-guide__text"},(0,l.createInterpolateElement)((0,E.__)("All of the blocks available to you live in the block library. You’ll find it wherever you see the icon."),{InserterIconImage:(0,l.createElement)("img",{className:"edit-widgets-welcome-guide__inserter-icon",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,l.createElement)(Zt,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.gif"}),content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)("h1",{className:"edit-widgets-welcome-guide__heading"},(0,E.__)("Learn how to use the block editor")),(0,l.createElement)("p",{className:"edit-widgets-welcome-guide__text"},(0,E.__)("New to the block editor? Want to learn more about using it? "),(0,l.createElement)(w.ExternalLink,{href:(0,E.__)("https://wordpress.org/support/article/wordpress-editor/")},(0,E.__)("Here's a detailed guide."))))}]})}function Zt(e){let{nonAnimatedSrc:t,animatedSrc:r}=e;return(0,l.createElement)("picture",{className:"edit-widgets-welcome-guide__image"},(0,l.createElement)("source",{srcSet:t,media:"(prefers-reduced-motion: reduce)"}),(0,l.createElement)("img",{src:r,width:"312",height:"240",alt:""}))}var er=function(e){let{blockEditorSettings:t,onError:r}=e;return(0,l.createElement)(ot,{onError:r},(0,l.createElement)(mt,{blockEditorSettings:t},(0,l.createElement)(Qt,{blockEditorSettings:t}),(0,l.createElement)(yt,null),(0,l.createElement)(w.Popover.Slot,null),(0,l.createElement)(H.PluginArea,null),(0,l.createElement)(Jt,null),(0,l.createElement)(Xt,null)))};const tr=["core/more","core/freeform","core/template-part","core/block"];function rr(e,t){(0,l.unmountComponentAtNode)(e);const r=rr.bind(null,e,t);(0,l.render)((0,l.createElement)(er,{blockEditorSettings:t,onError:r}),e)}function nr(e,t){const r=document.getElementById(e),n=rr.bind(null,r,t),i=(0,u.__experimentalGetCoreBlocks)().filter((e=>!(tr.includes(e.name)||e.name.startsWith("core/post")||e.name.startsWith("core/query")||e.name.startsWith("core/site")||e.name.startsWith("core/navigation"))));(0,d.dispatch)(U).setFeatureDefaults("core/edit-widgets",{fixedToolbar:!1,welcomeGuide:!0,showBlockBreadcrumbs:!0,themeStyles:!0}),(0,d.dispatch)(c.store).__experimentalReapplyBlockTypeFilters(),(0,u.registerCoreBlocks)(i),(0,g.registerLegacyWidgetBlock)(),(0,g.registerLegacyWidgetVariations)(t),ir(s),(0,g.registerWidgetGroupBlock)(),t.__experimentalFetchLinkSuggestions=(e,r)=>(0,m.__experimentalFetchLinkSuggestions)(e,r,t),(0,c.setFreeformContentHandlerName)("core/html"),(0,l.render)((0,l.createElement)(er,{blockEditorSettings:t,onError:n}),r)}const ir=e=>{if(!e)return;const{metadata:t,settings:r,name:n}=e;t&&(0,c.unstable__bootstrapServerSideBlockDefinitions)({[n]:t}),(0,c.registerBlockType)(n,r)}}(),(window.wp=window.wp||{}).editWidgets=n}();