KOTH_wordpress/wp_data/wp-includes/js/dist/edit-widgets.min.js
2023-02-19 18:03:46 -05:00

7 lines
57 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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

/*! This file is auto-generated */
!function(){var e={4403:function(e,t){var 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;t<arguments.length;t++){var r=arguments[t];if(r){var a=typeof r;if("string"===a||"number"===a)e.push(r);else if(Array.isArray(r)){if(r.length){var o=i.apply(null,r);o&&e.push(o)}}else if("object"===a){if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]")){e.push(r.toString());continue}for(var s in r)n.call(r,s)&&r[s]&&e.push(s)}}}return e.join(" ")}e.exports?(i.default=i,e.exports=i):void 0===(r=function(){return i}.apply(t,[]))||(e.exports=r)}()}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,r),a.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};!function(){"use strict";r.r(n),r.d(n,{initialize:function(){return rr},reinitializeEditor:function(){return tr}});var e={};r.r(e),r.d(e,{disableComplementaryArea:function(){return R},enableComplementaryArea:function(){return P},pinItem:function(){return L},setDefaultComplementaryArea:function(){return T},setFeatureDefaults:function(){return V},setFeatureValue:function(){return D},toggleFeature:function(){return M},unpinItem:function(){return O}});var t={};r.r(t),r.d(t,{getActiveComplementaryArea:function(){return F},isFeatureActive:function(){return z},isItemPinned:function(){return G}});var i={};r.r(i),r.d(i,{closeGeneralSidebar:function(){return Ce},moveBlockToWidgetArea:function(){return Be},persistStubPost:function(){return we},saveEditedWidgetAreas:function(){return fe},saveWidgetArea:function(){return Ee},saveWidgetAreas:function(){return be},setIsInserterOpened:function(){return Ie},setIsListViewOpened:function(){return Ae},setIsWidgetAreaOpen:function(){return Se},setWidgetAreasOpenState:function(){return ke},setWidgetIdForClientId:function(){return ye}});var a={};r.r(a),r.d(a,{getWidgetAreas:function(){return Ne},getWidgets:function(){return xe}});var o={};r.r(o),r.d(o,{__experimentalGetInsertionPoint:function(){return Ge},canInsertBlockInWidgetArea:function(){return ze},getEditedWidgetAreas:function(){return Oe},getIsWidgetAreaOpen:function(){return Ve},getParentWidgetAreaBlock:function(){return Le},getReferenceWidgetBlocks:function(){return Me},getWidget:function(){return Te},getWidgetAreaForWidgetId:function(){return Re},getWidgetAreas:function(){return Pe},getWidgets:function(){return We},isInserterOpened:function(){return Fe},isListViewOpened:function(){return He},isSavingWidgetAreas:function(){return De}});var s={};r.r(s),r.d(s,{metadata:function(){return Xe},name:function(){return Ze},settings:function(){return et}});var l=window.wp.element,c=window.wp.blocks,d=window.wp.data,u=window.wp.blockLibrary,m=window.wp.coreData,g=window.wp.widgets,p=window.wp.preferences,h=window.wp.apiFetch,_=r.n(h);var w=(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}}}),f=window.wp.i18n,b=window.wp.notices;function E(){return E=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},E.apply(this,arguments)}var v=r(4403),y=r.n(v),k=window.wp.components,S=window.wp.primitives;var I=(0,l.createElement)(S.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(S.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"}));var A=(0,l.createElement)(S.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(S.Path,{d:"M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z"}));var C=(0,l.createElement)(S.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(S.Path,{fillRule:"evenodd",d:"M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z",clipRule:"evenodd"})),B=window.wp.viewport;var N=(0,l.createElement)(S.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(S.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"})),x=window.wp.deprecated,W=r.n(x);const T=(e,t)=>({type:"SET_DEFAULT_COMPLEMENTARY_AREA",scope:e,area:t}),P=(e,t)=>r=>{let{registry:n,dispatch:i}=r;if(!t)return;n.select(p.store).get(e,"isComplementaryAreaVisible")||n.dispatch(p.store).set(e,"isComplementaryAreaVisible",!0),i({type:"ENABLE_COMPLEMENTARY_AREA",scope:e,area:t})},R=e=>t=>{let{registry:r}=t;r.select(p.store).get(e,"isComplementaryAreaVisible")&&r.dispatch(p.store).set(e,"isComplementaryAreaVisible",!1)},L=(e,t)=>r=>{let{registry:n}=r;if(!t)return;const i=n.select(p.store).get(e,"pinnedItems");!0!==(null==i?void 0:i[t])&&n.dispatch(p.store).set(e,"pinnedItems",{...i,[t]:!0})},O=(e,t)=>r=>{let{registry:n}=r;if(!t)return;const i=n.select(p.store).get(e,"pinnedItems");n.dispatch(p.store).set(e,"pinnedItems",{...i,[t]:!1})};function M(e,t){return function(r){let{registry:n}=r;W()("dispatch( 'core/interface' ).toggleFeature",{since:"6.0",alternative:"dispatch( 'core/preferences' ).toggle"}),n.dispatch(p.store).toggle(e,t)}}function D(e,t,r){return function(n){let{registry:i}=n;W()("dispatch( 'core/interface' ).setFeatureValue",{since:"6.0",alternative:"dispatch( 'core/preferences' ).set"}),i.dispatch(p.store).set(e,t,!!r)}}function V(e,t){return function(r){let{registry:n}=r;W()("dispatch( 'core/interface' ).setFeatureDefaults",{since:"6.0",alternative:"dispatch( 'core/preferences' ).setDefaults"}),n.dispatch(p.store).setDefaults(e,t)}}const F=(0,d.createRegistrySelector)((e=>(t,r)=>{var n;const i=e(p.store).get(r,"isComplementaryAreaVisible");if(void 0!==i)return i?null==t||null===(n=t.complementaryAreas)||void 0===n?void 0:n[r]:null})),G=(0,d.createRegistrySelector)((e=>(t,r,n)=>{var i;const a=e(p.store).get(r,"pinnedItems");return null===(i=null==a?void 0:a[n])||void 0===i||i})),z=(0,d.createRegistrySelector)((e=>(t,r,n)=>(W()("select( 'core/interface' ).isFeatureActive( scope, featureName )",{since:"6.0",alternative:"select( 'core/preferences' ).get( scope, featureName )"}),!!e(p.store).get(r,n))));var H=(0,d.combineReducers)({complementaryAreas: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_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}});const U=(0,d.createReduxStore)("core/interface",{reducer:H,actions:e,selectors:t});(0,d.register)(U);var j=window.wp.plugins,$=(0,j.withPluginContext)(((e,t)=>({icon:t.icon||e.icon,identifier:t.identifier||`${e.name}/${t.name}`})));var Y=$((function(e){let{as:t=k.Button,scope:r,identifier:n,icon:i,selectedIcon:a,name:o,...s}=e;const c=t,u=(0,d.useSelect)((e=>e(U).getActiveComplementaryArea(r)===n),[n]),{enableComplementaryArea:m,disableComplementaryArea:g}=(0,d.useDispatch)(U);return(0,l.createElement)(c,E({icon:a&&u?a:i,onClick:()=>{u?g(r):m(r,n)}},s))}));var K=e=>{let{smallScreenTitle:t,children:r,className:n,toggleButtonProps:i}=e;const a=(0,l.createElement)(Y,E({icon:N},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:y()("components-panel__header","interface-complementary-area-header",n),tabIndex:-1},r,a))};const q=()=>{};function Q(e){let{name:t,as:r=k.Button,onClick:n,...i}=e;return(0,l.createElement)(k.Fill,{name:t},(e=>{let{onClick:t}=e;return(0,l.createElement)(r,E({onClick:n||t?function(){(n||q)(...arguments),(t||q)(...arguments)}:void 0},i))}))}Q.Slot=function(e){let{name:t,as:r=k.ButtonGroup,fillProps:n={},bubblesVirtually:i,...a}=e;return(0,l.createElement)(k.Slot,{name:t,bubblesVirtually:i,fillProps:n},(e=>{if(!l.Children.toArray(e).length)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 J=Q;const X=e=>{let{__unstableExplicitMenuItem:t,__unstableTarget:r,...n}=e;return(0,l.createElement)(k.MenuItem,n)};function Z(e){let{scope:t,target:r,__unstableExplicitMenuItem:n,...i}=e;return(0,l.createElement)(Y,E({as:e=>(0,l.createElement)(J,E({__unstableExplicitMenuItem:n,__unstableTarget:`${t}/${r}`,as:X,name:`${t}/plugin-more-menu`},e)),role:"menuitemcheckbox",selectedIcon:I,name:r,scope:t},i))}function ee(e){let{scope:t,...r}=e;return(0,l.createElement)(k.Fill,E({name:`PinnedItems/${t}`},r))}ee.Slot=function(e){let{scope:t,className:r,...n}=e;return(0,l.createElement)(k.Slot,E({name:`PinnedItems/${t}`},n),(e=>(null==e?void 0:e.length)>0&&(0,l.createElement)("div",{className:y()(r,"interface-pinned-items")},e)))};var te=ee;function re(e){let{scope:t,children:r,className:n}=e;return(0,l.createElement)(k.Fill,{name:`ComplementaryArea/${t}`},(0,l.createElement)("div",{className:n},r))}const ne=$((function(e){let{children:t,className:r,closeLabel:n=(0,f.__)("Close plugin"),identifier:i,header:a,headerClassName:o,icon:s,isPinnable:c=!0,panelClassName:u,scope:m,name:g,smallScreenTitle:p,title:h,toggleShortcut:_,isActiveByDefault:w,showIconLabels:b=!1}=e;const{isActive:E,isPinned:v,activeArea:S,isSmall:N,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(B.store).isViewportMatch("< medium"),isLarge:e(B.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,S,E,N);const{enableComplementaryArea:W,disableComplementaryArea:T,pinItem:P,unpinItem:R}=(0,d.useDispatch)(U);return(0,l.useEffect)((()=>{w&&void 0===S&&!N&&W(m,i)}),[S,w,m,i,N]),(0,l.createElement)(l.Fragment,null,c&&(0,l.createElement)(te,{scope:m},v&&(0,l.createElement)(Y,{scope:m,identifier:i,isPressed:E&&(!b||x),"aria-expanded":E,label:h,icon:b?I:s,showTooltip:!b,variant:b?"tertiary":void 0})),g&&c&&(0,l.createElement)(Z,{target:g,scope:m,icon:s},h),E&&(0,l.createElement)(re,{className:y()("interface-complementary-area",r),scope:m},(0,l.createElement)(K,{className:o,closeLabel:n,onClose:()=>T(m),smallScreenTitle:p,toggleButtonProps:{label:n,shortcut:_,scope:m,identifier:i}},a||(0,l.createElement)(l.Fragment,null,(0,l.createElement)("strong",null,h),c&&(0,l.createElement)(k.Button,{className:"interface-complementary-area__pin-unpin-item",icon:v?A:C,label:v?(0,f.__)("Unpin from toolbar"):(0,f.__)("Pin to toolbar"),onClick:()=>(v?R:P)(m,i),isPressed:v,"aria-expanded":v}))),(0,l.createElement)(k.Panel,{className:u},t)))}));ne.Slot=function(e){let{scope:t,...r}=e;return(0,l.createElement)(k.Slot,E({name:`ComplementaryArea/${t}`},r))};var ie=ne,ae=window.wp.compose;var oe=(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 p=(0,k.__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 h={...{drawer:(0,f.__)("Drawer"),header:(0,f.__)("Header"),body:(0,f.__)("Content"),secondarySidebar:(0,f.__)("Block Library"),sidebar:(0,f.__)("Settings"),actions:(0,f.__)("Publish"),footer:(0,f.__)("Footer")},...u};return(0,l.createElement)("div",E({},p,{ref:(0,ae.useMergeRefs)([t,p.ref]),className:y()(m,"interface-interface-skeleton",p.className,!!r&&"has-footer")}),!!c&&(0,l.createElement)("div",{className:"interface-interface-skeleton__drawer",role:"region","aria-label":h.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":h.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":h.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":h.body,tabIndex:"-1"},s),!!i&&(0,l.createElement)("div",{className:"interface-interface-skeleton__sidebar",role:"region","aria-label":h.sidebar,tabIndex:"-1"},i),!!d&&(0,l.createElement)("div",{className:"interface-interface-skeleton__actions",role:"region","aria-label":h.actions,tabIndex:"-1"},d))),!!r&&(0,l.createElement)("div",{className:"interface-interface-skeleton__footer",role:"region","aria-label":h.footer,tabIndex:"-1"},r))}));var se=(0,l.createElement)(S.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(S.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"}));function le(e){let{as:t=k.DropdownMenu,className:r,label:n=(0,f.__)("Options"),popoverProps:i,toggleProps:a,children:o}=e;return(0,l.createElement)(t,{className:y()("interface-more-menu-dropdown",r),icon:se,label:n,popoverProps:{position:"bottom left",...i,className:y()("interface-more-menu-dropdown__content",null==i?void 0:i.className)},toggleProps:{tooltipPosition:"bottom",...a}},(e=>o(e)))}var ce=window.wp.blockEditor;function de(e){if("block"===e.id_base){const t=(0,c.parse)(e.instance.raw.content,{__unstableSkipAutop:!0});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 ue(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 me="root",ge="sidebar",pe="postType",he=e=>`widget-area-${e}`;const _e="core/edit-widgets",we=(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(me,pe,i,{id:i.id},!1),i},fe=()=>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(b.store).createSuccessNotice((0,f.__)("Widgets saved."),{type:"snackbar"})}catch(e){n.dispatch(b.store).createErrorNotice((0,f.sprintf)((0,f.__)("There was an error. %s"),e.message),{type:"snackbar"})}},be=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",me,ge,{per_page:-1})}},Ee=e=>async t=>{let{dispatch:r,select:n,registry:i}=t;const a=n.getWidgets(),o=i.select(m.store).getEditedEntityRecord(me,pe,he(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=[],h=[];for(let t=0;t<c.length;t++){const r=c[t],n=(0,g.getWidgetIdFromBlock)(r),o=a[n],s=ue(r,o);if(h.push(n),o){i.dispatch(m.store).editEntityRecord("root","widget",n,{...s,sidebar:e},{undoIgnore:!0});if(!i.select(m.store).hasEditsForEntityRecord("root","widget",n))continue;p.push((e=>{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 _=(await i.dispatch(m.store).__experimentalBatch(p)).filter((e=>!e.hasOwnProperty("deleted"))),w=[];for(let e=0;e<_.length;e++){const t=_[e],{block:r,position:n}=u[e];o.blocks[n].attributes.__internalWidgetId=t.id;var b;if(i.select(m.store).getLastEntitySaveError("root","widget",t.id))w.push((null===(b=r.attributes)||void 0===b?void 0:b.name)||(null==r?void 0:r.name));h[n]||(h[n]=t.id)}if(w.length)throw new Error((0,f.sprintf)((0,f.__)("Could not save the following widgets: %s."),w.join(", ")));i.dispatch(m.store).editEntityRecord(me,ge,e,{widgets:h},{undoIgnore:!0}),r(ve(e)),i.dispatch(m.store).receiveEntityRecords(me,pe,o,void 0)},ve=e=>t=>{let{registry:r}=t;r.dispatch(m.store).saveEditedEntityRecord(me,ge,e,{throwOnError:!0})};function ye(e,t){return{type:"SET_WIDGET_ID_FOR_CLIENT_ID",clientId:e,widgetId:t}}function ke(e){return{type:"SET_WIDGET_AREAS_OPEN_STATE",widgetAreasOpenState:e}}function Se(e,t){return{type:"SET_IS_WIDGET_AREA_OPEN",clientId:e,isOpen:t}}function Ie(e){return{type:"SET_IS_INSERTER_OPENED",value:e}}function Ae(e){return{type:"SET_IS_LIST_VIEW_OPENED",isOpen:e}}const Ce=()=>e=>{let{registry:t}=e;t.dispatch(U).disableComplementaryArea(_e)},Be=(e,t)=>async r=>{let{dispatch:n,select:i,registry:a}=r;const o=a.select(ce.store).getBlockRootClientId([e]),s=a.select(ce.store).getBlocks().find((e=>{let{attributes:r}=e;return r.id===t})).clientId,l=a.select(ce.store).getBlockOrder(s).length;i.getIsWidgetAreaOpen(s)||n.setIsWidgetAreaOpen(s,!0),a.dispatch(ce.store).moveBlocksToPosition([e],o,s,l)},Ne=()=>async e=>{let{dispatch:t,registry:r}=e;const n={per_page:-1},i=[],a=(await r.resolveSelect(m.store).getEntityRecords(me,ge,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(we(he(e.id),[]));const o={};i.forEach(((e,t)=>{o[e.clientId]=0===t})),t(ke(o)),t(we("widget-areas",i))},xe=()=>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=de(e);a[e.sidebar]=a[e.sidebar]||[],a[e.sidebar].push(t)}for(const e in a)a.hasOwnProperty(e)&&t(we(he(e),a[e]))},We=(0,d.createRegistrySelector)((e=>()=>{const t=e(m.store).getEntityRecords("root","widget",{per_page:-1,_embed:"about"});return(null==t?void 0:t.reduce(((e,t)=>({...e,[t.id]:t})),{}))||{}})),Te=(0,d.createRegistrySelector)((e=>(t,r)=>e(_e).getWidgets()[r])),Pe=(0,d.createRegistrySelector)((e=>()=>{const t={per_page:-1};return e(m.store).getEntityRecords(me,ge,t)})),Re=(0,d.createRegistrySelector)((e=>(t,r)=>e(_e).getWidgetAreas().find((t=>e(m.store).getEditedEntityRecord(me,pe,he(t.id)).blocks.map((e=>(0,g.getWidgetIdFromBlock)(e))).includes(r))))),Le=(0,d.createRegistrySelector)((e=>(t,r)=>{const{getBlock:n,getBlockName:i,getBlockParents:a}=e(ce.store);return n(a(r).find((e=>"core/widget-area"===i(e))))})),Oe=(0,d.createRegistrySelector)((e=>(t,r)=>{let n=e(_e).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(me,pe,he(r))})).map((t=>{let{id:r}=t;return e(m.store).getEditedEntityRecord(me,ge,r)}))):[]})),Me=(0,d.createRegistrySelector)((e=>function(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const n=[],i=e(_e).getWidgetAreas();for(const t of i){const i=e(m.store).getEditedEntityRecord(me,pe,he(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})),De=(0,d.createRegistrySelector)((e=>()=>{var t;const r=null===(t=e(_e).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(me,ge,t))return!0}const n=[...Object.keys(e(_e).getWidgets()),void 0];for(const t of n){if(e(m.store).isSavingEntityRecord("root","widget",t))return!0}return!1})),Ve=(e,t)=>{const{widgetAreasOpenState:r}=e;return!!r[t]};function Fe(e){return!!e.blockInserterPanel}function Ge(e){const{rootClientId:t,insertionIndex:r}=e.blockInserterPanel;return{rootClientId:t,insertionIndex:r}}const ze=(0,d.createRegistrySelector)((e=>(t,r)=>{const n=e(ce.store).getBlocks(),[i]=n;return e(ce.store).canInsertBlockType(r,i.clientId)}));function He(e){return e.listViewPanel}const Ue={reducer:w,selectors:o,resolvers:a,actions:i},je=(0,d.createReduxStore)(_e,Ue);(0,d.register)(je),_().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 $e=window.wp.hooks;const Ye=(0,ae.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(je),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)(je),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)(ce.BlockControls,null,(0,l.createElement)(g.MoveToWidgetArea,{widgetAreas:i,currentWidgetAreaId:a,onSelect:e=>{s(t.clientId,e)}})))}),"withMoveToWidgetAreaToolbarItem");(0,$e.addFilter)("editor.BlockEdit","core/edit-widgets/block-edit",Ye);var Ke=window.wp.mediaUtils;(0,$e.addFilter)("editor.MediaUpload","core/edit-widgets/replace-media-upload",(()=>Ke.MediaUpload));var qe=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 Qe(e){let{id:t}=e;const[r,n,i]=(0,m.useEntityBlockEditor)("root","postType"),a=(0,l.useRef)(),o=qe(a),s=(0,ce.useInnerBlocksProps)({ref:a},{value:r,onInput:n,onChange:i,templateLock:!1,renderAppender:ce.InnerBlocks.ButtonBlockAppender});return(0,l.createElement)("div",{"data-widget-area-id":t,className:y()("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 Je=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},Xe={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:Ze}=Xe,et={title:(0,f.__)("Widget Area"),description:(0,f.__)("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(je).getIsWidgetAreaOpen(t)),[t]),{setIsWidgetAreaOpen:o}=(0,d.useDispatch)(je),s=(0,l.useRef)(),c=(0,l.useCallback)((e=>o(t,e)),[t]),u=Je(s),g=qe(s),[p,h]=(0,l.useState)(!1);return(0,l.useEffect)((()=>{u?g&&!a?(c(!0),h(!0)):!g&&a&&p&&c(!1):h(!1)}),[a,u,g,p]),(0,l.createElement)(k.Panel,{className:r,ref:s},(0,l.createElement)(k.PanelBody,{title:i,opened:a,onToggle:()=>{o(t,!a)},scrollAfterOpen:!u},(e=>{let{opened:t}=e;return(0,l.createElement)(k.__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)(Qe,{id:n})))})))}};function tt(e){let{text:t,children:r}=e;const n=(0,ae.useCopyToClipboard)(t);return(0,l.createElement)(k.Button,{variant:"secondary",ref:n},r)}class rt extends l.Component{constructor(){super(...arguments),this.reboot=this.reboot.bind(this),this.state={error:null}}componentDidCatch(e){this.setState({error:e}),(0,$e.doAction)("editor.ErrorBoundary.errorLogged",e)}reboot(){this.props.onError()}render(){const{error:e}=this.state;return e?(0,l.createElement)(ce.Warning,{className:"edit-widgets-error-boundary",actions:[(0,l.createElement)(k.Button,{key:"recovery",onClick:this.reboot,variant:"secondary"},(0,f.__)("Attempt Recovery")),(0,l.createElement)(tt,{key:"copy-error",text:e.stack},(0,f.__)("Copy Error"))]},(0,f.__)("The editor has encountered an unexpected error.")):this.props.children}}var nt=window.wp.reusableBlocks,it=window.wp.keyboardShortcuts;function at(){const{redo:e,undo:t}=(0,d.useDispatch)(m.store),{saveEditedWidgetAreas:r}=(0,d.useDispatch)(je);return(0,it.useShortcut)("core/edit-widgets/undo",(e=>{t(),e.preventDefault()})),(0,it.useShortcut)("core/edit-widgets/redo",(t=>{e(),t.preventDefault()})),(0,it.useShortcut)("core/edit-widgets/save",(e=>{e.preventDefault(),r()})),null}at.Register=function(){const{registerShortcut:e}=(0,d.useDispatch)(it.store);return(0,l.useEffect)((()=>{e({name:"core/edit-widgets/undo",category:"global",description:(0,f.__)("Undo your last changes."),keyCombination:{modifier:"primary",character:"z"}}),e({name:"core/edit-widgets/redo",category:"global",description:(0,f.__)("Redo your last undo."),keyCombination:{modifier:"primaryShift",character:"z"}}),e({name:"core/edit-widgets/save",category:"global",description:(0,f.__)("Save your changes."),keyCombination:{modifier:"primary",character:"s"}}),e({name:"core/edit-widgets/keyboard-shortcuts",category:"main",description:(0,f.__)("Display these keyboard shortcuts."),keyCombination:{modifier:"access",character:"h"}}),e({name:"core/edit-widgets/next-region",category:"global",description:(0,f.__)("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,f.__)("Navigate to the previous part of the editor."),keyCombination:{modifier:"ctrlShift",character:"`"},aliases:[{modifier:"access",character:"p"}]})}),[e]),null};var ot=at;var st=()=>(0,d.useSelect)((e=>{var t;const{getBlockSelectionEnd:r,getBlockName:n}=e(ce.store),i=r();if("core/widget-area"===n(i))return i;const{getParentWidgetAreaBlock:a}=e(je),o=a(i),s=null==o?void 0:o.clientId;if(s)return s;const{getEntityRecord:l}=e(m.store),c=l(me,pe,"widget-areas");return null==c||null===(t=c.blocks[0])||void 0===t?void 0:t.clientId}),[]);function lt(e){let{blockEditorSettings:t,children:r,...n}=e;const i=(0,m.useResourcePermissions)("media"),{reusableBlocks:a,isFixedToolbarActive:o,keepCaretInsideBlock:s}=(0,d.useSelect)((e=>({widgetAreas:e(je).getWidgetAreas(),widgets:e(je).getWidgets(),reusableBlocks:[],isFixedToolbarActive:!!e(p.store).get("core/edit-widgets","fixedToolbar"),keepCaretInsideBlock:!!e(p.store).get("core/edit-widgets","keepCaretInsideBlock")})),[]),{setIsInserterOpened:c}=(0,d.useDispatch)(je),u=(0,l.useMemo)((()=>{let e;return i.canCreate&&(e=e=>{let{onError:r,...n}=e;(0,Ke.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.canCreate,a,c]),g=st(),[h,_,w]=(0,m.useEntityBlockEditor)(me,pe,{id:"widget-areas"});return(0,l.createElement)(it.ShortcutProvider,null,(0,l.createElement)(ce.BlockEditorKeyboardShortcuts.Register,null),(0,l.createElement)(ot.Register,null),(0,l.createElement)(k.SlotFillProvider,null,(0,l.createElement)(ce.BlockEditorProvider,E({value:h,onInput:_,onChange:w,settings:u,useSubRegistry:!1},n),(0,l.createElement)(ce.CopyHandler,null,r),(0,l.createElement)(nt.ReusableBlocksMenuItems,{rootClientId:g}))))}var ct=(0,l.createElement)(S.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(S.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 dt=(0,l.createElement)(S.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(S.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"})),ut=window.wp.url,mt=window.wp.dom;function gt(e){let{selectedWidgetAreaId:t}=e;const r=(0,d.useSelect)((e=>e(je).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,f.__)("Blocks in this Widget Area will not be displayed in your site."):n.description:(0,f.__)("Widget Areas are global parts in your sites 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)(ce.BlockIcon,{icon:dt}),(0,l.createElement)("div",null,(0,l.createElement)("p",{dangerouslySetInnerHTML:{__html:(0,mt.safeHTML)(i)}}),0===(null==r?void 0:r.length)&&(0,l.createElement)("p",null,(0,f.__)("Your theme does not contain any Widget Areas.")),!n&&(0,l.createElement)(k.Button,{href:(0,ut.addQueryArgs)("customize.php",{"autofocus[panel]":"widgets",return:window.location.pathname}),variant:"tertiary"},(0,f.__)("Manage with live preview")))))}const pt=l.Platform.select({web:!0,native:!1}),ht="edit-widgets/block-inspector",_t="edit-widgets/block-areas";function wt(e){let{identifier:t,label:r,isActive:n}=e;const{enableComplementaryArea:i}=(0,d.useDispatch)(U);return(0,l.createElement)(k.Button,{onClick:()=>i(je.name,t),className:y()("edit-widgets-sidebar__panel-tab",{"is-active":n}),"aria-label":n?(0,f.sprintf)((0,f.__)("%s (selected)"),r):r,"data-label":r},r)}function ft(){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(ce.store),{getActiveComplementaryArea:i}=e(U),a=t(),o=i(je.name);let s,l=o;return l||(l=a?ht:_t),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===_t&&n&&e("core/edit-widgets",ht),!r&&t===ht&&n&&e("core/edit-widgets",_t)}),[r,e]),(0,l.createElement)(ie,{className:"edit-widgets-sidebar",header:(0,l.createElement)("ul",null,(0,l.createElement)("li",null,(0,l.createElement)(wt,{identifier:_t,label:i?i.attributes.name:(0,f.__)("Widget Areas"),isActive:t===_t})),(0,l.createElement)("li",null,(0,l.createElement)(wt,{identifier:ht,label:(0,f.__)("Block"),isActive:t===ht}))),headerClassName:"edit-widgets-sidebar__panel-tabs",title:(0,f.__)("Settings"),closeLabel:(0,f.__)("Close settings"),scope:"core/edit-widgets",identifier:t,icon:ct,isActiveByDefault:pt},t===_t&&(0,l.createElement)(gt,{selectedWidgetAreaId:null==i?void 0:i.attributes.id}),t===ht&&(r?(0,l.createElement)(ce.BlockInspector,null):(0,l.createElement)("span",{className:"block-editor-block-inspector__no-blocks"},(0,f.__)("No block selected."))))}var bt=(0,l.createElement)(S.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(S.Path,{d:"M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"}));var Et=(0,l.createElement)(S.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(S.Path,{d:"M13.8 5.2H3v1.5h10.8V5.2zm-3.6 12v1.5H21v-1.5H10.2zm7.2-6H6.6v1.5h10.8v-1.5z"}));var vt=function(){const{hasEditedWidgetAreaIds:e,isSaving:t}=(0,d.useSelect)((e=>{var t;const{getEditedWidgetAreas:r,isSavingWidgetAreas:n}=e(je);return{hasEditedWidgetAreaIds:(null===(t=r())||void 0===t?void 0:t.length)>0,isSaving:n()}}),[]),{saveEditedWidgetAreas:r}=(0,d.useDispatch)(je);return(0,l.createElement)(k.Button,{variant:"primary",isBusy:t,"aria-disabled":t,onClick:t?void 0:r,disabled:!e},t?(0,f.__)("Saving…"):(0,f.__)("Update"))};var yt=(0,l.createElement)(S.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(S.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 kt=(0,l.createElement)(S.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(S.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"})),St=window.wp.keycodes;function It(){const e=(0,d.useSelect)((e=>e(m.store).hasUndo()),[]),{undo:t}=(0,d.useDispatch)(m.store);return(0,l.createElement)(k.ToolbarButton,{icon:(0,f.isRTL)()?kt:yt,label:(0,f.__)("Undo"),shortcut:St.displayShortcut.primary("z"),"aria-disabled":!e,onClick:e?t:void 0})}function At(){const e=(0,St.isAppleOS)()?St.displayShortcut.primaryShift("z"):St.displayShortcut.primary("y"),t=(0,d.useSelect)((e=>e(m.store).hasRedo()),[]),{redo:r}=(0,d.useDispatch)(m.store);return(0,l.createElement)(k.ToolbarButton,{icon:(0,f.isRTL)()?yt:kt,label:(0,f.__)("Redo"),shortcut:e,"aria-disabled":!t,onClick:t?r:void 0})}var Ct=(0,l.createElement)(S.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(S.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 Bt=[{keyCombination:{modifier:"primary",character:"b"},description:(0,f.__)("Make the selected text bold.")},{keyCombination:{modifier:"primary",character:"i"},description:(0,f.__)("Make the selected text italic.")},{keyCombination:{modifier:"primary",character:"k"},description:(0,f.__)("Convert the selected text into a link.")},{keyCombination:{modifier:"primaryShift",character:"k"},description:(0,f.__)("Remove a link.")},{keyCombination:{character:"[["},description:(0,f.__)("Insert a link to a post or page")},{keyCombination:{modifier:"primary",character:"u"},description:(0,f.__)("Underline the selected text.")},{keyCombination:{modifier:"access",character:"d"},description:(0,f.__)("Strikethrough the selected text.")},{keyCombination:{modifier:"access",character:"x"},description:(0,f.__)("Make the selected text inline code.")}];function Nt(e){let{keyCombination:t,forceAriaLabel:r}=e;const n=t.modifier?St.displayShortcutList[t.modifier](t.character):t.character,i=t.modifier?St.shortcutAriaLabel[t.modifier](t.character):t.character,a=Array.isArray(n)?n:[n];return(0,l.createElement)("kbd",{className:"edit-widgets-keyboard-shortcut-help-modal__shortcut-key-combination","aria-label":r||i},a.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 xt=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)(Nt,{keyCombination:r,forceAriaLabel:i}),n.map(((e,t)=>(0,l.createElement)(Nt,{keyCombination:e,forceAriaLabel:i,key:t})))))};var Wt=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(it.store);return{keyCombination:r(t),aliases:i(t),description:n(t)}}),[t]);return r?(0,l.createElement)(xt,{keyCombination:r,description:n,aliases:i}):null};const Tt=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},"string"==typeof e?(0,l.createElement)(Wt,{name:e}):(0,l.createElement)(xt,e)))))},Pt=e=>{let{title:t,shortcuts:r,className:n}=e;return(0,l.createElement)("section",{className:y()("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)(Tt,{shortcuts:r}))},Rt=e=>{let{title:t,categoryName:r,additionalShortcuts:n=[]}=e;const i=(0,d.useSelect)((e=>e(it.store).getCategoryShortcuts(r)),[r]);return(0,l.createElement)(Pt,{title:t,shortcuts:i.concat(n)})};function Lt(e){let{isModalActive:t,toggleModal:r}=e;return(0,it.useShortcut)("core/edit-widgets/keyboard-shortcuts",r,{bindGlobal:!0}),t?(0,l.createElement)(k.Modal,{className:"edit-widgets-keyboard-shortcut-help-modal",title:(0,f.__)("Keyboard shortcuts"),closeLabel:(0,f.__)("Close"),onRequestClose:r},(0,l.createElement)(Pt,{className:"edit-widgets-keyboard-shortcut-help-modal__main-shortcuts",shortcuts:["core/edit-widgets/keyboard-shortcuts"]}),(0,l.createElement)(Rt,{title:(0,f.__)("Global shortcuts"),categoryName:"global"}),(0,l.createElement)(Rt,{title:(0,f.__)("Selection shortcuts"),categoryName:"selection"}),(0,l.createElement)(Rt,{title:(0,f.__)("Block shortcuts"),categoryName:"block",additionalShortcuts:[{keyCombination:{character:"/"},description:(0,f.__)("Change the block type after adding a new paragraph."),ariaLabel:(0,f.__)("Forward-slash")}]}),(0,l.createElement)(Pt,{title:(0,f.__)("Text formatting"),shortcuts:Bt})):null}const{Fill:Ot,Slot:Mt}=(0,k.createSlotFill)("EditWidgetsToolsMoreMenuGroup");Ot.Slot=e=>{let{fillProps:t}=e;return(0,l.createElement)(Mt,{fillProps:t},(e=>e.length>0&&e))};var Dt=Ot;function Vt(){const[e,t]=(0,l.useState)(!1),r=()=>t(!e);(0,it.useShortcut)("core/edit-widgets/keyboard-shortcuts",r);const n=(0,ae.useViewportMatch)("medium");return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(le,null,(e=>(0,l.createElement)(l.Fragment,null,n&&(0,l.createElement)(k.MenuGroup,{label:(0,f._x)("View","noun")},(0,l.createElement)(p.PreferenceToggleMenuItem,{scope:"core/edit-widgets",name:"fixedToolbar",label:(0,f.__)("Top toolbar"),info:(0,f.__)("Access all block and document tools in a single place"),messageActivated:(0,f.__)("Top toolbar activated"),messageDeactivated:(0,f.__)("Top toolbar deactivated")})),(0,l.createElement)(k.MenuGroup,{label:(0,f.__)("Tools")},(0,l.createElement)(k.MenuItem,{onClick:()=>{t(!0)},shortcut:St.displayShortcut.access("h")},(0,f.__)("Keyboard shortcuts")),(0,l.createElement)(p.PreferenceToggleMenuItem,{scope:"core/edit-widgets",name:"welcomeGuide",label:(0,f.__)("Welcome Guide")}),(0,l.createElement)(k.MenuItem,{role:"menuitem",icon:Ct,href:(0,f.__)("https://wordpress.org/support/article/block-based-widgets-editor/"),target:"_blank",rel:"noopener noreferrer"},(0,f.__)("Help"),(0,l.createElement)(k.VisuallyHidden,{as:"span"},(0,f.__)("(opens in a new tab)"))),(0,l.createElement)(Dt.Slot,{fillProps:{onClose:e}})),(0,l.createElement)(k.MenuGroup,{label:(0,f.__)("Preferences")},(0,l.createElement)(p.PreferenceToggleMenuItem,{scope:"core/edit-widgets",name:"keepCaretInsideBlock",label:(0,f.__)("Contain text cursor inside block"),info:(0,f.__)("Aids screen readers by stopping text caret from leaving blocks."),messageActivated:(0,f.__)("Contain text cursor inside block activated"),messageDeactivated:(0,f.__)("Contain text cursor inside block deactivated")}),(0,l.createElement)(p.PreferenceToggleMenuItem,{scope:"core/edit-widgets",name:"themeStyles",info:(0,f.__)("Make the editor look like your theme."),label:(0,f.__)("Use theme styles")}),n&&(0,l.createElement)(p.PreferenceToggleMenuItem,{scope:"core/edit-widgets",name:"showBlockBreadcrumbs",label:(0,f.__)("Display block breadcrumbs"),info:(0,f.__)("Shows block breadcrumbs at the bottom of the editor."),messageActivated:(0,f.__)("Display block breadcrumbs activated"),messageDeactivated:(0,f.__)("Display block breadcrumbs deactivated")}))))),(0,l.createElement)(Lt,{isModalActive:e,toggleModal:r}))}var Ft=function(){const e=(0,ae.useViewportMatch)("medium"),t=(0,l.useRef)(),r=st(),n=(0,d.useSelect)((e=>e(je).getIsWidgetAreaOpen(r)),[r]),{isInserterOpen:i,isListViewOpen:a}=(0,d.useSelect)((e=>{const{isInserterOpened:t,isListViewOpened:r}=e(je);return{isInserterOpen:t(),isListViewOpen:r()}}),[]),{setIsWidgetAreaOpen:o,setIsInserterOpened:s,setIsListViewOpened:c}=(0,d.useDispatch)(je),{selectBlock:u}=(0,d.useDispatch)(ce.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,f.__)("Widgets")),!e&&(0,l.createElement)(k.VisuallyHidden,{as:"h1",className:"edit-widgets-header__title"},(0,f.__)("Widgets")),(0,l.createElement)(ce.NavigableToolbar,{className:"edit-widgets-header-toolbar","aria-label":(0,f.__)("Document tools")},(0,l.createElement)(k.ToolbarItem,{ref:t,as:k.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:bt,label:(0,f._x)("Toggle block inserter","Generic label for block inserter button")}),e&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(It,null),(0,l.createElement)(At,null),(0,l.createElement)(k.ToolbarItem,{as:k.Button,className:"edit-widgets-header-toolbar__list-view-toggle",icon:Et,isPressed:a,label:(0,f.__)("List View"),onClick:m})))),(0,l.createElement)("div",{className:"edit-widgets-header__actions"},(0,l.createElement)(vt,null),(0,l.createElement)(te.Slot,{scope:"core/edit-widgets"}),(0,l.createElement)(Vt,null))))};var Gt=function(){const{removeNotice:e}=(0,d.useDispatch)(b.store),{notices:t}=(0,d.useSelect)((e=>({notices:e(b.store).getNotices()})),[]),r=t.filter((e=>{let{isDismissible:t,type:r}=e;return t&&"default"===r})),n=t.filter((e=>{let{isDismissible:t,type:r}=e;return!t&&"default"===r})),i=t.filter((e=>{let{type:t}=e;return"snackbar"===t}));return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(k.NoticeList,{notices:n,className:"edit-widgets-notices__pinned"}),(0,l.createElement)(k.NoticeList,{notices:r,className:"edit-widgets-notices__dismissible",onRemove:e}),(0,l.createElement)(k.SnackbarList,{notices:i,className:"edit-widgets-notices__snackbar",onRemove:e}))};function zt(e){let{blockEditorSettings:t}=e;const r=(0,d.useSelect)((e=>!!e(p.store).get("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)(Gt,null),(0,l.createElement)(ce.BlockTools,null,(0,l.createElement)(ot,null),(0,l.createElement)(ce.__unstableEditorStyles,{styles:n}),(0,l.createElement)(ce.BlockSelectionClearer,null,(0,l.createElement)(ce.WritingFlow,null,(0,l.createElement)(ce.ObserveTyping,null,(0,l.createElement)(ce.BlockList,{className:"edit-widgets-main-block-list"}))))))}var Ht=(0,l.createElement)(S.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(S.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 Ut=()=>{const e=(0,d.useSelect)((e=>{var t;const{getEntityRecord:r}=e(m.store),n=r(me,pe,"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(ce.store),o=t(je).__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,ae.useViewportMatch)("medium","<"),{rootClientId:t,insertionIndex:r}=Ut(),{setIsInserterOpened:n}=(0,d.useDispatch)(je),i=(0,l.useCallback)((()=>n(!1)),[n]),a=e?"div":k.VisuallyHidden,[o,s]=(0,ae.__experimentalUseDialog)({onClose:i,focusOnMount:null}),c=(0,l.useRef)();return(0,l.useEffect)((()=>{c.current.focusSearch()}),[]),(0,l.createElement)("div",E({ref:o},s,{className:"edit-widgets-layout__inserter-panel"}),(0,l.createElement)(a,{className:"edit-widgets-layout__inserter-panel-header"},(0,l.createElement)(k.Button,{icon:Ht,onClick:i,label:(0,f.__)("Close block inserter")})),(0,l.createElement)("div",{className:"edit-widgets-layout__inserter-panel-content"},(0,l.createElement)(ce.__experimentalLibrary,{showInserterHelpPanel:!0,shouldFocusBlock:e,rootClientId:t,__experimentalInsertionIndex:r,ref:c})))}function $t(){const{setIsListViewOpened:e}=(0,d.useDispatch)(je),t=(0,ae.useFocusOnMount)("firstElement"),r=(0,ae.useFocusReturn)(),n=(0,ae.useFocusReturn)();const i=`edit-widgets-editor__list-view-panel-label-${(0,ae.useInstanceId)($t)}`;return(0,l.createElement)("div",{"aria-labelledby":i,className:"edit-widgets-editor__list-view-panel",onKeyDown:function(t){t.keyCode!==St.ESCAPE||t.defaultPrevented||(t.preventDefault(),e(!1))}},(0,l.createElement)("div",{className:"edit-widgets-editor__list-view-panel-header",ref:r},(0,l.createElement)("strong",{id:i},(0,f.__)("List View")),(0,l.createElement)(k.Button,{icon:N,label:(0,f.__)("Close List View Sidebar"),onClick:()=>e(!1)})),(0,l.createElement)("div",{className:"edit-widgets-editor__list-view-panel-content",ref:(0,ae.useMergeRefs)([n,t])},(0,l.createElement)(ce.__experimentalListView,null)))}function Yt(){const{isInserterOpen:e,isListViewOpen:t}=(0,d.useSelect)((e=>{const{isInserterOpened:t,isListViewOpened:r}=e(je);return{isInserterOpen:t(),isListViewOpen:r()}}),[]);return e?(0,l.createElement)(jt,null):t?(0,l.createElement)($t,null):null}const Kt={header:(0,f.__)("Widgets top bar"),body:(0,f.__)("Widgets and blocks"),sidebar:(0,f.__)("Widgets settings"),footer:(0,f.__)("Widgets footer")};var qt=function(e){let{blockEditorSettings:t}=e;const r=(0,ae.useViewportMatch)("medium","<"),n=(0,ae.useViewportMatch)("huge",">="),{setIsInserterOpened:i,setIsListViewOpened:a,closeGeneralSidebar:o}=(0,d.useDispatch)(je),{hasBlockBreadCrumbsEnabled:s,hasSidebarEnabled:c,isInserterOpened:u,isListViewOpened:m,previousShortcut:g,nextShortcut:h}=(0,d.useSelect)((e=>({hasSidebarEnabled:!!e(U).getActiveComplementaryArea(je.name),isInserterOpened:!!e(je).isInserterOpened(),isListViewOpened:!!e(je).isListViewOpened(),hasBlockBreadCrumbsEnabled:!!e(p.store).get("core/edit-widgets","showBlockBreadcrumbs"),previousShortcut:e(it.store).getAllShortcutKeyCombinations("core/edit-widgets/previous-region"),nextShortcut:e(it.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?(0,f.__)("List View"):(0,f.__)("Block Library"),w=m||u;return(0,l.createElement)(oe,{labels:{...Kt,secondarySidebar:_},header:(0,l.createElement)(Ft,null),secondarySidebar:w&&(0,l.createElement)(Yt,null),sidebar:c&&(0,l.createElement)(ie.Slot,{scope:"core/edit-widgets"}),content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)(zt,{blockEditorSettings:t}),(0,l.createElement)(ce.BlockStyles.Slot,{scope:"core/block-inspector"})),footer:s&&!r&&(0,l.createElement)("div",{className:"edit-widgets-layout__footer"},(0,l.createElement)(ce.BlockBreadcrumb,{rootLabelText:(0,f.__)("Widgets")})),shortcuts:{previous:g,next:h}})};function Qt(){const e=(0,d.useSelect)((e=>{const{getEditedWidgetAreas:t}=e(je),r=t();return(null==r?void 0:r.length)>0}),[]);return(0,l.useEffect)((()=>{const t=t=>{if(e)return t.returnValue=(0,f.__)("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 Jt(){var e;const t=(0,d.useSelect)((e=>!!e(p.store).get("core/edit-widgets","welcomeGuide")),[]),{toggle:r}=(0,d.useDispatch)(p.store),n=(0,d.useSelect)((e=>e(je).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)(k.Guide,{className:"edit-widgets-welcome-guide",contentLabel:(0,f.__)("Welcome to block Widgets"),finishButtonText:(0,f.__)("Get started"),onFinish:()=>r("core/edit-widgets","welcomeGuide"),pages:[{image:(0,l.createElement)(Xt,{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,f.__)("Welcome to block Widgets")),i?(0,l.createElement)(l.Fragment,null,(0,l.createElement)("p",{className:"edit-widgets-welcome-guide__text"},(0,f.sprintf)((0,f._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 theyll 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 theyll look on your site.",a),a))):(0,l.createElement)(l.Fragment,null,(0,l.createElement)("p",{className:"edit-widgets-welcome-guide__text"},(0,f.__)("You can now add any block to your sites widget areas. Dont 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,f.__)("Want to stick with the old widgets?"))," ",(0,l.createElement)(k.ExternalLink,{href:(0,f.__)("https://wordpress.org/plugins/classic-widgets/")},(0,f.__)("Get the Classic Widgets plugin.")))))},{image:(0,l.createElement)(Xt,{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,f.__)("Make each block your own")),(0,l.createElement)("p",{className:"edit-widgets-welcome-guide__text"},(0,f.__)("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)(Xt,{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,f.__)("Get to know the block library")),(0,l.createElement)("p",{className:"edit-widgets-welcome-guide__text"},(0,l.createInterpolateElement)((0,f.__)("All of the blocks available to you live in the block library. Youll find it wherever you see the <InserterIconImage /> icon."),{InserterIconImage:(0,l.createElement)("img",{className:"edit-widgets-welcome-guide__inserter-icon",alt:(0,f.__)("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)(Xt,{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,f.__)("Learn how to use the block editor")),(0,l.createElement)("p",{className:"edit-widgets-welcome-guide__text"},(0,f.__)("New to the block editor? Want to learn more about using it? "),(0,l.createElement)(k.ExternalLink,{href:(0,f.__)("https://wordpress.org/support/article/wordpress-editor/")},(0,f.__)("Here's a detailed guide."))))}]})}function Xt(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 Zt=function(e){let{blockEditorSettings:t,onError:r}=e;const{createErrorNotice:n}=(0,d.useDispatch)(b.store);return(0,l.createElement)(rt,{onError:r},(0,l.createElement)(lt,{blockEditorSettings:t},(0,l.createElement)(qt,{blockEditorSettings:t}),(0,l.createElement)(ft,null),(0,l.createElement)(k.Popover.Slot,null),(0,l.createElement)(j.PluginArea,{onError:function(e){n((0,f.sprintf)((0,f.__)('The "%s" plugin has encountered an error and cannot be rendered.'),e))}}),(0,l.createElement)(Qt,null),(0,l.createElement)(Jt,null)))};const er=["core/more","core/freeform","core/template-part","core/block"];function tr(e,t){(0,l.unmountComponentAtNode)(e);const r=tr.bind(null,e,t);(0,l.render)((0,l.createElement)(Zt,{blockEditorSettings:t,onError:r}),e)}function rr(e,t){const r=document.getElementById(e),n=tr.bind(null,r,t),i=(0,u.__experimentalGetCoreBlocks)().filter((e=>!(er.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)(p.store).setDefaults("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),nr(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)(Zt,{blockEditorSettings:t,onError:n}),r)}const nr=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}();